@osdk/maker 0.13.0-beta.1 → 0.13.0-beta.11

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 (60) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/build/browser/api/defineAction.js +57 -20
  3. package/build/browser/api/defineAction.js.map +1 -1
  4. package/build/browser/api/defineInterface.js +11 -6
  5. package/build/browser/api/defineInterface.js.map +1 -1
  6. package/build/browser/api/defineObject.js +2 -0
  7. package/build/browser/api/defineObject.js.map +1 -1
  8. package/build/browser/api/defineOntology.js +40 -109
  9. package/build/browser/api/defineOntology.js.map +1 -1
  10. package/build/browser/api/defineSpt.js.map +1 -1
  11. package/build/browser/api/defineValueType.js +2 -1
  12. package/build/browser/api/defineValueType.js.map +1 -1
  13. package/build/browser/api/markingconstraint.test.js +3 -3
  14. package/build/browser/api/markingconstraint.test.js.map +1 -1
  15. package/build/browser/api/objectStatus.test.js +4 -4
  16. package/build/browser/api/objectStatus.test.js.map +1 -1
  17. package/build/browser/api/overall.test.js +1015 -314
  18. package/build/browser/api/overall.test.js.map +1 -1
  19. package/build/browser/api/propertyConversionUtils.js +3 -1
  20. package/build/browser/api/propertyConversionUtils.js.map +1 -1
  21. package/build/browser/api/types.js.map +1 -1
  22. package/build/browser/cli/main.js +5 -5
  23. package/build/browser/cli/main.js.map +1 -1
  24. package/build/cjs/index.cjs +106 -141
  25. package/build/cjs/index.cjs.map +1 -1
  26. package/build/cjs/index.d.cts +8 -10
  27. package/build/esm/api/defineAction.js +57 -20
  28. package/build/esm/api/defineAction.js.map +1 -1
  29. package/build/esm/api/defineInterface.js +11 -6
  30. package/build/esm/api/defineInterface.js.map +1 -1
  31. package/build/esm/api/defineObject.js +2 -0
  32. package/build/esm/api/defineObject.js.map +1 -1
  33. package/build/esm/api/defineOntology.js +40 -109
  34. package/build/esm/api/defineOntology.js.map +1 -1
  35. package/build/esm/api/defineSpt.js.map +1 -1
  36. package/build/esm/api/defineValueType.js +2 -1
  37. package/build/esm/api/defineValueType.js.map +1 -1
  38. package/build/esm/api/markingconstraint.test.js +3 -3
  39. package/build/esm/api/markingconstraint.test.js.map +1 -1
  40. package/build/esm/api/objectStatus.test.js +4 -4
  41. package/build/esm/api/objectStatus.test.js.map +1 -1
  42. package/build/esm/api/overall.test.js +1015 -314
  43. package/build/esm/api/overall.test.js.map +1 -1
  44. package/build/esm/api/propertyConversionUtils.js +3 -1
  45. package/build/esm/api/propertyConversionUtils.js.map +1 -1
  46. package/build/esm/api/types.js.map +1 -1
  47. package/build/esm/cli/main.js +5 -5
  48. package/build/esm/cli/main.js.map +1 -1
  49. package/build/types/api/defineAction.d.ts.map +1 -1
  50. package/build/types/api/defineInterface.d.ts.map +1 -1
  51. package/build/types/api/defineObject.d.ts.map +1 -1
  52. package/build/types/api/defineOntology.d.ts +1 -6
  53. package/build/types/api/defineOntology.d.ts.map +1 -1
  54. package/build/types/api/defineSpt.d.ts +2 -2
  55. package/build/types/api/defineSpt.d.ts.map +1 -1
  56. package/build/types/api/propertyConversionUtils.d.ts +2 -2
  57. package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
  58. package/build/types/api/types.d.ts +6 -14
  59. package/build/types/api/types.d.ts.map +1 -1
  60. package/package.json +9 -10
