@osdk/maker 0.16.0-beta.8 → 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 (117) hide show
  1. package/CHANGELOG.md +142 -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 -147
  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 -218
  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 -147
  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 -7
  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/cjs/defineFunction-7ORD7HD4.cjs +0 -72
  81. package/build/cjs/defineFunction-7ORD7HD4.cjs.map +0 -1
  82. package/build/esm/api/test/actions.test.js +0 -14402
  83. package/build/esm/api/test/actions.test.js.map +0 -1
  84. package/build/esm/api/test/interfaces.test.js +0 -1189
  85. package/build/esm/api/test/interfaces.test.js.map +0 -1
  86. package/build/esm/api/test/links.test.js +0 -2019
  87. package/build/esm/api/test/links.test.js.map +0 -1
  88. package/build/esm/api/test/markingconstraint.test.js +0 -134
  89. package/build/esm/api/test/markingconstraint.test.js.map +0 -1
  90. package/build/esm/api/test/misc.test.js +0 -1315
  91. package/build/esm/api/test/misc.test.js.map +0 -1
  92. package/build/esm/api/test/objectStatus.test.js +0 -252
  93. package/build/esm/api/test/objectStatus.test.js.map +0 -1
  94. package/build/esm/api/test/objects.test.js +0 -4441
  95. package/build/esm/api/test/objects.test.js.map +0 -1
  96. package/build/esm/api/test/spt.test.js +0 -751
  97. package/build/esm/api/test/spt.test.js.map +0 -1
  98. package/build/esm/api/test/valueTypes.test.js +0 -307
  99. package/build/esm/api/test/valueTypes.test.js.map +0 -1
  100. package/build/types/api/test/actions.test.d.ts +0 -1
  101. package/build/types/api/test/actions.test.d.ts.map +0 -1
  102. package/build/types/api/test/interfaces.test.d.ts +0 -1
  103. package/build/types/api/test/interfaces.test.d.ts.map +0 -1
  104. package/build/types/api/test/links.test.d.ts +0 -1
  105. package/build/types/api/test/links.test.d.ts.map +0 -1
  106. package/build/types/api/test/markingconstraint.test.d.ts +0 -1
  107. package/build/types/api/test/markingconstraint.test.d.ts.map +0 -1
  108. package/build/types/api/test/misc.test.d.ts +0 -1
  109. package/build/types/api/test/misc.test.d.ts.map +0 -1
  110. package/build/types/api/test/objectStatus.test.d.ts +0 -1
  111. package/build/types/api/test/objectStatus.test.d.ts.map +0 -1
  112. package/build/types/api/test/objects.test.d.ts +0 -1
  113. package/build/types/api/test/objects.test.d.ts.map +0 -1
  114. package/build/types/api/test/spt.test.d.ts +0 -1
  115. package/build/types/api/test/spt.test.d.ts.map +0 -1
  116. package/build/types/api/test/valueTypes.test.d.ts +0 -1
  117. package/build/types/api/test/valueTypes.test.d.ts.map +0 -1
