@osdk/generator-converters 1.5.0 → 2.0.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 (36) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/build/browser/index.js +318 -0
  3. package/build/browser/index.js.map +1 -0
  4. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +4 -0
  5. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -0
  6. package/build/esm/empty.test.d.ts +2 -0
  7. package/build/esm/empty.test.d.ts.map +1 -0
  8. package/build/esm/index.d.ts +8 -0
  9. package/build/esm/index.d.ts.map +1 -0
  10. package/build/esm/index.js +318 -0
  11. package/build/esm/index.js.map +1 -0
  12. package/build/esm/isNullableQueryDataType.d.ts +3 -0
  13. package/build/esm/isNullableQueryDataType.d.ts.map +1 -0
  14. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts +10 -0
  15. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map +1 -0
  16. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts +2 -0
  17. package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map +1 -0
  18. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +4 -0
  19. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -0
  20. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts +6 -0
  21. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
  22. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +4 -0
  23. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -0
  24. package/build/esm/wireQueryTypeV2ToSdkQueryDefinition.d.ts +12 -0
  25. package/build/esm/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +1 -0
  26. package/package.json +24 -22
  27. package/build/js/index.cjs +0 -129
  28. package/build/js/index.cjs.map +0 -1
  29. package/build/js/index.mjs +0 -126
  30. package/build/js/index.mjs.map +0 -1
  31. package/build/types/empty.test.d.ts +0 -1
  32. package/build/types/index.d.ts +0 -2
  33. package/build/types/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts +0 -3
  34. package/build/types/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +0 -3
  35. package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts +0 -3
  36. package/changelog/@unreleased/pr-89.v2.yml +0 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,125 @@
