v2.0.0
Major Changes
-
#23
d2d1ecaThanks @flyon! - ## Breaking ChangesShape.select()andShape.update()no longer accept an ID as the first argumentUse
.for(id)to target a specific entity instead.Select:
// Before const result = await Person.select({ id: "..." }, (p) => p.name); // After const result = await Person.select((p) => p.name).for({ id: "..." });
.for(id)unwraps the result type from array to single object, matching the old single-subject overload behavior.Update:
// Before const result = await Person.update({ id: "..." }, { name: "Alice" }); // After const result = await Person.update({ name: "Alice" }).for({ id: "..." });
Shape.selectAll(id)also no longer accepts an id — usePerson.selectAll().for(id).ShapeTyperenamed toShapeConstructorThe type alias for concrete Shape subclass constructors has been renamed. Update any imports or references:
// Before import type { ShapeType } from "@_linked/core/shapes/Shape"; // After import type { ShapeConstructor } from "@_linked/core/shapes/Shape";
QueryString,QueryNumber,QueryBoolean,QueryDateclasses removedThese have been consolidated into a single generic
QueryPrimitive<T>class. If you were usinginstanceofchecks against these classes, useinstanceof QueryPrimitiveinstead and check the value's type.Internal IR types removed
The following types and functions have been removed from
SelectQuery. These were internal pipeline types — if you were using them for custom store integrations, the replacement isFieldSetEntry[](available fromFieldSet):- Types:
SelectPath,QueryPath,CustomQueryObject,SubQueryPaths,ComponentQueryPath - Functions:
fieldSetToSelectPath(),entryToQueryPath() - Methods:
QueryBuilder.getQueryPaths(),BoundComponent.getComponentQueryPaths() RawSelectInput.selectfield renamed toRawSelectInput.entries(type changed fromSelectPathtoFieldSetEntry[])
getPackageShape()return type is now nullableReturns
ShapeConstructor | undefinedinstead oftypeof Shape. Code that didn't null-check the return value will now get TypeScript errors.New Features
.for(id)and.forAll(ids)chainingConsistent API for targeting entities across select and update operations:
// Single entity (result is unwrapped, not an array) await Person.select((p) => p.name).for({ id: "..." }); await Person.select((p) => p.name).for("https://..."); // Multiple specific entities await QueryBuilder.from(Person) .select((p) => p.name) .forAll([{ id: "..." }, { id: "..." }]); // All instances (default — no .for() needed) await Person.select((p) => p.name);
Dynamic Query Building with
QueryBuilderandFieldSetBuild queries programmatically at runtime — for CMS dashboards, API endpoints, configurable reports. See the Dynamic Query Building section in the README for full documentation and examples.
Key capabilities:
QueryBuilder.from(Person)orQueryBuilder.from('https://schema.org/Person')— fluent, chainable, immutable query constructionFieldSet.for(Person, ['name', 'knows'])— composable field selections with.add(),.remove(),.pick(),FieldSet.merge()FieldSet.all(Person, {depth: 2})— select all decorated properties with optional depth- JSON serialization:
query.toJSON()/QueryBuilder.fromJSON(json)andfieldSet.toJSON()/FieldSet.fromJSON(json) - All builders are
PromiseLike—awaitthem directly or call.build()to inspect the IR
Mutation Builders
CreateBuilder,UpdateBuilder, andDeleteBuilderprovide the programmatic equivalent ofPerson.create(),Person.update(), andPerson.delete(), accepting Shape classes or shape IRI strings. See the Mutation Builders section in the README.PropertyPathexportedThe
PropertyPathvalue object is now a public export — a type-safe representation of a sequence of property traversals through a shape graph.import { PropertyPath, walkPropertyPath } from "@_linked/core";
ShapeConstructor<S>typeNew concrete constructor type for Shape subclasses. Eliminates ~30
as anycasts across the codebase and provides better type safety at runtime boundaries (builder.from()methods, Shape static methods). - Types: