@osdk/maker 0.8.0-beta.8 → 0.8.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/CHANGELOG.md +99 -0
- package/build/browser/api/defineInterface.d.ts +14 -0
- package/build/browser/api/defineInterface.d.ts.map +1 -0
- package/build/browser/api/defineInterface.js +67 -0
- package/build/browser/api/defineInterface.js.map +1 -0
- package/build/browser/api/defineInterfaceLinkConstraint.d.ts +21 -0
- package/build/browser/api/defineInterfaceLinkConstraint.d.ts.map +1 -0
- package/build/browser/api/defineInterfaceLinkConstraint.js +50 -0
- package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -0
- package/build/browser/api/defineLink.d.ts +18 -0
- package/build/browser/api/defineLink.d.ts.map +1 -0
- package/build/browser/api/defineLink.js +37 -0
- package/build/browser/api/defineLink.js.map +1 -0
- package/build/browser/api/defineObject.d.ts +15 -0
- package/build/browser/api/defineObject.d.ts.map +1 -0
- package/build/browser/api/defineObject.js +86 -0
- package/build/browser/api/defineObject.js.map +1 -0
- package/build/browser/api/defineOntology.d.ts +10 -0
- package/build/browser/api/defineOntology.d.ts.map +1 -0
- package/build/browser/api/defineOntology.js +174 -0
- package/build/browser/api/defineOntology.js.map +1 -0
- package/build/browser/api/defineSpt.d.ts +13 -0
- package/build/browser/api/defineSpt.d.ts.map +1 -0
- package/build/browser/api/defineSpt.js +36 -0
- package/build/browser/api/defineSpt.js.map +1 -0
- package/build/browser/api/defineValueType.d.ts +26 -0
- package/build/browser/api/defineValueType.d.ts.map +1 -0
- package/build/browser/api/defineValueType.js +61 -0
- package/build/browser/api/defineValueType.js.map +1 -0
- package/build/browser/api/iconNames.d.ts +3 -0
- package/build/browser/api/iconNames.d.ts.map +1 -0
- package/build/browser/api/iconNames.js +17 -0
- package/build/browser/api/iconNames.js.map +1 -0
- package/build/browser/api/overall.test.d.ts +2 -0
- package/build/browser/api/overall.test.d.ts.map +1 -0
- package/build/browser/api/overall.test.js +617 -0
- package/build/browser/api/overall.test.js.map +1 -0
- package/build/browser/api/types.d.ts +38 -0
- package/build/browser/api/types.d.ts.map +1 -0
- package/build/browser/api/types.js +17 -0
- package/build/browser/api/types.js.map +1 -0
- package/build/browser/cli/main.d.ts +2 -0
- package/build/browser/cli/main.d.ts.map +1 -0
- package/build/browser/cli/main.js +121 -0
- package/build/browser/cli/main.js.map +1 -0
- package/build/browser/index.d.ts +6 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +20 -280
- package/build/browser/index.js.map +1 -1
- package/build/esm/api/defineInterface.d.ts +1 -0
- package/build/esm/api/defineInterface.d.ts.map +1 -1
- package/build/esm/api/defineInterface.js +67 -0
- package/build/esm/api/defineInterface.js.map +1 -0
- package/build/esm/api/defineInterfaceLinkConstraint.js +50 -0
- package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -0
- package/build/esm/api/defineLink.js +37 -0
- package/build/esm/api/defineLink.js.map +1 -0
- package/build/esm/api/defineObject.d.ts +2 -2
- package/build/esm/api/defineObject.d.ts.map +1 -1
- package/build/esm/api/defineObject.js +86 -0
- package/build/esm/api/defineObject.js.map +1 -0
- package/build/esm/api/defineOntology.d.ts +8 -2
- package/build/esm/api/defineOntology.d.ts.map +1 -1
- package/build/esm/api/defineOntology.js +174 -0
- package/build/esm/api/defineOntology.js.map +1 -0
- package/build/esm/api/defineSpt.d.ts +2 -1
- package/build/esm/api/defineSpt.d.ts.map +1 -1
- package/build/esm/api/defineSpt.js +36 -0
- package/build/esm/api/defineSpt.js.map +1 -0
- package/build/esm/api/defineValueType.d.ts +26 -0
- package/build/esm/api/defineValueType.d.ts.map +1 -0
- package/build/esm/api/defineValueType.js +61 -0
- package/build/esm/api/defineValueType.js.map +1 -0
- package/build/esm/api/iconNames.js +17 -0
- package/build/esm/api/iconNames.js.map +1 -0
- package/build/esm/api/overall.test.js +617 -0
- package/build/esm/api/overall.test.js.map +1 -0
- package/build/esm/api/types.d.ts +12 -1
- package/build/esm/api/types.d.ts.map +1 -1
- package/build/esm/api/types.js +17 -0
- package/build/esm/api/types.js.map +1 -0
- package/build/esm/cli/main.d.ts.map +1 -1
- package/build/esm/cli/main.js +121 -0
- package/build/esm/cli/main.js.map +1 -0
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +20 -280
- package/build/esm/index.js.map +1 -1
- package/package.json +5 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/defineOntology.ts","../../src/api/defineSpt.ts","../../src/api/defineInterface.ts","../../src/cli/main.ts","../../src/api/defineInterfaceLinkConstraint.ts"],"names":["invariant","apiName"],"mappings":";;;;;;;;;;AAiBO,IAAI,kBAAA,CAAA;AAGJ,IAAI,SAAA,CAAA;AACX,eAAsB,cAAA,CAAe,IAAI,IAAM,EAAA;AAC7C,EAAY,SAAA,GAAA,EAAA,CAAA;AACZ,EAAqB,kBAAA,GAAA;AAAA,IACnB,aAAa,EAAC;AAAA,IACd,aAAa,EAAC;AAAA,IACd,YAAY,EAAC;AAAA,IACb,gBAAgB,EAAC;AAAA,IACjB,qBAAqB,EAAC;AAAA,GACxB,CAAA;AACA,EAAI,IAAA;AACF,IAAA,MAAM,IAAK,EAAA,CAAA;AAAA,WACJ,CAAG,EAAA;AAEV,IAAQ,OAAA,CAAA,KAAA,CAAM,8DAA8D,CAAC,CAAA,CAAA;AAC7E,IAAM,MAAA,CAAA,CAAA;AAAA,GACR;AACA,EAAA,OAAO,sBAAsB,kBAAkB,CAAA,CAAA;AACjD,CAAA;AACA,SAAS,sBAAsB,QAAU,EAAA;AACvC,EAAO,OAAA;AAAA,IACL,mBAAqB,EAAA,MAAA,CAAO,WAAY,CAAA,MAAA,CAAO,QAAQ,QAAS,CAAA,mBAAmB,CAAE,CAAA,GAAA,CAAI,CAAC,CAAC,OAAA,EAAS,GAAG,CAAA,KAAM,CAAC,OAAS,EAAA;AAAA,MACrH,kBAAA,EAAoB,WAAW,GAAG,CAA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AO,CAAA,mBAAA,EAAsB,OAAQ,CAAA,OAAO,CAAE,CAAA,CAAA,GAAIA,UAAU,CAAA,KAAK,CAAI,GAAA,KAAA,CAAA,CAAA;AACvP,EAAQ,OAAA,CAAA,IAAA,CAAK,MAAM,IAAK,CAAA;AAAA,IACtB,WAAA,EAAa,OAAQ,CAAA,MAAA,GAAS,MAAS,GAAA,QAAA;AAAA,IACvC,kBAAoB,EAAA,aAAA,CAAc,OAAQ,CAAA,MAAA,IAAU,QAAQ,KAAK,CAAA;AAAA,IACjE,QAAU,EAAA,YAAA;AAAA,IACV,QAAU,EAAA,IAAA;AAAA;AAAA,GACX,CAAA,CAAA;AACH,CAAA;AACA,SAAS,cAAc,CAAG,EAAA;AACxB,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,eAAA;AAAA,IACN,aAAe,EAAA,OAAO,CAAM,KAAA,QAAA,GAAW,IAAI,CAAE,CAAA,OAAA;AAAA,GAC/C,CAAA;AACF,CAAA;AACA,SAAS,YAAY,IAAM,EAAA;AACzB,EAAO,OAAA,OAAO,IAAS,KAAA,QAAA,GAAW,YAAa,CAAA;AAAA,IAC7C,SAAS,SAAY,GAAA,IAAA;AAAA,GACtB,CAAI,GAAA,YAAA,CAAa,IAAI,CAAA,CAAA;AACxB,CAAA;AACA,SAAS,YAAa,CAAA;AAAA,EACpB,OAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AACF,CAAG,EAAA;AACD,EAAO,OAAA;AAAA,IACL,SAAS,SAAY,GAAA,OAAA;AAAA,IACrB,aAAa,WAAe,IAAA,OAAA;AAAA,IAC5B,WAAA,EAAa,eAAe,WAAe,IAAA,OAAA;AAAA,GAC7C,CAAA;AACF","file":"index.js","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\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 objectTypes: {},\n queryTypes: {},\n interfaceTypes: {},\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 sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, {\n sharedPropertyType: convertSpt(spt)\n }])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, interfaceType]) => {\n return [apiName, {\n interfaceType: convertInterface(interfaceType)\n }];\n })),\n blockPermissionInformation: {\n actionTypes: {},\n linkTypes: {},\n objectTypes: {}\n }\n };\n}\nfunction convertInterface(interfaceType) {\n return {\n ...interfaceType,\n properties: Object.values(interfaceType.properties).map(spt => convertSpt(spt)),\n // these are omitted from our internal types but we need to re-add them for the final json\n allExtendsInterfaces: [],\n allLinks: [],\n allProperties: []\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntology(ontologyDefinition);\n}\nfunction convertSpt({\n type,\n array,\n description,\n apiName,\n displayName,\n gothamMapping,\n typeClasses\n}) {\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: \"NORMAL\",\n description\n },\n type: array ? {\n type: \"array\",\n array: {\n subtype: convertType(type)\n }\n } : convertType(type),\n aliases: [],\n baseFormatter: undefined,\n dataConstraints: undefined,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n provenance: undefined,\n typeClasses: typeClasses ?? [],\n valueType: undefined\n };\n}\nfunction convertType(type) {\n switch (type) {\n case \"marking\":\n return {\n type,\n [type]: {\n markingType: \"MANDATORY\"\n }\n };\n case \"geopoint\":\n return {\n type: \"geohash\",\n geohash: {}\n };\n case \"decimal\":\n return {\n type,\n [type]: {\n precision: undefined,\n scale: undefined\n }\n };\n case \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsExactMatching: true\n }\n };\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nfunction distributeTypeHelper(type) {\n return {\n type,\n [type]: {}\n }; // any cast to match conditional return type\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 { namespace, ontologyDefinition } from \"./defineOntology.js\";\nconst defaultTypeClasses = [{\n kind: \"render_hint\",\n name: \"SELECTABLE\"\n}, {\n kind: \"render_hint\",\n name: \"SORTABLE\"\n}];\nexport function defineSharedPropertyType(opts) {\n const apiName = namespace + opts.apiName;\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 ...opts,\n apiName,\n displayName: opts.displayName ?? opts.apiName,\n // This way the non-namespaced api name is the display name (maybe not ideal)\n typeClasses: opts.typeClasses ?? defaultTypeClasses\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 { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(opts) {\n const apiName = namespace + opts.apiName;\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 const spt = defineSharedPropertyType({\n apiName,\n displayName: apiName,\n type,\n array: false\n });\n return [apiName, spt];\n } else {\n !(namespace + 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 const a = {\n apiName,\n displayMetadata: {\n displayName: opts.displayName ?? opts.apiName,\n description: opts.description ?? opts.displayName ?? opts.apiName,\n icon: opts.icon !== undefined ? {\n type: \"blueprint\",\n blueprint: {\n color: opts.icon.color,\n locator: opts.icon.locator\n }\n } : undefined\n },\n extendsInterfaces: [],\n links: [],\n properties,\n status: {\n type: \"active\",\n active: {}\n }\n };\n return ontologyDefinition.interfaceTypes[apiName] = a;\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\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\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\";\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\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 apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\"\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve\n }\n }).parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = commandLineOpts.apiNamespace.slice(-1) !== \".\" ? commandLineOpts.apiNamespace + \".\" : commandLineOpts.apiNamespace;\n !(apiNamespace.length < 1024) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"API namespace is too long.\") : invariant(false) : void 0;\n !apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\") : invariant(false) : void 0;\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n const ontology = await loadOntology(commandLineOpts.input, apiNamespace);\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await 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, apiNamespace) {\n // Object.assign(globalThis, {\n // defineInterface,\n // defineLink,\n // defineObject,\n // defineSharedPropertyType,\n // });\n\n const q = await defineOntology(apiNamespace, 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 { namespace } from \"./defineOntology.js\";\nexport function defineInterfaceLinkConstraint(linkDef) {\n const fromLinkMeta = getLinkMeta(linkDef);\n !(linkDef.from.links.find(a => a.metadata.apiName === fromLinkMeta.apiName) == null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`) : invariant(false) : void 0;\n linkDef.from.links.push({\n cardinality: linkDef.toMany ? \"MANY\" : \"SINGLE\",\n linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),\n metadata: fromLinkMeta,\n required: true // TODO: expose this?\n });\n}\nfunction getLinkedType(t) {\n return {\n type: \"interfaceType\",\n interfaceType: typeof t === \"string\" ? t : t.apiName\n };\n}\nfunction getLinkMeta(meta) {\n return typeof meta === \"string\" ? withDefaults({\n apiName: namespace + meta\n }) : withDefaults(meta);\n}\nfunction withDefaults({\n apiName,\n description,\n displayName\n}) {\n return {\n apiName: namespace + apiName,\n displayName: displayName ?? apiName,\n description: description ?? displayName ?? apiName\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","defineInterface","defineInterfaceLinkConstraint","defineSharedPropertyType","defineValueType"],"sources":["index.js"],"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 */\nexport { default as default } from \"./cli/main.js\";\nexport { defineInterface } from \"./api/defineInterface.js\";\nexport { defineInterfaceLinkConstraint } from \"./api/defineInterfaceLinkConstraint.js\";\nexport { defineSharedPropertyType } from \"./api/defineSpt.js\";\nexport { defineValueType } from \"./api/defineValueType.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAkB,QAAQ,eAAe;AAClD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,6BAA6B,QAAQ,wCAAwC;AACtF,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,eAAe,QAAQ,0BAA0B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineInterface.d.ts","sourceRoot":"","sources":["../../../src/api/defineInterface.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CACjB,MAAM,EACN,kBAAkB,GAAG,gBAAgB,CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"defineInterface.d.ts","sourceRoot":"","sources":["../../../src/api/defineInterface.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CACjB,MAAM,EACN,kBAAkB,GAAG,gBAAgB,CACtC,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC;CACtC,GACA,aAAa,CA2Df"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import invariant from "tiny-invariant";
|
|
17
|
+
import { namespace, ontologyDefinition } from "./defineOntology.js";
|
|
18
|
+
import { defineSharedPropertyType } from "./defineSpt.js";
|
|
19
|
+
export function defineInterface(opts) {
|
|
20
|
+
const apiName = namespace + opts.apiName;
|
|
21
|
+
!(ontologyDefinition.interfaceTypes[apiName] === undefined) ? invariant(false, `Interface ${apiName} already exists`) : void 0;
|
|
22
|
+
const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {
|
|
23
|
+
if (typeof type === "string") {
|
|
24
|
+
!isSimpleType(type) ? invariant(false, `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`) : void 0;
|
|
25
|
+
const spt = defineSharedPropertyType({
|
|
26
|
+
apiName,
|
|
27
|
+
displayName: apiName,
|
|
28
|
+
type,
|
|
29
|
+
array: false
|
|
30
|
+
});
|
|
31
|
+
return [apiName, spt];
|
|
32
|
+
} else {
|
|
33
|
+
!(namespace + apiName === type.apiName) ? invariant(false, `property key and it's apiName must be identical. ${JSON.stringify({
|
|
34
|
+
key: apiName,
|
|
35
|
+
apiName: type.apiName
|
|
36
|
+
})}`) : void 0;
|
|
37
|
+
return [apiName, type];
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
// (opts.extends ?? []).map(val => {(val is InterfaceType) ? val :;});
|
|
41
|
+
const a = {
|
|
42
|
+
apiName,
|
|
43
|
+
displayMetadata: {
|
|
44
|
+
displayName: opts.displayName ?? opts.apiName,
|
|
45
|
+
description: opts.description ?? opts.displayName ?? opts.apiName,
|
|
46
|
+
icon: opts.icon !== undefined ? {
|
|
47
|
+
type: "blueprint",
|
|
48
|
+
blueprint: {
|
|
49
|
+
color: opts.icon.color,
|
|
50
|
+
locator: opts.icon.locator
|
|
51
|
+
}
|
|
52
|
+
} : undefined
|
|
53
|
+
},
|
|
54
|
+
extendsInterfaces: [],
|
|
55
|
+
links: [],
|
|
56
|
+
properties,
|
|
57
|
+
status: {
|
|
58
|
+
type: "active",
|
|
59
|
+
active: {}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return ontologyDefinition.interfaceTypes[apiName] = a;
|
|
63
|
+
}
|
|
64
|
+
function isSimpleType(v) {
|
|
65
|
+
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";
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=defineInterface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineInterface.js","names":["invariant","namespace","ontologyDefinition","defineSharedPropertyType","defineInterface","opts","apiName","interfaceTypes","undefined","properties","Object","fromEntries","entries","map","type","isSimpleType","spt","displayName","array","JSON","stringify","key","a","displayMetadata","description","icon","blueprint","color","locator","extendsInterfaces","links","status","active","v"],"sources":["defineInterface.js"],"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 */\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(opts) {\n const apiName = namespace + opts.apiName;\n invariant(ontologyDefinition.interfaceTypes[apiName] === undefined, `Interface ${apiName} already exists`);\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n invariant(isSimpleType(type), `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`);\n const spt = defineSharedPropertyType({\n apiName,\n displayName: apiName,\n type,\n array: false,\n });\n return [apiName, spt];\n }\n else {\n invariant(namespace + apiName === type.apiName, `property key and it's apiName must be identical. ${JSON.stringify({ key: apiName, apiName: type.apiName })}`);\n return [apiName, type];\n }\n }));\n // (opts.extends ?? []).map(val => {(val is InterfaceType) ? val :;});\n const a = {\n apiName,\n displayMetadata: {\n displayName: opts.displayName ?? opts.apiName,\n description: opts.description ?? opts.displayName ?? opts.apiName,\n icon: opts.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: { color: opts.icon.color, locator: opts.icon.locator },\n }\n : undefined,\n },\n extendsInterfaces: [],\n links: [],\n properties,\n status: { type: \"active\", active: {} },\n };\n return ontologyDefinition.interfaceTypes[apiName] = a;\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\"\n || v === \"date\" || v === \"decimal\" || v === \"double\"\n || v === \"float\" || v === \"geopoint\" || v === \"geoshape\"\n || v === \"integer\" || v === \"long\" || v === \"marking\"\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AACnE,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,OAAO,SAASC,eAAeA,CAACC,IAAI,EAAE;EAClC,MAAMC,OAAO,GAAGL,SAAS,GAAGI,IAAI,CAACC,OAAO;EACxC,EAAUJ,kBAAkB,CAACK,cAAc,CAACD,OAAO,CAAC,KAAKE,SAAS,IAAlER,SAAS,QAA2D,aAAaM,OAAO,iBAAiB;EACzG,MAAMG,UAAU,GAAGC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACP,IAAI,CAACI,UAAU,IAAI,CAAC,CAAC,CAAC,CAACI,GAAG,CAAC,CAAC,CAACP,OAAO,EAAEQ,IAAI,CAAC,KAAK;IACjG,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MAC1B,CAAUC,YAAY,CAACD,IAAI,CAAC,GAA5Bd,SAAS,QAAqB,qBAAqBc,IAAI,iBAAiBR,OAAO,qBAAqBA,OAAO,EAAE;MAC7G,MAAMU,GAAG,GAAGb,wBAAwB,CAAC;QACjCG,OAAO;QACPW,WAAW,EAAEX,OAAO;QACpBQ,IAAI;QACJI,KAAK,EAAE;MACX,CAAC,CAAC;MACF,OAAO,CAACZ,OAAO,EAA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A,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAClDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import invariant from "tiny-invariant";
|
|
17
|
+
import { namespace } from "./defineOntology.js";
|
|
18
|
+
export function defineInterfaceLinkConstraint(linkDef) {
|
|
19
|
+
const fromLinkMeta = getLinkMeta(linkDef);
|
|
20
|
+
!(linkDef.from.links.find(a => a.metadata.apiName === fromLinkMeta.apiName) == null) ? invariant(false, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`) : void 0;
|
|
21
|
+
linkDef.from.links.push({
|
|
22
|
+
cardinality: linkDef.toMany ? "MANY" : "SINGLE",
|
|
23
|
+
linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),
|
|
24
|
+
metadata: fromLinkMeta,
|
|
25
|
+
required: true // TODO: expose this?
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function getLinkedType(t) {
|
|
29
|
+
return {
|
|
30
|
+
type: "interfaceType",
|
|
31
|
+
interfaceType: typeof t === "string" ? t : t.apiName
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function getLinkMeta(meta) {
|
|
35
|
+
return typeof meta === "string" ? withDefaults({
|
|
36
|
+
apiName: namespace + meta
|
|
37
|
+
}) : withDefaults(meta);
|
|
38
|
+
}
|
|
39
|
+
function withDefaults({
|
|
40
|
+
apiName,
|
|
41
|
+
description,
|
|
42
|
+
displayName
|
|
43
|
+
}) {
|
|
44
|
+
return {
|
|
45
|
+
apiName: namespace + apiName,
|
|
46
|
+
displayName: displayName ?? apiName,
|
|
47
|
+
description: description ?? displayName ?? apiName
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=defineInterfaceLinkConstraint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineInterfaceLinkConstraint.js","names":["invariant","namespace","defineInterfaceLinkConstraint","linkDef","fromLinkMeta","getLinkMeta","from","links","find","a","metadata","apiName","push","cardinality","toMany","linkedEntityTypeId","getLinkedType","toOne","required","t","type","interfaceType","meta","withDefaults","description","displayName"],"sources":["defineInterfaceLinkConstraint.js"],"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 */\nimport invariant from \"tiny-invariant\";\nimport { namespace } from \"./defineOntology.js\";\nexport function defineInterfaceLinkConstraint(linkDef) {\n const fromLinkMeta = getLinkMeta(linkDef);\n invariant(linkDef.from.links.find(a => a.metadata.apiName === fromLinkMeta.apiName)\n == null, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`);\n linkDef.from.links.push({\n cardinality: linkDef.toMany ? \"MANY\" : \"SINGLE\",\n linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),\n metadata: fromLinkMeta,\n required: true, // TODO: expose this?\n });\n}\nfunction getLinkedType(t) {\n return {\n type: \"interfaceType\",\n interfaceType: typeof t === \"string\" ? t : t.apiName,\n };\n}\nfunction getLinkMeta(meta) {\n return typeof meta === \"string\"\n ? withDefaults({ apiName: namespace + meta })\n : withDefaults(meta);\n}\nfunction withDefaults({ apiName, description, displayName }) {\n return {\n apiName: namespace + apiName,\n displayName: displayName ?? apiName,\n description: description ?? displayName ?? apiName,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,OAAO,SAASC,6BAA6BA,CAACC,OAAO,EAAE;EACnD,MAAMC,YAAY,GAAGC,WAAW,CAACF,OAAO,CAAC;EACzC,EAAUA,OAAO,CAACG,IAAI,CAACC,KAAK,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAACC,OAAO,KAAKP,YAAY,CAACO,OAAO,CAAC,IAC5E,IAAI,IADXX,SAAS,QACI,qBAAqBI,YAAY,CAACO,OAAO,sBAAsBR,OAAO,CAACQ,OAAO,EAAE;EAC7FR,OAAO,CAACG,IAAI,CAACC,KAAK,CAACK,IAAI,CAAC;IACpBC,WAAW,EAAEV,OAAO,CAACW,MAAM,GAAG,MAAM,GAAG,QAAQ;IAC/CC,kBAAkB,EAAEC,aAAa,CAACb,OAAO,CAACW,MAAM,IAAIX,OAAO,CAACc,KAAK,CAAC;IAClEP,QAAQ,EAAEN,YAAY;IACtBc,QAAQ,EAAE,IAAI,CAAE;EACpB,CAAC,CAAC;AACN;AACA,SAASF,aAAaA,CAACG,CAAC,EAAE;EACtB,OAAO;IACHC,IAAI,EAAE,eAAe;IACrBC,aAAa,EAAE,OAAOF,CAAC,KAAK,QAAQ,GAAGA,CAAC,GAAGA,CAAC,CAACR;EACjD,CAAC;AACL;AACA,SAASN,WAAWA,CAACiB,IAAI,EAAE;EACvB,OAAO,OAAOA,IAAI,KAAK,QAAQ,GACzBC,YAAY,CAAC;IAAEZ,OAAO,EAAEV,SAAS,GAAGqB;EAAK,CAAC,CAAC,GAC3CC,YAAY,CAACD,IAAI,CAAC;AAC5B;AACA,SAASC,YAAYA,CAAC;EAAEZ,OAAO;EAAEa,WAAW;EAAEC;AAAY,CAAC,EAAE;EACzD,OAAO;IACHd,OAAO,EAAEV,SAAS,GAAGU,OAAO;IAC5Bc,WAAW,EAAEA,WAAW,IAAId,OAAO;IACnCa,WAAW,EAAEA,WAAW,IAAIC,WAAW,IAAId;EAC/C,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import invariant from "tiny-invariant";
|
|
17
|
+
export function defineLink(from, opts) {
|
|
18
|
+
const apiName = opts.one ?? opts.many;
|
|
19
|
+
const toApiName = opts.reverse.one ?? opts.reverse.many;
|
|
20
|
+
const to = opts.to;
|
|
21
|
+
!(from.linkTypes[apiName] == null) ? invariant(false, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`) : void 0;
|
|
22
|
+
!(from.linkTypes[toApiName] == null) ? invariant(false, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`) : void 0;
|
|
23
|
+
from.linkTypes[apiName] = {
|
|
24
|
+
cardinality: "ONE",
|
|
25
|
+
displayName: apiName,
|
|
26
|
+
objectTypeApiName: to.data.objectType.apiName,
|
|
27
|
+
status: "ACTIVE"
|
|
28
|
+
};
|
|
29
|
+
to.linkTypes[toApiName] = {
|
|
30
|
+
apiName: toApiName,
|
|
31
|
+
cardinality: "ONE",
|
|
32
|
+
displayName: apiName,
|
|
33
|
+
objectTypeApiName: from.data.objectType.apiName,
|
|
34
|
+
status: "ACTIVE"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=defineLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineLink.js","names":["invariant","defineLink","from","opts","apiName","one","many","toApiName","reverse","to","linkTypes","data","objectType","cardinality","displayName","objectTypeApiName","status"],"sources":["defineLink.js"],"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 */\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 invariant(from.linkTypes[apiName] == null, `Link with apiName ${apiName} already exists on ${from.data.objectType.apiName}`);\n invariant(from.linkTypes[toApiName] == null, `Link with apiName ${toApiName} already exists on ${to.data.objectType.apiName}`);\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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,UAAUA,CAACC,IAAI,EAAEC,IAAI,EAAE;EACnC,MAAMC,OAAO,GAAGD,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACG,IAAI;EACrC,MAAMC,SAAS,GAAGJ,IAAI,CAACK,OAAO,CAACH,GAAG,IAAIF,IAAI,CAACK,OAAO,CAACF,IAAI;EACvD,MAAMG,EAAE,GAAGN,IAAI,CAACM,EAAE;EAClB,EAAUP,IAAI,CAACQ,SAAS,CAACN,OAAO,CAAC,IAAI,IAAI,IAAzCJ,SAAS,QAAkC,qBAAqBI,OAAO,sBAAsBF,IAAI,CAACS,IAAI,CAACC,UAAU,CAACR,OAAO,EAAE;EAC3H,EAAUF,IAAI,CAACQ,SAAS,CAACH,SAAS,CAAC,IAAI,IAAI,IAA3CP,SAAS,QAAoC,qBAAqBO,SAAS,sBAAsBE,EAAE,CAACE,IAAI,CAACC,UAAU,CAACR,OAAO,EAAE;EAC7HF,IAAI,CAACQ,SAAS,CAACN,OAAO,CAAC,GAAG;IACtBS,WAAW,EAAE,KAAK;IAClBC,WAAW,EAAEV,OAAO;IACpBW,iBAAiB,EAAEN,EAAE,CAACE,IAAI,CAACC,UAAU,CAACR,OAAO;IAC7CY,MAAM,EAAE;EACZ,CAAC;EACDP,EAAE,CAACC,SAAS,CAACH,SAAS,CAAC,GAAG;IACtBH,OAAO,EAAEG,SAAS;IAClBM,WAAW,EAAE,KAAK;IAClBC,WAAW,EAAEV,OAAO;IACpBW,iBAAiB,EAAEb,IAAI,CAACS,IAAI,CAACC,UAAU,CAACR,OAAO;IAC/CY,MAAM,EAAE;EACZ,CAAC;AACL","ignoreList":[]}
|
|
@@ -7,9 +7,9 @@ export interface ObjectType {
|
|
|
7
7
|
export declare function defineObject(apiName: string, opts: {
|
|
8
8
|
displayName?: string;
|
|
9
9
|
pluralDisplayName?: string;
|
|
10
|
-
primaryKey: api.
|
|
10
|
+
primaryKey: api.ObjectMetadata.Property & {
|
|
11
11
|
apiName: string;
|
|
12
12
|
};
|
|
13
|
-
properties?: Record<string, api.WirePropertyTypes | api.
|
|
13
|
+
properties?: Record<string, api.WirePropertyTypes | api.ObjectMetadata.Property>;
|
|
14
14
|
}): ObjectType;
|
|
15
15
|
//# sourceMappingURL=defineObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineObject.d.ts","sourceRoot":"","sources":["../../../src/api/defineObject.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AASrC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAIzB,CAAC,CAAC;CACJ;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;IACJ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"defineObject.d.ts","sourceRoot":"","sources":["../../../src/api/defineObject.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AASrC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAIzB,CAAC,CAAC;CACJ;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;IACJ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,QAAQ,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,UAAU,CAAC,EAAE,MAAM,CACjB,MAAM,EACJ,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,cAAc,CAAC,QAAQ,CAC9B,CAAC;CACH,GACA,UAAU,CAiCZ"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import invariant from "tiny-invariant";
|
|
17
|
+
import { ontologyDefinition } from "./defineOntology.js";
|
|
18
|
+
export function defineObject(apiName, opts) {
|
|
19
|
+
ontologyDefinition.objectTypes[apiName] = {
|
|
20
|
+
implementsInterfaces: [],
|
|
21
|
+
implementsInterfaces2: {},
|
|
22
|
+
linkTypes: [],
|
|
23
|
+
objectType: {
|
|
24
|
+
apiName,
|
|
25
|
+
primaryKey: opts.primaryKey.apiName,
|
|
26
|
+
displayName: opts.displayName ?? apiName,
|
|
27
|
+
pluralDisplayName: opts.pluralDisplayName ?? apiName,
|
|
28
|
+
icon: {
|
|
29
|
+
color: "blue",
|
|
30
|
+
name: "cube",
|
|
31
|
+
type: "blueprint"
|
|
32
|
+
},
|
|
33
|
+
properties: {
|
|
34
|
+
[opts.primaryKey.apiName]: {
|
|
35
|
+
dataType: convertType(opts.primaryKey)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
rid: "PLACEHOLDER",
|
|
39
|
+
status: "ACTIVE",
|
|
40
|
+
titleProperty: opts.primaryKey.apiName
|
|
41
|
+
},
|
|
42
|
+
sharedPropertyTypeMapping: {}
|
|
43
|
+
};
|
|
44
|
+
// FIXME: don't return the raw value
|
|
45
|
+
return {
|
|
46
|
+
data: ontologyDefinition.objectTypes[apiName],
|
|
47
|
+
linkTypes: {}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function convertType(t) {
|
|
51
|
+
switch (true) {
|
|
52
|
+
case t.multiplicity === true:
|
|
53
|
+
return {
|
|
54
|
+
type: "array",
|
|
55
|
+
subType: convertType({
|
|
56
|
+
...t,
|
|
57
|
+
multiplicity: false
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
case t.type === "stringTimeseries":
|
|
61
|
+
return {
|
|
62
|
+
itemType: {
|
|
63
|
+
type: "string"
|
|
64
|
+
},
|
|
65
|
+
type: "timeseries"
|
|
66
|
+
};
|
|
67
|
+
break;
|
|
68
|
+
case t.type === "numericTimeseries":
|
|
69
|
+
return {
|
|
70
|
+
itemType: {
|
|
71
|
+
type: "double"
|
|
72
|
+
},
|
|
73
|
+
type: "timeseries"
|
|
74
|
+
};
|
|
75
|
+
case t.type === "datetime":
|
|
76
|
+
return {
|
|
77
|
+
type: "timestamp"
|
|
78
|
+
};
|
|
79
|
+
default:
|
|
80
|
+
return {
|
|
81
|
+
type: t.type
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
invariant(false);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=defineObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineObject.js","names":["invariant","ontologyDefinition","defineObject","apiName","opts","objectTypes","implementsInterfaces","implementsInterfaces2","linkTypes","objectType","primaryKey","displayName","pluralDisplayName","icon","color","name","type","properties","dataType","convertType","rid","status","titleProperty","sharedPropertyTypeMapping","data","t","multiplicity","subType","itemType"],"sources":["defineObject.js"],"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 */\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nexport function defineObject(apiName, opts) {\n ontologyDefinition.objectTypes[apiName] = {\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName,\n primaryKey: opts.primaryKey.apiName,\n displayName: opts.displayName ?? apiName,\n pluralDisplayName: opts.pluralDisplayName ?? apiName,\n icon: {\n color: \"blue\",\n name: \"cube\",\n type: \"blueprint\",\n },\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 // FIXME: don't 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({ ...t, multiplicity: false }),\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 invariant(false);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,OAAO,SAASC,YAAYA,CAACC,OAAO,EAAEC,IAAI,EAAE;EACxCH,kBAAkB,CAACI,WAAW,CAACF,OAAO,CAAC,GAAG;IACtCG,oBAAoB,EAAE,EAAE;IACxBC,qBAAqB,EAAE,CAAC,CAAC;IACzBC,SAAS,EAAE,EAAE;IACbC,UAAU,EAAE;MACRN,OAAO;MACPO,UAAU,EAAEN,IAAI,CAACM,UAAU,CAACP,OAAO;MACnCQ,WAAW,EAAEP,IAAI,CAACO,WAAW,IAAIR,OAAO;MACxCS,iBAAiB,EAAER,IAAI,CAACQ,iBAAiB,IAAIT,OAAO;MACpDU,IAAI,EAAE;QACFC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAE,MAAM;QACZC,IAAI,EAAE;MACV,CAAC;MACDC,UAAU,EAAE;QACR,CAACb,IAAI,CAACM,UAAU,CAACP,OAAO,GAAG;UACvBe,QAAQ,EAAEC,WAAW,CAACf,IAAI,CAACM,UAAU;QACzC;MACJ,CAAC;MACDU,GAAG,EAAE,aAAa;MAClBC,MAAM,EAAE,QAAQ;MAChBC,aAAa,EAAElB,IAAI,CAACM,UAAU,CAACP;IACnC,CAAC;IACDoB,yBAAyB,EAAE,CAAC;EAChC,CAAC;EACD;EACA,OAAO;IACHC,IAAI,EAAEvB,kBAAkB,CAACI,WAAW,CAACF,OAAO,CAAC;IAC7CK,SAAS,EAAE,CAAC;EAChB,CAAC;AACL;AACA,SAASW,WAAWA,CAACM,CAAC,EAAE;EACpB,QAAQ,IAAI;IACR,KAAKA,CAAC,CAACC,YAAY,KAAK,IAAI;MACxB,OAAO;QACHV,IAAI,EAAE,OAAO;QACbW,OAAO,EAAER,WAAW,CAAC;UAAE,GAAGM,CAAC;UAAEC,YAAY,EAAE;QAAM,CAAC;MACtD,CAAC;IACL,KAAKD,CAAC,CAACT,IAAI,KAAK,kBAAkB;MAC9B,OAAO;QACHY,QAAQ,EAAE;UACNZ,IAAI,EAAE;QACV,CAAC;QACDA,IAAI,EAAE;MACV,CAAC;MACD;IACJ,KAAKS,CAAC,CAACT,IAAI,KAAK,mBAAmB;MAC/B,OAAO;QACHY,QAAQ,EAAE;UACNZ,IAAI,EAAE;QACV,CAAC;QACDA,IAAI,EAAE;MACV,CAAC;IACL,KAAKS,CAAC,CAACT,IAAI,KAAK,UAAU;MACtB,OAAO;QACHA,IAAI,EAAE;MACV,CAAC;IACL;MACI,OAAO;QACHA,IAAI,EAAES,CAAC,CAACT;MACZ,CAAC;EACT;EACAhB,SAAS;AACb","ignoreList":[]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { OntologyIrOntologyBlockDataV2 } from "@osdk/client.unstable";
|
|
2
|
-
|
|
1
|
+
import type { OntologyIrOntologyBlockDataV2, OntologyIrValueTypeBlockData } from "@osdk/client.unstable";
|
|
2
|
+
type OntologyAndValueTypeIrs = {
|
|
3
|
+
ontology: OntologyIrOntologyBlockDataV2;
|
|
4
|
+
valueType: OntologyIrValueTypeBlockData;
|
|
5
|
+
};
|
|
6
|
+
export declare function defineOntology(ns: string, body: () => void | Promise<void>): Promise<OntologyAndValueTypeIrs>;
|
|
3
7
|
export declare function dumpOntologyFullMetadata(): OntologyIrOntologyBlockDataV2;
|
|
8
|
+
export declare function dumpValueTypeWireType(): OntologyIrValueTypeBlockData;
|
|
9
|
+
export {};
|
|
4
10
|
//# 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,EAGV,6BAA6B,
|
|
1
|
+
{"version":3,"file":"defineOntology.d.ts","sourceRoot":"","sources":["../../../src/api/defineOntology.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAGV,6BAA6B,EAG7B,4BAA4B,EAG7B,MAAM,uBAAuB,CAAC;AAc/B,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,6BAA6B,CAAC;IACxC,SAAS,EAAE,4BAA4B,CAAC;CACzC,CAAC;AAEF,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CA0BlC;AAsED,wBAAgB,wBAAwB,IAAI,6BAA6B,CAExE;AAED,wBAAgB,qBAAqB,IAAI,4BAA4B,CAEpE"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/** @internal */
|
|
17
|
+
export let ontologyDefinition;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export let namespace;
|
|
20
|
+
export async function defineOntology(ns, body) {
|
|
21
|
+
namespace = ns;
|
|
22
|
+
ontologyDefinition = {
|
|
23
|
+
actionTypes: {},
|
|
24
|
+
objectTypes: {},
|
|
25
|
+
queryTypes: {},
|
|
26
|
+
interfaceTypes: {},
|
|
27
|
+
sharedPropertyTypes: {},
|
|
28
|
+
valueTypes: {}
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
await body();
|
|
32
|
+
} catch (e) {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.error("Unexpected error while processing the body of the ontology", e);
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
ontology: convertToWireOntologyIr(ontologyDefinition),
|
|
39
|
+
valueType: convertOntologyToValueTypeIr(ontologyDefinition)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function convertOntologyToValueTypeIr(ontology) {
|
|
43
|
+
return {
|
|
44
|
+
valueTypes: Object.values(ontology.valueTypes).map(definitions => ({
|
|
45
|
+
metadata: {
|
|
46
|
+
apiName: definitions[0].apiName,
|
|
47
|
+
displayMetadata: definitions[0].displayMetadata,
|
|
48
|
+
status: definitions[0].status
|
|
49
|
+
},
|
|
50
|
+
versions: definitions.map(definition => ({
|
|
51
|
+
version: definition.version,
|
|
52
|
+
baseType: definition.baseType,
|
|
53
|
+
constraints: definition.constraints,
|
|
54
|
+
exampleValues: definition.exampleValues
|
|
55
|
+
}))
|
|
56
|
+
}))
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function convertToWireOntologyIr(ontology) {
|
|
60
|
+
return {
|
|
61
|
+
sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, {
|
|
62
|
+
sharedPropertyType: convertSpt(spt)
|
|
63
|
+
}])),
|
|
64
|
+
interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, interfaceType]) => {
|
|
65
|
+
return [apiName, {
|
|
66
|
+
interfaceType: convertInterface(interfaceType)
|
|
67
|
+
}];
|
|
68
|
+
})),
|
|
69
|
+
blockPermissionInformation: {
|
|
70
|
+
actionTypes: {},
|
|
71
|
+
linkTypes: {},
|
|
72
|
+
objectTypes: {}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function convertInterface(interfaceType) {
|
|
77
|
+
return {
|
|
78
|
+
...interfaceType,
|
|
79
|
+
properties: Object.values(interfaceType.properties).map(spt => convertSpt(spt)),
|
|
80
|
+
// these are omitted from our internal types but we need to re-add them for the final json
|
|
81
|
+
allExtendsInterfaces: [],
|
|
82
|
+
allLinks: [],
|
|
83
|
+
allProperties: []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function dumpOntologyFullMetadata() {
|
|
87
|
+
return convertToWireOntologyIr(ontologyDefinition);
|
|
88
|
+
}
|
|
89
|
+
export function dumpValueTypeWireType() {
|
|
90
|
+
return convertOntologyToValueTypeIr(ontologyDefinition);
|
|
91
|
+
}
|
|
92
|
+
function convertSpt({
|
|
93
|
+
type,
|
|
94
|
+
array,
|
|
95
|
+
description,
|
|
96
|
+
apiName,
|
|
97
|
+
displayName,
|
|
98
|
+
gothamMapping,
|
|
99
|
+
typeClasses,
|
|
100
|
+
valueType
|
|
101
|
+
}) {
|
|
102
|
+
return {
|
|
103
|
+
apiName,
|
|
104
|
+
displayMetadata: {
|
|
105
|
+
displayName: displayName ?? apiName,
|
|
106
|
+
visibility: "NORMAL",
|
|
107
|
+
description
|
|
108
|
+
},
|
|
109
|
+
type: array ? {
|
|
110
|
+
type: "array",
|
|
111
|
+
array: {
|
|
112
|
+
subtype: convertType(type)
|
|
113
|
+
}
|
|
114
|
+
} : convertType(type),
|
|
115
|
+
aliases: [],
|
|
116
|
+
baseFormatter: undefined,
|
|
117
|
+
dataConstraints: undefined,
|
|
118
|
+
gothamMapping: gothamMapping,
|
|
119
|
+
indexedForSearch: true,
|
|
120
|
+
provenance: undefined,
|
|
121
|
+
typeClasses: typeClasses ?? [],
|
|
122
|
+
valueType: valueType
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function convertType(type) {
|
|
126
|
+
switch (type) {
|
|
127
|
+
case "marking":
|
|
128
|
+
return {
|
|
129
|
+
type,
|
|
130
|
+
[type]: {
|
|
131
|
+
markingType: "MANDATORY"
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
case "geopoint":
|
|
135
|
+
return {
|
|
136
|
+
type: "geohash",
|
|
137
|
+
geohash: {}
|
|
138
|
+
};
|
|
139
|
+
case "decimal":
|
|
140
|
+
return {
|
|
141
|
+
type,
|
|
142
|
+
[type]: {
|
|
143
|
+
precision: undefined,
|
|
144
|
+
scale: undefined
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
case "string":
|
|
148
|
+
return {
|
|
149
|
+
type,
|
|
150
|
+
[type]: {
|
|
151
|
+
analyzerOverride: undefined,
|
|
152
|
+
enableAsciiFolding: undefined,
|
|
153
|
+
isLongText: false,
|
|
154
|
+
supportsExactMatching: true
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
default:
|
|
158
|
+
// use helper function to distribute `type` properly
|
|
159
|
+
return distributeTypeHelper(type);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Helper function to avoid duplication. Makes the types match properly with the correct
|
|
164
|
+
* behavior without needing to switch on type.
|
|
165
|
+
* @param type
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
function distributeTypeHelper(type) {
|
|
169
|
+
return {
|
|
170
|
+
type,
|
|
171
|
+
[type]: {}
|
|
172
|
+
}; // any cast to match conditional return type
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=defineOntology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineOntology.js","names":["ontologyDefinition","namespace","defineOntology","ns","body","actionTypes","objectTypes","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","e","console","error","ontology","convertToWireOntologyIr","valueType","convertOntologyToValueTypeIr","Object","values","map","definitions","metadata","apiName","displayMetadata","status","versions","definition","version","baseType","constraints","exampleValues","fromEntries","entries","spt","sharedPropertyType","convertSpt","interfaceType","convertInterface","blockPermissionInformation","linkTypes","properties","allExtendsInterfaces","allLinks","allProperties","dumpOntologyFullMetadata","dumpValueTypeWireType","type","array","description","displayName","gothamMapping","typeClasses","visibility","subtype","convertType","aliases","baseFormatter","undefined","dataConstraints","indexedForSearch","provenance","markingType","geohash","precision","scale","analyzerOverride","enableAsciiFolding","isLongText","supportsExactMatching","distributeTypeHelper"],"sources":["defineOntology.js"],"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/** @internal */\nexport let ontologyDefinition;\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n objectTypes: {},\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n };\n try {\n await body();\n }\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 {\n ontology: convertToWireOntologyIr(ontologyDefinition),\n valueType: convertOntologyToValueTypeIr(ontologyDefinition),\n };\n}\nfunction convertOntologyToValueTypeIr(ontology) {\n return {\n valueTypes: Object.values(ontology.valueTypes).map(definitions => ({\n metadata: {\n apiName: definitions[0].apiName,\n displayMetadata: definitions[0].displayMetadata,\n status: definitions[0].status,\n },\n versions: definitions.map(definition => ({\n version: definition.version,\n baseType: definition.baseType,\n constraints: definition.constraints,\n exampleValues: definition.exampleValues,\n })),\n })),\n };\n}\nfunction convertToWireOntologyIr(ontology) {\n return {\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes)\n .map(([apiName, spt]) => [apiName, { sharedPropertyType: convertSpt(spt) }])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes)\n .map(([apiName, interfaceType]) => {\n return [apiName, {\n interfaceType: convertInterface(interfaceType),\n }];\n })),\n blockPermissionInformation: {\n actionTypes: {},\n linkTypes: {},\n objectTypes: {},\n },\n };\n}\nfunction convertInterface(interfaceType) {\n return {\n ...interfaceType,\n properties: Object.values(interfaceType.properties)\n .map((spt) => convertSpt(spt)),\n // these are omitted from our internal types but we need to re-add them for the final json\n allExtendsInterfaces: [],\n allLinks: [],\n allProperties: [],\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntologyIr(ontologyDefinition);\n}\nexport function dumpValueTypeWireType() {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\nfunction convertSpt({ type, array, description, apiName, displayName, gothamMapping, typeClasses, valueType, }) {\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\",\n array: {\n subtype: convertType(type),\n },\n }\n : convertType(type),\n aliases: [],\n baseFormatter: undefined,\n dataConstraints: undefined,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n provenance: undefined,\n typeClasses: typeClasses ?? [],\n valueType: valueType,\n };\n}\nfunction convertType(type) {\n switch (type) {\n case \"marking\":\n return { type, [type]: { markingType: \"MANDATORY\" } };\n case \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n case \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n case \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsExactMatching: true,\n },\n };\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nfunction distributeTypeHelper(type) {\n return { type, [type]: {} }; // any cast to match conditional return type\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIA,kBAAkB;AAC7B;AACA,OAAO,IAAIC,SAAS;AACpB,OAAO,eAAeC,cAAcA,CAACC,EAAE,EAAEC,IAAI,EAAE;EAC3CH,SAAS,GAAGE,EAAE;EACdH,kBAAkB,GAAG;IACjBK,WAAW,EAAE,CAAC,CAAC;IACfC,WAAW,EAAE,CAAC,CAAC;IACfC,UAAU,EAAE,CAAC,CAAC;IACdC,cAAc,EAAE,CAAC,CAAC;IAClBC,mBAAmB,EAAE,CAAC,CAAC;IACvBC,UAAU,EAAE,CAAC;EACjB,CAAC;EACD,IAAI;IACA,MAAMN,IAAI,CAAC,CAAC;EAChB,CAAC,CACD,OAAOO,CAAC,EAAE;IACN;IACAC,OAAO,CAACC,KAAK,CAAC,4DAA4D,EAAEF,CAAC,CAAC;IAC9E,MAAMA,CAAC;EACX;EACA,OAAO;IACHG,QAAQ,EAAEC,uBAAuB,CAACf,kBAAkB,CAAC;IACrDgB,SAAS,EAAEC,4BAA4B,CAACjB,kBAAkB;EAC9D,CAAC;AACL;AACA,SAASiB,4BAA4BA,CAACH,QAAQ,EAAE;EAC5C,OAAO;IACHJ,UAAU,EAAEQ,MAAM,CAACC,MAAM,CAACL,QAAQ,CAACJ,UAAU,CAAC,CAACU,GAAG,CAACC,WAAW,KAAK;MAC/DC,QAAQ,EAAE;QACNC,OAAO,EAAEF,WAAW,CAAC,CAAC,CAAC,CAACE,OAAO;QAC/BC,eAAe,EAAEH,WAAW,CAAC,CAAC,CAAC,CAACG,eAAe;QAC/CC,MAAM,EAAEJ,WAA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AACA,IAAI,GAAG;UAAEiB,SAAS,EAAEN,SAAS;UAAEO,KAAK,EAAEP;QAAU;MAAE,CAAC;IACvE,KAAK,QAAQ;MACT,OAAO;QACHX,IAAI;QACJ,CAACA,IAAI,GAAG;UACJmB,gBAAgB,EAAER,SAAS;UAC3BS,kBAAkB,EAAET,SAAS;UAC7BU,UAAU,EAAE,KAAK;UACjBC,qBAAqB,EAAE;QAC3B;MACJ,CAAC;IACL;MACI;MACA,OAAOC,oBAAoB,CAACvB,IAAI,CAAC;EACzC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASuB,oBAAoBA,CAACvB,IAAI,EAAE;EAChC,OAAO;IAAEA,IAAI;IAAE,CAACA,IAAI,GAAG,CAAC;EAAE,CAAC,CAAC,CAAC;AACjC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SharedPropertyTypeGothamMapping } from "@osdk/client.unstable";
|
|
1
|
+
import type { ApiNameValueTypeReference, SharedPropertyTypeGothamMapping } from "@osdk/client.unstable";
|
|
2
2
|
import type { PropertyTypeType, SharedPropertyType } from "./types.js";
|
|
3
3
|
export declare function defineSharedPropertyType(opts: {
|
|
4
4
|
apiName: string;
|
|
@@ -6,6 +6,7 @@ export declare function defineSharedPropertyType(opts: {
|
|
|
6
6
|
array?: boolean;
|
|
7
7
|
description?: string;
|
|
8
8
|
displayName?: string;
|
|
9
|
+
valueType?: ApiNameValueTypeReference;
|
|
9
10
|
typeClasses?: SharedPropertyType["typeClasses"];
|
|
10
11
|
gothamMapping?: SharedPropertyTypeGothamMapping;
|
|
11
12
|
}): SharedPropertyType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSpt.d.ts","sourceRoot":"","sources":["../../../src/api/defineSpt.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"defineSpt.d.ts","sourceRoot":"","sources":["../../../src/api/defineSpt.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,yBAAyB,EACzB,+BAA+B,EAChC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAOvE,wBAAgB,wBAAwB,CACtC,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC,WAAW,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,+BAA+B,CAAC;CACjD,GACA,kBAAkB,CAapB"}
|