@_linked/core 2.22.7 → 2.22.9
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 +26 -0
- package/lib/esm/collections/CoreSet.js.map +1 -1
- package/lib/esm/collections/ShapeSet.js.map +1 -1
- package/lib/esm/expressions/Expr.js.map +1 -1
- package/lib/esm/expressions/ExpressionMethods.js.map +1 -1
- package/lib/esm/expressions/ExpressionNode.js +6 -1
- package/lib/esm/expressions/ExpressionNode.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/ICoreIterable.js.map +1 -1
- package/lib/esm/interfaces/IDataset.js.map +1 -1
- package/lib/esm/interfaces/IFileStore.js.map +1 -1
- package/lib/esm/ontologies/linked-core.js.map +1 -1
- package/lib/esm/ontologies/npm.js.map +1 -1
- package/lib/esm/ontologies/owl.js.map +1 -1
- package/lib/esm/ontologies/rdf.js.map +1 -1
- package/lib/esm/ontologies/rdfs.js.map +1 -1
- package/lib/esm/ontologies/shacl.js.map +1 -1
- package/lib/esm/ontologies/xsd.js.map +1 -1
- package/lib/esm/package.js.map +1 -1
- package/lib/esm/paths/PropertyPathExpr.js.map +1 -1
- package/lib/esm/paths/normalizePropertyPath.js.map +1 -1
- package/lib/esm/paths/pathExprToSparql.js.map +1 -1
- package/lib/esm/queries/AskBuilder.js.map +1 -1
- package/lib/esm/queries/AskQuery.js.map +1 -1
- package/lib/esm/queries/ContextRef.js.map +1 -1
- package/lib/esm/queries/CountBuilder.js.map +1 -1
- package/lib/esm/queries/CountQuery.js.map +1 -1
- package/lib/esm/queries/CreateBuilder.js.map +1 -1
- package/lib/esm/queries/CreateQuery.js.map +1 -1
- package/lib/esm/queries/DeleteBuilder.js.map +1 -1
- package/lib/esm/queries/DeleteQuery.js.map +1 -1
- package/lib/esm/queries/DslJsonExpression.js.map +1 -1
- package/lib/esm/queries/FieldSet.js.map +1 -1
- package/lib/esm/queries/IRAliasScope.js.map +1 -1
- package/lib/esm/queries/IRCanonicalize.js.map +1 -1
- package/lib/esm/queries/IRDesugar.js.map +1 -1
- package/lib/esm/queries/IRLower.js.map +1 -1
- package/lib/esm/queries/IRMutation.js.map +1 -1
- package/lib/esm/queries/IRPipeline.js.map +1 -1
- package/lib/esm/queries/IRProjection.js.map +1 -1
- package/lib/esm/queries/IntermediateRepresentation.d.ts +6 -1
- package/lib/esm/queries/IntermediateRepresentation.js.map +1 -1
- package/lib/esm/queries/MutationQuery.js.map +1 -1
- package/lib/esm/queries/MutationSerialization.js.map +1 -1
- package/lib/esm/queries/MutationThenable.js.map +1 -1
- package/lib/esm/queries/PropertyPath.js.map +1 -1
- package/lib/esm/queries/ProxiedPathBuilder.js.map +1 -1
- package/lib/esm/queries/QueryBuilder.js.map +1 -1
- package/lib/esm/queries/QueryBuilderSerialization.js.map +1 -1
- package/lib/esm/queries/QueryContext.js.map +1 -1
- package/lib/esm/queries/QueryFactory.js.map +1 -1
- package/lib/esm/queries/SelectQuery.js.map +1 -1
- package/lib/esm/queries/UpdateBuilder.js.map +1 -1
- package/lib/esm/queries/UpdateQuery.js.map +1 -1
- package/lib/esm/queries/fromJSON.js.map +1 -1
- package/lib/esm/queries/lower.js.map +1 -1
- package/lib/esm/queries/lowerMutationJSON.js.map +1 -1
- package/lib/esm/queries/mutationLowerSpec.js.map +1 -1
- package/lib/esm/queries/queryDispatch.js.map +1 -1
- package/lib/esm/queries/reservedQueryNames.js.map +1 -1
- package/lib/esm/queries/resolveShape.js.map +1 -1
- package/lib/esm/queries/wireVersion.js.map +1 -1
- package/lib/esm/shapes/List.js.map +1 -1
- package/lib/esm/shapes/PathNode.js.map +1 -1
- package/lib/esm/shapes/SHACL.js.map +1 -1
- package/lib/esm/shapes/Shape.js.map +1 -1
- package/lib/esm/shapes/nodeShapeData.js.map +1 -1
- package/lib/esm/shapes/nodeShapeWire.js.map +1 -1
- package/lib/esm/shapes/propertyShapeTerms.js.map +1 -1
- package/lib/esm/shapes/registerRuntimeShape.js.map +1 -1
- package/lib/esm/shapes/serializePathToNodeData.js.map +1 -1
- package/lib/esm/shapes/syncShapes.js.map +1 -1
- package/lib/esm/shapes/validation.js.map +1 -1
- package/lib/esm/sparql/SparqlAlgebra.js.map +1 -1
- package/lib/esm/sparql/SparqlDataset.js.map +1 -1
- package/lib/esm/sparql/algebraToString.js.map +1 -1
- package/lib/esm/sparql/index.js.map +1 -1
- package/lib/esm/sparql/irToAlgebra.js +34 -5
- package/lib/esm/sparql/irToAlgebra.js.map +1 -1
- package/lib/esm/sparql/resultMapping.js.map +1 -1
- package/lib/esm/sparql/sparqlUtils.js.map +1 -1
- package/lib/esm/utils/LinkedErrorLogging.js.map +1 -1
- package/lib/esm/utils/LinkedFileStorage.js.map +1 -1
- package/lib/esm/utils/LinkedStorage.js.map +1 -1
- package/lib/esm/utils/NameSpace.js.map +1 -1
- package/lib/esm/utils/NodeReference.js.map +1 -1
- package/lib/esm/utils/Package.js.map +1 -1
- package/lib/esm/utils/Prefix.js.map +1 -1
- package/lib/esm/utils/ShapeClass.js.map +1 -1
- package/lib/esm/utils/URI.js.map +1 -1
- package/lib/esm/utils/cached.js.map +1 -1
- package/lib/esm/utils/loadStores.js.map +1 -1
- package/lib/esm/utils/parseDatasetsConfig.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"IntermediateRepresentation.js","sourceRoot":"","sources":["../../../src/queries/IntermediateRepresentation.ts"],"names":[],"mappings":"","sourcesContent":["import {NodeReferenceValue} from './QueryFactory.js';\nimport type {PathExpr} from '../paths/PropertyPathExpr.js';\n\nexport type IRDirection = 'ASC' | 'DESC';\nexport type IRAlias = string;\n\nexport type IRValue = string | number | boolean | null;\n\nexport type IRQuery =\n | IRSelectQuery\n | IRAskQuery\n | IRCountQuery\n | IRCreateMutation\n | IRUpdateMutation\n | IRUpsertMutation\n | IRDeleteMutation\n | IRDeleteAllMutation\n | IRDeleteWhereMutation\n | IRUpdateWhereMutation;\n\nexport type IRSelectQuery = {\n kind: 'select';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n projection: IRProjectionItem[];\n where?: IRExpression;\n orderBy?: IROrderByItem[];\n limit?: number;\n offset?: number;\n subjectId?: string;\n subjectIds?: string[];\n singleResult?: boolean;\n resultMap?: IRResultMapEntry[];\n};\n\n/**\n * A query whose answer is a boolean.\n *\n * Carries a pattern and nothing else. There is no `projection`, `orderBy`,\n * `limit` or `offset`: each of those shapes or windows a *solution sequence*, and\n * an ask has none — so rather than being ignored during conversion, or guarded\n * against, they are unrepresentable.\n *\n * `root` is **optional**. Absent means no `rdf:type` constraint at all — \"does a\n * node with this IRI exist\", under any shape or none — which lowers to\n * `ASK { <iri> ?p ?o }`. A rootless ask carries no `patterns` or `where`, since\n * both reference properties and a property is only resolvable through a shape.\n */\nexport type IRAskQuery = {\n kind: 'ask';\n root?: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n};\n\n/**\n * A query whose answer is a single number: how many instances of a shape match.\n *\n * Like {@link IRAskQuery}, it carries a **pattern and nothing else**. There is no\n * `projection`, `orderBy`, `limit` or `offset`: each of those shapes or windows a\n * *solution sequence*, and a count has none — the number it answers is a property\n * of the whole match set. So rather than being ignored during conversion, or\n * guarded against, they are unrepresentable.\n *\n * That is the entire reason this is a distinct IR kind and not a flag on\n * {@link IRSelectQuery}: a count of a windowed query is meaningless, and a type\n * that cannot hold the window cannot half-drop it.\n *\n * `root` is **required**, unlike an ask's. A shapeless count would count every\n * node in the store, which is never what a caller means.\n */\nexport type IRCountQuery = {\n kind: 'count';\n root: IRShapeScanPattern;\n patterns: IRGraphPattern[];\n where?: IRExpression;\n subjectId?: string;\n subjectIds?: string[];\n /**\n * The variable the `COUNT` is bound to (`(COUNT(DISTINCT ?a0) AS ?count)`).\n * Carried in the IR rather than hardcoded in two places so lowering and result\n * mapping cannot disagree about it.\n */\n alias: IRAlias;\n};\n\nexport type IRProjectionItem = {\n alias: IRAlias;\n expression: IRExpression;\n};\n\nexport type IROrderByItem = {\n expression: IRExpression;\n direction: IRDirection;\n};\n\nexport type IRResultMapEntry = {\n key: string;\n alias: IRAlias;\n};\n\nexport type IRGraphPattern =\n | IRShapeScanPattern\n | IRTraversePattern\n | IRJoinPattern\n | IROptionalPattern\n | IRUnionPattern\n | IRExistsPattern\n | IRMinusPattern;\n\nexport type IRShapeScanPattern = {\n kind: 'shape_scan';\n shape: string;\n alias: IRAlias;\n};\n\nexport type IRTraversePattern = {\n kind: 'traverse';\n from: IRAlias;\n to: IRAlias;\n property: string;\n pathExpr?: PathExpr;\n filter?: IRExpression;\n maxCount?: number;\n /**\n * Inner LIMIT/OFFSET/ORDER BY for a nested select on this traversal's\n * related collection. When set, the root→child traverse is wrapped in a\n * SPARQL sub-SELECT to bound the collection per parent. Only valid when the\n * outer query targets a single root subject (enforced in irToAlgebra).\n */\n innerLimit?: number;\n innerOffset?: number;\n innerOrderBy?: IRInnerOrderBy[];\n};\n\nexport type IRInnerOrderBy = {\n property: string;\n direction: IRDirection;\n};\n\nexport type IRJoinPattern = {\n kind: 'join';\n patterns: IRGraphPattern[];\n};\n\nexport type IROptionalPattern = {\n kind: 'optional';\n pattern: IRGraphPattern;\n};\n\nexport type IRUnionPattern = {\n kind: 'union';\n branches: IRGraphPattern[];\n};\n\nexport type IRExistsPattern = {\n kind: 'exists';\n pattern: IRGraphPattern;\n};\n\nexport type IRMinusPattern = {\n kind: 'minus';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRExpression =\n | IRLiteralExpression\n | IRReferenceExpression\n | IRAliasExpression\n | IRPropertyExpression\n | IRContextPropertyExpression\n | IRBinaryExpression\n | IRLogicalExpression\n | IRNotExpression\n | IRFunctionExpression\n | IRAggregateExpression\n | IRExistsExpression\n | IRInExpression;\n\n/**\n * Membership test — `value IN (…)` / `NOT IN (…)`.\n * `source` is forward-shaped: today only the explicit-`list` arm exists (Rung 1);\n * a `{query}` arm (Rung 2 — membership against a subquery, lowering to EXISTS)\n * can be added without changing the node's identity or the `oneOf`/`notOneOf` DSL.\n */\nexport type IRInExpression = {\n kind: 'in_expr';\n negated: boolean;\n value: IRExpression;\n source: {list: IRExpression[]};\n};\n\nexport type IRLiteralExpression = {\n kind: 'literal_expr';\n /**\n * `Date` is admitted alongside `IRValue`: a temporal comparison has to reach the\n * SPARQL layer still knowing it is temporal, or the literal is emitted untyped\n * and never equals the `^^xsd:dateTime` term the mutation side writes.\n */\n value: IRValue | Date;\n};\n\nexport type IRReferenceExpression = {\n kind: 'reference_expr';\n /** The referenced node IRI. Optional only while a `contextName` is unresolved. */\n value?: string;\n /**\n * A query-context reference (`{@ctx}` on the wire). When set, `value` is filled\n * by `lower()` from the live context map — resolved or thrown there, never baked\n * at build time. Absent for a plain node reference.\n */\n contextName?: string;\n};\n\nexport type IRAliasExpression = {\n kind: 'alias_expr';\n alias: IRAlias;\n};\n\nexport type IRPropertyExpression = {\n kind: 'property_expr';\n sourceAlias: IRAlias;\n property: string;\n pathExpr?: import('../paths/PropertyPathExpr.js').PathExpr;\n maxCount?: number;\n};\n\nexport type IRContextPropertyExpression = {\n kind: 'context_property_expr';\n /** The context entity IRI. Optional only while a `contextName` is unresolved. */\n contextIri?: string;\n /** A query-context reference resolved into `contextIri` by `lower()`. */\n contextName?: string;\n property: string;\n};\n\nexport type IRBinaryOperator =\n | '='\n | '!='\n | '>'\n | '>='\n | '<'\n | '<='\n | '+'\n | '-'\n | '*'\n | '/';\n\nexport type IRBinaryExpression = {\n kind: 'binary_expr';\n operator: IRBinaryOperator;\n left: IRExpression;\n right: IRExpression;\n};\n\nexport type IRLogicalOperator = 'and' | 'or';\n\nexport type IRLogicalExpression = {\n kind: 'logical_expr';\n operator: IRLogicalOperator;\n expressions: IRExpression[];\n};\n\nexport type IRNotExpression = {\n kind: 'not_expr';\n expression: IRExpression;\n};\n\nexport type IRFunctionExpression = {\n kind: 'function_expr';\n name: string;\n args: IRExpression[];\n};\n\nexport type IRAggregateExpression = {\n kind: 'aggregate_expr';\n name: 'count' | 'sum' | 'avg' | 'min' | 'max';\n args: IRExpression[];\n};\n\nexport type IRExistsExpression = {\n kind: 'exists_expr';\n pattern: IRGraphPattern;\n filter?: IRExpression;\n};\n\nexport type IRCreateMutation = {\n kind: 'create';\n shape: string;\n data: IRNodeData;\n};\n\nexport type IRTraversalPattern = {\n from: string; // source alias\n property: string; // property IRI\n to: string; // target alias\n};\n\nexport type IRUpdateMutation = {\n kind: 'update';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\n/**\n * Create-or-replace against a known id, in one request.\n *\n * Structurally identical to {@link IRUpdateMutation} — it lowers through the same\n * DELETE/INSERT/WHERE body — and differs in exactly one emitted triple: upsert also\n * asserts `?id rdf:type <targetClass>`, which the update path never writes.\n *\n * That single triple is the whole difference between the two, because `update`'s WHERE\n * is a bare `OPTIONAL` and so already matches when the node is absent. It is a distinct\n * IR kind rather than a flag on the update mutation so that a consumer which does not\n * know about upsert fails loudly, instead of quietly writing an untyped node and\n * reporting success.\n */\nexport type IRUpsertMutation = {\n kind: 'upsert';\n shape: string;\n id: string;\n data: IRNodeData;\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRDeleteMutation = {\n kind: 'delete';\n shape: string;\n ids: NodeReferenceValue[];\n};\n\nexport type IRDeleteAllMutation = {\n kind: 'delete_all';\n shape: string;\n};\n\nexport type IRDeleteWhereMutation = {\n kind: 'delete_where';\n shape: string;\n where: IRExpression;\n wherePatterns: IRGraphPattern[];\n};\n\nexport type IRUpdateWhereMutation = {\n kind: 'update_where';\n shape: string;\n data: IRNodeData;\n where?: IRExpression;\n wherePatterns?: IRGraphPattern[];\n traversalPatterns?: IRTraversalPattern[];\n};\n\nexport type IRNodeData = {\n shape: string;\n fields: IRFieldUpdate[];\n id?: string;\n};\n\nexport type IRFieldUpdate = {\n property: string;\n value: IRFieldValue;\n};\n\nexport type IRSetModificationValue = {\n add?: IRFieldValue[];\n remove?: NodeReferenceValue[];\n};\n\nexport type IRFieldValue =\n | IRValue\n | Date\n | NodeReferenceValue\n | IRNodeData\n | IRSetModificationValue\n | IRFieldValue[]\n | IRExpression\n | undefined;\n\n// ---------------------------------------------------------------------------\n// Store result types\n// ---------------------------------------------------------------------------\n// These types describe what an IDataset implementation should return.\n// The calling layer (LinkedStorage via queryDispatch) threads the precise\n// DSL-level TypeScript result type back to the caller, so the store\n// only needs to produce data that satisfies these structural contracts.\n// ---------------------------------------------------------------------------\n\n/**\n * A single result row — an object with a node id and dynamic fields.\n * Used in select and create results.\n */\nexport type ResultRow = {id: string; [key: string]: ResultFieldValue};\n\n/**\n * Possible field values in a select or create result row.\n */\nexport type ResultFieldValue =\n | string\n | number\n | boolean\n | Date\n | null\n | undefined\n | ResultRow\n | ResultRow[]\n | string[]\n | number[]\n | boolean[]\n | Date[];\n\n/**\n * What `selectQuery` should return.\n *\n * - Array of rows for multi-result queries (the default).\n * - A single row when `query.singleResult` is true (`.one()` or subject-targeted query).\n * - `null` when `singleResult` is true and the target node doesn't exist.\n */\nexport type SelectResult = ResultRow[] | ResultRow | null;\n\n/**\n * What `createQuery` should return.\n *\n * A single row with the generated `id` and the created field values.\n * Nested creates appear as nested `ResultRow` objects (with their own ids).\n * Array fields (e.g. friends) appear as `ResultRow[]`.\n */\nexport type CreateResult = ResultRow;\n\n/**\n * When a set property is fully overwritten, the result contains `updatedTo`\n * with the new complete set of values.\n */\nexport type SetOverwriteResult = {updatedTo: ResultRow[]};\n\n/**\n * When a set property is incrementally modified with `{add, remove}`,\n * the result contains the added and removed entries.\n */\nexport type SetModificationResult = {added: ResultRow[]; removed: ResultRow[]};\n\n/**\n * Possible field values in an update result row.\n * Extends `ResultFieldValue` with set modification shapes.\n */\nexport type UpdateFieldValue =\n | ResultFieldValue\n | SetOverwriteResult\n | SetModificationResult;\n\n/**\n * What `updateQuery` should return.\n *\n * A single row with the target node's `id` and only the changed fields.\n * Fields not included in the update are omitted (not returned).\n *\n * Field value shapes depend on the type of update:\n * - Literal fields: the new value (string, number, boolean, Date).\n * - Single object fields: a `ResultRow` with the referenced/created node.\n * - Set overwrite (passing an array): `{updatedTo: ResultRow[]}`.\n * - Set add/remove (passing `{add, remove}`): `{added: ResultRow[], removed: ResultRow[]}`.\n * - Unset single field (passing `undefined` or `null`): field is `undefined`.\n * - Unset multi-value field (passing `undefined`): empty array `[]`.\n */\nexport type UpdateResult = {id: string; [key: string]: UpdateFieldValue};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationQuery.js","sourceRoot":"","sources":["../../../src/queries/MutationQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,GAMb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAC,gBAAgB,EAAiB,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAC,wBAAwB,EAAC,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,WAAW,EACX,yBAAyB,GAE1B,MAAM,yBAAyB,CAAC;AAgBjC,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IACpD;;;;;;;;;OASG;IACH,QAAQ,CACN,KAAoB,EACpB,IAAa,EACb,UAA2B,EAAE;QAE7B,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,mFAAmF;IACnF,iBAAiB,CAAC,GAAsB;QACtC,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC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AK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,GAAiB;QAC9C,OAAO,EAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAC,CAAC;IACtB,CAAC;CACF","sourcesContent":["import {\n type LiteralUpdateValue,\n type NodeDescriptionValue,\n NodeReferenceValue,\n type PropUpdateValue,\n QueryFactory,\n type SetModification,\n type SetModificationValue,\n type SinglePropertyUpdateValue,\n type UpdateNodePropertyValue,\n type UpdatePartial,\n} from './QueryFactory.js';\nimport {getPropertyShapes} from '../shapes/nodeShapeData.js';\nimport type {NodeShapeData, PropertyShapeData} from '../shapes/SHACL.js';\nimport {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {resolveShapeConstructor} from '../utils/ShapeClass.js';\nimport {isExpressionNode, ExpressionNode} from '../expressions/ExpressionNode.js';\nimport {createProxiedPathBuilder} from './ProxiedPathBuilder.js';\nimport {asContextRef} from './QueryContext.js';\nimport {\n assertValid,\n undeclaredPropertyMessage,\n type ValidationMode,\n} from '../shapes/validation.js';\n\nexport type NodeId = {id: string} | string;\n\n/** Options for {@link MutationQueryFactory.describe}. */\nexport interface DescribeOptions {\n /** Create data may carry a top-level `id`; update data may not. */\n allowTopLevelId?: boolean;\n /**\n * Validate the data against the shape before normalizing, throwing a\n * `ShapeValidationError` with every violation. Omit to skip validation\n * (normalization-only, e.g. when the caller has already validated).\n */\n validate?: ValidationMode;\n}\n\nexport class MutationQueryFactory extends QueryFactory {\n /**\n * Normalize raw create/update data into a {@link NodeDescriptionValue} — the\n * IR-free step shared by `toJSON()` and `lower()`. Kept on this base (which\n * imports no IR) so the builders can normalize for serialization without\n * pulling the canonical-IR pipeline.\n *\n * This is also the single validation gate: pass `validate` and the resolved\n * data is checked against the shape first, so `toJSON()`, `lower()` and\n * `exec()` reject exactly the same input. See `shapes/validation`.\n */\n describe(\n shape: NodeShapeData,\n data: unknown,\n options: DescribeOptions = {},\n ): NodeDescriptionValue {\n return this.convertUpdateObject(data as any, shape, options);\n }\n\n /** Normalize delete ids (strings / `{id}`) to `NodeReferenceValue[]` (IR-free). */\n normalizeNodeRefs(ids: NodeId[] | NodeId): NodeReferenceValue[] {\n return this.convertNodeReferences(ids);\n }\n\n protected convertUpdateObject(\n obj,\n shape: NodeShapeData,\n {allowTopLevelId = false, validate}: DescribeOptions = {},\n ): NodeDescriptionValue {\n let resolved;\n if (typeof obj === 'object' && !(obj instanceof Date) && obj !== null) {\n if (!allowTopLevelId && 'id' in obj) {\n throw new Error(\n 'You cannot use id in the top level of an update object',\n );\n }\n resolved = obj;\n } else if (typeof obj === 'function') {\n // A shape authored in a project exists only as metadata, so it has no authored\n // class. `getOrCreateShapeAdapter` derives a constructor from that metadata --\n // which is the documented return leg of the shape round trip (see\n // registerRuntimeShape). Resolving with `getShapeClass` alone made every runtime shape\n // fail here with \"Shape class not found\".\n const shapeClass = shape.id ? resolveShapeConstructor(shape.id) : undefined;\n if (!shapeClass) {\n throw new Error(`Shape class not found for ${shape.id || 'unknown'}`);\n }\n const proxy = createProxiedPathBuilder(shapeClass);\n const result = obj(proxy);\n if (typeof result !== 'object' || result === null) {\n throw new Error('Update function must return an object');\n }\n // Validate what the callback produced, not the callback itself.\n resolved = result;\n } else {\n throw new Error('Invalid update object');\n }\n if (validate) {\n assertValid(shape, resolved, {mode: validate});\n }\n return this.convertNodeDescription(resolved, shape);\n }\n\n protected isSetModification(obj, shape) {\n let hasAdd = obj.add;\n let hasRemove = obj.remove;\n let numKeysExpected = (hasAdd ? 1 : 0) + (hasRemove ? 1 : 0);\n let numKeys = Object.getOwnPropertyNames(obj).length;\n // A set modification is ONLY add/remove keys. Mixing them with other keys\n // (e.g. {add:[…], name:'x'}) must NOT be silently treated as a set mod —\n // that dropped the sibling fields. Require an exact key-count match for\n // both add and remove (mirrors isSetModificationValue).\n return (hasAdd || hasRemove) && numKeysExpected === numKeys;\n }\n\n protected convertSetModification(\n obj: SetModification<any>,\n shape: PropertyShapeData,\n ): SetModificationValue {\n if (!obj.add && !obj.remove) {\n throw new Error('Set modification should have either add or remove key');\n }\n const res: SetModificationValue = {};\n if (obj.add) {\n res.$add = this.convertSetAddValue(obj.add, shape);\n }\n if (obj.remove) {\n res.$remove = this.convertSetRemoveValue(obj.remove, shape);\n }\n return res;\n }\n\n protected convertSetRemoveValue(\n obj: UpdatePartial | UpdatePartial[],\n shape: PropertyShapeData,\n ): NodeReferenceValue[] {\n //the user can either pass an array of node references or a single node reference\n //either way we should return an array of node reference values\n if (Array.isArray(obj)) {\n return obj.map((o) => this.convertSingleRemoveValue(o, shape));\n } else {\n return [this.convertSingleRemoveValue(obj, shape)];\n }\n }\n\n protected convertSetAddValue(\n obj: UpdatePartial | UpdatePartial[],\n shape: PropertyShapeData,\n ): UpdatePartial[] {\n if (Array.isArray(obj)) {\n return obj.map((o) => this.convertUpdateValue(o, shape) as UpdatePartial);\n } else {\n return [this.convertUpdateValue(obj, shape) as UpdatePartial];\n }\n }\n\n protected convertSingleRemoveValue(\n value,\n shape: PropertyShapeData,\n ): NodeReferenceValue {\n const ctx = asContextRef(value);\n if (ctx) {\n return ctx as unknown as NodeReferenceValue;\n }\n if (this.isNodeReference(value)) {\n return this.convertNodeReference(value);\n } else {\n throw new Error(\n `Invalid value for ${shape.label}.$remove. Expected an object with an id as key: {id:string}`,\n );\n }\n }\n\n protected convertNodeDescription(\n inputObj: Record<string, unknown>,\n shape: NodeShapeData,\n ): NodeDescriptionValue {\n // Shallow-copy so we never mutate the caller's object\n const obj = {...inputObj};\n const props = getPropertyShapes(shape, true);\n const fields: UpdateNodePropertyValue[] = [];\n let id;\n if ('__id' in obj) {\n //if the object has a __id key, then we should use that in the result\n id = obj.__id.toString();\n //but we should not include it in the fields\n delete obj.__id;\n } else if ('id' in obj) {\n //if the object has an id key alongside other data properties,\n //treat it as a nested create with a predefined ID\n id = String(obj.id);\n delete obj.id;\n }\n for (var key in obj) {\n let propShape = props.find((p) => p.label === key);\n if (!propShape) {\n // Also reported as an `sh:ClosedConstraintComponent` violation when the\n // caller validates; kept here because normalization cannot build a field\n // without a property shape (`describe()` may run without validation).\n throw Error(undeclaredPropertyMessage(key, shape));\n } else {\n fields.push(this.createNodePropertyValue(obj[key], propShape));\n }\n }\n const res: NodeDescriptionValue = {\n fields,\n shape,\n };\n if (id) {\n res.__id = id;\n }\n\n return res;\n }\n\n protected createNodePropertyValue(\n value,\n propShape: PropertyShapeData,\n ): UpdateNodePropertyValue {\n return {\n prop: propShape,\n val: this.convertUpdateValue(value, propShape),\n } as UpdateNodePropertyValue;\n }\n\n protected convertUpdateValue(\n value,\n propShape?: PropertyShapeData,\n allowArrays: boolean = true,\n ): PropUpdateValue {\n // ExpressionNode → pass through as-is (will be converted to IRExpression by IRMutation)\n if (isExpressionNode(value)) {\n return value as unknown as PropUpdateValue;\n }\n\n // Query-context reference → preserve the live ref (do NOT collapse to {id},\n // which would read an unresolved `.id` as undefined). Handles both an unset\n // PendingQueryContext and a resolved context shape; both serialize as a {@ctx}\n // marker and are resolved — or throw — at lowering time.\n {\n const ctx = asContextRef(value);\n if (ctx) return ctx as unknown as PropUpdateValue;\n }\n\n //single value which will\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value instanceof Date\n ) {\n return value as LiteralUpdateValue;\n }\n\n //if multiple items are given as value of this prop\n if (Array.isArray(value)) {\n if (!allowArrays) {\n throw new Error('Nested arrays are not allowed as values of keys');\n }\n //then convert each value, but disallow nested arrays moving forward\n return value.map((o) => {\n return this.convertUpdateValue(o, propShape, false);\n }) as SinglePropertyUpdateValue[];\n } else if (typeof value === 'undefined') {\n return value;\n } else if (value === null) {\n //unsetting a value with null is also possible. But we pass it as undefined in the query object\n return undefined;\n } else if (typeof value === 'object') {\n if (this.isNodeReference(value)) {\n return this.convertNodeReference(value);\n } else {\n let valueShape: NodeShapeData = null;\n if (propShape.valueShape) {\n const shapeClass = resolveShapeConstructor(propShape.valueShape);\n valueShape = shapeClass?.shape || null;\n if (!valueShape) {\n throw new Error(\n `Shape class not found for ${propShape.valueShape.id}`,\n );\n }\n }\n //pass the value shape of the property as the node shape of this value\n if (!propShape.valueShape) {\n //It's possible to define the shape of the value in the value itself for properties who do not define the shape in their objectProperty\n if (value.shape) {\n if (!value.shape.shape) {\n throw new Error(\n `The value of property \"shape\" is invalid and should be a class that extends Shape.`,\n );\n }\n valueShape = (value.shape as typeof Shape).shape;\n } else {\n //TODO: not sure if this should be an error. Does every @linkedObject need to define the shape of the values?\n // If not, then how do we continue? because currently we use the value shape to look up further property shapes\n throw new Error(\n `Cannot update properties with plain objects if the shape of the values is not known. Make sure get/set ${propShape.parentNodeShape.label}.${propShape.label} defines the 'shape' key in its @objectProperty decorator.`,\n );\n }\n }\n //never keep a shape key in the value object\n if (value.shape) {\n //double check that IF a shape value is provided, that it matches the shape from the @objectProperty decorator\n if ((value.shape as typeof Shape).shape.id !== valueShape.id) {\n throw new Error(\n `The property 'shape' is reserved in LINCD and should not be used here in this way. The ${propShape.label} property already defines the shape of the value as ${propShape.label}. If you want to use a different shape, use the 'shape' key in the @objectProperty decorator.`,\n );\n }\n delete value.shape;\n }\n\n if (this.isSetModification(value, propShape)) {\n return this.convertSetModification(value, propShape);\n } else {\n return this.convertNodeDescription(value, valueShape);\n }\n }\n }\n throw new Error(`Unsupported update value type: ${typeof value}`);\n }\n\n protected isNodeReference(obj): obj is NodeReferenceValue {\n //check if obj is an object with only an id property\n //if additional data properties are present, it's a nested create with predefined ID\n return typeof obj === 'object' && obj !== null && 'id' in obj && Object.keys(obj).length === 1;\n }\n\n protected convertNodeReferences(\n input: NodeId[] | NodeId,\n ): NodeReferenceValue[] {\n if (Array.isArray(input)) {\n return input.map((o) => {\n return this.convertNodeReferenceOrString(o);\n });\n } else {\n return [this.convertNodeReferenceOrString(input)];\n }\n }\n\n protected convertNodeReferenceOrString(\n o: {id: string} | string,\n ): NodeReferenceValue {\n if (typeof o === 'string') {\n return {id: o};\n } else if (this.isNodeReference(o)) {\n return this.convertNodeReference(o);\n } else {\n throw new Error(`Invalid node reference: ${JSON.stringify(o)}`);\n }\n }\n\n protected convertNodeReference(obj: {id: string}): NodeReferenceValue {\n return {id: obj.id};\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationSerialization.js","sourceRoot":"","sources":["../../../src/queries/MutationSerialization.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAML,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAErD,OAAO,EACL,eAAe,EACf,eAAe,GAEhB,MAAM,wBAAwB,CAAC;AAoChC,qDAAqD;AACrD,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,cAAc,GAAG,SAAS,CAAC;AAmDjC,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,IAAwB;;IACnD,MAAM,EAAE,GAAG,MAAC,IAA+C,aAA/C,IAAI,uBAAJ,IAAI,CAA6C,UAAU,0CAAE,EAAE,CAAC;IAC5E,OAAO,EAAE,CAAC,CAAC,CAAC,MAAA,aAAa,CAAC,EAAE,CAAC,0CAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAED,kGAAkG;AAClG,SAAS,iBAAiB,CACxB,KAAgC,EAChC,IAAwB;IAExB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;IACjD,IAAI,gB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IAA0B,EAC1B,KAAqB;;IAErB,MAAM,SAAS,GACb,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,QAAQ;QACtC,CAAC,CAAC,MAAA,MAAA,aAAa,CAAC,IAAI,CAAC,cAAc,CAAW,CAAC,0CAAE,KAAK,mCAAI,KAAK;QAC/D,CAAC,CAAC,KAAK,CAAC;IACZ,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,QAAQ;QAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,cAAc,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QACjF,+DAA+D;QAC/D,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,aAAa,IAAI,GAAG,KAAK,WAAW;YAAE,SAAS;QAClF,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,GAAG,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAwB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/**\n * Lossless JSON (de)serialization for mutations (create / update / delete) — the\n * **IR-free wire codec**. The companion IR side (`decodeNodeData` / `lowerMutationJSON`)\n * lives in `lowerMutationJSON.ts` so this module never pulls the canonical-IR pipeline.\n *\n * The serialization unit is the normalized `NodeDescriptionValue` produced by the\n * IR-free factory base (`MutationQueryFactory.describe()`) — i.e. after `.set()` and\n * after any update-expression callback has been evaluated, but before canonical IR.\n * Property keys are serialized as **labels** (shape-relative, lightweight); decoding\n * resolves them back via the registered shape.\n *\n * Values use the DSL-JSON grammar (documentation/dsl-json.md): a bare scalar is a\n * literal; objects tag the kinds `JSON.stringify` can't represent natively\n * (`{@date}`, `{@id}`, `{@ctx}`, `{@list}`, `{@add,@remove}`, `{@unset}`); and a\n * computed value is an S-expr array via the shared `DslJsonExpression` codec —\n * so the wire carries no IR.\n */\nimport {\n type NodeDescriptionValue,\n type NodeReferenceValue,\n type PropUpdateValue,\n type SetModificationValue,\n type SinglePropertyUpdateValue,\n isSetModificationValue,\n} from './QueryFactory.js';\nimport {getPropertyShape} from '../shapes/nodeShapeData.js';\nimport {ExpressionNode, isExpressionNode} from '../expressions/ExpressionNode.js';\nimport type {WherePathJSON} from './QueryBuilderSerialization.js';\nimport type {ContextRefJSON} from './ContextRef.js';\nimport {PendingQueryContext} from './QueryContext.js';\nimport {getShapeClass} from '../utils/ShapeClass.js';\nimport type {NodeShapeData, PropertyShapeData} from '../shapes/SHACL.js';\nimport {\n encodeValueExpr,\n decodeValueExpr,\n type DslJsonValue,\n} from './DslJsonExpression.js';\n\n// =============================================================================\n// JSON types\n// =============================================================================\n\n/**\n * A mutation field value in the DSL-JSON grammar. A bare scalar is a literal; objects\n * tag the non-JSON-native kinds (`@`-sigiled); a computed value is an S-expr array (no IR); a\n * nested-node create is a bare path-keyed object ({@link MutationNodeDataJSON}),\n * disambiguated from the tagged forms by having no reserved value-key.\n */\nexport type MutationValueJSON =\n | string\n | number\n | boolean\n | null\n | {'@date': string}\n | {'@id': string}\n | {'@ctx': string}\n | {'@list': MutationValueJSON[]}\n | {'@add'?: MutationValueJSON[]; '@remove'?: string[]}\n | {'@unset': true}\n | MutationNodeDataJSON // nested-node create (bare, path-keyed)\n | DslJsonValue; // computed expression (S-expr) / {@path}\n\n/**\n * A node description in **path-keyed** form: `label → value`, plus two reserved\n * keys — `__id` (a fixed/predefined id) and `__shape` (the concrete shape IRI,\n * emitted only when it differs from the shape inferred from context, e.g. a\n * subclass instance under a superclass-typed relation).\n */\nexport type MutationNodeDataJSON = {\n [key: string]: MutationValueJSON | undefined;\n};\n\n/** Reserved node-data keys (not property labels). */\nconst NODE_ID_KEY = '__id';\nconst NODE_SHAPE_KEY = '__shape';\n\nexport type CreateMutationJSON = {\n v?: string;\n op: 'create';\n shape: string;\n data: MutationNodeDataJSON;\n};\n\nexport type UpdateMutationJSON = {\n v?: string;\n op: 'update';\n shape: string;\n mode: 'for' | 'forAll' | 'where';\n /** A node id, or a `{@ctx: name}` context reference resolved at lowering. */\n targetId?: string | ContextRefJSON;\n where?: WherePathJSON;\n data: MutationNodeDataJSON;\n};\n\n/**\n * Create-or-replace against a known id.\n *\n * A distinct `op` rather than `op: 'update'` with a new `mode`. An unaware consumer that\n * received `{op: 'update', mode: 'upsert'}` would fall past its `mode === 'for'` and\n * `mode === 'where'` branches into the update-where path with no where clause — an update\n * applied to *every instance of the shape*. A distinct op instead hits `fromJSON`'s\n * existing `default:` and throws \"Unknown query op\": loud, and safe.\n */\nexport type UpsertMutationJSON = {\n v?: string;\n op: 'upsert';\n shape: string;\n /** Upsert targets one known id; there is no `forAll`/`where` form. */\n mode: 'for';\n /** A node id, or a `{@ctx: name}` context reference resolved at lowering. */\n targetId?: string | ContextRefJSON;\n data: MutationNodeDataJSON;\n};\n\nexport type DeleteMutationJSON =\n | {v?: string; op: 'delete'; shape: string; mode: 'ids'; ids: (string | ContextRefJSON)[]}\n | {v?: string; op: 'delete'; shape: string; mode: 'all'}\n | {v?: string; op: 'delete'; shape: string; mode: 'where'; where: WherePathJSON};\n\nexport type MutationJSON =\n | CreateMutationJSON\n | UpdateMutationJSON\n | UpsertMutationJSON\n | DeleteMutationJSON;\n\n// =============================================================================\n// Value codec\n// =============================================================================\n\n/** The shape a nested node is expected to have (a property's value shape), if resolvable. */\nexport function valueShapeOf(prop?: PropertyShapeData): NodeShapeData | undefined {\n const id = (prop as unknown as {valueShape?: {id: string}})?.valueShape?.id;\n return id ? getShapeClass(id)?.shape : undefined;\n}\n\n/** Encode a single (non-array, non-setMod) property value. `prop` gives the nested-node shape. */\nfunction encodeSingleValue(\n value: SinglePropertyUpdateValue,\n prop?: PropertyShapeData,\n): MutationValueJSON {\n if (value === undefined) return {'@unset': true};\n if (isExpressionNode(value)) {\n // A computed value is an S-expr (or {@path}) via the shared codec — no IR.\n return encodeValueExpr(value.ir, value._refs) as MutationValueJSON;\n }\n if (value instanceof Date) return {'@date': value.toISOString()};\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ) {\n return value;\n }\n if (value && typeof value === 'object') {\n // Query-context reference — carry the name, resolve at lowering (checked\n // before the generic `.id` branch since a PendingQueryContext has an `.id` getter).\n if (value instanceof PendingQueryContext) {\n return {'@ctx': value.contextName};\n }\n if ('fields' in value) {\n // Nested-node create — bare path-keyed; expected shape = the relation's value shape.\n return encodeNodeData(value as NodeDescriptionValue, valueShapeOf(prop));\n }\n if ('id' in value) return {'@id': (value as NodeReferenceValue).id};\n }\n throw new Error(`Cannot serialize mutation value: ${JSON.stringify(value)}`);\n}\n\n/** Encode any property value, including arrays and set modifications. */\nexport function encodeValue(\n value: PropUpdateValue,\n prop?: PropertyShapeData,\n): MutationValueJSON {\n if (value === undefined) return {'@unset': true};\n if (Array.isArray(value)) {\n return {'@list': value.map((v) => encodeSingleValue(v, prop))};\n }\n if (isSetModificationValue(value)) {\n const mod = value as SetModificationValue;\n const json: {'@add'?: MutationValueJSON[]; '@remove'?: string[]} = {};\n if (mod.$add) json['@add'] = mod.$add.map((v) => encodeValue(v as PropUpdateValue, prop));\n if (mod.$remove) json['@remove'] = mod.$remove.map((r) => r.id);\n return json;\n }\n return encodeSingleValue(value as SinglePropertyUpdateValue, prop);\n}\n\n/**\n * Encode a normalized node description to path-keyed form. `expectedShape` is the\n * shape inferable from context (the envelope, or the parent relation's value shape);\n * `__shape` is emitted only when the concrete shape differs (a subclass instance).\n */\nexport function encodeNodeData(\n desc: NodeDescriptionValue,\n expectedShape?: NodeShapeData,\n): MutationNodeDataJSON {\n const json: MutationNodeDataJSON = {};\n if (desc.__id) json[NODE_ID_KEY] = desc.__id;\n if (!expectedShape || desc.shape.id !== expectedShape.id) {\n json[NODE_SHAPE_KEY] = desc.shape.id;\n }\n for (const f of desc.fields) {\n json[f.prop.label] = encodeValue(f.val, f.prop);\n }\n return json;\n}\n\n// =============================================================================\n// JSON → raw UpdatePartial (for builder rehydration / fromJSON)\n// =============================================================================\n\n// Bound the DSL-JSON decode recursion (rehydration path) against a deeply-nested\n// payload exhausting the stack. Mirrors the cap in lowerMutationJSON.\nconst MAX_DECODE_DEPTH = 128;\nlet _decodeDepth = 0;\n\n/**\n * Decode a DSL-JSON value back to a raw DSL value (the form `.set()` accepts).\n * `currentShape` resolves computed `{@path}`/S-expr; `prop` gives a nested node's shape.\n * Depth-guarded wrapper around {@link decodeValueToRawInner}.\n */\nfunction decodeValueToRaw(\n json: MutationValueJSON,\n currentShape: NodeShapeData | undefined,\n prop?: PropertyShapeData,\n): unknown {\n if (++_decodeDepth > MAX_DECODE_DEPTH) {\n _decodeDepth = 0;\n throw new Error('DSL-JSON value nested too deeply');\n }\n try {\n return decodeValueToRawInner(json, currentShape, prop);\n } finally {\n _decodeDepth--;\n }\n}\n\nfunction decodeValueToRawInner(\n json: MutationValueJSON,\n currentShape: NodeShapeData | undefined,\n prop?: PropertyShapeData,\n): unknown {\n // S-expr computed value\n if (Array.isArray(json)) {\n const {ir, refs} = decodeValueExpr(json as DslJsonValue, requireShapeForExpr(currentShape));\n return new ExpressionNode(ir, refs);\n }\n if (json === null) return null;\n if (typeof json !== 'object') return json; // bare scalar literal\n const o = json as Record<string, unknown>;\n if ('@unset' in o) return undefined;\n if ('@date' in o) return new Date(o['@date'] as string);\n // Rehydration path: preserve the live reference so it re-serializes as a\n // `{@ctx}` marker and resolves at the rebuilt builder's own lowering.\n if ('@ctx' in o) return new PendingQueryContext(o['@ctx'] as string);\n if ('@id' in o) return {id: o['@id']};\n if ('@list' in o) {\n return (o['@list'] as MutationValueJSON[]).map((i) => decodeValueToRaw(i, currentShape, prop));\n }\n if ('@add' in o || '@remove' in o) {\n // Raw DSL set-modifications use `@add`/`@remove` on the wire.\n const mod: {add?: unknown[]; remove?: {id: string}[]} = {};\n if (o['@add']) mod.add = (o['@add'] as MutationValueJSON[]).map((i) => decodeValueToRaw(i, currentShape, prop));\n if (o['@remove']) mod.remove = (o['@remove'] as string[]).map((id) => ({id}));\n return mod;\n }\n // A computed-path value (`{@path}`) used as a value.\n if ('@path' in o) {\n const {ir, refs} = decodeValueExpr(json as DslJsonValue, requireShapeForExpr(currentShape));\n return new ExpressionNode(ir, refs);\n }\n // Otherwise: a bare path-keyed nested-node create.\n return decodeNodeDataToRaw(o as MutationNodeDataJSON, valueShapeOf(prop) ?? currentShape);\n}\n\nfunction requireShapeForExpr(shape: NodeShapeData | undefined): NodeShapeData {\n if (!shape) {\n throw new Error('A shape is required to decode a computed mutation value');\n }\n return shape;\n}\n\n/**\n * Decode path-keyed node data into a raw object the mutation builders' `.set()` accepts.\n * `__id` becomes `id`; `__shape` (if present) overrides the inferred `shape`. Mirrors\n * {@link encodeNodeData}.\n */\nexport function decodeNodeDataToRaw(\n json: MutationNodeDataJSON,\n shape?: NodeShapeData,\n): Record<string, unknown> {\n const nodeShape =\n typeof json[NODE_SHAPE_KEY] === 'string'\n ? getShapeClass(json[NODE_SHAPE_KEY] as string)?.shape ?? shape\n : shape;\n const obj: Record<string, unknown> = {};\n if (typeof json[NODE_ID_KEY] === 'string') obj.id = json[NODE_ID_KEY];\n for (const [key, val] of Object.entries(json)) {\n if (key === NODE_ID_KEY || key === NODE_SHAPE_KEY || val === undefined) continue;\n // Skip prototype-polluting keys from untrusted DSL-JSON input.\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue;\n const prop = nodeShape ? getPropertyShape(nodeShape, key) : undefined;\n obj[key] = decodeValueToRaw(val as MutationValueJSON, nodeShape, prop);\n }\n return obj;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationThenable.js","sourceRoot":"","sources":["../../../src/queries/MutationThenable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAgB,gBAAgB;IAOpC,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,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"MutationThenable.js","sourceRoot":"","sources":["../../../src/queries/MutationThenable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAgB,gBAAgB;IAOpC,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,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/**\n * Shared thenable base for the mutation builders (Create/Update/Delete).\n *\n * Each builder is a lazy, `await`-able handle: it implements the full\n * `Promise<R>` surface by delegating to its own `exec()`, so `await builder`\n * runs the mutation. This base holds the identical `then`/`catch`/`finally`/\n * `Symbol.toStringTag` wiring; subclasses provide only `exec()` and a `_tag`.\n */\nexport abstract class MutationThenable<R> implements PromiseLike<R>, Promise<R> {\n /** Execute the mutation. Subclasses implement the dispatch. */\n abstract exec(): Promise<R>;\n\n /** Class name reported by `Symbol.toStringTag` (stable under minification). */\n protected abstract readonly _tag: string;\n\n then<TResult1 = R, TResult2 = never>(\n onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,\n ): Promise<TResult1 | TResult2> {\n return this.exec().then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,\n ): Promise<R | TResult> {\n return this.then().catch(onrejected);\n }\n\n finally(onfinally?: (() => void) | null): Promise<R> {\n return this.then().finally(onfinally);\n }\n\n get [Symbol.toStringTag](): string {\n return this._tag;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyPath.js","sourceRoot":"","sources":["../../../src/queries/PropertyPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACvB,YACW,SAAwB,EACxB,QAAsC;QADtC,cAAS,GAAT,SAAS,CAAe;QACxB,aAA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/nodeShapeData.js';\nimport {getShapeClass} from '../utils/ShapeClass.js';\n\n/**\n * A value object representing a sequence of property traversals from a root shape.\n *\n * Each segment is a PropertyShapeData representing one hop in the traversal.\n * For example, `friends.name` on PersonShape produces a PropertyPath with\n * two segments: [friendsPropertyShape, namePropertyShape].\n *\n * This is used by FieldSet and QueryBuilder to describe which properties\n * to select/filter, independent of proxy tracing.\n */\nexport class PropertyPath {\n constructor(\n readonly rootShape: NodeShapeData,\n readonly segments: readonly PropertyShapeData[],\n ) {}\n\n /** Append a property traversal hop, returning a new PropertyPath. */\n prop(property: PropertyShapeData): PropertyPath {\n return new PropertyPath(this.rootShape, [...this.segments, property]);\n }\n\n /** The terminal (leaf) property of this path. */\n get terminal(): PropertyShapeData | undefined {\n return this.segments[this.segments.length - 1];\n }\n\n /** The depth (number of hops) of this path. */\n get depth(): number {\n return this.segments.length;\n }\n\n /** String representation using property labels joined by dots. */\n toString(): string {\n return this.segments.map((s) => s.label).join('.');\n }\n\n /** Two PropertyPaths are equal if they have the same root shape and same segment sequence. */\n equals(other: PropertyPath): boolean {\n if (this.rootShape.id !== other.rootShape.id) return false;\n if (this.segments.length !== other.segments.length) return false;\n return this.segments.every((s, i) => s.id === other.segments[i].id);\n }\n}\n\n/**\n * Resolve a dot-separated property path string into a PropertyPath.\n *\n * Walks the shape's property shapes by label, following valueShape references\n * to traverse into nested shapes.\n *\n * Example: `walkPropertyPath(PersonShape, 'friends.name')` resolves\n * [friendsPropertyShape, namePropertyShape].\n *\n * @throws If any segment cannot be resolved.\n */\nexport function walkPropertyPath(shape: NodeShapeData, path: string): PropertyPath {\n const labels = path.split('.');\n const segments: PropertyShapeData[] = [];\n let currentShape = shape;\n\n for (const label of labels) {\n const propertyShape = getPropertyShape(currentShape, label);\n if (!propertyShape) {\n throw new Error(\n `Property '${label}' not found on shape '${currentShape.label || currentShape.id}' while resolving path '${path}'`,\n );\n }\n segments.push(propertyShape);\n\n // If there are more segments to resolve, follow the valueShape\n if (segments.length < labels.length) {\n if (!propertyShape.valueShape) {\n throw new Error(\n `Property '${label}' on shape '${currentShape.label || currentShape.id}' has no valueShape; cannot traverse further in path '${path}'`,\n );\n }\n const shapeClass = getShapeClass(propertyShape.valueShape);\n if (!shapeClass || !shapeClass.shape) {\n throw new Error(\n `Cannot resolve valueShape '${propertyShape.valueShape.id}' for property '${label}' in path '${path}'`,\n );\n }\n currentShape = shapeClass.shape;\n }\n }\n\n return new PropertyPath(shape, segments);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxiedPathBuilder.js","sourceRoot":"","sources":["../../../src/queries/ProxiedPathBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAA+C;IAE/C,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;QACxC,qEAAqE;QACrE,gEAAgE;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,2EAA2E;IAC3E,8EAA8E;IAC9E,yEAAyE;IACzE,oCAAoC;IACpC,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ProxiedPathBuilder.js","sourceRoot":"","sources":["../../../src/queries/ProxiedPathBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAA+C;IAE/C,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;QACxC,qEAAqE;QACrE,gEAAgE;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,2EAA2E;IAC3E,8EAA8E;IAC9E,yEAAyE;IACzE,oCAAoC;IACpC,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {Shape, createShapeTarget, type ShapeConstructor} from '../shapes/Shape.js';\nimport {QueryBuilderObject, QueryShape} from './SelectQuery.js';\n\n/**\n * Creates the proxy object used as the `p` parameter in query callbacks.\n *\n * Property access on the returned proxy (e.g., `p.name`, `p.friends.name`)\n * creates QueryBuilderObject chains that trace the path of requested properties.\n * This is the shared foundation for both the DSL (`Person.select(p => p.name)`)\n * and the future QueryBuilder API.\n *\n * Originally extracted from SelectQueryFactory.getQueryShape() to enable reuse\n * across the DSL and dynamic query building.\n */\nexport function createProxiedPathBuilder<S extends Shape>(\n shape: ShapeConstructor<S> | QueryBuilderObject,\n): QueryBuilderObject {\n if (shape instanceof QueryBuilderObject) {\n // When a QueryBuilderObject is passed directly (e.g. QueryPrimitives\n // used as the shape for where-clause evaluation), use it as-is.\n return shape;\n }\n // Create a constructor-less dummy shape target and wrap it in a QueryShape\n // proxy. The proxy intercepts property access and resolves each property name\n // to its PropertyShapeData, building a chain of QueryBuilderObjects that\n // records which path was traversed.\n const dummyShape = createShapeTarget(shape);\n return QueryShape.create(dummyShape);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilder.js","sourceRoot":"","sources":["../../../src/queries/QueryBuilder.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAC,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAOL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAC,YA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C;oBACtE,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,0EAA0E;gBAC1E,yEAAyE;gBACzE,0EAA0E;gBAC1E,wEAAwE;gBACxE,8DAA8D;gBAC9D,oEAAoE;gBACpE,sEAAsE;gBACtE,4CAA4C;gBAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,gCAAiC,GAAa,CAAC,KAAK,qCAAqC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;gBAChJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE;oBACtC,KAAK,EAAE,GAAG;oBACV,QAAQ,EAAE,IAAI;oBACd,YAAY,EAAE,IAAI;oBAClB,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,MAAM,OAAO,CAAC;YAChB,CAAC;QACH,CAAC;KAAA;IAED,8EAA8E;IAC9E,+BAA+B;IAC/B,8EAA8E;IAE9E,kCAAkC;IAClC,IAAI,CACF,WAA0E,EAC1E,UAAuE;QAEvE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,2EAA2E;IAC3E,KAAK,CACH,UAAqE;QAErE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,+EAA+E;IAC/E,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;AAED,4FAA4F;AAC5F,OAAO,EAAC,aAAa,IAAI,YAAY,EAAC,CAAC","sourcesContent":["import {Shape, type ShapeConstructor} from '../shapes/Shape.js';\nimport {getUniquePropertyShapes} from '../shapes/nodeShapeData.js';\nimport {resolveShape} from './resolveShape.js';\nimport {\n type QueryBuildFn,\n type WhereClause,\n type QResult,\n type QueryResponseToResultType,\n type SelectAllQueryResponse,\n type QueryComponentLike,\n processWhereClause,\n evaluateSortCallback,\n} from './SelectQuery.js';\nimport type {SortByPath, WherePath} from './SelectQuery.js';\nimport type {PropertyPathSegment, RawMinusEntry, RawSelectInput} from './IRDesugar.js';\nimport {WIRE_VERSION, assertWireVersion} from './wireVersion.js';\nimport {getQueryDispatch} from './queryDispatch.js';\nimport {AskBuilder} from './AskBuilder.js';\nimport {CountBuilder} from './CountBuilder.js';\nimport type {IDataset} from '../interfaces/IDataset.js';\nimport type {NodeShapeData} from '../shapes/SHACL.js';\nimport type {NodeReferenceValue} from './QueryFactory.js';\nimport {resolveUriOrThrow} from '../utils/NodeReference.js';\nimport {FieldSet, type FieldSetFieldJSON, type FieldSetEntry} from './FieldSet.js';\nimport {PendingQueryContext, UnresolvedContextError} from './QueryContext.js';\nimport {encodeContextRef, isContextRefJSON, type ContextRefJSON} from './ContextRef.js';\nimport {createProxiedPathBuilder} from './ProxiedPathBuilder.js';\nimport {\n serializeWherePath,\n serializeSortByPath,\n serializeRawMinusEntry,\n deserializeWherePath,\n deserializeSortByPath,\n deserializeRawMinusEntry,\n type WherePathJSON,\n type SortByPathJSON,\n type RawMinusEntryJSON,\n} from './QueryBuilderSerialization.js';\n\n/** JSON representation of a SelectBuilder. */\nexport type QueryBuilderJSON = {\n /** DSL-JSON wire-format version. */\n v?: string;\n shape: string;\n fields?: FieldSetFieldJSON[];\n limit?: number;\n offset?: number;\n /** A node id, or a `{@ctx: name}` context reference resolved at lowering. */\n subject?: string | ContextRefJSON;\n subjects?: string[];\n /** `.one()` — unwrap a single result. */\n one?: boolean;\n where?: WherePathJSON;\n sortBy?: SortByPathJSON;\n minusEntries?: RawMinusEntryJSON[];\n nullSubject?: boolean;\n};\n\n/** A preload entry binding a property path to a component's query. */\ninterface PreloadEntry {\n path: string;\n component: QueryComponentLike<any, any>;\n}\n\n/** A MINUS entry — either a shape type exclusion or a WHERE-clause condition. */\ninterface MinusEntry<S extends Shape> {\n shapeId?: string;\n whereFn?: WhereClause<S>;\n}\n\n/** Internal state bag for SelectBuilder. */\ninterface QueryBuilderInit<S extends Shape, R> {\n shape: ShapeConstructor<S>;\n selectFn?: QueryBuildFn<S, R>;\n whereFn?: WhereClause<S>;\n sortByFn?: QueryBuildFn<S, any>;\n sortDirection?: 'ASC' | 'DESC';\n limit?: number;\n offset?: number;\n subject?: S | QResult<S> | NodeReferenceValue;\n subjects?: NodeReferenceValue[];\n singleResult?: boolean;\n selectAllLabels?: string[];\n fieldSet?: FieldSet;\n preloads?: PreloadEntry[];\n minusEntries?: MinusEntry<S>[];\n _nullSubject?: boolean;\n _pendingContextName?: string;\n // Pre-evaluated data (restored from JSON; used when callbacks are not available)\n _where?: WherePath;\n _sortBy?: SortByPath;\n _rawMinusEntries?: RawMinusEntry[];\n}\n\n/**\n * An immutable, fluent query builder for select queries.\n *\n * Every mutation method (`.select()`, `.where()`, `.limit()`, etc.) returns\n * a **new** SelectBuilder instance — the original is never modified.\n *\n * Implements `PromiseLike` so queries execute on `await`:\n * ```ts\n * const results = await SelectBuilder.from(Person).select(p => p.name);\n * ```\n *\n * Produces a raw select input (`toRawInput()`) that the free `lower()` function\n * turns into IR; the builder itself carries no dependency on the IR pipeline.\n */\nexport class SelectBuilder<S extends Shape = Shape, R = any, Result = any>\n implements PromiseLike<Result>, Promise<Result>\n{\n private readonly _shape: ShapeConstructor<S>;\n private readonly _selectFn?: QueryBuildFn<S, R>;\n private readonly _whereFn?: WhereClause<S>;\n private readonly _sortByFn?: QueryBuildFn<S, any>;\n private readonly _sortDirection?: 'ASC' | 'DESC';\n private readonly _limit?: number;\n private readonly _offset?: number;\n private readonly _subject?: S | QResult<S> | NodeReferenceValue;\n private readonly _subjects?: NodeReferenceValue[];\n private readonly _singleResult?: boolean;\n private readonly _selectAllLabels?: string[];\n private readonly _fieldSet?: FieldSet;\n private readonly _preloads?: PreloadEntry[];\n private readonly _minusEntries?: MinusEntry<S>[];\n private readonly _nullSubject?: boolean;\n private readonly _pendingContextName?: string;\n // Pre-evaluated data (restored from JSON; used when callbacks are not available)\n private readonly _where?: WherePath;\n private readonly _sortBy?: SortByPath;\n private readonly _rawMinusEntries?: RawMinusEntry[];\n\n private constructor(init: QueryBuilderInit<S, R>) {\n this._shape = init.shape;\n this._selectFn = init.selectFn;\n this._whereFn = init.whereFn;\n this._sortByFn = init.sortByFn;\n this._sortDirection = init.sortDirection;\n this._limit = init.limit;\n this._offset = init.offset;\n this._subject = init.subject;\n this._subjects = init.subjects;\n this._singleResult = init.singleResult;\n this._selectAllLabels = init.selectAllLabels;\n this._fieldSet = init.fieldSet;\n this._preloads = init.preloads;\n this._minusEntries = init.minusEntries;\n this._nullSubject = init._nullSubject;\n this._pendingContextName = init._pendingContextName;\n this._where = init._where;\n this._sortBy = init._sortBy;\n this._rawMinusEntries = init._rawMinusEntries;\n }\n\n /** Create a shallow clone with overrides. */\n private clone<NR = R, NResult = Result>(overrides: Partial<QueryBuilderInit<S, any>> = {}): SelectBuilder<S, NR, NResult> {\n return new SelectBuilder<S, NR, NResult>({\n shape: this._shape,\n selectFn: this._selectFn as any,\n whereFn: this._whereFn,\n sortByFn: this._sortByFn,\n sortDirection: this._sortDirection,\n limit: this._limit,\n offset: this._offset,\n subject: this._subject,\n subjects: this._subjects,\n singleResult: this._singleResult,\n selectAllLabels: this._selectAllLabels,\n fieldSet: this._fieldSet,\n preloads: this._preloads,\n minusEntries: this._minusEntries,\n _nullSubject: this._nullSubject,\n _pendingContextName: this._pendingContextName,\n _where: this._where,\n _sortBy: this._sortBy,\n _rawMinusEntries: this._rawMinusEntries,\n ...overrides,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Static constructors\n // ---------------------------------------------------------------------------\n\n /**\n * Create a SelectBuilder for the given shape.\n *\n * Accepts a shape class (e.g. `Person`), a NodeShapeData instance,\n * or a shape IRI string (resolved via the shape registry).\n */\n static from<S extends Shape>(\n shape: ShapeConstructor<S> | string,\n ): SelectBuilder<S> {\n const resolved = resolveShape<S>(shape);\n return new SelectBuilder<S>({shape: resolved});\n }\n\n // ---------------------------------------------------------------------------\n // Fluent API — each returns a new instance\n // ---------------------------------------------------------------------------\n\n /** Set the select projection via a callback, labels, or FieldSet. */\n select<NewR>(fn: QueryBuildFn<S, NewR>): SelectBuilder<S, NewR, QueryResponseToResultType<NewR, S>[]>;\n select(labels: string[]): SelectBuilder<S>;\n select<NewR>(fieldSet: FieldSet<NewR>): SelectBuilder<S, NewR, QueryResponseToResultType<NewR, S>[]>;\n select<NewR = R>(fnOrLabelsOrFieldSet: QueryBuildFn<S, NewR> | string[] | FieldSet<any>): SelectBuilder<S, NewR, any> {\n if (fnOrLabelsOrFieldSet instanceof FieldSet) {\n const labels = fnOrLabelsOrFieldSet.labels();\n const selectFn = ((p: any) =>\n labels.map((label) => p[label])) as unknown as QueryBuildFn<S, any>;\n return this.clone<NewR, any>({selectFn, selectAllLabels: undefined, fieldSet: fnOrLabelsOrFieldSet});\n }\n if (Array.isArray(fnOrLabelsOrFieldSet)) {\n const labels = fnOrLabelsOrFieldSet;\n const selectFn = ((p: any) =>\n labels.map((label) => p[label])) as unknown as QueryBuildFn<S, any>;\n return this.clone<NewR, any>({selectFn, selectAllLabels: undefined, fieldSet: undefined});\n }\n return this.clone<NewR, any>({selectFn: fnOrLabelsOrFieldSet as any, selectAllLabels: undefined, fieldSet: undefined});\n }\n\n /** Select all decorated properties of the shape. */\n selectAll(): SelectBuilder<S, any, QueryResponseToResultType<SelectAllQueryResponse<S>, S>[]> {\n const propertyLabels = getUniquePropertyShapes(this._shape.shape)\n .map((ps) => ps.label);\n const selectFn = ((p: any) =>\n propertyLabels.map((label) => p[label])) as unknown as QueryBuildFn<S, any>;\n return this.clone({selectFn, selectAllLabels: propertyLabels});\n }\n\n /** Add a where clause. */\n where(fn: WhereClause<S>): SelectBuilder<S, R, Result> {\n return this.clone({whereFn: fn});\n }\n\n /**\n * Exclude results matching a MINUS pattern.\n *\n * Accepts:\n * - A shape constructor to exclude by type: `.minus(Employee)`\n * - A WHERE callback to exclude by condition: `.minus(p => p.hobby.equals('Chess'))`\n * - A callback returning a property or array of properties for existence exclusion:\n * `.minus(p => p.hobby)` or `.minus(p => [p.hobby, p.bestFriend.name])`\n *\n * Chainable: `.minus(A).minus(B)` produces two separate `MINUS { }` blocks.\n */\n minus(shapeOrFn: ShapeConstructor<any> | WhereClause<S> | ((s: any) => any)): SelectBuilder<S, R, Result> {\n const entry: MinusEntry<S> = {};\n if (typeof shapeOrFn === 'function' && 'shape' in shapeOrFn) {\n // ShapeConstructor — has a static .shape property\n entry.shapeId = (shapeOrFn as ShapeConstructor<any>).shape?.id;\n } else {\n // WhereClause callback\n entry.whereFn = shapeOrFn as WhereClause<S>;\n }\n const existing = this._minusEntries || [];\n return this.clone({minusEntries: [...existing, entry]});\n }\n\n /** Set sort order. */\n orderBy<OR>(fn: QueryBuildFn<S, OR>, direction: 'ASC' | 'DESC' = 'ASC'): SelectBuilder<S, R, Result> {\n return this.clone({sortByFn: fn as any, sortDirection: direction});\n }\n\n /**\n * @deprecated Use `orderBy()` instead.\n */\n sortBy<OR>(fn: QueryBuildFn<S, OR>, direction: 'ASC' | 'DESC' = 'ASC'): SelectBuilder<S, R, Result> {\n return this.orderBy(fn, direction);\n }\n\n /** Set result limit. */\n limit(n: number): SelectBuilder<S, R, Result> {\n return this.clone({limit: n});\n }\n\n /** Set result offset. */\n offset(n: number): SelectBuilder<S, R, Result> {\n return this.clone({offset: n});\n }\n\n /** Target a single entity by ID. Implies singleResult; unwraps array Result type. */\n for(id: string | NodeReferenceValue | PendingQueryContext | null | undefined): SelectBuilder<S, R, Result extends (infer E)[] ? E : Result> {\n if (id instanceof PendingQueryContext) {\n // Store the pending context as subject — its .id getter resolves lazily\n // from the global context map when the query is lowered/serialized.\n return this.clone({subject: id as any, subjects: undefined, singleResult: true, _nullSubject: false, _pendingContextName: id.contextName}) as any;\n }\n if (id == null) {\n // Return a builder that resolves to null when executed (no subject = no query).\n // This commonly happens when getQueryContext() returns null before the user is authenticated.\n return this.clone({subject: undefined, subjects: undefined, singleResult: true, _nullSubject: true, _pendingContextName: undefined}) as any;\n }\n const subject: NodeReferenceValue = typeof id === 'string' ? {id: resolveUriOrThrow(id)} : id;\n return this.clone({subject, subjects: undefined, singleResult: true, _pendingContextName: undefined}) as any;\n }\n\n /**\n * Whether the query has a pending (lazy) context that hasn't resolved yet.\n * Returns true when .for() received a PendingQueryContext whose value isn't available yet.\n */\n hasPendingContext(): boolean {\n return !!(this._pendingContextName && !this._subject?.id);\n }\n\n /** Target multiple entities by ID, or all if no ids given. */\n forAll(ids?: (string | NodeReferenceValue)[]): SelectBuilder<S, R, Result> {\n if (!ids) {\n return this.clone({subject: undefined, subjects: undefined, singleResult: false, _pendingContextName: undefined});\n }\n const subjects = ids.map((id) => typeof id === 'string' ? {id: resolveUriOrThrow(id)} : id);\n return this.clone({subject: undefined, subjects, singleResult: false, _pendingContextName: undefined});\n }\n\n /** Limit to one result. Unwraps array Result type to single element. */\n one(): SelectBuilder<S, R, Result extends (infer E)[] ? E : Result> {\n return this.clone<R, Result extends (infer E)[] ? E : Result>({limit: 1, singleResult: true});\n }\n\n /**\n * Whether **any** row matches this query. Executes immediately and resolves to a\n * real `boolean` — never a row, never `null`, never an array the caller has to\n * interpret.\n *\n * ```ts\n * await Person.select().where(p => p.name.equals('Semmy')).exists(); // boolean\n * await Person.exists({id}); // the common case\n * ```\n *\n * ### The query is normalised to its cheapest correct form first\n *\n * **Dropped** — the projection, preloads, sorting *and pagination* (`limit`/`offset`).\n * **Kept** — filters, `minus` entries and the subject: those decide whether a match\n * exists. `LIMIT 1` is then applied.\n *\n * So `.select(…).orderBy(…).offset(10).exists()` costs, and answers, exactly the\n * same as a bare `.exists()`. Against a SPARQL store that goes out as:\n *\n * ```sparql\n * ASK WHERE { ?a0 rdf:type <…> . FILTER(?a0 = <…>) }\n * ```\n *\n * Pagination does not survive, and cannot: `OFFSET` skips rows of a *solution\n * sequence*, and an ask has none. (Nor is it merely dropped — an\n * {@link AskBuilder} has nowhere to hold it.) `exists()` answers a question about\n * the **match set**, not about a page of it.\n *\n * ### Errors are not swallowed\n *\n * A store, transport or lowering failure rejects the returned promise; it is never\n * reported as `false`. That includes an unresolved query-context reference in a\n * where clause, which `exec()` deliberately reports as `null` (\"not ready\") but\n * which `exists()` must not flatten into a boolean — and a store whose `askQuery`\n * resolves to something that is not a boolean, which rejects rather than being\n * coerced into one.\n *\n * The one case that does resolve `false` without querying is a query with **no\n * subject to ask about** — `.for(null)`, `.for(undefined)`, or an unresolved\n * `PendingQueryContext` *as the subject*. \"Does the node with no id exist?\" has a\n * correct total answer, and it is `false`.\n *\n * @param target Optional explicit dataset, as for {@link exec}.\n */\n async exists(target?: IDataset): Promise<boolean> {\n return this._toAsk().exec(target);\n }\n\n /**\n * **How many** rows match this query — the total of the match set, as a real\n * `number`.\n *\n * ```ts\n * await Person.select().where(p => p.name.equals('Semmy')).count(); // number\n * await SelectBuilder.from(shapeIri).where(…).count(); // from an IRI alone\n * ```\n *\n * ### The query is normalised to its cheapest correct form first\n *\n * **Dropped** — the projection, preloads, sorting *and pagination*\n * (`limit`/`offset`). **Kept** — filters, `minus` entries and the subject: those\n * decide membership of the match set. Against a SPARQL store that goes out as:\n *\n * ```sparql\n * SELECT (COUNT(DISTINCT ?a0) AS ?count)\n * WHERE { ?a0 rdf:type <…> . ?a0 <…name> ?a0_name . FILTER(?a0_name = \"Semmy\") }\n * ```\n *\n * ### `limit`/`offset` are dropped, not rejected\n *\n * A count of a windowed query is meaningless — `OFFSET` skips rows of a *solution\n * sequence*, and the number a count answers is a property of the whole match set,\n * not of a page of it. So `.limit(20).offset(40).count()` costs, and answers,\n * exactly the same as a bare `.count()`.\n *\n * Dropping rather than throwing is deliberate: the paging caller holds **one**\n * builder and wants the page *and* its total from the same filter, so rejecting\n * the combination would force it to rebuild the builder by hand for no\n * correctness gain. There is exactly one sensible reading, and it is this one.\n * `.exists()` already made the same call, so the DSL has one rule — *a\n * scalar-answering query drops the solution-sequence modifiers* — not two.\n *\n * Nor is the drop merely a convention: a {@link CountBuilder} has nowhere to hold\n * a window, so it cannot be forgotten or half-applied downstream.\n *\n * `DISTINCT` is likewise not optional. A filter on a multi-valued property yields\n * several rows per subject, so the count is of distinct subjects — \"how many\n * instances match\", which is the question asked.\n *\n * ### Errors are not swallowed\n *\n * A store, transport or lowering failure **rejects**; it is never reported as `0`.\n * `0` is a plausible count: it renders an empty table and looks like data. Do not\n * wrap this in `.catch(() => 0)`.\n *\n * The one case that resolves `0` without querying is a query with no subject to\n * count — `.for(null)`, `.for(undefined)`, or an unresolved `PendingQueryContext`\n * *as the subject*.\n *\n * @param target Optional explicit dataset, as for {@link exec}.\n */\n async count(target?: IDataset): Promise<number> {\n return this.toCount().exec(target);\n }\n\n /**\n * Reduce this select to the count query that answers \"how many match?\".\n *\n * Public, unlike the ask equivalent, because a caller may want to **forward**\n * rather than execute: `builder.toCount().toJSON()` is the `{op: 'count'}` wire\n * envelope a router or RPC boundary sends on, and `fromJSON` turns it back into a\n * `CountBuilder` on the other side.\n *\n * Only the pattern survives — shape, subject(s), filters, `minus`. The projection,\n * preloads, sorting and pagination are not so much \"dropped\" as unrepresentable:\n * {@link CountBuilder} has nowhere to put them. That is the point of it being a\n * separate builder rather than a mode of this one.\n */\n toCount(): CountBuilder {\n return CountBuilder.of({\n shapeClass: this._shape,\n // `.for(null)` rides along in the spec. An unresolved pending context is\n // handled by CountBuilder.exec, which answers `0` without querying.\n ...this._patternSpec(),\n });\n }\n\n /**\n * The pattern-bearing part of this select: shape-membership, subject(s), filters\n * and `minus` — everything that decides which nodes are in the match set, and\n * nothing that shapes or windows the rows describing them.\n *\n * Shared by {@link _toAsk} and {@link toCount} rather than written twice. That is\n * not only about duplication: if the two normalisations drifted, `.exists()` and\n * `.count()` would disagree about what the match set *is* — a count of 0 next to\n * an `exists` of `true`, from the same builder.\n */\n private _patternSpec(): {\n subject?: NodeReferenceValue | PendingQueryContext;\n subjects?: NodeReferenceValue[];\n where?: WherePath;\n minusEntries?: RawMinusEntry[];\n nullSubject?: boolean;\n } {\n let where: WherePath | undefined;\n if (this._whereFn) {\n where = processWhereClause(this._whereFn, this._shape);\n } else if (this._where) {\n where = this._where;\n }\n\n let minusEntries: RawMinusEntry[] | undefined;\n if (this._minusEntries && this._minusEntries.length > 0) {\n minusEntries = this._evaluateMinusEntries();\n } else if (this._rawMinusEntries && this._rawMinusEntries.length > 0) {\n minusEntries = this._rawMinusEntries;\n }\n\n // A PendingQueryContext must survive as itself. It has an `id` *getter*, so\n // narrowing it to `{id}` here would silently resolve it against THIS process's\n // context map — and the query would then travel as a concrete IRI where the\n // equivalent select travels as `{\"@ctx\": name}` for the receiver to resolve.\n const subject =\n this._subject instanceof PendingQueryContext\n ? this._subject\n : this._subject && typeof this._subject === 'object' && 'id' in this._subject\n ? {id: (this._subject as NodeReferenceValue).id}\n : undefined;\n\n return {\n subject,\n subjects: this._subjects,\n where,\n minusEntries,\n nullSubject: this._nullSubject,\n };\n }\n\n /**\n * Reduce this select to the ask query that answers the same existence question.\n *\n * Only the pattern survives — shape, subject(s), filters, `minus`. The\n * projection, preloads, sorting and pagination are not \"dropped\" so much as\n * unrepresentable: {@link AskBuilder} has nowhere to put them. That is the point\n * of it being a separate builder rather than a mode of this one — the\n * normalisation cannot be forgotten or half-applied.\n */\n private _toAsk(): AskBuilder {\n return AskBuilder.of({\n shapeClass: this._shape,\n // `.for(null)` rides along in the spec. An unresolved pending context is\n // handled by AskBuilder.exec, which sees the live context and answers `false`\n // without querying.\n ...this._patternSpec(),\n });\n }\n\n /**\n * Preload a component's query fields at the given property path.\n *\n * This merges the component's query paths into this query's selection,\n * wrapping them in an OPTIONAL block (handled by the IR pipeline).\n *\n * Equivalent to the DSL's `.preloadFor()`:\n * ```ts\n * // DSL style\n * Person.select(p => p.bestFriend.preloadFor(PersonCard))\n * // SelectBuilder style\n * SelectBuilder.from(Person).select(p => [p.name]).preload('bestFriend', PersonCard)\n * ```\n *\n * NOTE: Preloads hold live component references and are not serializable.\n * They are merged into the selection when the field set is evaluated\n * (`_fieldsWithPreloads()`), so changes to preload handling must account for\n * the selectFn wrapping logic.\n */\n preload<CS extends Shape, CR>(\n path: string,\n component: QueryComponentLike<CS, CR>,\n ): SelectBuilder<S, R, Result> {\n const newPreloads = [...(this._preloads || []), {path, component}];\n return this.clone({preloads: newPreloads});\n }\n\n /**\n * Returns the current selection as a FieldSet.\n * If the selection was set via a FieldSet, returns that directly.\n * If set via selectAll labels, constructs a FieldSet from them.\n * If set via a callback, eagerly evaluates it through the proxy to produce a FieldSet.\n */\n fields(): FieldSet | undefined {\n if (this._fieldSet) {\n return this._fieldSet;\n }\n if (this._selectAllLabels) {\n return FieldSet.for(this._shape.shape, this._selectAllLabels);\n }\n if (this._selectFn) {\n // Eagerly evaluate the callback through FieldSet.for(ShapeClass, callback)\n // The callback is pure — same proxy always produces same paths.\n return FieldSet.for(this._shape, this._selectFn as unknown as (p: any) => any[]);\n }\n return undefined;\n }\n\n // ---------------------------------------------------------------------------\n // Internal helpers\n // ---------------------------------------------------------------------------\n\n /** Return the FieldSet with preload entries merged in (if any). */\n private _fieldsWithPreloads(): FieldSet | undefined {\n let fs = this.fields();\n if (this._preloads && this._preloads.length > 0) {\n const preloadFn = (p: any) => {\n return this._preloads!.map((entry) => p[entry.path].preloadFor(entry.component));\n };\n const preloadFs = FieldSet.for(this._shape, preloadFn);\n if (fs) {\n fs = FieldSet.createFromEntries(fs.shape, [\n ...(fs.entries as FieldSetEntry[]),\n ...(preloadFs.entries as FieldSetEntry[]),\n ]);\n } else {\n fs = preloadFs;\n }\n }\n return fs;\n }\n\n /** Evaluate minus entry callbacks into RawMinusEntry[] (plain data). */\n private _evaluateMinusEntries(): RawMinusEntry[] {\n const proxy = createProxiedPathBuilder(this._shape);\n return this._minusEntries!.map((entry) => {\n if (entry.shapeId) {\n return {shapeId: entry.shapeId};\n }\n if (entry.whereFn) {\n const result = (entry.whereFn as Function)(proxy);\n\n if (Array.isArray(result)) {\n const propertyPaths = result.map((item: any) => {\n const segments = FieldSet.collectPropertySegments(item);\n return segments.map((seg): PropertyPathSegment => ({propertyShapeId: seg.id}));\n });\n return {propertyPaths};\n }\n\n if (result && typeof result === 'object' && 'property' in result && 'subject' in result) {\n const segments = FieldSet.collectPropertySegments(result);\n return {propertyPaths: [segments.map((seg): PropertyPathSegment => ({propertyShapeId: seg.id}))]};\n }\n\n // WHERE-based exclusion\n return {where: processWhereClause(entry.whereFn, this._shape)};\n }\n return {};\n });\n }\n\n // ---------------------------------------------------------------------------\n // Serialization\n // ---------------------------------------------------------------------------\n\n /**\n * Serialize this SelectBuilder to a plain JSON object.\n *\n * Selections are serializable regardless of how they were set (FieldSet,\n * string[], selectAll, or callback). Callback-based selections are eagerly\n * evaluated through the proxy to produce a FieldSet.\n *\n * Where, orderBy, and minus clauses are evaluated through the proxy and\n * serialized as plain data structures. Preloads are merged into the FieldSet\n * as subSelect entries, producing identical IR on deserialization.\n */\n toJSON(): QueryBuilderJSON {\n const shapeId = this._shape.shape?.id || '';\n const json: QueryBuilderJSON = {\n v: WIRE_VERSION,\n shape: shapeId,\n };\n\n const fs = this._fieldsWithPreloads();\n if (fs) {\n json.fields = fs.toJSON().fields;\n }\n\n if (this._limit !== undefined) {\n json.limit = this._limit;\n }\n if (this._offset !== undefined) {\n json.offset = this._offset;\n }\n if (this._pendingContextName) {\n // Carry the context reference, not its (possibly unresolved) id, so the\n // receiver resolves it against its own context map at lowering time.\n json.subject = encodeContextRef(this._pendingContextName);\n } else if (this._subject && typeof this._subject === 'object' && 'id' in this._subject) {\n json.subject = (this._subject as NodeReferenceValue).id;\n }\n if (this._subjects && this._subjects.length > 0) {\n json.subjects = this._subjects.map((s) => s.id);\n }\n if (this._singleResult) {\n json.one = true;\n }\n\n if (this._whereFn) {\n json.where = serializeWherePath(processWhereClause(this._whereFn, this._shape), this._shape.shape);\n } else if (this._where) {\n json.where = serializeWherePath(this._where, this._shape.shape);\n }\n\n if (this._sortByFn) {\n json.sortBy = serializeSortByPath(\n evaluateSortCallback(this._shape, this._sortByFn as unknown as (p: any) => any, this._sortDirection || 'ASC'),\n );\n } else if (this._sortBy) {\n json.sortBy = serializeSortByPath(this._sortBy);\n }\n\n if (this._minusEntries && this._minusEntries.length > 0) {\n json.minusEntries = this._evaluateMinusEntries().map((e) =>\n serializeRawMinusEntry(e, this._shape.shape),\n );\n } else if (this._rawMinusEntries && this._rawMinusEntries.length > 0) {\n json.minusEntries = this._rawMinusEntries.map((e) =>\n serializeRawMinusEntry(e, this._shape.shape),\n );\n }\n\n if (this._nullSubject) {\n json.nullSubject = true;\n }\n\n return json;\n }\n\n /**\n * Reconstruct a SelectBuilder from a JSON object.\n * Resolves shape IRI via getShapeClass() and field paths as label selections.\n */\n static fromJSON<S extends Shape = Shape>(json: QueryBuilderJSON): SelectBuilder<S> {\n assertWireVersion(json.v);\n let builder = SelectBuilder.from<S>(json.shape as any);\n\n if (json.fields && json.fields.length > 0) {\n const fieldSet = FieldSet.fromJSON({\n shape: json.shape,\n fields: json.fields,\n });\n builder = builder.select(fieldSet) as SelectBuilder<S>;\n }\n\n if (json.limit !== undefined) {\n builder = builder.limit(json.limit) as SelectBuilder<S>;\n }\n if (json.offset !== undefined) {\n builder = builder.offset(json.offset) as SelectBuilder<S>;\n }\n if (json.subject) {\n // A `{@ctx}` subject rehydrates as a pending context (preserving the name\n // so it re-serializes as a context reference and resolves live).\n const subject = isContextRefJSON(json.subject)\n ? new PendingQueryContext(json.subject['@ctx'])\n : json.subject;\n builder = builder.for(subject) as SelectBuilder<S>;\n }\n if (json.subjects && json.subjects.length > 0) {\n builder = builder.forAll(json.subjects) as SelectBuilder<S>;\n }\n if (json.one && !json.subject) {\n builder = builder.one() as SelectBuilder<S>;\n }\n\n // Restore pre-evaluated data via clone — safe because fromJSON is in the same class.\n const overrides: Partial<QueryBuilderInit<S, any>> = {};\n const nodeShape = builder._shape.shape;\n\n // Restore where clause\n if (json.where && nodeShape) {\n overrides._where = deserializeWherePath(nodeShape, json.where);\n }\n\n // Restore sort key + direction (direction rides on the ordered sortBy array)\n if (json.sortBy && json.sortBy.length > 0 && nodeShape) {\n const sortBy = deserializeSortByPath(nodeShape, json.sortBy);\n overrides._sortBy = sortBy;\n overrides.sortDirection = sortBy.directions[0];\n }\n\n // Restore minus entries\n if (json.minusEntries && json.minusEntries.length > 0 && nodeShape) {\n overrides._rawMinusEntries = json.minusEntries.map((e) =>\n deserializeRawMinusEntry(nodeShape, e),\n );\n }\n\n // Restore nullSubject flag\n if (json.nullSubject) {\n overrides._nullSubject = true;\n }\n\n if (Object.keys(overrides).length > 0) {\n builder = (builder as any).clone(overrides) as SelectBuilder<S>;\n }\n\n return builder;\n }\n\n // ---------------------------------------------------------------------------\n // Build & execute\n // ---------------------------------------------------------------------------\n\n /**\n * Get the raw pipeline input.\n *\n * Constructs RawSelectInput directly from FieldSet entries.\n */\n toRawInput(): RawSelectInput {\n return this._buildDirectRawInput();\n }\n\n /** Build RawSelectInput directly from FieldSet entries. */\n private _buildDirectRawInput(): RawSelectInput {\n const fs = this._fieldsWithPreloads();\n const entries = fs ? fs.entries : [];\n\n let where: WherePath | undefined;\n if (this._whereFn) {\n where = processWhereClause(this._whereFn, this._shape);\n } else if (this._where) {\n where = this._where;\n }\n\n let sortBy: SortByPath | undefined;\n if (this._sortByFn) {\n sortBy = evaluateSortCallback(\n this._shape,\n this._sortByFn as unknown as (p: any) => any,\n this._sortDirection || 'ASC',\n );\n } else if (this._sortBy) {\n sortBy = this._sortBy;\n }\n\n const input: RawSelectInput = {\n entries,\n subject: this._subject,\n limit: this._limit,\n offset: this._offset,\n shape: this._shape,\n sortBy,\n singleResult:\n this._singleResult ||\n !!(\n this._subject &&\n typeof this._subject === 'object' &&\n 'id' in this._subject\n ),\n };\n\n if (where) {\n input.where = where;\n }\n if (this._subjects && this._subjects.length > 0) {\n input.subjects = this._subjects;\n }\n if (this._minusEntries && this._minusEntries.length > 0) {\n input.minusEntries = this._evaluateMinusEntries();\n } else if (this._rawMinusEntries && this._rawMinusEntries.length > 0) {\n input.minusEntries = this._rawMinusEntries;\n }\n\n return input;\n }\n\n /** Discriminator for the free `lower()` function and dataset routing. */\n readonly __queryKind = 'select' as const;\n\n /** The shape this query targets — the routing key datasets/`LinkedStorage` use. */\n get shape(): NodeShapeData {\n return this._shape.shape;\n }\n\n /**\n * Execute the query and return results.\n *\n * @param target Optional explicit dataset (a store or a router — a router *is* an\n * `IDataset`) to run against. Omitted → the global query dispatch (the router's\n * shape-based default). A `target` runs on that dataset only; the global router is\n * untouched. `await`ing the builder (the PromiseLike path) always uses the global\n * dispatch — only `.exec(target)` overrides.\n */\n async exec(target?: IDataset): Promise<Result> {\n return this._run(target, true) as Promise<Result>;\n }\n\n /**\n * Shared execution path for {@link exec} and {@link exists}.\n *\n * @param swallowUnresolvedContext When true (the `exec` path), a where-clause\n * context reference that has not resolved yet surfaces as `null` — \"not ready\",\n * which a reactive layer re-runs once the context lands. `exists()` passes\n * false: it must not turn \"could not ask\" into a boolean.\n */\n private async _run(\n target: IDataset | undefined,\n swallowUnresolvedContext: boolean,\n ): Promise<unknown> {\n if (this._nullSubject) {\n // .for(null/undefined) was called — return null instead of executing a broken query.\n return null;\n }\n if (this._pendingContextName && !this._subject?.id) {\n // Pending context hasn't resolved yet — return null rather than querying without a subject.\n return null;\n }\n // Dispatch the live (closed) query; the dataset decides whether to lower it.\n // `async` ensures a missing global dispatch surfaces as a rejected promise, not a sync throw.\n const dispatch = target ?? getQueryDispatch();\n try {\n return await dispatch.selectQuery(this);\n } catch (err) {\n // A where-clause context reference that hasn't resolved yet surfaces as\n // UnresolvedContextError when the dataset lowers the query. For SELECT this\n // means \"not ready\" — return null (a reactive layer re-runs once it lands),\n // mirroring the pending-subject behavior. Mutations still throw.\n if (swallowUnresolvedContext && err instanceof UnresolvedContextError) {\n return null;\n }\n // The message names the query, which is what a human needs. `cause` keeps\n // the ORIGINAL error reachable as an object, which is what code needs: a\n // store error's status/endpoint/class is how a caller tells \"this dataset\n // does not exist\" from \"this query is wrong\", and without the chain the\n // only way left is to pattern-match this string. Written with\n // defineProperty rather than `new Error(msg, {cause})` because this\n // package targets es6, where that overload is not typed; the property\n // shape (own, non-enumerable) is identical.\n const wrapped = Error(`Error while executing query: ${(err as Error).stack}.\\n\\nQuery related to this error: ${JSON.stringify(this.toJSON())}`);\n Object.defineProperty(wrapped, 'cause', {\n value: err,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n throw wrapped;\n }\n }\n\n // ---------------------------------------------------------------------------\n // Promise-compatible interface\n // ---------------------------------------------------------------------------\n\n /** `await` triggers execution. */\n then<TResult1 = Result, TResult2 = never>(\n onfulfilled?: ((value: Result) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,\n ): Promise<TResult1 | TResult2> {\n return this.exec().then(onfulfilled, onrejected);\n }\n\n /** Catch errors from execution. Chain off then() to avoid re-executing. */\n catch<TResult = never>(\n onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,\n ): Promise<Result | TResult> {\n return this.then().catch(onrejected);\n }\n\n /** Finally handler after execution. Chain off then() to avoid re-executing. */\n finally(onfinally?: (() => void) | null): Promise<Result> {\n return this.then().finally(onfinally);\n }\n\n get [Symbol.toStringTag](): string {\n return 'SelectBuilder';\n }\n}\n\n/** @deprecated Renamed to `SelectBuilder`. This alias will be removed in a future major. */\nexport {SelectBuilder as QueryBuilder};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilderSerialization.js","sourceRoot":"","sources":["../../../src/queries/QueryBuilderSerialization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EACL,eAAe,EACf,eAAe,GAEhB,MAAM,wBAAwB,CAAC;AA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AClB,gFAAgF;AAEhF,uEAAuE;AACvE,MAAM,UAAU,oBAAoB,CAClC,KAAoB,EACpB,IAAmB;IAEnB,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAoB,EACpB,IAAoB;IAEpB,yEAAyE;IACzE,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAuB;KACvE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,KAAoB,EACpB,IAAuB;IAEvB,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,IAAI,IAAI,CAAC,OAAO;QAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC/C,IAAI,IAAI,CAAC,KAAK;QAAE,KAAK,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACtE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAClD,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAuB,EAAE,CAAC,CAAC,EAAC,eAAe,EAAE,EAAE,EAAC,CAAC,CAAC,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Serialization helpers for QueryBuilder fields that contain live object\n * references (where-clauses, sort paths, minus entries).\n *\n * Where-clauses serialize through the DSL-JSON expression codec\n * (`DslJsonExpression.ts`) — the wire form carries no IR. This module wires that\n * codec into the select/mutation envelopes and handles sort + minus.\n */\n\nimport type {NodeShapeData} from '../shapes/SHACL.js';\nimport {walkPropertyPath} from './PropertyPath.js';\nimport type {WherePath, SortByPath} from './SelectQuery.js';\nimport type {RawMinusEntry, PropertyPathSegment} from './IRDesugar.js';\nimport {\n encodeCondition,\n decodeCondition,\n type DslJsonCondition,\n} from './DslJsonExpression.js';\nimport type {ExpressionNode, ExistsCondition} from '../expressions/ExpressionNode.js';\n\n// =============================================================================\n// JSON types\n// =============================================================================\n\n/** A where-clause on the wire is a DSL-JSON condition (see documentation/dsl-json.md). */\nexport type WherePathJSON = DslJsonCondition;\n\n/** An ordered list of `{path: direction}` — element order is sort precedence. */\nexport type SortByPathJSON = Array<{[path: string]: 'ASC' | 'DESC'}>;\n\nexport type RawMinusEntryJSON = {\n shapeId?: string;\n where?: WherePathJSON;\n propertyPaths?: string[][];\n};\n\n// =============================================================================\n// Serialization\n// =============================================================================\n\n/** Serialize a runtime where-clause to its DSL-JSON condition form. */\nexport function serializeWherePath(\n where: WherePath,\n shape: NodeShapeData,\n): WherePathJSON {\n const node: ExpressionNode | ExistsCondition =\n 'existsCondition' in (where as object)\n ? (where as {existsCondition: ExistsCondition}).existsCondition\n : (where as {expressionNode: ExpressionNode}).expressionNode;\n return encodeCondition(node, shape);\n}\n\nexport function serializeSortByPath(sort: SortByPath): SortByPathJSON {\n return sort.paths.map((p, i) => ({[p.toString()]: sort.directions[i]}));\n}\n\nexport function serializeRawMinusEntry(\n entry: RawMinusEntry,\n shape: NodeShapeData,\n): RawMinusEntryJSON {\n const json: RawMinusEntryJSON = {};\n if (entry.shapeId) json.shapeId = entry.shapeId;\n if (entry.where) json.where = serializeWherePath(entry.where, shape);\n if (entry.propertyPaths) {\n json.propertyPaths = entry.propertyPaths.map((pp) =>\n pp.map((seg) => seg.propertyShapeId),\n );\n }\n return json;\n}\n\n// =============================================================================\n// Deserialization\n// =============================================================================\n\n/** Rebuild a runtime where-clause from its DSL-JSON condition form. */\nexport function deserializeWherePath(\n shape: NodeShapeData,\n json: WherePathJSON,\n): WherePath {\n return decodeCondition(json, shape);\n}\n\nexport function deserializeSortByPath(\n shape: NodeShapeData,\n json: SortByPathJSON,\n): SortByPath {\n // Per-path directions: each `{path: dir}` entry keeps its own direction.\n return {\n paths: json.map((e) => walkPropertyPath(shape, Object.keys(e)[0])),\n directions: json.map((e) => Object.values(e)[0]) as ('ASC' | 'DESC')[],\n };\n}\n\nexport function deserializeRawMinusEntry(\n shape: NodeShapeData,\n json: RawMinusEntryJSON,\n): RawMinusEntry {\n const entry: RawMinusEntry = {};\n if (json.shapeId) entry.shapeId = json.shapeId;\n if (json.where) entry.where = deserializeWherePath(shape, json.where);\n if (json.propertyPaths) {\n entry.propertyPaths = json.propertyPaths.map((pp) =>\n pp.map((id): PropertyPathSegment => ({propertyShapeId: id})),\n );\n }\n return entry;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryContext.js","sourceRoot":"","sources":["../../../src/queries/QueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAE5D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAC9B,YAA4B,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;IAAG,CAAC;IAEnD,IAAI,EAAE;;QACJ,OAAO,MAAA,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,0CAAE,EAAE,CAAC;IAChD,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAA4B,WAAmB;QAC7C,KAAK,CACH,kBAAkB,WAAW,0DAA0D,CACxF,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2E;YAC3E,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,qHAAqH,CAC9I,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5D,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAChC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,CAAQ,CAAC,CAAC;QACxD,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,6DAA6D,OAAO,KAAK,wFAAwF,CAC1L,CAAC;AACJ,CAAC","sourcesContent":["import {type QShape, QueryShape} from './SelectQuery.js';\nimport {Shape, createShapeTarget} from '../shapes/Shape.js';\n\nconst queryContext = new Map<string, QShape<any, any, any>>();\n\n/**\n * A live reference returned by getQueryContext when the context hasn't been set yet.\n * Its `id` getter resolves lazily from the global context map, so queries built with\n * a PendingQueryContext will pick up the value once it's set (e.g. after auth completes).\n */\nexport class PendingQueryContext {\n constructor(public readonly contextName: string) {}\n\n get id(): string | undefined {\n return queryContext.get(this.contextName)?.id;\n }\n}\n\n/**\n * Thrown when a query carrying a context reference is lowered but the context\n * isn't set in the current process. A context ref is carried in DSL-JSON and\n * resolves at lowering time against whatever context map is available (e.g.\n * server-side auth); if it can't resolve, lowering throws this rather than\n * silently producing a subject-less query.\n */\nexport class UnresolvedContextError extends Error {\n constructor(public readonly contextName: string) {\n super(\n `Query context \"${contextName}\" is not set and could not be resolved at lowering time.`,\n );\n this.name = 'UnresolvedContextError';\n }\n}\n\n/** Listener notified (with the changed context name) whenever a context is set or cleared. */\nexport type QueryContextListener = (name: string) => void;\nconst contextListeners = new Set<QueryContextListener>();\n\n/**\n * Subscribe to query-context changes. Returns an unsubscribe function.\n *\n * This is the primitive that makes context resolution reactive: a consuming layer\n * (e.g. React components) subscribes and re-runs affected queries when the context\n * lands — so a query that resolved to `null` while the context was unset simply\n * re-runs and resolves once it's available (\"waiting\"), and re-runs again on any\n * later change (\"auto re-resolve\"). Core only emits the change; re-execution is the\n * consumer's responsibility.\n */\nexport function subscribeQueryContext(listener: QueryContextListener): () => void {\n contextListeners.add(listener);\n return () => contextListeners.delete(listener);\n}\n\nfunction notifyContextChange(name: string): void {\n // Snapshot so a listener that (un)subscribes or re-sets a context during\n // notification can't mutate the set mid-iteration.\n for (const listener of [...contextListeners]) listener(name);\n}\n\n/**\n * Normalize any query-context value to a {@link PendingQueryContext} carrying its name,\n * or return `undefined` if the value is not a context reference.\n *\n * A context appears in two runtime forms: a `PendingQueryContext` (the context was unset\n * when `getQueryContext()` was called) or a resolved `QueryShape` stamped with\n * `__queryContextName` (it was already set). Both must be treated as the same `{@ctx}`\n * reference wherever a node value/id is accepted (mutation field values, delete ids), so\n * that context-bound mutations behave identically whether the context is set or unset at\n * build time — resolution always happens at lowering.\n */\nexport function asContextRef(value: unknown): PendingQueryContext | undefined {\n if (value instanceof PendingQueryContext) return value;\n if (!value || typeof value !== 'object') return undefined;\n // A resolved context is a QueryShape proxy wrapping a Shape stamped with\n // `__queryContextName`. Read it via `originalValue` (a known QueryShape field)\n // so we don't trip the proxy's \"undecorated property\" guard (it now throws);\n // a bare Shape\n // carries the stamp directly.\n const v = value as {originalValue?: {__queryContextName?: unknown}; __queryContextName?: unknown};\n const source = v.originalValue ?? v;\n const name = (source as {__queryContextName?: unknown}).__queryContextName;\n if (typeof name === 'string') return new PendingQueryContext(name);\n return undefined;\n}\n\nexport function getQueryContext<T extends Shape>(name: string): QShape<T> {\n if (queryContext.has(name)) {\n return queryContext.get(name);\n }\n // Return a live reference that resolves lazily when the context is set.\n // This avoids the timing issue where module-level queries capture null\n // because the context hasn't been set yet (e.g. useEffect hasn't fired).\n return new PendingQueryContext(name) as any;\n}\n\nexport function setQueryContext(name: string, value: any, shapeType?) {\n // Clearing a context entry\n if (!value) {\n queryContext.delete(name);\n notifyContextChange(name);\n return;\n }\n\n // Already a QShape — stamp the underlying shape and store as-is. (Checked before\n // the plain-`{id}` branch below: a QueryShape's `.id` getter is also a string, so\n // testing for `{id}` first would wrongly require a shapeType and no-op.)\n if (value instanceof QueryShape) {\n const orig = (value as any).originalValue;\n if (orig) {\n orig.__queryContextName = name;\n if (typeof orig.id === 'string') orig.__queryContextId = orig.id;\n }\n queryContext.set(name, value as any);\n notifyContextChange(name);\n return;\n }\n\n // A Shape-shaped value (e.g. a `createShapeTarget` proxy target) — stamp it and\n // wrap as a QShape. Needs no shapeType (it already carries its shape class).\n if (value instanceof Shape) {\n value.__queryContextName = name;\n if (typeof value.id === 'string') value.__queryContextId = value.id;\n queryContext.set(name, new QueryShape(value) as any);\n notifyContextChange(name);\n return;\n }\n\n // A plain QResult `{id}` — materialize a shape (requires shapeType).\n if (typeof value.id === 'string') {\n if (!shapeType) {\n // A silent no-op here is a trap: the context never sets and the caller\n // gets no signal. A `{id}` value cannot be materialized without its shape.\n throw new Error(\n `setQueryContext('${name}'): a {id} value requires a shapeType so the shape can be materialized. Pass the Shape class as the third argument.`,\n );\n }\n const shape = createShapeTarget(shapeType as any, value.id);\n shape.__queryContextId = value.id;\n shape.__queryContextName = name;\n queryContext.set(name, QueryShape.create(shape) as any);\n notifyContextChange(name);\n return;\n }\n\n throw new Error(\n `setQueryContext('${name}'): value is not a QueryShape, Shape, or {id} result. Got ${typeof value}. Pass a Shape instance, a query-context shape, or a {id} result (with its shapeType).`,\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryFactory.js","sourceRoot":"","sources":["../../../src/queries/QueryFactory.ts"],"names":[],"mappings":"AAmKA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAG1D,MAAM,OAAgB,YAAY;CAAG;AAErC,MAAM,UAAU,sBAAsB,CACpC,KAAU;IAEV,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE9D,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"}
|
|
1
|
+
{"version":3,"file":"QueryFactory.js","sourceRoot":"","sources":["../../../src/queries/QueryFactory.ts"],"names":[],"mappings":"AAmKA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAG1D,MAAM,OAAgB,YAAY;CAAG;AAErC,MAAM,UAAU,sBAAsB,CACpC,KAAU;IAEV,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE9D,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","sourcesContent":["import type {NodeShapeData, PropertyShapeData} from '../shapes/SHACL.js';\nimport {Shape} from '../shapes/Shape.js';\nimport {ShapeSet} from '../collections/ShapeSet.js';\nimport type {NodeReferenceValue} from '../utils/NodeReference.js';\nimport {ExpressionNode} from '../expressions/ExpressionNode.js';\n\nexport type Prettify<T> = T extends infer R\n ? {\n [K in keyof R]: R[K];\n }\n : never;\n\n/**\n * Recursively adds an id property to all objects in the object.\n * Also makes all keys optional.\n */\ntype _AddId<U> = U extends string | number | boolean | Date | null | undefined\n ? U\n : U extends Array<infer T>\n ? Array<_AddId<T>>\n : WithId<U>;\n\ntype RemoveId<U> = Omit<U, 'id'>;\n\ntype WithId<U> = U & {id: string};\n\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\ntype CombineTypes<T> = {\n [K in keyof UnionToIntersection<T>]: T extends {[P in K]?: infer V}\n ? _AddId<V>\n : never;\n};\n\ntype IsPlainObject<T> = T extends object\n ? T extends any[]\n ? false\n : T extends Function\n ? false\n : T extends Date\n ? false\n : T extends RegExp\n ? false\n : T extends Error\n ? false\n : T extends null\n ? false\n : T extends undefined\n ? false\n : T extends object\n ? true\n : false\n : false;\n\ntype RecursiveTransform<T, IsCreate = false> = T extends\n | string\n | number\n | boolean\n | Date\n | null\n | undefined\n ? T\n : T extends Array<infer U>\n ? UpdatedSet<Prettify<RecursiveTransform<U>>, IsCreate>\n : IsSetModification<T> extends true\n ? ModifiedSet<T, IsCreate>\n : IsPlainObject<T> extends true\n ? // ? WithId<{ [K in keyof T]-?: Prettify<RecursiveTransform<T[K]>> }>\n WithId<{[K in keyof T]: Prettify<RecursiveTransform<T[K], IsCreate>>}>\n : T;\n\n//for update() we use {updatedTo} but for create() we actually just return the array of new values;\ntype UpdatedSet<U, IsCreate> = IsCreate extends true\n ? U[]\n : {\n updatedTo: U[];\n };\ntype IsSetModification<T> = T extends {add?: any; remove?: any} ? true : false;\ntype AddedType<T> = T extends {add: (infer U)[]}\n ? U\n : T extends {add: infer U}\n ? U\n : never;\n\ntype RemovedType<T> = T extends {remove: (infer U)[]}\n ? U\n : T extends {remove: infer U}\n ? U\n : never;\n\ntype ModifiedSet<T, IsCreate = false> = {\n added: AddId<AddedType<T>, IsCreate>[];\n removed: AddId<RemovedType<T>, IsCreate>[];\n};\n\nexport type AddId<T, IsCreate = false> = Prettify<\n RecursiveTransform<T, IsCreate>\n>;\n\nexport type UpdatePartial<S = Shape> =\n | UpdateNodeDescription<S>\n | NodeReferenceValue;\ntype UpdateNodeDescription<Shape> = Partial<\n Omit<\n {\n [P in KeysWithoutFunctions<Shape>]: ShapePropValueToUpdatePartial<\n Shape[P]\n >;\n },\n 'node' | 'nodeShape' | 'namedNode' | 'targetClass'\n >\n>;\ntype KeysWithoutFunctions<T> = {\n [K in keyof T]: T[K] extends Function ? never : K;\n}[keyof T];\n\ntype ShapePropValueToUpdatePartial<ShapeProperty> = ShapeProperty extends Shape\n ? UpdatePartial<ShapeProperty>\n : ShapeProperty extends ShapeSet<infer SSType>\n ? SetUpdateValue<SSType>\n : ShapeProperty | ExpressionNode;\n\ntype SetUpdateValue<SSType> = UpdatePartial<SSType>[] | SetModification<SSType>;\n\nexport type SetModification<SSType> = {\n add?: UpdatePartial<SSType>[] | UpdatePartial<SSType>;\n remove?: UpdatePartial<SSType>[] | UpdatePartial<SSType>;\n};\n\nexport type SetModificationValue = {\n $add?: UpdatePartial[];\n $remove?: NodeReferenceValue[];\n};\n\ntype UnsetValue = undefined;\nexport type LiteralUpdateValue = string | number | boolean | Date;\nexport type PropUpdateValue =\n | SinglePropertyUpdateValue\n | SinglePropertyUpdateValue[]\n | SetModificationValue;\nexport type SinglePropertyUpdateValue =\n | NodeDescriptionValue\n | NodeReferenceValue\n | LiteralUpdateValue\n | UnsetValue;\nexport type NodeDescriptionValue = {\n shape: NodeShapeData;\n fields: UpdateNodePropertyValue[];\n /**\n * The id of the node to be created.\n * Optional, if not provided a new id will be generated.\n */\n __id?: string;\n};\nexport type UpdateNodePropertyValue = {\n prop: PropertyShapeData;\n val: PropUpdateValue;\n};\nexport type ShapeReferenceValue = {id: string; shape: NodeReferenceValue};\nexport {toNodeReference} from '../utils/NodeReference.js';\nexport type {NodeReferenceValue};\n\nexport abstract class QueryFactory {}\n\nexport function isSetModificationValue(\n value: any,\n): value is SetModificationValue {\n if (value === null || typeof value !== 'object') return false;\n\n let hasAddKey = value.$add;\n let hasRemoveKey = value.$remove;\n let numKeys = Object.keys(value).length;\n //has no other keys\n return (\n (hasAddKey && hasRemoveKey && numKeys === 2) ||\n (hasAddKey && numKeys === 1) ||\n (hasRemoveKey && numKeys === 1)\n );\n}\n\n"]}
|