@tanstack/db-sqlite-persistence-core 0.4.8 → 0.4.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.
@@ -259,6 +259,27 @@ export type PersistedScannedRow<T extends object = Record<string, unknown>, TKey
259
259
  };
260
260
  export type PersistedRowScanOptions = SyncPersistenceScanOptions;
261
261
  export type PersistedKeySetEvidence = SyncPersistenceKeySetEvidence;
262
+ export type PersistedCacheGenerationClaim = {
263
+ storageCollectionId: string;
264
+ claimId: string;
265
+ /** Present when the adapter expires dormant claims. */
266
+ expiresAtMs?: number;
267
+ };
268
+ /** An eager Collection name or a claim-bound persisted cache generation. */
269
+ export type PersistedStorageTarget = {
270
+ kind: `eager`;
271
+ collectionId: string;
272
+ } | {
273
+ kind: `managed`;
274
+ storageCollectionId: string;
275
+ claimId: string;
276
+ };
277
+ export declare function eagerStorageTarget(collectionId: string): PersistedStorageTarget;
278
+ export declare function managedStorageTarget(storageCollectionId: string, claimId: string): PersistedStorageTarget;
279
+ export declare function resolvePersistedStorageTarget(target: PersistedStorageTarget, legacyClaimId?: string): {
280
+ collectionId: string;
281
+ claimId?: string;
282
+ };
262
283
  export type PersistencePullSinceResult = {
263
284
  latestRowVersion: number;
264
285
  requiresFullReload: true;
@@ -274,6 +295,8 @@ export type PersistedTx<T extends object = Record<string, unknown>, TKey extends
274
295
  term: number;
275
296
  seq: number;
276
297
  rowVersion: number;
298
+ /** Claim authorizing this transaction's persisted cache generation. */
299
+ cacheGenerationClaimId?: string;
277
300
  truncate?: boolean;
278
301
  mutations: Array<{
279
302
  type: `insert`;
@@ -308,16 +331,18 @@ export type PersistedTx<T extends object = Record<string, unknown>, TKey extends
308
331
  */
309
332
  export declare const SQLITE_DRIVER_SHARED_LOGICAL_SCHEDULING_KEY: unique symbol;
310
333
  export interface PersistenceAdapter {
311
- loadSubset: (collectionId: string, options: LoadSubsetOptions, ctx?: {
334
+ loadSubset: (target: PersistedStorageTarget, options: LoadSubsetOptions, ctx?: {
312
335
  requiredIndexSignatures?: ReadonlyArray<string>;
336
+ cacheGenerationClaimId?: string;
313
337
  }) => Promise<Array<{
314
338
  key: string | number;
315
339
  value: Record<string, unknown>;
316
340
  metadata?: unknown;
317
341
  }>>;
318
- loadResumeSnapshot: (collectionId: string, ctx?: {
342
+ loadResumeSnapshot: (target: PersistedStorageTarget, ctx?: {
319
343
  requiredIndexSignatures?: ReadonlyArray<string>;
320
344
  includeRows?: boolean;
345
+ cacheGenerationClaimId?: string;
321
346
  }) => Promise<{
322
347
  rows: Array<{
323
348
  key: string | number;
@@ -334,23 +359,43 @@ export interface PersistenceAdapter {
334
359
  latestRowVersion: number;
335
360
  resetEpoch: number;
336
361
  }>;
337
- applyCommittedTx: (collectionId: string, tx: PersistedTx) => Promise<void>;
362
+ applyCommittedTx: (target: PersistedStorageTarget, tx: PersistedTx) => Promise<void>;
363
+ claimCacheGeneration?: (collectionId: string) => Promise<PersistedCacheGenerationClaim>;
364
+ rotateCacheGeneration?: (collectionId: string, claimId: string, resetMetadata?: {
365
+ key: string;
366
+ value: unknown;
367
+ }, expectedStorageCollectionId?: string) => Promise<PersistedCacheGenerationClaim>;
368
+ releaseCacheGenerationClaim?: (claimId: string) => Promise<void>;
369
+ renewCacheGenerationClaim?: (storageCollectionId: string, claimId: string) => Promise<number | undefined>;
370
+ getCacheGenerationNow?: () => number;
338
371
  /** Atomically certify or apply one source transaction after a lost response. */
339
- reconcileCommittedTx?: (collectionId: string, tx: PersistedTx, anchor: CommittedTxAnchor) => Promise<ReconciledCommittedTx>;
340
- loadCollectionMetadata?: (collectionId: string) => Promise<Array<{
372
+ reconcileCommittedTx?: (target: PersistedStorageTarget, tx: PersistedTx, anchor: CommittedTxAnchor) => Promise<ReconciledCommittedTx>;
373
+ loadCollectionMetadata?: (target: PersistedStorageTarget, ctx?: {
374
+ cacheGenerationClaimId?: string;
375
+ }) => Promise<Array<{
341
376
  key: string;
342
377
  value: unknown;
343
378
  }>>;
344
- scanRows?: (collectionId: string, options?: PersistedRowScanOptions) => Promise<Array<PersistedScannedRow>>;
345
- ensureIndex: (collectionId: string, signature: string, spec: PersistedIndexSpec) => Promise<void>;
346
- markIndexRemoved?: (collectionId: string, signature: string) => Promise<void>;
347
- getStreamPosition?: (collectionId: string) => Promise<{
379
+ scanRows?: (target: PersistedStorageTarget, options?: PersistedRowScanOptions, ctx?: {
380
+ cacheGenerationClaimId?: string;
381
+ }) => Promise<Array<PersistedScannedRow>>;
382
+ ensureIndex: (target: PersistedStorageTarget, signature: string, spec: PersistedIndexSpec, ctx?: {
383
+ cacheGenerationClaimId?: string;
384
+ }) => Promise<void>;
385
+ markIndexRemoved?: (target: PersistedStorageTarget, signature: string, ctx?: {
386
+ cacheGenerationClaimId?: string;
387
+ }) => Promise<void>;
388
+ getStreamPosition?: (target: PersistedStorageTarget, ctx?: {
389
+ cacheGenerationClaimId?: string;
390
+ }) => Promise<{
348
391
  latestTerm: number;
349
392
  latestSeq: number;
350
393
  latestRowVersion: number;
351
394
  }>;
352
395
  /** Reserve a new durable election term before announcing Browser leadership. */
353
- reserveLeadershipTerm?: (collectionId: string, observedTerm: number) => Promise<{
396
+ reserveLeadershipTerm?: (target: PersistedStorageTarget, observedTerm: number, ctx?: {
397
+ cacheGenerationClaimId?: string;
398
+ }) => Promise<{
354
399
  latestTerm: number;
355
400
  latestSeq: number;
356
401
  latestRowVersion: number;
@@ -367,7 +412,9 @@ export interface PersistenceAdapter {
367
412
  isHydrationScopeScheduled?: () => boolean;
368
413
  }
369
414
  export type HydrationPersistenceAdapter = PersistenceAdapter & {
370
- pullSince?: (collectionId: string, fromRowVersion: number) => Promise<PersistencePullSinceResult>;
415
+ pullSince?: (target: PersistedStorageTarget, fromRowVersion: number, ctx?: {
416
+ cacheGenerationClaimId?: string;
417
+ }) => Promise<PersistencePullSinceResult>;
371
418
  };
372
419
  export type { RemoteSubsetOwner } from './remote-subset-owner.cjs';
373
420
  export interface SQLiteDriver {
@@ -387,7 +434,7 @@ export interface SQLiteDriver {
387
434
  export declare function forwardSQLiteDriverSharedLogicalScheduling<TDriver extends SQLiteDriver>(source: SQLiteDriver, wrapper: TDriver): TDriver;
388
435
  export interface PersistedCollectionCoordinator {
389
436
  getNodeId: () => string;
390
- setAdapterForCollection?: (collectionId: string, adapter: PersistenceAdapter) => void;
437
+ setAdapterForCollection?: (collectionId: string, adapter: PersistenceAdapter, cacheGenerationClaimId?: string) => void;
391
438
  subscribe: (collectionId: string, onMessage: (message: ProtocolEnvelope<unknown>) => void) => () => void;
392
439
  publish: (collectionId: string, message: ProtocolEnvelope<unknown>) => void;
393
440
  isLeader: (collectionId: string) => boolean;
@@ -400,8 +447,8 @@ export interface PersistedCollectionCoordinator {
400
447
  * and is never serialized to a follower. `localEnsureCompleted` lets the
401
448
  * built-in leader avoid repeating successful local work.
402
449
  */
403
- requestEnsurePersistedIndex: (collectionId: string, signature: string, spec: PersistedIndexSpec, scopedAdapter?: HydrationPersistenceAdapter, localEnsureCompleted?: boolean) => Promise<void>;
404
- requestApplyLocalMutations?: (collectionId: string, mutations: Array<PersistedMutationEnvelope>) => Promise<ApplyLocalMutationsResponse>;
450
+ requestEnsurePersistedIndex: (collectionId: string, signature: string, spec: PersistedIndexSpec, scopedAdapter?: HydrationPersistenceAdapter, localEnsureCompleted?: boolean, cacheGenerationClaimId?: string) => Promise<void>;
451
+ requestApplyLocalMutations?: (collectionId: string, mutations: Array<PersistedMutationEnvelope>, cacheGenerationClaimId?: string) => Promise<ApplyLocalMutationsResponse>;
405
452
  /**
406
453
  * Applies a committed transaction through the supplied adapter when present.
407
454
  * Wrappers must forward this leader-local loan: scheduling it again can wait
@@ -412,7 +459,7 @@ export interface PersistedCollectionCoordinator {
412
459
  /** Available only when the elected adapter can certify the durable outcome. */
413
460
  reconcileCommittedTx?: (collectionId: string, tx: PersistedTx, anchor: CommittedTxAnchor, scopedAdapter?: HydrationPersistenceAdapter) => Promise<ReconcileCommittedTxResponse>;
414
461
  /** The scoped adapter is leader-local and is never serialized to a follower. */
415
- pullSince?: (collectionId: string, fromRowVersion: number, scopedAdapter?: HydrationPersistenceAdapter) => Promise<PullSinceResponse>;
462
+ pullSince?: (collectionId: string, fromRowVersion: number, scopedAdapter?: HydrationPersistenceAdapter, cacheGenerationClaimId?: string) => Promise<PullSinceResponse>;
416
463
  }
417
464
  export interface PersistedCollectionPersistence {
418
465
  adapter: PersistenceAdapter;
@@ -37,6 +37,7 @@ function visitLoadSubsetOptions(options, validateOnly) {
37
37
  `limit`,
38
38
  `cursor`,
39
39
  `offset`,
40
+ `refetch`,
40
41
  `signal`,
41
42
  `subscription`
42
43
  ]);
@@ -57,6 +58,7 @@ function visitLoadSubsetOptions(options, validateOnly) {
57
58
  const limit = readDataProperty(options, `limit`, `options.limit`);
58
59
  const cursor = readDataProperty(options, `cursor`, `options.cursor`);
59
60
  const offset = readDataProperty(options, `offset`, `options.offset`);
61
+ const refetch = readDataProperty(options, `refetch`, `options.refetch`);
60
62
  if (where.present && where.value !== void 0) {
61
63
  const result = projectExpression(where.value, `options.where`, state);
62
64
  if (!state.validateOnly) projected.where = result;
@@ -77,6 +79,15 @@ function visitLoadSubsetOptions(options, validateOnly) {
77
79
  const result = projectNumber(offset.value, `options.offset`);
78
80
  if (!state.validateOnly) projected.offset = result;
79
81
  }
82
+ if (refetch.present && refetch.value !== void 0) {
83
+ if (typeof refetch.value !== `boolean`) {
84
+ throw new RemoteSubsetWireValueError(
85
+ `options.refetch`,
86
+ `expected boolean`
87
+ );
88
+ }
89
+ if (!state.validateOnly) projected.refetch = refetch.value;
90
+ }
80
91
  return projected;
81
92
  }
82
93
  function toProcessLocalLoadSubsetOptions(options, transported = toTransportedLoadSubsetOptions(options)) {
@@ -1 +1 @@
1
- {"version":3,"file":"remote-subset-wire.cjs","sources":["../../src/remote-subset-wire.ts"],"sourcesContent":["import { IR } from '@tanstack/db'\nimport type { LoadSubsetOptions } from '@tanstack/db'\n\nexport type RemoteSubsetWirePrimitive =\n undefined | null | boolean | string | number | bigint\n\nexport type RemoteSubsetWireTypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array\n | BigInt64Array\n | BigUint64Array\n\nexport type RemoteSubsetWireRecord = {\n [key: string]: RemoteSubsetWireValue\n}\n\n/** Values whose complete semantics survive a coordinator transport boundary. */\nexport type RemoteSubsetWireValue =\n | RemoteSubsetWirePrimitive\n | Date\n | RegExp\n | ArrayBuffer\n | DataView\n | RemoteSubsetWireTypedArray\n | Array<RemoteSubsetWireValue>\n | Map<RemoteSubsetWireValue, RemoteSubsetWireValue>\n | Set<RemoteSubsetWireValue>\n | RemoteSubsetWireRecord\n\nexport type RemoteSubsetWireExpression =\n | { type: `ref`; path: Array<string>; sourceAlias?: string }\n | { type: `val`; value: RemoteSubsetWireValue }\n | {\n type: `func`\n name: string\n args: Array<RemoteSubsetWireExpression>\n }\n\nexport type RemoteSubsetWireCompareOptions = {\n direction: `asc` | `desc`\n nulls: `first` | `last`\n} & (\n | { stringSort?: `lexical` }\n | {\n stringSort?: `locale`\n locale?: string\n localeOptions?: RemoteSubsetWireRecord\n }\n)\n\nexport type RemoteSubsetWireOrderByClause = {\n expression: RemoteSubsetWireExpression\n compareOptions: RemoteSubsetWireCompareOptions\n}\n\nexport type RemoteSubsetWireCursor = {\n whereFrom: RemoteSubsetWireExpression\n whereCurrent: RemoteSubsetWireExpression\n lastKey?: string | number\n}\n\n/** The complete data portion transported by a remote-subset request. */\nexport type TransportedLoadSubsetOptions = {\n where?: RemoteSubsetWireExpression\n orderBy?: Array<RemoteSubsetWireOrderByClause>\n limit?: number\n cursor?: RemoteSubsetWireCursor\n offset?: number\n}\n\nexport class RemoteSubsetWireValueError extends TypeError {\n override readonly name = `RemoteSubsetWireValueError`\n\n constructor(\n readonly path: string,\n reason: string,\n ) {\n super(`Unsupported remote subset wire value at ${path}: ${reason}`)\n }\n}\n\ntype ProjectionState = {\n validateOnly: boolean\n expressions: WeakMap<object, RemoteSubsetWireExpression>\n expressionArrays: WeakMap<object, Array<RemoteSubsetWireExpression>>\n stringArrays: WeakMap<object, Array<string>>\n orderByArrays: WeakMap<object, Array<RemoteSubsetWireOrderByClause>>\n orderByClauses: WeakMap<object, RemoteSubsetWireOrderByClause>\n compareOptions: WeakMap<object, RemoteSubsetWireCompareOptions>\n cursors: WeakMap<object, RemoteSubsetWireCursor>\n wireValues: WeakMap<object, RemoteSubsetWireValue>\n}\n\ntype DataProperty = {\n present: boolean\n value?: unknown\n}\n\ntype TypedArrayConstructor = {\n readonly prototype: RemoteSubsetWireTypedArray\n new (\n buffer: ArrayBuffer,\n byteOffset?: number,\n length?: number,\n ): RemoteSubsetWireTypedArray\n}\n\nconst typedArrayConstructors: ReadonlyArray<TypedArrayConstructor> = [\n Int8Array,\n Uint8Array,\n Uint8ClampedArray,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n BigInt64Array,\n BigUint64Array,\n]\n\nconst NativeDate = Date\nconst identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\n/**\n * Projects one live subset request into the exact coordinator wire domain.\n * Validation happens before callers choose a local-leader or transported path.\n */\nexport function toTransportedLoadSubsetOptions(\n options: LoadSubsetOptions,\n): TransportedLoadSubsetOptions {\n return visitLoadSubsetOptions(options, false)\n}\n\n/** Checks wire admission without constructing a detached request snapshot. */\nexport function validateRemoteSubsetOptions(options: LoadSubsetOptions): void {\n visitLoadSubsetOptions(options, true)\n}\n\n// Both modes run the same admission checks. Validation retains input nodes only\n// as cycle markers; it never writes to them or returns them to a caller.\nfunction visitLoadSubsetOptions(\n options: LoadSubsetOptions,\n validateOnly: boolean,\n): TransportedLoadSubsetOptions {\n assertPlainContainer(options, `options`)\n assertAllowedProperties(options, `options`, [\n `where`,\n `orderBy`,\n `limit`,\n `cursor`,\n `offset`,\n `signal`,\n `subscription`,\n ])\n\n const state: ProjectionState = {\n validateOnly,\n expressions: new WeakMap(),\n expressionArrays: new WeakMap(),\n stringArrays: new WeakMap(),\n orderByArrays: new WeakMap(),\n orderByClauses: new WeakMap(),\n compareOptions: new WeakMap(),\n cursors: new WeakMap(),\n wireValues: new WeakMap(),\n }\n const projected: TransportedLoadSubsetOptions = validateOnly\n ? (options as TransportedLoadSubsetOptions)\n : {}\n const where = readDataProperty(options, `where`, `options.where`)\n const orderBy = readDataProperty(options, `orderBy`, `options.orderBy`)\n const limit = readDataProperty(options, `limit`, `options.limit`)\n const cursor = readDataProperty(options, `cursor`, `options.cursor`)\n const offset = readDataProperty(options, `offset`, `options.offset`)\n\n if (where.present && where.value !== undefined) {\n const result = projectExpression(where.value, `options.where`, state)\n if (!state.validateOnly) projected.where = result\n }\n if (orderBy.present && orderBy.value !== undefined) {\n const result = projectOrderBy(orderBy.value, `options.orderBy`, state)\n if (!state.validateOnly) projected.orderBy = result\n }\n if (limit.present && limit.value !== undefined) {\n const result = projectNumber(limit.value, `options.limit`)\n if (!state.validateOnly) projected.limit = result\n }\n if (cursor.present && cursor.value !== undefined) {\n const result = projectCursor(cursor.value, `options.cursor`, state)\n if (!state.validateOnly) projected.cursor = result\n }\n if (offset.present && offset.value !== undefined) {\n const result = projectNumber(offset.value, `options.offset`)\n if (!state.validateOnly) projected.offset = result\n }\n\n return projected\n}\n\n/** Adds live lifecycle references only to an already validated local request. */\nexport function toProcessLocalLoadSubsetOptions(\n options: LoadSubsetOptions,\n transported = toTransportedLoadSubsetOptions(options),\n): TransportedLoadSubsetOptions &\n Pick<LoadSubsetOptions, `signal` | `subscription`> {\n const projected = {\n ...transported,\n } as TransportedLoadSubsetOptions &\n Pick<LoadSubsetOptions, `signal` | `subscription`>\n const signal = readDataProperty(options, `signal`, `options.signal`)\n const subscription = readDataProperty(\n options,\n `subscription`,\n `options.subscription`,\n )\n\n if (signal.present) {\n projected.signal = signal.value as LoadSubsetOptions[`signal`]\n }\n if (subscription.present) {\n projected.subscription =\n subscription.value as LoadSubsetOptions[`subscription`]\n }\n\n return projected\n}\n\nfunction projectExpression(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireExpression {\n const object = requireObject(value, path)\n const existing = state.expressions.get(object)\n if (existing) return existing\n\n const type = readDataProperty(object, `type`, `${path}.type`)\n if (!type.present || typeof type.value !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}.type`, describe(type.value))\n }\n\n switch (type.value) {\n case `ref`: {\n assertExpressionPrototype(object, path, IR.PropRef.prototype)\n assertAllowedProperties(object, path, [`type`, `path`, `sourceAlias`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `ref` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `ref` }>)\n : { type: `ref`, path: [] }\n state.expressions.set(object, projected)\n const sourcePath = readRequiredDataProperty(\n object,\n `path`,\n `${path}.path`,\n )\n const result = projectStringArray(sourcePath, `${path}.path`, state)\n if (!state.validateOnly) projected.path = result\n const sourceAlias = readDataProperty(\n object,\n `sourceAlias`,\n `${path}.sourceAlias`,\n )\n if (sourceAlias.present) {\n if (\n typeof sourceAlias.value !== `string` ||\n result[0] !== sourceAlias.value\n ) {\n throw new RemoteSubsetWireValueError(\n `${path}.sourceAlias`,\n `source alias must match the first path segment`,\n )\n }\n if (!state.validateOnly) projected.sourceAlias = sourceAlias.value\n }\n return projected\n }\n case `val`: {\n assertExpressionPrototype(object, path, IR.Value.prototype)\n assertAllowedProperties(object, path, [`type`, `value`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `val` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `val` }>)\n : { type: `val`, value: undefined }\n state.expressions.set(object, projected)\n const sourceValue = readRequiredDataProperty(\n object,\n `value`,\n `${path}.value`,\n )\n const result = projectWireValue(sourceValue, `${path}.value`, state)\n if (!state.validateOnly) projected.value = result\n return projected\n }\n case `func`: {\n assertExpressionPrototype(object, path, IR.Func.prototype)\n assertAllowedProperties(object, path, [`type`, `name`, `args`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `func` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `func` }>)\n : { type: `func`, name: ``, args: [] }\n state.expressions.set(object, projected)\n const name = readRequiredDataProperty(object, `name`, `${path}.name`)\n if (typeof name !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}.name`, describe(name))\n }\n if (!state.validateOnly) projected.name = name\n const args = readRequiredDataProperty(object, `args`, `${path}.args`)\n const result = projectExpressionArray(args, `${path}.args`, state)\n if (!state.validateOnly) projected.args = result\n return projected\n }\n default:\n throw new RemoteSubsetWireValueError(`${path}.type`, String(type.value))\n }\n}\n\nfunction projectExpressionArray(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireExpression> {\n const array = requireArray(value, path)\n const existing = state.expressionArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<RemoteSubsetWireExpression>)\n : new Array<RemoteSubsetWireExpression>(array.length)\n state.expressionArrays.set(array, projected)\n for (let index = 0; index < array.length; index++) {\n if (!(index in array)) {\n throw new RemoteSubsetWireValueError(\n `${path}[${index}]`,\n `missing expression`,\n )\n }\n const result = projectExpression(array[index], `${path}[${index}]`, state)\n if (!state.validateOnly) projected[index] = result\n }\n return projected\n}\n\nfunction projectStringArray(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<string> {\n const array = requireArray(value, path)\n const existing = state.stringArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<string>)\n : new Array<string>(array.length)\n state.stringArrays.set(array, projected)\n for (let index = 0; index < array.length; index++) {\n const entry = array[index]\n if (!(index in array) || typeof entry !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}[${index}]`, describe(entry))\n }\n if (!state.validateOnly) projected[index] = entry\n }\n return projected\n}\n\nfunction projectOrderBy(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireOrderByClause> {\n const array = requireArray(value, path)\n const existing = state.orderByArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<RemoteSubsetWireOrderByClause>)\n : new Array<RemoteSubsetWireOrderByClause>(array.length)\n state.orderByArrays.set(array, projected)\n\n for (let index = 0; index < array.length; index++) {\n const clausePath = `${path}[${index}]`\n const clause = requirePlainRecord(array[index], clausePath)\n const existingClause = state.orderByClauses.get(clause)\n if (existingClause) {\n if (!state.validateOnly) projected[index] = existingClause\n continue\n }\n assertAllowedProperties(clause, clausePath, [\n `expression`,\n `compareOptions`,\n ])\n const projectedClause = state.validateOnly\n ? (clause as RemoteSubsetWireOrderByClause)\n : {\n expression: undefined as unknown as RemoteSubsetWireExpression,\n compareOptions:\n undefined as unknown as RemoteSubsetWireCompareOptions,\n }\n if (!state.validateOnly) projected[index] = projectedClause\n state.orderByClauses.set(clause, projectedClause)\n const expression = projectExpression(\n readRequiredDataProperty(\n clause,\n `expression`,\n `${clausePath}.expression`,\n ),\n `${clausePath}.expression`,\n state,\n )\n const compareOptions = projectCompareOptions(\n readRequiredDataProperty(\n clause,\n `compareOptions`,\n `${clausePath}.compareOptions`,\n ),\n `${clausePath}.compareOptions`,\n state,\n )\n if (!state.validateOnly) {\n projectedClause.expression = expression\n projectedClause.compareOptions = compareOptions\n }\n }\n return projected\n}\n\nfunction projectCompareOptions(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireCompareOptions {\n const source = requirePlainRecord(value, path)\n const existing = state.compareOptions.get(source)\n if (existing) return existing\n assertAllowedProperties(source, path, [\n `direction`,\n `nulls`,\n `stringSort`,\n `locale`,\n `localeOptions`,\n ])\n const projected: {\n direction?: `asc` | `desc`\n nulls?: `first` | `last`\n stringSort?: `lexical` | `locale`\n locale?: string\n localeOptions?: RemoteSubsetWireRecord\n } = state.validateOnly ? source : {}\n\n const direction = readRequiredDataProperty(\n source,\n `direction`,\n `${path}.direction`,\n )\n if (direction !== `asc` && direction !== `desc`) {\n throw new RemoteSubsetWireValueError(\n `${path}.direction`,\n describe(direction),\n )\n }\n if (!state.validateOnly) projected.direction = direction\n\n const nulls = readRequiredDataProperty(source, `nulls`, `${path}.nulls`)\n if (nulls !== `first` && nulls !== `last`) {\n throw new RemoteSubsetWireValueError(`${path}.nulls`, describe(nulls))\n }\n if (!state.validateOnly) projected.nulls = nulls\n\n const stringSort = readDataProperty(\n source,\n `stringSort`,\n `${path}.stringSort`,\n )\n if (stringSort.present && stringSort.value !== undefined) {\n if (stringSort.value !== `lexical` && stringSort.value !== `locale`) {\n throw new RemoteSubsetWireValueError(\n `${path}.stringSort`,\n describe(stringSort.value),\n )\n }\n if (!state.validateOnly) projected.stringSort = stringSort.value\n }\n if (projected.stringSort !== `lexical`) {\n const locale = readDataProperty(source, `locale`, `${path}.locale`)\n if (locale.present && locale.value !== undefined) {\n if (typeof locale.value !== `string`) {\n throw new RemoteSubsetWireValueError(\n `${path}.locale`,\n describe(locale.value),\n )\n }\n if (!state.validateOnly) projected.locale = locale.value\n }\n const localeOptions = readDataProperty(\n source,\n `localeOptions`,\n `${path}.localeOptions`,\n )\n if (localeOptions.present && localeOptions.value !== undefined) {\n const result = projectWireRecord(\n localeOptions.value,\n `${path}.localeOptions`,\n state,\n )\n if (!state.validateOnly) projected.localeOptions = result\n }\n }\n const result = projected as RemoteSubsetWireCompareOptions\n state.compareOptions.set(source, result)\n return result\n}\n\nfunction projectCursor(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireCursor {\n const source = requirePlainRecord(value, path)\n const existing = state.cursors.get(source)\n if (existing) return existing\n assertAllowedProperties(source, path, [\n `whereFrom`,\n `whereCurrent`,\n `lastKey`,\n ])\n const projected: RemoteSubsetWireCursor = state.validateOnly\n ? (source as RemoteSubsetWireCursor)\n : {\n whereFrom: undefined as unknown as RemoteSubsetWireExpression,\n whereCurrent: undefined as unknown as RemoteSubsetWireExpression,\n }\n state.cursors.set(source, projected)\n const whereFrom = projectExpression(\n readRequiredDataProperty(source, `whereFrom`, `${path}.whereFrom`),\n `${path}.whereFrom`,\n state,\n )\n const whereCurrent = projectExpression(\n readRequiredDataProperty(source, `whereCurrent`, `${path}.whereCurrent`),\n `${path}.whereCurrent`,\n state,\n )\n if (!state.validateOnly) {\n projected.whereFrom = whereFrom\n projected.whereCurrent = whereCurrent\n }\n const lastKey = readDataProperty(source, `lastKey`, `${path}.lastKey`)\n if (lastKey.present && lastKey.value !== undefined) {\n if (\n typeof lastKey.value !== `string` &&\n typeof lastKey.value !== `number`\n ) {\n throw new RemoteSubsetWireValueError(\n `${path}.lastKey`,\n describe(lastKey.value),\n )\n }\n if (!state.validateOnly) projected.lastKey = lastKey.value\n }\n return projected\n}\n\nfunction projectWireValue(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireValue {\n if (\n value === undefined ||\n value === null ||\n typeof value === `boolean` ||\n typeof value === `string` ||\n typeof value === `number` ||\n typeof value === `bigint`\n ) {\n return value\n }\n if (typeof value !== `object`) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n\n const existing = state.wireValues.get(value)\n if (existing) return existing\n\n if (\n typeof SharedArrayBuffer !== `undefined` &&\n value instanceof SharedArrayBuffer\n ) {\n throw new RemoteSubsetWireValueError(path, `SharedArrayBuffer`)\n }\n if (value instanceof NativeDate) {\n assertExactPrototype(value, NativeDate.prototype, path)\n assertNoOwnProperties(value, path)\n const time = value.getTime()\n const projected = state.validateOnly ? value : new NativeDate(time)\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof RegExp) {\n assertExactPrototype(value, RegExp.prototype, path)\n assertRegExpShape(value, path)\n const { source, flags } = value\n const projected = state.validateOnly ? value : new RegExp(source, flags)\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof ArrayBuffer) {\n assertExactPrototype(value, ArrayBuffer.prototype, path)\n assertNoOwnProperties(value, path)\n assertFixedArrayBuffer(value, path)\n let projected: ArrayBuffer\n try {\n if (state.validateOnly) {\n // A zero-length view checks detachment without copying the backing bytes.\n new Uint8Array(value, 0, 0)\n projected = value\n } else {\n projected = value.slice(0)\n }\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached ArrayBuffer`)\n }\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof DataView) {\n assertExactPrototype(value, DataView.prototype, path)\n assertNoOwnProperties(value, path)\n let byteOffset: number\n let byteLength: number\n let buffer: ArrayBufferLike\n try {\n byteOffset = value.byteOffset\n byteLength = value.byteLength\n buffer = value.buffer\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached DataView`)\n }\n const projectedBuffer = projectWireValue(buffer, path, state)\n if (!(projectedBuffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared DataView buffer`)\n }\n const projected = state.validateOnly\n ? value\n : new DataView(projectedBuffer, byteOffset, byteLength)\n state.wireValues.set(value, projected)\n return projected\n }\n\n const typedArrayConstructor = getTypedArrayConstructor(value)\n if (typedArrayConstructor) {\n const typedArray = value as RemoteSubsetWireTypedArray\n assertTypedArrayShape(typedArray, path)\n let byteOffset: number\n let length: number\n let buffer: ArrayBufferLike\n try {\n byteOffset = typedArray.byteOffset\n length = typedArray.length\n buffer = typedArray.buffer\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached typed array`)\n }\n if (!(buffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared typed-array buffer`)\n }\n const projectedBuffer = projectWireValue(buffer, path, state)\n if (!(projectedBuffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared typed-array buffer`)\n }\n let projected: RemoteSubsetWireTypedArray\n try {\n projected = state.validateOnly\n ? typedArray\n : new typedArrayConstructor(projectedBuffer, byteOffset, length)\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached typed array`)\n }\n state.wireValues.set(value, projected)\n return projected\n }\n if (ArrayBuffer.isView(value)) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n if (Array.isArray(value)) return projectWireArray(value, path, state)\n if (value instanceof Map) return projectWireMap(value, path, state)\n if (value instanceof Set) return projectWireSet(value, path, state)\n return projectWireRecord(value, path, state)\n}\n\nfunction projectWireArray(\n value: Array<unknown>,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireValue> {\n assertArrayShape(value, path)\n const projected = state.validateOnly\n ? (value as Array<RemoteSubsetWireValue>)\n : new Array<RemoteSubsetWireValue>(value.length)\n state.wireValues.set(value, projected)\n for (let index = 0; index < value.length; index++) {\n if (index in value) {\n const result = projectWireValue(value[index], `${path}[${index}]`, state)\n if (!state.validateOnly) projected[index] = result\n }\n }\n return projected\n}\n\nfunction projectWireMap(\n value: Map<unknown, unknown>,\n path: string,\n state: ProjectionState,\n): Map<RemoteSubsetWireValue, RemoteSubsetWireValue> {\n assertExactPrototype(value, Map.prototype, path)\n assertNoOwnProperties(value, path)\n const projected = state.validateOnly\n ? (value as Map<RemoteSubsetWireValue, RemoteSubsetWireValue>)\n : new Map<RemoteSubsetWireValue, RemoteSubsetWireValue>()\n state.wireValues.set(value, projected)\n let index = 0\n for (const [key, entry] of value) {\n const projectedKey = projectWireValue(\n key,\n `${path}.entries[${index}].key`,\n state,\n )\n const projectedValue = projectWireValue(\n entry,\n `${path}.entries[${index}].value`,\n state,\n )\n if (!state.validateOnly) projected.set(projectedKey, projectedValue)\n index++\n }\n return projected\n}\n\nfunction projectWireSet(\n value: Set<unknown>,\n path: string,\n state: ProjectionState,\n): Set<RemoteSubsetWireValue> {\n assertExactPrototype(value, Set.prototype, path)\n assertNoOwnProperties(value, path)\n const projected = state.validateOnly\n ? (value as Set<RemoteSubsetWireValue>)\n : new Set<RemoteSubsetWireValue>()\n state.wireValues.set(value, projected)\n let index = 0\n for (const entry of value) {\n const result = projectWireValue(entry, `${path}.values[${index}]`, state)\n if (!state.validateOnly) projected.add(result)\n index++\n }\n return projected\n}\n\nfunction projectWireRecord(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireRecord {\n const source = requirePlainRecord(value, path)\n const existing = state.wireValues.get(source)\n if (existing) return existing as RemoteSubsetWireRecord\n const projected: RemoteSubsetWireRecord = state.validateOnly\n ? (source as RemoteSubsetWireRecord)\n : {}\n state.wireValues.set(source, projected)\n\n for (const key of ownKeys(source, path)) {\n const childPath = propertyPath(path, key)\n if (typeof key === `symbol`) {\n throw new RemoteSubsetWireValueError(childPath, `symbol property key`)\n }\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (!descriptor || !descriptor.enumerable || !(`value` in descriptor)) {\n throw new RemoteSubsetWireValueError(childPath, `non-data property`)\n }\n const result = projectWireValue(descriptor.value, childPath, state)\n if (!state.validateOnly) {\n Object.defineProperty(projected, key, {\n value: result,\n enumerable: true,\n writable: true,\n configurable: true,\n })\n }\n }\n return projected\n}\n\nfunction projectNumber(value: unknown, path: string): number {\n if (typeof value !== `number` || !Number.isSafeInteger(value) || value < 0) {\n throw new RemoteSubsetWireValueError(path, `non-negative safe integer`)\n }\n return value\n}\n\nfunction readRequiredDataProperty(\n value: object,\n key: string,\n path: string,\n): unknown {\n const property = readDataProperty(value, key, path)\n if (!property.present) {\n throw new RemoteSubsetWireValueError(path, `missing property`)\n }\n return property.value\n}\n\nfunction readDataProperty(\n value: object,\n key: string,\n path: string,\n): DataProperty {\n let descriptor: PropertyDescriptor | undefined\n try {\n descriptor = Object.getOwnPropertyDescriptor(value, key)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable property`)\n }\n if (!descriptor) return { present: false }\n if (!descriptor.enumerable || !(`value` in descriptor)) {\n throw new RemoteSubsetWireValueError(path, `non-data property`)\n }\n return { present: true, value: descriptor.value }\n}\n\nfunction assertAllowedProperties(\n value: object,\n path: string,\n allowed: ReadonlyArray<string>,\n): void {\n const allowedSet = new Set(allowed)\n for (const key of ownKeys(value, path)) {\n if (typeof key === `symbol` || !allowedSet.has(key)) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n readDataProperty(value, key, propertyPath(path, key))\n }\n}\n\nfunction assertPlainContainer(value: object, path: string): void {\n assertExactPrototype(value, Object.prototype, path)\n}\n\nfunction assertExpressionPrototype(\n value: object,\n path: string,\n expressionPrototype: object,\n): void {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable prototype`)\n }\n if (prototype !== Object.prototype && prototype !== expressionPrototype) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n}\n\nfunction assertExactPrototype(\n value: object,\n expected: object,\n path: string,\n): void {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable prototype`)\n }\n if (prototype !== expected) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n}\n\nfunction assertNoOwnProperties(value: object, path: string): void {\n const keys = ownKeys(value, path)\n if (keys.length > 0) {\n throw new RemoteSubsetWireValueError(\n propertyPath(path, keys[0]!),\n `property`,\n )\n }\n}\n\nfunction assertFixedArrayBuffer(value: ArrayBuffer, path: string): void {\n if ((value as ArrayBuffer & { readonly resizable?: boolean }).resizable) {\n throw new RemoteSubsetWireValueError(path, `resizable ArrayBuffer`)\n }\n}\n\nfunction assertRegExpShape(value: RegExp, path: string): void {\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (key !== `lastIndex`) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, `lastIndex`)\n if (!descriptor || !(`value` in descriptor) || descriptor.value !== 0) {\n throw new RemoteSubsetWireValueError(\n `${path}.lastIndex`,\n `RegExp lastIndex must be 0`,\n )\n }\n}\n\nfunction assertTypedArrayShape(\n value: RemoteSubsetWireTypedArray,\n path: string,\n): void {\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (typeof key !== `string` || !isCanonicalArrayIndex(key, value.length)) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n }\n}\n\nfunction assertArrayShape(value: Array<unknown>, path: string): void {\n assertExactPrototype(value, Array.prototype, path)\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (\n key !== `length` &&\n (typeof key !== `string` || !isCanonicalArrayIndex(key, value.length))\n ) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n if (key !== `length`) {\n readDataProperty(value, key, propertyPath(path, key))\n }\n }\n}\n\nfunction isCanonicalArrayIndex(key: string, length: number): boolean {\n if (!/^(0|[1-9][0-9]*)$/.test(key)) return false\n const index = Number(key)\n return Number.isSafeInteger(index) && index >= 0 && index < length\n}\n\nfunction getTypedArrayConstructor(\n value: object,\n): TypedArrayConstructor | undefined {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n return undefined\n }\n return typedArrayConstructors.find(\n (constructor) => prototype === constructor.prototype,\n )\n}\n\nfunction requireArray(value: unknown, path: string): Array<unknown> {\n if (!Array.isArray(value)) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n return value\n}\n\nfunction requireObject(value: unknown, path: string): object {\n if (value === null || typeof value !== `object`) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n return value\n}\n\nfunction requirePlainRecord(\n value: unknown,\n path: string,\n): Record<string, unknown> {\n const object = requireObject(value, path)\n assertExactPrototype(object, Object.prototype, path)\n return object as Record<string, unknown>\n}\n\nfunction ownKeys(value: object, path: string): Array<string | symbol> {\n try {\n return Reflect.ownKeys(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable properties`)\n }\n}\n\nfunction propertyPath(path: string, key: string | symbol): string {\n if (typeof key === `symbol`) return `${path}[${String(key)}]`\n return identifierPattern.test(key)\n ? `${path}.${key}`\n : `${path}[${JSON.stringify(key)}]`\n}\n\nfunction describe(value: unknown): string {\n if (value === null) return `null`\n if (typeof value !== `object`) return typeof value\n return `object`\n}\n"],"names":["IR","result"],"mappings":";;;AA6EO,MAAM,mCAAmC,UAAU;AAAA,EAGxD,YACW,MACT,QACA;AAC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BAAkB,KAAK,GAAG,IAC7B,GAAG,IAAI,IAAI,GAAG,KACd,GAAG,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC;AACpC;AAEA,SAAS,SAAS,OAAwB;AACxC,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,OAAO,UAAU,SAAU,QAAO,OAAO;AAC7C,SAAO;AACT;;;;;"}
1
+ {"version":3,"file":"remote-subset-wire.cjs","sources":["../../src/remote-subset-wire.ts"],"sourcesContent":["import { IR } from '@tanstack/db'\nimport type { LoadSubsetOptions } from '@tanstack/db'\n\nexport type RemoteSubsetWirePrimitive =\n undefined | null | boolean | string | number | bigint\n\nexport type RemoteSubsetWireTypedArray =\n | Int8Array\n | Uint8Array\n | Uint8ClampedArray\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Float32Array\n | Float64Array\n | BigInt64Array\n | BigUint64Array\n\nexport type RemoteSubsetWireRecord = {\n [key: string]: RemoteSubsetWireValue\n}\n\n/** Values whose complete semantics survive a coordinator transport boundary. */\nexport type RemoteSubsetWireValue =\n | RemoteSubsetWirePrimitive\n | Date\n | RegExp\n | ArrayBuffer\n | DataView\n | RemoteSubsetWireTypedArray\n | Array<RemoteSubsetWireValue>\n | Map<RemoteSubsetWireValue, RemoteSubsetWireValue>\n | Set<RemoteSubsetWireValue>\n | RemoteSubsetWireRecord\n\nexport type RemoteSubsetWireExpression =\n | { type: `ref`; path: Array<string>; sourceAlias?: string }\n | { type: `val`; value: RemoteSubsetWireValue }\n | {\n type: `func`\n name: string\n args: Array<RemoteSubsetWireExpression>\n }\n\nexport type RemoteSubsetWireCompareOptions = {\n direction: `asc` | `desc`\n nulls: `first` | `last`\n} & (\n | { stringSort?: `lexical` }\n | {\n stringSort?: `locale`\n locale?: string\n localeOptions?: RemoteSubsetWireRecord\n }\n)\n\nexport type RemoteSubsetWireOrderByClause = {\n expression: RemoteSubsetWireExpression\n compareOptions: RemoteSubsetWireCompareOptions\n}\n\nexport type RemoteSubsetWireCursor = {\n whereFrom: RemoteSubsetWireExpression\n whereCurrent: RemoteSubsetWireExpression\n lastKey?: string | number\n}\n\n/** The complete data portion transported by a remote-subset request. */\nexport type TransportedLoadSubsetOptions = {\n where?: RemoteSubsetWireExpression\n orderBy?: Array<RemoteSubsetWireOrderByClause>\n limit?: number\n cursor?: RemoteSubsetWireCursor\n offset?: number\n refetch?: boolean\n}\n\nexport class RemoteSubsetWireValueError extends TypeError {\n override readonly name = `RemoteSubsetWireValueError`\n\n constructor(\n readonly path: string,\n reason: string,\n ) {\n super(`Unsupported remote subset wire value at ${path}: ${reason}`)\n }\n}\n\ntype ProjectionState = {\n validateOnly: boolean\n expressions: WeakMap<object, RemoteSubsetWireExpression>\n expressionArrays: WeakMap<object, Array<RemoteSubsetWireExpression>>\n stringArrays: WeakMap<object, Array<string>>\n orderByArrays: WeakMap<object, Array<RemoteSubsetWireOrderByClause>>\n orderByClauses: WeakMap<object, RemoteSubsetWireOrderByClause>\n compareOptions: WeakMap<object, RemoteSubsetWireCompareOptions>\n cursors: WeakMap<object, RemoteSubsetWireCursor>\n wireValues: WeakMap<object, RemoteSubsetWireValue>\n}\n\ntype DataProperty = {\n present: boolean\n value?: unknown\n}\n\ntype TypedArrayConstructor = {\n readonly prototype: RemoteSubsetWireTypedArray\n new (\n buffer: ArrayBuffer,\n byteOffset?: number,\n length?: number,\n ): RemoteSubsetWireTypedArray\n}\n\nconst typedArrayConstructors: ReadonlyArray<TypedArrayConstructor> = [\n Int8Array,\n Uint8Array,\n Uint8ClampedArray,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n BigInt64Array,\n BigUint64Array,\n]\n\nconst NativeDate = Date\nconst identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\n/**\n * Projects one live subset request into the exact coordinator wire domain.\n * Validation happens before callers choose a local-leader or transported path.\n */\nexport function toTransportedLoadSubsetOptions(\n options: LoadSubsetOptions,\n): TransportedLoadSubsetOptions {\n return visitLoadSubsetOptions(options, false)\n}\n\n/** Checks wire admission without constructing a detached request snapshot. */\nexport function validateRemoteSubsetOptions(options: LoadSubsetOptions): void {\n visitLoadSubsetOptions(options, true)\n}\n\n// Both modes run the same admission checks. Validation retains input nodes only\n// as cycle markers; it never writes to them or returns them to a caller.\nfunction visitLoadSubsetOptions(\n options: LoadSubsetOptions,\n validateOnly: boolean,\n): TransportedLoadSubsetOptions {\n assertPlainContainer(options, `options`)\n assertAllowedProperties(options, `options`, [\n `where`,\n `orderBy`,\n `limit`,\n `cursor`,\n `offset`,\n `refetch`,\n `signal`,\n `subscription`,\n ])\n\n const state: ProjectionState = {\n validateOnly,\n expressions: new WeakMap(),\n expressionArrays: new WeakMap(),\n stringArrays: new WeakMap(),\n orderByArrays: new WeakMap(),\n orderByClauses: new WeakMap(),\n compareOptions: new WeakMap(),\n cursors: new WeakMap(),\n wireValues: new WeakMap(),\n }\n const projected: TransportedLoadSubsetOptions = validateOnly\n ? (options as TransportedLoadSubsetOptions)\n : {}\n const where = readDataProperty(options, `where`, `options.where`)\n const orderBy = readDataProperty(options, `orderBy`, `options.orderBy`)\n const limit = readDataProperty(options, `limit`, `options.limit`)\n const cursor = readDataProperty(options, `cursor`, `options.cursor`)\n const offset = readDataProperty(options, `offset`, `options.offset`)\n const refetch = readDataProperty(options, `refetch`, `options.refetch`)\n\n if (where.present && where.value !== undefined) {\n const result = projectExpression(where.value, `options.where`, state)\n if (!state.validateOnly) projected.where = result\n }\n if (orderBy.present && orderBy.value !== undefined) {\n const result = projectOrderBy(orderBy.value, `options.orderBy`, state)\n if (!state.validateOnly) projected.orderBy = result\n }\n if (limit.present && limit.value !== undefined) {\n const result = projectNumber(limit.value, `options.limit`)\n if (!state.validateOnly) projected.limit = result\n }\n if (cursor.present && cursor.value !== undefined) {\n const result = projectCursor(cursor.value, `options.cursor`, state)\n if (!state.validateOnly) projected.cursor = result\n }\n if (offset.present && offset.value !== undefined) {\n const result = projectNumber(offset.value, `options.offset`)\n if (!state.validateOnly) projected.offset = result\n }\n if (refetch.present && refetch.value !== undefined) {\n if (typeof refetch.value !== `boolean`) {\n throw new RemoteSubsetWireValueError(\n `options.refetch`,\n `expected boolean`,\n )\n }\n if (!state.validateOnly) projected.refetch = refetch.value\n }\n\n return projected\n}\n\n/** Adds live lifecycle references only to an already validated local request. */\nexport function toProcessLocalLoadSubsetOptions(\n options: LoadSubsetOptions,\n transported = toTransportedLoadSubsetOptions(options),\n): TransportedLoadSubsetOptions &\n Pick<LoadSubsetOptions, `signal` | `subscription`> {\n const projected = {\n ...transported,\n } as TransportedLoadSubsetOptions &\n Pick<LoadSubsetOptions, `signal` | `subscription`>\n const signal = readDataProperty(options, `signal`, `options.signal`)\n const subscription = readDataProperty(\n options,\n `subscription`,\n `options.subscription`,\n )\n\n if (signal.present) {\n projected.signal = signal.value as LoadSubsetOptions[`signal`]\n }\n if (subscription.present) {\n projected.subscription =\n subscription.value as LoadSubsetOptions[`subscription`]\n }\n\n return projected\n}\n\nfunction projectExpression(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireExpression {\n const object = requireObject(value, path)\n const existing = state.expressions.get(object)\n if (existing) return existing\n\n const type = readDataProperty(object, `type`, `${path}.type`)\n if (!type.present || typeof type.value !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}.type`, describe(type.value))\n }\n\n switch (type.value) {\n case `ref`: {\n assertExpressionPrototype(object, path, IR.PropRef.prototype)\n assertAllowedProperties(object, path, [`type`, `path`, `sourceAlias`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `ref` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `ref` }>)\n : { type: `ref`, path: [] }\n state.expressions.set(object, projected)\n const sourcePath = readRequiredDataProperty(\n object,\n `path`,\n `${path}.path`,\n )\n const result = projectStringArray(sourcePath, `${path}.path`, state)\n if (!state.validateOnly) projected.path = result\n const sourceAlias = readDataProperty(\n object,\n `sourceAlias`,\n `${path}.sourceAlias`,\n )\n if (sourceAlias.present) {\n if (\n typeof sourceAlias.value !== `string` ||\n result[0] !== sourceAlias.value\n ) {\n throw new RemoteSubsetWireValueError(\n `${path}.sourceAlias`,\n `source alias must match the first path segment`,\n )\n }\n if (!state.validateOnly) projected.sourceAlias = sourceAlias.value\n }\n return projected\n }\n case `val`: {\n assertExpressionPrototype(object, path, IR.Value.prototype)\n assertAllowedProperties(object, path, [`type`, `value`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `val` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `val` }>)\n : { type: `val`, value: undefined }\n state.expressions.set(object, projected)\n const sourceValue = readRequiredDataProperty(\n object,\n `value`,\n `${path}.value`,\n )\n const result = projectWireValue(sourceValue, `${path}.value`, state)\n if (!state.validateOnly) projected.value = result\n return projected\n }\n case `func`: {\n assertExpressionPrototype(object, path, IR.Func.prototype)\n assertAllowedProperties(object, path, [`type`, `name`, `args`])\n const projected: Extract<RemoteSubsetWireExpression, { type: `func` }> =\n state.validateOnly\n ? (object as Extract<RemoteSubsetWireExpression, { type: `func` }>)\n : { type: `func`, name: ``, args: [] }\n state.expressions.set(object, projected)\n const name = readRequiredDataProperty(object, `name`, `${path}.name`)\n if (typeof name !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}.name`, describe(name))\n }\n if (!state.validateOnly) projected.name = name\n const args = readRequiredDataProperty(object, `args`, `${path}.args`)\n const result = projectExpressionArray(args, `${path}.args`, state)\n if (!state.validateOnly) projected.args = result\n return projected\n }\n default:\n throw new RemoteSubsetWireValueError(`${path}.type`, String(type.value))\n }\n}\n\nfunction projectExpressionArray(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireExpression> {\n const array = requireArray(value, path)\n const existing = state.expressionArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<RemoteSubsetWireExpression>)\n : new Array<RemoteSubsetWireExpression>(array.length)\n state.expressionArrays.set(array, projected)\n for (let index = 0; index < array.length; index++) {\n if (!(index in array)) {\n throw new RemoteSubsetWireValueError(\n `${path}[${index}]`,\n `missing expression`,\n )\n }\n const result = projectExpression(array[index], `${path}[${index}]`, state)\n if (!state.validateOnly) projected[index] = result\n }\n return projected\n}\n\nfunction projectStringArray(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<string> {\n const array = requireArray(value, path)\n const existing = state.stringArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<string>)\n : new Array<string>(array.length)\n state.stringArrays.set(array, projected)\n for (let index = 0; index < array.length; index++) {\n const entry = array[index]\n if (!(index in array) || typeof entry !== `string`) {\n throw new RemoteSubsetWireValueError(`${path}[${index}]`, describe(entry))\n }\n if (!state.validateOnly) projected[index] = entry\n }\n return projected\n}\n\nfunction projectOrderBy(\n value: unknown,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireOrderByClause> {\n const array = requireArray(value, path)\n const existing = state.orderByArrays.get(array)\n if (existing) return existing\n assertArrayShape(array, path)\n const projected = state.validateOnly\n ? (array as Array<RemoteSubsetWireOrderByClause>)\n : new Array<RemoteSubsetWireOrderByClause>(array.length)\n state.orderByArrays.set(array, projected)\n\n for (let index = 0; index < array.length; index++) {\n const clausePath = `${path}[${index}]`\n const clause = requirePlainRecord(array[index], clausePath)\n const existingClause = state.orderByClauses.get(clause)\n if (existingClause) {\n if (!state.validateOnly) projected[index] = existingClause\n continue\n }\n assertAllowedProperties(clause, clausePath, [\n `expression`,\n `compareOptions`,\n ])\n const projectedClause = state.validateOnly\n ? (clause as RemoteSubsetWireOrderByClause)\n : {\n expression: undefined as unknown as RemoteSubsetWireExpression,\n compareOptions:\n undefined as unknown as RemoteSubsetWireCompareOptions,\n }\n if (!state.validateOnly) projected[index] = projectedClause\n state.orderByClauses.set(clause, projectedClause)\n const expression = projectExpression(\n readRequiredDataProperty(\n clause,\n `expression`,\n `${clausePath}.expression`,\n ),\n `${clausePath}.expression`,\n state,\n )\n const compareOptions = projectCompareOptions(\n readRequiredDataProperty(\n clause,\n `compareOptions`,\n `${clausePath}.compareOptions`,\n ),\n `${clausePath}.compareOptions`,\n state,\n )\n if (!state.validateOnly) {\n projectedClause.expression = expression\n projectedClause.compareOptions = compareOptions\n }\n }\n return projected\n}\n\nfunction projectCompareOptions(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireCompareOptions {\n const source = requirePlainRecord(value, path)\n const existing = state.compareOptions.get(source)\n if (existing) return existing\n assertAllowedProperties(source, path, [\n `direction`,\n `nulls`,\n `stringSort`,\n `locale`,\n `localeOptions`,\n ])\n const projected: {\n direction?: `asc` | `desc`\n nulls?: `first` | `last`\n stringSort?: `lexical` | `locale`\n locale?: string\n localeOptions?: RemoteSubsetWireRecord\n } = state.validateOnly ? source : {}\n\n const direction = readRequiredDataProperty(\n source,\n `direction`,\n `${path}.direction`,\n )\n if (direction !== `asc` && direction !== `desc`) {\n throw new RemoteSubsetWireValueError(\n `${path}.direction`,\n describe(direction),\n )\n }\n if (!state.validateOnly) projected.direction = direction\n\n const nulls = readRequiredDataProperty(source, `nulls`, `${path}.nulls`)\n if (nulls !== `first` && nulls !== `last`) {\n throw new RemoteSubsetWireValueError(`${path}.nulls`, describe(nulls))\n }\n if (!state.validateOnly) projected.nulls = nulls\n\n const stringSort = readDataProperty(\n source,\n `stringSort`,\n `${path}.stringSort`,\n )\n if (stringSort.present && stringSort.value !== undefined) {\n if (stringSort.value !== `lexical` && stringSort.value !== `locale`) {\n throw new RemoteSubsetWireValueError(\n `${path}.stringSort`,\n describe(stringSort.value),\n )\n }\n if (!state.validateOnly) projected.stringSort = stringSort.value\n }\n if (projected.stringSort !== `lexical`) {\n const locale = readDataProperty(source, `locale`, `${path}.locale`)\n if (locale.present && locale.value !== undefined) {\n if (typeof locale.value !== `string`) {\n throw new RemoteSubsetWireValueError(\n `${path}.locale`,\n describe(locale.value),\n )\n }\n if (!state.validateOnly) projected.locale = locale.value\n }\n const localeOptions = readDataProperty(\n source,\n `localeOptions`,\n `${path}.localeOptions`,\n )\n if (localeOptions.present && localeOptions.value !== undefined) {\n const result = projectWireRecord(\n localeOptions.value,\n `${path}.localeOptions`,\n state,\n )\n if (!state.validateOnly) projected.localeOptions = result\n }\n }\n const result = projected as RemoteSubsetWireCompareOptions\n state.compareOptions.set(source, result)\n return result\n}\n\nfunction projectCursor(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireCursor {\n const source = requirePlainRecord(value, path)\n const existing = state.cursors.get(source)\n if (existing) return existing\n assertAllowedProperties(source, path, [\n `whereFrom`,\n `whereCurrent`,\n `lastKey`,\n ])\n const projected: RemoteSubsetWireCursor = state.validateOnly\n ? (source as RemoteSubsetWireCursor)\n : {\n whereFrom: undefined as unknown as RemoteSubsetWireExpression,\n whereCurrent: undefined as unknown as RemoteSubsetWireExpression,\n }\n state.cursors.set(source, projected)\n const whereFrom = projectExpression(\n readRequiredDataProperty(source, `whereFrom`, `${path}.whereFrom`),\n `${path}.whereFrom`,\n state,\n )\n const whereCurrent = projectExpression(\n readRequiredDataProperty(source, `whereCurrent`, `${path}.whereCurrent`),\n `${path}.whereCurrent`,\n state,\n )\n if (!state.validateOnly) {\n projected.whereFrom = whereFrom\n projected.whereCurrent = whereCurrent\n }\n const lastKey = readDataProperty(source, `lastKey`, `${path}.lastKey`)\n if (lastKey.present && lastKey.value !== undefined) {\n if (\n typeof lastKey.value !== `string` &&\n typeof lastKey.value !== `number`\n ) {\n throw new RemoteSubsetWireValueError(\n `${path}.lastKey`,\n describe(lastKey.value),\n )\n }\n if (!state.validateOnly) projected.lastKey = lastKey.value\n }\n return projected\n}\n\nfunction projectWireValue(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireValue {\n if (\n value === undefined ||\n value === null ||\n typeof value === `boolean` ||\n typeof value === `string` ||\n typeof value === `number` ||\n typeof value === `bigint`\n ) {\n return value\n }\n if (typeof value !== `object`) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n\n const existing = state.wireValues.get(value)\n if (existing) return existing\n\n if (\n typeof SharedArrayBuffer !== `undefined` &&\n value instanceof SharedArrayBuffer\n ) {\n throw new RemoteSubsetWireValueError(path, `SharedArrayBuffer`)\n }\n if (value instanceof NativeDate) {\n assertExactPrototype(value, NativeDate.prototype, path)\n assertNoOwnProperties(value, path)\n const time = value.getTime()\n const projected = state.validateOnly ? value : new NativeDate(time)\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof RegExp) {\n assertExactPrototype(value, RegExp.prototype, path)\n assertRegExpShape(value, path)\n const { source, flags } = value\n const projected = state.validateOnly ? value : new RegExp(source, flags)\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof ArrayBuffer) {\n assertExactPrototype(value, ArrayBuffer.prototype, path)\n assertNoOwnProperties(value, path)\n assertFixedArrayBuffer(value, path)\n let projected: ArrayBuffer\n try {\n if (state.validateOnly) {\n // A zero-length view checks detachment without copying the backing bytes.\n new Uint8Array(value, 0, 0)\n projected = value\n } else {\n projected = value.slice(0)\n }\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached ArrayBuffer`)\n }\n state.wireValues.set(value, projected)\n return projected\n }\n if (value instanceof DataView) {\n assertExactPrototype(value, DataView.prototype, path)\n assertNoOwnProperties(value, path)\n let byteOffset: number\n let byteLength: number\n let buffer: ArrayBufferLike\n try {\n byteOffset = value.byteOffset\n byteLength = value.byteLength\n buffer = value.buffer\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached DataView`)\n }\n const projectedBuffer = projectWireValue(buffer, path, state)\n if (!(projectedBuffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared DataView buffer`)\n }\n const projected = state.validateOnly\n ? value\n : new DataView(projectedBuffer, byteOffset, byteLength)\n state.wireValues.set(value, projected)\n return projected\n }\n\n const typedArrayConstructor = getTypedArrayConstructor(value)\n if (typedArrayConstructor) {\n const typedArray = value as RemoteSubsetWireTypedArray\n assertTypedArrayShape(typedArray, path)\n let byteOffset: number\n let length: number\n let buffer: ArrayBufferLike\n try {\n byteOffset = typedArray.byteOffset\n length = typedArray.length\n buffer = typedArray.buffer\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached typed array`)\n }\n if (!(buffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared typed-array buffer`)\n }\n const projectedBuffer = projectWireValue(buffer, path, state)\n if (!(projectedBuffer instanceof ArrayBuffer)) {\n throw new RemoteSubsetWireValueError(path, `shared typed-array buffer`)\n }\n let projected: RemoteSubsetWireTypedArray\n try {\n projected = state.validateOnly\n ? typedArray\n : new typedArrayConstructor(projectedBuffer, byteOffset, length)\n } catch {\n throw new RemoteSubsetWireValueError(path, `detached typed array`)\n }\n state.wireValues.set(value, projected)\n return projected\n }\n if (ArrayBuffer.isView(value)) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n if (Array.isArray(value)) return projectWireArray(value, path, state)\n if (value instanceof Map) return projectWireMap(value, path, state)\n if (value instanceof Set) return projectWireSet(value, path, state)\n return projectWireRecord(value, path, state)\n}\n\nfunction projectWireArray(\n value: Array<unknown>,\n path: string,\n state: ProjectionState,\n): Array<RemoteSubsetWireValue> {\n assertArrayShape(value, path)\n const projected = state.validateOnly\n ? (value as Array<RemoteSubsetWireValue>)\n : new Array<RemoteSubsetWireValue>(value.length)\n state.wireValues.set(value, projected)\n for (let index = 0; index < value.length; index++) {\n if (index in value) {\n const result = projectWireValue(value[index], `${path}[${index}]`, state)\n if (!state.validateOnly) projected[index] = result\n }\n }\n return projected\n}\n\nfunction projectWireMap(\n value: Map<unknown, unknown>,\n path: string,\n state: ProjectionState,\n): Map<RemoteSubsetWireValue, RemoteSubsetWireValue> {\n assertExactPrototype(value, Map.prototype, path)\n assertNoOwnProperties(value, path)\n const projected = state.validateOnly\n ? (value as Map<RemoteSubsetWireValue, RemoteSubsetWireValue>)\n : new Map<RemoteSubsetWireValue, RemoteSubsetWireValue>()\n state.wireValues.set(value, projected)\n let index = 0\n for (const [key, entry] of value) {\n const projectedKey = projectWireValue(\n key,\n `${path}.entries[${index}].key`,\n state,\n )\n const projectedValue = projectWireValue(\n entry,\n `${path}.entries[${index}].value`,\n state,\n )\n if (!state.validateOnly) projected.set(projectedKey, projectedValue)\n index++\n }\n return projected\n}\n\nfunction projectWireSet(\n value: Set<unknown>,\n path: string,\n state: ProjectionState,\n): Set<RemoteSubsetWireValue> {\n assertExactPrototype(value, Set.prototype, path)\n assertNoOwnProperties(value, path)\n const projected = state.validateOnly\n ? (value as Set<RemoteSubsetWireValue>)\n : new Set<RemoteSubsetWireValue>()\n state.wireValues.set(value, projected)\n let index = 0\n for (const entry of value) {\n const result = projectWireValue(entry, `${path}.values[${index}]`, state)\n if (!state.validateOnly) projected.add(result)\n index++\n }\n return projected\n}\n\nfunction projectWireRecord(\n value: unknown,\n path: string,\n state: ProjectionState,\n): RemoteSubsetWireRecord {\n const source = requirePlainRecord(value, path)\n const existing = state.wireValues.get(source)\n if (existing) return existing as RemoteSubsetWireRecord\n const projected: RemoteSubsetWireRecord = state.validateOnly\n ? (source as RemoteSubsetWireRecord)\n : {}\n state.wireValues.set(source, projected)\n\n for (const key of ownKeys(source, path)) {\n const childPath = propertyPath(path, key)\n if (typeof key === `symbol`) {\n throw new RemoteSubsetWireValueError(childPath, `symbol property key`)\n }\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (!descriptor || !descriptor.enumerable || !(`value` in descriptor)) {\n throw new RemoteSubsetWireValueError(childPath, `non-data property`)\n }\n const result = projectWireValue(descriptor.value, childPath, state)\n if (!state.validateOnly) {\n Object.defineProperty(projected, key, {\n value: result,\n enumerable: true,\n writable: true,\n configurable: true,\n })\n }\n }\n return projected\n}\n\nfunction projectNumber(value: unknown, path: string): number {\n if (typeof value !== `number` || !Number.isSafeInteger(value) || value < 0) {\n throw new RemoteSubsetWireValueError(path, `non-negative safe integer`)\n }\n return value\n}\n\nfunction readRequiredDataProperty(\n value: object,\n key: string,\n path: string,\n): unknown {\n const property = readDataProperty(value, key, path)\n if (!property.present) {\n throw new RemoteSubsetWireValueError(path, `missing property`)\n }\n return property.value\n}\n\nfunction readDataProperty(\n value: object,\n key: string,\n path: string,\n): DataProperty {\n let descriptor: PropertyDescriptor | undefined\n try {\n descriptor = Object.getOwnPropertyDescriptor(value, key)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable property`)\n }\n if (!descriptor) return { present: false }\n if (!descriptor.enumerable || !(`value` in descriptor)) {\n throw new RemoteSubsetWireValueError(path, `non-data property`)\n }\n return { present: true, value: descriptor.value }\n}\n\nfunction assertAllowedProperties(\n value: object,\n path: string,\n allowed: ReadonlyArray<string>,\n): void {\n const allowedSet = new Set(allowed)\n for (const key of ownKeys(value, path)) {\n if (typeof key === `symbol` || !allowedSet.has(key)) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n readDataProperty(value, key, propertyPath(path, key))\n }\n}\n\nfunction assertPlainContainer(value: object, path: string): void {\n assertExactPrototype(value, Object.prototype, path)\n}\n\nfunction assertExpressionPrototype(\n value: object,\n path: string,\n expressionPrototype: object,\n): void {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable prototype`)\n }\n if (prototype !== Object.prototype && prototype !== expressionPrototype) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n}\n\nfunction assertExactPrototype(\n value: object,\n expected: object,\n path: string,\n): void {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable prototype`)\n }\n if (prototype !== expected) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n}\n\nfunction assertNoOwnProperties(value: object, path: string): void {\n const keys = ownKeys(value, path)\n if (keys.length > 0) {\n throw new RemoteSubsetWireValueError(\n propertyPath(path, keys[0]!),\n `property`,\n )\n }\n}\n\nfunction assertFixedArrayBuffer(value: ArrayBuffer, path: string): void {\n if ((value as ArrayBuffer & { readonly resizable?: boolean }).resizable) {\n throw new RemoteSubsetWireValueError(path, `resizable ArrayBuffer`)\n }\n}\n\nfunction assertRegExpShape(value: RegExp, path: string): void {\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (key !== `lastIndex`) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, `lastIndex`)\n if (!descriptor || !(`value` in descriptor) || descriptor.value !== 0) {\n throw new RemoteSubsetWireValueError(\n `${path}.lastIndex`,\n `RegExp lastIndex must be 0`,\n )\n }\n}\n\nfunction assertTypedArrayShape(\n value: RemoteSubsetWireTypedArray,\n path: string,\n): void {\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (typeof key !== `string` || !isCanonicalArrayIndex(key, value.length)) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n }\n}\n\nfunction assertArrayShape(value: Array<unknown>, path: string): void {\n assertExactPrototype(value, Array.prototype, path)\n const keys = ownKeys(value, path)\n for (const key of keys) {\n if (\n key !== `length` &&\n (typeof key !== `string` || !isCanonicalArrayIndex(key, value.length))\n ) {\n throw new RemoteSubsetWireValueError(propertyPath(path, key), `property`)\n }\n if (key !== `length`) {\n readDataProperty(value, key, propertyPath(path, key))\n }\n }\n}\n\nfunction isCanonicalArrayIndex(key: string, length: number): boolean {\n if (!/^(0|[1-9][0-9]*)$/.test(key)) return false\n const index = Number(key)\n return Number.isSafeInteger(index) && index >= 0 && index < length\n}\n\nfunction getTypedArrayConstructor(\n value: object,\n): TypedArrayConstructor | undefined {\n let prototype: object | null\n try {\n prototype = Object.getPrototypeOf(value)\n } catch {\n return undefined\n }\n return typedArrayConstructors.find(\n (constructor) => prototype === constructor.prototype,\n )\n}\n\nfunction requireArray(value: unknown, path: string): Array<unknown> {\n if (!Array.isArray(value)) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n return value\n}\n\nfunction requireObject(value: unknown, path: string): object {\n if (value === null || typeof value !== `object`) {\n throw new RemoteSubsetWireValueError(path, describe(value))\n }\n return value\n}\n\nfunction requirePlainRecord(\n value: unknown,\n path: string,\n): Record<string, unknown> {\n const object = requireObject(value, path)\n assertExactPrototype(object, Object.prototype, path)\n return object as Record<string, unknown>\n}\n\nfunction ownKeys(value: object, path: string): Array<string | symbol> {\n try {\n return Reflect.ownKeys(value)\n } catch {\n throw new RemoteSubsetWireValueError(path, `unreadable properties`)\n }\n}\n\nfunction propertyPath(path: string, key: string | symbol): string {\n if (typeof key === `symbol`) return `${path}[${String(key)}]`\n return identifierPattern.test(key)\n ? `${path}.${key}`\n : `${path}[${JSON.stringify(key)}]`\n}\n\nfunction describe(value: unknown): string {\n if (value === null) return `null`\n if (typeof value !== `object`) return typeof value\n return `object`\n}\n"],"names":["IR","result"],"mappings":";;;AA8EO,MAAM,mCAAmC,UAAU;AAAA,EAGxD,YACW,MACT,QACA;AACA,UAAM,2CAA2C,IAAI,KAAK,MAAM,EAAE;AAHzD,SAAA,OAAA;AAHX,SAAkB,OAAO;AAAA,EAOzB;AACF;AA4BA,MAAM,yBAA+D;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAMnB,SAAS,+BACd,SAC8B;AAC9B,SAAO,uBAAuB,SAAS,KAAK;AAC9C;AAGO,SAAS,4BAA4B,SAAkC;AAC5E,yBAAuB,SAAS,IAAI;AACtC;AAIA,SAAS,uBACP,SACA,cAC8B;AAC9B,uBAAqB,SAAS,SAAS;AACvC,0BAAwB,SAAS,WAAW;AAAA,IAC1C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,QAAM,QAAyB;AAAA,IAC7B;AAAA,IACA,iCAA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AY,OAAO,eAAe,KAAK;AAAA,EACzC,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO,uBAAuB;AAAA,IAC5B,CAAC,gBAAgB,cAAc,YAAY;AAAA,EAAA;AAE/C;AAEA,SAAS,aAAa,OAAgB,MAA8B;AAClE,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,UAAM,IAAI,2BAA2B,MAAM,SAAS,KAAK,CAAC;AAAA,EAC5D;AACA,SAAO;AACT;AAEA,SAAS,cAAc,OAAgB,MAAsB;AAC3D,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,UAAM,IAAI,2BAA2B,MAAM,SAAS,KAAK,CAAC;AAAA,EAC5D;AACA,SAAO;AACT;AAEA,SAAS,mBACP,OACA,MACyB;AACzB,QAAM,SAAS,cAAc,OAAO,IAAI;AACxC,uBAAqB,QAAQ,OAAO,WAAW,IAAI;AACnD,SAAO;AACT;AAEA,SAAS,QAAQ,OAAe,MAAsC;AACpE,MAAI;AACF,WAAO,QAAQ,QAAQ,KAAK;AAAA,EAC9B,QAAQ;AACN,UAAM,IAAI,2BAA2B,MAAM,uBAAuB;AAAA,EACpE;AACF;AAEA,SAAS,aAAa,MAAc,KAA8B;AAChE,MAAI,OAAO,QAAQ,SAAU,QAAO,GAAG,IAAI,IAAI,OAAO,GAAG,CAAC;AAC1D,SAAO,kBAAkB,KAAK,GAAG,IAC7B,GAAG,IAAI,IAAI,GAAG,KACd,GAAG,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC;AACpC;AAEA,SAAS,SAAS,OAAwB;AACxC,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,OAAO,UAAU,SAAU,QAAO,OAAO;AAC7C,SAAO;AACT;;;;;"}
@@ -44,6 +44,7 @@ export type TransportedLoadSubsetOptions = {
44
44
  limit?: number;
45
45
  cursor?: RemoteSubsetWireCursor;
46
46
  offset?: number;
47
+ refetch?: boolean;
47
48
  };
48
49
  export declare class RemoteSubsetWireValueError extends TypeError {
49
50
  readonly path: string;