@osdk/maker 0.9.0-beta.3 → 0.9.0-beta.30

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 (105) hide show
  1. package/CHANGELOG.md +258 -0
  2. package/build/browser/api/defineImportSpt.js +47 -0
  3. package/build/browser/api/defineImportSpt.js.map +1 -0
  4. package/build/browser/api/defineInterface.js +39 -11
  5. package/build/browser/api/defineInterface.js.map +1 -1
  6. package/build/browser/api/defineInterfaceLinkConstraint.js +3 -2
  7. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  8. package/build/browser/api/defineObject.js +57 -62
  9. package/build/browser/api/defineObject.js.map +1 -1
  10. package/build/browser/api/defineOntology.js +194 -23
  11. package/build/browser/api/defineOntology.js.map +1 -1
  12. package/build/browser/api/defineSpt.js +3 -1
  13. package/build/browser/api/defineSpt.js.map +1 -1
  14. package/build/browser/api/defineValueType.js +58 -11
  15. package/build/browser/api/defineValueType.js.map +1 -1
  16. package/build/browser/api/iconNames.js +0 -15
  17. package/build/browser/api/iconNames.js.map +1 -1
  18. package/build/browser/api/overall.test.js +704 -63
  19. package/build/browser/api/overall.test.js.map +1 -1
  20. package/build/browser/api/types.js +0 -15
  21. package/build/browser/api/types.js.map +1 -1
  22. package/build/browser/cli/main.js +5 -6
  23. package/build/browser/cli/main.js.map +1 -1
  24. package/build/browser/index.js +3 -0
  25. package/build/browser/index.js.map +1 -1
  26. package/build/cjs/index.cjs +716 -0
  27. package/build/cjs/index.cjs.map +1 -0
  28. package/build/cjs/index.d.cts +343 -0
  29. package/build/esm/api/defineImportSpt.js +47 -0
  30. package/build/esm/api/defineImportSpt.js.map +1 -0
  31. package/build/esm/api/defineInterface.js +39 -11
  32. package/build/esm/api/defineInterface.js.map +1 -1
  33. package/build/esm/api/defineInterfaceLinkConstraint.js +3 -2
  34. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  35. package/build/esm/api/defineObject.js +57 -62
  36. package/build/esm/api/defineObject.js.map +1 -1
  37. package/build/esm/api/defineOntology.js +194 -23
  38. package/build/esm/api/defineOntology.js.map +1 -1
  39. package/build/esm/api/defineSpt.js +3 -1
  40. package/build/esm/api/defineSpt.js.map +1 -1
  41. package/build/esm/api/defineValueType.js +58 -11
  42. package/build/esm/api/defineValueType.js.map +1 -1
  43. package/build/esm/api/iconNames.js +0 -15
  44. package/build/esm/api/iconNames.js.map +1 -1
  45. package/build/esm/api/overall.test.js +704 -63
  46. package/build/esm/api/overall.test.js.map +1 -1
  47. package/build/esm/api/types.js +0 -15
  48. package/build/esm/api/types.js.map +1 -1
  49. package/build/esm/cli/main.js +5 -6
  50. package/build/esm/cli/main.js.map +1 -1
  51. package/build/esm/index.js +3 -0
  52. package/build/esm/index.js.map +1 -1
  53. package/package.json +28 -13
  54. package/build/browser/api/defineInterface.d.ts +0 -14
  55. package/build/browser/api/defineInterface.d.ts.map +0 -1
  56. package/build/browser/api/defineInterfaceLinkConstraint.d.ts +0 -21
  57. package/build/browser/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
  58. package/build/browser/api/defineLink.d.ts +0 -18
  59. package/build/browser/api/defineLink.d.ts.map +0 -1
  60. package/build/browser/api/defineLink.js +0 -37
  61. package/build/browser/api/defineLink.js.map +0 -1
  62. package/build/browser/api/defineObject.d.ts +0 -15
  63. package/build/browser/api/defineObject.d.ts.map +0 -1
  64. package/build/browser/api/defineOntology.d.ts +0 -10
  65. package/build/browser/api/defineOntology.d.ts.map +0 -1
  66. package/build/browser/api/defineSpt.d.ts +0 -13
  67. package/build/browser/api/defineSpt.d.ts.map +0 -1
  68. package/build/browser/api/defineValueType.d.ts +0 -26
  69. package/build/browser/api/defineValueType.d.ts.map +0 -1
  70. package/build/browser/api/iconNames.d.ts +0 -3
  71. package/build/browser/api/iconNames.d.ts.map +0 -1
  72. package/build/browser/api/overall.test.d.ts +0 -2
  73. package/build/browser/api/overall.test.d.ts.map +0 -1
  74. package/build/browser/api/types.d.ts +0 -38
  75. package/build/browser/api/types.d.ts.map +0 -1
  76. package/build/browser/cli/main.d.ts +0 -2
  77. package/build/browser/cli/main.d.ts.map +0 -1
  78. package/build/browser/index.d.ts +0 -6
  79. package/build/browser/index.d.ts.map +0 -1
  80. package/build/esm/api/defineInterface.d.ts +0 -14
  81. package/build/esm/api/defineInterface.d.ts.map +0 -1
  82. package/build/esm/api/defineInterfaceLinkConstraint.d.ts +0 -21
  83. package/build/esm/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
  84. package/build/esm/api/defineLink.d.ts +0 -18
  85. package/build/esm/api/defineLink.d.ts.map +0 -1
  86. package/build/esm/api/defineLink.js +0 -37
  87. package/build/esm/api/defineLink.js.map +0 -1
  88. package/build/esm/api/defineObject.d.ts +0 -15
  89. package/build/esm/api/defineObject.d.ts.map +0 -1
  90. package/build/esm/api/defineOntology.d.ts +0 -10
  91. package/build/esm/api/defineOntology.d.ts.map +0 -1
  92. package/build/esm/api/defineSpt.d.ts +0 -13
  93. package/build/esm/api/defineSpt.d.ts.map +0 -1
  94. package/build/esm/api/defineValueType.d.ts +0 -26
  95. package/build/esm/api/defineValueType.d.ts.map +0 -1
  96. package/build/esm/api/iconNames.d.ts +0 -3
  97. package/build/esm/api/iconNames.d.ts.map +0 -1
  98. package/build/esm/api/overall.test.d.ts +0 -2
  99. package/build/esm/api/overall.test.d.ts.map +0 -1
  100. package/build/esm/api/types.d.ts +0 -38
  101. package/build/esm/api/types.d.ts.map +0 -1
  102. package/build/esm/cli/main.d.ts +0 -2
  103. package/build/esm/cli/main.d.ts.map +0 -1
  104. package/build/esm/index.d.ts +0 -6
  105. package/build/esm/index.d.ts.map +0 -1