1
+ # @osdk/generator-converters
2
+
3
+ ## 2.0.0-beta.11
4
+
5
+ ### Patch Changes
6
+
7
+ - @osdk/api@2.0.0-beta.11
8
+
9
+ ## 2.0.0-beta.10
10
+
11
+ ### Major Changes
12
+
13
+ - 1252d94: ESM Only
14
+ - 56df85a: We now generate minimal object and interface types
15
+
16
+ ### Minor Changes
17
+
18
+ - dc25fb4: Code generation now uses MinQueryDef
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [dc25fb4]
23
+ - Updated dependencies [dc25fb4]
24
+ - Updated dependencies [1252d94]
25
+ - Updated dependencies [56df85a]
26
+ - @osdk/api@2.0.0-beta.10
27
+
28
+ ## 2.0.0-beta.9
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [b946e00]
33
+ - @osdk/api@2.0.0-beta.9
34
+
35
+ ## 2.0.0-beta.8
36
+
37
+ ### Patch Changes
38
+
39
+ - @osdk/api@2.0.0-beta.8
40
+
41
+ ## 2.0.0-beta.7
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [9b0617d]
46
+ - @osdk/api@2.0.0-beta.7
47
+
48
+ ## 2.0.0-beta.6
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [3affe49]
53
+ - Updated dependencies [5d6d5ab]
54
+ - @osdk/api@2.0.0-beta.6
55
+ - @osdk/gateway@2.5.0-beta.0
56
+
57
+ ## 0.8.0-beta.1
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [dc25fb4]
62
+ - @osdk/api@1.10.0-beta.1
63
+
64
+ ## 0.8.0-beta.0
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [7c2db00]
69
+ - @osdk/api@1.10.0-beta.0
70
+
71
+ ## 0.7.0
72
+
73
+ ### Minor Changes
74
+
75
+ - 388dba9: Change all internal dependencies to be tilde not caret
76
+ - d8edf10: Fix primary key types
77
+ - bc89b62: Spelling fixes and spell check in CI
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [388dba9]
82
+ - Updated dependencies [d8edf10]
83
+ - Updated dependencies [3ec7c38]
84
+ - Updated dependencies [bc89b62]
85
+ - @osdk/api@1.9.0
86
+ - @osdk/gateway@2.4.0
87
+
88
+ ## 0.7.0-beta.1
89
+
90
+ ### Minor Changes
91
+
92
+ - bc89b62: Spelling fixes and spell check in CI
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [3ec7c38]
97
+ - Updated dependencies [bc89b62]
98
+ - @osdk/api@1.9.0-beta.1
99
+ - @osdk/gateway@2.4.0-beta.0
100
+
101
+ ## 0.7.0-beta.0
102
+
103
+ ### Minor Changes
104
+
105
+ - 388dba9: Change all internal dependencies to be tilde not caret
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [388dba9]
110
+ - @osdk/api@1.9.0-beta.0
111
+
112
+ ## 0.6.0
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [c9f3214]
117
+ - Updated dependencies [c9f3214]
118
+ - @osdk/gateway@2.3.0
119
+ - @osdk/api@1.8.0
120
+
121
+ ## 0.5.0
122
+
123
+ ### Patch Changes
124
+
125
+ - @osdk/api@1.7.0
@@ -0,0 +1,318 @@
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])) : {};
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: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)]))
147
+ };
148
+ }
149
+ function invertProps(a) {
150
+ return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : void 0;
151
+ }
152
+
153
+ // src/isNullableQueryDataType.ts
154
+ function isNullableQueryDataType(input) {
155
+ if (input.type === "null") {
156
+ return true;
157
+ }
158
+ if (input.type === "union") {
159
+ return input.unionTypes.some((t) => isNullableQueryDataType(t));
160
+ }
161
+ return false;
162
+ }
163
+
164
+ // src/wireQueryDataTypeToQueryDataTypeDefinition.ts
165
+ function wireQueryDataTypeToQueryDataTypeDefinition(input) {
166
+ switch (input.type) {
167
+ case "double":
168
+ case "float":
169
+ case "integer":
170
+ case "long":
171
+ case "attachment":
172
+ case "boolean":
173
+ case "date":
174
+ case "string":
175
+ case "timestamp":
176
+ return {
177
+ type: input.type,
178
+ nullable: false
179
+ };
180
+ case "object":
181
+ return {
182
+ type: "object",
183
+ object: input.objectTypeApiName,
184
+ nullable: false
185
+ };
186
+ case "objectSet":
187
+ return {
188
+ type: "objectSet",
189
+ objectSet: input.objectTypeApiName,
190
+ nullable: false
191
+ };
192
+ case "array":
193
+ return {
194
+ ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
195
+ multiplicity: true
196
+ };
197
+ case "set":
198
+ return {
199
+ type: "set",
200
+ set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
201
+ nullable: false
202
+ };
203
+ case "union":
204
+ const allowNulls = isNullableQueryDataType(input);
205
+ if (allowNulls && input.unionTypes.length === 2) {
206
+ const nonNull = input.unionTypes.find((t) => t.type != null);
207
+ if (nonNull) {
208
+ return {
209
+ ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
210
+ nullable: true
211
+ };
212
+ }
213
+ }
214
+ return {
215
+ type: "union",
216
+ union: input.unionTypes.reduce((acc, t) => {
217
+ if (t.type === "null") {
218
+ return acc;
219
+ }
220
+ acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
221
+ return acc;
222
+ }, []),
223
+ nullable: allowNulls
224
+ };
225
+ case "struct":
226
+ return {
227
+ type: "struct",
228
+ struct: Object.fromEntries(input.fields.map((f) => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
229
+ nullable: false
230
+ };
231
+ case "twoDimensionalAggregation":
232
+ return {
233
+ type: "twoDimensionalAggregation",
234
+ twoDimensionalAggregation: get2DQueryAggregationProps(input),
235
+ nullable: false
236
+ };
237
+ case "threeDimensionalAggregation":
238
+ return {
239
+ type: "threeDimensionalAggregation",
240
+ threeDimensionalAggregation: get3DQueryAggregationProps(input),
241
+ nullable: false
242
+ };
243
+ case "null":
244
+ case "unsupported":
245
+ throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
246
+ default:
247
+ throw new Error(`Unsupported QueryDataType.type ${input.type}`);
248
+ }
249
+ }
250
+ function get2DQueryAggregationProps(input) {
251
+ if (input.keyType.type === "range") {
252
+ return {
253
+ keyType: input.keyType.type,
254
+ keySubtype: input.keyType.subType.type,
255
+ valueType: input.valueType.type
256
+ };
257
+ } else {
258
+ if (guardInvalidKeyTypes(input.keyType)) {
259
+ return {
260
+ keyType: input.keyType.type,
261
+ valueType: input.valueType.type
262
+ };
263
+ }
264
+ throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
265
+ }
266
+ }
267
+ function get3DQueryAggregationProps(input) {
268
+ if (input.keyType.type === "range") {
269
+ return {
270
+ keyType: input.keyType.type,
271
+ keySubtype: input.keyType.subType.type,
272
+ valueType: get2DQueryAggregationProps(input.valueType)
273
+ };
274
+ } else {
275
+ if (guardInvalidKeyTypes(input.keyType)) {
276
+ return {
277
+ keyType: input.keyType.type,
278
+ valueType: get2DQueryAggregationProps(input.valueType)
279
+ };
280
+ }
281
+ throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
282
+ }
283
+ }
284
+ function guardInvalidKeyTypes(key) {
285
+ return key.type === "string" || key.type === "boolean";
286
+ }
287
+
288
+ // src/wireQueryTypeV2ToSdkQueryDefinition.ts
289
+ function wireQueryTypeV2ToSdkQueryDefinition(input) {
290
+ return {
291
+ type: "query",
292
+ apiName: input.apiName,
293
+ description: input.description,
294
+ displayName: input.displayName,
295
+ version: input.version,
296
+ parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
297
+ output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)
298
+ };
299
+ }
300
+ function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
301
+ return {
302
+ type: "query",
303
+ apiName: input.apiName,
304
+ description: input.description,
305
+ displayName: input.displayName,
306
+ version: input.version
307
+ };
308
+ }
309
+ function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
310
+ return {
311
+ description: parameter.description,
312
+ ...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
313
+ };
314
+ }
315
+
316
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition, wirePropertyV2ToSdkPropertyDefinition, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, wireQueryTypeV2ToSdkQueryDefinition, wireQueryTypeV2ToSdkQueryDefinitionNoParams };
317
+ //# sourceMappingURL=index.js.map
318
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts","../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.ts","../../src/isNullableQueryDataType.ts","../../src/wireQueryDataTypeToQueryDataTypeDefinition.ts","../../src/wireQueryTypeV2ToSdkQueryDefinition.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,MAAA,CAAA;AAAA,IACL,KAAK,SAAA,CAAA;AAAA,IACL,KAAK,QAAA,CAAA;AAAA,IACL,KAAK,OAAA,CAAA;AAAA,IACL,KAAK,MAAA,CAAA;AAAA,IACL,KAAK,OAAA,CAAA;AAAA,IACL,KAAK,SAAA,CAAA;AAAA,IACL,KAAK,MAAA,CAAA;AAAA,IACL,KAAK,YAAA,CAAA;AAAA,IACL,KAAK,UAAA,CAAA;AAAA,IACL,KAAK,UAAA,CAAA;AAAA,IACL,KAAK,WAAA,CAAA;AAAA,IACL,KAAK,YAAA,CAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAO,OAAA;AAAA,QACL,aAAa,KAAM,CAAA,WAAA;AAAA,QACnB,Y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SAAS,qBAAqB,GAAK,EAAA;AACjC,EAAA,OAAO,GAAI,CAAA,IAAA,KAAS,QAAY,IAAA,GAAA,CAAI,IAAS,KAAA,SAAA,CAAA;AAC/C,CAAA;;;AChIO,SAAS,oCAAoC,KAAO,EAAA;AACzD,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA;AAAA,IACf,aAAa,KAAM,CAAA,WAAA;AAAA,IACnB,aAAa,KAAM,CAAA,WAAA;AAAA,IACnB,SAAS,KAAM,CAAA,OAAA;AAAA,IACf,UAAA,EAAY,OAAO,WAAY,CAAA,MAAA,CAAO,QAAQ,KAAM,CAAA,UAAU,EAAE,GAAI,CAAA,CAAC,CAAC,IAAM,EAAA,SAAS,MAAM,CAAC,IAAA,EAAM,+CAA+C,SAAS,CAAC,CAAC,CAAC,CAAA;AAAA,IAC7J,MAAA,EAAQ,0CAA2C,CAAA,KAAA,CAAM,MAAM,CAAA;AAAA,GACjE,CAAA;AACF,CAAA;AACO,SAAS,4CAA4C,KAAO,EAAA;AACjE,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA;AAAA,IACf,aAAa,KAAM,CAAA,WAAA;AAAA,IACnB,aAAa,KAAM,CAAA,WAAA;AAAA,IACnB,SAAS,KAAM,CAAA,OAAA;AAAA,GACjB,CAAA;AACF,CAAA;AACO,SAAS,+CAA+C,SAAW,EAAA;AACxE,EAAO,OAAA;AAAA,IACL,aAAa,SAAU,CAAA,WAAA;AAAA,IACvB,GAAG,0CAA2C,CAAA,SAAA,CAAU,QAAQ,CAAA;AAAA,GAClE,CAAA;AACF","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])) : {};\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: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)]))\n };\n}\nfunction invertProps(a) {\n return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : undefined;\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 isNullableQueryDataType(input) {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\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 { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\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 case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName,\n nullable: false\n };\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName,\n nullable: false\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true\n };\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false\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 return {\n type: \"union\",\n union: input.unionTypes.reduce((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 case \"struct\":\n return {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),\n nullable: false\n };\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false\n };\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\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(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\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(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\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(key) {\n return key.type === \"string\" || key.type === \"boolean\";\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 { wireQueryDataTypeToQueryDataTypeDefinition } from \"./wireQueryDataTypeToQueryDataTypeDefinition.js\";\nexport function wireQueryTypeV2ToSdkQueryDefinition(input) {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)\n };\n}\nexport function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version\n };\n}\nexport function wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n ...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)\n };\n}"]}
@@ -0,0 +1,4 @@
1
+ import type { InterfaceDefinition } from "@osdk/api";
2
+ import type { InterfaceType } from "@osdk/internal.foundry.core";
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,6BAA6B,CAAC;AAGjE,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,8 @@
1
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
2
+ export { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "./wireObjectTypeFullMetadataToSdkObjectTypeDefinition.js";
3
+ export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
4
+ export { wireQueryDataTypeToQueryDataTypeDefinition } from "./wireQueryDataTypeToQueryDataTypeDefinition.js";
5
+ export { wireQueryTypeV2ToSdkQueryDefinition } from "./wireQueryTypeV2ToSdkQueryDefinition.js";
6
+ export { wireQueryParameterV2ToQueryParameterDefinition } from "./wireQueryTypeV2ToSdkQueryDefinition.js";
7
+ export { wireQueryTypeV2ToSdkQueryDefinitionNoParams } from "./wireQueryTypeV2ToSdkQueryDefinition.js";
8
+ //# 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;AACnG,OAAO,EAAE,0CAA0C,EAAE,MAAM,iDAAiD,CAAC;AAC7G,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,8CAA8C,EAAE,MAAM,0CAA0C,CAAC;AAC1G,OAAO,EAAE,2CAA2C,EAAE,MAAM,0CAA0C,CAAC"}