@osdk/maker 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/js/index.cjs +62 -11
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +62 -12
- package/build/js/index.mjs.map +1 -1
- package/build/types/api/defineOntology.d.ts +17 -1
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/cli/main.d.ts.map +1 -1
- package/changelog/0.2.0/pr-137.v2.yml +5 -0
- package/package.json +1 -1
- /package/changelog/{@unreleased → 0.1.0}/pr-136.v2.yml +0 -0
package/build/js/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ function _interopNamespace(e) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
33
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
33
34
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
34
35
|
var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
|
|
35
36
|
|
|
@@ -51,7 +52,56 @@ async function defineOntology(ns, body) {
|
|
|
51
52
|
console.error("Unexpected error while processing the body of the ontology", e);
|
|
52
53
|
throw e;
|
|
53
54
|
}
|
|
54
|
-
return ontologyDefinition;
|
|
55
|
+
return convertToWireOntology(ontologyDefinition);
|
|
56
|
+
}
|
|
57
|
+
function convertToWireOntology(ontology) {
|
|
58
|
+
return {
|
|
59
|
+
ontology: {
|
|
60
|
+
apiName: "IDK",
|
|
61
|
+
description: "IDK",
|
|
62
|
+
displayName: "IDK",
|
|
63
|
+
rid: "ri.ontology.main.generated-object.foo"
|
|
64
|
+
},
|
|
65
|
+
...ontology,
|
|
66
|
+
sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),
|
|
67
|
+
interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, {
|
|
68
|
+
displayName,
|
|
69
|
+
description,
|
|
70
|
+
properties
|
|
71
|
+
}]) => {
|
|
72
|
+
return [apiName, {
|
|
73
|
+
rid: "ri.ontology.main.generated-object.foo",
|
|
74
|
+
apiName,
|
|
75
|
+
displayName: displayName ?? apiName,
|
|
76
|
+
description,
|
|
77
|
+
extendsInterfaces: [],
|
|
78
|
+
links: {},
|
|
79
|
+
properties: Object.fromEntries(Object.entries(properties).map(([apiName2, spt]) => [apiName2, convertSpt(spt)]))
|
|
80
|
+
}];
|
|
81
|
+
}))
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function convertSpt({
|
|
85
|
+
type,
|
|
86
|
+
array,
|
|
87
|
+
description,
|
|
88
|
+
apiName,
|
|
89
|
+
displayName
|
|
90
|
+
}) {
|
|
91
|
+
return {
|
|
92
|
+
rid: "ri.ontology.main.generated-object.foo",
|
|
93
|
+
apiName,
|
|
94
|
+
displayName: displayName ?? apiName,
|
|
95
|
+
description,
|
|
96
|
+
dataType: array ? {
|
|
97
|
+
type: "array",
|
|
98
|
+
subType: {
|
|
99
|
+
type
|
|
100
|
+
}
|
|
101
|
+
} : {
|
|
102
|
+
type
|
|
103
|
+
}
|
|
104
|
+
};
|
|
55
105
|
}
|
|
56
106
|
function defineSharedPropertyType(apiName, opts) {
|
|
57
107
|
!(ontologyDefinition.sharedPropertyTypes[apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Shared property type ${apiName} already exists`) : invariant2__default.default(false) : void 0;
|
|
@@ -97,32 +147,33 @@ function isSimpleType(v) {
|
|
|
97
147
|
|
|
98
148
|
// src/cli/main.ts
|
|
99
149
|
async function main(args = process.argv) {
|
|
100
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.
|
|
150
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.2.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
101
151
|
input: {
|
|
102
152
|
alias: "i",
|
|
103
153
|
describe: "Input file",
|
|
104
154
|
type: "string",
|
|
105
|
-
default: ".ontology/ontology.ts"
|
|
155
|
+
default: ".ontology/ontology.ts",
|
|
156
|
+
coerce: path__namespace.resolve
|
|
106
157
|
},
|
|
107
158
|
output: {
|
|
108
159
|
alias: "o",
|
|
109
160
|
describe: "Output file",
|
|
110
161
|
type: "string",
|
|
111
|
-
default: "ontology.json"
|
|
162
|
+
default: "ontology.json",
|
|
163
|
+
coerce: path__namespace.resolve
|
|
112
164
|
},
|
|
113
165
|
snapshotDir: {
|
|
114
166
|
alias: "s",
|
|
115
167
|
describe: "Snapshot directory",
|
|
116
168
|
type: "string",
|
|
117
|
-
default: "snapshots"
|
|
169
|
+
default: "snapshots",
|
|
170
|
+
coerce: path__namespace.resolve
|
|
118
171
|
}
|
|
119
172
|
}).parseAsync();
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
consola.consola.info(`
|
|
123
|
-
|
|
124
|
-
consola.consola.info(`Saving ontology to ${fullOutputPath}`);
|
|
125
|
-
fs__namespace.writeFile(fullOutputPath, JSON.stringify(ontology, null, 2));
|
|
173
|
+
consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
|
|
174
|
+
const ontology = await loadOntology(commandLineOpts.input);
|
|
175
|
+
consola.consola.info(`Saving ontology to ${commandLineOpts.output}`);
|
|
176
|
+
fs__namespace.writeFile(commandLineOpts.output, JSON.stringify(ontology, null, 2));
|
|
126
177
|
}
|
|
127
178
|
async function loadOntology(input) {
|
|
128
179
|
const q = await defineOntology("", async () => await import(input));
|
package/build/js/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/main.ts","../../src/api/defineInterface.ts","../../src/api/defineOntology.ts","../../src/api/defineSpt.ts","../../src/api/defineLink.ts","../../src/api/defineObject.ts"],"names":["invariant","apiName"],"mappings":";AAgBA,SAAS,eAAe;AACxB,YAAY,QAAQ;AACpB,SAAS,YAAY;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AA,MACN,SAAS;AAAA,IACX;AAAA,EACF,CAAC,EAAE,WAAW;AACd,QAAM,gBAAgB,KAAK,QAAQ,IAAI,GAAG,gBAAgB,KAAK;AAC/D,QAAM,iBAAiB,KAAK,QAAQ,IAAI,GAAG,gBAAgB,MAAM;AACjE,UAAQ,KAAK,yBAAyB,aAAa,EAAE;AACrD,QAAM,WAAW,MAAM,aAAa,aAAa;AACjD,UAAQ,KAAK,sBAAsB,cAAc,EAAE;AACnD,EAAG,aAAU,gBAAgB,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAChE;AAmCA,eAAe,aAAa,OAAO;AAQjC,QAAM,IAAI,MAAM,eAAe,IAAI,YAAY,MAAM,OAAO,MAAM;AAClE,SAAO;AACT","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineInterface } from \"../api/defineInterface.js\";\nimport { defineLink } from \"../api/defineLink.js\";\nimport { defineObject } from \"../api/defineObject.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { defineSharedPropertyType } from \"../api/defineSpt.js\";\nexport default async function main(args = process.argv) {\n const commandLineOpts = await yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\"\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\"\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\"\n }\n }).parseAsync();\n const fullInputPath = join(process.cwd(), commandLineOpts.input);\n const fullOutputPath = join(process.cwd(), commandLineOpts.output);\n consola.info(`Loading ontology from ${fullInputPath}`);\n const ontology = await loadOntology(fullInputPath);\n consola.info(`Saving ontology to ${fullOutputPath}`);\n fs.writeFile(fullOutputPath, JSON.stringify(ontology, null, 2));\n}\nasync function loadOntologyViaJiti(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const jiti_ = await import(\"jiti\");\n const jiti = jiti_.default(process.cwd(), {\n debug: true\n });\n return defineOntology(\"\", async () => await jiti(input));\n}\nasync function loadOntologyViaTsNode(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const tsNode = await import(\"ts-node\");\n const tsNodeService = tsNode.register({\n transpileOnly: true,\n compilerOptions: {\n module: \"commonjs\",\n target: \"esnext\"\n },\n esm: true\n });\n tsNodeService.enabled(true);\n const fullPath = join(process.cwd(), input);\n const q = await import(fullPath);\n return q;\n}\nasync function loadOntology(input) {\n // Object.assign(globalThis, {\n // defineInterface,\n // defineLink,\n // defineObject,\n // defineSharedPropertyType,\n // });\n\n const q = await defineOntology(\"\", async () => await import(input));\n return q;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(apiName, opts) {\n !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Interface ${apiName} already exists`) : invariant(false) : void 0;\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n !isSimpleType(type) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`) : invariant(false) : void 0;\n // switch (v) {\n // case \"boolean\":\n // case \"byte\":\n // case \"date\":\n // case \"float\":\n // case \"geopoint\":\n // case \"geoshape\":\n // case \"integer\":\n // case \"decimal\":\n // case \"double\":\n // case \"long\":\n // case \"short\":\n // case \"string\":\n // case \"timestamp\":\n // return [\n // k,\n // {\n // rid: \"idk\",\n // apiName: k,\n // displayName: k,\n // dataType: {\n // type: v,\n // },\n // } satisfies SharedPropertyType,\n // ];\n // }\n\n const spt = defineSharedPropertyType(apiName, {\n displayName: apiName,\n type,\n array: false\n });\n return [apiName, spt];\n } else {\n !(apiName === type.apiName) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `property key and it's apiName must be identical. ${JSON.stringify({\n key: apiName,\n apiName: type.apiName\n })}`) : invariant(false) : void 0;\n return [apiName, type];\n }\n }));\n return ontologyDefinition.interfaceTypes[apiName] = {\n apiName,\n displayName: opts.displayName ?? apiName,\n extendsInterfaces: [],\n links: {},\n properties,\n rid: \"\",\n description: opts.description ?? opts.displayName ?? apiName\n };\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\" || v === \"date\" || v === \"decimal\" || v === \"double\" || v === \"float\" || v === \"geopoint\" || v === \"geoshape\" || v === \"integer\" || v === \"long\" || v === \"marking\" || v === \"short\" || v === \"string\" || v === \"timestamp\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @internal */\nexport let ontologyDefinition;\n\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n queryTypes: {},\n sharedPropertyTypes: {}\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return ontologyDefinition;\n}\nexport function dumpOntologyFullMetadata() {\n return {\n ontology: {\n apiName: \"IDK\",\n description: \"IDK\",\n displayName: \"IDK\",\n rid: \"IDK\"\n },\n ...ontologyDefinition,\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontologyDefinition.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),\n interfaceTypes: Object.fromEntries(Object.entries(ontologyDefinition.interfaceTypes).map(([apiName, {\n displayName,\n description,\n properties\n }]) => {\n return [apiName, {\n rid: \"IDK\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n extendsInterfaces: [],\n links: {},\n properties: Object.fromEntries(Object.entries(properties).map(([apiName, spt]) => [apiName, convertSpt(spt)]))\n }];\n }))\n };\n}\nfunction convertSpt({\n type,\n array,\n description,\n apiName,\n displayName\n}) {\n return {\n rid: \"IDK\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n dataType: array ? {\n type: \"array\",\n subType: {\n type\n }\n } : {\n type\n }\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineSharedPropertyType(apiName, opts) {\n !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Shared property type ${apiName} already exists`) : invariant(false) : void 0;\n return ontologyDefinition.sharedPropertyTypes[apiName] = {\n apiName,\n ...opts\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function defineLink(from, opts) {\n const apiName = opts.one ?? opts.many;\n const toApiName = opts.reverse.one ?? opts.reverse.many;\n const to = opts.to;\n !(from.linkTypes[apiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`) : invariant(false) : void 0;\n !(from.linkTypes[toApiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`) : invariant(false) : void 0;\n from.linkTypes[apiName] = {\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: to.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n to.linkTypes[toApiName] = {\n apiName: toApiName,\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: from.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineObject(apiName, opts) {\n ontologyDefinition.objectTypes[apiName] = {\n implementsInterfaces: [],\n linkTypes: [],\n objectType: {\n apiName,\n primaryKey: opts.primaryKey.apiName,\n properties: {\n [opts.primaryKey.apiName]: {\n dataType: convertType(opts.primaryKey)\n }\n },\n rid: \"PLACEHOLDER\",\n status: \"ACTIVE\",\n titleProperty: opts.primaryKey.apiName\n },\n sharedPropertyTypeMapping: {}\n };\n\n // FIXME: dont return the raw value\n return {\n data: ontologyDefinition.objectTypes[apiName],\n linkTypes: {}\n };\n}\nfunction convertType(t) {\n switch (true) {\n case t.multiplicity === true:\n return {\n type: \"array\",\n subType: convertType({\n ...t,\n multiplicity: false\n })\n };\n case t.type === \"stringTimeseries\":\n return {\n itemType: {\n type: \"string\"\n },\n type: \"timeseries\"\n };\n break;\n case t.type === \"numericTimeseries\":\n return {\n itemType: {\n type: \"double\"\n },\n type: \"timeseries\"\n };\n case t.type === \"datetime\":\n return {\n type: \"timestamp\"\n };\n default:\n return {\n type: t.type\n };\n }\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/main.ts","../../src/api/defineInterface.ts","../../src/api/defineOntology.ts","../../src/api/defineSpt.ts","../../src/api/defineLink.ts","../../src/api/define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A,IACf;AAAA,EACF,CAAC,EAAE,WAAW;AACd,UAAQ,KAAK,yBAAyB,gBAAgB,KAAK,EAAE;AAC7D,QAAM,WAAW,MAAM,aAAa,gBAAgB,KAAK;AACzD,UAAQ,KAAK,sBAAsB,gBAAgB,MAAM,EAAE;AAC3D,EAAG,aAAU,gBAAgB,QAAQ,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AACxE;AAkCA,eAAe,aAAa,OAAO;AAQjC,QAAM,IAAI,MAAM,eAAe,IAAI,YAAY,MAAM,OAAO,MAAM;AAClE,SAAO;AACT","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineInterface } from \"../api/defineInterface.js\";\nimport { defineLink } from \"../api/defineLink.js\";\nimport { defineObject } from \"../api/defineObject.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { defineSharedPropertyType } from \"../api/defineSpt.js\";\nexport default async function main(args = process.argv) {\n const commandLineOpts = await yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve\n }\n }).parseAsync();\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n const ontology = await loadOntology(commandLineOpts.input);\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n fs.writeFile(commandLineOpts.output, JSON.stringify(ontology, null, 2));\n}\nasync function loadOntologyViaJiti(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const jiti_ = await import(\"jiti\");\n const jiti = jiti_.default(process.cwd(), {\n debug: true\n });\n return defineOntology(\"\", async () => await jiti(input));\n}\nasync function loadOntologyViaTsNode(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const tsNode = await import(\"ts-node\");\n const tsNodeService = tsNode.register({\n transpileOnly: true,\n compilerOptions: {\n module: \"commonjs\",\n target: \"esnext\"\n },\n esm: true\n });\n tsNodeService.enabled(true);\n const q = await import(input);\n return q;\n}\nasync function loadOntology(input) {\n // Object.assign(globalThis, {\n // defineInterface,\n // defineLink,\n // defineObject,\n // defineSharedPropertyType,\n // });\n\n const q = await defineOntology(\"\", async () => await import(input));\n return q;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(apiName, opts) {\n !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Interface ${apiName} already exists`) : invariant(false) : void 0;\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n !isSimpleType(type) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`) : invariant(false) : void 0;\n // switch (v) {\n // case \"boolean\":\n // case \"byte\":\n // case \"date\":\n // case \"float\":\n // case \"geopoint\":\n // case \"geoshape\":\n // case \"integer\":\n // case \"decimal\":\n // case \"double\":\n // case \"long\":\n // case \"short\":\n // case \"string\":\n // case \"timestamp\":\n // return [\n // k,\n // {\n // rid: \"idk\",\n // apiName: k,\n // displayName: k,\n // dataType: {\n // type: v,\n // },\n // } satisfies SharedPropertyType,\n // ];\n // }\n\n const spt = defineSharedPropertyType(apiName, {\n displayName: apiName,\n type,\n array: false\n });\n return [apiName, spt];\n } else {\n !(apiName === type.apiName) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `property key and it's apiName must be identical. ${JSON.stringify({\n key: apiName,\n apiName: type.apiName\n })}`) : invariant(false) : void 0;\n return [apiName, type];\n }\n }));\n return ontologyDefinition.interfaceTypes[apiName] = {\n apiName,\n displayName: opts.displayName ?? apiName,\n extendsInterfaces: [],\n links: {},\n properties,\n rid: \"\",\n description: opts.description ?? opts.displayName ?? apiName\n };\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\" || v === \"date\" || v === \"decimal\" || v === \"double\" || v === \"float\" || v === \"geopoint\" || v === \"geoshape\" || v === \"integer\" || v === \"long\" || v === \"marking\" || v === \"short\" || v === \"string\" || v === \"timestamp\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @internal */\nexport let ontologyDefinition;\n\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n queryTypes: {},\n sharedPropertyTypes: {}\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return convertToWireOntology(ontologyDefinition);\n}\nfunction convertToWireOntology(ontology) {\n return {\n ontology: {\n apiName: \"IDK\",\n description: \"IDK\",\n displayName: \"IDK\",\n rid: \"ri.ontology.main.generated-object.foo\"\n },\n ...ontology,\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, {\n displayName,\n description,\n properties\n }]) => {\n return [apiName, {\n rid: \"ri.ontology.main.generated-object.foo\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n extendsInterfaces: [],\n links: {},\n properties: Object.fromEntries(Object.entries(properties).map(([apiName, spt]) => [apiName, convertSpt(spt)]))\n }];\n }))\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntology(ontologyDefinition);\n}\nfunction convertSpt({\n type,\n array,\n description,\n apiName,\n displayName\n}) {\n return {\n rid: \"ri.ontology.main.generated-object.foo\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n dataType: array ? {\n type: \"array\",\n subType: {\n type\n }\n } : {\n type\n }\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineSharedPropertyType(apiName, opts) {\n !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Shared property type ${apiName} already exists`) : invariant(false) : void 0;\n return ontologyDefinition.sharedPropertyTypes[apiName] = {\n apiName,\n ...opts\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function defineLink(from, opts) {\n const apiName = opts.one ?? opts.many;\n const toApiName = opts.reverse.one ?? opts.reverse.many;\n const to = opts.to;\n !(from.linkTypes[apiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`) : invariant(false) : void 0;\n !(from.linkTypes[toApiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`) : invariant(false) : void 0;\n from.linkTypes[apiName] = {\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: to.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n to.linkTypes[toApiName] = {\n apiName: toApiName,\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: from.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineObject(apiName, opts) {\n ontologyDefinition.objectTypes[apiName] = {\n implementsInterfaces: [],\n linkTypes: [],\n objectType: {\n apiName,\n primaryKey: opts.primaryKey.apiName,\n properties: {\n [opts.primaryKey.apiName]: {\n dataType: convertType(opts.primaryKey)\n }\n },\n rid: \"PLACEHOLDER\",\n status: \"ACTIVE\",\n titleProperty: opts.primaryKey.apiName\n },\n sharedPropertyTypeMapping: {}\n };\n\n // FIXME: dont return the raw value\n return {\n data: ontologyDefinition.objectTypes[apiName],\n linkTypes: {}\n };\n}\nfunction convertType(t) {\n switch (true) {\n case t.multiplicity === true:\n return {\n type: \"array\",\n subType: convertType({\n ...t,\n multiplicity: false\n })\n };\n case t.type === \"stringTimeseries\":\n return {\n itemType: {\n type: \"string\"\n },\n type: \"timeseries\"\n };\n break;\n case t.type === \"numericTimeseries\":\n return {\n itemType: {\n type: \"double\"\n },\n type: \"timeseries\"\n };\n case t.type === \"datetime\":\n return {\n type: \"timestamp\"\n };\n default:\n return {\n type: t.type\n };\n }\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n}"]}
|
package/build/js/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { consola } from 'consola';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
|
-
import
|
|
3
|
+
import * as path from 'path';
|
|
4
4
|
import yargs from 'yargs';
|
|
5
5
|
import { hideBin } from 'yargs/helpers';
|
|
6
6
|
import invariant2 from 'tiny-invariant';
|
|
@@ -23,7 +23,56 @@ async function defineOntology(ns, body) {
|
|
|
23
23
|
console.error("Unexpected error while processing the body of the ontology", e);
|
|
24
24
|
throw e;
|
|
25
25
|
}
|
|
26
|
-
return ontologyDefinition;
|
|
26
|
+
return convertToWireOntology(ontologyDefinition);
|
|
27
|
+
}
|
|
28
|
+
function convertToWireOntology(ontology) {
|
|
29
|
+
return {
|
|
30
|
+
ontology: {
|
|
31
|
+
apiName: "IDK",
|
|
32
|
+
description: "IDK",
|
|
33
|
+
displayName: "IDK",
|
|
34
|
+
rid: "ri.ontology.main.generated-object.foo"
|
|
35
|
+
},
|
|
36
|
+
...ontology,
|
|
37
|
+
sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),
|
|
38
|
+
interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, {
|
|
39
|
+
displayName,
|
|
40
|
+
description,
|
|
41
|
+
properties
|
|
42
|
+
}]) => {
|
|
43
|
+
return [apiName, {
|
|
44
|
+
rid: "ri.ontology.main.generated-object.foo",
|
|
45
|
+
apiName,
|
|
46
|
+
displayName: displayName ?? apiName,
|
|
47
|
+
description,
|
|
48
|
+
extendsInterfaces: [],
|
|
49
|
+
links: {},
|
|
50
|
+
properties: Object.fromEntries(Object.entries(properties).map(([apiName2, spt]) => [apiName2, convertSpt(spt)]))
|
|
51
|
+
}];
|
|
52
|
+
}))
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function convertSpt({
|
|
56
|
+
type,
|
|
57
|
+
array,
|
|
58
|
+
description,
|
|
59
|
+
apiName,
|
|
60
|
+
displayName
|
|
61
|
+
}) {
|
|
62
|
+
return {
|
|
63
|
+
rid: "ri.ontology.main.generated-object.foo",
|
|
64
|
+
apiName,
|
|
65
|
+
displayName: displayName ?? apiName,
|
|
66
|
+
description,
|
|
67
|
+
dataType: array ? {
|
|
68
|
+
type: "array",
|
|
69
|
+
subType: {
|
|
70
|
+
type
|
|
71
|
+
}
|
|
72
|
+
} : {
|
|
73
|
+
type
|
|
74
|
+
}
|
|
75
|
+
};
|
|
27
76
|
}
|
|
28
77
|
function defineSharedPropertyType(apiName, opts) {
|
|
29
78
|
!(ontologyDefinition.sharedPropertyTypes[apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant2(false, `Shared property type ${apiName} already exists`) : invariant2(false) : void 0;
|
|
@@ -69,32 +118,33 @@ function isSimpleType(v) {
|
|
|
69
118
|
|
|
70
119
|
// src/cli/main.ts
|
|
71
120
|
async function main(args = process.argv) {
|
|
72
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.
|
|
121
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.2.0").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
73
122
|
input: {
|
|
74
123
|
alias: "i",
|
|
75
124
|
describe: "Input file",
|
|
76
125
|
type: "string",
|
|
77
|
-
default: ".ontology/ontology.ts"
|
|
126
|
+
default: ".ontology/ontology.ts",
|
|
127
|
+
coerce: path.resolve
|
|
78
128
|
},
|
|
79
129
|
output: {
|
|
80
130
|
alias: "o",
|
|
81
131
|
describe: "Output file",
|
|
82
132
|
type: "string",
|
|
83
|
-
default: "ontology.json"
|
|
133
|
+
default: "ontology.json",
|
|
134
|
+
coerce: path.resolve
|
|
84
135
|
},
|
|
85
136
|
snapshotDir: {
|
|
86
137
|
alias: "s",
|
|
87
138
|
describe: "Snapshot directory",
|
|
88
139
|
type: "string",
|
|
89
|
-
default: "snapshots"
|
|
140
|
+
default: "snapshots",
|
|
141
|
+
coerce: path.resolve
|
|
90
142
|
}
|
|
91
143
|
}).parseAsync();
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
consola.info(`
|
|
95
|
-
|
|
96
|
-
consola.info(`Saving ontology to ${fullOutputPath}`);
|
|
97
|
-
fs.writeFile(fullOutputPath, JSON.stringify(ontology, null, 2));
|
|
144
|
+
consola.info(`Loading ontology from ${commandLineOpts.input}`);
|
|
145
|
+
const ontology = await loadOntology(commandLineOpts.input);
|
|
146
|
+
consola.info(`Saving ontology to ${commandLineOpts.output}`);
|
|
147
|
+
fs.writeFile(commandLineOpts.output, JSON.stringify(ontology, null, 2));
|
|
98
148
|
}
|
|
99
149
|
async function loadOntology(input) {
|
|
100
150
|
const q = await defineOntology("", async () => await import(input));
|
package/build/js/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/main.ts","../../src/api/defineInterface.ts","../../src/api/defineOntology.ts","../../src/api/defineSpt.ts","../../src/api/defineLink.ts","../../src/api/defineObject.ts"],"names":["invariant","apiName"],"mappings":";AAgBA,SAAS,eAAe;AACxB,YAAY,QAAQ;AACpB,SAAS,YAAY;AACrB,OAAO,WAAW;AAClB,SAAS,eAAe;;;ACJxB,OAAOA,gBAAe;;;ACCf,IAAI;AAGJ,IAAI;AACX,eAAsB,eAAe,IAAI,MAAM;AAC7C,cAAY;AACZ,uBAAqB;AAAA,IACnB,aAAa,CAAC;AAAA,IACd,gBAAgB,CAAC;AAAA,IACjB,aAAa,CAAC;AAAA,IACd,YAAY,CAAC;AAAA,IACb,qBAAqB,CAAC;AAAA,EACxB;AACA,MAAI;AACF,UAAM,KAAK;AAAA,EACb,SAAS,GAAG;AAEV,YAAQ,MAAM,8DAA8D,CAAC;AAC7E,UAAM;AAAA,EACR;AACA,SAAO;AACT;;;ACtBA,OAAO,eAAe;AAEf,SAAS,yBAAyB,SAAS,MAAM;AACtD,IAAE,mBAAmB,oBAAoB,OAAO,MAAM,UAAa,QAAQ,IAAI,aAAa,eAAe,UAAU,OAAO,wBAAwB,OAAO,iBAAiB,IAAI,UAAU,KAAK,IAAI;AACnM,SAAO,mBAAmB,oBAAoB,OAAO,IAAI;AAAA,IACvD;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AFLO,SAAS,gBA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YAAY,MAAM;AACzP;;;AG7DA,OAAOD,gBAAe;;;ACAtB,OAAOA,gBAAe;;;ALUtB,eAAO,KAA4B,OAAO,QAAQ,MAAM;AACtD,QAAM,kBAAkB,MAAM,MAAM,QAAQ,IAAI,CAAC,EAAE,QAAQ,OAAiC,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;AAAA,IACjK,OAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF,CAAC,EAAE,WAAW;AACd,QAAM,gBAAgB,KAAK,QAAQ,IAAI,GAAG,gBAAgB,KAAK;AAC/D,QAAM,iBAAiB,KAAK,QAAQ,IAAI,GAAG,gBAAgB,MAAM;AACjE,UAAQ,KAAK,yBAAyB,aAAa,EAAE;AACrD,QAAM,WAAW,MAAM,aAAa,aAAa;AACjD,UAAQ,KAAK,sBAAsB,cAAc,EAAE;AACnD,EAAG,aAAU,gBAAgB,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAChE;AAmCA,eAAe,aAAa,OAAO;AAQjC,QAAM,IAAI,MAAM,eAAe,IAAI,YAAY,MAAM,OAAO,MAAM;AAClE,SAAO;AACT","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineInterface } from \"../api/defineInterface.js\";\nimport { defineLink } from \"../api/defineLink.js\";\nimport { defineObject } from \"../api/defineObject.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { defineSharedPropertyType } from \"../api/defineSpt.js\";\nexport default async function main(args = process.argv) {\n const commandLineOpts = await yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\"\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\"\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\"\n }\n }).parseAsync();\n const fullInputPath = join(process.cwd(), commandLineOpts.input);\n const fullOutputPath = join(process.cwd(), commandLineOpts.output);\n consola.info(`Loading ontology from ${fullInputPath}`);\n const ontology = await loadOntology(fullInputPath);\n consola.info(`Saving ontology to ${fullOutputPath}`);\n fs.writeFile(fullOutputPath, JSON.stringify(ontology, null, 2));\n}\nasync function loadOntologyViaJiti(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const jiti_ = await import(\"jiti\");\n const jiti = jiti_.default(process.cwd(), {\n debug: true\n });\n return defineOntology(\"\", async () => await jiti(input));\n}\nasync function loadOntologyViaTsNode(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const tsNode = await import(\"ts-node\");\n const tsNodeService = tsNode.register({\n transpileOnly: true,\n compilerOptions: {\n module: \"commonjs\",\n target: \"esnext\"\n },\n esm: true\n });\n tsNodeService.enabled(true);\n const fullPath = join(process.cwd(), input);\n const q = await import(fullPath);\n return q;\n}\nasync function loadOntology(input) {\n // Object.assign(globalThis, {\n // defineInterface,\n // defineLink,\n // defineObject,\n // defineSharedPropertyType,\n // });\n\n const q = await defineOntology(\"\", async () => await import(input));\n return q;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(apiName, opts) {\n !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Interface ${apiName} already exists`) : invariant(false) : void 0;\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n !isSimpleType(type) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`) : invariant(false) : void 0;\n // switch (v) {\n // case \"boolean\":\n // case \"byte\":\n // case \"date\":\n // case \"float\":\n // case \"geopoint\":\n // case \"geoshape\":\n // case \"integer\":\n // case \"decimal\":\n // case \"double\":\n // case \"long\":\n // case \"short\":\n // case \"string\":\n // case \"timestamp\":\n // return [\n // k,\n // {\n // rid: \"idk\",\n // apiName: k,\n // displayName: k,\n // dataType: {\n // type: v,\n // },\n // } satisfies SharedPropertyType,\n // ];\n // }\n\n const spt = defineSharedPropertyType(apiName, {\n displayName: apiName,\n type,\n array: false\n });\n return [apiName, spt];\n } else {\n !(apiName === type.apiName) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `property key and it's apiName must be identical. ${JSON.stringify({\n key: apiName,\n apiName: type.apiName\n })}`) : invariant(false) : void 0;\n return [apiName, type];\n }\n }));\n return ontologyDefinition.interfaceTypes[apiName] = {\n apiName,\n displayName: opts.displayName ?? apiName,\n extendsInterfaces: [],\n links: {},\n properties,\n rid: \"\",\n description: opts.description ?? opts.displayName ?? apiName\n };\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\" || v === \"date\" || v === \"decimal\" || v === \"double\" || v === \"float\" || v === \"geopoint\" || v === \"geoshape\" || v === \"integer\" || v === \"long\" || v === \"marking\" || v === \"short\" || v === \"string\" || v === \"timestamp\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @internal */\nexport let ontologyDefinition;\n\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n queryTypes: {},\n sharedPropertyTypes: {}\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return ontologyDefinition;\n}\nexport function dumpOntologyFullMetadata() {\n return {\n ontology: {\n apiName: \"IDK\",\n description: \"IDK\",\n displayName: \"IDK\",\n rid: \"IDK\"\n },\n ...ontologyDefinition,\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontologyDefinition.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),\n interfaceTypes: Object.fromEntries(Object.entries(ontologyDefinition.interfaceTypes).map(([apiName, {\n displayName,\n description,\n properties\n }]) => {\n return [apiName, {\n rid: \"IDK\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n extendsInterfaces: [],\n links: {},\n properties: Object.fromEntries(Object.entries(properties).map(([apiName, spt]) => [apiName, convertSpt(spt)]))\n }];\n }))\n };\n}\nfunction convertSpt({\n type,\n array,\n description,\n apiName,\n displayName\n}) {\n return {\n rid: \"IDK\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n dataType: array ? {\n type: \"array\",\n subType: {\n type\n }\n } : {\n type\n }\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineSharedPropertyType(apiName, opts) {\n !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Shared property type ${apiName} already exists`) : invariant(false) : void 0;\n return ontologyDefinition.sharedPropertyTypes[apiName] = {\n apiName,\n ...opts\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function defineLink(from, opts) {\n const apiName = opts.one ?? opts.many;\n const toApiName = opts.reverse.one ?? opts.reverse.many;\n const to = opts.to;\n !(from.linkTypes[apiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`) : invariant(false) : void 0;\n !(from.linkTypes[toApiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`) : invariant(false) : void 0;\n from.linkTypes[apiName] = {\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: to.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n to.linkTypes[toApiName] = {\n apiName: toApiName,\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: from.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineObject(apiName, opts) {\n ontologyDefinition.objectTypes[apiName] = {\n implementsInterfaces: [],\n linkTypes: [],\n objectType: {\n apiName,\n primaryKey: opts.primaryKey.apiName,\n properties: {\n [opts.primaryKey.apiName]: {\n dataType: convertType(opts.primaryKey)\n }\n },\n rid: \"PLACEHOLDER\",\n status: \"ACTIVE\",\n titleProperty: opts.primaryKey.apiName\n },\n sharedPropertyTypeMapping: {}\n };\n\n // FIXME: dont return the raw value\n return {\n data: ontologyDefinition.objectTypes[apiName],\n linkTypes: {}\n };\n}\nfunction convertType(t) {\n switch (true) {\n case t.multiplicity === true:\n return {\n type: \"array\",\n subType: convertType({\n ...t,\n multiplicity: false\n })\n };\n case t.type === \"stringTimeseries\":\n return {\n itemType: {\n type: \"string\"\n },\n type: \"timeseries\"\n };\n break;\n case t.type === \"numericTimeseries\":\n return {\n itemType: {\n type: \"double\"\n },\n type: \"timeseries\"\n };\n case t.type === \"datetime\":\n return {\n type: \"timestamp\"\n };\n default:\n return {\n type: t.type\n };\n }\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/main.ts","../../src/api/defineInterface.ts","../../src/api/defineOntology.ts","../../src/api/defineSpt.ts","../../src/api/defineLink.ts","../../src/api/defineObject.ts"],"names":["invariant","apiName"],"mappings":";AAgBA,SAAS,eAAe;AACxB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,OAAO,WAAW;AAClB,SAAS,eAAe;;;ACJxB,OAAOA,gBAAe;;;ACCf,IAAI;AAGJ,IAAI;AACX,eAAsB,eAAe,IAAI,MAAM;AAC7C,cAAY;AACZ,uBAAqB;AAAA,IACnB,aAAa,CAAC;AAAA,IACd,gBAAgB,CAAC;AAAA,IACjB,aAAa,CAAC;AAAA,IACd,YAAY,CAAC;AAAA,IACb,qBAAqB,CAAC;AAAA,EACxB;AACA,MAAI;AACF,UAAM,KAAK;AAAA,EACb,SAAS,GAAG;AAEV,YAAQ,MAAM,8DAA8D,CAAC;AAC7E,UAAM;AAAA,EACR;AACA,SAAO,sBAAsB,kBAAkB;AACjD;AACA,SAAS,sBAAsB,UAAU;AACvC,SAAO;AAAA,IACL,UAAU;AAAA,MACR,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,MACb,KAAK;AAAA,IACP;AAAA,IACA,GAAG;AAAA,IACH,qBAAqB,OAAO,YAAY,OA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ALUtB,eAAO,KAA4B,OAAO,QAAQ,MAAM;AACtD,QAAM,kBAAkB,MAAM,MAAM,QAAQ,IAAI,CAAC,EAAE,QAAQ,OAAiC,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;AAAA,IACjK,OAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAa;AAAA,IACf;AAAA,IACA,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAa;AAAA,IACf;AAAA,IACA,aAAa;AAAA,MACX,OAAO;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAa;AAAA,IACf;AAAA,EACF,CAAC,EAAE,WAAW;AACd,UAAQ,KAAK,yBAAyB,gBAAgB,KAAK,EAAE;AAC7D,QAAM,WAAW,MAAM,aAAa,gBAAgB,KAAK;AACzD,UAAQ,KAAK,sBAAsB,gBAAgB,MAAM,EAAE;AAC3D,EAAG,aAAU,gBAAgB,QAAQ,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AACxE;AAkCA,eAAe,aAAa,OAAO;AAQjC,QAAM,IAAI,MAAM,eAAe,IAAI,YAAY,MAAM,OAAO,MAAM;AAClE,SAAO;AACT","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineInterface } from \"../api/defineInterface.js\";\nimport { defineLink } from \"../api/defineLink.js\";\nimport { defineObject } from \"../api/defineObject.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { defineSharedPropertyType } from \"../api/defineSpt.js\";\nexport default async function main(args = process.argv) {\n const commandLineOpts = await yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve\n }\n }).parseAsync();\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n const ontology = await loadOntology(commandLineOpts.input);\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n fs.writeFile(commandLineOpts.output, JSON.stringify(ontology, null, 2));\n}\nasync function loadOntologyViaJiti(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const jiti_ = await import(\"jiti\");\n const jiti = jiti_.default(process.cwd(), {\n debug: true\n });\n return defineOntology(\"\", async () => await jiti(input));\n}\nasync function loadOntologyViaTsNode(input) {\n Object.assign(globalThis, {\n defineInterface,\n defineLink,\n defineObject,\n defineSharedPropertyType\n });\n const tsNode = await import(\"ts-node\");\n const tsNodeService = tsNode.register({\n transpileOnly: true,\n compilerOptions: {\n module: \"commonjs\",\n target: \"esnext\"\n },\n esm: true\n });\n tsNodeService.enabled(true);\n const q = await import(input);\n return q;\n}\nasync function loadOntology(input) {\n // Object.assign(globalThis, {\n // defineInterface,\n // defineLink,\n // defineObject,\n // defineSharedPropertyType,\n // });\n\n const q = await defineOntology(\"\", async () => await import(input));\n return q;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(apiName, opts) {\n !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Interface ${apiName} already exists`) : invariant(false) : void 0;\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n !isSimpleType(type) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`) : invariant(false) : void 0;\n // switch (v) {\n // case \"boolean\":\n // case \"byte\":\n // case \"date\":\n // case \"float\":\n // case \"geopoint\":\n // case \"geoshape\":\n // case \"integer\":\n // case \"decimal\":\n // case \"double\":\n // case \"long\":\n // case \"short\":\n // case \"string\":\n // case \"timestamp\":\n // return [\n // k,\n // {\n // rid: \"idk\",\n // apiName: k,\n // displayName: k,\n // dataType: {\n // type: v,\n // },\n // } satisfies SharedPropertyType,\n // ];\n // }\n\n const spt = defineSharedPropertyType(apiName, {\n displayName: apiName,\n type,\n array: false\n });\n return [apiName, spt];\n } else {\n !(apiName === type.apiName) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `property key and it's apiName must be identical. ${JSON.stringify({\n key: apiName,\n apiName: type.apiName\n })}`) : invariant(false) : void 0;\n return [apiName, type];\n }\n }));\n return ontologyDefinition.interfaceTypes[apiName] = {\n apiName,\n displayName: opts.displayName ?? apiName,\n extendsInterfaces: [],\n links: {},\n properties,\n rid: \"\",\n description: opts.description ?? opts.displayName ?? apiName\n };\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\" || v === \"date\" || v === \"decimal\" || v === \"double\" || v === \"float\" || v === \"geopoint\" || v === \"geoshape\" || v === \"integer\" || v === \"long\" || v === \"marking\" || v === \"short\" || v === \"string\" || v === \"timestamp\";\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @internal */\nexport let ontologyDefinition;\n\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n queryTypes: {},\n sharedPropertyTypes: {}\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return convertToWireOntology(ontologyDefinition);\n}\nfunction convertToWireOntology(ontology) {\n return {\n ontology: {\n apiName: \"IDK\",\n description: \"IDK\",\n displayName: \"IDK\",\n rid: \"ri.ontology.main.generated-object.foo\"\n },\n ...ontology,\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, convertSpt(spt)])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, {\n displayName,\n description,\n properties\n }]) => {\n return [apiName, {\n rid: \"ri.ontology.main.generated-object.foo\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n extendsInterfaces: [],\n links: {},\n properties: Object.fromEntries(Object.entries(properties).map(([apiName, spt]) => [apiName, convertSpt(spt)]))\n }];\n }))\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntology(ontologyDefinition);\n}\nfunction convertSpt({\n type,\n array,\n description,\n apiName,\n displayName\n}) {\n return {\n rid: \"ri.ontology.main.generated-object.foo\",\n apiName,\n displayName: displayName ?? apiName,\n description,\n dataType: array ? {\n type: \"array\",\n subType: {\n type\n }\n } : {\n type\n }\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineSharedPropertyType(apiName, opts) {\n !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Shared property type ${apiName} already exists`) : invariant(false) : void 0;\n return ontologyDefinition.sharedPropertyTypes[apiName] = {\n apiName,\n ...opts\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nexport function defineLink(from, opts) {\n const apiName = opts.one ?? opts.many;\n const toApiName = opts.reverse.one ?? opts.reverse.many;\n const to = opts.to;\n !(from.linkTypes[apiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`) : invariant(false) : void 0;\n !(from.linkTypes[toApiName] == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`) : invariant(false) : void 0;\n from.linkTypes[apiName] = {\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: to.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n to.linkTypes[toApiName] = {\n apiName: toApiName,\n cardinality: \"ONE\",\n displayName: apiName,\n objectTypeApiName: from.data.objectType.apiName,\n status: \"ACTIVE\"\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineObject(apiName, opts) {\n ontologyDefinition.objectTypes[apiName] = {\n implementsInterfaces: [],\n linkTypes: [],\n objectType: {\n apiName,\n primaryKey: opts.primaryKey.apiName,\n properties: {\n [opts.primaryKey.apiName]: {\n dataType: convertType(opts.primaryKey)\n }\n },\n rid: \"PLACEHOLDER\",\n status: \"ACTIVE\",\n titleProperty: opts.primaryKey.apiName\n },\n sharedPropertyTypeMapping: {}\n };\n\n // FIXME: dont return the raw value\n return {\n data: ontologyDefinition.objectTypes[apiName],\n linkTypes: {}\n };\n}\nfunction convertType(t) {\n switch (true) {\n case t.multiplicity === true:\n return {\n type: \"array\",\n subType: convertType({\n ...t,\n multiplicity: false\n })\n };\n case t.type === \"stringTimeseries\":\n return {\n itemType: {\n type: \"string\"\n },\n type: \"timeseries\"\n };\n break;\n case t.type === \"numericTimeseries\":\n return {\n itemType: {\n type: \"double\"\n },\n type: \"timeseries\"\n };\n case t.type === \"datetime\":\n return {\n type: \"timestamp\"\n };\n default:\n return {\n type: t.type\n };\n }\n !false ? process.env.NODE_ENV !== \"production\" ? invariant(false) : invariant(false) : void 0;\n}"]}
|
|
@@ -4,6 +4,22 @@ import type { Ontology } from "./types.js";
|
|
|
4
4
|
export declare let ontologyDefinition: Ontology;
|
|
5
5
|
/** @internal */
|
|
6
6
|
export declare let namespace: string;
|
|
7
|
-
export declare function defineOntology(ns: string, body: () => void | Promise<void>): Promise<
|
|
7
|
+
export declare function defineOntology(ns: string, body: () => void | Promise<void>): Promise<{
|
|
8
|
+
sharedPropertyTypes: {
|
|
9
|
+
[k: string]: Gateway.SharedPropertyType;
|
|
10
|
+
};
|
|
11
|
+
interfaceTypes: {
|
|
12
|
+
[k: string]: Gateway.InterfaceType;
|
|
13
|
+
};
|
|
14
|
+
objectTypes: Record<string, Gateway.ObjectTypeFullMetadata>;
|
|
15
|
+
actionTypes: Record<string, Gateway.ActionTypeV2>;
|
|
16
|
+
queryTypes: Record<string, Gateway.QueryTypeV2>;
|
|
17
|
+
ontology: {
|
|
18
|
+
apiName: string;
|
|
19
|
+
description: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
rid: string;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
8
24
|
export declare function dumpOntologyFullMetadata(): Gateway.OntologyFullMetadata;
|
|
9
25
|
//# sourceMappingURL=defineOntology.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineOntology.d.ts","sourceRoot":"","sources":["../../../src/api/defineOntology.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,OAAO,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAE/D,gBAAgB;AAChB,eAAO,IAAI,kBAAkB,EAAE,QAAQ,CAAC;AAExC,gBAAgB;AAChB,eAAO,IAAI,SAAS,EAAE,MAAM,CAAC;AAE7B,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC
|
|
1
|
+
{"version":3,"file":"defineOntology.d.ts","sourceRoot":"","sources":["../../../src/api/defineOntology.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,OAAO,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAE/D,gBAAgB;AAChB,eAAO,IAAI,kBAAkB,EAAE,QAAQ,CAAC;AAExC,gBAAgB;AAChB,eAAO,IAAI,SAAS,EAAE,MAAM,CAAC;AAE7B,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;GAuBjC;AA6CD,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,oBAAoB,CAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/cli/main.ts"],"names":[],"mappings":"AA2BA,wBAA8B,IAAI,CAAC,IAAI,GAAE,MAAM,EAAiB,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/cli/main.ts"],"names":[],"mappings":"AA2BA,wBAA8B,IAAI,CAAC,IAAI,GAAE,MAAM,EAAiB,iBAwC/D"}
|
package/package.json
CHANGED
|
File without changes
|