@osdk/generator 2.5.0-beta.2 → 2.5.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/browser/shared/sanitizeMetadata.test.js +2 -1
  3. package/build/browser/shared/sanitizeMetadata.test.js.map +1 -1
  4. package/build/browser/util/test/TodoWireOntology.js +51 -2
  5. package/build/browser/util/test/TodoWireOntology.js.map +1 -1
  6. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -2
  7. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  8. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +2 -1
  9. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  10. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +37 -9
  11. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  12. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +2 -1
  13. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  14. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +45 -4
  15. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  16. package/build/cjs/index.cjs +46 -6
  17. package/build/cjs/index.cjs.map +1 -1
  18. package/build/esm/shared/sanitizeMetadata.test.js +2 -1
  19. package/build/esm/shared/sanitizeMetadata.test.js.map +1 -1
  20. package/build/esm/util/test/TodoWireOntology.js +51 -2
  21. package/build/esm/util/test/TodoWireOntology.js.map +1 -1
  22. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -2
  23. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  24. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +2 -1
  25. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  26. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +37 -9
  27. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  28. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +2 -1
  29. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  30. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +45 -4
  31. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  32. package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +2 -1
  33. package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  34. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 2.5.0-beta.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 7bdac45: Update Platform SDK dependency
8
+ - 7bdac45: Support value type enum generation for strings and booleans
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [7bdac45]
13
+ - Updated dependencies [7bdac45]
14
+ - Updated dependencies [20962bc]
15
+ - Updated dependencies [e48be06]
16
+ - @osdk/generator-converters@2.5.0-beta.3
17
+ - @osdk/api@2.5.0-beta.3
18
+
3
19
  ## 2.5.0-beta.2
4
20
 
5
21
  ### Minor Changes
@@ -37,7 +37,8 @@ describe(sanitizeMetadata, () => {
37
37
  },
38
38
  queryTypes: {},
39
39
  interfaceTypes: {},
40
- sharedPropertyTypes: {}
40
+ sharedPropertyTypes: {},
41
+ valueTypes: {}
41
42
  });
42
43
  expect(sanitizedOntology.actionTypes["kebabCase"].apiName).toEqual("kebabCase");
43
44
  });
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizeMetadata.test.js","names":["describe","expect","it","sanitizeMetadata","sanitizedOntology","objectTypes","actionTypes","apiName","operations","parameters","status","rid","ontology","displayName","description","queryTypes","interfaceTypes","sharedPropertyTypes","toEqual"],"sources":["sanitizeMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { sanitizeMetadata } from \"./sanitizeMetadata.js\";\n\ndescribe(sanitizeMetadata, () => {\n it(\"sanitized action apiNames\", () => {\n const sanitizedOntology = sanitizeMetadata({\n objectTypes: {},\n actionTypes: {\n \"kebab-case\": {\n apiName: \"kebab-case\",\n operations: [],\n parameters: {},\n status: \"ACTIVE\",\n rid: \"ri.a.b.c.d\",\n },\n },\n ontology: {\n rid: \"ri.a.b.c.d\",\n apiName: \"ontology\",\n displayName: \"\",\n description: \"\",\n },\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n });\n expect(sanitizedOntology.actionTypes[\"kebabCase\"].apiName).toEqual(\n \"kebabCase\",\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExDH,QAAQ,CAACG,gBAAgB,EAAE,MAAM;EAC/BD,EAAE,CAAC,2BAA2B,EAAE,MAAM;IACpC,MAAME,iBAAiB,GAAGD,gBAAgB,CAAC;MACzCE,WAAW,EAAE,CAAC,CAAC;MACfC,WAAW,EAAE;QACX,YAAY,EAAE;UACZC,OAAO,EAAE,YAAY;UACrBC,UAAU,EAAE,EAAE;UACdC,UAAU,EAAE,CAAC,CAAC;UACdC,MAAM,EAAE,QAAQ;UAChBC,GAAG,EAAE;QACP;MACF,CAAC;MACDC,QAAQ,EAAE;QACRD,GAAG,EAAE,YAAY;QACjBJ,OAAO,EAAE,UAAU;QACnBM,WAAW,EAAE,EAAE;QACfC,WAAW,EAAE;MACf,CAAC;MACDC,UAAU,EAAE,CAAC,CAAC;MACdC,cAAc,EAAE,CAAC,CAAC;MAClBC,mBAAmB,EAAE,CAAC;IACxB,CAAC,CAAC;IACFhB,MAAM,CAACG,iBAAiB,CAACE,WAAW,CAAC,WAAW,CAAC,CAACC,OAAO,CAAC,CAACW,OAAO,CAChE,WACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"sanitizeMetadata.test.js","names":["describe","expect","it","sanitizeMetadata","sanitizedOntology","objectTypes","actionTypes","apiName","operations","parameters","status","rid","ontology","displayName","description","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","toEqual"],"sources":["sanitizeMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { sanitizeMetadata } from \"./sanitizeMetadata.js\";\n\ndescribe(sanitizeMetadata, () => {\n it(\"sanitized action apiNames\", () => {\n const sanitizedOntology = sanitizeMetadata({\n objectTypes: {},\n actionTypes: {\n \"kebab-case\": {\n apiName: \"kebab-case\",\n operations: [],\n parameters: {},\n status: \"ACTIVE\",\n rid: \"ri.a.b.c.d\",\n },\n },\n ontology: {\n rid: \"ri.a.b.c.d\",\n apiName: \"ontology\",\n displayName: \"\",\n description: \"\",\n },\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n });\n expect(sanitizedOntology.actionTypes[\"kebabCase\"].apiName).toEqual(\n \"kebabCase\",\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExDH,QAAQ,CAACG,gBAAgB,EAAE,MAAM;EAC/BD,EAAE,CAAC,2BAA2B,EAAE,MAAM;IACpC,MAAME,iBAAiB,GAAGD,gBAAgB,CAAC;MACzCE,WAAW,EAAE,CAAC,CAAC;MACfC,WAAW,EAAE;QACX,YAAY,EAAE;UACZC,OAAO,EAAE,YAAY;UACrBC,UAAU,EAAE,EAAE;UACdC,UAAU,EAAE,CAAC,CAAC;UACdC,MAAM,EAAE,QAAQ;UAChBC,GAAG,EAAE;QACP;MACF,CAAC;MACDC,QAAQ,EAAE;QACRD,GAAG,EAAE,YAAY;QACjBJ,OAAO,EAAE,UAAU;QACnBM,WAAW,EAAE,EAAE;QACfC,WAAW,EAAE;MACf,CAAC;MACDC,UAAU,EAAE,CAAC,CAAC;MACdC,cAAc,EAAE,CAAC,CAAC;MAClBC,mBAAmB,EAAE,CAAC,CAAC;MACvBC,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IACFjB,MAAM,CAACG,iBAAiB,CAACE,WAAW,CAAC,WAAW,CAAC,CAACC,OAAO,CAAC,CAACY,OAAO,CAChE,WACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -89,7 +89,8 @@ export const TodoWireOntology = {
89
89
  dataType: {
90
90
  type: "integer"
91
91
  },
