From 5fa5d5f326add6e8876084de24e45163bdeff33b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 17:26:41 +0000 Subject: [PATCH 1/2] fix(core): Resolve mock fixture types without @data-client/endpoint core/mock fixture types imported EndpointInterface and ResolveType from @data-client/endpoint, which core doesn't depend on; import them from core itself. Also raise @data-client/test's @data-client/react peer floor to ^0.15.3, the first release whose /mock subpath loads under CommonJS. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01DWrXQsPLEpjGyPxXxv8Yhc --- .agents/skills/changeset/no-agent-impact.json | 2 +- .changeset/core-mock-fixture-types.md | 12 + .changeset/test-mock-reexports.md | 7 +- packages/core/src/mock/fixtureTypes.ts | 2 +- packages/test/package.json | 2 +- website/blog/2026-10-03-v0.19-batch-set.md | 8 +- .../editor-types/@data-client/core/mock.d.ts | 596 +++++------------- 7 files changed, 166 insertions(+), 463 deletions(-) create mode 100644 .changeset/core-mock-fixture-types.md diff --git a/.agents/skills/changeset/no-agent-impact.json b/.agents/skills/changeset/no-agent-impact.json index 40d9c27dc69a..ba65d26e5738 100644 --- a/.agents/skills/changeset/no-agent-impact.json +++ b/.agents/skills/changeset/no-agent-impact.json @@ -1,4 +1,4 @@ { "drop-typescript-3": "Agents don't install or keep TypeScript 3.x, so no realistic task hits the old behavior.", - "test-mock-reexports": "Agent-written test code and imports are the same before and after; only install-time peer resolution changes, for projects pinned to @data-client/react 0.14 or older." + "test-mock-reexports": "Agent-written test code and imports are the same before and after; only install-time peer resolution changes, for projects pinned to @data-client/react 0.15.2 or older." } diff --git a/.changeset/core-mock-fixture-types.md b/.changeset/core-mock-fixture-types.md new file mode 100644 index 000000000000..899f55ced5ff --- /dev/null +++ b/.changeset/core-mock-fixture-types.md @@ -0,0 +1,12 @@ +--- +'@data-client/core': patch +'@data-client/react': patch +'@data-client/test': patch +--- + +Fix fixture types needing `@data-client/endpoint` installed + +`Fixture` and the other fixture types from `@data-client/react/mock`, `@data-client/core/mock` and `@data-client/test` no +longer resolve `@data-client/endpoint`, which those packages don't depend on. Projects that install only +`@data-client/react` and `@data-client/test` (for example with pnpm's strict layout) no longer get +`Cannot find module '@data-client/endpoint'` when type-checking fixtures. diff --git a/.changeset/test-mock-reexports.md b/.changeset/test-mock-reexports.md index c6769e441f5b..08c42a7f26e1 100644 --- a/.changeset/test-mock-reexports.md +++ b/.changeset/test-mock-reexports.md @@ -2,10 +2,11 @@ '@data-client/test': minor --- -BREAKING: `@data-client/test` requires `@data-client/react` 0.15 or later +BREAKING: `@data-client/test` requires `@data-client/react` 0.15.3 or later -Support for `@data-client/react` 0.12 through 0.14 is dropped, since `@data-client/test` imports -`@data-client/react/mock`, which first shipped in 0.15. Upgrade `@data-client/react` along with `@data-client/test`. +Support for `@data-client/react` 0.12 through 0.15.2 is dropped, since `@data-client/test` imports +`@data-client/react/mock`, which first loads in Jest and other CommonJS tests in 0.15.3. Upgrade `@data-client/react` +along with `@data-client/test`. ```diff title="package.json" - "@data-client/react": "^0.14.0", diff --git a/packages/core/src/mock/fixtureTypes.ts b/packages/core/src/mock/fixtureTypes.ts index 7f408cc192e0..0cae76b992de 100644 --- a/packages/core/src/mock/fixtureTypes.ts +++ b/packages/core/src/mock/fixtureTypes.ts @@ -1,4 +1,4 @@ -import type { EndpointInterface, ResolveType } from '@data-client/endpoint'; +import type { EndpointInterface, ResolveType } from '../index.js'; type Updater = ( result: any, diff --git a/packages/test/package.json b/packages/test/package.json index f9ca432dd305..620cb83f4170 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -109,7 +109,7 @@ "@testing-library/react": "^16.0.0" }, "peerDependencies": { - "@data-client/react": "^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0", + "@data-client/react": "^0.15.3 || ^0.16.0 || ^0.17.0 || ^0.18.0", "@testing-library/react-hooks": "^8.0.0", "@testing-library/react-native": "^13.0.0 || ^14.0.0", "@types/react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-0 || ^19.0.0", diff --git a/website/blog/2026-10-03-v0.19-batch-set.md b/website/blog/2026-10-03-v0.19-batch-set.md index 836bd4a880ad..b180a017c7da 100644 --- a/website/blog/2026-10-03-v0.19-batch-set.md +++ b/website/blog/2026-10-03-v0.19-batch-set.md @@ -60,7 +60,7 @@ Coding agents also get a Claude Code plugin, Vue skills and llms.txt; see - [TypeScript 4.0 or later is required](/blog/2026/10/03/v0.19-batch-set#typescript-4) - the TypeScript 3.x declarations are removed ([#4151](https://github.com/reactive/data-client/pull/4151)) - [Managers must define `middleware`](/blog/2026/10/03/v0.19-batch-set#manager-middleware) - `getMiddleware()` is removed ([#4378](https://github.com/reactive/data-client/pull/4378), [#4382](https://github.com/reactive/data-client/pull/4382)) -- [@data-client/test requires @data-client/react 0.15 or later](/blog/2026/10/03/v0.19-batch-set#test-react-0.15) ([#4414](https://github.com/reactive/data-client/pull/4414)) +- [@data-client/test requires @data-client/react 0.15.3 or later](/blog/2026/10/03/v0.19-batch-set#test-react-0.15) ([#4414](https://github.com/reactive/data-client/pull/4414)) **[Get ready for future releases:](/blog/2026/10/03/v0.19-batch-set#future-releases)** @@ -797,12 +797,12 @@ class LoggingManager implements Manager { [#4382](https://github.com/reactive/data-client/pull/4382) -### @data-client/test requires @data-client/react 0.15 {#test-react-0.15} +### @data-client/test requires @data-client/react 0.15.3 {#test-react-0.15} Skip this section if you don't use [@data-client/test](https://www.npmjs.com/package/@data-client/test). -`@data-client/test` now builds on `@data-client/react/mock`, which first shipped in `@data-client/react` 0.15, so -support for 0.12 through 0.14 is dropped. Upgrade `@data-client/react` to the same version as `@data-client/test`, as +`@data-client/test` now builds on `@data-client/react/mock`, which first loads in Jest and other CommonJS tests in +`@data-client/react` 0.15.3, so support for 0.12 through 0.15.2 is dropped. Upgrade `@data-client/react` to the same version as `@data-client/test`, as the install command above does. Fixture types imported from `@data-client/test` and from `@data-client/react/mock` are now the same types. [#4414](https://github.com/reactive/data-client/pull/4414) diff --git a/website/src/components/Playground/editor-types/@data-client/core/mock.d.ts b/website/src/components/Playground/editor-types/@data-client/core/mock.d.ts index 8309965b151c..5b7d28cb64dc 100644 --- a/website/src/components/Playground/editor-types/@data-client/core/mock.d.ts +++ b/website/src/components/Playground/editor-types/@data-client/core/mock.d.ts @@ -1,39 +1,39 @@ -type Schema$1 = null | string | { +type Schema = null | string | { [K: string]: any; -} | Schema$1[] | SchemaSimple$1 | Serializable$1; -interface Queryable$1 { +} | Schema[] | SchemaSimple | Serializable; +interface Queryable { queryKey(args: Args, unvisit: (...args: any) => any, delegate: { getEntity: any; getIndex: any; }): {}; } -type Serializable$1 = (value: any) => T; -interface SchemaSimple$1 { - normalize(input: any, parent: any, key: any, delegate: INormalizeDelegate$1, +interface SchemaSimple { + normalize(input: any, parent: any, key: any, delegate: INormalizeDelegate, /** The nearest enclosing entity-like schema (one with `pk`), if any. * Tracked automatically by the visit walker. */ parentEntity?: any): any; - denormalize(input: {}, delegate: IDenormalizeDelegate$1): T; + denormalize(input: {}, delegate: IDenormalizeDelegate): T; queryKey(args: Args, unvisit: (...args: any) => any, delegate: { getEntity: any; getIndex: any; }): any; } -interface EntityInterface$1 extends SchemaSimple$1 { +interface EntityInterface extends SchemaSimple { createIfValid(props: any): any; pk(params: any, parent: any, key: string | undefined, args: readonly any[]): string | number | undefined; readonly key: string; indexes?: any; - schema: Record; + schema: Record; prototype: T; cacheWith?: object | undefined; maxEntityDepth?: number | undefined; } -interface Mergeable$1 { +interface Mergeable { key: string; merge(existing: any, incoming: any): any; mergeWithStore(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; @@ -47,7 +47,7 @@ interface NormalizedIndex { }; } /** Visits next data + schema while recurisvely normalizing */ -interface Visit$1 { +interface Visit { (schema: any, value: any, parent: any, key: any): any; creating?: boolean; } @@ -60,12 +60,12 @@ type IndexPath = [key: string, index: string, value: string]; type EntitiesPath = [key: string]; type QueryPath = IndexPath | [key: string, pk: string] | EntitiesPath; /** Interface specification for entities state accessor */ -interface EntitiesInterface$1 { +interface EntitiesInterface { keys(): IterableIterator; entries(): IterableIterator<[string, any]>; } /** Get normalized Entity from store */ -interface GetEntity$1 { +interface GetEntity { (key: string, pk: string): any; } /** Get PK using an Entity Index */ @@ -76,16 +76,16 @@ interface GetIndex { /** Accessors to the currently processing state while building query */ interface IQueryDelegate { /** Get all entities for a given schema key */ - getEntities(key: string): EntitiesInterface$1 | undefined; + getEntities(key: string): EntitiesInterface | undefined; /** Gets any previously normalized entity from store */ - getEntity: GetEntity$1; + getEntity: GetEntity; /** Get PK using an Entity Index */ getIndex: GetIndex; /** Return to consider results invalid */ INVALID: symbol; } /** Helpers during schema.denormalize() */ -interface IDenormalizeDelegate$1 { +interface IDenormalizeDelegate { /** Recursive denormalize of nested schemas */ unvisit(schema: any, input: any): any; /** Raw endpoint args. Reading this does NOT contribute to cache @@ -98,9 +98,9 @@ interface IDenormalizeDelegate$1 { argsKey(fn: (args: readonly any[]) => string | undefined): string | undefined; } /** Helpers during schema.normalize() */ -interface INormalizeDelegate$1 { +interface INormalizeDelegate { /** Recursive normalize of nested schemas */ - visit: Visit$1; + visit: Visit; /** Raw endpoint args for this normalize call */ readonly args: readonly any[]; /** Action meta-data for this normalize call */ @@ -110,11 +110,11 @@ interface INormalizeDelegate$1 { expiresAt: number; }; /** Get all entities for a given schema key */ - getEntities(key: string): EntitiesInterface$1 | undefined; + getEntities(key: string): EntitiesInterface | undefined; /** Gets any previously normalized entity from store */ - getEntity: GetEntity$1; + getEntity: GetEntity; /** Updates an entity using merge lifecycles when it has previously been set */ - mergeEntity(schema: Mergeable$1 & { + mergeEntity(schema: Mergeable & { indexes?: any; }, pk: string, incomingEntity: any): void; /** Sets an entity overwriting any previously set values */ @@ -135,79 +135,79 @@ interface INormalizeDelegate$1 { } /** Attempts to infer reasonable input type to construct an Entity */ -type EntityFields$1 = { +type EntityFields = { readonly [K in keyof U as U[K] extends (...args: any) => any ? never : K]?: U[K] extends number ? U[K] | string : U[K] extends string ? U[K] | number : U[K]; }; -type SchemaArgs$1 = S extends { +type SchemaArgs = S extends { createIfValid: any; pk: any; key: string; prototype: infer U; } ? [ - EntityFields$1 + EntityFields ] : S extends ({ queryKey(args: infer Args, ...rest: any): any; }) ? Args : S extends { [K: string]: any; -} ? ObjectArgs$1 : never; -type ObjectArgs$1> = { - [K in keyof S]: S[K] extends Schema$1 ? SchemaArgs$1 : never; +} ? ObjectArgs : never; +type ObjectArgs> = { + [K in keyof S]: S[K] extends Schema ? SchemaArgs : never; }[keyof S]; -type AbstractInstanceType$1 = T extends new (...args: any) => infer U ? U : T extends { +type AbstractInstanceType = T extends new (...args: any) => infer U ? U : T extends { prototype: infer U; } ? U : never; -type DenormalizeObject$1> = { - [K in keyof S]: S[K] extends Schema$1 ? Denormalize$1 : S[K]; +type DenormalizeObject> = { + [K in keyof S]: S[K] extends Schema ? Denormalize : S[K]; }; -type DenormalizeNullableObject$1> = { - [K in keyof S]: S[K] extends Schema$1 ? DenormalizeNullable$1 : S[K]; +type DenormalizeNullableObject> = { + [K in keyof S]: S[K] extends Schema ? DenormalizeNullable : S[K]; }; type NormalizeObject> = { - [K in keyof S]: S[K] extends Schema$1 ? Normalize : S[K]; + [K in keyof S]: S[K] extends Schema ? Normalize : S[K]; }; type NormalizedNullableObject> = { - [K in keyof S]: S[K] extends Schema$1 ? NormalizeNullable : S[K]; + [K in keyof S]: S[K] extends Schema ? NormalizeNullable : S[K]; }; -interface NestedSchemaClass$1 { - schema: Record; +interface NestedSchemaClass { + schema: Record; prototype: T; } -interface RecordClass$1 extends NestedSchemaClass$1 { - fromJS: (...args: any) => AbstractInstanceType$1; +interface RecordClass extends NestedSchemaClass { + fromJS: (...args: any) => AbstractInstanceType; } -type DenormalizeNullableNestedSchema$1 = keyof S['schema'] extends never ? S['prototype'] : string extends keyof S['schema'] ? S['prototype'] : S['prototype']; +type DenormalizeNullableNestedSchema = keyof S['schema'] extends never ? S['prototype'] : string extends keyof S['schema'] ? S['prototype'] : S['prototype']; type NormalizeReturnType = T extends (...args: any) => infer R ? R : never; -type Denormalize$1 = S extends { +type Denormalize = S extends { createIfValid: any; pk: any; key: string; prototype: infer U; -} ? U : S extends RecordClass$1 ? AbstractInstanceType$1 : S extends { +} ? U : S extends RecordClass ? AbstractInstanceType : S extends { denormalize: (...args: any) => any; -} ? ReturnType : S extends Serializable$1 ? T : S extends Array ? Denormalize$1[] : S extends { +} ? ReturnType : S extends Serializable ? T : S extends Array ? Denormalize[] : S extends { [K: string]: any; -} ? DenormalizeObject$1 : S; -type DenormalizeNullable$1 = S extends ({ +} ? DenormalizeObject : S; +type DenormalizeNullable = S extends ({ createIfValid: any; pk: any; key: string; prototype: any; schema: any; -}) ? DenormalizeNullableNestedSchema$1 | undefined : S extends RecordClass$1 ? DenormalizeNullableNestedSchema$1 : S extends { +}) ? DenormalizeNullableNestedSchema | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema : S extends { _denormalizeNullable: (...args: any) => any; -} ? ReturnType : S extends Serializable$1 ? T : S extends Array ? Denormalize$1[] | undefined : S extends { +} ? ReturnType : S extends Serializable ? T : S extends Array ? Denormalize[] | undefined : S extends { [K: string]: any; -} ? DenormalizeNullableObject$1 : S; +} ? DenormalizeNullableObject : S; type Normalize = S extends { createIfValid: any; pk: any; key: string; prototype: {}; -} ? string : S extends RecordClass$1 ? NormalizeObject : S extends { +} ? string : S extends RecordClass ? NormalizeObject : S extends { normalize: (...args: any) => any; -} ? NormalizeReturnType : S extends Serializable$1 ? T : S extends Array ? Normalize[] : S extends { +} ? NormalizeReturnType : S extends Serializable ? T : S extends Array ? Normalize[] : S extends { [K: string]: any; } ? NormalizeObject : S; type NormalizeNullable = S extends { @@ -215,9 +215,9 @@ type NormalizeNullable = S extends { pk: any; key: string; prototype: {}; -} ? string | undefined : S extends RecordClass$1 ? NormalizedNullableObject : S extends { +} ? string | undefined : S extends RecordClass ? NormalizedNullableObject : S extends { _normalizeNullable: (...args: any) => any; -} ? NormalizeReturnType : S extends Serializable$1 ? T : S extends Array ? Normalize[] | undefined : S extends { +} ? NormalizeReturnType : S extends Serializable ? T : S extends Array ? Normalize[] | undefined : S extends { [K: string]: any; } ? NormalizedNullableObject : S; @@ -271,7 +271,7 @@ declare abstract class BaseDelegate { entities: any; indexes: any; }); - abstract getEntities(key: string): EntitiesInterface$1 | undefined; + abstract getEntities(key: string): EntitiesInterface | undefined; abstract getEntity(key: string, pk: string): object | undefined; abstract getIndex(...path: IndexPath): object | undefined; abstract getIndexEnd(entity: any, value: string): string | undefined; @@ -289,7 +289,7 @@ interface IMemoPolicy { getEntities(entities: any): DenormGetEntity; } -type GetEntityCache = (pk: string, schema: EntityInterface$1) => WeakDependencyMap; +type GetEntityCache = (pk: string, schema: EntityInterface) => WeakDependencyMap; /** Singleton to store the memoization cache for denormalization methods */ declare class MemoCache { @@ -302,16 +302,16 @@ declare class MemoCache { protected policy: IMemoPolicy; constructor(policy?: IMemoPolicy); /** Compute denormalized form maintaining referential equality for same inputs */ - denormalize(schema: S | undefined, input: unknown, entities: any, args?: readonly any[]): { - data: DenormalizeNullable$1 | typeof INVALID; + denormalize(schema: S | undefined, input: unknown, entities: any, args?: readonly any[]): { + data: DenormalizeNullable | typeof INVALID; paths: EntityPath[]; }; /** Compute denormalized form maintaining referential equality for same inputs */ - query(schema: S, args: readonly any[], state: StateInterface, argsKey?: string): { - data: DenormalizeNullable$1 | typeof INVALID; + query(schema: S, args: readonly any[], state: StateInterface, argsKey?: string): { + data: DenormalizeNullable | typeof INVALID; paths: EntityPath[]; }; - buildQueryKey(schema: S, args: readonly any[], state: StateInterface, argsKey?: string): NormalizeNullable; + buildQueryKey(schema: S, args: readonly any[], state: StateInterface, argsKey?: string): NormalizeNullable; } type StateInterface = { entities: Record | undefined> | { @@ -331,7 +331,7 @@ type EntityRef = string | { }; /** Schemas that write each row to one stored entity: Entity, Union, or Invalidate (batch delete). * Query, All and Collection don't: they normalize to lists, or Collection keys by args batch set() lacks. */ -type SetEntitySchema = EntityInterface$1 | EntityRefSchema; +type SetEntitySchema = EntityInterface | EntityRefSchema; /** Union or Invalidate */ type EntityRefSchema = { _normalizeNullable(): EntityRef | undefined; @@ -339,7 +339,7 @@ type EntityRefSchema = { }; /** `[Entity]`, `schema.Array(Entity)` or `schema.Values(Entity)` (or of a Union or Invalidate) */ type SetManySchema = readonly SetEntitySchema[] | { - readonly schema: SetEntitySchema | Record; + readonly schema: SetEntitySchema | Record; schemaKey(): string; queryKey(...args: any): undefined; pk?: never; @@ -352,95 +352,95 @@ type SetInvalidateSchema = EntityRefSchema & { type IsUnion = T extends unknown ? [ U ] extends [T] ? false : true : never; -type FunctionKeys$1 = { +type FunctionKeys = { [K in keyof U]: U[K] extends (...args: any) => any ? K : never; }[keyof U]; /** Raw input for one field: numbers and strings coerce (literals stay exact); * objects are pre-normalize */ -type SetField$1 = T extends number ? number extends T ? T | string : T : T extends string ? string extends T ? T | number : T : T extends object ? unknown : T; +type SetField = T extends number ? number extends T ? T | string : T : T extends string ? string extends T ? T | number : T : T extends object ? unknown : T; /** Fields of one row (or a coerced primitive); like EntityFields, but distributive * and without key remapping (TS 4.0). A Union gets one row per member, so a * discriminator like `type` selects the member the other fields are checked against. */ -type SetRow$1 = 0 extends 1 & U ? { +type SetRow = 0 extends 1 & U ? { readonly [k: string]: any; } : U extends object ? { - readonly [K in Exclude>]?: SetField$1; -} : SetField$1; + readonly [K in Exclude>]?: SetField; +} : SetField; /** Keeps S inferred from the schema alone: inferring it from the value too would * walk the value's type against every conditional in SetValue (TS 5.4 has NoInfer) */ type SkipInfer = [T][S extends unknown ? 0 : never]; type SetManyValue = S extends readonly (infer E)[] ? true extends IsUnion ? readonly { 'Use a Union schema for several Entity types': never; -}[] : readonly SetRow$1>[] : SetValue$1; +}[] : readonly SetRow>[] : SetValue; /** Raw input `set()` normalizes for a Queryable */ -type SetValue$1 = InputSchema$1>> extends infer N ? N extends EntityInterface$1 ? SetRow$1> : SetInput$1> : never; +type SetValue = InputSchema>> extends infer N ? N extends EntityInterface ? SetRow> : SetInput> : never; /** Query normalizes with its inner schema; its process() output is not input * * Applied three times in SetValue to unwrap nested Queries (TS 4.0 has no recursive aliases) */ -type InputSchema$1 = S extends ({ +type InputSchema = S extends ({ readonly schema: infer Sch; process(...args: any): any; pk?: never; }) ? Sch : S; /** Raw input for a denormalized value, like a Collection's list or a Union's row */ -type SetInput$1 = 0 extends 1 & T ? any : [ +type SetInput = 0 extends 1 & T ? any : [ T -] extends [readonly (infer U)[]] ? readonly SetRow$1[] : string extends keyof T ? { - readonly [k: string]: SetRow$1; -} : SetRow$1; +] extends [readonly (infer U)[]] ? readonly SetRow[] : string extends keyof T ? { + readonly [k: string]: SetRow; +} : SetRow; -interface NetworkError$1 extends Error { +interface NetworkError extends Error { status: number; response?: Response; } -interface UnknownError$1 extends Error { +interface UnknownError extends Error { status?: unknown; response?: unknown; } -type ErrorTypes$1 = NetworkError$1 | UnknownError$1; +type ErrorTypes = NetworkError | UnknownError; /** What the function's promise resolves to */ -type ResolveType$1 any> = ReturnType extends Promise ? R : never; +type ResolveType any> = ReturnType extends Promise ? R : never; declare const enum ExpiryStatus { Invalid = 1, InvalidIfStale = 2, Valid = 3 } -type ExpiryStatusInterface$1 = 1 | 2 | 3; +type ExpiryStatusInterface = 1 | 2 | 3; -interface SnapshotInterface$1 { +interface SnapshotInterface { /** * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Snapshot#getResponse */ - getResponse>(endpoint: E, ...args: readonly any[]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatusInterface$1; + getResponse>(endpoint: E, ...args: readonly any[]): { + data: DenormalizeNullable; + expiryStatus: ExpiryStatusInterface; expiresAt: number; }; /** * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Snapshot#getResponseMeta */ - getResponseMeta>(endpoint: E, ...args: readonly any[]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatusInterface$1; + getResponseMeta>(endpoint: E, ...args: readonly any[]): { + data: DenormalizeNullable; + expiryStatus: ExpiryStatusInterface; expiresAt: number; }; /** @see https://dataclient.io/docs/api/Snapshot#getError */ - getError: , Args extends readonly [...Parameters]>(endpoint: E, ...args: Args) => ErrorTypes$1 | undefined; + getError: , Args extends readonly [...Parameters]>(endpoint: E, ...args: Args) => ErrorTypes | undefined; /** * Retrieved memoized value for any Querable schema * @see https://dataclient.io/docs/api/Snapshot#get */ - get(schema: S, ...args: readonly any[]): any; + get(schema: S, ...args: readonly any[]): any; /** * Queries the store for a Querable schema; providing related metadata * @see https://dataclient.io/docs/api/Snapshot#getQueryMeta */ - getQueryMeta(schema: S, ...args: readonly any[]): { + getQueryMeta(schema: S, ...args: readonly any[]): { data: any; countRef: () => () => void; }; @@ -449,13 +449,13 @@ interface SnapshotInterface$1 { } /** Defines a networking endpoint */ -interface EndpointInterface$1 extends EndpointExtraOptions$1 { +interface EndpointInterface extends EndpointExtraOptions { (...args: Parameters): ReturnType; key(...args: Parameters): string; readonly sideEffect?: M; readonly schema?: S; } -interface EndpointExtraOptions$1 { +interface EndpointExtraOptions { /** Default data expiry length, will fall back to NetworkManager default if not defined */ readonly dataExpiryLength?: number; /** Default error expiry length, will fall back to NetworkManager default if not defined */ @@ -465,20 +465,20 @@ interface EndpointExtraOptions$1 { /** Marks cached resources as invalid if they are stale */ readonly invalidIfStale?: boolean; /** Enables optimistic updates for this request - uses return value as assumed network response */ - getOptimisticResponse?(snap: SnapshotInterface$1, ...args: Parameters): ResolveType$1; + getOptimisticResponse?(snap: SnapshotInterface, ...args: Parameters): ResolveType; /** Determines whether to throw or fallback to */ errorPolicy?(error: any): 'hard' | 'soft' | undefined; /** User-land extra data to send */ readonly extra?: any; } -type FetchFunction$1 = (...args: A) => Promise; +type FetchFunction = (...args: A) => Promise; declare class AbortOptimistic extends Error { } -type ResultEntry = E['schema'] extends undefined | null ? ResolveType$1 : Normalize; -type EndpointUpdateFunction = Record> = (source: ResultEntry, ...args: any) => { +type ResultEntry = E['schema'] extends undefined | null ? ResolveType : Normalize; +type EndpointUpdateFunction = Record> = (source: ResultEntry, ...args: any) => { [K in keyof Updaters]: (result: Updaters[K]) => Updaters[K]; }; @@ -494,11 +494,11 @@ declare const INVALIDATEALL: 'rdc/invalidateall'; declare const EXPIREALL: 'rdc/expireall'; declare const GC: 'rdc/gc'; -type EndpointAndUpdate = EndpointInterface$1 & { +type EndpointAndUpdate = EndpointInterface & { update?: EndpointUpdateFunction; }; -type EndpointDefault = EndpointInterface$1 & { - update?: EndpointUpdateFunction; +type EndpointDefault = EndpointInterface & { + update?: EndpointUpdateFunction; }; /** General meta-data for operators */ interface ActionMeta { @@ -507,12 +507,12 @@ interface ActionMeta { readonly expiresAt: number; } /** Action for Controller.set() */ -interface SetAction { +interface SetAction { type: typeof SET; schema: S; args: readonly any[]; meta: ActionMeta; - value: {} | ((previousValue: Denormalize$1) => {}); + value: {} | ((previousValue: Denormalize) => {}); } interface SetResponseActionBase = EndpointDefault> { type: typeof SET_RESPONSE; @@ -522,11 +522,11 @@ interface SetResponseActionBase = EndpointDefault meta: ActionMeta; } interface SetResponseActionSuccess = EndpointDefault> extends SetResponseActionBase { - response: ResolveType$1; + response: ResolveType; error?: false; } interface SetResponseActionError = EndpointDefault> extends SetResponseActionBase { - response: UnknownError$1; + response: UnknownError; error: true; } /** Action for Controller.setResponse() */ @@ -613,7 +613,7 @@ interface State { readonly fetchedAt: number; readonly expiresAt: number; readonly prevExpiresAt?: number; - readonly error?: ErrorTypes$1; + readonly error?: ErrorTypes; readonly invalidated?: boolean; readonly errorPolicy?: 'hard' | 'soft' | undefined; }; @@ -699,22 +699,22 @@ declare class Controller { * Fetches the endpoint with given args, updating the Reactive Data Client cache with the response or error upon completion. * @see https://dataclient.io/docs/api/Controller#fetch */ - fetch: ; - }>(endpoint: E, ...args: readonly [...Parameters]) => E['schema'] extends undefined | null ? ReturnType : Promise>; + }>(endpoint: E, ...args: readonly [...Parameters]) => E['schema'] extends undefined | null ? ReturnType : Promise>; /** * Fetches only if endpoint is considered 'stale'; otherwise returns the cached data synchronously * @see https://dataclient.io/docs/api/Controller#fetchIfStale */ - fetchIfStale: ; - }>(endpoint: E, ...args: readonly [...Parameters]) => E['schema'] extends undefined | null ? ReturnType | ResolveType$1 : Promise> | Denormalize$1; + }>(endpoint: E, ...args: readonly [...Parameters]) => E['schema'] extends undefined | null ? ReturnType | ResolveType : Promise> | Denormalize; /** * Forces refetching on useSuspense with the same Endpoint and parameters, suspending until it resolves * (mounted Vue components keep their current data instead). * @see https://dataclient.io/docs/api/Controller#invalidate */ - invalidate: (endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; + invalidate: (endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; /** * Forces refetching on useSuspense on all matching endpoint result keys, suspending until it resolves * (mounted Vue components keep their current data instead). @@ -741,9 +741,9 @@ declare class Controller { * Sets value for the Queryable and args. * @see https://dataclient.io/docs/api/Controller#set */ - set(schema: S, ...rest: readonly [ - ...SchemaArgs$1, - SkipInfer | ((previousValue: Denormalize$1) => SetValue$1), S> + set(schema: S, ...rest: readonly [ + ...SchemaArgs, + SkipInfer | ((previousValue: Denormalize) => SetValue), S> ]): Promise; /** * Sets every row of an Array or Values of one Entity (or Union) in one normalize, @@ -755,21 +755,21 @@ declare class Controller { * Sets response for the Endpoint and args. * @see https://dataclient.io/docs/api/Controller#setResponse */ - setResponse: ; }>(endpoint: E, ...rest: readonly [...Parameters, any]) => Promise; /** * Sets an error response for the Endpoint and args. * @see https://dataclient.io/docs/api/Controller#setError */ - setError: ; }>(endpoint: E, ...rest: readonly [...Parameters, Error]) => Promise; /** * Resolves an inflight fetch. * @see https://dataclient.io/docs/api/Controller#resolve */ - resolve: ; }>(endpoint: E, meta: { args: readonly [...Parameters]; @@ -786,12 +786,12 @@ declare class Controller { * Marks a new subscription to a given Endpoint. * @see https://dataclient.io/docs/api/Controller#subscribe */ - subscribe: >(endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; + subscribe: >(endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; /** * Marks completion of subscription to a given Endpoint. * @see https://dataclient.io/docs/api/Controller#unsubscribe */ - unsubscribe: >(endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; + unsubscribe: >(endpoint: E, ...args: readonly [...Parameters] | readonly [null]) => Promise; /*************** More ***************/ /** * Gets a snapshot (https://dataclient.io/docs/api/Snapshot) @@ -802,23 +802,23 @@ declare class Controller { * Gets the error, if any, for a given endpoint. Returns undefined for no errors. * @see https://dataclient.io/docs/api/Controller#getError */ - getError(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): ErrorTypes$1 | undefined; - getError>(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): ErrorTypes$1 | undefined; + getError(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): ErrorTypes | undefined; + getError>(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): ErrorTypes | undefined; /** * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Controller#getResponse */ - getResponse(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): { - data: DenormalizeNullable$1; + getResponse(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): { + data: DenormalizeNullable; expiryStatus: ExpiryStatus; expiresAt: number; countRef: () => () => void; }; - getResponse>(endpoint: E, ...rest: readonly [ + getResponse>(endpoint: E, ...rest: readonly [ ...(readonly [...Parameters] | readonly [null]), State ]): { - data: DenormalizeNullable$1; + data: DenormalizeNullable; expiryStatus: ExpiryStatus; expiresAt: number; countRef: () => () => void; @@ -827,17 +827,17 @@ declare class Controller { * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. * @see https://dataclient.io/docs/api/Controller#getResponseMeta */ - getResponseMeta(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): { - data: DenormalizeNullable$1; + getResponseMeta(endpoint: E, ...rest: readonly [null, State] | readonly [...Parameters, State]): { + data: DenormalizeNullable; expiryStatus: ExpiryStatus; expiresAt: number; countRef: () => () => void; }; - getResponseMeta>(endpoint: E, ...rest: readonly [ + getResponseMeta>(endpoint: E, ...rest: readonly [ ...(readonly [...Parameters] | readonly [null]), State ]): { - data: DenormalizeNullable$1; + data: DenormalizeNullable; expiryStatus: ExpiryStatus; expiresAt: number; countRef: () => () => void; @@ -846,25 +846,25 @@ declare class Controller { * Queries the store for a Querable schema * @see https://dataclient.io/docs/api/Controller#get */ - get(schema: S, ...rest: readonly [ - ...SchemaArgs$1, + get(schema: S, ...rest: readonly [ + ...SchemaArgs, Pick, 'entities' | 'indexes'> - ]): DenormalizeNullable$1 | undefined; + ]): DenormalizeNullable | undefined; /** * Queries the store for a Querable schema; providing related metadata * @see https://dataclient.io/docs/api/Controller#getQueryMeta */ - getQueryMeta(schema: S, ...rest: readonly [ - ...SchemaArgs$1, + getQueryMeta(schema: S, ...rest: readonly [ + ...SchemaArgs, Pick, 'entities' | 'indexes'> ]): { - data: DenormalizeNullable$1 | undefined; + data: DenormalizeNullable | undefined; countRef: () => () => void; }; private getExpiryStatus; } -declare class Snapshot implements SnapshotInterface$1 { +declare class Snapshot implements SnapshotInterface { static readonly abort: AbortOptimistic; private state; private controller; @@ -873,198 +873,35 @@ declare class Snapshot implements SnapshotInterface$1 { constructor(controller: Controller, state: State, fetchedAt?: number); /*************** Data Access ***************/ /** @see https://dataclient.io/docs/api/Snapshot#getResponse */ - getResponse(endpoint: E, ...args: readonly [null]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - getResponse(endpoint: E, ...args: readonly [...Parameters]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - getResponse>(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - /** @see https://dataclient.io/docs/api/Snapshot#getResponseMeta */ - getResponseMeta(endpoint: E, ...args: readonly [null]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - getResponseMeta(endpoint: E, ...args: readonly [...Parameters]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - getResponseMeta>(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): { - data: DenormalizeNullable$1; - expiryStatus: ExpiryStatus; - expiresAt: number; - }; - /** @see https://dataclient.io/docs/api/Snapshot#getError */ - getError(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): ErrorTypes$1 | undefined; - getError>(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): ErrorTypes$1 | undefined; - /** - * Retrieved memoized value for any Querable schema - * @see https://dataclient.io/docs/api/Snapshot#get - */ - get(schema: S, ...args: SchemaArgs$1): DenormalizeNullable$1 | undefined; - /** - * Queries the store for a Querable schema; providing related metadata - * @see https://dataclient.io/docs/api/Snapshot#getQueryMeta - */ - getQueryMeta(schema: S, ...args: SchemaArgs$1): { - data: DenormalizeNullable$1 | undefined; - countRef: () => () => void; - }; -} - -/** Attempts to infer reasonable input type to construct an Entity */ -type EntityFields = { - readonly [K in keyof U as U[K] extends (...args: any) => any ? never : K]?: U[K] extends number ? U[K] | string : U[K] extends string ? U[K] | number : U[K]; -}; - -type SchemaArgs = S extends { - createIfValid: any; - pk: any; - key: string; - prototype: infer U; -} ? [ - EntityFields -] : S extends ({ - queryKey(args: infer Args, ...rest: any): any; -}) ? Args : S extends { - [K: string]: any; -} ? ObjectArgs : never; -type ObjectArgs> = { - [K in keyof S]: S[K] extends Schema ? SchemaArgs : never; -}[keyof S]; - -type AbstractInstanceType = T extends new (...args: any) => infer U ? U : T extends { - prototype: infer U; -} ? U : never; -type DenormalizeObject> = { - [K in keyof S]: S[K] extends Schema ? Denormalize : S[K]; -}; -type DenormalizeNullableObject> = { - [K in keyof S]: S[K] extends Schema ? DenormalizeNullable : S[K]; -}; -interface NestedSchemaClass { - schema: Record; - prototype: T; -} -interface RecordClass extends NestedSchemaClass { - fromJS: (...args: any) => AbstractInstanceType; -} -type DenormalizeNullableNestedSchema = keyof S['schema'] extends never ? S['prototype'] : string extends keyof S['schema'] ? S['prototype'] : S['prototype'] & { - [K in keyof S['schema']]: DenormalizeNullable; -}; -type Denormalize = S extends { - createIfValid: any; - pk: any; - key: string; - prototype: infer U; -} ? U : S extends RecordClass ? AbstractInstanceType : S extends { - denormalize: (...args: any) => any; -} ? ReturnType : S extends Serializable ? T : S extends Array ? Denormalize[] : S extends { - [K: string]: any; -} ? DenormalizeObject : S; -type DenormalizeNullable = S extends ({ - createIfValid: any; - pk: any; - key: string; - prototype: any; - schema: any; -}) ? DenormalizeNullableNestedSchema | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema : S extends { - _denormalizeNullable: (...args: any) => any; -} ? ReturnType : S extends Serializable ? T : S extends Array ? Denormalize[] | undefined : S extends { - [K: string]: any; -} ? DenormalizeNullableObject : S; - -type FunctionKeys = { - [K in keyof U]: U[K] extends (...args: any) => any ? K : never; -}[keyof U]; -/** Raw input for one field: numbers and strings coerce (literals stay exact); - * objects are pre-normalize */ -type SetField = T extends number ? number extends T ? T | string : T : T extends string ? string extends T ? T | number : T : T extends object ? unknown : T; -/** Fields of one row (or a coerced primitive); like EntityFields, but distributive - * and without key remapping (TS 4.0). A Union gets one row per member, so a - * discriminator like `type` selects the member the other fields are checked against. */ -type SetRow = 0 extends 1 & U ? { - readonly [k: string]: any; -} : U extends object ? { - readonly [K in Exclude>]?: SetField; -} : SetField; -/** Raw input `set()` normalizes for a Queryable */ -type SetValue = InputSchema>> extends infer N ? N extends EntityInterface ? SetRow> : SetInput> : never; -/** Query normalizes with its inner schema; its process() output is not input - * - * Applied three times in SetValue to unwrap nested Queries (TS 4.0 has no recursive aliases) - */ -type InputSchema = S extends ({ - readonly schema: infer Sch; - process(...args: any): any; - pk?: never; -}) ? Sch : S; -/** Raw input for a denormalized value, like a Collection's list or a Union's row */ -type SetInput = 0 extends 1 & T ? any : [ - T -] extends [readonly (infer U)[]] ? readonly SetRow[] : string extends keyof T ? { - readonly [k: string]: SetRow; -} : SetRow; - -interface NetworkError extends Error { - status: number; - response?: Response; -} -interface UnknownError extends Error { - status?: unknown; - response?: unknown; -} -type ErrorTypes = NetworkError | UnknownError; - -interface SnapshotInterface { - readonly fetchedAt: number; - readonly abort: Error; - /** - * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. - * @see https://dataclient.io/docs/api/Snapshot#getResponse - */ getResponse(endpoint: E, ...args: readonly [null]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; getResponse(endpoint: E, ...args: readonly [...Parameters]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; getResponse>(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; - /** - * Gets the (globally referentially stable) response for a given endpoint/args pair from state given. - * @see https://dataclient.io/docs/api/Snapshot#getResponseMeta - */ + /** @see https://dataclient.io/docs/api/Snapshot#getResponseMeta */ getResponseMeta(endpoint: E, ...args: readonly [null]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; getResponseMeta(endpoint: E, ...args: readonly [...Parameters]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; getResponseMeta>(endpoint: E, ...args: readonly [...Parameters] | readonly [null]): { data: DenormalizeNullable; - expiryStatus: ExpiryStatusInterface; + expiryStatus: ExpiryStatus; expiresAt: number; }; /** @see https://dataclient.io/docs/api/Snapshot#getError */ @@ -1075,161 +912,14 @@ interface SnapshotInterface { * @see https://dataclient.io/docs/api/Snapshot#get */ get(schema: S, ...args: SchemaArgs): DenormalizeNullable | undefined; -} -type ExpiryStatusInterface = 1 | 2 | 3; - -/** What the function's promise resolves to */ -type ResolveType any> = ReturnType extends Promise ? R : never; - -type FetchFunction = (...args: A) => Promise; -interface EndpointExtraOptions { - /** Default data expiry length, will fall back to NetworkManager default if not defined */ - readonly dataExpiryLength?: number; - /** Default error expiry length, will fall back to NetworkManager default if not defined */ - readonly errorExpiryLength?: number; - /** Poll with at least this frequency in miliseconds */ - readonly pollFrequency?: number; - /** Marks cached resources as invalid if they are stale */ - readonly invalidIfStale?: boolean; - /** Determines whether to throw or fallback to */ - errorPolicy?(error: any): 'hard' | 'soft' | undefined; - /** Enables optimistic updates for this request - uses return value as assumed network response */ - getOptimisticResponse?(snap: SnapshotInterface, ...args: Parameters): OptimisticResponse; - /** User-land extra data to send */ - readonly extra?: any; -} -/** What getOptimisticResponse() returns: the fetch's resolved type, or when that is `any` - * (no `process()`), the raw input the schema normalizes, like a `Controller.set()` value */ -type OptimisticResponse = undefined extends S ? ResolveType : null extends S ? ResolveType : 0 extends 1 & ResolveType ? SetValue : ResolveType; - -type Schema = null | string | { - [K: string]: any; -} | Schema[] | SchemaSimple | Serializable; -interface Queryable { - queryKey(args: Args, unvisit: (...args: any) => any, delegate: { - getEntity: any; - getIndex: any; - }): {}; -} -type Serializable = (value: any) => T; -interface SchemaSimple { /** - * Normalize a value into entity table form. - * - * @param input The value being normalized. - * @param parent The parent object/array/dictionary containing `input`. - * @param key The key under which `input` lives on `parent`. - * @param delegate Recursive visitor, endpoint args, and store accessors. - * @param parentEntity Nearest enclosing entity-like schema (one with `pk`), - * tracked automatically by the visit walker. `Scalar` - * uses this to discover its entity binding. + * Queries the store for a Querable schema; providing related metadata + * @see https://dataclient.io/docs/api/Snapshot#getQueryMeta */ - normalize(input: any, parent: any, key: any, delegate: INormalizeDelegate, parentEntity?: any): any; - denormalize(input: {}, delegate: IDenormalizeDelegate): T; - queryKey(args: Args, unvisit: (...args: any) => any, delegate: { - getEntity: any; - getIndex: any; - }): any; -} -interface EntityInterface extends SchemaSimple { - createIfValid(props: any): any; - pk(params: any, parent: any, key: string | undefined, args: any[]): string | number | undefined; - readonly key: string; - indexes?: any; - prototype: T; -} -interface Mergeable { - key: string; - merge(existing: any, incoming: any): any; - mergeWithStore(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; - mergeMetaWithStore(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; -} -/** - * Visits next data + schema while recursively normalizing. - * - * @param schema The schema to apply to `value`. - * @param value The value being visited. - * @param parent The parent object/array/dictionary that holds `value`. - * Schemas that recurse via `visit` should pass their own - * `input` (or the surrounding container) here. - * @param key The key under which `value` lives on `parent`. - * - * The walker internally tracks the nearest enclosing entity-like schema and - * forwards it to `schema.normalize` as a trailing `parentEntity` argument — - * see `SchemaSimple.normalize`. - */ -interface Visit { - (schema: any, value: any, parent: any, key: any): any; - creating?: boolean; -} -/** Interface specification for entities state accessor */ -interface EntitiesInterface { - keys(): IterableIterator; - entries(): IterableIterator<[string, any]>; -} -/** Get normalized Entity from store */ -interface GetEntity { - (key: string, pk: string): any; -} -/** Helpers during schema.denormalize() */ -interface IDenormalizeDelegate { - /** Recursive denormalize of nested schemas */ - unvisit(schema: any, input: any): any; - /** Raw endpoint args. Reading this does NOT contribute to cache - * invalidation — if your output varies with args, register an `argsKey` - * so the cache buckets correctly. */ - readonly args: readonly any[]; - /** Adds a memoization dimension to the surrounding cache frame. - * `fn` must be referentially stable (it doubles as the cache path key). - * Returns `fn(args)` for convenience. */ - argsKey(fn: (args: readonly any[]) => string | undefined): string | undefined; -} -/** Helpers during schema.normalize() */ -interface INormalizeDelegate { - /** Recursive normalize of nested schemas */ - visit: Visit; - /** Raw endpoint args for this normalize call */ - readonly args: readonly any[]; - /** Action meta-data for this normalize call */ - readonly meta: { - fetchedAt: number; - date: number; - expiresAt: number; + getQueryMeta(schema: S, ...args: SchemaArgs): { + data: DenormalizeNullable | undefined; + countRef: () => () => void; }; - /** Get all entities for a given schema key */ - getEntities(key: string): EntitiesInterface | undefined; - /** Gets any previously normalized entity from store */ - getEntity: GetEntity; - /** Updates an entity using merge lifecycles when it has previously been set */ - mergeEntity(schema: Mergeable & { - indexes?: any; - }, pk: string, incomingEntity: any): void; - /** Sets an entity overwriting any previously set values */ - setEntity(schema: { - key: string; - indexes?: any; - }, pk: string, entity: any, meta?: { - fetchedAt: number; - date: number; - expiresAt: number; - }): void; - /** Invalidates an entity, potentially triggering suspense */ - invalidate(schema: { - key: string; - }, pk: string): void; - /** Returns true when we're in a cycle, so we should not continue recursing */ - checkLoop(key: string, pk: string, input: object): boolean; -} -/** Defines a networking endpoint */ -interface EndpointInterface extends EndpointExtraOptions { - (...args: Parameters): ReturnType; - key(...args: Parameters): string; - readonly sideEffect?: M; - readonly schema?: S; } type Updater = (result: any, ...args: any) => Record any>; From 6d1249211ae563a9e051bccb03532936bd243363 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 17:32:07 +0000 Subject: [PATCH 2/2] fix(core): Import mock fixture types from normalizr, like the rest of core Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01DWrXQsPLEpjGyPxXxv8Yhc --- packages/core/src/mock/fixtureTypes.ts | 2 +- website/blog/2026-10-03-v0.19-batch-set.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/mock/fixtureTypes.ts b/packages/core/src/mock/fixtureTypes.ts index 0cae76b992de..e39c8627def5 100644 --- a/packages/core/src/mock/fixtureTypes.ts +++ b/packages/core/src/mock/fixtureTypes.ts @@ -1,4 +1,4 @@ -import type { EndpointInterface, ResolveType } from '../index.js'; +import type { EndpointInterface, ResolveType } from '@data-client/normalizr'; type Updater = ( result: any, diff --git a/website/blog/2026-10-03-v0.19-batch-set.md b/website/blog/2026-10-03-v0.19-batch-set.md index b180a017c7da..e954e862f8b8 100644 --- a/website/blog/2026-10-03-v0.19-batch-set.md +++ b/website/blog/2026-10-03-v0.19-batch-set.md @@ -802,9 +802,9 @@ class LoggingManager implements Manager { Skip this section if you don't use [@data-client/test](https://www.npmjs.com/package/@data-client/test). `@data-client/test` now builds on `@data-client/react/mock`, which first loads in Jest and other CommonJS tests in -`@data-client/react` 0.15.3, so support for 0.12 through 0.15.2 is dropped. Upgrade `@data-client/react` to the same version as `@data-client/test`, as -the install command above does. Fixture types imported from `@data-client/test` and from `@data-client/react/mock` are -now the same types. [#4414](https://github.com/reactive/data-client/pull/4414) +`@data-client/react` 0.15.3, so support for 0.12 through 0.15.2 is dropped. Upgrade `@data-client/react` to the same +version as `@data-client/test`, as the install command above does. Fixture types imported from `@data-client/test` and +from `@data-client/react/mock` are now the same types. [#4414](https://github.com/reactive/data-client/pull/4414) ### Get ready for future releases {#future-releases}