@_linked/core 1.0.0-next.20260224083238 → 1.1.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 +4 -12
- package/README.md +40 -186
- package/lib/cjs/index.js +0 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/IQuadStore.d.ts +7 -19
- package/lib/cjs/interfaces/IQueryParser.d.ts +13 -0
- package/lib/cjs/interfaces/IQueryParser.js +10 -0
- package/lib/cjs/interfaces/IQueryParser.js.map +1 -0
- package/lib/cjs/queries/CreateQuery.d.ts +8 -7
- package/lib/cjs/queries/CreateQuery.js +4 -4
- package/lib/cjs/queries/CreateQuery.js.map +1 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +8 -7
- package/lib/cjs/queries/DeleteQuery.js +4 -4
- package/lib/cjs/queries/DeleteQuery.js.map +1 -1
- package/lib/cjs/queries/QueryFactory.d.ts +2 -0
- package/lib/cjs/queries/QueryFactory.js +3 -0
- package/lib/cjs/queries/QueryFactory.js.map +1 -1
- package/lib/cjs/queries/QueryParser.d.ts +1 -6
- package/lib/cjs/queries/QueryParser.js +22 -14
- package/lib/cjs/queries/QueryParser.js.map +1 -1
- package/lib/cjs/queries/SelectQuery.d.ts +27 -18
- package/lib/cjs/queries/SelectQuery.js +45 -54
- package/lib/cjs/queries/SelectQuery.js.map +1 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +9 -8
- package/lib/cjs/queries/UpdateQuery.js +4 -4
- package/lib/cjs/queries/UpdateQuery.js.map +1 -1
- package/lib/cjs/shapes/SHACL.d.ts +0 -1
- package/lib/cjs/shapes/SHACL.js +2 -82
- package/lib/cjs/shapes/SHACL.js.map +1 -1
- package/lib/cjs/shapes/Shape.d.ts +10 -11
- package/lib/cjs/shapes/Shape.js +5 -11
- package/lib/cjs/shapes/Shape.js.map +1 -1
- package/lib/cjs/test-helpers/query-fixtures.d.ts +88 -671
- package/lib/cjs/test-helpers/query-fixtures.js +1 -39
- package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
- package/lib/cjs/utils/LinkedStorage.d.ts +7 -7
- package/lib/cjs/utils/LinkedStorage.js +3 -4
- package/lib/cjs/utils/LinkedStorage.js.map +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/IQuadStore.d.ts +7 -19
- package/lib/esm/interfaces/IQueryParser.d.ts +13 -0
- package/lib/esm/interfaces/IQueryParser.js +7 -0
- package/lib/esm/interfaces/IQueryParser.js.map +1 -0
- package/lib/esm/queries/CreateQuery.d.ts +8 -7
- package/lib/esm/queries/CreateQuery.js +4 -4
- package/lib/esm/queries/CreateQuery.js.map +1 -1
- package/lib/esm/queries/DeleteQuery.d.ts +8 -7
- package/lib/esm/queries/DeleteQuery.js +4 -4
- package/lib/esm/queries/DeleteQuery.js.map +1 -1
- package/lib/esm/queries/QueryFactory.d.ts +2 -0
- package/lib/esm/queries/QueryFactory.js +3 -0
- package/lib/esm/queries/QueryFactory.js.map +1 -1
- package/lib/esm/queries/QueryParser.d.ts +1 -6
- package/lib/esm/queries/QueryParser.js +23 -14
- package/lib/esm/queries/QueryParser.js.map +1 -1
- package/lib/esm/queries/SelectQuery.d.ts +27 -18
- package/lib/esm/queries/SelectQuery.js +45 -54
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/UpdateQuery.d.ts +9 -8
- package/lib/esm/queries/UpdateQuery.js +4 -4
- package/lib/esm/queries/UpdateQuery.js.map +1 -1
- package/lib/esm/shapes/SHACL.d.ts +0 -1
- package/lib/esm/shapes/SHACL.js +2 -82
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/Shape.d.ts +10 -11
- package/lib/esm/shapes/Shape.js +5 -11
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/test-helpers/query-fixtures.d.ts +88 -671
- package/lib/esm/test-helpers/query-fixtures.js +0 -38
- package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
- package/lib/esm/utils/LinkedStorage.d.ts +7 -7
- package/lib/esm/utils/LinkedStorage.js +3 -4
- package/lib/esm/utils/LinkedStorage.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
- package/lib/cjs/queries/IRAliasScope.js +0 -52
- package/lib/cjs/queries/IRAliasScope.js.map +0 -1
- package/lib/cjs/queries/IRCanonicalize.d.ts +0 -36
- package/lib/cjs/queries/IRCanonicalize.js +0 -112
- package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
- package/lib/cjs/queries/IRDesugar.d.ts +0 -98
- package/lib/cjs/queries/IRDesugar.js +0 -244
- package/lib/cjs/queries/IRDesugar.js.map +0 -1
- package/lib/cjs/queries/IRLower.d.ts +0 -8
- package/lib/cjs/queries/IRLower.js +0 -238
- package/lib/cjs/queries/IRLower.js.map +0 -1
- package/lib/cjs/queries/IRMutation.d.ts +0 -23
- package/lib/cjs/queries/IRMutation.js +0 -77
- package/lib/cjs/queries/IRMutation.js.map +0 -1
- package/lib/cjs/queries/IRPipeline.d.ts +0 -8
- package/lib/cjs/queries/IRPipeline.js +0 -25
- package/lib/cjs/queries/IRPipeline.js.map +0 -1
- package/lib/cjs/queries/IRProjection.d.ts +0 -27
- package/lib/cjs/queries/IRProjection.js +0 -84
- package/lib/cjs/queries/IRProjection.js.map +0 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -200
- package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
- package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/cjs/test-helpers/query-capture-store.d.ts +0 -5
- package/lib/cjs/test-helpers/query-capture-store.js +0 -59
- package/lib/cjs/test-helpers/query-capture-store.js.map +0 -1
- package/lib/esm/queries/IRAliasScope.d.ts +0 -20
- package/lib/esm/queries/IRAliasScope.js +0 -47
- package/lib/esm/queries/IRAliasScope.js.map +0 -1
- package/lib/esm/queries/IRCanonicalize.d.ts +0 -36
- package/lib/esm/queries/IRCanonicalize.js +0 -107
- package/lib/esm/queries/IRCanonicalize.js.map +0 -1
- package/lib/esm/queries/IRDesugar.d.ts +0 -98
- package/lib/esm/queries/IRDesugar.js +0 -240
- package/lib/esm/queries/IRDesugar.js.map +0 -1
- package/lib/esm/queries/IRLower.d.ts +0 -8
- package/lib/esm/queries/IRLower.js +0 -234
- package/lib/esm/queries/IRLower.js.map +0 -1
- package/lib/esm/queries/IRMutation.d.ts +0 -23
- package/lib/esm/queries/IRMutation.js +0 -71
- package/lib/esm/queries/IRMutation.js.map +0 -1
- package/lib/esm/queries/IRPipeline.d.ts +0 -8
- package/lib/esm/queries/IRPipeline.js +0 -21
- package/lib/esm/queries/IRPipeline.js.map +0 -1
- package/lib/esm/queries/IRProjection.d.ts +0 -27
- package/lib/esm/queries/IRProjection.js +0 -78
- package/lib/esm/queries/IRProjection.js.map +0 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +0 -200
- package/lib/esm/queries/IntermediateRepresentation.js +0 -2
- package/lib/esm/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/esm/test-helpers/query-capture-store.d.ts +0 -5
- package/lib/esm/test-helpers/query-capture-store.js +0 -55
- package/lib/esm/test-helpers/query-capture-store.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- [#1](https://github.com/Semantu/linked/pull/1) [`0938ede`](https://github.com/Semantu/linked/commit/0938edec623e9d611767ae150b8d60270035ffeb) Thanks [@flyon](https://github.com/flyon)! - first major release
|
|
3
|
+
## 1.1.0
|
|
8
4
|
|
|
9
5
|
### Minor Changes
|
|
10
6
|
|
|
11
|
-
- [#9](https://github.com/Semantu/linked/pull/9) [`381067b`](https://github.com/Semantu/linked/commit/381067b0fbc25f4a0446c5f8cc0eec57ddded466) Thanks [@flyon](https://github.com/flyon)! - Introduce canonical Intermediate Representation (IR) support for query and mutation objects.
|
|
12
|
-
|
|
13
|
-
- Add select-query IR pipeline stages (desugar, canonicalize, projection, alias scope, pipeline helpers) and expose `getCanonicalIR()` on select factories.
|
|
14
|
-
- Add canonical mutation IR conversion for create/update/delete query objects.
|
|
15
|
-
- Add IR documentation and parity/golden test coverage for select and mutation conversion behavior.
|
|
16
|
-
|
|
17
7
|
- [#4](https://github.com/Semantu/linked/pull/4) [`c35e686`](https://github.com/Semantu/linked/commit/c35e6861600d7aa8683b4b288fc4d1dc74c4aff2) Thanks [@flyon](https://github.com/flyon)! - - Added `Shape.selectAll()` plus nested `selectAll()` support on sub-queries.
|
|
18
8
|
- Added inherited property deduplication via `NodeShape.getUniquePropertyShapes()` so subclass overrides win by label and are selected once.
|
|
19
9
|
- Improved `selectAll()` type inference (including nested queries) and excluded base `Shape` keys from inferred results.
|
|
@@ -21,7 +11,9 @@
|
|
|
21
11
|
- Fixed `createPropertyShape` to preserve explicit `minCount: 0` / `maxCount: 0`.
|
|
22
12
|
- Expanded tests and README documentation for `selectAll`, CRUD return types, and multi-value update semantics.
|
|
23
13
|
|
|
24
|
-
|
|
14
|
+
## 1.0.0
|
|
15
|
+
|
|
16
|
+
### Major Changes
|
|
25
17
|
|
|
26
18
|
This is a rebranding + extraction release. It moves the core query/shape system into `@_linked/core` and removes RDF models and React-specific code.
|
|
27
19
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @_linked/core
|
|
2
2
|
Core Linked package for the query DSL, SHACL shape decorators/metadata, and package registration.
|
|
3
3
|
|
|
4
|
-
Linked core gives you a type-safe, schema-parameterized query language and SHACL-driven Shape classes for linked data. It compiles queries into a
|
|
4
|
+
Linked core gives you a type-safe, schema-parameterized query language and SHACL-driven Shape classes for linked data. It compiles queries into a plain JS query object that can be executed by a store.
|
|
5
5
|
|
|
6
6
|
## Linked core offers
|
|
7
7
|
|
|
@@ -27,10 +27,6 @@ import {linkedPackage} from '@_linked/core/utils/Package';
|
|
|
27
27
|
- `@_linked/rdf-mem-store`: in-memory RDF store that implements `IQuadStore`.
|
|
28
28
|
- `@_linked/react`: React bindings for Linked queries and shapes.
|
|
29
29
|
|
|
30
|
-
## Documentation
|
|
31
|
-
|
|
32
|
-
- [Intermediate Representation (IR)](./documentation/intermediate-representation.md)
|
|
33
|
-
|
|
34
30
|
## Linked Package Setup
|
|
35
31
|
|
|
36
32
|
Linked packages expose shapes, utilities, and ontologies through a small `package.ts` file. This makes module exports discoverable across Linked modules and enables linked decorators.
|
|
@@ -89,35 +85,41 @@ export class Person extends Shape {
|
|
|
89
85
|
## Queries: Create, Select, Update, Delete
|
|
90
86
|
|
|
91
87
|
Queries are expressed with the same Shape classes and compile to a query object that a store executes.
|
|
92
|
-
Use this section as a quick start. Detailed query variations are documented in `Query examples` below.
|
|
93
|
-
|
|
94
|
-
A few quick examples:
|
|
95
88
|
|
|
96
|
-
**1) Select one field for all matching nodes**
|
|
97
89
|
```typescript
|
|
90
|
+
/* Result: Array<{id: string; name: string}> */
|
|
98
91
|
const names = await Person.select((p) => p.name);
|
|
99
|
-
/* names: {id: string; name: string}[] */
|
|
100
|
-
```
|
|
101
92
|
|
|
102
|
-
**2) Select all decorated fields of nested related nodes**
|
|
103
|
-
```typescript
|
|
104
|
-
const allFriends = await Person.select((p) => p.knows.selectAll());
|
|
105
|
-
/* allFriends: {
|
|
106
|
-
id?: string;
|
|
107
|
-
knows: {
|
|
108
|
-
id?: string;
|
|
109
|
-
...all decorated Person fields...
|
|
110
|
-
}[]
|
|
111
|
-
}[] */
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**3) Apply a simple mutation**
|
|
115
|
-
```typescript
|
|
116
93
|
const myNode = {id: 'https://my.app/node1'};
|
|
94
|
+
/* Result: {id: string; name: string} | null */
|
|
95
|
+
const person = await Person.select(myNode, (p) => p.name);
|
|
96
|
+
const missing = await Person.select({id: 'https://my.app/missing'}, (p) => p.name); // null
|
|
97
|
+
|
|
98
|
+
/* Result: {id: string} & UpdatePartial<Person> */
|
|
99
|
+
const created = await Person.create({
|
|
100
|
+
name: 'Alice',
|
|
101
|
+
knows: [{id: 'https://my.app/node2'}],
|
|
102
|
+
});
|
|
103
|
+
|
|
117
104
|
const updated = await Person.update(myNode, {
|
|
118
105
|
name: 'Alicia',
|
|
119
106
|
});
|
|
120
|
-
|
|
107
|
+
|
|
108
|
+
// Overwrite a multi-value property
|
|
109
|
+
const overwriteFriends = await Person.update(myNode, {
|
|
110
|
+
knows: [{id: 'https://my.app/node2'}],
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Add/remove items in a multi-value property
|
|
114
|
+
const addRemoveFriends = await Person.update(myNode, {
|
|
115
|
+
knows: {
|
|
116
|
+
add: [{id: 'https://my.app/node3'}],
|
|
117
|
+
remove: [{id: 'https://my.app/node2'}],
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/* Result: {deleted: Array<{id: string}>, count: number} */
|
|
122
|
+
await Person.delete(myNode);
|
|
121
123
|
```
|
|
122
124
|
|
|
123
125
|
## Storage configuration
|
|
@@ -170,13 +172,10 @@ Result types are inferred from your Shape definitions and the selected paths. Ex
|
|
|
170
172
|
|
|
171
173
|
#### Basic selection
|
|
172
174
|
```typescript
|
|
173
|
-
/*
|
|
175
|
+
/* Result: Array<{id: string; name: string}> */
|
|
174
176
|
const names = await Person.select((p) => p.name);
|
|
175
177
|
|
|
176
|
-
/*
|
|
177
|
-
id: string;
|
|
178
|
-
knows: { id: string }[]
|
|
179
|
-
}[] */
|
|
178
|
+
/* Result: Array<{id: string; knows: Array<{id: string}>}> */
|
|
180
179
|
const friends = await Person.select((p) => p.knows);
|
|
181
180
|
|
|
182
181
|
const dates = await Person.select((p) => [p.birthDate, p.name]);
|
|
@@ -203,12 +202,6 @@ const deep = await Person.select((p) => p.knows.bestFriend.name);
|
|
|
203
202
|
const detailed = await Person.select((p) =>
|
|
204
203
|
p.knows.select((f) => f.name),
|
|
205
204
|
);
|
|
206
|
-
|
|
207
|
-
const allPeople = await Person.selectAll();
|
|
208
|
-
|
|
209
|
-
const detailedAll = await Person.select((p) =>
|
|
210
|
-
p.knows.selectAll(),
|
|
211
|
-
);
|
|
212
205
|
```
|
|
213
206
|
|
|
214
207
|
#### Where + equals
|
|
@@ -268,9 +261,7 @@ const custom = await Person.select((p) => ({
|
|
|
268
261
|
}));
|
|
269
262
|
```
|
|
270
263
|
|
|
271
|
-
#### Query As (type casting
|
|
272
|
-
If person.pets returns an array of Pets. And Dog extends Pet.
|
|
273
|
-
And you want to select properties of those pets that are dogs:
|
|
264
|
+
#### Query As (type casting)
|
|
274
265
|
```typescript
|
|
275
266
|
const guards = await Person.select((p) => p.pets.as(Dog).guardDogLevel);
|
|
276
267
|
```
|
|
@@ -302,171 +293,34 @@ const preloaded = await Person.select((p) => [
|
|
|
302
293
|
]);
|
|
303
294
|
```
|
|
304
295
|
|
|
305
|
-
#### Create
|
|
306
|
-
|
|
296
|
+
#### Create / Update / Delete
|
|
307
297
|
```typescript
|
|
308
298
|
/* Result: {id: string} & UpdatePartial<Person> */
|
|
309
299
|
const created = await Person.create({name: 'Alice'});
|
|
310
|
-
```
|
|
311
|
-
Where UpdatePartial<Shape> reflects the created properties.
|
|
312
300
|
|
|
313
|
-
#### Update
|
|
314
|
-
|
|
315
|
-
Update will patch any property that you send as payload and leave the rest untouched.
|
|
316
|
-
```typescript
|
|
317
|
-
/* Result: {id: string} & UpdatePartial<Person> */
|
|
318
301
|
const updated = await Person.update({id: 'https://my.app/node1'}, {name: 'Alicia'});
|
|
319
|
-
```
|
|
320
|
-
Returns:
|
|
321
|
-
```json
|
|
322
|
-
{
|
|
323
|
-
id:"https://my.app/node1",
|
|
324
|
-
name:"Alicia"
|
|
325
|
-
}
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
**Updating multi-value properties**
|
|
329
|
-
When updating a property that holds multiple values (one that returns an array in the results), you can either overwrite all the values with a new explicit array of values, or delete from/add to the current values.
|
|
330
302
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const overwriteFriends = await Person.update({id: 'https://my.app/person1'}, {
|
|
335
|
-
knows: [{id: 'https://my.app/person2'}],
|
|
303
|
+
// Overwrite a multi-value property
|
|
304
|
+
const overwriteFriends = await Person.update({id: 'https://my.app/node1'}, {
|
|
305
|
+
knows: [{id: 'https://my.app/node2'}],
|
|
336
306
|
});
|
|
337
|
-
```
|
|
338
|
-
The result will contain an object with `updatedTo`, to indicate that previous values were overwritten to this new set of values:
|
|
339
|
-
```json
|
|
340
|
-
{
|
|
341
|
-
id: "https://my.app/person1",
|
|
342
|
-
knows: {
|
|
343
|
-
updatedTo: [{id:"https://my.app/person2"}],
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
307
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
// Add one value and remove one value without replacing the whole set.
|
|
351
|
-
const addRemoveFriends = await Person.update({id: 'https://my.app/person1'}, {
|
|
308
|
+
// Add/remove items in a multi-value property
|
|
309
|
+
const addRemoveFriends = await Person.update({id: 'https://my.app/node1'}, {
|
|
352
310
|
knows: {
|
|
353
|
-
add: [{id: 'https://my.app/
|
|
354
|
-
remove: [{id: 'https://my.app/
|
|
311
|
+
add: [{id: 'https://my.app/node3'}],
|
|
312
|
+
remove: [{id: 'https://my.app/node2'}],
|
|
355
313
|
},
|
|
356
314
|
});
|
|
357
|
-
```
|
|
358
|
-
This returns an object with the added and removed items
|
|
359
|
-
```json
|
|
360
|
-
{
|
|
361
|
-
id: "https://my.app/person1",
|
|
362
|
-
knows: {
|
|
363
|
-
added?: [{id:"https://my.app/person2"},
|
|
364
|
-
removed?: [{id:"https://my.app/person3"}],
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
```
|
|
368
315
|
|
|
369
|
-
|
|
370
|
-
#### Delete
|
|
371
|
-
To delete a node entirely:
|
|
372
|
-
|
|
373
|
-
```typescript
|
|
374
|
-
/* Result: {deleted: Array<{id: string}>, count: number} */
|
|
375
|
-
const deleted = await Person.delete({id: 'https://my.app/node1'});
|
|
376
|
-
```
|
|
377
|
-
Returns
|
|
378
|
-
```json
|
|
379
|
-
{
|
|
380
|
-
deleted:[
|
|
381
|
-
{id:"https://my.app/node1"}
|
|
382
|
-
],
|
|
383
|
-
count:1
|
|
384
|
-
}
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
To delete multiple nodes pass an array:
|
|
388
|
-
|
|
389
|
-
```typescript
|
|
390
|
-
/* Result: {deleted: Array<{id: string}>, count: number} */
|
|
391
|
-
const deleted = await Person.delete([{id: 'https://my.app/node1'},{id: 'https://my.app/node2'}]);
|
|
316
|
+
await Person.delete({id: 'https://my.app/node1'});
|
|
392
317
|
```
|
|
393
318
|
|
|
394
|
-
|
|
395
|
-
## Extending shapes
|
|
396
|
-
|
|
397
|
-
Shape classes can extend other shape classes. Subclasses inherit property shapes from their superclasses and may override them.
|
|
398
|
-
This example assumes `Person` from the `Shapes` section above.
|
|
399
|
-
|
|
400
|
-
```typescript
|
|
401
|
-
import {literalProperty} from '@_linked/core/shapes/SHACL';
|
|
402
|
-
import {createNameSpace} from '@_linked/core/utils/NameSpace';
|
|
403
|
-
import {linkedShape} from './package';
|
|
404
|
-
|
|
405
|
-
const schema = createNameSpace('https://schema.org/');
|
|
406
|
-
const EmployeeClass = schema('Employee');
|
|
407
|
-
const name = schema('name');
|
|
408
|
-
const employeeId = schema('employeeId');
|
|
409
|
-
|
|
410
|
-
@linkedShape
|
|
411
|
-
export class Employee extends Person {
|
|
412
|
-
static targetClass = EmployeeClass;
|
|
413
|
-
|
|
414
|
-
// Override inherited "name" with stricter constraints (still maxCount: 1)
|
|
415
|
-
@literalProperty({path: name, required: true, minLength: 2, maxCount: 1})
|
|
416
|
-
declare name: string;
|
|
417
|
-
|
|
418
|
-
@literalProperty({path: employeeId, required: true, maxCount: 1})
|
|
419
|
-
declare employeeId: string;
|
|
420
|
-
}
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
Override behavior:
|
|
424
|
-
|
|
425
|
-
- `NodeShape.getUniquePropertyShapes()` returns one property shape per label, with subclass overrides taking precedence.
|
|
426
|
-
- Overrides must be tighten-only for `minCount`, `maxCount`, and `nodeKind` (widening is rejected at registration time).
|
|
427
|
-
- If an override omits `minCount`, `maxCount`, or `nodeKind`, inherited values are kept.
|
|
428
|
-
- Current scope: compatibility checks for `datatype`, `class`, and `pattern` are not enforced yet.
|
|
429
|
-
|
|
430
319
|
## TODO
|
|
431
320
|
|
|
432
321
|
- Allow `preloadFor` to accept another query (not just a component).
|
|
433
322
|
- Make and expose functions for auto syncing shapes to the graph.
|
|
434
323
|
|
|
435
|
-
## Intermediate Representation (IR)
|
|
436
|
-
|
|
437
|
-
Every Linked query compiles to a plain, JSON-serializable JavaScript object — the **Intermediate Representation**. This IR is the contract between the DSL and any storage backend. A store receives these objects and translates them into its native query language (SPARQL, SQL, etc.).
|
|
438
|
-
|
|
439
|
-
For example, this DSL call:
|
|
440
|
-
|
|
441
|
-
```typescript
|
|
442
|
-
const names = await Person.select((p) => p.name);
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
produces the following IR object, which is passed to your store's `selectQuery()` method:
|
|
446
|
-
|
|
447
|
-
```json
|
|
448
|
-
{
|
|
449
|
-
"kind": "select",
|
|
450
|
-
"root": {"kind": "shape_scan", "shape": "https://schema.org/Person", "alias": "a0"},
|
|
451
|
-
"patterns": [],
|
|
452
|
-
"projection": [
|
|
453
|
-
{
|
|
454
|
-
"alias": "a1",
|
|
455
|
-
"expression": {"kind": "property_expr", "sourceAlias": "a0", "property": "https://schema.org/name"}
|
|
456
|
-
}
|
|
457
|
-
],
|
|
458
|
-
"resultMap": [{"key": "name", "alias": "a1"}],
|
|
459
|
-
"singleResult": false
|
|
460
|
-
}
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
All IR types are available from `@_linked/core/queries/IntermediateRepresentation`. See the full [Intermediate Representation docs](./documentation/intermediate-representation.md) for the complete type reference, examples, and a store implementer guide.
|
|
464
|
-
|
|
465
|
-
**Store packages:**
|
|
466
|
-
|
|
467
|
-
- `@_linked/sparql-store` — SPARQL endpoint store (coming soon)
|
|
468
|
-
- `@_linked/rdf-mem-store` — in-memory RDF store
|
|
469
|
-
|
|
470
324
|
## Changelog
|
|
471
325
|
|
|
472
326
|
See [CHANGELOG.md](./CHANGELOG.md).
|
package/lib/cjs/index.js
CHANGED
|
@@ -61,7 +61,6 @@ const DeleteQuery = __importStar(require("./queries/DeleteQuery.js"));
|
|
|
61
61
|
const CreateQuery = __importStar(require("./queries/CreateQuery.js"));
|
|
62
62
|
const QueryParser = __importStar(require("./queries/QueryParser.js"));
|
|
63
63
|
const QueryFactory = __importStar(require("./queries/QueryFactory.js"));
|
|
64
|
-
const IntermediateRepresentation = __importStar(require("./queries/IntermediateRepresentation.js"));
|
|
65
64
|
const NameSpace = __importStar(require("./utils/NameSpace.js"));
|
|
66
65
|
const ShapeClass = __importStar(require("./utils/ShapeClass.js"));
|
|
67
66
|
const cached = __importStar(require("./utils/cached.js"));
|
|
@@ -104,7 +103,6 @@ function initModularApp() {
|
|
|
104
103
|
CreateQuery,
|
|
105
104
|
QueryParser,
|
|
106
105
|
QueryFactory,
|
|
107
|
-
IntermediateRepresentation,
|
|
108
106
|
SHACLShapes,
|
|
109
107
|
rdf,
|
|
110
108
|
rdfs,
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,wCA+CC;AAvFD;;;;GAIG;AACH,4DAA8C;AAC9C,kFAAoE;AACpE,gFAAkE;AAClE,wEAA0D;AAC1D,kEAAoD;AACpD,kEAAoD;AACpD,yDAA2C;AAC3C,+DAAiD;AACjD,oEAAsD;AACtD,0DAA4C;AAC5C,oDAAsC;AACtC,sEAAwD;AACxD,sEAAwD;AACxD,0EAA4D;AAC5D,sEAAwD;AACxD,sEAAwD;AACxD,sEAAwD;AACxD,wEAA0D;AAC1D,gEAAkD;AAClD,kEAAoD;AACpD,0DAA4C;AAC5C,uDAAyC;AACzC,6EAA+D;AAC/D,uEAAyD;AACzD,uEAAyD;AACzD,yDAA2C;AAC3C,2DAA6C;AAC7C,yDAA2C;AAC3C,6DAA+C;AAC/C,6DAA+C;AAC/C,yDAA2C;AAC3C,yDAA2C;AAC3C,0DAAiC;AACzB,mBADD,mBAAQ,CACC;AAEhB,SAAgB,cAAc;IAC5B,IAAI,WAAW,GAAG;QAChB,OAAO;QACP,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,OAAO;QACP,OAAO;QACP,KAAK;QACL,QAAQ;QACR,MAAM;QACN,SAAS;QACT,MAAM;QACN,GAAG;QACH,UAAU;QACV,IAAI;QACJ,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW;QACX,WAAW;QACX,aAAa;QACb,WAAW;QACX,WAAW;QACX,WAAW;QACX,YAAY;QACZ,WAAW;QACX,GAAG;QACH,IAAI;QACJ,GAAG;QACH,KAAK;QACL,KAAK;QACL,GAAG;QACH,GAAG;KACJ,CAAC;IACF,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,eAAe,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,KAAK,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;YACtC,WAAW,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import type { SelectResult, CreateResult, UpdateResult } from '../queries/IntermediateRepresentation.js';
|
|
6
|
-
/**
|
|
7
|
-
* Store interface for executing IR queries.
|
|
8
|
-
*
|
|
9
|
-
* Implement this interface to back Linked with a custom storage engine
|
|
10
|
-
* (SPARQL endpoint, SQL database, in-memory store, etc.).
|
|
11
|
-
*
|
|
12
|
-
* Each method receives a canonical IR query object and returns the result.
|
|
13
|
-
* The calling layer (LinkedStorage / QueryParser) threads the precise
|
|
14
|
-
* DSL-level TypeScript result type back to the caller — the store only
|
|
15
|
-
* needs to produce data that matches the structural result types.
|
|
16
|
-
*/
|
|
1
|
+
import { CreateQuery } from '../queries/CreateQuery.js';
|
|
2
|
+
import { DeleteQuery, DeleteResponse } from '../queries/DeleteQuery.js';
|
|
3
|
+
import { SelectQuery } from '../queries/SelectQuery.js';
|
|
4
|
+
import { UpdateQuery } from '../queries/UpdateQuery.js';
|
|
17
5
|
export interface IQuadStore {
|
|
18
6
|
/**
|
|
19
7
|
* Prepares the store to be used.
|
|
20
8
|
*/
|
|
21
9
|
init?(): Promise<any>;
|
|
22
|
-
selectQuery(query: SelectQuery): Promise<
|
|
23
|
-
updateQuery
|
|
24
|
-
createQuery
|
|
10
|
+
selectQuery<ResultType>(query: SelectQuery<any>): Promise<ResultType>;
|
|
11
|
+
updateQuery?<RType>(q: UpdateQuery<RType>): Promise<RType>;
|
|
12
|
+
createQuery?<R>(q: CreateQuery<R>): Promise<R>;
|
|
25
13
|
deleteQuery?(query: DeleteQuery): Promise<DeleteResponse>;
|
|
26
14
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetQueryResponseType, QueryResponseToResultType, SelectQueryFactory } from '../queries/SelectQuery.js';
|
|
2
|
+
import { Shape } from '../shapes/Shape.js';
|
|
3
|
+
import { AddId, NodeReferenceValue, UpdatePartial } from '../queries/QueryFactory.js';
|
|
4
|
+
import { CreateResponse } from '../queries/CreateQuery.js';
|
|
5
|
+
import { NodeId } from '../queries/MutationQuery.js';
|
|
6
|
+
import { DeleteResponse } from '../queries/DeleteQuery.js';
|
|
7
|
+
export interface IQueryParser {
|
|
8
|
+
selectQuery<ShapeType extends Shape, ResponseType, Source, ResultType = QueryResponseToResultType<GetQueryResponseType<SelectQueryFactory<ShapeType, ResponseType>>, ShapeType>[]>(query: SelectQueryFactory<ShapeType, ResponseType, Source>): Promise<ResultType>;
|
|
9
|
+
updateQuery<ShapeType extends Shape, U extends UpdatePartial<ShapeType>>(id: string | NodeReferenceValue, updateObjectOrFn: U, shapeClass: typeof Shape): Promise<AddId<U>>;
|
|
10
|
+
createQuery<ShapeType extends Shape, U extends UpdatePartial<ShapeType>>(updateObjectOrFn: U, shapeClass: typeof Shape): Promise<CreateResponse<U>>;
|
|
11
|
+
deleteQuery(id: NodeId | NodeId[] | NodeReferenceValue[], shapeClass: typeof Shape): Promise<DeleteResponse>;
|
|
12
|
+
}
|
|
13
|
+
export declare function staticImplements<T>(): <U extends T>(constructor: U) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.staticImplements = staticImplements;
|
|
4
|
+
/* class decorator */
|
|
5
|
+
function staticImplements() {
|
|
6
|
+
return (constructor) => {
|
|
7
|
+
constructor;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=IQueryParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IQueryParser.js","sourceRoot":"","sources":["../../../src/interfaces/IQueryParser.ts"],"names":[],"mappings":";;AA8CA,4CAIC;AALD,qBAAqB;AACrB,SAAgB,gBAAgB;IAC9B,OAAO,CAAc,WAAc,EAAE,EAAE;QACrC,WAAW,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Shape } from '../shapes/Shape.js';
|
|
2
|
+
import { NodeShape } from '../shapes/SHACL.js';
|
|
3
|
+
import { LinkedQuery } from './SelectQuery.js';
|
|
2
4
|
import { AddId, NodeDescriptionValue, UpdatePartial } from './QueryFactory.js';
|
|
3
5
|
import { MutationQueryFactory } from './MutationQuery.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type CreateQuery = IRCreateMutation;
|
|
6
|
+
export interface CreateQuery<ResponseType = null> extends LinkedQuery {
|
|
7
|
+
type: 'create';
|
|
8
|
+
shape: NodeShape;
|
|
9
|
+
description: NodeDescriptionValue;
|
|
10
|
+
}
|
|
10
11
|
export type CreateResponse<U> = AddId<U, true>;
|
|
11
12
|
export declare class CreateQueryFactory<ShapeType extends Shape, U extends UpdatePartial<ShapeType>> extends MutationQueryFactory {
|
|
12
13
|
shapeClass: typeof Shape;
|
|
13
14
|
readonly id: string;
|
|
14
15
|
readonly description: NodeDescriptionValue;
|
|
15
16
|
constructor(shapeClass: typeof Shape, updateObjectOrFn: U);
|
|
16
|
-
|
|
17
|
+
getQueryObject(): CreateQuery<AddId<U, true>>;
|
|
17
18
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateQueryFactory = void 0;
|
|
4
4
|
const MutationQuery_js_1 = require("./MutationQuery.js");
|
|
5
|
-
const IRMutation_js_1 = require("./IRMutation.js");
|
|
6
5
|
class CreateQueryFactory extends MutationQuery_js_1.MutationQueryFactory {
|
|
7
6
|
constructor(shapeClass, updateObjectOrFn) {
|
|
8
7
|
super();
|
|
9
8
|
this.shapeClass = shapeClass;
|
|
10
9
|
this.description = this.convertUpdateObject(updateObjectOrFn, this.shapeClass.shape, true);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
return
|
|
11
|
+
getQueryObject() {
|
|
12
|
+
return {
|
|
13
|
+
type: 'create',
|
|
14
14
|
shape: this.shapeClass.shape,
|
|
15
15
|
description: this.description,
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.CreateQueryFactory = CreateQueryFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateQuery.js","sourceRoot":"","sources":["../../../src/queries/CreateQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CreateQuery.js","sourceRoot":"","sources":["../../../src/queries/CreateQuery.ts"],"names":[],"mappings":";;;AAIA,yDAAwD;AAUxD,MAAa,kBAGX,SAAQ,uCAAoB;IAI5B,YACS,UAAwB,EAC/B,gBAAmB;QAEnB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAAc;QAI/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CACzC,gBAAgB,EAChB,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,cAAc;QACZ,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;CACF;AA1BD,gDA0BC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Shape } from '../shapes/Shape.js';
|
|
2
|
+
import { NodeShape } from '../shapes/SHACL.js';
|
|
3
|
+
import { LinkedQuery } from './SelectQuery.js';
|
|
2
4
|
import { NodeReferenceValue, UpdatePartial } from './QueryFactory.js';
|
|
3
5
|
import { MutationQueryFactory, NodeId } from './MutationQuery.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type DeleteQuery = IRDeleteMutation;
|
|
6
|
+
export interface DeleteQuery extends LinkedQuery {
|
|
7
|
+
type: 'delete';
|
|
8
|
+
shape: NodeShape;
|
|
9
|
+
ids: NodeReferenceValue[];
|
|
10
|
+
}
|
|
10
11
|
export type DeleteResponse = {
|
|
11
12
|
/**
|
|
12
13
|
* The IDs of the items that were successfully deleted.
|
|
@@ -30,5 +31,5 @@ export declare class DeleteQueryFactory<ShapeType extends Shape, U extends Updat
|
|
|
30
31
|
readonly id: string;
|
|
31
32
|
readonly ids: NodeReferenceValue[];
|
|
32
33
|
constructor(shapeClass: typeof Shape, ids: NodeId[] | NodeId);
|
|
33
|
-
|
|
34
|
+
getQueryObject(): DeleteQuery;
|
|
34
35
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteQueryFactory = void 0;
|
|
4
4
|
const MutationQuery_js_1 = require("./MutationQuery.js");
|
|
5
|
-
const IRMutation_js_1 = require("./IRMutation.js");
|
|
6
5
|
class DeleteQueryFactory extends MutationQuery_js_1.MutationQueryFactory {
|
|
7
6
|
constructor(shapeClass, ids) {
|
|
8
7
|
super();
|
|
9
8
|
this.shapeClass = shapeClass;
|
|
10
9
|
this.ids = this.convertNodeReferences(ids);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
return
|
|
11
|
+
getQueryObject() {
|
|
12
|
+
return {
|
|
13
|
+
type: 'delete',
|
|
14
14
|
shape: this.shapeClass.shape,
|
|
15
15
|
ids: this.ids,
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.DeleteQueryFactory = DeleteQueryFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":";;;AAIA,yDAAgE;AA2BhE,MAAa,kBAGX,SAAQ,uCAAoB;IAI5B,YACS,UAAwB,EAC/B,GAAsB;QAEtB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAAc;QAI/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc;QACZ,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;CACF;AAtBD,gDAsBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LinkedQuery } from './SelectQuery.js';
|
|
1
2
|
import { NodeShape, PropertyShape } from '../shapes/SHACL.js';
|
|
2
3
|
import { Shape } from '../shapes/Shape.js';
|
|
3
4
|
import { ShapeSet } from '../collections/ShapeSet.js';
|
|
@@ -75,6 +76,7 @@ export type ShapeReferenceValue = {
|
|
|
75
76
|
export { toNodeReference } from '../utils/NodeReference.js';
|
|
76
77
|
export type { NodeReferenceValue };
|
|
77
78
|
export declare abstract class QueryFactory {
|
|
79
|
+
getQueryObject(): LinkedQuery | Promise<LinkedQuery>;
|
|
78
80
|
}
|
|
79
81
|
export declare function isSetModificationValue(value: any): value is SetModificationValue;
|
|
80
82
|
/**
|
|
@@ -6,6 +6,9 @@ exports.checkNewCount = checkNewCount;
|
|
|
6
6
|
var NodeReference_js_1 = require("../utils/NodeReference.js");
|
|
7
7
|
Object.defineProperty(exports, "toNodeReference", { enumerable: true, get: function () { return NodeReference_js_1.toNodeReference; } });
|
|
8
8
|
class QueryFactory {
|
|
9
|
+
getQueryObject() {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
exports.QueryFactory = QueryFactory;
|
|
11
14
|
function isSetModificationValue(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryFactory.js","sourceRoot":"","sources":["../../../src/queries/QueryFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"QueryFactory.js","sourceRoot":"","sources":["../../../src/queries/QueryFactory.ts"],"names":[],"mappings":";;;AA6OA,wDAcC;AAQD,sCAeC;AA9CD,8DAA0D;AAAlD,mHAAA,eAAe,OAAA;AAGvB,MAAsB,YAAY;IAChC,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAJD,oCAIC;AAED,SAAgB,sBAAsB,CACpC,KAAU;IAEV,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/C,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC3B,IAAI,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC;IACjC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACxC,mBAAmB;IACnB,OAAO,CACL,CAAC,SAAS,IAAI,YAAY,IAAI,OAAO,KAAK,CAAC,CAAC;QAC5C,CAAC,SAAS,IAAI,OAAO,KAAK,CAAC,CAAC;QAC5B,CAAC,YAAY,IAAI,OAAO,KAAK,CAAC,CAAC,CAChC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,SAAwB,EAAE,SAAiB;IACvE,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,IAAI,SAAS,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACb,iCAAiC,SAAS,CAAC,KAAK,mBAAmB,SAAS,CAAC,QAAQ,4BAA4B,SAAS,EAAE,CAC7H,CAAC;QACJ,CAAC;IACH,CAAC;IACD,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,IAAI,SAAS,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACb,gCAAgC,SAAS,CAAC,KAAK,mBAAmB,SAAS,CAAC,QAAQ,4BAA4B,SAAS,EAAE,CAC5H,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { GetQueryResponseType, QueryResponseToResultType, SelectQueryFactory } from './SelectQuery.js';
|
|
2
2
|
import { AddId, NodeReferenceValue, UpdatePartial } from './QueryFactory.js';
|
|
3
|
-
import
|
|
3
|
+
import { Shape } from '../shapes/Shape.js';
|
|
4
4
|
import { CreateResponse } from './CreateQuery.js';
|
|
5
5
|
import { DeleteResponse } from './DeleteQuery.js';
|
|
6
6
|
import { NodeId } from './MutationQuery.js';
|
|
7
|
-
/**
|
|
8
|
-
* Bridges the DSL layer (Shape.select/create/update/delete) to the storage
|
|
9
|
-
* layer (LinkedStorage → IQuadStore). Each method builds the IR from a
|
|
10
|
-
* factory and routes it to the appropriate store.
|
|
11
|
-
*/
|
|
12
7
|
export declare class QueryParser {
|
|
13
8
|
static selectQuery<ShapeType extends Shape, ResponseType, Source, ResultType = QueryResponseToResultType<GetQueryResponseType<SelectQueryFactory<ShapeType, ResponseType>>, ShapeType>[]>(query: SelectQueryFactory<ShapeType, ResponseType, Source>): Promise<ResultType>;
|
|
14
9
|
static updateQuery<ShapeType extends Shape, U extends UpdatePartial<ShapeType>>(id: string | NodeReferenceValue, updateObjectOrFn: U, shapeClass: typeof Shape): Promise<AddId<U>>;
|