@osdk/generator-converters 1.5.0 → 2.0.0-beta.6

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 (44) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/build/{js/index.mjs → browser/index.js} +68 -39
  3. package/build/browser/index.js.map +1 -0
  4. package/build/cjs/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.cts +4 -0
  5. package/build/cjs/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -0
  6. package/build/cjs/empty.test.d.cts +2 -0
  7. package/build/cjs/empty.test.d.ts.map +1 -0
  8. package/build/{js → cjs}/index.cjs +67 -37
  9. package/build/cjs/index.cjs.map +1 -0
  10. package/build/cjs/index.d.cts +4 -0
  11. package/build/cjs/index.d.ts.map +1 -0
  12. package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.cts +10 -0
  13. package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map +1 -0
  14. package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.cts +2 -0
  15. package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map +1 -0
  16. package/build/cjs/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.cts +4 -0
  17. package/build/cjs/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -0
  18. package/build/cjs/wirePropertyV2ToSdkPropertyDefinition.d.cts +6 -0
  19. package/build/cjs/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
  20. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +4 -0
  21. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -0
  22. package/build/esm/empty.test.d.ts +2 -0
  23. package/build/esm/empty.test.d.ts.map +1 -0
  24. package/build/esm/index.d.ts +4 -0
  25. package/build/esm/index.d.ts.map +1 -0
  26. package/build/esm/index.js +155 -0
  27. package/build/esm/index.js.map +1 -0
  28. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts +10 -0
  29. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map +1 -0
  30. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts +2 -0
  31. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map +1 -0
  32. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +4 -0
  33. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -0
  34. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts +6 -0
  35. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
  36. package/package.json +27 -22
  37. package/build/js/index.cjs.map +0 -1
  38. package/build/js/index.mjs.map +0 -1
  39. package/build/types/empty.test.d.ts +0 -1
  40. package/build/types/index.d.ts +0 -2
  41. package/build/types/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts +0 -3
  42. package/build/types/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +0 -3
  43. package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts +0 -3
  44. package/changelog/@unreleased/pr-89.v2.yml +0 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,80 @@
1
+ # @osdk/generator-converters
2
+
3
+ ## 2.0.0-beta.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3affe49]
8
+ - Updated dependencies [5d6d5ab]
9
+ - @osdk/api@2.0.0-beta.6
10
+ - @osdk/gateway@2.5.0-beta.0
11
+
12
+ ## 0.8.0-beta.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [dc25fb4]
17
+ - @osdk/api@1.10.0-beta.1
18
+
19
+ ## 0.8.0-beta.0
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [7c2db00]
24
+ - @osdk/api@1.10.0-beta.0
25
+
26
+ ## 0.7.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 388dba9: Change all internal dependencies to be tilde not caret
31
+ - d8edf10: Fix primary key types
32
+ - bc89b62: Spelling fixes and spell check in CI
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [388dba9]
37
+ - Updated dependencies [d8edf10]
38
+ - Updated dependencies [3ec7c38]
39
+ - Updated dependencies [bc89b62]
40
+ - @osdk/api@1.9.0
41
+ - @osdk/gateway@2.4.0
42
+
43
+ ## 0.7.0-beta.1
44
+
45
+ ### Minor Changes
46
+
47
+ - bc89b62: Spelling fixes and spell check in CI
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [3ec7c38]
52
+ - Updated dependencies [bc89b62]
53
+ - @osdk/api@1.9.0-beta.1
54
+ - @osdk/gateway@2.4.0-beta.0
55
+
56
+ ## 0.7.0-beta.0
57
+
58
+ ### Minor Changes
59
+
60
+ - 388dba9: Change all internal dependencies to be tilde not caret
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [388dba9]
65
+ - @osdk/api@1.9.0-beta.0
66
+
67
+ ## 0.6.0
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [c9f3214]
72
+ - Updated dependencies [c9f3214]
73
+ - @osdk/gateway@2.3.0
74
+ - @osdk/api@1.8.0
75
+
76
+ ## 0.5.0
77
+
78
+ ### Patch Changes
79
+
80
+ - @osdk/api@1.7.0
@@ -1,36 +1,3 @@
1
- // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
2
- function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
3
- switch (input.dataType.type) {
4
- case "integer":
5
- case "double":
6
- case "string":
7
- case "boolean":
8
- case "attachment":
9
- case "byte":
10
- case "decimal":
11
- case "float":
12
- case "geopoint":
13
- case "geoshape":
14
- case "long":
15
- case "short": {
16
- return input.dataType.type;
17
- }
18
- case "date": {
19
- return "datetime";
20
- }
21
- case "timestamp": {
22
- return "timestamp";
23
- }
24
- case "timeseries":
25
- case "array":
26
- case "marking":
27
- throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
28
- default:
29
- input.dataType;
30
- throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
31
- }
32
- }
33
-
34
1
  // src/wirePropertyV2ToSdkPropertyDefinition.ts
