chore: ng-e2e-helpers suit alpha.14, et la mise a jour des paquets devient une tache
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
import { ng as realNg, init as realInit } from "@ng-org/web";
|
||||
import { initNg as ormInitNg, OrmSubscription, type Scope as OrmScope } from "@ng-org/orm";
|
||||
import { initNg as ormInitNg, RdfOrmSubscription, type Scope as OrmScope } from "@ng-org/orm";
|
||||
import { configure, docs, init, useShape as libUseShape } from "@ng-eventually/polyfill";
|
||||
import type { BaseType, Nuri, ShapeType } from "@ng-eventually/polyfill";
|
||||
import { adoptCurrentUser, configureStoreRegistry } from "../src/shared-wallet/bootstrap";
|
||||
@@ -92,9 +92,22 @@ const sessionReady = new Promise<BrokerSession>((r) => (sessionResolve = r));
|
||||
* the broker refused leaves it pending for ever — the silence this measurement is here to
|
||||
* break.
|
||||
*/
|
||||
let liveSubscription: OrmSubscription<BaseType> | null = null;
|
||||
/**
|
||||
* The handle this page keeps, DERIVED from `getOrCreate` rather than written by hand.
|
||||
*
|
||||
* `RdfOrmSubscription` (renamed from `OrmSubscription` in `@ng-org/orm@0.1.2-alpha.21`)
|
||||
* now takes its config as a type parameter and `getOrCreate` returns a narrowed
|
||||
* `RdfOrmSubscriptionFor<...>` - the paging methods are `Omit`ted when no `pageSize` is
|
||||
* asked for. Naming the class directly would restate that narrowing and get it wrong the
|
||||
* next time it moves; `ReturnType` asks the package what it actually hands back.
|
||||
*/
|
||||
type LiveSubscription = ReturnType<
|
||||
typeof RdfOrmSubscription.getOrCreate<ShapeType<BaseType>, BaseType, OrmScope>
|
||||
>;
|
||||
|
||||
let liveSubscription: LiveSubscription | null = null;
|
||||
function realOrmUseShape(shapeType: unknown, scope: unknown): unknown {
|
||||
const sub = OrmSubscription.getOrCreate(shapeType as ShapeType<BaseType>, scope as OrmScope);
|
||||
const sub = RdfOrmSubscription.getOrCreate(shapeType as ShapeType<BaseType>, scope as OrmScope);
|
||||
liveSubscription = sub;
|
||||
return sub.signalObject;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": ["bun"],
|
||||
"noEmit": true
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"@ng-org/web": ["../node_modules/@ng-org/web"]
|
||||
}
|
||||
},
|
||||
"include": ["."]
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ng-org/web": "0.1.2-alpha.13",
|
||||
"@ng-org/shex-orm": "0.1.2-alpha.8",
|
||||
"@ng-org/alien-deepsignals": "0.1.2-alpha.11"
|
||||
"@ng-org/alien-deepsignals": "0.1.2-alpha.13",
|
||||
"@ng-org/orm": "0.1.2-alpha.21",
|
||||
"@ng-org/shex-orm": "0.1.2-alpha.9",
|
||||
"@ng-org/web": "0.1.2-alpha.14",
|
||||
"ng-e2e-helpers": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "bun test",
|
||||
|
||||
@@ -19,12 +19,18 @@
|
||||
* scope still syncing reads `{ data: [], isPending: true, isSuccess: false }`.
|
||||
*
|
||||
* ── The scope is the SDK's, and translating it is EXPLICITLY TEMPORARY ─────
|
||||
* `scope` is `@ng-org/orm`'s own `Scope` — `{ graphs?: string[] | string; subjects?:
|
||||
* `scope` is `@ng-org/orm`'s own `Scope` — `{ graphs: string[] | string; subjects?:
|
||||
* string[] }` — not the three strings this module took before. A `graphs` entry names
|
||||
* ONE document's graph, `did:ng:i` (or `""`) discards the rest and means the whole local
|
||||
* dataset, and `[]` or `undefined` returns no objects at all: all three are upstream's
|
||||
* rules, reproduced by `normalizeScope` below.
|
||||
*
|
||||
* `graphs` is REQUIRED as of `@ng-org/orm@0.1.2-alpha.21`; it used to be optional. Only
|
||||
* the spelling changed, never the meaning: a caller who wants "everything" still has to
|
||||
* say `did:ng:i`, because on this axis an empty list is the EMPTY set and not the absent
|
||||
* filter. `subjects` keeps the opposite convention - there `[]` means no filtering - so
|
||||
* the two axes read `[]` in opposite directions and `normalizeScope` keeps them apart.
|
||||
*
|
||||
* Only the whole-dataset reading still has to be TRANSLATED, and the translation is the
|
||||
* tell that the mechanism under it is about to stop being ours: it is served by
|
||||
* enumerating this identity's own documents across its three stores
|
||||
|
||||
@@ -453,7 +453,11 @@ describe("useShapeQuery", () => {
|
||||
// Upstream: "Setting value to `[]` or leaving it `undefined`, no objects are returned."
|
||||
// It is an ANSWER, not a failure - and not the pending state either, which is what an
|
||||
// application would otherwise be left staring at.
|
||||
const obs = useShapeQuery(EventShape, {});
|
||||
// `graphs` became REQUIRED in `@ng-org/orm@0.1.2-alpha.21`, so the "leaving it
|
||||
// `undefined`" half of that sentence is no longer reachable by omitting the key. `[]`
|
||||
// is the other half, and it is the one that still spells "empty" - `normalizeScope`
|
||||
// maps both onto the same empty list, so this asks the same question it always did.
|
||||
const obs = useShapeQuery(EventShape, { graphs: [] });
|
||||
const unsub = obs.subscribe(() => {});
|
||||
await tick();
|
||||
await tick();
|
||||
|
||||
Reference in New Issue
Block a user