@neo4j/graph-schema-utils 1.0.0-next.1 → 1.0.0-next.3

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.
@@ -1,4 +1,3 @@
1
1
  export { validateSchema, SchemaValidationError } from "./validation.js";
2
- import * as model from "./model";
3
-
2
+ import * as model from "./model/index.js";
4
3
  export { model };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { validateSchema, SchemaValidationError } from "./validation.js";
2
+ import * as model from "./model/index.js";
3
+ export { model };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,179 @@
1
+ export declare class GraphSchemaRepresentation {
2
+ version: string;
3
+ graphSchema: GraphSchema;
4
+ constructor(version: string, graphSchema: GraphSchema);
5
+ toJson(): string;
6
+ static parseJson(jsonString: any): GraphSchemaRepresentation;
7
+ }
8
+ export declare class GraphSchema {
9
+ nodeLabels: NodeLabel[];
10
+ relationshipTypes: RelationshipType[];
11
+ nodeObjectTypes: NodeObjectType[];
12
+ relationshipObjectTypes: RelationshipObjectType[];
13
+ constructor(nodeLabels: NodeLabel[], relationshipTypes: RelationshipType[], nodeObjectTypes: NodeObjectType[], relationshipObjectTypes: RelationshipObjectType[]);
14
+ toJsonStruct(): {
15
+ nodeLabels: {
16
+ $id: string;
17
+ token: string;
18
+ }[];
19
+ relationshipTypes: {
20
+ $id: string;
21
+ token: string;
22
+ }[];
23
+ nodeObjectTypes: {
24
+ $id: string;
25
+ labels: {
26
+ $ref: string;
27
+ }[];
28
+ properties: {
29
+ type: any[] | {
30
+ type: PropertyTypes;
31
+ } | {
32
+ type: "array";
33
+ items: PropertyBaseType;
34
+ };
35
+ token: string;
36
+ mandatory: boolean;
37
+ }[];
38
+ }[];
39
+ relationshipObjectTypes: {
40
+ $id: string;
41
+ type: {
42
+ $ref: string;
43
+ };
44
+ from: {
45
+ $ref: string;
46
+ };
47
+ to: {
48
+ $ref: string;
49
+ };
50
+ properties: {
51
+ type: any[] | {
52
+ type: PropertyTypes;
53
+ } | {
54
+ type: "array";
55
+ items: PropertyBaseType;
56
+ };
57
+ token: string;
58
+ mandatory: boolean;
59
+ }[];
60
+ }[];
61
+ };
62
+ static fromJsonStruct(json: any): GraphSchema;
63
+ }
64
+ export declare class NodeLabel {
65
+ $id: string;
66
+ token: string;
67
+ constructor(id: string, token: string);
68
+ toJsonStruct(): {
69
+ $id: string;
70
+ token: string;
71
+ };
72
+ toRef(): {
73
+ $ref: string;
74
+ };
75
+ }
76
+ export declare class RelationshipType {
77
+ $id: string;
78
+ token: string;
79
+ constructor(id: string, token: string);
80
+ toJsonStruct(): {
81
+ $id: string;
82
+ token: string;
83
+ };
84
+ toRef(): {
85
+ $ref: string;
86
+ };
87
+ }
88
+ export declare class NodeObjectType {
89
+ $id: string;
90
+ labels: NodeLabel[];
91
+ properties: Property[];
92
+ constructor(id: string, labels: NodeLabel[], properties: Property[]);
93
+ toJsonStruct(): {
94
+ $id: string;
95
+ labels: {
96
+ $ref: string;
97
+ }[];
98
+ properties: {
99
+ type: any[] | {
100
+ type: PropertyTypes;
101
+ } | {
102
+ type: "array";
103
+ items: PropertyBaseType;
104
+ };
105
+ token: string;
106
+ mandatory: boolean;
107
+ }[];
108
+ };
109
+ toRef(): {
110
+ $ref: string;
111
+ };
112
+ }
113
+ export declare class RelationshipObjectType {
114
+ $id: string;
115
+ type: RelationshipType;
116
+ from: NodeObjectType;
117
+ to: NodeObjectType;
118
+ properties: Property[];
119
+ constructor(id: string, type: RelationshipType, from: NodeObjectType, to: NodeObjectType, properties: Property[]);
120
+ toJsonStruct(): {
121
+ $id: string;
122
+ type: {
123
+ $ref: string;
124
+ };
125
+ from: {
126
+ $ref: string;
127
+ };
128
+ to: {
129
+ $ref: string;
130
+ };
131
+ properties: {
132
+ type: any[] | {
133
+ type: PropertyTypes;
134
+ } | {
135
+ type: "array";
136
+ items: PropertyBaseType;
137
+ };
138
+ token: string;
139
+ mandatory: boolean;
140
+ }[];
141
+ };
142
+ }
143
+ export declare class Property {
144
+ token: string;
145
+ type: PropertyBaseType | PropertyArrayType;
146
+ mandatory: boolean;
147
+ constructor(token: string, type: PropertyBaseType | PropertyArrayType, mandatory: boolean);
148
+ toJsonStruct(): {
149
+ type: any[] | {
150
+ type: PropertyTypes;
151
+ } | {
152
+ type: "array";
153
+ items: PropertyBaseType;
154
+ };
155
+ token: string;
156
+ mandatory: boolean;
157
+ };
158
+ }
159
+ export declare class PropertyBaseType {
160
+ type: PropertyTypes;
161
+ constructor(type: PropertyTypes);
162
+ toJsonStruct(): {
163
+ type: PropertyTypes;
164
+ };
165
+ }
166
+ export declare class PropertyArrayType {
167
+ items: PropertyBaseType;
168
+ type: "array";
169
+ constructor(items: PropertyBaseType);
170
+ toJsonStruct(): {
171
+ type: "array";
172
+ items: PropertyBaseType;
173
+ };
174
+ }
175
+ export declare class PropertyType {
176
+ static fromJsonStruct(json: any): any;
177
+ }
178
+ type PropertyTypes = "integer" | "string" | "float" | "boolean" | "point" | "date" | "datetime" | "time" | "localtime" | "localdatetime" | "duration";
179
+ export {};
@@ -0,0 +1,200 @@
1
+ export class GraphSchemaRepresentation {
2
+ constructor(version, graphSchema) {
3
+ this.version = version;
4
+ this.graphSchema = graphSchema;
5
+ }
6
+ toJson() {
7
+ return JSON.stringify({
8
+ graphSchemaRepresentation: {
9
+ version: this.version,
10
+ graphSchema: this.graphSchema.toJsonStruct(),
11
+ },
12
+ });
13
+ }
14
+ static parseJson(jsonString) {
15
+ const json = JSON.parse(jsonString);
16
+ const version = json.graphSchemaRepresentation.version;
17
+ const graphSchema = GraphSchema.fromJsonStruct(json.graphSchemaRepresentation.graphSchema);
18
+ return new GraphSchemaRepresentation(version, graphSchema);
19
+ }
20
+ }
21
+ export class GraphSchema {
22
+ constructor(nodeLabels, relationshipTypes, nodeObjectTypes, relationshipObjectTypes) {
23
+ this.nodeLabels = nodeLabels;
24
+ this.relationshipTypes = relationshipTypes;
25
+ this.nodeObjectTypes = nodeObjectTypes;
26
+ this.relationshipObjectTypes = relationshipObjectTypes;
27
+ }
28
+ toJsonStruct() {
29
+ return {
30
+ nodeLabels: this.nodeLabels.map((nodeLabel) => nodeLabel.toJsonStruct()),
31
+ relationshipTypes: this.relationshipTypes.map((relationshipType) => relationshipType.toJsonStruct()),
32
+ nodeObjectTypes: this.nodeObjectTypes.map((nodeObjectType) => nodeObjectType.toJsonStruct()),
33
+ relationshipObjectTypes: this.relationshipObjectTypes.map((relationshipObjectType) => relationshipObjectType.toJsonStruct()),
34
+ };
35
+ }
36
+ static fromJsonStruct(json) {
37
+ const nodeLabels = json.nodeLabels.map((nodeLabel) => new NodeLabel(nodeLabel.$id, nodeLabel.token));
38
+ const relationshipTypes = json.relationshipTypes.map((relationshipType) => new RelationshipType(relationshipType.$id, relationshipType.token));
39
+ const nodeObjectTypes = json.nodeObjectTypes.map((nodeObjectType) => {
40
+ const labels = nodeObjectType.labels
41
+ .map((label) => nodeLabels.find((nodeLabel) => nodeLabel.$id === label.$ref.slice(1)))
42
+ .filter((label) => label);
43
+ if (labels.length !== nodeObjectType.labels.length) {
44
+ throw new Error("Not all label references are defined");
45
+ }
46
+ return new NodeObjectType(nodeObjectType.$id, labels, nodeObjectType.properties.map((property) => new Property(property.token, PropertyType.fromJsonStruct(property.type), property.mandatory)));
47
+ });
48
+ const relationshipObjectTypes = json.relationshipObjectTypes.map((relationshipObjectType) => {
49
+ const type = relationshipTypes.find((relationshipType) => relationshipType.$id === relationshipObjectType.type.$ref.slice(1));
50
+ if (!type) {
51
+ throw new Error("Not all relationship type references are defined");
52
+ }
53
+ const from = nodeObjectTypes.find((nodeObjectType) => nodeObjectType.$id === relationshipObjectType.from.$ref.slice(1));
54
+ if (!from) {
55
+ throw new Error("Not all node object type references in from are defined");
56
+ }
57
+ const to = nodeObjectTypes.find((nodeObjectType) => nodeObjectType.$id === relationshipObjectType.to.$ref.slice(1));
58
+ if (!to) {
59
+ throw new Error("Not all node object type references in to are defined");
60
+ }
61
+ return new RelationshipObjectType(relationshipObjectType.$id, type, from, to, relationshipObjectType.properties.map((property) => new Property(property.token, PropertyType.fromJsonStruct(property.type), property.mandatory)));
62
+ });
63
+ return new GraphSchema(nodeLabels, relationshipTypes, nodeObjectTypes, relationshipObjectTypes);
64
+ }
65
+ }
66
+ export class NodeLabel {
67
+ constructor(id, token) {
68
+ this.$id = id;
69
+ this.token = token;
70
+ }
71
+ toJsonStruct() {
72
+ return {
73
+ $id: this.$id,
74
+ token: this.token,
75
+ };
76
+ }
77
+ toRef() {
78
+ return {
79
+ $ref: `#${this.$id}`,
80
+ };
81
+ }
82
+ }
83
+ export class RelationshipType {
84
+ constructor(id, token) {
85
+ this.$id = id;
86
+ this.token = token;
87
+ }
88
+ toJsonStruct() {
89
+ return {
90
+ $id: this.$id,
91
+ token: this.token,
92
+ };
93
+ }
94
+ toRef() {
95
+ return {
96
+ $ref: `#${this.$id}`,
97
+ };
98
+ }
99
+ }
100
+ export class NodeObjectType {
101
+ constructor(id, labels, properties) {
102
+ this.$id = id;
103
+ this.labels = labels;
104
+ this.properties = properties;
105
+ }
106
+ toJsonStruct() {
107
+ const brokenLabels = this.labels.filter((label) => !label);
108
+ if (brokenLabels.length > 0) {
109
+ throw new Error("Not all labels are defined");
110
+ }
111
+ return {
112
+ $id: this.$id,
113
+ labels: this.labels.map((label) => label.toRef()),
114
+ properties: this.properties.map((property) => property.toJsonStruct()),
115
+ };
116
+ }
117
+ toRef() {
118
+ return {
119
+ $ref: `#${this.$id}`,
120
+ };
121
+ }
122
+ }
123
+ export class RelationshipObjectType {
124
+ constructor(id, type, from, to, properties) {
125
+ this.$id = id;
126
+ this.type = type;
127
+ this.from = from;
128
+ this.to = to;
129
+ this.properties = properties;
130
+ }
131
+ toJsonStruct() {
132
+ if (!this.type) {
133
+ throw new Error("RelationshipObjectType.type is not defined");
134
+ }
135
+ if (!this.from) {
136
+ throw new Error("RelationshipObjectType.from is not defined");
137
+ }
138
+ if (!this.to) {
139
+ throw new Error("RelationshipObjectType.to is not defined");
140
+ }
141
+ return {
142
+ $id: this.$id,
143
+ type: this.type.toRef(),
144
+ from: this.from.toRef(),
145
+ to: this.to.toRef(),
146
+ properties: this.properties.map((property) => property.toJsonStruct()),
147
+ };
148
+ }
149
+ }
150
+ export class Property {
151
+ constructor(token, type, mandatory) {
152
+ this.token = token;
153
+ this.type = type;
154
+ this.mandatory = mandatory;
155
+ }
156
+ toJsonStruct() {
157
+ const typeVal = Array.isArray(this.type)
158
+ ? this.type.map((t) => t.toJsonStruct())
159
+ : this.type.toJsonStruct();
160
+ return {
161
+ type: typeVal,
162
+ token: this.token,
163
+ mandatory: this.mandatory,
164
+ };
165
+ }
166
+ }
167
+ export class PropertyBaseType {
168
+ constructor(type) {
169
+ this.type = type;
170
+ }
171
+ toJsonStruct() {
172
+ return {
173
+ type: this.type,
174
+ };
175
+ }
176
+ }
177
+ export class PropertyArrayType {
178
+ constructor(items) {
179
+ this.type = "array";
180
+ this.items = items;
181
+ }
182
+ toJsonStruct() {
183
+ return {
184
+ type: this.type,
185
+ items: this.items,
186
+ };
187
+ }
188
+ }
189
+ export class PropertyType {
190
+ static fromJsonStruct(json) {
191
+ if (Array.isArray(json)) {
192
+ return json.map((item) => PropertyType.fromJsonStruct(item));
193
+ }
194
+ if (json.type === "array") {
195
+ return new PropertyArrayType(json.items);
196
+ }
197
+ return new PropertyBaseType(json.type);
198
+ }
199
+ }
200
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,yBAAyB;IAIpC,YAAY,O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AAK,CAAC;IACrB,CAAC;IACD,YAAY;QACV,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,cAAc,CAAC,IAAI;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;SAC9D;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YACzB,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;QACD,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import AjvModule from "ajv";
2
+ export declare function validateSchema(jsonSchema: string, graphSchema: string): boolean;
3
+ export declare class SchemaValidationError extends Error {
4
+ messages: AjvModule.ErrorObject<string, Record<string, any>, unknown>[];
5
+ constructor(inputMessages: AjvModule.ErrorObject<string, Record<string, any>, unknown>[]);
6
+ }
7
+ export declare class InputTypeError extends Error {
8
+ constructor(message: string);
9
+ }
@@ -0,0 +1,47 @@
1
+ import AjvModule from "ajv";
2
+ // FIXME: https://github.com/ajv-validator/ajv/issues/2047
3
+ const Ajv = AjvModule.default;
4
+ const ajv = new Ajv({ strict: false, allErrors: true });
5
+ export function validateSchema(jsonSchema, graphSchema) {
6
+ if (typeof jsonSchema !== "string") {
7
+ throw new InputTypeError("JSON schema should be a string");
8
+ }
9
+ let jsonSchemaObj;
10
+ try {
11
+ jsonSchemaObj = JSON.parse(jsonSchema);
12
+ }
13
+ catch (_) {
14
+ throw new InputTypeError("Cannot JSON.parse JSON schema input");
15
+ }
16
+ if (typeof graphSchema !== "string") {
17
+ throw new InputTypeError("Graph schema should be a string");
18
+ }
19
+ let graphSchemaObj;
20
+ try {
21
+ graphSchemaObj = JSON.parse(graphSchema);
22
+ }
23
+ catch (_) {
24
+ throw new InputTypeError("Cannot JSON.parse graph schema input");
25
+ }
26
+ const validate = ajv.compile(jsonSchemaObj);
27
+ const result = validate(graphSchemaObj);
28
+ if (result !== true) {
29
+ throw new SchemaValidationError(validate.errors);
30
+ }
31
+ return true;
32
+ }
33
+ export class SchemaValidationError extends Error {
34
+ constructor(inputMessages) {
35
+ super(`See error.messages for details`);
36
+ this.messages = [];
37
+ this.messages = inputMessages;
38
+ this.name = "SchemaValidationError";
39
+ }
40
+ }
41
+ export class InputTypeError extends Error {
42
+ constructor(message) {
43
+ super(message);
44
+ this.name = "InputTypeError";
45
+ }
46
+ }
47
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,KAAK,CAAC;AAE5B,0DAA0D;AAC1D,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC;AAE9B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAExD,MAAM,UAAU,cAAc,CAC5B,UAAkB,EAClB,WAAmB;IAEnB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,IAAI,cAAc,CAAC,gCAAgC,CAAC,CAAC;KAC5D;IACD,IAAI,aAAa,CAAC;IAClB,IAAI;QACF,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;KACxC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,cAAc,CAAC,qCAAqC,CAAC,CAAC;KACjE;IAED,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,MAAM,IAAI,cAAc,CAAC,iCAAiC,CAAC,CAAC;KAC7D;IAED,IAAI,cAAc,CAAC;IACnB,IAAI;QACF,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,cAAc,CAAC,sCAAsC,CAAC,CAAC;KAClE;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IACxC,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,MAAM,IAAI,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAClD;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAG9C,YACE,aAA4E;QAE5E,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAL1C,aAAQ,GAAkE,EAAE,CAAC;QAM3E,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF"}
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@neo4j/graph-schema-utils",
3
- "version": "1.0.0-next.1",
4
- "description": "Utilities for the Neo4j Graph Schema JSON representation",
5
- "module": "src/index.js",
3
+ "version": "1.0.0-next.3",
4
+ "description": "Utilities for Neo4j Graph Schema JSON representation",
5
+ "module": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
6
13
  "type": "module",