92
- rid: "rid"
92
+ rid: "rid",
93
+ valueTypeApiName: "numericValueType"
93
94
  },
94
95
  body: {
95
96
  dataType: {
@@ -104,6 +105,16 @@ export const TodoWireOntology = {
104
105
  type: "boolean"
105
106
  },
106
107
  rid: "rid"
108
+ },
109
+ array: {
110
+ dataType: {
111
+ type: "array",
112
+ subType: {
113
+ type: "string"
114
+ }
115
+ },
116
+ valueTypeApiName: "arrayValueType",
117
+ rid: "rid"
107
118
  }
108
119
  },
109
120
  status: "ACTIVE",
@@ -146,7 +157,8 @@ export const TodoWireOntology = {
146
157
  dataType: {
147
158
  type: "string"
148
159
  },
149
- rid: "rid"
160
+ rid: "rid",
161
+ valueTypeApiName: "emailValueType"
150
162
  }
151
163
  },
152
164
  rid: "ridForPerson",
@@ -250,6 +262,43 @@ export const TodoWireOntology = {
250
262
  },
251
263
  rid: "idk2"
252
264
  }
265
+ },
266
+ valueTypes: {
267
+ emailValueType: {
268
+ apiName: "emailValueType",
269
+ description: "A value type for email addresses",
270
+ displayName: "Email Value Type",
271
+ rid: "ridForEmailValueType",
272
+ version: "1.0.0",
273
+ fieldType: {
274
+ type: "string"
275
+ },
276
+ constraints: [{
277
+ type: "enum",
278
+ options: ["osdk@palantir.com", "foundry@palantir.com"]
279
+ }]
280
+ },
281
+ arrayValueType: {
282
+ apiName: "arrayValueType",
283
+ description: "A value type for arrays of strings",
284
+ displayName: "Array Value Type",
285
+ rid: "ridForArrayValueType",
286
+ version: "1.0.0",
287
+ fieldType: {
288
+ type: "array",
289
+ subType: {
290
+ type: "string"
291
+ }
292
+ },
293
+ constraints: [{
294
+ type: "array",
295
+ valueConstraint: {
296
+ type: "enum",
297
+ options: ["a", "b", "c"]
298
+ },
299
+ uniqueValues: false
300
+ }]
301
+ }
253
302
  }
254
303
  };