@@ -13,97 +13,97 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import { beforeEach, describe, expect, it } from "vitest";
18
+ import { importSharedPropertyType } from "./defineImportSpt.js";
17
19
  import { defineInterface } from "./defineInterface.js";
18
20
  import { defineInterfaceLinkConstraint } from "./defineInterfaceLinkConstraint.js";
21
+ import { defineObject } from "./defineObject.js";
19
22
  import { defineOntology, dumpOntologyFullMetadata, dumpValueTypeWireType } from "./defineOntology.js";
20
23
  import { defineSharedPropertyType } from "./defineSpt.js";
21
24
  import { defineValueType } from "./defineValueType.js";
22
25
  describe("Ontology Defining", () => {
23
- beforeEach(() => {
24
- defineOntology("com.palantir.", () => {});
26
+ beforeEach(async () => {
27
+ await defineOntology("com.palantir.", () => {});
25
28
  });
26
29
  describe("ValueTypes", () => {
27
30
  it("Fails to define value type with incorrect semver", () => {
28
31
  expect(() => defineValueType({
29
32
  apiName: "apiName",
30
33
  displayName: "displayName",
31
- typeAndConstraints: {
32
- baseType: {
33
- boolean: {}
34
- },
34
+ type: {
35
+ "type": "boolean",
35
36
  constraints: [{
36
37
  constraint: {
37
- boolean: {
38
- allowedValues: ["TRUE_VALUE"]
39
- }
38
+ "allowedValues": ["TRUE_VALUE"]
40
39
  }
41
40
  }]
42
41
  },
43
42
  version: "not a version"
44
43
  })).toThrowErrorMatchingInlineSnapshot("[Error: Invariant failed: Version is not a valid semver]");
45
44
  });
46
- it("Correctly serializes a value type", () => {
45
+ it("Correctly serializes a value type", async () => {
47
46
  defineValueType({
48
47
  apiName: "apiName",
49
48
  displayName: "displayName",
50
- typeAndConstraints: {
51
- baseType: {
52
- boolean: {}
53
- },
49
+ type: {
50
+ "type": "boolean",
54
51
  constraints: [{
55
52
  constraint: {
56
- boolean: {
57
- allowedValues: ["TRUE_VALUE"]
58
- }
53
+ "allowedValues": ["TRUE_VALUE"]
59
54
  }
60
55
  }]
61
56
  },
62
57
  version: "0.1.0"
63
58
  });
64
59
  expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`
60
+ {
61
+ "valueTypes": [
62
+ {
63
+ "metadata": {
64
+ "apiName": "apiName",
65
+ "displayMetadata": {
66
+ "description": "",
67
+ "displayName": "displayName",
68
+ },
69
+ "status": {
70
+ "active": {},
71
+ "type": "active",
72
+ },
73
+ },
74
+ "versions": [
65
75
  {
66
- "valueTypes": [
67
- {
68
- "metadata": {
69
- "apiName": "apiName",
70
- "displayMetadata": {
71
- "description": "",
72
- "displayName": "displayName",
73
- },
74
- "status": {
75
- "active": {},
76
- "type": "active",
77
- },
78
- },
79
- "versions": [
80
- {
81
- "baseType": {
82
- "boolean": {},
83
- },
84
- "constraints": [
85
- {
86
- "constraint": {
87
- "boolean": "boolean",
88
- "constraint": {
89
- "boolean": {
90
- "allowedValues": [
91
- "TRUE_VALUE",
92
- ],
93
- },
94
- },
95
- },
96
- },
97
- ],
98
- "exampleValues": [],
99
- "version": "0.1.0",
100
- },
101
- ],
102
- },
103
- ],
104
- }
76
+ "baseType": {
77
+ "boolean": {},
78
+ "type": "boolean",
79
+ },
80
+ "constraints": [
81
+ {
82
+ "constraint": {
83
+ "constraint": {
84
+ "boolean": {
85
+ "allowedValues": [
86
+ "TRUE_VALUE",
87
+ ],
88
+ },
89
+ "type": "boolean",
90
+ },
91
+ "failureMessage": undefined,
92
+ },
93
+ },
94
+ ],
95
+ "exampleValues": [],
96
+ "version": "0.1.0",
97
+ },
98
+ ],
99
+ },
100
+ ],
101
+ }
105
102
  `);
106
103
  });
104
+
105
+ // N.B Not sure what this is for but I don't want to break anything so I added the eslint ignore
106
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
107
107
  defineOntology("com.palantir.", () => {});
108
108
  });
109
109
  describe("Interfaces", () => {
@@ -144,7 +144,7 @@ describe("Ontology Defining", () => {
144
144
  foo: "string"
145
145
  }
146
146
  });
147
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
147
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
148
148
  {
149
149
  "blockPermissionInformation": {
150
150
  "actionTypes": {},
@@ -184,6 +184,7 @@ describe("Ontology Defining", () => {
184
184
  "analyzerOverride": undefined,
185
185
  "enableAsciiFolding": undefined,
186
186
  "isLongText": false,
187
+ "supportsEfficientLeadingWildcard": false,
187
188
  "supportsExactMatching": true,
188
189
  },
189
190
  "type": "string",
@@ -208,6 +209,7 @@ describe("Ontology Defining", () => {
208
209
  },
209
210
  },
210
211
  },
212
+ "objectTypes": {},
211
213
  "sharedPropertyTypes": {
212
214
  "com.palantir.foo": {
213
215
  "sharedPropertyType": {
@@ -228,6 +230,7 @@ describe("Ontology Defining", () => {
228
230
  "analyzerOverride": undefined,
229
231
  "enableAsciiFolding": undefined,
230
232
  "isLongText": false,
233
+ "supportsEfficientLeadingWildcard": false,
231
234
  "supportsExactMatching": true,
232
235
  },
233
236
  "type": "string",
@@ -254,7 +257,7 @@ describe("Ontology Defining", () => {
254
257
  apiName: "foo",
255
258
  type: "string"
256
259
  });
257
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
260
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
258
261
  {
259
262
  "blockPermissionInformation": {
260
263
  "actionTypes": {},
@@ -262,6 +265,7 @@ describe("Ontology Defining", () => {
262
265
  "objectTypes": {},
263
266
  },
264
267
  "interfaceTypes": {},
268
+ "objectTypes": {},
265
269
  "sharedPropertyTypes": {
266
270
  "com.palantir.foo": {
267
271
  "sharedPropertyType": {
@@ -282,6 +286,7 @@ describe("Ontology Defining", () => {
282
286
  "analyzerOverride": undefined,
283
287
  "enableAsciiFolding": undefined,
284
288
  "isLongText": false,
289
+ "supportsEfficientLeadingWildcard": false,
285
290
  "supportsExactMatching": true,
286
291
  },
287
292
  "type": "string",
@@ -326,7 +331,7 @@ describe("Ontology Defining", () => {
326
331
  },
327
332
  extends: [parentInterface]
328
333
  });
329
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
334
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
330
335
  {
331
336
  "blockPermissionInformation": {
332
337
  "actionTypes": {},
@@ -368,6 +373,7 @@ describe("Ontology Defining", () => {
368
373
  "analyzerOverride": undefined,
369
374
  "enableAsciiFolding": undefined,
370
375
  "isLongText": false,
376
+ "supportsEfficientLeadingWildcard": false,
371
377
  "supportsExactMatching": true,
372
378
  },
373
379
  "type": "string",
@@ -423,6 +429,7 @@ describe("Ontology Defining", () => {
423
429
  "analyzerOverride": undefined,
424
430
  "enableAsciiFolding": undefined,
425
431
  "isLongText": false,
432
+ "supportsEfficientLeadingWildcard": false,
426
433
  "supportsExactMatching": true,
427
434
  },
428
435
  "type": "string",
@@ -447,6 +454,7 @@ describe("Ontology Defining", () => {
447
454
  },
448
455
  },
449
456
  },
457
+ "objectTypes": {},
450
458
  "sharedPropertyTypes": {
451
459
  "com.palantir.property1": {
452
460
  "sharedPropertyType": {
@@ -467,6 +475,7 @@ describe("Ontology Defining", () => {
467
475
  "analyzerOverride": undefined,
468
476
  "enableAsciiFolding": undefined,
469
477
  "isLongText": false,
478
+ "supportsEfficientLeadingWildcard": false,
470
479
  "supportsExactMatching": true,
471
480
  },
472
481
  "type": "string",
@@ -503,6 +512,7 @@ describe("Ontology Defining", () => {
503
512
  "analyzerOverride": undefined,
504
513
  "enableAsciiFolding": undefined,
505
514
  "isLongText": false,
515
+ "supportsEfficientLeadingWildcard": false,
506
516
  "supportsExactMatching": true,
507
517
  },
508
518
  "type": "string",
@@ -538,7 +548,7 @@ describe("Ontology Defining", () => {
538
548
  },
539
549
  extends: ["parentInterface"]
540
550
  });
541
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
551
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
542
552
  {
543
553
  "blockPermissionInformation": {
544
554
  "actionTypes": {},
@@ -580,6 +590,7 @@ describe("Ontology Defining", () => {
580
590
  "analyzerOverride": undefined,
581
591
  "enableAsciiFolding": undefined,
582
592
  "isLongText": false,
593
+ "supportsEfficientLeadingWildcard": false,
583
594
  "supportsExactMatching": true,
584
595
  },
585
596
  "type": "string",
@@ -635,6 +646,7 @@ describe("Ontology Defining", () => {
635
646
  "analyzerOverride": undefined,
636
647
  "enableAsciiFolding": undefined,
637
648
  "isLongText": false,
649
+ "supportsEfficientLeadingWildcard": false,
638
650
  "supportsExactMatching": true,
639
651
  },
640
652
  "type": "string",
@@ -659,6 +671,7 @@ describe("Ontology Defining", () => {
659
671
  },
660
672
  },
661
673
  },
674
+ "objectTypes": {},
662
675
  "sharedPropertyTypes": {
663
676
  "com.palantir.property1": {
664
677
  "sharedPropertyType": {
@@ -679,6 +692,7 @@ describe("Ontology Defining", () => {
679
692
  "analyzerOverride": undefined,
680
693
  "enableAsciiFolding": undefined,
681
694
  "isLongText": false,
695
+ "supportsEfficientLeadingWildcard": false,
682
696
  "supportsExactMatching": true,
683
697
  },
684
698
  "type": "string",
@@ -715,6 +729,7 @@ describe("Ontology Defining", () => {
715
729
  "analyzerOverride": undefined,
716
730
  "enableAsciiFolding": undefined,
717
731
  "isLongText": false,
732
+ "supportsEfficientLeadingWildcard": false,
718
733
  "supportsExactMatching": true,
719
734
  },
720
735
  "type": "string",
@@ -755,7 +770,7 @@ describe("Ontology Defining", () => {
755
770
  toOne: b,
756
771
  apiName: "singleLink"
757
772
  });
758
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
773
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
759
774
  {
760
775
  "blockPermissionInformation": {
761
776
  "actionTypes": {},
@@ -818,6 +833,7 @@ describe("Ontology Defining", () => {
818
833
  },
819
834
  },
820
835
  },
836
+ "objectTypes": {},
821
837
  "sharedPropertyTypes": {},
822
838
  }
823
839
  `);
@@ -828,7 +844,7 @@ describe("Ontology Defining", () => {
828
844
  toMany: b,
829
845
  apiName: "manyLink"
830
846
  });
831
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
847
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
832
848
  {
833
849
  "blockPermissionInformation": {
834
850
  "actionTypes": {},
@@ -891,6 +907,7 @@ describe("Ontology Defining", () => {
891
907
  },
892
908
  },
893
909
  },
910
+ "objectTypes": {},
894
911
  "sharedPropertyTypes": {},
895
912
  }
896
913
  `);
@@ -926,7 +943,7 @@ describe("Ontology Defining", () => {
926
943
  locator: "airplane"
927
944
  }
928
945
  });
929
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
946
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
930
947
  {
931
948
  "blockPermissionInformation": {
932
949
  "actionTypes": {},
@@ -972,6 +989,7 @@ describe("Ontology Defining", () => {
972
989
  "analyzerOverride": undefined,
973
990
  "enableAsciiFolding": undefined,
974
991
  "isLongText": false,
992
+ "supportsEfficientLeadingWildcard": false,
975
993
  "supportsExactMatching": true,
976
994
  },
977
995
  "type": "string",
@@ -996,6 +1014,7 @@ describe("Ontology Defining", () => {
996
1014
  },
997
1015
  },
998
1016
  },
1017
+ "objectTypes": {},
999
1018
  "sharedPropertyTypes": {
1000
1019
  "com.palantir.fooSpt": {
1001
1020
  "sharedPropertyType": {
@@ -1016,6 +1035,7 @@ describe("Ontology Defining", () => {
1016
1035
  "analyzerOverride": undefined,
1017
1036
  "enableAsciiFolding": undefined,
1018
1037
  "isLongText": false,
1038
+ "supportsEfficientLeadingWildcard": false,
1019
1039
  "supportsExactMatching": true,
1020
1040
  },
1021
1041
  "type": "string",
@@ -1037,5 +1057,626 @@ describe("Ontology Defining", () => {
1037
1057
  }
1038
1058
  `);
1039
1059
  });
1060
+ it("properly serializes both types of struct SPTs", () => {
1061
+ defineSharedPropertyType({
1062
+ apiName: "fooSpt",
1063
+ type: {
1064
+ type: "struct",
1065
+ structDefinition: {
1066
+ "simpleProperty": "boolean",
1067
+ "complexProperty": {
1068
+ fieldType: "date",
1069
+ displayMetadata: {
1070
+ displayName: "complex property",
1071
+ description: undefined
1072
+ }
1073
+ }
1074
+ }
1075
+ }
1076
+ });
1077
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1078
+ {
1079
+ "blockPermissionInformation": {
1080
+ "actionTypes": {},
1081
+ "linkTypes": {},
1082
+ "objectTypes": {},
1083
+ },
1084
+ "interfaceTypes": {},
1085
+ "objectTypes": {},
1086
+ "sharedPropertyTypes": {
1087
+ "com.palantir.fooSpt": {
1088
+ "sharedPropertyType": {
1089
+ "aliases": [],
1090
+ "apiName": "com.palantir.fooSpt",
1091
+ "baseFormatter": undefined,
1092
+ "dataConstraints": undefined,
1093
+ "displayMetadata": {
1094
+ "description": undefined,
1095
+ "displayName": "fooSpt",
1096
+ "visibility": "NORMAL",
1097
+ },
1098
+ "gothamMapping": undefined,
1099
+ "indexedForSearch": true,
1100
+ "provenance": undefined,
1101
+ "type": {
1102
+ "struct": {
1103
+ "structFields": [
1104
+ {
1105
+ "aliases": [],
1106
+ "apiName": "simpleProperty",
1107
+ "displayMetadata": {
1108
+ "description": undefined,
1109
+ "displayName": "simpleProperty",
1110
+ },
1111
+ "fieldType": {
1112
+ "boolean": {},
1113
+ "type": "boolean",
1114
+ },
1115
+ "typeClasses": [],
1116
+ },
1117
+ {
1118
+ "aliases": [],
1119
+ "apiName": "complexProperty",
1120
+ "displayMetadata": {
1121
+ "description": undefined,
1122
+ "displayName": "complex property",
1123
+ },
1124
+ "fieldType": {
1125
+ "date": {},
1126
+ "type": "date",
1127
+ },
1128
+ "typeClasses": [],
1129
+ },
1130
+ ],
1131
+ },
1132
+ "type": "struct",
1133
+ },
1134
+ "typeClasses": [
1135
+ {
1136
+ "kind": "render_hint",
1137
+ "name": "SELECTABLE",
1138
+ },
1139
+ {
1140
+ "kind": "render_hint",
1141
+ "name": "SORTABLE",
1142
+ },
1143
+ ],
1144
+ "valueType": undefined,
1145
+ },
1146
+ },
1147
+ },
1148
+ }
1149
+ `);
1150
+ });
1151
+ it("Adds imported SPTs only to the interface definition", () => {
1152
+ const regularSpt = defineSharedPropertyType({
1153
+ apiName: "foo",
1154
+ type: {
1155
+ type: "marking",
1156
+ markingType: "CBAC"
1157
+ }
1158
+ });
1159
+ const importedSpt = importSharedPropertyType({
1160
+ apiName: "bar",
1161
+ typeHint: "string",
1162
+ packageName: "com.palantir.bar"
1163
+ });
1164
+ defineInterface({
1165
+ apiName: "interface",
1166
+ properties: {
1167
+ foo: regularSpt,
1168
+ bar: importedSpt
1169
+ }
1170
+ });
1171
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1172
+ {
1173
+ "blockPermissionInformation": {
1174
+ "actionTypes": {},
1175
+ "linkTypes": {},
1176
+ "objectTypes": {},
1177
+ },
1178
+ "interfaceTypes": {
1179
+ "com.palantir.interface": {
1180
+ "interfaceType": {
1181
+ "allExtendsInterfaces": [],
1182
+ "allLinks": [],
1183
+ "allProperties": [],
1184
+ "apiName": "com.palantir.interface",
1185
+ "displayMetadata": {
1186
+ "description": "interface",
1187
+ "displayName": "interface",
1188
+ "icon": undefined,
1189
+ },
1190
+ "extendsInterfaces": [],
1191
+ "links": [],
1192
+ "properties": [
1193
+ {
1194
+ "aliases": [],
1195
+ "apiName": "com.palantir.foo",
1196
+ "baseFormatter": undefined,
1197
+ "dataConstraints": {
1198
+ "nullability": undefined,
1199
+ "nullabilityV2": {
1200
+ "noEmptyCollections": true,
1201
+ "noNulls": true,
1202
+ },
1203
+ "propertyTypeConstraints": [],
1204
+ },
1205
+ "displayMetadata": {
1206
+ "description": undefined,
1207
+ "displayName": "foo",
1208
+ "visibility": "NORMAL",
1209
+ },
1210
+ "gothamMapping": undefined,
1211
+ "indexedForSearch": true,
1212
+ "provenance": undefined,
1213
+ "type": {
1214
+ "marking": {
1215
+ "markingType": "CBAC",
1216
+ },
1217
+ "type": "marking",
1218
+ },
1219
+ "typeClasses": [
1220
+ {
1221
+ "kind": "render_hint",
1222
+ "name": "SELECTABLE",
1223
+ },
1224
+ {
1225
+ "kind": "render_hint",
1226
+ "name": "SORTABLE",
1227
+ },
1228
+ ],
1229
+ "valueType": undefined,
1230
+ },
1231
+ {
1232
+ "aliases": [],
1233
+ "apiName": "com.palantir.bar.bar",
1234
+ "baseFormatter": undefined,
1235
+ "dataConstraints": undefined,
1236
+ "displayMetadata": {
1237
+ "description": undefined,
1238
+ "displayName": "com.palantir.bar.bar",
1239
+ "visibility": "NORMAL",
1240
+ },
1241
+ "gothamMapping": undefined,
1242
+ "indexedForSearch": true,
1243
+ "provenance": undefined,
1244
+ "type": {
1245
+ "string": {
1246
+ "analyzerOverride": undefined,
1247
+ "enableAsciiFolding": undefined,
1248
+ "isLongText": false,
1249
+ "supportsEfficientLeadingWildcard": false,
1250
+ "supportsExactMatching": true,
1251
+ },
1252
+ "type": "string",
1253
+ },
1254
+ "typeClasses": [],
1255
+ "valueType": undefined,
1256
+ },
1257
+ ],
1258
+ "status": {
1259
+ "active": {},
1260
+ "type": "active",
1261
+ },
1262
+ },
1263
+ },
1264
+ },
1265
+ "objectTypes": {},
1266
+ "sharedPropertyTypes": {
1267
+ "com.palantir.foo": {
1268
+ "sharedPropertyType": {
1269
+ "aliases": [],
1270
+ "apiName": "com.palantir.foo",
1271
+ "baseFormatter": undefined,
1272
+ "dataConstraints": {
1273
+ "nullability": undefined,
1274
+ "nullabilityV2": {
1275
+ "noEmptyCollections": true,
1276
+ "noNulls": true,
1277
+ },
1278
+ "propertyTypeConstraints": [],
1279
+ },
1280
+ "displayMetadata": {
1281
+ "description": undefined,
1282
+ "displayName": "foo",
1283
+ "visibility": "NORMAL",
1284
+ },
1285
+ "gothamMapping": undefined,
1286
+ "indexedForSearch": true,
1287
+ "provenance": undefined,
1288
+ "type": {
1289
+ "marking": {
1290
+ "markingType": "CBAC",
1291
+ },
1292
+ "type": "marking",
1293
+ },
1294
+ "typeClasses": [
1295
+ {
1296
+ "kind": "render_hint",
1297
+ "name": "SELECTABLE",
1298
+ },
1299
+ {
1300
+ "kind": "render_hint",
1301
+ "name": "SORTABLE",
1302
+ },
1303
+ ],
1304
+ "valueType": undefined,
1305
+ },
1306
+ },
1307
+ },
1308
+ }
1309
+ `);
1310
+ expect(dumpOntologyFullMetadata().importedTypes).toMatchInlineSnapshot(`
1311
+ {
1312
+ "sharedPropertyTypes": [
1313
+ {
1314
+ "apiName": "bar",
1315
+ "packageName": "com.palantir.bar",
1316
+ },
1317
+ ],
1318
+ }
1319
+ `);
1320
+ });
1321
+ it("defaults interface status to active", () => {
1322
+ const result = defineInterface({
1323
+ apiName: "Foo"
1324
+ });
1325
+ expect(result.status).toEqual({
1326
+ type: "active",
1327
+ active: {}
1328
+ });
1329
+ });
1330
+ it("sets interface status as experimental from opts as typed", () => {
1331
+ const result = defineInterface({
1332
+ apiName: "Foo",
1333
+ status: {
1334
+ type: "experimental"
1335
+ }
1336
+ });
1337
+ expect(result.status).toEqual({
1338
+ type: "experimental",
1339
+ experimental: {}
1340
+ });
1341
+ });
1342
+ it("sets interface status as deprecated from opts as typed", () => {
1343
+ const result = defineInterface({
1344
+ apiName: "Foo",
1345
+ status: {
1346
+ type: "deprecated",
1347
+ message: "foo",
1348
+ deadline: "foo"
1349
+ }
1350
+ });
1351
+ expect(result.status).toEqual({
1352
+ type: "deprecated",
1353
+ deprecated: {
1354
+ message: "foo",
1355
+ deadline: "foo"
1356
+ }
1357
+ });
1358
+ });
1359
+ describe("Objects", () => {
1360
+ it("Fails if any property reference does not exist", () => {
1361
+ const spt = defineSharedPropertyType({
1362
+ apiName: "foo",
1363
+ type: "string"
1364
+ });
1365
+ const sample = defineInterface({
1366
+ apiName: "interface",
1367
+ properties: {
1368
+ foo: spt
1369
+ }
1370
+ });
1371
+ expect(() => {
1372
+ defineObject({
1373
+ titlePropertyApiName: "fizz",
1374
+ displayName: "Foo",
1375
+ pluralDisplayName: "Foo",
1376
+ apiName: "foo",
1377
+ primaryKeys: ["bar"],
1378
+ properties: [{
1379
+ apiName: "bar",
1380
+ type: "string",
1381
+ displayName: "Bar"
1382
+ }]
1383
+ });
1384
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Title property fizz is not defined on object foo]`);
1385
+ expect(() => {
1386
+ defineObject({
1387
+ titlePropertyApiName: "bar",
1388
+ displayName: "Foo",
1389
+ pluralDisplayName: "Foo",
1390
+ apiName: "foo",
1391
+ primaryKeys: ["fizz"],
1392
+ properties: [{
1393
+ apiName: "bar",
1394
+ type: "string",
1395
+ displayName: "Bar"
1396
+ }]
1397
+ });
1398
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Primary key properties fizz do not exist on object foo]`);
1399
+ expect(() => {
1400
+ defineObject({
1401
+ titlePropertyApiName: "bar",
1402
+ displayName: "Foo",
1403
+ pluralDisplayName: "Foo",
1404
+ apiName: "foo",
1405
+ primaryKeys: ["bar"],
1406
+ properties: [{
1407
+ apiName: "bar",
1408
+ type: "string",
1409
+ displayName: "Bar"
1410
+ }],
1411
+ implementsInterfaces: [{
1412
+ implements: sample,
1413
+ propertyMapping: [{
1414
+ interfaceProperty: "foo",
1415
+ mapsTo: "fizz"
1416
+ }]
1417
+ }]
1418
+ });
1419
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Object property mapped to interface does not exist. Object Property Mapped: fizz\n]`);
1420
+ expect(() => {
1421
+ defineObject({
1422
+ titlePropertyApiName: "bar",
1423
+ displayName: "Foo",
1424
+ pluralDisplayName: "Foo",
1425
+ apiName: "foo",
1426
+ primaryKeys: ["bar"],
1427
+ properties: [{
1428
+ apiName: "bar",
1429
+ type: "string",
1430
+ displayName: "Bar"
1431
+ }],
1432
+ implementsInterfaces: [{
1433
+ implements: sample,
1434
+ propertyMapping: [{
1435
+ interfaceProperty: "fizz",
1436
+ mapsTo: "bar"
1437
+ }, {
1438
+ interfaceProperty: "foo",
1439
+ mapsTo: "bar"
1440
+ }]
1441
+ }]
1442
+ });
1443
+ }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: \nOntology Definition Error: Interface property com.palantir.interface.fizz referenced in foo object does not exist\n]`);
1444
+ });
1445
+ it("Objects properly defined", () => {
1446
+ const spt = defineSharedPropertyType({
1447
+ apiName: "foo",
1448
+ type: "string"
1449
+ });
1450
+ const sample = defineInterface({
1451
+ apiName: "interface",
1452
+ properties: {
1453
+ foo: spt
1454
+ }
1455
+ });
1456
+ defineObject({
1457
+ titlePropertyApiName: "bar",
1458
+ displayName: "Foo",
1459
+ pluralDisplayName: "Foo",
1460
+ apiName: "foo",
1461
+ primaryKeys: ["bar"],
1462
+ properties: [{
1463
+ apiName: "bar",
1464
+ type: "string",
1465
+ displayName: "Bar"
1466
+ }],
1467
+ implementsInterfaces: [{
1468
+ implements: sample,
1469
+ propertyMapping: [{
1470
+ interfaceProperty: "foo",
1471
+ mapsTo: "bar"
1472
+ }]
1473
+ }]
1474
+ });
1475
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1476
+ {
1477
+ "blockPermissionInformation": {
1478
+ "actionTypes": {},
1479
+ "linkTypes": {},
1480
+ "objectTypes": {},
1481
+ },
1482
+ "interfaceTypes": {
1483
+ "com.palantir.interface": {
1484
+ "interfaceType": {
1485
+ "allExtendsInterfaces": [],
1486
+ "allLinks": [],
1487
+ "allProperties": [],
1488
+ "apiName": "com.palantir.interface",
1489
+ "displayMetadata": {
1490
+ "description": "interface",
1491
+ "displayName": "interface",
1492
+ "icon": undefined,
1493
+ },
1494
+ "extendsInterfaces": [],
1495
+ "links": [],
1496
+ "properties": [
1497
+ {
1498
+ "aliases": [],
1499
+ "apiName": "com.palantir.foo",
1500
+ "baseFormatter": undefined,
1501
+ "dataConstraints": undefined,
1502
+ "displayMetadata": {
1503
+ "description": undefined,
1504
+ "displayName": "foo",
1505
+ "visibility": "NORMAL",
1506
+ },
1507
+ "gothamMapping": undefined,
1508
+ "indexedForSearch": true,
1509
+ "provenance": undefined,
1510
+ "type": {
1511
+ "string": {
1512
+ "analyzerOverride": undefined,
1513
+ "enableAsciiFolding": undefined,
1514
+ "isLongText": false,
1515
+ "supportsEfficientLeadingWildcard": false,
1516
+ "supportsExactMatching": true,
1517
+ },
1518
+ "type": "string",
1519
+ },
1520
+ "typeClasses": [
1521
+ {
1522
+ "kind": "render_hint",
1523
+ "name": "SELECTABLE",
1524
+ },
1525
+ {
1526
+ "kind": "render_hint",
1527
+ "name": "SORTABLE",
1528
+ },
1529
+ ],
1530
+ "valueType": undefined,
1531
+ },
1532
+ ],
1533
+ "status": {
1534
+ "active": {},
1535
+ "type": "active",
1536
+ },
1537
+ },
1538
+ },
1539
+ },
1540
+ "objectTypes": {
1541
+ "com.palantir.foo": {
1542
+ "datasources": [
1543
+ {
1544
+ "datasource": {
1545
+ "datasetV2": {
1546
+ "datasetRid": "com.palantir.foo",
1547
+ "propertyMapping": {
1548
+ "bar": {
1549
+ "column": "bar",
1550
+ "type": "column",
1551
+ },
1552
+ },
1553
+ },
1554
+ "type": "datasetV2",
1555
+ },
1556
+ "editsConfiguration": {
1557
+ "onlyAllowPrivilegedEdits": false,
1558
+ },
1559
+ "redacted": false,
1560
+ "rid": "ri.ontology.main.datasource.com.palantir.foo",
1561
+ },
1562
+ ],
1563
+ "entityMetadata": {
1564
+ "arePatchesEnabled": false,
1565
+ },
1566
+ "objectType": {
1567
+ "allImplementsInterfaces": {},
1568
+ "apiName": "com.palantir.foo",
1569
+ "displayMetadata": {
1570
+ "description": undefined,
1571
+ "displayName": "Foo",
1572
+ "groupDisplayName": undefined,
1573
+ "icon": {
1574
+ "blueprint": {
1575
+ "color": "#2D72D2",
1576
+ "locator": "cube",
1577
+ },
1578
+ "type": "blueprint",
1579
+ },
1580
+ "pluralDisplayName": "Foo",
1581
+ "visibility": "NORMAL",
1582
+ },
1583
+ "implementsInterfaces2": [
1584
+ {
1585
+ "interfaceTypeApiName": "com.palantir.interface",
1586
+ "properties": {
1587
+ "com.palantir.foo": {
1588
+ "propertyTypeRid": "bar",
1589
+ },
1590
+ },
1591
+ },
1592
+ ],
1593
+ "primaryKeys": [
1594
+ "bar",
1595
+ ],
1596
+ "propertyTypes": {
1597
+ "bar": {
1598
+ "apiName": "bar",
1599
+ "baseFormatter": undefined,
1600
+ "dataConstraints": undefined,
1601
+ "displayMetadata": {
1602
+ "description": undefined,
1603
+ "displayName": "Bar",
1604
+ "visibility": "NORMAL",
1605
+ },
1606
+ "indexedForSearch": true,
1607
+ "inlineAction": undefined,
1608
+ "ruleSetBinding": undefined,
1609
+ "sharedPropertyTypeApiName": undefined,
1610
+ "sharedPropertyTypeRid": undefined,
1611
+ "status": {
1612
+ "active": {},
1613
+ "type": "active",
1614
+ },
1615
+ "type": {
1616
+ "string": {
1617
+ "analyzerOverride": undefined,
1618
+ "enableAsciiFolding": undefined,
1619
+ "isLongText": false,
1620
+ "supportsEfficientLeadingWildcard": false,
1621
+ "supportsExactMatching": true,
1622
+ },
1623
+ "type": "string",
1624
+ },
1625
+ "typeClasses": [],
1626
+ "valueType": undefined,
1627
+ },
1628
+ },
1629
+ "redacted": false,
1630
+ "status": {
1631
+ "active": {},
1632
+ "type": "active",
1633
+ },
1634
+ "titlePropertyTypeRid": "bar",
1635
+ },
1636
+ },
1637
+ },
1638
+ "sharedPropertyTypes": {
1639
+ "com.palantir.foo": {
1640
+ "sharedPropertyType": {
1641
+ "aliases": [],
1642
+ "apiName": "com.palantir.foo",
1643
+ "baseFormatter": undefined,
1644
+ "dataConstraints": undefined,
1645
+ "displayMetadata": {
1646
+ "description": undefined,
1647
+ "displayName": "foo",
1648
+ "visibility": "NORMAL",
1649
+ },
1650
+ "gothamMapping": undefined,
1651
+ "indexedForSearch": true,
1652
+ "provenance": undefined,
1653
+ "type": {
1654
+ "string": {
1655
+ "analyzerOverride": undefined,
1656
+ "enableAsciiFolding": undefined,
1657
+ "isLongText": false,
1658
+ "supportsEfficientLeadingWildcard": false,
1659
+ "supportsExactMatching": true,
1660
+ },
1661
+ "type": "string",
1662
+ },
1663
+ "typeClasses": [
1664
+ {
1665
+ "kind": "render_hint",
1666
+ "name": "SELECTABLE",
1667
+ },
1668
+ {
1669
+ "kind": "render_hint",
1670
+ "name": "SORTABLE",
1671
+ },
1672
+ ],
1673
+ "valueType": undefined,
1674
+ },
1675
+ },
1676
+ },
1677
+ }
1678
+ `);
1679
+ });
1680
+ });
1040
1681
  });
1041
1682
  //# sourceMappingURL=overall.test.js.map