@osdk/generator-converters 2.4.0-beta.1 → 2.4.0-beta.11

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +3 -3
  3. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
  4. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +72 -0
  5. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +1 -0
  6. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js +3 -3
  7. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
  8. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +136 -0
  9. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -1
  10. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +2 -2
  11. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
  12. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +2 -0
  13. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  14. package/build/cjs/index.cjs +12 -10
  15. package/build/cjs/index.cjs.map +1 -1
  16. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +3 -3
  17. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
  18. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +72 -0
  19. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +1 -0
  20. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js +3 -3
  21. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
  22. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +136 -0
  23. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -1
  24. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +2 -2
  25. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
  26. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +2 -0
  27. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  28. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts +1 -0
  29. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts.map +1 -0
  30. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -1
  31. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @osdk/generator-converters
2
2
 
3
+ ## 2.4.0-beta.11
4
+
5
+ ### Minor Changes
6
+
7
+ - f277b30: Ensure stable ordering of arrays in code generation for object types and interface types. Sort `implements`, `implementedBy` and `linkTypes` arrays alphabetically for consistent output.
8
+
9
+ ### Patch Changes
10
+
11
+ - @osdk/api@2.4.0-beta.11
12
+
13
+ ## 2.4.0-beta.10
14
+
15
+ ### Patch Changes
16
+
17
+ - @osdk/api@2.4.0-beta.10
18
+
19
+ ## 2.4.0-beta.9
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [9101bad]
24
+ - @osdk/api@2.4.0-beta.9
25
+
26
+ ## 2.4.0-beta.8
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [9f4fe9e]
31
+ - @osdk/api@2.4.0-beta.8
32
+
33
+ ## 2.4.0-beta.7
34
+
35
+ ### Patch Changes
36
+
37
+ - @osdk/api@2.4.0-beta.7
38
+
39
+ ## 2.4.0-beta.6
40
+
41
+ ### Patch Changes
42
+
43
+ - @osdk/api@2.4.0-beta.6
44
+
45
+ ## 2.4.0-beta.5
46
+
47
+ ### Patch Changes
48
+
49
+ - @osdk/api@2.4.0-beta.5
50
+
51
+ ## 2.4.0-beta.4
52
+
53
+ ### Patch Changes
54
+
55
+ - @osdk/api@2.4.0-beta.4
56
+
57
+ ## 2.4.0-beta.3
58
+
59
+ ### Patch Changes
60
+
61
+ - @osdk/api@2.4.0-beta.3
62
+
63
+ ## 2.4.0-beta.2
64
+
65
+ ### Minor Changes
66
+
67
+ - 8c95154: Add nearestNeighbor support
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [29d2ada]
72
+ - Updated dependencies [8c95154]
73
+ - Updated dependencies [c32dcf2]
74
+ - @osdk/api@2.4.0-beta.2
75
+
3
76
  ## 2.3.0-beta.10
4
77
 
5
78
  ### Patch Changes
@@ -22,12 +22,12 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceTyp
22
22
  apiName: interfaceType.apiName,
23
23
  displayName: interfaceType.displayName,
24
24
  description: interfaceType.description,
25
- implements: interfaceType.allExtendsInterfaces ?? interfaceType.extendsInterfaces,
25
+ implements: interfaceType.allExtendsInterfaces ? [...interfaceType.allExtendsInterfaces].sort((a, b) => a.localeCompare(b)) : interfaceType.extendsInterfaces ? [...interfaceType.extendsInterfaces].sort((a, b) => a.localeCompare(b)) : undefined,
26
26
  properties: Object.fromEntries(Object.entries(interfaceType.allProperties ?? interfaceType.properties).map(([key, value]) => {
27
27
  return [key, wirePropertyV2ToSdkPropertyDefinition(value, true, log)];
28
- }).filter(([key, value]) => value != null)),
28
+ }).filter(([_, value]) => value != null)),
29
29
  links: {},
30
- implementedBy: interfaceType.implementedByObjectTypes
30
+ implementedBy: interfaceType.implementedByObjectTypes ? [...interfaceType.implementedByObjectTypes].sort((a, b) => a.localeCompare(b)) : interfaceType.implementedByObjectTypes
31
31
  };
32
32
  }
33
33
  //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","v2","log","type","rid","apiName","displayName","description","implements","allExtendsInterfaces","extendsInterfaces","properties","Object","fromEntries","entries","allProperties","map","key","value","filter","links","implementedBy","implementedByObjectTypes"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.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 { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceType: InterfaceType,\n v2: boolean,\n log?: { info: (msg: string) => void },\n): InterfaceMetadata {\n return {\n type: \"interface\",\n rid: interfaceType.rid,\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.allExtendsInterfaces\n ?? interfaceType.extendsInterfaces,\n properties: Object.fromEntries(\n Object.entries(interfaceType.allProperties ?? interfaceType.properties)\n .map((\n [key, value],\n ) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n true,\n log,\n ),\n ];\n }).filter(([key, value]) => value != null),\n ),\n links: {},\n implementedBy: interfaceType.implementedByObjectTypes,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,mDAAmDA,CACjEC,aAA4B,EAC5BC,EAAW,EACXC,GAAqC,EAClB;EACnB,OAAO;IACLC,IAAI,EAAE,WAAW;IACjBC,GAAG,EAAEJ,aAAa,CAACI,GAAG;IACtBC,OAAO,EAAEL,aAAa,CAACK,OAAO;IAC9BC,WAAW,EAAEN,aAAa,CAACM,WAAW;IACtCC,WAAW,EAAEP,aAAa,CAACO,WAAW;IACtCC,UAAU,EAAER,aAAa,CAACS,oBAAoB,IACzCT,aAAa,CAACU,iBAAiB;IACpCC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAC5BD,MAAM,CAACE,OAAO,CAACd,aAAa,CAACe,aAAa,IAAIf,aAAa,CAACW,UAAU,CAAC,CACpEK,GAAG,CAAC,CACH,CAACC,GAAG,EAAEC,KAAK,CAAC,KACT;MACH,OAAO,CACLD,GAAG,EACHnB,qCAAqC,CACnCoB,KAAK,EACL,IAAI,EACJhB,GACF,CAAC,CACF;IACH,CAAC,CAAC,CAACiB,MAAM,CAAC,CAAC,CAACF,GAAG,EAAEC,KAAK,CAAC,KAAKA,KAAK,IAAI,IAAI,CAC7C,CAAC;IACDE,KAAK,EAAE,CAAC,CAAC;IACTC,aAAa,EAAErB,aAAa,CAACsB;EAC/B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","v2","log","type","rid","apiName","displayName","description","implements","allExtendsInterfaces","sort","a","b","localeCompare","extendsInterfaces","undefined","properties","Object","fromEntries","entries","allProperties","map","key","value","filter","_","links","implementedBy","implementedByObjectTypes"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.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 { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceType: InterfaceType,\n v2: boolean,\n log?: { info: (msg: string) => void },\n): InterfaceMetadata {\n return {\n type: \"interface\",\n rid: interfaceType.rid,\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.allExtendsInterfaces\n ? [...interfaceType.allExtendsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.extendsInterfaces\n ? [...interfaceType.extendsInterfaces].sort((a, b) => a.localeCompare(b))\n : undefined,\n properties: Object.fromEntries(\n Object.entries(interfaceType.allProperties ?? interfaceType.properties)\n .map((\n [key, value],\n ) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n true,\n log,\n ),\n ];\n }).filter(([_, value]) => value != null),\n ),\n links: {},\n implementedBy: interfaceType.implementedByObjectTypes\n ? [...interfaceType.implementedByObjectTypes].sort((a, b) =>\n a.localeCompare(b)\n )\n : interfaceType.implementedByObjectTypes,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,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AC4B;EACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { describe, expect, it } from "vitest";
