@osdk/maker 0.14.0-beta.2 → 0.14.0-beta.4

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 (120) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/browser/api/defineAction.js +121 -413
  3. package/build/browser/api/defineAction.js.map +1 -1
  4. package/build/browser/api/defineCreateInterfaceObjectAction.js +69 -0
  5. package/build/browser/api/defineCreateInterfaceObjectAction.js.map +1 -0
  6. package/build/browser/api/defineCreateObjectAction.js +76 -0
  7. package/build/browser/api/defineCreateObjectAction.js.map +1 -0
  8. package/build/browser/api/defineCreateOrModifyObjectAction.js +92 -0
  9. package/build/browser/api/defineCreateOrModifyObjectAction.js.map +1 -0
  10. package/build/browser/api/defineDeleteObjectAction.js +56 -0
  11. package/build/browser/api/defineDeleteObjectAction.js.map +1 -0
  12. package/build/browser/api/defineModifyInterfaceObjectAction.js +68 -0
  13. package/build/browser/api/defineModifyInterfaceObjectAction.js.map +1 -0
  14. package/build/browser/api/defineModifyObjectAction.js +91 -0
  15. package/build/browser/api/defineModifyObjectAction.js.map +1 -0
  16. package/build/browser/api/test/actions.test.js +12014 -0
  17. package/build/browser/api/test/actions.test.js.map +1 -0
  18. package/build/browser/api/test/interfaces.test.js +924 -0
  19. package/build/browser/api/test/interfaces.test.js.map +1 -0
  20. package/build/browser/api/test/links.test.js +1974 -0
  21. package/build/browser/api/test/links.test.js.map +1 -0
  22. package/build/browser/api/{markingconstraint.test.js → test/markingconstraint.test.js} +28 -2
  23. package/build/browser/api/test/markingconstraint.test.js.map +1 -0
  24. package/build/browser/api/test/misc.test.js +1058 -0
  25. package/build/browser/api/test/misc.test.js.map +1 -0
  26. package/build/browser/api/{objectStatus.test.js → test/objectStatus.test.js} +2 -2
  27. package/build/browser/api/test/objectStatus.test.js.map +1 -0
  28. package/build/browser/api/test/objects.test.js +1494 -0
  29. package/build/browser/api/test/objects.test.js.map +1 -0
  30. package/build/browser/api/test/spt.test.js +387 -0
  31. package/build/browser/api/test/spt.test.js.map +1 -0
  32. package/build/browser/api/test/valueTypes.test.js +156 -0
  33. package/build/browser/api/test/valueTypes.test.js.map +1 -0
  34. package/build/browser/cli/main.js +1 -1
  35. package/build/browser/index.js +7 -1
  36. package/build/browser/index.js.map +1 -1
  37. package/build/cjs/index.cjs +561 -503
  38. package/build/cjs/index.cjs.map +1 -1
  39. package/build/cjs/index.d.cts +27 -13
  40. package/build/esm/api/defineAction.js +121 -413
  41. package/build/esm/api/defineAction.js.map +1 -1
  42. package/build/esm/api/defineCreateInterfaceObjectAction.js +69 -0
  43. package/build/esm/api/defineCreateInterfaceObjectAction.js.map +1 -0
  44. package/build/esm/api/defineCreateObjectAction.js +76 -0
  45. package/build/esm/api/defineCreateObjectAction.js.map +1 -0
  46. package/build/esm/api/defineCreateOrModifyObjectAction.js +92 -0
  47. package/build/esm/api/defineCreateOrModifyObjectAction.js.map +1 -0
  48. package/build/esm/api/defineDeleteObjectAction.js +56 -0
  49. package/build/esm/api/defineDeleteObjectAction.js.map +1 -0
  50. package/build/esm/api/defineModifyInterfaceObjectAction.js +68 -0
  51. package/build/esm/api/defineModifyInterfaceObjectAction.js.map +1 -0
  52. package/build/esm/api/defineModifyObjectAction.js +91 -0
  53. package/build/esm/api/defineModifyObjectAction.js.map +1 -0
  54. package/build/esm/api/test/actions.test.js +12014 -0
  55. package/build/esm/api/test/actions.test.js.map +1 -0
  56. package/build/esm/api/test/interfaces.test.js +924 -0
  57. package/build/esm/api/test/interfaces.test.js.map +1 -0
  58. package/build/esm/api/test/links.test.js +1974 -0
  59. package/build/esm/api/test/links.test.js.map +1 -0
  60. package/build/esm/api/{markingconstraint.test.js → test/markingconstraint.test.js} +28 -2
  61. package/build/esm/api/test/markingconstraint.test.js.map +1 -0
  62. package/build/esm/api/test/misc.test.js +1058 -0
  63. package/build/esm/api/test/misc.test.js.map +1 -0
  64. package/build/esm/api/{objectStatus.test.js → test/objectStatus.test.js} +2 -2
  65. package/build/esm/api/test/objectStatus.test.js.map +1 -0
  66. package/build/esm/api/test/objects.test.js +1494 -0
  67. package/build/esm/api/test/objects.test.js.map +1 -0
  68. package/build/esm/api/test/spt.test.js +387 -0
  69. package/build/esm/api/test/spt.test.js.map +1 -0
  70. package/build/esm/api/test/valueTypes.test.js +156 -0
  71. package/build/esm/api/test/valueTypes.test.js.map +1 -0
  72. package/build/esm/cli/main.js +1 -1
  73. package/build/esm/index.js +7 -1
  74. package/build/esm/index.js.map +1 -1
  75. package/build/types/api/defineAction.d.ts +22 -6
  76. package/build/types/api/defineAction.d.ts.map +1 -1
  77. package/build/types/api/defineCreateInterfaceObjectAction.d.ts +3 -0
  78. package/build/types/api/defineCreateInterfaceObjectAction.d.ts.map +1 -0
  79. package/build/types/api/defineCreateObjectAction.d.ts +3 -0
  80. package/build/types/api/defineCreateObjectAction.d.ts.map +1 -0
  81. package/build/types/api/defineCreateOrModifyObjectAction.d.ts +3 -0
  82. package/build/types/api/defineCreateOrModifyObjectAction.d.ts.map +1 -0
  83. package/build/types/api/defineDeleteObjectAction.d.ts +3 -0
  84. package/build/types/api/defineDeleteObjectAction.d.ts.map +1 -0
  85. package/build/types/api/defineModifyInterfaceObjectAction.d.ts +3 -0
  86. package/build/types/api/defineModifyInterfaceObjectAction.d.ts.map +1 -0
  87. package/build/types/api/defineModifyObjectAction.d.ts +3 -0
  88. package/build/types/api/defineModifyObjectAction.d.ts.map +1 -0
  89. package/build/types/api/test/actions.test.d.ts.map +1 -0
  90. package/build/types/api/test/interfaces.test.d.ts.map +1 -0
  91. package/build/types/api/test/links.test.d.ts.map +1 -0
  92. package/build/types/api/test/markingconstraint.test.d.ts +1 -0
  93. package/build/types/api/test/markingconstraint.test.d.ts.map +1 -0
  94. package/build/types/api/test/misc.test.d.ts +1 -0
  95. package/build/types/api/test/misc.test.d.ts.map +1 -0
  96. package/build/types/api/test/objectStatus.test.d.ts +1 -0
  97. package/build/types/api/test/objectStatus.test.d.ts.map +1 -0
  98. package/build/types/api/test/objects.test.d.ts +1 -0
  99. package/build/types/api/test/objects.test.d.ts.map +1 -0
  100. package/build/types/api/test/spt.test.d.ts +1 -0
  101. package/build/types/api/test/spt.test.d.ts.map +1 -0
  102. package/build/types/api/test/valueTypes.test.d.ts +1 -0
  103. package/build/types/api/test/valueTypes.test.d.ts.map +1 -0
  104. package/build/types/index.d.ts +7 -1
  105. package/build/types/index.d.ts.map +1 -1
  106. package/package.json +3 -3
  107. package/build/browser/api/markingconstraint.test.js.map +0 -1
  108. package/build/browser/api/objectStatus.test.js.map +0 -1
  109. package/build/browser/api/overall.test.js +0 -14002
  110. package/build/browser/api/overall.test.js.map +0 -1
  111. package/build/esm/api/markingconstraint.test.js.map +0 -1
  112. package/build/esm/api/objectStatus.test.js.map +0 -1
  113. package/build/esm/api/overall.test.js +0 -14002
  114. package/build/esm/api/overall.test.js.map +0 -1
  115. package/build/types/api/markingconstraint.test.d.ts.map +0 -1
  116. package/build/types/api/objectStatus.test.d.ts.map +0 -1
  117. package/build/types/api/overall.test.d.ts.map +0 -1
  118. /package/build/types/api/{markingconstraint.test.d.ts → test/actions.test.d.ts} +0 -0
  119. /package/build/types/api/{objectStatus.test.d.ts → test/interfaces.test.d.ts} +0 -0
  120. /package/build/types/api/{overall.test.d.ts → test/links.test.d.ts} +0 -0