255
304
  //# sourceMappingURL=TodoWireOntology.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TodoWireOntology.js","names":["TodoWireOntology","ontology","rid","apiName","displayName","description","actionTypes","parameters","object","dataType","type","objectApiName","objectTypeApiName","required","operations","status","objectTypes","Todo","objectType","primaryKey","pluralDisplayName","icon","name","color","titleProperty","properties","id","body","complete","linkTypes","cardinality","foreignKeyPropertyApiName","linkTypeRid","implementsInterfaces","implementsInterfaces2","sharedPropertyTypeMapping","Person","email","queryTypes","output","completed","version","someTodo","interfaceTypes","SomeInterface","extendsInterfaces","links","implementedByObjectTypes","allProperties","allExtendsInterfaces","allLinks","sharedPropertyTypes","SomeProperty"],"sources":["TodoWireOntology.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WireOntologyDefinition } from \"../../WireOntologyDefinition.js\";\n\nexport const TodoWireOntology: WireOntologyDefinition = {\n ontology: {\n rid: \"ridHere\",\n apiName: \"OntologyApiName\",\n displayName: \"\",\n description: \"\",\n },\n actionTypes: {\n \"markTodoCompleted\": {\n apiName: \"markTodoCompleted\",\n description: \"An action which takes different types of parameters\",\n parameters: {\n object: {\n displayName: \"markTodoCompleted\",\n description: \"A Todo to mark completed\",\n dataType: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n required: false,\n },\n },\n rid: \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n operations: [{\n type: \"modifyObject\",\n objectTypeApiName: \"Todo\",\n }],\n status: \"ACTIVE\",\n },\n \"deleteTodos\": {\n apiName: \"deleteTodos\",\n description: \"An action which takes in an array of objects\",\n parameters: {\n object: {\n displayName: \"deleteTodos\",\n description: \"Todo(s) to be deleted\",\n \"dataType\": {\n \"type\": \"array\",\n\n \"subType\": {\n \"type\": \"object\",\n \"objectApiName\": \"Todo\",\n \"objectTypeApiName\": \"Todo\",\n },\n },\n required: false,\n },\n },\n rid: \"ri.ontology.main.action-type.8f94017d-cf17-4fa8-84c3-8e01e5d594f2\",\n operations: [{\n type: \"deleteObject\",\n objectTypeApiName: \"Todo\",\n }],\n status: \"ACTIVE\",\n },\n },\n objectTypes: {\n Todo: {\n objectType: {\n apiName: \"Todo\",\n primaryKey: \"id\",\n displayName: \"AwesomeTodoDisplayname\",\n pluralDisplayName: \"AwesomeTodoDisplayNames\",\n icon: { type: \"blueprint\", name: \"document\", color: \"blue\" },\n description: \"Its a todo item.\",\n titleProperty: \"body\",\n properties: {\n id: {\n dataType: {\n type: \"integer\",\n },\n rid: \"rid\",\n },\n body: {\n dataType: {\n type: \"string\",\n },\n description: \"The text of the todo\",\n displayName: \"Body\",\n rid: \"rid\",\n },\n complete: {\n dataType: {\n type: \"boolean\",\n },\n rid: \"rid\",\n },\n },\n status: \"ACTIVE\",\n rid: \"ridForTodo\",\n },\n linkTypes: [{\n apiName: \"Assignee\",\n cardinality: \"ONE\",\n displayName: \"Assignee\",\n objectTypeApiName: \"Person\",\n status: \"ACTIVE\",\n foreignKeyPropertyApiName: \"email\",\n linkTypeRid: \"\",\n }],\n implementsInterfaces: [\"SomeInterface\"],\n implementsInterfaces2: {\n \"SomeInterface\": {\n properties: {\n \"SomeProperty\": \"body\",\n },\n },\n },\n sharedPropertyTypeMapping: {},\n },\n Person: {\n objectType: {\n apiName: \"Person\",\n primaryKey: \"email\",\n displayName: \"Person\",\n pluralDisplayName: \"Persons\",\n icon: { type: \"blueprint\", name: \"document\", color: \"blue\" },\n description: \"A person\",\n titleProperty: \"email\",\n properties: {\n email: {\n dataType: {\n type: \"string\",\n },\n rid: \"rid\",\n },\n },\n\n rid: \"ridForPerson\",\n status: \"ACTIVE\",\n },\n linkTypes: [{\n apiName: \"Todos\",\n cardinality: \"MANY\",\n displayName: \"Todos\",\n objectTypeApiName: \"Todo\",\n status: \"ACTIVE\",\n foreignKeyPropertyApiName: \"id\",\n linkTypeRid: \"\",\n }],\n implementsInterfaces: [],\n implementsInterfaces2: {},\n sharedPropertyTypeMapping: {},\n },\n },\n queryTypes: {\n \"getCount\": {\n apiName: \"getCount\",\n output: {\n type: \"integer\",\n },\n parameters: {\n completed: { dataType: { type: \"boolean\" } },\n },\n rid: \"rid.query.1\",\n version: \"1.1.0\",\n },\n \"returnsTodo\": {\n apiName: \"returnsTodo\",\n output: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n parameters: {\n someTodo: {\n description: \"Random desc so we test jsdoc\",\n dataType: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n },\n },\n rid: \"rid.query.2\",\n version: \"3.2.0\",\n },\n },\n interfaceTypes: {\n SomeInterface: {\n apiName: \"SomeInterface\",\n description: \"Some interface\",\n properties: {\n \"SomeProperty\": {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n required: false,\n },\n },\n rid: \"idk\",\n displayName: \"Sum Interface\",\n extendsInterfaces: [],\n links: {},\n implementedByObjectTypes: [],\n allProperties: {\n \"SomeProperty\": {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n required: false,\n },\n },\n allExtendsInterfaces: [],\n allLinks: {},\n },\n },\n sharedPropertyTypes: {\n SomeProperty: {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n },\n },\n} as const satisfies WireOntologyDefinition;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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F,CAAC;MACDV,GAAG,EAAE,aAAa;MAClBuC,OAAO,EAAE;IACX;EACF,CAAC;EACDE,cAAc,EAAE;IACdC,aAAa,EAAE;MACbzC,OAAO,EAAE,eAAe;MACxBE,WAAW,EAAE,gBAAgB;MAC7BoB,UAAU,EAAE;QACV,cAAc,EAAE;UACdtB,OAAO,EAAE,cAAc;UACvBE,WAAW,EAAE,eAAe;UAC5BD,WAAW,EAAE,cAAc;UAC3BK,QAAQ,EAAE;YACRC,IAAI,EAAE;UACR,CAAC;UACDR,GAAG,EAAE,MAAM;UACXW,QAAQ,EAAE;QACZ;MACF,CAAC;MACDX,GAAG,EAAE,KAAK;MACVE,WAAW,EAAE,eAAe;MAC5ByC,iBAAiB,EAAE,EAAE;MACrBC,KAAK,EAAE,CAAC,CAAC;MACTC,wBAAwB,EAAE,EAAE;MAC5BC,aAAa,EAAE;QACb,cAAc,EAAE;UACd7C,OAAO,EAAE,cAAc;UACvBE,WAAW,EAAE,eAAe;UAC5BD,WAAW,EAAE,cAAc;UAC3BK,QAAQ,EAAE;YACRC,IAAI,EAAE;UACR,CAAC;UACDR,GAAG,EAAE,MAAM;UACXW,QAAQ,EAAE;QACZ;MACF,CAAC;MACDoC,oBAAoB,EAAE,EAAE;MACxBC,QAAQ,EAAE,CAAC;IACb;EACF,CAAC;EACDC,mBAAmB,EAAE;IACnBC,YAAY,EAAE;MACZjD,OAAO,EAAE,cAAc;MACvBE,WAAW,EAAE,eAAe;MAC5BD,WAAW,EAAE,cAAc;MAC3BK,QAAQ,EAAE;QACRC,IAAI,EAAE;MACR,CAAC;MACDR,GAAG,EAAE;IACP;EACF;AACF,CAA2C","ignoreList":[]}
