@osdk/maker 0.9.0-beta.2 → 0.9.0-beta.21

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 (76) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/build/browser/api/defineImportSpt.d.ts +10 -0
  3. package/build/browser/api/defineImportSpt.d.ts.map +1 -0
  4. package/build/browser/api/defineImportSpt.js +44 -0
  5. package/build/browser/api/defineImportSpt.js.map +1 -0
  6. package/build/browser/api/defineInterface.d.ts +11 -0
  7. package/build/browser/api/defineInterface.d.ts.map +1 -1
  8. package/build/browser/api/defineInterface.js +38 -11
  9. package/build/browser/api/defineInterface.js.map +1 -1
  10. package/build/browser/api/defineInterfaceLinkConstraint.d.ts +2 -0
  11. package/build/browser/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
  12. package/build/browser/api/defineInterfaceLinkConstraint.js +2 -2
  13. package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
  14. package/build/browser/api/defineLink.js +2 -2
  15. package/build/browser/api/defineLink.js.map +1 -1
  16. package/build/browser/api/defineObject.d.ts.map +1 -1
  17. package/build/browser/api/defineObject.js +19 -2
  18. package/build/browser/api/defineObject.js.map +1 -1
  19. package/build/browser/api/defineOntology.d.ts +3 -3
  20. package/build/browser/api/defineOntology.d.ts.map +1 -1
  21. package/build/browser/api/defineOntology.js +85 -24
  22. package/build/browser/api/defineOntology.js.map +1 -1
  23. package/build/browser/api/defineSpt.js +1 -1
  24. package/build/browser/api/defineSpt.js.map +1 -1
  25. package/build/browser/api/defineValueType.d.ts +8 -17
  26. package/build/browser/api/defineValueType.d.ts.map +1 -1
  27. package/build/browser/api/defineValueType.js +57 -11
  28. package/build/browser/api/defineValueType.js.map +1 -1
  29. package/build/browser/api/overall.test.js +351 -60
  30. package/build/browser/api/overall.test.js.map +1 -1
  31. package/build/browser/api/types.d.ts +196 -3
  32. package/build/browser/api/types.d.ts.map +1 -1
  33. package/build/browser/cli/main.js +3 -3
  34. package/build/browser/cli/main.js.map +1 -1
  35. package/build/browser/index.d.ts +1 -0
  36. package/build/browser/index.d.ts.map +1 -1
  37. package/build/browser/index.js +1 -0
  38. package/build/browser/index.js.map +1 -1
  39. package/build/esm/api/defineImportSpt.d.ts +10 -0
  40. package/build/esm/api/defineImportSpt.d.ts.map +1 -0
  41. package/build/esm/api/defineImportSpt.js +44 -0
  42. package/build/esm/api/defineImportSpt.js.map +1 -0
  43. package/build/esm/api/defineInterface.d.ts +11 -0
  44. package/build/esm/api/defineInterface.d.ts.map +1 -1
  45. package/build/esm/api/defineInterface.js +38 -11
  46. package/build/esm/api/defineInterface.js.map +1 -1
  47. package/build/esm/api/defineInterfaceLinkConstraint.d.ts +2 -0
  48. package/build/esm/api/defineInterfaceLinkConstraint.d.ts.map +1 -1
  49. package/build/esm/api/defineInterfaceLinkConstraint.js +2 -2
  50. package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
  51. package/build/esm/api/defineLink.js +2 -2
  52. package/build/esm/api/defineLink.js.map +1 -1
  53. package/build/esm/api/defineObject.d.ts.map +1 -1
  54. package/build/esm/api/defineObject.js +19 -2
  55. package/build/esm/api/defineObject.js.map +1 -1
  56. package/build/esm/api/defineOntology.d.ts +3 -3
  57. package/build/esm/api/defineOntology.d.ts.map +1 -1
  58. package/build/esm/api/defineOntology.js +85 -24
  59. package/build/esm/api/defineOntology.js.map +1 -1
  60. package/build/esm/api/defineSpt.js +1 -1
  61. package/build/esm/api/defineSpt.js.map +1 -1
  62. package/build/esm/api/defineValueType.d.ts +8 -17
  63. package/build/esm/api/defineValueType.d.ts.map +1 -1
  64. package/build/esm/api/defineValueType.js +57 -11
  65. package/build/esm/api/defineValueType.js.map +1 -1
  66. package/build/esm/api/overall.test.js +351 -60
  67. package/build/esm/api/overall.test.js.map +1 -1
  68. package/build/esm/api/types.d.ts +196 -3
  69. package/build/esm/api/types.d.ts.map +1 -1
  70. package/build/esm/cli/main.js +3 -3
  71. package/build/esm/cli/main.js.map +1 -1
  72. package/build/esm/index.d.ts +1 -0
  73. package/build/esm/index.d.ts.map +1 -1
  74. package/build/esm/index.js +1 -0
  75. package/build/esm/index.js.map +1 -1
  76. package/package.json +11 -9
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { beforeEach, describe, expect, it } from "vitest";
17
+ import { importSharedPropertyType } from "./defineImportSpt.js";
17
18
  import { defineInterface } from "./defineInterface.js";