18
+ import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
19
+ describe("__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition", () => {
20
+ it("sorts the implements array for stable output", () => {
21
+ const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
22
+ apiName: "TestInterface",
23
+ rid: "testRid",
24
+ displayName: "Test Interface",
25
+ description: "A test interface",
26
+ properties: {},
27
+ allProperties: {},
28
+ extendsInterfaces: ["ParentZ", "ParentA", "ParentC"],
29
+ allExtendsInterfaces: ["ParentZ", "ParentA", "ParentC"],
30
+ implementedByObjectTypes: [],
31
+ links: {},
32
+ allLinks: {}
33
+ }, true);
34
+ expect(result.implements).toEqual(["ParentA", "ParentC", "ParentZ"]);
35
+ });
36
+ it("sorts the implementedBy array for stable output", () => {
37
+ const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
38
+ apiName: "TestInterface",
39
+ rid: "testRid",
40
+ displayName: "Test Interface",
41
+ description: "A test interface",
42
+ properties: {},
43
+ allProperties: {},
44
+ extendsInterfaces: [],
45
+ allExtendsInterfaces: [],
46
+ implementedByObjectTypes: ["ObjectZ", "ObjectA", "ObjectC"],
47
+ links: {},
48
+ allLinks: {}
49
+ }, true);
50
+ expect(result.implementedBy).toEqual(["ObjectA", "ObjectC", "ObjectZ"]);
51
+ });
52
+ it("preserves empty arrays", () => {
53
+ const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
54
+ apiName: "TestInterface",
55
+ rid: "testRid",
56
+ displayName: "Test Interface",
57
+ description: "A test interface",
58
+ properties: {},
59
+ allProperties: {},
60
+ extendsInterfaces: [],
61
+ allExtendsInterfaces: [],
62
+ implementedByObjectTypes: [],
63
+ links: {},
64
+ allLinks: {}
65
+ }, true);
66
+
67
+ // Empty arrays should remain as empty arrays
68
+ expect(result.implements).toEqual([]);
69
+ expect(result.implementedBy).toEqual([]);
70
+ });
71
+ });
72
+ //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js","names":["describe","expect","it","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","result","apiName","rid","displayName","description","properties","allProperties","extendsInterfaces","allExtendsInterfaces","implementedByObjectTypes","links","allLinks","implements","toEqual","implementedBy"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.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 { describe, expect, it } from \"vitest\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js\";\n\ndescribe(\"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition\", () => {\n it(\"sorts the implements array for stable output\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n extendsInterfaces: [\"ParentZ\", \"ParentA\", \"ParentC\"],\n allExtendsInterfaces: [\"ParentZ\", \"ParentA\", \"ParentC\"],\n implementedByObjectTypes: [],\n links: {},\n allLinks: {},\n }, true);\n\n expect(result.implements).toEqual([\"ParentA\", \"ParentC\", \"ParentZ\"]);\n });\n\n it(\"sorts the implementedBy array for stable output\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n extendsInterfaces: [],\n allExtendsInterfaces: [],\n implementedByObjectTypes: [\"ObjectZ\", \"ObjectA\", \"ObjectC\"],\n links: {},\n allLinks: {},\n }, true);\n\n expect(result.implementedBy).toEqual([\"ObjectA\", \"ObjectC\", \"ObjectZ\"]);\n });\n\n it(\"preserves empty arrays\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n extendsInterfaces: [],\n allExtendsInterfaces: [],\n implementedByObjectTypes: [],\n links: {},\n allLinks: {},\n }, true);\n\n // Empty arrays should remain as empty arrays\n expect(result.implements).toEqual([]);\n expect(result.implementedBy).toEqual([]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,mDAAmD,QAAQ,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zE,CAAC,CAAC;EAEFf,EAAE,CAAC,wBAAwB,EAAE,MAAM;IACjC,MAAME,MAAM,GAAGD,mDAAmD,CAAC;MACjEE,OAAO,EAAE,eAAe;MACxBC,GAAG,EAAE,SAAS;MACdC,WAAW,EAAE,gBAAgB;MAC7BC,WAAW,EAAE,kBAAkB;MAC/BC,UAAU,EAAE,CAAC,CAAC;MACdC,aAAa,EAAE,CAAC,CAAC;MACjBC,iBAAiB,EAAE,EAAE;MACrBC,oBAAoB,EAAE,EAAE;MACxBC,wBAAwB,EAAE,EAAE;MAC5BC,KAAK,EAAE,CAAC,CAAC;MACTC,QAAQ,EAAE,CAAC;IACb,CAAC,EAAE,IAAI,CAAC;;IAER;IACAd,MAAM,CAACG,MAAM,CAACY,UAAU,CAAC,CAACC,OAAO,CAAC,EAAE,CAAC;IACrChB,MAAM,CAACG,MAAM,CAACc,aAAa,CAAC,CAACD,OAAO,CAAC,EAAE,CAAC;EAC1C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -32,14 +32,14 @@ export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink
32
32
  description: objectTypeWithLink.objectType.description,
33
33
  primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,
34
34
  primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),
35
- links: Object.fromEntries(objectTypeWithLink.linkTypes.map(linkType => {
35
+ links: Object.fromEntries([...objectTypeWithLink.linkTypes].sort((a, b) => a.apiName.localeCompare(b.apiName)).map(linkType => {
36
36
  return [linkType.apiName, {
37
37
  multiplicity: linkType.cardinality === "MANY",
38
38
  targetType: linkType.objectTypeApiName
39
39
  }];
40
40
  })),
41
- properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key), log)]).filter(([key, value]) => value != null)),
42
- implements: objectTypeWithLink.implementsInterfaces,
41
+ properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key), log)]).filter(([_, value]) => value != null)),
42
+ implements: objectTypeWithLink.implementsInterfaces ? [...objectTypeWithLink.implementsInterfaces].sort((a, b) => a.localeCompare(b)) : objectTypeWithLink.implementsInterfaces,
43
43
  interfaceMap,
44
44
  inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),
