@osdk/maker 0.9.0-beta.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/build/browser/api/defineImportSpt.js +24 -2
  3. package/build/browser/api/defineImportSpt.js.map +1 -1
  4. package/build/browser/api/defineInterface.js +34 -6
  5. package/build/browser/api/defineInterface.js.map +1 -1
  6. package/build/browser/api/defineInterfaceLinkConstraint.js +2 -1
  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 +130 -14
  11. package/build/browser/api/defineOntology.js.map +1 -1
  12. package/build/browser/api/defineSpt.js +2 -0
  13. package/build/browser/api/defineSpt.js.map +1 -1
  14. package/build/browser/api/defineValueType.js +57 -10
  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 +461 -68
  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 +3 -4
  23. package/build/browser/cli/main.js.map +1 -1
  24. package/build/browser/index.js +2 -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 +24 -2
  30. package/build/esm/api/defineImportSpt.js.map +1 -1
  31. package/build/esm/api/defineInterface.js +34 -6
  32. package/build/esm/api/defineInterface.js.map +1 -1
  33. package/build/esm/api/defineInterfaceLinkConstraint.js +2 -1
  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 +130 -14
  38. package/build/esm/api/defineOntology.js.map +1 -1
  39. package/build/esm/api/defineSpt.js +2 -0
  40. package/build/esm/api/defineSpt.js.map +1 -1
  41. package/build/esm/api/defineValueType.js +57 -10
  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 +461 -68
  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 +3 -4
  50. package/build/esm/cli/main.js.map +1 -1
  51. package/build/esm/index.js +2 -0
  52. package/build/esm/index.js.map +1 -1
  53. package/package.json +25 -12
  54. package/build/browser/api/defineImportSpt.d.ts +0 -10
  55. package/build/browser/api/defineImportSpt.d.ts.map +0 -1
  56. package/build/browser/api/defineInterface.d.ts +0 -14
  57. package/build/browser/api/defineInterface.d.ts.map +0 -1
  58. package/build/browser/api/defineInterfaceLinkConstraint.d.ts +0 -21
  59. package/build/browser/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
  60. package/build/browser/api/defineLink.d.ts +0 -18
  61. package/build/browser/api/defineLink.d.ts.map +0 -1
  62. package/build/browser/api/defineLink.js +0 -37
  63. package/build/browser/api/defineLink.js.map +0 -1
  64. package/build/browser/api/defineObject.d.ts +0 -15
  65. package/build/browser/api/defineObject.d.ts.map +0 -1
  66. package/build/browser/api/defineOntology.d.ts +0 -10
  67. package/build/browser/api/defineOntology.d.ts.map +0 -1
  68. package/build/browser/api/defineSpt.d.ts +0 -13
  69. package/build/browser/api/defineSpt.d.ts.map +0 -1
  70. package/build/browser/api/defineValueType.d.ts +0 -26
  71. package/build/browser/api/defineValueType.d.ts.map +0 -1
  72. package/build/browser/api/iconNames.d.ts +0 -3
  73. package/build/browser/api/iconNames.d.ts.map +0 -1
  74. package/build/browser/api/overall.test.d.ts +0 -2
  75. package/build/browser/api/overall.test.d.ts.map +0 -1
  76. package/build/browser/api/types.d.ts +0 -52
  77. package/build/browser/api/types.d.ts.map +0 -1
  78. package/build/browser/cli/main.d.ts +0 -2
  79. package/build/browser/cli/main.d.ts.map +0 -1
  80. package/build/browser/index.d.ts +0 -7
  81. package/build/browser/index.d.ts.map +0 -1
  82. package/build/esm/api/defineImportSpt.d.ts +0 -10
  83. package/build/esm/api/defineImportSpt.d.ts.map +0 -1
  84. package/build/esm/api/defineInterface.d.ts +0 -14
  85. package/build/esm/api/defineInterface.d.ts.map +0 -1
  86. package/build/esm/api/defineInterfaceLinkConstraint.d.ts +0 -21
  87. package/build/esm/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
  88. package/build/esm/api/defineLink.d.ts +0 -18
  89. package/build/esm/api/defineLink.d.ts.map +0 -1
  90. package/build/esm/api/defineLink.js +0 -37
  91. package/build/esm/api/defineLink.js.map +0 -1
  92. package/build/esm/api/defineObject.d.ts +0 -15
  93. package/build/esm/api/defineObject.d.ts.map +0 -1
  94. package/build/esm/api/defineOntology.d.ts +0 -10
  95. package/build/esm/api/defineOntology.d.ts.map +0 -1
  96. package/build/esm/api/defineSpt.d.ts +0 -13
  97. package/build/esm/api/defineSpt.d.ts.map +0 -1
  98. package/build/esm/api/defineValueType.d.ts +0 -26
  99. package/build/esm/api/defineValueType.d.ts.map +0 -1
  100. package/build/esm/api/iconNames.d.ts +0 -3
  101. package/build/esm/api/iconNames.d.ts.map +0 -1
  102. package/build/esm/api/overall.test.d.ts +0 -2
  103. package/build/esm/api/overall.test.d.ts.map +0 -1
  104. package/build/esm/api/types.d.ts +0 -52
  105. package/build/esm/api/types.d.ts.map +0 -1
  106. package/build/esm/cli/main.d.ts +0 -2
  107. package/build/esm/cli/main.d.ts.map +0 -1
  108. package/build/esm/index.d.ts +0 -7
  109. package/build/esm/index.d.ts.map +0 -1
