@_linked/core 2.0.0 → 2.0.1
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 +27 -0
- package/README.md +50 -24
- package/lib/cjs/queries/DeleteBuilder.d.ts +17 -20
- package/lib/cjs/queries/DeleteBuilder.js +46 -19
- package/lib/cjs/queries/DeleteBuilder.js.map +1 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +2 -2
- package/lib/cjs/queries/DeleteQuery.js.map +1 -1
- package/lib/cjs/queries/IRCanonicalize.d.ts +9 -2
- package/lib/cjs/queries/IRCanonicalize.js +6 -1
- package/lib/cjs/queries/IRCanonicalize.js.map +1 -1
- package/lib/cjs/queries/IRDesugar.d.ts +19 -0
- package/lib/cjs/queries/IRDesugar.js +15 -9
- package/lib/cjs/queries/IRDesugar.js.map +1 -1
- package/lib/cjs/queries/IRLower.d.ts +10 -2
- package/lib/cjs/queries/IRLower.js +104 -2
- package/lib/cjs/queries/IRLower.js.map +1 -1
- package/lib/cjs/queries/IRMutation.d.ts +21 -1
- package/lib/cjs/queries/IRMutation.js +30 -1
- package/lib/cjs/queries/IRMutation.js.map +1 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +24 -2
- package/lib/cjs/queries/QueryBuilder.d.ts +14 -1
- package/lib/cjs/queries/QueryBuilder.js +59 -2
- package/lib/cjs/queries/QueryBuilder.js.map +1 -1
- package/lib/cjs/queries/UpdateBuilder.d.ts +20 -13
- package/lib/cjs/queries/UpdateBuilder.js +61 -11
- package/lib/cjs/queries/UpdateBuilder.js.map +1 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +2 -2
- package/lib/cjs/shapes/Shape.d.ts +6 -2
- package/lib/cjs/shapes/Shape.js +9 -5
- package/lib/cjs/shapes/Shape.js.map +1 -1
- package/lib/cjs/sparql/SparqlStore.js +15 -0
- package/lib/cjs/sparql/SparqlStore.js.map +1 -1
- package/lib/cjs/sparql/irToAlgebra.d.ts +34 -3
- package/lib/cjs/sparql/irToAlgebra.js +294 -35
- package/lib/cjs/sparql/irToAlgebra.js.map +1 -1
- package/lib/cjs/test-helpers/query-fixtures.d.ts +1464 -16
- package/lib/cjs/test-helpers/query-fixtures.js +31 -2
- package/lib/cjs/test-helpers/query-fixtures.js.map +1 -1
- package/lib/esm/queries/DeleteBuilder.d.ts +17 -20
- package/lib/esm/queries/DeleteBuilder.js +46 -19
- package/lib/esm/queries/DeleteBuilder.js.map +1 -1
- package/lib/esm/queries/DeleteQuery.d.ts +2 -2
- package/lib/esm/queries/DeleteQuery.js.map +1 -1
- package/lib/esm/queries/IRCanonicalize.d.ts +9 -2
- package/lib/esm/queries/IRCanonicalize.js +6 -1
- package/lib/esm/queries/IRCanonicalize.js.map +1 -1
- package/lib/esm/queries/IRDesugar.d.ts +19 -0
- package/lib/esm/queries/IRDesugar.js +7 -2
- package/lib/esm/queries/IRDesugar.js.map +1 -1
- package/lib/esm/queries/IRLower.d.ts +10 -2
- package/lib/esm/queries/IRLower.js +102 -1
- package/lib/esm/queries/IRLower.js.map +1 -1
- package/lib/esm/queries/IRMutation.d.ts +21 -1
- package/lib/esm/queries/IRMutation.js +26 -0
- package/lib/esm/queries/IRMutation.js.map +1 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +24 -2
- package/lib/esm/queries/QueryBuilder.d.ts +14 -1
- package/lib/esm/queries/QueryBuilder.js +59 -2
- package/lib/esm/queries/QueryBuilder.js.map +1 -1
- package/lib/esm/queries/UpdateBuilder.d.ts +20 -13
- package/lib/esm/queries/UpdateBuilder.js +61 -11
- package/lib/esm/queries/UpdateBuilder.js.map +1 -1
- package/lib/esm/queries/UpdateQuery.d.ts +2 -2
- package/lib/esm/shapes/Shape.d.ts +6 -2
- package/lib/esm/shapes/Shape.js +9 -5
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/sparql/SparqlStore.js +16 -1
- package/lib/esm/sparql/SparqlStore.js.map +1 -1
- package/lib/esm/sparql/irToAlgebra.d.ts +34 -3
- package/lib/esm/sparql/irToAlgebra.js +288 -35
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/lib/esm/test-helpers/query-fixtures.d.ts +1464 -16
- package/lib/esm/test-helpers/query-fixtures.js +31 -2
- package/lib/esm/test-helpers/query-fixtures.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#27](https://github.com/Semantu/linked/pull/27) [`d3c1e91`](https://github.com/Semantu/linked/commit/d3c1e918b2a63240ddbf3cb550ec43fa1e019c35) Thanks [@flyon](https://github.com/flyon)! - Add MINUS support on QueryBuilder with multiple call styles:
|
|
8
|
+
|
|
9
|
+
- `.minus(Shape)` — exclude by shape type
|
|
10
|
+
- `.minus(p => p.prop.equals(val))` — exclude by condition
|
|
11
|
+
- `.minus(p => p.prop)` — exclude by property existence
|
|
12
|
+
- `.minus(p => [p.prop1, p.nested.prop2])` — exclude by multi-property existence with nested path support
|
|
13
|
+
|
|
14
|
+
Add bulk delete operations:
|
|
15
|
+
|
|
16
|
+
- `Shape.deleteAll()` / `DeleteBuilder.from(Shape).all()` — delete all instances with schema-aware blank node cleanup
|
|
17
|
+
- `Shape.deleteWhere(fn)` / `DeleteBuilder.from(Shape).where(fn)` — conditional delete
|
|
18
|
+
|
|
19
|
+
Add conditional update operations:
|
|
20
|
+
|
|
21
|
+
- `.update(data).where(fn)` — update matching instances
|
|
22
|
+
- `.update(data).forAll()` — update all instances
|
|
23
|
+
|
|
24
|
+
API cleanup:
|
|
25
|
+
|
|
26
|
+
- Deprecate `sortBy()` in favor of `orderBy()`
|
|
27
|
+
- Remove `DeleteBuilder.for()` — use `DeleteBuilder.from(shape, ids)` instead
|
|
28
|
+
- Require `data` parameter in `Shape.update(data)`
|
|
29
|
+
|
|
3
30
|
## 2.0.0
|
|
4
31
|
|
|
5
32
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -246,9 +246,7 @@ const allFriends = await Person.select((p) => p.knows.selectAll());
|
|
|
246
246
|
|
|
247
247
|
**3) Apply a simple mutation**
|
|
248
248
|
```typescript
|
|
249
|
-
const updated = await Person.update({
|
|
250
|
-
name: 'Alicia',
|
|
251
|
-
}).for({id: 'https://my.app/node1'});
|
|
249
|
+
const updated = await Person.update({name: 'Alicia'}).for({id: 'https://my.app/node1'});
|
|
252
250
|
/* updated: {id: string} & UpdatePartial<Person> */
|
|
253
251
|
```
|
|
254
252
|
|
|
@@ -291,10 +289,11 @@ The query DSL is schema-parameterized: you define your own SHACL shapes, and Lin
|
|
|
291
289
|
- Counting with `.size()`
|
|
292
290
|
- Custom result formats (object mapping)
|
|
293
291
|
- Type casting with `.as(Shape)`
|
|
292
|
+
- MINUS exclusion (by shape, property, condition, multi-property, nested path)
|
|
294
293
|
- Sorting, limiting, and `.one()`
|
|
295
294
|
- Query context variables
|
|
296
295
|
- Preloading (`preloadFor`) for component-like queries
|
|
297
|
-
- Create / Update / Delete mutations
|
|
296
|
+
- Create / Update / Delete mutations (including bulk and conditional)
|
|
298
297
|
- Dynamic query building with `QueryBuilder`
|
|
299
298
|
- Composable field sets with `FieldSet`
|
|
300
299
|
- Mutation builders (`CreateBuilder`, `UpdateBuilder`, `DeleteBuilder`)
|
|
@@ -410,9 +409,27 @@ And you want to select properties of those pets that are dogs:
|
|
|
410
409
|
const guards = await Person.select((p) => p.pets.as(Dog).guardDogLevel);
|
|
411
410
|
```
|
|
412
411
|
|
|
412
|
+
#### MINUS (exclusion)
|
|
413
|
+
```typescript
|
|
414
|
+
// Exclude by shape — all Persons that are NOT also Employees
|
|
415
|
+
const nonEmployees = await Person.select((p) => p.name).minus(Employee);
|
|
416
|
+
|
|
417
|
+
// Exclude by property existence — Persons that do NOT have a hobby
|
|
418
|
+
const noHobby = await Person.select((p) => p.name).minus((p) => p.hobby);
|
|
419
|
+
|
|
420
|
+
// Exclude by multiple properties — Persons missing BOTH hobby AND nickNames
|
|
421
|
+
const sparse = await Person.select((p) => p.name).minus((p) => [p.hobby, p.nickNames]);
|
|
422
|
+
|
|
423
|
+
// Exclude by nested path — Persons whose bestFriend does NOT have a name
|
|
424
|
+
const unnamed = await Person.select((p) => p.name).minus((p) => [p.bestFriend.name]);
|
|
425
|
+
|
|
426
|
+
// Exclude by condition — Persons whose hobby is NOT 'Chess'
|
|
427
|
+
const noChess = await Person.select((p) => p.name).minus((p) => p.hobby.equals('Chess'));
|
|
428
|
+
```
|
|
429
|
+
|
|
413
430
|
#### Sorting, limiting, one
|
|
414
431
|
```typescript
|
|
415
|
-
const sorted = await Person.select((p) => p.name).
|
|
432
|
+
const sorted = await Person.select((p) => p.name).orderBy((p) => p.name, 'ASC');
|
|
416
433
|
const limited = await Person.select((p) => p.name).limit(1);
|
|
417
434
|
const single = await Person.select((p) => p.name).one();
|
|
418
435
|
```
|
|
@@ -447,8 +464,10 @@ Where UpdatePartial<Shape> reflects the created properties.
|
|
|
447
464
|
|
|
448
465
|
#### Update
|
|
449
466
|
|
|
450
|
-
Update will patch any property that you send as payload and leave the rest untouched.
|
|
467
|
+
Update will patch any property that you send as payload and leave the rest untouched. The data to update is required:
|
|
468
|
+
|
|
451
469
|
```typescript
|
|
470
|
+
// Target a specific entity with .for(id)
|
|
452
471
|
/* Result: {id: string} & UpdatePartial<Person> */
|
|
453
472
|
const updated = await Person.update({name: 'Alicia'}).for({id: 'https://my.app/node1'});
|
|
454
473
|
```
|
|
@@ -460,6 +479,15 @@ Returns:
|
|
|
460
479
|
}
|
|
461
480
|
```
|
|
462
481
|
|
|
482
|
+
**Conditional and bulk updates:**
|
|
483
|
+
```typescript
|
|
484
|
+
// Update all matching entities
|
|
485
|
+
const archived = await Person.update({status: 'archived'}).where(p => p.status.equals('inactive'));
|
|
486
|
+
|
|
487
|
+
// Update all instances of a shape
|
|
488
|
+
await Person.update({verified: true}).forAll();
|
|
489
|
+
```
|
|
490
|
+
|
|
463
491
|
**Updating multi-value properties**
|
|
464
492
|
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.
|
|
465
493
|
|
|
@@ -503,27 +531,19 @@ This returns an object with the added and removed items
|
|
|
503
531
|
|
|
504
532
|
|
|
505
533
|
#### Delete
|
|
506
|
-
To delete a node entirely:
|
|
507
534
|
|
|
508
535
|
```typescript
|
|
509
|
-
|
|
536
|
+
// Delete a single node
|
|
510
537
|
const deleted = await Person.delete({id: 'https://my.app/node1'});
|
|
511
|
-
```
|
|
512
|
-
Returns
|
|
513
|
-
```json
|
|
514
|
-
{
|
|
515
|
-
deleted:[
|
|
516
|
-
{id:"https://my.app/node1"}
|
|
517
|
-
],
|
|
518
|
-
count:1
|
|
519
|
-
}
|
|
520
|
-
```
|
|
521
538
|
|
|
522
|
-
|
|
539
|
+
// Delete multiple nodes
|
|
540
|
+
const deleted = await Person.delete([{id: 'https://my.app/node1'}, {id: 'https://my.app/node2'}]);
|
|
523
541
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
542
|
+
// Delete all instances of a shape (with blank node cleanup)
|
|
543
|
+
await Person.deleteAll();
|
|
544
|
+
|
|
545
|
+
// Conditional delete
|
|
546
|
+
await Person.deleteWhere(p => p.status.equals('inactive'));
|
|
527
547
|
```
|
|
528
548
|
|
|
529
549
|
|
|
@@ -716,8 +736,14 @@ const updated = await UpdateBuilder.from(Person)
|
|
|
716
736
|
.for({id: 'https://my.app/alice'})
|
|
717
737
|
.set({name: 'Alicia'});
|
|
718
738
|
|
|
719
|
-
// Delete — equivalent to Person.delete({id: '...'})
|
|
720
|
-
const deleted = await DeleteBuilder.from(Person
|
|
739
|
+
// Delete by ID — equivalent to Person.delete({id: '...'})
|
|
740
|
+
const deleted = await DeleteBuilder.from(Person, {id: 'https://my.app/alice'});
|
|
741
|
+
|
|
742
|
+
// Delete all — equivalent to Person.deleteAll()
|
|
743
|
+
await DeleteBuilder.from(Person).all();
|
|
744
|
+
|
|
745
|
+
// Conditional update — equivalent to Person.update({...}).where(fn)
|
|
746
|
+
await UpdateBuilder.from(Person).set({verified: true}).forAll();
|
|
721
747
|
|
|
722
748
|
// All builders are PromiseLike — await them or call .build() for the IR
|
|
723
749
|
const ir = CreateBuilder.from(Person).set({name: 'Alice'}).build();
|
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import { Shape, ShapeConstructor } from '../shapes/Shape.js';
|
|
2
2
|
import { DeleteQuery, DeleteResponse } from './DeleteQuery.js';
|
|
3
3
|
import { NodeId } from './MutationQuery.js';
|
|
4
|
+
import { WhereClause } from './SelectQuery.js';
|
|
4
5
|
/**
|
|
5
6
|
* An immutable, fluent builder for delete mutations.
|
|
6
7
|
*
|
|
7
8
|
* Implements PromiseLike so mutations execute on `await`:
|
|
8
9
|
* ```ts
|
|
9
|
-
* const result = await DeleteBuilder.from(Person
|
|
10
|
+
* const result = await DeleteBuilder.from(Person, {id: '...'});
|
|
11
|
+
* await DeleteBuilder.from(Person).all(); // returns void
|
|
10
12
|
* ```
|
|
11
13
|
*
|
|
12
|
-
*
|
|
14
|
+
* R is the resolved type: DeleteResponse for ID-based, void for bulk operations.
|
|
13
15
|
*/
|
|
14
|
-
export declare class DeleteBuilder<S extends Shape = Shape> implements PromiseLike<
|
|
16
|
+
export declare class DeleteBuilder<S extends Shape = Shape, R = DeleteResponse> implements PromiseLike<R>, Promise<R> {
|
|
15
17
|
private readonly _shape;
|
|
16
18
|
private readonly _ids?;
|
|
19
|
+
private readonly _mode?;
|
|
20
|
+
private readonly _whereFn?;
|
|
17
21
|
private constructor();
|
|
18
22
|
private clone;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* DeleteBuilder.from(Person, {id: '...'}) // also supported
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?: NodeId | NodeId[]): DeleteBuilder<S>;
|
|
29
|
-
/** Specify the target IDs to delete. */
|
|
30
|
-
for(ids: NodeId | NodeId[]): DeleteBuilder<S>;
|
|
31
|
-
/** Build the IR mutation. Throws if no IDs were specified via .for(). */
|
|
23
|
+
static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?: NodeId | NodeId[]): DeleteBuilder<S, DeleteResponse>;
|
|
24
|
+
/** Delete all instances of this shape type. Returns void. */
|
|
25
|
+
all(): DeleteBuilder<S, void>;
|
|
26
|
+
/** Delete instances matching a condition. Returns void. */
|
|
27
|
+
where(fn: WhereClause<S>): DeleteBuilder<S, void>;
|
|
28
|
+
/** Build the IR mutation. */
|
|
32
29
|
build(): DeleteQuery;
|
|
33
30
|
/** Execute the mutation. */
|
|
34
|
-
exec(): Promise<
|
|
35
|
-
then<TResult1 =
|
|
36
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<
|
|
37
|
-
finally(onfinally?: (() => void) | null): Promise<
|
|
31
|
+
exec(): Promise<R>;
|
|
32
|
+
then<TResult1 = R, TResult2 = never>(onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
33
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<R | TResult>;
|
|
34
|
+
finally(onfinally?: (() => void) | null): Promise<R>;
|
|
38
35
|
get [Symbol.toStringTag](): string;
|
|
39
36
|
}
|
|
@@ -4,65 +4,92 @@ exports.DeleteBuilder = void 0;
|
|
|
4
4
|
const resolveShape_js_1 = require("./resolveShape.js");
|
|
5
5
|
const DeleteQuery_js_1 = require("./DeleteQuery.js");
|
|
6
6
|
const queryDispatch_js_1 = require("./queryDispatch.js");
|
|
7
|
+
const SelectQuery_js_1 = require("./SelectQuery.js");
|
|
8
|
+
const IRMutation_js_1 = require("./IRMutation.js");
|
|
9
|
+
const IRDesugar_js_1 = require("./IRDesugar.js");
|
|
10
|
+
const IRCanonicalize_js_1 = require("./IRCanonicalize.js");
|
|
11
|
+
const IRLower_js_1 = require("./IRLower.js");
|
|
7
12
|
/**
|
|
8
13
|
* An immutable, fluent builder for delete mutations.
|
|
9
14
|
*
|
|
10
15
|
* Implements PromiseLike so mutations execute on `await`:
|
|
11
16
|
* ```ts
|
|
12
|
-
* const result = await DeleteBuilder.from(Person
|
|
17
|
+
* const result = await DeleteBuilder.from(Person, {id: '...'});
|
|
18
|
+
* await DeleteBuilder.from(Person).all(); // returns void
|
|
13
19
|
* ```
|
|
14
20
|
*
|
|
15
|
-
*
|
|
21
|
+
* R is the resolved type: DeleteResponse for ID-based, void for bulk operations.
|
|
16
22
|
*/
|
|
17
23
|
class DeleteBuilder {
|
|
18
24
|
constructor(init) {
|
|
19
25
|
this._shape = init.shape;
|
|
20
26
|
this._ids = init.ids;
|
|
27
|
+
this._mode = init.mode;
|
|
28
|
+
this._whereFn = init.whereFn;
|
|
21
29
|
}
|
|
22
30
|
clone(overrides = {}) {
|
|
23
|
-
return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids }, overrides));
|
|
31
|
+
return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids, mode: this._mode, whereFn: this._whereFn }, overrides));
|
|
24
32
|
}
|
|
25
33
|
// ---------------------------------------------------------------------------
|
|
26
34
|
// Static constructors
|
|
27
35
|
// ---------------------------------------------------------------------------
|
|
28
|
-
/**
|
|
29
|
-
* Create a DeleteBuilder for the given shape.
|
|
30
|
-
*
|
|
31
|
-
* Optionally accepts IDs inline for backwards compatibility:
|
|
32
|
-
* ```ts
|
|
33
|
-
* DeleteBuilder.from(Person).for({id: '...'}) // preferred
|
|
34
|
-
* DeleteBuilder.from(Person, {id: '...'}) // also supported
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
36
|
static from(shape, ids) {
|
|
38
37
|
const resolved = (0, resolveShape_js_1.resolveShape)(shape);
|
|
39
38
|
if (ids !== undefined) {
|
|
40
39
|
const idsArray = Array.isArray(ids) ? ids : [ids];
|
|
41
|
-
return new DeleteBuilder({ shape: resolved, ids: idsArray });
|
|
40
|
+
return new DeleteBuilder({ shape: resolved, ids: idsArray, mode: 'ids' });
|
|
42
41
|
}
|
|
43
42
|
return new DeleteBuilder({ shape: resolved });
|
|
44
43
|
}
|
|
45
44
|
// ---------------------------------------------------------------------------
|
|
46
45
|
// Fluent API
|
|
47
46
|
// ---------------------------------------------------------------------------
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
/** Delete all instances of this shape type. Returns void. */
|
|
48
|
+
all() {
|
|
49
|
+
return this.clone({ mode: 'all', ids: undefined, whereFn: undefined });
|
|
50
|
+
}
|
|
51
|
+
/** Delete instances matching a condition. Returns void. */
|
|
52
|
+
where(fn) {
|
|
53
|
+
return this.clone({ mode: 'where', whereFn: fn, ids: undefined });
|
|
52
54
|
}
|
|
53
55
|
// ---------------------------------------------------------------------------
|
|
54
56
|
// Build & execute
|
|
55
57
|
// ---------------------------------------------------------------------------
|
|
56
|
-
/** Build the IR mutation.
|
|
58
|
+
/** Build the IR mutation. */
|
|
57
59
|
build() {
|
|
60
|
+
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
61
|
+
if (mode === 'all') {
|
|
62
|
+
return (0, IRMutation_js_1.buildCanonicalDeleteAllMutationIR)({
|
|
63
|
+
shape: this._shape.shape,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (mode === 'where') {
|
|
67
|
+
if (!this._whereFn) {
|
|
68
|
+
throw new Error('DeleteBuilder.where() requires a condition callback.');
|
|
69
|
+
}
|
|
70
|
+
const wherePath = (0, SelectQuery_js_1.processWhereClause)(this._whereFn, this._shape);
|
|
71
|
+
const desugared = (0, IRDesugar_js_1.toWhere)(wherePath);
|
|
72
|
+
const canonical = (0, IRCanonicalize_js_1.canonicalizeWhere)(desugared);
|
|
73
|
+
const { where, wherePatterns } = (0, IRLower_js_1.lowerWhereToIR)(canonical);
|
|
74
|
+
return (0, IRMutation_js_1.buildCanonicalDeleteWhereMutationIR)({
|
|
75
|
+
shape: this._shape.shape,
|
|
76
|
+
where,
|
|
77
|
+
wherePatterns,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Default: ID-based delete
|
|
58
81
|
if (!this._ids || this._ids.length === 0) {
|
|
59
|
-
throw new Error('DeleteBuilder requires at least one ID to delete.
|
|
82
|
+
throw new Error('DeleteBuilder requires at least one ID to delete. Use DeleteBuilder.from(shape, ids), .all(), or .where().');
|
|
60
83
|
}
|
|
61
84
|
const factory = new DeleteQuery_js_1.DeleteQueryFactory(this._shape, this._ids);
|
|
62
85
|
return factory.build();
|
|
63
86
|
}
|
|
64
87
|
/** Execute the mutation. */
|
|
65
88
|
exec() {
|
|
89
|
+
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
90
|
+
if (mode === 'all' || mode === 'where') {
|
|
91
|
+
return (0, queryDispatch_js_1.getQueryDispatch)().deleteQuery(this.build()).then(() => undefined);
|
|
92
|
+
}
|
|
66
93
|
return (0, queryDispatch_js_1.getQueryDispatch)().deleteQuery(this.build());
|
|
67
94
|
}
|
|
68
95
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AAC/C,qDAAiF;AAEjF,yDAAoD;
|
|
1
|
+
{"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":";;;AACA,uDAA+C;AAC/C,qDAAiF;AAEjF,yDAAoD;AACpD,qDAAiE;AACjE,mDAGyB;AACzB,iDAAuC;AACvC,2DAAsD;AACtD,6CAA4C;AAc5C;;;;;;;;;;GAUG;AACH,MAAa,a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|
1
1
|
import { Shape, ShapeConstructor } from '../shapes/Shape.js';
|
|
2
2
|
import { NodeReferenceValue, UpdatePartial } from './QueryFactory.js';
|
|
3
3
|
import { MutationQueryFactory, NodeId } from './MutationQuery.js';
|
|
4
|
-
import { IRDeleteMutation } from './IntermediateRepresentation.js';
|
|
4
|
+
import { IRDeleteMutation, IRDeleteAllMutation, IRDeleteWhereMutation } from './IntermediateRepresentation.js';
|
|
5
5
|
/**
|
|
6
6
|
* The canonical DeleteQuery type — an IR AST node representing a delete mutation.
|
|
7
7
|
* This is the type received by IQuadStore.deleteQuery().
|
|
8
8
|
*/
|
|
9
|
-
export type DeleteQuery = IRDeleteMutation;
|
|
9
|
+
export type DeleteQuery = IRDeleteMutation | IRDeleteAllMutation | IRDeleteWhereMutation;
|
|
10
10
|
export type DeleteResponse = {
|
|
11
11
|
/**
|
|
12
12
|
* The IDs of the items that were successfully deleted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":";;;AAEA,yDAAgE;
|
|
1
|
+
{"version":3,"file":"DeleteQuery.js","sourceRoot":"","sources":["../../../src/queries/DeleteQuery.ts"],"names":[],"mappings":";;;AAEA,yDAAgE;AAMhE,mDAA+D;AA2B/D,MAAa,kBAGX,SAAQ,uCAAoB;IAI5B,YACS,UAAuC,EAC9C,GAAsB;QAEtB,KAAK,EAAE,CAAC;QAHD,eAAU,GAAV,UAAU,CAA6B;QAI9C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACH,OAAO,IAAA,8CAA8B,EAAC;YACpC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAC;IACL,CAAC;CACF;AArBD,gDAqBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesugaredSelectionPath, DesugaredSelectQuery, DesugaredWhere, DesugaredWhereArg } from './IRDesugar.js';
|
|
1
|
+
import { DesugaredSelectionPath, DesugaredSelectQuery, DesugaredWhere, DesugaredWhereArg, PropertyPathSegment } from './IRDesugar.js';
|
|
2
2
|
import { WhereMethods } from './SelectQuery.js';
|
|
3
3
|
export type CanonicalWhereComparison = {
|
|
4
4
|
kind: 'where_binary';
|
|
@@ -21,8 +21,15 @@ export type CanonicalWhereNot = {
|
|
|
21
21
|
expression: CanonicalWhereExpression;
|
|
22
22
|
};
|
|
23
23
|
export type CanonicalWhereExpression = CanonicalWhereComparison | CanonicalWhereLogical | CanonicalWhereExists | CanonicalWhereNot;
|
|
24
|
-
|
|
24
|
+
/** A canonicalized MINUS entry. */
|
|
25
|
+
export type CanonicalMinusEntry = {
|
|
26
|
+
shapeId?: string;
|
|
25
27
|
where?: CanonicalWhereExpression;
|
|
28
|
+
propertyPaths?: PropertyPathSegment[][];
|
|
29
|
+
};
|
|
30
|
+
export type CanonicalDesugaredSelectQuery = Omit<DesugaredSelectQuery, 'where' | 'minusEntries'> & {
|
|
31
|
+
where?: CanonicalWhereExpression;
|
|
32
|
+
minusEntries?: CanonicalMinusEntry[];
|
|
26
33
|
};
|
|
27
34
|
/**
|
|
28
35
|
* Recursively rewrites a desugared where-clause into canonical form:
|
|
@@ -115,7 +115,12 @@ exports.canonicalizeWhere = canonicalizeWhere;
|
|
|
115
115
|
* All other fields pass through unchanged.
|
|
116
116
|
*/
|
|
117
117
|
const canonicalizeDesugaredSelectQuery = (query) => {
|
|
118
|
-
|
|
118
|
+
var _a;
|
|
119
|
+
return Object.assign(Object.assign({}, query), { where: query.where ? (0, exports.canonicalizeWhere)(query.where) : undefined, minusEntries: (_a = query.minusEntries) === null || _a === void 0 ? void 0 : _a.map((entry) => ({
|
|
120
|
+
shapeId: entry.shapeId,
|
|
121
|
+
where: entry.where ? (0, exports.canonicalizeWhere)(entry.where) : undefined,
|
|
122
|
+
propertyPaths: entry.propertyPaths,
|
|
123
|
+
})) });
|
|
119
124
|
};
|
|
120
125
|
exports.canonicalizeDesugaredSelectQuery = canonicalizeDesugaredSelectQuery;
|
|
121
126
|
//# sourceMappingURL=IRCanonicalize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRCanonicalize.js","sourceRoot":"","sources":["../../../src/queries/IRCanonicalize.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"IRCanonicalize.js","sourceRoot":"","sources":["../../../src/queries/IRCanonicalize.ts"],"names":[],"mappings":";;;AASA,qDAA8C;AA4C9C,MAAM,YAAY,GAAG,CACnB,UAAoC,EACV,EAAE;IAC5B,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK,EAAE,UAAU,CAAC,KAAK;KACxB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,GAAsB,EAAyB,EAAE;IACzE,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,CAAC,CAAC,GAAG;QACL,MAAM,IAAI,GAAG;QACb,CAAE,GAAsB,CAAC,IAAI,KAAK,kBAAkB;YACjD,GAAsB,CAAC,IAAI,KAAK,eAAe,CAAC,CACpD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CACf,UAAoC,EACV,EAAE;IAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,QAAQ,KAAK,6BAAY,CAAC,IAAI,EAAE,CAAC;QAC9C,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|
7
|
+
/** A single segment in a property path (used for MINUS property existence). */
|
|
8
|
+
export type PropertyPathSegment = {
|
|
9
|
+
propertyShapeId: string;
|
|
10
|
+
};
|
|
11
|
+
/** A raw MINUS entry before desugaring. */
|
|
12
|
+
export type RawMinusEntry = {
|
|
13
|
+
shapeId?: string;
|
|
14
|
+
where?: WherePath;
|
|
15
|
+
propertyPaths?: PropertyPathSegment[][];
|
|
16
|
+
};
|
|
7
17
|
export type RawSelectInput = {
|
|
8
18
|
entries: readonly FieldSetEntry[];
|
|
9
19
|
where?: WherePath;
|
|
@@ -19,6 +29,7 @@ export type RawSelectInput = {
|
|
|
19
29
|
limit?: number;
|
|
20
30
|
offset?: number;
|
|
21
31
|
singleResult?: boolean;
|
|
32
|
+
minusEntries?: RawMinusEntry[];
|
|
22
33
|
};
|
|
23
34
|
export type DesugaredPropertyStep = {
|
|
24
35
|
kind: 'property_step';
|
|
@@ -85,6 +96,12 @@ export type DesugaredWhereArg = JSNonNullPrimitive | NodeReferenceValue | ShapeR
|
|
|
85
96
|
subject?: ShapeReferenceValue;
|
|
86
97
|
path: DesugaredSelectionPath;
|
|
87
98
|
} | DesugaredWhere;
|
|
99
|
+
/** A desugared MINUS entry. */
|
|
100
|
+
export type DesugaredMinusEntry = {
|
|
101
|
+
shapeId?: string;
|
|
102
|
+
where?: DesugaredWhere;
|
|
103
|
+
propertyPaths?: PropertyPathSegment[][];
|
|
104
|
+
};
|
|
88
105
|
export type DesugaredSelectQuery = {
|
|
89
106
|
kind: 'desugared_select';
|
|
90
107
|
shapeId?: string;
|
|
@@ -96,7 +113,9 @@ export type DesugaredSelectQuery = {
|
|
|
96
113
|
selections: DesugaredSelection[];
|
|
97
114
|
sortBy?: DesugaredSortBy;
|
|
98
115
|
where?: DesugaredWhere;
|
|
116
|
+
minusEntries?: DesugaredMinusEntry[];
|
|
99
117
|
};
|
|
118
|
+
export declare const toWhere: (path: WherePath) => DesugaredWhere;
|
|
100
119
|
/**
|
|
101
120
|
* Converts a RawSelectInput (FieldSet entries + where/sort) into a DesugaredSelectQuery.
|
|
102
121
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.desugarSelectQuery = void 0;
|
|
3
|
+
exports.desugarSelectQuery = exports.toWhere = void 0;
|
|
4
4
|
const SelectQuery_js_1 = require("./SelectQuery.js");
|
|
5
5
|
const isShapeRef = (value) => !!value && typeof value === 'object' && 'id' in value && 'shape' in value;
|
|
6
6
|
const isNodeRef = (value) => typeof value === 'object' && value !== null && 'id' in value;
|
|
@@ -20,7 +20,7 @@ const desugarEntry = (entry) => {
|
|
|
20
20
|
if (entry.evaluation) {
|
|
21
21
|
return {
|
|
22
22
|
kind: 'evaluation_select',
|
|
23
|
-
where: toWhere(entry.evaluation.wherePath),
|
|
23
|
+
where: (0, exports.toWhere)(entry.evaluation.wherePath),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
// Count aggregation → DesugaredCountStep
|
|
@@ -51,7 +51,7 @@ const desugarEntry = (entry) => {
|
|
|
51
51
|
propertyShapeId: segment.id,
|
|
52
52
|
};
|
|
53
53
|
if (entry.scopedFilter && i === segments.length - 1) {
|
|
54
|
-
step.where = toWhere(entry.scopedFilter);
|
|
54
|
+
step.where = (0, exports.toWhere)(entry.scopedFilter);
|
|
55
55
|
}
|
|
56
56
|
return step;
|
|
57
57
|
});
|
|
@@ -143,7 +143,7 @@ const toSelectionPath = (path) => ({
|
|
|
143
143
|
propertyShapeId: step.property.id,
|
|
144
144
|
};
|
|
145
145
|
if (step.where) {
|
|
146
|
-
result.where = toWhere(step.where);
|
|
146
|
+
result.where = (0, exports.toWhere)(step.where);
|
|
147
147
|
}
|
|
148
148
|
return result;
|
|
149
149
|
}
|
|
@@ -166,7 +166,7 @@ const toWhereArg = (arg) => {
|
|
|
166
166
|
}
|
|
167
167
|
if (arg && typeof arg === 'object') {
|
|
168
168
|
if ((0, SelectQuery_js_1.isWhereEvaluationPath)(arg) || 'firstPath' in arg) {
|
|
169
|
-
return toWhere(arg);
|
|
169
|
+
return (0, exports.toWhere)(arg);
|
|
170
170
|
}
|
|
171
171
|
if (isArgPath(arg)) {
|
|
172
172
|
return {
|
|
@@ -196,13 +196,14 @@ const toWhere = (path) => {
|
|
|
196
196
|
kind: 'where_boolean',
|
|
197
197
|
first: toWhereComparison(grouped.firstPath),
|
|
198
198
|
andOr: grouped.andOr.map((token) => ({
|
|
199
|
-
and: token.and ? toWhere(token.and) : undefined,
|
|
200
|
-
or: token.or ? toWhere(token.or) : undefined,
|
|
199
|
+
and: token.and ? (0, exports.toWhere)(token.and) : undefined,
|
|
200
|
+
or: token.or ? (0, exports.toWhere)(token.or) : undefined,
|
|
201
201
|
})),
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
return toWhereComparison(path);
|
|
205
205
|
};
|
|
206
|
+
exports.toWhere = toWhere;
|
|
206
207
|
const toSortBy = (query) => {
|
|
207
208
|
if (!query.sortBy) {
|
|
208
209
|
return undefined;
|
|
@@ -222,7 +223,7 @@ const toSortBy = (query) => {
|
|
|
222
223
|
* Converts a RawSelectInput (FieldSet entries + where/sort) into a DesugaredSelectQuery.
|
|
223
224
|
*/
|
|
224
225
|
const desugarSelectQuery = (query) => {
|
|
225
|
-
var _a, _b, _c;
|
|
226
|
+
var _a, _b, _c, _d;
|
|
226
227
|
const selections = desugarFieldSetEntries(query.entries);
|
|
227
228
|
const subjectId = query.subject && typeof query.subject === 'object' && 'id' in query.subject
|
|
228
229
|
? query.subject.id
|
|
@@ -248,7 +249,12 @@ const desugarSelectQuery = (query) => {
|
|
|
248
249
|
offset: query.offset,
|
|
249
250
|
selections,
|
|
250
251
|
sortBy: toSortBy(query),
|
|
251
|
-
where: query.where ? toWhere(query.where) : undefined,
|
|
252
|
+
where: query.where ? (0, exports.toWhere)(query.where) : undefined,
|
|
253
|
+
minusEntries: (_d = query.minusEntries) === null || _d === void 0 ? void 0 : _d.map((entry) => ({
|
|
254
|
+
shapeId: entry.shapeId,
|
|
255
|
+
where: entry.where ? (0, exports.toWhere)(entry.where) : undefined,
|
|
256
|
+
propertyPaths: entry.propertyPaths,
|
|
257
|
+
})),
|
|
252
258
|
};
|
|
253
259
|
};
|
|
254
260
|
exports.desugarSelectQuery = desugarSelectQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRDesugar.js","sourceRoot":"","sources":["../../../src/queries/IRDesugar.ts"],"names":[],"mappings":";;;AAAA,qDAY0B;
|
|
1
|
+
{"version":3,"file":"IRDesugar.js","sourceRoot":"","sources":["../../../src/queries/IRDesugar.ts"],"names":[],"mappings":";;;AAAA,qDAY0B;AA8I1B,MAAM,UAAU,GAAG,CAAC,KAAc,EAAgC,EAAE,CAClE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC;AAE5E,MAAM,SAAS,GAAG,CAAC,KAAc,EAA+B,EAAE,CAChE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;AAE/D;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,QAAyB,EAA2B,EAAE,CAC7E,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACrB,IAAI,EAAE,eAAwB;IAC9B,eAAe,EAAE,GAAG,CAAC,EAAE;CACxB,CAAC,CAAC,CAAC;AAEN;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,KAAoB,EAAsB,EAAE;IAChE,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;IAErC,iFAAiF;IACjF,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QACrB,OAAO;YACL,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,UAA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CAAC,CAAC,CAAC,CAAC,SAAS;QACrD,YAAY,EAAE,MAAA,KAAK,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChD,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,eAAO,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;YACrD,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,kBAAkB,sBAoC7B"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { CanonicalDesugaredSelectQuery } from './IRCanonicalize.js';
|
|
2
|
-
import { IRSelectQuery } from './IntermediateRepresentation.js';
|
|
1
|
+
import { CanonicalDesugaredSelectQuery, CanonicalWhereExpression } from './IRCanonicalize.js';
|
|
2
|
+
import { IRExpression, IRGraphPattern, IRSelectQuery } from './IntermediateRepresentation.js';
|
|
3
3
|
/**
|
|
4
4
|
* Lowers a canonical desugared select query into the final IRSelectQuery.
|
|
5
5
|
* Introduces aliases, graph patterns (shape scans, traversals), and
|
|
6
6
|
* converts selection paths and where-clauses into IR expressions.
|
|
7
7
|
*/
|
|
8
8
|
export declare const lowerSelectQuery: (canonical: CanonicalDesugaredSelectQuery) => IRSelectQuery;
|
|
9
|
+
/**
|
|
10
|
+
* Standalone WHERE lowering — converts a CanonicalWhereExpression to IR expression + patterns.
|
|
11
|
+
* Used by mutation builders (DeleteBuilder, UpdateBuilder) that don't go through the select pipeline.
|
|
12
|
+
*/
|
|
13
|
+
export declare const lowerWhereToIR: (where: CanonicalWhereExpression, rootAlias?: string) => {
|
|
14
|
+
where: IRExpression;
|
|
15
|
+
wherePatterns: IRGraphPattern[];
|
|
16
|
+
};
|