@osdk/maker 0.16.0-beta.1 → 0.16.0-beta.3
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 +23 -0
- package/README.md +14 -0
- package/build/browser/api/code-snippets/createCodeSnippets.js +1 -1
- package/build/browser/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/browser/api/defineObject.js +26 -9
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/object/ObjectPropertyType.js.map +1 -1
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
- package/build/browser/api/properties/ReducerType.js +2 -0
- package/build/browser/api/properties/ReducerType.js.map +1 -0
- package/build/browser/api/properties/SharedPropertyType.js.map +1 -1
- package/build/browser/api/test/actions.test.js +5 -0
- package/build/browser/api/test/actions.test.js.map +1 -1
- package/build/browser/api/test/objectStatus.test.js +93 -1
- package/build/browser/api/test/objectStatus.test.js.map +1 -1
- package/build/browser/api/test/objects.test.js +576 -0
- package/build/browser/api/test/objects.test.js.map +1 -1
- package/build/browser/api/test/spt.test.js +62 -61
- package/build/browser/api/test/spt.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertMainValue.js +36 -0
- package/build/browser/conversion/toMarketplace/convertMainValue.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +4 -3
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertReducers.js +53 -0
- package/build/browser/conversion/toMarketplace/convertReducers.js.map +1 -0
- package/build/browser/conversion/toMarketplace/convertSpt.js +5 -3
- package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -2
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/cjs/index.cjs +152 -84
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +13 -1
- package/build/esm/api/code-snippets/createCodeSnippets.js +1 -1
- package/build/esm/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/esm/api/defineObject.js +26 -9
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/object/ObjectPropertyType.js.map +1 -1
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
- package/build/esm/api/properties/ReducerType.js +2 -0
- package/build/esm/api/properties/ReducerType.js.map +1 -0
- package/build/esm/api/properties/SharedPropertyType.js.map +1 -1
- package/build/esm/api/test/actions.test.js +5 -0
- package/build/esm/api/test/actions.test.js.map +1 -1
- package/build/esm/api/test/objectStatus.test.js +93 -1
- package/build/esm/api/test/objectStatus.test.js.map +1 -1
- package/build/esm/api/test/objects.test.js +576 -0
- package/build/esm/api/test/objects.test.js.map +1 -1
- package/build/esm/api/test/spt.test.js +62 -61
- package/build/esm/api/test/spt.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertMainValue.js +36 -0
- package/build/esm/conversion/toMarketplace/convertMainValue.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +4 -3
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertReducers.js +53 -0
- package/build/esm/conversion/toMarketplace/convertReducers.js.map +1 -0
- package/build/esm/conversion/toMarketplace/convertSpt.js +5 -3
- package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -2
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -0
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/object/ObjectPropertyType.d.ts +2 -0
- package/build/types/api/object/ObjectPropertyType.d.ts.map +1 -1
- package/build/types/api/properties/PropertyTypeType.d.ts +4 -0
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
- package/build/types/api/properties/ReducerType.d.ts +4 -0
- package/build/types/api/properties/ReducerType.d.ts.map +1 -0
- package/build/types/api/properties/SharedPropertyType.d.ts +2 -0
- package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertMainValue.d.ts +4 -0
- package/build/types/conversion/toMarketplace/convertMainValue.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertReducers.d.ts +6 -0
- package/build/types/conversion/toMarketplace/convertReducers.d.ts.map +1 -0
- package/build/types/conversion/toMarketplace/convertSpt.d.ts +1 -1
- package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts +2 -1
- package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @osdk/maker
|
|
2
2
|
|
|
3
|
+
## 0.16.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8f92197: update code snippet to have interface dependent properties
|
|
8
|
+
- 6499ff9: Support reducers and struct main values in oac
|
|
9
|
+
- 5b938ef: Enforce OT and prop statuses match
|
|
10
|
+
- e9f9f58: Allow primitive struct main values to be title props
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- @osdk/api@2.8.0-beta.5
|
|
15
|
+
|
|
16
|
+
## 0.16.0-beta.2
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- e462938: Support PSGs in OAC
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @osdk/api@2.8.0-beta.2
|
|
25
|
+
|
|
3
26
|
## 0.15.0-beta.9
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -97,6 +97,10 @@ const tagsProperty = defineSharedPropertyType({
|
|
|
97
97
|
array: true,
|
|
98
98
|
displayName: "Tags",
|
|
99
99
|
description: "List of tags",
|
|
100
|
+
// optionally add a reducer
|
|
101
|
+
reducers: [{
|
|
102
|
+
direction: "descending",
|
|
103
|
+
}],
|
|
100
104
|
});
|
|
101
105
|
```
|
|
102
106
|
|
|
@@ -120,6 +124,11 @@ const addressProperty = defineSharedPropertyType({
|
|
|
120
124
|
},
|
|
121
125
|
country: "string",
|
|
122
126
|
},
|
|
127
|
+
// optionally add a main value
|
|
128
|
+
mainValue: {
|
|
129
|
+
fields: "street",
|
|
130
|
+
type: "string",
|
|
131
|
+
},
|
|
123
132
|
},
|
|
124
133
|
displayName: "Address",
|
|
125
134
|
description: "Physical address information",
|
|
@@ -438,6 +447,11 @@ const customerObject = defineObject({
|
|
|
438
447
|
zipCode: "string",
|
|
439
448
|
country: "string",
|
|
440
449
|
},
|
|
450
|
+
// optionally add a main value
|
|
451
|
+
mainValue: {
|
|
452
|
+
fields: "street",
|
|
453
|
+
type: "string",
|
|
454
|
+
},
|
|
441
455
|
},
|
|
442
456
|
displayName: "Address",
|
|
443
457
|
},
|
|
@@ -60,7 +60,7 @@ 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.propertiesV3), ...Object.keys(interfaceType.propertiesV2)],
|
|
64
64
|
"interfaceName": interfaceType.displayMetadata.displayName
|
|
65
65
|
};
|
|
66
66
|
return getSnippets(interfaceSnippets, interfaceContext);
|
|
@@ -1 +1 @@
|
|
|
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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,wBAAwB,QAAQ,2BAA2B;AACpE,SAASC,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,IAAI;AACxB,OAAOC,QAAQ,MAAM,UAAU;AAC/B,OAAO,KAAKC,IAAI,MAAM,MAAM;AAG5B,SAASC,sBAAsB,QAAQ,qCAAqC;AAG5E,SACEC,cAAc,EACdC,iBAAiB,EACjBC,cAAc,EACdC,kBAAkB,QACb,mBAAmB;AAE1B,OAAO,SAASC,kBAAkBA,CAChCC,QAA4B,EAC5BC,WAA+B,EAC/BC,SAA6B,EACvB;EACN,IAAIA,SAAS,KAAKC,SAAS,EAAE;IAC3BD,SAAS,GAAG,iBAAiB;EAC/B;EACA,IAAI,CAACX,EAAE,CAACa,UAAU,CAACF,SAAS,CAAC,EAAE;IAC7BX,EAAE,CAACc,SAAS,CAACH,SAAS,EAAE;MAAEI,SAAS,EAAE;IAAK,CAAC,CAAC;EAC9C;EACA,IAAIL,WAAW,KAAKE,SAAS,EAAE;IAC7BF,WAAW,GAAG,EAAE;EAClB;EACAX,OAAO,CAACiB,IAAI,CAAC,8BAA8B,EAAEL,SAAS,CAAC;EACvD,KAAK,MAAMM,IAAI,IAAIC,MAAM,CAACC,MAAM,CAAChB,sBAAsB,CAAC,EAAE;IACxD,KAAK,MAAMiB,MAAM,IAAIF,MAAM,CAACC,MAAM,CAACV,QAAQ,CAACQ,IAAI,CAAC,CAAC,EAAE;MAClD,IAAII,OAAO,GAAG,CAAC,CAAC;MAChB,QAAQJ,IAAI;QACV,KAAKd,sBAAsB,CAACmB,WAAW;UACrCD,OAAO,GAAGE,qBAAqB,CAACH,MAAM,EAAEV,WAAW,CAAC;UACpD;QACF,KAAKP,sBAAsB,CAACqB,WAAW;UACrCH,OAAO,GAAGI,qBAAqB,CAACL,MAAM,EAAEV,WAAW,CAAC;UACpD;QACF,KAAKP,sBAAsB,CAACuB,cAAc;UACxCL,OAAO,GAAGM,wBAAwB,CAACP,MAAM,EAAEV,WAAW,CAAC;UACvD;QACF;UACE;MACJ;MACAV,EAAE,CAAC4B,aAAa,CACd1B,IAAI,CAAC2B,IAAI,CAAClB,SAAS,EAAES,MAAM,CAACU,OAAO,CAAC,EACpCC,IAAI,CAACC,SAAS,CAACX,OAAO,CACxB,CAAC;IACH;EACF;EACAtB,OAAO,CAACiB,IAAI,CAAC,kCAAkC,CAAC;AAClD;AAEA,SAASW,wBAAwBA,CAC/BM,aAA4B,EAC5BvB,WAAmB,EACnB;EACA,MAAMwB,gBAAgB,GAAG;IACvB,kBAAkB,EAAED,aAAa,CAACH,OAAO;IACzC,aAAa,EAAEpB,WAAW;IAC1B,0BAA0B,EAAEuB,aAAa,CAACH,OAAO;IACjD,eAAe,
|
|
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","propertiesV3","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\": [\n ...Object.keys(interfaceType.propertiesV3),\n ...Object.keys(interfaceType.propertiesV2),\n ],\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 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;EACD,OAAO8B,WAAW,CAACpC,cAAc,EAAEwC,aAAa,CAAC;AACnD;AAEA,SAASJ,WAAWA,CAClBK,WAGyB,EACzBC,OAAW,EACX;EACA,MAAMC,WAAW,GAAG,CAAC,CAAC;EACtB,KACE,MAAMC,YAAY,IAAI9B,MAAM,CAACiB,IAAI,CAACU,WAAW,CAAC,CAACI,MAAM,CAACC,GAAG,IACvDC,KAAK,CAACC,MAAM,CAACF,GAAG,CAAC,CACnB,CAAC,EACD;IACA,MAAMG,QAAQ,GAAGnC,MAAM,CAACC,MAAM,CAACrB,wBAAwB,CAACuD,QAAQ,CAAC;IACjE,MAAMC,cAAc,GAAGD,QAAQ,CAC5BE,KAAK,CAAC,CAAC,CACPC,OAAO,CAAC,CAAC,CACTC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAACX,YAAY,CAAC,CAAC,EAClCW,QAAQ,CAACX,YAAY,CAAC,CACvBY,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEC,QAAQ,IAAI,EAAE;IACzB,MAAMC,gBAAgB,GAAG7D,QAAQ,CAAC8D,MAAM,CAACT,cAAc,EAAER,OAAO,CAAC;IACjE,MAAMkB,WAAW,GAAGzD,kBAAkB,CAAC0D,GAAG,CAACjB,YAAY,CAAC;IAEvDD,WAAW,CACViB,WAAW,KAAKpD,SAAS,GACrBX,QAAQ,CAAC8D,MAAM,CAACC,WAAW,EAAElB,OAAO,CAAC,GACrCE,YAAY,CACjB,GAAGc,gBAAgB;EACtB;EACA,OAAOf,WAAW;AACpB","ignoreList":[]}
|
|
@@ -20,8 +20,7 @@ import { OntologyEntityTypeEnum } from "./common/OntologyEntityTypeEnum.js";
|
|
|
20
20
|
import { addNamespaceIfNone, importedTypes, namespace, ontologyDefinition, updateOntology, withoutNamespace } from "./defineOntology.js";
|
|
21
21
|
import { getFlattenedInterfaceProperties } from "./interface/getFlattenedInterfaceProperties.js";
|
|
22
22
|
import { getInterfacePropertyTypeType, isInterfaceSharedPropertyType } from "./interface/InterfacePropertyType.js";
|
|
23
|
-
import { isExotic } from "./properties/PropertyTypeType.js";
|
|
24
|
-
|
|
23
|
+
import { isExotic, isStruct } from "./properties/PropertyTypeType.js";
|
|
25
24
|
// From https://stackoverflow.com/a/79288714
|
|
26
25
|
const ISO_8601_DURATION = /^P(?!$)(?:(?:((?:\d+Y)|(?:\d+(?:\.|,)\d+Y$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+D)|(?:\d+(?:\.|,)\d+D$))?(T((?:\d+H)|(?:\d+(?:\.|,)\d+H$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+S)|(?:\d+(?:\.|,)\d+S$))?)?)|(?:\d+(?:(?:\.|,)\d+)?W))$/;
|
|
27
26
|
|
|
@@ -49,15 +48,23 @@ export function defineObject(objectDef) {
|
|
|
49
48
|
derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
// Validate
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
// Validate property statuses match the object status.
|
|
52
|
+
// An experimental object can only have experimental properties.
|
|
53
|
+
// A deprecated object can only have deprecated properties.
|
|
54
|
+
// An example object can only have example properties.
|
|
55
|
+
// There is no restriction on property statuses of an active object.
|
|
56
|
+
const objectStatusType = getStatusType(objectDef.status);
|
|
57
|
+
if (objectStatusType === "experimental" || objectStatusType === "deprecated" || objectStatusType === "example") {
|
|
58
|
+
const mismatchedProperties = [];
|
|
55
59
|
Object.entries(objectDef.properties ?? {}).forEach(([apiName, property]) => {
|
|
56
|
-
if (property.status
|
|
57
|
-
|
|
60
|
+
if (property.status !== undefined) {
|
|
61
|
+
const propertyStatusType = getStatusType(property.status);
|
|
62
|
+
if (propertyStatusType !== objectStatusType) {
|
|
63
|
+
mismatchedProperties.push(apiName);
|
|
64
|
+
}
|
|
58
65
|
}
|
|
59
66
|
});
|
|
60
|
-
!(
|
|
67
|
+
!(mismatchedProperties.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, `Object "${objectDef.apiName}" has "${objectStatusType}" status, but the following properties have a different status: ${mismatchedProperties.join(", ")}`) : invariant(false) : void 0;
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
// Validate deprecated status deadline is in ISO 8601 format
|
|
@@ -65,7 +72,8 @@ export function defineObject(objectDef) {
|
|
|
65
72
|
const deadline = objectDef.status.deadline;
|
|
66
73
|
!(deadline !== undefined && ISO_8601_DATETIME.test(deadline)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Deprecated status deadline "${deadline}" on object "${objectDef.apiName}" is not a valid ISO 8601 datetime string`) : invariant(false) : void 0;
|
|
67
74
|
}
|
|
68
|
-
|
|
75
|
+
const titleProp = objectDef.properties?.[objectDef.titlePropertyApiName]?.type;
|
|
76
|
+
!(!isExotic(titleProp) || isStruct(titleProp) && titleProp.mainValue && !isExotic(titleProp.mainValue.type)) ? process.env.NODE_ENV !== "production" ? invariant(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant(false) : void 0;
|
|
69
77
|
!!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant(false) : void 0;
|
|
70
78
|
objectDef.implementsInterfaces?.forEach(interfaceImpl => {
|
|
71
79
|
const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
|
|
@@ -258,4 +266,13 @@ function isPrimitive(type) {
|
|
|
258
266
|
const typeType = typeof type === "string" ? type : type.type;
|
|
259
267
|
return ["boolean", "byte", "date", "double", "float", "integer", "long", "short", "string", "timestamp"].includes(typeType);
|
|
260
268
|
}
|
|
269
|
+
function getStatusType(status) {
|
|
270
|
+
if (status === undefined) {
|
|
271
|
+
return "active";
|
|
272
|
+
}
|
|
273
|
+
if (typeof status === "string") {
|
|
274
|
+
return status;
|
|
275
|
+
}
|
|
276
|
+
return status.type;
|
|
277
|
+
}
|
|
261
278
|
//# sourceMappingURL=defineObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineObject.js","names":["invariant","getObject","OntologyEntityTypeEnum","addNamespaceIfNone","importedTypes","namespace","ontologyDefinition","updateOntology","withoutNamespace","getFlattenedInterfaceProperties","getInterfacePropertyTypeType","isInterfaceSharedPropertyType","isExotic","ISO_8601_DURATION","ISO_8601_DATETIME","API_NAME_PATTERN","defineObject","objectDef","apiName","propertyApiNames","properties","Object","keys","OBJECT_TYPE","undefined","Error","test","process","env","NODE_ENV","includes","titlePropertyApiName","primaryKeyPropertyApiName","editOnly","retentionPeriods","datasources","filter","ds","type","map","retentionPeriod","forEach","baseDatasources","length","join","derivedDatasources","validateDerivedDatasource","status","activeProperties","entries","property","push","deadline","implementsInterfaces","interfaceImpl","allInterfaceProperties","implements","nonExistentInterfaceProperties","propertyMapping","val","interfaceProperty","interfaceProp","reason","interfaceToObjectProperties","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","validateInterfaceImplProperty","validations","allFailedValidations","concat","formatValidationErrors","flattenedProperties","convertUserObjectPropertyType","finalObject","__type","error","mappedObjectProp","object","objProp","propertyType","JSON","stringify","uppercaseFirstLetter","s","charAt","toUpperCase","slice","convertToPluralDisplayName","endsWith","displayName","datasource","linkDefinition","link","linkApiName","linkType","LINK_TYPE","prop","isLinkedProperties","values","validateLinkedProperties","validateAggregations","getPropertiesForValidation","linkObject","targetApiName","selfApiName","hasProperty","propName","find","p","foreignProperties","targetObject","at","toMany","props","agg","isCollectible","limit","isNumeric","isPrimitive","foreignProperty","array","typeType"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { getObject } from \"../conversion/toMarketplace/convertLink.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n addNamespaceIfNone,\n importedTypes,\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\nimport {\n getInterfacePropertyTypeType,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport type { ObjectPropertyType } from \"./object/ObjectPropertyType.js\";\nimport type { ObjectPropertyTypeUserDefinition } from \"./object/ObjectPropertyTypeUserDefinition.js\";\nimport type { ObjectType } from \"./object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n ObjectTypeDatasourceDefinition_stream,\n} from \"./object/ObjectTypeDatasourceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./object/ObjectTypeDefinition.js\";\nimport type { PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { isExotic } from \"./properties/PropertyTypeType.js\";\n\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\n// ISO 8601 date and time format (YYYY-MM-DDThh:mm:ss.sssZ)\nconst ISO_8601_DATETIME =\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/;\n\nconst API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/;\n\nexport function defineObject(\n objectDef: ObjectTypeDefinition,\n): ObjectTypeDefinition {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = objectDef.properties\n ? Object.keys(objectDef.properties)\n : [];\n if (\n ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName]\n !== undefined\n ) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n API_NAME_PATTERN.test(objectDef.apiName),\n `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n propertyApiNames.includes(objectDef.primaryKeyPropertyApiName),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`,\n );\n\n invariant(\n !(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`,\n );\n\n const retentionPeriods =\n ((objectDef.datasources ?? []).filter(ds =>\n ds.type === \"stream\"\n ) as ObjectTypeDatasourceDefinition_stream[]).map(ds => ds.retentionPeriod);\n retentionPeriods.forEach(retentionPeriod => {\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n });\n\n const baseDatasources = (objectDef.datasources ?? []).filter(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n invariant(\n baseDatasources.length <= 1,\n `Object ${objectDef.apiName} has more than one base datasource (got: [${\n baseDatasources.map(ds => ds.type).join(\", \")\n }])`,\n );\n const derivedDatasources = (objectDef.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n if (derivedDatasources.length > 0) {\n derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));\n }\n\n // Validate that if object status is experimental, no property can have a status of active\n if (objectDef.status === \"experimental\") {\n const activeProperties: string[] = [];\n Object.entries(objectDef.properties ?? {}).forEach(\n ([apiName, property]) => {\n if (property.status === \"active\") {\n activeProperties.push(apiName);\n }\n },\n );\n invariant(\n activeProperties.length === 0,\n `When object \"${objectDef.apiName}\" has experimental status, no properties can have \"active\" status, but found active properties: ${\n activeProperties.join(\", \")\n }`,\n );\n }\n\n // Validate deprecated status deadline is in ISO 8601 format\n if (\n objectDef.status && typeof objectDef.status === \"object\"\n && objectDef.status.type === \"deprecated\"\n ) {\n const deadline = objectDef.status.deadline;\n invariant(\n deadline !== undefined && ISO_8601_DATETIME.test(deadline),\n `Deprecated status deadline \"${deadline}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 datetime string`,\n );\n }\n invariant(\n !isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type),\n `Title property ${objectDef.titlePropertyApiName} must be a primitive type`,\n );\n invariant(\n !isExotic(\n objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type,\n ),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const allInterfaceProperties = getFlattenedInterfaceProperties(\n interfaceImpl.implements,\n );\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n allInterfaceProperties[addNamespaceIfNone(interfaceProperty)]\n === undefined\n && allInterfaceProperties[withoutNamespace(interfaceProperty)]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [\n mapping.interfaceProperty,\n mapping.mapsTo,\n ],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n const apiName = isInterfaceSharedPropertyType(interfaceProp[1])\n ? interfaceProp[1].sharedPropertyType.apiName\n : interfaceProp[0];\n if (apiName in interfaceToObjectProperties) {\n return validateInterfaceImplProperty(\n interfaceProp[1],\n apiName,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason:\n `Interface spt ${apiName} not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const validations = Object.entries(\n getFlattenedInterfaceProperties(interfaceImpl.implements),\n ).map(validateProperty);\n const allFailedValidations = validations.concat(\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n const flattenedProperties: Array<ObjectPropertyType> = Object.entries(\n objectDef.properties ?? {},\n ).map(([apiName, property]) =>\n convertUserObjectPropertyType(apiName, property)\n );\n\n const finalObject: ObjectType = {\n ...objectDef,\n apiName: apiName,\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n properties: flattenedProperties,\n };\n updateOntology(finalObject);\n objectDef.apiName = apiName;\n return objectDef;\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n type: InterfacePropertyType,\n apiName: string,\n mappedObjectProp: string,\n object: ObjectTypeDefinition,\n): ValidationResult {\n const objProp = object.properties?.[mappedObjectProp];\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n const propertyType = getInterfacePropertyTypeType(type);\n if (JSON.stringify(propertyType) !== JSON.stringify(objProp?.type)) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n\nexport function uppercaseFirstLetter(s: string | undefined | null): string {\n return s === undefined || s == null\n ? \"\"\n : s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n// TODO: edge cases\nexport function convertToPluralDisplayName(\n s: string | undefined | null,\n): string {\n return s === undefined || s == null\n ? \"\"\n : s.endsWith(\"s\")\n ? uppercaseFirstLetter(s)\n : uppercaseFirstLetter(s) + \"s\";\n}\n\nfunction convertUserObjectPropertyType(\n apiName: string,\n property: ObjectPropertyTypeUserDefinition,\n): ObjectPropertyType {\n // fill in missing fields to be used by actions\n property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);\n return {\n ...property,\n apiName: apiName,\n displayName: property.displayName ?? uppercaseFirstLetter(apiName),\n type: property.type,\n };\n}\nfunction validateDerivedDatasource(\n objectDef: ObjectTypeDefinition,\n datasource: ObjectTypeDatasourceDefinition_derived,\n) {\n // there should be at least one link\n invariant(\n datasource.linkDefinition.length > 0,\n `Derived datasource for object '${objectDef.apiName}' must have at least one link.`,\n );\n\n // all of the links references should exist\n datasource.linkDefinition.forEach(link => {\n const linkApiName = link.linkType.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined\n || importedTypes[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined,\n `Link type '${linkApiName}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n // all of the properties references on the source object should exist\n Object.keys(datasource.propertyMapping).forEach(prop => {\n invariant(\n objectDef.properties?.[prop] !== undefined,\n `Property '${prop}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n const isLinkedProperties =\n (typeof Object.values(datasource.propertyMapping)[0]) === \"string\";\n if (isLinkedProperties) {\n validateLinkedProperties(datasource, objectDef);\n } else {\n validateAggregations(datasource, objectDef);\n }\n}\n\n/**\n * Gets properties for validation, handling self-referential links where\n * the target object is the same as the object being defined (not yet in registry).\n */\nfunction getPropertiesForValidation(\n linkObject: string | ObjectTypeDefinition,\n objectDef: ObjectTypeDefinition,\n): { apiName: string; hasProperty: (propName: string) => boolean } {\n const targetApiName = typeof linkObject === \"string\"\n ? linkObject\n : linkObject.apiName;\n const selfApiName = namespace + objectDef.apiName;\n\n // Self-referential: use objectDef directly (not yet in registry)\n if (targetApiName === selfApiName) {\n return {\n apiName: selfApiName,\n hasProperty: (propName: string) =>\n objectDef.properties?.[propName] !== undefined,\n };\n }\n\n // Non-self-referential: look up from registry\n const { apiName, object } = getObject(linkObject);\n return {\n apiName,\n hasProperty: (propName: string) =>\n object.properties?.find(p => p.apiName === propName) !== undefined,\n };\n}\n\nfunction validateLinkedProperties(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const foreignProperties = Object.values(\n datasource.propertyMapping,\n ) as string[];\n // the foreign property must exist in the final object in the link chain\n const targetObject = datasource.linkDefinition.at(-1)!.linkType.toMany.object;\n const { apiName, hasProperty } = getPropertiesForValidation(\n targetObject,\n objectDef,\n );\n foreignProperties.forEach(prop => {\n invariant(\n hasProperty(prop),\n `Property '${prop}' on object '${apiName}' is not defined`,\n );\n });\n}\n\nfunction validateAggregations(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const props = datasource.propertyMapping as Record<\n string,\n DerivedPropertyAggregation\n >;\n\n Object.entries(props).forEach(([propName, agg]) => {\n // TODO(dpaquin): check that the property type matches the foreign property type,\n // for collectList/collectSet and maybe min/max too?\n const property = objectDef.properties![propName];\n switch (agg.type) {\n case \"collectList\":\n case \"collectSet\":\n // property's type is collectible\n invariant(\n isCollectible(property),\n `Property '${propName}' on object '${objectDef.apiName}' is not collectible`,\n );\n // limit <= 100\n invariant(\n agg.limit <= 100,\n `[Error] Limit for collection '${propName}' on object '${objectDef.apiName}' is greater than 100`,\n );\n break;\n case \"avg\":\n case \"sum\":\n // property's type is numeric\n invariant(\n isNumeric(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not numeric`,\n );\n break;\n case \"min\":\n case \"max\":\n case \"approximateCardinality\":\n case \"exactCardinality\":\n // property's type is primitive\n invariant(\n isPrimitive(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not primitive`,\n );\n break;\n default:\n break;\n }\n\n // if a foreign property is referenced, it must exist in the final object\n if (agg.type !== \"count\") {\n const foreignProperty = agg.property;\n const targetObject =\n datasource.linkDefinition.at(-1)!.linkType.toMany.object;\n const { apiName, hasProperty } = getPropertiesForValidation(\n targetObject,\n objectDef,\n );\n invariant(\n hasProperty(foreignProperty),\n `Property '${foreignProperty}' on object '${apiName}' is not defined`,\n );\n }\n });\n}\n\nfunction isCollectible(property: ObjectPropertyTypeUserDefinition): boolean {\n if (!(property.array ?? false)) {\n return false;\n }\n const typeType = typeof property.type === \"string\"\n ? property.type\n : property.type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"geohash\",\n \"geoshape\",\n \"integer\",\n \"long\",\n \"mediareference\",\n \"short\",\n \"string\",\n \"struct\",\n \"timestamp\",\n ].includes(typeType);\n}\n\nfunction isNumeric(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"byte\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n ].includes(typeType);\n}\n\nfunction isPrimitive(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n \"string\",\n \"timestamp\",\n ].includes(typeType);\n}\n"],"mappings":"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QAAQ,CAAC8F,QAAQ,CAAC;AACtB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"defineObject.js","names":["invariant","getObject","OntologyEntityTypeEnum","addNamespaceIfNone","importedTypes","namespace","ontologyDefinition","updateOntology","withoutNamespace","getFlattenedInterfaceProperties","getInterfacePropertyTypeType","isInterfaceSharedPropertyType","isExotic","isStruct","ISO_8601_DURATION","ISO_8601_DATETIME","API_NAME_PATTERN","defineObject","objectDef","apiName","propertyApiNames","properties","Object","keys","OBJECT_TYPE","undefined","Error","test","process","env","NODE_ENV","includes","titlePropertyApiName","primaryKeyPropertyApiName","editOnly","retentionPeriods","datasources","filter","ds","type","map","retentionPeriod","forEach","baseDatasources","length","join","derivedDatasources","validateDerivedDatasource","objectStatusType","getStatusType","status","mismatchedProperties","entries","property","propertyStatusType","push","deadline","titleProp","mainValue","implementsInterfaces","interfaceImpl","allInterfaceProperties","implements","nonExistentInterfaceProperties","propertyMapping","val","interfaceProperty","interfaceProp","reason","interfaceToObjectProperties","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","validateInterfaceImplProperty","validations","allFailedValidations","concat","formatValidationErrors","flattenedProperties","convertUserObjectPropertyType","finalObject","__type","error","mappedObjectProp","object","objProp","propertyType","JSON","stringify","uppercaseFirstLetter","s","charAt","toUpperCase","slice","convertToPluralDisplayName","endsWith","displayName","datasource","linkDefinition","link","linkApiName","linkType","LINK_TYPE","prop","isLinkedProperties","values","validateLinkedProperties","validateAggregations","getPropertiesForValidation","linkObject","targetApiName","selfApiName","hasProperty","propName","find","p","foreignProperties","targetObject","at","toMany","props","agg","isCollectible","limit","isNumeric","isPrimitive","foreignProperty","array","typeType"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { getObject } from \"../conversion/toMarketplace/convertLink.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n addNamespaceIfNone,\n importedTypes,\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\nimport {\n getInterfacePropertyTypeType,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport type { ObjectPropertyType } from \"./object/ObjectPropertyType.js\";\nimport type { ObjectPropertyTypeUserDefinition } from \"./object/ObjectPropertyTypeUserDefinition.js\";\nimport type { ObjectType } from \"./object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n ObjectTypeDatasourceDefinition_stream,\n} from \"./object/ObjectTypeDatasourceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./object/ObjectTypeDefinition.js\";\nimport type { ObjectTypeStatus } from \"./object/ObjectTypeStatus.js\";\nimport type { PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { isExotic, isStruct } from \"./properties/PropertyTypeType.js\";\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\n// ISO 8601 date and time format (YYYY-MM-DDThh:mm:ss.sssZ)\nconst ISO_8601_DATETIME =\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/;\n\nconst API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/;\n\nexport function defineObject(\n objectDef: ObjectTypeDefinition,\n): ObjectTypeDefinition {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = objectDef.properties\n ? Object.keys(objectDef.properties)\n : [];\n if (\n ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName]\n !== undefined\n ) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n API_NAME_PATTERN.test(objectDef.apiName),\n `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n propertyApiNames.includes(objectDef.primaryKeyPropertyApiName),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`,\n );\n\n invariant(\n !(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`,\n );\n\n const retentionPeriods =\n ((objectDef.datasources ?? []).filter(ds =>\n ds.type === \"stream\"\n ) as ObjectTypeDatasourceDefinition_stream[]).map(ds => ds.retentionPeriod);\n retentionPeriods.forEach(retentionPeriod => {\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n });\n\n const baseDatasources = (objectDef.datasources ?? []).filter(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n invariant(\n baseDatasources.length <= 1,\n `Object ${objectDef.apiName} has more than one base datasource (got: [${\n baseDatasources.map(ds => ds.type).join(\", \")\n }])`,\n );\n const derivedDatasources = (objectDef.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n if (derivedDatasources.length > 0) {\n derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));\n }\n\n // Validate property statuses match the object status.\n // An experimental object can only have experimental properties.\n // A deprecated object can only have deprecated properties.\n // An example object can only have example properties.\n // There is no restriction on property statuses of an active object.\n const objectStatusType = getStatusType(objectDef.status);\n if (\n objectStatusType === \"experimental\" || objectStatusType === \"deprecated\"\n || objectStatusType === \"example\"\n ) {\n const mismatchedProperties: string[] = [];\n Object.entries(objectDef.properties ?? {}).forEach(\n ([apiName, property]) => {\n if (property.status !== undefined) {\n const propertyStatusType = getStatusType(property.status);\n if (propertyStatusType !== objectStatusType) {\n mismatchedProperties.push(apiName);\n }\n }\n },\n );\n invariant(\n mismatchedProperties.length === 0,\n `Object \"${objectDef.apiName}\" has \"${objectStatusType}\" status, but the following properties have a different status: ${\n mismatchedProperties.join(\", \")\n }`,\n );\n }\n\n // Validate deprecated status deadline is in ISO 8601 format\n if (\n objectDef.status && typeof objectDef.status === \"object\"\n && objectDef.status.type === \"deprecated\"\n ) {\n const deadline = objectDef.status.deadline;\n invariant(\n deadline !== undefined && ISO_8601_DATETIME.test(deadline),\n `Deprecated status deadline \"${deadline}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 datetime string`,\n );\n }\n const titleProp = objectDef.properties?.[objectDef.titlePropertyApiName]\n ?.type;\n invariant(\n !isExotic(titleProp)\n || (isStruct(titleProp) && titleProp.mainValue\n && !isExotic(titleProp.mainValue.type)),\n `Title property ${objectDef.titlePropertyApiName} must be a primitive type`,\n );\n invariant(\n !isExotic(\n objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type,\n ),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const allInterfaceProperties = getFlattenedInterfaceProperties(\n interfaceImpl.implements,\n );\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n allInterfaceProperties[addNamespaceIfNone(interfaceProperty)]\n === undefined\n && allInterfaceProperties[withoutNamespace(interfaceProperty)]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [\n mapping.interfaceProperty,\n mapping.mapsTo,\n ],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n const apiName = isInterfaceSharedPropertyType(interfaceProp[1])\n ? interfaceProp[1].sharedPropertyType.apiName\n : interfaceProp[0];\n if (apiName in interfaceToObjectProperties) {\n return validateInterfaceImplProperty(\n interfaceProp[1],\n apiName,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason:\n `Interface spt ${apiName} not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const validations = Object.entries(\n getFlattenedInterfaceProperties(interfaceImpl.implements),\n ).map(validateProperty);\n const allFailedValidations = validations.concat(\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n const flattenedProperties: Array<ObjectPropertyType> = Object.entries(\n objectDef.properties ?? {},\n ).map(([apiName, property]) =>\n convertUserObjectPropertyType(apiName, property)\n );\n\n const finalObject: ObjectType = {\n ...objectDef,\n apiName: apiName,\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n properties: flattenedProperties,\n };\n updateOntology(finalObject);\n objectDef.apiName = apiName;\n return objectDef;\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n type: InterfacePropertyType,\n apiName: string,\n mappedObjectProp: string,\n object: ObjectTypeDefinition,\n): ValidationResult {\n const objProp = object.properties?.[mappedObjectProp];\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n const propertyType = getInterfacePropertyTypeType(type);\n if (JSON.stringify(propertyType) !== JSON.stringify(objProp?.type)) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n\nexport function uppercaseFirstLetter(s: string | undefined | null): string {\n return s === undefined || s == null\n ? \"\"\n : s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n// TODO: edge cases\nexport function convertToPluralDisplayName(\n s: string | undefined | null,\n): string {\n return s === undefined || s == null\n ? \"\"\n : s.endsWith(\"s\")\n ? uppercaseFirstLetter(s)\n : uppercaseFirstLetter(s) + \"s\";\n}\n\nfunction convertUserObjectPropertyType(\n apiName: string,\n property: ObjectPropertyTypeUserDefinition,\n): ObjectPropertyType {\n // fill in missing fields to be used by actions\n property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);\n return {\n ...property,\n apiName: apiName,\n displayName: property.displayName ?? uppercaseFirstLetter(apiName),\n type: property.type,\n };\n}\nfunction validateDerivedDatasource(\n objectDef: ObjectTypeDefinition,\n datasource: ObjectTypeDatasourceDefinition_derived,\n) {\n // there should be at least one link\n invariant(\n datasource.linkDefinition.length > 0,\n `Derived datasource for object '${objectDef.apiName}' must have at least one link.`,\n );\n\n // all of the links references should exist\n datasource.linkDefinition.forEach(link => {\n const linkApiName = link.linkType.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined\n || importedTypes[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined,\n `Link type '${linkApiName}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n // all of the properties references on the source object should exist\n Object.keys(datasource.propertyMapping).forEach(prop => {\n invariant(\n objectDef.properties?.[prop] !== undefined,\n `Property '${prop}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n const isLinkedProperties =\n (typeof Object.values(datasource.propertyMapping)[0]) === \"string\";\n if (isLinkedProperties) {\n validateLinkedProperties(datasource, objectDef);\n } else {\n validateAggregations(datasource, objectDef);\n }\n}\n\n/**\n * Gets properties for validation, handling self-referential links where\n * the target object is the same as the object being defined (not yet in registry).\n */\nfunction getPropertiesForValidation(\n linkObject: string | ObjectTypeDefinition,\n objectDef: ObjectTypeDefinition,\n): { apiName: string; hasProperty: (propName: string) => boolean } {\n const targetApiName = typeof linkObject === \"string\"\n ? linkObject\n : linkObject.apiName;\n const selfApiName = namespace + objectDef.apiName;\n\n // Self-referential: use objectDef directly (not yet in registry)\n if (targetApiName === selfApiName) {\n return {\n apiName: selfApiName,\n hasProperty: (propName: string) =>\n objectDef.properties?.[propName] !== undefined,\n };\n }\n\n // Non-self-referential: look up from registry\n const { apiName, object } = getObject(linkObject);\n return {\n apiName,\n hasProperty: (propName: string) =>\n object.properties?.find(p => p.apiName === propName) !== undefined,\n };\n}\n\nfunction validateLinkedProperties(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const foreignProperties = Object.values(\n datasource.propertyMapping,\n ) as string[];\n // the foreign property must exist in the final object in the link chain\n const targetObject = datasource.linkDefinition.at(-1)!.linkType.toMany.object;\n const { apiName, hasProperty } = getPropertiesForValidation(\n targetObject,\n objectDef,\n );\n foreignProperties.forEach(prop => {\n invariant(\n hasProperty(prop),\n `Property '${prop}' on object '${apiName}' is not defined`,\n );\n });\n}\n\nfunction validateAggregations(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const props = datasource.propertyMapping as Record<\n string,\n DerivedPropertyAggregation\n >;\n\n Object.entries(props).forEach(([propName, agg]) => {\n // TODO(dpaquin): check that the property type matches the foreign property type,\n // for collectList/collectSet and maybe min/max too?\n const property = objectDef.properties![propName];\n switch (agg.type) {\n case \"collectList\":\n case \"collectSet\":\n // property's type is collectible\n invariant(\n isCollectible(property),\n `Property '${propName}' on object '${objectDef.apiName}' is not collectible`,\n );\n // limit <= 100\n invariant(\n agg.limit <= 100,\n `[Error] Limit for collection '${propName}' on object '${objectDef.apiName}' is greater than 100`,\n );\n break;\n case \"avg\":\n case \"sum\":\n // property's type is numeric\n invariant(\n isNumeric(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not numeric`,\n );\n break;\n case \"min\":\n case \"max\":\n case \"approximateCardinality\":\n case \"exactCardinality\":\n // property's type is primitive\n invariant(\n isPrimitive(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not primitive`,\n );\n break;\n default:\n break;\n }\n\n // if a foreign property is referenced, it must exist in the final object\n if (agg.type !== \"count\") {\n const foreignProperty = agg.property;\n const targetObject =\n datasource.linkDefinition.at(-1)!.linkType.toMany.object;\n const { apiName, hasProperty } = getPropertiesForValidation(\n targetObject,\n objectDef,\n );\n invariant(\n hasProperty(foreignProperty),\n `Property '${foreignProperty}' on object '${apiName}' is not defined`,\n );\n }\n });\n}\n\nfunction isCollectible(property: ObjectPropertyTypeUserDefinition): boolean {\n if (!(property.array ?? false)) {\n return false;\n }\n const typeType = typeof property.type === \"string\"\n ? property.type\n : property.type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"geohash\",\n \"geoshape\",\n \"integer\",\n \"long\",\n \"mediareference\",\n \"short\",\n \"string\",\n \"struct\",\n \"timestamp\",\n ].includes(typeType);\n}\n\nfunction isNumeric(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"byte\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n ].includes(typeType);\n}\n\nfunction isPrimitive(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n \"string\",\n \"timestamp\",\n ].includes(typeType);\n}\n\nfunction getStatusType(status: ObjectTypeStatus | undefined): string {\n if (status === undefined) {\n return \"active\";\n }\n if (typeof status === \"string\") {\n return status;\n }\n return status.type;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,QAAQ,4CAA4C;AACtE,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,kBAAkB,EAClBC,aAAa,EACbC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,QACX,qBAAqB;AAC5B,SAASC,+BAA+B,QAAQ,gDAAgD;AAChG,SACEC,4BAA4B,EAE5BC,6BAA6B,QACxB,sCAAsC;AAY7C,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,kCAAkC;AACrE;AACA,MAAMC,iBAAiB,GACrB,+OAA+O;;AAEjP;AACA,MAAMC,iBAAiB,GACrB,sEAAsE;AAExE,MAAMC,gBAAgB,GAAG,6BAA6B;AAEtD,OAAO,SAASC,YAAYA,CAC1BC,SAA+B,EACT;EACtB,MAAMC,OAAO,GAAGd,SAAS,GAAGa,SAAS,CAACC,OAAO;EAC7C,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,UAAU,GACzCC,MAAM,CAACC,IAAI,CAACL,SAAS,CAACG,UAAU,CAAC,GACjC,EAAE;EACN,IACEf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K;EACd;EACA,MAAMC,QAAQ,GAAG,OAAO7E,QAAQ,CAACd,IAAI,KAAK,QAAQ,GAC9Cc,QAAQ,CAACd,IAAI,GACbc,QAAQ,CAACd,IAAI,CAACA,IAAI;EACtB,OAAO,CACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,CACZ,CAACR,QAAQ,CAACmG,QAAQ,CAAC;AACtB;AAEA,SAASJ,SAASA,CAACvF,IAAsB,EAAW;EAClD,MAAM2F,QAAQ,GAAG,OAAO3F,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,CACR,CAACR,QAAQ,CAACmG,QAAQ,CAAC;AACtB;AAEA,SAASH,WAAWA,CAACxF,IAAsB,EAAW;EACpD,MAAM2F,QAAQ,GAAG,OAAO3F,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,CACZ,CAACR,QAAQ,CAACmG,QAAQ,CAAC;AACtB;AAEA,SAASjF,aAAaA,CAACC,MAAoC,EAAU;EACnE,IAAIA,MAAM,KAAKzB,SAAS,EAAE;IACxB,OAAO,QAAQ;EACjB;EACA,IAAI,OAAOyB,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EACA,OAAOA,MAAM,CAACX,IAAI;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSpt.js","names":["invariant","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldNotHaveRenderHints","defineSharedPropertyType","sptDef","apiName","SHARED_PROPERTY_TYPE","undefined","process","env","NODE_ENV","type","typeClasses","fullSpt","nonNameSpacedApiName","displayName","__type"],"sources":["defineSpt.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n} from \"./defineOntology.js\";\nimport type { Nullability } from \"./properties/Nullability.js\";\nimport { type PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldNotHaveRenderHints,\n} from \"./propertyConversionUtils.js\";\n\nexport interface SharedPropertyTypeDefinition {\n apiName: string;\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n nullability?: Nullability;\n typeClasses?: SharedPropertyType[\"typeClasses\"];\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n}\n\nexport function defineSharedPropertyType(\n sptDef: SharedPropertyTypeDefinition,\n): SharedPropertyType {\n const apiName = namespace + sptDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName]\n === undefined,\n `Shared property type ${apiName} already exists`,\n );\n\n invariant(\n !shouldNotHaveRenderHints(sptDef.type)\n || !hasRenderHints(sptDef.typeClasses),\n `Shared property type ${apiName} of type '${\n getPropertyTypeName(sptDef.type)\n }' should not have render hints`,\n );\n\n const fullSpt: SharedPropertyType = {\n ...sptDef,\n apiName,\n nonNameSpacedApiName: sptDef.apiName,\n displayName: sptDef.displayName ?? sptDef.apiName, // This way the non-namespaced api name is the display name (maybe not ideal)\n typeClasses: sptDef.typeClasses\n ?? (shouldNotHaveRenderHints(sptDef.type) ? [] : defaultTypeClasses),\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n };\n updateOntology(fullSpt);\n return fullSpt;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,QACT,qBAAqB;
|
|
1
|
+
{"version":3,"file":"defineSpt.js","names":["invariant","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldNotHaveRenderHints","defineSharedPropertyType","sptDef","apiName","SHARED_PROPERTY_TYPE","undefined","process","env","NODE_ENV","type","typeClasses","fullSpt","nonNameSpacedApiName","displayName","__type"],"sources":["defineSpt.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n} from \"./defineOntology.js\";\nimport type { Nullability } from \"./properties/Nullability.js\";\nimport { type PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport type { ReducerType } from \"./properties/ReducerType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldNotHaveRenderHints,\n} from \"./propertyConversionUtils.js\";\n\nexport interface SharedPropertyTypeDefinition {\n apiName: string;\n type: PropertyTypeType;\n array?: boolean;\n reducers?: Array<ReducerType>;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n nullability?: Nullability;\n typeClasses?: SharedPropertyType[\"typeClasses\"];\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n}\n\nexport function defineSharedPropertyType(\n sptDef: SharedPropertyTypeDefinition,\n): SharedPropertyType {\n const apiName = namespace + sptDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName]\n === undefined,\n `Shared property type ${apiName} already exists`,\n );\n\n invariant(\n !shouldNotHaveRenderHints(sptDef.type)\n || !hasRenderHints(sptDef.typeClasses),\n `Shared property type ${apiName} of type '${\n getPropertyTypeName(sptDef.type)\n }' should not have render hints`,\n );\n\n const fullSpt: SharedPropertyType = {\n ...sptDef,\n apiName,\n nonNameSpacedApiName: sptDef.apiName,\n displayName: sptDef.displayName ?? sptDef.apiName, // This way the non-namespaced api name is the display name (maybe not ideal)\n typeClasses: sptDef.typeClasses\n ?? (shouldNotHaveRenderHints(sptDef.type) ? [] : defaultTypeClasses),\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n };\n updateOntology(fullSpt);\n return fullSpt;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,QACT,qBAAqB;AAK5B,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,wBAAwB,QACnB,8BAA8B;AAkBrC,OAAO,SAASC,wBAAwBA,CACtCC,MAAoC,EAChB;EACpB,MAAMC,OAAO,GAAGT,SAAS,GAAGQ,MAAM,CAACC,OAAO;EAC1C,EACER,kBAAkB,CAACF,sBAAsB,CAACW,oBAAoB,CAAC,CAACD,OAAO,CAAC,KAClEE,SAAS,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAFjBhB,SAAS,QAGP,wBAAwBW,OAAO,iBAAiB,IAHlDX,SAAS;EAMT,EACE,CAACQ,wBAAwB,CAACE,MAAM,CAACO,IAAI,CAAC,IACjC,CAACV,cAAc,CAACG,MAAM,CAACQ,WAAW,CAAC,IAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAF1ChB,SAAS,QAGP,wBAAwBW,OAAO,aAC7BL,mBAAmB,CAACI,MAAM,CAACO,IAAI,CAAC,gCACF,IALlCjB,SAAS;EAQT,MAAMmB,OAA2B,GAAG;IAClC,GAAGT,MAAM;IACTC,OAAO;IACPS,oBAAoB,EAAEV,MAAM,CAACC,OAAO;IACpCU,WAAW,EAAEX,MAAM,CAACW,WAAW,IAAIX,MAAM,CAACC,OAAO;IAAE;IACnDO,WAAW,EAAER,MAAM,CAACQ,WAAW,KACzBV,wBAAwB,CAACE,MAAM,CAACO,IAAI,CAAC,GAAG,EAAE,GAAGZ,kBAAkB,CAAC;IACtEiB,MAAM,EAAErB,sBAAsB,CAACW;EACjC,CAAC;EACDR,cAAc,CAACe,OAAO,CAAC;EACvB,OAAOA,OAAO;AAChB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectPropertyType.js","names":[],"sources":["ObjectPropertyType.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 {\n OntologyIrBaseFormatter,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { RequiredFields } from \"../../util/RequiredFields.js\";\nimport type { Nullability } from \"../properties/Nullability.js\";\nimport type { PropertyTypeType } from \"../properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"../properties/SharedPropertyType.js\";\nimport type { ValueTypeDefinitionVersion } from \"../values/ValueTypeDefinitionVersion.js\";\nimport type { ObjectTypeStatus } from \"./ObjectTypeStatus.js\";\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport interface ObjectPropertyTypeInner {\n // <These values are taken from OntologyIrPropertyType (Old code used an Omit)>\n apiName: string; // was: ObjectTypeFieldApiName;\n\n // FIXME: This still depends on conjure types\n baseFormatter?: OntologyIrBaseFormatter | null | undefined;\n indexedForSearch: boolean;\n typeClasses: Array<{\n kind: string;\n name: string;\n }>;\n // </These values are taken from OntologyIrPropertyType (Old code used an Omit)>\n type: PropertyTypeType;\n array?: boolean;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectPropertyType.js","names":[],"sources":["ObjectPropertyType.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 {\n OntologyIrBaseFormatter,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { RequiredFields } from \"../../util/RequiredFields.js\";\nimport type { Nullability } from \"../properties/Nullability.js\";\nimport type { PropertyTypeType } from \"../properties/PropertyTypeType.js\";\nimport type { ReducerType } from \"../properties/ReducerType.js\";\nimport type { SharedPropertyType } from \"../properties/SharedPropertyType.js\";\nimport type { ValueTypeDefinitionVersion } from \"../values/ValueTypeDefinitionVersion.js\";\nimport type { ObjectTypeStatus } from \"./ObjectTypeStatus.js\";\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport interface ObjectPropertyTypeInner {\n // <These values are taken from OntologyIrPropertyType (Old code used an Omit)>\n apiName: string; // was: ObjectTypeFieldApiName;\n\n // FIXME: This still depends on conjure types\n baseFormatter?: OntologyIrBaseFormatter | null | undefined;\n indexedForSearch: boolean;\n typeClasses: Array<{\n kind: string;\n name: string;\n }>;\n // </These values are taken from OntologyIrPropertyType (Old code used an Omit)>\n type: PropertyTypeType;\n array?: boolean;\n reducers?: Array<ReducerType>;\n valueType: ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n nullability?: Nullability;\n status?: ObjectTypeStatus;\n editOnly?: boolean;\n}\n"],"mappings":"","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 | \"attachment\";\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 || type.type === \"string\"\n || type.type === \"decimal\";\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 requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
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 | \"attachment\";\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 mainValue?: {\n fields: string | Array<string>;\n // TODO(ethana): we can infer this type from fields\n type: PropertyTypeType;\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 || type.type === \"string\"\n || type.type === \"decimal\";\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 requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuEA,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,IACnDA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACtBA,IAAI,CAACA,IAAI,KAAK,SAAS;EAC9B;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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReducerType.js","names":[],"sources":["ReducerType.ts"],"sourcesContent":["/*\n * Copyright 2026 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 type ReducerType = {\n direction:\n | \"ascending\" // first (A -> Z) value, least recent date, etc.\n | \"descending\"; // last (Z -> A) value, most recent date, etc.\n structField?: string;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedPropertyType.js","names":[],"sources":["SharedPropertyType.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 {\n OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { TypeClass } from \"../common/TypeClass.js\";\nimport type { Nullability } from \"./Nullability.js\";\nimport type { PropertyTypeType } from \"./PropertyTypeType.js\";\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SharedPropertyType.js","names":[],"sources":["SharedPropertyType.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 {\n OntologyIrBaseFormatter,\n OntologyIrValueTypeReferenceWithMetadata,\n SharedPropertyTypeGothamMapping,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { TypeClass } from \"../common/TypeClass.js\";\nimport type { Nullability } from \"./Nullability.js\";\nimport type { PropertyTypeType } from \"./PropertyTypeType.js\";\nimport type { ReducerType } from \"./ReducerType.js\";\n\nexport interface SharedPropertyType extends OntologyEntityBase, PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n aliases?: Array<string>;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n baseFormatter?: OntologyIrBaseFormatter;\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE;\n}\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n reducers?: Array<ReducerType>;\n description?: string;\n displayName?: string;\n valueType?: OntologyIrValueTypeReferenceWithMetadata;\n visibility?: Visibility;\n typeClasses?: TypeClass[];\n nullability?: Nullability;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -950,6 +950,7 @@
|
|
|
950
950
|
"indexedForSearch": true,
|
|
951
951
|
"type": {
|
|
952
952
|
"struct": {
|
|
953
|
+
"mainValue": undefined,
|
|
953
954
|
"structFields": [
|
|
954
955
|
{
|
|
955
956
|
"aliases": [],
|
|
@@ -1037,6 +1038,7 @@
|
|
|
1037
1038
|
"indexedForSearch": true,
|
|
1038
1039
|
"type": {
|
|
1039
1040
|
"struct": {
|
|
1041
|
+
"mainValue": undefined,
|
|
1040
1042
|
"structFields": [
|
|
1041
1043
|
{
|
|
1042
1044
|
"aliases": [],
|
|
@@ -1291,6 +1293,7 @@
|
|
|
1291
1293
|
},
|
|
1292
1294
|
"type": {
|
|
1293
1295
|
"struct": {
|
|
1296
|
+
"mainValue": undefined,
|
|
1294
1297
|
"structFields": [
|
|
1295
1298
|
{
|
|
1296
1299
|
"aliases": [],
|
|
@@ -1384,6 +1387,7 @@
|
|
|
1384
1387
|
"indexedForSearch": true,
|
|
1385
1388
|
"type": {
|
|
1386
1389
|
"struct": {
|
|
1390
|
+
"mainValue": undefined,
|
|
1387
1391
|
"structFields": [
|
|
1388
1392
|
{
|
|
1389
1393
|
"aliases": [],
|
|
@@ -6414,6 +6418,7 @@
|
|
|
6414
6418
|
},
|
|
6415
6419
|
"type": {
|
|
6416
6420
|
"struct": {
|
|
6421
|
+
"mainValue": undefined,
|
|
6417
6422
|
"structFields": [
|
|
6418
6423
|
{
|
|
6419
6424
|
"aliases": [],
|