@osdk/maker 0.13.0-beta.1 → 0.13.0-beta.10
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.
- package/CHANGELOG.md +97 -0
- package/build/browser/api/defineAction.js +21 -19
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineObject.js +2 -0
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +33 -109
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/defineValueType.js +2 -1
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/markingconstraint.test.js +3 -3
- package/build/browser/api/markingconstraint.test.js.map +1 -1
- package/build/browser/api/objectStatus.test.js +4 -4
- package/build/browser/api/objectStatus.test.js.map +1 -1
- package/build/browser/api/overall.test.js +841 -310
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/propertyConversionUtils.js +3 -1
- package/build/browser/api/propertyConversionUtils.js.map +1 -1
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +5 -5
- package/build/browser/cli/main.js.map +1 -1
- package/build/cjs/index.cjs +67 -136
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +8 -10
- package/build/esm/api/defineAction.js +21 -19
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineObject.js +2 -0
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +33 -109
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/defineValueType.js +2 -1
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/markingconstraint.test.js +3 -3
- package/build/esm/api/markingconstraint.test.js.map +1 -1
- package/build/esm/api/objectStatus.test.js +4 -4
- package/build/esm/api/objectStatus.test.js.map +1 -1
- package/build/esm/api/overall.test.js +841 -310
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/propertyConversionUtils.js +3 -1
- package/build/esm/api/propertyConversionUtils.js.map +1 -1
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +5 -5
- package/build/esm/cli/main.js.map +1 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +1 -6
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -2
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/propertyConversionUtils.d.ts +2 -2
- package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
- package/build/types/api/types.d.ts +6 -14
- package/build/types/api/types.d.ts.map +1 -1
- 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.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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().
|
|
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,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
72
73
|
"displayMetadata": {
|
|
73
74
|
"description": "Foo",
|
|
74
75
|
"displayName": "Foo",
|
|
75
|
-
"icon": undefined,
|
|
76
76
|
},
|
|
77
77
|
"extendsInterfaces": [],
|
|
78
78
|
"links": [],
|
|
@@ -166,7 +166,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
166
166
|
},
|
|
167
167
|
},
|
|
168
168
|
}
|
|
169
|
-
`);});it("does not let you conflict spts",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(dumpOntologyFullMetadata().
|
|
169
|
+
`);});it("does not let you conflict spts",()=>{defineSharedPropertyType({apiName:"foo",type:"string"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
170
170
|
{
|
|
171
171
|
"actionTypes": {},
|
|
172
172
|
"blockPermissionInformation": {
|
|
@@ -216,7 +216,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
216
216
|
},
|
|
217
217
|
},
|
|
218
218
|
}
|
|
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().
|
|
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().ontology).toMatchInlineSnapshot(`
|
|
220
220
|
{
|
|
221
221
|
"actionTypes": {},
|
|
222
222
|
"blockPermissionInformation": {
|
|
@@ -231,7 +231,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
231
231
|
"displayMetadata": {
|
|
232
232
|
"description": "childInterface",
|
|
233
233
|
"displayName": "childInterface",
|
|
234
|
-
"icon": undefined,
|
|
235
234
|
},
|
|
236
235
|
"extendsInterfaces": [
|
|
237
236
|
"com.palantir.parentInterface",
|
|
@@ -291,7 +290,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
291
290
|
"displayMetadata": {
|
|
292
291
|
"description": "parentInterface",
|
|
293
292
|
"displayName": "parentInterface",
|
|
294
|
-
"icon": undefined,
|
|
295
293
|
},
|
|
296
294
|
"extendsInterfaces": [],
|
|
297
295
|
"links": [],
|
|
@@ -421,7 +419,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
421
419
|
},
|
|
422
420
|
},
|
|
423
421
|
}
|
|
424
|
-
`);});it("supports optional properties",()=>{defineInterface({apiName:"parentInterface",properties:{property1:{required:false,propertyDefinition:"string"}}});expect(dumpOntologyFullMetadata().
|
|
422
|
+
`);});it("supports optional properties",()=>{defineInterface({apiName:"parentInterface",properties:{property1:{required:false,propertyDefinition:"string"}}});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
425
423
|
{
|
|
426
424
|
"actionTypes": {},
|
|
427
425
|
"blockPermissionInformation": {
|
|
@@ -436,7 +434,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
436
434
|
"displayMetadata": {
|
|
437
435
|
"description": "parentInterface",
|
|
438
436
|
"displayName": "parentInterface",
|
|
439
|
-
"icon": undefined,
|
|
440
437
|
},
|
|
441
438
|
"extendsInterfaces": [],
|
|
442
439
|
"links": [],
|
|
@@ -530,7 +527,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
530
527
|
},
|
|
531
528
|
},
|
|
532
529
|
}
|
|
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().
|
|
530
|
+
`);});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
531
|
{
|
|
535
532
|
"actionTypes": {},
|
|
536
533
|
"blockPermissionInformation": {
|
|
@@ -545,7 +542,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
545
542
|
"displayMetadata": {
|
|
546
543
|
"description": "childInterface",
|
|
547
544
|
"displayName": "childInterface",
|
|
548
|
-
"icon": undefined,
|
|
549
545
|
},
|
|
550
546
|
"extendsInterfaces": [
|
|
551
547
|
"com.palantir.parentInterface",
|
|
@@ -605,7 +601,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
605
601
|
"displayMetadata": {
|
|
606
602
|
"description": "parentInterface",
|
|
607
603
|
"displayName": "parentInterface",
|
|
608
|
-
"icon": undefined,
|
|
609
604
|
},
|
|
610
605
|
"extendsInterfaces": [],
|
|
611
606
|
"links": [],
|
|
@@ -735,7 +730,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
735
730
|
},
|
|
736
731
|
},
|
|
737
732
|
}
|
|
738
|
-
`);});it("supports specifying searchable",()=>{defineInterface({apiName:"parentInterface",searchable:false});expect(dumpOntologyFullMetadata().
|
|
733
|
+
`);});it("supports specifying searchable",()=>{defineInterface({apiName:"parentInterface",searchable:false});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
739
734
|
{
|
|
740
735
|
"actionTypes": {},
|
|
741
736
|
"blockPermissionInformation": {
|
|
@@ -750,7 +745,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
750
745
|
"displayMetadata": {
|
|
751
746
|
"description": "parentInterface",
|
|
752
747
|
"displayName": "parentInterface",
|
|
753
|
-
"icon": undefined,
|
|
754
748
|
},
|
|
755
749
|
"extendsInterfaces": [],
|
|
756
750
|
"links": [],
|
|
@@ -769,7 +763,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
769
763
|
"objectTypes": {},
|
|
770
764
|
"sharedPropertyTypes": {},
|
|
771
765
|
}
|
|
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().
|
|
766
|
+
`);});});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
767
|
{
|
|
774
768
|
"actionTypes": {},
|
|
775
769
|
"blockPermissionInformation": {
|
|
@@ -784,7 +778,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
784
778
|
"displayMetadata": {
|
|
785
779
|
"description": "A",
|
|
786
780
|
"displayName": "A",
|
|
787
|
-
"icon": undefined,
|
|
788
781
|
},
|
|
789
782
|
"extendsInterfaces": [],
|
|
790
783
|
"links": [
|
|
@@ -818,7 +811,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
818
811
|
"displayMetadata": {
|
|
819
812
|
"description": "B",
|
|
820
813
|
"displayName": "B",
|
|
821
|
-
"icon": undefined,
|
|
822
814
|
},
|
|
823
815
|
"extendsInterfaces": [],
|
|
824
816
|
"links": [],
|
|
@@ -837,7 +829,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
837
829
|
"objectTypes": {},
|
|
838
830
|
"sharedPropertyTypes": {},
|
|
839
831
|
}
|
|
840
|
-
`);});it("many link works",()=>{defineInterfaceLinkConstraint({from:a,toMany:b,apiName:"manyLink"});expect(dumpOntologyFullMetadata().
|
|
832
|
+
`);});it("many link works",()=>{defineInterfaceLinkConstraint({from:a,toMany:b,apiName:"manyLink"});expect(dumpOntologyFullMetadata().ontology).toMatchInlineSnapshot(`
|
|
841
833
|
{
|
|
842
834
|
"actionTypes": {},
|
|
843
835
|
"blockPermissionInformation": {
|
|
@@ -852,7 +844,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
852
844
|
"displayMetadata": {
|
|
853
845
|
"description": "A",
|
|
854
846
|
"displayName": "A",
|
|
855
|
-
"icon": undefined,
|
|
856
847
|
},
|
|
857
848
|
"extendsInterfaces": [],
|
|
858
849
|
"links": [
|
|
@@ -886,7 +877,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
886
877
|
"displayMetadata": {
|
|
887
878
|
"description": "B",
|
|
888
879
|
"displayName": "B",
|
|
889
|
-
"icon": undefined,
|
|
890
880
|
},
|
|
891
881
|
"extendsInterfaces": [],
|
|
892
882
|
"links": [],
|
|
@@ -905,7 +895,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
905
895
|
"objectTypes": {},
|
|
906
896
|
"sharedPropertyTypes": {},
|
|
907
897
|
}
|
|
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().
|
|
898
|
+
`);});});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
899
|
{
|
|
910
900
|
"actionTypes": {},
|
|
911
901
|
"blockPermissionInformation": {
|
|
@@ -920,13 +910,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
920
910
|
"displayMetadata": {
|
|
921
911
|
"description": "Foo Interface",
|
|
922
912
|
"displayName": "Foo Interface",
|
|
923
|
-
"icon": {
|
|
924
|
-
"blueprint": {
|
|
925
|
-
"color": "#00000",
|
|
926
|
-
"locator": "airplane",
|
|
927
|
-
},
|
|
928
|
-
"type": "blueprint",
|
|
929
|
-
},
|
|
930
913
|
},
|
|
931
914
|
"extendsInterfaces": [],
|
|
932
915
|
"links": [],
|
|
@@ -1020,7 +1003,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1020
1003
|
},
|
|
1021
1004
|
},
|
|
1022
1005
|
}
|
|
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().
|
|
1006
|
+
`);});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
1007
|
{
|
|
1025
1008
|
"actionTypes": {},
|
|
1026
1009
|
"blockPermissionInformation": {
|
|
@@ -1084,7 +1067,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1084
1067
|
},
|
|
1085
1068
|
},
|
|
1086
1069
|
}
|
|
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().
|
|
1070
|
+
`);});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
1071
|
{
|
|
1089
1072
|
"actionTypes": {},
|
|
1090
1073
|
"blockPermissionInformation": {
|
|
@@ -1099,7 +1082,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1099
1082
|
"displayMetadata": {
|
|
1100
1083
|
"description": "interface",
|
|
1101
1084
|
"displayName": "interface",
|
|
1102
|
-
"icon": undefined,
|
|
1103
1085
|
},
|
|
1104
1086
|
"extendsInterfaces": [],
|
|
1105
1087
|
"links": [],
|
|
@@ -1193,7 +1175,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1193
1175
|
},
|
|
1194
1176
|
},
|
|
1195
1177
|
}
|
|
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().
|
|
1178
|
+
`);});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
1179
|
{
|
|
1198
1180
|
"actionTypes": {},
|
|
1199
1181
|
"blockPermissionInformation": {
|
|
@@ -1208,7 +1190,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1208
1190
|
"displayMetadata": {
|
|
1209
1191
|
"description": "interface",
|
|
1210
1192
|
"displayName": "interface",
|
|
1211
|
-
"icon": undefined,
|
|
1212
1193
|
},
|
|
1213
1194
|
"extendsInterfaces": [],
|
|
1214
1195
|
"links": [],
|
|
@@ -1529,7 +1510,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1529
1510
|
},
|
|
1530
1511
|
},
|
|
1531
1512
|
}
|
|
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().
|
|
1513
|
+
`);});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
1514
|
{
|
|
1534
1515
|
"actionTypes": {},
|
|
1535
1516
|
"blockPermissionInformation": {
|
|
@@ -1834,7 +1815,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
1834
1815
|
},
|
|
1835
1816
|
"sharedPropertyTypes": {},
|
|
1836
1817
|
}
|
|
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().
|
|
1818
|
+
`);});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
1819
|
{
|
|
1839
1820
|
"actionTypes": {},
|
|
1840
1821
|
"blockPermissionInformation": {
|
|
@@ -2184,7 +2165,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
2184
2165
|
},
|
|
2185
2166
|
"sharedPropertyTypes": {},
|
|
2186
2167
|
}
|
|
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().
|
|
2168
|
+
`);});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
2169
|
{
|
|
2189
2170
|
"actionTypes": {},
|
|
2190
2171
|
"blockPermissionInformation": {
|
|
@@ -2489,7 +2470,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
2489
2470
|
},
|
|
2490
2471
|
"sharedPropertyTypes": {},
|
|
2491
2472
|
}
|
|
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().
|
|
2473
|
+
`);});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
2474
|
{
|
|
2494
2475
|
"actionTypes": {},
|
|
2495
2476
|
"blockPermissionInformation": {
|
|
@@ -2840,7 +2821,22 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
2840
2821
|
}
|
|
2841
2822
|
`);});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
2823
|
{
|
|
2843
|
-
"
|
|
2824
|
+
"importedOntology": {
|
|
2825
|
+
"actionTypes": {},
|
|
2826
|
+
"blockPermissionInformation": {
|
|
2827
|
+
"actionTypes": {},
|
|
2828
|
+
"linkTypes": {},
|
|
2829
|
+
"objectTypes": {},
|
|
2830
|
+
},
|
|
2831
|
+
"interfaceTypes": {},
|
|
2832
|
+
"linkTypes": {},
|
|
2833
|
+
"objectTypes": {},
|
|
2834
|
+
"sharedPropertyTypes": {},
|
|
2835
|
+
},
|
|
2836
|
+
"importedValueTypes": {
|
|
2837
|
+
"valueTypes": [],
|
|
2838
|
+
},
|
|
2839
|
+
"ontology": {
|
|
2844
2840
|
"actionTypes": {},
|
|
2845
2841
|
"blockPermissionInformation": {
|
|
2846
2842
|
"actionTypes": {},
|
|
@@ -2949,17 +2945,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
2949
2945
|
},
|
|
2950
2946
|
"sharedPropertyTypes": {},
|
|
2951
2947
|
},
|
|
2952
|
-
"
|
|
2953
|
-
"
|
|
2954
|
-
"interfaceTypes": [],
|
|
2955
|
-
"linkTypes": [],
|
|
2956
|
-
"objectTypes": [],
|
|
2957
|
-
"sharedPropertyTypes": [],
|
|
2948
|
+
"valueTypes": {
|
|
2949
|
+
"valueTypes": [],
|
|
2958
2950
|
},
|
|
2959
2951
|
}
|
|
2960
2952
|
`);});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
2953
|
{
|
|
2962
|
-
"
|
|
2954
|
+
"importedOntology": {
|
|
2955
|
+
"actionTypes": {},
|
|
2956
|
+
"blockPermissionInformation": {
|
|
2957
|
+
"actionTypes": {},
|
|
2958
|
+
"linkTypes": {},
|
|
2959
|
+
"objectTypes": {},
|
|
2960
|
+
},
|
|
2961
|
+
"interfaceTypes": {},
|
|
2962
|
+
"linkTypes": {},
|
|
2963
|
+
"objectTypes": {},
|
|
2964
|
+
"sharedPropertyTypes": {},
|
|
2965
|
+
},
|
|
2966
|
+
"importedValueTypes": {
|
|
2967
|
+
"valueTypes": [],
|
|
2968
|
+
},
|
|
2969
|
+
"ontology": {
|
|
2963
2970
|
"actionTypes": {},
|
|
2964
2971
|
"blockPermissionInformation": {
|
|
2965
2972
|
"actionTypes": {},
|
|
@@ -3112,17 +3119,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
3112
3119
|
},
|
|
3113
3120
|
"sharedPropertyTypes": {},
|
|
3114
3121
|
},
|
|
3115
|
-
"
|
|
3116
|
-
"
|
|
3117
|
-
"interfaceTypes": [],
|
|
3118
|
-
"linkTypes": [],
|
|
3119
|
-
"objectTypes": [],
|
|
3120
|
-
"sharedPropertyTypes": [],
|
|
3122
|
+
"valueTypes": {
|
|
3123
|
+
"valueTypes": [],
|
|
3121
3124
|
},
|
|
3122
3125
|
}
|
|
3123
3126
|
`);});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
3127
|
{
|
|
3125
|
-
"
|
|
3128
|
+
"importedOntology": {
|
|
3129
|
+
"actionTypes": {},
|
|
3130
|
+
"blockPermissionInformation": {
|
|
3131
|
+
"actionTypes": {},
|
|
3132
|
+
"linkTypes": {},
|
|
3133
|
+
"objectTypes": {},
|
|
3134
|
+
},
|
|
3135
|
+
"interfaceTypes": {},
|
|
3136
|
+
"linkTypes": {},
|
|
3137
|
+
"objectTypes": {},
|
|
3138
|
+
"sharedPropertyTypes": {},
|
|
3139
|
+
},
|
|
3140
|
+
"importedValueTypes": {
|
|
3141
|
+
"valueTypes": [],
|
|
3142
|
+
},
|
|
3143
|
+
"ontology": {
|
|
3126
3144
|
"actionTypes": {},
|
|
3127
3145
|
"blockPermissionInformation": {
|
|
3128
3146
|
"actionTypes": {},
|
|
@@ -3276,17 +3294,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
3276
3294
|
},
|
|
3277
3295
|
"sharedPropertyTypes": {},
|
|
3278
3296
|
},
|
|
3279
|
-
"
|
|
3280
|
-
"
|
|
3281
|
-
"interfaceTypes": [],
|
|
3282
|
-
"linkTypes": [],
|
|
3283
|
-
"objectTypes": [],
|
|
3284
|
-
"sharedPropertyTypes": [],
|
|
3297
|
+
"valueTypes": {
|
|
3298
|
+
"valueTypes": [],
|
|
3285
3299
|
},
|
|
3286
3300
|
}
|
|
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.
|
|
3301
|
+
`);});});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",()=>{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
3302
|
{
|
|
3289
|
-
"
|
|
3303
|
+
"importedOntology": {
|
|
3304
|
+
"actionTypes": {},
|
|
3305
|
+
"blockPermissionInformation": {
|
|
3306
|
+
"actionTypes": {},
|
|
3307
|
+
"linkTypes": {},
|
|
3308
|
+
"objectTypes": {},
|
|
3309
|
+
},
|
|
3310
|
+
"interfaceTypes": {},
|
|
3311
|
+
"linkTypes": {},
|
|
3312
|
+
"objectTypes": {},
|
|
3313
|
+
"sharedPropertyTypes": {},
|
|
3314
|
+
},
|
|
3315
|
+
"importedValueTypes": {
|
|
3316
|
+
"valueTypes": [],
|
|
3317
|
+
},
|
|
3318
|
+
"ontology": {
|
|
3290
3319
|
"actionTypes": {
|
|
3291
3320
|
"com.palantir.foo": {
|
|
3292
3321
|
"actionType": {
|
|
@@ -3422,17 +3451,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
3422
3451
|
"objectTypes": {},
|
|
3423
3452
|
"sharedPropertyTypes": {},
|
|
3424
3453
|
},
|
|
3425
|
-
"
|
|
3426
|
-
"
|
|
3427
|
-
"interfaceTypes": [],
|
|
3428
|
-
"linkTypes": [],
|
|
3429
|
-
"objectTypes": [],
|
|
3430
|
-
"sharedPropertyTypes": [],
|
|
3454
|
+
"valueTypes": {
|
|
3455
|
+
"valueTypes": [],
|
|
3431
3456
|
},
|
|
3432
3457
|
}
|
|
3433
3458
|
`);});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(`
|
|
3434
3459
|
{
|
|
3435
|
-
"
|
|
3460
|
+
"importedOntology": {
|
|
3461
|
+
"actionTypes": {},
|
|
3462
|
+
"blockPermissionInformation": {
|
|
3463
|
+
"actionTypes": {},
|
|
3464
|
+
"linkTypes": {},
|
|
3465
|
+
"objectTypes": {},
|
|
3466
|
+
},
|
|
3467
|
+
"interfaceTypes": {},
|
|
3468
|
+
"linkTypes": {},
|
|
3469
|
+
"objectTypes": {},
|
|
3470
|
+
"sharedPropertyTypes": {},
|
|
3471
|
+
},
|
|
3472
|
+
"importedValueTypes": {
|
|
3473
|
+
"valueTypes": [],
|
|
3474
|
+
},
|
|
3475
|
+
"ontology": {
|
|
3436
3476
|
"actionTypes": {
|
|
3437
3477
|
"com.palantir.create-example-interface-foo": {
|
|
3438
3478
|
"actionType": {
|
|
@@ -3914,7 +3954,6 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
3914
3954
|
"displayMetadata": {
|
|
3915
3955
|
"description": "exampleInterface",
|
|
3916
3956
|
"displayName": "exampleInterface",
|
|
3917
|
-
"icon": undefined,
|
|
3918
3957
|
},
|
|
3919
3958
|
"extendsInterfaces": [],
|
|
3920
3959
|
"links": [],
|
|
@@ -4385,17 +4424,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4385
4424
|
},
|
|
4386
4425
|
},
|
|
4387
4426
|
},
|
|
4388
|
-
"
|
|
4389
|
-
"
|
|
4390
|
-
"interfaceTypes": [],
|
|
4391
|
-
"linkTypes": [],
|
|
4392
|
-
"objectTypes": [],
|
|
4393
|
-
"sharedPropertyTypes": [],
|
|
4427
|
+
"valueTypes": {
|
|
4428
|
+
"valueTypes": [],
|
|
4394
4429
|
},
|
|
4395
4430
|
}
|
|
4396
4431
|
`);});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
4432
|
{
|
|
4398
|
-
"
|
|
4433
|
+
"importedOntology": {
|
|
4434
|
+
"actionTypes": {},
|
|
4435
|
+
"blockPermissionInformation": {
|
|
4436
|
+
"actionTypes": {},
|
|
4437
|
+
"linkTypes": {},
|
|
4438
|
+
"objectTypes": {},
|
|
4439
|
+
},
|
|
4440
|
+
"interfaceTypes": {},
|
|
4441
|
+
"linkTypes": {},
|
|
4442
|
+
"objectTypes": {},
|
|
4443
|
+
"sharedPropertyTypes": {},
|
|
4444
|
+
},
|
|
4445
|
+
"importedValueTypes": {
|
|
4446
|
+
"valueTypes": [],
|
|
4447
|
+
},
|
|
4448
|
+
"ontology": {
|
|
4399
4449
|
"actionTypes": {
|
|
4400
4450
|
"com.palantir.foo": {
|
|
4401
4451
|
"actionType": {
|
|
@@ -4536,17 +4586,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4536
4586
|
"objectTypes": {},
|
|
4537
4587
|
"sharedPropertyTypes": {},
|
|
4538
4588
|
},
|
|
4539
|
-
"
|
|
4540
|
-
"
|
|
4541
|
-
"interfaceTypes": [],
|
|
4542
|
-
"linkTypes": [],
|
|
4543
|
-
"objectTypes": [],
|
|
4544
|
-
"sharedPropertyTypes": [],
|
|
4589
|
+
"valueTypes": {
|
|
4590
|
+
"valueTypes": [],
|
|
4545
4591
|
},
|
|
4546
4592
|
}
|
|
4547
4593
|
`);});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
4594
|
{
|
|
4549
|
-
"
|
|
4595
|
+
"importedOntology": {
|
|
4596
|
+
"actionTypes": {},
|
|
4597
|
+
"blockPermissionInformation": {
|
|
4598
|
+
"actionTypes": {},
|
|
4599
|
+
"linkTypes": {},
|
|
4600
|
+
"objectTypes": {},
|
|
4601
|
+
},
|
|
4602
|
+
"interfaceTypes": {},
|
|
4603
|
+
"linkTypes": {},
|
|
4604
|
+
"objectTypes": {},
|
|
4605
|
+
"sharedPropertyTypes": {},
|
|
4606
|
+
},
|
|
4607
|
+
"importedValueTypes": {
|
|
4608
|
+
"valueTypes": [],
|
|
4609
|
+
},
|
|
4610
|
+
"ontology": {
|
|
4550
4611
|
"actionTypes": {
|
|
4551
4612
|
"com.palantir.foo": {
|
|
4552
4613
|
"actionType": {
|
|
@@ -4774,17 +4835,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4774
4835
|
"objectTypes": {},
|
|
4775
4836
|
"sharedPropertyTypes": {},
|
|
4776
4837
|
},
|
|
4777
|
-
"
|
|
4778
|
-
"
|
|
4779
|
-
"interfaceTypes": [],
|
|
4780
|
-
"linkTypes": [],
|
|
4781
|
-
"objectTypes": [],
|
|
4782
|
-
"sharedPropertyTypes": [],
|
|
4838
|
+
"valueTypes": {
|
|
4839
|
+
"valueTypes": [],
|
|
4783
4840
|
},
|
|
4784
4841
|
}
|
|
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(`
|
|
4842
|
+
`);});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
4843
|
{
|
|
4787
|
-
"
|
|
4844
|
+
"importedOntology": {
|
|
4845
|
+
"actionTypes": {},
|
|
4846
|
+
"blockPermissionInformation": {
|
|
4847
|
+
"actionTypes": {},
|
|
4848
|
+
"linkTypes": {},
|
|
4849
|
+
"objectTypes": {},
|
|
4850
|
+
},
|
|
4851
|
+
"interfaceTypes": {},
|
|
4852
|
+
"linkTypes": {},
|
|
4853
|
+
"objectTypes": {},
|
|
4854
|
+
"sharedPropertyTypes": {},
|
|
4855
|
+
},
|
|
4856
|
+
"importedValueTypes": {
|
|
4857
|
+
"valueTypes": [],
|
|
4858
|
+
},
|
|
4859
|
+
"ontology": {
|
|
4788
4860
|
"actionTypes": {
|
|
4789
4861
|
"com.palantir.create-object-foo": {
|
|
4790
4862
|
"actionType": {
|
|
@@ -4799,6 +4871,10 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4799
4871
|
"parameterId": "bar",
|
|
4800
4872
|
"type": "parameterId",
|
|
4801
4873
|
},
|
|
4874
|
+
"optionalProp": {
|
|
4875
|
+
"parameterId": "optionalProp",
|
|
4876
|
+
"type": "parameterId",
|
|
4877
|
+
},
|
|
4802
4878
|
},
|
|
4803
4879
|
"structFieldValues": {},
|
|
4804
4880
|
},
|
|
@@ -4844,8 +4920,36 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4844
4920
|
"type": "text",
|
|
4845
4921
|
},
|
|
4846
4922
|
"required": {
|
|
4847
|
-
"
|
|
4848
|
-
"type": "
|
|
4923
|
+
"notRequired": {},
|
|
4924
|
+
"type": "notRequired",
|
|
4925
|
+
},
|
|
4926
|
+
},
|
|
4927
|
+
},
|
|
4928
|
+
},
|
|
4929
|
+
"optionalProp": {
|
|
4930
|
+
"conditionalOverrides": [],
|
|
4931
|
+
"defaultValidation": {
|
|
4932
|
+
"display": {
|
|
4933
|
+
"renderHint": {
|
|
4934
|
+
"textInput": {},
|
|
4935
|
+
"type": "textInput",
|
|
4936
|
+
},
|
|
4937
|
+
"visibility": {
|
|
4938
|
+
"editable": {},
|
|
4939
|
+
"type": "editable",
|
|
4940
|
+
},
|
|
4941
|
+
},
|
|
4942
|
+
"validation": {
|
|
4943
|
+
"allowedValues": {
|
|
4944
|
+
"text": {
|
|
4945
|
+
"text": {},
|
|
4946
|
+
"type": "text",
|
|
4947
|
+
},
|
|
4948
|
+
"type": "text",
|
|
4949
|
+
},
|
|
4950
|
+
"required": {
|
|
4951
|
+
"notRequired": {},
|
|
4952
|
+
"type": "notRequired",
|
|
4849
4953
|
},
|
|
4850
4954
|
},
|
|
4851
4955
|
},
|
|
@@ -4893,6 +4997,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4893
4997
|
"formContentOrdering": [],
|
|
4894
4998
|
"parameterOrdering": [
|
|
4895
4999
|
"bar",
|
|
5000
|
+
"optionalProp",
|
|
4896
5001
|
],
|
|
4897
5002
|
"parameters": {
|
|
4898
5003
|
"bar": {
|
|
@@ -4907,6 +5012,18 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4907
5012
|
"type": "string",
|
|
4908
5013
|
},
|
|
4909
5014
|
},
|
|
5015
|
+
"optionalProp": {
|
|
5016
|
+
"displayMetadata": {
|
|
5017
|
+
"description": "",
|
|
5018
|
+
"displayName": "OptionalProp",
|
|
5019
|
+
"typeClasses": [],
|
|
5020
|
+
},
|
|
5021
|
+
"id": "optionalProp",
|
|
5022
|
+
"type": {
|
|
5023
|
+
"string": {},
|
|
5024
|
+
"type": "string",
|
|
5025
|
+
},
|
|
5026
|
+
},
|
|
4910
5027
|
},
|
|
4911
5028
|
"sections": {},
|
|
4912
5029
|
"status": {
|
|
@@ -4924,7 +5041,12 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4924
5041
|
{
|
|
4925
5042
|
"addOrModifyObjectRuleV2": {
|
|
4926
5043
|
"objectToModify": "objectToCreateOrModifyParameter",
|
|
4927
|
-
"propertyValues": {
|
|
5044
|
+
"propertyValues": {
|
|
5045
|
+
"optionalProp": {
|
|
5046
|
+
"parameterId": "optionalProp",
|
|
5047
|
+
"type": "parameterId",
|
|
5048
|
+
},
|
|
5049
|
+
},
|
|
4928
5050
|
"structFieldValues": {},
|
|
4929
5051
|
},
|
|
4930
5052
|
"type": "addOrModifyObjectRuleV2",
|
|
@@ -4975,6 +5097,41 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
4975
5097
|
},
|
|
4976
5098
|
},
|
|
4977
5099
|
},
|
|
5100
|
+
"optionalProp": {
|
|
5101
|
+
"conditionalOverrides": [],
|
|
5102
|
+
"defaultValidation": {
|
|
5103
|
+
"display": {
|
|
5104
|
+
"prefill": {
|
|
5105
|
+
"objectParameterPropertyValue": {
|
|
5106
|
+
"parameterId": "objectToCreateOrModifyParameter",
|
|
5107
|
+
"propertyTypeId": "optionalProp",
|
|
5108
|
+
},
|
|
5109
|
+
"type": "objectParameterPropertyValue",
|
|
5110
|
+
},
|
|
5111
|
+
"renderHint": {
|
|
5112
|
+
"textInput": {},
|
|
5113
|
+
"type": "textInput",
|
|
5114
|
+
},
|
|
5115
|
+
"visibility": {
|
|
5116
|
+
"editable": {},
|
|
5117
|
+
"type": "editable",
|
|
5118
|
+
},
|
|
5119
|
+
},
|
|
5120
|
+
"validation": {
|
|
5121
|
+
"allowedValues": {
|
|
5122
|
+
"text": {
|
|
5123
|
+
"text": {},
|
|
5124
|
+
"type": "text",
|
|
5125
|
+
},
|
|
5126
|
+
"type": "text",
|
|
5127
|
+
},
|
|
5128
|
+
"required": {
|
|
5129
|
+
"notRequired": {},
|
|
5130
|
+
"type": "notRequired",
|
|
5131
|
+
},
|
|
5132
|
+
},
|
|
5133
|
+
},
|
|
5134
|
+
},
|
|
4978
5135
|
},
|
|
4979
5136
|
"sectionValidations": {},
|
|
4980
5137
|
},
|
|
@@ -5018,6 +5175,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5018
5175
|
"formContentOrdering": [],
|
|
5019
5176
|
"parameterOrdering": [
|
|
5020
5177
|
"objectToCreateOrModifyParameter",
|
|
5178
|
+
"optionalProp",
|
|
5021
5179
|
],
|
|
5022
5180
|
"parameters": {
|
|
5023
5181
|
"objectToCreateOrModifyParameter": {
|
|
@@ -5038,6 +5196,18 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5038
5196
|
"type": "objectReference",
|
|
5039
5197
|
},
|
|
5040
5198
|
},
|
|
5199
|
+
"optionalProp": {
|
|
5200
|
+
"displayMetadata": {
|
|
5201
|
+
"description": "",
|
|
5202
|
+
"displayName": "OptionalProp",
|
|
5203
|
+
"typeClasses": [],
|
|
5204
|
+
},
|
|
5205
|
+
"id": "optionalProp",
|
|
5206
|
+
"type": {
|
|
5207
|
+
"string": {},
|
|
5208
|
+
"type": "string",
|
|
5209
|
+
},
|
|
5210
|
+
},
|
|
5041
5211
|
},
|
|
5042
5212
|
"sections": {},
|
|
5043
5213
|
"status": {
|
|
@@ -5180,7 +5350,12 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5180
5350
|
{
|
|
5181
5351
|
"modifyObjectRule": {
|
|
5182
5352
|
"objectToModify": "objectToModifyParameter",
|
|
5183
|
-
"propertyValues": {
|
|
5353
|
+
"propertyValues": {
|
|
5354
|
+
"optionalProp": {
|
|
5355
|
+
"parameterId": "optionalProp",
|
|
5356
|
+
"type": "parameterId",
|
|
5357
|
+
},
|
|
5358
|
+
},
|
|
5184
5359
|
"structFieldValues": {},
|
|
5185
5360
|
},
|
|
5186
5361
|
"type": "modifyObjectRule",
|
|
@@ -5231,6 +5406,41 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5231
5406
|
},
|
|
5232
5407
|
},
|
|
5233
5408
|
},
|
|
5409
|
+
"optionalProp": {
|
|
5410
|
+
"conditionalOverrides": [],
|
|
5411
|
+
"defaultValidation": {
|
|
5412
|
+
"display": {
|
|
5413
|
+
"prefill": {
|
|
5414
|
+
"objectParameterPropertyValue": {
|
|
5415
|
+
"parameterId": "objectToModifyParameter",
|
|
5416
|
+
"propertyTypeId": "optionalProp",
|
|
5417
|
+
},
|
|
5418
|
+
"type": "objectParameterPropertyValue",
|
|
5419
|
+
},
|
|
5420
|
+
"renderHint": {
|
|
5421
|
+
"textInput": {},
|
|
5422
|
+
"type": "textInput",
|
|
5423
|
+
},
|
|
5424
|
+
"visibility": {
|
|
5425
|
+
"editable": {},
|
|
5426
|
+
"type": "editable",
|
|
5427
|
+
},
|
|
5428
|
+
},
|
|
5429
|
+
"validation": {
|
|
5430
|
+
"allowedValues": {
|
|
5431
|
+
"text": {
|
|
5432
|
+
"text": {},
|
|
5433
|
+
"type": "text",
|
|
5434
|
+
},
|
|
5435
|
+
"type": "text",
|
|
5436
|
+
},
|
|
5437
|
+
"required": {
|
|
5438
|
+
"notRequired": {},
|
|
5439
|
+
"type": "notRequired",
|
|
5440
|
+
},
|
|
5441
|
+
},
|
|
5442
|
+
},
|
|
5443
|
+
},
|
|
5234
5444
|
},
|
|
5235
5445
|
"sectionValidations": {},
|
|
5236
5446
|
},
|
|
@@ -5274,6 +5484,7 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5274
5484
|
"formContentOrdering": [],
|
|
5275
5485
|
"parameterOrdering": [
|
|
5276
5486
|
"objectToModifyParameter",
|
|
5487
|
+
"optionalProp",
|
|
5277
5488
|
],
|
|
5278
5489
|
"parameters": {
|
|
5279
5490
|
"objectToModifyParameter": {
|
|
@@ -5290,6 +5501,18 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5290
5501
|
"type": "objectReference",
|
|
5291
5502
|
},
|
|
5292
5503
|
},
|
|
5504
|
+
"optionalProp": {
|
|
5505
|
+
"displayMetadata": {
|
|
5506
|
+
"description": "",
|
|
5507
|
+
"displayName": "OptionalProp",
|
|
5508
|
+
"typeClasses": [],
|
|
5509
|
+
},
|
|
5510
|
+
"id": "optionalProp",
|
|
5511
|
+
"type": {
|
|
5512
|
+
"string": {},
|
|
5513
|
+
"type": "string",
|
|
5514
|
+
},
|
|
5515
|
+
},
|
|
5293
5516
|
},
|
|
5294
5517
|
"sections": {},
|
|
5295
5518
|
"status": {
|
|
@@ -5319,6 +5542,10 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5319
5542
|
"column": "bar",
|
|
5320
5543
|
"type": "column",
|
|
5321
5544
|
},
|
|
5545
|
+
"optionalProp": {
|
|
5546
|
+
"column": "optionalProp",
|
|
5547
|
+
"type": "column",
|
|
5548
|
+
},
|
|
5322
5549
|
"structProp": {
|
|
5323
5550
|
"struct": {
|
|
5324
5551
|
"column": "structProp",
|
|
@@ -5407,6 +5634,46 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5407
5634
|
],
|
|
5408
5635
|
"valueType": undefined,
|
|
5409
5636
|
},
|
|
5637
|
+
"optionalProp": {
|
|
5638
|
+
"apiName": "optionalProp",
|
|
5639
|
+
"baseFormatter": undefined,
|
|
5640
|
+
"dataConstraints": undefined,
|
|
5641
|
+
"displayMetadata": {
|
|
5642
|
+
"description": undefined,
|
|
5643
|
+
"displayName": "OptionalProp",
|
|
5644
|
+
"visibility": "NORMAL",
|
|
5645
|
+
},
|
|
5646
|
+
"indexedForSearch": true,
|
|
5647
|
+
"inlineAction": undefined,
|
|
5648
|
+
"ruleSetBinding": undefined,
|
|
5649
|
+
"sharedPropertyTypeApiName": undefined,
|
|
5650
|
+
"sharedPropertyTypeRid": undefined,
|
|
5651
|
+
"status": {
|
|
5652
|
+
"active": {},
|
|
5653
|
+
"type": "active",
|
|
5654
|
+
},
|
|
5655
|
+
"type": {
|
|
5656
|
+
"string": {
|
|
5657
|
+
"analyzerOverride": undefined,
|
|
5658
|
+
"enableAsciiFolding": undefined,
|
|
5659
|
+
"isLongText": false,
|
|
5660
|
+
"supportsEfficientLeadingWildcard": false,
|
|
5661
|
+
"supportsExactMatching": true,
|
|
5662
|
+
},
|
|
5663
|
+
"type": "string",
|
|
5664
|
+
},
|
|
5665
|
+
"typeClasses": [
|
|
5666
|
+
{
|
|
5667
|
+
"kind": "render_hint",
|
|
5668
|
+
"name": "SELECTABLE",
|
|
5669
|
+
},
|
|
5670
|
+
{
|
|
5671
|
+
"kind": "render_hint",
|
|
5672
|
+
"name": "SORTABLE",
|
|
5673
|
+
},
|
|
5674
|
+
],
|
|
5675
|
+
"valueType": undefined,
|
|
5676
|
+
},
|
|
5410
5677
|
"structProp": {
|
|
5411
5678
|
"apiName": "structProp",
|
|
5412
5679
|
"baseFormatter": undefined,
|
|
@@ -5466,17 +5733,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5466
5733
|
},
|
|
5467
5734
|
"sharedPropertyTypes": {},
|
|
5468
5735
|
},
|
|
5469
|
-
"
|
|
5470
|
-
"
|
|
5471
|
-
"interfaceTypes": [],
|
|
5472
|
-
"linkTypes": [],
|
|
5473
|
-
"objectTypes": [],
|
|
5474
|
-
"sharedPropertyTypes": [],
|
|
5736
|
+
"valueTypes": {
|
|
5737
|
+
"valueTypes": [],
|
|
5475
5738
|
},
|
|
5476
5739
|
}
|
|
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(`
|
|
5740
|
+
`);});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
5741
|
{
|
|
5479
|
-
"
|
|
5742
|
+
"importedOntology": {
|
|
5743
|
+
"actionTypes": {},
|
|
5744
|
+
"blockPermissionInformation": {
|
|
5745
|
+
"actionTypes": {},
|
|
5746
|
+
"linkTypes": {},
|
|
5747
|
+
"objectTypes": {},
|
|
5748
|
+
},
|
|
5749
|
+
"interfaceTypes": {},
|
|
5750
|
+
"linkTypes": {},
|
|
5751
|
+
"objectTypes": {},
|
|
5752
|
+
"sharedPropertyTypes": {},
|
|
5753
|
+
},
|
|
5754
|
+
"importedValueTypes": {
|
|
5755
|
+
"valueTypes": [],
|
|
5756
|
+
},
|
|
5757
|
+
"ontology": {
|
|
5480
5758
|
"actionTypes": {
|
|
5481
5759
|
"com.palantir.create-object-foo": {
|
|
5482
5760
|
"actionType": {
|
|
@@ -5545,6 +5823,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5545
5823
|
"typeClasses": [],
|
|
5546
5824
|
},
|
|
5547
5825
|
},
|
|
5826
|
+
"1": {
|
|
5827
|
+
"condition": {
|
|
5828
|
+
"comparison": {
|
|
5829
|
+
"left": {
|
|
5830
|
+
"type": "userProperty",
|
|
5831
|
+
"userProperty": {
|
|
5832
|
+
"propertyValue": {
|
|
5833
|
+
"groupIds": {},
|
|
5834
|
+
"type": "groupIds",
|
|
5835
|
+
},
|
|
5836
|
+
"userId": {
|
|
5837
|
+
"currentUser": {},
|
|
5838
|
+
"type": "currentUser",
|
|
5839
|
+
},
|
|
5840
|
+
},
|
|
5841
|
+
},
|
|
5842
|
+
"operator": "INTERSECTS",
|
|
5843
|
+
"right": {
|
|
5844
|
+
"staticValue": {
|
|
5845
|
+
"stringList": {
|
|
5846
|
+
"strings": [
|
|
5847
|
+
"actionLevelGroup2",
|
|
5848
|
+
],
|
|
5849
|
+
},
|
|
5850
|
+
"type": "stringList",
|
|
5851
|
+
},
|
|
5852
|
+
"type": "staticValue",
|
|
5853
|
+
},
|
|
5854
|
+
},
|
|
5855
|
+
"type": "comparison",
|
|
5856
|
+
},
|
|
5857
|
+
"displayMetadata": {
|
|
5858
|
+
"failureMessage": "Different custom failure message",
|
|
5859
|
+
"typeClasses": [],
|
|
5860
|
+
},
|
|
5861
|
+
},
|
|
5548
5862
|
},
|
|
5549
5863
|
},
|
|
5550
5864
|
"parameterValidations": {
|
|
@@ -5570,8 +5884,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5570
5884
|
"type": "text",
|
|
5571
5885
|
},
|
|
5572
5886
|
"required": {
|
|
5573
|
-
"
|
|
5574
|
-
"type": "
|
|
5887
|
+
"notRequired": {},
|
|
5888
|
+
"type": "notRequired",
|
|
5575
5889
|
},
|
|
5576
5890
|
},
|
|
5577
5891
|
},
|
|
@@ -5701,8 +6015,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5701
6015
|
"type": "text",
|
|
5702
6016
|
},
|
|
5703
6017
|
"required": {
|
|
5704
|
-
"
|
|
5705
|
-
"type": "
|
|
6018
|
+
"notRequired": {},
|
|
6019
|
+
"type": "notRequired",
|
|
5706
6020
|
},
|
|
5707
6021
|
},
|
|
5708
6022
|
},
|
|
@@ -5872,6 +6186,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
5872
6186
|
"typeClasses": [],
|
|
5873
6187
|
},
|
|
5874
6188
|
},
|
|
6189
|
+
"1": {
|
|
6190
|
+
"condition": {
|
|
6191
|
+
"comparison": {
|
|
6192
|
+
"left": {
|
|
6193
|
+
"type": "userProperty",
|
|
6194
|
+
"userProperty": {
|
|
6195
|
+
"propertyValue": {
|
|
6196
|
+
"groupIds": {},
|
|
6197
|
+
"type": "groupIds",
|
|
6198
|
+
},
|
|
6199
|
+
"userId": {
|
|
6200
|
+
"currentUser": {},
|
|
6201
|
+
"type": "currentUser",
|
|
6202
|
+
},
|
|
6203
|
+
},
|
|
6204
|
+
},
|
|
6205
|
+
"operator": "INTERSECTS",
|
|
6206
|
+
"right": {
|
|
6207
|
+
"staticValue": {
|
|
6208
|
+
"stringList": {
|
|
6209
|
+
"strings": [
|
|
6210
|
+
"actionLevelGroup2",
|
|
6211
|
+
],
|
|
6212
|
+
},
|
|
6213
|
+
"type": "stringList",
|
|
6214
|
+
},
|
|
6215
|
+
"type": "staticValue",
|
|
6216
|
+
},
|
|
6217
|
+
},
|
|
6218
|
+
"type": "comparison",
|
|
6219
|
+
},
|
|
6220
|
+
"displayMetadata": {
|
|
6221
|
+
"failureMessage": "Different custom failure message",
|
|
6222
|
+
"typeClasses": [],
|
|
6223
|
+
},
|
|
6224
|
+
},
|
|
5875
6225
|
},
|
|
5876
6226
|
},
|
|
5877
6227
|
"parameterValidations": {
|
|
@@ -6212,6 +6562,42 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
6212
6562
|
"typeClasses": [],
|
|
6213
6563
|
},
|
|
6214
6564
|
},
|
|
6565
|
+
"1": {
|
|
6566
|
+
"condition": {
|
|
6567
|
+
"comparison": {
|
|
6568
|
+
"left": {
|
|
6569
|
+
"type": "userProperty",
|
|
6570
|
+
"userProperty": {
|
|
6571
|
+
"propertyValue": {
|
|
6572
|
+
"groupIds": {},
|
|
6573
|
+
"type": "groupIds",
|
|
6574
|
+
},
|
|
6575
|
+
"userId": {
|
|
6576
|
+
"currentUser": {},
|
|
6577
|
+
"type": "currentUser",
|
|
6578
|
+
},
|
|
6579
|
+
},
|
|
6580
|
+
},
|
|
6581
|
+
"operator": "INTERSECTS",
|
|
6582
|
+
"right": {
|
|
6583
|
+
"staticValue": {
|
|
6584
|
+
"stringList": {
|
|
6585
|
+
"strings": [
|
|
6586
|
+
"actionLevelGroup2",
|
|
6587
|
+
],
|
|
6588
|
+
},
|
|
6589
|
+
"type": "stringList",
|
|
6590
|
+
},
|
|
6591
|
+
"type": "staticValue",
|
|
6592
|
+
},
|
|
6593
|
+
},
|
|
6594
|
+
"type": "comparison",
|
|
6595
|
+
},
|
|
6596
|
+
"displayMetadata": {
|
|
6597
|
+
"failureMessage": "Different custom failure message",
|
|
6598
|
+
"typeClasses": [],
|
|
6599
|
+
},
|
|
6600
|
+
},
|
|
6215
6601
|
},
|
|
6216
6602
|
},
|
|
6217
6603
|
"parameterValidations": {
|
|
@@ -6747,17 +7133,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
6747
7133
|
},
|
|
6748
7134
|
"sharedPropertyTypes": {},
|
|
6749
7135
|
},
|
|
6750
|
-
"
|
|
6751
|
-
"
|
|
6752
|
-
"interfaceTypes": [],
|
|
6753
|
-
"linkTypes": [],
|
|
6754
|
-
"objectTypes": [],
|
|
6755
|
-
"sharedPropertyTypes": [],
|
|
7136
|
+
"valueTypes": {
|
|
7137
|
+
"valueTypes": [],
|
|
6756
7138
|
},
|
|
6757
7139
|
}
|
|
6758
7140
|
`);});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
7141
|
{
|
|
6760
|
-
"
|
|
7142
|
+
"importedOntology": {
|
|
7143
|
+
"actionTypes": {},
|
|
7144
|
+
"blockPermissionInformation": {
|
|
7145
|
+
"actionTypes": {},
|
|
7146
|
+
"linkTypes": {},
|
|
7147
|
+
"objectTypes": {},
|
|
7148
|
+
},
|
|
7149
|
+
"interfaceTypes": {},
|
|
7150
|
+
"linkTypes": {},
|
|
7151
|
+
"objectTypes": {},
|
|
7152
|
+
"sharedPropertyTypes": {},
|
|
7153
|
+
},
|
|
7154
|
+
"importedValueTypes": {
|
|
7155
|
+
"valueTypes": [],
|
|
7156
|
+
},
|
|
7157
|
+
"ontology": {
|
|
6761
7158
|
"actionTypes": {
|
|
6762
7159
|
"com.palantir.create-object-foo": {
|
|
6763
7160
|
"actionType": {
|
|
@@ -6825,8 +7222,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
6825
7222
|
"type": "text",
|
|
6826
7223
|
},
|
|
6827
7224
|
"required": {
|
|
6828
|
-
"
|
|
6829
|
-
"type": "
|
|
7225
|
+
"notRequired": {},
|
|
7226
|
+
"type": "notRequired",
|
|
6830
7227
|
},
|
|
6831
7228
|
},
|
|
6832
7229
|
},
|
|
@@ -7363,17 +7760,28 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
7363
7760
|
},
|
|
7364
7761
|
"sharedPropertyTypes": {},
|
|
7365
7762
|
},
|
|
7366
|
-
"
|
|
7367
|
-
"
|
|
7368
|
-
"interfaceTypes": [],
|
|
7369
|
-
"linkTypes": [],
|
|
7370
|
-
"objectTypes": [],
|
|
7371
|
-
"sharedPropertyTypes": [],
|
|
7763
|
+
"valueTypes": {
|
|
7764
|
+
"valueTypes": [],
|
|
7372
7765
|
},
|
|
7373
7766
|
}
|
|
7374
7767
|
`);});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
7768
|
{
|
|
7376
|
-
"
|
|
7769
|
+
"importedOntology": {
|
|
7770
|
+
"actionTypes": {},
|
|
7771
|
+
"blockPermissionInformation": {
|
|
7772
|
+
"actionTypes": {},
|
|
7773
|
+
"linkTypes": {},
|
|
7774
|
+
"objectTypes": {},
|
|
7775
|
+
},
|
|
7776
|
+
"interfaceTypes": {},
|
|
7777
|
+
"linkTypes": {},
|
|
7778
|
+
"objectTypes": {},
|
|
7779
|
+
"sharedPropertyTypes": {},
|
|
7780
|
+
},
|
|
7781
|
+
"importedValueTypes": {
|
|
7782
|
+
"valueTypes": [],
|
|
7783
|
+
},
|
|
7784
|
+
"ontology": {
|
|
7377
7785
|
"actionTypes": {
|
|
7378
7786
|
"com.palantir.create-or-modify-employee": {
|
|
7379
7787
|
"actionType": {
|
|
@@ -7981,12 +8389,8 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
7981
8389
|
},
|
|
7982
8390
|
"sharedPropertyTypes": {},
|
|
7983
8391
|
},
|
|
7984
|
-
"
|
|
7985
|
-
"
|
|
7986
|
-
"interfaceTypes": [],
|
|
7987
|
-
"linkTypes": [],
|
|
7988
|
-
"objectTypes": [],
|
|
7989
|
-
"sharedPropertyTypes": [],
|
|
8392
|
+
"valueTypes": {
|
|
8393
|
+
"valueTypes": [],
|
|
7990
8394
|
},
|
|
7991
8395
|
}
|
|
7992
8396
|
`);});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 +8399,22 @@ defineOntology("com.palantir.",()=>{},"/tmp/");});describe("Interfaces",()=>{it(
|
|
|
7995
8399
|
// id of the selected manager object type.
|
|
7996
8400
|
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
8401
|
{
|
|
7998
|
-
"
|
|
8402
|
+
"importedOntology": {
|
|
8403
|
+
"actionTypes": {},
|
|
8404
|
+
"blockPermissionInformation": {
|
|
8405
|
+
"actionTypes": {},
|
|
8406
|
+
"linkTypes": {},
|
|
8407
|
+
"objectTypes": {},
|
|
8408
|
+
},
|
|
8409
|
+
"interfaceTypes": {},
|
|
8410
|
+
"linkTypes": {},
|
|
8411
|
+
"objectTypes": {},
|
|
8412
|
+
"sharedPropertyTypes": {},
|
|
8413
|
+
},
|
|
8414
|
+
"importedValueTypes": {
|
|
8415
|
+
"valueTypes": [],
|
|
8416
|
+
},
|
|
8417
|
+
"ontology": {
|
|
7999
8418
|
"actionTypes": {
|
|
8000
8419
|
"com.palantir.create-object-employee": {
|
|
8001
8420
|
"actionType": {
|
|
@@ -8059,8 +8478,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8059
8478
|
"type": "text",
|
|
8060
8479
|
},
|
|
8061
8480
|
"required": {
|
|
8062
|
-
"
|
|
8063
|
-
"type": "
|
|
8481
|
+
"notRequired": {},
|
|
8482
|
+
"type": "notRequired",
|
|
8064
8483
|
},
|
|
8065
8484
|
},
|
|
8066
8485
|
},
|
|
@@ -8094,8 +8513,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8094
8513
|
"type": "text",
|
|
8095
8514
|
},
|
|
8096
8515
|
"required": {
|
|
8097
|
-
"
|
|
8098
|
-
"type": "
|
|
8516
|
+
"notRequired": {},
|
|
8517
|
+
"type": "notRequired",
|
|
8099
8518
|
},
|
|
8100
8519
|
},
|
|
8101
8520
|
},
|
|
@@ -8122,8 +8541,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8122
8541
|
"type": "objectQuery",
|
|
8123
8542
|
},
|
|
8124
8543
|
"required": {
|
|
8125
|
-
"
|
|
8126
|
-
"type": "
|
|
8544
|
+
"notRequired": {},
|
|
8545
|
+
"type": "notRequired",
|
|
8127
8546
|
},
|
|
8128
8547
|
},
|
|
8129
8548
|
},
|
|
@@ -8470,17 +8889,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8470
8889
|
},
|
|
8471
8890
|
"sharedPropertyTypes": {},
|
|
8472
8891
|
},
|
|
8473
|
-
"
|
|
8474
|
-
"
|
|
8475
|
-
"interfaceTypes": [],
|
|
8476
|
-
"linkTypes": [],
|
|
8477
|
-
"objectTypes": [],
|
|
8478
|
-
"sharedPropertyTypes": [],
|
|
8892
|
+
"valueTypes": {
|
|
8893
|
+
"valueTypes": [],
|
|
8479
8894
|
},
|
|
8480
8895
|
}
|
|
8481
8896
|
`);});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
8897
|
{
|
|
8483
|
-
"
|
|
8898
|
+
"importedOntology": {
|
|
8899
|
+
"actionTypes": {},
|
|
8900
|
+
"blockPermissionInformation": {
|
|
8901
|
+
"actionTypes": {},
|
|
8902
|
+
"linkTypes": {},
|
|
8903
|
+
"objectTypes": {},
|
|
8904
|
+
},
|
|
8905
|
+
"interfaceTypes": {},
|
|
8906
|
+
"linkTypes": {},
|
|
8907
|
+
"objectTypes": {},
|
|
8908
|
+
"sharedPropertyTypes": {},
|
|
8909
|
+
},
|
|
8910
|
+
"importedValueTypes": {
|
|
8911
|
+
"valueTypes": [],
|
|
8912
|
+
},
|
|
8913
|
+
"ontology": {
|
|
8484
8914
|
"actionTypes": {
|
|
8485
8915
|
"com.palantir.create-example-interface": {
|
|
8486
8916
|
"actionType": {
|
|
@@ -8846,7 +9276,6 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8846
9276
|
"displayMetadata": {
|
|
8847
9277
|
"description": "exampleInterface",
|
|
8848
9278
|
"displayName": "exampleInterface",
|
|
8849
|
-
"icon": undefined,
|
|
8850
9279
|
},
|
|
8851
9280
|
"extendsInterfaces": [],
|
|
8852
9281
|
"links": [],
|
|
@@ -8940,17 +9369,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
8940
9369
|
},
|
|
8941
9370
|
},
|
|
8942
9371
|
},
|
|
8943
|
-
"
|
|
8944
|
-
"
|
|
8945
|
-
"interfaceTypes": [],
|
|
8946
|
-
"linkTypes": [],
|
|
8947
|
-
"objectTypes": [],
|
|
8948
|
-
"sharedPropertyTypes": [],
|
|
9372
|
+
"valueTypes": {
|
|
9373
|
+
"valueTypes": [],
|
|
8949
9374
|
},
|
|
8950
9375
|
}
|
|
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(`
|
|
9376
|
+
`);});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
9377
|
{
|
|
8953
|
-
"
|
|
9378
|
+
"importedOntology": {
|
|
9379
|
+
"actionTypes": {},
|
|
9380
|
+
"blockPermissionInformation": {
|
|
9381
|
+
"actionTypes": {},
|
|
9382
|
+
"linkTypes": {},
|
|
9383
|
+
"objectTypes": {},
|
|
9384
|
+
},
|
|
9385
|
+
"interfaceTypes": {},
|
|
9386
|
+
"linkTypes": {},
|
|
9387
|
+
"objectTypes": {},
|
|
9388
|
+
"sharedPropertyTypes": {},
|
|
9389
|
+
},
|
|
9390
|
+
"importedValueTypes": {
|
|
9391
|
+
"valueTypes": [],
|
|
9392
|
+
},
|
|
9393
|
+
"ontology": {
|
|
8954
9394
|
"actionTypes": {
|
|
8955
9395
|
"com.palantir.create-object-sample-object": {
|
|
8956
9396
|
"actionType": {
|
|
@@ -9040,8 +9480,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9040
9480
|
"type": "text",
|
|
9041
9481
|
},
|
|
9042
9482
|
"required": {
|
|
9043
|
-
"
|
|
9044
|
-
"type": "
|
|
9483
|
+
"notRequired": {},
|
|
9484
|
+
"type": "notRequired",
|
|
9045
9485
|
},
|
|
9046
9486
|
},
|
|
9047
9487
|
},
|
|
@@ -9068,8 +9508,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9068
9508
|
"type": "text",
|
|
9069
9509
|
},
|
|
9070
9510
|
"required": {
|
|
9071
|
-
"
|
|
9072
|
-
"type": "
|
|
9511
|
+
"notRequired": {},
|
|
9512
|
+
"type": "notRequired",
|
|
9073
9513
|
},
|
|
9074
9514
|
},
|
|
9075
9515
|
},
|
|
@@ -9313,17 +9753,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9313
9753
|
},
|
|
9314
9754
|
"sharedPropertyTypes": {},
|
|
9315
9755
|
},
|
|
9316
|
-
"
|
|
9317
|
-
"
|
|
9318
|
-
"interfaceTypes": [],
|
|
9319
|
-
"linkTypes": [],
|
|
9320
|
-
"objectTypes": [],
|
|
9321
|
-
"sharedPropertyTypes": [],
|
|
9756
|
+
"valueTypes": {
|
|
9757
|
+
"valueTypes": [],
|
|
9322
9758
|
},
|
|
9323
9759
|
}
|
|
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(`
|
|
9760
|
+
`);});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
9761
|
{
|
|
9326
|
-
"
|
|
9762
|
+
"importedOntology": {
|
|
9763
|
+
"actionTypes": {},
|
|
9764
|
+
"blockPermissionInformation": {
|
|
9765
|
+
"actionTypes": {},
|
|
9766
|
+
"linkTypes": {},
|
|
9767
|
+
"objectTypes": {},
|
|
9768
|
+
},
|
|
9769
|
+
"interfaceTypes": {},
|
|
9770
|
+
"linkTypes": {},
|
|
9771
|
+
"objectTypes": {},
|
|
9772
|
+
"sharedPropertyTypes": {},
|
|
9773
|
+
},
|
|
9774
|
+
"importedValueTypes": {
|
|
9775
|
+
"valueTypes": [],
|
|
9776
|
+
},
|
|
9777
|
+
"ontology": {
|
|
9327
9778
|
"actionTypes": {
|
|
9328
9779
|
"com.palantir.create-object-sample-object": {
|
|
9329
9780
|
"actionType": {
|
|
@@ -9413,8 +9864,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9413
9864
|
"type": "text",
|
|
9414
9865
|
},
|
|
9415
9866
|
"required": {
|
|
9416
|
-
"
|
|
9417
|
-
"type": "
|
|
9867
|
+
"notRequired": {},
|
|
9868
|
+
"type": "notRequired",
|
|
9418
9869
|
},
|
|
9419
9870
|
},
|
|
9420
9871
|
},
|
|
@@ -9441,8 +9892,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9441
9892
|
"type": "text",
|
|
9442
9893
|
},
|
|
9443
9894
|
"required": {
|
|
9444
|
-
"
|
|
9445
|
-
"type": "
|
|
9895
|
+
"notRequired": {},
|
|
9896
|
+
"type": "notRequired",
|
|
9446
9897
|
},
|
|
9447
9898
|
},
|
|
9448
9899
|
},
|
|
@@ -9686,17 +10137,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9686
10137
|
},
|
|
9687
10138
|
"sharedPropertyTypes": {},
|
|
9688
10139
|
},
|
|
9689
|
-
"
|
|
9690
|
-
"
|
|
9691
|
-
"interfaceTypes": [],
|
|
9692
|
-
"linkTypes": [],
|
|
9693
|
-
"objectTypes": [],
|
|
9694
|
-
"sharedPropertyTypes": [],
|
|
10140
|
+
"valueTypes": {
|
|
10141
|
+
"valueTypes": [],
|
|
9695
10142
|
},
|
|
9696
10143
|
}
|
|
9697
10144
|
`);});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
10145
|
{
|
|
9699
|
-
"
|
|
10146
|
+
"importedOntology": {
|
|
10147
|
+
"actionTypes": {},
|
|
10148
|
+
"blockPermissionInformation": {
|
|
10149
|
+
"actionTypes": {},
|
|
10150
|
+
"linkTypes": {},
|
|
10151
|
+
"objectTypes": {},
|
|
10152
|
+
},
|
|
10153
|
+
"interfaceTypes": {},
|
|
10154
|
+
"linkTypes": {},
|
|
10155
|
+
"objectTypes": {},
|
|
10156
|
+
"sharedPropertyTypes": {},
|
|
10157
|
+
},
|
|
10158
|
+
"importedValueTypes": {
|
|
10159
|
+
"valueTypes": [],
|
|
10160
|
+
},
|
|
10161
|
+
"ontology": {
|
|
9700
10162
|
"actionTypes": {
|
|
9701
10163
|
"com.palantir.create-object-object-with-arrays": {
|
|
9702
10164
|
"actionType": {
|
|
@@ -9768,8 +10230,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9768
10230
|
"type": "text",
|
|
9769
10231
|
},
|
|
9770
10232
|
"required": {
|
|
9771
|
-
"
|
|
9772
|
-
"type": "
|
|
10233
|
+
"notRequired": {},
|
|
10234
|
+
"type": "notRequired",
|
|
9773
10235
|
},
|
|
9774
10236
|
},
|
|
9775
10237
|
},
|
|
@@ -9827,8 +10289,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
9827
10289
|
"type": "text",
|
|
9828
10290
|
},
|
|
9829
10291
|
"required": {
|
|
9830
|
-
"
|
|
9831
|
-
"type": "
|
|
10292
|
+
"notRequired": {},
|
|
10293
|
+
"type": "notRequired",
|
|
9832
10294
|
},
|
|
9833
10295
|
},
|
|
9834
10296
|
},
|
|
@@ -10503,17 +10965,28 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
10503
10965
|
},
|
|
10504
10966
|
"sharedPropertyTypes": {},
|
|
10505
10967
|
},
|
|
10506
|
-
"
|
|
10507
|
-
"
|
|
10508
|
-
"interfaceTypes": [],
|
|
10509
|
-
"linkTypes": [],
|
|
10510
|
-
"objectTypes": [],
|
|
10511
|
-
"sharedPropertyTypes": [],
|
|
10968
|
+
"valueTypes": {
|
|
10969
|
+
"valueTypes": [],
|
|
10512
10970
|
},
|
|
10513
10971
|
}
|
|
10514
10972
|
`);});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
10973
|
{
|
|
10516
|
-
"
|
|
10974
|
+
"importedOntology": {
|
|
10975
|
+
"actionTypes": {},
|
|
10976
|
+
"blockPermissionInformation": {
|
|
10977
|
+
"actionTypes": {},
|
|
10978
|
+
"linkTypes": {},
|
|
10979
|
+
"objectTypes": {},
|
|
10980
|
+
},
|
|
10981
|
+
"interfaceTypes": {},
|
|
10982
|
+
"linkTypes": {},
|
|
10983
|
+
"objectTypes": {},
|
|
10984
|
+
"sharedPropertyTypes": {},
|
|
10985
|
+
},
|
|
10986
|
+
"importedValueTypes": {
|
|
10987
|
+
"valueTypes": [],
|
|
10988
|
+
},
|
|
10989
|
+
"ontology": {
|
|
10517
10990
|
"actionTypes": {
|
|
10518
10991
|
"com.palantir.create-object-sample-object": {
|
|
10519
10992
|
"actionType": {
|
|
@@ -10577,8 +11050,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
10577
11050
|
"type": "text",
|
|
10578
11051
|
},
|
|
10579
11052
|
"required": {
|
|
10580
|
-
"
|
|
10581
|
-
"type": "
|
|
11053
|
+
"notRequired": {},
|
|
11054
|
+
"type": "notRequired",
|
|
10582
11055
|
},
|
|
10583
11056
|
},
|
|
10584
11057
|
},
|
|
@@ -10605,8 +11078,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
10605
11078
|
"type": "text",
|
|
10606
11079
|
},
|
|
10607
11080
|
"required": {
|
|
10608
|
-
"
|
|
10609
|
-
"type": "
|
|
11081
|
+
"notRequired": {},
|
|
11082
|
+
"type": "notRequired",
|
|
10610
11083
|
},
|
|
10611
11084
|
},
|
|
10612
11085
|
},
|
|
@@ -10922,12 +11395,8 @@ const employeeObject=defineObject({apiName:"employee",displayName:"Employee",plu
|
|
|
10922
11395
|
},
|
|
10923
11396
|
"sharedPropertyTypes": {},
|
|
10924
11397
|
},
|
|
10925
|
-
"
|
|
10926
|
-
"
|
|
10927
|
-
"interfaceTypes": [],
|
|
10928
|
-
"linkTypes": [],
|
|
10929
|
-
"objectTypes": [],
|
|
10930
|
-
"sharedPropertyTypes": [],
|
|
11398
|
+
"valueTypes": {
|
|
11399
|
+
"valueTypes": [],
|
|
10931
11400
|
},
|
|
10932
11401
|
}
|
|
10933
11402
|
`);});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 +11406,22 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
10937
11406
|
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
11407
|
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
11408
|
{
|
|
10940
|
-
"
|
|
11409
|
+
"importedOntology": {
|
|
11410
|
+
"actionTypes": {},
|
|
11411
|
+
"blockPermissionInformation": {
|
|
11412
|
+
"actionTypes": {},
|
|
11413
|
+
"linkTypes": {},
|
|
11414
|
+
"objectTypes": {},
|
|
11415
|
+
},
|
|
11416
|
+
"interfaceTypes": {},
|
|
11417
|
+
"linkTypes": {},
|
|
11418
|
+
"objectTypes": {},
|
|
11419
|
+
"sharedPropertyTypes": {},
|
|
11420
|
+
},
|
|
11421
|
+
"importedValueTypes": {
|
|
11422
|
+
"valueTypes": [],
|
|
11423
|
+
},
|
|
11424
|
+
"ontology": {
|
|
10941
11425
|
"actionTypes": {
|
|
10942
11426
|
"com.palantir.create-object-sample-object": {
|
|
10943
11427
|
"actionType": {
|
|
@@ -11005,8 +11489,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11005
11489
|
"type": "text",
|
|
11006
11490
|
},
|
|
11007
11491
|
"required": {
|
|
11008
|
-
"
|
|
11009
|
-
"type": "
|
|
11492
|
+
"notRequired": {},
|
|
11493
|
+
"type": "notRequired",
|
|
11010
11494
|
},
|
|
11011
11495
|
},
|
|
11012
11496
|
},
|
|
@@ -11033,8 +11517,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11033
11517
|
"type": "text",
|
|
11034
11518
|
},
|
|
11035
11519
|
"required": {
|
|
11036
|
-
"
|
|
11037
|
-
"type": "
|
|
11520
|
+
"notRequired": {},
|
|
11521
|
+
"type": "notRequired",
|
|
11038
11522
|
},
|
|
11039
11523
|
},
|
|
11040
11524
|
},
|
|
@@ -11092,8 +11576,8 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11092
11576
|
"type": "text",
|
|
11093
11577
|
},
|
|
11094
11578
|
"required": {
|
|
11095
|
-
"
|
|
11096
|
-
"type": "
|
|
11579
|
+
"notRequired": {},
|
|
11580
|
+
"type": "notRequired",
|
|
11097
11581
|
},
|
|
11098
11582
|
},
|
|
11099
11583
|
},
|
|
@@ -11386,17 +11870,56 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11386
11870
|
},
|
|
11387
11871
|
"sharedPropertyTypes": {},
|
|
11388
11872
|
},
|
|
11389
|
-
"
|
|
11390
|
-
"
|
|
11391
|
-
"interfaceTypes": [],
|
|
11392
|
-
"linkTypes": [],
|
|
11393
|
-
"objectTypes": [],
|
|
11394
|
-
"sharedPropertyTypes": [],
|
|
11873
|
+
"valueTypes": {
|
|
11874
|
+
"valueTypes": [],
|
|
11395
11875
|
},
|
|
11396
11876
|
}
|
|
11397
11877
|
`);});});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
11878
|
{
|
|
11399
|
-
"
|
|
11879
|
+
"importedOntology": {
|
|
11880
|
+
"actionTypes": {},
|
|
11881
|
+
"blockPermissionInformation": {
|
|
11882
|
+
"actionTypes": {},
|
|
11883
|
+
"linkTypes": {},
|
|
11884
|
+
"objectTypes": {},
|
|
11885
|
+
},
|
|
11886
|
+
"interfaceTypes": {},
|
|
11887
|
+
"linkTypes": {},
|
|
11888
|
+
"objectTypes": {},
|
|
11889
|
+
"sharedPropertyTypes": {
|
|
11890
|
+
"com.palantir.core.ontology.types.id": {
|
|
11891
|
+
"sharedPropertyType": {
|
|
11892
|
+
"aliases": [],
|
|
11893
|
+
"apiName": "com.palantir.core.ontology.types.id",
|
|
11894
|
+
"baseFormatter": undefined,
|
|
11895
|
+
"dataConstraints": undefined,
|
|
11896
|
+
"displayMetadata": {
|
|
11897
|
+
"description": undefined,
|
|
11898
|
+
"displayName": "com.palantir.core.ontology.types.id",
|
|
11899
|
+
"visibility": "NORMAL",
|
|
11900
|
+
},
|
|
11901
|
+
"gothamMapping": undefined,
|
|
11902
|
+
"indexedForSearch": true,
|
|
11903
|
+
"type": {
|
|
11904
|
+
"string": {
|
|
11905
|
+
"analyzerOverride": undefined,
|
|
11906
|
+
"enableAsciiFolding": undefined,
|
|
11907
|
+
"isLongText": false,
|
|
11908
|
+
"supportsEfficientLeadingWildcard": false,
|
|
11909
|
+
"supportsExactMatching": true,
|
|
11910
|
+
},
|
|
11911
|
+
"type": "string",
|
|
11912
|
+
},
|
|
11913
|
+
"typeClasses": [],
|
|
11914
|
+
"valueType": undefined,
|
|
11915
|
+
},
|
|
11916
|
+
},
|
|
11917
|
+
},
|
|
11918
|
+
},
|
|
11919
|
+
"importedValueTypes": {
|
|
11920
|
+
"valueTypes": [],
|
|
11921
|
+
},
|
|
11922
|
+
"ontology": {
|
|
11400
11923
|
"actionTypes": {},
|
|
11401
11924
|
"blockPermissionInformation": {
|
|
11402
11925
|
"actionTypes": {},
|
|
@@ -11410,7 +11933,6 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11410
11933
|
"displayMetadata": {
|
|
11411
11934
|
"description": "myInterface",
|
|
11412
11935
|
"displayName": "myInterface",
|
|
11413
|
-
"icon": undefined,
|
|
11414
11936
|
},
|
|
11415
11937
|
"extendsInterfaces": [],
|
|
11416
11938
|
"links": [],
|
|
@@ -11458,35 +11980,57 @@ parameterOrdering:["foo","id"]});}).toThrowErrorMatchingInlineSnapshot(`[Error:
|
|
|
11458
11980
|
"objectTypes": {},
|
|
11459
11981
|
"sharedPropertyTypes": {},
|
|
11460
11982
|
},
|
|
11461
|
-
"
|
|
11462
|
-
"
|
|
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
|
-
],
|
|
11983
|
+
"valueTypes": {
|
|
11984
|
+
"valueTypes": [],
|
|
11484
11985
|
},
|
|
11485
11986
|
}
|
|
11486
11987
|
`);});it("Simple importing works",()=>{// does the same as "import { spt } from '@other/package'"
|
|
11487
11988
|
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
11989
|
{
|
|
11489
|
-
"
|
|
11990
|
+
"importedOntology": {
|
|
11991
|
+
"actionTypes": {},
|
|
11992
|
+
"blockPermissionInformation": {
|
|
11993
|
+
"actionTypes": {},
|
|
11994
|
+
"linkTypes": {},
|
|
11995
|
+
"objectTypes": {},
|
|
11996
|
+
},
|
|
11997
|
+
"interfaceTypes": {},
|
|
11998
|
+
"linkTypes": {},
|
|
11999
|
+
"objectTypes": {},
|
|
12000
|
+
"sharedPropertyTypes": {
|
|
12001
|
+
"com.other.package.spt": {
|
|
12002
|
+
"sharedPropertyType": {
|
|
12003
|
+
"aliases": [],
|
|
12004
|
+
"apiName": "com.other.package.spt",
|
|
12005
|
+
"baseFormatter": undefined,
|
|
12006
|
+
"dataConstraints": undefined,
|
|
12007
|
+
"displayMetadata": {
|
|
12008
|
+
"description": undefined,
|
|
12009
|
+
"displayName": "com.other.package.spt",
|
|
12010
|
+
"visibility": "NORMAL",
|
|
12011
|
+
},
|
|
12012
|
+
"gothamMapping": undefined,
|
|
12013
|
+
"indexedForSearch": true,
|
|
12014
|
+
"type": {
|
|
12015
|
+
"string": {
|
|
12016
|
+
"analyzerOverride": undefined,
|
|
12017
|
+
"enableAsciiFolding": undefined,
|
|
12018
|
+
"isLongText": false,
|
|
12019
|
+
"supportsEfficientLeadingWildcard": false,
|
|
12020
|
+
"supportsExactMatching": true,
|
|
12021
|
+
},
|
|
12022
|
+
"type": "string",
|
|
12023
|
+
},
|
|
12024
|
+
"typeClasses": [],
|
|
12025
|
+
"valueType": undefined,
|
|
12026
|
+
},
|
|
12027
|
+
},
|
|
12028
|
+
},
|
|
12029
|
+
},
|
|
12030
|
+
"importedValueTypes": {
|
|
12031
|
+
"valueTypes": [],
|
|
12032
|
+
},
|
|
12033
|
+
"ontology": {
|
|
11490
12034
|
"actionTypes": {},
|
|
11491
12035
|
"blockPermissionInformation": {
|
|
11492
12036
|
"actionTypes": {},
|
|
@@ -11500,7 +12044,6 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
11500
12044
|
"displayMetadata": {
|
|
11501
12045
|
"description": "myInterface",
|
|
11502
12046
|
"displayName": "myInterface",
|
|
11503
|
-
"icon": undefined,
|
|
11504
12047
|
},
|
|
11505
12048
|
"extendsInterfaces": [],
|
|
11506
12049
|
"links": [],
|
|
@@ -11548,29 +12091,8 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
11548
12091
|
"objectTypes": {},
|
|
11549
12092
|
"sharedPropertyTypes": {},
|
|
11550
12093
|
},
|
|
11551
|
-
"
|
|
11552
|
-
"
|
|
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
|
-
],
|
|
12094
|
+
"valueTypes": {
|
|
12095
|
+
"valueTypes": [],
|
|
11574
12096
|
},
|
|
11575
12097
|
}
|
|
11576
12098
|
`);});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 +12322,22 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
11800
12322
|
"
|
|
11801
12323
|
`);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
12324
|
{
|
|
11803
|
-
"
|
|
12325
|
+
"importedOntology": {
|
|
12326
|
+
"actionTypes": {},
|
|
12327
|
+
"blockPermissionInformation": {
|
|
12328
|
+
"actionTypes": {},
|
|
12329
|
+
"linkTypes": {},
|
|
12330
|
+
"objectTypes": {},
|
|
12331
|
+
},
|
|
12332
|
+
"interfaceTypes": {},
|
|
12333
|
+
"linkTypes": {},
|
|
12334
|
+
"objectTypes": {},
|
|
12335
|
+
"sharedPropertyTypes": {},
|
|
12336
|
+
},
|
|
12337
|
+
"importedValueTypes": {
|
|
12338
|
+
"valueTypes": [],
|
|
12339
|
+
},
|
|
12340
|
+
"ontology": {
|
|
11804
12341
|
"actionTypes": {},
|
|
11805
12342
|
"blockPermissionInformation": {
|
|
11806
12343
|
"actionTypes": {},
|
|
@@ -11814,7 +12351,6 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
11814
12351
|
"displayMetadata": {
|
|
11815
12352
|
"description": "childInterface",
|
|
11816
12353
|
"displayName": "childInterface",
|
|
11817
|
-
"icon": undefined,
|
|
11818
12354
|
},
|
|
11819
12355
|
"extendsInterfaces": [
|
|
11820
12356
|
"com.palantir.parentInterface",
|
|
@@ -11874,7 +12410,6 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
11874
12410
|
"displayMetadata": {
|
|
11875
12411
|
"description": "parentInterface",
|
|
11876
12412
|
"displayName": "parentInterface",
|
|
11877
|
-
"icon": undefined,
|
|
11878
12413
|
},
|
|
11879
12414
|
"extendsInterfaces": [],
|
|
11880
12415
|
"links": [],
|
|
@@ -12159,12 +12694,8 @@ const spt={apiName:"com.other.package.spt",nonNameSpacedApiName:"spt",type:"stri
|
|
|
12159
12694
|
},
|
|
12160
12695
|
},
|
|
12161
12696
|
},
|
|
12162
|
-
"
|
|
12163
|
-
"
|
|
12164
|
-
"interfaceTypes": [],
|
|
12165
|
-
"linkTypes": [],
|
|
12166
|
-
"objectTypes": [],
|
|
12167
|
-
"sharedPropertyTypes": [],
|
|
12697
|
+
"valueTypes": {
|
|
12698
|
+
"valueTypes": [],
|
|
12168
12699
|
},
|
|
12169
12700
|
}
|
|
12170
12701
|
`);});});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(`
|