From 39fb807b7555d1cf5ab57f9600de9af54ec4e087 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 19 Mar 2024 16:23:15 -0400 Subject: [PATCH] output property types --- packages/maker/src/api/defineOntology.ts | 21 +++++++++++++-------- packages/maker/src/api/overall.test.ts | 20 ++++++++++---------- packages/maker/src/cli/main.ts | 4 +--- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/packages/maker/src/api/defineOntology.ts b/packages/maker/src/api/defineOntology.ts index badfc9be7..8b0603c73 100644 --- a/packages/maker/src/api/defineOntology.ts +++ b/packages/maker/src/api/defineOntology.ts @@ -47,21 +47,21 @@ export async function defineOntology( throw e; } - return ontologyDefinition; + return convertToWireOntology(ontologyDefinition); } -export function dumpOntologyFullMetadata(): Gateway.OntologyFullMetadata { +function convertToWireOntology(ontology: Ontology) { return { ontology: { apiName: "IDK", description: "IDK", displayName: "IDK", - rid: "IDK", + rid: "ri.ontology.main.generated-object.foo", }, - ...ontologyDefinition, + ...ontology, sharedPropertyTypes: Object.fromEntries( Object.entries( - ontologyDefinition.sharedPropertyTypes, + ontology.sharedPropertyTypes, ) .map<[string, Gateway.SharedPropertyType]>(( [apiName, spt], @@ -69,12 +69,12 @@ export function dumpOntologyFullMetadata(): Gateway.OntologyFullMetadata { ), interfaceTypes: Object.fromEntries( Object.entries( - ontologyDefinition.interfaceTypes, + ontology.interfaceTypes, ) .map<[string, Gateway.InterfaceType]>( ([apiName, { displayName, description, properties }]) => { return [apiName, { - rid: "IDK", + rid: "ri.ontology.main.generated-object.foo", apiName, displayName: displayName ?? apiName, description, @@ -92,11 +92,16 @@ export function dumpOntologyFullMetadata(): Gateway.OntologyFullMetadata { ), }; } + +export function dumpOntologyFullMetadata(): Gateway.OntologyFullMetadata { + return convertToWireOntology(ontologyDefinition); +} + function convertSpt( { type, array, description, apiName, displayName }: SharedPropertyType, ): Gateway.SharedPropertyType { return { - rid: "IDK", + rid: "ri.ontology.main.generated-object.foo", apiName, displayName: displayName ?? apiName, description, diff --git a/packages/maker/src/api/overall.test.ts b/packages/maker/src/api/overall.test.ts index e09604894..386088905 100644 --- a/packages/maker/src/api/overall.test.ts +++ b/packages/maker/src/api/overall.test.ts @@ -75,10 +75,10 @@ describe("Ontology Defining", () => { }, "description": undefined, "displayName": "foo", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, "objectTypes": {}, @@ -86,7 +86,7 @@ describe("Ontology Defining", () => { "apiName": "IDK", "description": "IDK", "displayName": "IDK", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, "queryTypes": {}, "sharedPropertyTypes": { @@ -97,7 +97,7 @@ describe("Ontology Defining", () => { }, "description": undefined, "displayName": "foo", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, } @@ -118,7 +118,7 @@ describe("Ontology Defining", () => { "apiName": "IDK", "description": "IDK", "displayName": "IDK", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, "queryTypes": {}, "sharedPropertyTypes": { @@ -129,7 +129,7 @@ describe("Ontology Defining", () => { }, "description": undefined, "displayName": "foo", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, } @@ -200,10 +200,10 @@ describe("Ontology Defining", () => { }, "description": undefined, "displayName": "fooSpt", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, "objectTypes": {}, @@ -211,7 +211,7 @@ describe("Ontology Defining", () => { "apiName": "IDK", "description": "IDK", "displayName": "IDK", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, "queryTypes": {}, "sharedPropertyTypes": { @@ -222,7 +222,7 @@ describe("Ontology Defining", () => { }, "description": undefined, "displayName": "fooSpt", - "rid": "IDK", + "rid": "ri.ontology.main.generated-object.foo", }, }, } diff --git a/packages/maker/src/cli/main.ts b/packages/maker/src/cli/main.ts index 8beb604da..3967d07c5 100644 --- a/packages/maker/src/cli/main.ts +++ b/packages/maker/src/cli/main.ts @@ -104,9 +104,7 @@ async function loadOntologyViaTsNode(input: string) { tsNodeService.enabled(true); - const fullPath = join(process.cwd(), input); - - const q = await import(fullPath); + const q = await import(input); return q; }