45
45
  icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type) ? objectTypeWithLink.objectType.icon : undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","log","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","type","description","primaryKeyApiName","primaryKeyType","links","linkTypes","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","ensureStringEnumSupportedOrUndefined","supportedReleaseStatus","rid","visibility","supportedObjectTypeVisibility","a","k","v","supportedValues"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectMetadata } from \"@osdk/api\";\nimport type {\n ObjectTypeFullMetadata,\n PropertyApiName,\n PropertyV2,\n} from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function wireObjectTypeFullMetadataToSdkObjectMetadata(\n objectTypeWithLink: ObjectTypeFullMetadata & {\n objectType: {\n properties: Record<PropertyApiName, PropertyV2 & { nullable?: boolean }>;\n };\n },\n v2: boolean,\n log?: { info: (msg: string) => void },\n): ObjectMetadata {\n if (\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey] === undefined\n ) {\n throw new Error(\n `Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`,\n );\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (\n objectTypeWithLink.implementsInterfaces2 == null\n && objectTypeWithLink.implementsInterfaces != null\n ) {\n throw new Error(\n \"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\",\n );\n }\n\n const interfaceMap = objectTypeWithLink.implementsInterfaces2\n ? Object.fromEntries(\n Object.entries(objectTypeWithLink.implementsInterfaces2).map(\n ([interfaceApiName, impl]) => [interfaceApiName, impl.properties],\n ),\n )\n : {};\n\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey],\n ),\n links: Object.fromEntries(objectTypeWithLink.linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\n }];\n })),\n properties: Object.fromEntries(\n Object.entries(objectTypeWithLink.objectType.properties).map((\n [key, value],\n ) => [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n !(v2 && objectTypeWithLink.objectType.primaryKey === key),\n log,\n ),\n ]).filter(([key, value]) => value != null),\n ),\n implements: objectTypeWithLink.implementsInterfaces as string[],\n interfaceMap,\n inverseInterfaceMap: Object.fromEntries(\n Object.entries(interfaceMap).map((\n [interfaceApiName, props],\n ) => [interfaceApiName, invertProps(props)]),\n ),\n icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type)\n ? objectTypeWithLink.objectType.icon\n : undefined,\n titleProperty: objectTypeWithLink.objectType.titleProperty,\n displayName: objectTypeWithLink.objectType.displayName,\n pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,\n status: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.status,\n supportedReleaseStatus,\n ),\n rid: objectTypeWithLink.objectType.rid,\n visibility: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.visibility,\n supportedObjectTypeVisibility,\n ),\n };\n}\n\nfunction invertProps(\n a?: Record<string, string>,\n): typeof a extends undefined ? typeof a : Record<string, string> {\n return (a\n ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k]))\n : undefined) as typeof a extends undefined ? typeof a\n : Record<string, string>;\n}\n\nexport const supportedIconTypes = [\"blueprint\"] as const;\n\nexport const supportedReleaseStatus = [\n \"ACTIVE\",\n \"EXPERIMENTAL\",\n \"DEPRECATED\",\n \"ENDORSED\",\n] as const;\n\nexport const supportedObjectTypeVisibility = [\n \"NORMAL\",\n \"PROMINENT\",\n \"HIDDEN\",\n] as const;\n\nexport function ensureStringEnumSupportedOrUndefined<T extends string>(\n value: T | undefined,\n supportedValues: readonly string[],\n): T | undefined {\n return value && supportedValues.includes(value) ? value : undefined;\n}\n"],"mapp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EzC,kBAAkB,CAACG,UAAU,CAACsC,iBAAiB;IAClEC,MAAM,EAAEC,oCAAoC,CAC1C3C,kBAAkB,CAACG,UAAU,CAACuC,MAAM,EACpCE,sBACF,CAAC;IACDC,GAAG,EAAE7C,kBAAkB,CAACG,UAAU,CAAC0C,GAAG;IACtCC,UAAU,EAAEH,oCAAoC,CAC9C3C,kBAAkB,CAACG,UAAU,CAAC2C,UAAU,EACxCC,6BACF;EACF,CAAC;AACH;AAEA,SAASZ,WAAWA,CAClBa,CAA0B,EACsC;EAChE,OAAQA,CAAC,GACLpC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACkC,CAAC,CAAC,CAACjC,GAAG,CAAC,CAAC,CAACkC,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7D3C,SAAS;AAEf;AAEA,OAAO,MAAM+B,kBAAkB,GAAG,CAAC,WAAW,CAAU;AAExD,OAAO,MAAMO,sBAAsB,GAAG,CACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,CACF;AAEV,OAAO,MAAMG,6BAA6B,GAAG,CAC3C,QAAQ,EACR,WAAW,EACX,QAAQ,CACA;AAEV,OAAO,SAASJ,oCAAoCA,CAClDb,KAAoB,EACpBqB,eAAkC,EACnB;EACf,OAAOrB,KAAK,IAAIqB,eAAe,CAACb,QAAQ,CAACR,KAAK,CAAC,GAAGA,KAAK,GAAGxB,SAAS;AACrE","ignoreList":[]}