35
2
  function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
36
3
  switch (input.dataType.type) {
@@ -51,13 +18,15 @@ function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
51
18
  case "timeseries":
52
19
  case "marking":
53
20
  return {
21
+ displayName: input.displayName,
54
22
  multiplicity: false,
55
23
  description: input.description,
56
24
  type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
57
- nullable: isNullable
25
+ nullable: input.nullable == null ? isNullable : input.nullable
58
26
  };
59
27
  case "array": {
60
28
  return {
29
+ displayName: input.displayName,
61
30
  multiplicity: true,
62
31
  description: input.description,
63
32
  type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
@@ -96,7 +65,55 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
96
65
  }
97
66
  return "numericTimeseries";
98
67
  default:
99
- throw new Error(`Unexecpected data type ${JSON.stringify(propertyType)}`);
68
+ throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
69
+ }
70
+ }
71
+
72
+ // src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts
73
+ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
74
+ return {
75
+ type: "interface",
76
+ apiName: interfaceType.apiName,
77
+ displayName: interfaceType.displayName,
78
+ description: interfaceType.description,
79
+ implements: interfaceType.extendsInterfaces,
80
+ properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
81
+ return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
82
+ })),
83
+ links: {}
84
+ };
85
+ }
86
+
87
+ // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
88
+ function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
89
+ switch (input.dataType.type) {
90
+ case "integer":
91
+ case "double":
92
+ case "string":
93
+ case "boolean":
94
+ case "byte":
95
+ case "long":
96
+ case "short": {
97
+ return input.dataType.type;
98
+ }
99
+ case "date": {
100
+ return "datetime";
101
+ }
102
+ case "timestamp": {
103
+ return "timestamp";
104
+ }
105
+ case "geopoint":
106
+ case "geoshape":
107
+ case "decimal":
108
+ case "attachment":
109
+ case "timeseries":
110
+ case "array":
111
+ case "marking":
112
+ case "float":
113
+ throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
114
+ default:
115
+ input.dataType;
116
+ throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
100
117
  }
101
118
  }
102
119
 
@@ -105,6 +122,10 @@ function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink,
105
122
  if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === void 0) {
106
123
  throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
107
124
  }
125
+ if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
126
+ throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
127
+ }
128
+ const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : void 0;
108
129
  return {
109
130
  type: "object",
110
131
  apiName: objectTypeWithLink.objectType.apiName,
@@ -117,10 +138,18 @@ function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink,
117
138
  targetType: linkType.objectTypeApiName
118
139
  }];
119
140
  })),
120
- properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]))
141
+ properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),
142
+ spts: objectTypeWithLink.sharedPropertyTypeMapping,
143
+ inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),
144
+ implements: objectTypeWithLink.implementsInterfaces,
145
+ interfaceMap,
146
+ inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : void 0
121
147
  };
122
148
  }
149
+ function invertProps(a) {
150
+ return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : void 0;
151
+ }
123
152
 
