@osdk/generator-converters 2.8.0-beta.8 → 2.8.0

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 (39) hide show
  1. package/CHANGELOG.md +202 -0
  2. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js +2 -1
  3. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
  4. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +4 -0
  5. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  6. package/build/cjs/index.cjs +6 -1
  7. package/build/cjs/index.cjs.map +1 -1
  8. package/build/cjs/index.d.cts +1 -1
  9. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js +2 -1
  10. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
  11. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +4 -0
  12. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  13. package/build/types/wireActionTypeV2ToSdkActionMetadata.d.ts +1 -1
  14. package/build/types/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -1
  15. package/package.json +5 -5
  16. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +0 -78
  17. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +0 -1
  18. package/build/browser/empty.test.js +0 -23
  19. package/build/browser/empty.test.js.map +0 -1
  20. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +0 -269
  21. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +0 -1
  22. package/build/browser/wirePropertyFormattingToSdkFormatting.test.js +0 -344
  23. package/build/browser/wirePropertyFormattingToSdkFormatting.test.js.map +0 -1
  24. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js +0 -78
  25. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.js.map +0 -1
  26. package/build/esm/empty.test.js +0 -23
  27. package/build/esm/empty.test.js.map +0 -1
  28. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +0 -269
  29. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +0 -1
  30. package/build/esm/wirePropertyFormattingToSdkFormatting.test.js +0 -344
  31. package/build/esm/wirePropertyFormattingToSdkFormatting.test.js.map +0 -1
  32. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts +0 -1
  33. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.test.d.ts.map +0 -1
  34. package/build/types/empty.test.d.ts +0 -1
  35. package/build/types/empty.test.d.ts.map +0 -1
  36. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +0 -1
  37. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +0 -1
  38. package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts +0 -1
  39. package/build/types/wirePropertyFormattingToSdkFormatting.test.d.ts.map +0 -1
