feat!: la famille ORM est publiee enveloppee, et le ng publie cesse de rendre des promesses
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
// any runtime `@ng-org` import). They describe what `configure` RECEIVES; nothing here
|
||||
// re-exports them.
|
||||
import type { Scope } from "@ng-org/orm";
|
||||
// `RdfOrmConfig` lives on the SDK's `/all` subpath rather than on its main entry - the
|
||||
// config type `getObjects` DECLARES is not exported beside the function that takes it.
|
||||
// Imported as a TYPE, so nothing of that subpath reaches the build.
|
||||
import type { RdfOrmConfig } from "@ng-org/orm/all";
|
||||
import type { BaseType, ShapeType } from "@ng-org/shex-orm";
|
||||
|
||||
/**
|
||||
@@ -126,6 +130,41 @@ export type OrmSubscriptionLike = <T extends BaseType>(
|
||||
scope: Scope,
|
||||
) => OrmSubscriptionHandle;
|
||||
|
||||
/**
|
||||
* Loose shape of `@ng-org/orm`'s `getObjects` - the SDK's ONE-SHOT read, the counterpart
|
||||
* of the two-way subscription {@link OrmSubscriptionLike} opens.
|
||||
*
|
||||
* The parameters are upstream's own, passed through rather than restated: a
|
||||
* {@link ShapeType} and the config `RdfOrmConfig` declares minus its two pagination
|
||||
* fields, which `getObjects` `Omit`s because a one-shot read has no pages. The return is
|
||||
* upstream's too - an ARRAY when the config asks for an `orderBy`, a `Set` otherwise -
|
||||
* and it is DETACHED: `structuredClone` of the raw signal object, so mutating an item of
|
||||
* it reaches nothing.
|
||||
*
|
||||
* An application injects the real one (`getObjects: getObjects`, from `@ng-org/orm`); it
|
||||
* is assignable to this as it stands, with no wrapper and no cast.
|
||||
*/
|
||||
// @provenance GetObjectsLike kind=invention level=none ref=none - nothing upstream is injected; the type exists only to describe what `configure` receives, here for the ORM's own one-shot read
|
||||
export type GetObjectsLike = <T extends BaseType>(
|
||||
shapeType: ShapeType<T>,
|
||||
config: Omit<RdfOrmConfig<T>, "pageSize" | "maxActivePages">,
|
||||
) => Promise<T[] | Set<T>>;
|
||||
|
||||
/**
|
||||
* Loose shape of `@ng-org/orm`'s `insertObject` - the SDK's write that needs no
|
||||
* subscription of its own.
|
||||
*
|
||||
* Upstream it opens a subscription scoped to NO document (`{ graphs: [] }`), adds the
|
||||
* object to that set and closes it, so the object must carry its `@graph`: the write has
|
||||
* no other way of knowing which document it lands in. It returns the object it inserted,
|
||||
* with a generated `@id` where one was left empty.
|
||||
*/
|
||||
// @provenance InsertObjectLike kind=invention level=none ref=none - same, for the ORM's own subscription-free write
|
||||
export type InsertObjectLike = <T extends BaseType>(
|
||||
shapeType: ShapeType<T>,
|
||||
object: T,
|
||||
) => Promise<T>;
|
||||
|
||||
/**
|
||||
* The stores that can carry an inbox. NOT `StoreType`: upstream only the public and
|
||||
* protected store repos get one — `new_store_default` attaches an inbox solely
|
||||
|
||||
Reference in New Issue
Block a user