@_linked/core 2.9.0 → 2.10.0-next.20260630062115
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 +57 -0
- package/README.md +102 -59
- package/lib/cjs/expressions/ExpressionNode.d.ts +2 -1
- package/lib/cjs/expressions/ExpressionNode.js +4 -0
- package/lib/cjs/expressions/ExpressionNode.js.map +1 -1
- package/lib/cjs/index.d.ts +12 -1
- package/lib/cjs/index.js +26 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/IDataset.d.ts +5 -3
- package/lib/cjs/package.json +7 -1
- package/lib/cjs/queries/ContextRef.d.ts +21 -0
- package/lib/cjs/queries/ContextRef.js +58 -0
- package/lib/cjs/queries/ContextRef.js.map +1 -0
- package/lib/cjs/queries/CreateBuilder.d.ts +20 -4
- package/lib/cjs/queries/CreateBuilder.js +43 -11
- package/lib/cjs/queries/CreateBuilder.js.map +1 -1
- package/lib/cjs/queries/CreateQuery.d.ts +16 -13
- package/lib/cjs/queries/CreateQuery.js +0 -17
- package/lib/cjs/queries/CreateQuery.js.map +1 -1
- package/lib/cjs/queries/DeleteBuilder.d.ts +19 -4
- package/lib/cjs/queries/DeleteBuilder.js +82 -29
- package/lib/cjs/queries/DeleteBuilder.js.map +1 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +16 -13
- package/lib/cjs/queries/DeleteQuery.js +0 -17
- package/lib/cjs/queries/DeleteQuery.js.map +1 -1
- package/lib/cjs/queries/IRLower.js +48 -3
- package/lib/cjs/queries/IRLower.js.map +1 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +12 -2
- package/lib/cjs/queries/MutationQuery.d.ts +9 -0
- package/lib/cjs/queries/MutationQuery.js +27 -0
- package/lib/cjs/queries/MutationQuery.js.map +1 -1
- package/lib/cjs/queries/MutationSerialization.d.ts +103 -0
- package/lib/cjs/queries/MutationSerialization.js +161 -0
- package/lib/cjs/queries/MutationSerialization.js.map +1 -0
- package/lib/cjs/queries/QueryBuilder.d.ts +44 -33
- package/lib/cjs/queries/QueryBuilder.js +55 -43
- package/lib/cjs/queries/QueryBuilder.js.map +1 -1
- package/lib/cjs/queries/QueryBuilderSerialization.js +16 -5
- package/lib/cjs/queries/QueryBuilderSerialization.js.map +1 -1
- package/lib/cjs/queries/QueryContext.d.ts +36 -0
- package/lib/cjs/queries/QueryContext.js +96 -12
- package/lib/cjs/queries/QueryContext.js.map +1 -1
- package/lib/cjs/queries/SelectQuery.d.ts +16 -7
- package/lib/cjs/queries/SelectQuery.js +22 -13
- package/lib/cjs/queries/SelectQuery.js.map +1 -1
- package/lib/cjs/queries/UpdateBuilder.d.ts +23 -5
- package/lib/cjs/queries/UpdateBuilder.js +102 -43
- package/lib/cjs/queries/UpdateBuilder.js.map +1 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +14 -12
- package/lib/cjs/queries/UpdateQuery.js +0 -20
- package/lib/cjs/queries/UpdateQuery.js.map +1 -1
- package/lib/cjs/queries/fromJSON.d.ts +16 -0
- package/lib/cjs/queries/fromJSON.js +41 -0
- package/lib/cjs/queries/fromJSON.js.map +1 -0
- package/lib/cjs/queries/lower.d.ts +28 -0
- package/lib/cjs/queries/lower.js +115 -0
- package/lib/cjs/queries/lower.js.map +1 -0
- package/lib/cjs/queries/lowerMutationJSON.d.ts +12 -0
- package/lib/cjs/queries/lowerMutationJSON.js +135 -0
- package/lib/cjs/queries/lowerMutationJSON.js.map +1 -0
- package/lib/cjs/queries/mutationLowerSpec.d.ts +32 -0
- package/lib/cjs/queries/mutationLowerSpec.js +8 -0
- package/lib/cjs/queries/mutationLowerSpec.js.map +1 -0
- package/lib/cjs/queries/wireVersion.d.ts +7 -0
- package/lib/cjs/queries/wireVersion.js +25 -0
- package/lib/cjs/queries/wireVersion.js.map +1 -0
- package/lib/cjs/shapes/Shape.d.ts +4 -3
- package/lib/cjs/shapes/Shape.js.map +1 -1
- package/lib/cjs/sparql/SparqlDataset.js +22 -17
- package/lib/cjs/sparql/SparqlDataset.js.map +1 -1
- package/lib/cjs/sparql/irToAlgebra.js +20 -5
- package/lib/cjs/sparql/irToAlgebra.js.map +1 -1
- package/lib/cjs/test-helpers/query-capture-store.js +8 -4
- package/lib/cjs/test-helpers/query-capture-store.js.map +1 -1
- package/lib/cjs/utils/LinkedStorage.d.ts +1 -1
- package/lib/cjs/utils/LinkedStorage.js +20 -7
- package/lib/cjs/utils/LinkedStorage.js.map +1 -1
- package/lib/esm/expressions/ExpressionNode.d.ts +2 -1
- package/lib/esm/expressions/ExpressionNode.js +4 -0
- package/lib/esm/expressions/ExpressionNode.js.map +1 -1
- package/lib/esm/index.d.ts +12 -1
- package/lib/esm/index.js +10 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/IDataset.d.ts +5 -3
- package/lib/esm/package.json +7 -1
- package/lib/esm/queries/ContextRef.d.ts +21 -0
- package/lib/esm/queries/ContextRef.js +52 -0
- package/lib/esm/queries/ContextRef.js.map +1 -0
- package/lib/esm/queries/CreateBuilder.d.ts +20 -4
- package/lib/esm/queries/CreateBuilder.js +43 -11
- package/lib/esm/queries/CreateBuilder.js.map +1 -1
- package/lib/esm/queries/CreateQuery.d.ts +16 -13
- package/lib/esm/queries/CreateQuery.js +1 -15
- package/lib/esm/queries/CreateQuery.js.map +1 -1
- package/lib/esm/queries/DeleteBuilder.d.ts +19 -4
- package/lib/esm/queries/DeleteBuilder.js +82 -29
- package/lib/esm/queries/DeleteBuilder.js.map +1 -1
- package/lib/esm/queries/DeleteQuery.d.ts +16 -13
- package/lib/esm/queries/DeleteQuery.js +1 -15
- package/lib/esm/queries/DeleteQuery.js.map +1 -1
- package/lib/esm/queries/IRLower.js +48 -3
- package/lib/esm/queries/IRLower.js.map +1 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +12 -2
- package/lib/esm/queries/MutationQuery.d.ts +9 -0
- package/lib/esm/queries/MutationQuery.js +27 -0
- package/lib/esm/queries/MutationQuery.js.map +1 -1
- package/lib/esm/queries/MutationSerialization.d.ts +103 -0
- package/lib/esm/queries/MutationSerialization.js +155 -0
- package/lib/esm/queries/MutationSerialization.js.map +1 -0
- package/lib/esm/queries/QueryBuilder.d.ts +44 -33
- package/lib/esm/queries/QueryBuilder.js +55 -42
- package/lib/esm/queries/QueryBuilder.js.map +1 -1
- package/lib/esm/queries/QueryBuilderSerialization.js +16 -5
- package/lib/esm/queries/QueryBuilderSerialization.js.map +1 -1
- package/lib/esm/queries/QueryContext.d.ts +36 -0
- package/lib/esm/queries/QueryContext.js +92 -11
- package/lib/esm/queries/QueryContext.js.map +1 -1
- package/lib/esm/queries/SelectQuery.d.ts +16 -7
- package/lib/esm/queries/SelectQuery.js +22 -13
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/UpdateBuilder.d.ts +23 -5
- package/lib/esm/queries/UpdateBuilder.js +102 -43
- package/lib/esm/queries/UpdateBuilder.js.map +1 -1
- package/lib/esm/queries/UpdateQuery.d.ts +14 -12
- package/lib/esm/queries/UpdateQuery.js +1 -18
- package/lib/esm/queries/UpdateQuery.js.map +1 -1
- package/lib/esm/queries/fromJSON.d.ts +16 -0
- package/lib/esm/queries/fromJSON.js +38 -0
- package/lib/esm/queries/fromJSON.js.map +1 -0
- package/lib/esm/queries/lower.d.ts +28 -0
- package/lib/esm/queries/lower.js +112 -0
- package/lib/esm/queries/lower.js.map +1 -0
- package/lib/esm/queries/lowerMutationJSON.d.ts +12 -0
- package/lib/esm/queries/lowerMutationJSON.js +131 -0
- package/lib/esm/queries/lowerMutationJSON.js.map +1 -0
- package/lib/esm/queries/mutationLowerSpec.d.ts +32 -0
- package/lib/esm/queries/mutationLowerSpec.js +7 -0
- package/lib/esm/queries/mutationLowerSpec.js.map +1 -0
- package/lib/esm/queries/wireVersion.d.ts +7 -0
- package/lib/esm/queries/wireVersion.js +21 -0
- package/lib/esm/queries/wireVersion.js.map +1 -0
- package/lib/esm/shapes/Shape.d.ts +4 -3
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/sparql/SparqlDataset.js +22 -17
- package/lib/esm/sparql/SparqlDataset.js.map +1 -1
- package/lib/esm/sparql/irToAlgebra.js +20 -5
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/lib/esm/test-helpers/query-capture-store.js +8 -4
- package/lib/esm/test-helpers/query-capture-store.js.map +1 -1
- package/lib/esm/utils/LinkedStorage.d.ts +1 -1
- package/lib/esm/utils/LinkedStorage.js +20 -7
- package/lib/esm/utils/LinkedStorage.js.map +1 -1
- package/package.json +7 -1
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,aAAa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;QACH,IAAI;QACJ,GAAG;QACH,KAAK;QACL,YAAY;QACZ,GAAG;QACH,GAAG;QACH,MAAM;QACN,2BAA2B;QAC3B,kBAAkB;QAClB,kBAAkB;QAClB,oBAAoB;QACpB,cAAc;QACd,mBAAmB;QACnB,mBAAmB;QACnB,mBAAmB;KACpB,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,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -8,9 +8,11 @@ import type { SelectResult, CreateResult, UpdateResult } from '../queries/Interm
|
|
|
8
8
|
* Linked Queries as input. The implementing class decides how to handle them —
|
|
9
9
|
* compiling to SPARQL for Fuseki, forwarding as-is to a Host Agent API, etc.
|
|
10
10
|
*
|
|
11
|
-
* Each method receives
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Each method receives the live, closed (read-only) query object — the builder
|
|
12
|
+
* viewed through its `*Query` interface — and returns the result. A store reads
|
|
13
|
+
* `query.toJSON()` to forward it, or `lower(query)` to get canonical IR. The
|
|
14
|
+
* calling layer (LinkedStorage via queryDispatch) threads the precise DSL-level
|
|
15
|
+
* TypeScript result type back to the caller.
|
|
14
16
|
*/
|
|
15
17
|
export interface IDataset {
|
|
16
18
|
/**
|
package/lib/esm/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The reserved key that tags a context reference in DSL-JSON. */
|
|
2
|
+
export declare const CONTEXT_REF_KEY = "$ctx";
|
|
3
|
+
/** The wire shape of a context reference: `{$ctx: "<contextName>"}`. */
|
|
4
|
+
export interface ContextRefJSON {
|
|
5
|
+
[CONTEXT_REF_KEY]: string;
|
|
6
|
+
}
|
|
7
|
+
/** Build a context-reference marker for the given context name. */
|
|
8
|
+
export declare function encodeContextRef(name: string): ContextRefJSON;
|
|
9
|
+
/** Type guard: is this value a `{$ctx: "..."}` context-reference marker? */
|
|
10
|
+
export declare function isContextRefJSON(value: unknown): value is ContextRefJSON;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a context name to its node id against the current context map.
|
|
13
|
+
*
|
|
14
|
+
* @param name the context name (e.g. `'user'`)
|
|
15
|
+
* @param required when true, throw {@link UnresolvedContextError} if the context
|
|
16
|
+
* isn't set (the mutation contract — a mutation must not silently target
|
|
17
|
+
* nothing). When false, return `undefined` (the select contract — an
|
|
18
|
+
* unresolved subject simply yields no results, and a reactive layer re-runs
|
|
19
|
+
* the query once the context lands).
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveContextId(name: string, required: boolean): string | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The unified wire encoding for a *query-context reference*.
|
|
8
|
+
*
|
|
9
|
+
* A context reference is a placeholder for a node id that is not known when the
|
|
10
|
+
* query is authored — e.g. "the currently authenticated user". Instead of
|
|
11
|
+
* resolving it eagerly (which loses the reference and breaks queries built
|
|
12
|
+
* before auth completes), the reference is carried on the wire as a tagged
|
|
13
|
+
* marker and resolved at lowering time against whatever context map is
|
|
14
|
+
* available (client-side React context, server-side auth, …).
|
|
15
|
+
*
|
|
16
|
+
* The same `{$ctx: "<name>"}` marker is used in *every* position a node id can
|
|
17
|
+
* appear: the select subject, the update target, where-clause arguments, and
|
|
18
|
+
* mutation field values. One marker, one resolver, everywhere.
|
|
19
|
+
*/
|
|
20
|
+
import { getQueryContext, UnresolvedContextError } from './QueryContext.js';
|
|
21
|
+
/** The reserved key that tags a context reference in DSL-JSON. */
|
|
22
|
+
export const CONTEXT_REF_KEY = '$ctx';
|
|
23
|
+
/** Build a context-reference marker for the given context name. */
|
|
24
|
+
export function encodeContextRef(name) {
|
|
25
|
+
return { [CONTEXT_REF_KEY]: name };
|
|
26
|
+
}
|
|
27
|
+
/** Type guard: is this value a `{$ctx: "..."}` context-reference marker? */
|
|
28
|
+
export function isContextRefJSON(value) {
|
|
29
|
+
return (!!value &&
|
|
30
|
+
typeof value === 'object' &&
|
|
31
|
+
typeof value[CONTEXT_REF_KEY] === 'string' &&
|
|
32
|
+
Object.keys(value).length === 1);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a context name to its node id against the current context map.
|
|
36
|
+
*
|
|
37
|
+
* @param name the context name (e.g. `'user'`)
|
|
38
|
+
* @param required when true, throw {@link UnresolvedContextError} if the context
|
|
39
|
+
* isn't set (the mutation contract — a mutation must not silently target
|
|
40
|
+
* nothing). When false, return `undefined` (the select contract — an
|
|
41
|
+
* unresolved subject simply yields no results, and a reactive layer re-runs
|
|
42
|
+
* the query once the context lands).
|
|
43
|
+
*/
|
|
44
|
+
export function resolveContextId(name, required) {
|
|
45
|
+
var _a;
|
|
46
|
+
const id = (_a = getQueryContext(name)) === null || _a === void 0 ? void 0 : _a.id;
|
|
47
|
+
if (!id && required) {
|
|
48
|
+
throw new UnresolvedContextError(name);
|
|
49
|
+
}
|
|
50
|
+
return id;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ContextRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextRef.js","sourceRoot":"","sources":["../../../src/queries/ContextRef.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAC,eAAe,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAE1E,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAOtC,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,EAAC,CAAC,eAAe,CAAC,EAAE,IAAI,EAAC,CAAC;AACnC,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CACL,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAQ,KAAiC,CAAC,eAAe,CAAC,KAAK,QAAQ;QACvE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,KAAK,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,QAAiB;;IAEjB,MAAM,EAAE,GAAG,MAAA,eAAe,CAAC,IAAI,CAAC,0CAAE,EAAE,CAAC;IACrC,IAAI,CAAC,EAAE,IAAI,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Shape, type ShapeConstructor } from '../shapes/Shape.js';
|
|
2
2
|
import type { UpdatePartial } from './QueryFactory.js';
|
|
3
|
-
import
|
|
3
|
+
import type { CreateResponse } from './CreateQuery.js';
|
|
4
|
+
import type { NodeShape } from '../shapes/SHACL.js';
|
|
5
|
+
import { type CreateMutationJSON } from './MutationSerialization.js';
|
|
6
|
+
import type { CreateLowerSpec } from './mutationLowerSpec.js';
|
|
4
7
|
/**
|
|
5
8
|
* An immutable, fluent builder for create mutations.
|
|
6
9
|
*
|
|
@@ -11,7 +14,8 @@ import { type CreateQuery, type CreateResponse } from './CreateQuery.js';
|
|
|
11
14
|
* const result = await CreateBuilder.from(Person).set({name: 'Alice'});
|
|
12
15
|
* ```
|
|
13
16
|
*
|
|
14
|
-
*
|
|
17
|
+
* Serialization normalizes through the IR-free factory base; IR is produced by
|
|
18
|
+
* the free `lower()` function (the builder itself imports no IR).
|
|
15
19
|
*/
|
|
16
20
|
export declare class CreateBuilder<S extends Shape = Shape, U extends UpdatePartial<S> = UpdatePartial<S>> implements PromiseLike<CreateResponse<U>>, Promise<CreateResponse<U>> {
|
|
17
21
|
private readonly _shape;
|
|
@@ -23,12 +27,24 @@ export declare class CreateBuilder<S extends Shape = Shape, U extends UpdatePart
|
|
|
23
27
|
* Create a CreateBuilder for the given shape.
|
|
24
28
|
*/
|
|
25
29
|
static from<S extends Shape>(shape: ShapeConstructor<S> | string): CreateBuilder<S>;
|
|
30
|
+
/** Reconstruct a CreateBuilder from its DSL-JSON (inverse of `toJSON`). */
|
|
31
|
+
static fromJSON(json: CreateMutationJSON): CreateBuilder;
|
|
26
32
|
/** Set the data for the entity to create. */
|
|
27
33
|
set<NewU extends UpdatePartial<S>>(data: NewU): CreateBuilder<S, NewU>;
|
|
28
34
|
/** Pre-assign a node ID for the created entity. */
|
|
29
35
|
withId(id: string): CreateBuilder<S, U>;
|
|
30
|
-
/**
|
|
31
|
-
|
|
36
|
+
/** Discriminator for the free `lower()` function and dataset routing. */
|
|
37
|
+
readonly __queryKind: "create";
|
|
38
|
+
/** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
|
|
39
|
+
get shape(): NodeShape;
|
|
40
|
+
/** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
|
|
41
|
+
_lowerSpec(): CreateLowerSpec<S>;
|
|
42
|
+
/**
|
|
43
|
+
* Serialize this create mutation to lightweight DSL-JSON. Normalizes the create
|
|
44
|
+
* data through the IR-free factory base (the same normalization `lower()` runs)
|
|
45
|
+
* so the result is concrete and JSON-safe, then encodes the node description.
|
|
46
|
+
*/
|
|
47
|
+
toJSON(): CreateMutationJSON;
|
|
32
48
|
/** Execute the mutation. */
|
|
33
49
|
exec(): Promise<CreateResponse<U>>;
|
|
34
50
|
then<TResult1 = CreateResponse<U>, TResult2 = never>(onfulfilled?: ((value: CreateResponse<U>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { resolveShape } from './resolveShape.js';
|
|
2
|
-
import {
|
|
2
|
+
import { MutationQueryFactory } from './MutationQuery.js';
|
|
3
3
|
import { getQueryDispatch } from './queryDispatch.js';
|
|
4
|
+
import { WIRE_VERSION, assertWireVersion } from './wireVersion.js';
|
|
5
|
+
import { encodeNodeData, decodeNodeDataToRaw } from './MutationSerialization.js';
|
|
4
6
|
/**
|
|
5
7
|
* An immutable, fluent builder for create mutations.
|
|
6
8
|
*
|
|
@@ -11,10 +13,16 @@ import { getQueryDispatch } from './queryDispatch.js';
|
|
|
11
13
|
* const result = await CreateBuilder.from(Person).set({name: 'Alice'});
|
|
12
14
|
* ```
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* Serialization normalizes through the IR-free factory base; IR is produced by
|
|
17
|
+
* the free `lower()` function (the builder itself imports no IR).
|
|
15
18
|
*/
|
|
16
19
|
export class CreateBuilder {
|
|
17
20
|
constructor(init) {
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Build & execute
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Discriminator for the free `lower()` function and dataset routing. */
|
|
25
|
+
this.__queryKind = 'create';
|
|
18
26
|
this._shape = init.shape;
|
|
19
27
|
this._data = init.data;
|
|
20
28
|
this._fixedId = init.fixedId;
|
|
@@ -32,6 +40,11 @@ export class CreateBuilder {
|
|
|
32
40
|
const resolved = resolveShape(shape);
|
|
33
41
|
return new CreateBuilder({ shape: resolved });
|
|
34
42
|
}
|
|
43
|
+
/** Reconstruct a CreateBuilder from its DSL-JSON (inverse of `toJSON`). */
|
|
44
|
+
static fromJSON(json) {
|
|
45
|
+
assertWireVersion(json.v);
|
|
46
|
+
return CreateBuilder.from(json.shape).set(decodeNodeDataToRaw(json.data));
|
|
47
|
+
}
|
|
35
48
|
// ---------------------------------------------------------------------------
|
|
36
49
|
// Fluent API
|
|
37
50
|
// ---------------------------------------------------------------------------
|
|
@@ -43,13 +56,14 @@ export class CreateBuilder {
|
|
|
43
56
|
withId(id) {
|
|
44
57
|
return this.clone({ fixedId: id });
|
|
45
58
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
/** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
|
|
60
|
+
get shape() {
|
|
61
|
+
return this._shape.shape;
|
|
62
|
+
}
|
|
63
|
+
/** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
|
|
64
|
+
_lowerSpec() {
|
|
51
65
|
if (!this._data) {
|
|
52
|
-
throw new Error('CreateBuilder requires .set(data) before .
|
|
66
|
+
throw new Error('CreateBuilder requires .set(data) before it can be lowered. Specify what to create.');
|
|
53
67
|
}
|
|
54
68
|
const data = this._data;
|
|
55
69
|
// Validate that required properties (minCount >= 1) are present in data
|
|
@@ -70,12 +84,30 @@ export class CreateBuilder {
|
|
|
70
84
|
// Inject __id if fixedId is set
|
|
71
85
|
const dataWithId = this._fixedId
|
|
72
86
|
? Object.assign(Object.assign({}, data), { __id: this._fixedId }) : data;
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
return { shapeClass: this._shape, data: dataWithId };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Serialize this create mutation to lightweight DSL-JSON. Normalizes the create
|
|
91
|
+
* data through the IR-free factory base (the same normalization `lower()` runs)
|
|
92
|
+
* so the result is concrete and JSON-safe, then encodes the node description.
|
|
93
|
+
*/
|
|
94
|
+
toJSON() {
|
|
95
|
+
if (!this._data) {
|
|
96
|
+
throw new Error('CreateBuilder requires .set(data) before .toJSON().');
|
|
97
|
+
}
|
|
98
|
+
const dataWithId = this._fixedId
|
|
99
|
+
? Object.assign(Object.assign({}, this._data), { __id: this._fixedId }) : this._data;
|
|
100
|
+
const description = new MutationQueryFactory().describe(this._shape.shape, dataWithId, true);
|
|
101
|
+
return {
|
|
102
|
+
v: WIRE_VERSION,
|
|
103
|
+
op: 'create',
|
|
104
|
+
shape: this._shape.shape.id,
|
|
105
|
+
data: encodeNodeData(description),
|
|
106
|
+
};
|
|
75
107
|
}
|
|
76
108
|
/** Execute the mutation. */
|
|
77
109
|
exec() {
|
|
78
|
-
return getQueryDispatch().createQuery(this
|
|
110
|
+
return getQueryDispatch().createQuery(this);
|
|
79
111
|
}
|
|
80
112
|
// ---------------------------------------------------------------------------
|
|
81
113
|
// Promise interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateBuilder.js","sourceRoot":"","sources":["../../../src/queries/CreateBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateBuilder.js","sourceRoot":"","sources":["../../../src/queries/CreateBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAA0B,MAAM,4BAA4B,CAAC;AAYxG;;;;;;;;;;;;GA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AAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { AddId, NodeDescriptionValue, UpdatePartial } from './QueryFactory.js';
|
|
3
|
-
import { MutationQueryFactory } from './MutationQuery.js';
|
|
1
|
+
import type { AddId } from './QueryFactory.js';
|
|
4
2
|
import type { IRCreateMutation } from './IntermediateRepresentation.js';
|
|
3
|
+
import type { NodeShape } from '../shapes/SHACL.js';
|
|
4
|
+
import type { CreateMutationJSON } from './MutationSerialization.js';
|
|
5
|
+
import type { CreateLowerSpec } from './mutationLowerSpec.js';
|
|
5
6
|
/**
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
7
|
+
* The closed, read-only create query a dataset receives (implemented by
|
|
8
|
+
* `CreateBuilder`). The IR is `IRCreateQuery`, produced by `lower(query)` — the
|
|
9
|
+
* IR construction lives in the IR tier, not here, so this module stays IR-free.
|
|
8
10
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
constructor(shapeClass: ShapeConstructor<ShapeType>, updateObjectOrFn: U);
|
|
16
|
-
build(): CreateQuery;
|
|
11
|
+
export interface CreateQuery {
|
|
12
|
+
readonly __queryKind: 'create';
|
|
13
|
+
readonly shape: NodeShape;
|
|
14
|
+
toJSON(): CreateMutationJSON;
|
|
15
|
+
/** @internal IR-free lowering spec consumed by `lower()`. */
|
|
16
|
+
_lowerSpec(): CreateLowerSpec;
|
|
17
17
|
}
|
|
18
|
+
/** The lowered IR for a create mutation (what `lower()` produces). */
|
|
19
|
+
export type IRCreateQuery = IRCreateMutation;
|
|
20
|
+
export type CreateResponse<U> = AddId<U, true>;
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { buildCanonicalCreateMutationIR } from './IRMutation.js';
|
|
3
|
-
export class CreateQueryFactory extends MutationQueryFactory {
|
|
4
|
-
constructor(shapeClass, updateObjectOrFn) {
|
|
5
|
-
super();
|
|
6
|
-
this.shapeClass = shapeClass;
|
|
7
|
-
this.description = this.convertUpdateObject(updateObjectOrFn, this.shapeClass.shape, true);
|
|
8
|
-
}
|
|
9
|
-
build() {
|
|
10
|
-
return buildCanonicalCreateMutationIR({
|
|
11
|
-
shape: this.shapeClass.shape,
|
|
12
|
-
description: this.description,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
export {};
|
|
16
2
|
//# sourceMappingURL=CreateQuery.js.map
|
|
@@ -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":""}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Shape, type ShapeConstructor } from '../shapes/Shape.js';
|
|
2
|
-
import
|
|
2
|
+
import type { DeleteResponse } from './DeleteQuery.js';
|
|
3
3
|
import type { NodeId } from './MutationQuery.js';
|
|
4
|
+
import type { NodeShape } from '../shapes/SHACL.js';
|
|
4
5
|
import { type WhereClause } from './SelectQuery.js';
|
|
6
|
+
import { type DeleteMutationJSON } from './MutationSerialization.js';
|
|
7
|
+
import type { DeleteLowerSpec } from './mutationLowerSpec.js';
|
|
8
|
+
import { PendingQueryContext } from './QueryContext.js';
|
|
9
|
+
/** A node to delete: a concrete id, a `{id}` ref, or a live query-context reference. */
|
|
10
|
+
export type DeleteId = NodeId | PendingQueryContext;
|
|
5
11
|
/**
|
|
6
12
|
* An immutable, fluent builder for delete mutations.
|
|
7
13
|
*
|
|
@@ -18,15 +24,24 @@ export declare class DeleteBuilder<S extends Shape = Shape, R = DeleteResponse>
|
|
|
18
24
|
private readonly _ids?;
|
|
19
25
|
private readonly _mode?;
|
|
20
26
|
private readonly _whereFn?;
|
|
27
|
+
private readonly _where?;
|
|
21
28
|
private constructor();
|
|
22
29
|
private clone;
|
|
23
|
-
static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?:
|
|
30
|
+
static from<S extends Shape>(shape: ShapeConstructor<S> | string, ids?: DeleteId | DeleteId[]): DeleteBuilder<S, DeleteResponse>;
|
|
31
|
+
/** Reconstruct a DeleteBuilder from its DSL-JSON (inverse of `toJSON`). */
|
|
32
|
+
static fromJSON(json: DeleteMutationJSON): DeleteBuilder;
|
|
24
33
|
/** Delete all instances of this shape type. Returns void. */
|
|
25
34
|
all(): DeleteBuilder<S, void>;
|
|
26
35
|
/** Delete instances matching a condition. Returns void. */
|
|
27
36
|
where(fn: WhereClause<S>): DeleteBuilder<S, void>;
|
|
28
|
-
/**
|
|
29
|
-
|
|
37
|
+
/** Discriminator for the free `lower()` function and dataset routing. */
|
|
38
|
+
readonly __queryKind: "delete";
|
|
39
|
+
/** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
|
|
40
|
+
get shape(): NodeShape;
|
|
41
|
+
/** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
|
|
42
|
+
_lowerSpec(): DeleteLowerSpec<S>;
|
|
43
|
+
/** Serialize this delete mutation to lightweight DSL-JSON. */
|
|
44
|
+
toJSON(): DeleteMutationJSON;
|
|
30
45
|
/** Execute the mutation. */
|
|
31
46
|
exec(): Promise<R>;
|
|
32
47
|
then<TResult1 = R, TResult2 = never>(onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { resolveShape } from './resolveShape.js';
|
|
2
|
-
import { DeleteQueryFactory } from './DeleteQuery.js';
|
|
3
2
|
import { getQueryDispatch } from './queryDispatch.js';
|
|
3
|
+
import { WIRE_VERSION, assertWireVersion } from './wireVersion.js';
|
|
4
4
|
import { processWhereClause } from './SelectQuery.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { lowerWhereToIR } from './IRLower.js';
|
|
5
|
+
import { serializeWherePath, deserializeWherePath } from './QueryBuilderSerialization.js';
|
|
6
|
+
import { PendingQueryContext, asContextRef } from './QueryContext.js';
|
|
7
|
+
import { encodeContextRef, isContextRefJSON } from './ContextRef.js';
|
|
9
8
|
/**
|
|
10
9
|
* An immutable, fluent builder for delete mutations.
|
|
11
10
|
*
|
|
@@ -19,13 +18,19 @@ import { lowerWhereToIR } from './IRLower.js';
|
|
|
19
18
|
*/
|
|
20
19
|
export class DeleteBuilder {
|
|
21
20
|
constructor(init) {
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Build & execute
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Discriminator for the free `lower()` function and dataset routing. */
|
|
25
|
+
this.__queryKind = 'delete';
|
|
22
26
|
this._shape = init.shape;
|
|
23
27
|
this._ids = init.ids;
|
|
24
28
|
this._mode = init.mode;
|
|
25
29
|
this._whereFn = init.whereFn;
|
|
30
|
+
this._where = init.where;
|
|
26
31
|
}
|
|
27
32
|
clone(overrides = {}) {
|
|
28
|
-
return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids, mode: this._mode, whereFn: this._whereFn }, overrides));
|
|
33
|
+
return new DeleteBuilder(Object.assign({ shape: this._shape, ids: this._ids, mode: this._mode, whereFn: this._whereFn, where: this._where }, overrides));
|
|
29
34
|
}
|
|
30
35
|
// ---------------------------------------------------------------------------
|
|
31
36
|
// Static constructors
|
|
@@ -33,11 +38,28 @@ export class DeleteBuilder {
|
|
|
33
38
|
static from(shape, ids) {
|
|
34
39
|
const resolved = resolveShape(shape);
|
|
35
40
|
if (ids !== undefined) {
|
|
36
|
-
|
|
41
|
+
// Normalize any context reference (unset PendingQueryContext or a resolved
|
|
42
|
+
// context shape) to a {$ctx} marker so set/unset behave identically.
|
|
43
|
+
const idsArray = (Array.isArray(ids) ? ids : [ids]).map((id) => { var _a; return (_a = asContextRef(id)) !== null && _a !== void 0 ? _a : id; });
|
|
37
44
|
return new DeleteBuilder({ shape: resolved, ids: idsArray, mode: 'ids' });
|
|
38
45
|
}
|
|
39
46
|
return new DeleteBuilder({ shape: resolved });
|
|
40
47
|
}
|
|
48
|
+
/** Reconstruct a DeleteBuilder from its DSL-JSON (inverse of `toJSON`). */
|
|
49
|
+
static fromJSON(json) {
|
|
50
|
+
assertWireVersion(json.v);
|
|
51
|
+
const resolved = resolveShape(json.shape);
|
|
52
|
+
if (json.mode === 'ids') {
|
|
53
|
+
// A `{$ctx}` id rehydrates as a live context ref (resolved at lower).
|
|
54
|
+
const ids = json.ids.map((id) => isContextRefJSON(id) ? new PendingQueryContext(id.$ctx) : { id });
|
|
55
|
+
return new DeleteBuilder({ shape: resolved, ids, mode: 'ids' });
|
|
56
|
+
}
|
|
57
|
+
if (json.mode === 'all') {
|
|
58
|
+
return new DeleteBuilder({ shape: resolved, mode: 'all' });
|
|
59
|
+
}
|
|
60
|
+
const where = deserializeWherePath(resolved.shape, json.where);
|
|
61
|
+
return new DeleteBuilder({ shape: resolved, mode: 'where', where });
|
|
62
|
+
}
|
|
41
63
|
// ---------------------------------------------------------------------------
|
|
42
64
|
// Fluent API
|
|
43
65
|
// ---------------------------------------------------------------------------
|
|
@@ -49,45 +71,76 @@ export class DeleteBuilder {
|
|
|
49
71
|
where(fn) {
|
|
50
72
|
return this.clone({ mode: 'where', whereFn: fn, ids: undefined });
|
|
51
73
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
/** The shape this query targets — the routing key datasets/`LinkedStorage` use. */
|
|
75
|
+
get shape() {
|
|
76
|
+
return this._shape.shape;
|
|
77
|
+
}
|
|
78
|
+
/** @internal The IR-free lowering spec consumed by `lower()`. Validates inputs. */
|
|
79
|
+
_lowerSpec() {
|
|
80
|
+
var _a;
|
|
57
81
|
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
58
82
|
if (mode === 'all') {
|
|
59
|
-
return
|
|
60
|
-
shape: this._shape.shape,
|
|
61
|
-
});
|
|
83
|
+
return { shapeClass: this._shape, mode: 'all' };
|
|
62
84
|
}
|
|
63
85
|
if (mode === 'where') {
|
|
64
|
-
|
|
86
|
+
const wherePath = (_a = this._where) !== null && _a !== void 0 ? _a : (this._whereFn ? processWhereClause(this._whereFn, this._shape) : undefined);
|
|
87
|
+
if (!wherePath) {
|
|
65
88
|
throw new Error('DeleteBuilder.where() requires a condition callback.');
|
|
66
89
|
}
|
|
67
|
-
|
|
68
|
-
const desugared = toWhere(wherePath);
|
|
69
|
-
const canonical = canonicalizeWhere(desugared);
|
|
70
|
-
const { where, wherePatterns } = lowerWhereToIR(canonical);
|
|
71
|
-
return buildCanonicalDeleteWhereMutationIR({
|
|
72
|
-
shape: this._shape.shape,
|
|
73
|
-
where,
|
|
74
|
-
wherePatterns,
|
|
75
|
-
});
|
|
90
|
+
return { shapeClass: this._shape, mode: 'where', wherePath };
|
|
76
91
|
}
|
|
77
92
|
// Default: ID-based delete
|
|
78
93
|
if (!this._ids || this._ids.length === 0) {
|
|
79
94
|
throw new Error('DeleteBuilder requires at least one ID to delete. Use DeleteBuilder.from(shape, ids), .all(), or .where().');
|
|
80
95
|
}
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
return { shapeClass: this._shape, mode: 'ids', ids: this._ids };
|
|
97
|
+
}
|
|
98
|
+
/** Serialize this delete mutation to lightweight DSL-JSON. */
|
|
99
|
+
toJSON() {
|
|
100
|
+
var _a;
|
|
101
|
+
const shape = this._shape.shape.id;
|
|
102
|
+
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
103
|
+
if (mode === 'all') {
|
|
104
|
+
return { v: WIRE_VERSION, op: 'delete', shape, mode: 'all' };
|
|
105
|
+
}
|
|
106
|
+
if (mode === 'where') {
|
|
107
|
+
const wherePath = (_a = this._where) !== null && _a !== void 0 ? _a : (this._whereFn ? processWhereClause(this._whereFn, this._shape) : undefined);
|
|
108
|
+
if (!wherePath) {
|
|
109
|
+
throw new Error('DeleteBuilder.where() requires a condition callback.');
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
v: WIRE_VERSION,
|
|
113
|
+
op: 'delete',
|
|
114
|
+
shape,
|
|
115
|
+
mode: 'where',
|
|
116
|
+
where: serializeWherePath(wherePath),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (!this._ids || this._ids.length === 0) {
|
|
120
|
+
throw new Error('DeleteBuilder requires at least one ID, .all(), or .where() before .toJSON().');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
v: WIRE_VERSION,
|
|
124
|
+
op: 'delete',
|
|
125
|
+
shape,
|
|
126
|
+
mode: 'ids',
|
|
127
|
+
ids: this._ids.map((id) =>
|
|
128
|
+
// An unresolved context ref travels as a `{$ctx}` marker; a concrete id
|
|
129
|
+
// (string or `{id}`, incl. a resolved context shape) as a plain string.
|
|
130
|
+
id instanceof PendingQueryContext
|
|
131
|
+
? encodeContextRef(id.contextName)
|
|
132
|
+
: typeof id === 'string'
|
|
133
|
+
? id
|
|
134
|
+
: id.id),
|
|
135
|
+
};
|
|
83
136
|
}
|
|
84
137
|
/** Execute the mutation. */
|
|
85
138
|
exec() {
|
|
86
139
|
const mode = this._mode || (this._ids ? 'ids' : undefined);
|
|
87
140
|
if (mode === 'all' || mode === 'where') {
|
|
88
|
-
return getQueryDispatch().deleteQuery(this
|
|
141
|
+
return getQueryDispatch().deleteQuery(this).then(() => undefined);
|
|
89
142
|
}
|
|
90
|
-
return getQueryDispatch().deleteQuery(this
|
|
143
|
+
return getQueryDispatch().deleteQuery(this);
|
|
91
144
|
}
|
|
92
145
|
// ---------------------------------------------------------------------------
|
|
93
146
|
// Promise interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DeleteBuilder.js","sourceRoot":"","sources":["../../../src/queries/DeleteBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAmC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAC,kBAAkB,EAAE,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAExF,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAmBnE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IASxB,YAAoB,IAA0B;QAuE9C,8EAA8E;QAC9E,kBAAkB;QAClB,8EAA8E;QAE9E,yEAAyE;QAChE,gBAAW,GAAG,QAAiB,CAAC;QA3EvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,YAA2C,EAAE;QACzD,OAAO,IAAI,aAAa,iBACtB,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,GAAG,EAAE,IAAI,CAAC,I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CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACvC,OAAO,gBAAgB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAe,CAAC;QAClF,CAAC;QACD,OAAO,gBAAgB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAe,CAAC;IAC5D,CAAC;IAED,8EAA8E;IAC9E,oBAAoB;IACpB,8EAA8E;IAE9E,IAAI,CACF,WAAqE,EACrE,UAAuE;QAEvE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CACH,UAAqE;QAErE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,SAA+B;QACrC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NodeReferenceValue, type UpdatePartial } from './QueryFactory.js';
|
|
3
|
-
import { MutationQueryFactory, type NodeId } from './MutationQuery.js';
|
|
1
|
+
import type { NodeReferenceValue } from './QueryFactory.js';
|
|
4
2
|
import type { IRDeleteMutation, IRDeleteAllMutation, IRDeleteWhereMutation } from './IntermediateRepresentation.js';
|
|
3
|
+
import type { NodeShape } from '../shapes/SHACL.js';
|
|
4
|
+
import type { DeleteMutationJSON } from './MutationSerialization.js';
|
|
5
|
+
import type { DeleteLowerSpec } from './mutationLowerSpec.js';
|
|
5
6
|
/**
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
7
|
+
* The closed, read-only delete query a dataset receives (implemented by
|
|
8
|
+
* `DeleteBuilder`). The IR is `IRDeleteQuery`, produced by `lower(query)` — the
|
|
9
|
+
* IR construction lives in the IR tier, not here, so this module stays IR-free.
|
|
8
10
|
*/
|
|
9
|
-
export
|
|
11
|
+
export interface DeleteQuery {
|
|
12
|
+
readonly __queryKind: 'delete';
|
|
13
|
+
readonly shape: NodeShape;
|
|
14
|
+
toJSON(): DeleteMutationJSON;
|
|
15
|
+
/** @internal IR-free lowering spec consumed by `lower()`. */
|
|
16
|
+
_lowerSpec(): DeleteLowerSpec;
|
|
17
|
+
}
|
|
18
|
+
/** The lowered IR for a delete mutation (what `lower()` produces). */
|
|
19
|
+
export type IRDeleteQuery = IRDeleteMutation | IRDeleteAllMutation | IRDeleteWhereMutation;
|
|
10
20
|
export type DeleteResponse = {
|
|
11
21
|
/**
|
|
12
22
|
* The IDs of the items that were successfully deleted.
|
|
@@ -25,10 +35,3 @@ export type DeleteResponse = {
|
|
|
25
35
|
*/
|
|
26
36
|
errors?: Record<string, string>;
|
|
27
37
|
};
|
|
28
|
-
export declare class DeleteQueryFactory<ShapeType extends Shape, U extends UpdatePartial<ShapeType>> extends MutationQueryFactory {
|
|
29
|
-
shapeClass: ShapeConstructor<ShapeType>;
|
|
30
|
-
readonly id: string;
|
|
31
|
-
readonly ids: NodeReferenceValue[];
|
|
32
|
-
constructor(shapeClass: ShapeConstructor<ShapeType>, ids: NodeId[] | NodeId);
|
|
33
|
-
build(): DeleteQuery;
|
|
34
|
-
}
|