1
+ {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","log","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","type","description","primaryKeyApiName","primaryKeyType","links","linkTypes","sort","a","b","localeCompare","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","filter","_","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","ensureStringEnumSupportedOrUndefined","supportedReleaseStatus","rid","visibility","supportedObjectTypeVisibility","k","v","supportedValues"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { ObjectMetadata } from \"@osdk/api\";\nimport type {\n ObjectTypeFullMetadata,\n PropertyApiName,\n PropertyV2,\n} from \"@osdk/foundry.ontologies\";\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\n\nexport function wireObjectTypeFullMetadataToSdkObjectMetadata(\n objectTypeWithLink: ObjectTypeFullMetadata & {\n objectType: {\n properties: Record<PropertyApiName, PropertyV2 & { nullable?: boolean }>;\n };\n },\n v2: boolean,\n log?: { info: (msg: string) => void },\n): ObjectMetadata {\n if (\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey] === undefined\n ) {\n throw new Error(\n `Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`,\n );\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (\n objectTypeWithLink.implementsInterfaces2 == null\n && objectTypeWithLink.implementsInterfaces != null\n ) {\n throw new Error(\n \"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\",\n );\n }\n\n const interfaceMap = objectTypeWithLink.implementsInterfaces2\n ? Object.fromEntries(\n Object.entries(objectTypeWithLink.implementsInterfaces2).map(\n ([interfaceApiName, impl]) => [interfaceApiName, impl.properties],\n ),\n )\n : {};\n\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey],\n ),\n links: Object.fromEntries(\n [...objectTypeWithLink.linkTypes].sort((a, b) =>\n a.apiName.localeCompare(b.apiName)\n ).map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\n }];\n }),\n ),\n properties: Object.fromEntries(\n Object.entries(objectTypeWithLink.objectType.properties).map((\n [key, value],\n ) => [\n key,\n wirePropertyV2ToSdkPropertyDefinition(\n value,\n !(v2 && objectTypeWithLink.objectType.primaryKey === key),\n log,\n ),\n ]).filter(([_, value]) => value != null),\n ),\n implements: objectTypeWithLink.implementsInterfaces\n ? [...objectTypeWithLink.implementsInterfaces].sort((a, b) =>\n a.localeCompare(b)\n )\n : objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: Object.fromEntries(\n Object.entries(interfaceMap).map((\n [interfaceApiName, props],\n ) => [interfaceApiName, invertProps(props)]),\n ),\n icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type)\n ? objectTypeWithLink.objectType.icon\n : undefined,\n titleProperty: objectTypeWithLink.objectType.titleProperty,\n displayName: objectTypeWithLink.objectType.displayName,\n pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,\n status: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.status,\n supportedReleaseStatus,\n ),\n rid: objectTypeWithLink.objectType.rid,\n visibility: ensureStringEnumSupportedOrUndefined(\n objectTypeWithLink.objectType.visibility,\n supportedObjectTypeVisibility,\n ),\n };\n}\n\nfunction invertProps(\n a?: Record<string, string>,\n): typeof a extends undefined ? typeof a : Record<string, string> {\n return (a\n ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k]))\n : undefined) as typeof a extends undefined ? typeof a\n : Record<string, string>;\n}\n\nexport const supportedIconTypes = [\"blueprint\"] as const;\n\nexport const supportedReleaseStatus = [\n \"ACTIVE\",\n \"EXPERIMENTAL\",\n \"DEPRECATED\",\n \"ENDORSED\",\n] as const;\n\nexport const supportedObjectTypeVisibility = [\n \"NORMAL\",\n \"PROMINENT\",\n \"HIDDEN\",\n] as const;\n\nexport function ensureStringEnumSupportedOrUndefined<T extends string>(\n value: T | undefined,\n supportedValues: readonly string[],\n): T | undefined {\n return value && supportedValues.includes(value) ? value : undefined;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,2CAA2C,QAAQ,kDAAkD;AAC9G,SAASC,qCAAqC,QAAQ,4CAA4C;AAElG,OAAO,SAASC,6CAA6CA,CAC3DC,kBAIC,EACDC,EAAW,EACXC,GAAqC,EACrB;EAChB,IACEF,kBAAkB,CAACG,UAAU,CAC1BC,UAAU,CAACJ,kBAAkB,CAACG,UAAU,CAACE,UAAU,CAAC,KAAKC,SAAS,EACrE;IACA,MAAM,IAAIC,KAAK,CACb,eAAeP,kBAAkB,CAACG,UAAU,CAACE,UAAU,iBAAiBL,kBAAkB,CAACG,UAAU,CAACK,OAAO,EAC/G,CAAC;EACH;;EAEA;EACA,IACER,kBAAkB,CAACS,qBAAqB,IAAI,IAAI,IAC7CT,kBAAkB,CAACU,oBAAoB,IAAI,IAAI,EAClD;IACA,MAAM,IAAIH,KAAK,CACb,2FACF,CAAC;EACH;EAEA,MAAMI,YAAY,G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AA0B,EACsC;EAChE,OAAQA,CAAC,GACLb,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACW,CAAC,CAAC,CAACV,GAAG,CAAC,CAAC,CAACsC,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7D/C,SAAS;AAEf;AAEA,OAAO,MAAMoC,kBAAkB,GAAG,CAAC,WAAW,CAAU;AAExD,OAAO,MAAMO,sBAAsB,GAAG,CACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,CACF;AAEV,OAAO,MAAMG,6BAA6B,GAAG,CAC3C,QAAQ,EACR,WAAW,EACX,QAAQ,CACA;AAEV,OAAO,SAASJ,oCAAoCA,CAClDd,KAAoB,EACpBqB,eAAkC,EACnB;EACf,OAAOrB,KAAK,IAAIqB,eAAe,CAACZ,QAAQ,CAACT,KAAK,CAAC,GAAGA,KAAK,GAAG5B,SAAS;AACrE","ignoreList":[]}
@@ -123,5 +123,141 @@ describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
123
123
  expect(result.visibility).toBeUndefined();
124
124
  expect(result.icon).toBeUndefined();
125
125
  });
126
+ it("sorts the implements array for stable output", () => {
127
+ const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
128
+ implementsInterfaces: ["InterfaceZ", "InterfaceA", "InterfaceC"],
129
+ implementsInterfaces2: {
130
+ "InterfaceZ": {
131
+ properties: {}
132
+ },
133
+ "InterfaceA": {
134
+ properties: {}
135
+ },
136
+ "InterfaceC": {
137
+ properties: {}
138
+ }
139
+ },
140
+ linkTypes: [],
141
+ objectType: {
142
+ apiName: "apiName",
143
+ description: "description",
144
+ displayName: "displayName",
145
+ pluralDisplayName: "displayNames",
146
+ icon: {
147
+ type: "blueprint",
148
+ name: "blueprint",
149
+ color: "blue"
150
+ },
151
+ primaryKey: "primaryKey",
152
+ properties: {
153
+ primaryKey: {
154
+ dataType: {
155
+ type: "string"
156
+ },
157
+ "rid": "rid"
158
+ }
159
+ },
160
+ rid: "rid",
161
+ status: "ACTIVE",
162
+ titleProperty: "primaryKey"
163
+ },
164
+ sharedPropertyTypeMapping: {}
165
+ }, true);
166
+
167
+ // Check that the array is sorted alphabetically
168
+ expect(result.implements).toEqual(["InterfaceA", "InterfaceC", "InterfaceZ"]);
169
+ });
170
+ it("sorts the linkTypes array for stable output", () => {
171
+ const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
172
+ implementsInterfaces: [],
173
+ implementsInterfaces2: {},
174
+ linkTypes: [{
175
+ apiName: "linkZ",
176
+ cardinality: "ONE",
177
+ objectTypeApiName: "TargetZ",
178
+ displayName: "LinkZ",
179
+ status: "ACTIVE",
180
+ linkTypeRid: "ridZ"
181
+ }, {
182
+ apiName: "linkA",
183
+ cardinality: "MANY",
184
+ objectTypeApiName: "TargetA",
185
+ displayName: "LinkA",
186
+ status: "ACTIVE",
187
+ linkTypeRid: "ridA"
188
+ }, {
189
+ apiName: "linkC",
190
+ cardinality: "ONE",
191
+ objectTypeApiName: "TargetC",
192
+ displayName: "LinkC",
193
+ status: "ACTIVE",
194
+ linkTypeRid: "ridC"
195
+ }],
196
+ objectType: {
197
+ apiName: "apiName",
198
+ description: "description",
199
+ displayName: "displayName",
200
+ pluralDisplayName: "displayNames",
201
+ icon: {
202
+ type: "blueprint",
203
+ name: "blueprint",
204
+ color: "blue"
205
+ },
206
+ primaryKey: "primaryKey",
207
+ properties: {
208
+ primaryKey: {
209
+ dataType: {
210
+ type: "string"
211
+ },
212
+ "rid": "rid"
213
+ }
214
+ },
215
+ rid: "rid",
216
+ status: "ACTIVE",
217
+ titleProperty: "primaryKey"
218
+ },
219
+ sharedPropertyTypeMapping: {}
220
+ }, true);
221
+
222
+ // Get the link keys in the order they appear in the result
223
+ const linkKeys = Object.keys(result.links);
224
+
225
+ // Check that the links are sorted alphabetically by apiName
226
+ expect(linkKeys).toEqual(["linkA", "linkC", "linkZ"]);
227
+ });
228
+ it("preserves empty arrays", () => {
229
+ const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
230
+ implementsInterfaces: [],
231
+ implementsInterfaces2: {},
232
+ linkTypes: [],
233
+ objectType: {
234
+ apiName: "apiName",
235
+ description: "description",
236
+ displayName: "displayName",
237
+ pluralDisplayName: "displayNames",
238
+ icon: {
239
+ type: "blueprint",
240
+ name: "blueprint",
241
+ color: "blue"
242
+ },
243
+ primaryKey: "primaryKey",
244
+ properties: {
245
+ primaryKey: {
246
+ dataType: {
247
+ type: "string"
248
+ },
249
+ "rid": "rid"
250
+ }
251
+ },
252
+ rid: "rid",
253
+ status: "ACTIVE",
254
+ titleProperty: "primaryKey"
255
+ },
256
+ sharedPropertyTypeMapping: {}
257
+ }, true);
258
+
259
+ // Check that empty array is preserved
260
+ expect(result.implements).toEqual([]);
261
+ });
126
262
  });
