grafeo-ogm 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +156 -1
- package/dist/cjs/compilers/vector.compiler.d.ts +56 -0
- package/dist/cjs/compilers/vector.compiler.d.ts.map +1 -0
- package/dist/cjs/compilers/vector.compiler.js +129 -0
- package/dist/cjs/compilers/vector.compiler.js.map +1 -0
- package/dist/cjs/generator/generate-types.d.ts.map +1 -1
- package/dist/cjs/generator/generate-types.js +2 -0
- package/dist/cjs/generator/generate-types.js.map +1 -1
- package/dist/cjs/generator/type-emitters/fulltext-emitter.d.ts +16 -4
- package/dist/cjs/generator/type-emitters/fulltext-emitter.d.ts.map +1 -1
- package/dist/cjs/generator/type-emitters/fulltext-emitter.js +122 -9
- package/dist/cjs/generator/type-emitters/fulltext-emitter.js.map +1 -1
- package/dist/cjs/generator/type-emitters/model-map-emitter.d.ts +6 -0
- package/dist/cjs/generator/type-emitters/model-map-emitter.d.ts.map +1 -1
- package/dist/cjs/generator/type-emitters/model-map-emitter.js +76 -5
- package/dist/cjs/generator/type-emitters/model-map-emitter.js.map +1 -1
- package/dist/cjs/generator/type-emitters/utility-types.js +1 -1
- package/dist/cjs/generator/type-emitters/utility-types.js.map +1 -1
- package/dist/cjs/generator/type-emitters/vector-emitter.d.ts +14 -0
- package/dist/cjs/generator/type-emitters/vector-emitter.d.ts.map +1 -0
- package/dist/cjs/generator/type-emitters/vector-emitter.js +81 -0
- package/dist/cjs/generator/type-emitters/vector-emitter.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.d.ts +127 -1
- package/dist/cjs/model.d.ts.map +1 -1
- package/dist/cjs/model.js +150 -44
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/ogm.d.ts.map +1 -1
- package/dist/cjs/ogm.js +3 -0
- package/dist/cjs/ogm.js.map +1 -1
- package/dist/cjs/schema/parser.d.ts.map +1 -1
- package/dist/cjs/schema/parser.js +48 -0
- package/dist/cjs/schema/parser.js.map +1 -1
- package/dist/cjs/schema/types.d.ts +7 -0
- package/dist/cjs/schema/types.d.ts.map +1 -1
- package/dist/esm/compilers/vector.compiler.d.ts +56 -0
- package/dist/esm/compilers/vector.compiler.d.ts.map +1 -0
- package/dist/esm/compilers/vector.compiler.js +125 -0
- package/dist/esm/compilers/vector.compiler.js.map +1 -0
- package/dist/esm/generator/generate-types.d.ts.map +1 -1
- package/dist/esm/generator/generate-types.js +2 -0
- package/dist/esm/generator/generate-types.js.map +1 -1
- package/dist/esm/generator/type-emitters/fulltext-emitter.d.ts +16 -4
- package/dist/esm/generator/type-emitters/fulltext-emitter.d.ts.map +1 -1
- package/dist/esm/generator/type-emitters/fulltext-emitter.js +121 -9
- package/dist/esm/generator/type-emitters/fulltext-emitter.js.map +1 -1
- package/dist/esm/generator/type-emitters/model-map-emitter.d.ts +6 -0
- package/dist/esm/generator/type-emitters/model-map-emitter.d.ts.map +1 -1
- package/dist/esm/generator/type-emitters/model-map-emitter.js +76 -5
- package/dist/esm/generator/type-emitters/model-map-emitter.js.map +1 -1
- package/dist/esm/generator/type-emitters/utility-types.js +1 -1
- package/dist/esm/generator/type-emitters/utility-types.js.map +1 -1
- package/dist/esm/generator/type-emitters/vector-emitter.d.ts +14 -0
- package/dist/esm/generator/type-emitters/vector-emitter.d.ts.map +1 -0
- package/dist/esm/generator/type-emitters/vector-emitter.js +78 -0
- package/dist/esm/generator/type-emitters/vector-emitter.js.map +1 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.d.ts +127 -1
- package/dist/esm/model.d.ts.map +1 -1
- package/dist/esm/model.js +150 -44
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/ogm.d.ts.map +1 -1
- package/dist/esm/ogm.js +3 -0
- package/dist/esm/ogm.js.map +1 -1
- package/dist/esm/schema/parser.d.ts.map +1 -1
- package/dist/esm/schema/parser.js +48 -0
- package/dist/esm/schema/parser.js.map +1 -1
- package/dist/esm/schema/types.d.ts +7 -0
- package/dist/esm/schema/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,33 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.emitFulltextTypes = emitFulltextTypes;
|
|
4
|
+
exports.nodeHasAnyFulltext = nodeHasAnyFulltext;
|
|
4
5
|
// ---------------------------------------------------------------------------
|
|
5
6
|
// Public API
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
7
8
|
/**
|
|
8
9
|
* Emits fulltext-related types for every node that declares at least one
|
|
9
|
-
* `@fulltext` index
|
|
10
|
+
* `@fulltext` index (either directly on the node or on a relationship whose
|
|
11
|
+
* `@relationshipProperties` type has fulltext indexes):
|
|
10
12
|
*
|
|
11
13
|
* - `<Node>FulltextResult` — score + the matched node
|
|
12
14
|
* - `<Node>FulltextWhere` — filtering by score and node-level where
|
|
13
15
|
* - `<Node>FulltextSort` — sorting by score and node-level sort
|
|
16
|
+
* - `<Node>FulltextLeaf` — per-node leaf with literal index-name keys
|
|
17
|
+
* - `<Node>FulltextInput` — leaf | OR/AND/NOT composition
|
|
14
18
|
*
|
|
15
|
-
* Also emits the shared `FloatWhere`
|
|
19
|
+
* Also emits the shared `FloatWhere` and `FulltextIndexEntry` types used by
|
|
20
|
+
* the typed inputs.
|
|
16
21
|
*
|
|
17
|
-
* Returns an empty string when no nodes have fulltext indexes
|
|
22
|
+
* Returns an empty string when no nodes have fulltext indexes (direct or via
|
|
23
|
+
* a relationship-properties type).
|
|
18
24
|
*/
|
|
19
25
|
function emitFulltextTypes(schema) {
|
|
20
|
-
const
|
|
21
|
-
|
|
26
|
+
const nodesWithResults = getNodesWithNodeLevelFulltext(schema);
|
|
27
|
+
const nodesWithInputs = getNodesWithAnyFulltext(schema);
|
|
28
|
+
if (nodesWithResults.length === 0 && nodesWithInputs.length === 0)
|
|
22
29
|
return '';
|
|
23
|
-
const blocks = [FLOAT_WHERE_TYPE];
|
|
24
|
-
|
|
30
|
+
const blocks = [FLOAT_WHERE_TYPE, FULLTEXT_INDEX_ENTRY_TYPE];
|
|
31
|
+
// Node-level fulltext result/where/sort — only emitted when the node itself
|
|
32
|
+
// has indexes (these types describe RETURN shape, which only makes sense
|
|
33
|
+
// when you query the node's own index).
|
|
34
|
+
for (const node of nodesWithResults) {
|
|
25
35
|
blocks.push(emitFulltextResult(node));
|
|
26
36
|
blocks.push(emitFulltextWhere(node));
|
|
27
37
|
blocks.push(emitFulltextSort(node));
|
|
28
38
|
}
|
|
39
|
+
// Per-node typed fulltext INPUT — emitted when the node OR any relationship
|
|
40
|
+
// exposes a fulltext index. Drives the find()/findFirst()/count()/aggregate()
|
|
41
|
+
// autocomplete in the generated model.
|
|
42
|
+
for (const node of nodesWithInputs) {
|
|
43
|
+
blocks.push(emitFulltextLeaf(node, schema));
|
|
44
|
+
blocks.push(emitFulltextInput(node));
|
|
45
|
+
}
|
|
29
46
|
return blocks.join('\n\n');
|
|
30
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns true when the node has a node-level fulltext index OR a
|
|
50
|
+
* relationship whose `@relationshipProperties` type has fulltext indexes.
|
|
51
|
+
* Exposed so the model-map emitter can decide whether to override the
|
|
52
|
+
* `fulltext` parameter type on the generated `<Node>Model`.
|
|
53
|
+
*/
|
|
54
|
+
function nodeHasAnyFulltext(node, schema) {
|
|
55
|
+
if (node.fulltextIndexes.length > 0)
|
|
56
|
+
return true;
|
|
57
|
+
return getRelationshipFulltextEntries(node, schema).length > 0;
|
|
58
|
+
}
|
|
31
59
|
// ---------------------------------------------------------------------------
|
|
32
60
|
// Shared types
|
|
33
61
|
// ---------------------------------------------------------------------------
|
|
@@ -35,18 +63,54 @@ const FLOAT_WHERE_TYPE = `export type FloatWhere = {
|
|
|
35
63
|
min?: InputMaybe<Scalars["Float"]["input"]>;
|
|
36
64
|
max?: InputMaybe<Scalars["Float"]["input"]>;
|
|
37
65
|
};`;
|
|
66
|
+
/**
|
|
67
|
+
* Structural mirror of the runtime `FulltextIndexEntry` in `src/model.ts`.
|
|
68
|
+
* Inlined here so the generated file stays decoupled from runtime internals.
|
|
69
|
+
*/
|
|
70
|
+
const FULLTEXT_INDEX_ENTRY_TYPE = `export type FulltextIndexEntry = {
|
|
71
|
+
phrase: string;
|
|
72
|
+
score?: number;
|
|
73
|
+
};`;
|
|
38
74
|
// ---------------------------------------------------------------------------
|
|
39
75
|
// Helpers
|
|
40
76
|
// ---------------------------------------------------------------------------
|
|
41
77
|
/**
|
|
42
|
-
* Returns all nodes that have at least one fulltext index,
|
|
78
|
+
* Returns all nodes that have at least one node-level fulltext index,
|
|
43
79
|
* sorted alphabetically by type name.
|
|
44
80
|
*/
|
|
45
|
-
function
|
|
81
|
+
function getNodesWithNodeLevelFulltext(schema) {
|
|
46
82
|
return [...schema.nodes.values()]
|
|
47
83
|
.filter((node) => node.fulltextIndexes.length > 0)
|
|
48
84
|
.sort((a, b) => a.typeName.localeCompare(b.typeName));
|
|
49
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns all nodes that have at least one node-level OR relationship-level
|
|
88
|
+
* fulltext index, sorted alphabetically by type name.
|
|
89
|
+
*/
|
|
90
|
+
function getNodesWithAnyFulltext(schema) {
|
|
91
|
+
return [...schema.nodes.values()]
|
|
92
|
+
.filter((node) => nodeHasAnyFulltext(node, schema))
|
|
93
|
+
.sort((a, b) => a.typeName.localeCompare(b.typeName));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* For a given node, returns each relationship that points to a
|
|
97
|
+
* `@relationshipProperties` type whose fulltext indexes list is non-empty.
|
|
98
|
+
* The resulting entries drive the nested keys on `<Node>FulltextLeaf`.
|
|
99
|
+
*/
|
|
100
|
+
function getRelationshipFulltextEntries(node, schema) {
|
|
101
|
+
const entries = [];
|
|
102
|
+
for (const rel of node.relationships.values()) {
|
|
103
|
+
if (!rel.properties)
|
|
104
|
+
continue;
|
|
105
|
+
const props = schema.relationshipProperties.get(rel.properties);
|
|
106
|
+
if (!props)
|
|
107
|
+
continue;
|
|
108
|
+
if (!props.fulltextIndexes || props.fulltextIndexes.length === 0)
|
|
109
|
+
continue;
|
|
110
|
+
entries.push({ rel, props });
|
|
111
|
+
}
|
|
112
|
+
return entries.sort((a, b) => a.rel.fieldName.localeCompare(b.rel.fieldName));
|
|
113
|
+
}
|
|
50
114
|
/**
|
|
51
115
|
* Converts a PascalCase type name to camelCase for the result field name.
|
|
52
116
|
* e.g. `Book` → `book`, `BookCategory` → `bookCategory`
|
|
@@ -54,6 +118,17 @@ function getNodesWithFulltext(schema) {
|
|
|
54
118
|
function toCamelCase(typeName) {
|
|
55
119
|
return typeName.charAt(0).toLowerCase() + typeName.slice(1);
|
|
56
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Returns a syntactically valid TypeScript object-literal key for the given
|
|
123
|
+
* name. Identifiers are left bare; anything else is quoted.
|
|
124
|
+
*
|
|
125
|
+
* Matches TypeScript's identifier rules conservatively: must start with a
|
|
126
|
+
* letter, `_`, or `$`, and only contain letters, digits, `_`, `$`.
|
|
127
|
+
*/
|
|
128
|
+
function formatObjectKey(name) {
|
|
129
|
+
const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
130
|
+
return IDENTIFIER.test(name) ? name : `'${name.replace(/'/g, "\\'")}'`;
|
|
131
|
+
}
|
|
57
132
|
function emitFulltextResult(node) {
|
|
58
133
|
const fieldName = toCamelCase(node.typeName);
|
|
59
134
|
return `export type ${node.typeName}FulltextResult = {
|
|
@@ -77,4 +152,42 @@ function emitFulltextSort(node) {
|
|
|
77
152
|
${fieldName}?: InputMaybe<${node.typeName}Sort>;
|
|
78
153
|
};`;
|
|
79
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Emits `<Node>FulltextLeaf` — an object whose keys are the node's fulltext
|
|
157
|
+
* index names (literal, optional) and whose relationship keys map to
|
|
158
|
+
* `{ [IndexName]?: FulltextIndexEntry }` shapes matching the runtime
|
|
159
|
+
* `FulltextRelationshipEntry` contract.
|
|
160
|
+
*
|
|
161
|
+
* If the node has node-level indexes only, the relationship section is
|
|
162
|
+
* omitted and vice-versa.
|
|
163
|
+
*/
|
|
164
|
+
function emitFulltextLeaf(node, schema) {
|
|
165
|
+
const nodeLevelKeys = node.fulltextIndexes.map((idx) => {
|
|
166
|
+
const key = formatObjectKey(idx.name);
|
|
167
|
+
return ` ${key}?: FulltextIndexEntry;`;
|
|
168
|
+
});
|
|
169
|
+
const relEntries = getRelationshipFulltextEntries(node, schema);
|
|
170
|
+
const relKeys = relEntries.map(({ rel, props }) => {
|
|
171
|
+
const key = formatObjectKey(rel.fieldName);
|
|
172
|
+
const indexKeys = (props.fulltextIndexes ?? [])
|
|
173
|
+
.map((idx) => `${formatObjectKey(idx.name)}?: FulltextIndexEntry`)
|
|
174
|
+
.join('; ');
|
|
175
|
+
return ` ${key}?: { ${indexKeys} };`;
|
|
176
|
+
});
|
|
177
|
+
const body = [...nodeLevelKeys, ...relKeys].join('\n');
|
|
178
|
+
return `export type ${node.typeName}FulltextLeaf = {
|
|
179
|
+
${body}
|
|
180
|
+
};`;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Emits `<Node>FulltextInput` — the top-level union accepted by `find()` et
|
|
184
|
+
* al. Includes the leaf and the three logical composition operators.
|
|
185
|
+
*/
|
|
186
|
+
function emitFulltextInput(node) {
|
|
187
|
+
return `export type ${node.typeName}FulltextInput =
|
|
188
|
+
| ${node.typeName}FulltextLeaf
|
|
189
|
+
| { OR: ${node.typeName}FulltextInput[] }
|
|
190
|
+
| { AND: ${node.typeName}FulltextInput[] }
|
|
191
|
+
| { NOT: ${node.typeName}FulltextInput };`;
|
|
192
|
+
}
|
|
80
193
|
//# sourceMappingURL=fulltext-emitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fulltext-emitter.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/fulltext-emitter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"fulltext-emitter.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/fulltext-emitter.ts"],"names":[],"mappings":";;AA4BA,8CA0BC;AAQD,gDAMC;AA7DD,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,iBAAiB,CAAC,MAAsB;IACtD,MAAM,gBAAgB,GAAG,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAExD,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7E,MAAM,MAAM,GAAa,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;IAEvE,4EAA4E;IAC5E,yEAAyE;IACzE,wCAAwC;IACxC,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,4EAA4E;IAC5E,8EAA8E;IAC9E,uCAAuC;IACvC,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,iBAA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AAe,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC;aACjE,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,KAAK,GAAG,QAAQ,SAAS,KAAK,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,CAAC,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvD,OAAO,eAAe,IAAI,CAAC,QAAQ;EACnC,IAAI;GACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,IAAoB;IAC7C,OAAO,eAAe,IAAI,CAAC,QAAQ;MAC/B,IAAI,CAAC,QAAQ;YACP,IAAI,CAAC,QAAQ;aACZ,IAAI,CAAC,QAAQ;aACb,IAAI,CAAC,QAAQ,kBAAkB,CAAC;AAC7C,CAAC"}
|
|
@@ -17,6 +17,12 @@ import type { SchemaMetadata } from '../../schema/types';
|
|
|
17
17
|
* 'books'
|
|
18
18
|
* >;
|
|
19
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
* When the node has at least one fulltext index (directly or via a
|
|
22
|
+
* relationship-properties type), the fulltext-accepting methods (`find`,
|
|
23
|
+
* `findFirst`, `findFirstOrThrow`, `count`, `aggregate`) are re-declared with
|
|
24
|
+
* a narrowed `fulltext?: <Node>FulltextInput` so users get autocomplete and
|
|
25
|
+
* typo-checking on index names.
|
|
20
26
|
*/
|
|
21
27
|
export declare function emitModelDeclarations(schema: SchemaMetadata): string;
|
|
22
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-map-emitter.d.ts","sourceRoot":"","sources":["../../../../src/generator/type-emitters/model-map-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-map-emitter.d.ts","sourceRoot":"","sources":["../../../../src/generator/type-emitters/model-map-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAoBpE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAiB3D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAWpE"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.emitModelDeclarations = emitModelDeclarations;
|
|
4
4
|
exports.emitModelMap = emitModelMap;
|
|
5
5
|
exports.emitInterfaceModelMap = emitInterfaceModelMap;
|
|
6
|
+
const fulltext_emitter_1 = require("./fulltext-emitter");
|
|
6
7
|
/**
|
|
7
8
|
* Emits a model declaration type for each node type, wrapping the generic
|
|
8
9
|
* `ModelInterface` from `grafeo-ogm` with the correct type parameters.
|
|
@@ -21,6 +22,12 @@ exports.emitInterfaceModelMap = emitInterfaceModelMap;
|
|
|
21
22
|
* 'books'
|
|
22
23
|
* >;
|
|
23
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* When the node has at least one fulltext index (directly or via a
|
|
27
|
+
* relationship-properties type), the fulltext-accepting methods (`find`,
|
|
28
|
+
* `findFirst`, `findFirstOrThrow`, `count`, `aggregate`) are re-declared with
|
|
29
|
+
* a narrowed `fulltext?: <Node>FulltextInput` so users get autocomplete and
|
|
30
|
+
* typo-checking on index names.
|
|
24
31
|
*/
|
|
25
32
|
function emitModelDeclarations(schema) {
|
|
26
33
|
const blocks = [];
|
|
@@ -28,7 +35,8 @@ function emitModelDeclarations(schema) {
|
|
|
28
35
|
for (const typeName of sortedNodes) {
|
|
29
36
|
const node = schema.nodes.get(typeName);
|
|
30
37
|
const hasRels = node.relationships.size > 0;
|
|
31
|
-
|
|
38
|
+
const hasFulltext = (0, fulltext_emitter_1.nodeHasAnyFulltext)(node, schema);
|
|
39
|
+
blocks.push(buildModelType(typeName, node.pluralName, hasRels, hasFulltext));
|
|
32
40
|
}
|
|
33
41
|
// Interface model declarations
|
|
34
42
|
const sortedInterfaces = [...schema.interfaces.keys()].sort();
|
|
@@ -70,7 +78,7 @@ function emitInterfaceModelMap(schema) {
|
|
|
70
78
|
// ---------------------------------------------------------------------------
|
|
71
79
|
// Helpers
|
|
72
80
|
// ---------------------------------------------------------------------------
|
|
73
|
-
function buildModelType(typeName, pluralName, hasRels) {
|
|
81
|
+
function buildModelType(typeName, pluralName, hasRels, hasFulltext) {
|
|
74
82
|
const connectType = hasRels
|
|
75
83
|
? `${typeName}ConnectInput`
|
|
76
84
|
: 'Record<string, never>';
|
|
@@ -80,8 +88,8 @@ function buildModelType(typeName, pluralName, hasRels) {
|
|
|
80
88
|
const deleteType = hasRels
|
|
81
89
|
? `${typeName}DeleteInput`
|
|
82
90
|
: 'Record<string, never>';
|
|
83
|
-
|
|
84
|
-
`
|
|
91
|
+
const baseAlias = [
|
|
92
|
+
`ModelInterface<`,
|
|
85
93
|
` ${typeName},`,
|
|
86
94
|
` ${typeName}SelectFields,`,
|
|
87
95
|
` ${typeName}Where,`,
|
|
@@ -92,7 +100,70 @@ function buildModelType(typeName, pluralName, hasRels) {
|
|
|
92
100
|
` ${deleteType},`,
|
|
93
101
|
` '${pluralName}',`,
|
|
94
102
|
` ${typeName}MutationSelectFields`,
|
|
95
|
-
|
|
103
|
+
`>`,
|
|
104
|
+
].join('\n');
|
|
105
|
+
if (!hasFulltext)
|
|
106
|
+
return `export type ${typeName}Model = ${baseAlias};`;
|
|
107
|
+
return buildModelTypeWithTypedFulltext(typeName, baseAlias);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Builds a `<Node>Model` alias that keeps every method from `ModelInterface`
|
|
111
|
+
* but replaces the `fulltext` parameter with the node-specific
|
|
112
|
+
* `<Node>FulltextInput`, giving users autocomplete + typo-checking on
|
|
113
|
+
* index names.
|
|
114
|
+
*
|
|
115
|
+
* Uses `Omit<..., 'find' | ...>` to strip the loose variants from the base,
|
|
116
|
+
* then intersects with the refined signatures.
|
|
117
|
+
*/
|
|
118
|
+
function buildModelTypeWithTypedFulltext(typeName, baseAlias) {
|
|
119
|
+
const fulltextInput = `${typeName}FulltextInput`;
|
|
120
|
+
const where = `${typeName}Where`;
|
|
121
|
+
const select = `${typeName}SelectFields`;
|
|
122
|
+
// We only re-declare what we need to change. The shared parameter shapes
|
|
123
|
+
// are inlined to stay decoupled from the non-exported runtime
|
|
124
|
+
// `FindOptions`; `ExecutionContext` is imported from the package.
|
|
125
|
+
const findParams = `{
|
|
126
|
+
where?: ${where};
|
|
127
|
+
selectionSet?: string | DocumentNode;
|
|
128
|
+
select?: ${select};
|
|
129
|
+
labels?: string[];
|
|
130
|
+
options?: { limit?: number; offset?: number; sort?: Array<Record<string, 'ASC' | 'DESC'>> };
|
|
131
|
+
fulltext?: ${fulltextInput};
|
|
132
|
+
context?: ExecutionContext;
|
|
133
|
+
}`;
|
|
134
|
+
const findFirstParams = `{
|
|
135
|
+
where?: ${where};
|
|
136
|
+
selectionSet?: string | DocumentNode;
|
|
137
|
+
select?: ${select};
|
|
138
|
+
labels?: string[];
|
|
139
|
+
options?: { offset?: number; sort?: Array<Record<string, 'ASC' | 'DESC'>> };
|
|
140
|
+
fulltext?: ${fulltextInput};
|
|
141
|
+
context?: ExecutionContext;
|
|
142
|
+
}`;
|
|
143
|
+
const countParams = `{
|
|
144
|
+
where?: ${where};
|
|
145
|
+
labels?: string[];
|
|
146
|
+
fulltext?: ${fulltextInput};
|
|
147
|
+
context?: ExecutionContext;
|
|
148
|
+
}`;
|
|
149
|
+
const aggregateParams = `{
|
|
150
|
+
where?: ${where};
|
|
151
|
+
aggregate: { count?: boolean; [field: string]: boolean | undefined };
|
|
152
|
+
labels?: string[];
|
|
153
|
+
fulltext?: ${fulltextInput};
|
|
154
|
+
context?: ExecutionContext;
|
|
155
|
+
}`;
|
|
156
|
+
return [
|
|
157
|
+
`export type ${typeName}Model = Omit<`,
|
|
158
|
+
` ${baseAlias.split('\n').join('\n ')},`,
|
|
159
|
+
` 'find' | 'findFirst' | 'findFirstOrThrow' | 'count' | 'aggregate'`,
|
|
160
|
+
`> & {`,
|
|
161
|
+
` find(params?: ${findParams}): Promise<${typeName}[]>;`,
|
|
162
|
+
` findFirst(params?: ${findFirstParams}): Promise<${typeName} | null>;`,
|
|
163
|
+
` findFirstOrThrow(params?: ${findFirstParams}): Promise<${typeName}>;`,
|
|
164
|
+
` count(params?: ${countParams}): Promise<number>;`,
|
|
165
|
+
` aggregate(params: ${aggregateParams}): Promise<{ count?: number; [field: string]: unknown }>;`,
|
|
166
|
+
`};`,
|
|
96
167
|
].join('\n');
|
|
97
168
|
}
|
|
98
169
|
function buildInterfaceModelType(ifaceName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-map-emitter.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/model-map-emitter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"model-map-emitter.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/model-map-emitter.ts"],"names":[],"mappings":";;AA4BA,sDAoBC;AAMD,oCAiBC;AAMD,sDAWC;AAvFD,yDAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,qBAAqB,CAAC,MAAsB;IAC1D,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,WAAW,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAEpD,KAAK,MAAM,QAAQ,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,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S,KAAK;QACnB,aAAa,SAAS,GAAG;QACzB,cAAc,SAAS,QAAQ;QAC/B,MAAM;KACP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -25,7 +25,7 @@ function emitHeader(config, packageName = 'grafeo-ogm') {
|
|
|
25
25
|
function emitImports(packageName = 'grafeo-ogm') {
|
|
26
26
|
return [
|
|
27
27
|
'import type { SelectionSetNode, DocumentNode } from "graphql";',
|
|
28
|
-
`import type {
|
|
28
|
+
`import type { ModelInterface, InterfaceModelInterface, ExecutionContext } from "${packageName}";`,
|
|
29
29
|
].join('\n');
|
|
30
30
|
}
|
|
31
31
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility-types.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/utility-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAMH,gCAYC;AAMD,kCAKC;AAMD,4CA0DC;AA3FD,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,SAAgB,UAAU,CACxB,MAA4B,EAC5B,WAAW,GAAG,YAAY;IAE1B,MAAM,KAAK,GAAG;QACZ,sCAAsC;QACtC,mBAAmB,WAAW,kBAAkB;KACjD,CAAC;IAEF,IAAI,MAAM,EAAE,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAgB,WAAW,CAAC,WAAW,GAAG,YAAY;IACpD,OAAO;QACL,gEAAgE;QAChE,
|
|
1
|
+
{"version":3,"file":"utility-types.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/utility-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAMH,gCAYC;AAMD,kCAKC;AAMD,4CA0DC;AA3FD,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,SAAgB,UAAU,CACxB,MAA4B,EAC5B,WAAW,GAAG,YAAY;IAE1B,MAAM,KAAK,GAAG;QACZ,sCAAsC;QACtC,mBAAmB,WAAW,kBAAkB;KACjD,CAAC;IAEF,IAAI,MAAM,EAAE,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAgB,WAAW,CAAC,WAAW,GAAG,YAAY;IACpD,OAAO;QACL,gEAAgE;QAChE,mFAAmF,WAAW,IAAI;KACnG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAE9E,SAAgB,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SchemaMetadata } from '../../schema/types';
|
|
2
|
+
/**
|
|
3
|
+
* Emits vector-search-related types for every node that declares at least one
|
|
4
|
+
* `@vector` index:
|
|
5
|
+
*
|
|
6
|
+
* - `<Node>VectorResult` — `{ node, score }` returned by search
|
|
7
|
+
* - `<Node>VectorSearchByVectorInput` — arguments for `searchByVector`
|
|
8
|
+
* - `<Node>VectorSearchByPhraseInput` — arguments for `searchByPhrase`
|
|
9
|
+
* (only emitted when at least one index on the node has `provider` set)
|
|
10
|
+
*
|
|
11
|
+
* Returns an empty string when no nodes have vector indexes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function emitVectorTypes(schema: SchemaMetadata): string;
|
|
14
|
+
//# sourceMappingURL=vector-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-emitter.d.ts","sourceRoot":"","sources":["../../../../src/generator/type-emitters/vector-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAkB9D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitVectorTypes = emitVectorTypes;
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Public API
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
/**
|
|
8
|
+
* Emits vector-search-related types for every node that declares at least one
|
|
9
|
+
* `@vector` index:
|
|
10
|
+
*
|
|
11
|
+
* - `<Node>VectorResult` — `{ node, score }` returned by search
|
|
12
|
+
* - `<Node>VectorSearchByVectorInput` — arguments for `searchByVector`
|
|
13
|
+
* - `<Node>VectorSearchByPhraseInput` — arguments for `searchByPhrase`
|
|
14
|
+
* (only emitted when at least one index on the node has `provider` set)
|
|
15
|
+
*
|
|
16
|
+
* Returns an empty string when no nodes have vector indexes.
|
|
17
|
+
*/
|
|
18
|
+
function emitVectorTypes(schema) {
|
|
19
|
+
const nodesWithVectors = getNodesWithVectors(schema);
|
|
20
|
+
if (nodesWithVectors.length === 0)
|
|
21
|
+
return '';
|
|
22
|
+
const blocks = [];
|
|
23
|
+
for (const node of nodesWithVectors) {
|
|
24
|
+
const indexes = node.vectorIndexes ?? [];
|
|
25
|
+
blocks.push(emitVectorResult(node));
|
|
26
|
+
blocks.push(emitVectorSearchByVectorInput(node, indexes));
|
|
27
|
+
const providerIndexes = indexes.filter((idx) => Boolean(idx.provider));
|
|
28
|
+
if (providerIndexes.length > 0)
|
|
29
|
+
blocks.push(emitVectorSearchByPhraseInput(node, providerIndexes));
|
|
30
|
+
}
|
|
31
|
+
return blocks.join('\n\n');
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Helpers
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Returns all nodes that have at least one vector index,
|
|
38
|
+
* sorted alphabetically by type name.
|
|
39
|
+
*/
|
|
40
|
+
function getNodesWithVectors(schema) {
|
|
41
|
+
return [...schema.nodes.values()]
|
|
42
|
+
.filter((node) => (node.vectorIndexes ?? []).length > 0)
|
|
43
|
+
.sort((a, b) => a.typeName.localeCompare(b.typeName));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds a literal union of index names, e.g. `'idx_a' | 'idx_b'`.
|
|
47
|
+
* Assumes the caller guarantees a non-empty list.
|
|
48
|
+
*/
|
|
49
|
+
function toIndexNameUnion(indexes) {
|
|
50
|
+
return indexes.map((idx) => `'${idx.indexName}'`).join(' | ');
|
|
51
|
+
}
|
|
52
|
+
function emitVectorResult(node) {
|
|
53
|
+
return `export type ${node.typeName}VectorResult = {
|
|
54
|
+
node: ${node.typeName};
|
|
55
|
+
score: number;
|
|
56
|
+
};`;
|
|
57
|
+
}
|
|
58
|
+
function emitVectorSearchByVectorInput(node, indexes) {
|
|
59
|
+
const indexUnion = toIndexNameUnion(indexes);
|
|
60
|
+
return `export type ${node.typeName}VectorSearchByVectorInput = {
|
|
61
|
+
indexName: ${indexUnion};
|
|
62
|
+
vector: number[];
|
|
63
|
+
k: number;
|
|
64
|
+
where?: ${node.typeName}Where;
|
|
65
|
+
selectionSet?: string;
|
|
66
|
+
labels?: string[];
|
|
67
|
+
};`;
|
|
68
|
+
}
|
|
69
|
+
function emitVectorSearchByPhraseInput(node, providerIndexes) {
|
|
70
|
+
const indexUnion = toIndexNameUnion(providerIndexes);
|
|
71
|
+
return `export type ${node.typeName}VectorSearchByPhraseInput = {
|
|
72
|
+
indexName: ${indexUnion};
|
|
73
|
+
phrase: string;
|
|
74
|
+
k: number;
|
|
75
|
+
providerConfig?: Record<string, unknown>;
|
|
76
|
+
where?: ${node.typeName}Where;
|
|
77
|
+
selectionSet?: string;
|
|
78
|
+
labels?: string[];
|
|
79
|
+
};`;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=vector-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-emitter.js","sourceRoot":"","sources":["../../../../src/generator/type-emitters/vector-emitter.ts"],"names":[],"mappings":";;AAqBA,0CAkBC;AAjCD,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,MAAsB;IACpD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QAE1D,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvE,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,mBAAmB,CAAC,MAAsB;IACjD,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SAC9B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACvD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,OAAsB;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAoB;IAC5C,OAAO,eAAe,IAAI,CAAC,QAAQ;UAC3B,IAAI,CAAC,QAAQ;;GAEpB,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAoB,EACpB,OAAsB;IAEtB,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE7C,OAAO,eAAe,IAAI,CAAC,QAAQ;eACtB,UAAU;;;YAGb,IAAI,CAAC,QAAQ;;;GAGtB,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,IAAoB,EACpB,eAA8B;IAE9B,MAAM,UAAU,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAErD,OAAO,eAAe,IAAI,CAAC,QAAQ;eACtB,UAAU;;;;YAIb,IAAI,CAAC,QAAQ;;;GAGtB,CAAC;AACJ,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { ModelInterface, MutationResponse, MutationInfo, FulltextIndexEntry
|
|
|
7
7
|
export { InterfaceModel } from './interface-model';
|
|
8
8
|
export type { InterfaceModelInterface } from './interface-model';
|
|
9
9
|
export { OGMError, RecordNotFoundError, SubgraphOperationError, } from './errors';
|
|
10
|
-
export type { SchemaMetadata, NodeDefinition, InterfaceDefinition, RelationshipDefinition, RelationshipPropertiesDefinition, PropertyDefinition, FulltextIndex, Neo4jValue, WhereInput, MutationInput, } from './schema/types';
|
|
10
|
+
export type { SchemaMetadata, NodeDefinition, InterfaceDefinition, RelationshipDefinition, RelationshipPropertiesDefinition, PropertyDefinition, FulltextIndex, VectorIndex, Neo4jValue, WhereInput, MutationInput, } from './schema/types';
|
|
11
11
|
export { parseSchema, pluralize } from './schema/parser';
|
|
12
12
|
export { clearResolveTargetDefCache } from './schema/utils';
|
|
13
13
|
export { WhereCompiler } from './compilers/where.compiler';
|
|
@@ -18,6 +18,8 @@ export { SelectNormalizer } from './compilers/select-normalizer';
|
|
|
18
18
|
export { MutationCompiler } from './compilers/mutation.compiler';
|
|
19
19
|
export type { MutationResult } from './compilers/mutation.compiler';
|
|
20
20
|
export { FulltextCompiler } from './compilers/fulltext.compiler';
|
|
21
|
+
export { VectorCompiler } from './compilers/vector.compiler';
|
|
22
|
+
export type { VectorResult } from './compilers/vector.compiler';
|
|
21
23
|
export { Executor } from './execution/executor';
|
|
22
24
|
export type { ExecutionContext, OGMLogger } from './execution/executor';
|
|
23
25
|
export { ResultMapper } from './execution/result-mapper';
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,kCAAkC;AAClC,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACtE,YAAY,EACV,cAAc,EACd,gBAA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sBAAsB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.escapeIdentifier = exports.assertSortDirection = exports.assertSafeLabel = exports.assertSafeIdentifier = exports.sanitizeLuceneQuery = exports.deleteSubgraph = exports.cloneSubgraph = exports.generateTypes = exports.ResultMapper = exports.Executor = exports.FulltextCompiler = exports.MutationCompiler = exports.SelectNormalizer = exports.SelectionCompiler = exports.WhereCompiler = exports.clearResolveTargetDefCache = exports.pluralize = exports.parseSchema = exports.SubgraphOperationError = exports.RecordNotFoundError = exports.OGMError = exports.InterfaceModel = exports.isFulltextIndexEntry = exports.isFulltextLeaf = exports.Model = exports.SafedoseOGM = exports.OGM = void 0;
|
|
3
|
+
exports.escapeIdentifier = exports.assertSortDirection = exports.assertSafeLabel = exports.assertSafeIdentifier = exports.sanitizeLuceneQuery = exports.deleteSubgraph = exports.cloneSubgraph = exports.generateTypes = exports.ResultMapper = exports.Executor = exports.VectorCompiler = exports.FulltextCompiler = exports.MutationCompiler = exports.SelectNormalizer = exports.SelectionCompiler = exports.WhereCompiler = exports.clearResolveTargetDefCache = exports.pluralize = exports.parseSchema = exports.SubgraphOperationError = exports.RecordNotFoundError = exports.OGMError = exports.InterfaceModel = exports.isFulltextIndexEntry = exports.isFulltextLeaf = exports.Model = exports.SafedoseOGM = exports.OGM = void 0;
|
|
4
4
|
// Main classes
|
|
5
5
|
var ogm_1 = require("./ogm");
|
|
6
6
|
Object.defineProperty(exports, "OGM", { enumerable: true, get: function () { return ogm_1.OGM; } });
|
|
@@ -36,6 +36,8 @@ var mutation_compiler_1 = require("./compilers/mutation.compiler");
|
|
|
36
36
|
Object.defineProperty(exports, "MutationCompiler", { enumerable: true, get: function () { return mutation_compiler_1.MutationCompiler; } });
|
|
37
37
|
var fulltext_compiler_1 = require("./compilers/fulltext.compiler");
|
|
38
38
|
Object.defineProperty(exports, "FulltextCompiler", { enumerable: true, get: function () { return fulltext_compiler_1.FulltextCompiler; } });
|
|
39
|
+
var vector_compiler_1 = require("./compilers/vector.compiler");
|
|
40
|
+
Object.defineProperty(exports, "VectorCompiler", { enumerable: true, get: function () { return vector_compiler_1.VectorCompiler; } });
|
|
39
41
|
// Execution
|
|
40
42
|
var executor_1 = require("./execution/executor");
|
|
41
43
|
Object.defineProperty(exports, "Executor", { enumerable: true, get: function () { return executor_1.Executor; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACf,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AAEZ,kCAAkC;AAClC,6BAA2C;AAAlC,kGAAA,GAAG,OAAe;AAC3B,iCAAsE;AAA7D,8FAAA,KAAK,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAUpD,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,SAAS;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