124
- export { wireObjectTypeFullMetadataToSdkObjectTypeDefinition, wirePropertyV2ToSdkPropertyDefinition };
125
- //# sourceMappingURL=out.js.map
126
- //# sourceMappingURL=index.mjs.map
153
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition, wirePropertyV2ToSdkPropertyDefinition };
154
+ //# sourceMappingURL=index.js.map
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts","../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":";AAgBO,SAAS,qCAAA,CAAsC,KAAO,EAAA,UAAA,GAAa,IAAM,EAAA;AAC9E,EAAQ,QAAA,KAAA,CAAM,SAAS,IAAM;AAAA,IAC3B,KAAK,SAAA,CAAA;AAAA,IACL,KAAK,QAAA,CAAA;AAAA,IACL,KAAK,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A,IACF,UAAA,EAAY,MAAO,CAAA,WAAA,CAAY,MAAO,CAAA,OAAA,CAAQ,kBAAmB,CAAA,UAAA,CAAW,UAAU,CAAA,CAAE,GAAI,CAAA,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM,CAAC,GAAA,EAAK,qCAAsC,CAAA,KAAA,EAAO,EAAE,EAAA,IAAM,kBAAmB,CAAA,UAAA,CAAW,UAAe,KAAA,GAAA,CAAI,CAAC,CAAC,CAAC,CAAA;AAAA,IAC7N,MAAM,kBAAmB,CAAA,yBAAA;AAAA,IACzB,WAAA,EAAa,WAAY,CAAA,kBAAA,CAAmB,yBAAyB,CAAA;AAAA,IACrE,YAAY,kBAAmB,CAAA,oBAAA;AAAA,IAC/B,YAAA;AAAA,IACA,mBAAA,EAAqB,eAAe,MAAO,CAAA,WAAA,CAAY,OAAO,OAAQ,CAAA,YAAY,EAAE,GAAI,CAAA,CAAC,CAAC,gBAAkB,EAAA,KAAK,MAAM,CAAC,gBAAA,EAAkB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAI,GAAA,KAAA,CAAA;AAAA,GACpK,CAAA;AACF,CAAA;AACA,SAAS,YAAY,CAAG,EAAA;AACtB,EAAA,OAAO,IAAI,MAAO,CAAA,WAAA,CAAY,OAAO,OAAQ,CAAA,CAAC,EAAE,GAAI,CAAA,CAAC,CAAC,CAAA,EAAG,CAAC,CAAM,KAAA,CAAC,GAAG,CAAC,CAAC,CAAC,CAAI,GAAA,KAAA,CAAA,CAAA;AAC7E","file":"index.js","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\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\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 \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: input.nullable == null ? isNullable : input.nullable\n };\n case \"array\":\n {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\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 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 }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);\n }\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {\n return {\n type: \"interface\",\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.extendsInterfaces,\n properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {\n return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];\n })),\n links: {}\n };\n}","/*\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\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"byte\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"geopoint\":\n case \"geoshape\":\n case \"decimal\":\n case \"attachment\":\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n case \"float\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {\n throw new Error(\"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\");\n }\n const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : undefined;\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),\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(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),\n spts: objectTypeWithLink.sharedPropertyTypeMapping,\n inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),\n implements: objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : undefined\n };\n}\nfunction invertProps(a) {\n return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : undefined;\n}"]}
@@ -0,0 +1,4 @@
1
+ import type { InterfaceDefinition } from "@osdk/api";
2
+ import type { InterfaceType } from "@osdk/gateway/types";
3
+ export declare function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType: InterfaceType, v2: boolean): InterfaceDefinition<any, any>;
4
+ //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts","sourceRoot":"","sources":["../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAgB,mDAAmD,CACjE,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,OAAO,GACV,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAsB/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=empty.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.d.ts","sourceRoot":"","sources":["../../src/empty.test.ts"],"names":[],"mappings":""}
@@ -1,38 +1,5 @@
1
1
  'use strict';
2
2
 
3
- // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
4
- function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
5
- switch (input.dataType.type) {
6
- case "integer":
7
- case "double":
8
- case "string":
9
- case "boolean":
10
- case "attachment":
11
- case "byte":
12
- case "decimal":
13
- case "float":
14
- case "geopoint":
15
- case "geoshape":
16
- case "long":
17
- case "short": {
18
- return input.dataType.type;
19
- }
20
- case "date": {
21
- return "datetime";
22
- }
23
- case "timestamp": {
24
- return "timestamp";
25
- }
26
- case "timeseries":
27
- case "array":
28
- case "marking":
29
- throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
30
- default:
31
- input.dataType;
32
- throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
33
- }
34
- }
35
-
36
3
  // src/wirePropertyV2ToSdkPropertyDefinition.ts
37
4
  function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