@@ -13,98 +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";
17
18
  import { importSharedPropertyType } from "./defineImportSpt.js";
18
19
  import { defineInterface } from "./defineInterface.js";
19
20
  import { defineInterfaceLinkConstraint } from "./defineInterfaceLinkConstraint.js";
21
+ import { defineObject } from "./defineObject.js";
20
22
  import { defineOntology, dumpOntologyFullMetadata, dumpValueTypeWireType } from "./defineOntology.js";
21
23
  import { defineSharedPropertyType } from "./defineSpt.js";
22
24
  import { defineValueType } from "./defineValueType.js";
23
25
  describe("Ontology Defining", () => {
24
- beforeEach(() => {
25
- defineOntology("com.palantir.", () => {});
26
+ beforeEach(async () => {
27
+ await defineOntology("com.palantir.", () => {});
26
28
  });
27
29
  describe("ValueTypes", () => {
28
30
  it("Fails to define value type with incorrect semver", () => {
29
31
  expect(() => defineValueType({
30
32
  apiName: "apiName",
31
33
  displayName: "displayName",
32
- typeAndConstraints: {
33
- baseType: {
34
- boolean: {}
35
- },
34
+ type: {
35
+ "type": "boolean",
36
36
  constraints: [{
37
37
  constraint: {
38
- boolean: {
39
- allowedValues: ["TRUE_VALUE"]
40
- }
38
+ "allowedValues": ["TRUE_VALUE"]
41
39
  }
42
40
  }]
43
41
  },
44
42
  version: "not a version"
45
43
  })).toThrowErrorMatchingInlineSnapshot("[Error: Invariant failed: Version is not a valid semver]");
46
44
  });
47
- it("Correctly serializes a value type", () => {
45
+ it("Correctly serializes a value type", async () => {
48
46
  defineValueType({
49
47
  apiName: "apiName",
50
48
  displayName: "displayName",
51
- typeAndConstraints: {
52
- baseType: {
53
- boolean: {}
54
- },
49
+ type: {
50
+ "type": "boolean",
55
51
  constraints: [{
56
52
  constraint: {
57
- boolean: {
58
- allowedValues: ["TRUE_VALUE"]
59
- }
53
+ "allowedValues": ["TRUE_VALUE"]
60
54
  }
61
55
  }]
62
56
  },
63
57
  version: "0.1.0"
64
58
  });
65
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": [
66
75
  {
67
- "valueTypes": [
68
- {
69
- "metadata": {
70
- "apiName": "apiName",
71
- "displayMetadata": {
72
- "description": "",
73
- "displayName": "displayName",
74
- },
75
- "status": {
76
- "active": {},
77
- "type": "active",
78
- },
79
- },
80
- "versions": [
81
- {
82
- "baseType": {
83
- "boolean": {},
84
- },
85
- "constraints": [
86
- {
87
- "constraint": {
88
- "boolean": "boolean",
89
- "constraint": {
90
- "boolean": {
91
- "allowedValues": [
92
- "TRUE_VALUE",
93
- ],
94
- },
95
- },
96
- },
97
- },
98
- ],
99
- "exampleValues": [],
100
- "version": "0.1.0",
101
- },
102
- ],
103
- },
104
- ],
105
- }
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
+ }
106
102
  `);
107
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
108
107
  defineOntology("com.palantir.", () => {});
109
108
  });
110
109
  describe("Interfaces", () => {
@@ -145,7 +144,7 @@ describe("Ontology Defining", () => {
145
144
  foo: "string"
146
145
  }
147
146
  });
148
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
147
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
149
148
  {
150
149
  "blockPermissionInformation": {
151
150
  "actionTypes": {},
@@ -185,6 +184,7 @@ describe("Ontology Defining", () => {
185
184
  "analyzerOverride": undefined,
186
185
  "enableAsciiFolding": undefined,
187
186
  "isLongText": false,
187
+ "supportsEfficientLeadingWildcard": false,
188
188
  "supportsExactMatching": true,
189
189
  },
190
190
  "type": "string",
@@ -209,6 +209,7 @@ describe("Ontology Defining", () => {
209
209
  },
210
210
  },
211
211
  },
212
+ "objectTypes": {},
212
213
  "sharedPropertyTypes": {
213
214
  "com.palantir.foo": {
214
215
  "sharedPropertyType": {
@@ -229,6 +230,7 @@ describe("Ontology Defining", () => {
229
230
  "analyzerOverride": undefined,
230
231
  "enableAsciiFolding": undefined,
231
232
  "isLongText": false,
233
+ "supportsEfficientLeadingWildcard": false,
232
234
  "supportsExactMatching": true,
233
235
  },
234
236
  "type": "string",
@@ -255,7 +257,7 @@ describe("Ontology Defining", () => {
255
257
  apiName: "foo",
256
258
  type: "string"
257
259
  });
258
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
260
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
259
261
  {
260
262
  "blockPermissionInformation": {
261
263
  "actionTypes": {},
@@ -263,6 +265,7 @@ describe("Ontology Defining", () => {
263
265
  "objectTypes": {},
264
266
  },
265
267
  "interfaceTypes": {},
268
+ "objectTypes": {},
266
269
  "sharedPropertyTypes": {
267
270
  "com.palantir.foo": {
268
271
  "sharedPropertyType": {
@@ -283,6 +286,7 @@ describe("Ontology Defining", () => {
283
286
  "analyzerOverride": undefined,
284
287
  "enableAsciiFolding": undefined,
285
288
  "isLongText": false,
289
+ "supportsEfficientLeadingWildcard": false,
286
290
  "supportsExactMatching": true,
287
291
  },
288
292
  "type": "string",
@@ -327,7 +331,7 @@ describe("Ontology Defining", () => {
327
331
  },
328
332
  extends: [parentInterface]
329
333
  });
330
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
334
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
331
335
  {
332
336
  "blockPermissionInformation": {
333
337
  "actionTypes": {},
@@ -369,6 +373,7 @@ describe("Ontology Defining", () => {
369
373
  "analyzerOverride": undefined,
370
374
  "enableAsciiFolding": undefined,
371
375
  "isLongText": false,
376
+ "supportsEfficientLeadingWildcard": false,
372
377
  "supportsExactMatching": true,
373
378
  },
374
379
  "type": "string",
@@ -424,6 +429,7 @@ describe("Ontology Defining", () => {
424
429
  "analyzerOverride": undefined,
425
430
  "enableAsciiFolding": undefined,
426
431
  "isLongText": false,
432
+ "supportsEfficientLeadingWildcard": false,
427
433
  "supportsExactMatching": true,
428
434
  },
429
435
  "type": "string",
@@ -448,6 +454,7 @@ describe("Ontology Defining", () => {
448
454
  },
449
455
  },
450
456
  },
457
+ "objectTypes": {},
451
458
  "sharedPropertyTypes": {
452
459
  "com.palantir.property1": {
453
460
  "sharedPropertyType": {
@@ -468,6 +475,7 @@ describe("Ontology Defining", () => {
468
475
  "analyzerOverride": undefined,
469
476
  "enableAsciiFolding": undefined,
470
477
  "isLongText": false,
478
+ "supportsEfficientLeadingWildcard": false,
471
479
  "supportsExactMatching": true,
472
480
  },
473
481
  "type": "string",
@@ -504,6 +512,7 @@ describe("Ontology Defining", () => {
504
512
  "analyzerOverride": undefined,
505
513
  "enableAsciiFolding": undefined,
506
514
  "isLongText": false,
515
+ "supportsEfficientLeadingWildcard": false,
507
516
  "supportsExactMatching": true,
508
517
  },
509
518
  "type": "string",
@@ -539,7 +548,7 @@ describe("Ontology Defining", () => {
539
548
  },
540
549
  extends: ["parentInterface"]
541
550
  });
542
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
551
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
543
552
  {
544
553
  "blockPermissionInformation": {
545
554
  "actionTypes": {},
@@ -581,6 +590,7 @@ describe("Ontology Defining", () => {
581
590
  "analyzerOverride": undefined,
582
591
  "enableAsciiFolding": undefined,
583
592
  "isLongText": false,
593
+ "supportsEfficientLeadingWildcard": false,
584
594
  "supportsExactMatching": true,
585
595
  },
586
596
  "type": "string",
@@ -636,6 +646,7 @@ describe("Ontology Defining", () => {
636
646
  "analyzerOverride": undefined,
637
647
  "enableAsciiFolding": undefined,
638
648
  "isLongText": false,
649
+ "supportsEfficientLeadingWildcard": false,
639
650
  "supportsExactMatching": true,
640
651
  },
641
652
  "type": "string",
@@ -660,6 +671,7 @@ describe("Ontology Defining", () => {
660
671
  },
661
672
  },
662
673
  },
674
+ "objectTypes": {},
663
675
  "sharedPropertyTypes": {
664
676
  "com.palantir.property1": {
665
677
  "sharedPropertyType": {
@@ -680,6 +692,7 @@ describe("Ontology Defining", () => {
680
692
  "analyzerOverride": undefined,
681
693
  "enableAsciiFolding": undefined,
682
694
  "isLongText": false,
695
+ "supportsEfficientLeadingWildcard": false,
683
696
  "supportsExactMatching": true,
684
697
  },
685
698
  "type": "string",
@@ -716,6 +729,7 @@ describe("Ontology Defining", () => {
716
729
  "analyzerOverride": undefined,
717
730
  "enableAsciiFolding": undefined,
718
731
  "isLongText": false,
732
+ "supportsEfficientLeadingWildcard": false,
719
733
  "supportsExactMatching": true,
720
734
  },
721
735
  "type": "string",
@@ -756,7 +770,7 @@ describe("Ontology Defining", () => {
756
770
  toOne: b,
757
771
  apiName: "singleLink"
758
772
  });
759
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
773
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
760
774
  {
761
775
  "blockPermissionInformation": {
762
776
  "actionTypes": {},
@@ -819,6 +833,7 @@ describe("Ontology Defining", () => {
819
833
  },
820
834
  },
821
835
  },
836
+ "objectTypes": {},
822
837
  "sharedPropertyTypes": {},
823
838
  }
824
839
  `);
@@ -829,7 +844,7 @@ describe("Ontology Defining", () => {
829
844
  toMany: b,
830
845
  apiName: "manyLink"
831
846
  });
832
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
847
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
833
848
  {
834
849
  "blockPermissionInformation": {
835
850
  "actionTypes": {},
@@ -892,6 +907,7 @@ describe("Ontology Defining", () => {
892
907
  },
893
908
  },
894
909
  },
910
+ "objectTypes": {},
895
911
  "sharedPropertyTypes": {},
896
912
  }
897
913
  `);
@@ -927,7 +943,7 @@ describe("Ontology Defining", () => {
927
943
  locator: "airplane"
928
944
  }
929
945
  });
930
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
946
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
931
947
  {
932
948
  "blockPermissionInformation": {
933
949
  "actionTypes": {},
@@ -973,6 +989,7 @@ describe("Ontology Defining", () => {
973
989
  "analyzerOverride": undefined,
974
990
  "enableAsciiFolding": undefined,
975
991
  "isLongText": false,
992
+ "supportsEfficientLeadingWildcard": false,
976
993
  "supportsExactMatching": true,
977
994
  },
978
995
  "type": "string",
@@ -997,6 +1014,7 @@ describe("Ontology Defining", () => {
997
1014
  },
998
1015
  },
999
1016
  },
1017
+ "objectTypes": {},
1000
1018
  "sharedPropertyTypes": {
1001
1019
  "com.palantir.fooSpt": {
1002
1020
  "sharedPropertyType": {
@@ -1017,6 +1035,7 @@ describe("Ontology Defining", () => {
1017
1035
  "analyzerOverride": undefined,
1018
1036
  "enableAsciiFolding": undefined,
1019
1037
  "isLongText": false,
1038
+ "supportsEfficientLeadingWildcard": false,
1020
1039
  "supportsExactMatching": true,
1021
1040
  },
1022
1041
  "type": "string",
@@ -1055,7 +1074,7 @@ describe("Ontology Defining", () => {
1055
1074
  }
1056
1075
  }
1057
1076
  });
1058
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
1077
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1059
1078
  {
1060
1079
  "blockPermissionInformation": {
1061
1080
  "actionTypes": {},
@@ -1063,6 +1082,7 @@ describe("Ontology Defining", () => {
1063
1082
  "objectTypes": {},
1064
1083
  },
1065
1084
  "interfaceTypes": {},
1085
+ "objectTypes": {},
1066
1086
  "sharedPropertyTypes": {
1067
1087
  "com.palantir.fooSpt": {
1068
1088
  "sharedPropertyType": {
@@ -1138,7 +1158,8 @@ describe("Ontology Defining", () => {
1138
1158
  });
1139
1159
  const importedSpt = importSharedPropertyType({
1140
1160
  apiName: "bar",
1141
- typeHint: "string"
1161
+ typeHint: "string",
1162
+ packageName: "com.palantir.bar"
1142
1163
  });
1143
1164
  defineInterface({
1144
1165
  apiName: "interface",
@@ -1147,7 +1168,7 @@ describe("Ontology Defining", () => {
1147
1168
  bar: importedSpt
1148
1169
  }
1149
1170
  });
1150
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
1171
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1151
1172
  {
1152
1173
  "blockPermissionInformation": {
1153
1174
  "actionTypes": {},
@@ -1209,12 +1230,12 @@ describe("Ontology Defining", () => {
1209
1230
  },
1210
1231
  {
1211
1232
  "aliases": [],
1212
- "apiName": "bar",
1233
+ "apiName": "com.palantir.bar.bar",
1213
1234
  "baseFormatter": undefined,
1214
1235
  "dataConstraints": undefined,
1215
1236
  "displayMetadata": {
1216
1237
  "description": undefined,
1217
- "displayName": "bar",
1238
+ "displayName": "com.palantir.bar.bar",
1218
1239
  "visibility": "NORMAL",
1219
1240
  },
1220
1241
  "gothamMapping": undefined,
@@ -1225,6 +1246,7 @@ describe("Ontology Defining", () => {
1225
1246
  "analyzerOverride": undefined,
1226
1247
  "enableAsciiFolding": undefined,
1227
1248
  "isLongText": false,
1249
+ "supportsEfficientLeadingWildcard": false,
1228
1250
  "supportsExactMatching": true,
1229
1251
  },
1230
1252
  "type": "string",
@@ -1240,6 +1262,7 @@ describe("Ontology Defining", () => {
1240
1262
  },
1241
1263
  },
1242
1264
  },
1265
+ "objectTypes": {},
1243
1266
  "sharedPropertyTypes": {
1244
1267
  "com.palantir.foo": {
1245
1268
  "sharedPropertyType": {
@@ -1284,6 +1307,376 @@ describe("Ontology Defining", () => {
1284
1307
  },
1285
1308
  }
1286
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
+ });
1287
1680
  });
1288
1681
  });
1289
1682
  //# sourceMappingURL=overall.test.js.map