@osdk/generator-converters 2.8.0-beta.2 → 2.8.0-beta.21

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 (32) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +3 -0
  3. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  4. package/build/cjs/index.cjs +3 -0
  5. package/build/cjs/index.cjs.map +1 -1
  6. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +3 -0
  7. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  8. package/package.json +3 -3
  9. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +0 -78
  10. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +0 -1
  11. package/build/browser/empty.test.js +0 -23
  12. package/build/browser/empty.test.js.map +0 -1
  13. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +0 -269
  14. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +0 -1
  15. package/build/browser/wirePropertyFormattingToSdkFormatting.test.js +0 -344
  16. package/build/browser/wirePropertyFormattingToSdkFormatting.test.js.map +0 -1
  17. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +0 -78
  18. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +0 -1
  19. package/build/esm/empty.test.js +0 -23
  20. package/build/esm/empty.test.js.map +0 -1
  21. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +0 -269
  22. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +0 -1
  23. package/build/esm/wirePropertyFormattingToSdkFormatting.test.js +0 -344
  24. package/build/esm/wirePropertyFormattingToSdkFormatting.test.js.map +0 -1
  25. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts +0 -1
  26. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts.map +0 -1
  27. package/build/types/empty.test.d.ts +0 -1
  28. package/build/types/empty.test.d.ts.map +0 -1
  29. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +0 -1
  30. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +0 -1
  31. package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts +0 -1
  32. package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/generator-converters",
3
- "version": "2.8.0-beta.2",
3
+ "version": "2.8.0-beta.21",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@osdk/foundry.ontologies": "2.45.0",
33
- "@osdk/api": "~2.8.0-beta.2"
32
+ "@osdk/foundry.ontologies": "2.50.0",
33
+ "@osdk/api": "~2.8.0-beta.21"
34
34
  },