38
5
  switch (input.dataType.type) {
@@ -53,13 +20,15 @@ function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
53
20
  case "timeseries":
54
21
  case "marking":
55
22
  return {
23
+ displayName: input.displayName,
56
24
  multiplicity: false,
57
25
  description: input.description,
58
26
  type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
59
- nullable: isNullable
27
+ nullable: input.nullable == null ? isNullable : input.nullable
60
28
  };
61
29
  case "array": {
62
30
  return {
31
+ displayName: input.displayName,
63
32
  multiplicity: true,
64
33
  description: input.description,
65
34
  type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
@@ -98,7 +67,55 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
98
67
  }
99
68
  return "numericTimeseries";
100
69
  default:
101
- throw new Error(`Unexecpected data type ${JSON.stringify(propertyType)}`);
70
+ throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
71
+ }
72
+ }
73
+
74
+ // src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts
75
+ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
76
+ return {
77
+ type: "interface",
78
+ apiName: interfaceType.apiName,
79
+ displayName: interfaceType.displayName,
80
+ description: interfaceType.description,
81
+ implements: interfaceType.extendsInterfaces,
82
+ properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
83
+ return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
84
+ })),
85
+ links: {}
86
+ };
87
+ }
88
+
89
+ // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
90
+ function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
91
+ switch (input.dataType.type) {
92
+ case "integer":
93
+ case "double":
94
+ case "string":
95
+ case "boolean":
96
+ case "byte":
97
+ case "long":
98
+ case "short": {
99
+ return input.dataType.type;
100
+ }
101
+ case "date": {
102
+ return "datetime";
103
+ }
104
+ case "timestamp": {
105
+ return "timestamp";
106
+ }
107
+ case "geopoint":
108
+ case "geoshape":
109
+ case "decimal":
110
+ case "attachment":
111
+ case "timeseries":
112
+ case "array":
113
+ case "marking":
114
+ case "float":
115
+ throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
116
+ default:
117
+ input.dataType;
118
+ throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
102
119
  }
103
120
  }
104
121
 
@@ -107,6 +124,10 @@ function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink,
107
124
  if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === void 0) {
108
125
  throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
109
126
  }
127
+ if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
128
+ throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
129
+ }
130
+ const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : void 0;
110
131
  return {
111
132
  type: "object",
112
133
  apiName: objectTypeWithLink.objectType.apiName,
@@ -119,11 +140,20 @@ function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink,
119
140
  targetType: linkType.objectTypeApiName
120
141
  }];
121
142
  })),
122
- properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]))
143
+ properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),
144
+ spts: objectTypeWithLink.sharedPropertyTypeMapping,
145
+ inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),
146
+ implements: objectTypeWithLink.implementsInterfaces,
147
+ interfaceMap,
148
+ inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : void 0
123
149
  };
124
150
  }
151
+ function invertProps(a) {
152
+ return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : void 0;
153
+ }
125
154
 
155
+ exports.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition;
126
156
  exports.wireObjectTypeFullMetadataToSdkObjectTypeDefinition = wireObjectTypeFullMetadataToSdkObjectTypeDefinition;
127
157
  exports.wirePropertyV2ToSdkPropertyDefinition = wirePropertyV2ToSdkPropertyDefinition;
128
- //# sourceMappingURL=out.js.map
158
+ //# sourceMappingURL=index.cjs.map
129
159
  //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts","../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wireObjectTypeFullMetadataToSdk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the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\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 \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: input.nullable == null ? isNullable : input.nullable\n };\n case \"array\":\n {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\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 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 }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);\n }\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {\n return {\n type: \"interface\",\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.extendsInterfaces,\n properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {\n return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];\n })),\n links: {}\n };\n}","/*\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\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"byte\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"geopoint\":\n case \"geoshape\":\n case \"decimal\":\n case \"attachment\":\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n case \"float\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {\n throw new Error(\"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\");\n }\n const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : undefined;\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),\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(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),\n spts: objectTypeWithLink.sharedPropertyTypeMapping,\n inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),\n implements: objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : undefined\n };\n}\nfunction invertProps(a) {\n return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : undefined;\n}"]}
