@osdk/maker 0.14.0-beta.11 → 0.14.0-beta.13
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 +21 -0
- package/build/browser/api/code-snippets/createCodeSnippets.js +7 -4
- package/build/browser/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/browser/api/code-snippets/snippetTypes.js +1 -0
- package/build/browser/api/code-snippets/snippetTypes.js.map +1 -1
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
- package/build/browser/api/test/spt.test.js +204 -105
- package/build/browser/api/test/spt.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +19 -7
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/cjs/index.cjs +27 -11
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +11 -4
- package/build/esm/api/code-snippets/createCodeSnippets.js +7 -4
- package/build/esm/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/esm/api/code-snippets/snippetTypes.js +1 -0
- package/build/esm/api/code-snippets/snippetTypes.js.map +1 -1
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
- package/build/esm/api/test/spt.test.js +204 -105
- package/build/esm/api/test/spt.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +19 -7
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/types/api/code-snippets/createCodeSnippets.d.ts.map +1 -1
- package/build/types/api/code-snippets/snippetTypes.d.ts +1 -0
- package/build/types/api/code-snippets/snippetTypes.d.ts.map +1 -1
- package/build/types/api/properties/PropertyTypeType.d.ts +11 -4
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @osdk/maker
|
|
2
2
|
|
|
3
|
+
## 0.14.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9ddb3b4: Update snippet names and get latest template
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [b307201]
|
|
12
|
+
- @osdk/api@2.6.0-beta.9
|
|
13
|
+
|
|
14
|
+
## 0.14.0-beta.12
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 5e4aabd: Add decimal property type customizations
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- @osdk/api@2.6.0-beta.7
|
|
23
|
+
|
|
3
24
|
## 0.14.0-beta.11
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -20,7 +20,7 @@ import * as fs from "fs";
|
|
|
20
20
|
import Mustache from "mustache";
|
|
21
21
|
import * as path from "path";
|
|
22
22
|
import { OntologyEntityTypeEnum } from "../common/OntologyEntityTypeEnum.js";
|
|
23
|
-
import { actionSnippets, interfaceSnippets, objectSnippets } from "./snippetTypes.js";
|
|
23
|
+
import { actionSnippets, interfaceSnippets, objectSnippets, snippetNameMapping } from "./snippetTypes.js";
|
|
24
24
|
export function createCodeSnippets(ontology, packageName, outputDir) {
|
|
25
25
|
if (outputDir === undefined) {
|
|
26
26
|
outputDir = "./code-snippets";
|
|
@@ -60,7 +60,8 @@ function generateInterfaceSnippet(interfaceType, packageName) {
|
|
|
60
60
|
"interfaceApiName": interfaceType.apiName,
|
|
61
61
|
"packageName": packageName,
|
|
62
62
|
"objectOrInterfaceApiName": interfaceType.apiName,
|
|
63
|
-
"propertyNames": Object.keys(interfaceType.propertiesV2)
|
|
63
|
+
"propertyNames": Object.keys(interfaceType.propertiesV2),
|
|
64
|
+
"interfaceName": interfaceType.displayMetadata.displayName
|
|
64
65
|
};
|
|
65
66
|
return getSnippets(interfaceSnippets, interfaceContext);
|
|
66
67
|
}
|
|
@@ -82,9 +83,11 @@ function generateActionSnippet(actionType, packageName) {
|
|
|
82
83
|
function getSnippets(snippetType, context) {
|
|
83
84
|
const allSnippets = {};
|
|
84
85
|
for (const templateName of Object.keys(snippetType).filter(key => isNaN(Number(key)))) {
|
|
85
|
-
const
|
|
86
|
+
const versions = Object.values(TYPESCRIPT_OSDK_SNIPPETS.versions);
|
|
87
|
+
const latestTemplate = versions.slice().reverse().find(v => v.snippets[templateName])?.snippets[templateName].at(-1)?.template ?? "";
|
|
86
88
|
const renderedTemplate = Mustache.render(latestTemplate, context);
|
|
87
|
-
|
|
89
|
+
const snippetName = snippetNameMapping.get(templateName);
|
|
90
|
+
allSnippets[snippetName !== undefined ? Mustache.render(snippetName, context) : templateName] = renderedTemplate;
|
|
88
91
|
}
|
|
89
92
|
return allSnippets;
|
|
90
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCodeSnippets.js","names":["TYPESCRIPT_OSDK_SNIPPETS","consola","fs","Mustache","path","OntologyEntityTypeEnum","actionSnippets","interfaceSnippets","objectSnippets","createCodeSnippets","ontology","packageName","outputDir","undefined","existsSync","mkdirSync","recursive","info","type","Object","values","object","snippet","OBJECT_TYPE","generateObjectSnippet","ACTION_TYPE","generateActionSnippet","INTERFACE_TYPE","generateInterfaceSnippet","writeFileSync","join","apiName","JSON","stringify","interfaceType","interfaceContext","keys","propertiesV2","getSnippets","objectType","objectContext","actionType","actionContext","snippetType","context","allSnippets","templateName","filter","key","isNaN","Number","latestTemplate","
|
|
1
|
+
{"version":3,"file":"createCodeSnippets.js","names":["TYPESCRIPT_OSDK_SNIPPETS","consola","fs","Mustache","path","OntologyEntityTypeEnum","actionSnippets","interfaceSnippets","objectSnippets","snippetNameMapping","createCodeSnippets","ontology","packageName","outputDir","undefined","existsSync","mkdirSync","recursive","info","type","Object","values","object","snippet","OBJECT_TYPE","generateObjectSnippet","ACTION_TYPE","generateActionSnippet","INTERFACE_TYPE","generateInterfaceSnippet","writeFileSync","join","apiName","JSON","stringify","interfaceType","interfaceContext","keys","propertiesV2","displayMetadata","displayName","getSnippets","objectType","objectContext","actionType","actionContext","snippetType","context","allSnippets","templateName","filter","key","isNaN","Number","versions","latestTemplate","slice","reverse","find","v","snippets","at","template","renderedTemplate","render","snippetName","get"],"sources":["createCodeSnippets.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { TYPESCRIPT_OSDK_SNIPPETS } from \"@osdk/typescript-sdk-docs\";\nimport { consola } from \"consola\";\nimport * as fs from \"fs\";\nimport Mustache from \"mustache\";\nimport * as path from \"path\";\nimport type { ActionType } from \"../action/ActionType.js\";\nimport type { OntologyDefinition } from \"../common/OntologyDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { InterfaceType } from \"../interface/InterfaceType.js\";\nimport type { ObjectType } from \"../object/ObjectType.js\";\nimport {\n actionSnippets,\n interfaceSnippets,\n objectSnippets,\n snippetNameMapping,\n} from \"./snippetTypes.js\";\n\nexport function createCodeSnippets(\n ontology: OntologyDefinition,\n packageName: string | undefined,\n outputDir: string | undefined,\n): void {\n if (outputDir === undefined) {\n outputDir = \"./code-snippets\";\n }\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n if (packageName === undefined) {\n packageName = \"\";\n }\n consola.info(\"Generating code snippets to \", outputDir);\n for (const type of Object.values(OntologyEntityTypeEnum)) {\n for (const object of Object.values(ontology[type])) {\n let snippet = {};\n switch (type) {\n case OntologyEntityTypeEnum.OBJECT_TYPE:\n snippet = generateObjectSnippet(object, packageName);\n break;\n case OntologyEntityTypeEnum.ACTION_TYPE:\n snippet = generateActionSnippet(object, packageName);\n break;\n case OntologyEntityTypeEnum.INTERFACE_TYPE:\n snippet = generateInterfaceSnippet(object, packageName);\n break;\n default:\n continue;\n }\n fs.writeFileSync(\n path.join(outputDir, object.apiName),\n JSON.stringify(snippet),\n );\n }\n }\n consola.info(\"Finished Code Snippet Generation\");\n}\n\nfunction generateInterfaceSnippet(\n interfaceType: InterfaceType,\n packageName: string,\n) {\n const interfaceContext = {\n \"interfaceApiName\": interfaceType.apiName,\n \"packageName\": packageName,\n \"objectOrInterfaceApiName\": interfaceType.apiName,\n \"propertyNames\": Object.keys(interfaceType.propertiesV2),\n \"interfaceName\": interfaceType.displayMetadata.displayName,\n };\n\n return getSnippets(interfaceSnippets, interfaceContext);\n}\n\nfunction generateObjectSnippet(objectType: ObjectType, packageName: string) {\n const objectContext = {\n \"objectType\": objectType.apiName,\n \"packageName\": packageName,\n \"objectOrInterfaceApiName\": objectType.apiName,\n };\n return getSnippets(objectSnippets, objectContext);\n}\n\nfunction generateActionSnippet(actionType: ActionType, packageName: string) {\n const actionContext = {\n \"actionApiName\": actionType.apiName,\n \"packageName\": packageName,\n };\n return getSnippets(actionSnippets, actionContext);\n}\n\nfunction getSnippets(\n snippetType:\n | typeof interfaceSnippets\n | typeof actionSnippets\n | typeof objectSnippets,\n context: {},\n) {\n const allSnippets = {};\n for (\n const templateName of Object.keys(snippetType).filter(key =>\n isNaN(Number(key))\n )\n ) {\n const versions = Object.values(TYPESCRIPT_OSDK_SNIPPETS.versions);\n const latestTemplate = versions\n .slice()\n .reverse()\n .find(v => v.snippets[templateName])\n ?.snippets[templateName]\n .at(-1)?.template ?? \"\";\n const renderedTemplate = Mustache.render(latestTemplate, context);\n const snippetName = snippetNameMapping.get(templateName);\n\n (allSnippets as any)[\n snippetName !== undefined\n ? Mustache.render(snippetName, context)\n : templateName\n ] = renderedTemplate;\n }\n return allSnippets;\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -57,4 +57,5 @@ export let objectSnippets = /*#__PURE__*/function (objectSnippets) {
|
|
|
57
57
|
objectSnippets[objectSnippets["subscribeToObjectSetInstructions"] = 8] = "subscribeToObjectSetInstructions";
|
|
58
58
|
return objectSnippets;
|
|
59
59
|
}({});
|
|
60
|
+
export const snippetNameMapping = new Map([["loadInterfaceMetadataSnippet", "Load {{interfaceName}} metadata"], ["loadInterfacesReference", "Load pages of {{interfaceName}}"], ["loadAllInterfacesReference", "Load all {{interfaceName}}"], ["loadOrderedInterfacesReference", "Load ordered {{interfaceName}}"], ["searchInterfacesReference", "Filtering"], ["subscribeToObjectSetInstructions", "Subscribe to object sets"]]);
|
|
60
61
|
//# sourceMappingURL=snippetTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippetTypes.js","names":["interfaceSnippets","actionSnippets","objectSnippets"],"sources":["snippetTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 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\nexport enum interfaceSnippets {\n loadInterfacesReference,\n loadAllInterfacesReference,\n loadOrderedInterfacesReference,\n searchInterfacesReference,\n loadInterfaceMetadataSnippet,\n subscribeToObjectSetInstructions,\n}\n\nexport enum actionSnippets {\n applyAction,\n batchApplyAction,\n}\n\nexport enum objectSnippets {\n loadSingleObjectGuide,\n loadObjectsReference,\n loadAllObjectsReference,\n loadOrderedInterfacesReference, // what\n searchObjectsGuide, // There's specific search queries under this one too, but a little verbose\n aggregationTemplate,\n /* Types of aggregation + group bys\n approximateDistinctAggregationTemplate,\n exactDistinctAggregationTemplate,\n numericAggregationTemplate,\n countAggregationTemplate,\n fixedWidthGroupByTemplate,\n durationGroupByTemplate,\n exactGroupByTemplate,\n rangeGroupByTemplate,\n */\n objectSetOperationsGuide,\n /* Types of set operations\n objectSetOperationsUnion,\n objectSetOperationsSubtract,\n objectSetOperationsIntersect,\n */\n loadObjectMetadataSnippet,\n subscribeToObjectSetInstructions,\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAS7B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAK1B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAIQ;EAJtBA,cAAc,CAAdA,cAAc;EAKJ;EALVA,cAAc,CAAdA,cAAc;EAOxB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAhBYA,cAAc,CAAdA,cAAc;EAkBxB;AACF;AACA;AACA;AACA;EAtBYA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"snippetTypes.js","names":["interfaceSnippets","actionSnippets","objectSnippets","snippetNameMapping","Map"],"sources":["snippetTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 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\nexport enum interfaceSnippets {\n loadInterfacesReference,\n loadAllInterfacesReference,\n loadOrderedInterfacesReference,\n searchInterfacesReference,\n loadInterfaceMetadataSnippet,\n subscribeToObjectSetInstructions,\n}\n\nexport enum actionSnippets {\n applyAction,\n batchApplyAction,\n}\n\nexport enum objectSnippets {\n loadSingleObjectGuide,\n loadObjectsReference,\n loadAllObjectsReference,\n loadOrderedInterfacesReference, // what\n searchObjectsGuide, // There's specific search queries under this one too, but a little verbose\n aggregationTemplate,\n /* Types of aggregation + group bys\n approximateDistinctAggregationTemplate,\n exactDistinctAggregationTemplate,\n numericAggregationTemplate,\n countAggregationTemplate,\n fixedWidthGroupByTemplate,\n durationGroupByTemplate,\n exactGroupByTemplate,\n rangeGroupByTemplate,\n */\n objectSetOperationsGuide,\n /* Types of set operations\n objectSetOperationsUnion,\n objectSetOperationsSubtract,\n objectSetOperationsIntersect,\n */\n loadObjectMetadataSnippet,\n subscribeToObjectSetInstructions,\n}\n\nexport const snippetNameMapping: Map<string, string> = new Map<string, string>([\n [\"loadInterfaceMetadataSnippet\", \"Load {{interfaceName}} metadata\"],\n [\"loadInterfacesReference\", \"Load pages of {{interfaceName}}\"],\n [\"loadAllInterfacesReference\", \"Load all {{interfaceName}}\"],\n [\"loadOrderedInterfacesReference\", \"Load ordered {{interfaceName}}\"],\n [\"searchInterfacesReference\", \"Filtering\"],\n [\"subscribeToObjectSetInstructions\", \"Subscribe to object sets\"],\n]);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAS7B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAK1B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAIQ;EAJtBA,cAAc,CAAdA,cAAc;EAKJ;EALVA,cAAc,CAAdA,cAAc;EAOxB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAhBYA,cAAc,CAAdA,cAAc;EAkBxB;AACF;AACA;AACA;AACA;EAtBYA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AA2B1B,OAAO,MAAMC,kBAAuC,GAAG,IAAIC,GAAG,CAAiB,CAC7E,CAAC,8BAA8B,EAAE,iCAAiC,CAAC,EACnE,CAAC,yBAAyB,EAAE,iCAAiC,CAAC,EAC9D,CAAC,4BAA4B,EAAE,4BAA4B,CAAC,EAC5D,CAAC,gCAAgC,EAAE,gCAAgC,CAAC,EACpE,CAAC,2BAA2B,EAAE,WAAW,CAAC,EAC1C,CAAC,kCAAkC,EAAE,0BAA0B,CAAC,CACjE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct"],"sources":["PropertyTypeType.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type { StructFieldType } from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText
|
|
1
|
+
{"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct"],"sources":["PropertyTypeType.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type { StructFieldType } from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString\n | PropertyTypeTypeDecimal;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, PropertyTypeTypeMarking>;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText?: boolean;\n supportsEfficientLeadingWildcard?: boolean;\n supportsExactMatching?: boolean;\n supportsFullTextRegex?: boolean;\n enableAsciiFolding?: boolean;\n};\n\ntype PropertyTypeTypeDecimal = {\n type: \"decimal\";\n precision?: number;\n scale?: number;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\nexport function isPropertyTypeType(\n v: PropertyTypeType,\n): v is PropertyTypeType {\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\"\n || (typeof v === \"object\" && v.type === \"marking\")\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\nexport function isExotic(\n type: PropertyTypeType | undefined,\n): type is PropertyTypeTypeExotic {\n if (type === undefined) {\n return false;\n }\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return type.type === \"marking\" || type.type === \"struct\";\n }\n return false;\n}\nexport function isStruct(\n type: PropertyTypeType,\n): type is PropertyTypeTypeStruct {\n return typeof type === \"object\" && type.type === \"struct\";\n}\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiEA,OAAO,SAASA,kBAAkBA,CAChCC,CAAmB,EACI;EACvB,OAAOA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IACjCA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,QAAQ,IACjDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,UAAU,IAAIA,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAC9B,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACC,IAAI,KAAK,SAAU,IAC/CD,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AACxB;AACA,OAAO,SAASE,QAAQA,CACtBD,IAAkC,EACF;EAChC,IAAIA,IAAI,KAAKE,SAAS,EAAE;IACtB,OAAO,KAAK;EACd;EACA,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAACG,QAAQ,CACzEH,IACF,CAAC;EACH,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,IAAI,IAAI,EAAE;IACnD,OAAOA,IAAI,CAACA,IAAI,KAAK,SAAS,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;EAC1D;EACA,OAAO,KAAK;AACd;AACA,OAAO,SAASI,QAAQA,CACtBJ,IAAsB,EACU;EAChC,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;AAC3D","ignoreList":[]}
|
|
@@ -267,121 +267,220 @@ describe("SPTs", () => {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
},
|
|
289
|
-
"type": "blueprint",
|
|
290
|
-
},
|
|
270
|
+
{
|
|
271
|
+
"actionTypes": {},
|
|
272
|
+
"blockPermissionInformation": {
|
|
273
|
+
"actionTypes": {},
|
|
274
|
+
"linkTypes": {},
|
|
275
|
+
"objectTypes": {},
|
|
276
|
+
},
|
|
277
|
+
"interfaceTypes": {
|
|
278
|
+
"com.palantir.interface": {
|
|
279
|
+
"interfaceType": {
|
|
280
|
+
"apiName": "com.palantir.interface",
|
|
281
|
+
"displayMetadata": {
|
|
282
|
+
"description": "interface",
|
|
283
|
+
"displayName": "interface",
|
|
284
|
+
"icon": {
|
|
285
|
+
"blueprint": {
|
|
286
|
+
"color": "#4C90F0",
|
|
287
|
+
"locator": "layout-hierarchy",
|
|
291
288
|
},
|
|
292
|
-
"
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
"
|
|
321
|
-
{
|
|
322
|
-
"kind": "render_hint",
|
|
323
|
-
"name": "SELECTABLE",
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"kind": "render_hint",
|
|
327
|
-
"name": "SORTABLE",
|
|
328
|
-
},
|
|
329
|
-
],
|
|
330
|
-
"valueType": undefined,
|
|
289
|
+
"type": "blueprint",
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
"extendsInterfaces": [],
|
|
293
|
+
"links": [],
|
|
294
|
+
"properties": [],
|
|
295
|
+
"propertiesV2": {
|
|
296
|
+
"com.palantir.foo": {
|
|
297
|
+
"required": true,
|
|
298
|
+
"sharedPropertyType": {
|
|
299
|
+
"aliases": [],
|
|
300
|
+
"apiName": "com.palantir.foo",
|
|
301
|
+
"baseFormatter": undefined,
|
|
302
|
+
"dataConstraints": undefined,
|
|
303
|
+
"displayMetadata": {
|
|
304
|
+
"description": undefined,
|
|
305
|
+
"displayName": "foo",
|
|
306
|
+
"visibility": "NORMAL",
|
|
307
|
+
},
|
|
308
|
+
"gothamMapping": undefined,
|
|
309
|
+
"indexedForSearch": true,
|
|
310
|
+
"type": {
|
|
311
|
+
"string": {
|
|
312
|
+
"analyzerOverride": undefined,
|
|
313
|
+
"enableAsciiFolding": undefined,
|
|
314
|
+
"isLongText": true,
|
|
315
|
+
"supportsEfficientLeadingWildcard": true,
|
|
316
|
+
"supportsExactMatching": false,
|
|
317
|
+
"supportsFullTextRegex": undefined,
|
|
331
318
|
},
|
|
319
|
+
"type": "string",
|
|
332
320
|
},
|
|
321
|
+
"typeClasses": [
|
|
322
|
+
{
|
|
323
|
+
"kind": "render_hint",
|
|
324
|
+
"name": "SELECTABLE",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"kind": "render_hint",
|
|
328
|
+
"name": "SORTABLE",
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
"valueType": undefined,
|
|
333
332
|
},
|
|
334
|
-
"propertiesV3": {},
|
|
335
|
-
"searchable": true,
|
|
336
|
-
"status": {
|
|
337
|
-
"active": {},
|
|
338
|
-
"type": "active",
|
|
339
|
-
},
|
|
340
333
|
},
|
|
341
334
|
},
|
|
335
|
+
"propertiesV3": {},
|
|
336
|
+
"searchable": true,
|
|
337
|
+
"status": {
|
|
338
|
+
"active": {},
|
|
339
|
+
"type": "active",
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
"linkTypes": {},
|
|
345
|
+
"objectTypes": {},
|
|
346
|
+
"sharedPropertyTypes": {
|
|
347
|
+
"com.palantir.foo": {
|
|
348
|
+
"sharedPropertyType": {
|
|
349
|
+
"aliases": [],
|
|
350
|
+
"apiName": "com.palantir.foo",
|
|
351
|
+
"baseFormatter": undefined,
|
|
352
|
+
"dataConstraints": undefined,
|
|
353
|
+
"displayMetadata": {
|
|
354
|
+
"description": undefined,
|
|
355
|
+
"displayName": "foo",
|
|
356
|
+
"visibility": "NORMAL",
|
|
357
|
+
},
|
|
358
|
+
"gothamMapping": undefined,
|
|
359
|
+
"indexedForSearch": true,
|
|
360
|
+
"type": {
|
|
361
|
+
"string": {
|
|
362
|
+
"analyzerOverride": undefined,
|
|
363
|
+
"enableAsciiFolding": undefined,
|
|
364
|
+
"isLongText": true,
|
|
365
|
+
"supportsEfficientLeadingWildcard": true,
|
|
366
|
+
"supportsExactMatching": false,
|
|
367
|
+
"supportsFullTextRegex": undefined,
|
|
368
|
+
},
|
|
369
|
+
"type": "string",
|
|
370
|
+
},
|
|
371
|
+
"typeClasses": [
|
|
372
|
+
{
|
|
373
|
+
"kind": "render_hint",
|
|
374
|
+
"name": "SELECTABLE",
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"kind": "render_hint",
|
|
378
|
+
"name": "SORTABLE",
|
|
379
|
+
},
|
|
380
|
+
],
|
|
381
|
+
"valueType": undefined,
|
|
342
382
|
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
`);
|
|
387
|
+
});
|
|
388
|
+
it("Custom decimal fields properly set", () => {
|
|
389
|
+
defineSharedPropertyType({
|
|
390
|
+
apiName: "precision",
|
|
391
|
+
type: {
|
|
392
|
+
type: "decimal",
|
|
393
|
+
precision: 10
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
defineSharedPropertyType({
|
|
397
|
+
apiName: "scale",
|
|
398
|
+
type: {
|
|
399
|
+
type: "decimal",
|
|
400
|
+
scale: 5
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
404
|
+
{
|
|
405
|
+
"actionTypes": {},
|
|
406
|
+
"blockPermissionInformation": {
|
|
407
|
+
"actionTypes": {},
|
|
408
|
+
"linkTypes": {},
|
|
409
|
+
"objectTypes": {},
|
|
410
|
+
},
|
|
411
|
+
"interfaceTypes": {},
|
|
412
|
+
"linkTypes": {},
|
|
413
|
+
"objectTypes": {},
|
|
414
|
+
"sharedPropertyTypes": {
|
|
415
|
+
"com.palantir.precision": {
|
|
416
|
+
"sharedPropertyType": {
|
|
417
|
+
"aliases": [],
|
|
418
|
+
"apiName": "com.palantir.precision",
|
|
419
|
+
"baseFormatter": undefined,
|
|
420
|
+
"dataConstraints": undefined,
|
|
421
|
+
"displayMetadata": {
|
|
422
|
+
"description": undefined,
|
|
423
|
+
"displayName": "precision",
|
|
424
|
+
"visibility": "NORMAL",
|
|
425
|
+
},
|
|
426
|
+
"gothamMapping": undefined,
|
|
427
|
+
"indexedForSearch": true,
|
|
428
|
+
"type": {
|
|
429
|
+
"decimal": {
|
|
430
|
+
"precision": 10,
|
|
431
|
+
"scale": undefined,
|
|
380
432
|
},
|
|
433
|
+
"type": "decimal",
|
|
381
434
|
},
|
|
435
|
+
"typeClasses": [
|
|
436
|
+
{
|
|
437
|
+
"kind": "render_hint",
|
|
438
|
+
"name": "SELECTABLE",
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"kind": "render_hint",
|
|
442
|
+
"name": "SORTABLE",
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
"valueType": undefined,
|
|
382
446
|
},
|
|
383
|
-
}
|
|
384
|
-
|
|
447
|
+
},
|
|
448
|
+
"com.palantir.scale": {
|
|
449
|
+
"sharedPropertyType": {
|
|
450
|
+
"aliases": [],
|
|
451
|
+
"apiName": "com.palantir.scale",
|
|
452
|
+
"baseFormatter": undefined,
|
|
453
|
+
"dataConstraints": undefined,
|
|
454
|
+
"displayMetadata": {
|
|
455
|
+
"description": undefined,
|
|
456
|
+
"displayName": "scale",
|
|
457
|
+
"visibility": "NORMAL",
|
|
458
|
+
},
|
|
459
|
+
"gothamMapping": undefined,
|
|
460
|
+
"indexedForSearch": true,
|
|
461
|
+
"type": {
|
|
462
|
+
"decimal": {
|
|
463
|
+
"precision": undefined,
|
|
464
|
+
"scale": 5,
|
|
465
|
+
},
|
|
466
|
+
"type": "decimal",
|
|
467
|
+
},
|
|
468
|
+
"typeClasses": [
|
|
469
|
+
{
|
|
470
|
+
"kind": "render_hint",
|
|
471
|
+
"name": "SELECTABLE",
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"kind": "render_hint",
|
|
475
|
+
"name": "SORTABLE",
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
"valueType": undefined,
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
}
|
|
483
|
+
`);
|
|
385
484
|
});
|
|
386
485
|
});
|
|
387
486
|
//# sourceMappingURL=spt.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spt.test.js","names":["beforeEach","describe","expect","it","defineInterface","defineOntology","dumpOntologyFullMetadata","defineSharedPropertyType","apiName","type","toThrowErrorMatchingInlineSnapshot","fooSpt","displayName","properties","icon","color","locator","ontology","toMatchInlineSnapshot","structDefinition","fieldType","displayMetadata","description","undefined","spt","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","foo"],"sources":["spt.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { beforeEach, describe, expect, it } from \"vitest\";\nimport { defineInterface } from \"../defineInterface.js\";\nimport { defineOntology, dumpOntologyFullMetadata } from \"../defineOntology.js\";\nimport { defineSharedPropertyType } from \"../defineSpt.js\";\ndescribe(\"SPTs\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n it(\"doesn't let you create the same spt twice\", () => {\n defineSharedPropertyType({\n apiName: \"foo\",\n type: \"string\",\n });\n\n expect(() => {\n defineSharedPropertyType({\n apiName: \"foo\",\n type: \"string\",\n });\n }).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invariant failed: Shared property type com.palantir.foo already exists]`,\n );\n });\n\n it(\"uses a predefined spt\", () => {\n const fooSpt = defineSharedPropertyType({\n apiName: \"fooSpt\",\n type: \"string\",\n });\n\n const FooInterface = defineInterface({\n apiName: \"FooInterface\",\n displayName: \"Foo Interface\",\n properties: {\n fooSpt,\n },\n icon: { color: \"#00000\", locator: \"airplane\" },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.FooInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.FooInterface\",\n \"displayMetadata\": {\n \"description\": \"Foo Interface\",\n \"displayName\": \"Foo Interface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#00000\",\n \"locator\": \"airplane\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.fooSpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.fooSpt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n\n it(\"properly serializes both types of struct SPTs\", () => {\n const fooSpt = defineSharedPropertyType({\n apiName: \"fooSpt\",\n type: {\n type: \"struct\",\n structDefinition: {\n \"simpleProperty\": \"boolean\",\n \"complexProperty\": {\n fieldType: \"date\",\n displayMetadata: {\n displayName: \"complex property\",\n description: undefined,\n },\n },\n },\n },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.fooSpt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"struct\": {\n \"structFields\": [\n {\n \"aliases\": [],\n \"apiName\": \"simpleProperty\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"simpleProperty\",\n },\n \"fieldType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"typeClasses\": [],\n },\n {\n \"aliases\": [],\n \"apiName\": \"complexProperty\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"complex property\",\n },\n \"fieldType\": {\n \"date\": {},\n \"type\": \"date\",\n },\n \"typeClasses\": [],\n },\n ],\n },\n \"type\": \"struct\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n\n it(\"Custom string fields properly set\", () => {\n const spt = defineSharedPropertyType({\n apiName: \"foo\",\n type: {\n type: \"string\",\n isLongText: true,\n supportsEfficientLeadingWildcard: true,\n supportsExactMatching: false,\n },\n });\n\n defineInterface({\n apiName: \"interface\",\n properties: { foo: spt },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.interface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.interface\",\n \"displayMetadata\": {\n \"description\": \"interface\",\n \"displayName\": \"interface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.foo\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.foo\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"foo\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": true,\n \"supportsEfficientLeadingWildcard\": true,\n \"supportsExactMatching\": false,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.foo\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.foo\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"foo\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": true,\n \"supportsEfficientLeadingWildcard\": true,\n \"supportsExactMatching\": false,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,sBAAsB;AAC/E,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1DN,QAAQ,CAAC,MAAM,EAAE,MAAM;EACrBD,UAAU,CAAC,YAAY;IACrB,MAAMK,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFF,EAAE,CAAC,2CAA2C,EAAE,MAAM;IACpDI,wBAAwB,CAAC;MACvBC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACR,CAAC,CAAC;IAEFP,MAAM,CAAC,MAAM;MACXK,wBAAwB,CAAC;QACvBC,OAAO,EAAE,KAAK;QACdC,IAAI,EAAE;MACR,CAAC,CAAC;IACJ,CAAC,CAAC,CAACC,kCAAkC,CACnC,iFACF,CAAC;EACH,CAAC,CAAC;EAEFP,EAAE,CAAC,uBAAuB,EAAE,MAAM;IAChC,MAAMQ,MAAM,GAAGJ,wBAAwB,CAAC;MACtCC,OAAO,EAAE,QAAQ;MACjBC,IAAI,EAAE;IACR,CAAC,CAAC;IAEmBL,eAAe,CAAC;MACnCI,OAAO,EAAE,cAAc;MACvBI,WAAW,EAAE,eAAe;MAC5BC,UAAU,EAAE;QACVF;MACF,CAAC;MACDG,IAAI,EAAE;QAAEC,KAAK,EAAE,QAAQ;QAAEC,OAAO,EAAE;MAAW;IAC/C,CAAC,CAAC;IAEFd,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC;EACR,CAAC,CAAC;EAEFf,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACzCI,wBAAwB,CAAC;MACtCC,OAAO,EAAE,QAAQ;MACjBC,IAAI,EAAE;QACJA,IAAI,EAAE,QAAQ;QACdU,gBAAgB,EAAE;UAChB,gBAAgB,EAAE,SAAS;UAC3B,iBAAiB,EAAE;YACjBC,SAAS,EAAE,MAAM;YACjBC,eAAe,EAAE;cACfT,WAAW,EAAE,kBAAkB;cAC/BU,WAAW,EAAEC;YACf;UACF;QACF;MACF;IACF,CAAC,CAAC;IAEFrB,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,CAAC;EACV,CAAC,CAAC;EAEFf,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAMqB,GAAG,GAAGjB,wBAAwB,CAAC;MACnCC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;QACJA,IAAI,EAAE,QAAQ;QACdgB,UAAU,EAAE,IAAI;QAChBC,gCAAgC,EAAE,IAAI;QACtCC,qBAAqB,EAAE;MACzB;IACF,CAAC,CAAC;IAEFvB,eAAe,CAAC;MACdI,OAAO,EAAE,WAAW;MACpBK,UAAU,EAAE;QAAEe,GAAG,EAAEJ;MAAI;IACzB,CAAC,CAAC;IAEFtB,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC;EACR,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"spt.test.js","names":["beforeEach","describe","expect","it","defineInterface","defineOntology","dumpOntologyFullMetadata","defineSharedPropertyType","apiName","type","toThrowErrorMatchingInlineSnapshot","fooSpt","displayName","properties","icon","color","locator","ontology","toMatchInlineSnapshot","structDefinition","fieldType","displayMetadata","description","undefined","spt","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","foo","precision","scale"],"sources":["spt.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { beforeEach, describe, expect, it } from \"vitest\";\nimport { defineInterface } from \"../defineInterface.js\";\nimport { defineOntology, dumpOntologyFullMetadata } from \"../defineOntology.js\";\nimport { defineSharedPropertyType } from \"../defineSpt.js\";\ndescribe(\"SPTs\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n it(\"doesn't let you create the same spt twice\", () => {\n defineSharedPropertyType({\n apiName: \"foo\",\n type: \"string\",\n });\n\n expect(() => {\n defineSharedPropertyType({\n apiName: \"foo\",\n type: \"string\",\n });\n }).toThrowErrorMatchingInlineSnapshot(\n `[Error: Invariant failed: Shared property type com.palantir.foo already exists]`,\n );\n });\n\n it(\"uses a predefined spt\", () => {\n const fooSpt = defineSharedPropertyType({\n apiName: \"fooSpt\",\n type: \"string\",\n });\n\n const FooInterface = defineInterface({\n apiName: \"FooInterface\",\n displayName: \"Foo Interface\",\n properties: {\n fooSpt,\n },\n icon: { color: \"#00000\", locator: \"airplane\" },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.FooInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.FooInterface\",\n \"displayMetadata\": {\n \"description\": \"Foo Interface\",\n \"displayName\": \"Foo Interface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#00000\",\n \"locator\": \"airplane\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.fooSpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.fooSpt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n\n it(\"properly serializes both types of struct SPTs\", () => {\n const fooSpt = defineSharedPropertyType({\n apiName: \"fooSpt\",\n type: {\n type: \"struct\",\n structDefinition: {\n \"simpleProperty\": \"boolean\",\n \"complexProperty\": {\n fieldType: \"date\",\n displayMetadata: {\n displayName: \"complex property\",\n description: undefined,\n },\n },\n },\n },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.fooSpt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.fooSpt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"fooSpt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"struct\": {\n \"structFields\": [\n {\n \"aliases\": [],\n \"apiName\": \"simpleProperty\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"simpleProperty\",\n },\n \"fieldType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"typeClasses\": [],\n },\n {\n \"aliases\": [],\n \"apiName\": \"complexProperty\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"complex property\",\n },\n \"fieldType\": {\n \"date\": {},\n \"type\": \"date\",\n },\n \"typeClasses\": [],\n },\n ],\n },\n \"type\": \"struct\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n\n it(\"Custom string fields properly set\", () => {\n const spt = defineSharedPropertyType({\n apiName: \"foo\",\n type: {\n type: \"string\",\n isLongText: true,\n supportsEfficientLeadingWildcard: true,\n supportsExactMatching: false,\n },\n });\n\n defineInterface({\n apiName: \"interface\",\n properties: { foo: spt },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.interface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.interface\",\n \"displayMetadata\": {\n \"description\": \"interface\",\n \"displayName\": \"interface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.foo\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.foo\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"foo\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": true,\n \"supportsEfficientLeadingWildcard\": true,\n \"supportsExactMatching\": false,\n \"supportsFullTextRegex\": undefined,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.foo\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.foo\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"foo\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": true,\n \"supportsEfficientLeadingWildcard\": true,\n \"supportsExactMatching\": false,\n \"supportsFullTextRegex\": undefined,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n\n it(\"Custom decimal fields properly set\", () => {\n const spt1 = defineSharedPropertyType({\n apiName: \"precision\",\n type: {\n type: \"decimal\",\n precision: 10,\n },\n });\n const spt2 = defineSharedPropertyType({\n apiName: \"scale\",\n type: {\n type: \"decimal\",\n scale: 5,\n },\n });\n\n expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`\n {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.precision\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.precision\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"precision\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"decimal\": {\n \"precision\": 10,\n \"scale\": undefined,\n },\n \"type\": \"decimal\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"com.palantir.scale\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.scale\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"scale\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"decimal\": {\n \"precision\": undefined,\n \"scale\": 5,\n },\n \"type\": \"decimal\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,sBAAsB;AAC/E,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1DN,QAAQ,CAAC,MAAM,EAAE,MAAM;EACrBD,UAAU,CAAC,YAAY;IACrB,MAAMK,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFF,EAAE,CAAC,2CAA2C,EAAE,MAAM;IACpDI,wBAAwB,CAAC;MACvBC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACR,CAAC,CAAC;IAEFP,MAAM,CAAC,MAAM;MACXK,wBAAwB,CAAC;QACvBC,OAAO,EAAE,KAAK;QACdC,IAAI,EAAE;MACR,CAAC,CAAC;IACJ,CAAC,CAAC,CAACC,kCAAkC,CACnC,iFACF,CAAC;EACH,CAAC,CAAC;EAEFP,EAAE,CAAC,uBAAuB,EAAE,MAAM;IAChC,MAAMQ,MAAM,GAAGJ,wBAAwB,CAAC;MACtCC,OAAO,EAAE,QAAQ;MACjBC,IAAI,EAAE;IACR,CAAC,CAAC;IAEmBL,eAAe,CAAC;MACnCI,OAAO,EAAE,cAAc;MACvBI,WAAW,EAAE,eAAe;MAC5BC,UAAU,EAAE;QACVF;MACF,CAAC;MACDG,IAAI,EAAE;QAAEC,KAAK,EAAE,QAAQ;QAAEC,OAAO,EAAE;MAAW;IAC/C,CAAC,CAAC;IAEFd,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,CAAC;EACR,CAAC,CAAC;EAEFf,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACzCI,wBAAwB,CAAC;MACtCC,OAAO,EAAE,QAAQ;MACjBC,IAAI,EAAE;QACJA,IAAI,EAAE,QAAQ;QACdU,gBAAgB,EAAE;UAChB,gBAAgB,EAAE,SAAS;UAC3B,iBAAiB,EAAE;YACjBC,SAAS,EAAE,MAAM;YACjBC,eAAe,EAAE;cACfT,WAAW,EAAE,kBAAkB;cAC/BU,WAAW,EAAEC;YACf;UACF;QACF;MACF;IACF,CAAC,CAAC;IAEFrB,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,CAAC;EACV,CAAC,CAAC;EAEFf,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAMqB,GAAG,GAAGjB,wBAAwB,CAAC;MACnCC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;QACJA,IAAI,EAAE,QAAQ;QACdgB,UAAU,EAAE,IAAI;QAChBC,gCAAgC,EAAE,IAAI;QACtCC,qBAAqB,EAAE;MACzB;IACF,CAAC,CAAC;IAEFvB,eAAe,CAAC;MACdI,OAAO,EAAE,WAAW;MACpBK,UAAU,EAAE;QAAEe,GAAG,EAAEJ;MAAI;IACzB,CAAC,CAAC;IAEFtB,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFf,EAAE,CAAC,oCAAoC,EAAE,MAAM;IAChCI,wBAAwB,CAAC;MACpCC,OAAO,EAAE,WAAW;MACpBC,IAAI,EAAE;QACJA,IAAI,EAAE,SAAS;QACfoB,SAAS,EAAE;MACb;IACF,CAAC,CAAC;IACWtB,wBAAwB,CAAC;MACpCC,OAAO,EAAE,OAAO;MAChBC,IAAI,EAAE;QACJA,IAAI,EAAE,SAAS;QACfqB,KAAK,EAAE;MACT;IACF,CAAC,CAAC;IAEF5B,MAAM,CAACI,wBAAwB,CAAC,CAAC,CAACW,QAAQ,CAAC,CAACC,qBAAqB,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -24,7 +24,7 @@ import { defineOntology } from "../api/defineOntology.js";
|
|
|
24
24
|
const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
25
25
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
26
26
|
export default async function main(args = process.argv) {
|
|
27
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.14.0-beta.
|
|
27
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.14.0-beta.13" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
28
28
|
input: {
|
|
29
29
|
alias: "i",
|
|
30
30
|
describe: "Input file",
|