@@ -12,52 +12,53 @@
12
12
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
- */import*as fs from"fs";import path from"path";import{fileURLToPath}from"url";import{beforeEach,describe,expect,it}from"vitest";import{addDependency}from"./addDependency.js";import{defineAction,defineCreateInterfaceObjectAction,defineCreateObjectAction,defineCreateOrModifyObjectAction,defineDeleteObjectAction,defineModifyInterfaceObjectAction,defineModifyObjectAction}from"./defineAction.js";import{importSharedPropertyType}from"./defineImportSpt.js";import{defineInterface}from"./defineInterface.js";import{defineInterfaceLinkConstraint}from"./defineInterfaceLinkConstraint.js";import{defineLink}from"./defineLink.js";import{defineObject}from"./defineObject.js";import{defineOntology,dumpOntologyFullMetadata,dumpValueTypeWireType}from"./defineOntology.js";import{defineSharedPropertyType}from"./defineSpt.js";import{defineValueType}from"./defineValueType.js";import{importOntologyEntity}from"./importOntologyEntity.js";import{CREATE_OR_MODIFY_OBJECT_PARAMETER,MODIFY_OBJECT_PARAMETER,OntologyEntityTypeEnum}from"./types.js";describe("Ontology Defining",()=>{beforeEach(async()=>{await defineOntology("com.palantir.",()=>{},"/tmp/");});describe("ValueTypes",()=>{it("Fails to define value type with incorrect semver",()=>{expect(()=>defineValueType({apiName:"apiName",displayName:"displayName",type:{"type":"boolean",constraints:[{constraint:{"allowedValues":["TRUE_VALUE"]}}]},version:"not a version"})).toThrowErrorMatchingInlineSnapshot("[Error: Invariant failed: Version is not a valid semver]");});it("Tests convertProperty function with valueType constraints for string",()=>{const testStringValueType=defineValueType({apiName:"stringWithConstraints",displayName:"String With Constraints",description:"A string type with additional constraints",type:{"type":"string",constraints:[{constraint:{type:"length",length:{minSize:5,maxSize:20}},failureMessage:{message:"String must be between 5 and 20 characters"}}]},version:"1.0.0"});defineObject({titlePropertyApiName:"constrainedString",displayName:"Test Object",pluralDisplayName:"Test Objects",apiName:"testObject",primaryKeyPropertyApiName:"constrainedString",properties:{"constrainedString":{type:"string",displayName:"Constrained String",valueType:testStringValueType}}});const ontology=dumpOntologyFullMetadata();const objectPropertyType=ontology.blockData.objectTypes["com.palantir.testObject"].objectType.propertyTypes["constrainedString"];expect(objectPropertyType.valueType).toEqual({apiName:"stringWithConstraints",version:"1.0.0"});expect(objectPropertyType.dataConstraints).toBeDefined();expect(objectPropertyType.dataConstraints?.propertyTypeConstraints).toHaveLength(1);const constraintWrapper=objectPropertyType.dataConstraints?.propertyTypeConstraints[0];expect(constraintWrapper?.constraints?.type).toBe("string");expect((constraintWrapper?.constraints).string.length.minSize).toBe(5);expect((constraintWrapper?.constraints).string.length.maxSize).toBe(20);expect(constraintWrapper?.failureMessage?.message).toBe("String must be between 5 and 20 characters");});it("Correctly serializes a value type",()=>{defineValueType({apiName:"apiName",displayName:"displayName",type:{"type":"boolean",constraints:[{constraint:{"allowedValues":["TRUE_VALUE"]}}]},version:"0.1.0"});expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`
16
- {
17
- "valueTypes": [
18
- {
19
- "metadata": {
20
- "apiName": "apiName",
21
- "displayMetadata": {
22
- "description": "",
23
- "displayName": "displayName",
24
- },
25
- "status": {
26
- "active": {},
27
- "type": "active",
28
- },
29
- },
30
- "versions": [
31
- {
32
- "baseType": {
33
- "boolean": {},
34
- "type": "boolean",
35
- },
36
- "constraints": [
37
- {
38
- "constraint": {
39
- "constraint": {
40
- "boolean": {
41
- "allowedValues": [
42
- "TRUE_VALUE",
43
- ],
44
- },
45
- "type": "boolean",
46
- },
47
- "failureMessage": undefined,
48
- },
49
- },
50
- ],
51
- "exampleValues": [],
52
- "version": "0.1.0",
53
- },
54
- ],
55
- },
56
- ],
57
- }
58
- `);});// N.B Not sure what this is for but I don't want to break anything so I added the eslint ignore
15
+ */import*as fs from"fs";import path from"path";import{fileURLToPath}from"url";import{beforeEach,describe,expect,it}from"vitest";import{addDependency}from"./addDependency.js";import{defineAction,defineCreateInterfaceObjectAction,defineCreateObjectAction,defineCreateOrModifyObjectAction,defineDeleteObjectAction,defineModifyInterfaceObjectAction,defineModifyObjectAction}from"./defineAction.js";import{importSharedPropertyType}from"./defineImportSpt.js";import{defineInterface}from"./defineInterface.js";import{defineInterfaceLinkConstraint}from"./defineInterfaceLinkConstraint.js";import{defineLink}from"./defineLink.js";import{defineObject}from"./defineObject.js";import{defineOntology,dumpOntologyFullMetadata,dumpValueTypeWireType}from"./defineOntology.js";import{defineSharedPropertyType}from"./defineSpt.js";import{defineValueType}from"./defineValueType.js";import{importOntologyEntity}from"./importOntologyEntity.js";import{CREATE_OR_MODIFY_OBJECT_PARAMETER,MODIFY_OBJECT_PARAMETER,OntologyEntityTypeEnum}from"./types.js";describe("Ontology Defining",()=>{beforeEach(async()=>{await defineOntology("com.palantir.",()=>{},"/tmp/");});describe("ValueTypes",()=>{it("Fails to define value type with incorrect semver",()=>{expect(()=>defineValueType({apiName:"apiName",displayName:"displayName",type:{"type":"boolean",constraints:[{constraint:{"allowedValues":["TRUE_VALUE"]}}]},version:"not a version"})).toThrowErrorMatchingInlineSnapshot("[Error: Invariant failed: Version is not a valid semver]");});it("Tests convertProperty function with valueType constraints for string",()=>{const testStringValueType=defineValueType({apiName:"stringWithConstraints",displayName:"String With Constraints",description:"A string type with additional constraints",type:{"type":"string",constraints:[{constraint:{type:"length",length:{minSize:5,maxSize:20}},failureMessage:{message:"String must be between 5 and 20 characters"}}]},version:"1.0.0"});defineObject({titlePropertyApiName:"constrainedString",displayName:"Test Object",pluralDisplayName:"Test Objects",apiName:"testObject",primaryKeyPropertyApiName:"constrainedString",properties:{"constrainedString":{type:"string",displayName:"Constrained String",valueType:testStringValueType}}});const ontology=dumpOntologyFullMetadata();const objectPropertyType=ontology.ontology.objectTypes["com.palantir.testObject"].objectType.propertyTypes["constrainedString"];expect(objectPropertyType.valueType).toEqual({apiName:"stringWithConstraints",version:"1.0.0",packageNamespace:"com.palantir",displayMetadata:{displayName:"String With Constraints",description:"A string type with additional constraints"}});expect(objectPropertyType.dataConstraints).toBeDefined();expect(objectPropertyType.dataConstraints?.propertyTypeConstraints).toHaveLength(1);const constraintWrapper=objectPropertyType.dataConstraints?.propertyTypeConstraints[0];expect(constraintWrapper?.constraints?.type).toBe("string");expect((constraintWrapper?.constraints).string.length.minSize).toBe(5);expect((constraintWrapper?.constraints).string.length.maxSize).toBe(20);expect(constraintWrapper?.failureMessage?.message).toBe("String must be between 5 and 20 characters");});it("Correctly serializes a value type",()=>{defineValueType({apiName:"apiName",displayName:"displayName",type:{"type":"boolean",constraints:[{constraint:{"allowedValues":["TRUE_VALUE"]}}]},version:"0.1.0"});expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`
16
+ {
17
+ "valueTypes": [
18
+ {
19
+ "metadata": {
20
+ "apiName": "apiName",
21
+ "displayMetadata": {
22
+ "description": "",
23
+ "displayName": "displayName",
24
+ },
25
+ "packageNamespace": "com.palantir",
26
+ "status": {
27
+ "active": {},
28
+ "type": "active",
29
+ },
30
+ },
31
+ "versions": [
32
+ {
33
+ "baseType": {
34
+ "boolean": {},
35
+ "type": "boolean",
36
+ },
37
+ "constraints": [
38
+ {
39
+ "constraint": {
40
+ "constraint": {
41
+ "boolean": {
42
+ "allowedValues": [
43
+ "TRUE_VALUE",
44
+ ],
45
+ },
46
+ "type": "boolean",
47
+ },
48
+ "failureMessage": undefined,
49
+ },
50
+ },
51
+ ],
52
+ "exampleValues": [],
53
+ "version": "0.1.0",
54
+ },
55
+ ],
56
+ },
57
+ ],
58
+ }
59
+ `);});// N.B Not sure what this is for but I don't want to break anything so I added the eslint ignore
59
60
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
60
- defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it("doesn't let you define the same interface twice",()=>{defineInterface({apiName:"Foo"});expect(()=>{defineInterface({apiName:"Foo"});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Interface com.palantir.Foo already exists]`);});it("defaults displayName to apiName",()=>{const result=defineInterface({apiName:"Foo"});expect(result.displayMetadata.displayName).toBe("Foo");});it("defaults description to displayName",()=>{const result=defineInterface({apiName:"Foo",displayName:"d"});expect(result.displayMetadata.description).toBe("d");});it("defaults description to displayName to apiName",()=>{const result=defineInterface({apiName:"Foo"});expect(result.displayMetadata.description).toBe("Foo");});describe("auto spts",()=>{it("auto creates spts",()=>{defineInterface({apiName:"Foo",properties:{foo:"string"}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
61
+ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it("doesn't let you define the same interface twice",()=>{defineInterface({apiName:"Foo"});expect(()=>{defineInterface({apiName:"Foo"});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Interface com.palantir.Foo already exists]`);});it("defaults displayName to apiName",()=>{const result=defineInterface({apiName:"Foo"});expect(result.displayMetadata.displayName).toBe("Foo");});it("defaults description to displayName",()=>{const result=defineInterface({apiName:"Foo",displayName:"d"});expect(result.displayMetadata.description).toBe("d");});it("defaults description to displayName to apiName",()=>{const result=defineInterface({apiName:"Foo"});expect(result.displayMetadata.description).toBe("Foo");});describe("auto spts",()=>{it("auto creates spts",()=>{defineInterface({apiName:"Foo",properties:{foo:"string"}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
61
62
  {
62
63
  "actionTypes": {},
63
64
  "blockPermissionInformation": {
@@ -72,7 +73,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
72
73
  "displayMetadata": {
73
74
  "description": "Foo",
74
75
  "displayName": "Foo",
75
- "icon": undefined,
76
+ "icon": {
77
+ "blueprint": {
78
+ "color": "#4C90F0",
79
+ "locator": "layout-hierarchy",
80
+ },
81
+ "type": "blueprint",
82
+ },
76
83
  },
77
84
  "extendsInterfaces": [],
78
85
  "links": [],
@@ -166,7 +173,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
166
173
  },
167
174
  },
168
175
  }
169
- `);});it("does not let you conflict spts",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
176
+ `);});it("does not let you conflict spts",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
170
177
  {
171
178
  "actionTypes": {},
172
179
  "blockPermissionInformation": {
@@ -216,7 +223,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
216
223
  },
217
224
  },
218
225
  }
219
- `);expect(()=>{defineInterface({apiName:"Foo",properties:{foo:"string"}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);});});it("allows extends interfaces with InterfaceType provided",()=>{const parentInterface=defineInterface({apiName:"parentInterface",properties:{property1:"string"}});defineInterface({apiName:"childInterface",properties:{property2:"string"},extends:[parentInterface]});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
226
+ `);expect(()=>{defineInterface({apiName:"Foo",properties:{foo:"string"}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);});});it("allows extends interfaces with InterfaceType provided",()=>{const parentInterface=defineInterface({apiName:"parentInterface",properties:{property1:"string"}});defineInterface({apiName:"childInterface",properties:{property2:"string"},extends:[parentInterface]});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
220
227
  {
221
228
  "actionTypes": {},
222
229
  "blockPermissionInformation": {
@@ -231,7 +238,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
231
238
  "displayMetadata": {
232
239
  "description": "childInterface",
233
240
  "displayName": "childInterface",
234
- "icon": undefined,
241
+ "icon": {
242
+ "blueprint": {
243
+ "color": "#4C90F0",
244
+ "locator": "layout-hierarchy",
245
+ },
246
+ "type": "blueprint",
247
+ },
235
248
  },
236
249
  "extendsInterfaces": [
237
250
  "com.palantir.parentInterface",
@@ -291,7 +304,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
291
304
  "displayMetadata": {
292
305
  "description": "parentInterface",
293
306
  "displayName": "parentInterface",
294
- "icon": undefined,
307
+ "icon": {
308
+ "blueprint": {
309
+ "color": "#4C90F0",
310
+ "locator": "layout-hierarchy",
311
+ },
312
+ "type": "blueprint",
313
+ },
295
314
  },
296
315
  "extendsInterfaces": [],
297
316
  "links": [],
@@ -421,7 +440,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
421
440
  },
422
441
  },
423
442
  }
424
- `);});it("supports optional properties",()=>{defineInterface({apiName:"parentInterface",properties:{property1:{required:false,propertyDefinition:"string"}}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
443
+ `);});it("supports optional properties",()=>{defineInterface({apiName:"parentInterface",properties:{property1:{required:false,propertyDefinition:"string"}}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
425
444
  {
426
445
  "actionTypes": {},
427
446
  "blockPermissionInformation": {
@@ -436,7 +455,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
436
455
  "displayMetadata": {
437
456
  "description": "parentInterface",
438
457
  "displayName": "parentInterface",
439
- "icon": undefined,
458
+ "icon": {
459
+ "blueprint": {
460
+ "color": "#4C90F0",
461
+ "locator": "layout-hierarchy",
462
+ },
463
+ "type": "blueprint",
464
+ },
440
465
  },
441
466
  "extendsInterfaces": [],
442
467
  "links": [],
@@ -530,7 +555,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
530
555
  },
531
556
  },
532
557
  }
533
- `);});it("allows extends interfaces with apiName provided",()=>{const parentInterface=defineInterface({apiName:"parentInterface",properties:{property1:"string"}});defineInterface({apiName:"childInterface",properties:{property2:"string"},extends:parentInterface});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
558
+ `);});it("allows extends interfaces with apiName provided",()=>{const parentInterface=defineInterface({apiName:"parentInterface",properties:{property1:"string"}});defineInterface({apiName:"childInterface",properties:{property2:"string"},extends:parentInterface});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
534
559
  {
535
560
  "actionTypes": {},
536
561
  "blockPermissionInformation": {
@@ -545,7 +570,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
545
570
  "displayMetadata": {
546
571
  "description": "childInterface",
547
572
  "displayName": "childInterface",
548
- "icon": undefined,
573
+ "icon": {
574
+ "blueprint": {
575
+ "color": "#4C90F0",
576
+ "locator": "layout-hierarchy",
577
+ },
578
+ "type": "blueprint",
579
+ },
549
580
  },
550
581
  "extendsInterfaces": [
551
582
  "com.palantir.parentInterface",
@@ -605,7 +636,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
605
636
  "displayMetadata": {
606
637
  "description": "parentInterface",
607
638
  "displayName": "parentInterface",
608
- "icon": undefined,
639
+ "icon": {
640
+ "blueprint": {
641
+ "color": "#4C90F0",
642
+ "locator": "layout-hierarchy",
643
+ },
644
+ "type": "blueprint",
645
+ },
609
646
  },
610
647
  "extendsInterfaces": [],
611
648
  "links": [],
@@ -735,7 +772,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
735
772
  },
736
773
  },
737
774
  }
738
- `);});it("supports specifying searchable",()=>{defineInterface({apiName:"parentInterface",searchable:false});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
775
+ `);});it("supports specifying searchable",()=>{defineInterface({apiName:"parentInterface",searchable:false});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
739
776
  {
740
777
  "actionTypes": {},
741
778
  "blockPermissionInformation": {
@@ -750,7 +787,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
750
787
  "displayMetadata": {
751
788
  "description": "parentInterface",
752
789
  "displayName": "parentInterface",
753
- "icon": undefined,
790
+ "icon": {
791
+ "blueprint": {
792
+ "color": "#4C90F0",
793
+ "locator": "layout-hierarchy",
794
+ },
795
+ "type": "blueprint",
796
+ },
754
797
  },
755
798
  "extendsInterfaces": [],
756
799
  "links": [],
@@ -769,7 +812,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
769
812
  "objectTypes": {},
770
813
  "sharedPropertyTypes": {},
771
814
  }
772
- `);});});describe("ILTs",()=>{let a;let b;beforeEach(()=>{a=defineInterface({apiName:"A"});b=defineInterface({apiName:"B"});});it("single link works",()=>{expect(a).not.toBeUndefined();defineInterfaceLinkConstraint({from:a,toOne:b,apiName:"singleLink"});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
815
+ `);});});describe("ILTs",()=>{let a;let b;beforeEach(()=>{a=defineInterface({apiName:"A"});b=defineInterface({apiName:"B"});});it("single link works",()=>{expect(a).not.toBeUndefined();defineInterfaceLinkConstraint({from:a,toOne:b,apiName:"singleLink"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
773
816
  {
774
817
  "actionTypes": {},
775
818
  "blockPermissionInformation": {
@@ -784,7 +827,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
784
827
  "displayMetadata": {
785
828
  "description": "A",
786
829
  "displayName": "A",
787
- "icon": undefined,
830
+ "icon": {
831
+ "blueprint": {
832
+ "color": "#4C90F0",
833
+ "locator": "layout-hierarchy",
834
+ },
835
+ "type": "blueprint",
836
+ },
788
837
  },
789
838
  "extendsInterfaces": [],
790
839
  "links": [
@@ -818,7 +867,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
818
867
  "displayMetadata": {
819
868
  "description": "B",
820
869
  "displayName": "B",
821
- "icon": undefined,
870
+ "icon": {
871
+ "blueprint": {
872
+ "color": "#4C90F0",
873
+ "locator": "layout-hierarchy",
874
+ },
875
+ "type": "blueprint",
876
+ },
822
877
  },
823
878
  "extendsInterfaces": [],
824
879
  "links": [],
@@ -837,7 +892,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
837
892
  "objectTypes": {},
838
893
  "sharedPropertyTypes": {},
839
894
  }
840
- `);});it("many link works",()=>{defineInterfaceLinkConstraint({from:a,toMany:b,apiName:"manyLink"});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
895
+ `);});it("many link works",()=>{defineInterfaceLinkConstraint({from:a,toMany:b,apiName:"manyLink"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
841
896
  {
842
897
  "actionTypes": {},
843
898
  "blockPermissionInformation": {
@@ -852,7 +907,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
852
907
  "displayMetadata": {
853
908
  "description": "A",
854
909
  "displayName": "A",
855
- "icon": undefined,
910
+ "icon": {
911
+ "blueprint": {
912
+ "color": "#4C90F0",
913
+ "locator": "layout-hierarchy",
914
+ },
915
+ "type": "blueprint",
916
+ },
856
917
  },
857
918
  "extendsInterfaces": [],
858
919
  "links": [
@@ -886,7 +947,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
886
947
  "displayMetadata": {
887
948
  "description": "B",
888
949
  "displayName": "B",
889
- "icon": undefined,
950
+ "icon": {
951
+ "blueprint": {
952
+ "color": "#4C90F0",
953
+ "locator": "layout-hierarchy",
954
+ },
955
+ "type": "blueprint",
956
+ },
890
957
  },
891
958
  "extendsInterfaces": [],
892
959
  "links": [],
@@ -905,7 +972,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
905
972
  "objectTypes": {},
906
973
  "sharedPropertyTypes": {},
907
974
  }
908
- `);});});describe("SPTs",()=>{it("doesn't let you create the same spt twice",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(()=>{defineSharedPropertyType({apiName:"foo",type:"string"});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);});});it("uses a predefined spt",()=>{const fooSpt=defineSharedPropertyType({apiName:"fooSpt",type:"string"});defineInterface({apiName:"FooInterface",displayName:"Foo Interface",properties:{fooSpt},icon:{color:"#00000",locator:"airplane"}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
975
+ `);});});describe("SPTs",()=>{it("doesn't let you create the same spt twice",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(()=>{defineSharedPropertyType({apiName:"foo",type:"string"});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);});});it("uses a predefined spt",()=>{const fooSpt=defineSharedPropertyType({apiName:"fooSpt",type:"string"});defineInterface({apiName:"FooInterface",displayName:"Foo Interface",properties:{fooSpt},icon:{color:"#00000",locator:"airplane"}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
909
976
  {
910
977
  "actionTypes": {},
911
978
  "blockPermissionInformation": {
@@ -1020,7 +1087,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1020
1087
  },
1021
1088
  },
1022
1089
  }
1023
- `);});it("properly serializes both types of struct SPTs",()=>{defineSharedPropertyType({apiName:"fooSpt",type:{type:"struct",structDefinition:{"simpleProperty":"boolean","complexProperty":{fieldType:"date",displayMetadata:{displayName:"complex property",description:undefined}}}}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1090
+ `);});it("properly serializes both types of struct SPTs",()=>{defineSharedPropertyType({apiName:"fooSpt",type:{type:"struct",structDefinition:{"simpleProperty":"boolean","complexProperty":{fieldType:"date",displayMetadata:{displayName:"complex property",description:undefined}}}}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1024
1091
  {
1025
1092
  "actionTypes": {},
1026
1093
  "blockPermissionInformation": {
@@ -1084,7 +1151,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1084
1151
  },
1085
1152
  },
1086
1153
  }
1087
- `);});it("Custom string fields properly set",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:{type:"string",isLongText:true,supportsEfficientLeadingWildcard:true,supportsExactMatching:false}});defineInterface({apiName:"interface",properties:{foo:spt}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1154
+ `);});it("Custom string fields properly set",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:{type:"string",isLongText:true,supportsEfficientLeadingWildcard:true,supportsExactMatching:false}});defineInterface({apiName:"interface",properties:{foo:spt}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1088
1155
  {
1089
1156
  "actionTypes": {},
1090
1157
  "blockPermissionInformation": {
@@ -1099,7 +1166,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1099
1166
  "displayMetadata": {
1100
1167
  "description": "interface",
1101
1168
  "displayName": "interface",
1102
- "icon": undefined,
1169
+ "icon": {
1170
+ "blueprint": {
1171
+ "color": "#4C90F0",
1172
+ "locator": "layout-hierarchy",
1173
+ },
1174
+ "type": "blueprint",
1175
+ },
1103
1176
  },
1104
1177
  "extendsInterfaces": [],
1105
1178
  "links": [],
@@ -1193,7 +1266,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1193
1266
  },
1194
1267
  },
1195
1268
  }
1196
- `);});it("defaults interface status to active",()=>{const result=defineInterface({apiName:"Foo"});expect(result.status).toEqual({type:"active",active:{}});});it("sets interface status as experimental from opts",()=>{const result=defineInterface({apiName:"Foo",status:{type:"experimental"}});expect(result.status).toEqual({type:"experimental",experimental:{}});});it("sets interface status as deprecated from opts",()=>{const result=defineInterface({apiName:"Foo",status:{type:"deprecated",message:"foo",deadline:"foo"}});expect(result.status).toEqual({type:"deprecated",deprecated:{message:"foo",deadline:"foo"}});});describe("Objects",()=>{it("Fails if any property reference does not exist",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:"string"});const sample=defineInterface({apiName:"interface",properties:{foo:spt}});expect(()=>{defineObject({titlePropertyApiName:"fizz",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Title property fizz is not defined on object foo]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"fizz",properties:{"bar":{type:"string"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key property fizz does not exist on object foo]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"com.palantir.foo",mapsTo:"fizz"}]}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Object property mapped to interface does not exist. Object Property Mapped: fizz\n]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"com.palantir.fizz",mapsTo:"bar"},{interfaceProperty:"com.palantir.foo",mapsTo:"bar"}]}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Interface property com.palantir.fizz referenced in foo object does not exist\n]`);});it("Objects properly defined",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:"string"});const sample=defineInterface({apiName:"interface",properties:{foo:spt}});defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string",displayName:"Bar"},"arrayProp":{type:"string",array:true,displayName:"Array Property Test"},"geopoint":{type:{type:"struct",structDefinition:{lat:"double",lng:"double"}},displayName:"geopoint"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"foo",mapsTo:"bar"}]}]});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1269
+ `);});it("defaults interface status to active",()=>{const result=defineInterface({apiName:"Foo"});expect(result.status).toEqual({type:"active",active:{}});});it("sets interface status as experimental from opts",()=>{const result=defineInterface({apiName:"Foo",status:{type:"experimental"}});expect(result.status).toEqual({type:"experimental",experimental:{}});});it("sets interface status as deprecated from opts",()=>{const result=defineInterface({apiName:"Foo",status:{type:"deprecated",message:"foo",deadline:"foo"}});expect(result.status).toEqual({type:"deprecated",deprecated:{message:"foo",deadline:"foo"}});});describe("Objects",()=>{it("Fails if the api name is invalid",()=>{expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo_with_underscores",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Invalid API name foo_with_underscores. API names must match the regex /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/.]`);});it("Fails if any property reference does not exist",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:"string"});const sample=defineInterface({apiName:"interface",properties:{foo:spt}});expect(()=>{defineObject({titlePropertyApiName:"fizz",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Title property fizz is not defined on object foo]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"fizz",properties:{"bar":{type:"string"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key property fizz does not exist on object foo]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"com.palantir.foo",mapsTo:"fizz"}]}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Object property mapped to interface does not exist. Object Property Mapped: fizz\n]`);expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"com.palantir.fizz",mapsTo:"bar"},{interfaceProperty:"com.palantir.foo",mapsTo:"bar"}]}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Interface property com.palantir.fizz referenced in foo object does not exist\n]`);});it("Objects properly defined",()=>{const spt=defineSharedPropertyType({apiName:"foo",type:"string"});const sample=defineInterface({apiName:"interface",properties:{foo:spt}});defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string",displayName:"Bar"},"arrayProp":{type:"string",array:true,displayName:"Array Property Test"},"geopoint":{type:{type:"struct",structDefinition:{lat:"double",lng:"double"}},displayName:"geopoint"}},implementsInterfaces:[{implements:sample,propertyMapping:[{interfaceProperty:"foo",mapsTo:"bar"}]}]});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1197
1270
  {
1198
1271
  "actionTypes": {},
1199
1272
  "blockPermissionInformation": {
@@ -1208,7 +1281,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1208
1281
  "displayMetadata": {
1209
1282
  "description": "interface",
1210
1283
  "displayName": "interface",
1211
- "icon": undefined,
1284
+ "icon": {
1285
+ "blueprint": {
1286
+ "color": "#4C90F0",
1287
+ "locator": "layout-hierarchy",
1288
+ },
1289
+ "type": "blueprint",
1290
+ },
1212
1291
  },
1213
1292
  "extendsInterfaces": [],
1214
1293
  "links": [],
@@ -1529,7 +1608,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1529
1608
  },
1530
1609
  },
1531
1610
  }
1532
- `);});it("One To Many Links are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",one:{object:object,metadata:{apiName:"fizzes",displayName:"Foo",pluralDisplayName:"Foos"}},toMany:{object:otherObject,metadata:{displayName:"Fizz",pluralDisplayName:"Fizzes",apiName:"foos"}},manyForeignKeyProperty:"bar"});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1611
+ `);});it("One To Many Links are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",one:{object:object,metadata:{apiName:"fizzes",displayName:"Foo",pluralDisplayName:"Foos"}},toMany:{object:otherObject,metadata:{displayName:"Fizz",pluralDisplayName:"Fizzes",apiName:"foos"}},manyForeignKeyProperty:"bar"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1533
1612
  {
1534
1613
  "actionTypes": {},
1535
1614
  "blockPermissionInformation": {
@@ -1834,7 +1913,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
1834
1913
  },
1835
1914
  "sharedPropertyTypes": {},
1836
1915
  }
1837
- `);});it("Many To Many Links are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",many:{object:object,metadata:{displayName:"Foo",pluralDisplayName:"Foos",apiName:"fizzes"}},toMany:{object:otherObject,metadata:{displayName:"Fizz",pluralDisplayName:"Fizzes",apiName:"foos"}}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1916
+ `);});it("Many To Many Links are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",many:{object:object,metadata:{displayName:"Foo",pluralDisplayName:"Foos",apiName:"fizzes"}},toMany:{object:otherObject,metadata:{displayName:"Fizz",pluralDisplayName:"Fizzes",apiName:"foos"}}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
1838
1917
  {
1839
1918
  "actionTypes": {},
1840
1919
  "blockPermissionInformation": {
@@ -2184,7 +2263,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
2184
2263
  },
2185
2264
  "sharedPropertyTypes": {},
2186
2265
  }
2187
- `);});it("Minimal link definitions are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",one:{object:object,metadata:{apiName:"fizzes"}},toMany:{object:otherObject,metadata:{apiName:"foos"}},manyForeignKeyProperty:"bar"});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
2266
+ `);});it("Minimal link definitions are properly defined",()=>{const object=defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}}});const otherObject=defineObject({titlePropertyApiName:"fizz",displayName:"Fizz",pluralDisplayName:"Fizz",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}}});defineLink({apiName:"fizzToFoo",one:{object:object,metadata:{apiName:"fizzes"}},toMany:{object:otherObject,metadata:{apiName:"foos"}},manyForeignKeyProperty:"bar"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
2188
2267
  {
2189
2268
  "actionTypes": {},
2190
2269
  "blockPermissionInformation": {
@@ -2489,7 +2568,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
2489
2568
  },
2490
2569
  "sharedPropertyTypes": {},
2491
2570
  }
2492
- `);});it("Explicit datasource definitions are properly defined",()=>{defineObject({titlePropertyApiName:"bar",displayName:"datasetBackedObject",pluralDisplayName:"datasetBackedObject",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},datasource:{type:"dataset"}});defineObject({titlePropertyApiName:"fizz",displayName:"streamBackedObjectNoRetention",pluralDisplayName:"streamBackedObjectNoRetention",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}},datasource:{type:"stream"}});defineObject({titlePropertyApiName:"buzz",displayName:"streamBackedObjectWithRetention",pluralDisplayName:"streamBackedObjectWithRetention",apiName:"buzz",primaryKeyPropertyApiName:"buzz",properties:{"buzz":{type:"string"}},datasource:{type:"stream",retentionPeriod:"PT1H"}});expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
2571
+ `);});it("Explicit datasource definitions are properly defined",()=>{defineObject({titlePropertyApiName:"bar",displayName:"datasetBackedObject",pluralDisplayName:"datasetBackedObject",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},datasource:{type:"dataset"}});defineObject({titlePropertyApiName:"fizz",displayName:"streamBackedObjectNoRetention",pluralDisplayName:"streamBackedObjectNoRetention",apiName:"fizz",primaryKeyPropertyApiName:"fizz",properties:{"fizz":{type:"string"},"bar":{type:"string"}},datasource:{type:"stream"}});defineObject({titlePropertyApiName:"buzz",displayName:"streamBackedObjectWithRetention",pluralDisplayName:"streamBackedObjectWithRetention",apiName:"buzz",primaryKeyPropertyApiName:"buzz",properties:{"buzz":{type:"string"}},datasource:{type:"stream",retentionPeriod:"PT1H"}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
2493
2572
  {
2494
2573
  "actionTypes": {},
2495
2574
  "blockPermissionInformation": {
@@ -2840,7 +2919,22 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
2840
2919
  }
2841
2920
  `);});it("Restricted view datasources are properly defined",()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},datasource:{type:"restrictedView"}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
2842
2921
  {
2843
- "blockData": {
2922
+ "importedOntology": {
2923
+ "actionTypes": {},
2924
+ "blockPermissionInformation": {
2925
+ "actionTypes": {},
2926
+ "linkTypes": {},
2927
+ "objectTypes": {},
2928
+ },
2929
+ "interfaceTypes": {},
2930
+ "linkTypes": {},
2931
+ "objectTypes": {},
2932
+ "sharedPropertyTypes": {},
2933
+ },
2934
+ "importedValueTypes": {
2935
+ "valueTypes": [],
2936
+ },
2937
+ "ontology": {
2844
2938
  "actionTypes": {},
2845
2939
  "blockPermissionInformation": {
2846
2940
  "actionTypes": {},
@@ -2949,17 +3043,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
2949
3043
  },
2950
3044
  "sharedPropertyTypes": {},
2951
3045
  },
2952
- "importedTypes": {
2953
- "actionTypes": [],
2954
- "interfaceTypes": [],
2955
- "linkTypes": [],
2956
- "objectTypes": [],
2957
- "sharedPropertyTypes": [],
3046
+ "valueTypes": {
3047
+ "valueTypes": [],
2958
3048
  },
2959
3049
  }
2960
3050
  `);});it("Edit only properties are properly defined",()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"fizz",properties:{"bar":{type:"string",editOnly:true},"fizz":{type:"string"}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
2961
3051
  {
2962
- "blockData": {
3052
+ "importedOntology": {
3053
+ "actionTypes": {},
3054
+ "blockPermissionInformation": {
3055
+ "actionTypes": {},
3056
+ "linkTypes": {},
3057
+ "objectTypes": {},
3058
+ },
3059
+ "interfaceTypes": {},
3060
+ "linkTypes": {},
3061
+ "objectTypes": {},
3062
+ "sharedPropertyTypes": {},
3063
+ },
3064
+ "importedValueTypes": {
3065
+ "valueTypes": [],
3066
+ },
3067
+ "ontology": {
2963
3068
  "actionTypes": {},
2964
3069
  "blockPermissionInformation": {
2965
3070
  "actionTypes": {},
@@ -3112,17 +3217,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
3112
3217
  },
3113
3218
  "sharedPropertyTypes": {},
3114
3219
  },
3115
- "importedTypes": {
3116
- "actionTypes": [],
3117
- "interfaceTypes": [],
3118
- "linkTypes": [],
3119
- "objectTypes": [],
3120
- "sharedPropertyTypes": [],
3220
+ "valueTypes": {
3221
+ "valueTypes": [],
3121
3222
  },
3122
3223
  }
3123
3224
  `);});it("Fails if edit only property is primary key",()=>{expect(()=>{defineObject({titlePropertyApiName:"bar",displayName:"Foo",pluralDisplayName:"Foo",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string",editOnly:true}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key property bar on object foo cannot be edit-only]`);});it("Fail if stream retention period is not ISO 8601 compliant",()=>{expect(()=>defineObject({titlePropertyApiName:"buzz",displayName:"streamBackedObjectWithRetention",pluralDisplayName:"streamBackedObjectWithRetention",apiName:"buzz",primaryKeyPropertyApiName:"buzz",properties:{"buzz":{type:"string"}},datasource:{type:"stream",retentionPeriod:"bad retention period string"}})).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Retention period "bad retention period string" on object "buzz" is not a valid ISO 8601 duration string]`);});it("Property-level datasources are properly defined",()=>{defineObject({titlePropertyApiName:"bar",displayName:"exampleObject",pluralDisplayName:"exampleObject",apiName:"fizz",primaryKeyPropertyApiName:"bar",properties:{"fizz":{type:"mediaReference"},"bar":{type:"string"}},datasource:{type:"stream"}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
3124
3225
  {
3125
- "blockData": {
3226
+ "importedOntology": {
3227
+ "actionTypes": {},
3228
+ "blockPermissionInformation": {
3229
+ "actionTypes": {},
3230
+ "linkTypes": {},
3231
+ "objectTypes": {},
3232
+ },
3233
+ "interfaceTypes": {},
3234
+ "linkTypes": {},
3235
+ "objectTypes": {},
3236
+ "sharedPropertyTypes": {},
3237
+ },
3238
+ "importedValueTypes": {
3239
+ "valueTypes": [],
3240
+ },
3241
+ "ontology": {
3126
3242
  "actionTypes": {},
3127
3243
  "blockPermissionInformation": {
3128
3244
  "actionTypes": {},
@@ -3276,17 +3392,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
3276
3392
  },
3277
3393
  "sharedPropertyTypes": {},
3278
3394
  },
3279
- "importedTypes": {
3280
- "actionTypes": [],
3281
- "interfaceTypes": [],
3282
- "linkTypes": [],
3283
- "objectTypes": [],
3284
- "sharedPropertyTypes": [],
3395
+ "valueTypes": {
3396
+ "valueTypes": [],
3285
3397
  },
3286
3398
  }
3287
- `);});});describe("Marking Constraints",()=>{it("supports marking constraints with CBAC type and markingInputGroupName",()=>{defineObject({titlePropertyApiName:"title",displayName:"Document",pluralDisplayName:"Documents",apiName:"document",primaryKeyPropertyApiName:"title",properties:{"title":{type:"string",displayName:"Title"},"classification":{type:{type:"marking",markingType:"CBAC",markingInputGroupName:"classificationGroup"},displayName:"Classification"}}});const ontology=dumpOntologyFullMetadata();const classificationConstraint=ontology.blockData.objectTypes["com.palantir.document"].datasources[0].dataSecurity?.classificationConstraint;expect(classificationConstraint.markingGroupName).toEqual("classificationGroup");});});describe("Actions",()=>{it("Interface actions are properly defined",()=>{defineAction({apiName:"foo",displayName:"exampleAction",status:"active",rules:[{type:"addInterfaceRule",addInterfaceRule:{interfaceApiName:"foo",objectTypeParameter:"param1",sharedPropertyValues:{}}}],parameters:[{id:"param1",displayName:"param1",type:"boolean",validation:{required:true,allowedValues:{type:"boolean"}}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
3399
+ `);});});describe("Marking Constraints",()=>{it("supports marking constraints with CBAC type and markingInputGroupName",()=>{defineObject({titlePropertyApiName:"title",displayName:"Document",pluralDisplayName:"Documents",apiName:"document",primaryKeyPropertyApiName:"title",properties:{"title":{type:"string",displayName:"Title"},"classification":{type:{type:"marking",markingType:"CBAC",markingInputGroupName:"classificationGroup"},displayName:"Classification"}}});const ontology=dumpOntologyFullMetadata();const classificationConstraint=ontology.ontology.objectTypes["com.palantir.document"].datasources[0].dataSecurity?.classificationConstraint;expect(classificationConstraint.markingGroupName).toEqual("classificationGroup");});});describe("Actions",()=>{it("Interface actions are properly defined",()=>{defineInterface({apiName:"foo",displayName:"foo",properties:{}});defineAction({apiName:"foo",displayName:"exampleAction",status:"active",rules:[{type:"addInterfaceRule",addInterfaceRule:{interfaceApiName:"foo",objectTypeParameter:"param1",sharedPropertyValues:{}}}],parameters:[{id:"param1",displayName:"param1",type:"boolean",validation:{required:true,allowedValues:{type:"boolean"}}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
3288
3400
  {
3289
- "blockData": {
3401
+ "importedOntology": {
3402
+ "actionTypes": {},
3403
+ "blockPermissionInformation": {
3404
+ "actionTypes": {},
3405
+ "linkTypes": {},
3406
+ "objectTypes": {},
3407
+ },
3408
+ "interfaceTypes": {},
3409
+ "linkTypes": {},
3410
+ "objectTypes": {},
3411
+ "sharedPropertyTypes": {},
3412
+ },
3413
+ "importedValueTypes": {
3414
+ "valueTypes": [],
3415
+ },
3416
+ "ontology": {
3290
3417
  "actionTypes": {
3291
3418
  "com.palantir.foo": {
3292
3419
  "actionType": {
@@ -3417,22 +3544,60 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
3417
3544
  "linkTypes": {},
3418
3545
  "objectTypes": {},
3419
3546
  },
3420
- "interfaceTypes": {},
3547
+ "interfaceTypes": {
3548
+ "com.palantir.foo": {
3549
+ "interfaceType": {
3550
+ "apiName": "com.palantir.foo",
3551
+ "displayMetadata": {
3552
+ "description": "foo",
3553
+ "displayName": "foo",
3554
+ "icon": {
3555
+ "blueprint": {
3556
+ "color": "#4C90F0",
3557
+ "locator": "layout-hierarchy",
3558
+ },
3559
+ "type": "blueprint",
3560
+ },
3561
+ },
3562
+ "extendsInterfaces": [],
3563
+ "links": [],
3564
+ "properties": [],
3565
+ "propertiesV2": {},
3566
+ "propertiesV3": {},
3567
+ "searchable": true,
3568
+ "status": {
3569
+ "active": {},
3570
+ "type": "active",
3571
+ },
3572
+ },
3573
+ },
3574
+ },
3421
3575
  "linkTypes": {},
3422
3576
  "objectTypes": {},
3423
3577
  "sharedPropertyTypes": {},
3424
3578
  },
3425
- "importedTypes": {
3426
- "actionTypes": [],
3427
- "interfaceTypes": [],
3428
- "linkTypes": [],
3429
- "objectTypes": [],
3430
- "sharedPropertyTypes": [],
3579
+ "valueTypes": {
3580
+ "valueTypes": [],
3431
3581
  },
3432
3582
  }
3433
- `);});it("Simple interface actions (with object types) are properly defined",()=>{const exampleStructPropertyType=defineSharedPropertyType({apiName:"property2",type:{type:"struct",structDefinition:{simpleProperty:"string"}}});const mySpt=defineSharedPropertyType({apiName:"mySpt",type:"string"});const exampleInterface=defineInterface({apiName:"exampleInterface",properties:{mySpt,property1:"string",property2:exampleStructPropertyType}});const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"},"property1":{type:"string"},"property2":{type:{type:"struct",structDefinition:{simpleProperty:"string"}}}},implementsInterfaces:[{implements:exampleInterface,propertyMapping:[{interfaceProperty:"com.palantir.mySpt",mapsTo:"bar"},{interfaceProperty:"com.palantir.property1",mapsTo:"property1"},{interfaceProperty:"com.palantir.property2",mapsTo:"property2"}]}]});defineCreateInterfaceObjectAction(exampleInterface,exampleObjectType);defineModifyInterfaceObjectAction(exampleInterface,exampleObjectType);expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
3583
+ `);});it("Simple interface actions (with object types) are properly defined",()=>{const exampleStructPropertyType=defineSharedPropertyType({apiName:"property2",type:{type:"struct",structDefinition:{simpleProperty:"string"}}});const mySpt=defineSharedPropertyType({apiName:"mySpt",type:"string"});const exampleInterface=defineInterface({apiName:"exampleInterface",icon:{color:"#c7cdd6ff",locator:"globe"},properties:{mySpt,property1:"string",property2:exampleStructPropertyType}});const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"},"property1":{type:"string"},"property2":{type:{type:"struct",structDefinition:{simpleProperty:"string"}}}},implementsInterfaces:[{implements:exampleInterface,propertyMapping:[{interfaceProperty:"com.palantir.mySpt",mapsTo:"bar"},{interfaceProperty:"com.palantir.property1",mapsTo:"property1"},{interfaceProperty:"com.palantir.property2",mapsTo:"property2"}]}]});defineCreateInterfaceObjectAction(exampleInterface,exampleObjectType);defineModifyInterfaceObjectAction(exampleInterface,exampleObjectType);expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
3434
3584
  {
3435
- "blockData": {
3585
+ "importedOntology": {
3586
+ "actionTypes": {},
3587
+ "blockPermissionInformation": {
3588
+ "actionTypes": {},
3589
+ "linkTypes": {},
3590
+ "objectTypes": {},
3591
+ },
3592
+ "interfaceTypes": {},
3593
+ "linkTypes": {},
3594
+ "objectTypes": {},
3595
+ "sharedPropertyTypes": {},
3596
+ },
3597
+ "importedValueTypes": {
3598
+ "valueTypes": [],
3599
+ },
3600
+ "ontology": {
3436
3601
  "actionTypes": {
3437
3602
  "com.palantir.create-example-interface-foo": {
3438
3603
  "actionType": {
@@ -3914,7 +4079,13 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
3914
4079
  "displayMetadata": {
3915
4080
  "description": "exampleInterface",
3916
4081
  "displayName": "exampleInterface",
3917
- "icon": undefined,
4082
+ "icon": {
4083
+ "blueprint": {
4084
+ "color": "#c7cdd6ff",
4085
+ "locator": "globe",
4086
+ },
4087
+ "type": "blueprint",
4088
+ },
3918
4089
  },
3919
4090
  "extendsInterfaces": [],
3920
4091
  "links": [],
@@ -4385,17 +4556,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4385
4556
  },
4386
4557
  },
4387
4558
  },
4388
- "importedTypes": {
4389
- "actionTypes": [],
4390
- "interfaceTypes": [],
4391
- "linkTypes": [],
4392
- "objectTypes": [],
4393
- "sharedPropertyTypes": [],
4559
+ "valueTypes": {
4560
+ "valueTypes": [],
4394
4561
  },
4395
4562
  }
4396
4563
  `);});it("Concrete actions are properly defined",()=>{defineAction({apiName:"foo",displayName:"exampleAction",status:"active",rules:[{type:"addOrModifyObjectRuleV2",addOrModifyObjectRuleV2:{objectToModify:"objectToModifyParameter",propertyValues:{"bar":{type:"parameterId",parameterId:"param1"}},structFieldValues:{}}}],parameters:[{id:"param1",displayName:"param1",type:"boolean",validation:{required:true,allowedValues:{type:"boolean"}}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
4397
4564
  {
4398
- "blockData": {
4565
+ "importedOntology": {
4566
+ "actionTypes": {},
4567
+ "blockPermissionInformation": {
4568
+ "actionTypes": {},
4569
+ "linkTypes": {},
4570
+ "objectTypes": {},
4571
+ },
4572
+ "interfaceTypes": {},
4573
+ "linkTypes": {},
4574
+ "objectTypes": {},
4575
+ "sharedPropertyTypes": {},
4576
+ },
4577
+ "importedValueTypes": {
4578
+ "valueTypes": [],
4579
+ },
4580
+ "ontology": {
4399
4581
  "actionTypes": {
4400
4582
  "com.palantir.foo": {
4401
4583
  "actionType": {
@@ -4536,17 +4718,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4536
4718
  "objectTypes": {},
4537
4719
  "sharedPropertyTypes": {},
4538
4720
  },
4539
- "importedTypes": {
4540
- "actionTypes": [],
4541
- "interfaceTypes": [],
4542
- "linkTypes": [],
4543
- "objectTypes": [],
4544
- "sharedPropertyTypes": [],
4721
+ "valueTypes": {
4722
+ "valueTypes": [],
4545
4723
  },
4546
4724
  }
4547
4725
  `);});it("Conditional overrides on actions are properly defined",()=>{defineAction({apiName:"foo",displayName:"exampleAction",status:"active",rules:[{type:"modifyObjectRule",modifyObjectRule:{objectToModify:"objectToModifyParameter",propertyValues:{"bar":{type:"parameterId",parameterId:"param1"}},structFieldValues:{}}}],parameters:[{id:"param1",displayName:"param1",type:"boolean",validation:{required:true,allowedValues:{type:"boolean"},defaultVisibility:"editable",conditionalOverrides:[{type:"visibility",condition:{type:"group",name:"myGroup"}}]}},{id:"objectToModifyParameter",displayName:"objectToModifyParameter",type:"objectTypeReference",validation:{required:true,allowedValues:{type:"objectTypeReference",interfaceTypes:[]},defaultVisibility:"editable"}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
4548
4726
  {
4549
- "blockData": {
4727
+ "importedOntology": {
4728
+ "actionTypes": {},
4729
+ "blockPermissionInformation": {
4730
+ "actionTypes": {},
4731
+ "linkTypes": {},
4732
+ "objectTypes": {},
4733
+ },
4734
+ "interfaceTypes": {},
4735
+ "linkTypes": {},
4736
+ "objectTypes": {},
4737
+ "sharedPropertyTypes": {},
4738
+ },
4739
+ "importedValueTypes": {
4740
+ "valueTypes": [],
4741
+ },
4742
+ "ontology": {
4550
4743
  "actionTypes": {
4551
4744
  "com.palantir.foo": {
4552
4745
  "actionType": {
@@ -4774,17 +4967,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4774
4967
  "objectTypes": {},
4775
4968
  "sharedPropertyTypes": {},
4776
4969
  },
4777
- "importedTypes": {
4778
- "actionTypes": [],
4779
- "interfaceTypes": [],
4780
- "linkTypes": [],
4781
- "objectTypes": [],
4782
- "sharedPropertyTypes": [],
4970
+ "valueTypes": {
4971
+ "valueTypes": [],
4783
4972
  },
4784
4973
  }
4785
- `);});it("Simple concrete actions are properly defined",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"},"structProp":{type:{type:"struct",structDefinition:{simpleProperty:"string"}}}}});defineCreateObjectAction({objectType:exampleObjectType});defineModifyObjectAction({objectType:exampleObjectType});defineDeleteObjectAction({objectType:exampleObjectType});defineCreateOrModifyObjectAction({objectType:exampleObjectType});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
4974
+ `);});it("Simple concrete actions are properly defined",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"},"structProp":{type:{type:"struct",structDefinition:{simpleProperty:"string"}}},"optionalProp":{type:"string"}}});defineCreateObjectAction({objectType:exampleObjectType});defineModifyObjectAction({objectType:exampleObjectType});defineDeleteObjectAction({objectType:exampleObjectType});defineCreateOrModifyObjectAction({objectType:exampleObjectType});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
4786
4975
  {
4787
- "blockData": {
4976
+ "importedOntology": {
4977
+ "actionTypes": {},
4978
+ "blockPermissionInformation": {
4979
+ "actionTypes": {},
4980
+ "linkTypes": {},
4981
+ "objectTypes": {},
4982
+ },
4983
+ "interfaceTypes": {},
4984
+ "linkTypes": {},
4985
+ "objectTypes": {},
4986
+ "sharedPropertyTypes": {},
4987
+ },
4988
+ "importedValueTypes": {
4989
+ "valueTypes": [],
4990
+ },
4991
+ "ontology": {
4788
4992
  "actionTypes": {
4789
4993
  "com.palantir.create-object-foo": {
4790
4994
  "actionType": {
@@ -4799,6 +5003,10 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4799
5003
  "parameterId": "bar",
4800
5004
  "type": "parameterId",
4801
5005
  },
5006
+ "optionalProp": {
5007
+ "parameterId": "optionalProp",
5008
+ "type": "parameterId",
5009
+ },
4802
5010
  },
4803
5011
  "structFieldValues": {},
4804
5012
  },
@@ -4844,8 +5052,36 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4844
5052
  "type": "text",
4845
5053
  },
4846
5054
  "required": {
4847
- "required": {},
4848
- "type": "required",
5055
+ "notRequired": {},
5056
+ "type": "notRequired",
5057
+ },
5058
+ },
5059
+ },
5060
+ },
5061
+ "optionalProp": {
5062
+ "conditionalOverrides": [],
5063
+ "defaultValidation": {
5064
+ "display": {
5065
+ "renderHint": {
5066
+ "textInput": {},
5067
+ "type": "textInput",
5068
+ },
5069
+ "visibility": {
5070
+ "editable": {},
5071
+ "type": "editable",
5072
+ },
5073
+ },
5074
+ "validation": {
5075
+ "allowedValues": {
5076
+ "text": {
5077
+ "text": {},
5078
+ "type": "text",
5079
+ },
5080
+ "type": "text",
5081
+ },
5082
+ "required": {
5083
+ "notRequired": {},
5084
+ "type": "notRequired",
4849
5085
  },
4850
5086
  },
4851
5087
  },
@@ -4893,6 +5129,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4893
5129
  "formContentOrdering": [],
4894
5130
  "parameterOrdering": [
4895
5131
  "bar",
5132
+ "optionalProp",
4896
5133
  ],
4897
5134
  "parameters": {
4898
5135
  "bar": {
@@ -4907,14 +5144,26 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4907
5144
  "type": "string",
4908
5145
  },
4909
5146
  },
4910
- },
4911
- "sections": {},
4912
- "status": {
4913
- "active": {},
4914
- "type": "active",
4915
- },
4916
- },
4917
- },
5147
+ "optionalProp": {
5148
+ "displayMetadata": {
5149
+ "description": "",
5150
+ "displayName": "OptionalProp",
5151
+ "typeClasses": [],
5152
+ },
5153
+ "id": "optionalProp",
5154
+ "type": {
5155
+ "string": {},
5156
+ "type": "string",
5157
+ },
5158
+ },
5159
+ },
5160
+ "sections": {},
5161
+ "status": {
5162
+ "active": {},
5163
+ "type": "active",
5164
+ },
5165
+ },
5166
+ },
4918
5167
  },
4919
5168
  "com.palantir.create-or-modify-foo": {
4920
5169
  "actionType": {
@@ -4924,7 +5173,12 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4924
5173
  {
4925
5174
  "addOrModifyObjectRuleV2": {
4926
5175
  "objectToModify": "objectToCreateOrModifyParameter",
4927
- "propertyValues": {},
5176
+ "propertyValues": {
5177
+ "optionalProp": {
5178
+ "parameterId": "optionalProp",
5179
+ "type": "parameterId",
5180
+ },
5181
+ },
4928
5182
  "structFieldValues": {},
4929
5183
  },
4930
5184
  "type": "addOrModifyObjectRuleV2",
@@ -4975,6 +5229,41 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
4975
5229
  },
4976
5230
  },
4977
5231
  },
5232
+ "optionalProp": {
5233
+ "conditionalOverrides": [],
5234
+ "defaultValidation": {
5235
+ "display": {
5236
+ "prefill": {
5237
+ "objectParameterPropertyValue": {
5238
+ "parameterId": "objectToCreateOrModifyParameter",
5239
+ "propertyTypeId": "optionalProp",
5240
+ },
5241
+ "type": "objectParameterPropertyValue",
5242
+ },
5243
+ "renderHint": {
5244
+ "textInput": {},
5245
+ "type": "textInput",
5246
+ },
5247
+ "visibility": {
5248
+ "editable": {},
5249
+ "type": "editable",
5250
+ },
5251
+ },
5252
+ "validation": {
5253
+ "allowedValues": {
5254
+ "text": {
5255
+ "text": {},
5256
+ "type": "text",
5257
+ },
5258
+ "type": "text",
5259
+ },
5260
+ "required": {
5261
+ "notRequired": {},
5262
+ "type": "notRequired",
5263
+ },
5264
+ },
5265
+ },
5266
+ },
4978
5267
  },
4979
5268
  "sectionValidations": {},
4980
5269
  },
@@ -5018,6 +5307,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5018
5307
  "formContentOrdering": [],
5019
5308
  "parameterOrdering": [
5020
5309
  "objectToCreateOrModifyParameter",
5310
+ "optionalProp",
5021
5311
  ],
5022
5312
  "parameters": {
5023
5313
  "objectToCreateOrModifyParameter": {
@@ -5038,6 +5328,18 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5038
5328
  "type": "objectReference",
5039
5329
  },
5040
5330
  },
5331
+ "optionalProp": {
5332
+ "displayMetadata": {
5333
+ "description": "",
5334
+ "displayName": "OptionalProp",
5335
+ "typeClasses": [],
5336
+ },
5337
+ "id": "optionalProp",
5338
+ "type": {
5339
+ "string": {},
5340
+ "type": "string",
5341
+ },
5342
+ },
5041
5343
  },
5042
5344
  "sections": {},
5043
5345
  "status": {
@@ -5180,7 +5482,12 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5180
5482
  {
5181
5483
  "modifyObjectRule": {
5182
5484
  "objectToModify": "objectToModifyParameter",
5183
- "propertyValues": {},
5485
+ "propertyValues": {
5486
+ "optionalProp": {
5487
+ "parameterId": "optionalProp",
5488
+ "type": "parameterId",
5489
+ },
5490
+ },
5184
5491
  "structFieldValues": {},
5185
5492
  },
5186
5493
  "type": "modifyObjectRule",
@@ -5231,6 +5538,41 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5231
5538
  },
5232
5539
  },
5233
5540
  },
5541
+ "optionalProp": {
5542
+ "conditionalOverrides": [],
5543
+ "defaultValidation": {
5544
+ "display": {
5545
+ "prefill": {
5546
+ "objectParameterPropertyValue": {
5547
+ "parameterId": "objectToModifyParameter",
5548
+ "propertyTypeId": "optionalProp",
5549
+ },
5550
+ "type": "objectParameterPropertyValue",
5551
+ },
5552
+ "renderHint": {
5553
+ "textInput": {},
5554
+ "type": "textInput",
5555
+ },
5556
+ "visibility": {
5557
+ "editable": {},
5558
+ "type": "editable",
5559
+ },
5560
+ },
5561
+ "validation": {
5562
+ "allowedValues": {
5563
+ "text": {
5564
+ "text": {},
5565
+ "type": "text",
5566
+ },
5567
+ "type": "text",
5568
+ },
5569
+ "required": {
5570
+ "notRequired": {},
5571
+ "type": "notRequired",
5572
+ },
5573
+ },
5574
+ },
5575
+ },
5234
5576
  },
5235
5577
  "sectionValidations": {},
5236
5578
  },
@@ -5274,6 +5616,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5274
5616
  "formContentOrdering": [],
5275
5617
  "parameterOrdering": [
5276
5618
  "objectToModifyParameter",
5619
+ "optionalProp",
5277
5620
  ],
5278
5621
  "parameters": {
5279
5622
  "objectToModifyParameter": {
@@ -5290,6 +5633,18 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5290
5633
  "type": "objectReference",
5291
5634
  },
5292
5635
  },
5636
+ "optionalProp": {
5637
+ "displayMetadata": {
5638
+ "description": "",
5639
+ "displayName": "OptionalProp",
5640
+ "typeClasses": [],
5641
+ },
5642
+ "id": "optionalProp",
5643
+ "type": {
5644
+ "string": {},
5645
+ "type": "string",
5646
+ },
5647
+ },
5293
5648
  },
5294
5649
  "sections": {},
5295
5650
  "status": {
@@ -5319,6 +5674,10 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5319
5674
  "column": "bar",
5320
5675
  "type": "column",
5321
5676
  },
5677
+ "optionalProp": {
5678
+ "column": "optionalProp",
5679
+ "type": "column",
5680
+ },
5322
5681
  "structProp": {
5323
5682
  "struct": {
5324
5683
  "column": "structProp",
@@ -5407,6 +5766,46 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5407
5766
  ],
5408
5767
  "valueType": undefined,
5409
5768
  },
5769
+ "optionalProp": {
5770
+ "apiName": "optionalProp",
5771
+ "baseFormatter": undefined,
5772
+ "dataConstraints": undefined,
5773
+ "displayMetadata": {
5774
+ "description": undefined,
5775
+ "displayName": "OptionalProp",
5776
+ "visibility": "NORMAL",
5777
+ },
5778
+ "indexedForSearch": true,
5779
+ "inlineAction": undefined,
5780
+ "ruleSetBinding": undefined,
5781
+ "sharedPropertyTypeApiName": undefined,
5782
+ "sharedPropertyTypeRid": undefined,
5783
+ "status": {
5784
+ "active": {},
5785
+ "type": "active",
5786
+ },
5787
+ "type": {
5788
+ "string": {
5789
+ "analyzerOverride": undefined,
5790
+ "enableAsciiFolding": undefined,
5791
+ "isLongText": false,
5792
+ "supportsEfficientLeadingWildcard": false,
5793
+ "supportsExactMatching": true,
5794
+ },
5795
+ "type": "string",
5796
+ },
5797
+ "typeClasses": [
5798
+ {
5799
+ "kind": "render_hint",
5800
+ "name": "SELECTABLE",
5801
+ },
5802
+ {
5803
+ "kind": "render_hint",
5804
+ "name": "SORTABLE",
5805
+ },
5806
+ ],
5807
+ "valueType": undefined,
5808
+ },
5410
5809
  "structProp": {
5411
5810
  "apiName": "structProp",
5412
5811
  "baseFormatter": undefined,
@@ -5466,17 +5865,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5466
5865
  },
5467
5866
  "sharedPropertyTypes": {},
5468
5867
  },
5469
- "importedTypes": {
5470
- "actionTypes": [],
5471
- "interfaceTypes": [],
5472
- "linkTypes": [],
5473
- "objectTypes": [],
5474
- "sharedPropertyTypes": [],
5868
+ "valueTypes": {
5869
+ "valueTypes": [],
5475
5870
  },
5476
5871
  }
5477
- `);});it("Customizations on CRUD actions are properly defined",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"primary",properties:{"bar":{type:"string"},"fizz":{type:"string"},"buzz":{type:"string"},"primary":{type:"string"}}});defineCreateObjectAction({objectType:exampleObjectType,actionLevelValidation:{condition:{type:"group",name:"actionLevelGroup"}},parameterOrdering:["bar","fizz","primary"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}}});defineModifyObjectAction({objectType:exampleObjectType,actionLevelValidation:{condition:{type:"group",name:"actionLevelGroup"}},parameterOrdering:["bar","fizz"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}}});defineCreateOrModifyObjectAction({objectType:exampleObjectType,actionLevelValidation:{condition:{type:"group",name:"actionLevelGroup"}},parameterOrdering:["bar","fizz"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}},primaryKeyOption:"userInput"});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
5872
+ `);});it("Customizations on CRUD actions are properly defined",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"primary",properties:{"bar":{type:"string"},"fizz":{type:"string"},"buzz":{type:"string"},"primary":{type:"string"}}});defineCreateObjectAction({objectType:exampleObjectType,actionLevelValidation:[{condition:{type:"group",name:"actionLevelGroup"}},{condition:{type:"group",name:"actionLevelGroup2"},displayMetadata:{failureMessage:"Different custom failure message",typeClasses:[]}}],parameterOrdering:["bar","fizz","primary"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}}});defineModifyObjectAction({objectType:exampleObjectType,actionLevelValidation:[{condition:{type:"group",name:"actionLevelGroup"}},{condition:{type:"group",name:"actionLevelGroup2"},displayMetadata:{failureMessage:"Different custom failure message",typeClasses:[]}}],parameterOrdering:["bar","fizz"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}}});defineCreateOrModifyObjectAction({objectType:exampleObjectType,actionLevelValidation:[{condition:{type:"group",name:"actionLevelGroup"}},{condition:{type:"group",name:"actionLevelGroup2"},displayMetadata:{failureMessage:"Different custom failure message",typeClasses:[]}}],parameterOrdering:["bar","fizz"],parameterConfiguration:{"fizz":{required:false,conditionalOverrides:[{type:"required",condition:{type:"and",conditions:[{type:"group",name:"parameterLevelGroup"},{type:"parameter",parameterId:"bar",matches:{type:"staticValue",staticValue:{type:"string",string:"bar"}}}]}}],defaultValue:{type:"staticValue",staticValue:{type:"string",string:"default_fizz"}},displayName:"fizz_display",description:"fizz_description"}},excludedProperties:["buzz"],defaultFormat:"TABLE",enableLayoutSwitch:true,submissionMetadata:{successMessage:"Custom success message",undoButtonConfiguration:true,submitButtonDisplayMetadata:{intent:"DANGER",text:"Custom button"}},primaryKeyOption:"userInput"});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
5478
5873
  {
5479
- "blockData": {
5874
+ "importedOntology": {
5875
+ "actionTypes": {},
5876
+ "blockPermissionInformation": {
5877
+ "actionTypes": {},
5878
+ "linkTypes": {},
5879
+ "objectTypes": {},
5880
+ },
5881
+ "interfaceTypes": {},
5882
+ "linkTypes": {},
5883
+ "objectTypes": {},
5884
+ "sharedPropertyTypes": {},
5885
+ },
5886
+ "importedValueTypes": {
5887
+ "valueTypes": [],
5888
+ },
5889
+ "ontology": {
5480
5890
  "actionTypes": {
5481
5891
  "com.palantir.create-object-foo": {
5482
5892
  "actionType": {
@@ -5545,6 +5955,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5545
5955
  "typeClasses": [],
5546
5956
  },
5547
5957
  },
5958
+ "1": {
5959
+ "condition": {
5960
+ "comparison": {
5961
+ "left": {
5962
+ "type": "userProperty",
5963
+ "userProperty": {
5964
+ "propertyValue": {
5965
+ "groupIds": {},
5966
+ "type": "groupIds",
5967
+ },
5968
+ "userId": {
5969
+ "currentUser": {},
5970
+ "type": "currentUser",
5971
+ },
5972
+ },
5973
+ },
5974
+ "operator": "INTERSECTS",
5975
+ "right": {
5976
+ "staticValue": {
5977
+ "stringList": {
5978
+ "strings": [
5979
+ "actionLevelGroup2",
5980
+ ],
5981
+ },
5982
+ "type": "stringList",
5983
+ },
5984
+ "type": "staticValue",
5985
+ },
5986
+ },
5987
+ "type": "comparison",
5988
+ },
5989
+ "displayMetadata": {
5990
+ "failureMessage": "Different custom failure message",
5991
+ "typeClasses": [],
5992
+ },
5993
+ },
5548
5994
  },
5549
5995
  },
5550
5996
  "parameterValidations": {
@@ -5570,8 +6016,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5570
6016
  "type": "text",
5571
6017
  },
5572
6018
  "required": {
5573
- "required": {},
5574
- "type": "required",
6019
+ "notRequired": {},
6020
+ "type": "notRequired",
5575
6021
  },
5576
6022
  },
5577
6023
  },
@@ -5701,8 +6147,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5701
6147
  "type": "text",
5702
6148
  },
5703
6149
  "required": {
5704
- "required": {},
5705
- "type": "required",
6150
+ "notRequired": {},
6151
+ "type": "notRequired",
5706
6152
  },
5707
6153
  },
5708
6154
  },
@@ -5872,6 +6318,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
5872
6318
  "typeClasses": [],
5873
6319
  },
5874
6320
  },
6321
+ "1": {
6322
+ "condition": {
6323
+ "comparison": {
6324
+ "left": {
6325
+ "type": "userProperty",
6326
+ "userProperty": {
6327
+ "propertyValue": {
6328
+ "groupIds": {},
6329
+ "type": "groupIds",
6330
+ },
6331
+ "userId": {
6332
+ "currentUser": {},
6333
+ "type": "currentUser",
6334
+ },
6335
+ },
6336
+ },
6337
+ "operator": "INTERSECTS",
6338
+ "right": {
6339
+ "staticValue": {
6340
+ "stringList": {
6341
+ "strings": [
6342
+ "actionLevelGroup2",
6343
+ ],
6344
+ },
6345
+ "type": "stringList",
6346
+ },
6347
+ "type": "staticValue",
6348
+ },
6349
+ },
6350
+ "type": "comparison",
6351
+ },
6352
+ "displayMetadata": {
6353
+ "failureMessage": "Different custom failure message",
6354
+ "typeClasses": [],
6355
+ },
6356
+ },
5875
6357
  },
5876
6358
  },
5877
6359
  "parameterValidations": {
@@ -6212,6 +6694,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
6212
6694
  "typeClasses": [],
6213
6695
  },
6214
6696
  },
6697
+ "1": {
6698
+ "condition": {
6699
+ "comparison": {
6700
+ "left": {
6701
+ "type": "userProperty",
6702
+ "userProperty": {
6703
+ "propertyValue": {
6704
+ "groupIds": {},
6705
+ "type": "groupIds",
6706
+ },
6707
+ "userId": {
6708
+ "currentUser": {},
6709
+ "type": "currentUser",
6710
+ },
6711
+ },
6712
+ },
6713
+ "operator": "INTERSECTS",
6714
+ "right": {
6715
+ "staticValue": {
6716
+ "stringList": {
6717
+ "strings": [
6718
+ "actionLevelGroup2",
6719
+ ],
6720
+ },
6721
+ "type": "stringList",
6722
+ },
6723
+ "type": "staticValue",
6724
+ },
6725
+ },
6726
+ "type": "comparison",
6727
+ },
6728
+ "displayMetadata": {
6729
+ "failureMessage": "Different custom failure message",
6730
+ "typeClasses": [],
6731
+ },
6732
+ },
6215
6733
  },
6216
6734
  },
6217
6735
  "parameterValidations": {
@@ -6747,17 +7265,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
6747
7265
  },
6748
7266
  "sharedPropertyTypes": {},
6749
7267
  },
6750
- "importedTypes": {
6751
- "actionTypes": [],
6752
- "interfaceTypes": [],
6753
- "linkTypes": [],
6754
- "objectTypes": [],
6755
- "sharedPropertyTypes": [],
7268
+ "valueTypes": {
7269
+ "valueTypes": [],
6756
7270
  },
6757
7271
  }
6758
7272
  `);});it("Non-parameter mapped properties are properly defined",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"},"fizz":{type:"string"},"buzz":{type:"timestamp"}}});defineCreateObjectAction({objectType:exampleObjectType,nonParameterMappings:{"fizz":{type:"currentUser"},"buzz":{type:"currentTime"}}});defineModifyObjectAction({objectType:exampleObjectType,nonParameterMappings:{"fizz":{type:"currentUser"},"buzz":{type:"currentTime"}}});defineCreateOrModifyObjectAction({objectType:exampleObjectType,nonParameterMappings:{"fizz":{type:"currentUser"},"buzz":{type:"currentTime"}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
6759
7273
  {
6760
- "blockData": {
7274
+ "importedOntology": {
7275
+ "actionTypes": {},
7276
+ "blockPermissionInformation": {
7277
+ "actionTypes": {},
7278
+ "linkTypes": {},
7279
+ "objectTypes": {},
7280
+ },
7281
+ "interfaceTypes": {},
7282
+ "linkTypes": {},
7283
+ "objectTypes": {},
7284
+ "sharedPropertyTypes": {},
7285
+ },
7286
+ "importedValueTypes": {
7287
+ "valueTypes": [],
7288
+ },
7289
+ "ontology": {
6761
7290
  "actionTypes": {
6762
7291
  "com.palantir.create-object-foo": {
6763
7292
  "actionType": {
@@ -6825,8 +7354,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
6825
7354
  "type": "text",
6826
7355
  },
6827
7356
  "required": {
6828
- "required": {},
6829
- "type": "required",
7357
+ "notRequired": {},
7358
+ "type": "notRequired",
6830
7359
  },
6831
7360
  },
6832
7361
  },
@@ -7363,17 +7892,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
7363
7892
  },
7364
7893
  "sharedPropertyTypes": {},
7365
7894
  },
7366
- "importedTypes": {
7367
- "actionTypes": [],
7368
- "interfaceTypes": [],
7369
- "linkTypes": [],
7370
- "objectTypes": [],
7371
- "sharedPropertyTypes": [],
7895
+ "valueTypes": {
7896
+ "valueTypes": [],
7372
7897
  },
7373
7898
  }
7374
7899
  `);});it("Parameter configuration, property mapping, and excluded property validations work",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string"},"id":{type:"string"}}});expect(()=>{defineCreateObjectAction({objectType:sampleObject,parameterConfiguration:{"name":{displayName:"Name"},"custom_parameter":{displayName:"My Custom Param"}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Parameter custom_parameter does not exist as a property on com.palantir.sampleObject and its type is not explicitly defined]`);expect(()=>{defineCreateObjectAction({objectType:sampleObject,nonParameterMappings:{"custom_parameter":{type:"staticValue",staticValue:{type:"string",string:"custom_value"}}}});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Property custom_parameter does not exist as a property on com.palantir.sampleObject]`);expect(()=>{defineCreateObjectAction({objectType:sampleObject,excludedProperties:["custom_parameter"]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Property custom_parameter does not exist as a property on com.palantir.sampleObject]`);});it("Static default action parameters must match type",()=>{const exampleObjectType=defineObject({titlePropertyApiName:"bar",displayName:"exampleObjectType",pluralDisplayName:"exampleObjectTypes",apiName:"foo",primaryKeyPropertyApiName:"primary",properties:{"bar":{type:"string"},"fizz":{type:"string"},"buzz":{type:"string"},"primary":{type:"string"}}});expect(()=>defineCreateObjectAction({objectType:exampleObjectType,parameterConfiguration:{"buzz":{defaultValue:{type:"staticValue",staticValue:{type:"boolean",boolean:true}}}}})).toThrowError("Invariant failed: Default static value for parameter buzz does not match type");});it("ModifyObjectRule requires objectToModify parameter",()=>{defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string",description:"The name of the test object"},"id":{type:"string",description:"The ID of the test object"}}});expect(()=>defineAction({apiName:"foo",displayName:"exampleAction",status:"active",rules:[{type:"modifyObjectRule",modifyObjectRule:{objectToModify:"sampleObject",propertyValues:{"name":{type:"parameterId",parameterId:"name"}},structFieldValues:{}}}],parameters:[{id:"name",displayName:"Name",type:"string",validation:{required:true,allowedValues:{type:"text"}}}]})).toThrowError("Invariant failed: Object to modify parameter must be defined in parameters");});it("Target object parameters are configurable",()=>{const employeeObject=defineObject({apiName:"employee",displayName:"Employee",pluralDisplayName:"Employees",titlePropertyApiName:"id",primaryKeyPropertyApiName:"id",properties:{"id":{type:"string",displayName:"ID",description:"dummy"},"managedBy":{type:"string"}}});defineModifyObjectAction({objectType:employeeObject,parameterConfiguration:{[MODIFY_OBJECT_PARAMETER]:{displayName:"Chose a manager to modify",description:"Description",conditionalOverrides:[{type:"visibility",condition:{type:"group",name:"supervisors"}}]}}});defineCreateOrModifyObjectAction({objectType:employeeObject,parameterConfiguration:{[CREATE_OR_MODIFY_OBJECT_PARAMETER]:{displayName:"Chose a manager to modify or create a new one",description:"Description",conditionalOverrides:[{type:"visibility",condition:{type:"group",name:"supervisors"}}]}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
7375
7900
  {
7376
- "blockData": {
7901
+ "importedOntology": {
7902
+ "actionTypes": {},
7903
+ "blockPermissionInformation": {
7904
+ "actionTypes": {},
7905
+ "linkTypes": {},
7906
+ "objectTypes": {},
7907
+ },
7908
+ "interfaceTypes": {},
7909
+ "linkTypes": {},
7910
+ "objectTypes": {},
7911
+ "sharedPropertyTypes": {},
7912
+ },
7913
+ "importedValueTypes": {
7914
+ "valueTypes": [],
7915
+ },
7916
+ "ontology": {
7377
7917
  "actionTypes": {
7378
7918
  "com.palantir.create-or-modify-employee": {
7379
7919
  "actionType": {
@@ -7981,12 +8521,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
7981
8521
  },
7982
8522
  "sharedPropertyTypes": {},
7983
8523
  },
7984
- "importedTypes": {
7985
- "actionTypes": [],
7986
- "interfaceTypes": [],
7987
- "linkTypes": [],
7988
- "objectTypes": [],
7989
- "sharedPropertyTypes": [],
8524
+ "valueTypes": {
8525
+ "valueTypes": [],
7990
8526
  },
7991
8527
  }
7992
8528
  `);});it("OAC defined object references as parameters are properly defined",()=>{// This test defines an action that creates an OAC-defined employee object type and also adds an additional parameter
@@ -7995,7 +8531,22 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
7995
8531
  // id of the selected manager object type.
7996
8532
  const employeeObject=defineObject({apiName:"employee",displayName:"Employee",pluralDisplayName:"Employees",titlePropertyApiName:"id",primaryKeyPropertyApiName:"id",properties:{"id":{type:"string",displayName:"ID",description:"dummy"},"managedBy":{type:"string"}}});const managerObject=defineObject({apiName:"manager",displayName:"Manager",pluralDisplayName:"Managers",titlePropertyApiName:"id",primaryKeyPropertyApiName:"id",properties:{"id":{type:"string",displayName:"ID",description:"dummy"}},editsEnabled:true});defineCreateObjectAction({objectType:employeeObject,parameterOrdering:["myManager","id","managedBy"],parameterConfiguration:{"myManager":{customParameterType:{type:"objectReference",objectReference:{objectTypeId:managerObject.apiName}}},"managedBy":{defaultValue:{type:"objectParameterPropertyValue",objectParameterPropertyValue:{parameterId:"myManager",propertyTypeId:"id"}}}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
7997
8533
  {
7998
- "blockData": {
8534
+ "importedOntology": {
8535
+ "actionTypes": {},
8536
+ "blockPermissionInformation": {
8537
+ "actionTypes": {},
8538
+ "linkTypes": {},
8539
+ "objectTypes": {},
8540
+ },
8541
+ "interfaceTypes": {},
8542
+ "linkTypes": {},
8543
+ "objectTypes": {},
8544
+ "sharedPropertyTypes": {},
8545
+ },
8546
+ "importedValueTypes": {
8547
+ "valueTypes": [],
8548
+ },
8549
+ "ontology": {
7999
8550
  "actionTypes": {
8000
8551
  "com.palantir.create-object-employee": {
8001
8552
  "actionType": {
@@ -8059,8 +8610,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8059
8610
  "type": "text",
8060
8611
  },
8061
8612
  "required": {
8062
- "required": {},
8063
- "type": "required",
8613
+ "notRequired": {},
8614
+ "type": "notRequired",
8064
8615
  },
8065
8616
  },
8066
8617
  },
@@ -8094,8 +8645,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8094
8645
  "type": "text",
8095
8646
  },
8096
8647
  "required": {
8097
- "required": {},
8098
- "type": "required",
8648
+ "notRequired": {},
8649
+ "type": "notRequired",
8099
8650
  },
8100
8651
  },
8101
8652
  },
@@ -8122,8 +8673,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8122
8673
  "type": "objectQuery",
8123
8674
  },
8124
8675
  "required": {
8125
- "required": {},
8126
- "type": "required",
8676
+ "notRequired": {},
8677
+ "type": "notRequired",
8127
8678
  },
8128
8679
  },
8129
8680
  },
@@ -8470,17 +9021,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8470
9021
  },
8471
9022
  "sharedPropertyTypes": {},
8472
9023
  },
8473
- "importedTypes": {
8474
- "actionTypes": [],
8475
- "interfaceTypes": [],
8476
- "linkTypes": [],
8477
- "objectTypes": [],
8478
- "sharedPropertyTypes": [],
9024
+ "valueTypes": {
9025
+ "valueTypes": [],
8479
9026
  },
8480
9027
  }
8481
9028
  `);});it("Simple interface actions (without object types) are properly defined",()=>{const exampleInterface=defineInterface({apiName:"exampleInterface",properties:{property1:"string"}});defineCreateInterfaceObjectAction(exampleInterface);defineModifyInterfaceObjectAction(exampleInterface);expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
8482
9029
  {
8483
- "blockData": {
9030
+ "importedOntology": {
9031
+ "actionTypes": {},
9032
+ "blockPermissionInformation": {
9033
+ "actionTypes": {},
9034
+ "linkTypes": {},
9035
+ "objectTypes": {},
9036
+ },
9037
+ "interfaceTypes": {},
9038
+ "linkTypes": {},
9039
+ "objectTypes": {},
9040
+ "sharedPropertyTypes": {},
9041
+ },
9042
+ "importedValueTypes": {
9043
+ "valueTypes": [],
9044
+ },
9045
+ "ontology": {
8484
9046
  "actionTypes": {
8485
9047
  "com.palantir.create-example-interface": {
8486
9048
  "actionType": {
@@ -8846,7 +9408,13 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8846
9408
  "displayMetadata": {
8847
9409
  "description": "exampleInterface",
8848
9410
  "displayName": "exampleInterface",
8849
- "icon": undefined,
9411
+ "icon": {
9412
+ "blueprint": {
9413
+ "color": "#4C90F0",
9414
+ "locator": "layout-hierarchy",
9415
+ },
9416
+ "type": "blueprint",
9417
+ },
8850
9418
  },
8851
9419
  "extendsInterfaces": [],
8852
9420
  "links": [],
@@ -8940,17 +9508,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
8940
9508
  },
8941
9509
  },
8942
9510
  },
8943
- "importedTypes": {
8944
- "actionTypes": [],
8945
- "interfaceTypes": [],
8946
- "linkTypes": [],
8947
- "objectTypes": [],
8948
- "sharedPropertyTypes": [],
9511
+ "valueTypes": {
9512
+ "valueTypes": [],
8949
9513
  },
8950
9514
  }
8951
- `);});it("Actions with group permissions are properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string",description:"The name of the test object"},"id":{type:"string",displayName:"ID",description:"The ID of the test object"}}});defineCreateObjectAction({objectType:sampleObject,actionLevelValidation:{condition:{type:"group",name:"testGroup"}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
9515
+ `);});it("Actions with group permissions are properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string",description:"The name of the test object"},"id":{type:"string",displayName:"ID",description:"The ID of the test object"}}});defineCreateObjectAction({objectType:sampleObject,actionLevelValidation:[{condition:{type:"group",name:"testGroup"}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
8952
9516
  {
8953
- "blockData": {
9517
+ "importedOntology": {
9518
+ "actionTypes": {},
9519
+ "blockPermissionInformation": {
9520
+ "actionTypes": {},
9521
+ "linkTypes": {},
9522
+ "objectTypes": {},
9523
+ },
9524
+ "interfaceTypes": {},
9525
+ "linkTypes": {},
9526
+ "objectTypes": {},
9527
+ "sharedPropertyTypes": {},
9528
+ },
9529
+ "importedValueTypes": {
9530
+ "valueTypes": [],
9531
+ },
9532
+ "ontology": {
8954
9533
  "actionTypes": {
8955
9534
  "com.palantir.create-object-sample-object": {
8956
9535
  "actionType": {
@@ -9040,8 +9619,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9040
9619
  "type": "text",
9041
9620
  },
9042
9621
  "required": {
9043
- "required": {},
9044
- "type": "required",
9622
+ "notRequired": {},
9623
+ "type": "notRequired",
9045
9624
  },
9046
9625
  },
9047
9626
  },
@@ -9068,8 +9647,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9068
9647
  "type": "text",
9069
9648
  },
9070
9649
  "required": {
9071
- "required": {},
9072
- "type": "required",
9650
+ "notRequired": {},
9651
+ "type": "notRequired",
9073
9652
  },
9074
9653
  },
9075
9654
  },
@@ -9313,17 +9892,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9313
9892
  },
9314
9893
  "sharedPropertyTypes": {},
9315
9894
  },
9316
- "importedTypes": {
9317
- "actionTypes": [],
9318
- "interfaceTypes": [],
9319
- "linkTypes": [],
9320
- "objectTypes": [],
9321
- "sharedPropertyTypes": [],
9895
+ "valueTypes": {
9896
+ "valueTypes": [],
9322
9897
  },
9323
9898
  }
9324
- `);});it("Actions with custom permissions are properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string",description:"The name of the test object"},"id":{type:"string",displayName:"ID",description:"The ID of the test object"}}});defineCreateObjectAction({objectType:sampleObject,actionLevelValidation:{displayMetadata:{failureMessage:"Insufficient permissions. Missing organization membership required to submit action",typeClasses:[]},condition:{type:"comparison",comparison:{operator:"INTERSECTS",left:{type:"userProperty",userProperty:{userId:{type:"currentUser",currentUser:{}},propertyValue:{type:"organizationMarkingIds",organizationMarkingIds:{}}}},right:{type:"staticValue",staticValue:{type:"stringList",stringList:{strings:["87ef507e-f954-457e-ad68-e0df71ef7567"]}}}}}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
9899
+ `);});it("Actions with custom permissions are properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string",description:"The name of the test object"},"id":{type:"string",displayName:"ID",description:"The ID of the test object"}}});defineCreateObjectAction({objectType:sampleObject,actionLevelValidation:[{displayMetadata:{failureMessage:"Insufficient permissions. Missing organization membership required to submit action",typeClasses:[]},condition:{type:"comparison",comparison:{operator:"INTERSECTS",left:{type:"userProperty",userProperty:{userId:{type:"currentUser",currentUser:{}},propertyValue:{type:"organizationMarkingIds",organizationMarkingIds:{}}}},right:{type:"staticValue",staticValue:{type:"stringList",stringList:{strings:["87ef507e-f954-457e-ad68-e0df71ef7567"]}}}}}}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
9325
9900
  {
9326
- "blockData": {
9901
+ "importedOntology": {
9902
+ "actionTypes": {},
9903
+ "blockPermissionInformation": {
9904
+ "actionTypes": {},
9905
+ "linkTypes": {},
9906
+ "objectTypes": {},
9907
+ },
9908
+ "interfaceTypes": {},
9909
+ "linkTypes": {},
9910
+ "objectTypes": {},
9911
+ "sharedPropertyTypes": {},
9912
+ },
9913
+ "importedValueTypes": {
9914
+ "valueTypes": [],
9915
+ },
9916
+ "ontology": {
9327
9917
  "actionTypes": {
9328
9918
  "com.palantir.create-object-sample-object": {
9329
9919
  "actionType": {
@@ -9413,8 +10003,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9413
10003
  "type": "text",
9414
10004
  },
9415
10005
  "required": {
9416
- "required": {},
9417
- "type": "required",
10006
+ "notRequired": {},
10007
+ "type": "notRequired",
9418
10008
  },
9419
10009
  },
9420
10010
  },
@@ -9441,8 +10031,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9441
10031
  "type": "text",
9442
10032
  },
9443
10033
  "required": {
9444
- "required": {},
9445
- "type": "required",
10034
+ "notRequired": {},
10035
+ "type": "notRequired",
9446
10036
  },
9447
10037
  },
9448
10038
  },
@@ -9686,17 +10276,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9686
10276
  },
9687
10277
  "sharedPropertyTypes": {},
9688
10278
  },
9689
- "importedTypes": {
9690
- "actionTypes": [],
9691
- "interfaceTypes": [],
9692
- "linkTypes": [],
9693
- "objectTypes": [],
9694
- "sharedPropertyTypes": [],
10279
+ "valueTypes": {
10280
+ "valueTypes": [],
9695
10281
  },
9696
10282
  }
9697
10283
  `);});it("Array property validation is correctly structured for actions",()=>{const objectWithArrays=defineObject({apiName:"objectWithArrays",displayName:"Object With Arrays",primaryKeyPropertyApiName:"id",titlePropertyApiName:"id",pluralDisplayName:"Objects With Arrays",properties:{"id":{type:"string",displayName:"ID"},"tags":{type:"string",array:true,displayName:"Tags"},"numbers":{type:"integer",array:true,displayName:"Numbers"},"singleValue":{type:"string",displayName:"Single Value"}}});defineCreateObjectAction({objectType:objectWithArrays});defineModifyObjectAction({objectType:objectWithArrays});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
9698
10284
  {
9699
- "blockData": {
10285
+ "importedOntology": {
10286
+ "actionTypes": {},
10287
+ "blockPermissionInformation": {
10288
+ "actionTypes": {},
10289
+ "linkTypes": {},
10290
+ "objectTypes": {},
10291
+ },
10292
+ "interfaceTypes": {},
10293
+ "linkTypes": {},
10294
+ "objectTypes": {},
10295
+ "sharedPropertyTypes": {},
10296
+ },
10297
+ "importedValueTypes": {
10298
+ "valueTypes": [],
10299
+ },
10300
+ "ontology": {
9700
10301
  "actionTypes": {
9701
10302
  "com.palantir.create-object-object-with-arrays": {
9702
10303
  "actionType": {
@@ -9768,8 +10369,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9768
10369
  "type": "text",
9769
10370
  },
9770
10371
  "required": {
9771
- "required": {},
9772
- "type": "required",
10372
+ "notRequired": {},
10373
+ "type": "notRequired",
9773
10374
  },
9774
10375
  },
9775
10376
  },
@@ -9827,8 +10428,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
9827
10428
  "type": "text",
9828
10429
  },
9829
10430
  "required": {
9830
- "required": {},
9831
- "type": "required",
10431
+ "notRequired": {},
10432
+ "type": "notRequired",
9832
10433
  },
9833
10434
  },
9834
10435
  },
@@ -10503,17 +11104,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
10503
11104
  },
10504
11105
  "sharedPropertyTypes": {},
10505
11106
  },
10506
- "importedTypes": {
10507
- "actionTypes": [],
10508
- "interfaceTypes": [],
10509
- "linkTypes": [],
10510
- "objectTypes": [],
10511
- "sharedPropertyTypes": [],
11107
+ "valueTypes": {
11108
+ "valueTypes": [],
10512
11109
  },
10513
11110
  }
10514
11111
  `);});it("Action sections are properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string"},"id":{type:"string"}}});defineCreateObjectAction({objectType:sampleObject,sections:[{id:"section1",displayName:"Section 1",parameters:["id"],description:"Description for Section 1",conditionalOverrides:[{type:"visibility",condition:{type:"group",name:"testGroup"}}]}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
10515
11112
  {
10516
- "blockData": {
11113
+ "importedOntology": {
11114
+ "actionTypes": {},
11115
+ "blockPermissionInformation": {
11116
+ "actionTypes": {},
11117
+ "linkTypes": {},
11118
+ "objectTypes": {},
11119
+ },
11120
+ "interfaceTypes": {},
11121
+ "linkTypes": {},
11122
+ "objectTypes": {},
11123
+ "sharedPropertyTypes": {},
11124
+ },
11125
+ "importedValueTypes": {
11126
+ "valueTypes": [],
11127
+ },
11128
+ "ontology": {
10517
11129
  "actionTypes": {
10518
11130
  "com.palantir.create-object-sample-object": {
10519
11131
  "actionType": {
@@ -10577,8 +11189,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
10577
11189
  "type": "text",
10578
11190
  },
10579
11191
  "required": {
10580
- "required": {},
10581
- "type": "required",
11192
+ "notRequired": {},
11193
+ "type": "notRequired",
10582
11194
  },
10583
11195
  },
10584
11196
  },
@@ -10605,8 +11217,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
10605
11217
  "type": "text",
10606
11218
  },
10607
11219
  "required": {
10608
- "required": {},
10609
- "type": "required",
11220
+ "notRequired": {},
11221
+ "type": "notRequired",
10610
11222
  },
10611
11223
  },
10612
11224
  },
@@ -10922,12 +11534,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
10922
11534
  },
10923
11535
  "sharedPropertyTypes": {},
10924
11536
  },
10925
- "importedTypes": {
10926
- "actionTypes": [],
10927
- "interfaceTypes": [],
10928
- "linkTypes": [],
10929
- "objectTypes": [],
10930
- "sharedPropertyTypes": [],
11537
+ "valueTypes": {
11538
+ "valueTypes": [],
10931
11539
  },
10932
11540
  }
10933
11541
  `);});it("Action section parameters must exist",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string"},"id":{type:"string"}}});expect(()=>{defineCreateObjectAction({objectType:sampleObject,sections:[{id:"section1",displayName:"Section 1",parameters:["foo"]}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Parameters ["foo"] were referenced but not defined]`);});it("Custom parameter ordering is properly defined",()=>{const sampleObject=defineObject({apiName:"sampleObject",displayName:"Test Object",description:"Sample object description",primaryKeyPropertyApiName:"id",pluralDisplayName:"tests",titlePropertyApiName:"name",properties:{"name":{type:"string"},"id":{type:"string"},"foo":{type:"string"}}});expect(()=>{defineCreateObjectAction({objectType:sampleObject,parameterOrdering:["foo","id"],excludedProperties:["id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Action parameter ordering for create-object-sample-object does not match expected parameters. Extraneous parameters in ordering: {id}, Missing parameters in ordering: {name}]`);expect(()=>{defineModifyObjectAction({objectType:sampleObject,// primary keys should not be in modify action orderings
@@ -10937,7 +11545,22 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
10937
11545
  parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Action parameter ordering for modify-object-sample-object does not match expected parameters. Extraneous parameters in ordering: {foo,id}, Missing parameters in ordering: {name}]`);expect(()=>{defineCreateOrModifyObjectAction({objectType:sampleObject,nonParameterMappings:{"foo":{type:"currentUser"}},// non-parameter mapped properties should not be in action orderings
10938
11546
  parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Action parameter ordering for create-or-modify-sample-object does not match expected parameters. Extraneous parameters in ordering: {foo,id}, Missing parameters in ordering: {name}]`);defineCreateObjectAction({objectType:sampleObject,parameterOrdering:["foo","name","id"],parameterConfiguration:{"name":{conditionalOverrides:[{type:"visibility",condition:{type:"parameter",parameterId:"foo",matches:{type:"staticValue",staticValue:{type:"string",string:"foo"}}}}]}}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
10939
11547
  {
10940
- "blockData": {
11548
+ "importedOntology": {
11549
+ "actionTypes": {},
11550
+ "blockPermissionInformation": {
11551
+ "actionTypes": {},
11552
+ "linkTypes": {},
11553
+ "objectTypes": {},
11554
+ },
11555
+ "interfaceTypes": {},
11556
+ "linkTypes": {},
11557
+ "objectTypes": {},
11558
+ "sharedPropertyTypes": {},
11559
+ },
11560
+ "importedValueTypes": {
11561
+ "valueTypes": [],
11562
+ },
11563
+ "ontology": {
10941
11564
  "actionTypes": {
10942
11565
  "com.palantir.create-object-sample-object": {
10943
11566
  "actionType": {
@@ -11005,8 +11628,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11005
11628
  "type": "text",
11006
11629
  },
11007
11630
  "required": {
11008
- "required": {},
11009
- "type": "required",
11631
+ "notRequired": {},
11632
+ "type": "notRequired",
11010
11633
  },
11011
11634
  },
11012
11635
  },
@@ -11033,8 +11656,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11033
11656
  "type": "text",
11034
11657
  },
11035
11658
  "required": {
11036
- "required": {},
11037
- "type": "required",
11659
+ "notRequired": {},
11660
+ "type": "notRequired",
11038
11661
  },
11039
11662
  },
11040
11663
  },
@@ -11092,8 +11715,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11092
11715
  "type": "text",
11093
11716
  },
11094
11717
  "required": {
11095
- "required": {},
11096
- "type": "required",
11718
+ "notRequired": {},
11719
+ "type": "notRequired",
11097
11720
  },
11098
11721
  },
11099
11722
  },
@@ -11386,17 +12009,59 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11386
12009
  },
11387
12010
  "sharedPropertyTypes": {},
11388
12011
  },
11389
- "importedTypes": {
11390
- "actionTypes": [],
11391
- "interfaceTypes": [],
11392
- "linkTypes": [],
11393
- "objectTypes": [],
11394
- "sharedPropertyTypes": [],
12012
+ "valueTypes": {
12013
+ "valueTypes": [],
11395
12014
  },
11396
12015
  }
11397
- `);});});describe("Imports",()=>{it("Legacy importing works",()=>{const id=importSharedPropertyType({apiName:"id",packageName:"com.palantir.core.ontology.types",typeHint:"string"});defineInterface({apiName:"myInterface",properties:{id}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
12016
+ `);});it("Interface actions validate SPT existence globally",()=>{expect(()=>{const spt=defineSharedPropertyType({apiName:"spt",type:"string"});const pulseRepetitionIntervalSecs={"apiName":"com.palantir.other.ontology.pulseRepetitionIntervalSecs","displayName":"Pulse Repetition Interval (s)","description":"Pulse Repetition Interval in seconds.","type":"double","nonNameSpacedApiName":"pulseRepetitionIntervalSecs","typeClasses":[],"__type":OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE};importOntologyEntity(pulseRepetitionIntervalSecs);const interfaceType=defineInterface({apiName:"interfaceType",properties:{spt,pulseRepetitionIntervalSecs}});defineAction({apiName:"action",displayName:"action",status:"active",parameters:[{id:"interfaceObjectToModifyParameter",displayName:"Interface object to modify",type:{type:"interfaceReference",interfaceReference:{interfaceTypeRid:interfaceType.apiName}},validation:{required:true,allowedValues:{type:"interfaceObjectQuery"}}},{id:"sptParameter",displayName:"SPT",type:"string",validation:{required:true,allowedValues:{type:"text"}}},{id:"otherParameter",displayName:"Other parameter",type:"string",validation:{required:true,allowedValues:{type:"text"}}}],rules:[{type:"modifyInterfaceRule",modifyInterfaceRule:{interfaceObjectToModifyParameter:"interfaceObjectToModifyParameter",sharedPropertyValues:{spt:{type:"parameterId",parameterId:"sptParameter"},[pulseRepetitionIntervalSecs.apiName]:{type:"staticValue",staticValue:{type:"double",double:4}},other:{type:"parameterId",parameterId:"otherParameter"}}}}]});}).toThrowErrorMatchingInlineSnapshot(`
12017
+ [Error: Invariant failed: Shared property type com.palantir.other does not exist.
12018
+ If this SPT was imported, you may need to use [spt.apiName] as the key so that it is qualified with the right namespace]
12019
+ `);});it("Interface actions validate SPT existence on the interface",()=>{expect(()=>{const spt=defineSharedPropertyType({apiName:"spt",type:"string"});const pulseRepetitionIntervalSecs={"apiName":"com.palantir.other.ontology.pulseRepetitionIntervalSecs","displayName":"Pulse Repetition Interval (s)","description":"Pulse Repetition Interval in seconds.","type":"double","nonNameSpacedApiName":"pulseRepetitionIntervalSecs","typeClasses":[],"__type":OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE};importOntologyEntity(pulseRepetitionIntervalSecs);const interfaceType=defineInterface({apiName:"interfaceType",properties:{spt}});defineAction({apiName:"action",displayName:"action",status:"active",parameters:[{id:"interfaceObjectToModifyParameter",displayName:"Interface object to modify",type:{type:"interfaceReference",interfaceReference:{interfaceTypeRid:interfaceType.apiName}},validation:{required:true,allowedValues:{type:"interfaceObjectQuery"}}},{id:"sptParameter",displayName:"SPT",type:"string",validation:{required:true,allowedValues:{type:"text"}}}],rules:[{type:"modifyInterfaceRule",modifyInterfaceRule:{interfaceObjectToModifyParameter:"interfaceObjectToModifyParameter",sharedPropertyValues:{spt:{type:"parameterId",parameterId:"sptParameter"},[pulseRepetitionIntervalSecs.apiName]:{type:"staticValue",staticValue:{type:"double",double:4}}}}}]});}).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.other.ontology.pulseRepetitionIntervalSecs does not exist in interface type com.palantir.interfaceType]`);});});describe("Imports",()=>{it("Legacy importing works",()=>{const id=importSharedPropertyType({apiName:"id",packageName:"com.palantir.core.ontology.types",typeHint:"string"});defineInterface({apiName:"myInterface",properties:{id}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
11398
12020
  {
11399
- "blockData": {
12021
+ "importedOntology": {
12022
+ "actionTypes": {},
12023
+ "blockPermissionInformation": {
12024
+ "actionTypes": {},
12025
+ "linkTypes": {},
12026
+ "objectTypes": {},
12027
+ },
12028
+ "interfaceTypes": {},
12029
+ "linkTypes": {},
12030
+ "objectTypes": {},
12031
+ "sharedPropertyTypes": {
12032
+ "com.palantir.core.ontology.types.id": {
12033
+ "sharedPropertyType": {
12034
+ "aliases": [],
12035
+ "apiName": "com.palantir.core.ontology.types.id",
12036
+ "baseFormatter": undefined,
12037
+ "dataConstraints": undefined,
12038
+ "displayMetadata": {
12039
+ "description": undefined,
12040
+ "displayName": "com.palantir.core.ontology.types.id",
12041
+ "visibility": "NORMAL",
12042
+ },
12043
+ "gothamMapping": undefined,
12044
+ "indexedForSearch": true,
12045
+ "type": {
12046
+ "string": {
12047
+ "analyzerOverride": undefined,
12048
+ "enableAsciiFolding": undefined,
12049
+ "isLongText": false,
12050
+ "supportsEfficientLeadingWildcard": false,
12051
+ "supportsExactMatching": true,
12052
+ },
12053
+ "type": "string",
12054
+ },
12055
+ "typeClasses": [],
12056
+ "valueType": undefined,
12057
+ },
12058
+ },
12059
+ },
12060
+ },
12061
+ "importedValueTypes": {
12062
+ "valueTypes": [],
12063
+ },
12064
+ "ontology": {
11400
12065
  "actionTypes": {},
11401
12066
  "blockPermissionInformation": {
11402
12067
  "actionTypes": {},
@@ -11410,7 +12075,13 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11410
12075
  "displayMetadata": {
11411
12076
  "description": "myInterface",
11412
12077
  "displayName": "myInterface",
11413
- "icon": undefined,
12078
+ "icon": {
12079
+ "blueprint": {
12080
+ "color": "#4C90F0",
12081
+ "locator": "layout-hierarchy",
12082
+ },
12083
+ "type": "blueprint",
12084
+ },
11414
12085
  },
11415
12086
  "extendsInterfaces": [],
11416
12087
  "links": [],
@@ -11458,35 +12129,57 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
11458
12129
  "objectTypes": {},
11459
12130
  "sharedPropertyTypes": {},
11460
12131
  },
11461
- "importedTypes": {
11462
- "actionTypes": [],
11463
- "interfaceTypes": [],
11464
- "linkTypes": [],
11465
- "objectTypes": [],
11466
- "sharedPropertyTypes": [
11467
- {
11468
- "apiName": "com.palantir.core.ontology.types.id",
11469
- "description": undefined,
11470
- "displayName": "com.palantir.core.ontology.types.id",
11471
- "type": {
11472
- "string": {
11473
- "analyzerOverride": undefined,
11474
- "enableAsciiFolding": undefined,
11475
- "isLongText": false,
11476
- "supportsEfficientLeadingWildcard": false,
11477
- "supportsExactMatching": true,
11478
- },
11479
- "type": "string",
11480
- },
11481
- "valueType": undefined,
11482
- },
11483
- ],
12132
+ "valueTypes": {
12133
+ "valueTypes": [],
11484
12134
  },
11485
12135
  }
11486
12136
  `);});it("Simple importing works",()=>{// does the same as "import { spt } from '@other/package'"
11487
12137
  const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"string",__type:OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE};importOntologyEntity(spt);defineInterface({apiName:"myInterface",properties:{spt}});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
11488
12138
  {
11489
- "blockData": {
12139
+ "importedOntology": {
12140
+ "actionTypes": {},
12141
+ "blockPermissionInformation": {
12142
+ "actionTypes": {},
12143
+ "linkTypes": {},
12144
+ "objectTypes": {},
12145
+ },
12146
+ "interfaceTypes": {},
12147
+ "linkTypes": {},
12148
+ "objectTypes": {},
12149
+ "sharedPropertyTypes": {
12150
+ "com.other.package.spt": {
12151
+ "sharedPropertyType": {
12152
+ "aliases": [],
12153
+ "apiName": "com.other.package.spt",
12154
+ "baseFormatter": undefined,
12155
+ "dataConstraints": undefined,
12156
+ "displayMetadata": {
12157
+ "description": undefined,
12158
+ "displayName": "com.other.package.spt",
12159
+ "visibility": "NORMAL",
12160
+ },
12161
+ "gothamMapping": undefined,
12162
+ "indexedForSearch": true,
12163
+ "type": {
12164
+ "string": {
12165
+ "analyzerOverride": undefined,
12166
+ "enableAsciiFolding": undefined,
12167
+ "isLongText": false,
12168
+ "supportsEfficientLeadingWildcard": false,
12169
+ "supportsExactMatching": true,
12170
+ },
12171
+ "type": "string",
12172
+ },
12173
+ "typeClasses": [],
12174
+ "valueType": undefined,
12175
+ },
12176
+ },
12177
+ },
12178
+ },
12179
+ "importedValueTypes": {
12180
+ "valueTypes": [],
12181
+ },
12182
+ "ontology": {
11490
12183
  "actionTypes": {},
11491
12184
  "blockPermissionInformation": {
11492
12185
  "actionTypes": {},
@@ -11500,7 +12193,13 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
11500
12193
  "displayMetadata": {
11501
12194
  "description": "myInterface",
11502
12195
  "displayName": "myInterface",
11503
- "icon": undefined,
12196
+ "icon": {
12197
+ "blueprint": {
12198
+ "color": "#4C90F0",
12199
+ "locator": "layout-hierarchy",
12200
+ },
12201
+ "type": "blueprint",
12202
+ },
11504
12203
  },
11505
12204
  "extendsInterfaces": [],
11506
12205
  "links": [],
@@ -11548,29 +12247,8 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
11548
12247
  "objectTypes": {},
11549
12248
  "sharedPropertyTypes": {},
11550
12249
  },
11551
- "importedTypes": {
11552
- "actionTypes": [],
11553
- "interfaceTypes": [],
11554
- "linkTypes": [],
11555
- "objectTypes": [],
11556
- "sharedPropertyTypes": [
11557
- {
11558
- "apiName": "com.other.package.spt",
11559
- "description": undefined,
11560
- "displayName": "com.other.package.spt",
11561
- "type": {
11562
- "string": {
11563
- "analyzerOverride": undefined,
11564
- "enableAsciiFolding": undefined,
11565
- "isLongText": false,
11566
- "supportsEfficientLeadingWildcard": false,
11567
- "supportsExactMatching": true,
11568
- },
11569
- "type": "string",
11570
- },
11571
- "valueType": undefined,
11572
- },
11573
- ],
12250
+ "valueTypes": {
12251
+ "valueTypes": [],
11574
12252
  },
11575
12253
  }
11576
12254
  `);});it("Export files are generated correctly",async()=>{const generatedDir=path.resolve(path.join(__dirname,"..","generatedNoCheck","export_files_are_generated_correctly"));await defineOntology("com.my.package.",()=>{const mySpt=defineSharedPropertyType({apiName:"mySpt",type:"string"});const myInterface=defineInterface({apiName:"myInterface",properties:{mySpt}});defineObject({titlePropertyApiName:"bar",displayName:"My Object",pluralDisplayName:"myObjects",apiName:"myObject",primaryKeyPropertyApiName:"bar",properties:{"bar":{type:"string"}},implementsInterfaces:[{implements:myInterface,propertyMapping:[{interfaceProperty:"com.my.package.mySpt",mapsTo:"bar"}]}]});},generatedDir);expect(fs.readFileSync(path.join(generatedDir,"codegen/interface-types/myInterface.ts"),"utf8")).toMatchInlineSnapshot(`
@@ -11800,7 +12478,22 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
11800
12478
  "
11801
12479
  `);fs.rmSync(path.join(generatedDir,".."),{recursive:true,force:true});});it("Extended interface properties are checked in object type property mapping",()=>{const parentInterface=defineInterface({apiName:"parentInterface",properties:{iProperty1:"string"}});const childInterface=defineInterface({apiName:"childInterface",properties:{iProperty2:"string"},extends:[parentInterface]});defineObject({apiName:"objectDef",primaryKeyPropertyApiName:"property1",titlePropertyApiName:"property1",displayName:"objectDef",pluralDisplayName:"objectDefs",properties:{"property1":{type:"string",displayName:"property1"},"property2":{type:"string",displayName:"property2"}},implementsInterfaces:[{implements:childInterface,propertyMapping:[{interfaceProperty:"com.palantir.iProperty1",mapsTo:"property1"},{interfaceProperty:"com.palantir.iProperty2",mapsTo:"property2"}]}]});expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
11802
12480
  {
11803
- "blockData": {
12481
+ "importedOntology": {
12482
+ "actionTypes": {},
12483
+ "blockPermissionInformation": {
12484
+ "actionTypes": {},
12485
+ "linkTypes": {},
12486
+ "objectTypes": {},
12487
+ },
12488
+ "interfaceTypes": {},
12489
+ "linkTypes": {},
12490
+ "objectTypes": {},
12491
+ "sharedPropertyTypes": {},
12492
+ },
12493
+ "importedValueTypes": {
12494
+ "valueTypes": [],
12495
+ },
12496
+ "ontology": {
11804
12497
  "actionTypes": {},
11805
12498
  "blockPermissionInformation": {
11806
12499
  "actionTypes": {},
@@ -11814,7 +12507,13 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
11814
12507
  "displayMetadata": {
11815
12508
  "description": "childInterface",
11816
12509
  "displayName": "childInterface",
11817
- "icon": undefined,
12510
+ "icon": {
12511
+ "blueprint": {
12512
+ "color": "#4C90F0",
12513
+ "locator": "layout-hierarchy",
12514
+ },
12515
+ "type": "blueprint",
12516
+ },
11818
12517
  },
11819
12518
  "extendsInterfaces": [
11820
12519
  "com.palantir.parentInterface",
@@ -11874,7 +12573,13 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
11874
12573
  "displayMetadata": {
11875
12574
  "description": "parentInterface",
11876
12575
  "displayName": "parentInterface",
11877
- "icon": undefined,
12576
+ "icon": {
12577
+ "blueprint": {
12578
+ "color": "#4C90F0",
12579
+ "locator": "layout-hierarchy",
12580
+ },
12581
+ "type": "blueprint",
12582
+ },
11878
12583
  },
11879
12584
  "extendsInterfaces": [],
11880
12585
  "links": [],
@@ -12159,12 +12864,8 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
12159
12864
  },
12160
12865
  },
12161
12866
  },
12162
- "importedTypes": {
12163
- "actionTypes": [],
12164
- "interfaceTypes": [],
12165
- "linkTypes": [],
12166
- "objectTypes": [],
12167
- "sharedPropertyTypes": [],
12867
+ "valueTypes": {
12868
+ "valueTypes": [],
12168
12869
  },
12169
12870
  }
12170
12871
  `);});});describe("Dependencies",()=>{it("Correctly adds dependencies",async()=>{const generatedDir=path.resolve(path.join(__dirname,"..","generatedNoCheck","correctly_adds_dependencies"));await defineOntology("com.palantir.",()=>{addDependency("com.palantir",fileURLToPath(import.meta.url));defineInterface({apiName:"myInterface",properties:{property1:"string"}});},generatedDir,path.join(generatedDir,"dependencies.json"));const packageJson=JSON.parse(fs.readFileSync(path.join(__dirname,"..","..","package.json"),"utf8"));expect(packageJson.version).toBeDefined();expect(fs.readFileSync(path.join(generatedDir,"dependencies.json"),"utf8")).toMatchInlineSnapshot(`