@@ -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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,CAAC,EAAE,IAAI,CAAC;;IAER;IACA,MAAMY,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACpC,MAAM,CAAC4B,KAAK,CAAC;;IAE1C;IACAhC,MAAM,CAACsC,QAAQ,CAAC,CAACJ,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACvD,CAAC,CAAC;EAEFhC,EAAE,CAAC,wBAAwB,EAAE,MAAM;IACjC,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;UAAEC,IAAI,EAAE,WAAW;UAAEC,KAAK,EAAE;QAAO,CAAC;QAC7DC,UAAU,EAAE,YAAY;QACxBC,UAAU,EAAE;UACVD,UAAU,EAAE;YAAEE,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS,CAAC;YAAE,KAAK,EAAE;UAAM;QAC3D,CAAC;QACDQ,GAAG,EAAE,KAAK;QACVE,MAAM,EAAE,QAAQ;QAChBC,aAAa,EAAE;MACjB,CAAC;MACDC,yBAAyB,EAAE,CAAC;IAC9B,CAAC,EAAE,IAAI,CAAC;;IAER;IACA1B,MAAM,CAACI,MAAM,CAAC6B,UAAU,CAAC,CAACC,OAAO,CAAC,EAAE,CAAC;EACvC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,344 +0,0 @@
1
- /*
2
- * Copyright 2025 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 { wirePropertyFormattingToSdkFormatting } from "./wirePropertyFormattingToSdkFormatting.js";
19
- describe(wirePropertyFormattingToSdkFormatting, () => {
20
- describe("number formatting", () => {
21
- it("converts standard number format", () => {
22
- const result = wirePropertyFormattingToSdkFormatting({
23
- type: "number",
24
- numberType: {
25
- type: "standard",
26
- baseFormatOptions: {
27
- useGrouping: true,
28
- minimumFractionDigits: 2,
29
- maximumFractionDigits: 4,
30
- notation: "COMPACT"
31
- }
32
- }
33
- });
34
- expect(result).toEqual({
35
- type: "number",
36
- numberType: {
37
- type: "standard",
38
- baseFormatOptions: {
39
- useGrouping: true,
40
- minimumFractionDigits: 2,
41
- maximumFractionDigits: 4,
42
- notation: "COMPACT"
43
- }
44
- }
45
- });
46
- });
47
- it("converts currency format with property reference", () => {
48
- const result = wirePropertyFormattingToSdkFormatting({
49
- type: "number",
50
- numberType: {
51
- type: "currency",
52
- baseFormatOptions: {
53
- minimumFractionDigits: 2,
54
- maximumFractionDigits: 2
55
- },
56
- style: "STANDARD",
57
- currencyCode: {
58
- type: "propertyType",
59
- propertyApiName: "currencyField"
60
- }
61
- }
62
- });
63
- expect(result).toEqual({
64
- type: "number",
65
- numberType: {
66
- type: "currency",
67
- baseFormatOptions: {
68
- minimumFractionDigits: 2,
69
- maximumFractionDigits: 2
70
- },
71
- style: "STANDARD",
72
- currencyCode: {
73
- type: "propertyType",
74
- propertyApiName: "currencyField"
75
- }
76
- }
77
- });
78
- });
79
- it("converts duration format with human readable style", () => {
80
- const result = wirePropertyFormattingToSdkFormatting({
81
- type: "number",
82
- numberType: {
83
- type: "duration",
84
- formatStyle: {
85
- type: "humanReadable",
86
- showFullUnits: true
87
- },
88
- precision: "MINUTES",
89
- baseValue: "SECONDS"
90
- }
91
- });
92
- expect(result).toEqual({
93
- type: "number",
94
- numberType: {
95
- type: "duration",
96
- formatStyle: {
97
- type: "humanReadable",
98
- showFullUnits: true
99
- },
100
- precision: "MINUTES",
101
- baseValue: "SECONDS"
102
- }
103
- });
104
- });
105
- it("converts ratio format for percentage", () => {
106
- const result = wirePropertyFormattingToSdkFormatting({
107
- type: "number",
108
- numberType: {
109
- type: "ratio",
110
- ratioType: "PERCENTAGE",
111
- baseFormatOptions: {
112
- minimumFractionDigits: 1,
113
- maximumFractionDigits: 2
114
- }
115
- }
116
- });
117
- expect(result).toEqual({
118
- type: "number",
119
- numberType: {
120
- type: "ratio",
121
- ratioType: "PERCENTAGE",
122
- baseFormatOptions: {
123
- minimumFractionDigits: 1,
124
- maximumFractionDigits: 2
125
- }
126
- }
127
- });
128
- });
129
- it("returns undefined for unknown number format type", () => {
130
- const result = wirePropertyFormattingToSdkFormatting({
131
- type: "number",
132
- numberType: {
133
- type: "INVALID_FORMAT_TYPE",
134
- someUnknownField: "value"
135
- }
136
- });
137
- expect(result).toBeUndefined();
138
- });
139
- });
140
- describe("date/timestamp formatting", () => {
141
- it("converts date format with string pattern", () => {
142
- const result = wirePropertyFormattingToSdkFormatting({
143
- type: "date",
144
- format: {
145
- type: "stringFormat",
146
- pattern: "yyyy-MM-dd"
147
- }
148
- });
149
- expect(result).toEqual({
150
- type: "date",
151
- format: {
152
- type: "stringFormat",
153
- pattern: "yyyy-MM-dd"
154
- }
155
- });
156
- });
157
- it("converts timestamp format with localized format and static timezone", () => {
158
- const result = wirePropertyFormattingToSdkFormatting({
159
- type: "timestamp",
160
- format: {
161
- type: "localizedFormat",
162
- format: "DATE_FORMAT_DATE_TIME"
163
- },
164
- displayTimezone: {
165
- type: "static",
166
- zoneId: {
167
- type: "constant",
168
- value: "America/New_York"
169
- }
170
- }
171
- });
172
- expect(result).toEqual({
173
- type: "timestamp",
174
- format: {
175
- type: "localizedFormat",
176
- format: "DATE_FORMAT_DATE_TIME"
177
- },
178
- displayTimezone: {
179
- type: "static",
180
- zoneId: {
181
- type: "constant",
182
- value: "America/New_York"
183
- }
184
- }
185
- });
186
- });
187
- it("returns undefined for unknown datetime format type", () => {
188
- const result = wirePropertyFormattingToSdkFormatting({
189
- type: "date",
190
- format: {
191
- type: "UNKNOWN_FORMAT_TYPE"
192
- }
193
- });
194
- expect(result).toBeUndefined();
195
- });
196
- });
197
- describe("boolean formatting", () => {
198
- it("converts boolean format", () => {
199
- const result = wirePropertyFormattingToSdkFormatting({
200
- type: "boolean",
201
- valueIfTrue: "Yes",
202
- valueIfFalse: "No"
203
- });
204
- expect(result).toEqual({
205
- type: "boolean",
206
- valueIfTrue: "Yes",
207
- valueIfFalse: "No"
208
- });
209
- });
210
- });
211
- describe("known type formatting", () => {
212
- it("converts valid known types", () => {
213
- const testCases = [{
214
- input: "USER_OR_GROUP_ID",
215
- expected: "USER_OR_GROUP_ID"
216
- }, {
217
- input: "RESOURCE_RID",
218
- expected: "RESOURCE_RID"
219
- }, {
220
- input: "ARTIFACT_GID",
221
- expected: "ARTIFACT_GID"
222
- }];
223
- for (const {
224
- input,
225
- expected
226
- } of testCases) {
227
- const result = wirePropertyFormattingToSdkFormatting({
228
- type: "knownType",
229
- knownType: input
230
- });
231
- expect(result).toEqual({
232
- type: "knownType",
233
- knownType: expected
234
- });
235
- }
236
- });
237
- it("returns undefined for invalid known type", () => {
238
- const result = wirePropertyFormattingToSdkFormatting({
239
- type: "knownType",
240
- knownType: "INVALID_KNOWN_TYPE"
241
- });
242
- expect(result).toBeUndefined();
243
- });
244
- });
245
- describe("unknown formatting types", () => {
246
- it("returns undefined for completely unknown formatting type", () => {
247
- const result = wirePropertyFormattingToSdkFormatting({
248
- type: "UNKNOWN_FORMAT_TYPE",
249
- someField: "value"
250
- });
251
- expect(result).toBeUndefined();
252
- });
253
- describe("affix formatting", () => {
254
- it("converts affix format with prefix and postfix", () => {
255
- const result = wirePropertyFormattingToSdkFormatting({
256
- type: "number",
257
- numberType: {
258
- type: "affix",
259
- baseFormatOptions: {
260
- useGrouping: true
261
- },
262
- affix: {
263
- prefix: {
264
- type: "constant",
265
- value: "$"
266
- },
267
- postfix: {
268
- type: "propertyType",
269
- propertyApiName: "unitField"
270
- }
271
- }
272
- }
273
- });
274
- expect(result).toEqual({
275
- type: "number",
276
- numberType: {
277
- type: "affix",
278
- baseFormatOptions: {
279
- useGrouping: true
280
- },
281
- affix: {
282
- prefix: {
283
- type: "constant",
284
- value: "$"
285
- },
286
- postfix: {
287
- type: "propertyType",
288
- propertyApiName: "unitField"
289
- }
290
- }
291
- }
292
- });
293
- });
294
- it("handles affix with missing prefix/postfix", () => {
295
- const result = wirePropertyFormattingToSdkFormatting({
296
- type: "number",
297
- numberType: {
298
- type: "affix",
299
- baseFormatOptions: {},
300
- affix: {}
301
- }
302
- });
303
- expect(result).toEqual({
304
- type: "number",
305
- numberType: {
306
- type: "affix",
307
- baseFormatOptions: {},
308
- affix: {
309
- prefix: undefined,
310
- postfix: undefined
311
- }
312
- }
313
- });
314
- });
315
- });
316
- describe("fixed values formatting", () => {
317
- it("converts fixed values format", () => {
318
- const result = wirePropertyFormattingToSdkFormatting({
319
- type: "number",
320
- numberType: {
321
- type: "fixedValues",
322
- values: {
323
- 1: "First",
324
- 2: "Second",
325
- 3: "Third"
326
- }
327
- }
328
- });
329
- expect(result).toEqual({
330
- type: "number",
331
- numberType: {
332
- type: "fixedValues",
333
- values: {
334
- 1: "First",
335
- 2: "Second",
336
- 3: "Third"
337
- }
338
- }
339
- });
340
- });
341
- });
342
- });
343
- });
344
- //# sourceMappingURL=wirePropertyFormattingToSdkFormatting.test.js.map