@neo4j/graph-schema-utils 1.0.0-next.2 → 1.0.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -1
- package/dist/formatters/index.js +2 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/json/extensions.js +439 -0
- package/dist/formatters/json/extensions.js.map +1 -0
- package/dist/formatters/json/index.js +4 -0
- package/dist/formatters/json/index.js.map +1 -0
- package/dist/formatters/json/types.js +37 -0
- package/dist/formatters/json/types.js.map +1 -0
- package/dist/formatters/llm-prompt/index.js +102 -0
- package/dist/formatters/llm-prompt/index.js.map +1 -0
- package/dist/formatters/llm-prompt/types.js.map +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/model/index.js +165 -148
- package/dist/model/index.js.map +1 -1
- package/dist/types/formatters/index.d.ts +1 -0
- package/dist/types/formatters/json/extensions.d.ts +9 -0
- package/dist/types/formatters/json/index.d.ts +3 -0
- package/dist/types/formatters/json/types.d.ts +150 -0
- package/dist/types/formatters/llm-prompt/index.d.ts +3 -0
- package/dist/types/formatters/llm-prompt/types.d.ts +5 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/model/index.d.ts +131 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/validation.js +3 -1
- package/dist/validation.js.map +1 -1
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +14 -7
- package/dist/index.d.ts +0 -3
- package/dist/model/index.d.ts +0 -179
- package/dist/types.js.map +0 -1
- /package/dist/{types.js → formatters/llm-prompt/types.js} +0 -0
- /package/dist/{validation.d.ts → types/validation.d.ts} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { PrimitivePropertyType, } from "../../model/index.js";
|
|
2
|
+
export function toTomaz(schema) {
|
|
3
|
+
let out = [`Node properties are the following:`].concat(schema.nodeObjectTypes.map(nodeObjectTypes).filter(Boolean), [`Relationship properties are the following:`], schema.relationshipObjectTypes.map(relationshipObjectTypes).filter(Boolean), [`The relationships are the following:`], JSON.stringify(schema.relationshipObjectTypes.map(paths)));
|
|
4
|
+
function nodeObjectTypes(nodeObjectType) {
|
|
5
|
+
const out = [];
|
|
6
|
+
const properties = nodeObjectType.getProperties().map((property) => {
|
|
7
|
+
const base = {
|
|
8
|
+
property: property.token,
|
|
9
|
+
type: formatPropertyType(property.type),
|
|
10
|
+
};
|
|
11
|
+
if (property.nullable) {
|
|
12
|
+
base.nullable = true;
|
|
13
|
+
}
|
|
14
|
+
return base;
|
|
15
|
+
});
|
|
16
|
+
if (!properties.length) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
out.push({
|
|
20
|
+
properties: properties,
|
|
21
|
+
labels: nodeObjectType.labels.map((label) => label.token),
|
|
22
|
+
});
|
|
23
|
+
return JSON.stringify(out);
|
|
24
|
+
}
|
|
25
|
+
function relationshipObjectTypes(relationshipObjectType) {
|
|
26
|
+
const out = [];
|
|
27
|
+
const properties = relationshipObjectType
|
|
28
|
+
.getProperties()
|
|
29
|
+
.map((property) => {
|
|
30
|
+
const base = {
|
|
31
|
+
property: property.token,
|
|
32
|
+
type: formatPropertyType(property.type),
|
|
33
|
+
};
|
|
34
|
+
if (property.nullable) {
|
|
35
|
+
base.nullable = true;
|
|
36
|
+
}
|
|
37
|
+
return base;
|
|
38
|
+
});
|
|
39
|
+
if (!properties.length) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
out.push({
|
|
43
|
+
labels: [relationshipObjectType.type.token],
|
|
44
|
+
properties: properties,
|
|
45
|
+
});
|
|
46
|
+
return JSON.stringify(out);
|
|
47
|
+
}
|
|
48
|
+
function paths(relationshipObjectType) {
|
|
49
|
+
return `(:${relationshipObjectType.from.labels
|
|
50
|
+
.map((label) => label.token)
|
|
51
|
+
.join(":")})-[:${relationshipObjectType.type.token}]->(:${relationshipObjectType.to.labels
|
|
52
|
+
.map((label) => label.token)
|
|
53
|
+
.join(":")})`;
|
|
54
|
+
}
|
|
55
|
+
return out.join("\n");
|
|
56
|
+
}
|
|
57
|
+
export function toOskars(schema) {
|
|
58
|
+
let out = [`Node types with their properties + types`].concat(schema.nodeObjectTypes.map(nodeObjectTypes), [`Relationship types with properties + types`], schema.relationshipObjectTypes.map(relationshipObjectTypes).filter(Boolean), [
|
|
59
|
+
`Paths (all combinations of node types and relationship types and the direction of the relationship)`,
|
|
60
|
+
], schema.relationshipObjectTypes.map(paths));
|
|
61
|
+
function nodeObjectTypes(nodeObjectType) {
|
|
62
|
+
const out = [];
|
|
63
|
+
const properties = nodeObjectType.getProperties().map((property) => {
|
|
64
|
+
return `${property.token}: ${formatPropertyType(property.type)}${property.nullable ? " (nullable)" : ""}`;
|
|
65
|
+
});
|
|
66
|
+
out.push(` (:${nodeObjectType.labels.map((label) => label.token).join(":")}${properties.length > 0 ? ` {${properties.join(", ")}}` : ""})`);
|
|
67
|
+
return out.join("\n");
|
|
68
|
+
}
|
|
69
|
+
function relationshipObjectTypes(relationshipObjectType) {
|
|
70
|
+
const out = [];
|
|
71
|
+
const properties = relationshipObjectType
|
|
72
|
+
.getProperties()
|
|
73
|
+
.map((property) => {
|
|
74
|
+
return `${property.token}: ${formatPropertyType(property.type)}${property.nullable ? " (nullable)" : ""}`;
|
|
75
|
+
});
|
|
76
|
+
if (!properties.length) {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
out.push(` [:${relationshipObjectType.type.token}${properties.length > 0 ? ` {${properties.join(", ")}}` : ""}]`);
|
|
80
|
+
return out.join("\n");
|
|
81
|
+
}
|
|
82
|
+
function paths(relationshipObjectType) {
|
|
83
|
+
const out = [];
|
|
84
|
+
out.push(` (:${relationshipObjectType.from.labels
|
|
85
|
+
.map((label) => label.token)
|
|
86
|
+
.join(":")})-[:${relationshipObjectType.type.token}]->(:${relationshipObjectType.to.labels
|
|
87
|
+
.map((label) => label.token)
|
|
88
|
+
.join(":")})`);
|
|
89
|
+
return out.join("\n");
|
|
90
|
+
}
|
|
91
|
+
return out.join("\n");
|
|
92
|
+
}
|
|
93
|
+
function formatPropertyType(type) {
|
|
94
|
+
if (Array.isArray(type)) {
|
|
95
|
+
return type.map(formatPropertyType).join("|");
|
|
96
|
+
}
|
|
97
|
+
if (type instanceof PrimitivePropertyType) {
|
|
98
|
+
return type.type;
|
|
99
|
+
}
|
|
100
|
+
return `${type.items.type}[]`;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatters/llm-prompt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,GAGtB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,UAAU,OAAO,CAAC,MAAmB;IACzC,IAAI,GAAG,GAAa,CAAC,oCAAoC,CAAC,CAAC,MAAM,CAC/D,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAC3D,CAAC,4CAA4C,CAAC,EAC9C,MAAM,CAAC,uBAAuB,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAC3E,CAAC,sCAAsC,CAAC,EACxC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;IAEF,SAAS,eAAe,CAAC,cAA8B;QACrD,MAAM,GAAG,GAAG,EAAE,CAAC;QACf,MAAM,UAAU,GAAG,cAAc,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjE,MAAM,IAAI,GAA0B;gBAClC,QAAQ,EAAE,QAAQ,CAAC,KAAK;gBACxB,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC;aACxC,CAAC;YACF,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBAC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,sBAAsB,CAAC,EAAE,CAAC,MAAM;aACrC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;aAC3B,IAAI,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAmC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,IAAI,YAAY,qBAAqB,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/formatters/llm-prompt/types.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { PACKAGE_VERSION, LAST_BUILD_TIME } from "./version.js";
|
|
1
2
|
export { validateSchema, SchemaValidationError } from "./validation.js";
|
|
2
3
|
import * as model from "./model/index.js";
|
|
3
|
-
|
|
4
|
+
import * as formatters from "./formatters/index.js";
|
|
5
|
+
export { model, formatters };
|
|
6
|
+
export { VECTOR_TYPE_OPTIONS, VectorElementType } from "./model/index.js";
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/model/index.js
CHANGED
|
@@ -1,200 +1,217 @@
|
|
|
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
1
|
export class GraphSchema {
|
|
22
|
-
constructor(
|
|
23
|
-
this.nodeLabels =
|
|
24
|
-
this.relationshipTypes =
|
|
2
|
+
constructor(nodeObjectTypes, relationshipObjectTypes, constraints = [], indexes = []) {
|
|
3
|
+
this.nodeLabels = [];
|
|
4
|
+
this.relationshipTypes = [];
|
|
25
5
|
this.nodeObjectTypes = nodeObjectTypes;
|
|
26
6
|
this.relationshipObjectTypes = relationshipObjectTypes;
|
|
7
|
+
this.constraints = constraints;
|
|
8
|
+
this.indexes = indexes;
|
|
9
|
+
this.extractNodeLabels();
|
|
10
|
+
this.extractRelationshipTypes();
|
|
11
|
+
}
|
|
12
|
+
extractNodeLabels() {
|
|
13
|
+
const nodeLabels = this.nodeObjectTypes.flatMap((nodeObjectType) => nodeObjectType.labels);
|
|
14
|
+
this.nodeLabels = [...new Set(nodeLabels)];
|
|
15
|
+
}
|
|
16
|
+
extractRelationshipTypes() {
|
|
17
|
+
const relationshipTypes = this.relationshipObjectTypes.flatMap((relationshipObjectType) => relationshipObjectType.type);
|
|
18
|
+
this.relationshipTypes = [...new Set(relationshipTypes)];
|
|
19
|
+
}
|
|
20
|
+
getAllNodeLabelTokens() {
|
|
21
|
+
return this.nodeLabels.map((nodeLabel) => nodeLabel.token);
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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);
|
|
23
|
+
getAllRelationshipTypeTokens() {
|
|
24
|
+
return this.relationshipTypes.map((relationshipType) => relationshipType.token);
|
|
25
|
+
}
|
|
26
|
+
getAllPropertyTokens() {
|
|
27
|
+
const nodeProperties = this.nodeObjectTypes.flatMap((nodeObjectType) => nodeObjectType.getPropertyTokens());
|
|
28
|
+
const relationshipProperties = this.relationshipObjectTypes.flatMap((relationshipObjectType) => relationshipObjectType.getPropertyTokens());
|
|
29
|
+
// return all tokens without duplicates
|
|
30
|
+
return [...new Set([...nodeProperties, ...relationshipProperties])];
|
|
64
31
|
}
|
|
65
32
|
}
|
|
66
33
|
export class NodeLabel {
|
|
67
|
-
constructor(id, token) {
|
|
34
|
+
constructor(id, token, properties = []) {
|
|
68
35
|
this.$id = id;
|
|
69
36
|
this.token = token;
|
|
37
|
+
this.properties = properties;
|
|
70
38
|
}
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
$id: this.$id,
|
|
74
|
-
token: this.token,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
toRef() {
|
|
78
|
-
return {
|
|
79
|
-
$ref: `#${this.$id}`,
|
|
80
|
-
};
|
|
39
|
+
getPropertyTokens() {
|
|
40
|
+
return this.properties.map((property) => property.token);
|
|
81
41
|
}
|
|
82
42
|
}
|
|
83
43
|
export class RelationshipType {
|
|
84
|
-
constructor(id, token) {
|
|
44
|
+
constructor(id, token, properties = []) {
|
|
85
45
|
this.$id = id;
|
|
86
46
|
this.token = token;
|
|
47
|
+
this.properties = properties;
|
|
87
48
|
}
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
$id: this.$id,
|
|
91
|
-
token: this.token,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
toRef() {
|
|
95
|
-
return {
|
|
96
|
-
$ref: `#${this.$id}`,
|
|
97
|
-
};
|
|
49
|
+
getPropertyTokens() {
|
|
50
|
+
return this.properties.map((property) => property.token);
|
|
98
51
|
}
|
|
99
52
|
}
|
|
100
53
|
export class NodeObjectType {
|
|
101
|
-
constructor(id, labels
|
|
54
|
+
constructor(id, labels) {
|
|
102
55
|
this.$id = id;
|
|
103
56
|
this.labels = labels;
|
|
104
|
-
this.properties = properties;
|
|
105
57
|
}
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
};
|
|
58
|
+
getProperties() {
|
|
59
|
+
return this.labels.flatMap((l) => l.properties);
|
|
116
60
|
}
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
-
|
|
120
|
-
};
|
|
61
|
+
getPropertyTokens() {
|
|
62
|
+
// return all tokens without duplicates
|
|
63
|
+
return [...new Set(this.getProperties().map((property) => property.token))];
|
|
121
64
|
}
|
|
122
65
|
}
|
|
123
66
|
export class RelationshipObjectType {
|
|
124
|
-
constructor(id, type, from, to
|
|
67
|
+
constructor(id, type, from, to) {
|
|
125
68
|
this.$id = id;
|
|
126
69
|
this.type = type;
|
|
127
70
|
this.from = from;
|
|
128
71
|
this.to = to;
|
|
72
|
+
}
|
|
73
|
+
getProperties() {
|
|
74
|
+
return this.type.properties;
|
|
75
|
+
}
|
|
76
|
+
getPropertyTokens() {
|
|
77
|
+
// return all tokens without duplicates
|
|
78
|
+
return [...new Set(this.getProperties().map((property) => property.token))];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export const isNodeLabelConstraint = (constraint) => {
|
|
82
|
+
return constraint.entityType === "node" && "nodeLabel" in constraint;
|
|
83
|
+
};
|
|
84
|
+
export const isRelationshipTypeConstraint = (constraint) => {
|
|
85
|
+
return (constraint.entityType === "relationship" && "relationshipType" in constraint);
|
|
86
|
+
};
|
|
87
|
+
export const isNodeLabelIndex = (index) => {
|
|
88
|
+
return (index.entityType === "node" &&
|
|
89
|
+
index.indexType !== "lookup" &&
|
|
90
|
+
"nodeLabel" in index);
|
|
91
|
+
};
|
|
92
|
+
export const isRelationshipTypeIndex = (index) => {
|
|
93
|
+
return (index.entityType === "relationship" &&
|
|
94
|
+
index.indexType !== "lookup" &&
|
|
95
|
+
"relationshipType" in index);
|
|
96
|
+
};
|
|
97
|
+
export const isLookupIndex = (index) => {
|
|
98
|
+
return index.indexType === "lookup";
|
|
99
|
+
};
|
|
100
|
+
export class NodeLabelConstraint {
|
|
101
|
+
constructor($id, name, constraintType, nodeLabel, properties) {
|
|
102
|
+
this.$id = $id;
|
|
103
|
+
this.name = name;
|
|
104
|
+
this.constraintType = constraintType;
|
|
105
|
+
this.nodeLabel = nodeLabel;
|
|
129
106
|
this.properties = properties;
|
|
107
|
+
this.entityType = "node";
|
|
130
108
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
109
|
+
}
|
|
110
|
+
export class RelationshipTypeConstraint {
|
|
111
|
+
constructor($id, name, constraintType, relationshipType, properties) {
|
|
112
|
+
this.$id = $id;
|
|
113
|
+
this.name = name;
|
|
114
|
+
this.constraintType = constraintType;
|
|
115
|
+
this.relationshipType = relationshipType;
|
|
116
|
+
this.properties = properties;
|
|
117
|
+
this.entityType = "relationship";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export class NodeLabelIndex {
|
|
121
|
+
constructor($id, name, indexType, nodeLabel, properties) {
|
|
122
|
+
this.$id = $id;
|
|
123
|
+
this.name = name;
|
|
124
|
+
this.nodeLabel = nodeLabel;
|
|
125
|
+
this.indexType = indexType;
|
|
126
|
+
this.properties = properties;
|
|
127
|
+
this.entityType = "node";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export class RelationshipTypeIndex {
|
|
131
|
+
constructor($id, name, indexType, relationshipType, properties) {
|
|
132
|
+
this.$id = $id;
|
|
133
|
+
this.name = name;
|
|
134
|
+
this.indexType = indexType;
|
|
135
|
+
this.entityType = "relationship";
|
|
136
|
+
this.relationshipType = relationshipType;
|
|
137
|
+
this.properties = properties;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export class LookupIndex {
|
|
141
|
+
constructor($id, name, entityType) {
|
|
142
|
+
this.$id = $id;
|
|
143
|
+
this.name = name;
|
|
144
|
+
this.indexType = "lookup";
|
|
145
|
+
this.entityType = entityType;
|
|
148
146
|
}
|
|
149
147
|
}
|
|
148
|
+
export const isPrimitiveArrayPropertyType = (property) => {
|
|
149
|
+
return (property instanceof Object &&
|
|
150
|
+
property.type === "array" &&
|
|
151
|
+
property.items !== undefined);
|
|
152
|
+
};
|
|
153
|
+
export const isPrimitivePropertyType = (property) => {
|
|
154
|
+
return (property instanceof Object &&
|
|
155
|
+
"type" in property &&
|
|
156
|
+
PRIMITIVE_TYPE_OPTIONS.some((p) => property.type === p));
|
|
157
|
+
};
|
|
150
158
|
export class Property {
|
|
151
|
-
constructor(token, type,
|
|
159
|
+
constructor($id, token, type, nullable) {
|
|
160
|
+
this.$id = $id;
|
|
152
161
|
this.token = token;
|
|
153
162
|
this.type = type;
|
|
154
|
-
this.
|
|
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
|
-
};
|
|
163
|
+
this.nullable = nullable;
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
export class
|
|
166
|
+
export class PrimitivePropertyType {
|
|
168
167
|
constructor(type) {
|
|
169
168
|
this.type = type;
|
|
170
169
|
}
|
|
171
|
-
toJsonStruct() {
|
|
172
|
-
return {
|
|
173
|
-
type: this.type,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
170
|
}
|
|
177
|
-
export class
|
|
171
|
+
export class PrimitiveArrayPropertyType {
|
|
178
172
|
constructor(items) {
|
|
179
173
|
this.type = "array";
|
|
180
174
|
this.items = items;
|
|
181
175
|
}
|
|
182
|
-
toJsonStruct() {
|
|
183
|
-
return {
|
|
184
|
-
type: this.type,
|
|
185
|
-
items: this.items,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
176
|
}
|
|
189
|
-
export class
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return new PropertyArrayType(json.items);
|
|
177
|
+
export class VectorPropertyType {
|
|
178
|
+
constructor(items, dimension) {
|
|
179
|
+
this.type = "vector";
|
|
180
|
+
this.items = items;
|
|
181
|
+
if (typeof dimension === "number") {
|
|
182
|
+
this.dimension = dimension;
|
|
196
183
|
}
|
|
197
|
-
return new PropertyBaseType(json.type);
|
|
198
184
|
}
|
|
199
185
|
}
|
|
186
|
+
export const PRIMITIVE_TYPE_OPTIONS = [
|
|
187
|
+
"integer",
|
|
188
|
+
"string",
|
|
189
|
+
"float",
|
|
190
|
+
"boolean",
|
|
191
|
+
"point",
|
|
192
|
+
"date",
|
|
193
|
+
"datetime",
|
|
194
|
+
"time",
|
|
195
|
+
"localtime",
|
|
196
|
+
"localdatetime",
|
|
197
|
+
"duration",
|
|
198
|
+
];
|
|
199
|
+
export const isVectorPropertyType = (property) => {
|
|
200
|
+
return (property.type === "vector" &&
|
|
201
|
+
property.items !== undefined &&
|
|
202
|
+
(property.dimension === undefined || typeof property.dimension === "number"));
|
|
203
|
+
};
|
|
204
|
+
export class VectorElementType {
|
|
205
|
+
constructor(type) {
|
|
206
|
+
this.type = type;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export const VECTOR_TYPE_OPTIONS = [
|
|
210
|
+
"integer",
|
|
211
|
+
"integer8",
|
|
212
|
+
"integer16",
|
|
213
|
+
"integer32",
|
|
214
|
+
"float",
|
|
215
|
+
"float32",
|
|
216
|
+
];
|
|
200
217
|
//# sourceMappingURL=index.js.map
|
package/dist/model/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IAQtB,YACE,eAAiC,EACjC,uBAAiD,EACjD,cAA4B,EAAE,EAC9B,UAAmB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,KAAK,SAAS;QAC5B,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,CAC7E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,iBAAiB;IAE5B,YAAY,IAAwB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AACD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,OAAO;IACP,SAAS;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as json from "./json/index.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GraphSchema } from "../../model/index.js";
|
|
2
|
+
import { GraphSchemaJsonStruct, RootSchemaJsonStruct } from "./types.js";
|
|
3
|
+
export declare const VERSION = "0.0.1";
|
|
4
|
+
export declare function toJson(schema: GraphSchema, space?: string | number | undefined): string;
|
|
5
|
+
export declare function toJsonStruct(schema: GraphSchema): RootSchemaJsonStruct;
|
|
6
|
+
export declare function fromJson(schema: string): GraphSchema;
|
|
7
|
+
export declare function hasDuplicateNodeLabelIds(schema: GraphSchemaJsonStruct): boolean;
|
|
8
|
+
export declare function hasDuplicateNodeObjectTypeIds(schema: GraphSchemaJsonStruct): boolean;
|
|
9
|
+
export declare function fromJsonStruct(schemaJson: RootSchemaJsonStruct): GraphSchema;
|