@osdk/maker 0.16.0-beta.9 → 0.16.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 (115) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/build/browser/api/defineFunction.js +6 -5
  3. package/build/browser/api/defineFunction.js.map +1 -1
  4. package/build/browser/api/defineInterface.js +3 -0
  5. package/build/browser/api/defineInterface.js.map +1 -1
  6. package/build/browser/api/defineLink.js +3 -0
  7. package/build/browser/api/defineLink.js.map +1 -1
  8. package/build/browser/api/defineObject.js +9 -2
  9. package/build/browser/api/defineObject.js.map +1 -1
  10. package/build/browser/api/interface/InterfaceType.js.map +1 -1
  11. package/build/browser/api/links/LinkType.js.map +1 -1
  12. package/build/browser/api/object/ObjectType.js.map +1 -1
  13. package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -1
  14. package/build/browser/cli/main.js +4 -4
  15. package/build/browser/cli/main.js.map +1 -1
  16. package/build/browser/conversion/toMarketplace/convertInterface.js +2 -1
  17. package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -1
  18. package/build/browser/conversion/toMarketplace/convertLink.js +9 -4
  19. package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -1
  20. package/build/browser/util/ApiNameValidator.js +26 -0
  21. package/build/browser/util/ApiNameValidator.js.map +1 -0
  22. package/build/cjs/index.cjs +107 -83
  23. package/build/cjs/index.cjs.map +1 -1
  24. package/build/cjs/index.d.cts +5 -1
  25. package/build/esm/api/defineFunction.js +6 -5
  26. package/build/esm/api/defineFunction.js.map +1 -1
  27. package/build/esm/api/defineInterface.js +3 -0
  28. package/build/esm/api/defineInterface.js.map +1 -1
  29. package/build/esm/api/defineLink.js +3 -0
  30. package/build/esm/api/defineLink.js.map +1 -1
  31. package/build/esm/api/defineObject.js +9 -2
  32. package/build/esm/api/defineObject.js.map +1 -1
  33. package/build/esm/api/interface/InterfaceType.js.map +1 -1
  34. package/build/esm/api/links/LinkType.js.map +1 -1
  35. package/build/esm/api/object/ObjectType.js.map +1 -1
  36. package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -1
  37. package/build/esm/cli/main.js +4 -4
  38. package/build/esm/cli/main.js.map +1 -1
  39. package/build/esm/conversion/toMarketplace/convertInterface.js +2 -1
  40. package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -1
  41. package/build/esm/conversion/toMarketplace/convertLink.js +9 -4
  42. package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -1
  43. package/build/esm/util/ApiNameValidator.js +26 -0
  44. package/build/esm/util/ApiNameValidator.js.map +1 -0
  45. package/build/types/api/defineFunction.d.ts.map +1 -1
  46. package/build/types/api/defineInterface.d.ts.map +1 -1
  47. package/build/types/api/defineLink.d.ts.map +1 -1
  48. package/build/types/api/defineObject.d.ts.map +1 -1
  49. package/build/types/api/interface/InterfaceType.d.ts +1 -1
  50. package/build/types/api/interface/InterfaceType.d.ts.map +1 -1
  51. package/build/types/api/links/LinkType.d.ts +2 -0
  52. package/build/types/api/links/LinkType.d.ts.map +1 -1
  53. package/build/types/api/object/ObjectType.d.ts +1 -0
  54. package/build/types/api/object/ObjectType.d.ts.map +1 -1
  55. package/build/types/api/object/ObjectTypeDefinition.d.ts +1 -0
  56. package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -1
  57. package/build/types/cli/main.d.ts.map +1 -1
  58. package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -1
  59. package/build/types/util/ApiNameValidator.d.ts +4 -0
  60. package/build/types/util/ApiNameValidator.d.ts.map +1 -0
  61. package/package.json +6 -6
  62. package/build/browser/api/test/actions.test.js +0 -14402
  63. package/build/browser/api/test/actions.test.js.map +0 -1
  64. package/build/browser/api/test/interfaces.test.js +0 -1189
  65. package/build/browser/api/test/interfaces.test.js.map +0 -1
  66. package/build/browser/api/test/links.test.js +0 -2019
  67. package/build/browser/api/test/links.test.js.map +0 -1
  68. package/build/browser/api/test/markingconstraint.test.js +0 -134
  69. package/build/browser/api/test/markingconstraint.test.js.map +0 -1
  70. package/build/browser/api/test/misc.test.js +0 -1315
  71. package/build/browser/api/test/misc.test.js.map +0 -1
  72. package/build/browser/api/test/objectStatus.test.js +0 -252
  73. package/build/browser/api/test/objectStatus.test.js.map +0 -1
  74. package/build/browser/api/test/objects.test.js +0 -4441
  75. package/build/browser/api/test/objects.test.js.map +0 -1
  76. package/build/browser/api/test/spt.test.js +0 -751
  77. package/build/browser/api/test/spt.test.js.map +0 -1
  78. package/build/browser/api/test/valueTypes.test.js +0 -307
  79. package/build/browser/api/test/valueTypes.test.js.map +0 -1
  80. package/build/esm/api/test/actions.test.js +0 -14402
  81. package/build/esm/api/test/actions.test.js.map +0 -1
  82. package/build/esm/api/test/interfaces.test.js +0 -1189
  83. package/build/esm/api/test/interfaces.test.js.map +0 -1
  84. package/build/esm/api/test/links.test.js +0 -2019
  85. package/build/esm/api/test/links.test.js.map +0 -1
  86. package/build/esm/api/test/markingconstraint.test.js +0 -134
  87. package/build/esm/api/test/markingconstraint.test.js.map +0 -1
  88. package/build/esm/api/test/misc.test.js +0 -1315
  89. package/build/esm/api/test/misc.test.js.map +0 -1
  90. package/build/esm/api/test/objectStatus.test.js +0 -252
  91. package/build/esm/api/test/objectStatus.test.js.map +0 -1
  92. package/build/esm/api/test/objects.test.js +0 -4441
  93. package/build/esm/api/test/objects.test.js.map +0 -1
  94. package/build/esm/api/test/spt.test.js +0 -751
  95. package/build/esm/api/test/spt.test.js.map +0 -1
  96. package/build/esm/api/test/valueTypes.test.js +0 -307
  97. package/build/esm/api/test/valueTypes.test.js.map +0 -1
  98. package/build/types/api/test/actions.test.d.ts +0 -1
  99. package/build/types/api/test/actions.test.d.ts.map +0 -1
  100. package/build/types/api/test/interfaces.test.d.ts +0 -1
  101. package/build/types/api/test/interfaces.test.d.ts.map +0 -1
  102. package/build/types/api/test/links.test.d.ts +0 -1
  103. package/build/types/api/test/links.test.d.ts.map +0 -1
  104. package/build/types/api/test/markingconstraint.test.d.ts +0 -1
  105. package/build/types/api/test/markingconstraint.test.d.ts.map +0 -1
  106. package/build/types/api/test/misc.test.d.ts +0 -1
  107. package/build/types/api/test/misc.test.d.ts.map +0 -1
  108. package/build/types/api/test/objectStatus.test.d.ts +0 -1
  109. package/build/types/api/test/objectStatus.test.d.ts.map +0 -1
  110. package/build/types/api/test/objects.test.d.ts +0 -1
  111. package/build/types/api/test/objects.test.d.ts.map +0 -1
  112. package/build/types/api/test/spt.test.d.ts +0 -1
  113. package/build/types/api/test/spt.test.d.ts.map +0 -1
  114. package/build/types/api/test/valueTypes.test.d.ts +0 -1
  115. package/build/types/api/test/valueTypes.test.d.ts.map +0 -1