35
35
  "devDependencies": {
36
36
  "ts-expect": "^1.3.0",
@@ -1,78 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { describe, expect, it } from "vitest";
18
- import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
19
- describe("__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition", () => {
20
- it("sorts the implements array for stable output", () => {
21
- const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
22
- apiName: "TestInterface",
23
- rid: "testRid",
24
- displayName: "Test Interface",
25
- description: "A test interface",
26
- properties: {},
27
- allProperties: {},
28
- propertiesV2: {},
29
- allPropertiesV2: {},
30
- extendsInterfaces: ["ParentZ", "ParentA", "ParentC"],
31
- allExtendsInterfaces: ["ParentZ", "ParentA", "ParentC"],
32
- implementedByObjectTypes: [],
33
- links: {},
34
- allLinks: {}
35
- }, true);
36
- expect(result.implements).toEqual(["ParentA", "ParentC", "ParentZ"]);
37
- });
38
- it("sorts the implementedBy array for stable output", () => {
39
- const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
40
- apiName: "TestInterface",
41
- rid: "testRid",
42
- displayName: "Test Interface",
43
- description: "A test interface",
44
- properties: {},
45
- allProperties: {},
46
- propertiesV2: {},
47
- allPropertiesV2: {},
48
- extendsInterfaces: [],
49
- allExtendsInterfaces: [],
50
- implementedByObjectTypes: ["ObjectZ", "ObjectA", "ObjectC"],
51
- links: {},
52
- allLinks: {}
53
- }, true);
54
- expect(result.implementedBy).toEqual(["ObjectA", "ObjectC", "ObjectZ"]);
55
- });
56
- it("preserves empty arrays", () => {
57
- const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({
58
- apiName: "TestInterface",
59
- rid: "testRid",
60
- displayName: "Test Interface",
61
- description: "A test interface",
62
- properties: {},
63
- allProperties: {},
64
- propertiesV2: {},
65
- allPropertiesV2: {},
66
- extendsInterfaces: [],
67
- allExtendsInterfaces: [],
68
- implementedByObjectTypes: [],
69
- links: {},
70
- allLinks: {}
71
- }, true);
72
-
73
- // Empty arrays should remain as empty arrays
74
- expect(result.implements).toEqual([]);
75
- expect(result.implementedBy).toEqual([]);
76
- });
77
- });
78
- //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js","names":["describe","expect","it","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","result","apiName","rid","displayName","description","properties","allProperties","propertiesV2","allPropertiesV2","extendsInterfaces","allExtendsInterfaces","implementedByObjectTypes","links","allLinks","implements","toEqual","implementedBy"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js\";\n\ndescribe(\"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition\", () => {\n it(\"sorts the implements array for stable output\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n propertiesV2: {},\n allPropertiesV2: {},\n extendsInterfaces: [\"ParentZ\", \"ParentA\", \"ParentC\"],\n allExtendsInterfaces: [\"ParentZ\", \"ParentA\", \"ParentC\"],\n implementedByObjectTypes: [],\n links: {},\n allLinks: {},\n }, true);\n\n expect(result.implements).toEqual([\"ParentA\", \"ParentC\", \"ParentZ\"]);\n });\n\n it(\"sorts the implementedBy array for stable output\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n propertiesV2: {},\n allPropertiesV2: {},\n extendsInterfaces: [],\n allExtendsInterfaces: [],\n implementedByObjectTypes: [\"ObjectZ\", \"ObjectA\", \"ObjectC\"],\n links: {},\n allLinks: {},\n }, true);\n\n expect(result.implementedBy).toEqual([\"ObjectA\", \"ObjectC\", \"ObjectZ\"]);\n });\n\n it(\"preserves empty arrays\", () => {\n const result = __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition({\n apiName: \"TestInterface\",\n rid: \"testRid\",\n displayName: \"Test Interface\",\n description: \"A test interface\",\n properties: {},\n allProperties: {},\n propertiesV2: {},\n allPropertiesV2: {},\n extendsInterfaces: [],\n allExtendsInterfaces: [],\n implementedByObjectTypes: [],\n links: {},\n allLinks: {},\n }, true);\n\n // Empty arrays should remain as empty arrays\n expect(result.implements).toEqual([]);\n expect(result.implementedBy).toEqual([]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,mDAAmD,QAAQ,0DAA0D;AAE9HH,QAAQ,CAAC,qDAAqD,EAAE,MAAM;EACpEE,EAAE,CAAC,8CAA8C,EAAE,MAAM;IACvD,MAAME,MAAM,GAAGD,mDAAmD,CAAC;MACjEE,OAAO,EAAE,eAAe;MACxBC,GAAG,EAAE,SAAS;MACdC,WAAW,EAAE,gBAAgB;MAC7BC,WAAW,EAAE,kBAAkB;MAC/BC,UAAU,EAAE,CAAC,CAAC;MACdC,aAAa,EAAE,CAAC,CAAC;MACjBC,YAAY,EAAE,CAAC,CAAC;MAChBC,eAAe,EAAE,CAAC,CAAC;M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C;MACdC,aAAa,EAAE,CAAC,CAAC;MACjBC,YAAY,EAAE,CAAC,CAAC;MAChBC,eAAe,EAAE,CAAC,CAAC;MACnBC,iBAAiB,EAAE,EAAE;MACrBC,oBAAoB,EAAE,EAAE;MACxBC,wBAAwB,EAAE,EAAE;MAC5BC,KAAK,EAAE,CAAC,CAAC;MACTC,QAAQ,EAAE,CAAC;IACb,CAAC,EAAE,IAAI,CAAC;;IAER;IACAhB,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,CAACC,OAAO,CAAC,EAAE,CAAC;IACrClB,MAAM,CAACG,MAAM,CAACgB,aAAa,CAAC,CAACD,OAAO,CAAC,EAAE,CAAC;EAC1C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { describe, it } from "vitest";
18
- describe("nothing", () => {
19
- it("does nothing", () => {
20
- return true;
21
- });
22
- });
23
- //# sourceMappingURL=empty.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"empty.test.js","names":["describe","it"],"sources":["empty.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, it } from \"vitest\";\n\ndescribe(\"nothing\", () => {\n it(\"does nothing\", () => {\n return true;\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,EAAE,QAAQ,QAAQ;AAErCD,QAAQ,CAAC,SAAS,EAAE,MAAM;EACxBC,EAAE,CAAC,cAAc,EAAE,MAAM;IACvB,OAAO,IAAI;EACb,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,269 +0,0 @@
1
- /*
2
- * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { describe, expect, expectTypeOf, it } from "vitest";
18
- import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "./wireObjectTypeFullMetadataToSdkObjectMetadata.js";
19
- describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
20
- it("handles magic nullable properties", () => {
21
- const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
22
- implementsInterfaces: [],
23
- implementsInterfaces2: {},
24
- linkTypes: [],
25
- objectType: {
26
- apiName: "apiName",
27
- description: "description",
28
- displayName: "displayName",
29
- pluralDisplayName: "displayNames",
30
- icon: {
31
- type: "blueprint",
32
- name: "blueprint",
33
- color: "blue"
34
- },
35
- primaryKey: "primaryKey",
36
- properties: {
37
- primaryKey: {
38
- dataType: {
39
- type: "string"
40
- },
41
- "rid": "rid"
42
- },
43
- otherKey: {
44
- nullable: false,
45
- dataType: {
46
- type: "string"
47
- },
48
- rid: "rid"
49
- },
50
- defaulted: {
51
- dataType: {
52
- type: "string"
53
- },
54
- rid: "rid"
55
- }
56
- },
57
- rid: "rid",
58
- status: "ACTIVE",
59
- titleProperty: "otherKey"
60
- },
61
- sharedPropertyTypeMapping: {}
62
- }, true);
63
-
64
- // PK is never nullable
65
- expect(result.properties["primaryKey"].nullable).toBe(false);
66
-
67
- // was specified above
68
- expect(result.properties["otherKey"].nullable).toBe(false);
69
-
70
- // was unspecified, so should be nullable
71
- expect(result.properties["defaulted"].nullable).toBe(true);
72
- });
73
- it("Is up to date with the enums from API", () => {
74
- expectTypeOf().toEqualTypeOf();
75
- expectTypeOf().toEqualTypeOf();
76
- expectTypeOf().toEqualTypeOf();
77
- });
78
- it("does not throw when enums don't match", () => {
79
- const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
80
- implementsInterfaces: [],
81
- implementsInterfaces2: {},
82
- linkTypes: [],
83
- objectType: {
84
- apiName: "apiName",
85
- description: "description",
86
- displayName: "displayName",
87
- pluralDisplayName: "displayNames",
88
- icon: {
89
- type: "INVALID_NOT_IN_API",
90
- name: "blueprint",
91
- color: "blue"
92
- },
93
- primaryKey: "primaryKey",
94
- properties: {
95
- primaryKey: {
96
- dataType: {
97
- type: "string"
98
- },
99
- "rid": "rid"
100
- },
101
- otherKey: {
102
- nullable: false,
103
- dataType: {
104
- type: "string"
105
- },
106
- rid: "rid"
107
- },
108
- defaulted: {
109
- dataType: {
110
- type: "string"
111
- },
112
- rid: "rid"
113
- }
114
- },
115
- rid: "rid",
116
- status: "INVALID_NOT_IN_API",
117
- visibility: "INVALID_NOT_IN_API",
118
- titleProperty: "otherKey"
119
- },
120
- sharedPropertyTypeMapping: {}
121
- }, true);
122
- expect(result.status).toBeUndefined();
123
- expect(result.visibility).toBeUndefined();
124
- expect(result.icon).toBeUndefined();
125
- });
126
- it("sorts the implements array for stable output", () => {
127
- const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
128
- implementsInterfaces: ["InterfaceZ", "InterfaceA", "InterfaceC"],
129
- implementsInterfaces2: {
130
- "InterfaceZ": {
131
- properties: {},
132
- propertiesV2: {},
133
- links: {}
134
- },
135
- "InterfaceA": {
136
- properties: {},
137
- propertiesV2: {},
138
- links: {}
139
- },
140
- "InterfaceC": {
141
- properties: {},
142
- propertiesV2: {},
143
- links: {}
144
- }
145
- },
146
- linkTypes: [],
147
- objectType: {
148
- apiName: "apiName",
149
- description: "description",
150
- displayName: "displayName",
151
- pluralDisplayName: "displayNames",
152
- icon: {
153
- type: "blueprint",
154
- name: "blueprint",
155
- color: "blue"
156
- },
157
- primaryKey: "primaryKey",
158
- properties: {
159
- primaryKey: {
160
- dataType: {
161
- type: "string"
162
- },
163
- "rid": "rid"
164
- }
165
- },
166
- rid: "rid",
167
- status: "ACTIVE",
168
- titleProperty: "primaryKey"
169
- },
170
- sharedPropertyTypeMapping: {}
171
- }, true);
172
-
173
- // Check that the array is sorted alphabetically
174
- expect(result.implements).toEqual(["InterfaceA", "InterfaceC", "InterfaceZ"]);
175
- });
176
- it("sorts the linkTypes array for stable output", () => {
177
- const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
178
- implementsInterfaces: [],
179
- implementsInterfaces2: {},
180
- linkTypes: [{
181
- apiName: "linkZ",
182
- cardinality: "ONE",
183
- objectTypeApiName: "TargetZ",
184
- displayName: "LinkZ",
185
- status: "ACTIVE",
186
- linkTypeRid: "ridZ"
187
- }, {
188
- apiName: "linkA",
189
- cardinality: "MANY",
190
- objectTypeApiName: "TargetA",
191
- displayName: "LinkA",
192
- status: "ACTIVE",
193
- linkTypeRid: "ridA"
194
- }, {
195
- apiName: "linkC",
196
- cardinality: "ONE",
197
- objectTypeApiName: "TargetC",
198
- displayName: "LinkC",
199
- status: "ACTIVE",
200
- linkTypeRid: "ridC"
201
- }],
202
- objectType: {
203
- apiName: "apiName",
204
- description: "description",
205
- displayName: "displayName",
206
- pluralDisplayName: "displayNames",
207
- icon: {
208
- type: "blueprint",
209
- name: "blueprint",
210
- color: "blue"
211
- },
212
- primaryKey: "primaryKey",
213
- properties: {
214
- primaryKey: {
215
- dataType: {
216
- type: "string"
217
- },
218
- "rid": "rid"
219
- }
220
- },
221
- rid: "rid",
222
- status: "ACTIVE",
223
- titleProperty: "primaryKey"
224
- },
225
- sharedPropertyTypeMapping: {}
226
- }, true);
227
-
228
- // Get the link keys in the order they appear in the result
229
- const linkKeys = Object.keys(result.links);
230
-
231
- // Check that the links are sorted alphabetically by apiName
232
- expect(linkKeys).toEqual(["linkA", "linkC", "linkZ"]);
233
- });
234
- it("preserves empty arrays", () => {
235
- const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
236
- implementsInterfaces: [],
237
- implementsInterfaces2: {},
238
- linkTypes: [],
239
- objectType: {
240
- apiName: "apiName",
241
- description: "description",
242
- displayName: "displayName",
243
- pluralDisplayName: "displayNames",
244
- icon: {
245
- type: "blueprint",
246
- name: "blueprint",
247
- color: "blue"
248
- },
249
- primaryKey: "primaryKey",
250
- properties: {
251
- primaryKey: {
252
- dataType: {
253
- type: "string"
254
- },
255
- "rid": "rid"
256
- }
257
- },
258
- rid: "rid",
259
- status: "ACTIVE",
260
- titleProperty: "primaryKey"
261
- },
262
- sharedPropertyTypeMapping: {}
263
- }, true);
264
-
265
- // Check that empty array is preserved
266
- expect(result.implements).toEqual([]);
267
- });
268
- });
269
- //# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.test.js","names":["describe","expect","expectTypeOf","it","wireObjectTypeFullMetadataToSdkObjectMetadata","result","implementsInterfaces","implementsInterfaces2","linkTypes","objectType","apiName","description","displayName","pluralDisplayName","icon","type","name","color","primaryKey","properties","dataType","otherKey","nullable","rid","defaulted","status","titleProperty","sharedPropertyTypeMapping","toBe","toEqualTypeOf","visibility","toBeUndefined","propertiesV2","links","implements","toEqual","cardinality","objectTypeApiName","linkTypeRid","linkKeys","Object","keys"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport { describe, expect, expectTypeOf, it } from \"vitest\";\nimport type {\n supportedIconTypes,\n supportedObjectTypeVisibility,\n supportedReleaseStatus,\n} from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\n\ndescribe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {\n it(\"handles magic nullable properties\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // PK is never nullable\n expect(result.properties[\"primaryKey\"].nullable).toBe(false);\n\n // was specified above\n expect(result.properties[\"otherKey\"].nullable).toBe(false);\n\n // was unspecified, so should be nullable\n expect(result.properties[\"defaulted\"].nullable).toBe(true);\n });\n\n it(\"Is up to date with the enums from API\", () => {\n type excludedStatuses = \"\";\n expectTypeOf<\n Exclude<\n typeof supportedReleaseStatus[number],\n excludedStatuses\n >\n >()\n .toEqualTypeOf<\n NonNullable<ObjectMetadata[\"status\"]>\n >();\n\n type excludedVisibility = \"\";\n expectTypeOf<\n Exclude<typeof supportedObjectTypeVisibility[number], excludedVisibility>\n >().toEqualTypeOf<\n NonNullable<ObjectMetadata[\"visibility\"]>\n >();\n\n type excludedIconTypes = \"\";\n expectTypeOf<\n Exclude<typeof supportedIconTypes[number], excludedIconTypes>\n >()\n .toEqualTypeOf<\n NonNullable<NonNullable<ObjectMetadata[\"icon\"]>[\"type\"]>\n >();\n });\n\n it(\"does not throw when enums don't match\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: {\n type: \"INVALID_NOT_IN_API\",\n name: \"blueprint\",\n color: \"blue\",\n } as any,\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"INVALID_NOT_IN_API\" as any,\n visibility: \"INVALID_NOT_IN_API\" as any,\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n expect(result.status).toBeUndefined();\n expect(result.visibility).toBeUndefined();\n expect(result.icon).toBeUndefined();\n });\n\n it(\"sorts the implements array for stable output\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [\"InterfaceZ\", \"InterfaceA\", \"InterfaceC\"],\n implementsInterfaces2: {\n \"InterfaceZ\": { properties: {}, propertiesV2: {}, links: {} },\n \"InterfaceA\": { properties: {}, propertiesV2: {}, links: {} },\n \"InterfaceC\": { properties: {}, propertiesV2: {}, links: {} },\n },\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Check that the array is sorted alphabetically\n expect(result.implements).toEqual([\n \"InterfaceA\",\n \"InterfaceC\",\n \"InterfaceZ\",\n ]);\n });\n\n it(\"sorts the linkTypes array for stable output\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [\n {\n apiName: \"linkZ\",\n cardinality: \"ONE\",\n objectTypeApiName: \"TargetZ\",\n displayName: \"LinkZ\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridZ\",\n },\n {\n apiName: \"linkA\",\n cardinality: \"MANY\",\n objectTypeApiName: \"TargetA\",\n displayName: \"LinkA\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridA\",\n },\n {\n apiName: \"linkC\",\n cardinality: \"ONE\",\n objectTypeApiName: \"TargetC\",\n displayName: \"LinkC\",\n status: \"ACTIVE\",\n linkTypeRid: \"ridC\",\n },\n ],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Get the link keys in the order they appear in the result\n const linkKeys = Object.keys(result.links);\n\n // Check that the links are sorted alphabetically by apiName\n expect(linkKeys).toEqual([\"linkA\", \"linkC\", \"linkZ\"]);\n });\n\n it(\"preserves empty arrays\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" }, \"rid\": \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"primaryKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // Check that empty array is preserved\n expect(result.implements).toEqual([]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAM3D,SAASC,6CAA6C,QAAQ,oDAAoD;AAElHJ,QAAQ,CAACI,6CAA6C,EAAE,MAAM;EAC5DD,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAME,MAAM,GAAGD,6CAA6C,CAAC;MAC3DE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACVC,OAAO,EAAE,SAAS;QAClBC,WAAW,EAAE,aAAa;QAC1BC,WAAW,EAAE,aAAa;QAC1BC,iBAAiB,EAAE,cAAc;QACjCC,IAAI,EAAE;UAAEC,IAAI,EAAE,WAAW;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