{"version":3,"file":"index.cjs","sources":["../../src/libs/list/list.ts","../../src/libs/dcupl/dcupl-list-controller.ts","../../src/libs/dcupl/dcupl-api.ts","../../src/libs/dcupl/dcupl.ts"],"sourcesContent":["import {\n  CallbackFunction,\n  ChangeDetector,\n  DcuplListOptions,\n  deepQueryService,\n  IndicesController,\n  ListItem,\n  RawItem,\n  resolveCacheMaxSize,\n  trigger,\n} from '@dcupl/common';\nimport { Catalog } from '../catalog';\nimport { DcuplModel } from '../model-parser';\n\nimport { DcuplApi } from '../dcupl/dcupl-api';\nimport { cloneDeep } from 'lodash-es';\n\nexport class DcuplList<ListType extends RawItem = RawItem> {\n  private options!: DcuplListOptions;\n  public key!: string;\n  public modelKey!: string;\n  public catalog!: Catalog<ListType & ListItem>;\n  /**\n   * The key set of a scoped list: its `listItemKeys`, or the keys its seed\n   * `query` selected when the item set was last derived (creation or\n   * {@link update}). Undefined for a list over the whole model. A scoped list\n   * owns a private IndicesController built from its items rather than sharing\n   * the model's, and serves the model's current item for each of these keys\n   * (#366).\n   */\n  private scopeKeys: string[] | undefined;\n\n  constructor(\n    private dcuplApi: DcuplApi,\n    private cdRef: ChangeDetector,\n  ) {}\n\n  private setup(options: DcuplListOptions): void {\n    /**\n     * 1) Get the corresponding model\n     */\n    this.dcuplApi['modelParser'].prepareModelForRead(options.modelKey);\n    const model = this.dcuplApi['modelParser'].models.get(options.modelKey) as\n      | DcuplModel<ListType & ListItem>\n      | undefined;\n\n    if (!model) {\n      throw new Error(`Model with key ${options.modelKey} not found`);\n    }\n\n    /**\n     * 2) Set data based on listItemKeys or query\n     */\n    const listItemKeys = this.getListItemKeys(options);\n    this.scopeKeys = listItemKeys;\n\n    const data: Map<string, ListType & ListItem> = this.getRelevantData(model, listItemKeys);\n\n    /**\n     * 3) Create indicesController depdending on listItemKys\n     */\n\n    const indicesController = this.initIndicesController(listItemKeys, model, data);\n\n    /**\n     * 4) Create catalog\n     */\n    if (!this.catalog) {\n      this.catalog = new Catalog<ListType & ListItem>(this.dcuplApi, this.cdRef, indicesController);\n      this.catalog['init'](this.modelKey, model, data);\n    } else {\n      this.catalog['filter'].update(model, data, indicesController);\n    }\n  }\n\n  private initIndicesController(\n    listItemKeys: string[] | undefined,\n    model: DcuplModel<ListType & ListItem>,\n    data: Map<string, ListType & ListItem>,\n  ): IndicesController {\n    let indicesController: IndicesController | undefined;\n    if (listItemKeys) {\n      indicesController = new IndicesController({\n        maxContextIndexSize: resolveCacheMaxSize(this.dcuplApi.initOptions.performance?.cache),\n      });\n      // Only whole-attribute indices: a context index (a query's or a section's) belongs to the\n      // model's data and query, and its name is not an attribute to rebuild here (#356 review).\n      // Deep paths (`customer.country`) are skipped too: they resolve only on projected items, so a\n      // copy rebuilt over these items maps every item to undefined and the list's facets on the path\n      // came back empty. The list builds them on first use from projected data (#360).\n      for (const key of model.indicesController.getAttributeIndexKeys()) {\n        if (deepQueryService.parse(key).isDeepQuery) {\n          continue;\n        }\n        indicesController.getOrCreateIndex(key, data);\n      }\n    } else {\n      indicesController = model.indicesController;\n    }\n\n    return indicesController;\n  }\n\n  private getListItemKeys(options: DcuplListOptions): string[] | undefined {\n    let listItemKeys: string[] | undefined;\n    if (options.listItemKeys) {\n      listItemKeys = options.listItemKeys;\n    } else if (options.query) {\n      const items = this.dcuplApi.query.execute(options.query);\n      listItemKeys = items.map((item) => item.key);\n    }\n\n    return listItemKeys;\n  }\n\n  private getRelevantData(\n    model: DcuplModel<ListType & ListItem>,\n    listItemKeys: string[] | undefined,\n  ): Map<string, ListType & ListItem> {\n    const modelData = model.getData();\n\n    if (listItemKeys) {\n      return this.initFromItemKeys(modelData, listItemKeys);\n    } else {\n      return modelData;\n    }\n  }\n\n  // private initCdRef(options: DcuplListOptions): void {\n  //   const rootCdRef = this.dcuplApi['cdRef'];\n  //   this.cdRef = new ChangeDetector();\n  //   this.cdRef._init({\n  //     cdRefKey: options.listKey!,\n  //     parentCd: rootCdRef,\n  //     dcuplInitOptions: this.dcuplApi.initOptions,\n  //     analyticsController: this.dcuplApi['analyticsController'],\n  //   });\n  // }\n\n  // @trigger({ scope: 'global', name: 'list:create', type: 'list_created' })\n  protected init(_initialOptions: DcuplListOptions): void {\n    /**\n     * Initialize default options\n     */\n\n    this.options = cloneDeep(_initialOptions);\n    this.key = this.options.listKey!;\n    this.modelKey = this.options.modelKey;\n    // this.initCdRef(this.options);\n    this.setup(this.options);\n  }\n\n  private initFromItemKeys(\n    modelData: Map<string, ListType & ListItem>,\n    itemKeys: string[],\n  ): Map<string, ListType & ListItem> {\n    const data = new Map();\n    itemKeys.forEach((key) => {\n      if (modelData.has(key)) {\n        const item = modelData.get(key) as ListType & ListItem;\n        if (item) {\n          data.set(key, item);\n        }\n      }\n    });\n    return data;\n  }\n\n  public destroy(): void {\n    try {\n      this.dcuplApi.lists.destroy({ listKey: this.key });\n    } catch (_err) {\n      // Ignore destruction errors\n    }\n  }\n\n  @trigger({\n    scope: 'list',\n    type: 'list_destroyed',\n    connectMessage: true,\n  })\n  protected _destroy(): void {\n    this.catalog['filter'].cdRef?.destroy();\n  }\n\n  @trigger({\n    scope: 'list',\n    type: 'list_updated',\n    action: 'update',\n    connectMessage: true,\n  })\n  public update(options?: { reprocessData?: boolean }): void {\n    if ((options && options.reprocessData) || !options) {\n      this.setup(this.options);\n    }\n  }\n\n  /**\n   * Drops the list's query/result caches; the filtered data is recomputed\n   * lazily on the next read from the list's current data, without\n   * re-deriving a scoped list's item set (that is what {@link update} does).\n   * dcupl.update() calls this for affected lists that do not auto-update, so\n   * a query executed before the update can never keep serving its pre-update\n   * cached result — while lists nobody reads pay no eager recompute.\n   *\n   * A scoped list (listItemKeys / seed query) keeps its key set but serves the\n   * model's current items: each key is looked up again in the model's data,\n   * and a key whose item was removed drops out. The full and the partial\n   * update path behave the same (#366).\n   */\n  public invalidate(): void {\n    if (!this.catalog) {\n      return;\n    }\n    const filter = this.catalog['filter'];\n    if (this.scopeKeys) {\n      // A full rebuild replaces the model's item objects and a removal deletes\n      // them, so the items picked at the last setup can carry old values or be\n      // gone (#366): pick the current ones for the same keys.\n      filter.initialData = this.initFromItemKeys(filter.model.getData(), this.scopeKeys);\n      // The private indices were built from the previous items, and a partial\n      // update never reaches this controller (#243 resets only model-level\n      // indices). Drop them all; the next read lazily rebuilds each index from\n      // the current items (#245).\n      filter.indicesController.reset();\n    }\n    filter.resetCache();\n  }\n\n  /**\n   * The models other than this list's own that its cached results were read\n   * through (dotted paths in its query, facets, aggregates, …). dcupl.update()\n   * treats the list as affected when any of them changes (#284).\n   * @internal\n   */\n  public getDependencyModels(): ReadonlySet<string> {\n    return this.catalog ? this.catalog['filter'].getDependencyModels() : new Set();\n  }\n\n  /**\n   * Emits `result_updated` for this list. dcupl.update() calls it once per\n   * affected list, after every affected list has been refreshed, so a\n   * subscriber re-querying any list in its handler sees post-update results\n   * (#278).\n   * @internal\n   */\n  public emitResultUpdated(): void {\n    if (!this.catalog) {\n      return;\n    }\n    this.catalog['filter'].emitResultUpdated();\n  }\n\n  public on(cb: CallbackFunction): () => void {\n    return this.cdRef.on(cb);\n  }\n\n  /**\n   * Subscribes to changes of this list's result: `list.on` filtered to\n   * `result_updated`. Fires when a query change recomputes the result and\n   * once per `dcupl.update()` that can have changed it — never for reads\n   * (`execute`, `fn.facets`, `fn.aggregate`, …).\n   * @returns a function that removes the subscription\n   */\n  public onResultChange(cb: CallbackFunction): () => void {\n    return this.cdRef.on((msg) => {\n      if (msg.type === 'result_updated') {\n        cb(msg);\n      }\n    });\n  }\n}\n","import { ListItem, DcuplGlobalQueryOptions, ChangeDetector, generateKey, trigger, RawItem } from '@dcupl/common';\n\nimport { DcuplList } from '../list';\n\nimport { DcuplApi } from './dcupl-api';\n\nexport class ListsController {\n  private lists: DcuplList[] = [];\n\n  constructor(\n    private dcuplInstance: DcuplApi<any>,\n    protected cdRef: ChangeDetector,\n  ) {}\n\n  public get(listKey: string): DcuplList | undefined {\n    if (listKey) {\n      return this.lists.find((list) => list.key === listKey);\n    }\n    return undefined;\n  }\n\n  public getAll(options?: { modelKey: string }): DcuplList[] {\n    if (!options) return this.lists;\n    return this.lists.filter((list) => list.modelKey === options?.modelKey);\n  }\n\n  public destroy(options?: { listKey?: string; modelKey?: string }): void {\n    if (!options) {\n      this.lists.forEach((list) => list['_destroy']());\n      this.lists = [];\n    } else if (options.listKey) {\n      const idx = this.lists.findIndex((list) => list.key === options.listKey);\n      if (idx > -1) {\n        this.lists[idx]!['_destroy']();\n        this.lists.splice(idx, 1);\n      }\n    } else if (options.modelKey) {\n      this.lists = this.lists.filter((list) => {\n        if (list.modelKey === options.modelKey) {\n          list['_destroy']();\n          return false;\n        }\n        return true;\n      });\n    }\n  }\n\n  /**\n   * Creates a list over a model's items. The type argument types the items the list's queries\n   * return: `lists.create<Product>(...)` returns a `DcuplList<Product>`.\n   */\n  @trigger({\n    scope: 'global',\n    type: 'list_created',\n    connectMessage: true,\n  })\n  public create<ListType extends RawItem = RawItem>(options: {\n    modelKey: string;\n    listKey?: string;\n    listItemKeys?: string[];\n    query?: DcuplGlobalQueryOptions<ListItem>;\n  }): DcuplList<ListType> {\n    options.listKey = options.listKey || generateKey();\n\n    const cdRef = new ChangeDetector();\n\n    cdRef._init({\n      cdRefKey: options.listKey!,\n      parentCd: this.dcuplInstance['cdRef'],\n      dcuplInitOptions: this.dcuplInstance.initOptions,\n      analyticsController: this.dcuplInstance['analyticsController'],\n    });\n\n    const list = new DcuplList<ListType & ListItem>(this.dcuplInstance, cdRef);\n\n    list['init'](options);\n\n    this.lists.push(list);\n\n    return list as DcuplList<ListType>;\n  }\n}\n","import { ItemService } from '../catalog';\n\nimport { DcuplModel, ModelParser } from '../model-parser';\nimport {\n  AttributeNode,\n  DataContainer,\n  DcuplInitOptions,\n  ModelDefinition,\n  ListItem,\n  RawItem,\n  ViewDefinition,\n  ChangeDetector,\n  trigger,\n  DcuplGlobalItemOptions,\n  CallbackFunction,\n  DcuplQueryBuilder,\n  DcuplQueryGroup,\n  DcuplQuery,\n  DcuplGlobalQueryOptions,\n  generateKey,\n  DataOptions,\n  DcuplGlobalManyItemOptions,\n  AnalyticsController,\n  CustomOperatorFn,\n  QueryManager,\n  PivotResponse,\n  DcuplGlobalPivotOptions,\n  DcuplGlobalAggregateOptions,\n  Aggregation,\n  DcuplGlobalSuggestionOptions,\n  Suggestion,\n  DcuplGlobalGroupByOptions,\n  GroupByResponse,\n  DcuplGlobalFacetOptions,\n  FilterItemEntry,\n  ListMetadata,\n  DcuplGlobalMetadataOptions,\n  ScriptController,\n  EndpointScriptContext,\n  EndpointScriptRequest,\n  ReadOnlyDcupl,\n  clone,\n  QualityAnalyzer,\n  perf,\n  logger,\n  DcuplSealedError,\n} from '@dcupl/common';\nimport { ListsController } from './dcupl-list-controller';\nimport { cloneDeep, merge } from 'lodash-es';\nimport { DcuplList } from '../list';\nimport { QualityController } from '../quality/quality.controller';\n\n/**\n * Source metadata for a DataContainer carried via side channel from the loader.\n * Not part of the public DataContainer type — kept internal so SDK users\n * authoring containers programmatically don't need to populate these fields.\n */\nexport type ContainerSourceMetadata = {\n  sourceColumns: string[];\n  coercionFailureSamples: Record<string, { rawValue: string; expected: string; count: number }>;\n  /**\n   * Where the container data came from. For loader-fetched resources this is\n   * the resource URL; for inline `model.data` no metadata is registered and\n   * callers should fall back to `'inline'`. Surfaced in error `meta.origin`.\n   */\n  origin?: string;\n};\n\n/**\n * Options for update() method\n */\nexport type DcuplUpdateOptions = {\n  /**\n   * Override auto-update behavior for this specific update.\n   * - true: Force auto-update for all lists (even those configured as false)\n   * - false: Disable auto-update for all lists (even those configured as true)\n   * - undefined: Use list-level and global configuration\n   *\n   * Highest priority - overrides both list-level and global settings.\n   *\n   * Auto-update gates re-deriving a list's item set (a scoped list's query\n   * re-runs). Affected lists that do not auto-update still have their\n   * query/result caches dropped — lazily, recomputed on next read — so no\n   * list ever serves pre-update results (#239/#245).\n   * @default undefined\n   */\n  autoUpdateLists?: boolean;\n};\n\n/** Why seal() and an init() that seals refuse while a loader resource has not resolved (#332). */\nconst PENDING_RESOURCES = 'loader resources are still pending';\n/** ... and while rows or model changes were staged that no init()/update() has applied yet (#332). */\nconst UNAPPLIED_CHANGES = 'changes are staged but not applied';\n\nexport class DcuplApi<ModelNames extends string = string> {\n  protected cdRef = new ChangeDetector();\n  protected analyticsController = new AnalyticsController();\n  protected containerSourceMetadata: WeakMap<DataContainer, ContainerSourceMetadata> = new WeakMap();\n  protected scriptController = new ScriptController();\n  protected qualityController = new QualityController(this.scriptController);\n  private log = logger.child({ prefix: 'Dcupl' });\n  public modelParser = new ModelParser(this.cdRef, this.qualityController, this);\n  public globalItemService = new ItemService(this.modelParser, this.scriptController);\n\n  protected queryManager = new QueryManager<DcuplModel>(\n    this.scriptController,\n    this.globalItemService,\n    this.modelParser,\n  );\n\n  private _loaders = new Map<string, any>();\n  private rootQueryBuilder = new DcuplQueryBuilder();\n  private _defaultInitOptions: DcuplInitOptions = {\n    config: { projectId: undefined, apiKey: undefined, version: 'draft' },\n    errorTracking: {\n      enabled: false,\n    },\n    quality: {\n      enabled: true,\n    },\n    analytics: {\n      enabled: false,\n    },\n    performance: {\n      cache: {\n        enabled: true,\n      },\n      clone: {\n        enabled: true,\n      },\n      partialUpdates: {\n        modelRatioThreshold: 0.5,\n        itemRatioThreshold: 0.5,\n        enableDetailedLogging: false,\n      },\n      autoUpdateLists: {\n        enabled: false,\n      },\n      retainStagedData: true,\n    },\n    referenceMetadata: {\n      enabled: false,\n    },\n  };\n\n  public initOptions!: DcuplInitOptions;\n\n  public lists: ListsController = new ListsController(this, this.cdRef);\n\n  private busy: boolean = false; // Set until the update queue is drained\n  private initialized = false; // true after the first init() that built the models (#332)\n  private updateQueue: (() => Promise<void>)[] = []; // Pending applies; each settles its own caller\n\n  constructor(options?: DcuplInitOptions) {\n    this.analyticsController.init(!!options?.analytics?.enabled);\n\n    this.qualityController.dcupl = this as any; // Cast needed in constructor before 'this' is fully initialized\n    this.analyticsController.mark({ name: 'dcupl:constructor' });\n\n    this.initOptions = merge({}, this._defaultInitOptions, options);\n\n    // Set global quality controller flag\n    // This is enabled if EITHER errorTracking.enabled OR quality.enabled is true\n    // Note: Individual models can still disable validation via model.quality.enabled = false\n    this.qualityController.enabled =\n      this.initOptions.errorTracking?.enabled || this.initOptions.quality?.enabled || false;\n    this.qualityController.maxErrorsPerGroup = this.initOptions.quality?.maxErrorsPerGroup ?? 1000;\n\n    this.modelParser.initOptions = Object.assign({}, this.initOptions);\n\n    this.scriptController.enabled = this.initOptions.scripting?.enabled ?? true;\n    if (this.initOptions.scripting?.compile) {\n      this.scriptController.compiler = this.initOptions.scripting.compile;\n    }\n\n    this.cdRef._init({\n      cdRefKey: 'root',\n      dcuplInitOptions: this.initOptions,\n      analyticsController: this.analyticsController,\n    });\n  }\n\n  /** True after seal() / an init() with performance.retainStagedData: false (#332). */\n  public get sealed(): boolean {\n    return this.modelParser.sealed;\n  }\n\n  /**\n   * Drops the staged raw rows for good (#332): frees their memory, and from now on every data or\n   * model write throws DcuplSealedError while init()/update() resolve false. Reads are unaffected.\n   * Refuses (throws DcuplSealedError, changes nothing) before the first completed init(), while an\n   * apply is in flight, while a loader resource is still pending, or while staged rows or model\n   * changes are not applied yet (call `update()` first): sealing then would lose data that was\n   * never applied.\n   */\n  public seal(): void {\n    if (this.sealed) return;\n    if (!this.initialized) throw new DcuplSealedError('seal()', 'init() has not completed');\n    if (this.busy) throw new DcuplSealedError('seal()', 'an init() or update() is in flight');\n    const blocker = this.sealBlocker();\n    if (blocker) {\n      throw new DcuplSealedError('seal()', blocker === UNAPPLIED_CHANGES ? `${blocker}; call update() first` : blocker);\n    }\n    this.modelParser.seal();\n  }\n\n  /** A loader resource that registered its placeholder container and has not resolved yet. */\n  private hasPendingLoaderResources(): boolean {\n    return this.modelParser['unprocessedData'].some((container) => container.placeholderUid);\n  }\n\n  /**\n   * Rows or model changes (definition set/updated/removed, model dropped) staged since the last\n   * apply. The parser clears its change tracker and definition changes when an init()/update()\n   * completes and re-records what was staged while it ran, so this is false right after one.\n   */\n  private hasUnappliedChanges(): boolean {\n    return this.modelParser.changeTracker.hasChanges() || this.modelParser.getDefinitionChanges().length > 0;\n  }\n\n  /** Why the staged log cannot be dropped now because it holds data that was never applied; undefined if it can. */\n  private sealBlocker(): string | undefined {\n    if (this.hasPendingLoaderResources()) return PENDING_RESOURCES;\n    if (this.hasUnappliedChanges()) return UNAPPLIED_CHANGES;\n    return undefined;\n  }\n\n  /**\n   * First statement of every staging verb: a call on a sealed instance names itself in the error and\n   * changes nothing, where the parser's own guard would fire after e.g. `models.set` had already\n   * dropped the registered definition (#332).\n   */\n  private rejectWhenSealed(what: string): void {\n    if (this.sealed) {\n      throw new DcuplSealedError(what);\n    }\n  }\n\n  public models = {\n    /**\n     * A copy of the model's definition (#314): changing it does not change this instance. Inline\n     * `data` passed to `set`/`update` is not part of it (it is loaded like `data.set`).\n     */\n    get: (modelKey: ModelNames): ModelDefinition | undefined => {\n      return cloneDeep(this.modelParser.models.get(modelKey)?.getModelDefinition());\n    },\n    /**\n     * Registers `model` as the whole definition for its key: a definition registered earlier under\n     * the same key (by `set` or `update`) is replaced, so get → change → `set` edits a model and an\n     * attribute left out is removed. Takes effect on the next `init()` or `update()`; after init,\n     * that `update()` rebuilds all data like `init()`, and existing lists serve the new definition\n     * (#408). The instance keeps a copy, so later changes to `model` have no effect (#314). For a\n     * partial change, use `update`.\n     */\n    set: (model: ModelDefinition<ModelNames>): void => {\n      this.rejectWhenSealed('models.set');\n      this.modelParser.unprocessedModelDescriptions.delete(model.key);\n      this.modelParser.addModel(model);\n      if (this.modelParser.unprocessedModelDescriptions.has(model.key)) {\n        this.modelParser.markDefinitionChanged(model.key);\n        // an earlier rejected definition for the key no longer describes it (#417)\n        this.qualityController.removeRejectedDefinitionErrors(model.key);\n      } else {\n        // an invalid definition (quality error): nothing is registered under the key any more\n        this.modelParser.models.delete(model.key);\n      }\n    },\n    /**\n     * Merges `model` into the definition registered under its key (or registers it): scalar fields\n     * of `model` win, `properties` and `references` are appended, and an attribute declared twice\n     * keeps its first declaration (to change an attribute, use `set`). Takes effect on the next\n     * `init()` or `update()`; after init, that `update()` rebuilds all data like `init()` (#408).\n     * Stores a copy (#314).\n     */\n    update: (model: ModelDefinition<ModelNames>): void => {\n      this.rejectWhenSealed('models.update');\n      this.modelParser.addModel(model);\n      if (this.modelParser.unprocessedModelDescriptions.has(model.key)) {\n        this.modelParser.markDefinitionChanged(model.key);\n      }\n    },\n    /**\n     * Unregisters the model: its definition, its data (rows passed to `data.*` or inline) and its\n     * lists are gone at once, also when an `init()`/`update()` is running, and the next `init()` does\n     * not bring it back. Its errors leave `quality.errors.summary()` at once and the\n     * `$DcuplErrorTracking*` models on the next `init()`/`update()`. That run rebuilds all data like\n     * `init()` and resolves references to the model as to a missing model. A later `set` registers\n     * it again, without the old data (#420).\n     */\n    remove: (modelKey: ModelNames): void => {\n      this.rejectWhenSealed('models.remove');\n      this.lists.destroy({ modelKey });\n      this.modelParser.removeModel(modelKey);\n      this.qualityController.removeErrorsOfModel(modelKey);\n    },\n    keys: (): string[] => {\n      return this.modelParser._getModelKeys();\n    },\n  };\n\n  public quality = {\n    errors: {\n      /**\n       * Exact error totals per (model, attribute, errorType) group, including\n       * how many records were retained under `maxErrorsPerGroup` and whether\n       * the group was truncated. Also queryable as `$DcuplErrorTrackingSummary`.\n       */\n      summary: (): QualityAnalyzer.ErrorGroupSummary[] => {\n        return this.qualityController.getErrorSummary();\n      },\n    },\n  };\n\n  public views = {\n    /** A copy of the view's definition (#314): changing it does not change this instance. */\n    get: (viewKey: string): ViewDefinition | undefined => {\n      return cloneDeep(this.modelParser.views.get(viewKey));\n    },\n    keys: (options?: { modelKey: string }): string[] => {\n      return this.modelParser._getViewKeys(options);\n    },\n    /**\n     * Registers `view` as the whole definition for its key, replacing an earlier one. The instance\n     * keeps a copy, so later changes to `view` have no effect (#314).\n     */\n    set: (view: ViewDefinition): void => {\n      return this.modelParser.addView(view);\n    },\n    /** Unregisters the view. Takes effect at once; no `update()` is needed (#420). */\n    remove: (viewKey: string): void => {\n      this.modelParser.removeView(viewKey);\n    },\n  };\n\n  public data = {\n    update: (data: RawItem[], options: DataOptions): void => {\n      this.rejectWhenSealed('data.update');\n      this.modelParser.addData({\n        data,\n        model: options.model,\n        type: 'update',\n        keyProperty: options.keyProperty,\n        keyPropertySeparator: options.keyPropertySeparator,\n        autoGenerateKey: options.autoGenerateKey,\n      });\n    },\n    upsert: (data: RawItem[], options: DataOptions): void => {\n      this.rejectWhenSealed('data.upsert');\n      this.modelParser.addData({\n        data,\n        model: options.model,\n        type: 'upsert',\n        keyProperty: options.keyProperty,\n        keyPropertySeparator: options.keyPropertySeparator,\n        autoGenerateKey: options.autoGenerateKey,\n      });\n    },\n    set: (data: RawItem[], options: DataOptions): void => {\n      this.rejectWhenSealed('data.set');\n      this.modelParser.addData({\n        data,\n        model: options.model,\n        type: 'set',\n        keyProperty: options.keyProperty,\n        keyPropertySeparator: options.keyPropertySeparator,\n        autoGenerateKey: options.autoGenerateKey,\n      });\n    },\n    remove: (data: RawItem[], options: DataOptions): void => {\n      this.rejectWhenSealed('data.remove');\n      this.modelParser.addData({\n        data,\n        model: options.model,\n        type: 'remove',\n        keyProperty: options.keyProperty,\n        keyPropertySeparator: options.keyPropertySeparator,\n        autoGenerateKey: options.autoGenerateKey,\n      });\n    },\n    /**\n     * Stages the removal of every row of a model. Like the other data verbs\n     * it is applied by the next `update()`/`init()`, is folded in call order\n     * with mutations staged after it, and invalidates the affected lists\n     * through the normal update path. Equivalent to `data.set([], { model })`.\n     * Used to clear the built model directly, which the next apply undid by\n     * replaying the data log (#257).\n     */\n    reset: (options: { model: ModelNames }): void => {\n      this.rejectWhenSealed('data.reset');\n      if (options.model) {\n        this.modelParser.addData({ data: [], model: options.model, type: 'set' });\n      }\n    },\n    apply: (container: DataContainer<RawItem, ModelNames>): void => {\n      this.rejectWhenSealed('data.apply');\n      return this.modelParser.addData(container);\n    },\n  };\n\n  public loaders = {\n    add: (loader: any, key?: string): void => {\n      this.addLoader(loader, key);\n    },\n    remove: (key: string): void => {\n      this.rejectWhenSealed('loaders.remove');\n      this.removeLoader(key);\n    },\n    get: (key: string): any => {\n      return this._loaders.get(key);\n    },\n  };\n\n  public scripts = {\n    set: (key: string, script: string): void => {\n      this.scriptController.setScript(key, script);\n    },\n    remove: (key: string): void => {\n      this.scriptController.removeScript(key);\n    },\n    get: (key: string): string | undefined => {\n      return this.scriptController.getScript(key);\n    },\n    keys: (): string[] => {\n      return this.scriptController.keys();\n    },\n    execute: (key: string, options?: any): any => {\n      const args = {\n        dcupl: this,\n        options,\n      };\n      return this.scriptController.executeScript(key, 'script', args);\n    },\n    executeAsync: (key: string, options?: any): any => {\n      return new Promise((resolve, reject) => {\n        const args = {\n          dcupl: this,\n          options,\n          resolve,\n          reject,\n        };\n        return this.scriptController.executeScript(key, 'async_script', args);\n      });\n    },\n    /**\n     * Runs `key` in `endpoint` mode (#311): the script receives `{ dcupl, request, options }` where\n     * `dcupl` is the read-only facade of this instance, and its return value — awaited when it is a\n     * Promise — becomes the result. `request` is passed by reference (the host clones it).\n     * Rejects with `ScriptNotFoundError` for an unknown key — check `error.name === 'ScriptNotFound'`,\n     * not `instanceof`, since `@dcupl/core` bundles its own copy of `@dcupl/common` — and refuses\n     * like `execute` when scripting is disabled. Timeouts are the host's job: synchronous script\n     * code cannot be interrupted here.\n     */\n    executeEndpoint: async (\n      key: string,\n      request: EndpointScriptRequest,\n      options?: Record<string, unknown>,\n    ): Promise<unknown> => {\n      const args: EndpointScriptContext = { dcupl: this.getReadOnlyFacade(), request, options: options ?? {} };\n      const result: unknown = this.scriptController.executeScript(key, 'endpoint', args);\n      return await result;\n    },\n  };\n\n  private _readOnlyFacade?: ReadOnlyDcupl;\n\n  /**\n   * What an `endpoint` script sees as `dcupl` (#311): the read paths of this instance as closures\n   * over the real methods, frozen at every level, one object per instance. `data`, `init`,\n   * `update`, `lists`, `scripts.set` and `query.registerCustomOperator` are absent, so\n   * `dcupl.data.update(...)` is a `TypeError` inside the script.\n   *\n   * Every result is a deep copy whatever `performance.clone` says: with cloning off (the app\n   * runner's setting) the real query methods hand out live items, so a script could otherwise\n   * edit instance state through a result. Same `clone` as `@trigger({ cloneResult: true })`,\n   * forced on. `models.get`/`views.get` are passed through: they return copies already (#314).\n   */\n  private getReadOnlyFacade(): ReadOnlyDcupl {\n    if (!this._readOnlyFacade) {\n      const copy = <T>(value: T): T => clone(value, true);\n      this._readOnlyFacade = Object.freeze<ReadOnlyDcupl>({\n        query: Object.freeze({\n          one: <T extends ListItem = ListItem>(options: DcuplGlobalItemOptions<T>): T | null =>\n            copy(this.query.one<T>(options)),\n          many: <T extends ListItem = ListItem>(options: DcuplGlobalManyItemOptions<T>): T[] =>\n            copy(this.query.many<T>(options)),\n          execute: <T extends ListItem = ListItem>(options: DcuplGlobalQueryOptions<T>): T[] =>\n            copy(this.query.execute<T>(options)),\n          generate: (\n            modelKey: string,\n            query: DcuplQueryGroup | DcuplQuery | DcuplQuery[] | DcuplQueryGroup[],\n          ): DcuplGlobalQueryOptions<any> => copy(this.query.generate(modelKey, query)),\n        }),\n        fn: Object.freeze({\n          pivot: (options: DcuplGlobalPivotOptions): PivotResponse => copy(this.fn.pivot(options)),\n          aggregate: (options: DcuplGlobalAggregateOptions): Aggregation => copy(this.fn.aggregate(options)),\n          suggest: (options: DcuplGlobalSuggestionOptions): Suggestion[] => copy(this.fn.suggest(options)),\n          groupBy: (options: DcuplGlobalGroupByOptions): GroupByResponse => copy(this.fn.groupBy(options)),\n          facets: (options: DcuplGlobalFacetOptions): FilterItemEntry[] => copy(this.fn.facets(options)),\n          metadata: (options: DcuplGlobalMetadataOptions): ListMetadata => copy(this.fn.metadata(options)),\n        }),\n        models: Object.freeze({\n          get: (modelKey: string): ModelDefinition | undefined => this.models.get(modelKey as ModelNames),\n          keys: (): string[] => this.models.keys(),\n        }),\n        views: Object.freeze({\n          get: (viewKey: string): ViewDefinition | undefined => this.views.get(viewKey),\n          keys: (options?: { modelKey: string }): string[] => this.views.keys(options),\n        }),\n        scripts: Object.freeze({\n          keys: (): string[] => this.scripts.keys(),\n        }),\n      });\n    }\n    return this._readOnlyFacade;\n  }\n\n  public fn = {\n    pivot: (options: DcuplGlobalPivotOptions): PivotResponse => {\n      return this._pivot(options);\n    },\n    aggregate: (options: DcuplGlobalAggregateOptions): Aggregation => {\n      return this._aggregate(options);\n    },\n    suggest: (options: DcuplGlobalSuggestionOptions): Suggestion[] => {\n      return this._suggest(options);\n    },\n    groupBy: (options: DcuplGlobalGroupByOptions): GroupByResponse => {\n      return this._groupBy(options);\n    },\n    facets: (options: DcuplGlobalFacetOptions): FilterItemEntry[] => {\n      return this._facets(options);\n    },\n    metadata: (options: DcuplGlobalMetadataOptions): ListMetadata => {\n      return this._metadata(options);\n    },\n  };\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_pivot',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _pivot(options: DcuplGlobalPivotOptions): PivotResponse {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.pivot(options.options);\n    return result;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_aggregate',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _aggregate(options: DcuplGlobalAggregateOptions): Aggregation {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.aggregate(options.options);\n    return result;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_suggest',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _suggest(options: DcuplGlobalSuggestionOptions): Suggestion[] {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.suggest(options.options);\n    return result;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_groupBy',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _groupBy(options: DcuplGlobalGroupByOptions): GroupByResponse {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.groupBy(options.options);\n    return result;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_facets',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _facets(options: DcuplGlobalFacetOptions): FilterItemEntry[] {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.facets(options.options);\n    return result;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'fn_metadata',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _metadata(options: DcuplGlobalMetadataOptions): ListMetadata {\n    const list = this.getFnList(options);\n    const result = list.catalog.fn.metadata();\n    return result;\n  }\n\n  protected registerContainer(container: DataContainer): void {\n    this.rejectWhenSealed('loader resource');\n    this.modelParser.addData(container);\n  }\n\n  protected updateRegisteredContainer(container: DataContainer, sourceMetadata?: ContainerSourceMetadata): void {\n    this.rejectWhenSealed('loader resource');\n    const relevantContainer = this.modelParser['unprocessedData'].findIndex(\n      (c) => c.placeholderUid === container.placeholderUid,\n    );\n    if (relevantContainer > -1) {\n      delete container.placeholderUid;\n      if (!container.type) {\n        container.type = 'set';\n      }\n      this.modelParser['unprocessedData'][relevantContainer] = container;\n      // Resolving is a data change of its own: an apply that ran while the\n      // placeholder was pending consumed the placeholder's change record, and\n      // without a record a partial apply folds this data in unprocessed.\n      this.modelParser.changeTracker.recordDataChange(container);\n      if (sourceMetadata) {\n        this.containerSourceMetadata.set(container, sourceMetadata);\n      }\n    }\n  }\n\n  protected removeRegisteredContainer(container: DataContainer): void {\n    if (this.sealed) return; // the loader calls this on a resource's failure path; nothing is staged to remove\n    const relevantContainer = this.modelParser['unprocessedData'].findIndex(\n      (c) => c.placeholderUid === container.placeholderUid,\n    );\n    if (relevantContainer > -1) {\n      this.modelParser['unprocessedData'].splice(relevantContainer, 1);\n    }\n  }\n\n  public getContainerSourceMetadata(container: DataContainer): ContainerSourceMetadata | undefined {\n    return this.containerSourceMetadata.get(container);\n  }\n\n  /**\n   * Registers source metadata for a container. Used internally by the model\n   * parser to carry per-resource loader metadata onto a merged container\n   * (dcupl#197). Not part of the public SDK contract.\n   * @internal\n   */\n  public setContainerSourceMetadata(container: DataContainer, metadata: ContainerSourceMetadata): void {\n    this.containerSourceMetadata.set(container, metadata);\n  }\n\n  /**\n   * The hidden list that serves `fn.*` and `query.execute` for a model. It is reused across\n   * calls, so every call starts from a reset query and applies `options.query` as the whole\n   * (root) query: a query without `groupType` is evaluated as `'and'`, the same as in\n   * `query.execute` and `lists.create({ query })`, and the same call always returns the same\n   * result (#370). Only `groupType` and `queries` are taken from `options.query`.\n   */\n  private getFnList(options: { modelKey: string; query?: DcuplGlobalQueryOptions<any> }): DcuplList {\n    let list = this.lists.get(`__global_list__${options.modelKey}`);\n\n    if (!list) {\n      list = this.lists.create({\n        modelKey: options.modelKey,\n        listKey: `__global_list__${options.modelKey}`,\n      });\n    }\n\n    if (options.query) {\n      list.catalog.query.reset({ skipProcessing: true });\n      list.catalog.query.apply(\n        {\n          groupKey: 'root',\n          groupType: options.query.groupType ?? 'and',\n          queries: options.query.queries ?? [],\n        },\n        { mode: 'set' },\n      );\n    } else {\n      list.catalog.query.reset();\n    }\n\n    return list;\n  }\n\n  /**\n   * Snapshots the pending changes as one `model → changed attribute keys` map\n   * before the parser clears the tracker. Every effectively changed model is a\n   * key: a full reset (data.set) records no attribute changes and a deletion\n   * records its attribute changes only later, inside the parser, so both\n   * expand to all of the model's property and reference keys — which is what\n   * the parser itself treats as changed for them. Returns null when nothing\n   * is pending (a plain full rebuild).\n   */\n  private snapshotChangedAttributes(): Map<string, Set<string>> | null {\n    const changeTracker = this.modelParser.changeTracker;\n    if (!changeTracker.hasChanges()) {\n      return null;\n    }\n    const tracked = changeTracker.getChangedAttributes();\n    const snapshot = new Map<string, Set<string>>();\n    for (const modelKey of changeTracker.getEffectivelyChangedModels()) {\n      const attributeKeys = new Set(tracked.get(modelKey) ?? []);\n      if (attributeKeys.size === 0) {\n        const model = this.modelParser.models.get(modelKey);\n        for (const key of model?.properties.keys() ?? []) {\n          attributeKeys.add(key);\n        }\n        for (const key of model?.references.keys() ?? []) {\n          attributeKeys.add(key);\n        }\n      }\n      snapshot.set(modelKey, attributeKeys);\n    }\n    return snapshot;\n  }\n\n  /**\n   * Adds the models whose definition `models.set`/`models.update` changed since the last init to\n   * the changed attributes, with every attribute of the rebuilt model, so their lists are\n   * refreshed and the update event names them (#408).\n   */\n  private withRedefinedModels(\n    changed: Map<string, Set<string>> | null,\n    modelKeys: string[],\n  ): Map<string, Set<string>> | null {\n    if (modelKeys.length === 0) {\n      return changed;\n    }\n    const result = changed ?? new Map<string, Set<string>>();\n    for (const modelKey of modelKeys) {\n      const model = this.modelParser.models.get(modelKey);\n      const attributeKeys = result.get(modelKey) ?? new Set<string>();\n      for (const key of model?.properties.keys() ?? []) {\n        attributeKeys.add(key);\n      }\n      for (const key of model?.references.keys() ?? []) {\n        attributeKeys.add(key);\n      }\n      result.set(modelKey, attributeKeys);\n    }\n    return result;\n  }\n\n  /**\n   * Gets all models that are affected by changes to the specified models/attributes.\n   * Includes the changed models themselves, models that (transitively) reference\n   * them (their lists can observe the change through deep queries), and models\n   * reached through the attribute-level cascade (resolved/derived attributes\n   * live on models the reference graph does not point at) (#241).\n   */\n  private getAffectedModels(changedModels: Map<string, Set<string>>): string[] {\n    const affectedModels = new Set<string>(changedModels.keys());\n\n    const dependencyGraph = this.modelParser.dependencyGraph;\n    if (dependencyGraph) {\n      for (const modelKey of dependencyGraph.getImpactedNodes(Array.from(changedModels.keys()), 'downstream')) {\n        affectedModels.add(modelKey);\n      }\n    }\n\n    const attributeGraph = this.modelParser.attributeDependencyGraph;\n    if (attributeGraph) {\n      const changedNodes: AttributeNode[] = [];\n      for (const [modelKey, attributeKeys] of changedModels) {\n        for (const attributeKey of attributeKeys) {\n          changedNodes.push({ modelKey, attributeKey, type: 'property', processingStep: 1 });\n        }\n      }\n      for (const impacted of attributeGraph.getImpactedAttributes(changedNodes)) {\n        affectedModels.add(impacted.modelKey);\n      }\n    }\n\n    // Partial and full updates rebuild the error-tracking models (#368)\n    if (this.qualityController.enabled) {\n      for (const modelKey of this.modelParser.models.keys()) {\n        if (modelKey.startsWith('$DcuplErrorTracking')) {\n          affectedModels.add(modelKey);\n        }\n      }\n    }\n\n    return Array.from(affectedModels);\n  }\n\n  /**\n   * Update lists based on auto-update configuration and affected models.\n   *\n   * @param changeInfo - Information about changed/affected models (null for full updates)\n   * @param autoUpdateOverride - Per-update auto-update override\n   */\n  private updateFnLists(\n    changeInfo: { changedModels: string[]; affectedModels: string[] } | null,\n    autoUpdateOverride?: boolean,\n  ): void {\n    const enableLogging = this.initOptions.performance?.partialUpdates?.enableDetailedLogging ?? false;\n    const refreshedLists: DcuplList[] = [];\n    const affectedModels = changeInfo ? new Set(changeInfo.affectedModels) : null;\n\n    for (const list of this.lists.getAll()) {\n      // For partial updates, only touch affected lists\n      if (affectedModels && !this.isListAffectedByChanges(list, affectedModels)) {\n        if (enableLogging) {\n          this.log.debug('List skipped (not affected)', {\n            listKey: list.key,\n            modelKey: list.modelKey,\n          });\n        }\n        continue;\n      }\n\n      // One list's failing refresh (e.g. a throwing custom-operator script)\n      // must not abort invalidation of the remaining lists — the data change\n      // has already been committed at this point (#245).\n      try {\n        if (this.shouldAutoUpdateList(list, autoUpdateOverride)) {\n          if (enableLogging) {\n            this.log.debug('List auto-updating', {\n              listKey: list.key,\n              modelKey: list.modelKey,\n              affectedModels: changeInfo?.affectedModels ?? 'all',\n            });\n          }\n          list.update();\n        } else {\n          // Auto-update only gates re-deriving a scoped list's item set. An\n          // affected list must still drop its caches, or queries executed\n          // before this update keep serving pre-update results (#239).\n          if (enableLogging) {\n            this.log.debug('List caches invalidated (auto-update disabled)', {\n              listKey: list.key,\n              modelKey: list.modelKey,\n            });\n          }\n          list.invalidate();\n        }\n        refreshedLists.push(list);\n      } catch (err) {\n        this.log.error(`List refresh failed for '${list.key}'`, err as Error);\n      }\n    }\n\n    // The data change can have changed each refreshed list's result: announce\n    // it exactly once per list (#278). Emitted only after every affected list\n    // is refreshed, so a handler re-querying any list sees post-update\n    // results. Unaffected lists (partial path) were skipped above and stay\n    // silent; internal global lists have no subscribers.\n    for (const list of refreshedLists) {\n      if (list.key.startsWith('__global_list__')) {\n        continue;\n      }\n      try {\n        list.emitResultUpdated();\n      } catch (err) {\n        this.log.error(`result_updated handler failed for list '${list.key}'`, err as Error);\n      }\n    }\n  }\n\n  /**\n   * Determines if a list is affected by changes to specific models: its own\n   * model is affected, or one of the models its cached results were read\n   * through is. The model graph has no edges for resolved and derived\n   * references (they would make it cyclic), so a `project` list filtered on\n   * `memberships.user.daysInactive` is not downstream of `user` there — the\n   * list itself knows which models its dotted paths resolve (#284).\n   */\n  private isListAffectedByChanges(list: DcuplList, affectedModels: Set<string>): boolean {\n    if (affectedModels.has(list.modelKey)) {\n      return true;\n    }\n    for (const modelKey of list.getDependencyModels()) {\n      if (affectedModels.has(modelKey)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * Determines if auto-update should be enabled for a specific list.\n   * Priority: per-update > list-level > global\n   *\n   * @param list - The list to check\n   * @param perUpdateOverride - Optional per-update override from update() call\n   * @returns true if the list should auto-update, false otherwise\n   */\n  private shouldAutoUpdateList(list: DcuplList, perUpdateOverride?: boolean): boolean {\n    // Special case: Global lists always auto-update (backwards compatibility)\n    if (list.key.startsWith('__global_list__')) {\n      return true;\n    }\n\n    // Highest priority: per-update override\n    if (perUpdateOverride !== undefined) {\n      return perUpdateOverride;\n    }\n\n    // Medium priority: list-level configuration\n    if (list['options'].autoUpdate !== undefined) {\n      return list['options'].autoUpdate;\n    }\n\n    // Lowest priority: global configuration\n    return this.initOptions.performance?.autoUpdateLists?.enabled ?? false;\n  }\n\n  public query = {\n    one: <ItemType extends ListItem = ListItem>(options: DcuplGlobalItemOptions<ItemType>): ItemType | null => {\n      return this.getItem(options);\n    },\n    many: <ItemType extends ListItem = ListItem>(options: DcuplGlobalManyItemOptions<ItemType>): ItemType[] => {\n      return this._getManyItems(options);\n    },\n    execute: <ItemType extends ListItem = ListItem>(options: DcuplGlobalQueryOptions<ItemType>): ItemType[] => {\n      return this.executeQuery(options);\n    },\n    generate: (\n      modelKey: string,\n      query: DcuplQueryGroup | DcuplQuery | DcuplQuery[] | DcuplQueryGroup[],\n    ): DcuplGlobalQueryOptions<any> => {\n      this.rootQueryBuilder.init({ modelKey: modelKey });\n      return this.rootQueryBuilder.applyQuery(query);\n    },\n    registerCustomOperator: (operator: string, fn: CustomOperatorFn): void => {\n      this.queryManager.registerCustomOperator(operator, fn);\n    },\n  };\n\n  public on(cb: CallbackFunction): () => void {\n    return this.cdRef.on(cb);\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'dcupl_initialized',\n    connectMessage: true,\n  })\n  public async init(): Promise<boolean> {\n    try {\n      const sealAfterInit = this.initOptions.performance?.retainStagedData === false;\n      // why the build was not sealed, when it was built but sealing was refused (see below)\n      const notSealed = await this.performUpdate(async (): Promise<string | undefined> => {\n        // Under retainStagedData: false the build seals the instance, which a pending loader resource\n        // would lose: fail before building anything.\n        if (sealAfterInit && this.hasPendingLoaderResources()) {\n          throw new DcuplSealedError('init()', PENDING_RESOURCES);\n        }\n        await this.modelParser.init();\n        this.initialized = true;\n        if (!sealAfterInit) return undefined;\n        // Sealed inside the apply: this task still holds the queue (`busy`), which the public seal()\n        // refuses. The build yields, so a loader can register a resource and a caller can stage rows or\n        // model changes while it runs: sealing would drop what was never applied, so do not seal.\n        const blocker = this.sealBlocker();\n        if (blocker) return blocker;\n        this.modelParser.seal();\n        return undefined;\n      });\n      // Re-init is a supported flow: lists created before this init would\n      // otherwise keep serving pre-init results from their own caches (#245).\n      this.updateFnLists(null);\n      if (notSealed) {\n        // The build stands: say so, where \"init() is not available\" would read as a failed init().\n        throw new DcuplSealedError(\n          'init()',\n          notSealed,\n          `init() built the models but did not seal: ${notSealed}; call update(), then seal()`,\n        );\n      }\n      return true;\n    } catch (err) {\n      this.log.error('Initialization failed', err as Error);\n      return false;\n    }\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'dcupl_updated_manually',\n    action: 'update',\n    connectMessage: true,\n  })\n  public async update(options?: DcuplUpdateOptions): Promise<boolean> {\n    try {\n      // Snapshot the pending changes BEFORE the update — the parser clears\n      // the tracker — but when the apply starts, not when update() was\n      // called: a queued update applies everything staged until its turn.\n      // One map keyed by every effectively changed model (#245): the\n      // payload's changedModels is exactly changedAttributes.keys(), so no\n      // consumer has to special-case an empty attribute set.\n      // `path` is the route the parser took: dcupl_partial_update is also emitted when it fell\n      // back to a full rebuild, and its payload reported `isPartialUpdate: true` either way (#383).\n      // `start` is when this apply began (after any queue wait), so the event's `duration` is the\n      // apply plus the list refresh — it had none and came out as NaN.\n      const { changedAttributes, path, start, modelRemoved } = await this.performUpdate(async () => {\n        const applyStart = perf.now();\n        const snapshot = this.snapshotChangedAttributes();\n        const redefinedModels = this.modelParser.getDefinitionChanges();\n        const updatePath = await this.modelParser.update();\n        return {\n          changedAttributes: this.withRedefinedModels(snapshot, redefinedModels),\n          path: updatePath,\n          start: applyStart,\n          // a removed model is no longer in the dependency graph, so the lists that read it are not\n          // found as affected: refresh every list (#420)\n          modelRemoved: redefinedModels.some((modelKey) => !this.modelParser.models.has(modelKey)),\n        };\n      });\n\n      // Query/facet caches live per list (Filter.cacheCtrl, and Filter.projectionCacheCtrl for\n      // the projections of deep facets and deep filters) and are dropped lazily by updateFnLists →\n      // list.invalidate(); there is no global cache to invalidate here (#245).\n      if (changedAttributes) {\n        const changeInfo = {\n          isPartialUpdate: path === 'partial',\n          changedModels: Array.from(changedAttributes.keys()),\n          changedAttributes,\n          affectedModels: this.getAffectedModels(changedAttributes),\n        };\n\n        // Invalidate lists BEFORE announcing the update — the trigger is\n        // synchronous, and a subscriber re-querying a list in its handler\n        // must see post-update results (#245).\n        this.updateFnLists(modelRemoved ? null : changeInfo, options?.autoUpdateLists);\n\n        this.cdRef.trigger({\n          scope: 'global',\n          type: 'dcupl_partial_update',\n          args: [changeInfo],\n          start,\n        });\n      } else {\n        this.updateFnLists(null, options?.autoUpdateLists);\n      }\n\n      return true;\n    } catch (err) {\n      this.log.error('Update failed', err as Error);\n      return false;\n    }\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'dcupl_destroyed',\n    connectMessage: true,\n  })\n  public destroy(): void {\n    try {\n      this.lists.destroy();\n      this._loaders.forEach((loader) => {\n        loader.destroy();\n      });\n    } catch (_err) {\n      // Ignore destruction errors\n    }\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'query_one',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private getItem<ItemType = ListItem>(options: DcuplGlobalItemOptions<any>): ItemType | null {\n    this.modelParser.prepareModelForRead(options.modelKey);\n    const model = this.modelParser.models.get(options.modelKey);\n\n    if (!model) {\n      throw new Error();\n    }\n\n    return this.globalItemService.getItem(options.itemKey, model['data'], model, options) as ItemType | null;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'query_many',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private _getManyItems<ItemType = ListItem>(options: DcuplGlobalManyItemOptions<ItemType>): ItemType[] {\n    this.modelParser.prepareModelForRead(options.modelKey);\n    const model = this.modelParser.models.get(options.modelKey);\n\n    if (!model) {\n      throw new Error();\n    }\n    const items = this.globalItemService.getManyItems(options.itemKeys, model['data'], model, options);\n    return items as ItemType[];\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'query_execute',\n    cloneResult: true,\n    connectMessage: true,\n    connectMessageResult: true,\n  })\n  private executeQuery<ItemType extends ListItem = ListItem>(options?: DcuplGlobalQueryOptions<ItemType>): ItemType[] {\n    if (!options?.modelKey) {\n      throw new Error(`No modelKey provided`);\n    }\n    const list = this.getFnList({ modelKey: options?.modelKey });\n    const result = list.catalog.query.execute(options);\n    return result;\n  }\n\n  private addLoader(loader: any, key?: string): void {\n    const start = perf.now();\n    const loaderKey = key || generateKey();\n    this._loaders.set(loaderKey, loader);\n    loader.core = this;\n    loader.key = loaderKey;\n    const loaderCd = new ChangeDetector();\n    loaderCd._init({\n      cdRefKey: loaderKey,\n      parentCd: this.cdRef,\n      dcuplInitOptions: this.initOptions,\n      analyticsController: this.analyticsController,\n    });\n    loader.cdRef = loaderCd;\n\n    if (this.initOptions.config?.projectId) {\n      loader.defaultVariables.set('projectId', { key: 'projectId', value: this.initOptions.config?.projectId });\n    }\n    if (this.initOptions.config?.apiKey) {\n      loader.defaultVariables.set('apiKey', { key: 'apiKey', value: this.initOptions.config?.apiKey });\n    }\n    if (this.initOptions.config?.version) {\n      loader.defaultVariables.set('version', { key: 'version', value: this.initOptions.config?.version });\n    }\n\n    this.cdRef.trigger({ scope: 'global', type: 'loader_added', connectMessage: true, args: [loaderKey], start });\n  }\n  @trigger({\n    scope: 'global',\n    type: 'loader_removed',\n    connectMessage: true,\n  })\n  private removeLoader(key: string): void {\n    const loader = this._loaders.get(key);\n    if (loader) {\n      loader.destroy();\n    }\n    this._loaders.delete(key);\n  }\n\n  /**\n   * UPDATE QUEUE\n   *\n   * Every init()/update() apply runs through here, strictly one at a time and\n   * in call order. `busy` stays set until the queue is drained, so a call that\n   * arrives while queued applies are still running waits for its turn instead\n   * of running alongside them. Each queued entry settles its own caller's\n   * promise — resolve or reject — and never rejects itself, so a failing apply\n   * neither strands the applies queued behind it nor surfaces as an unhandled\n   * rejection. When idle, the apply starts synchronously, as before.\n   */\n\n  private performUpdate<T>(task: () => Promise<T>): Promise<T> {\n    return new Promise<T>((resolve, reject) => {\n      this.updateQueue.push(async () => {\n        try {\n          resolve(await task());\n        } catch (err) {\n          reject(err);\n        }\n      });\n\n      if (!this.busy) {\n        void this.processQueue();\n      }\n    });\n  }\n\n  private async processQueue(): Promise<void> {\n    this.busy = true;\n    try {\n      while (this.updateQueue.length > 0) {\n        await this.updateQueue.shift()!();\n      }\n    } finally {\n      this.busy = false;\n    }\n  }\n}\n","import { DcuplInitOptions } from '@dcupl/common';\n\nimport { DcuplApi } from './dcupl-api';\n\n/**\n * The version in packages/core/package.json. The build (packages/core/vite.config.ts) and the test\n * suite (packages/tests/vitest.config.ts) replace it via Vite's `define`, so the version that\n * `changeset version` writes is the one `Dcupl.version` reports.\n */\ndeclare const __DCUPL_CORE_VERSION__: string;\n\n/**\n * This is the dcupl core class. It is used to initialize the dcupl library.\n * @param options The options to initialize the dcupl library.\n * @example\n * ```ts\n * const dcupl = new Dcupl();\n * const dcupl = new Dcupl({\n *  config: {\n *   projectId: 'xxx',\n *   apiKey: 'yyy',\n *  },\n * });\n *\n * ```\n */\nexport class Dcupl<ModelKeys extends string = string> extends DcuplApi<ModelKeys> {\n  /** The installed `@dcupl/core` version, e.g. `2.0.0-beta.32`. dcupl Connect checks it. */\n  public version: string = __DCUPL_CORE_VERSION__;\n  constructor(options?: DcuplInitOptions) {\n    super(options);\n  }\n}\n"],"names":["DcuplList","dcuplApi","cdRef","options","model","listItemKeys","data","indicesController","Catalog","IndicesController","resolveCacheMaxSize","key","deepQueryService","item","modelData","_initialOptions","cloneDeep","itemKeys","filter","cb","msg","__decorateClass","trigger","ListsController","dcuplInstance","listKey","list","idx","generateKey","ChangeDetector","PENDING_RESOURCES","UNAPPLIED_CHANGES","DcuplApi","AnalyticsController","ScriptController","QualityController","logger","ModelParser","ItemService","QueryManager","DcuplQueryBuilder","merge","DcuplSealedError","blocker","container","what","modelKey","viewKey","view","loader","script","args","resolve","reject","request","copy","value","clone","query","sourceMetadata","relevantContainer","c","metadata","changeTracker","tracked","snapshot","attributeKeys","changed","modelKeys","result","changedModels","affectedModels","dependencyGraph","attributeGraph","changedNodes","attributeKey","impacted","changeInfo","autoUpdateOverride","enableLogging","refreshedLists","err","perUpdateOverride","operator","fn","sealAfterInit","notSealed","changedAttributes","path","start","modelRemoved","applyStart","perf","redefinedModels","updatePath","loaderKey","loaderCd","task","Dcupl"],"mappings":"qWAiBO,MAAMA,CAA8C,CAezD,YACUC,EACAC,EACR,CAFQ,KAAA,SAAAD,EACA,KAAA,MAAAC,CACP,CAFO,SACA,MAhBF,QACD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