18
19
  import { defineInterfaceLinkConstraint } from "./defineInterfaceLinkConstraint.js";
19
20
  import { defineOntology, dumpOntologyFullMetadata, dumpValueTypeWireType } from "./defineOntology.js";
@@ -28,15 +29,11 @@ describe("Ontology Defining", () => {
28
29
  expect(() => defineValueType({
29
30
  apiName: "apiName",
30
31
  displayName: "displayName",
31
- typeAndConstraints: {
32
- baseType: {
33
- boolean: {}
34
- },
32
+ type: {
33
+ "type": "boolean",
35
34
  constraints: [{
36
35
  constraint: {
37
- boolean: {
38
- allowedValues: ["TRUE_VALUE"]
39
- }
36
+ "allowedValues": ["TRUE_VALUE"]
40
37
  }
41
38
  }]
42
39
  },
@@ -47,61 +44,59 @@ describe("Ontology Defining", () => {
47
44
  defineValueType({
48
45
  apiName: "apiName",
49
46
  displayName: "displayName",
50
- typeAndConstraints: {
51
- baseType: {
52
- boolean: {}
53
- },
47
+ type: {
48
+ "type": "boolean",
54
49
  constraints: [{
55
50
  constraint: {
56
- boolean: {
57
- allowedValues: ["TRUE_VALUE"]
58
- }
51
+ "allowedValues": ["TRUE_VALUE"]
59
52
  }
60
53
  }]
61
54
  },
62
55
  version: "0.1.0"
63
56
  });
64
57
  expect(dumpValueTypeWireType()).toMatchInlineSnapshot(`
58
+ {
59
+ "valueTypes": [
60
+ {
61
+ "metadata": {
62
+ "apiName": "apiName",
63
+ "displayMetadata": {
64
+ "description": "",
65
+ "displayName": "displayName",
66
+ },
67
+ "status": {
68
+ "active": {},
69
+ "type": "active",
70
+ },
71
+ },
72
+ "versions": [
65
73
  {
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
- }
74
+ "baseType": {
75
+ "boolean": {},
76
+ "type": "boolean",
77
+ },
78
+ "constraints": [
79
+ {
80
+ "constraint": {
81
+ "constraint": {
82
+ "boolean": {
83
+ "allowedValues": [
84
+ "TRUE_VALUE",
85
+ ],
86
+ },
87
+ "type": "boolean",
88
+ },
89
+ "failureMessage": undefined,
90
+ },
91
+ },
92
+ ],
93
+ "exampleValues": [],
94
+ "version": "0.1.0",
95
+ },
96
+ ],
97
+ },
98
+ ],
99
+ }
105
100
  `);
106
101
  });
107
102
  defineOntology("com.palantir.", () => {});
@@ -144,7 +139,7 @@ describe("Ontology Defining", () => {
144
139
  foo: "string"
145
140
  }
146
141
  });
147
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
142
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
148
143
  {
149
144
  "blockPermissionInformation": {
150
145
  "actionTypes": {},
@@ -254,7 +249,7 @@ describe("Ontology Defining", () => {
254
249
  apiName: "foo",
255
250
  type: "string"
256
251
  });
257
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
252
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
258
253
  {
259
254
  "blockPermissionInformation": {
260
255
  "actionTypes": {},
@@ -326,7 +321,7 @@ describe("Ontology Defining", () => {
326
321
  },
327
322
  extends: [parentInterface]
328
323
  });
329
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
324
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
330
325
  {
331
326
  "blockPermissionInformation": {
332
327
  "actionTypes": {},
@@ -538,7 +533,7 @@ describe("Ontology Defining", () => {
538
533
  },
539
534
  extends: ["parentInterface"]
540
535
  });
541
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
536
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
542
537
  {
543
538
  "blockPermissionInformation": {
544
539
  "actionTypes": {},
@@ -755,7 +750,7 @@ describe("Ontology Defining", () => {
755
750
  toOne: b,
756
751
  apiName: "singleLink"
757
752
  });
758
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
753
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
759
754
  {
760
755
  "blockPermissionInformation": {
761
756
  "actionTypes": {},
@@ -828,7 +823,7 @@ describe("Ontology Defining", () => {
828
823
  toMany: b,
829
824
  apiName: "manyLink"
830
825
  });
831
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
826
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
832
827
  {
833
828
  "blockPermissionInformation": {
834
829
  "actionTypes": {},
@@ -926,7 +921,7 @@ describe("Ontology Defining", () => {
926
921
  locator: "airplane"
927
922
  }
928
923
  });
929
- expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
924
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
930
925
  {
931
926
  "blockPermissionInformation": {
932
927
  "actionTypes": {},
@@ -1037,5 +1032,301 @@ describe("Ontology Defining", () => {
1037
1032
  }
1038
1033
  `);
1039
1034
  });
1035
+ it("properly serializes both types of struct SPTs", () => {
1036
+ defineSharedPropertyType({
1037
+ apiName: "fooSpt",
1038
+ type: {
1039
+ type: "struct",
1040
+ structDefinition: {
1041
+ "simpleProperty": "boolean",
1042
+ "complexProperty": {
1043
+ fieldType: "date",
1044
+ displayMetadata: {
1045
+ displayName: "complex property",
1046
+ description: undefined
1047
+ }
1048
+ }
1049
+ }
1050
+ }
1051
+ });
1052
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1053
+ {
1054
+ "blockPermissionInformation": {
1055
+ "actionTypes": {},
1056
+ "linkTypes": {},
1057
+ "objectTypes": {},
1058
+ },
1059
+ "interfaceTypes": {},
1060
+ "sharedPropertyTypes": {
1061
+ "com.palantir.fooSpt": {
1062
+ "sharedPropertyType": {
1063
+ "aliases": [],
1064
+ "apiName": "com.palantir.fooSpt",
1065
+ "baseFormatter": undefined,
1066
+ "dataConstraints": undefined,
1067
+ "displayMetadata": {
1068
+ "description": undefined,
1069
+ "displayName": "fooSpt",
1070
+ "visibility": "NORMAL",
1071
+ },
1072
+ "gothamMapping": undefined,
1073
+ "indexedForSearch": true,
1074
+ "provenance": undefined,
1075
+ "type": {
1076
+ "struct": {
1077
+ "structFields": [
1078
+ {
1079
+ "aliases": [],
1080
+ "apiName": "simpleProperty",
1081
+ "displayMetadata": {
1082
+ "description": undefined,
1083
+ "displayName": "simpleProperty",
1084
+ },
1085
+ "fieldType": {
1086
+ "boolean": {},
1087
+ "type": "boolean",
1088
+ },
1089
+ "typeClasses": [],
1090
+ },
1091
+ {
1092
+ "aliases": [],
1093
+ "apiName": "complexProperty",
1094
+ "displayMetadata": {
1095
+ "description": undefined,
1096
+ "displayName": "complex property",
1097
+ },
1098
+ "fieldType": {
1099
+ "date": {},
1100
+ "type": "date",
1101
+ },
1102
+ "typeClasses": [],
1103
+ },
1104
+ ],
1105
+ },
1106
+ "type": "struct",
1107
+ },
1108
+ "typeClasses": [
1109
+ {
1110
+ "kind": "render_hint",
1111
+ "name": "SELECTABLE",
1112
+ },
1113
+ {
1114
+ "kind": "render_hint",
1115
+ "name": "SORTABLE",
1116
+ },
1117
+ ],
1118
+ "valueType": undefined,
1119
+ },
1120
+ },
1121
+ },
1122
+ }
1123
+ `);
1124
+ });
1125
+ it("Adds imported SPTs only to the interface definition", () => {
1126
+ const regularSpt = defineSharedPropertyType({
1127
+ apiName: "foo",
1128
+ type: {
1129
+ type: "marking",
1130
+ markingType: "CBAC"
1131
+ }
1132
+ });
1133
+ const importedSpt = importSharedPropertyType({
1134
+ apiName: "bar",
1135
+ typeHint: "string",
1136
+ packageName: "com.palantir.bar"
1137
+ });
1138
+ defineInterface({
1139
+ apiName: "interface",
1140
+ properties: {
1141
+ foo: regularSpt,
1142
+ bar: importedSpt
1143
+ }
1144
+ });
1145
+ expect(dumpOntologyFullMetadata().blockData).toMatchInlineSnapshot(`
1146
+ {
1147
+ "blockPermissionInformation": {
1148
+ "actionTypes": {},
1149
+ "linkTypes": {},
1150
+ "objectTypes": {},
1151
+ },
1152
+ "interfaceTypes": {
1153
+ "com.palantir.interface": {
1154
+ "interfaceType": {
1155
+ "allExtendsInterfaces": [],
1156
+ "allLinks": [],
1157
+ "allProperties": [],
1158
+ "apiName": "com.palantir.interface",
1159
+ "displayMetadata": {
1160
+ "description": "interface",
1161
+ "displayName": "interface",
1162
+ "icon": undefined,
1163
+ },
1164
+ "extendsInterfaces": [],
1165
+ "links": [],
1166
+ "properties": [
1167
+ {
1168
+ "aliases": [],
1169
+ "apiName": "com.palantir.foo",
1170
+ "baseFormatter": undefined,
1171
+ "dataConstraints": {
1172
+ "nullability": "NO_EXPLICIT_NULLS",
1173
+ "nullabilityV2": {
1174
+ "noEmptyCollections": true,
1175
+ "noNulls": true,
1176
+ },
1177
+ "propertyTypeConstraints": [],
1178
+ },
1179
+ "displayMetadata": {
1180
+ "description": undefined,
1181
+ "displayName": "foo",
1182
+ "visibility": "NORMAL",
1183
+ },
1184
+ "gothamMapping": undefined,
1185
+ "indexedForSearch": true,
1186
+ "provenance": undefined,
1187
+ "type": {
1188
+ "marking": {
1189
+ "markingType": "CBAC",
1190
+ },
1191
+ "type": "marking",
1192
+ },
1193
+ "typeClasses": [
1194
+ {
1195
+ "kind": "render_hint",
1196
+ "name": "SELECTABLE",
1197
+ },
1198
+ {
1199
+ "kind": "render_hint",
1200
+ "name": "SORTABLE",
1201
+ },
1202
+ ],
1203
+ "valueType": undefined,
1204
+ },
1205
+ {
1206
+ "aliases": [],
1207
+ "apiName": "com.palantir.bar.bar",
1208
+ "baseFormatter": undefined,
1209
+ "dataConstraints": undefined,
1210
+ "displayMetadata": {
1211
+ "description": undefined,
1212
+ "displayName": "com.palantir.bar.bar",
1213
+ "visibility": "NORMAL",
1214
+ },
1215
+ "gothamMapping": undefined,
1216
+ "indexedForSearch": true,
1217
+ "provenance": undefined,
1218
+ "type": {
1219
+ "string": {
1220
+ "analyzerOverride": undefined,
1221
+ "enableAsciiFolding": undefined,
1222
+ "isLongText": false,
1223
+ "supportsExactMatching": true,
1224
+ },
1225
+ "type": "string",
1226
+ },
1227
+ "typeClasses": [],
1228
+ "valueType": undefined,
1229
+ },
1230
+ ],
1231
+ "status": {
1232
+ "active": {},
1233
+ "type": "active",
1234
+ },
1235
+ },
1236
+ },
1237
+ },
1238
+ "sharedPropertyTypes": {
1239
+ "com.palantir.foo": {
1240
+ "sharedPropertyType": {
1241
+ "aliases": [],
1242
+ "apiName": "com.palantir.foo",
1243
+ "baseFormatter": undefined,
1244
+ "dataConstraints": {
1245
+ "nullability": "NO_EXPLICIT_NULLS",
1246
+ "nullabilityV2": {
1247
+ "noEmptyCollections": true,
1248
+ "noNulls": true,
1249
+ },
1250
+ "propertyTypeConstraints": [],
1251
+ },
1252
+ "displayMetadata": {
1253
+ "description": undefined,
1254
+ "displayName": "foo",
1255
+ "visibility": "NORMAL",
1256
+ },
1257
+ "gothamMapping": undefined,
1258
+ "indexedForSearch": true,
1259
+ "provenance": undefined,
1260
+ "type": {
1261
+ "marking": {
1262
+ "markingType": "CBAC",
1263
+ },
1264
+ "type": "marking",
1265
+ },
1266
+ "typeClasses": [
1267
+ {
1268
+ "kind": "render_hint",
1269
+ "name": "SELECTABLE",
1270
+ },
1271
+ {
1272
+ "kind": "render_hint",
1273
+ "name": "SORTABLE",
1274
+ },
1275
+ ],
1276
+ "valueType": undefined,
1277
+ },
1278
+ },
1279
+ },
1280
+ }
1281
+ `);
1282
+ expect(dumpOntologyFullMetadata().importedTypes).toMatchInlineSnapshot(`
1283
+ {
1284
+ "sharedPropertyTypes": [
1285
+ {
1286
+ "apiName": "bar",
1287
+ "packageName": "com.palantir.bar",
1288
+ },
1289
+ ],
1290
+ }
1291
+ `);
1292
+ });
1293
+ it("defaults interface status to active", () => {
1294
+ const result = defineInterface({
1295
+ apiName: "Foo"
1296
+ });
1297
+ expect(result.status).toEqual({
1298
+ type: "active",
1299
+ active: {}
1300
+ });
1301
+ });
1302
+ it("sets interface status as experimental from opts as typed", () => {
1303
+ const result = defineInterface({
1304
+ apiName: "Foo",
1305
+ status: {
1306
+ type: "experimental"
1307
+ }
1308
+ });
1309
+ expect(result.status).toEqual({
1310
+ type: "experimental",
1311
+ experimental: {}
1312
+ });
1313
+ });
1314
+ it("sets interface status as deprecated from opts as typed", () => {
1315
+ const result = defineInterface({
1316
+ apiName: "Foo",
1317
+ status: {
1318
+ type: "deprecated",
1319
+ message: "foo",
1320
+ deadline: "foo"
1321
+ }
1322
+ });
1323
+ expect(result.status).toEqual({
1324
+ type: "deprecated",
1325
+ deprecated: {
1326
+ message: "foo",
1327
+ deadline: "foo"
1328
+ }
1329
+ });
1330
+ });
1040
1331
  });
1041
1332
  //# sourceMappingURL=overall.test.js.map