@@ -1,1189 +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 { defineInterface } from "../defineInterface.js";
19
- import { defineOntology, dumpOntologyFullMetadata } from "../defineOntology.js";
20
- import { defineSharedPropertyType } from "../defineSpt.js";
21
- describe("Interfaces", () => {
22
- beforeEach(async () => {
23
- await defineOntology("com.palantir.", () => {}, "/tmp/");
24
- });
25
- it("doesn't let you define the same interface twice", () => {
26
- defineInterface({
27
- apiName: "Foo"
28
- });
29
- expect(() => {
30
- defineInterface({
31
- apiName: "Foo"
32
- });
33
- }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Interface com.palantir.Foo already exists]`);
34
- });
35
- it("defaults displayName to apiName", () => {
36
- const result = defineInterface({
37
- apiName: "Foo"
38
- });
39
- expect(result.displayMetadata.displayName).toBe("Foo");
40
- });
41
- it("defaults description to displayName", () => {
42
- const result = defineInterface({
43
- apiName: "Foo",
44
- displayName: "d"
45
- });
46
- expect(result.displayMetadata.description).toBe("d");
47
- });
48
- it("defaults description to displayName to apiName", () => {
49
- const result = defineInterface({
50
- apiName: "Foo"
51
- });
52
- expect(result.displayMetadata.description).toBe("Foo");
53
- });
54
- describe("Auto IDPs", () => {
55
- it("Auto creates IDPs", () => {
56
- defineInterface({
57
- apiName: "Foo",
58
- properties: {
59
- foo: {
60
- type: "string"
61
- }
62
- }
63
- });
64
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
65
- {
66
- "actionTypes": {},
67
- "blockPermissionInformation": {
68
- "actionTypes": {},
69
- "linkTypes": {},
70
- "objectTypes": {},
71
- },
72
- "interfaceTypes": {
73
- "com.palantir.Foo": {
74
- "interfaceType": {
75
- "apiName": "com.palantir.Foo",
76
- "displayMetadata": {
77
- "description": "Foo",
78
- "displayName": "Foo",
79
- "icon": {
80
- "blueprint": {
81
- "color": "#4C90F0",
82
- "locator": "layout-hierarchy",
83
- },
84
- "type": "blueprint",
85
- },
86
- },
87
- "extendsInterfaces": [],
88
- "links": [],
89
- "properties": [],
90
- "propertiesV2": {},
91
- "propertiesV3": {
92
- "foo": {
93
- "interfaceDefinedPropertyType": {
94
- "apiName": "foo",
95
- "constraints": {
96
- "dataConstraints": undefined,
97
- "indexedForSearch": true,
98
- "primaryKeyConstraint": "NO_RESTRICTION",
99
- "requireImplementation": true,
100
- "typeClasses": [],
101
- "valueType": undefined,
102
- },
103
- "displayMetadata": {
104
- "description": undefined,
105
- "displayName": "foo",
106
- "visibility": "NORMAL",
107
- },
108
- "type": {
109
- "string": {
110
- "analyzerOverride": undefined,
111
- "enableAsciiFolding": undefined,
112
- "isLongText": false,
113
- "supportsEfficientLeadingWildcard": false,
114
- "supportsExactMatching": true,
115
- },
116
- "type": "string",
117
- },
118
- },
119
- "type": "interfaceDefinedPropertyType",
120
- },
121
- },
122
- "searchable": true,
123
- "status": {
124
- "active": {},
125
- "type": "active",
126
- },
127
- },
128
- },
129
- },
130
- "linkTypes": {},
131
- "objectTypes": {},
132
- "sharedPropertyTypes": {},
133
- }
134
- `);
135
- });
136
- });
137
- describe("Interface properties", () => {
138
- it("IDPs and SPTs on the same interface", () => {
139
- const spt = defineSharedPropertyType({
140
- apiName: "spt",
141
- type: "string"
142
- });
143
- defineInterface({
144
- apiName: "bar",
145
- displayName: "Bar",
146
- properties: {
147
- "foo": {
148
- type: "boolean"
149
- },
150
- "spt": spt
151
- }
152
- });
153
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
154
- {
155
- "actionTypes": {},
156
- "blockPermissionInformation": {
157
- "actionTypes": {},
158
- "linkTypes": {},
159
- "objectTypes": {},
160
- },
161
- "interfaceTypes": {
162
- "com.palantir.bar": {
163
- "interfaceType": {
164
- "apiName": "com.palantir.bar",
165
- "displayMetadata": {
166
- "description": "Bar",
167
- "displayName": "Bar",
168
- "icon": {
169
- "blueprint": {
170
- "color": "#4C90F0",
171
- "locator": "layout-hierarchy",
172
- },
173
- "type": "blueprint",
174
- },
175
- },
176
- "extendsInterfaces": [],
177
- "links": [],
178
- "properties": [],
179
- "propertiesV2": {
180
- "com.palantir.spt": {
181
- "required": true,
182
- "sharedPropertyType": {
183
- "aliases": [],
184
- "apiName": "com.palantir.spt",
185
- "baseFormatter": undefined,
186
- "dataConstraints": undefined,
187
- "displayMetadata": {
188
- "description": undefined,
189
- "displayName": "spt",
190
- "visibility": "NORMAL",
191
- },
192
- "gothamMapping": undefined,
193
- "indexedForSearch": true,
194
- "type": {
195
- "string": {
196
- "analyzerOverride": undefined,
197
- "enableAsciiFolding": undefined,
198
- "isLongText": false,
199
- "supportsEfficientLeadingWildcard": false,
200
- "supportsExactMatching": true,
201
- },
202
- "type": "string",
203
- },
204
- "typeClasses": [
205
- {
206
- "kind": "render_hint",
207
- "name": "SELECTABLE",
208
- },
209
- {
210
- "kind": "render_hint",
211
- "name": "SORTABLE",
212
- },
213
- ],
214
- "valueType": undefined,
215
- },
216
- },
217
- },
218
- "propertiesV3": {
219
- "com.palantir.spt": {
220
- "sharedPropertyBasedPropertyType": {
221
- "requireImplementation": true,
222
- "sharedPropertyType": {
223
- "aliases": [],
224
- "apiName": "com.palantir.spt",
225
- "baseFormatter": undefined,
226
- "dataConstraints": undefined,
227
- "displayMetadata": {
228
- "description": undefined,
229
- "displayName": "spt",
230
- "visibility": "NORMAL",
231
- },
232
- "gothamMapping": undefined,
233
- "indexedForSearch": true,
234
- "type": {
235
- "string": {
236
- "analyzerOverride": undefined,
237
- "enableAsciiFolding": undefined,
238
- "isLongText": false,
239
- "supportsEfficientLeadingWildcard": false,
240
- "supportsExactMatching": true,
241
- },
242
- "type": "string",
243
- },
244
- "typeClasses": [
245
- {
246
- "kind": "render_hint",
247
- "name": "SELECTABLE",
248
- },
249
- {
250
- "kind": "render_hint",
251
- "name": "SORTABLE",
252
- },
253
- ],
254
- "valueType": undefined,
255
- },
256
- },
257
- "type": "sharedPropertyBasedPropertyType",
258
- },
259
- "foo": {
260
- "interfaceDefinedPropertyType": {
261
- "apiName": "foo",
262
- "constraints": {
263
- "dataConstraints": undefined,
264
- "indexedForSearch": true,
265
- "primaryKeyConstraint": "NO_RESTRICTION",
266
- "requireImplementation": true,
267
- "typeClasses": [],
268
- "valueType": undefined,
269
- },
270
- "displayMetadata": {
271
- "description": undefined,
272
- "displayName": "foo",
273
- "visibility": "NORMAL",
274
- },
275
- "type": {
276
- "boolean": {},
277
- "type": "boolean",
278
- },
279
- },
280
- "type": "interfaceDefinedPropertyType",
281
- },
282
- },
283
- "searchable": true,
284
- "status": {
285
- "active": {},
286
- "type": "active",
287
- },
288
- },
289
- },
290
- },
291
- "linkTypes": {},
292
- "objectTypes": {},
293
- "sharedPropertyTypes": {
294
- "com.palantir.spt": {
295
- "sharedPropertyType": {
296
- "aliases": [],
297
- "apiName": "com.palantir.spt",
298
- "baseFormatter": undefined,
299
- "dataConstraints": undefined,
300
- "displayMetadata": {
301
- "description": undefined,
302
- "displayName": "spt",
303
- "visibility": "NORMAL",
304
- },
305
- "gothamMapping": undefined,
306
- "indexedForSearch": true,
307
- "type": {
308
- "string": {
309
- "analyzerOverride": undefined,
310
- "enableAsciiFolding": undefined,
311
- "isLongText": false,
312
- "supportsEfficientLeadingWildcard": false,
313
- "supportsExactMatching": true,
314
- },
315
- "type": "string",
316
- },
317
- "typeClasses": [
318
- {
319
- "kind": "render_hint",
320
- "name": "SELECTABLE",
321
- },
322
- {
323
- "kind": "render_hint",
324
- "name": "SORTABLE",
325
- },
326
- ],
327
- "valueType": undefined,
328
- },
329
- },
330
- },
331
- }
332
- `);
333
- });
334
- it("supports optional properties", () => {
335
- const spt = defineSharedPropertyType({
336
- apiName: "spt",
337
- type: "string"
338
- });
339
- defineInterface({
340
- apiName: "parentInterface",
341
- properties: {
342
- spt: {
343
- required: false,
344
- sharedPropertyType: spt
345
- },
346
- idp: {
347
- required: false,
348
- type: "string"
349
- }
350
- }
351
- });
352
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
353
- {
354
- "actionTypes": {},
355
- "blockPermissionInformation": {
356
- "actionTypes": {},
357
- "linkTypes": {},
358
- "objectTypes": {},
359
- },
360
- "interfaceTypes": {
361
- "com.palantir.parentInterface": {
362
- "interfaceType": {
363
- "apiName": "com.palantir.parentInterface",
364
- "displayMetadata": {
365
- "description": "parentInterface",
366
- "displayName": "parentInterface",
367
- "icon": {
368
- "blueprint": {
369
- "color": "#4C90F0",
370
- "locator": "layout-hierarchy",
371
- },
372
- "type": "blueprint",
373
- },
374
- },
375
- "extendsInterfaces": [],
376
- "links": [],
377
- "properties": [],
378
- "propertiesV2": {
379
- "com.palantir.spt": {
380
- "required": false,
381
- "sharedPropertyType": {
382
- "aliases": [],
383
- "apiName": "com.palantir.spt",
384
- "baseFormatter": undefined,
385
- "dataConstraints": undefined,
386
- "displayMetadata": {
387
- "description": undefined,
388
- "displayName": "spt",
389
- "visibility": "NORMAL",
390
- },
391
- "gothamMapping": undefined,
392
- "indexedForSearch": true,
393
- "type": {
394
- "string": {
395
- "analyzerOverride": undefined,
396
- "enableAsciiFolding": undefined,
397
- "isLongText": false,
398
- "supportsEfficientLeadingWildcard": false,
399
- "supportsExactMatching": true,
400
- },
401
- "type": "string",
402
- },
403
- "typeClasses": [
404
- {
405
- "kind": "render_hint",
406
- "name": "SELECTABLE",
407
- },
408
- {
409
- "kind": "render_hint",
410
- "name": "SORTABLE",
411
- },
412
- ],
413
- "valueType": undefined,
414
- },
415
- },
416
- },
417
- "propertiesV3": {
418
- "com.palantir.spt": {
419
- "sharedPropertyBasedPropertyType": {
420
- "requireImplementation": false,
421
- "sharedPropertyType": {
422
- "aliases": [],
423
- "apiName": "com.palantir.spt",
424
- "baseFormatter": undefined,
425
- "dataConstraints": undefined,
426
- "displayMetadata": {
427
- "description": undefined,
428
- "displayName": "spt",
429
- "visibility": "NORMAL",
430
- },
431
- "gothamMapping": undefined,
432
- "indexedForSearch": true,
433
- "type": {
434
- "string": {
435
- "analyzerOverride": undefined,
436
- "enableAsciiFolding": undefined,
437
- "isLongText": false,
438
- "supportsEfficientLeadingWildcard": false,
439
- "supportsExactMatching": true,
440
- },
441
- "type": "string",
442
- },
443
- "typeClasses": [
444
- {
445
- "kind": "render_hint",
446
- "name": "SELECTABLE",
447
- },
448
- {
449
- "kind": "render_hint",
450
- "name": "SORTABLE",
451
- },
452
- ],
453
- "valueType": undefined,
454
- },
455
- },
456
- "type": "sharedPropertyBasedPropertyType",
457
- },
458
- "idp": {
459
- "interfaceDefinedPropertyType": {
460
- "apiName": "idp",
461
- "constraints": {
462
- "dataConstraints": undefined,
463
- "indexedForSearch": true,
464
- "primaryKeyConstraint": "NO_RESTRICTION",
465
- "requireImplementation": false,
466
- "typeClasses": [],
467
- "valueType": undefined,
468
- },
469
- "displayMetadata": {
470
- "description": undefined,
471
- "displayName": "idp",
472
- "visibility": "NORMAL",
473
- },
474
- "type": {
475
- "string": {
476
- "analyzerOverride": undefined,
477
- "enableAsciiFolding": undefined,
478
- "isLongText": false,
479
- "supportsEfficientLeadingWildcard": false,
480
- "supportsExactMatching": true,
481
- },
482
- "type": "string",
483
- },
484
- },
485
- "type": "interfaceDefinedPropertyType",
486
- },
487
- },
488
- "searchable": true,
489
- "status": {
490
- "active": {},
491
- "type": "active",
492
- },
493
- },
494
- },
495
- },
496
- "linkTypes": {},
497
- "objectTypes": {},
498
- "sharedPropertyTypes": {
499
- "com.palantir.spt": {
500
- "sharedPropertyType": {
501
- "aliases": [],
502
- "apiName": "com.palantir.spt",
503
- "baseFormatter": undefined,
504
- "dataConstraints": undefined,
505
- "displayMetadata": {
506
- "description": undefined,
507
- "displayName": "spt",
508
- "visibility": "NORMAL",
509
- },
510
- "gothamMapping": undefined,
511
- "indexedForSearch": true,
512
- "type": {
513
- "string": {
514
- "analyzerOverride": undefined,
515
- "enableAsciiFolding": undefined,
516
- "isLongText": false,
517
- "supportsEfficientLeadingWildcard": false,
518
- "supportsExactMatching": true,
519
- },
520
- "type": "string",
521
- },
522
- "typeClasses": [
523
- {
524
- "kind": "render_hint",
525
- "name": "SELECTABLE",
526
- },
527
- {
528
- "kind": "render_hint",
529
- "name": "SORTABLE",
530
- },
531
- ],
532
- "valueType": undefined,
533
- },
534
- },
535
- },
536
- }
537
- `);
538
- });
539
- it("Struct IDPs", () => {
540
- defineInterface({
541
- apiName: "bar",
542
- displayName: "Bar",
543
- properties: {
544
- "struct": {
545
- type: {
546
- type: "struct",
547
- structDefinition: {
548
- field: {
549
- fieldType: "string",
550
- requireImplementation: true,
551
- displayMetadata: {
552
- displayName: "Field"
553
- }
554
- },
555
- optional: "string"
556
- }
557
- }
558
- }
559
- }
560
- });
561
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
562
- {
563
- "actionTypes": {},
564
- "blockPermissionInformation": {
565
- "actionTypes": {},
566
- "linkTypes": {},
567
- "objectTypes": {},
568
- },
569
- "interfaceTypes": {
570
- "com.palantir.bar": {
571
- "interfaceType": {
572
- "apiName": "com.palantir.bar",
573
- "displayMetadata": {
574
- "description": "Bar",
575
- "displayName": "Bar",
576
- "icon": {
577
- "blueprint": {
578
- "color": "#4C90F0",
579
- "locator": "layout-hierarchy",
580
- },
581
- "type": "blueprint",
582
- },
583
- },
584
- "extendsInterfaces": [],
585
- "links": [],
586
- "properties": [],
587
- "propertiesV2": {},
588
- "propertiesV3": {
589
- "struct": {
590
- "interfaceDefinedPropertyType": {
591
- "apiName": "struct",
592
- "constraints": {
593
- "dataConstraints": undefined,
594
- "indexedForSearch": true,
595
- "primaryKeyConstraint": "NO_RESTRICTION",
596
- "requireImplementation": true,
597
- "typeClasses": [],
598
- "valueType": undefined,
599
- },
600
- "displayMetadata": {
601
- "description": undefined,
602
- "displayName": "struct",
603
- "visibility": "NORMAL",
604
- },
605
- "type": {
606
- "struct": {
607
- "structFields": [
608
- {
609
- "aliases": [],
610
- "apiName": "field",
611
- "displayMetadata": {
612
- "displayName": "Field",
613
- },
614
- "fieldType": {
615
- "string": {
616
- "analyzerOverride": undefined,
617
- "enableAsciiFolding": undefined,
618
- "isLongText": false,
619
- "supportsEfficientLeadingWildcard": false,
620
- "supportsExactMatching": true,
621
- },
622
- "type": "string",
623
- },
624
- "requireImplementation": true,
625
- "typeClasses": [],
626
- },
627
- {
628
- "aliases": [],
629
- "apiName": "optional",
630
- "displayMetadata": {
631
- "description": undefined,
632
- "displayName": "optional",
633
- },
634
- "fieldType": {
635
- "string": {
636
- "analyzerOverride": undefined,
637
- "enableAsciiFolding": undefined,
638
- "isLongText": false,
639
- "supportsEfficientLeadingWildcard": false,
640
- "supportsExactMatching": true,
641
- },
642
- "type": "string",
643
- },
644
- "requireImplementation": true,
645
- "typeClasses": [],
646
- },
647
- ],
648
- },
649
- "type": "struct",
650
- },
651
- },
652
- "type": "interfaceDefinedPropertyType",
653
- },
654
- },
655
- "searchable": true,
656
- "status": {
657
- "active": {},
658
- "type": "active",
659
- },
660
- },
661
- },
662
- },
663
- "linkTypes": {},
664
- "objectTypes": {},
665
- "sharedPropertyTypes": {},
666
- }
667
- `);
668
- });
669
- it("Complex interface properties", () => {
670
- const spt = defineSharedPropertyType({
671
- apiName: "spt",
672
- type: "string",
673
- array: true,
674
- description: "Description",
675
- displayName: "Display Name",
676
- visibility: "HIDDEN",
677
- nullability: {
678
- noEmptyCollections: true,
679
- noNulls: true
680
- }
681
- });
682
- defineInterface({
683
- apiName: "parentInterface",
684
- properties: {
685
- spt: {
686
- required: false,
687
- sharedPropertyType: spt
688
- },
689
- idp: {
690
- required: false,
691
- type: "string",
692
- primaryKeyConstraint: "MUST_BE_PK",
693
- array: true,
694
- description: "Description",
695
- displayName: "Display Name",
696
- visibility: "HIDDEN",
697
- nullability: {
698
- noEmptyCollections: true,
699
- noNulls: true
700
- }
701
- }
702
- }
703
- });
704
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
705
- {
706
- "actionTypes": {},
707
- "blockPermissionInformation": {
708
- "actionTypes": {},
709
- "linkTypes": {},
710
- "objectTypes": {},
711
- },
712
- "interfaceTypes": {
713
- "com.palantir.parentInterface": {
714
- "interfaceType": {
715
- "apiName": "com.palantir.parentInterface",
716
- "displayMetadata": {
717
- "description": "parentInterface",
718
- "displayName": "parentInterface",
719
- "icon": {
720
- "blueprint": {
721
- "color": "#4C90F0",
722
- "locator": "layout-hierarchy",
723
- },
724
- "type": "blueprint",
725
- },
726
- },
727
- "extendsInterfaces": [],
728
- "links": [],
729
- "properties": [],
730
- "propertiesV2": {
731
- "com.palantir.spt": {
732
- "required": false,
733
- "sharedPropertyType": {
734
- "aliases": [],
735
- "apiName": "com.palantir.spt",
736
- "baseFormatter": undefined,
737
- "dataConstraints": {
738
- "nullability": undefined,
739
- "nullabilityV2": {
740
- "noEmptyCollections": true,
741
- "noNulls": true,
742
- },
743
- "propertyTypeConstraints": [],
744
- },
745
- "displayMetadata": {
746
- "description": "Description",
747
- "displayName": "Display Name",
748
- "visibility": "HIDDEN",
749
- },
750
- "gothamMapping": undefined,
751
- "indexedForSearch": true,
752
- "type": {
753
- "array": {
754
- "reducers": [],
755
- "subtype": {
756
- "string": {
757
- "analyzerOverride": undefined,
758
- "enableAsciiFolding": undefined,
759
- "isLongText": false,
760
- "supportsEfficientLeadingWildcard": false,
761
- "supportsExactMatching": true,
762
- },
763
- "type": "string",
764
- },
765
- },
766
- "type": "array",
767
- },
768
- "typeClasses": [
769
- {
770
- "kind": "render_hint",
771
- "name": "SELECTABLE",
772
- },
773
- {
774
- "kind": "render_hint",
775
- "name": "SORTABLE",
776
- },
777
- ],
778
- "valueType": undefined,
779
- },
780
- },
781
- },
782
- "propertiesV3": {
783
- "com.palantir.spt": {
784
- "sharedPropertyBasedPropertyType": {
785
- "requireImplementation": false,
786
- "sharedPropertyType": {
787
- "aliases": [],
788
- "apiName": "com.palantir.spt",
789
- "baseFormatter": undefined,
790
- "dataConstraints": {
791
- "nullability": undefined,
792
- "nullabilityV2": {
793
- "noEmptyCollections": true,
794
- "noNulls": true,
795
- },
796
- "propertyTypeConstraints": [],
797
- },
798
- "displayMetadata": {
799
- "description": "Description",
800
- "displayName": "Display Name",
801
- "visibility": "HIDDEN",
802
- },
803
- "gothamMapping": undefined,
804
- "indexedForSearch": true,
805
- "type": {
806
- "array": {
807
- "reducers": [],
808
- "subtype": {
809
- "string": {
810
- "analyzerOverride": undefined,
811
- "enableAsciiFolding": undefined,
812
- "isLongText": false,
813
- "supportsEfficientLeadingWildcard": false,
814
- "supportsExactMatching": true,
815
- },
816
- "type": "string",
817
- },
818
- },
819
- "type": "array",
820
- },
821
- "typeClasses": [
822
- {
823
- "kind": "render_hint",
824
- "name": "SELECTABLE",
825
- },
826
- {
827
- "kind": "render_hint",
828
- "name": "SORTABLE",
829
- },
830
- ],
831
- "valueType": undefined,
832
- },
833
- },
834
- "type": "sharedPropertyBasedPropertyType",
835
- },
836
- "idp": {
837
- "interfaceDefinedPropertyType": {
838
- "apiName": "idp",
839
- "constraints": {
840
- "dataConstraints": {
841
- "nullability": undefined,
842
- "nullabilityV2": {
843
- "noEmptyCollections": true,
844
- "noNulls": true,
845
- },
846
- "propertyTypeConstraints": [],
847
- },
848
- "indexedForSearch": true,
849
- "primaryKeyConstraint": "MUST_BE_PK",
850
- "requireImplementation": false,
851
- "typeClasses": [],
852
- "valueType": undefined,
853
- },
854
- "displayMetadata": {
855
- "description": "Description",
856
- "displayName": "Display Name",
857
- "visibility": "HIDDEN",
858
- },
859
- "type": {
860
- "array": {
861
- "subtype": {
862
- "string": {
863
- "analyzerOverride": undefined,
864
- "enableAsciiFolding": undefined,
865
- "isLongText": false,
866
- "supportsEfficientLeadingWildcard": false,
867
- "supportsExactMatching": true,
868
- },
869
- "type": "string",
870
- },
871
- },
872
- "type": "array",
873
- },
874
- },
875
- "type": "interfaceDefinedPropertyType",
876
- },
877
- },
878
- "searchable": true,
879
- "status": {
880
- "active": {},
881
- "type": "active",
882
- },
883
- },
884
- },
885
- },
886
- "linkTypes": {},
887
- "objectTypes": {},
888
- "sharedPropertyTypes": {
889
- "com.palantir.spt": {
890
- "sharedPropertyType": {
891
- "aliases": [],
892
- "apiName": "com.palantir.spt",
893
- "baseFormatter": undefined,
894
- "dataConstraints": {
895
- "nullability": undefined,
896
- "nullabilityV2": {
897
- "noEmptyCollections": true,
898
- "noNulls": true,
899
- },
900
- "propertyTypeConstraints": [],
901
- },
902
- "displayMetadata": {
903
- "description": "Description",
904
- "displayName": "Display Name",
905
- "visibility": "HIDDEN",
906
- },
907
- "gothamMapping": undefined,
908
- "indexedForSearch": true,
909
- "type": {
910
- "array": {
911
- "reducers": [],
912
- "subtype": {
913
- "string": {
914
- "analyzerOverride": undefined,
915
- "enableAsciiFolding": undefined,
916
- "isLongText": false,
917
- "supportsEfficientLeadingWildcard": false,
918
- "supportsExactMatching": true,
919
- },
920
- "type": "string",
921
- },
922
- },
923
- "type": "array",
924
- },
925
- "typeClasses": [
926
- {
927
- "kind": "render_hint",
928
- "name": "SELECTABLE",
929
- },
930
- {
931
- "kind": "render_hint",
932
- "name": "SORTABLE",
933
- },
934
- ],
935
- "valueType": undefined,
936
- },
937
- },
938
- },
939
- }
940
- `);
941
- });
942
- });
943
- it("allows extends interfaces with apiName provided", () => {
944
- const parentInterface = defineInterface({
945
- apiName: "parentInterface",
946
- properties: {
947
- property1: {
948
- type: "string"
949
- }
950
- }
951
- });
952
- defineInterface({
953
- apiName: "childInterface",
954
- properties: {
955
- property2: {
956
- type: "string"
957
- }
958
- },
959
- extends: parentInterface
960
- });
961
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
962
- {
963
- "actionTypes": {},
964
- "blockPermissionInformation": {
965
- "actionTypes": {},
966
- "linkTypes": {},
967
- "objectTypes": {},
968
- },
969
- "interfaceTypes": {
970
- "com.palantir.childInterface": {
971
- "interfaceType": {
972
- "apiName": "com.palantir.childInterface",
973
- "displayMetadata": {
974
- "description": "childInterface",
975
- "displayName": "childInterface",
976
- "icon": {
977
- "blueprint": {
978
- "color": "#4C90F0",
979
- "locator": "layout-hierarchy",
980
- },
981
- "type": "blueprint",
982
- },
983
- },
984
- "extendsInterfaces": [
985
- "com.palantir.parentInterface",
986
- ],
987
- "links": [],
988
- "properties": [],
989
- "propertiesV2": {},
990
- "propertiesV3": {
991
- "property2": {
992
- "interfaceDefinedPropertyType": {
993
- "apiName": "property2",
994
- "constraints": {
995
- "dataConstraints": undefined,
996
- "indexedForSearch": true,
997
- "primaryKeyConstraint": "NO_RESTRICTION",
998
- "requireImplementation": true,
999
- "typeClasses": [],
1000
- "valueType": undefined,
1001
- },
1002
- "displayMetadata": {
1003
- "description": undefined,
1004
- "displayName": "property2",
1005
- "visibility": "NORMAL",
1006
- },
1007
- "type": {
1008
- "string": {
1009
- "analyzerOverride": undefined,
1010
- "enableAsciiFolding": undefined,
1011
- "isLongText": false,
1012
- "supportsEfficientLeadingWildcard": false,
1013
- "supportsExactMatching": true,
1014
- },
1015
- "type": "string",
1016
- },
1017
- },
1018
- "type": "interfaceDefinedPropertyType",
1019
- },
1020
- },
1021
- "searchable": true,
1022
- "status": {
1023
- "active": {},
1024
- "type": "active",
1025
- },
1026
- },
1027
- },
1028
- "com.palantir.parentInterface": {
1029
- "interfaceType": {
1030
- "apiName": "com.palantir.parentInterface",
1031
- "displayMetadata": {
1032
- "description": "parentInterface",
1033
- "displayName": "parentInterface",
1034
- "icon": {
1035
- "blueprint": {
1036
- "color": "#4C90F0",
1037
- "locator": "layout-hierarchy",
1038
- },
1039
- "type": "blueprint",
1040
- },
1041
- },
1042
- "extendsInterfaces": [],
1043
- "links": [],
1044
- "properties": [],
1045
- "propertiesV2": {},
1046
- "propertiesV3": {
1047
- "property1": {
1048
- "interfaceDefinedPropertyType": {
1049
- "apiName": "property1",
1050
- "constraints": {
1051
- "dataConstraints": undefined,
1052
- "indexedForSearch": true,
1053
- "primaryKeyConstraint": "NO_RESTRICTION",
1054
- "requireImplementation": true,
1055
- "typeClasses": [],
1056
- "valueType": undefined,
1057
- },
1058
- "displayMetadata": {
1059
- "description": undefined,
1060
- "displayName": "property1",
1061
- "visibility": "NORMAL",
1062
- },
1063
- "type": {
1064
- "string": {
1065
- "analyzerOverride": undefined,
1066
- "enableAsciiFolding": undefined,
1067
- "isLongText": false,
1068
- "supportsEfficientLeadingWildcard": false,
1069
- "supportsExactMatching": true,
1070
- },
1071
- "type": "string",
1072
- },
1073
- },
1074
- "type": "interfaceDefinedPropertyType",
1075
- },
1076
- },
1077
- "searchable": true,
1078
- "status": {
1079
- "active": {},
1080
- "type": "active",
1081
- },
1082
- },
1083
- },
1084
- },
1085
- "linkTypes": {},
1086
- "objectTypes": {},
1087
- "sharedPropertyTypes": {},
1088
- }
1089
- `);
1090
- });
1091
- it("supports specifying searchable", () => {
1092
- defineInterface({
1093
- apiName: "parentInterface",
1094
- searchable: false
1095
- });
1096
- expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1097
- {
1098
- "actionTypes": {},
1099
- "blockPermissionInformation": {
1100
- "actionTypes": {},
1101
- "linkTypes": {},
1102
- "objectTypes": {},
1103
- },
1104
- "interfaceTypes": {
1105
- "com.palantir.parentInterface": {
1106
- "interfaceType": {
1107
- "apiName": "com.palantir.parentInterface",
1108
- "displayMetadata": {
1109
- "description": "parentInterface",
1110
- "displayName": "parentInterface",
1111
- "icon": {
1112
- "blueprint": {
1113
- "color": "#4C90F0",
1114
- "locator": "layout-hierarchy",
1115
- },
1116
- "type": "blueprint",
1117
- },
1118
- },
1119
- "extendsInterfaces": [],
1120
- "links": [],
1121
- "properties": [],
1122
- "propertiesV2": {},
1123
- "propertiesV3": {},
1124
- "searchable": false,
1125
- "status": {
1126
- "active": {},
1127
- "type": "active",
1128
- },
1129
- },
1130
- },
1131
- },
1132
- "linkTypes": {},
1133
- "objectTypes": {},
1134
- "sharedPropertyTypes": {},
1135
- }
1136
- `);
1137
- });
1138
- it("defaults interface status to active", () => {
1139
- const result = defineInterface({
1140
- apiName: "Foo"
1141
- });
1142
- expect(result.status).toEqual({
1143
- type: "active",
1144
- active: {}
1145
- });
1146
- });
1147
- it("sets interface status as experimental from opts", () => {
1148
- const result = defineInterface({
1149
- apiName: "Foo",
1150
- status: {
1151
- type: "experimental"
1152
- }
1153
- });
1154
- expect(result.status).toEqual({
1155
- type: "experimental",
1156
- experimental: {}
1157
- });
1158
- });
1159
- it("sets interface status as deprecated from opts", () => {
1160
- const result = defineInterface({
1161
- apiName: "Foo",
1162
- status: {
1163
- type: "deprecated",
1164
- message: "foo",
1165
- deadline: "foo"
1166
- }
1167
- });
1168
- expect(result.status).toEqual({
1169
- type: "deprecated",
1170
- deprecated: {
1171
- message: "foo",
1172
- deadline: "foo"
1173
- }
1174
- });
1175
- });
1176
- it("sets interface status as example from opts", () => {
1177
- const result = defineInterface({
1178
- apiName: "Foo",
1179
- status: {
1180
- type: "example"
1181
- }
1182
- });
1183
- expect(result.status).toEqual({
1184
- type: "example",
1185
- example: {}
1186
- });
1187
- });
1188
- });
1189
- //# sourceMappingURL=interfaces.test.js.map