127
263
  //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.test.js","names":["describe","expect","expectTypeOf","it","wireObjectTypeFullMetadataToSdkObjectMetadata","result","implementsInterfaces","implementsInterfaces2","linkTypes","objectType","apiName","description","displayName","pluralDisplayName","icon","type","name","color","primaryKey","properties","dataType","otherKey","nullable","rid","defaulted","status","titleProperty","sharedPropertyTypeMapping","toBe","toEqualTypeOf","visibility","toBeUndefined"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.test.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 { ObjectMetadata } from \"@osdk/api\";\nimport { describe, expect, expectTypeOf, it } from \"vitest\";\nimport type {\n supportedIconTypes,\n supportedObjectTypeVisibility,\n supportedReleaseStatus,\n} from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\n\ndescribe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {\n it(\"handles magic nullable properties\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // PK is never nullable\n expect(result.properties[\"primaryKey\"].nullable).toBe(false);\n\n // was specified above\n expect(result.properties[\"otherKey\"].nullable).toBe(false);\n\n // was unspecified, so should be nullable\n expect(result.properties[\"defaulted\"].nullable).toBe(true);\n });\n\n it(\"Is up to date with the enums from API\", () => {\n type excludedStatuses = \"\";\n expectTypeOf<\n Exclude<\n typeof supportedReleaseStatus[number],\n excludedStatuses\n >\n >()\n .toEqualTypeOf<\n NonNullable<ObjectMetadata[\"status\"]>\n >();\n\n type excludedVisibility = \"\";\n expectTypeOf<\n Exclude<typeof supportedObjectTypeVisibility[number], excludedVisibility>\n >().toEqualTypeOf<\n NonNullable<ObjectMetadata[\"visibility\"]>\n >();\n\n type excludedIconTypes = \"\";\n expectTypeOf<\n Exclude<typeof supportedIconTypes[number], excludedIconTypes>\n >()\n .toEqualTypeOf<\n NonNullable<NonNullable<ObjectMetadata[\"icon\"]>[\"type\"]>\n >();\n });\n\n it(\"does not throw when enums don't match\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: {\n type: \"INVALID_NOT_IN_API\",\n name: \"blueprint\",\n color: \"blue\",\n } as any,\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"INVALID_NOT_IN_API\" as any,\n visibility: \"INVALID_NOT_IN_API\" as any,\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n expect(result.status).toBeUndefined();\n expect(result.visibility).toBeUndefined();\n expect(result.icon).toBeUndefined();\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAM3D,SAASC,6CAA6C,QAAQ,oDAAoD;AAElHJ,QAAQ,CAACI,6CAA6C,EAAE,MAAM;EAC5DD,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAME,MAAM,GAAGD,6CAA6C,CAAC;MAC3DE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACVC,OAAO,EAAE,SAAS;QAClBC,WAAW,EAAE,aAAa;QAC1BC,WAAW,EAAE,aAAa;QAC1BC,iBAAiB,EA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["describe","expect","expectTypeOf","it","wireObjectTypeFullMetadataToSdkObjectMetadata","result","implementsInterfaces","implementsInterfaces2","linkTypes","objectType","apiName","description","displayName","pluralDisplayName","icon","type","name","color","primaryKey","properties","dataType","otherKey","nullable","rid","defaulted","status","titleProperty","sharedPropertyTypeMapping","toBe","toEqualTypeOf","visibility","toBeUndefined","implements","toEqual","cardinality","objectTypeApiName","linkTypeRid","linkKeys","Object","keys","links"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.test.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 { ObjectMetadata } from \"@osdk/api\";\nimport { describe, expect, expectTypeOf, it } from \"vitest\";\nimport type {\n supportedIconTypes,\n supportedObjectTypeVisibility,\n supportedReleaseStatus,\n} from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\n\ndescribe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {\n it(\"handles magic nullable properties\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // PK is never nullable\n expect(result.properties[\"primaryKey\"].nullable).toBe(false);\n\n // was specified above\n expect(result.properties[\"otherKey\"].nullable).toBe(false);\n\n // was unspecified, so should be nullable\n expect(result.properties[\"defaulted\"].nullable).toBe(true);\n });\n\n it(\"Is up to date with the enums from API\", () => {\n type excludedStatuses = \"\";\n expectTypeOf<\n Exclude<\n typeof supportedReleaseStatus[number],\n excludedStatuses\n >\n >()\n .toEqualTypeOf<\n NonNullable<ObjectMetadata[\"status\"]>\n >();\n\n type excludedVisibility = \"\";\n expectTypeOf<\n Exclude<typeof supportedObjectTypeVisibility[number], excludedVisibility>\n >().toEqualTypeOf<\n NonNullable<ObjectMetadata[\"visibility\"]>\n >();\n\n type excludedIconTypes = \"\";\n expectTypeOf<\n Exclude<typeof supportedIconTypes[number], excludedIconTypes>\n >()\n .toEqualTypeOf<\n NonNullable<NonNullable<ObjectMetadata[\"icon\"]>[\"type\"]>\n >();\n });\n\n it(\"does not throw when enums don't match\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: {\n type: \"INVALID_NOT_IN_API\",\n name: \"blueprint\",\n color: \"blue\",\n } as any,\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"INVALID_NOT_IN_API\" as any,\n visibility: \"INVALID_NOT_IN_API\" as any,\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n expect(result.status).toBeUndefined();\n expect(result.visibility).toBeUndefined();\n expect(result.icon).toBeUndefined();\n });\n\n it(\"sorts the implements array for stable output\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [\"InterfaceZ\", \"InterfaceA\", \"InterfaceC\"],\n implementsInterfaces2: {\n \"InterfaceZ\": { properties: {} },\n \"InterfaceA\": { properties: {} },\n \"InterfaceC\": { properties: {} },\n },\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Check that the array is sorted alphabetically\n expect(result.implements).toEqual([\n \"InterfaceA\",\n \"InterfaceC\",\n \"InterfaceZ\",\n ]);\n });\n\n it(\"sorts the linkTypes array for stable output\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [\n {\n apiName: \"linkZ\",\n cardinality: \"ONE\",\n objectTypeApiName: \"TargetZ\",\n displayName: \"LinkZ\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridZ\",\n },\n {\n apiName: \"linkA\",\n cardinality: \"MANY\",\n objectTypeApiName: \"TargetA\",\n displayName: \"LinkA\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridA\",\n },\n {\n apiName: \"linkC\",\n cardinality: \"ONE\",\n objectTypeApiName: \"TargetC\",\n displayName: \"LinkC\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridC\",\n },\n ],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Get the link keys in the order they appear in the result\n const linkKeys = Object.keys(result.links);\n\n // Check that the links are sorted alphabetically by apiName\n expect(linkKeys).toEqual([\"linkA\", \"linkC\", \"linkZ\"]);\n });\n\n it(\"preserves empty arrays\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Check that empty array is preserved\n expect(result.implements).toEqual([]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAM3D,SAASC,6CAA6C,QAAQ,oDAAoD;AAElHJ,QAAQ,CAACI,6CAA6C,EAAE,MAAM;EAC5DD,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAME,MAAM,GAAGD,6CAA6C,CAAC;MAC3DE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACVC,OAAO,EAAE,SAAS;QAClBC,W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,CAAC;MAC3DE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACVC,OAAO,EAAE,SAAS;QAClBC,WAAW,EAAE,aAAa;QAC1BC,WAAW,EAAE,aAAa;QAC1BC,iBAAiB,EAAE,cAAc;QACjCC,IAAI,EAAE;UAAEC,IAAI,EAAE,WAAW;UAAEC,IAAI,EAAE,WAAW;UAAEC,KAAK,EAAE;QAAO,CAAC;QAC7DC,UAAU,EAAE,YAAY;QACxBC,UAAU,EAAE;UACVD,UAAU,EAAE;YAAEE,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS,CAAC;YAAE,KAAK,EAAE;UAAM;QAC3D,CAAC;QACDQ,GAAG,EAAE,KAAK;QACVE,MAAM,EAAE,QAAQ;QAChBC,aAAa,EAAE;MACjB,CAAC;MACDC,yBAAyB,EAAE,CAAC;IAC9B,CAAC,EAAE,IAAI,CAAC;;IAER;IACA1B,MAAM,CAACI,MAAM,CAAC2B,UAAU,CAAC,CAACC,OAAO,CAAC,EAAE,CAAC;EACvC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -39,6 +39,7 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true,