@@ -0,0 +1,4 @@
1
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.cjs";
2
+ export { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "./wireObjectTypeFullMetadataToSdkObjectTypeDefinition.cjs";
3
+ export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.cjs";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mDAAmD,EAAE,MAAM,0DAA0D,CAAC;AAC/H,OAAO,EAAE,mDAAmD,EAAE,MAAM,0DAA0D,CAAC;AAC/H,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ObjectTypeDefinition } from "@osdk/api";
2
+ import type { ObjectTypeFullMetadata } from "@osdk/gateway/types";
3
+ export declare function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink: ObjectTypeFullMetadata & {
4
+ objectType: {
5
+ properties: Record<string, {
6
+ nullable?: boolean;
7
+ }>;
8
+ };
9
+ }, v2: boolean): ObjectTypeDefinition<any>;
10
+ //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIlE,wBAAgB,mDAAmD,CACjE,kBAAkB,EAAE,sBAAsB,GAAG;IAC3C,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACpE,EACD,EAAE,EAAE,OAAO,GACV,oBAAoB,CAAC,GAAG,CAAC,CAkE3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts","sourceRoot":"","sources":["../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { PrimaryKeyTypes } from "@osdk/api";
2
+ import type { PropertyV2 } from "@osdk/gateway/types";
3
+ export declare function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input: PropertyV2): PrimaryKeyTypes;
4
+ //# sourceMappingURL=wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,UAAU,GAChB,eAAe,CAkCjB"}
@@ -0,0 +1,6 @@
1
+ import type { ObjectTypePropertyDefinition } from "@osdk/api";
2
+ import type { PropertyV2, SharedPropertyType } from "@osdk/gateway/types";
3
+ export declare function wirePropertyV2ToSdkPropertyDefinition(input: (PropertyV2 | SharedPropertyType) & {
4
+ nullable?: boolean;
5
+ }, isNullable?: boolean): ObjectTypePropertyDefinition;
6
+ //# sourceMappingURL=wirePropertyV2ToSdkPropertyDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEV,UAAU,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EACjE,UAAU,GAAE,OAAc,GACzB,4BAA4B,CAwC9B"}
@@ -0,0 +1,4 @@
1
+ import type { InterfaceDefinition } from "@osdk/api";
2
+ import type { InterfaceType } from "@osdk/gateway/types";
3
+ export declare function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType: InterfaceType, v2: boolean): InterfaceDefinition<any, any>;
4
+ //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts","sourceRoot":"","sources":["../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAgB,mDAAmD,CACjE,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,OAAO,GACV,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAsB/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=empty.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.d.ts","sourceRoot":"","sources":["../../src/empty.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
2
+ export { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "./wireObjectTypeFullMetadataToSdkObjectTypeDefinition.js";
3
+ export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mDAAmD,EAAE,MAAM,0DAA0D,CAAC;AAC/H,OAAO,EAAE,mDAAmD,EAAE,MAAM,0DAA0D,CAAC;AAC/H,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC"}
@@ -0,0 +1,155 @@
1
+ // src/wirePropertyV2ToSdkPropertyDefinition.ts
2
+ function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
3
+ switch (input.dataType.type) {
4
+ case "integer":
5
+ case "string":
6
+ case "byte":
7
+ case "decimal":
8
+ case "double":
9
+ case "float":
10
+ case "long":
11
+ case "short":
12
+ case "boolean":
13
+ case "date":
14
+ case "attachment":
15
+ case "geopoint":
16
+ case "geoshape":
17
+ case "timestamp":
18
+ case "timeseries":
19
+ case "marking":
20
+ return {
21
+ displayName: input.displayName,
22
+ multiplicity: false,
23
+ description: input.description,
24
+ type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
25
+ nullable: input.nullable == null ? isNullable : input.nullable
26
+ };
27
+ case "array": {
28
+ return {
29
+ displayName: input.displayName,
30
+ multiplicity: true,
31
+ description: input.description,
32
+ type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
33
+ nullable: true
34
+ };
35
+ }
36
+ default:
37
+ input.dataType;
38
+ throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);
39
+ }
40
+ }
41
+ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
42
+ switch (propertyType.type) {
43
+ case "integer":
44
+ case "string":
45
+ case "byte":
46
+ case "decimal":
47
+ case "double":
48
+ case "float":
49
+ case "long":
50
+ case "short":
51
+ case "boolean":
52
+ case "attachment":
53
+ case "geopoint":
54
+ case "geoshape":
55
+ case "timestamp":
56
+ case "marking":
57
+ return propertyType.type;
58
+ case "date":
59
+ return "datetime";
60
+ case "array":
61
+ return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);
62
+ case "timeseries":
63
+ if (propertyType.itemType.type === "string") {
64
+ return "stringTimeseries";
65
+ }
66
+ return "numericTimeseries";
67
+ default:
68
+ throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
69
+ }
70
+ }
71
+
72
+ // src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts
73
+ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
74
+ return {
75
+ type: "interface",
76
+ apiName: interfaceType.apiName,
77
+ displayName: interfaceType.displayName,
78
+ description: interfaceType.description,
79
+ implements: interfaceType.extendsInterfaces,
80
+ properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
81
+ return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
82
+ })),
83
+ links: {}
84
+ };
85
+ }
86
+
87
+ // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
88
+ function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
89
+ switch (input.dataType.type) {
90
+ case "integer":
91
+ case "double":
92
+ case "string":
93
+ case "boolean":
94
+ case "byte":
95
+ case "long":
96
+ case "short": {
97
+ return input.dataType.type;
98
+ }
99
+ case "date": {
100
+ return "datetime";
101
+ }
102
+ case "timestamp": {
103
+ return "timestamp";
104
+ }
105
+ case "geopoint":
106
+ case "geoshape":
107
+ case "decimal":
108
+ case "attachment":
109
+ case "timeseries":
110
+ case "array":
111
+ case "marking":
112
+ case "float":
113
+ throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
114
+ default:
115
+ input.dataType;
116
+ throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
117
+ }
118
+ }
119
+
120
+ // src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts
121
+ function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {
122
+ if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === void 0) {
123
+ throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
124
+ }
125
+ if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
126
+ throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
127
+ }
128
+ const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : void 0;
129
+ return {
130
+ type: "object",
131
+ apiName: objectTypeWithLink.objectType.apiName,
132
+ description: objectTypeWithLink.objectType.description,
133
+ primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,
134
+ primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),
135
+ links: Object.fromEntries(objectTypeWithLink.linkTypes.map((linkType) => {
136
+ return [linkType.apiName, {
137
+ multiplicity: linkType.cardinality === "MANY",
138
+ targetType: linkType.objectTypeApiName
139
+ }];
140
+ })),
141
+ properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),
142
+ spts: objectTypeWithLink.sharedPropertyTypeMapping,
143
+ inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),
144
+ implements: objectTypeWithLink.implementsInterfaces,
145
+ interfaceMap,
146
+ inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : void 0
147
+ };
148
+ }
149
+ function invertProps(a) {
150
+ return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : void 0;
151
+ }
152
+
153
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition, wirePropertyV2ToSdkPropertyDefinition };
154
+ //# sourceMappingURL=index.js.map
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts","../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":";AAgBO,SAAS,qCAAA,CAAsC,KAAO,EAAA,UAAA,GAAa,IAAM,EAAA;AAC9E,EAAQ,QAAA,KAAA,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,MAAA;AAAA,QACvC,YAAY,QAAS,CAAA,iBAAA;AAAA,OACtB,CAAA,CAAA;AAAA,KACF,CAAC,CAAA;AAAA,IACF,UAAA,EAAY,MAAO,CAAA,WAAA,CAAY,MAAO,CAAA,OAAA,CAAQ,kBAAmB,CAAA,UAAA,CAAW,UAAU,CAAA,CAAE,GAAI,CAAA,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM,CAAC,GAAA,EAAK,qCAAsC,CAAA,KAAA,EAAO,EAAE,EAAA,IAAM,kBAAmB,CAAA,UAAA,CAAW,UAAe,KAAA,GAAA,CAAI,CAAC,CAAC,CAAC,CAAA;AAAA,IAC7N,MAAM,kBAAmB,CAAA,yBAAA;AAAA,IACzB,WAAA,EAAa,WAAY,CAAA,kBAAA,CAAmB,yBAAyB,CAAA;AAAA,IACrE,YAAY,kBAAmB,CAAA,oBAAA;AAAA,IAC/B,YAAA;AAAA,IACA,mBAAA,EAAqB,eAAe,MAAO,CAAA,WAAA,CAAY,OAAO,OAAQ,CAAA,YAAY,EAAE,GAAI,CAAA,CAAC,CAAC,gBAAkB,EAAA,KAAK,MAAM,CAAC,gBAAA,EAAkB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAI,GAAA,KAAA,CAAA;AAAA,GACpK,CAAA;AACF,CAAA;AACA,SAAS,YAAY,CAAG,EAAA;AACtB,EAAA,OAAO,IAAI,MAAO,CAAA,WAAA,CAAY,OAAO,OAAQ,CAAA,CAAC,EAAE,GAAI,CAAA,CAAC,CAAC,CAAA,EAAG,CAAC,CAAM,KAAA,CAAC,GAAG,CAAC,CAAC,CAAC,CAAI,GAAA,KAAA,CAAA,CAAA;AAC7E","file":"index.js","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\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\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 \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: input.nullable == null ? isNullable : input.nullable\n };\n case \"array\":\n {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\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 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 }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);\n }\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {\n return {\n type: \"interface\",\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.extendsInterfaces,\n properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {\n return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];\n })),\n links: {}\n };\n}","/*\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\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"byte\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"geopoint\":\n case \"geoshape\":\n case \"decimal\":\n case \"attachment\":\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n case \"float\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {\n throw new Error(\"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\");\n }\n const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : undefined;\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),\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(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),\n spts: objectTypeWithLink.sharedPropertyTypeMapping,\n inverseSpts: invertProps(objectTypeWithLink.sharedPropertyTypeMapping),\n implements: objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: interfaceMap ? Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])) : undefined\n };\n}\nfunction invertProps(a) {\n return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : undefined;\n}"]}
@@ -0,0 +1,10 @@
1
+ import type { ObjectTypeDefinition } from "@osdk/api";
2
+ import type { ObjectTypeFullMetadata } from "@osdk/gateway/types";
3
+ export declare function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink: ObjectTypeFullMetadata & {
4
+ objectType: {
5
+ properties: Record<string, {
6
+ nullable?: boolean;
7
+ }>;
8
+ };
9
+ }, v2: boolean): ObjectTypeDefinition<any>;
10
+ //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIlE,wBAAgB,mDAAmD,CACjE,kBAAkB,EAAE,sBAAsB,GAAG;IAC3C,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACpE,EACD,EAAE,EAAE,OAAO,GACV,oBAAoB,CAAC,GAAG,CAAC,CAkE3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts","sourceRoot":"","sources":["../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { PrimaryKeyTypes } from "@osdk/api";
2
+ import type { PropertyV2 } from "@osdk/gateway/types";
3
+ export declare function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input: PropertyV2): PrimaryKeyTypes;
4
+ //# sourceMappingURL=wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,UAAU,GAChB,eAAe,CAkCjB"}
@@ -0,0 +1,6 @@
1
+ import type { ObjectTypePropertyDefinition } from "@osdk/api";
2
+ import type { PropertyV2, SharedPropertyType } from "@osdk/gateway/types";
3
+ export declare function wirePropertyV2ToSdkPropertyDefinition(input: (PropertyV2 | SharedPropertyType) & {
4
+ nullable?: boolean;
5
+ }, isNullable?: boolean): ObjectTypePropertyDefinition;
6
+ //# sourceMappingURL=wirePropertyV2ToSdkPropertyDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEV,UAAU,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EACjE,UAAU,GAAE,OAAc,GACzB,4BAA4B,CAwC9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/generator-converters",
3
- "version": "1.5.0",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -10,50 +10,55 @@
10
10
  },