1
+ {"version":3,"file":"TodoWireOntology.js","names":["TodoWireOntology","ontology","rid","apiName","displayName","description","actionTypes","parameters","object","dataType","type","objectApiName","objectTypeApiName","required","operations","status","objectTypes","Todo","objectType","primaryKey","pluralDisplayName","icon","name","color","titleProperty","properties","id","valueTypeApiName","body","complete","array","subType","linkTypes","cardinality","foreignKeyPropertyApiName","linkTypeRid","implementsInterfaces","implementsInterfaces2","sharedPropertyTypeMapping","Person","email","queryTypes","output","completed","version","someTodo","interfaceTypes","SomeInterface","extendsInterfaces","links","implementedByObjectTypes","allProperties","allExtendsInterfaces","allLinks","sharedPropertyTypes","SomeProperty","valueTypes","emailValueType","fieldType","constraints","options","arrayValueType","valueConstraint","uniqueValues"],"sources":["TodoWireOntology.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WireOntologyDefinition } from \"../../WireOntologyDefinition.js\";\n\nexport const TodoWireOntology: WireOntologyDefinition = {\n ontology: {\n rid: \"ridHere\",\n apiName: \"OntologyApiName\",\n displayName: \"\",\n description: \"\",\n },\n actionTypes: {\n \"markTodoCompleted\": {\n apiName: \"markTodoCompleted\",\n description: \"An action which takes different types of parameters\",\n parameters: {\n object: {\n displayName: \"markTodoCompleted\",\n description: \"A Todo to mark completed\",\n dataType: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n required: false,\n },\n },\n rid: \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n operations: [{\n type: \"modifyObject\",\n objectTypeApiName: \"Todo\",\n }],\n status: \"ACTIVE\",\n },\n \"deleteTodos\": {\n apiName: \"deleteTodos\",\n description: \"An action which takes in an array of objects\",\n parameters: {\n object: {\n displayName: \"deleteTodos\",\n description: \"Todo(s) to be deleted\",\n \"dataType\": {\n \"type\": \"array\",\n\n \"subType\": {\n \"type\": \"object\",\n \"objectApiName\": \"Todo\",\n \"objectTypeApiName\": \"Todo\",\n },\n },\n required: false,\n },\n },\n rid: \"ri.ontology.main.action-type.8f94017d-cf17-4fa8-84c3-8e01e5d594f2\",\n operations: [{\n type: \"deleteObject\",\n objectTypeApiName: \"Todo\",\n }],\n status: \"ACTIVE\",\n },\n },\n objectTypes: {\n Todo: {\n objectType: {\n apiName: \"Todo\",\n primaryKey: \"id\",\n displayName: \"AwesomeTodoDisplayname\",\n pluralDisplayName: \"AwesomeTodoDisplayNames\",\n icon: { type: \"blueprint\", name: \"document\", color: \"blue\" },\n description: \"Its a todo item.\",\n titleProperty: \"body\",\n properties: {\n id: {\n dataType: {\n type: \"integer\",\n },\n rid: \"rid\",\n valueTypeApiName: \"numericValueType\",\n },\n body: {\n dataType: {\n type: \"string\",\n },\n description: \"The text of the todo\",\n displayName: \"Body\",\n rid: \"rid\",\n },\n complete: {\n dataType: {\n type: \"boolean\",\n },\n rid: \"rid\",\n },\n array: {\n dataType: {\n type: \"array\",\n subType: {\n type: \"string\",\n },\n },\n valueTypeApiName: \"arrayValueType\",\n rid: \"rid\",\n },\n },\n status: \"ACTIVE\",\n rid: \"ridForTodo\",\n },\n linkTypes: [{\n apiName: \"Assignee\",\n cardinality: \"ONE\",\n displayName: \"Assignee\",\n objectTypeApiName: \"Person\",\n status: \"ACTIVE\",\n foreignKeyPropertyApiName: \"email\",\n linkTypeRid: \"\",\n }],\n implementsInterfaces: [\"SomeInterface\"],\n implementsInterfaces2: {\n \"SomeInterface\": {\n properties: {\n \"SomeProperty\": \"body\",\n },\n },\n },\n sharedPropertyTypeMapping: {},\n },\n Person: {\n objectType: {\n apiName: \"Person\",\n primaryKey: \"email\",\n displayName: \"Person\",\n pluralDisplayName: \"Persons\",\n icon: { type: \"blueprint\", name: \"document\", color: \"blue\" },\n description: \"A person\",\n titleProperty: \"email\",\n properties: {\n email: {\n dataType: {\n type: \"string\",\n },\n rid: \"rid\",\n valueTypeApiName: \"emailValueType\",\n },\n },\n\n rid: \"ridForPerson\",\n status: \"ACTIVE\",\n },\n linkTypes: [{\n apiName: \"Todos\",\n cardinality: \"MANY\",\n displayName: \"Todos\",\n objectTypeApiName: \"Todo\",\n status: \"ACTIVE\",\n foreignKeyPropertyApiName: \"id\",\n linkTypeRid: \"\",\n }],\n implementsInterfaces: [],\n implementsInterfaces2: {},\n sharedPropertyTypeMapping: {},\n },\n },\n queryTypes: {\n \"getCount\": {\n apiName: \"getCount\",\n output: {\n type: \"integer\",\n },\n parameters: {\n completed: { dataType: { type: \"boolean\" } },\n },\n rid: \"rid.query.1\",\n version: \"1.1.0\",\n },\n \"returnsTodo\": {\n apiName: \"returnsTodo\",\n output: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n parameters: {\n someTodo: {\n description: \"Random desc so we test jsdoc\",\n dataType: {\n type: \"object\",\n objectApiName: \"Todo\",\n objectTypeApiName: \"Todo\",\n },\n },\n },\n rid: \"rid.query.2\",\n version: \"3.2.0\",\n },\n },\n interfaceTypes: {\n SomeInterface: {\n apiName: \"SomeInterface\",\n description: \"Some interface\",\n properties: {\n \"SomeProperty\": {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n required: false,\n },\n },\n rid: \"idk\",\n displayName: \"Sum Interface\",\n extendsInterfaces: [],\n links: {},\n implementedByObjectTypes: [],\n allProperties: {\n \"SomeProperty\": {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n required: false,\n },\n },\n allExtendsInterfaces: [],\n allLinks: {},\n },\n },\n sharedPropertyTypes: {\n SomeProperty: {\n apiName: \"SomeProperty\",\n description: \"Some property\",\n displayName: \"Sum Property\",\n dataType: {\n type: \"string\",\n },\n rid: \"idk2\",\n },\n },\n valueTypes: {\n emailValueType: {\n apiName: \"emailValueType\",\n description: \"A value type for email addresses\",\n displayName: \"Email Value Type\",\n rid: \"ridForEmailValueType\",\n version: \"1.0.0\",\n fieldType: {\n type: \"string\",\n },\n constraints: [{\n type: \"enum\",\n options: [\"osdk@palantir.com\", \"foundry@palantir.com\"],\n }],\n },\n arrayValueType: {\n apiName: \"arrayValueType\",\n description: \"A value type for arrays of strings\",\n displayName: \"Array Value Type\",\n rid: \"ridForArrayValueType\",\n version: \"1.0.0\",\n fieldType: {\n type: \"array\",\n subType: {\n type: \"string\",\n },\n },\n constraints: [{\n type: \"array\",\n valueConstraint: { type: \"enum\", options: [\"a\", \"b\", \"c\"] },\n uniqueValues: false,\n }],\n },\n },\n} as const satisfies WireOntologyDefinition;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,MAAMA,gBAAwC,GAAG;EACtDC,QAAQ,EAAE;IACRC,GAAG,EAAE,SAAS;IACdC,OAAO,EAAE,iBAAiB;IAC1BC,WAAW,EAAE,EAAE;IACfC,WAAW,EAAE;EACf,CAAC;EACDC,WAAW,EAAE;IACX,mBAAmB,EAAE;MACnBH,OAAO,EAAE,mBAAmB;MAC5BE,WAAW,EAAE,qDAAqD;MAClEE,UAAU,EAAE;QACVC,MAAM,EAAE;UACNJ,WAAW,EAAE,mBAAmB;UAChCC,WAAW,EAAE,0BAA0B;UACvCI,QAAQ,EAAE;YACRC,IAAI,EAAE,QAAQ;YACdC,aAAa,EAAE,MAAM;YACrBC,iBAAiB,EAAE;UACrB,CAAC;UACDC,QAAQ,EAAE;QACZ;MACF,CAAC;MACDX,GAAG,EAAE,mEAAmE;MACxEY,UAAU,EAAE,CAAC;QACXJ,IAAI,EAAE,cAAc;QACpBE,iBAAiB,EAAE;MACrB,CAAC,CAAC;MACFG,MAAM,EAAE;IACV,CAAC;IACD,aAAa,EAAE;MACbZ,OAAO,EAAE,aAAa;MACtBE,WAAW,EAAE,8CAA8C;MAC3DE,UAAU,EA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,GAAG,EAAE,GAAG,EAAE,GAAG;QAAE,CAAC;QAC3DG,YAAY,EAAE;MAChB,CAAC;IACH;EACF;AACF,CAA2C","ignoreList":[]}
@@ -106,8 +106,8 @@ ${stringify(definition.links, {
106
106
  ${createPropertyKeys(interfaceDef)}
107
107
 
108
108
 
109
- ${createProps(interfaceDef, "Props", false)}
110
- ${createProps(interfaceDef, "StrictProps", true)}
109
+ ${createProps(interfaceDef, "Props", false, ontology.raw.valueTypes)}
110
+ ${createProps(interfaceDef, "StrictProps", true, ontology.raw.valueTypes)}
111
111
 
112
112
 
113
113
  ${createObjectSet(interfaceDef, ids)}
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","consola","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","getObjectImports","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","currentFilePath","definition","raw","uniqueLinkTargetTypes","Set","links","Object","values","map","a","targetType","requireObjectType","targetTypeApiName","requireInterfaceType","objectDefIdentifier","getDefinitionIdentifier","parents","implements","p","parent","it","mergedProperties","properties","apiName","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","imports","linkTarget","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n currentFilePath: string = \"\",\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n const uniqueLinkTargetTypes = new Set(\n definition.links\n ? Object.values(definition.links).map(a =>\n a.targetType === \"object\"\n ? ontology.requireObjectType(\n a.targetTypeApiName,\n )\n : ontology.requireInterfaceType(\n a.targetTypeApiName,\n )\n )\n : [],\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n consola,\n ),\n );\n return it;\n }\n }) ?? [];\n\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`,\n );\n } else if (mergedProperties[apiName] != null) {\n invariant(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\n\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n definition.links\n ? Object.keys(definition.links).length > 0\n ? `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = definition.targetType === \"object\"\n ? ontology.requireObjectType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2)\n : ontology.requireInterfaceType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `${linkTarget}.ObjectSet`\n }\n `;\n },\n })\n }\n }\n `\n : `export type ${osdkObjectLinksIdentifier} = {};`\n : `export type ${osdkObjectLinksIdentifier} = {};`\n }\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n\n const imports: string = getObjectImports(\n uniqueLinkTargetTypes,\n definition.apiName,\n currentFilePath,\n true,\n );\n definition;\n return `${imports}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C1C;AACA,mBAAmBH,YAAY,CAACiC,YAAY,KAAKjC,YAAY,CAACiC,YAAY;AAC1E;AACA,kBAAkBjC,YAAY,CAAC6C,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","consola","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","getObjectImports","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","currentFilePath","definition","raw","uniqueLinkTargetTypes","Set","links","Object","values","map","a","targetType","requireObjectType","targetTypeApiName","requireInterfaceType","objectDefIdentifier","getDefinitionIdentifier","parents","implements","p","parent","it","mergedProperties","properties","apiName","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","imports","linkTarget","getImportedDefinitionIdentifier","multiplicity","valueTypes"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n currentFilePath: string = \"\",\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n const uniqueLinkTargetTypes = new Set(\n definition.links\n ? Object.values(definition.links).map(a =>\n a.targetType === \"object\"\n ? ontology.requireObjectType(\n a.targetTypeApiName,\n )\n : ontology.requireInterfaceType(\n a.targetTypeApiName,\n )\n )\n : [],\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n consola,\n ),\n );\n return it;\n }\n }) ?? [];\n\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`,\n );\n } else if (mergedProperties[apiName] != null) {\n invariant(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\n\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n definition.links\n ? Object.keys(definition.links).length > 0\n ? `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = definition.targetType === \"object\"\n ? ontology.requireObjectType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2)\n : ontology.requireInterfaceType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `${linkTarget}.ObjectSet`\n }\n `;\n },\n })\n }\n }\n `\n : `export type ${osdkObjectLinksIdentifier} = {};`\n : `export type ${osdkObjectLinksIdentifier} = {};`\n }\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false, ontology.raw.valueTypes)}\n ${createProps(interfaceDef, \"StrictProps\", true, ontology.raw.valueTypes)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n\n const imports: string = getObjectImports(\n uniqueLinkTargetTypes,\n definition.apiName,\n currentFilePath,\n true,\n );\n definition;\n return `${imports}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAA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oreList":[]}
@@ -64,7 +64,8 @@ function simpleOntology(apiName, interfaces) {
64
64
  rid: `${apiName} ontology rid`
65
65
  },
66
66
  queryTypes: {},
67
- sharedPropertyTypes
67
+ sharedPropertyTypes,
68
+ valueTypes: {}
68
69
  };
69
70
  }
70
71
  describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo","Child","implementsMatch","match","not","toBeNull","implementsStr","toContain"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n description: undefined;\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n /**\n * display name: 'bar property dn',\n *\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n *\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates map for implementedBy\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"], 2, [\"childrenObject\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [\"childrenObject\"];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"sorts the implements array for stable output\", async () => {\n // Test with multiple parent interfaces in non-alphabetical order\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Child\", [simpleSpt(\"child\")], [\n \"ParentZ\",\n \"ParentA\",\n \"ParentC\",\n ]),\n simpleInterface(\"ParentZ\", [simpleSpt(\"z\")], []),\n simpleInterface(\"ParentA\", [simpleSpt(\"a\")], []),\n simpleInterface(\"ParentC\", [simpleSpt(\"c\")], []),\n ]),\n importExt: \"\",\n });\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Child as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n\n // Extract the implements array from the generated code\n const implementsMatch = formattedCode.match(/implements:\\s*\\[([^\\]]+)\\]/s);\n expect(implementsMatch).not.toBeNull();\n\n if (implementsMatch) {\n const implementsStr = implementsMatch[1];\n // Check that the array is sorted alphabetically\n expect(implementsStr).toContain(\"\\\"ParentA\\\", \\\"ParentC\\\", \\\"ParentZ\\\"\");\n }\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAElH,SAASC,SAASA,CAAmBC,OAAU,EAAEC,aAAwB,GAAG,CAAC,EAAE;EAC7E,OAAO;IACLD,OAAO;IACPE,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFhD,EAAE,CAAC,yCAAyC,EAAE,YAAY;IACxD,MAAMiD,MAAM,GAAG5C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM6C,MAAM,GAAG7C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMiC,QAAQ,GAAGpC,eAAe,CAC9B;MACEsC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CACpCf,eAAe,CAAC,KAAK,EAAE,CAACmC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAC5CnC,eAAe,CAAC,QAAQ,EAAE,CAACoC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MAEFT,SAAS,EAAE;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAMhD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD/C,MAAM,CAAC8C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EAC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,CACV,CAAC,EACFS,eAAe,CAAC,SAAS,EAAE,CAACT,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAChDS,eAAe,CAAC,SAAS,EAAE,CAACT,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAChDS,eAAe,CAAC,SAAS,EAAE,CAACT,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CACjD,CAAC;MACFoC,SAAS,EAAE;IACb,CAAC,CAAC;IAEF,MAAMI,aAAa,GAAG,MAAMhD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACqB,KAAK,EAC7Bd,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;;IAED;IACA,MAAMO,eAAe,GAAGR,aAAa,CAACS,KAAK,CAAC,6BAA6B,CAAC;IAC1EvD,MAAM,CAACsD,eAAe,CAAC,CAACE,GAAG,CAACC,QAAQ,CAAC,CAAC;IAEtC,IAAIH,eAAe,EAAE;MACnB,MAAMI,aAAa,GAAGJ,eAAe,CAAC,CAAC,CAAC;MACxC;MACAtD,MAAM,CAAC0D,aAAa,CAAC,CAACC,SAAS,CAAC,uCAAuC,CAAC;IAC1E;EACF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","valueTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo","Child","implementsMatch","match","not","toBeNull","implementsStr","toContain"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n valueTypes: {},\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n description: undefined;\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n /**\n * display name: 'bar property dn',\n *\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n *\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates map for implementedBy\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"], 2, [\"childrenObject\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [\"childrenObject\"];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n *\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"sorts the implements array for stable output\", async () => {\n // Test with multiple parent interfaces in non-alphabetical order\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Child\", [simpleSpt(\"child\")], [\n \"ParentZ\",\n \"ParentA\",\n \"ParentC\",\n ]),\n simpleInterface(\"ParentZ\", [simpleSpt(\"z\")], []),\n simpleInterface(\"ParentA\", [simpleSpt(\"a\")], []),\n simpleInterface(\"ParentC\", [simpleSpt(\"c\")], []),\n ]),\n importExt: \"\",\n });\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Child as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n\n // Extract the implements array from the generated code\n const implementsMatch = formattedCode.match(/implements:\\s*\\[([^\\]]+)\\]/s);\n expect(implementsMatch).not.toBeNull();\n\n if (implementsMatch) {\n const implementsStr = implementsMatch[1];\n // Check that the array is sorted alphabetically\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,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACES,MAAM,EAAE;IACV,CACF,CAAC;IACDhD,MAAM,CAAC+C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFjD,EAAE,CAAC,iCAAiC,EAAE,YAAY;IAChD,MAAMkD,MAAM,GAAG7C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM8C,MAAM,GAAG9C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMiC,QAAQ,GAAGpC,eAAe,CAC9B;MACEuC,SAAS,EAAEZ,cAAc,CAAC,UAAU,EAAE,CACpCf,eAAe,CAAC,KAAK,EAAE,CAACoC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,EACnEpC,eAAe,CAAC,QAAQ,EAAE,CAACqC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MAEFT,SAAS,EAAE;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAMjD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACqB,GAAG,EAC3Bd,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACES,MAAM,EAAE;IACV,CACF,CAAC;IACDhD,MAAM,CAAC+C,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M,CAACuD,eAAe,CAAC,CAACE,GAAG,CAACC,QAAQ,CAAC,CAAC;IAEtC,IAAIH,eAAe,EAAE;MACnB,MAAMI,aAAa,GAAGJ,eAAe,CAAC,CAAC,CAAC;MACxC;MACAvD,MAAM,CAAC2D,aAAa,CAAC,CAACC,SAAS,CAAC,uCAAuC,CAAC;IAC1E;EACF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -234,7 +234,8 @@ const referencedOntology = {
234
234
  displayName: "Some Property",
235
235
  rid: "idk"
236
236
  }
237
- }
237
+ },
238
+ valueTypes: {}
238
239
  };
239
240
  const referencingOntology = {
240
241
  ontology: TodoWireOntology.ontology,
@@ -370,7 +371,8 @@ const referencingOntology = {
370
371
  version: "0"
371
372
  }
372
373
  },
373
- sharedPropertyTypes: {}
374
+ sharedPropertyTypes: {},
375
+ valueTypes: {}
374
376
  };
375
377
  const fooBarTodoWireOntology = changeNames(TodoWireOntology, {
376
378
  objects: {
@@ -701,7 +703,7 @@ describe("generator", () => {
701
703
  /**
702
704
  * (no ontology metadata)
703
705
  */
704
- readonly email: $PropType['string'];
706
+ readonly email: 'osdk@palantir.com' | 'foundry@palantir.com';
705
707
  }