@@ -0,0 +1,1494 @@
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 { defineObject } from "../defineObject.js";
20
+ import { defineOntology, dumpOntologyFullMetadata } from "../defineOntology.js";
21
+ import { defineSharedPropertyType } from "../defineSpt.js";
22
+ describe("Object Types", () => {
23
+ beforeEach(async () => {
24
+ await defineOntology("com.palantir.", () => {}, "/tmp/");
25
+ });
26
+ it("Fails if the api name is invalid", () => {
27
+ expect(() => {
28
+ defineObject({
29
+ titlePropertyApiName: "bar",
30
+ displayName: "Foo",
31
+ pluralDisplayName: "Foo",
32
+ apiName: "foo_with_underscores",
33
+ primaryKeyPropertyApiName: "bar",
34
+ properties: {
35
+ "bar": {
36
+ type: "string"
37
+ }
38
+ }
39
+ });
40
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Invalid API name foo_with_underscores. API names must match the regex /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/.]`);
41
+ });
42
+ it("Fails if any property reference does not exist", () => {
43
+ const spt = defineSharedPropertyType({
44
+ apiName: "foo",
45
+ type: "string"
46
+ });
47
+ const sample = defineInterface({
48
+ apiName: "interface",
49
+ properties: {
50
+ foo: spt
51
+ }
52
+ });
53
+ expect(() => {
54
+ defineObject({
55
+ titlePropertyApiName: "fizz",
56
+ displayName: "Foo",
57
+ pluralDisplayName: "Foo",
58
+ apiName: "foo",
59
+ primaryKeyPropertyApiName: "bar",
60
+ properties: {
61
+ "bar": {
62
+ type: "string"
63
+ }
64
+ }
65
+ });
66
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Title property fizz is not defined on object foo]`);
67
+ expect(() => {
68
+ defineObject({
69
+ titlePropertyApiName: "bar",
70
+ displayName: "Foo",
71
+ pluralDisplayName: "Foo",
72
+ apiName: "foo",
73
+ primaryKeyPropertyApiName: "fizz",
74
+ properties: {
75
+ "bar": {
76
+ type: "string"
77
+ }
78
+ }
79
+ });
80
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key property fizz does not exist on object foo]`);
81
+ expect(() => {
82
+ defineObject({
83
+ titlePropertyApiName: "bar",
84
+ displayName: "Foo",
85
+ pluralDisplayName: "Foo",
86
+ apiName: "foo",
87
+ primaryKeyPropertyApiName: "bar",
88
+ properties: {
89
+ "bar": {
90
+ type: "string"
91
+ }
92
+ },
93
+ implementsInterfaces: [{
94
+ implements: sample,
95
+ propertyMapping: [{
96
+ interfaceProperty: "com.palantir.foo",
97
+ mapsTo: "fizz"
98
+ }]
99
+ }]
100
+ });
101
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Object property mapped to interface does not exist. Object Property Mapped: fizz\n]`);
102
+ expect(() => {
103
+ defineObject({
104
+ titlePropertyApiName: "bar",
105
+ displayName: "Foo",
106
+ pluralDisplayName: "Foo",
107
+ apiName: "foo",
108
+ primaryKeyPropertyApiName: "bar",
109
+ properties: {
110
+ "bar": {
111
+ type: "string"
112
+ }
113
+ },
114
+ implementsInterfaces: [{
115
+ implements: sample,
116
+ propertyMapping: [{
117
+ interfaceProperty: "com.palantir.fizz",
118
+ mapsTo: "bar"
119
+ }, {
120
+ interfaceProperty: "com.palantir.foo",
121
+ mapsTo: "bar"
122
+ }]
123
+ }]
124
+ });
125
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Interface property com.palantir.fizz referenced in foo object does not exist\n]`);
126
+ });
127
+ it("Objects properly defined", () => {
128
+ const spt = defineSharedPropertyType({
129
+ apiName: "foo",
130
+ type: "string"
131
+ });
132
+ const sample = defineInterface({
133
+ apiName: "interface",
134
+ properties: {
135
+ foo: spt
136
+ }
137
+ });
138
+ defineObject({
139
+ titlePropertyApiName: "bar",
140
+ displayName: "Foo",
141
+ pluralDisplayName: "Foo",
142
+ apiName: "foo",
143
+ primaryKeyPropertyApiName: "bar",
144
+ properties: {
145
+ "bar": {
146
+ type: "string",
147
+ displayName: "Bar"
148
+ },
149
+ "arrayProp": {
150
+ type: "string",
151
+ array: true,
152
+ displayName: "Array Property Test"
153
+ },
154
+ "geopoint": {
155
+ type: {
156
+ type: "struct",
157
+ structDefinition: {
158
+ lat: "double",
159
+ lng: "double"
160
+ }
161
+ },
162
+ displayName: "geopoint"
163
+ }
164
+ },
165
+ implementsInterfaces: [{
166
+ implements: sample,
167
+ propertyMapping: [{
168
+ interfaceProperty: "foo",
169
+ mapsTo: "bar"
170
+ }]
171
+ }]
172
+ });
173
+ expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
174
+ {
175
+ "actionTypes": {},
176
+ "blockPermissionInformation": {
177
+ "actionTypes": {},
178
+ "linkTypes": {},
179
+ "objectTypes": {},
180
+ },
181
+ "interfaceTypes": {
182
+ "com.palantir.interface": {
183
+ "interfaceType": {
184
+ "apiName": "com.palantir.interface",
185
+ "displayMetadata": {
186
+ "description": "interface",
187
+ "displayName": "interface",
188
+ "icon": {
189
+ "blueprint": {
190
+ "color": "#4C90F0",
191
+ "locator": "layout-hierarchy",
192
+ },
193
+ "type": "blueprint",
194
+ },
195
+ },
196
+ "extendsInterfaces": [],
197
+ "links": [],
198
+ "properties": [],
199
+ "propertiesV2": {
200
+ "com.palantir.foo": {
201
+ "required": true,
202
+ "sharedPropertyType": {
203
+ "aliases": [],
204
+ "apiName": "com.palantir.foo",
205
+ "baseFormatter": undefined,
206
+ "dataConstraints": undefined,
207
+ "displayMetadata": {
208
+ "description": undefined,
209
+ "displayName": "foo",
210
+ "visibility": "NORMAL",
211
+ },
212
+ "gothamMapping": undefined,
213
+ "indexedForSearch": true,
214
+ "type": {
215
+ "string": {
216
+ "analyzerOverride": undefined,
217
+ "enableAsciiFolding": undefined,
218
+ "isLongText": false,
219
+ "supportsEfficientLeadingWildcard": false,
220
+ "supportsExactMatching": true,
221
+ },
222
+ "type": "string",
223
+ },
224
+ "typeClasses": [
225
+ {
226
+ "kind": "render_hint",
227
+ "name": "SELECTABLE",
228
+ },
229
+ {
230
+ "kind": "render_hint",
231
+ "name": "SORTABLE",
232
+ },
233
+ ],
234
+ "valueType": undefined,
235
+ },
236
+ },
237
+ },
238
+ "propertiesV3": {},
239
+ "searchable": true,
240
+ "status": {
241
+ "active": {},
242
+ "type": "active",
243
+ },
244
+ },
245
+ },
246
+ },
247
+ "linkTypes": {},
248
+ "objectTypes": {
249
+ "com.palantir.foo": {
250
+ "datasources": [
251
+ {
252
+ "datasource": {
253
+ "datasetV2": {
254
+ "datasetRid": "com.palantir.foo",
255
+ "propertyMapping": {
256
+ "arrayProp": {
257
+ "column": "arrayProp",
258
+ "type": "column",
259
+ },
260
+ "bar": {
261
+ "column": "bar",
262
+ "type": "column",
263
+ },
264
+ "geopoint": {
265
+ "struct": {
266
+ "column": "geopoint",
267
+ "mapping": {
268
+ "lat": {
269
+ "apiName": "lat",
270
+ "mappings": {},
271
+ },
272
+ "lng": {
273
+ "apiName": "lng",
274
+ "mappings": {},
275
+ },
276
+ },
277
+ },
278
+ "type": "struct",
279
+ },
280
+ },
281
+ },
282
+ "type": "datasetV2",
283
+ },
284
+ "datasourceName": "com.palantir.foo",
285
+ "editsConfiguration": {
286
+ "onlyAllowPrivilegedEdits": false,
287
+ },
288
+ "redacted": false,
289
+ },
290
+ ],
291
+ "entityMetadata": {
292
+ "arePatchesEnabled": false,
293
+ },
294
+ "objectType": {
295
+ "allImplementsInterfaces": {},
296
+ "apiName": "com.palantir.foo",
297
+ "displayMetadata": {
298
+ "description": undefined,
299
+ "displayName": "Foo",
300
+ "groupDisplayName": undefined,
301
+ "icon": {
302
+ "blueprint": {
303
+ "color": "#2D72D2",
304
+ "locator": "cube",
305
+ },
306
+ "type": "blueprint",
307
+ },
308
+ "pluralDisplayName": "Foo",
309
+ "visibility": "NORMAL",
310
+ },
311
+ "implementsInterfaces2": [
312
+ {
313
+ "interfaceTypeApiName": "com.palantir.interface",
314
+ "linksV2": {},
315
+ "properties": {
316
+ "com.palantir.foo": {
317
+ "propertyTypeRid": "bar",
318
+ },
319
+ },
320
+ "propertiesV2": {},
321
+ },
322
+ ],
323
+ "primaryKeys": [
324
+ "bar",
325
+ ],
326
+ "propertyTypes": {
327
+ "arrayProp": {
328
+ "apiName": "arrayProp",
329
+ "baseFormatter": undefined,
330
+ "dataConstraints": undefined,
331
+ "displayMetadata": {
332
+ "description": undefined,
333
+ "displayName": "Array Property Test",
334
+ "visibility": "NORMAL",
335
+ },
336
+ "indexedForSearch": true,
337
+ "inlineAction": undefined,
338
+ "ruleSetBinding": undefined,
339
+ "sharedPropertyTypeApiName": undefined,
340
+ "sharedPropertyTypeRid": undefined,
341
+ "status": {
342
+ "active": {},
343
+ "type": "active",
344
+ },
345
+ "type": {
346
+ "array": {
347
+ "subtype": {
348
+ "string": {
349
+ "analyzerOverride": undefined,
350
+ "enableAsciiFolding": undefined,
351
+ "isLongText": false,
352
+ "supportsEfficientLeadingWildcard": false,
353
+ "supportsExactMatching": true,
354
+ },
355
+ "type": "string",
356
+ },
357
+ },
358
+ "type": "array",
359
+ },
360
+ "typeClasses": [
361
+ {
362
+ "kind": "render_hint",
363
+ "name": "SELECTABLE",
364
+ },
365
+ {
366
+ "kind": "render_hint",
367
+ "name": "SORTABLE",
368
+ },
369
+ ],
370
+ "valueType": undefined,
371
+ },
372
+ "bar": {
373
+ "apiName": "bar",
374
+ "baseFormatter": undefined,
375
+ "dataConstraints": undefined,
376
+ "displayMetadata": {
377
+ "description": undefined,
378
+ "displayName": "Bar",
379
+ "visibility": "NORMAL",
380
+ },
381
+ "indexedForSearch": true,
382
+ "inlineAction": undefined,
383
+ "ruleSetBinding": undefined,
384
+ "sharedPropertyTypeApiName": undefined,
385
+ "sharedPropertyTypeRid": undefined,
386
+ "status": {
387
+ "active": {},
388
+ "type": "active",
389
+ },
390
+ "type": {
391
+ "string": {
392
+ "analyzerOverride": undefined,
393
+ "enableAsciiFolding": undefined,
394
+ "isLongText": false,
395
+ "supportsEfficientLeadingWildcard": false,
396
+ "supportsExactMatching": true,
397
+ },
398
+ "type": "string",
399
+ },
400
+ "typeClasses": [
401
+ {
402
+ "kind": "render_hint",
403
+ "name": "SELECTABLE",
404
+ },
405
+ {
406
+ "kind": "render_hint",
407
+ "name": "SORTABLE",
408
+ },
409
+ ],
410
+ "valueType": undefined,
411
+ },
412
+ "geopoint": {
413
+ "apiName": "geopoint",
414
+ "baseFormatter": undefined,
415
+ "dataConstraints": undefined,
416
+ "displayMetadata": {
417
+ "description": undefined,
418
+ "displayName": "geopoint",
419
+ "visibility": "NORMAL",
420
+ },
421
+ "indexedForSearch": true,
422
+ "inlineAction": undefined,
423
+ "ruleSetBinding": undefined,
424
+ "sharedPropertyTypeApiName": undefined,
425
+ "sharedPropertyTypeRid": undefined,
426
+ "status": {
427
+ "active": {},
428
+ "type": "active",
429
+ },
430
+ "type": {
431
+ "struct": {
432
+ "structFields": [
433
+ {
434
+ "aliases": [],
435
+ "apiName": "lat",
436
+ "displayMetadata": {
437
+ "description": undefined,
438
+ "displayName": "lat",
439
+ },
440
+ "fieldType": {
441
+ "double": {},
442
+ "type": "double",
443
+ },
444
+ "typeClasses": [],
445
+ },
446
+ {
447
+ "aliases": [],
448
+ "apiName": "lng",
449
+ "displayMetadata": {
450
+ "description": undefined,
451
+ "displayName": "lng",
452
+ },
453
+ "fieldType": {
454
+ "double": {},
455
+ "type": "double",
456
+ },
457
+ "typeClasses": [],
458
+ },
459
+ ],
460
+ },
461
+ "type": "struct",
462
+ },
463
+ "typeClasses": [],
464
+ "valueType": undefined,
465
+ },
466
+ },
467
+ "redacted": false,
468
+ "status": {
469
+ "active": {},
470
+ "type": "active",
471
+ },
472
+ "titlePropertyTypeRid": "bar",
473
+ },
474
+ },
475
+ },
476
+ "sharedPropertyTypes": {
477
+ "com.palantir.foo": {
478
+ "sharedPropertyType": {
479
+ "aliases": [],
480
+ "apiName": "com.palantir.foo",
481
+ "baseFormatter": undefined,
482
+ "dataConstraints": undefined,
483
+ "displayMetadata": {
484
+ "description": undefined,
485
+ "displayName": "foo",
486
+ "visibility": "NORMAL",
487
+ },
488
+ "gothamMapping": undefined,
489
+ "indexedForSearch": true,
490
+ "type": {
491
+ "string": {
492
+ "analyzerOverride": undefined,
493
+ "enableAsciiFolding": undefined,
494
+ "isLongText": false,
495
+ "supportsEfficientLeadingWildcard": false,
496
+ "supportsExactMatching": true,
497
+ },
498
+ "type": "string",
499
+ },
500
+ "typeClasses": [
501
+ {
502
+ "kind": "render_hint",
503
+ "name": "SELECTABLE",
504
+ },
505
+ {
506
+ "kind": "render_hint",
507
+ "name": "SORTABLE",
508
+ },
509
+ ],
510
+ "valueType": undefined,
511
+ },
512
+ },
513
+ },
514
+ }
515
+ `);
516
+ });
517
+ it("Explicit datasource definitions are properly defined", () => {
518
+ defineObject({
519
+ titlePropertyApiName: "bar",
520
+ displayName: "datasetBackedObject",
521
+ pluralDisplayName: "datasetBackedObject",
522
+ apiName: "foo",
523
+ primaryKeyPropertyApiName: "bar",
524
+ properties: {
525
+ "bar": {
526
+ type: "string"
527
+ }
528
+ },
529
+ datasource: {
530
+ type: "dataset"
531
+ }
532
+ });
533
+ defineObject({
534
+ titlePropertyApiName: "fizz",
535
+ displayName: "streamBackedObjectNoRetention",
536
+ pluralDisplayName: "streamBackedObjectNoRetention",
537
+ apiName: "fizz",
538
+ primaryKeyPropertyApiName: "fizz",
539
+ properties: {
540
+ "fizz": {
541
+ type: "string"
542
+ },
543
+ "bar": {
544
+ type: "string"
545
+ }
546
+ },
547
+ datasource: {
548
+ type: "stream"
549
+ }
550
+ });
551
+ defineObject({
552
+ titlePropertyApiName: "buzz",
553
+ displayName: "streamBackedObjectWithRetention",
554
+ pluralDisplayName: "streamBackedObjectWithRetention",
555
+ apiName: "buzz",
556
+ primaryKeyPropertyApiName: "buzz",
557
+ properties: {
558
+ "buzz": {
559
+ type: "string"
560
+ }
561
+ },
562
+ datasource: {
563
+ type: "stream",
564
+ retentionPeriod: "PT1H"
565
+ }
566
+ });
567
+ expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
568
+ {
569
+ "actionTypes": {},
570
+ "blockPermissionInformation": {
571
+ "actionTypes": {},
572
+ "linkTypes": {},
573
+ "objectTypes": {},
574
+ },
575
+ "interfaceTypes": {},
576
+ "linkTypes": {},
577
+ "objectTypes": {
578
+ "com.palantir.buzz": {
579
+ "datasources": [
580
+ {
581
+ "datasource": {
582
+ "streamV2": {
583
+ "propertyMapping": {
584
+ "buzz": "buzz",
585
+ },
586
+ "propertySecurityGroups": undefined,
587
+ "retentionPolicy": {
588
+ "time": {
589
+ "window": "PT1H",
590
+ },
591
+ "type": "time",
592
+ },
593
+ "streamLocator": "com.palantir.buzz",
594
+ },
595
+ "type": "streamV2",
596
+ },
597
+ "datasourceName": "com.palantir.buzz",
598
+ "editsConfiguration": {
599
+ "onlyAllowPrivilegedEdits": false,
600
+ },
601
+ "redacted": false,
602
+ },
603
+ ],
604
+ "entityMetadata": {
605
+ "arePatchesEnabled": false,
606
+ },
607
+ "objectType": {
608
+ "allImplementsInterfaces": {},
609
+ "apiName": "com.palantir.buzz",
610
+ "displayMetadata": {
611
+ "description": undefined,
612
+ "displayName": "streamBackedObjectWithRetention",
613
+ "groupDisplayName": undefined,
614
+ "icon": {
615
+ "blueprint": {
616
+ "color": "#2D72D2",
617
+ "locator": "cube",
618
+ },
619
+ "type": "blueprint",
620
+ },
621
+ "pluralDisplayName": "streamBackedObjectWithRetention",
622
+ "visibility": "NORMAL",
623
+ },
624
+ "implementsInterfaces2": [],
625
+ "primaryKeys": [
626
+ "buzz",
627
+ ],
628
+ "propertyTypes": {
629
+ "buzz": {
630
+ "apiName": "buzz",
631
+ "baseFormatter": undefined,
632
+ "dataConstraints": undefined,
633
+ "displayMetadata": {
634
+ "description": undefined,
635
+ "displayName": "Buzz",
636
+ "visibility": "NORMAL",
637
+ },
638
+ "indexedForSearch": true,
639
+ "inlineAction": undefined,
640
+ "ruleSetBinding": undefined,
641
+ "sharedPropertyTypeApiName": undefined,
642
+ "sharedPropertyTypeRid": undefined,
643
+ "status": {
644
+ "active": {},
645
+ "type": "active",
646
+ },
647
+ "type": {
648
+ "string": {
649
+ "analyzerOverride": undefined,
650
+ "enableAsciiFolding": undefined,
651
+ "isLongText": false,
652
+ "supportsEfficientLeadingWildcard": false,
653
+ "supportsExactMatching": true,
654
+ },
655
+ "type": "string",
656
+ },
657
+ "typeClasses": [
658
+ {
659
+ "kind": "render_hint",
660
+ "name": "SELECTABLE",
661
+ },
662
+ {
663
+ "kind": "render_hint",
664
+ "name": "SORTABLE",
665
+ },
666
+ ],
667
+ "valueType": undefined,
668
+ },
669
+ },
670
+ "redacted": false,
671
+ "status": {
672
+ "active": {},
673
+ "type": "active",
674
+ },
675
+ "titlePropertyTypeRid": "buzz",
676
+ },
677
+ },
678
+ "com.palantir.fizz": {
679
+ "datasources": [
680
+ {
681
+ "datasource": {
682
+ "streamV2": {
683
+ "propertyMapping": {
684
+ "bar": "bar",
685
+ "fizz": "fizz",
686
+ },
687
+ "propertySecurityGroups": undefined,
688
+ "retentionPolicy": {
689
+ "none": {},
690
+ "type": "none",
691
+ },
692
+ "streamLocator": "com.palantir.fizz",
693
+ },
694
+ "type": "streamV2",
695
+ },
696
+ "datasourceName": "com.palantir.fizz",
697
+ "editsConfiguration": {
698
+ "onlyAllowPrivilegedEdits": false,
699
+ },
700
+ "redacted": false,
701
+ },
702
+ ],
703
+ "entityMetadata": {
704
+ "arePatchesEnabled": false,
705
+ },
706
+ "objectType": {
707
+ "allImplementsInterfaces": {},
708
+ "apiName": "com.palantir.fizz",
709
+ "displayMetadata": {
710
+ "description": undefined,
711
+ "displayName": "streamBackedObjectNoRetention",
712
+ "groupDisplayName": undefined,
713
+ "icon": {
714
+ "blueprint": {
715
+ "color": "#2D72D2",
716
+ "locator": "cube",
717
+ },
718
+ "type": "blueprint",
719
+ },
720
+ "pluralDisplayName": "streamBackedObjectNoRetention",
721
+ "visibility": "NORMAL",
722
+ },
723
+ "implementsInterfaces2": [],
724
+ "primaryKeys": [
725
+ "fizz",
726
+ ],
727
+ "propertyTypes": {
728
+ "bar": {
729
+ "apiName": "bar",
730
+ "baseFormatter": undefined,
731
+ "dataConstraints": undefined,
732
+ "displayMetadata": {
733
+ "description": undefined,
734
+ "displayName": "Bar",
735
+ "visibility": "NORMAL",
736
+ },
737
+ "indexedForSearch": true,
738
+ "inlineAction": undefined,
739
+ "ruleSetBinding": undefined,
740
+ "sharedPropertyTypeApiName": undefined,
741
+ "sharedPropertyTypeRid": undefined,
742
+ "status": {
743
+ "active": {},
744
+ "type": "active",
745
+ },
746
+ "type": {
747
+ "string": {
748
+ "analyzerOverride": undefined,
749
+ "enableAsciiFolding": undefined,
750
+ "isLongText": false,
751
+ "supportsEfficientLeadingWildcard": false,
752
+ "supportsExactMatching": true,
753
+ },
754
+ "type": "string",
755
+ },
756
+ "typeClasses": [
757
+ {
758
+ "kind": "render_hint",
759
+ "name": "SELECTABLE",
760
+ },
761
+ {
762
+ "kind": "render_hint",
763
+ "name": "SORTABLE",
764
+ },
765
+ ],
766
+ "valueType": undefined,
767
+ },
768
+ "fizz": {
769
+ "apiName": "fizz",
770
+ "baseFormatter": undefined,
771
+ "dataConstraints": undefined,
772
+ "displayMetadata": {
773
+ "description": undefined,
774
+ "displayName": "Fizz",
775
+ "visibility": "NORMAL",
776
+ },
777
+ "indexedForSearch": true,
778
+ "inlineAction": undefined,
779
+ "ruleSetBinding": undefined,
780
+ "sharedPropertyTypeApiName": undefined,
781
+ "sharedPropertyTypeRid": undefined,
782
+ "status": {
783
+ "active": {},
784
+ "type": "active",
785
+ },
786
+ "type": {
787
+ "string": {
788
+ "analyzerOverride": undefined,
789
+ "enableAsciiFolding": undefined,
790
+ "isLongText": false,
791
+ "supportsEfficientLeadingWildcard": false,
792
+ "supportsExactMatching": true,
793
+ },
794
+ "type": "string",
795
+ },
796
+ "typeClasses": [
797
+ {
798
+ "kind": "render_hint",
799
+ "name": "SELECTABLE",
800
+ },
801
+ {
802
+ "kind": "render_hint",
803
+ "name": "SORTABLE",
804
+ },
805
+ ],
806
+ "valueType": undefined,
807
+ },
808
+ },
809
+ "redacted": false,
810
+ "status": {
811
+ "active": {},
812
+ "type": "active",
813
+ },
814
+ "titlePropertyTypeRid": "fizz",
815
+ },
816
+ },
817
+ "com.palantir.foo": {
818
+ "datasources": [
819
+ {
820
+ "datasource": {
821
+ "datasetV2": {
822
+ "datasetRid": "com.palantir.foo",
823
+ "propertyMapping": {
824
+ "bar": {
825
+ "column": "bar",
826
+ "type": "column",
827
+ },
828
+ },
829
+ },
830
+ "type": "datasetV2",
831
+ },
832
+ "datasourceName": "com.palantir.foo",
833
+ "editsConfiguration": {
834
+ "onlyAllowPrivilegedEdits": false,
835
+ },
836
+ "redacted": false,
837
+ },
838
+ ],
839
+ "entityMetadata": {
840
+ "arePatchesEnabled": false,
841
+ },
842
+ "objectType": {
843
+ "allImplementsInterfaces": {},
844
+ "apiName": "com.palantir.foo",
845
+ "displayMetadata": {
846
+ "description": undefined,
847
+ "displayName": "datasetBackedObject",
848
+ "groupDisplayName": undefined,
849
+ "icon": {
850
+ "blueprint": {
851
+ "color": "#2D72D2",
852
+ "locator": "cube",
853
+ },
854
+ "type": "blueprint",
855
+ },
856
+ "pluralDisplayName": "datasetBackedObject",
857
+ "visibility": "NORMAL",
858
+ },
859
+ "implementsInterfaces2": [],
860
+ "primaryKeys": [
861
+ "bar",
862
+ ],
863
+ "propertyTypes": {
864
+ "bar": {
865
+ "apiName": "bar",
866
+ "baseFormatter": undefined,
867
+ "dataConstraints": undefined,
868
+ "displayMetadata": {
869
+ "description": undefined,
870
+ "displayName": "Bar",
871
+ "visibility": "NORMAL",
872
+ },
873
+ "indexedForSearch": true,
874
+ "inlineAction": undefined,
875
+ "ruleSetBinding": undefined,
876
+ "sharedPropertyTypeApiName": undefined,
877
+ "sharedPropertyTypeRid": undefined,
878
+ "status": {
879
+ "active": {},
880
+ "type": "active",
881
+ },
882
+ "type": {
883
+ "string": {
884
+ "analyzerOverride": undefined,
885
+ "enableAsciiFolding": undefined,
886
+ "isLongText": false,
887
+ "supportsEfficientLeadingWildcard": false,
888
+ "supportsExactMatching": true,
889
+ },
890
+ "type": "string",
891
+ },
892
+ "typeClasses": [
893
+ {
894
+ "kind": "render_hint",
895
+ "name": "SELECTABLE",
896
+ },
897
+ {
898
+ "kind": "render_hint",
899
+ "name": "SORTABLE",
900
+ },
901
+ ],
902
+ "valueType": undefined,
903
+ },
904
+ },
905
+ "redacted": false,
906
+ "status": {
907
+ "active": {},
908
+ "type": "active",
909
+ },
910
+ "titlePropertyTypeRid": "bar",
911
+ },
912
+ },
913
+ },
914
+ "sharedPropertyTypes": {},
915
+ }
916
+ `);
917
+ });
918
+ it("Restricted view datasources are properly defined", () => {
919
+ defineObject({
920
+ titlePropertyApiName: "bar",
921
+ displayName: "Foo",
922
+ pluralDisplayName: "Foo",
923
+ apiName: "foo",
924
+ primaryKeyPropertyApiName: "bar",
925
+ properties: {
926
+ "bar": {
927
+ type: "string"
928
+ }
929
+ },
930
+ datasource: {
931
+ type: "restrictedView"
932
+ }
933
+ });
934
+ expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
935
+ {
936
+ "importedOntology": {
937
+ "actionTypes": {},
938
+ "blockPermissionInformation": {
939
+ "actionTypes": {},
940
+ "linkTypes": {},
941
+ "objectTypes": {},
942
+ },
943
+ "interfaceTypes": {},
944
+ "linkTypes": {},
945
+ "objectTypes": {},
946
+ "sharedPropertyTypes": {},
947
+ },
948
+ "importedValueTypes": {
949
+ "valueTypes": [],
950
+ },
951
+ "ontology": {
952
+ "actionTypes": {},
953
+ "blockPermissionInformation": {
954
+ "actionTypes": {},
955
+ "linkTypes": {},
956
+ "objectTypes": {},
957
+ },
958
+ "interfaceTypes": {},
959
+ "linkTypes": {},
960
+ "objectTypes": {
961
+ "com.palantir.foo": {
962
+ "datasources": [
963
+ {
964
+ "datasource": {
965
+ "restrictedViewV2": {
966
+ "propertyMapping": {
967
+ "bar": {
968
+ "column": "bar",
969
+ "type": "column",
970
+ },
971
+ },
972
+ "restrictedViewRid": "com.palantir.foo",
973
+ },
974
+ "type": "restrictedViewV2",
975
+ },
976
+ "datasourceName": "com.palantir.foo",
977
+ "editsConfiguration": {
978
+ "onlyAllowPrivilegedEdits": false,
979
+ },
980
+ "redacted": false,
981
+ },
982
+ ],
983
+ "entityMetadata": {
984
+ "arePatchesEnabled": false,
985
+ },
986
+ "objectType": {
987
+ "allImplementsInterfaces": {},
988
+ "apiName": "com.palantir.foo",
989
+ "displayMetadata": {
990
+ "description": undefined,
991
+ "displayName": "Foo",
992
+ "groupDisplayName": undefined,
993
+ "icon": {
994
+ "blueprint": {
995
+ "color": "#2D72D2",
996
+ "locator": "cube",
997
+ },
998
+ "type": "blueprint",
999
+ },
1000
+ "pluralDisplayName": "Foo",
1001
+ "visibility": "NORMAL",
1002
+ },
1003
+ "implementsInterfaces2": [],
1004
+ "primaryKeys": [
1005
+ "bar",
1006
+ ],
1007
+ "propertyTypes": {
1008
+ "bar": {
1009
+ "apiName": "bar",
1010
+ "baseFormatter": undefined,
1011
+ "dataConstraints": undefined,
1012
+ "displayMetadata": {
1013
+ "description": undefined,
1014
+ "displayName": "Bar",
1015
+ "visibility": "NORMAL",
1016
+ },
1017
+ "indexedForSearch": true,
1018
+ "inlineAction": undefined,
1019
+ "ruleSetBinding": undefined,
1020
+ "sharedPropertyTypeApiName": undefined,
1021
+ "sharedPropertyTypeRid": undefined,
1022
+ "status": {
1023
+ "active": {},
1024
+ "type": "active",
1025
+ },
1026
+ "type": {
1027
+ "string": {
1028
+ "analyzerOverride": undefined,
1029
+ "enableAsciiFolding": undefined,
1030
+ "isLongText": false,
1031
+ "supportsEfficientLeadingWildcard": false,
1032
+ "supportsExactMatching": true,
1033
+ },
1034
+ "type": "string",
1035
+ },
1036
+ "typeClasses": [
1037
+ {
1038
+ "kind": "render_hint",
1039
+ "name": "SELECTABLE",
1040
+ },
1041
+ {
1042
+ "kind": "render_hint",
1043
+ "name": "SORTABLE",
1044
+ },
1045
+ ],
1046
+ "valueType": undefined,
1047
+ },
1048
+ },
1049
+ "redacted": false,
1050
+ "status": {
1051
+ "active": {},
1052
+ "type": "active",
1053
+ },
1054
+ "titlePropertyTypeRid": "bar",
1055
+ },
1056
+ },
1057
+ },
1058
+ "sharedPropertyTypes": {},
1059
+ },
1060
+ "randomnessKey": undefined,
1061
+ "valueTypes": {
1062
+ "valueTypes": [],
1063
+ },
1064
+ }
1065
+ `);
1066
+ });
1067
+ it("Edit only properties are properly defined", () => {
1068
+ defineObject({
1069
+ titlePropertyApiName: "bar",
1070
+ displayName: "Foo",
1071
+ pluralDisplayName: "Foo",
1072
+ apiName: "foo",
1073
+ primaryKeyPropertyApiName: "fizz",
1074
+ properties: {
1075
+ "bar": {
1076
+ type: "string",
1077
+ editOnly: true
1078
+ },
1079
+ "fizz": {
1080
+ type: "string"
1081
+ }
1082
+ }
1083
+ });
1084
+ expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
1085
+ {
1086
+ "importedOntology": {
1087
+ "actionTypes": {},
1088
+ "blockPermissionInformation": {
1089
+ "actionTypes": {},
1090
+ "linkTypes": {},
1091
+ "objectTypes": {},
1092
+ },
1093
+ "interfaceTypes": {},
1094
+ "linkTypes": {},
1095
+ "objectTypes": {},
1096
+ "sharedPropertyTypes": {},
1097
+ },
1098
+ "importedValueTypes": {
1099
+ "valueTypes": [],
1100
+ },
1101
+ "ontology": {
1102
+ "actionTypes": {},
1103
+ "blockPermissionInformation": {
1104
+ "actionTypes": {},
1105
+ "linkTypes": {},
1106
+ "objectTypes": {},
1107
+ },
1108
+ "interfaceTypes": {},
1109
+ "linkTypes": {},
1110
+ "objectTypes": {
1111
+ "com.palantir.foo": {
1112
+ "datasources": [
1113
+ {
1114
+ "datasource": {
1115
+ "datasetV2": {
1116
+ "datasetRid": "com.palantir.foo",
1117
+ "propertyMapping": {
1118
+ "bar": {
1119
+ "editOnly": {},
1120
+ "type": "editOnly",
1121
+ },
1122
+ "fizz": {
1123
+ "column": "fizz",
1124
+ "type": "column",
1125
+ },
1126
+ },
1127
+ },
1128
+ "type": "datasetV2",
1129
+ },
1130
+ "datasourceName": "com.palantir.foo",
1131
+ "editsConfiguration": {
1132
+ "onlyAllowPrivilegedEdits": false,
1133
+ },
1134
+ "redacted": false,
1135
+ },
1136
+ ],
1137
+ "entityMetadata": {
1138
+ "arePatchesEnabled": false,
1139
+ },
1140
+ "objectType": {
1141
+ "allImplementsInterfaces": {},
1142
+ "apiName": "com.palantir.foo",
1143
+ "displayMetadata": {
1144
+ "description": undefined,
1145
+ "displayName": "Foo",
1146
+ "groupDisplayName": undefined,
1147
+ "icon": {
1148
+ "blueprint": {
1149
+ "color": "#2D72D2",
1150
+ "locator": "cube",
1151
+ },
1152
+ "type": "blueprint",
1153
+ },
1154
+ "pluralDisplayName": "Foo",
1155
+ "visibility": "NORMAL",
1156
+ },
1157
+ "implementsInterfaces2": [],
1158
+ "primaryKeys": [
1159
+ "fizz",
1160
+ ],
1161
+ "propertyTypes": {
1162
+ "bar": {
1163
+ "apiName": "bar",
1164
+ "baseFormatter": undefined,
1165
+ "dataConstraints": undefined,
1166
+ "displayMetadata": {
1167
+ "description": undefined,
1168
+ "displayName": "Bar",
1169
+ "visibility": "NORMAL",
1170
+ },
1171
+ "indexedForSearch": true,
1172
+ "inlineAction": undefined,
1173
+ "ruleSetBinding": undefined,
1174
+ "sharedPropertyTypeApiName": undefined,
1175
+ "sharedPropertyTypeRid": undefined,
1176
+ "status": {
1177
+ "active": {},
1178
+ "type": "active",
1179
+ },
1180
+ "type": {
1181
+ "string": {
1182
+ "analyzerOverride": undefined,
1183
+ "enableAsciiFolding": undefined,
1184
+ "isLongText": false,
1185
+ "supportsEfficientLeadingWildcard": false,
1186
+ "supportsExactMatching": true,
1187
+ },
1188
+ "type": "string",
1189
+ },
1190
+ "typeClasses": [
1191
+ {
1192
+ "kind": "render_hint",
1193
+ "name": "SELECTABLE",
1194
+ },
1195
+ {
1196
+ "kind": "render_hint",
1197
+ "name": "SORTABLE",
1198
+ },
1199
+ ],
1200
+ "valueType": undefined,
1201
+ },
1202
+ "fizz": {
1203
+ "apiName": "fizz",
1204
+ "baseFormatter": undefined,
1205
+ "dataConstraints": undefined,
1206
+ "displayMetadata": {
1207
+ "description": undefined,
1208
+ "displayName": "Fizz",
1209
+ "visibility": "NORMAL",
1210
+ },
1211
+ "indexedForSearch": true,
1212
+ "inlineAction": undefined,
1213
+ "ruleSetBinding": undefined,
1214
+ "sharedPropertyTypeApiName": undefined,
1215
+ "sharedPropertyTypeRid": undefined,
1216
+ "status": {
1217
+ "active": {},
1218
+ "type": "active",
1219
+ },
1220
+ "type": {
1221
+ "string": {
1222
+ "analyzerOverride": undefined,
1223
+ "enableAsciiFolding": undefined,
1224
+ "isLongText": false,
1225
+ "supportsEfficientLeadingWildcard": false,
1226
+ "supportsExactMatching": true,
1227
+ },
1228
+ "type": "string",
1229
+ },
1230
+ "typeClasses": [
1231
+ {
1232
+ "kind": "render_hint",
1233
+ "name": "SELECTABLE",
1234
+ },
1235
+ {
1236
+ "kind": "render_hint",
1237
+ "name": "SORTABLE",
1238
+ },
1239
+ ],
1240
+ "valueType": undefined,
1241
+ },
1242
+ },
1243
+ "redacted": false,
1244
+ "status": {
1245
+ "active": {},
1246
+ "type": "active",
1247
+ },
1248
+ "titlePropertyTypeRid": "bar",
1249
+ },
1250
+ },
1251
+ },
1252
+ "sharedPropertyTypes": {},
1253
+ },
1254
+ "randomnessKey": undefined,
1255
+ "valueTypes": {
1256
+ "valueTypes": [],
1257
+ },
1258
+ }
1259
+ `);
1260
+ });
1261
+ it("Fails if edit only property is primary key", () => {
1262
+ expect(() => {
1263
+ defineObject({
1264
+ titlePropertyApiName: "bar",
1265
+ displayName: "Foo",
1266
+ pluralDisplayName: "Foo",
1267
+ apiName: "foo",
1268
+ primaryKeyPropertyApiName: "bar",
1269
+ properties: {
1270
+ "bar": {
1271
+ type: "string",
1272
+ editOnly: true
1273
+ }
1274
+ }
1275
+ });
1276
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key property bar on object foo cannot be edit-only]`);
1277
+ });
1278
+ it("Fail if stream retention period is not ISO 8601 compliant", () => {
1279
+ expect(() => defineObject({
1280
+ titlePropertyApiName: "buzz",
1281
+ displayName: "streamBackedObjectWithRetention",
1282
+ pluralDisplayName: "streamBackedObjectWithRetention",
1283
+ apiName: "buzz",
1284
+ primaryKeyPropertyApiName: "buzz",
1285
+ properties: {
1286
+ "buzz": {
1287
+ type: "string"
1288
+ }
1289
+ },
1290
+ datasource: {
1291
+ type: "stream",
1292
+ retentionPeriod: "bad retention period string"
1293
+ }
1294
+ })).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Retention period "bad retention period string" on object "buzz" is not a valid ISO 8601 duration string]`);
1295
+ });
1296
+ it("Property-level datasources are properly defined", () => {
1297
+ defineObject({
1298
+ titlePropertyApiName: "bar",
1299
+ displayName: "exampleObject",
1300
+ pluralDisplayName: "exampleObject",
1301
+ apiName: "fizz",
1302
+ primaryKeyPropertyApiName: "bar",
1303
+ properties: {
1304
+ "fizz": {
1305
+ type: "mediaReference"
1306
+ },
1307
+ "bar": {
1308
+ type: "string"
1309
+ }
1310
+ },
1311
+ datasource: {
1312
+ type: "stream"
1313
+ }
1314
+ });
1315
+ expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
1316
+ {
1317
+ "importedOntology": {
1318
+ "actionTypes": {},
1319
+ "blockPermissionInformation": {
1320
+ "actionTypes": {},
1321
+ "linkTypes": {},
1322
+ "objectTypes": {},
1323
+ },
1324
+ "interfaceTypes": {},
1325
+ "linkTypes": {},
1326
+ "objectTypes": {},
1327
+ "sharedPropertyTypes": {},
1328
+ },
1329
+ "importedValueTypes": {
1330
+ "valueTypes": [],
1331
+ },
1332
+ "ontology": {
1333
+ "actionTypes": {},
1334
+ "blockPermissionInformation": {
1335
+ "actionTypes": {},
1336
+ "linkTypes": {},
1337
+ "objectTypes": {},
1338
+ },
1339
+ "interfaceTypes": {},
1340
+ "linkTypes": {},
1341
+ "objectTypes": {
1342
+ "com.palantir.fizz": {
1343
+ "datasources": [
1344
+ {
1345
+ "datasource": {
1346
+ "mediaSetView": {
1347
+ "assumedMarkings": [],
1348
+ "mediaSetViewLocator": "com.palantir.fizz.fizz",
1349
+ "properties": [
1350
+ "fizz",
1351
+ ],
1352
+ },
1353
+ "type": "mediaSetView",
1354
+ },
1355
+ "datasourceName": "fizz",
1356
+ "editsConfiguration": {
1357
+ "onlyAllowPrivilegedEdits": false,
1358
+ },
1359
+ "redacted": false,
1360
+ },
1361
+ {
1362
+ "datasource": {
1363
+ "streamV2": {
1364
+ "propertyMapping": {
1365
+ "bar": "bar",
1366
+ "fizz": "fizz",
1367
+ },
1368
+ "propertySecurityGroups": undefined,
1369
+ "retentionPolicy": {
1370
+ "none": {},
1371
+ "type": "none",
1372
+ },
1373
+ "streamLocator": "com.palantir.fizz",
1374
+ },
1375
+ "type": "streamV2",
1376
+ },
1377
+ "datasourceName": "com.palantir.fizz",
1378
+ "editsConfiguration": {
1379
+ "onlyAllowPrivilegedEdits": false,
1380
+ },
1381
+ "redacted": false,
1382
+ },
1383
+ ],
1384
+ "entityMetadata": {
1385
+ "arePatchesEnabled": false,
1386
+ },
1387
+ "objectType": {
1388
+ "allImplementsInterfaces": {},
1389
+ "apiName": "com.palantir.fizz",
1390
+ "displayMetadata": {
1391
+ "description": undefined,
1392
+ "displayName": "exampleObject",
1393
+ "groupDisplayName": undefined,
1394
+ "icon": {
1395
+ "blueprint": {
1396
+ "color": "#2D72D2",
1397
+ "locator": "cube",
1398
+ },
1399
+ "type": "blueprint",
1400
+ },
1401
+ "pluralDisplayName": "exampleObject",
1402
+ "visibility": "NORMAL",
1403
+ },
1404
+ "implementsInterfaces2": [],
1405
+ "primaryKeys": [
1406
+ "bar",
1407
+ ],
1408
+ "propertyTypes": {
1409
+ "bar": {
1410
+ "apiName": "bar",
1411
+ "baseFormatter": undefined,
1412
+ "dataConstraints": undefined,
1413
+ "displayMetadata": {
1414
+ "description": undefined,
1415
+ "displayName": "Bar",
1416
+ "visibility": "NORMAL",
1417
+ },
1418
+ "indexedForSearch": true,
1419
+ "inlineAction": undefined,
1420
+ "ruleSetBinding": undefined,
1421
+ "sharedPropertyTypeApiName": undefined,
1422
+ "sharedPropertyTypeRid": undefined,
1423
+ "status": {
1424
+ "active": {},
1425
+ "type": "active",
1426
+ },
1427
+ "type": {
1428
+ "string": {
1429
+ "analyzerOverride": undefined,
1430
+ "enableAsciiFolding": undefined,
1431
+ "isLongText": false,
1432
+ "supportsEfficientLeadingWildcard": false,
1433
+ "supportsExactMatching": true,
1434
+ },
1435
+ "type": "string",
1436
+ },
1437
+ "typeClasses": [
1438
+ {
1439
+ "kind": "render_hint",
1440
+ "name": "SELECTABLE",
1441
+ },
1442
+ {
1443
+ "kind": "render_hint",
1444
+ "name": "SORTABLE",
1445
+ },
1446
+ ],
1447
+ "valueType": undefined,
1448
+ },
1449
+ "fizz": {
1450
+ "apiName": "fizz",
1451
+ "baseFormatter": undefined,
1452
+ "dataConstraints": undefined,
1453
+ "displayMetadata": {
1454
+ "description": undefined,
1455
+ "displayName": "Fizz",
1456
+ "visibility": "NORMAL",
1457
+ },
1458
+ "indexedForSearch": true,
1459
+ "inlineAction": undefined,
1460
+ "ruleSetBinding": undefined,
1461
+ "sharedPropertyTypeApiName": undefined,
1462
+ "sharedPropertyTypeRid": undefined,
1463
+ "status": {
1464
+ "active": {},
1465
+ "type": "active",
1466
+ },
1467
+ "type": {
1468
+ "mediaReference": {},
1469
+ "type": "mediaReference",
1470
+ },
1471
+ "typeClasses": [],
1472
+ "valueType": undefined,
1473
+ },
1474
+ },
1475
+ "redacted": false,
1476
+ "status": {
1477
+ "active": {},
1478
+ "type": "active",
1479
+ },
1480
+ "titlePropertyTypeRid": "bar",
1481
+ },
1482
+ },
1483
+ },
1484
+ "sharedPropertyTypes": {},
1485
+ },
1486
+ "randomnessKey": undefined,
1487
+ "valueTypes": {
1488
+ "valueTypes": [],
1489
+ },
1490
+ }
1491
+ `);
1492
+ });
1493
+ });
1494
+ //# sourceMappingURL=objects.test.js.map