39
39
  case "marking":
40
40
  case "geotimeSeriesReference":
41
41
  case "struct":
42
+ case "vector":
42
43
  return {
43
44
  displayName: input.displayName,
44
45
  multiplicity: false,
@@ -57,7 +58,6 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true,
57
58
  };
58
59
  }
59
60
  case "cipherText":
60
- case "vector":
61
61
  {
62
62
  log?.info(`${JSON.stringify(input.dataType.type)} is not a supported dataType`);
63
63
  return undefined;
@@ -86,6 +86,7 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType, log) {
86
86
  case "marking":
87
87
  case "geotimeSeriesReference":
88
88
  case "mediaReference":
89
+ case "vector":
89
90
  return propertyType.type;
90
91
  case "date":
91
92
  return "datetime";
@@ -105,7 +106,6 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType, log) {
105
106
  }, {});
106
107
  }
107
108
  case "cipherText":
108
- case "vector":
109
109
  {
110
110
  log?.info(`${JSON.stringify(propertyType.type)} is not a supported propertyType`);
111
111
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","input","isNullable","log","sdkPropDefinition","objectPropertyTypeToSdkPropertyDefinition","dataType","undefined","type","displayName","multiplicity","description","nullable","info","JSON","stringify","propertyType","subType","itemType","structFieldTypes","reduce","structMap","structField","apiName"],"sources":["wirePropertyV2ToSdkPropertyDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 BaseWirePropertyTypes,\n ObjectMetadata,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type {\n ObjectPropertyType,\n PropertyV2,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPropertyDefinition(\n input: (PropertyV2 | SharedPropertyType) & { nullable?: boolean },\n isNullable: boolean = true,\n log?: { info: (msg: string) => void },\n): ObjectMetadata.Property | undefined {\n const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(\n input.dataType,\n log,\n );\n if (sdkPropDefinition == null) {\n return undefined;\n }\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"mediaReference\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"struct\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: sdkPropDefinition,\n nullable: input.nullable == null ? isNullable : input.nullable,\n };\n case \"array\": {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: sdkPropDefinition,\n nullable: true,\n };\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(input.dataType.type)} is not a supported dataType`,\n );\n\n return undefined;\n }\n default:\n const _: never = input.dataType;\n log?.info(\n `${JSON.stringify(input.dataType)} is not a supported dataType`,\n );\n\n return undefined;\n }\n}\n\nfunction objectPropertyTypeToSdkPropertyDefinition(\n propertyType: ObjectPropertyType,\n log?: { info: (msg: string) => void },\n): WirePropertyTypes | undefined {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"mediaReference\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType?.type === \"string\") {\n return \"stringTimeseries\";\n } else if (propertyType.itemType?.type === \"double\") {\n return \"numericTimeseries\";\n } else return \"sensorTimeseries\";\n case \"struct\": {\n return propertyType.structFieldTypes.reduce(\n (structMap: Record<string, BaseWirePropertyTypes>, structField) => {\n structMap[structField.apiName] =\n objectPropertyTypeToSdkPropertyDefinition(\n structField.dataType,\n ) as BaseWirePropertyTypes;\n return structMap;\n },\n {},\n );\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(propertyType.type)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n default: {\n const _: never = propertyType;\n log?.info(\n `${JSON.stringify(propertyType)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASA,qCAAqCA,CACnDC,KAAiE,EACjEC,UAAmB,GAAG,IAAI,EAC1BC,GAAqC,EACA;EACrC,MAAMC,iBAAiB,GAAGC,yCAAyC,CACjEJ,KAAK,CAACK,QAAQ,EACdH,GACF,CAAC;EACD,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOG,SAAS;EAClB;EACA,QAAQN,KAAK,CAACK,QAAQ,CAACE,IAAI;IACzB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,MAAM;IACX,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,MAAM;IACX,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,gBAAgB;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,wBAAwB;IAC7B,KAAK,QAAQ;MACX,OAAO;QACLC,WAAW,EAAER,KAAK,CAACQ,WAAW;QAC9BC,YAAY,EAAE,KAAK;QACnBC,WAAW,EAAEV,KAAK,CAACU,WAAW;QAC9BH,IAAI,EAAEJ,iBAAiB;QACvBQ,QAAQ,EAAEX,KAAK,CAACW,QAAQ,IAAI,IAAI,GAAGV,UAAU,GAAGD,KAAK,CAACW;MACxD,CAAC;IACH,KAAK,OAAO;MAAE;QACZ,OAAO;UACLH,WAAW,EAAER,KAAK,CAACQ,WAAW;UAC9BC,YAAY,EAAE,IAAI;UAClBC,WAAW,EAAEV,KAAK,CAACU,WAAW;UAC9BH,IAAI,EAAEJ,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AAW,KAAK;UACjED,SAAS,CAACC,WAAW,CAACC,OAAO,CAAC,GAC5BlB,yCAAyC,CACvCiB,WAAW,CAAChB,QACd,CAA0B;UAC5B,OAAOe,SAAS;QAClB,CAAC,EACD,CAAC,CACH,CAAC;MACH;IACA,KAAK,YAAY;IACjB,KAAK,QAAQ;MAAE;QACblB,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAACR,IAAI,CAAC,kCACtC,CAAC;QAED,OAAOD,SAAS;MAClB;IACA;MAAS;QAEPJ,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAAC,kCACjC,CAAC;QAED,OAAOT,SAAS;MAClB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","input","isNullable","log","sdkPropDefinition","objectPropertyTypeToSdkPropertyDefinition","dataType","undefined","type","displayName","multiplicity","description","nullable","info","JSON","stringify","propertyType","subType","itemType","structFieldTypes","reduce","structMap","structField","apiName"],"sources":["wirePropertyV2ToSdkPropertyDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 BaseWirePropertyTypes,\n ObjectMetadata,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type {\n ObjectPropertyType,\n PropertyV2,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPropertyDefinition(\n input: (PropertyV2 | SharedPropertyType) & { nullable?: boolean },\n isNullable: boolean = true,\n log?: { info: (msg: string) => void },\n): ObjectMetadata.Property | undefined {\n const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(\n input.dataType,\n log,\n );\n if (sdkPropDefinition == null) {\n return undefined;\n }\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"mediaReference\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"struct\":\n case \"vector\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: sdkPropDefinition,\n nullable: input.nullable == null ? isNullable : input.nullable,\n };\n case \"array\": {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: sdkPropDefinition,\n nullable: true,\n };\n }\n case \"cipherText\": {\n log?.info(\n `${JSON.stringify(input.dataType.type)} is not a supported dataType`,\n );\n\n return undefined;\n }\n\n default:\n const _: never = input.dataType;\n log?.info(\n `${JSON.stringify(input.dataType)} is not a supported dataType`,\n );\n\n return undefined;\n }\n}\n\nfunction objectPropertyTypeToSdkPropertyDefinition(\n propertyType: ObjectPropertyType,\n log?: { info: (msg: string) => void },\n): WirePropertyTypes | undefined {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"mediaReference\":\n case \"vector\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType?.type === \"string\") {\n return \"stringTimeseries\";\n } else if (propertyType.itemType?.type === \"double\") {\n return \"numericTimeseries\";\n } else return \"sensorTimeseries\";\n case \"struct\": {\n return propertyType.structFieldTypes.reduce(\n (structMap: Record<string, BaseWirePropertyTypes>, structField) => {\n structMap[structField.apiName] =\n objectPropertyTypeToSdkPropertyDefinition(\n structField.dataType,\n ) as BaseWirePropertyTypes;\n return structMap;\n },\n {},\n );\n }\n case \"cipherText\": {\n log?.info(\n `${JSON.stringify(propertyType.type)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n default: {\n const _: never = propertyType;\n log?.info(\n `${JSON.stringify(propertyType)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,SAASA,qCAAqCA,CACnDC,KAAiE,EACjEC,UAAmB,GAAG,IAAI,EAC1BC,GAAqC,EACA;EACrC,MAAMC,iBAAiB,GAAGC,yCAAyC,CACjEJ,KAAK,CAACK,QAAQ,EACdH,GACF,CAAC;EACD,IAAIC,iBAAiB,IAAI,IAAI,EAAE;IAC7B,OAAOG,SAAS;EAClB;EACA,QAAQN,KAAK,CAACK,QAAQ,CAACE,IAAI;IACzB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,MAAM;IACX,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,MAAM;IACX,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,gBAAgB;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,wBAAwB;IAC7B,KAAK,QAAQ;IACb,KAAK,QAAQ;MACX,OAAO;QACLC,WAAW,EAAER,KAAK,CAACQ,WAAW;QAC9BC,YAAY,EAAE,KAAK;QACnBC,WAAW,EAAEV,KAAK,CAACU,WAAW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AAQ,EAAEV,IAAI,KAAK,QAAQ,EAAE;QAC5C,OAAO,kBAAkB;MAC3B,CAAC,MAAM,IAAIQ,YAAY,CAACE,QAAQ,EAAEV,IAAI,KAAK,QAAQ,EAAE;QACnD,OAAO,mBAAmB;MAC5B,CAAC,MAAM,OAAO,kBAAkB;IAClC,KAAK,QAAQ;MAAE;QACb,OAAOQ,YAAY,CAACG,gBAAgB,CAACC,MAAM,CACzC,CAACC,SAAgD,EAAEC,WAAW,KAAK;UACjED,SAAS,CAACC,WAAW,CAACC,OAAO,CAAC,GAC5BlB,yCAAyC,CACvCiB,WAAW,CAAChB,QACd,CAA0B;UAC5B,OAAOe,SAAS;QAClB,CAAC,EACD,CAAC,CACH,CAAC;MACH;IACA,KAAK,YAAY;MAAE;QACjBlB,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAACR,IAAI,CAAC,kCACtC,CAAC;QAED,OAAOD,SAAS;MAClB;IACA;MAAS;QAEPJ,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAAC,kCACjC,CAAC;QAED,OAAOT,SAAS;MAClB;EACF;AACF","ignoreList":[]}
@@ -111,6 +111,8 @@ export function wireQueryDataTypeToQueryDataTypeDefinition(input) {
111
111
  };
112
112
  case "null":
113
113
  case "unsupported":
114
+ case "interfaceObject":
115
+ case "interfaceObjectSet":
114
116
  throw new Error(`Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`);
115
117
  default:
116
118
  throw new Error(`Unsupported QueryDataType.type ${input.type}`);
@@ -1 +1 @@
1
- {"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.js","names":["isNullableQueryDataType","wireQueryDataTypeToQueryDataTypeDefinition","input","type","nullable","object","objectTypeApiName","objectSet","subType","multiplicity","set","allowNulls","unionTypes","length","nonNull","find","t","union","reduce","acc","push","struct","Object","fromEntries","fields","map","f","name","fieldType","twoDimensionalAggregation","get2DQueryAggregationProps","threeDimensionalAggregation","get3DQueryAggregationProps","keyType","validMapKeyTypes","includes","Error","toString","valueType","keySubtype","guardInvalidKeyTypes","key"],"sources":["wireQueryDataTypeToQueryDataTypeDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 QueryDataTypeDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"@osdk/api\";\nimport type {\n QueryAggregationKeyType,\n QueryDataType,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/foundry.ontologies\";\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\n\nexport function wireQueryDataTypeToQueryDataTypeDefinition<\n K extends string,\n>(\n input: QueryDataType,\n): QueryDataTypeDefinition {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false,\n };\n\n case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true,\n };\n\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false,\n };\n\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonNull = input.unionTypes.find(t => t.type != null);\n if (nonNull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),\n nullable: true,\n };\n }\n }\n\n return {\n type: \"union\",\n union: input.unionTypes.reduce<QueryDataTypeDefinition[]>((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, []),\n nullable: allowNulls,\n };\n\n case \"struct\":\n return {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [\n f.name,\n wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType),\n ])),\n nullable: false,\n };\n\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"entrySet\":\n const keyType = wireQueryDataTypeToQueryDataTypeDefinition(input.keyType);\n\n if (!validMapKeyTypes.includes(keyType.type)) {\n throw new Error(\n \"Map types with a key type of \" + keyType.type + \" are not supported\"\n + validMapKeyTypes.toString(),\n );\n }\n\n if (keyType.multiplicity === true) {\n throw new Error(\n \"Map types cannot have keys as arrays\",\n );\n }\n\n return {\n type: \"map\",\n nullable: false,\n keyType,\n valueType: wireQueryDataTypeToQueryDataTypeDefinition(input.valueType),\n };\n\n case \"null\":\n case \"unsupported\":\n throw new Error(\n `Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`,\n );\n\n default:\n const _: never = input;\n throw new Error(`Unsupported QueryDataType.type ${(input as any).type}`);\n }\n}\n\nfunction get2DQueryAggregationProps(\n input: TwoDimensionalAggregation,\n): TwoDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type,\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type,\n };\n }\n throw new Error(\n `Cannot create 2D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\nfunction get3DQueryAggregationProps(\n input: ThreeDimensionalAggregation,\n): ThreeDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n throw new Error(\n `Cannot create 3D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(\n key: QueryAggregationKeyType,\n): key is QueryAggregationKeyType & ({ type: \"string\" | \"boolean\" }) {\n return key.type === \"string\" || key.type === \"boolean\";\n}\n\n/**\n * The set of all valid key types for maps. This includes all types that are represented by strings or numbers in the OSDK, and Ontology Objects.\n */\nconst validMapKeyTypes = [\n \"string\",\n \"object\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"date\",\n \"timestamp\",\n \"byte\",\n \"datetime\",\n \"decimal\",\n \"marking\",\n \"short\",\n \"objectType\",\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,SAASC,0CAA0CA,CAGxDC,KAAoB,EACK;EACzB,QAAQA,KAAK,CAACC,IAAI;IAChB,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK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AAE;MACvC,OAAO;QACLA,OAAO,EAAE/B,KAAK,CAAC+B,OAAO,CAAC9B,IAAI;QAC3BmC,SAAS,EAAER,0BAA0B,CAAC5B,KAAK,CAACoC,SAAS;MACvD,CAAC;IACH;IACA,MAAM,IAAIF,KAAK,CACb,qCAAqClC,KAAK,CAAC+B,OAAO,CAAC9B,IAAI,cACzD,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA,SAASqC,oBAAoBA,CAC3BC,GAA4B,EACuC;EACnE,OAAOA,GAAG,CAACtC,IAAI,KAAK,QAAQ,IAAIsC,GAAG,CAACtC,IAAI,KAAK,SAAS;AACxD;;AAEA;AACA;AACA;AACA,MAAM+B,gBAAgB,GAAG,CACvB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,YAAY,CACb","ignoreList":[]}
1
+ {"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.js","names":["isNullableQueryDataType","wireQueryDataTypeToQueryDataTypeDefinition","input","type","nullable","object","objectTypeApiName","objectSet","subType","multiplicity","set","allowNulls","unionTypes","length","nonNull","find","t","union","reduce","acc","push","struct","Object","fromEntries","fields","map","f","name","fieldType","twoDimensionalAggregation","get2DQueryAggregationProps","threeDimensionalAggregation","get3DQueryAggregationProps","keyType","validMapKeyTypes","includes","Error","toString","valueType","keySubtype","guardInvalidKeyTypes","key"],"sources":["wireQueryDataTypeToQueryDataTypeDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 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 QueryDataTypeDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"@osdk/api\";\nimport type {\n QueryAggregationKeyType,\n QueryDataType,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/foundry.ontologies\";\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\n\nexport function wireQueryDataTypeToQueryDataTypeDefinition<\n K extends string,\n>(\n input: QueryDataType,\n): QueryDataTypeDefinition {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false,\n };\n\n case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true,\n };\n\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false,\n };\n\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonNull = input.unionTypes.find(t => t.type != null);\n if (nonNull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),\n nullable: true,\n };\n }\n }\n\n return {\n type: \"union\",\n union: input.unionTypes.reduce<QueryDataTypeDefinition[]>((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, []),\n nullable: allowNulls,\n };\n\n case \"struct\":\n return {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [\n f.name,\n wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType),\n ])),\n nullable: false,\n };\n\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"entrySet\":\n const keyType = wireQueryDataTypeToQueryDataTypeDefinition(input.keyType);\n\n if (!validMapKeyTypes.includes(keyType.type)) {\n throw new Error(\n \"Map types with a key type of \" + keyType.type + \" are not supported\"\n + validMapKeyTypes.toString(),\n );\n }\n\n if (keyType.multiplicity === true) {\n throw new Error(\n \"Map types cannot have keys as arrays\",\n );\n }\n\n return {\n type: \"map\",\n nullable: false,\n keyType,\n valueType: wireQueryDataTypeToQueryDataTypeDefinition(input.valueType),\n };\n\n case \"null\":\n case \"unsupported\":\n case \"interfaceObject\":\n case \"interfaceObjectSet\":\n throw new Error(\n `Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`,\n );\n\n default:\n const _: never = input;\n throw new Error(`Unsupported QueryDataType.type ${(input as any).type}`);\n }\n}\n\nfunction get2DQueryAggregationProps(\n input: TwoDimensionalAggregation,\n): TwoDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type,\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type,\n };\n }\n throw new Error(\n `Cannot create 2D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\nfunction get3DQueryAggregationProps(\n input: ThreeDimensionalAggregation,\n): ThreeDimensionalQueryAggregationDefinition {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n throw new Error(\n `Cannot create 3D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(\n key: QueryAggregationKeyType,\n): key is QueryAggregationKeyType & ({ type: \"string\" | \"boolean\" }) {\n return key.type === \"string\" || key.type === \"boolean\";\n}\n\n/**\n * The set of all valid key types for maps. This includes all types that are represented by strings or numbers in the OSDK, and Ontology Objects.\n */\nconst validMapKeyTypes = [\n \"string\",\n \"object\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"date\",\n \"timestamp\",\n \"byte\",\n \"datetime\",\n \"decimal\",\n \"marking\",\n \"short\",\n \"objectType\",\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,SAASC,0CAA0CA,CAGxDC,KAAoB,EACK;EACzB,QAAQA,KAAK,CAACC,IAAI;IAChB,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,WAAW;MACd,OAAO;QACLA,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBC,QAAQ,EAAE;MACZ,CAAC;IAEH,KAAK,QAAQ;MACX,OAAO;QACLD,IAAI,EAAE,QAAQ;QACdE,MAAM,EAAEH,KAAK,CAACI,iBAAsB;QACpCF,QAAQ,EAAE;MACZ,CAAC;IAEH,KAAK,WAAW;MACd,OAAO;QACLD,IAAI,EAAE,WAAW;QACjBI,SAAS,EAAEL,KAAK,CAACI,iBAAsB;QACvCF,Q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