@osdk/maker 0.15.0-beta.8 → 0.15.0-beta.9
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 +8 -0
- package/build/browser/api/action/ActionParameterConditionalOverride.js.map +1 -1
- package/build/browser/api/defineValueType.js +8 -3
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/test/actions.test.js +8 -5
- package/build/browser/api/test/actions.test.js.map +1 -1
- package/build/browser/api/test/misc.test.js +4 -2
- package/build/browser/api/test/misc.test.js.map +1 -1
- package/build/browser/api/test/objects.test.js +3 -2
- package/build/browser/api/test/objects.test.js.map +1 -1
- package/build/browser/api/test/valueTypes.test.js +82 -0
- package/build/browser/api/test/valueTypes.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +15 -7
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertObject.js +6 -5
- package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/cjs/index.cjs +28 -14
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +3 -0
- package/build/esm/api/action/ActionParameterConditionalOverride.js.map +1 -1
- package/build/esm/api/defineValueType.js +8 -3
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/test/actions.test.js +8 -5
- package/build/esm/api/test/actions.test.js.map +1 -1
- package/build/esm/api/test/misc.test.js +4 -2
- package/build/esm/api/test/misc.test.js.map +1 -1
- package/build/esm/api/test/objects.test.js +3 -2
- package/build/esm/api/test/objects.test.js.map +1 -1
- package/build/esm/api/test/valueTypes.test.js +82 -0
- package/build/esm/api/test/valueTypes.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +15 -7
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertObject.js +6 -5
- package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts +2 -0
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts.map +1 -1
- package/build/types/api/defineValueType.d.ts +1 -0
- package/build/types/api/defineValueType.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -221,5 +221,87 @@ describe("Value Types", () => {
|
|
|
221
221
|
}
|
|
222
222
|
`);
|
|
223
223
|
});
|
|
224
|
+
it("Prefixes apiName with namespace when namespacePrefix is true", () => {
|
|
225
|
+
defineValueType({
|
|
226
|
+
apiName: "myValueType",
|
|
227
|
+
displayName: "My Value Type",
|
|
228
|
+
type: {
|
|
229
|
+
type: "string"
|
|
230
|
+
},
|
|
231
|
+
version: "1.0.0",
|
|
232
|
+
namespacePrefix: true
|
|
233
|
+
});
|
|
234
|
+
expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`
|
|
235
|
+
{
|
|
236
|
+
"valueTypes": [
|
|
237
|
+
{
|
|
238
|
+
"metadata": {
|
|
239
|
+
"apiName": "com.palantir.myValueType",
|
|
240
|
+
"displayMetadata": {
|
|
241
|
+
"description": "",
|
|
242
|
+
"displayName": "My Value Type",
|
|
243
|
+
},
|
|
244
|
+
"packageNamespace": "com.palantir",
|
|
245
|
+
"status": {
|
|
246
|
+
"active": {},
|
|
247
|
+
"type": "active",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
"versions": [
|
|
251
|
+
{
|
|
252
|
+
"baseType": {
|
|
253
|
+
"string": {},
|
|
254
|
+
"type": "string",
|
|
255
|
+
},
|
|
256
|
+
"constraints": [],
|
|
257
|
+
"exampleValues": [],
|
|
258
|
+
"version": "1.0.0",
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
}
|
|
264
|
+
`);
|
|
265
|
+
});
|
|
266
|
+
it("Fails to define duplicate value type with same apiName and version", () => {
|
|
267
|
+
defineValueType({
|
|
268
|
+
apiName: "duplicateTest",
|
|
269
|
+
displayName: "First Value Type",
|
|
270
|
+
type: {
|
|
271
|
+
type: "string"
|
|
272
|
+
},
|
|
273
|
+
version: "1.0.0"
|
|
274
|
+
});
|
|
275
|
+
expect(() => defineValueType({
|
|
276
|
+
apiName: "duplicateTest",
|
|
277
|
+
displayName: "Second Value Type",
|
|
278
|
+
type: {
|
|
279
|
+
type: "boolean"
|
|
280
|
+
},
|
|
281
|
+
version: "1.0.0"
|
|
282
|
+
})).toThrowErrorMatchingInlineSnapshot("[Error: Invariant failed: Value type with apiName duplicateTest and version 1.0.0 is already defined]");
|
|
283
|
+
});
|
|
284
|
+
it("Allows multiple versions of the same value type", () => {
|
|
285
|
+
defineValueType({
|
|
286
|
+
apiName: "multiVersion",
|
|
287
|
+
displayName: "Multi Version Type",
|
|
288
|
+
type: {
|
|
289
|
+
type: "string"
|
|
290
|
+
},
|
|
291
|
+
version: "1.0.0"
|
|
292
|
+
});
|
|
293
|
+
defineValueType({
|
|
294
|
+
apiName: "multiVersion",
|
|
295
|
+
displayName: "Multi Version Type",
|
|
296
|
+
type: {
|
|
297
|
+
type: "string"
|
|
298
|
+
},
|
|
299
|
+
version: "2.0.0"
|
|
300
|
+
});
|
|
301
|
+
const wireType = dumpValueTypeWireType();
|
|
302
|
+
expect(wireType.valueTypes).toHaveLength(1);
|
|
303
|
+
expect(wireType.valueTypes[0].versions).toHaveLength(2);
|
|
304
|
+
expect(wireType.valueTypes[0].versions.map(v => v.version)).toEqual(["1.0.0", "2.0.0"]);
|
|
305
|
+
});
|
|
224
306
|
});
|
|
225
307
|
//# sourceMappingURL=valueTypes.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueTypes.test.js","names":["beforeEach","describe","expect","it","defineObject","defineOntology","dumpOntologyFullMetadata","dumpValueTypeWireType","defineValueType","apiName","displayName","type","constraints","constraint","version","toThrowErrorMatchingInlineSnapshot","testStringValueType","description","length","minSize","maxSize","failureMessage","message","titlePropertyApiName","pluralDisplayName","primaryKeyPropertyApiName","properties","valueType","ontology","objectPropertyType","objectTypes","objectType","propertyTypes","toEqual","packageNamespace","displayMetadata","dataConstraints","toBeDefined","propertyTypeConstraints","toHaveLength","constraintWrapper","toBe","string","toMatchInlineSnapshot","status","deadline"],"sources":["valueTypes.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 { defineObject } from \"../defineObject.js\";\nimport {\n defineOntology,\n dumpOntologyFullMetadata,\n dumpValueTypeWireType,\n} from \"../defineOntology.js\";\nimport { defineValueType } from \"../defineValueType.js\";\n\ndescribe(\"Value Types\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n it(\"Fails to define value type with incorrect semver\", () => {\n expect(() =>\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n version: \"not a version\",\n })\n ).toThrowErrorMatchingInlineSnapshot(\n \"[Error: Invariant failed: Version is not a valid semver]\",\n );\n });\n\n it(\"Tests convertProperty function with valueType constraints for string\", () => {\n const testStringValueType = defineValueType({\n apiName: \"stringWithConstraints\",\n displayName: \"String With Constraints\",\n description: \"A string type with additional constraints\",\n type: {\n \"type\": \"string\",\n constraints: [\n {\n constraint: {\n type: \"length\",\n length: {\n minSize: 5,\n maxSize: 20,\n },\n },\n failureMessage: {\n message: \"String must be between 5 and 20 characters\",\n },\n },\n ],\n },\n version: \"1.0.0\",\n });\n\n const object = defineObject({\n titlePropertyApiName: \"constrainedString\",\n displayName: \"Test Object\",\n pluralDisplayName: \"Test Objects\",\n apiName: \"testObject\",\n primaryKeyPropertyApiName: \"constrainedString\",\n properties: {\n \"constrainedString\": {\n type: \"string\",\n displayName: \"Constrained String\",\n valueType: testStringValueType,\n },\n },\n });\n\n const ontology = dumpOntologyFullMetadata();\n const objectPropertyType =\n ontology.ontology.objectTypes[\"com.palantir.testObject\"]\n .objectType.propertyTypes[\"constrainedString\"];\n\n expect(objectPropertyType.valueType).toEqual({\n apiName: \"stringWithConstraints\",\n version: \"1.0.0\",\n packageNamespace: \"com.palantir\",\n displayMetadata: {\n displayName: \"String With Constraints\",\n description: \"A string type with additional constraints\",\n },\n });\n\n expect(objectPropertyType.dataConstraints).toBeDefined();\n expect(objectPropertyType.dataConstraints?.propertyTypeConstraints)\n .toHaveLength(1);\n\n const constraintWrapper = objectPropertyType.dataConstraints\n ?.propertyTypeConstraints[0];\n expect(constraintWrapper?.constraints?.type).toBe(\"string\");\n expect(\n (constraintWrapper?.constraints as {\n type: \"string\";\n string: { length: { minSize: number; maxSize: number } };\n }).string.length.minSize,\n ).toBe(5);\n expect(\n (constraintWrapper?.constraints as {\n type: \"string\";\n string: { length: { minSize: number; maxSize: number } };\n }).string.length.maxSize,\n ).toBe(20);\n expect(constraintWrapper?.failureMessage?.message).toBe(\n \"String must be between 5 and 20 characters\",\n );\n });\n\n it(\"Correctly serializes a value type\", () => {\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n version: \"0.1.0\",\n });\n expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`\n {\n \"valueTypes\": [\n {\n \"metadata\": {\n \"apiName\": \"apiName\",\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"displayName\",\n },\n \"packageNamespace\": \"com.palantir\",\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n \"versions\": [\n {\n \"baseType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"constraints\": [\n {\n \"constraint\": {\n \"constraint\": {\n \"boolean\": {\n \"allowedValues\": [\n \"TRUE_VALUE\",\n ],\n },\n \"type\": \"boolean\",\n },\n \"failureMessage\": undefined,\n },\n },\n ],\n \"exampleValues\": [],\n \"version\": \"0.1.0\",\n },\n ],\n },\n ],\n }\n `);\n });\n it(\"Correctly sets a status\", () => {\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n status: {\n type: \"deprecated\",\n deadline: \"2026-01-01\",\n message: \"This value type is deprecated\",\n },\n version: \"0.1.0\",\n });\n expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`\n {\n \"valueTypes\": [\n {\n \"metadata\": {\n \"apiName\": \"apiName\",\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"displayName\",\n },\n \"packageNamespace\": \"com.palantir\",\n \"status\": {\n \"deprecated\": {\n \"deadline\": \"2026-01-01\",\n \"message\": \"This value type is deprecated\",\n \"replacedBy\": undefined,\n },\n \"type\": \"deprecated\",\n },\n },\n \"versions\": [\n {\n \"baseType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"constraints\": [\n {\n \"constraint\": {\n \"constraint\": {\n \"boolean\": {\n \"allowedValues\": [\n \"TRUE_VALUE\",\n ],\n },\n \"type\": \"boolean\",\n },\n \"failureMessage\": undefined,\n },\n },\n ],\n \"exampleValues\": [],\n \"version\": \"0.1.0\",\n },\n ],\n },\n ],\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA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AAqB,CAAC,CAAC,CAAC,CAACoC,qBAAqB,CAAC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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":[]}
|
|
1
|
+
{"version":3,"file":"valueTypes.test.js","names":["beforeEach","describe","expect","it","defineObject","defineOntology","dumpOntologyFullMetadata","dumpValueTypeWireType","defineValueType","apiName","displayName","type","constraints","constraint","version","toThrowErrorMatchingInlineSnapshot","testStringValueType","description","length","minSize","maxSize","failureMessage","message","titlePropertyApiName","pluralDisplayName","primaryKeyPropertyApiName","properties","valueType","ontology","objectPropertyType","objectTypes","objectType","propertyTypes","toEqual","packageNamespace","displayMetadata","dataConstraints","toBeDefined","propertyTypeConstraints","toHaveLength","constraintWrapper","toBe","string","toMatchInlineSnapshot","status","deadline","namespacePrefix","wireType","valueTypes","versions","map","v"],"sources":["valueTypes.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 { defineObject } from \"../defineObject.js\";\nimport {\n defineOntology,\n dumpOntologyFullMetadata,\n dumpValueTypeWireType,\n} from \"../defineOntology.js\";\nimport { defineValueType } from \"../defineValueType.js\";\n\ndescribe(\"Value Types\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n it(\"Fails to define value type with incorrect semver\", () => {\n expect(() =>\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n version: \"not a version\",\n })\n ).toThrowErrorMatchingInlineSnapshot(\n \"[Error: Invariant failed: Version is not a valid semver]\",\n );\n });\n\n it(\"Tests convertProperty function with valueType constraints for string\", () => {\n const testStringValueType = defineValueType({\n apiName: \"stringWithConstraints\",\n displayName: \"String With Constraints\",\n description: \"A string type with additional constraints\",\n type: {\n \"type\": \"string\",\n constraints: [\n {\n constraint: {\n type: \"length\",\n length: {\n minSize: 5,\n maxSize: 20,\n },\n },\n failureMessage: {\n message: \"String must be between 5 and 20 characters\",\n },\n },\n ],\n },\n version: \"1.0.0\",\n });\n\n const object = defineObject({\n titlePropertyApiName: \"constrainedString\",\n displayName: \"Test Object\",\n pluralDisplayName: \"Test Objects\",\n apiName: \"testObject\",\n primaryKeyPropertyApiName: \"constrainedString\",\n properties: {\n \"constrainedString\": {\n type: \"string\",\n displayName: \"Constrained String\",\n valueType: testStringValueType,\n },\n },\n });\n\n const ontology = dumpOntologyFullMetadata();\n const objectPropertyType =\n ontology.ontology.objectTypes[\"com.palantir.testObject\"]\n .objectType.propertyTypes[\"constrainedString\"];\n\n expect(objectPropertyType.valueType).toEqual({\n apiName: \"stringWithConstraints\",\n version: \"1.0.0\",\n packageNamespace: \"com.palantir\",\n displayMetadata: {\n displayName: \"String With Constraints\",\n description: \"A string type with additional constraints\",\n },\n });\n\n expect(objectPropertyType.dataConstraints).toBeDefined();\n expect(objectPropertyType.dataConstraints?.propertyTypeConstraints)\n .toHaveLength(1);\n\n const constraintWrapper = objectPropertyType.dataConstraints\n ?.propertyTypeConstraints[0];\n expect(constraintWrapper?.constraints?.type).toBe(\"string\");\n expect(\n (constraintWrapper?.constraints as {\n type: \"string\";\n string: { length: { minSize: number; maxSize: number } };\n }).string.length.minSize,\n ).toBe(5);\n expect(\n (constraintWrapper?.constraints as {\n type: \"string\";\n string: { length: { minSize: number; maxSize: number } };\n }).string.length.maxSize,\n ).toBe(20);\n expect(constraintWrapper?.failureMessage?.message).toBe(\n \"String must be between 5 and 20 characters\",\n );\n });\n\n it(\"Correctly serializes a value type\", () => {\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n version: \"0.1.0\",\n });\n expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`\n {\n \"valueTypes\": [\n {\n \"metadata\": {\n \"apiName\": \"apiName\",\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"displayName\",\n },\n \"packageNamespace\": \"com.palantir\",\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n \"versions\": [\n {\n \"baseType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"constraints\": [\n {\n \"constraint\": {\n \"constraint\": {\n \"boolean\": {\n \"allowedValues\": [\n \"TRUE_VALUE\",\n ],\n },\n \"type\": \"boolean\",\n },\n \"failureMessage\": undefined,\n },\n },\n ],\n \"exampleValues\": [],\n \"version\": \"0.1.0\",\n },\n ],\n },\n ],\n }\n `);\n });\n it(\"Correctly sets a status\", () => {\n defineValueType({\n apiName: \"apiName\",\n displayName: \"displayName\",\n type: {\n \"type\": \"boolean\",\n constraints: [{ constraint: { \"allowedValues\": [\"TRUE_VALUE\"] } }],\n },\n status: {\n type: \"deprecated\",\n deadline: \"2026-01-01\",\n message: \"This value type is deprecated\",\n },\n version: \"0.1.0\",\n });\n expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`\n {\n \"valueTypes\": [\n {\n \"metadata\": {\n \"apiName\": \"apiName\",\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"displayName\",\n },\n \"packageNamespace\": \"com.palantir\",\n \"status\": {\n \"deprecated\": {\n \"deadline\": \"2026-01-01\",\n \"message\": \"This value type is deprecated\",\n \"replacedBy\": undefined,\n },\n \"type\": \"deprecated\",\n },\n },\n \"versions\": [\n {\n \"baseType\": {\n \"boolean\": {},\n \"type\": \"boolean\",\n },\n \"constraints\": [\n {\n \"constraint\": {\n \"constraint\": {\n \"boolean\": {\n \"allowedValues\": [\n \"TRUE_VALUE\",\n ],\n },\n \"type\": \"boolean\",\n },\n \"failureMessage\": undefined,\n },\n },\n ],\n \"exampleValues\": [],\n \"version\": \"0.1.0\",\n },\n ],\n },\n ],\n }\n `);\n });\n\n it(\"Prefixes apiName with namespace when namespacePrefix is true\", () => {\n defineValueType({\n apiName: \"myValueType\",\n displayName: \"My Value Type\",\n type: {\n type: \"string\",\n },\n version: \"1.0.0\",\n namespacePrefix: true,\n });\n expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`\n {\n \"valueTypes\": [\n {\n \"metadata\": {\n \"apiName\": \"com.palantir.myValueType\",\n \"displayMetadata\": {\n \"description\": \"\",\n \"displayName\": \"My Value Type\",\n },\n \"packageNamespace\": \"com.palantir\",\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n \"versions\": [\n {\n \"baseType\": {\n \"string\": {},\n \"type\": \"string\",\n },\n \"constraints\": [],\n \"exampleValues\": [],\n \"version\": \"1.0.0\",\n },\n ],\n },\n ],\n }\n `);\n });\n\n it(\"Fails to define duplicate value type with same apiName and version\", () => {\n defineValueType({\n apiName: \"duplicateTest\",\n displayName: \"First Value Type\",\n type: {\n type: \"string\",\n },\n version: \"1.0.0\",\n });\n\n expect(() =>\n defineValueType({\n apiName: \"duplicateTest\",\n displayName: \"Second Value Type\",\n type: {\n type: \"boolean\",\n },\n version: \"1.0.0\",\n })\n ).toThrowErrorMatchingInlineSnapshot(\n \"[Error: Invariant failed: Value type with apiName duplicateTest and version 1.0.0 is already defined]\",\n );\n });\n\n it(\"Allows multiple versions of the same value type\", () => {\n defineValueType({\n apiName: \"multiVersion\",\n displayName: \"Multi Version Type\",\n type: {\n type: \"string\",\n },\n version: \"1.0.0\",\n });\n\n defineValueType({\n apiName: \"multiVersion\",\n displayName: \"Multi Version Type\",\n type: {\n type: \"string\",\n },\n version: \"2.0.0\",\n });\n\n const wireType = dumpValueTypeWireType();\n expect(wireType.valueTypes).toHaveLength(1);\n expect(wireType.valueTypes[0].versions).toHaveLength(2);\n expect(wireType.valueTypes[0].versions.map(v => v.version)).toEqual([\n \"1.0.0\",\n \"2.0.0\",\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,YAAY,QAAQ,oBAAoB;AACjD,SACEC,cAAc,EACdC,wBAAwB,EACxBC,qBAAqB,QAChB,sBAAsB;AAC7B,SAASC,eAAe,QAAQ,uBAAuB;AAEvDP,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC5BD,UAAU,CAAC,YAAY;IACrB,MAAMK,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFF,EAAE,CAAC,kDAAkD,EAAE,MAAM;IAC3DD,MAAM,CAAC,MACLM,eAAe,CAAC;MACdC,OAAO,EAAE,SAAS;MAClBC,WAAW,EAAE,aAAa;MAC1BC,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS;QACjBC,WAAW,EAAE,CAAC;UAAEC,UAAU,EAAE;YAAE,eAAe,EAAE,CAAC,YAAY;UAAE;QAAE,CAAC;MACnE,CAAC;MACDC,OAAO,EAAE;IACX,CAAC,CACH,CAAC,CAACC,kCAAkC,CAClC,0DACF,CAAC;EACH,CAAC,CAAC;EAEFZ,EAAE,CAAC,sEAA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li/main.js
CHANGED
|
@@ -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.15.0-beta.
|
|
27
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.15.0-beta.9" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
28
28
|
input: {
|
|
29
29
|
alias: "i",
|
|
30
30
|
describe: "Input file",
|
|
@@ -34,29 +34,37 @@ export function convertActionParameterConditionalOverride(override, validation,
|
|
|
34
34
|
};
|
|
35
35
|
break;
|
|
36
36
|
case "visibility":
|
|
37
|
+
let overrideType = override.then ?? (validation.defaultVisibility === "editable" ? "hidden" : "editable");
|
|
37
38
|
parameterBlockOverride = {
|
|
38
39
|
type: "visibility",
|
|
39
40
|
visibility: {
|
|
40
|
-
visibility:
|
|
41
|
+
visibility: overrideType === "editable" ? {
|
|
42
|
+
type: "editable",
|
|
43
|
+
editable: {}
|
|
44
|
+
} : overrideType === "hidden" ? {
|
|
41
45
|
type: "hidden",
|
|
42
46
|
hidden: {}
|
|
43
47
|
} : {
|
|
44
|
-
type: "
|
|
45
|
-
|
|
48
|
+
type: "disabled",
|
|
49
|
+
disabled: {}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
break;
|
|
50
54
|
case "disabled":
|
|
55
|
+
overrideType = override.then ?? (validation.defaultVisibility === "editable" ? "disabled" : "editable");
|
|
51
56
|
parameterBlockOverride = {
|
|
52
57
|
type: "visibility",
|
|
53
58
|
visibility: {
|
|
54
|
-
visibility:
|
|
55
|
-
type: "disabled",
|
|
56
|
-
disabled: {}
|
|
57
|
-
} : {
|
|
59
|
+
visibility: overrideType === "editable" ? {
|
|
58
60
|
type: "editable",
|
|
59
61
|
editable: {}
|
|
62
|
+
} : overrideType === "hidden" ? {
|
|
63
|
+
type: "hidden",
|
|
64
|
+
hidden: {}
|
|
65
|
+
} : {
|
|
66
|
+
type: "disabled",
|
|
67
|
+
disabled: {}
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertActionParameterConditionalOverride.js","names":["extractAllowedValues","convertConditionDefinition","convertActionParameterConditionalOverride","override","validation","actionParameters","parameterBlockOverride","type","parameterRequired","required","notRequired","
|
|
1
|
+
{"version":3,"file":"convertActionParameterConditionalOverride.js","names":["extractAllowedValues","convertConditionDefinition","convertActionParameterConditionalOverride","override","validation","actionParameters","parameterBlockOverride","type","parameterRequired","required","notRequired","overrideType","then","defaultVisibility","visibility","editable","hidden","disabled","prefill","defaultValue","allowedValues","constraint","Error","condition","parameterBlockOverrides"],"sources":["convertActionParameterConditionalOverride.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 OntologyIrConditionalOverride,\n OntologyIrParameterValidationBlockOverride,\n} from \"@osdk/client.unstable\";\nimport type {\n ActionParameter,\n ActionParameterValidation,\n} from \"../../api/action/ActionParameter.js\";\nimport type { ActionParameterConditionalOverride } from \"../../api/action/ActionParameterConditionalOverride.js\";\nimport { extractAllowedValues } from \"../../api/defineOntology.js\";\nimport { convertConditionDefinition } from \"./convertConditionDefinition.js\";\n\nexport function convertActionParameterConditionalOverride(\n override: ActionParameterConditionalOverride,\n validation: ActionParameterValidation,\n actionParameters?: ActionParameter[],\n): OntologyIrConditionalOverride {\n let parameterBlockOverride: OntologyIrParameterValidationBlockOverride;\n switch (override.type) {\n case \"required\":\n parameterBlockOverride = {\n type: \"parameterRequired\",\n parameterRequired: {\n required: validation.required\n ? {\n type: \"notRequired\",\n notRequired: {},\n }\n : {\n type: \"required\",\n required: {},\n },\n },\n };\n break;\n case \"visibility\":\n let overrideType = override.then ?? (\n validation.defaultVisibility === \"editable\" ? \"hidden\" : \"editable\"\n );\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: overrideType === \"editable\"\n ? {\n type: \"editable\",\n editable: {},\n }\n : overrideType === \"hidden\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"disabled\",\n disabled: {},\n },\n },\n };\n break;\n case \"disabled\":\n overrideType = override.then ?? (\n validation.defaultVisibility === \"editable\" ? \"disabled\" : \"editable\"\n );\n parameterBlockOverride = {\n type: \"visibility\",\n visibility: {\n visibility: overrideType === \"editable\"\n ? {\n type: \"editable\",\n editable: {},\n }\n : overrideType === \"hidden\"\n ? {\n type: \"hidden\",\n hidden: {},\n }\n : {\n type: \"disabled\",\n disabled: {},\n },\n },\n };\n break;\n case \"defaultValue\":\n parameterBlockOverride = {\n type: \"prefill\",\n prefill: {\n prefill: override.defaultValue,\n },\n };\n break;\n case \"constraint\":\n parameterBlockOverride = {\n type: \"allowedValues\",\n allowedValues: {\n allowedValues: extractAllowedValues(override.constraint),\n },\n };\n break;\n default:\n throw new Error(`Unknown parameter override type`);\n }\n return {\n condition: convertConditionDefinition(override.condition, actionParameters),\n parameterBlockOverrides: [parameterBlockOverride],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,0BAA0B,QA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GACzB;YACAJ,IAAI,EAAE,QAAQ;YACdS,MAAM,EAAE,CAAC;UACX,CAAC,GACC;YACAT,IAAI,EAAE,UAAU;YAChBU,QAAQ,EAAE,CAAC;UACb;QACJ;MACF,CAAC;MACD;IACF,KAAK,cAAc;MACjBX,sBAAsB,GAAG;QACvBC,IAAI,EAAE,SAAS;QACfW,OAAO,EAAE;UACPA,OAAO,EAAEf,QAAQ,CAACgB;QACpB;MACF,CAAC;MACD;IACF,KAAK,YAAY;MACfb,sBAAsB,GAAG;QACvBC,IAAI,EAAE,eAAe;QACrBa,aAAa,EAAE;UACbA,aAAa,EAAEpB,oBAAoB,CAACG,QAAQ,CAACkB,UAAU;QACzD;MACF,CAAC;MACD;IACF;MACE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;EACtD;EACA,OAAO;IACLC,SAAS,EAAEtB,0BAA0B,CAACE,QAAQ,CAACoB,SAAS,EAAElB,gBAAgB,CAAC;IAC3EmB,uBAAuB,EAAE,CAAClB,sBAAsB;EAClD,CAAC;AACH","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { buildDatasource, cleanAndValidateLinkTypeId, convertObjectStatus } from "../../api/defineOntology.js";
|
|
18
18
|
import { isExotic } from "../../api/properties/PropertyTypeType.js";
|
|
19
19
|
import { convertDatasourceDefinition } from "./convertDatasourceDefinition.js";
|
|
20
20
|
import { convertObjectPropertyType } from "./convertObjectPropertyType.js";
|
|
@@ -55,10 +55,11 @@ export function convertObject(objectType) {
|
|
|
55
55
|
implementsInterfaces2: implementations.map(impl => ({
|
|
56
56
|
interfaceTypeApiName: impl.implements.apiName,
|
|
57
57
|
linksV2: {},
|
|
58
|
-
propertiesV2: {
|
|
59
|
-
|
|
60
|
-
propertyTypeRid:
|
|
61
|
-
}]))
|
|
58
|
+
propertiesV2: Object.fromEntries(impl.propertyMapping.map(mappings => [mappings.interfaceProperty, {
|
|
59
|
+
type: "propertyTypeRid",
|
|
60
|
+
propertyTypeRid: mappings.mapsTo
|
|
61
|
+
}])),
|
|
62
|
+
properties: {}
|
|
62
63
|
})),
|
|
63
64
|
allImplementsInterfaces: {}
|
|
64
65
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertObject.js","names":["addNamespaceIfNone","buildDatasource","cleanAndValidateLinkTypeId","convertObjectStatus","isExotic","convertDatasourceDefinition","convertObjectPropertyType","convertObject","objectType","derivedDatasources","derivedPropertyNames","extractDerivedDatasources","propertyDatasources","properties","filter","prop","includes","apiName","flatMap","extractPropertyDatasource","classificationGroupMarkingNames","extractMarkingGroups","mandatoryMarkingNames","classificationInputGroup","length","reduce","l","r","undefined","mandatoryInputGroup","objectDatasource","implementations","implementsInterfaces","displayMetadata","description","displayName","groupDisplayName","icon","type","blueprint","locator","color","pluralDisplayName","visibility","primaryKeys","primaryKeyPropertyApiName","propertyTypes","Object","fromEntries","map","val","titlePropertyTypeRid","titlePropertyApiName","status","redacted","implementsInterfaces2","impl","interfaceTypeApiName","implements","linksV2","propertiesV2","propertyMapping","mapping","interfaceProperty","propertyTypeRid","mapsTo","allImplementsInterfaces","datasources","entityMetadata","arePatchesEnabled","editsEnabled","aliases","markingType","markingInputGroupName","property","objectTypeApiName","identifier","geotimeDefinition","geotimeSeries","geotimeSeriesIntegrationRid","mediaSetDefinition","mediaSetView","assumedMarkings","mediaSetViewLocator","uploadProperties","inputDerivedDatasources","ds","i","buildDerivedDatasource","keys","datasource","index","linkDefinition","multiHopLink","steps","step","searchAround","linkTypeIdentifier","linkType","linkTypeSide","side","isLinkedProperties","values","derivedDefinition","linkedProperties","propertyTypeMapping","entries","sourceProp","targetProp","propertyType","aggregatedProperties","agg","buildAggregation","toString","derived","definition","limit","foreignProperty","innerDef"],"sources":["convertObject.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 OntologyIrDerivedPropertiesDefinition,\n OntologyIrDerivedPropertyAggregation,\n OntologyIrObjectTypeBlockDataV2,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertyType,\n} from \"@osdk/client.unstable\";\nimport {\n addNamespaceIfNone,\n buildDatasource,\n cleanAndValidateLinkTypeId,\n convertObjectStatus,\n} from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n} from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport { isExotic } from \"../../api/properties/PropertyTypeType.js\";\nimport { convertDatasourceDefinition } from \"./convertDatasourceDefinition.js\";\nimport { convertObjectPropertyType } from \"./convertObjectPropertyType.js\";\n\nexport function convertObject(\n objectType: ObjectType,\n): OntologyIrObjectTypeBlockDataV2 {\n const { derivedDatasources, derivedPropertyNames } =\n extractDerivedDatasources(objectType);\n\n const propertyDatasources: OntologyIrObjectTypeDatasource[] =\n (objectType.properties ?? [])\n .filter(prop => !derivedPropertyNames.includes(prop.apiName))\n .flatMap(prop => extractPropertyDatasource(prop, objectType.apiName));\n\n const classificationGroupMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"CBAC\",\n );\n\n const mandatoryMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"MANDATORY\",\n );\n\n const classificationInputGroup = classificationGroupMarkingNames.length > 0\n ? classificationGroupMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const mandatoryInputGroup = mandatoryMarkingNames.length > 0\n ? mandatoryMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const objectDatasource = buildDatasource(\n objectType.apiName,\n convertDatasourceDefinition(\n objectType,\n (objectType.properties ?? []).filter(prop =>\n !derivedPropertyNames.includes(prop.apiName)\n ),\n ),\n classificationInputGroup,\n mandatoryInputGroup,\n );\n\n const implementations = objectType.implementsInterfaces ?? [];\n\n return {\n objectType: {\n displayMetadata: {\n description: objectType.description,\n displayName: objectType.displayName,\n groupDisplayName: undefined,\n icon: {\n type: \"blueprint\",\n blueprint: objectType.icon ?? { locator: \"cube\", color: \"#2D72D2\" },\n },\n pluralDisplayName: objectType.pluralDisplayName,\n visibility: objectType.visibility ?? \"NORMAL\",\n },\n primaryKeys: [objectType.primaryKeyPropertyApiName],\n propertyTypes: Object.fromEntries(\n objectType.properties?.map<[string, OntologyIrPropertyType]>(\n val => [val.apiName, convertObjectPropertyType(val)],\n ) ?? [],\n ),\n titlePropertyTypeRid: objectType.titlePropertyApiName,\n apiName: objectType.apiName,\n status: convertObjectStatus(objectType.status),\n redacted: false,\n implementsInterfaces2: implementations.map(impl => ({\n interfaceTypeApiName: impl.implements.apiName,\n linksV2: {},\n propertiesV2: {},\n properties: Object.fromEntries(\n impl.propertyMapping.map(\n mapping => [addNamespaceIfNone(mapping.interfaceProperty), {\n propertyTypeRid: mapping.mapsTo,\n }],\n ),\n ),\n })),\n allImplementsInterfaces: {},\n },\n datasources: [\n ...propertyDatasources,\n ...derivedDatasources,\n objectDatasource,\n ],\n entityMetadata: {\n arePatchesEnabled: objectType.editsEnabled ?? false,\n aliases: objectType.aliases ?? [],\n },\n };\n}\n\n/**\n * Extracts marking group names of a specific type from object properties\n */\nexport function extractMarkingGroups(\n properties: ObjectPropertyType[],\n markingType: \"CBAC\" | \"MANDATORY\",\n): string[] {\n return properties\n .map(prop => {\n if (\n typeof prop.type === \"object\"\n && prop.type.type === \"marking\"\n && prop.type.markingType === markingType\n ) {\n return prop.type.markingInputGroupName;\n }\n return undefined;\n })\n .filter((val): val is string => val !== undefined);\n}\nexport function extractPropertyDatasource(\n property: ObjectPropertyType,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource[] {\n if (!isExotic(property.type)) {\n return [];\n }\n const identifier = objectTypeApiName + \".\" + property.apiName;\n switch (property.type as string) {\n case \"geotimeSeries\":\n const geotimeDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"geotimeSeries\",\n geotimeSeries: {\n geotimeSeriesIntegrationRid: identifier,\n properties: [property.apiName],\n },\n };\n return [buildDatasource(property.apiName, geotimeDefinition)];\n case \"mediaReference\":\n const mediaSetDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"mediaSetView\",\n mediaSetView: {\n assumedMarkings: [],\n mediaSetViewLocator: identifier,\n properties: [property.apiName],\n uploadProperties: [],\n },\n };\n return [buildDatasource(property.apiName, mediaSetDefinition)];\n default:\n return [];\n }\n}\n\nfunction extractDerivedDatasources(\n objectType: ObjectType,\n): {\n derivedDatasources: OntologyIrObjectTypeDatasource[];\n derivedPropertyNames: string[];\n} {\n const inputDerivedDatasources = (objectType.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n const derivedDatasources = inputDerivedDatasources.map((ds, i) =>\n buildDerivedDatasource(ds, i, objectType.apiName)\n );\n const derivedPropertyNames = inputDerivedDatasources.flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n return { derivedDatasources, derivedPropertyNames };\n}\n\nfunction buildDerivedDatasource(\n datasource: ObjectTypeDatasourceDefinition_derived,\n index: number,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource {\n const linkDefinition = {\n type: \"multiHopLink\",\n multiHopLink: {\n steps: datasource.linkDefinition.map(step => ({\n type: \"searchAround\",\n searchAround: {\n linkTypeIdentifier: {\n type: \"linkType\",\n linkType: cleanAndValidateLinkTypeId(step.linkType.apiName),\n },\n linkTypeSide: step.side ?? \"SOURCE\",\n },\n })),\n },\n };\n\n const isLinkedProperties =\n typeof Object.values(datasource.propertyMapping)[0] === \"string\";\n const derivedDefinition = isLinkedProperties\n ? {\n type: \"linkedProperties\",\n linkedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, targetProp],\n ) => [sourceProp, {\n type: \"propertyType\",\n propertyType: targetProp,\n }]),\n ),\n },\n }\n : {\n type: \"aggregatedProperties\",\n aggregatedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, agg],\n ) => [sourceProp, buildAggregation(agg)]),\n ),\n },\n };\n const fullDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"derived\",\n derived: {\n definition: derivedDefinition as OntologyIrDerivedPropertiesDefinition,\n },\n };\n return buildDatasource(\n objectTypeApiName + \".derived.\" + index.toString(),\n fullDefinition,\n );\n}\n\nfunction buildAggregation(\n agg: DerivedPropertyAggregation,\n): OntologyIrDerivedPropertyAggregation {\n const type = agg.type;\n const limit = \"limit\" in agg ? agg.limit : undefined;\n const foreignProperty = \"property\" in agg ? agg.property : undefined;\n const innerDef: any = {};\n if (type !== \"count\") {\n if ([\"collectList\", \"collectSet\"].includes(type)) {\n innerDef[\"linkedProperty\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n innerDef[\"limit\"] = limit;\n } else {\n innerDef[\"property\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n }\n }\n return {\n type,\n [type]: innerDef,\n } as unknown as OntologyIrDerivedPropertyAggregation;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SACEA,kBAAkB,EAClBC,eAAe,EACfC,0BAA0B,EAC1BC,mBAAmB,QACd,6BAA6B;AAOpC,SAASC,QAAQ,QAAQ,0CAA0C;AACnE,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AE;MACPC,UAAU,EAAEZ;IACd;EACF,CAIA,CAAC;AACH;AAEA,SAASS,gBAAgBA,CACvBD,GAA+B,EACO;EACtC,MAAMzE,IAAI,GAAGyE,GAAG,CAACzE,IAAI;EACrB,MAAM8E,KAAK,GAAG,OAAO,IAAIL,GAAG,GAAGA,GAAG,CAACK,KAAK,GAAGxF,SAAS;EACpD,MAAMyF,eAAe,GAAG,UAAU,IAAIN,GAAG,GAAGA,GAAG,CAACrC,QAAQ,GAAG9C,SAAS;EACpE,MAAM0F,QAAa,GAAG,CAAC,CAAC;EACxB,IAAIhF,IAAI,KAAK,OAAO,EAAE;IACpB,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAACtB,QAAQ,CAACsB,IAAI,CAAC,EAAE;MAChDgF,QAAQ,CAAC,gBAAgB,CAAC,GAAG;QAC3BhF,IAAI,EAAE,cAAc;QACpBuE,YAAY,EAAEQ;MAChB,CAAC;MACDC,QAAQ,CAAC,OAAO,CAAC,GAAGF,KAAK;IAC3B,CAAC,MAAM;MACLE,QAAQ,CAAC,UAAU,CAAC,GAAG;QACrBhF,IAAI,EAAE,cAAc;QACpBuE,YAAY,EAAEQ;MAChB,CAAC;IACH;EACF;EACA,OAAO;IACL/E,IAAI;IACJ,CAACA,IAAI,GAAGgF;EACV,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertObject.js","names":["buildDatasource","cleanAndValidateLinkTypeId","convertObjectStatus","isExotic","convertDatasourceDefinition","convertObjectPropertyType","convertObject","objectType","derivedDatasources","derivedPropertyNames","extractDerivedDatasources","propertyDatasources","properties","filter","prop","includes","apiName","flatMap","extractPropertyDatasource","classificationGroupMarkingNames","extractMarkingGroups","mandatoryMarkingNames","classificationInputGroup","length","reduce","l","r","undefined","mandatoryInputGroup","objectDatasource","implementations","implementsInterfaces","displayMetadata","description","displayName","groupDisplayName","icon","type","blueprint","locator","color","pluralDisplayName","visibility","primaryKeys","primaryKeyPropertyApiName","propertyTypes","Object","fromEntries","map","val","titlePropertyTypeRid","titlePropertyApiName","status","redacted","implementsInterfaces2","impl","interfaceTypeApiName","implements","linksV2","propertiesV2","propertyMapping","mappings","interfaceProperty","propertyTypeRid","mapsTo","allImplementsInterfaces","datasources","entityMetadata","arePatchesEnabled","editsEnabled","aliases","markingType","markingInputGroupName","property","objectTypeApiName","identifier","geotimeDefinition","geotimeSeries","geotimeSeriesIntegrationRid","mediaSetDefinition","mediaSetView","assumedMarkings","mediaSetViewLocator","uploadProperties","inputDerivedDatasources","ds","i","buildDerivedDatasource","keys","datasource","index","linkDefinition","multiHopLink","steps","step","searchAround","linkTypeIdentifier","linkType","linkTypeSide","side","isLinkedProperties","values","derivedDefinition","linkedProperties","propertyTypeMapping","entries","sourceProp","targetProp","propertyType","aggregatedProperties","agg","buildAggregation","toString","derived","definition","limit","foreignProperty","innerDef"],"sources":["convertObject.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 OntologyIrDerivedPropertiesDefinition,\n OntologyIrDerivedPropertyAggregation,\n OntologyIrObjectTypeBlockDataV2,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertyType,\n} from \"@osdk/client.unstable\";\nimport {\n buildDatasource,\n cleanAndValidateLinkTypeId,\n convertObjectStatus,\n} from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n} from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport { isExotic } from \"../../api/properties/PropertyTypeType.js\";\nimport { convertDatasourceDefinition } from \"./convertDatasourceDefinition.js\";\nimport { convertObjectPropertyType } from \"./convertObjectPropertyType.js\";\n\nexport function convertObject(\n objectType: ObjectType,\n): OntologyIrObjectTypeBlockDataV2 {\n const { derivedDatasources, derivedPropertyNames } =\n extractDerivedDatasources(objectType);\n\n const propertyDatasources: OntologyIrObjectTypeDatasource[] =\n (objectType.properties ?? [])\n .filter(prop => !derivedPropertyNames.includes(prop.apiName))\n .flatMap(prop => extractPropertyDatasource(prop, objectType.apiName));\n\n const classificationGroupMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"CBAC\",\n );\n\n const mandatoryMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"MANDATORY\",\n );\n\n const classificationInputGroup = classificationGroupMarkingNames.length > 0\n ? classificationGroupMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const mandatoryInputGroup = mandatoryMarkingNames.length > 0\n ? mandatoryMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const objectDatasource = buildDatasource(\n objectType.apiName,\n convertDatasourceDefinition(\n objectType,\n (objectType.properties ?? []).filter(prop =>\n !derivedPropertyNames.includes(prop.apiName)\n ),\n ),\n classificationInputGroup,\n mandatoryInputGroup,\n );\n\n const implementations = objectType.implementsInterfaces ?? [];\n\n return {\n objectType: {\n displayMetadata: {\n description: objectType.description,\n displayName: objectType.displayName,\n groupDisplayName: undefined,\n icon: {\n type: \"blueprint\",\n blueprint: objectType.icon ?? { locator: \"cube\", color: \"#2D72D2\" },\n },\n pluralDisplayName: objectType.pluralDisplayName,\n visibility: objectType.visibility ?? \"NORMAL\",\n },\n primaryKeys: [objectType.primaryKeyPropertyApiName],\n propertyTypes: Object.fromEntries(\n objectType.properties?.map<[string, OntologyIrPropertyType]>(\n val => [val.apiName, convertObjectPropertyType(val)],\n ) ?? [],\n ),\n titlePropertyTypeRid: objectType.titlePropertyApiName,\n apiName: objectType.apiName,\n status: convertObjectStatus(objectType.status),\n redacted: false,\n implementsInterfaces2: implementations.map(impl => ({\n interfaceTypeApiName: impl.implements.apiName,\n linksV2: {},\n propertiesV2: Object.fromEntries(impl.propertyMapping\n .map(\n mappings => [mappings.interfaceProperty, {\n type: \"propertyTypeRid\",\n propertyTypeRid: mappings.mapsTo,\n }],\n )),\n properties: {},\n })),\n allImplementsInterfaces: {},\n },\n datasources: [\n ...propertyDatasources,\n ...derivedDatasources,\n objectDatasource,\n ],\n entityMetadata: {\n arePatchesEnabled: objectType.editsEnabled ?? false,\n aliases: objectType.aliases ?? [],\n },\n };\n}\n\n/**\n * Extracts marking group names of a specific type from object properties\n */\nexport function extractMarkingGroups(\n properties: ObjectPropertyType[],\n markingType: \"CBAC\" | \"MANDATORY\",\n): string[] {\n return properties\n .map(prop => {\n if (\n typeof prop.type === \"object\"\n && prop.type.type === \"marking\"\n && prop.type.markingType === markingType\n ) {\n return prop.type.markingInputGroupName;\n }\n return undefined;\n })\n .filter((val): val is string => val !== undefined);\n}\nexport function extractPropertyDatasource(\n property: ObjectPropertyType,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource[] {\n if (!isExotic(property.type)) {\n return [];\n }\n const identifier = objectTypeApiName + \".\" + property.apiName;\n switch (property.type as string) {\n case \"geotimeSeries\":\n const geotimeDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"geotimeSeries\",\n geotimeSeries: {\n geotimeSeriesIntegrationRid: identifier,\n properties: [property.apiName],\n },\n };\n return [buildDatasource(property.apiName, geotimeDefinition)];\n case \"mediaReference\":\n const mediaSetDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"mediaSetView\",\n mediaSetView: {\n assumedMarkings: [],\n mediaSetViewLocator: identifier,\n properties: [property.apiName],\n uploadProperties: [],\n },\n };\n return [buildDatasource(property.apiName, mediaSetDefinition)];\n default:\n return [];\n }\n}\n\nfunction extractDerivedDatasources(\n objectType: ObjectType,\n): {\n derivedDatasources: OntologyIrObjectTypeDatasource[];\n derivedPropertyNames: string[];\n} {\n const inputDerivedDatasources = (objectType.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n const derivedDatasources = inputDerivedDatasources.map((ds, i) =>\n buildDerivedDatasource(ds, i, objectType.apiName)\n );\n const derivedPropertyNames = inputDerivedDatasources.flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n return { derivedDatasources, derivedPropertyNames };\n}\n\nfunction buildDerivedDatasource(\n datasource: ObjectTypeDatasourceDefinition_derived,\n index: number,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource {\n const linkDefinition = {\n type: \"multiHopLink\",\n multiHopLink: {\n steps: datasource.linkDefinition.map(step => ({\n type: \"searchAround\",\n searchAround: {\n linkTypeIdentifier: {\n type: \"linkType\",\n linkType: cleanAndValidateLinkTypeId(step.linkType.apiName),\n },\n linkTypeSide: step.side ?? \"SOURCE\",\n },\n })),\n },\n };\n\n const isLinkedProperties =\n typeof Object.values(datasource.propertyMapping)[0] === \"string\";\n const derivedDefinition = isLinkedProperties\n ? {\n type: \"linkedProperties\",\n linkedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, targetProp],\n ) => [sourceProp, {\n type: \"propertyType\",\n propertyType: targetProp,\n }]),\n ),\n },\n }\n : {\n type: \"aggregatedProperties\",\n aggregatedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, agg],\n ) => [sourceProp, buildAggregation(agg)]),\n ),\n },\n };\n const fullDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"derived\",\n derived: {\n definition: derivedDefinition as OntologyIrDerivedPropertiesDefinition,\n },\n };\n return buildDatasource(\n objectTypeApiName + \".derived.\" + index.toString(),\n fullDefinition,\n );\n}\n\nfunction buildAggregation(\n agg: DerivedPropertyAggregation,\n): OntologyIrDerivedPropertyAggregation {\n const type = agg.type;\n const limit = \"limit\" in agg ? agg.limit : undefined;\n const foreignProperty = \"property\" in agg ? agg.property : undefined;\n const innerDef: any = {};\n if (type !== \"count\") {\n if ([\"collectList\", \"collectSet\"].includes(type)) {\n innerDef[\"linkedProperty\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n innerDef[\"limit\"] = limit;\n } else {\n innerDef[\"property\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n }\n }\n return {\n type,\n [type]: innerDef,\n } as unknown as OntologyIrDerivedPropertyAggregation;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SACEA,eAAe,EACfC,0BAA0B,EAC1BC,mBAAmB,QACd,6BAA6B;AAOpC,SAASC,QAAQ,QAAQ,0CAA0C;AACnE,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,gCAAgC;AAE1E,OAAO,SAASC,aAAaA,CAC3BC,UAAsB,EACW;EACjC,MAAM;IAAEC,kBAAkB;IAAEC;EAAqB,CAAC,GAChDC,yBAAyB,CAACH,UAAU,CAAC;EAEvC,MAAMI,mBAAqD,GACzD,CAACJ,UAAU,CAACK,UAAU,IAAI,EAAE,EACzBC,MAAM,CAACC,IAAI,IAAI,CAACL,oBAAoB,CAACM,QAAQ,CAACD,IAAI,CAACE,OAAO,CAAC,CAAC,CAC5DC,OAAO,CAACH,IAAI,IAAII,yBAAyB,CAACJ,IAAI,EAAEP,UAAU,CAACS,OAAO,CAAC,CAAC;EAEzE,MAAMG,+BAA+B,GAAGC,oBAAoB,CAC1Db,UAAU,CAACK,UAAU,IAAI,EAAE,EAC3B,MACF,CAAC;EAED,MAAMS,qBAAqB,GAAGD,oBAAoB,CAChDb,UAAU,CAACK,UAAU,IAAI,EAAE,EAC3B,WACF,CAAC;EAED,MAAMU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MACLE,QAAQ,CAAC,UAAU,CAAC,GAAG;QACrBhF,IAAI,EAAE,cAAc;QACpBuE,YAAY,EAAEQ;MAChB,CAAC;IACH;EACF;EACA,OAAO;IACL/E,IAAI;IACJ,CAACA,IAAI,GAAGgF;EACV,CAAC;AACH","ignoreList":[]}
|
|
@@ -5,10 +5,12 @@ export type ActionParameterConditionalOverride = VisibilityOverride | DisabledOv
|
|
|
5
5
|
export type VisibilityOverride = {
|
|
6
6
|
type: "visibility"
|
|
7
7
|
condition: ConditionDefinition
|
|
8
|
+
then?: "editable" | "disabled" | "hidden"
|
|
8
9
|
};
|
|
9
10
|
export type DisabledOverride = {
|
|
10
11
|
type: "disabled"
|
|
11
12
|
condition: ConditionDefinition
|
|
13
|
+
then?: "editable" | "disabled" | "hidden"
|
|
12
14
|
};
|
|
13
15
|
export type RequiredOverride = {
|
|
14
16
|
type: "required"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,kCAAkC,uBAAwB;AACxE,cAAc,oCAAoC,mCAAoC;AACtF,cAAc,2BAA2B,0BAA2B;AAEpE,YAAY,qCACR,qBACA,mBACA,mBACA,uBACA;AAEJ,YAAY,qBAAqB;CAC/B,MAAM;CACN,WAAW;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,kCAAkC,uBAAwB;AACxE,cAAc,oCAAoC,mCAAoC;AACtF,cAAc,2BAA2B,0BAA2B;AAEpE,YAAY,qCACR,qBACA,mBACA,mBACA,uBACA;AAEJ,YAAY,qBAAqB;CAC/B,MAAM;CACN,WAAW;CACX,OACI,aACA,aACA;AACL;AAED,YAAY,mBAAmB;CAC7B,MAAM;CACN,WAAW;CACX,OACI,aACA,aACA;AACL;AAED,YAAY,mBAAmB;CAC7B,MAAM;CACN,WAAW;AACZ;AAED,YAAY,uBAAuB;CACjC,MAAM;CACN,WAAW;CACX,cAAc;AACf;AAED,YAAY,qBAAqB;CAC/B,MAAM;CACN,WAAW;CACX,YAAY;AACb","names":[],"sources":["../../../../src/api/action/ActionParameterConditionalOverride.ts"],"version":3,"file":"ActionParameterConditionalOverride.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAME,cACA,uBACK,uBAAwB;
|
|
1
|
+
{"mappings":"AAgBA,cAME,cACA,uBACK,uBAAwB;AAQ/B,cAAc,kCAAkC,wCAAyC;AACzF,cAAc,qBAAqB,2BAA4B;KAiC1D,mCACF,QAAQ,iBAAiB,KAAK,WAAU;CACvC,MAAM,KAAK;CACX,cAAc,KAAK;AACpB;KAEE,yBACH,oCAAoC;AA+CtC,YAAY,sBAAsB;CAChC;CACA;CACA;CACA,MAAM;CACN;CACA,SAAS;CACT;AACD;AAED,YAAY,sBAAsB,WAAW;CAC3C,MAAM;CACN;CACA;CACA,aAAa;AACd;AAED,OAAO,iBAAS,gBACdA,cAAc,sBACb;AA0DH,OAAO,iBAAS,4CACdC,QAAQ,kCACP","names":["valueTypeDef: ValueTypeDefinition","status: UserValueTypeStatus | undefined"],"sources":["../../../src/api/defineValueType.ts"],"version":3,"file":"defineValueType.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAGE,iCACA,sCAGK,uBAAwB;
|
|
1
|
+
{"mappings":"AAgBA,cAGE,iCACA,sCAGK,uBAAwB;AAM/B,cAAc,0BAA0B,wCAAyC;AACjF,cAAc,kBAAkB,gCAAiC;AASjE,OAAO,iBAAS,cACdA,YAAY,aACX;;;;AA6FH,OAAO,iBAAS,qBACdC,YAAY,sBACZC,aAAa,SAAS;AAexB,OAAO,iBAAS,0BACdC,UAAU,oBACVC,4BACC","names":["objectType: ObjectType","properties: ObjectPropertyType[]","markingType: \"CBAC\" | \"MANDATORY\"","property: ObjectPropertyType","objectTypeApiName: string"],"sources":["../../../../src/conversion/toMarketplace/convertObject.ts"],"version":3,"file":"convertObject.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/maker",
|
|
3
|
-
"version": "0.15.0-beta.
|
|
3
|
+
"version": "0.15.0-beta.9",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"tiny-invariant": "^1.3.3",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
37
|
"yargs": "^17.7.2",
|
|
38
|
-
"@osdk/api": "~2.7.0-beta.
|
|
38
|
+
"@osdk/api": "~2.7.0-beta.14"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/mustache": "^4.2.6",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@types/yargs": "^17.0.33",
|
|
44
44
|
"typescript": "~5.5.4",
|
|
45
45
|
"vitest": "^3.2.4",
|
|
46
|
-
"@osdk/client.unstable": "~2.7.0-beta.12",
|
|
47
46
|
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
47
|
+
"@osdk/client.unstable": "~2.7.0-beta.14",
|
|
48
48
|
"@osdk/monorepo.tsconfig": "~0.6.0-beta.1"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|