706
708
  export type StrictProps = Props;
707
709
 
@@ -783,13 +785,17 @@ describe("generator", () => {
783
785
  } from '@osdk/client';
784
786
 
785
787
  export namespace Todo {
786
- export type PropertyKeys = 'id' | 'body' | 'complete';
788
+ export type PropertyKeys = 'id' | 'body' | 'complete' | 'array';
787
789
 
788
790
  export interface Links {
789
791
  readonly Assignee: $SingleLinkAccessor<Person>;
790
792
  }
791
793
 
792
794
  export interface Props {
795
+ /**
796
+ * (no ontology metadata)
797
+ */
798
+ readonly array: ('a' | 'b' | 'c')[] | undefined;
793
799
  /**
794
800
  * display name: 'Body',
795
801
  *
@@ -856,6 +862,10 @@ describe("generator", () => {
856
862
  primaryKeyApiName: 'id';
857
863
  primaryKeyType: 'integer';
858
864
  properties: {
865
+ /**
866
+ * (no ontology metadata)
867
+ */
868
+ array: $PropertyDef<'string', 'nullable', 'array'>;
859
869
  /**
860
870
  * display name: 'Body',
861
871
  *
@@ -1312,7 +1322,7 @@ describe("generator", () => {
1312
1322
  /**
1313
1323
  * (no ontology metadata)
1314
1324
  */
1315
- readonly email: $PropType['string'];
1325
+ readonly email: 'osdk@palantir.com' | 'foundry@palantir.com';
1316
1326
  }
1317
1327
  export type StrictProps = Props;
1318
1328
 
@@ -1394,13 +1404,17 @@ describe("generator", () => {
1394
1404
  } from '@osdk/api';
1395
1405
 
1396
1406
  export namespace Todo {
1397
- export type PropertyKeys = 'id' | 'body' | 'complete';
1407
+ export type PropertyKeys = 'id' | 'body' | 'complete' | 'array';
1398
1408
 
1399
1409
  export interface Links {
1400
1410
  readonly Assignee: $SingleLinkAccessor<Person>;
1401
1411
  }
1402
1412
 
1403
1413
  export interface Props {
1414
+ /**
1415
+ * (no ontology metadata)
1416
+ */
1417
+ readonly array: ('a' | 'b' | 'c')[] | undefined;
1404
1418
  /**
1405
1419
  * display name: 'Body',
1406
1420
  *
@@ -1467,6 +1481,10 @@ describe("generator", () => {
1467
1481
  primaryKeyApiName: 'id';
1468
1482
  primaryKeyType: 'integer';
1469
1483
  properties: {
1484
+ /**
1485
+ * (no ontology metadata)
1486
+ */
1487
+ array: $PropertyDef<'string', 'nullable', 'array'>;
1470
1488
  /**
1471
1489
  * display name: 'Body',
1472
1490
  *
@@ -1625,7 +1643,8 @@ describe("generator", () => {
1625
1643
  interfaceTypes: {},
1626
1644
  objectTypes: {},
1627
1645
  queryTypes: {},
1628
- sharedPropertyTypes: {}
1646
+ sharedPropertyTypes: {},
1647
+ valueTypes: {}
1629
1648
  }, "", helper.minimalFiles, BASE_PATH);
1630
1649
  expect(helper.getFiles()[`${BASE_PATH}/ontology/objects.ts`]).toEqual("export {};\n");
1631
1650
  });
@@ -1934,7 +1953,8 @@ describe("generator", () => {
1934
1953
  version: "0"
1935
1954
  }
1936
1955
  },
1937
- sharedPropertyTypes: {}
1956
+ sharedPropertyTypes: {},
1957
+ valueTypes: {}
1938
1958
  }, "typescript-sdk/0.0.0 osdk-cli/0.0.0", helper.minimalFiles, BASE_PATH, "module", new Map(), new Map(), new Map(), false, ["getCount"]);
1939
1959
  expect(tweakedFilesForSnapshotConsistency(helper.getFiles())).toMatchInlineSnapshot(`
1940
1960
  {
@@ -2071,13 +2091,17 @@ describe("generator", () => {
2071
2091
  } from '@osdk/client';
2072
2092
 
2073
2093
  export namespace Todo {
2074
- export type PropertyKeys = 'id' | 'body' | 'complete';
2094
+ export type PropertyKeys = 'id' | 'body' | 'complete' | 'array';
2075
2095
 
2076
2096
  export interface Links {
2077
2097
  readonly Assignee: $SingleLinkAccessor<Person>;
2078
2098
  }
2079
2099
 
2080
2100
  export interface Props {
2101
+ /**
2102
+ * (no ontology metadata)
2103
+ */
2104
+ readonly array: $PropType['string'][] | undefined;
2081
2105
  /**
2082
2106
  * display name: 'Body',
2083
2107
  *
@@ -2144,6 +2168,10 @@ describe("generator", () => {
2144
2168
  primaryKeyApiName: 'id';
2145
2169
  primaryKeyType: 'integer';
2146
2170
  properties: {
2171
+ /**
2172
+ * (no ontology metadata)
2173
+ */
2174
+ array: $PropertyDef<'string', 'nullable', 'array'>;
2147
2175
  /**
2148
2176
  * display name: 'Body',
2149
2177
  *