11
11
  "exports": {
12
12
  ".": {
13
- "types": "./build/types/index.d.ts",
14
- "import": "./build/js/index.mjs",
15
- "require": "./build/js/index.cjs"
13
+ "require": "./build/cjs/index.cjs",
14
+ "browser": "./build/browser/index.js",
15
+ "import": "./build/esm/index.js"
16
16
  },
17
17
  "./*": {
18
- "types": "./build/types/public/*.d.ts",
19
- "import": "./build/js/public/*.mjs",
20
- "require": "./build/js/public/*.cjs"
18
+ "require": "./build/cjs/public/*.cjs",
19
+ "browser": "./build/browser/public/*.js",
20
+ "import": "./build/esm/public/*.js"
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@osdk/api": "1.2.0",
25
- "@osdk/gateway": "1.2.0"
24
+ "@osdk/api": "~2.0.0-beta.6",
25
+ "@osdk/gateway": "~2.5.0-beta.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "ts-expect": "^1.3.0",
29
- "typescript": "^5.2.2",
30
- "vitest": "^1.2.2"
29
+ "typescript": "^5.5.4",
30
+ "vitest": "^2.0.4",
31
+ "@osdk/monorepo.tsconfig": "~0.0.0",
32
+ "@osdk/monorepo.tsup": "~0.0.0",
33
+ "@osdk/monorepo.api-extractor": "~0.0.0"
31
34
  },
32
35
  "publishConfig": {
33
36
  "access": "public"
34
37
  },
35
38
  "keywords": [],
36
39
  "files": [
37
- "build/types",
38
- "build/js",
39
- "changelog",
40
- "CHANGELOG_OLD.md",
40
+ "build/cjs",
41
+ "build/esm",
42
+ "build/browser",
43
+ "CHANGELOG.md",
41
44
  "package.json",
42
45
  "templates",
43
46
  "*.d.ts"
44
47
  ],
45
- "main": "./build/js/index.cjs",
46
- "module": "./build/js/index.mjs",
47
- "types": "./build/types/index.d.ts",
48
+ "main": "./build/cjs/index.cjs",
49
+ "module": "./build/esm/index.js",
50
+ "types": "./build/cjs/index.d.cts",
51
+ "type": "module",
48
52
  "scripts": {
53
+ "check-attw": "monorepo.tool.attw both",
54
+ "check-spelling": "cspell --quiet .",
49
55
  "clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
50
- "dev:transpile": "tsup --watch",
51
56
  "fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
52
57
  "lint": "eslint . && dprint check --config $(find-up dprint.json)",
53
- "test": "vitest run",
58
+ "test": "vitest run --pool=forks",
54
59
  "test:watch": "vitest",
55
- "transpile": "tsup",
60
+ "transpile": "monorepo.tool.transpile",
56
61
  "transpileWatch": "tsup --watch",
57
- "typecheck": "tsc-absolute --build"
62
+ "typecheck": "monorepo.tool.typecheck both"
58
63
  }
59
64
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":";AAgBO,SAAS,4CAA4C,OAAO;AACjE,UAAQ,MAAM,SAAS,MAAM;AAAA,IAC3B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,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AAA,EAC/N;AACF","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\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\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 \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: isNullable\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\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 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 }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${JSON.stringify(propertyType)}`);\n }\n}","/*\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 { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),\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(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]))\n };\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts"],"names":[],"mappings":";AAgBO,SAAS,4CAA4C,OAAO;AACjE,UAAQ,MAAM,SAAS,MAAM;AAAA,IAC3B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,SACH;AACE,aAAO,MAAM,SAAS;AAAA,IACxB;AAAA,IACF,KAAK,QACH;AACE,aAAO;AAAA,IACT;AAAA,IACF,KAAK,aACH;AACE,aAAO;AAAA,IACT;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,YAAM,IAAI,MAAM,s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ACH,aAAO,0CAA0C,aAAa,OAAO;AAAA,IACvE,KAAK;AACH,UAAI,aAAa,SAAS,SAAS,UAAU;AAC3C,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AACE,YAAM,IAAI;AACV,YAAM,IAAI,MAAM,0BAA0B,KAAK,UAAU,YAAY,CAAC,EAAE;AAAA,EAC5E;AACF;;;AClEO,SAAS,oDAAoD,oBAAoB,IAAI;AAC1F,MAAI,mBAAmB,WAAW,WAAW,mBAAmB,WAAW,UAAU,MAAM,QAAW;AACpG,UAAM,IAAI,MAAM,eAAe,mBAAmB,WAAW,UAAU,iBAAiB,mBAAmB,WAAW,OAAO,EAAE;AAAA,EACjI;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,mBAAmB,WAAW;AAAA,IACvC,aAAa,mBAAmB,WAAW;AAAA,IAC3C,mBAAmB,mBAAmB,WAAW;AAAA,IACjD,gBAAgB,4CAA4C,mBAAmB,WAAW,WAAW,mBAAmB,WAAW,UAAU,CAAC;AAAA,IAC9I,OAAO,OAAO,YAAY,mBAAmB,UAAU,IAAI,cAAY;AACrE,aAAO,CAAC,SAAS,SAAS;AAAA,QACxB,cAAc,SAAS,gBAAgB;AAAA,QACvC,YAAY,SAAS;AAAA,MACvB,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,IACF,YAAY,OAAO,YAAY,OAAO,QAAQ,mBAAmB,WAAW,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,sCAAsC,OAAO,EAAE,MAAM,mBAAmB,WAAW,eAAe,IAAI,CAAC,CAAC,CAAC;AAAA,EAC/N;AACF","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\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\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 \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: isNullable\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\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 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 }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${JSON.stringify(propertyType)}`);\n }\n}","/*\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 { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),\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(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]))\n };\n}"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "./wireObjectTypeFullMetadataToSdkObjectTypeDefinition";
2
- export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition";
@@ -1,3 +0,0 @@
1
- import type { ObjectTypeDefinition } from "@osdk/api";
2
- import type { ObjectTypeFullMetadata } from "@osdk/gateway/types";
3
- export declare function wireObjectTypeFullMetadataToSdkObjectTypeDefinition(objectTypeWithLink: ObjectTypeFullMetadata, v2: boolean): ObjectTypeDefinition<any>;
@@ -1,3 +0,0 @@
1
- import type { WirePropertyTypes } from "@osdk/api";
2
- import type { PropertyV2 } from "@osdk/gateway/types";
3
- export declare function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input: PropertyV2): keyof WirePropertyTypes;
@@ -1,3 +0,0 @@
1
- import type { ObjectTypePropertyDefinition } from "@osdk/api";
2
- import type { PropertyV2 } from "@osdk/gateway/types";
3
- export declare function wirePropertyV2ToSdkPropertyDefinition(input: PropertyV2, isNullable?: boolean): ObjectTypePropertyDefinition;
@@ -1,5 +0,0 @@
1
- type: improvement
2
- improvement:
3
- description: Dynamic ontology data loading
4
- links:
5
- - https://github.com/palantir/osdk-ts/pull/89