@@ -1,751 +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 { beforeEach, describe, expect, it } from "vitest";
18
- import { defineCreateObjectAction } from "../defineCreateObjectAction.js";
19
- import { defineInterface } from "../defineInterface.js";
20
- import { defineObject } from "../defineObject.js";
21
- import { defineOntology, dumpOntologyFullMetadata } from "../defineOntology.js";
22
- import { defineSharedPropertyType } from "../defineSpt.js";
23
- describe("SPTs", () => {
24
- beforeEach(async () => {
25
- await defineOntology("com.palantir.", () => {}, "/tmp/");
26
- });
27
- it("doesn't let you create the same spt twice", () => {
28
- defineSharedPropertyType({
29
- apiName: "foo",
30
- type: "string"
31
- });
32
- expect(() => {
33
- defineSharedPropertyType({
34
- apiName: "foo",
35
- type: "string"
36
- });
37
- }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);
38
- });
39
- it("uses a predefined spt", () => {
40
- const fooSpt = defineSharedPropertyType({
41
- apiName: "fooSpt",
42
- type: "string"
43
- });
44
- defineInterface({
45
- apiName: "FooInterface",
46
- displayName: "Foo Interface",
47
- properties: {
48
- fooSpt
49
- },
50
- icon: {
51
- color: "#00000",
52
- locator: "airplane"
53
- }
54
- });
55
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
56
- {
57
- "actionTypes": {},
58
- "blockPermissionInformation": {
59
- "actionTypes": {},
60
- "linkTypes": {},
61
- "objectTypes": {},
62
- },
63
- "interfaceTypes": {
64
- "com.palantir.FooInterface": {
65
- "interfaceType": {
66
- "apiName": "com.palantir.FooInterface",
67
- "displayMetadata": {
68
- "description": "Foo Interface",
69
- "displayName": "Foo Interface",
70
- "icon": {
71
- "blueprint": {
72
- "color": "#00000",
73
- "locator": "airplane",
74
- },
75
- "type": "blueprint",
76
- },
77
- },
78
- "extendsInterfaces": [],
79
- "links": [],
80
- "properties": [],
81
- "propertiesV2": {
82
- "com.palantir.fooSpt": {
83
- "required": true,
84
- "sharedPropertyType": {
85
- "aliases": [],
86
- "apiName": "com.palantir.fooSpt",
87
- "baseFormatter": undefined,
88
- "dataConstraints": undefined,
89
- "displayMetadata": {
90
- "description": undefined,
91
- "displayName": "fooSpt",
92
- "visibility": "NORMAL",
93
- },
94
- "gothamMapping": undefined,
95
- "indexedForSearch": true,
96
- "type": {
97
- "string": {
98
- "analyzerOverride": undefined,
99
- "enableAsciiFolding": undefined,
100
- "isLongText": false,
101
- "supportsEfficientLeadingWildcard": false,
102
- "supportsExactMatching": true,
103
- },
104
- "type": "string",
105
- },
106
- "typeClasses": [
107
- {
108
- "kind": "render_hint",
109
- "name": "SELECTABLE",
110
- },
111
- {
112
- "kind": "render_hint",
113
- "name": "SORTABLE",
114
- },
115
- ],
116
- "valueType": undefined,
117
- },
118
- },
119
- },
120
- "propertiesV3": {
121
- "com.palantir.fooSpt": {
122
- "sharedPropertyBasedPropertyType": {
123
- "requireImplementation": true,
124
- "sharedPropertyType": {
125
- "aliases": [],
126
- "apiName": "com.palantir.fooSpt",
127
- "baseFormatter": undefined,
128
- "dataConstraints": undefined,
129
- "displayMetadata": {
130
- "description": undefined,
131
- "displayName": "fooSpt",
132
- "visibility": "NORMAL",
133
- },
134
- "gothamMapping": undefined,
135
- "indexedForSearch": true,
136
- "type": {
137
- "string": {
138
- "analyzerOverride": undefined,
139
- "enableAsciiFolding": undefined,
140
- "isLongText": false,
141
- "supportsEfficientLeadingWildcard": false,
142
- "supportsExactMatching": true,
143
- },
144
- "type": "string",
145
- },
146
- "typeClasses": [
147
- {
148
- "kind": "render_hint",
149
- "name": "SELECTABLE",
150
- },
151
- {
152
- "kind": "render_hint",
153
- "name": "SORTABLE",
154
- },
155
- ],
156
- "valueType": undefined,
157
- },
158
- },
159
- "type": "sharedPropertyBasedPropertyType",
160
- },
161
- },
162
- "searchable": true,
163
- "status": {
164
- "active": {},
165
- "type": "active",
166
- },
167
- },
168
- },
169
- },
170
- "linkTypes": {},
171
- "objectTypes": {},
172
- "sharedPropertyTypes": {
173
- "com.palantir.fooSpt": {
174
- "sharedPropertyType": {
175
- "aliases": [],
176
- "apiName": "com.palantir.fooSpt",
177
- "baseFormatter": undefined,
178
- "dataConstraints": undefined,
179
- "displayMetadata": {
180
- "description": undefined,
181
- "displayName": "fooSpt",
182
- "visibility": "NORMAL",
183
- },
184
- "gothamMapping": undefined,
185
- "indexedForSearch": true,
186
- "type": {
187
- "string": {
188
- "analyzerOverride": undefined,
189
- "enableAsciiFolding": undefined,
190
- "isLongText": false,
191
- "supportsEfficientLeadingWildcard": false,
192
- "supportsExactMatching": true,
193
- },
194
- "type": "string",
195
- },
196
- "typeClasses": [
197
- {
198
- "kind": "render_hint",
199
- "name": "SELECTABLE",
200
- },
201
- {
202
- "kind": "render_hint",
203
- "name": "SORTABLE",
204
- },
205
- ],
206
- "valueType": undefined,
207
- },
208
- },
209
- },
210
- }
211
- `);
212
- });
213
- it("properly serializes both types of struct SPTs", () => {
214
- defineSharedPropertyType({
215
- apiName: "fooSpt",
216
- type: {
217
- type: "struct",
218
- structDefinition: {
219
- "simpleProperty": "boolean",
220
- "complexProperty": {
221
- fieldType: "date",
222
- displayMetadata: {
223
- displayName: "complex property",
224
- description: undefined
225
- }
226
- }
227
- }
228
- }
229
- });
230
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
231
- {
232
- "actionTypes": {},
233
- "blockPermissionInformation": {
234
- "actionTypes": {},
235
- "linkTypes": {},
236
- "objectTypes": {},
237
- },
238
- "interfaceTypes": {},
239
- "linkTypes": {},
240
- "objectTypes": {},
241
- "sharedPropertyTypes": {
242
- "com.palantir.fooSpt": {
243
- "sharedPropertyType": {
244
- "aliases": [],
245
- "apiName": "com.palantir.fooSpt",
246
- "baseFormatter": undefined,
247
- "dataConstraints": undefined,
248
- "displayMetadata": {
249
- "description": undefined,
250
- "displayName": "fooSpt",
251
- "visibility": "NORMAL",
252
- },
253
- "gothamMapping": undefined,
254
- "indexedForSearch": true,
255
- "type": {
256
- "struct": {
257
- "mainValue": undefined,
258
- "structFields": [
259
- {
260
- "aliases": [],
261
- "apiName": "simpleProperty",
262
- "displayMetadata": {
263
- "description": undefined,
264
- "displayName": "simpleProperty",
265
- },
266
- "fieldType": {
267
- "boolean": {},
268
- "type": "boolean",
269
- },
270
- "typeClasses": [],
271
- },
272
- {
273
- "aliases": [],
274
- "apiName": "complexProperty",
275
- "displayMetadata": {
276
- "description": undefined,
277
- "displayName": "complex property",
278
- },
279
- "fieldType": {
280
- "date": {},
281
- "type": "date",
282
- },
283
- "typeClasses": [],
284
- },
285
- ],
286
- },
287
- "type": "struct",
288
- },
289
- "typeClasses": [],
290
- "valueType": undefined,
291
- },
292
- },
293
- },
294
- }
295
- `);
296
- });
297
- it("Custom string fields properly set", () => {
298
- const spt = defineSharedPropertyType({
299
- apiName: "foo",
300
- type: {
301
- type: "string",
302
- isLongText: true,
303
- supportsEfficientLeadingWildcard: true,
304
- supportsExactMatching: false
305
- }
306
- });
307
- defineInterface({
308
- apiName: "interface",
309
- properties: {
310
- foo: spt
311
- }
312
- });
313
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
314
- {
315
- "actionTypes": {},
316
- "blockPermissionInformation": {
317
- "actionTypes": {},
318
- "linkTypes": {},
319
- "objectTypes": {},
320
- },
321
- "interfaceTypes": {
322
- "com.palantir.interface": {
323
- "interfaceType": {
324
- "apiName": "com.palantir.interface",
325
- "displayMetadata": {
326
- "description": "interface",
327
- "displayName": "interface",
328
- "icon": {
329
- "blueprint": {
330
- "color": "#4C90F0",
331
- "locator": "layout-hierarchy",
332
- },
333
- "type": "blueprint",
334
- },
335
- },
336
- "extendsInterfaces": [],
337
- "links": [],
338
- "properties": [],
339
- "propertiesV2": {
340
- "com.palantir.foo": {
341
- "required": true,
342
- "sharedPropertyType": {
343
- "aliases": [],
344
- "apiName": "com.palantir.foo",
345
- "baseFormatter": undefined,
346
- "dataConstraints": undefined,
347
- "displayMetadata": {
348
- "description": undefined,
349
- "displayName": "foo",
350
- "visibility": "NORMAL",
351
- },
352
- "gothamMapping": undefined,
353
- "indexedForSearch": true,
354
- "type": {
355
- "string": {
356
- "analyzerOverride": undefined,
357
- "enableAsciiFolding": undefined,
358
- "isLongText": true,
359
- "supportsEfficientLeadingWildcard": true,
360
- "supportsExactMatching": false,
361
- "supportsFullTextRegex": undefined,
362
- },
363
- "type": "string",
364
- },
365
- "typeClasses": [
366
- {
367
- "kind": "render_hint",
368
- "name": "SELECTABLE",
369
- },
370
- {
371
- "kind": "render_hint",
372
- "name": "SORTABLE",
373
- },
374
- ],
375
- "valueType": undefined,
376
- },
377
- },
378
- },
379
- "propertiesV3": {
380
- "com.palantir.foo": {
381
- "sharedPropertyBasedPropertyType": {
382
- "requireImplementation": true,
383
- "sharedPropertyType": {
384
- "aliases": [],
385
- "apiName": "com.palantir.foo",
386
- "baseFormatter": undefined,
387
- "dataConstraints": undefined,
388
- "displayMetadata": {
389
- "description": undefined,
390
- "displayName": "foo",
391
- "visibility": "NORMAL",
392
- },
393
- "gothamMapping": undefined,
394
- "indexedForSearch": true,
395
- "type": {
396
- "string": {
397
- "analyzerOverride": undefined,
398
- "enableAsciiFolding": undefined,
399
- "isLongText": true,
400
- "supportsEfficientLeadingWildcard": true,
401
- "supportsExactMatching": false,
402
- "supportsFullTextRegex": undefined,
403
- },
404
- "type": "string",
405
- },
406
- "typeClasses": [
407
- {
408
- "kind": "render_hint",
409
- "name": "SELECTABLE",
410
- },
411
- {
412
- "kind": "render_hint",
413
- "name": "SORTABLE",
414
- },
415
- ],
416
- "valueType": undefined,
417
- },
418
- },
419
- "type": "sharedPropertyBasedPropertyType",
420
- },
421
- },
422
- "searchable": true,
423
- "status": {
424
- "active": {},
425
- "type": "active",
426
- },
427
- },
428
- },
429
- },
430
- "linkTypes": {},
431
- "objectTypes": {},
432
- "sharedPropertyTypes": {
433
- "com.palantir.foo": {
434
- "sharedPropertyType": {
435
- "aliases": [],
436
- "apiName": "com.palantir.foo",
437
- "baseFormatter": undefined,
438
- "dataConstraints": undefined,
439
- "displayMetadata": {
440
- "description": undefined,
441
- "displayName": "foo",
442
- "visibility": "NORMAL",
443
- },
444
- "gothamMapping": undefined,
445
- "indexedForSearch": true,
446
- "type": {
447
- "string": {
448
- "analyzerOverride": undefined,
449
- "enableAsciiFolding": undefined,
450
- "isLongText": true,
451
- "supportsEfficientLeadingWildcard": true,
452
- "supportsExactMatching": false,
453
- "supportsFullTextRegex": undefined,
454
- },
455
- "type": "string",
456
- },
457
- "typeClasses": [
458
- {
459
- "kind": "render_hint",
460
- "name": "SELECTABLE",
461
- },
462
- {
463
- "kind": "render_hint",
464
- "name": "SORTABLE",
465
- },
466
- ],
467
- "valueType": undefined,
468
- },
469
- },
470
- },
471
- }
472
- `);
473
- });
474
- it("Custom decimal fields properly set", () => {
475
- defineSharedPropertyType({
476
- apiName: "precision",
477
- type: {
478
- type: "decimal",
479
- precision: 10
480
- }
481
- });
482
- defineSharedPropertyType({
483
- apiName: "scale",
484
- type: {
485
- type: "decimal",
486
- scale: 5
487
- }
488
- });
489
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
490
- {
491
- "actionTypes": {},
492
- "blockPermissionInformation": {
493
- "actionTypes": {},
494
- "linkTypes": {},
495
- "objectTypes": {},
496
- },
497
- "interfaceTypes": {},
498
- "linkTypes": {},
499
- "objectTypes": {},
500
- "sharedPropertyTypes": {
501
- "com.palantir.precision": {
502
- "sharedPropertyType": {
503
- "aliases": [],
504
- "apiName": "com.palantir.precision",
505
- "baseFormatter": undefined,
506
- "dataConstraints": undefined,
507
- "displayMetadata": {
508
- "description": undefined,
509
- "displayName": "precision",
510
- "visibility": "NORMAL",
511
- },
512
- "gothamMapping": undefined,
513
- "indexedForSearch": true,
514
- "type": {
515
- "decimal": {
516
- "precision": 10,
517
- "scale": undefined,
518
- },
519
- "type": "decimal",
520
- },
521
- "typeClasses": [
522
- {
523
- "kind": "render_hint",
524
- "name": "SELECTABLE",
525
- },
526
- {
527
- "kind": "render_hint",
528
- "name": "SORTABLE",
529
- },
530
- ],
531
- "valueType": undefined,
532
- },
533
- },
534
- "com.palantir.scale": {
535
- "sharedPropertyType": {
536
- "aliases": [],
537
- "apiName": "com.palantir.scale",
538
- "baseFormatter": undefined,
539
- "dataConstraints": undefined,
540
- "displayMetadata": {
541
- "description": undefined,
542
- "displayName": "scale",
543
- "visibility": "NORMAL",
544
- },
545
- "gothamMapping": undefined,
546
- "indexedForSearch": true,
547
- "type": {
548
- "decimal": {
549
- "precision": undefined,
550
- "scale": 5,
551
- },
552
- "type": "decimal",
553
- },
554
- "typeClasses": [
555
- {
556
- "kind": "render_hint",
557
- "name": "SELECTABLE",
558
- },
559
- {
560
- "kind": "render_hint",
561
- "name": "SORTABLE",
562
- },
563
- ],
564
- "valueType": undefined,
565
- },
566
- },
567
- },
568
- }
569
- `);
570
- });
571
- it("Object decimal property with precision/scale works in actions", () => {
572
- const obj = defineObject({
573
- apiName: "decimal-test",
574
- displayName: "Decimal Test",
575
- pluralDisplayName: "Decimal Tests",
576
- primaryKeyPropertyApiName: "id",
577
- titlePropertyApiName: "id",
578
- properties: {
579
- id: {
580
- type: "string"
581
- },
582
- price: {
583
- type: {
584
- type: "decimal",
585
- precision: 10,
586
- scale: 2
587
- }
588
- }
589
- }
590
- });
591
- const action = defineCreateObjectAction({
592
- objectType: obj
593
- });
594
- const priceParam = action.parameters?.find(p => p.id === "price");
595
- expect(priceParam?.type).toBe("decimal");
596
- });
597
- it("Number formatting works", () => {
598
- defineSharedPropertyType({
599
- apiName: "foo",
600
- type: "double",
601
- baseFormatter: {
602
- type: "number",
603
- number: {
604
- type: "base",
605
- base: {
606
- maximumFractionDigits: 1
607
- }
608
- }
609
- }
610
- });
611
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
612
- {
613
- "importedOntology": {
614
- "actionTypes": {},
615
- "blockPermissionInformation": {
616
- "actionTypes": {},
617
- "linkTypes": {},
618
- "objectTypes": {},
619
- },
620
- "interfaceTypes": {},
621
- "linkTypes": {},
622
- "objectTypes": {},
623
- "sharedPropertyTypes": {},
624
- },
625
- "importedValueTypes": {
626
- "valueTypes": [],
627
- },
628
- "ontology": {
629
- "actionTypes": {},
630
- "blockPermissionInformation": {
631
- "actionTypes": {},
632
- "linkTypes": {},
633
- "objectTypes": {},
634
- },
635
- "interfaceTypes": {},
636
- "linkTypes": {},
637
- "objectTypes": {},
638
- "sharedPropertyTypes": {
639
- "com.palantir.foo": {
640
- "sharedPropertyType": {
641
- "aliases": [],
642
- "apiName": "com.palantir.foo",
643
- "baseFormatter": {
644
- "number": {
645
- "base": {
646
- "maximumFractionDigits": 1,
647
- },
648
- "type": "base",
649
- },
650
- "type": "number",
651
- },
652
- "dataConstraints": undefined,
653
- "displayMetadata": {
654
- "description": undefined,
655
- "displayName": "foo",
656
- "visibility": "NORMAL",
657
- },
658
- "gothamMapping": undefined,
659
- "indexedForSearch": true,
660
- "type": {
661
- "double": {},
662
- "type": "double",
663
- },
664
- "typeClasses": [
665
- {
666
- "kind": "render_hint",
667
- "name": "SELECTABLE",
668
- },
669
- {
670
- "kind": "render_hint",
671
- "name": "SORTABLE",
672
- },
673
- ],
674
- "valueType": undefined,
675
- },
676
- },
677
- },
678
- },
679
- "randomnessKey": undefined,
680
- "valueTypes": {
681
- "valueTypes": [],
682
- },
683
- }
684
- `);
685
- });
686
- it("Aliases properly set", () => {
687
- defineSharedPropertyType({
688
- apiName: "foo",
689
- type: {
690
- type: "string"
691
- },
692
- aliases: ["alias1", "alias2"]
693
- });
694
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
695
- {
696
- "actionTypes": {},
697
- "blockPermissionInformation": {
698
- "actionTypes": {},
699
- "linkTypes": {},
700
- "objectTypes": {},
701
- },
702
- "interfaceTypes": {},
703
- "linkTypes": {},
704
- "objectTypes": {},
705
- "sharedPropertyTypes": {
706
- "com.palantir.foo": {
707
- "sharedPropertyType": {
708
- "aliases": [
709
- "alias1",
710
- "alias2",
711
- ],
712
- "apiName": "com.palantir.foo",
713
- "baseFormatter": undefined,
714
- "dataConstraints": undefined,
715
- "displayMetadata": {
716
- "description": undefined,
717
- "displayName": "foo",
718
- "visibility": "NORMAL",
719
- },
720
- "gothamMapping": undefined,
721
- "indexedForSearch": true,
722
- "type": {
723
- "string": {
724
- "analyzerOverride": undefined,
725
- "enableAsciiFolding": undefined,
726
- "isLongText": false,
727
- "supportsEfficientLeadingWildcard": false,
728
- "supportsExactMatching": true,
729
- "supportsFullTextRegex": undefined,
730
- },
731
- "type": "string",
732
- },
733
- "typeClasses": [
734
- {
735
- "kind": "render_hint",
736
- "name": "SELECTABLE",
737
- },
738
- {
739
- "kind": "render_hint",
740
- "name": "SORTABLE",
741
- },
742
- ],
743
- "valueType": undefined,
744
- },
745
- },
746
- },
747
- }
748
- `);
749
- });
750
- });
751
- //# sourceMappingURL=spt.test.js.map