7
14
  "scripts": {
8
15
  "test:watch": "vitest",
9
- "test": "vitest run"
16
+ "test": "vitest run",
17
+ "build": "tsc"
10
18
  },
11
19
  "files": [
12
- "src"
20
+ "dist"
13
21
  ],
14
22
  "repository": {
15
23
  "type": "git",
@@ -1,330 +0,0 @@
1
- export class GraphSchemaRepresentation {
2
- /**
3
- * @param {string} version
4
- * @param {GraphSchema} graphSchema
5
- */
6
- constructor(version, graphSchema) {
7
- this.version = version;
8
- this.graphSchema = graphSchema;
9
- }
10
-
11
- toJson() {
12
- return JSON.stringify({
13
- graphSchemaRepresentation: {
14
- version: this.version,
15
- graphSchema: this.graphSchema.toJsonStruct(),
16
- },
17
- });
18
- }
19
-
20
- static parseJson(jsonString) {
21
- const json = JSON.parse(jsonString);
22
- const version = json.graphSchemaRepresentation.version;
23
- const graphSchema = GraphSchema.fromJsonStruct(
24
- json.graphSchemaRepresentation.graphSchema
25
- );
26
- return new GraphSchemaRepresentation(version, graphSchema);
27
- }
28
- }
29
-
30
- export class GraphSchema {
31
- /**
32
- * @param {NodeLabel[]} nodeLabels
33
- * @param {RelationshipType[]} relationshipTypes
34
- * @param {NodeObjectType[]} nodeObjectTypes
35
- * @param {RelationshipObjectType[]} relationshipObjectTypes
36
- */
37
- constructor(
38
- nodeLabels,
39
- relationshipTypes,
40
- nodeObjectTypes,
41
- relationshipObjectTypes
42
- ) {
43
- this.nodeLabels = nodeLabels;
44
- this.relationshipTypes = relationshipTypes;
45
- this.nodeObjectTypes = nodeObjectTypes;
46
- this.relationshipObjectTypes = relationshipObjectTypes;
47
- }
48
- toJsonStruct() {
49
- return {
50
- nodeLabels: this.nodeLabels.map((nodeLabel) => nodeLabel.toJsonStruct()),
51
- relationshipTypes: this.relationshipTypes.map((relationshipType) =>
52
- relationshipType.toJsonStruct()
53
- ),
54
- nodeObjectTypes: this.nodeObjectTypes.map((nodeObjectType) =>
55
- nodeObjectType.toJsonStruct()
56
- ),
57
- relationshipObjectTypes: this.relationshipObjectTypes.map(
58
- (relationshipObjectType) => relationshipObjectType.toJsonStruct()
59
- ),
60
- };
61
- }
62
-
63
- static fromJsonStruct(json) {
64
- const nodeLabels = json.nodeLabels.map(
65
- (nodeLabel) => new NodeLabel(nodeLabel.$id, nodeLabel.token)
66
- );
67
- const relationshipTypes = json.relationshipTypes.map(
68
- (relationshipType) =>
69
- new RelationshipType(relationshipType.$id, relationshipType.token)
70
- );
71
- const nodeObjectTypes = json.nodeObjectTypes.map((nodeObjectType) => {
72
- const labels = nodeObjectType.labels
73
- .map((label) =>
74
- nodeLabels.find((nodeLabel) => nodeLabel.$id === label.$ref.slice(1))
75
- )
76
- .filter((label) => label);
77
- if (labels.length !== nodeObjectType.labels.length) {
78
- throw new Error("Not all label references are defined");
79
- }
80
- return new NodeObjectType(
81
- nodeObjectType.$id,
82
- labels,
83
- nodeObjectType.properties.map(
84
- (property) =>
85
- new Property(
86
- property.token,
87
- PropertyType.fromJsonStruct(property.type),
88
- property.mandatory
89
- )
90
- )
91
- );
92
- });
93
- const relationshipObjectTypes = json.relationshipObjectTypes.map(
94
- (relationshipObjectType) => {
95
- const type = relationshipTypes.find(
96
- (relationshipType) =>
97
- relationshipType.$id === relationshipObjectType.type.$ref.slice(1)
98
- );
99
- if (!type) {
100
- throw new Error("Not all relationship type references are defined");
101
- }
102
- const from = nodeObjectTypes.find(
103
- (nodeObjectType) =>
104
- nodeObjectType.$id === relationshipObjectType.from.$ref.slice(1)
105
- );
106
- if (!from) {
107
- throw new Error(
108
- "Not all node object type references in from are defined"
109
- );
110
- }
111
- const to = nodeObjectTypes.find(
112
- (nodeObjectType) =>
113
- nodeObjectType.$id === relationshipObjectType.to.$ref.slice(1)
114
- );
115
- if (!to) {
116
- throw new Error(
117
- "Not all node object type references in to are defined"
118
- );
119
- }
120
- return new RelationshipObjectType(
121
- relationshipObjectType.$id,
122
- type,
123
- from,
124
- to,
125
- relationshipObjectType.properties.map(
126
- (property) =>
127
- new Property(
128
- property.token,
129
- PropertyType.fromJsonStruct(property.type),
130
- property.mandatory
131
- )
132
- )
133
- );
134
- }
135
- );
136
- return new GraphSchema(
137
- nodeLabels,
138
- relationshipTypes,
139
- nodeObjectTypes,
140
- relationshipObjectTypes
141
- );
142
- }
143
- }
144
-
145
- export class NodeLabel {
146
- /**
147
- * @param {string} id
148
- * @param {string} token
149
- */
150
- constructor(id, token) {
151
- this.$id = id;
152
- this.token = token;
153
- }
154
- toJsonStruct() {
155
- return {
156
- $id: this.$id,
157
- token: this.token,
158
- };
159
- }
160
- toRef() {
161
- return {
162
- $ref: `#${this.$id}`,
163
- };
164
- }
165
- }
166
-
167
- export class RelationshipType {
168
- /**
169
- * @param {string} id
170
- * @param {string} token
171
- */
172
- constructor(id, token) {
173
- this.$id = id;
174
- this.token = token;
175
- }
176
- toJsonStruct() {
177
- return {
178
- $id: this.$id,
179
- token: this.token,
180
- };
181
- }
182
- toRef() {
183
- return {
184
- $ref: `#${this.$id}`,
185
- };
186
- }
187
- }
188
-
189
- export class NodeObjectType {
190
- /**
191
- * @param {string} id
192
- * @param {NodeLabel[]} labels
193
- * @param {Property[]} properties
194
- */
195
- constructor(id, labels, properties) {
196
- this.$id = id;
197
- this.labels = labels;
198
- this.properties = properties;
199
- }
200
- toJsonStruct() {
201
- const brokenLabels = this.labels.filter((label) => !label);
202
- if (brokenLabels.length > 0) {
203
- throw new Error("Not all labels are defined");
204
- }
205
- return {
206
- $id: this.$id,
207
- labels: this.labels.map((label) => label.toRef()),
208
- properties: this.properties.map((property) => property.toJsonStruct()),
209
- };
210
- }
211
- toRef() {
212
- return {
213
- $ref: `#${this.$id}`,
214
- };
215
- }
216
- }
217
-
218
- export class RelationshipObjectType {
219
- /**
220
- * @param {string} id
221
- * @param {RelationshipType} type
222
- * @param {NodeObjectType} from
223
- * @param {NodeObjectType} to
224
- * @param {Property[]} properties
225
- */
226
- constructor(id, type, from, to, properties) {
227
- this.$id = id;
228
- this.type = type;
229
- this.from = from;
230
- this.to = to;
231
- this.properties = properties;
232
- }
233
- toJsonStruct() {
234
- if (!this.type) {
235
- throw new Error("RelationshipObjectType.type is not defined");
236
- }
237
- if (!this.from) {
238
- throw new Error("RelationshipObjectType.from is not defined");
239
- }
240
- if (!this.to) {
241
- throw new Error("RelationshipObjectType.to is not defined");
242
- }
243
- return {
244
- $id: this.$id,
245
- type: this.type.toRef(),
246
- from: this.from.toRef(),
247
- to: this.to.toRef(),
248
- properties: this.properties.map((property) => property.toJsonStruct()),
249
- };
250
- }
251
- }
252
-
253
- export class Property {
254
- /** @type {string} */
255
- token;
256
- /** @type {PropertyBaseType | PropertyArrayType} */
257
- type;
258
- /** @type {boolean} */
259
- mandatory;
260
-
261
- /**
262
- * @param {string} token
263
- * @param {PropertyBaseType | PropertyArrayType} type
264
- * @param {boolean} [mandatory]
265
- */
266
- constructor(token, type, mandatory) {
267
- this.token = token;
268
- this.type = type;
269
- this.mandatory = mandatory;
270
- }
271
- toJsonStruct() {
272
- const typeVal = Array.isArray(this.type)
273
- ? this.type.map((t) => t.toJsonStruct())
274
- : this.type.toJsonStruct();
275
- return {
276
- type: typeVal,
277
- token: this.token,
278
- mandatory: this.mandatory,
279
- };
280
- }
281
- }
282
-
283
- export class PropertyBaseType {
284
- /** @type {PropertyTypes} */
285
- type;
286
-
287
- /**
288
- * @param {PropertyTypes} type
289
- */
290
- constructor(type) {
291
- this.type = type;
292
- }
293
- toJsonStruct() {
294
- return {
295
- type: this.type,
296
- };
297
- }
298
- }
299
-
300
- export class PropertyArrayType {
301
- /** @type {PropertyBaseType} */
302
- items;
303
- /**
304
- * @param {PropertyBaseType} items
305
- */
306
- constructor(items) {
307
- this.type = "array";
308
- this.items = items;
309
- }
310
- toJsonStruct() {
311
- return {
312
- type: this.type,
313
- items: this.items,
314
- };
315
- }
316
- }
317
-
318
- export class PropertyType {
319
- static fromJsonStruct(json) {
320
- if (Array.isArray(json)) {
321
- return json.map((item) => PropertyType.fromJsonStruct(item));
322
- }
323
- if (json.type === "array") {
324
- return new PropertyArrayType(json.items);
325
- }
326
- return new PropertyBaseType(json.type);
327
- }
328
- }
329
-
330
- /** @typedef {"integer" | "string" | "float" | "boolean" | "point" | "date" | "datetime" | "time" | "localtime" | "localdatetime" | "duration"} PropertyTypes */
package/src/types.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export type ValidateSchemaFunction = (jsonSchema: string, graphSchema: string) => boolean;
2
-
3
-
4
-
5
-
package/src/validation.js DELETED
@@ -1,65 +0,0 @@
1
- import Ajv from "ajv";
2
-
3
- const ajv = new Ajv({ strict: false, allErrors: true });
4
-
5
- /**
6
- *
7
- * @type {import ("./types").ValidateSchemaFunction}
8
- *
9
- */
10
- export function validateSchema(jsonSchema, graphSchema) {
11
- if (typeof jsonSchema !== "string") {
12
- throw new InputTypeError("JSON schema should be a string");
13
- }
14
- let jsonSchemaObj;
15
- try {
16
- jsonSchemaObj = JSON.parse(jsonSchema);
17
- } catch (_) {
18
- throw new InputTypeError("Cannot JSON.parse JSON schema input");
19
- }
20
-
21
- if (typeof graphSchema !== "string") {
22
- throw new InputTypeError("Graph schema should be a string");
23
- }
24
-
25
- let graphSchemaObj;
26
- try {
27
- graphSchemaObj = JSON.parse(graphSchema);
28
- } catch (_) {
29
- throw new InputTypeError("Cannot JSON.parse graph schema input");
30
- }
31
-
32
- const validate = ajv.compile(jsonSchemaObj);
33
- const result = validate(graphSchemaObj);
34
-
35
- if (result !== true) {
36
- throw new SchemaValidationError(validate.errors);
37
- }
38
- return true;
39
- }
40
-
41
- export class SchemaValidationError extends Error {
42
- /**
43
- * @type {string[]}
44
- */
45
- messages = [];
46
-
47
- /**
48
- * @param {string[]} inputMessages
49
- */
50
- constructor(inputMessages) {
51
- super(inputMessages);
52
- this.messages = inputMessages;
53
- this.name = "SchemaValidationError";
54
- }
55
- }
56
-
57
- export class InputTypeError extends Error {
58
- /**
59
- * @param {string} message
60
- */
61
- constructor(message) {
62
- super(message);
63
- this.name = "InputTypeError";
64
- }
65
- }