{"version":3,"sources":["../src/devtools/setup-plugin.ts","../src/devtools/index.ts","../src/model-store-registry.ts","../src/application-store.ts","../src/decorators/reactive.ts","../src/models/abstract-model.ts","../src/models/async-model.ts","../src/models/model.ts","../src/models/index.ts","../src/stores/abstract-store.ts","../src/utils/optimistic.ts","../src/utils/pagination.ts","../src/utils/query-cache.ts","../src/utils/request-tracker.ts","../src/stores/async-store.ts","../src/stores/store.ts","../src/swr/index.ts"],"names":["watch","capitalize","inject","ref","shallowReactive","reactive","toRaw","snapshot","record","index"],"mappings":";;;;;AAKA,IAAM,YAAA,GAAe,YAAA;AAErB,IAAM,+BAAe,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,QAAQ,CAAC,CAAA;AAShD,SAAS,gBAAgB,SAAA,EAAyD;AAChF,EAAA,OAAO,OAAO,OAAA,CAAQ,SAAS,CAAA,CAAE,MAAA,CAAO,CAAC,KAAA,KAAwC;AAC/E,IAAA,MAAM,GAAG,KAAK,CAAA,GAAI,KAAA;AAElB,IAAA,OAAO,KAAA,KAAU,QAAQ,OAAO,KAAA,KAAU,YAAY,KAAA,CAAM,OAAA,CAAQ,MAAM,OAAO,CAAA;AAAA,EACnF,CAAC,CAAA;AACH;AAMA,SAAS,YAAY,MAAA,EAA+B;AAClD,EAAA,OAAO,MAAA,CAAO,UAAS,IAAK,EAAA;AAC9B;AAGA,SAAS,eAAA,CAAgB,GAAA,EAAU,MAAA,GAAS,EAAA,EAAW;AACrD,EAAA,MAAM,SAAgB,EAAC;AAEvB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAA,EAAG;AAC9C,IAAA,MAAM,UAAU,MAAA,GAAS,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,GAAK,GAAA;AAE9C,IAAA,IAAI,aAAa,GAAA,CAAI,GAAG,CAAA,IAAK,OAAO,UAAU,UAAA,EAAY;AACxD,MAAA,MAAA,CAA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-store\";\nimport type { AbstractModel } from \"../models\";\n\nconst INSPECTOR_ID = \"data-store\";\n\nconst SKIPPED_KEYS = new Set([\"store\", \"stores\"]);\n\n/**\n * Matched structurally rather than by class: `Store` and `AsyncStore` share no\n * concrete base, and DevTools only ever reads `records`.\n */\ntype StoreLike = { records: AbstractModel[] };\n\n/** Stores registered on the ApplicationStore, skipping non-store members such as `client`. */\nfunction getStoreEntries(dataStore: ApplicationStore): Array<[string, StoreLike]> {\n  return Object.entries(dataStore).filter((entry): entry is [string, StoreLike] => {\n    const [, value] = entry;\n\n    return value !== null && typeof value === \"object\" && Array.isArray(value.records);\n  });\n}\n\n/**\n * `AbstractModel.toString()` returns the id, which is `undefined` on a record that\n * has never been persisted — so it is not the `string` its signature promises.\n */\nfunction recordLabel(record: AbstractModel): string {\n  return record.toString() || \"\";\n}\n\n/** Create a flat structure with dot notation to show nesting in DevTools */\nfunction createFlatState(obj: any, prefix = \"\"): any[] {\n  const result: any[] = [];\n\n  for (const [key, value] of Object.entries(obj)) {\n    const fullKey = prefix ? `${prefix}.${key}` : key;\n\n    if (SKIPPED_KEYS.has(key) || typeof value === \"function\") {\n      result.push({ key: fullKey, value: \"[Skipped]\", editable: false });\n      continue;\n    }\n\n    if (typeof value !== \"object\" || value === null) {\n      result.push({ key: fullKey, value, editable: false });\n      continue;\n    }\n\n    if (Array.isArray(value)) {\n      result.push({ key: fullKey, value: `[${value.length} items]`, editable: false });\n      flattenArrayItems(result, value, fullKey);\n    } else {\n      result.push({\n        key: fullKey,\n        value: `{${Object.keys(value).length} properties}`,\n        editable: false,\n      });\n      result.push(...createFlatState(value, fullKey));\n    }\n  }\n\n  return result;\n}\n\nfunction flattenArrayItems(result: any[], items: any[], parentKey: string): void {\n  for (let i = 0; i < items.length; i++) {\n    const item = items[i];\n    if (typeof item === \"object\" && item !== null) {\n      result.push(...createFlatState(item, `${parentKey}[${i}]`));\n    } else {\n      result.push({ key: `${parentKey}[${i}]`, value: item, editable: false });\n    }\n  }\n}\n\nconst debounce = (callback: () => void, delay = 300) => {\n  let timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n  return (...args: []) => {\n    clearTimeout(timeoutId);\n    timeoutId = setTimeout(() => callback.apply(this, args), delay);\n  };\n};\n\nexport default async function setupDevtools(app: any) {\n  // Lazy-import so `@vue/devtools-api` lands in a separate chunk and never\n  // ships in production bundles (the call site is guarded out for prod).\n  const { setupDevtoolsPlugin } = await import(\"@vue/devtools-api\");\n\n  setupDevtoolsPlugin(\n    {\n      id: \"kita-data-store\",\n      label: \"Kita Data Store\",\n      app,\n    },\n    (api) => {\n      const dataStore = app.config.globalProperties.store as ApplicationStore;\n\n      const filterState = {\n        showNew: true,\n        showPersisted: true,\n      };\n\n      // Add to Vue Devtools Panel\n      api.addInspector({\n        id: INSPECTOR_ID,\n        label: \"Data Store\",\n        icon: \"storage\",\n        treeFilterPlaceholder: \"Search records\",\n        actions: [\n          {\n            icon: \"fiber_new\",\n            tooltip: \"Toggle Show/Hide New Records\",\n            action: debounce(() => {\n              filterState.showNew = !filterState.showNew;\n              api.sendInspectorTree(INSPECTOR_ID);\n            }, 50),\n          },\n          {\n            icon: \"save\",\n            tooltip: \"Toggle Show/Hide Persisted Records\",\n            action: debounce(() => {\n              filterState.showPersisted = !filterState.showPersisted;\n              api.sendInspectorTree(INSPECTOR_ID);\n            }, 50),\n          },\n        ],\n      });\n\n      // Build UI\n      api.on.getInspectorTree((payload /** context */) => {\n        if (payload.inspectorId !== INSPECTOR_ID) return;\n\n        payload.rootNodes = getStoreEntries(dataStore)\n          .map(([storeName, storeInstance]) => {\n            // A model may override `toString()`, so building one store's node can throw on\n            // user code. Isolate it: one bad store must not blank the whole inspector.\n            try {\n              return createStoreTree({\n                storeName,\n                storeInstance,\n                filter: payload.filter,\n                filterState,\n              });\n            } catch (error: unknown) {\n              console.error(`Failure attempting to create store tree for ${storeName}`, error);\n              return null;\n            }\n          })\n          .filter((node) => !!node);\n      });\n\n      // Show the selected record\n      api.on.getInspectorState((payload) => {\n        if (payload.inspectorId !== INSPECTOR_ID) return;\n\n        const allRecords = getStoreEntries(dataStore).flatMap(([, store]) => store.records);\n        const selectedRecord = allRecords.find((record) => record.id === payload.nodeId);\n\n        if (!selectedRecord) {\n          payload.state = {\n            Error: [\n              { key: \"message\", value: \"Record not found\", editable: false },\n              { key: \"nodeId\", value: payload.nodeId, editable: false },\n              { key: \"availableRecords\", value: allRecords.length, editable: false },\n            ],\n          };\n          return;\n        }\n\n        try {\n          payload.state = { Record: createFlatState(selectedRecord) };\n        } catch (error: unknown) {\n          payload.state = {\n            Error: [\n              {\n                key: \"message\",\n                value: `Error formatting record: ${error instanceof Error ? error.message : String(error)}`,\n                editable: false,\n              },\n            ],\n          };\n        }\n      });\n\n      // DevTools re-requests the tree only when told to, so a store gaining or losing\n      // records has to push. `records` is backed by a Vue ref, making this free when idle.\n      watch(\n        () => getStoreEntries(dataStore).map(([, store]) => store.records.length),\n        debounce(() => api.sendInspectorTree(INSPECTOR_ID), 50),\n      );\n    },\n  );\n}\n\nfunction createStoreTree({\n  storeName,\n  storeInstance,\n  filter,\n  filterState,\n}: {\n  storeName: string;\n  storeInstance: StoreLike;\n  filter: string;\n  filterState: { showNew: boolean; showPersisted: boolean };\n}) {\n  const searchFilterFn = filter\n    ? (record: AbstractModel) => recordLabel(record).toLowerCase().includes(filter.toLowerCase())\n    : () => true;\n\n  const booleanFilterFn = (record: AbstractModel) => {\n    if (filterState.showNew && record.isNew) return true;\n    if (filterState.showPersisted && !record.isNew) return true;\n\n    return false;\n  };\n\n  return {\n    id: storeName,\n    label: `${capitalize(storeName)} (${storeInstance.records.length})`,\n    children: storeInstance.records\n      .filter(booleanFilterFn)\n      .filter(searchFilterFn)\n      .map((record) => {\n        return {\n          id: record.id,\n          label: recordLabel(record),\n          tags: [\n            {\n              label: record.isNew ? \"New\" : \"Persisted\",\n              textColor: 0xffffff,\n              backgroundColor: record.isNew ? 0x4caf50 : 0x2196f3,\n            },\n          ],\n        };\n      }),\n  };\n}\n","import { App } from \"vue\";\n\nimport setupDevtools from \"./setup-plugin\";\n\nexport default {\n  install(app: App /** options = {} */) {\n    // Devtools are dev-only. In production this branch is statically eliminated\n    // (and `setupDevtools` + `@vue/devtools-api` tree-shaken out with it).\n    if (process.env.NODE_ENV === \"production\") return;\n    return setupDevtools(app);\n  },\n};\n","import { AsyncModel, Model } from \"./models\";\nimport { AsyncStore, Store } from \"./stores\";\n\nclass ModelStoreRegistry {\n  private readonly stores: Record<string, Store<Model> | AsyncStore<AsyncModel>> = {};\n  private readonly models: Record<string, typeof Model | typeof AsyncModel> = {};\n\n  public registerStore(storeId: string, store: Store<any> | AsyncStore<any>) {\n    this.stores[storeId] = store;\n  }\n\n  public getStore(storeId: string): Store<Model> | AsyncStore<AsyncModel> {\n    return this.stores[storeId];\n  }\n\n  public registerModel<T extends typeof Model | typeof AsyncModel>(model: T) {\n    this.models[model.id] = model;\n  }\n\n  public getModel(modelId: string): typeof Model | typeof AsyncModel {\n    return this.models[modelId];\n  }\n\n  public allStores(): Record<string, Store<Model> | AsyncStore<AsyncModel>> {\n    return this.stores;\n  }\n}\n\nexport type { ModelStoreRegistry };\n\nexport default new ModelStoreRegistry();\n","import type { App, InjectionKey } from \"vue\";\nimport { inject } from \"vue\";\n\nimport dataStorePlugin from \"./devtools\";\nimport type { HttpClient } from \"./http\";\nimport ModelStoreRegistry from \"./model-store-registry\";\nimport { AsyncModel, Model } from \"./models\";\nimport { AsyncStore, Store } from \"./stores\";\n\n/**\n * Symbol-based injection key for the ApplicationStore. Used by kita's own\n * `useStore` helper. Exported so advanced consumers can write their own\n * inject() calls without colliding on a string key like `\"store\"`.\n */\nexport const KITA_STORE_KEY: InjectionKey<ApplicationStore> = Symbol(\n  \"@ofrusch/kita/application-store\",\n);\n\nexport class ApplicationStore<TClient extends HttpClient = HttpClient> {\n  declare client: TClient;\n\n  // accept any store definitions\n  [key: string]: any;\n\n  constructor(client: TClient) {\n    this.client = client;\n  }\n\n  registerStore<T extends typeof Store<Model> | typeof AsyncStore<AsyncModel>>(StoreClass: T) {\n    const storeInstance = new StoreClass(this.client, {});\n\n    this[StoreClass.id] = storeInstance;\n    ModelStoreRegistry.registerStore(StoreClass.id, storeInstance);\n\n    return this;\n  }\n\n  getStore<T = Store<Model> | AsyncStore<AsyncModel>>(recordType: string): T {\n    return this[recordType] as T;\n  }\n\n  install(app: App) {\n    app.provide(KITA_STORE_KEY, this);\n    // Keep globalProperties.store for Vue DevTools and template access compatibility.\n    app.config.globalProperties.store = this;\n\n    // Register the DevTools plugin.\n    app.use(dataStorePlugin);\n  }\n}\n\nexport function createStore<T extends new (client: never) => ApplicationStore<HttpClient>>(\n  appStoreClass: T,\n  client: ConstructorParameters<T>[0],\n): { appStore: InstanceType<T>; useStore: () => InstanceType<T> } {\n  const useStore = () => {\n    return inject(KITA_STORE_KEY) as InstanceType<T>;\n  };\n\n  const appStore = new appStoreClass(client as never) as InstanceType<T>;\n\n  return { appStore, useStore };\n}\n\nexport function createAndRegisterStore<\n  T extends new (client: never) => ApplicationStore<HttpClient>,\n>(\n  appStoreClass: T,\n  modelStores: Array<typeof Store<Model> | typeof AsyncStore<AsyncModel>>,\n  client: ConstructorParameters<T>[0],\n): {\n  appStore: InstanceType<T>;\n  useStore: () => InstanceType<T>;\n} {\n  const { appStore, useStore } = createStore(appStoreClass, client);\n\n  modelStores.forEach((store) => appStore.registerStore(store));\n\n  return { appStore, useStore };\n}\n","import { ref, type Ref } from \"vue\";\n\n/**\n * Use to define a reactive property on an object. Creates a getter and setter on the target\n * object that maintain a Vue ref under the hood.\n *\n * Example usage (Stage 3 decorators):\n *   @reactive()\n *   accessor reactiveArray: string[] = [];\n *\n * Note: The decorator argument is optional and ignored for backwards compatibility.\n * The initial value comes from the class field initializer.\n */\nexport default function reactive(_defaultValue?: unknown) {\n  // WeakMap to store per-instance refs\n  const instanceRefs = new WeakMap<object, Ref<unknown>>();\n\n  return function <This extends object, T>(\n    _target: ClassAccessorDecoratorTarget<This, T>,\n    _context: ClassAccessorDecoratorContext<This, T>,\n  ): ClassAccessorDecoratorResult<This, T> {\n    return {\n      get(this: This): T {\n        const localRef = instanceRefs.get(this);\n        if (!localRef) {\n          // This shouldn't happen if init() was called\n          return undefined as T;\n        }\n        return localRef.value as T;\n      },\n      set(this: This, value: T): void {\n        let localRef = instanceRefs.get(this);\n        if (!localRef) {\n          localRef = ref(value);\n          instanceRefs.set(this, localRef);\n        } else {\n          localRef.value = value;\n        }\n      },\n      init(this: This, value: T): T {\n        // Initialize the ref with the provided initial value from the class field\n        const localRef = ref(value);\n        instanceRefs.set(this, localRef);\n        return value;\n      },\n    };\n  };\n}\n","import ModelStoreRegistry from \"../model-store-registry\";\n\nexport abstract class AbstractModel {\n  static id = \"base\";\n\n  declare readonly id: string;\n\n  /** `!this.id` — a record with no id has never been persisted. */\n  get isNew(): boolean {\n    return !this.id;\n  }\n\n  toString() {\n    return this.id;\n  }\n\n  constructor(params: Record<string, unknown>) {\n    Object.assign(this, params);\n  }\n\n  public get stores() {\n    return ModelStoreRegistry.allStores();\n  }\n\n  serialize(removeKeys: string[] = []): string {\n    return JSON.stringify(this, (k, v) => {\n      if (![\"store\", \"stores\", ...removeKeys].includes(k)) return v;\n    });\n  }\n}\n","import type { ApplicationStore } from \"../application-store\";\nimport ModelStoreRegistry from \"../model-store-registry\";\nimport type { AsyncStore } from \"../stores\";\nimport { AbstractModel } from \"./abstract-model\";\n\nexport class AsyncModel extends AbstractModel {\n  declare store: AsyncStore<this>;\n\n  get stores() {\n    return ModelStoreRegistry.allStores() as ApplicationStore;\n  }\n\n  async save(): Promise<void> {\n    if (!this.store) {\n      throw new Error(\"You must define a store in the model class in order to use this function\");\n    }\n    const data = await this.store.save(this);\n    Object.assign(this, { ...data });\n  }\n\n  /**\n   * Apply a partial patch and persist. Equivalent to `Object.assign(this, patch); await this.save();`.\n   *\n   * @example\n   * await user.update({ email: \"new@example.com\" });\n   */\n  async update(patch: Record<string, unknown>): Promise<void> {\n    Object.assign(this, patch);\n    await this.save();\n  }\n\n  async delete(): Promise<void> {\n    if (!this.store) {\n      throw new Error(\"You must define a store in the model class in order to use this function\");\n    }\n    await this.store.delete(this);\n  }\n\n  static create<T extends AsyncModel, U>(\n    this: new (params: Record<string, unknown>) => T,\n    params?: U,\n  ): T & U {\n    const newRecord = new this({ ...(params as Record<string, unknown>) }) as T & U;\n    Object.assign(newRecord, params);\n    const modelType = (newRecord.constructor as any).id;\n    newRecord.store = ModelStoreRegistry.getStore(modelType) as AsyncStore<T>;\n\n    // Only register records that already have an identity. An id-less draft\n    // (e.g. `Model.create({ title })` before save) has nothing to key on — it\n    // gets pushed under its real id by `save()` / `_createRecord`. Pushing it\n    // here would pollute the lookup map under an `undefined` key and leave a\n    // duplicate behind once the server assigns the real id.\n    if (newRecord.id != null) {\n      try {\n        newRecord.store._pushRecord(newRecord);\n      } catch {\n        console.error(`No store found for model of type ${modelType}`);\n      }\n    }\n\n    return newRecord;\n  }\n}\n","import type { Store } from \"../stores\";\nimport { AbstractModel } from \"./abstract-model\";\n\nexport class Model extends AbstractModel {\n  declare store: Store<this>;\n\n  static create<T extends Model, U>(\n    this: new (params: Record<string, unknown>) => T,\n    params?: U,\n  ): T & U {\n    const newRecord = new this({ ...(params as Record<string, unknown>) }) as T & U;\n    Object.assign(newRecord, params);\n\n    return newRecord;\n  }\n}\n","import ModelStoreRegistry from \"../model-store-registry\";\nimport { AsyncModel } from \"./async-model\";\nimport { Model } from \"./model\";\n\n/**\n * Register a model class with the ModelStoreRegistry.\n * Call this in a static initialization block in your model class.\n *\n * @example\n * ```typescript\n * export default class UserModel extends AsyncModel {\n *   static readonly id = \"users\";\n *   static { registerModel(this); }\n * }\n * ```\n */\nfunction registerModel<T extends typeof AsyncModel | typeof Model>(modelClass: T): void {\n  ModelStoreRegistry.registerModel(modelClass);\n}\n\n/**\n * @deprecated Use `registerModel(this)` in a `static {}` initialization block instead.\n * `connectToStore` will be removed in a future major release.\n *\n * @example\n * // Old (deprecated):\n * @connectToStore\n * class UserModel extends AsyncModel { … }\n *\n * // New:\n * class UserModel extends AsyncModel {\n *   static { registerModel(this); }\n * }\n */\nfunction connectToStore<T extends typeof AsyncModel>(cls: T) {\n  ModelStoreRegistry.registerModel(cls);\n}\n\nexport { AbstractModel } from \"./abstract-model\";\nexport { AsyncModel } from \"./async-model\";\nexport { Model } from \"./model\";\nexport { connectToStore, registerModel };\n","import { Ref } from \"vue\";\n\nimport { AbstractModel } from \"../models\";\n\n/**\n * Options for findRecords with query caching support.\n */\nexport interface FindRecordsOptions {\n  /** Whether to use cached results (default: true) */\n  cache?: boolean;\n  /** Cache TTL in milliseconds (default: 60000 = 1 minute) */\n  cacheTTL?: number;\n  /** Whether to replace the store contents (default: false) */\n  replaceStore?: boolean;\n}\n\nexport abstract class AbstractStore<T extends AbstractModel> {\n  static readonly id: string;\n\n  declare protected _records: Ref<T[]>;\n  declare protected _recordsById: Map<string, T>;\n\n  public get records() {\n    return this._records.value;\n  }\n\n  public set records(value) {\n    this._records.value = value;\n  }\n\n  protected abstract reset(): void;\n\n  abstract findRecord(id: string): T | undefined;\n\n  abstract _pushRecord(record: T): void;\n\n  abstract _deleteRecord(record: T): void;\n\n  abstract _updateRecord(record: T): T;\n}\n","/**\n * Execute an optimistic update with automatic rollback on error.\n *\n * @param optimisticAction - Function that performs the optimistic UI update and returns a snapshot for rollback\n * @param serverAction - Function that performs the actual server request\n * @param rollback - Function that restores the previous state using the snapshot\n * @returns The result from the server action\n * @throws Re-throws any error from the server action after rolling back\n */\nexport async function withOptimisticUpdate<TSnapshot, TResult>(\n  optimisticAction: () => TSnapshot,\n  serverAction: () => Promise<TResult>,\n  rollback: (snapshot: TSnapshot) => void,\n): Promise<TResult> {\n  const snapshot = optimisticAction();\n  try {\n    return await serverAction();\n  } catch (error) {\n    rollback(snapshot);\n    throw error;\n  }\n}\n","import { ref } from \"vue\";\n\n/**\n * Metadata returned from paginated API responses.\n */\nexport interface PaginationMeta {\n  page: number;\n  totalPages: number;\n  totalCount: number;\n  hasMore: boolean;\n}\n\n/**\n * Result from a paginated fetch operation.\n */\nexport interface PaginatedResult<T> {\n  records: T[];\n  meta: PaginationMeta;\n}\n\n/**\n * Manages paginated data fetching with automatic page tracking.\n *\n * State is backed by Vue `ref`s so the getters are reactive: read `hasMore` /\n * `isLoading` / `page` in a template or `computed` and they update as pages\n * load, even when the query instance is held in a `shallowRef`.\n */\nexport class PaginatedQuery<T> {\n  private _currentPage = ref(1);\n  private _hasMore = ref(true);\n  private _isLoading = ref(false);\n  private _totalCount = ref(0);\n  private _totalPages = ref(0);\n\n  constructor(private fetcher: (page: number) => Promise<PaginatedResult<T>>) {}\n\n  /** Whether more pages are available to load */\n  get hasMore(): boolean {\n    return this._hasMore.value;\n  }\n\n  /** Whether a fetch is currently in progress */\n  get isLoading(): boolean {\n    return this._isLoading.value;\n  }\n\n  /** Current page number (1-indexed) */\n  get page(): number {\n    return this._currentPage.value;\n  }\n\n  /** Total number of records across all pages (if known) */\n  get totalCount(): number {\n    return this._totalCount.value;\n  }\n\n  /** Total number of pages (if known) */\n  get totalPages(): number {\n    return this._totalPages.value;\n  }\n\n  /**\n   * Load the next page of results.\n   * Returns empty array if no more pages or already loading.\n   */\n  async loadMore(): Promise<T[]> {\n    if (!this._hasMore.value || this._isLoading.value) return [];\n\n    this._isLoading.value = true;\n    try {\n      const { records, meta } = await this.fetcher(this._currentPage.value);\n      this._hasMore.value = meta.hasMore;\n      this._totalCount.value = meta.totalCount;\n      this._totalPages.value = meta.totalPages;\n      this._currentPage.value++;\n      return records;\n    } finally {\n      this._isLoading.value = false;\n    }\n  }\n\n  /**\n   * Reset pagination state to fetch from the beginning.\n   */\n  reset(): void {\n    this._currentPage.value = 1;\n    this._hasMore.value = true;\n    this._isLoading.value = false;\n    this._totalCount.value = 0;\n    this._totalPages.value = 0;\n  }\n}\n","interface CacheEntry<T, M> {\n  data: T;\n  meta?: M;\n  timestamp: number;\n  ttl: number;\n  params: Record<string, unknown>;\n}\n\nconst DEFAULT_TTL = 60_000;\nconst DEFAULT_MAX_SIZE = 100;\n\nfunction assertPositiveInteger(option: string, value: number): void {\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new RangeError(`QueryCache: ${option} must be a positive integer, received ${value}`);\n  }\n}\n\n/**\n * Configuration for a {@link QueryCache}.\n */\nexport interface QueryCacheOptions {\n  /**\n   * Milliseconds an entry stays valid for. Must be a positive integer.\n   * Defaults to `60_000`.\n   */\n  ttl?: number;\n\n  /**\n   * Maximum number of entries to retain. Once exceeded, the oldest entries are\n   * evicted. Must be a positive integer. Defaults to `100`.\n   */\n  maxSize?: number;\n}\n\n/**\n * Caches query results with TTL-based expiration and invalidation support.\n *\n * Optionally carries response metadata (`M`) alongside the records — e.g.\n * pagination meta — so a cache hit can return it via {@link QueryCache.getEntry}.\n *\n * The cache is bounded: every {@link QueryCache.set} first sweeps expired\n * entries, then evicts from the oldest end until `size <= maxSize`. This keeps\n * high-cardinality params (a search box caching per keystroke, per-user filters,\n * pagination cursors) from growing the cache forever.\n *\n * Eviction is insertion-order (FIFO), not LRU: reading an entry does not refresh\n * its recency, only re-writing it does.\n */\nexport class QueryCache<T, M = Record<string, unknown>> {\n  private cache = new Map<string, CacheEntry<T[], M>>();\n  private defaultTTL: number;\n  private maxSize: number;\n\n  /**\n   * Create a cache with a custom TTL in milliseconds, or the default TTL (60s)\n   * and max size (100 entries) when omitted.\n   *\n   * @throws {RangeError} If `ttl` is not a positive integer.\n   */\n  constructor(ttl?: number);\n\n  /**\n   * Create a cache with a custom TTL and/or max size.\n   *\n   * @throws {RangeError} If `ttl` or `maxSize` is not a positive integer.\n   */\n  constructor(options?: QueryCacheOptions);\n\n  constructor(options: number | QueryCacheOptions = {}) {\n    const { ttl = DEFAULT_TTL, maxSize = DEFAULT_MAX_SIZE }: QueryCacheOptions =\n      typeof options === \"number\" ? { ttl: options } : options;\n\n    assertPositiveInteger(\"ttl\", ttl);\n    assertPositiveInteger(\"maxSize\", maxSize);\n\n    this.defaultTTL = ttl;\n    this.maxSize = maxSize;\n  }\n\n  /**\n   * Create a stable cache key from query parameters.\n   * Sorts keys to ensure consistent ordering.\n   */\n  private makeKey(params: Record<string, unknown>): string {\n    const sortedKeys = Object.keys(params).sort();\n    const sortedParams: Record<string, unknown> = {};\n    for (const key of sortedKeys) {\n      sortedParams[key] = params[key];\n    }\n    return JSON.stringify(sortedParams);\n  }\n\n  /**\n   * Get cached records if a valid (unexpired) entry exists, else null.\n   */\n  get(params: Record<string, unknown>, ttl = this.defaultTTL): T[] | null {\n    return this.getEntry(params, ttl)?.data ?? null;\n  }\n\n  /**\n   * Get the full cached entry — records plus any stored metadata — if a valid\n   * (unexpired) entry exists, else null. Use this when the cached query carried\n   * response metadata (e.g. pagination meta) you need on a cache hit.\n   */\n  getEntry(params: Record<string, unknown>, ttl = this.defaultTTL): { data: T[]; meta?: M } | null {\n    const key = this.makeKey(params);\n    const entry = this.cache.get(key);\n\n    if (!entry) return null;\n\n    if (Date.now() - entry.timestamp > ttl) {\n      this.cache.delete(key);\n      return null;\n    }\n\n    return { data: entry.data, meta: entry.meta };\n  }\n\n  private deleteExpiredEntries(now = Date.now()): void {\n    for (const [key, entry] of this.cache) {\n      if (now - entry.timestamp > entry.ttl) {\n        this.cache.delete(key);\n      }\n    }\n  }\n\n  private enforceMaximumSize(): void {\n    while (this.cache.size > this.maxSize) {\n      const oldestKey = this.cache.keys().next().value;\n\n      if (oldestKey === undefined) return;\n\n      this.cache.delete(oldestKey);\n    }\n  }\n\n  /**\n   * Store data in the cache, optionally with response metadata.\n   *\n   * Sweeps expired entries and evicts the oldest ones if the write pushes the\n   * cache past `maxSize`. Re-writing an existing key makes it the newest entry.\n   *\n   * Pass `ttl` to give this entry a lifetime other than the cache's default. The\n   * sweep honours each entry's own ttl, so a longer-lived entry survives writes\n   * to unrelated keys.\n   */\n  set(params: Record<string, unknown>, data: T[], meta?: M, ttl = this.defaultTTL): void {\n    const key = this.makeKey(params);\n    const now = Date.now();\n\n    this.deleteExpiredEntries(now);\n\n    // Deleting before re-inserting moves the key to the back of the Map's\n    // insertion order, so a rewrite counts as new and eviction — which takes\n    // from the front — reaches it last.\n    this.cache.delete(key);\n    this.cache.set(key, { data, meta, timestamp: now, ttl, params });\n\n    this.enforceMaximumSize();\n  }\n\n  /**\n   * Check if a cache entry exists and is still valid.\n   */\n  has(params: Record<string, unknown>, ttl = this.defaultTTL): boolean {\n    return this.get(params, ttl) !== null;\n  }\n\n  /**\n   * Invalidate cache entries.\n   * If no predicate is provided, clears all entries.\n   * If a predicate is provided, only clears entries where predicate returns true.\n   */\n  invalidate(predicate?: (params: Record<string, unknown>) => boolean): void {\n    if (!predicate) {\n      this.cache.clear();\n      return;\n    }\n\n    for (const [key, entry] of this.cache) {\n      if (predicate(entry.params)) {\n        this.cache.delete(key);\n      }\n    }\n  }\n\n  /**\n   * Get the number of cached entries.\n   */\n  get size(): number {\n    return this.cache.size;\n  }\n\n  /**\n   * Clear all cached entries.\n   */\n  clear(): void {\n    this.cache.clear();\n  }\n}\n","type PendingRequest<T> = Promise<T>;\n\n/**\n * Deduplicates in-flight requests by tracking pending promises.\n * When multiple callers request the same resource simultaneously,\n * only one network request is made and the result is shared.\n */\nexport class RequestTracker {\n  private pending = new Map<string, PendingRequest<unknown>>();\n\n  /**\n   * Execute a request with deduplication. If a request with the same key\n   * is already in flight, returns the existing promise instead of starting a new one.\n   */\n  async dedupe<T>(key: string, request: () => Promise<T>): Promise<T> {\n    const existing = this.pending.get(key);\n    if (existing) return existing as Promise<T>;\n\n    const promise = request().finally(() => {\n      this.pending.delete(key);\n    });\n\n    this.pending.set(key, promise);\n    return promise;\n  }\n\n  /**\n   * Check if a request with the given key is currently in flight.\n   */\n  hasPending(key: string): boolean {\n    return this.pending.has(key);\n  }\n\n  /**\n   * Clear all pending requests (useful for cleanup/reset).\n   */\n  clear(): void {\n    this.pending.clear();\n  }\n}\n","import { reactive, Ref, ref, shallowReactive, toRaw } from \"vue\";\n\nimport type { HttpClient } from \"../http\";\nimport ModelStoreRegistry from \"../model-store-registry\";\nimport { AsyncModel } from \"../models\";\nimport { withOptimisticUpdate } from \"../utils/optimistic\";\nimport { PaginatedQuery, type PaginatedResult } from \"../utils/pagination\";\nimport { QueryCache } from \"../utils/query-cache\";\nimport { RequestTracker } from \"../utils/request-tracker\";\nimport type { FindRecordsOptions } from \"./abstract-store\";\n\nconst underscore = (s: string) => {\n  return s\n    .split(/\\.?(?=[A-Z])/)\n    .join(\"_\")\n    .toLowerCase();\n};\n\ninterface ConstructorArgs {\n  APIUrl?: string;\n}\n\nexport class AsyncStore<T extends AsyncModel, TClient extends HttpClient = HttpClient> {\n  static readonly id: string;\n\n  protected readonly _records: Ref<T[]>;\n  // Must stay reactive — peekRecord is read inside consumer computeds, and a\n  // plain Map read tracks nothing. shallowReactive, not reactive: stored models\n  // must keep their identity for Object.assign merges and toRaw checks.\n  protected readonly _recordsById: Map<string, T>;\n  protected readonly client: TClient;\n  protected page = 1;\n  protected nextPage = 1;\n  protected APIUrl: string;\n  protected requestTracker = new RequestTracker();\n  private queryCache = new QueryCache<T>();\n  private nextTemporaryId = 0;\n  private readonly pendingCreates = new Map<T, Promise<T>>();\n\n  constructor(client: TClient, args: ConstructorArgs) {\n    this._records = ref([]);\n    this._recordsById = shallowReactive(new Map());\n    this.client = client;\n\n    if (args.APIUrl) {\n      this.APIUrl = args.APIUrl;\n    } else {\n      // @ts-expect-error\n      this.APIUrl = underscore(this.constructor.id);\n    }\n  }\n\n  public get records() {\n    return this._records.value;\n  }\n\n  public set records(value) {\n    this._records.value = value;\n  }\n\n  public get stores() {\n    return ModelStoreRegistry.allStores();\n  }\n\n  protected get modelType(): typeof AsyncModel {\n    // @ts-expect-error\n    return ModelStoreRegistry.getModel(this.constructor.id);\n  }\n\n  protected reset() {\n    this._records.value = [];\n    this._recordsById.clear();\n    this.requestTracker.clear();\n    this.queryCache.clear();\n    this.pendingCreates.clear();\n    this.nextPage = 0;\n    this.page = 0;\n  }\n\n  /**\n   * Synchronous cache read — no fetch. Reactive per key, so it is safe inside\n   * computeds/watchers even on a cache miss.\n   */\n  public peekRecord(id: string): T | undefined {\n    return this._recordsById.get(id);\n  }\n\n  /**\n   * Find a single record by ID. Returns the cached record if present,\n   * otherwise fetches from the API and caches it.\n   *\n   * Concurrent requests for the same record are deduplicated.\n   *\n   * @param id - Record ID to fetch\n   * @param params - Query parameters for the request\n   * @param revalidate - Force a refetch even if a cached record exists\n   */\n  public async findRecord(\n    id: string,\n    params: Record<string, unknown> = {},\n    revalidate = false,\n  ): Promise<T | undefined> {\n    const existing = this._recordsById.get(id);\n    if (existing && !revalidate) return existing;\n    return this._fetchAndCacheRecord(id, params);\n  }\n\n  /**\n   * Fetch a record from the API and merge it into the local cache.\n   * Exposed as `protected` so SWR/custom subclasses can hook into the fetch path.\n   */\n  protected async _fetchAndCacheRecord(id: string, params: Record<string, unknown>): Promise<T> {\n    const cacheKey = `findRecord:${id}:${JSON.stringify(params)}`;\n\n    return this.requestTracker.dedupe(cacheKey, async () => {\n      const res = await this.client.get<any>(`/${this.APIUrl}/${id}/`, { params });\n      const record = this.modelType.create(res.data) as T;\n\n      // Update existing record or push new one\n      const existing = this._recordsById.get(id);\n      if (existing) {\n        Object.assign(existing, record);\n        return existing;\n      }\n\n      return record;\n    });\n  }\n\n  /**\n   * Find multiple records with query caching support.\n   * Deduplicates concurrent requests with the same params.\n   *\n   * @param params - Query parameters for the request\n   * @param options - Cache options or boolean for legacy replaceStore\n   */\n  public async findRecords(\n    params: Record<string, unknown> = {},\n    options: FindRecordsOptions | boolean = {},\n  ): Promise<{ records: T[]; meta?: Record<string, unknown> }> {\n    // Support legacy boolean replaceStore parameter\n    const opts: FindRecordsOptions =\n      typeof options === \"boolean\" ? { replaceStore: options } : options;\n    const { cache = true, cacheTTL, replaceStore = false } = opts;\n\n    // Check cache first (unless replacing store)\n    if (cache && !replaceStore) {\n      const cached = this.queryCache.getEntry(params, cacheTTL);\n      if (cached) {\n        return { records: cached.data, meta: cached.meta };\n      }\n    }\n\n    const cacheKey = `findRecords:${JSON.stringify(params)}:${replaceStore}`;\n\n    return this.requestTracker.dedupe(cacheKey, async () => {\n      const res = await this.client.get<any>(`/${this.APIUrl}/`, { params });\n      let recordsJSON, meta;\n      if (res.data.meta) {\n        recordsJSON = res.data.data;\n        meta = res.data.meta;\n      } else {\n        recordsJSON = res.data;\n        meta = undefined;\n      }\n      if (replaceStore) this.reset();\n      const newRecords = recordsJSON.map((json: object) => this.modelType.create(json)) as T[];\n\n      // Cache the results (with meta, so a cache hit can return it too)\n      if (cache) {\n        this.queryCache.set(params, newRecords, meta, cacheTTL);\n      }\n\n      return { records: newRecords, meta };\n    });\n  }\n\n  /**\n   * Invalidate all cached query results.\n   * Optionally provide a predicate to selectively invalidate.\n   */\n  public invalidateQueries(predicate?: (params: Record<string, unknown>) => boolean): void {\n    this.queryCache.invalidate(predicate);\n  }\n\n  /**\n   * Persist a record. POSTs if the record is new (no id), PUTs otherwise.\n   * Returns the server-confirmed record.\n   *\n   * Higher-level than the protected `_createRecord` / `_updateRecord` —\n   * normal consumer code should call this (or `model.save()`).\n   */\n  public async save(record: T): Promise<T> {\n    return record.isNew ? this._createRecord(record) : this._updateRecord(record);\n  }\n\n  /**\n   * Delete a record. Removes locally if the record is new (no id),\n   * otherwise issues a DELETE then removes locally.\n   *\n   * Higher-level than the protected `_deleteRecord` — normal consumer\n   * code should call this (or `model.delete()`).\n   */\n  public async delete(record: T): Promise<void> {\n    if (record.isNew) {\n      this._removeRecord(record);\n      return;\n    }\n    await this._deleteRecord(record);\n  }\n\n  protected async _updateRecord(record: T): Promise<T> {\n    const res = await this.client.put<any>(`/${this.APIUrl}/${record.id}/`, record.serialize());\n    const updatedRecord = Object.assign(record, res.data);\n    this.queryCache.invalidate();\n    return updatedRecord;\n  }\n\n  /**\n   * POST a record and merge the server response onto it. Store membership is\n   * left to the caller, so both the `save()` path and the optimistic path can\n   * share the request.\n   *\n   * @param record - The model instance to persist and merge the response into\n   * @param payload - Request body; defaults to the record's current state\n   */\n  protected async _postRecord(record: T, payload: string = record.serialize()): Promise<T> {\n    const res = await this.client.post<any>(`/${this.APIUrl}/`, payload);\n    // Merge onto the record being saved rather than building a model out of\n    // `res.data`: the caller already holds this instance, and the response is\n    // only there to carry the server-assigned id. Merge through the *reactive*\n    // view, because `records` stores raw targets — assigning straight onto the\n    // instance bypasses the proxy's set trap, so a record already in the list\n    // would never re-render. `reactive()` hands back the proxy Vue has cached\n    // for this target, and writes through to it.\n    Object.assign(reactive(record), res.data);\n\n    return record;\n  }\n\n  protected async _createRecord(record: T): Promise<T> {\n    await this._postRecord(record);\n\n    const newRecord = this._pushRecord(record);\n    this.queryCache.invalidate();\n\n    return newRecord;\n  }\n\n  protected async _deleteRecord(record: T) {\n    await this.client.delete(`/${this.APIUrl}/${record?.id}/`);\n    this._removeRecord(record);\n    this.queryCache.invalidate();\n  }\n\n  public _removeRecord(record: T) {\n    this._recordsById.delete(record.id);\n    this.records = this.records.filter((r) => r.id !== record.id);\n  }\n\n  public _pushRecord(record: T) {\n    const existing = this._recordsById.get(record.id);\n\n    if (existing) {\n      Object.assign(existing, record);\n      return existing;\n    }\n\n    this._recordsById.set(record.id, record);\n    this.records.push(record);\n    return record;\n  }\n\n  /**\n   * Create a record optimistically - adds to store immediately, syncs with server.\n   * Rolls back on error.\n   *\n   * The record instance itself is inserted under a temporary id and stays in\n   * `records` for the whole round-trip, so it keeps its prototype and never\n   * flickers out of the list. On success only the `_recordsById` key is swapped\n   * from the temporary id to the server id.\n   *\n   * The pending record carries the temporary id, so it is *not* `isNew` while\n   * the POST is in flight — do not call `save()` / `delete()` on it until this\n   * promise settles. Re-entrant calls for the same instance (a double-submitted\n   * form) share the in-flight request rather than issuing a second POST.\n   *\n   * @param record - A record not yet in the store; pass an existing one to `save()`\n   * @throws If the store already holds this instance under its current id\n   */\n  public async optimisticCreate(record: T): Promise<T> {\n    const target = toRaw(record);\n    const inFlight = this.pendingCreates.get(target);\n\n    if (inFlight) return inFlight;\n\n    // Re-creating an instance the store already holds is never right: it would\n    // POST a duplicate row, push the instance into `records` twice, and let a\n    // rollback evict the copy the first create confirmed. Re-persisting an\n    // existing record is what `save()` is for.\n    const stored = this._recordsById.get(record.id);\n\n    if (stored && toRaw(stored) === target) {\n      throw new Error(\n        `Record \"${record.id}\" is already in the store — use save() to update it, not optimisticCreate().`,\n      );\n    }\n\n    const originalId = record.id;\n    const temporaryId = `temp_${++this.nextTemporaryId}`;\n    // Serialized before the temporary id is assigned, so the POST body carries\n    // the pristine record. `serialize([\"id\"])` would strip `id` at every nesting\n    // depth, dropping nested ids too.\n    const payload = record.serialize();\n\n    const request = withOptimisticUpdate(\n      () => {\n        Object.assign(reactive(record), { id: temporaryId });\n        this._pushRecord(record);\n      },\n      async () => {\n        await this._postRecord(record, payload);\n\n        this._recordsById.delete(temporaryId);\n\n        // The server id may already be held by a *different* instance — a\n        // concurrent `findRecords` that returned the new row, or an upsert\n        // endpoint echoing an existing one. Mirror `_pushRecord` and merge into\n        // the incumbent, rather than leaving two array entries under one id.\n        const existing = this._recordsById.get(record.id);\n\n        if (existing && toRaw(existing) !== target) {\n          Object.assign(reactive(existing), record);\n          this.records = this.records.filter((r) => toRaw(r) !== target);\n          this.queryCache.invalidate();\n\n          return existing;\n        }\n\n        this._recordsById.set(record.id, record);\n        this.queryCache.invalidate();\n\n        return record;\n      },\n      () => {\n        // The instance may already have been re-keyed to a real server id by a\n        // confirmed create, in which case unwinding would evict a live record.\n        // Only roll back what is still parked under the temporary id.\n        if (record.id !== temporaryId) return;\n\n        this._recordsById.delete(temporaryId);\n        // Not `_removeRecord`: it matches on `record.id`, which is a moving\n        // target here. Evict by identity — `toRaw` because `records` is a deep\n        // `ref`, so its instrumented `filter` hands the callback reactive\n        // proxies, never the raw instance.\n        this.records = this.records.filter((r) => toRaw(r) !== target);\n\n        Object.assign(reactive(record), { id: originalId });\n      },\n    );\n\n    this.pendingCreates.set(target, request);\n\n    try {\n      return await request;\n    } finally {\n      this.pendingCreates.delete(target);\n    }\n  }\n\n  /**\n   * Update a record optimistically - applies changes immediately, syncs with server.\n   * Rolls back to previous state on error.\n   */\n  public async optimisticUpdate(record: T): Promise<T> {\n    const existing = this._recordsById.get(record.id);\n    if (!existing) {\n      // No existing record, just do a normal update\n      return this._updateRecord(record);\n    }\n\n    const snapshot = { ...existing };\n\n    return withOptimisticUpdate(\n      () => {\n        Object.assign(existing, record);\n        return snapshot;\n      },\n      () => this._updateRecord(record),\n      (snapshot) => {\n        Object.assign(existing, snapshot);\n      },\n    );\n  }\n\n  /**\n   * Delete a record optimistically - removes from store immediately, syncs with server.\n   *\n   * On error the original model instance is restored at its previous position, so\n   * references the caller still holds stay valid and keep their model behaviour.\n   */\n  public async optimisticDelete(record: T): Promise<void> {\n    // Reads off the records ref yield reactive proxies, so identity lookups miss a raw\n    // model once the array has been rebuilt by `_removeRecord`. Match its id semantics.\n    const index = this.records.findIndex((r) => r.id === record.id);\n\n    return withOptimisticUpdate(\n      () => {\n        this._removeRecord(record);\n\n        return { record, index };\n      },\n      async () => {\n        await this._deleteRecord(record);\n      },\n      ({ record, index }) => {\n        this._recordsById.set(record.id, record);\n\n        // Records may have come or gone while the DELETE was in flight, so the saved\n        // index can now be past the end; clamping appends instead of splicing short.\n        const insertionIndex =\n          index >= 0 ? Math.min(index, this.records.length) : this.records.length;\n\n        this.records.splice(insertionIndex, 0, record);\n      },\n    );\n  }\n\n  /**\n   * Create a paginated query helper for fetching records in pages.\n   * Handles page tracking, loading state, and hasMore detection.\n   *\n   * @param params - Base query parameters (page will be added automatically)\n   * @returns PaginatedQuery instance with loadMore(), reset(), and state getters\n   */\n  public createPaginatedQuery(params: Record<string, unknown> = {}): PaginatedQuery<T> {\n    return new PaginatedQuery(async (page) => {\n      // `cache: false` — the query cache stores records only, so a cache hit\n      // returns `meta: undefined` and the pagination math below collapses to\n      // `hasMore: false`. Each page is fetched once during a scroll anyway, and\n      // a reset is meant to refetch, so caching here is both wrong and useless.\n      const { records, meta } = await this.findRecords({ ...params, page }, { cache: false });\n      return {\n        records,\n        meta: {\n          page,\n          totalPages: (meta?.totalPages as number) ?? 1,\n          totalCount: (meta?.totalCount as number) ?? records.length,\n          hasMore: (meta?.hasMore as boolean) ?? false,\n        },\n      } as PaginatedResult<T>;\n    });\n  }\n}\n","import { ref } from \"vue\";\n\nimport { Model } from \"../models\";\nimport { AbstractStore } from \"./abstract-store\";\n\nexport class Store<T extends Model> extends AbstractStore<T> {\n  // eslint-disable-next-line\n  constructor(..._args: any[]) {\n    super();\n\n    this._records = ref([]);\n    this._recordsById = new Map();\n  }\n\n  public findRecord(id: string) {\n    return this._recordsById.get(id);\n  }\n\n  public peekRecord(id: string): T | undefined {\n    return this._recordsById.get(id);\n  }\n\n  public _pushRecord(record: T) {\n    const existing = this._recordsById.get(record.id);\n\n    if (existing) {\n      Object.assign(existing, record);\n      return existing;\n    }\n\n    this._recordsById.set(record.id, record);\n    this.records.push(record);\n    return record;\n  }\n\n  public _removeRecord(record: T) {\n    this._recordsById.delete(record.id);\n    this.records = this.records.filter((r) => r.id !== record.id);\n  }\n\n  public _updateRecord(record: T) {\n    return this._pushRecord(record);\n  }\n\n  public _deleteRecord(record: T) {\n    this._recordsById.delete(record.id);\n    this.records = this.records.filter((r) => r.id !== record.id);\n  }\n\n  protected reset() {\n    this._records.value = [];\n    this._recordsById.clear();\n  }\n}\n","import type { HttpClient } from \"../http\";\nimport type { AsyncModel } from \"../models\";\nimport { AsyncStore } from \"../stores\";\n\n/**\n * Options for stale-while-revalidate `findRecord`.\n */\nexport interface FindRecordOptions {\n  /** Milliseconds before data is considered stale (default: 0 = always stale) */\n  staleTime?: number;\n  /** Force background revalidation even if data is fresh */\n  revalidate?: boolean;\n}\n\n/**\n * Opt-in stale-while-revalidate variant of {@link AsyncStore}.\n *\n * Extends `AsyncStore` with per-record freshness tracking. `findRecord`\n * returns cached data immediately when present, then revalidates in the\n * background when the record is older than `staleTime` or when\n * `revalidate: true` is passed.\n *\n * If you don't need SWR semantics, extend {@link AsyncStore} directly —\n * it has simpler typing and a smaller surface.\n *\n * @example\n * ```ts\n * class UserStore extends AsyncStoreSWR<UserModel> {\n *   static readonly id = \"users\";\n * }\n *\n * // Returns cached user instantly if < 30s old; refetches in background otherwise.\n * await users.findRecord(\"u-1\", {}, { staleTime: 30_000 });\n * ```\n */\nexport class AsyncStoreSWR<\n  T extends AsyncModel,\n  TClient extends HttpClient = HttpClient,\n> extends AsyncStore<T, TClient> {\n  protected recordTimestamps = new Map<string, number>();\n\n  private pendingRevalidations = new Set<string>();\n\n  protected reset() {\n    super.reset();\n    this.recordTimestamps.clear();\n    this.pendingRevalidations.clear();\n  }\n\n  /**\n   * Returns true if the record doesn't exist locally or is older than `staleTime`.\n   */\n  public isRecordStale(id: string, staleTime: number): boolean {\n    const timestamp = this.recordTimestamps.get(id);\n    if (!timestamp) return true;\n    return Date.now() - timestamp > staleTime;\n  }\n\n  /**\n   * Drop the record's freshness timestamp so the next `findRecord` refetches.\n   * Does not remove the record from the local cache.\n   */\n  public invalidateRecord(id: string): void {\n    this.recordTimestamps.delete(id);\n  }\n\n  /**\n   * Find a single record by ID with stale-while-revalidate semantics.\n   *\n   * - If a fresh cached record exists, returns it immediately.\n   * - If a stale cached record exists, returns it immediately and revalidates in the background.\n   * - If no cached record exists, awaits the fetch.\n   *\n   * @param id - Record ID to fetch\n   * @param params - Query parameters for the request\n   * @param options - SWR options, or `true` for the legacy \"force revalidate\" boolean form\n   */\n  public async findRecord(\n    id: string,\n    params: Record<string, unknown> = {},\n    options: FindRecordOptions | boolean = {},\n  ): Promise<T | undefined> {\n    const opts: FindRecordOptions =\n      typeof options === \"boolean\" ? { revalidate: options } : options;\n    const { staleTime = 0, revalidate = false } = opts;\n\n    const existing = this._recordsById.get(id);\n    const timestamp = this.recordTimestamps.get(id) ?? 0;\n    const isStale = Date.now() - timestamp > staleTime;\n\n    if (existing && !isStale && !revalidate) {\n      return existing;\n    }\n\n    if (existing && (isStale || revalidate)) {\n      this.revalidateInBackground(id, params);\n\n      return existing;\n    }\n\n    return this._fetchAndCacheRecord(id, params);\n  }\n\n  /**\n   * Called when a *background* revalidation fails. The default implementation is a\n   * deliberate no-op: under stale-while-revalidate a failed refresh is non-fatal —\n   * the caller already has the stale record and the record stays stale, so the next\n   * `findRecord` retries.\n   *\n   * Override it to surface the failure to your error reporter. A rejection from the\n   * awaited path (no cached record) still propagates to the caller and does not\n   * reach this hook.\n   *\n   * Fires once per background revalidation, not once per caller: concurrent\n   * `findRecord` calls for the same record share a single refresh. An error thrown by\n   * an override is swallowed — a failing reporter must not become the unhandled\n   * rejection this hook exists to prevent.\n   *\n   * @param _error - Rejection value from the background fetch\n   * @param _id - ID of the record being revalidated\n   *\n   * @example\n   * ```ts\n   * class UserStore extends AsyncStoreSWR<UserModel> {\n   *   static readonly id = \"users\";\n   *\n   *   protected onRevalidationError(error: unknown, id: string) {\n   *     Sentry.captureException(error, { tags: { store: \"users\", recordId: id } });\n   *   }\n   * }\n   * ```\n   */\n  protected onRevalidationError(_error: unknown, _id: string): void {}\n\n  private revalidateInBackground(id: string, params: Record<string, unknown>): void {\n    const key = `${id}:${JSON.stringify(params)}`;\n\n    // The request tracker already collapses the concurrent HTTP calls, but each caller\n    // holds its own promise — without this, one failed refresh would report once per caller.\n    if (this.pendingRevalidations.has(key)) return;\n\n    this.pendingRevalidations.add(key);\n\n    void this._fetchAndCacheRecord(id, params)\n      .catch((error) => {\n        try {\n          this.onRevalidationError(error, id);\n        } catch {\n          // A throwing reporter must not become the unhandled rejection this hook prevents.\n        }\n      })\n      .finally(() => {\n        this.pendingRevalidations.delete(key);\n      });\n  }\n\n  /**\n   * Override the base fetch to stamp the record with a fresh timestamp.\n   *\n   * The stamp lands only after `super` resolves, so a failed fetch leaves the\n   * previous timestamp untouched and the record stays stale.\n   */\n  protected async _fetchAndCacheRecord(id: string, params: Record<string, unknown>): Promise<T> {\n    const record = await super._fetchAndCacheRecord(id, params);\n    this.recordTimestamps.set(id, Date.now());\n    return record;\n  }\n}\n"]}