@warp-drive/core 5.6.0-alpha.15 → 5.6.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/build-config/babel-macros.d.ts +1 -2
- package/declarations/build-config/canary-features.d.ts +1 -2
- package/declarations/build-config/debugging.d.ts +1 -2
- package/declarations/build-config/deprecations.d.ts +1 -2
- package/declarations/build-config/env.d.ts +1 -2
- package/declarations/build-config/macros.d.ts +1 -2
- package/declarations/build-config.d.ts +1 -2
- package/declarations/configure.d.ts +6 -7
- package/declarations/graph/-private/-diff.d.ts +21 -22
- package/declarations/graph/-private/-edge-definition.d.ts +134 -135
- package/declarations/graph/-private/-state.d.ts +93 -7
- package/declarations/graph/-private/-utils.d.ts +18 -13
- package/declarations/graph/-private/coerce-id.d.ts +6 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
- package/declarations/graph/-private/edges/collection.d.ts +35 -36
- package/declarations/graph/-private/edges/implicit.d.ts +28 -29
- package/declarations/graph/-private/edges/resource.d.ts +19 -20
- package/declarations/graph/-private/graph.d.ts +83 -48
- package/declarations/graph/-private/normalize-link.d.ts +7 -2
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
- package/declarations/graph/-private.d.ts +9 -10
- package/declarations/index.d.ts +11 -12
- package/declarations/reactive/-private/document.d.ts +143 -144
- package/declarations/reactive/-private/fields/compute.d.ts +31 -28
- package/declarations/reactive/-private/fields/extension.d.ts +2 -3
- package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
- package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
- package/declarations/reactive/-private/hooks.d.ts +3 -4
- package/declarations/reactive/-private/record.d.ts +61 -59
- package/declarations/reactive/-private/schema.d.ts +242 -224
- package/declarations/reactive/-private/symbols.d.ts +26 -1
- package/declarations/reactive/-private.d.ts +1 -2
- package/declarations/reactive.d.ts +4 -5
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +23 -24
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -157
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -124
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -6
- package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
- package/declarations/store/-private/cache-handler/types.d.ts +95 -96
- package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
- package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
- package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
- package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
- package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
- package/declarations/store/-private/debug/utils.d.ts +6 -7
- package/declarations/store/-private/default-cache-policy.d.ts +362 -361
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
- package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
- package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
- package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
- package/declarations/store/-private/network/request-cache.d.ts +86 -83
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +154 -155
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +253 -223
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -121
- package/declarations/store/-private/record-arrays/many-array.d.ts +180 -184
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
- package/declarations/store/-private/store-service.d.ts +1594 -1586
- package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
- package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +31 -28
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
- package/declarations/store/-types/q/ds-model.d.ts +17 -18
- package/declarations/store/-types/q/identifier.d.ts +11 -12
- package/declarations/store/-types/q/record-instance.d.ts +16 -17
- package/declarations/store/-types/q/schema-service.d.ts +346 -343
- package/declarations/store/-types/q/store.d.ts +25 -28
- package/declarations/store.d.ts +1 -2
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -32
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1713
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -11
- package/declarations/utils/string.d.ts +43 -40
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-D1C3Innj.js → handler-C2T-IyJK.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +42 -73
- package/dist/{request-state-CCOJIj5i.js → request-state-CjLph1LP.js} +275 -261
- package/dist/store/-private.js +2 -2
- package/dist/{symbols-epHW0Vm9.js → symbols-SIstXMLI.js} +1 -1
- package/dist/types/-private.js +1 -1
- package/package.json +4 -4
- package/declarations/build-config/babel-macros.d.ts.map +0 -1
- package/declarations/build-config/canary-features.d.ts.map +0 -1
- package/declarations/build-config/debugging.d.ts.map +0 -1
- package/declarations/build-config/deprecations.d.ts.map +0 -1
- package/declarations/build-config/env.d.ts.map +0 -1
- package/declarations/build-config/macros.d.ts.map +0 -1
- package/declarations/build-config.d.ts.map +0 -1
- package/declarations/configure.d.ts.map +0 -1
- package/declarations/graph/-private/-diff.d.ts.map +0 -1
- package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
- package/declarations/graph/-private/-state.d.ts.map +0 -1
- package/declarations/graph/-private/-utils.d.ts.map +0 -1
- package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
- package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
- package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
- package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
- package/declarations/graph/-private/graph.d.ts.map +0 -1
- package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
- package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
- package/declarations/graph/-private.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/reactive/-private/document.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/extension.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
- package/declarations/reactive/-private/hooks.d.ts.map +0 -1
- package/declarations/reactive/-private/record.d.ts.map +0 -1
- package/declarations/reactive/-private/schema.d.ts.map +0 -1
- package/declarations/reactive/-private/symbols.d.ts.map +0 -1
- package/declarations/reactive/-private.d.ts.map +0 -1
- package/declarations/reactive.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
- package/declarations/store/-private/debug/utils.d.ts.map +0 -1
- package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
- package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/declarations/store/-private/store-service.d.ts.map +0 -1
- package/declarations/store/-private/store-service.type-test.d.ts +0 -2
- package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
- package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
- package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
- package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/declarations/store/-private.d.ts.map +0 -1
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
- package/declarations/store/-types/q/identifier.d.ts.map +0 -1
- package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
- package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
- package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
- package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
- package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
- package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
- package/declarations/store/-types/q/store.d.ts.map +0 -1
- package/declarations/store.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/declarations/utils/string.d.ts.map +0 -1
- package/dist/build-config/babel-macros.js.map +0 -1
- package/dist/build-config/canary-features.js.map +0 -1
- package/dist/build-config/debugging.js.map +0 -1
- package/dist/build-config/deprecations.js.map +0 -1
- package/dist/build-config/env.js.map +0 -1
- package/dist/build-config/macros.js.map +0 -1
- package/dist/build-config.js.map +0 -1
- package/dist/configure-B48bFHOl.js.map +0 -1
- package/dist/configure.js.map +0 -1
- package/dist/context-COmAnXUQ.js.map +0 -1
- package/dist/graph/-private.js.map +0 -1
- package/dist/handler-D1C3Innj.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactive/-private.js.map +0 -1
- package/dist/reactive.js.map +0 -1
- package/dist/request-state-CCOJIj5i.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/store/-private.js.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/symbols-epHW0Vm9.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/string.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-state-CCOJIj5i.js","sources":["../src/store/-private/utils/coerce-id.ts","../src/store/-private/utils/normalize-model-name.ts","../src/store/-private/utils/uuid-polyfill.ts","../src/store/-private/caches/resource-utils.ts","../src/store/-private/caches/identifier-cache.ts","../src/store/-private/new-core-tmp/reactivity/internal.ts","../src/store/-private/new-core-tmp/reactivity/signal.ts","../src/reactive/-private/document.ts","../src/store/-private/debug/utils.ts","../src/store/-private/legacy-model-support/record-reference.ts","../src/store/-private/managers/cache-capabilities-manager.ts","../src/store/-private/caches/cache-utils.ts","../src/store/-private/caches/instance-cache.ts","../src/store/-private/legacy-model-support/shim-model-class.ts","../src/store/-private/managers/cache-manager.ts","../src/store/-private/managers/notification-manager.ts","../src/reactive/-private/fields/extension.ts","../src/store/-private/record-arrays/native-proxy-type-fix.ts","../src/store/-private/record-arrays/identifier-array.ts","../src/store/-private/managers/record-array-manager.ts","../src/store/-private/network/request-cache.ts","../src/store/-private/utils/is-non-empty-string.ts","../src/store/-private/utils/construct-resource.ts","../src/store/-private/store-service.ts","../src/store/-private/record-arrays/many-array.ts","../src/store/-private/new-core-tmp/promise-state.ts","../../../node_modules/.pnpm/decorat_e726cea2fd4487945e014da78f788773/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../src/store/-private/new-core-tmp/request-subscription.ts","../src/store/-private/new-core-tmp/request-state.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_ID } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\n// Used by the store to normalize IDs entering the store. Despite the fact\n// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),\n// it is important that internally we use strings, since IDs may be serialized\n// and lose type information. For example, Ember's router may put a record's\n// ID into the URL, and if we later try to deserialize that URL and find the\n// corresponding record, we will not know if it is a string or a number.\ntype Coercable = string | number | boolean | null | undefined | symbol;\n\nexport function coerceId(id: unknown): string | null {\n if (DEPRECATE_NON_STRICT_ID) {\n let normalized: string | null;\n if (id === null || id === undefined || id === '') {\n normalized = null;\n } else {\n normalized = String(id);\n }\n\n deprecate(\n `The resource id '<${typeof id}> ${String(\n id\n )} ' is not normalized. Update your application code to use '${JSON.stringify(normalized)}' instead.`,\n normalized === id,\n {\n id: 'ember-data:deprecate-non-strict-id',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return normalized;\n }\n\n assert(\n `Resource IDs must be a non-empty string or null. Received '${String(id)}'.`,\n id === null || (typeof id === 'string' && id.length > 0)\n );\n\n return id;\n}\n\nexport function ensureStringId(id: Coercable): string {\n let normalized: string | null = null;\n if (typeof id === 'string') {\n normalized = id.length > 0 ? id : null;\n } else if (typeof id === 'number' && !isNaN(id)) {\n normalized = String(id);\n }\n\n assert(`Expected id to be a string or number, received ${String(id)}`, normalized !== null);\n\n return normalized;\n}\n","import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\n\nimport { dasherize } from '../../../utils/string.ts';\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","interface FastbootCrypto {\n randomFillSync(v: Uint8Array): Uint8Array;\n}\n\ntype UUIDv4 = `${string}-${string}-${string}-${string}-${string}`;\n\nexport default function installPolyfill() {\n const isFastBoot = typeof FastBoot !== 'undefined';\n const CRYPTO: Crypto = isFastBoot ? (FastBoot.require('crypto') as Crypto) : globalThis.crypto;\n\n if (!CRYPTO.randomUUID) {\n // we might be able to optimize this by requesting more bytes than we need at a time\n const rng = function (): Uint8Array {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n const rnds8 = new Uint8Array(16);\n\n if (!CRYPTO.getRandomValues && !isFastBoot) {\n throw new Error(`Unable to generate bytes for UUID`);\n }\n\n return CRYPTO.getRandomValues\n ? CRYPTO.getRandomValues(rnds8)\n : (CRYPTO as unknown as FastbootCrypto).randomFillSync(rnds8);\n };\n\n /*\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n const byteToHex: string[] = [];\n for (let i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n }\n\n const bytesToUuid = function (buf: Uint8Array): UUIDv4 {\n const bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return [\n bth[buf[0]],\n bth[buf[1]],\n bth[buf[2]],\n bth[buf[3]],\n '-',\n bth[buf[4]],\n bth[buf[5]],\n '-',\n bth[buf[6]],\n bth[buf[7]],\n '-',\n bth[buf[8]],\n bth[buf[9]],\n '-',\n bth[buf[10]],\n bth[buf[11]],\n bth[buf[12]],\n bth[buf[13]],\n bth[buf[14]],\n bth[buf[15]],\n ].join('') as UUIDv4;\n };\n\n CRYPTO.randomUUID = function uuidv4(): UUIDv4 {\n const rnds = rng();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n return bytesToUuid(rnds);\n };\n }\n}\n","function isResource(resource: unknown): resource is Record<string, unknown> {\n return Boolean(resource && typeof resource === 'object');\n}\n\nfunction hasProp<T extends string, K extends { [J in T]: string }>(resource: unknown, prop: T): resource is K {\n return Boolean(\n isResource(resource) && prop in resource && typeof resource[prop] === 'string' && resource[prop].length\n );\n}\n\nexport function hasLid(resource: unknown): resource is { lid: string } {\n return hasProp(resource, 'lid');\n}\n\nexport function hasId(resource: unknown): resource is { id: string } {\n return (\n hasProp(resource, 'id') || Boolean(isResource(resource) && 'id' in resource && typeof resource.id === 'number')\n );\n}\n\nexport function hasType(resource: unknown): resource is { type: string } {\n return hasProp(resource, 'type');\n}\n","import { warn } from '@ember/debug';\n\nimport { getGlobalConfig, macroCondition } from '@embroider/macros';\n\nimport { LOG_IDENTIFIERS } from '@warp-drive/core/build-config/debugging';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport { getOrSetGlobal, peekTransient, setTransient } from '../../../types/-private.ts';\nimport {\n CACHE_OWNER,\n DEBUG_CLIENT_ORIGINATED,\n DEBUG_IDENTIFIER_BUCKET,\n DEBUG_STALE_CACHE_OWNER,\n type Identifier,\n type IdentifierBucket,\n type RecordIdentifier,\n type StableDocumentIdentifier,\n type StableExistingRecordIdentifier,\n type StableIdentifier,\n type StableRecordIdentifier,\n} from '../../../types/identifier.ts';\nimport type { ImmutableRequestInfo } from '../../../types/request.ts';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n ResourceIdentifierObject,\n} from '../../../types/spec/json-api-raw.ts';\nimport type {\n ForgetMethod,\n GenerationMethod,\n KeyInfo,\n KeyInfoMethod,\n ResetMethod,\n UpdateMethod,\n} from '../../-types/q/identifier.ts';\nimport { coerceId } from '../utils/coerce-id.ts';\nimport { normalizeModelName } from '../utils/normalize-model-name.ts';\nimport installPolyfill from '../utils/uuid-polyfill.ts';\nimport { hasId, hasLid, hasType } from './resource-utils.ts';\n\ntype ResourceData = unknown;\n\ntype TypeFromIdentifier<T> = T extends { type: infer U } ? U : string;\n\ntype NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject\n ? StableExistingRecordIdentifier<TypeFromIdentifier<T>>\n : StableRecordIdentifier;\n\nconst DOCUMENTS = getOrSetGlobal('DOCUMENTS', new Set());\n\nexport function isStableIdentifier(identifier: unknown): identifier is StableRecordIdentifier {\n return (identifier as StableRecordIdentifier)[CACHE_OWNER] !== undefined;\n}\n\nexport function isDocumentIdentifier(identifier: unknown): identifier is StableDocumentIdentifier {\n return DOCUMENTS.has(identifier);\n}\n\nconst isFastBoot = typeof FastBoot !== 'undefined';\nconst _crypto: Crypto = isFastBoot ? (FastBoot.require('crypto') as Crypto) : globalThis.crypto;\n\nif (macroCondition(getGlobalConfig<{ WarpDrive: { polyfillUUID: boolean } }>().WarpDrive.polyfillUUID)) {\n installPolyfill();\n}\n\nfunction uuidv4(): string {\n assert(\n 'crypto.randomUUID needs to be avaliable. Some browsers incorrectly disallow it in insecure contexts. You maybe want to enable the polyfill: https://github.com/emberjs/data#randomuuid-polyfill',\n typeof _crypto.randomUUID === 'function'\n );\n return _crypto.randomUUID();\n}\n\nfunction freeze<T>(obj: T): T {\n if (typeof Object.freeze === 'function') {\n return Object.freeze(obj);\n }\n return obj;\n}\n\ninterface KeyOptions {\n lid: IdentifierMap;\n id: IdentifierMap;\n}\ntype TypeMap = { [key: string]: KeyOptions };\n\n// type IdentifierTypeLookup = { all: Set<StableRecordIdentifier>; id: Map<string, StableRecordIdentifier> };\n// type IdentifiersByType = Map<string, IdentifierTypeLookup>;\ntype IdentifierMap = Map<string, StableRecordIdentifier>;\n\ntype StableCache = {\n resources: IdentifierMap;\n documents: Map<string, StableDocumentIdentifier>;\n resourcesByType: TypeMap;\n polymorphicLidBackMap: Map<string, string[]>;\n};\n\nexport type MergeMethod = (\n targetIdentifier: StableRecordIdentifier,\n matchedIdentifier: StableRecordIdentifier,\n resourceData: unknown\n) => StableRecordIdentifier;\n\n/**\n Configures how unique identifier lid strings are generated by @ember-data/store.\n\n This configuration MUST occur prior to the store instance being created.\n\n Takes a method which can expect to receive various data as its first argument\n and the name of a bucket as its second argument.\n\n Currently there are two buckets, 'record' and 'document'.\n\n ### Resource (`Record`) Identity\n\n If the bucket is `record` the method must return a unique (to at-least\n the given bucket) string identifier for the given data as a string to be\n used as the `lid` of an `Identifier` token.\n\n This method will only be called by either `getOrCreateRecordIdentifier` or\n `createIdentifierForNewRecord` when an identifier for the supplied data\n is not already known via `lid` or `type + id` combo and one needs to be\n generated or retrieved from a proprietary cache.\n\n `data` will be the same data argument provided to `getOrCreateRecordIdentifier`\n and in the `createIdentifierForNewRecord` case will be an object with\n only `type` as a key.\n\n ```ts\n import { setIdentifierGenerationMethod } from '@warp-drive/core';\n\n export function initialize(applicationInstance) {\n // note how `count` here is now scoped to the application instance\n // for our generation method by being inside the closure provided\n // by the initialize function\n let count = 0;\n\n setIdentifierGenerationMethod((resource, bucket) => {\n return resource.lid || `my-key-${count++}`;\n });\n }\n\n export default {\n name: 'configure-ember-data-identifiers',\n initialize\n };\n ```\n\n ### Document Identity\n\n If the bucket is `document` the method will receive the associated\n immutable `request` passed to `store.request` as its first argument\n and should return a unique string for the given request if the document\n should be cached, and `null` if it should not be cached.\n\n Note, the request result will still be passed to the cache via `Cache.put`,\n but caches should take this as a signal that the document should not itself\n be cached, while its contents may still be used to update other cache state.\n\n The presence of `cacheOptions.key` on the request will take precedence\n for the document cache key, and this method will not be called if it is\n present.\n\n The default method implementation for this bucket is to return `null`\n for all requests whose method is not `GET`, and to return the `url` for\n those where it is.\n\n This means that queries via `POST` MUST provide `cacheOptions.key` or\n implement this hook.\n\n ⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`\n\n @public\n*/\nexport function setIdentifierGenerationMethod(method: GenerationMethod | null): void {\n setTransient('configuredGenerationMethod', method);\n}\n\n/**\n Configure a callback for when the identifier cache encounters new resource\n data for an existing resource.\n\n This configuration MUST occur prior to the store instance being created.\n\n ```js\n import { setIdentifierUpdateMethod } from '@warp-drive/core';\n ```\n\n Takes a method which can expect to receive an existing `Identifier` alongside\n some new data to consider as a second argument. This is an opportunity\n for secondary lookup tables and caches associated with the identifier\n to be amended.\n\n This method is called everytime `updateRecordIdentifier` is called and\n with the same arguments. It provides the opportunity to update secondary\n lookup tables for existing identifiers.\n\n It will always be called after an identifier created with `createIdentifierForNewRecord`\n has been committed, or after an update to the `record` a `RecordIdentifier`\n is assigned to has been committed. Committed here meaning that the server\n has acknowledged the update (for instance after a call to `.save()`)\n\n If `id` has not previously existed, it will be assigned to the `Identifier`\n prior to this `UpdateMethod` being called; however, calls to the parent method\n `updateRecordIdentifier` that attempt to change the `id` or calling update\n without providing an `id` when one is missing will throw an error.\n\n @public\n*/\nexport function setIdentifierUpdateMethod(method: UpdateMethod | null): void {\n setTransient('configuredUpdateMethod', method);\n}\n\n/**\n Configure a callback for when the identifier cache is going to release an identifier.\n\n This configuration MUST occur prior to the store instance being created.\n\n ```js\n import { setIdentifierForgetMethod } from '@warp-drive/core';\n ```\n\n Takes method which can expect to receive an existing `Identifier` that should be eliminated\n from any secondary lookup tables or caches that the user has populated for it.\n\n @public\n*/\nexport function setIdentifierForgetMethod(method: ForgetMethod | null): void {\n setTransient('configuredForgetMethod', method);\n}\n\n/**\n Configure a callback for when the identifier cache is being torn down.\n\n This configuration MUST occur prior to the store instance being created.\n\n ```js\n import { setIdentifierResetMethod } from '@warp-drive/core';\n ```\n\n Takes a method which can expect to be called when the parent application is destroyed.\n\n If you have properly used a WeakMap to encapsulate the state of your customization\n to the application instance, you may not need to implement the `resetMethod`.\n\n @public\n*/\nexport function setIdentifierResetMethod(method: ResetMethod | null): void {\n setTransient('configuredResetMethod', method);\n}\n\n/**\n Configure a callback for when the identifier cache is generating a new\n StableRecordIdentifier for a resource.\n\n This method controls the `type` and `id` that will be assigned to the\n `StableRecordIdentifier` that is created.\n\n This configuration MUST occur prior to the store instance being created.\n\n ```js\n import { setKeyInfoForResource } from '@warp-drive/core';\n ```\n\n @public\n */\nexport function setKeyInfoForResource(method: KeyInfoMethod | null): void {\n setTransient('configuredKeyInfoMethod', method);\n}\n\nfunction assertIsRequest(request: unknown): asserts request is ImmutableRequestInfo {\n return;\n}\n\n// Map<type, Map<id, lid>>\ntype TypeIdMap = Map<string, Map<string, string>>;\n// TODO can we just delete this?\nconst NEW_IDENTIFIERS: TypeIdMap = new Map();\n// TODO @runspired maybe needs peekTransient ?\nlet IDENTIFIER_CACHE_ID = 0;\n\nfunction updateTypeIdMapping(typeMap: TypeIdMap, identifier: StableRecordIdentifier, id: string): void {\n let idMap = typeMap.get(identifier.type);\n if (!idMap) {\n idMap = new Map();\n typeMap.set(identifier.type, idMap);\n }\n idMap.set(id, identifier.lid);\n}\n\nfunction defaultUpdateMethod(identifier: StableRecordIdentifier, data: unknown, bucket: 'record'): void;\nfunction defaultUpdateMethod(identifier: StableIdentifier, newData: unknown, bucket: never): void;\nfunction defaultUpdateMethod(\n identifier: StableIdentifier | StableRecordIdentifier,\n data: unknown,\n bucket: 'record'\n): void {\n if (bucket === 'record') {\n assert(`Expected identifier to be a StableRecordIdentifier`, isStableIdentifier(identifier));\n if (!identifier.id && hasId(data)) {\n updateTypeIdMapping(NEW_IDENTIFIERS, identifier, data.id);\n }\n }\n}\n\nfunction defaultKeyInfoMethod(resource: unknown, known: StableRecordIdentifier | null): KeyInfo {\n // TODO RFC something to make this configurable\n const id = hasId(resource) ? coerceId(resource.id) : null;\n const type = hasType(resource) ? normalizeModelName(resource.type) : known ? known.type : null;\n\n assert(`Expected keyInfoForResource to provide a type for the resource`, type);\n\n return { type, id };\n}\n\nfunction defaultGenerationMethod(data: ImmutableRequestInfo, bucket: 'document'): string | null;\nfunction defaultGenerationMethod(data: ResourceData | { type: string }, bucket: 'record'): string;\nfunction defaultGenerationMethod(\n data: ImmutableRequestInfo | ResourceData | { type: string },\n bucket: IdentifierBucket\n): string | null {\n if (bucket === 'record') {\n if (hasLid(data)) {\n return data.lid;\n }\n\n assert(`Cannot generate an identifier for a resource without a type`, hasType(data));\n\n if (hasId(data)) {\n const type = normalizeModelName(data.type);\n const lid = NEW_IDENTIFIERS.get(type)?.get(data.id);\n\n return lid || `@lid:${type}-${data.id}`;\n }\n\n return uuidv4();\n } else if (bucket === 'document') {\n assertIsRequest(data);\n if (!data.url) {\n return null;\n }\n if (!data.method || data.method.toUpperCase() === 'GET') {\n return data.url;\n }\n return null;\n }\n assert(`Unknown bucket ${bucket as string}`, false);\n}\n\nfunction defaultEmptyCallback(...args: unknown[]): void {}\nfunction defaultMergeMethod(\n a: StableRecordIdentifier,\n _b: StableRecordIdentifier,\n _c: unknown\n): StableRecordIdentifier {\n return a;\n}\n\nlet DEBUG_MAP: WeakMap<StableRecordIdentifier, StableRecordIdentifier>;\nif (DEBUG) {\n DEBUG_MAP = getOrSetGlobal('DEBUG_MAP', new WeakMap<StableRecordIdentifier, StableRecordIdentifier>());\n}\n\n/**\n * Each instance of {Store} receives a unique instance of a IdentifierCache.\n *\n * This cache is responsible for assigning or retrieving the unique identify\n * for arbitrary resource data encountered by the store. Data representing\n * a unique resource or record should always be represented by the same\n * identifier.\n *\n * It can be configured by consuming applications.\n *\n * @class IdentifierCache\n @public\n */\nexport class IdentifierCache {\n declare _cache: StableCache;\n declare _generate: GenerationMethod;\n declare _update: UpdateMethod;\n declare _forget: ForgetMethod;\n declare _reset: ResetMethod;\n declare _merge: MergeMethod;\n declare _keyInfoForResource: KeyInfoMethod;\n declare _id: number;\n\n constructor() {\n // we cache the user configuredGenerationMethod at init because it must\n // be configured prior and is not allowed to be changed\n this._generate =\n peekTransient<GenerationMethod>('configuredGenerationMethod') || (defaultGenerationMethod as GenerationMethod);\n this._update = peekTransient<UpdateMethod>('configuredUpdateMethod') || defaultUpdateMethod;\n this._forget = peekTransient<ForgetMethod>('configuredForgetMethod') || defaultEmptyCallback;\n this._reset = peekTransient<ResetMethod>('configuredResetMethod') || defaultEmptyCallback;\n this._merge = defaultMergeMethod;\n this._keyInfoForResource = peekTransient<KeyInfoMethod>('configuredKeyInfoMethod') || defaultKeyInfoMethod;\n this._id = IDENTIFIER_CACHE_ID++;\n\n this._cache = {\n resources: new Map<string, StableRecordIdentifier>(),\n resourcesByType: Object.create(null) as TypeMap,\n documents: new Map<string, StableDocumentIdentifier>(),\n polymorphicLidBackMap: new Map<string, string[]>(),\n };\n }\n\n /**\n * Internal hook to allow management of merge conflicts with identifiers.\n *\n * we allow late binding of this private internal merge so that\n * the cache can insert itself here to handle elimination of duplicates\n *\n * @private\n */\n __configureMerge(method: MergeMethod | null) {\n this._merge = method || defaultMergeMethod;\n }\n\n upgradeIdentifier(resource: { type: string; id: string | null; lid?: string }): StableRecordIdentifier {\n return this._getRecordIdentifier(resource, 2);\n }\n\n /**\n * @private\n */\n _getRecordIdentifier(\n resource: { type: string; id: string | null; lid?: string },\n shouldGenerate: 2\n ): StableRecordIdentifier;\n _getRecordIdentifier(resource: unknown, shouldGenerate: 1): StableRecordIdentifier;\n _getRecordIdentifier(resource: unknown, shouldGenerate: 0): StableRecordIdentifier | undefined;\n _getRecordIdentifier(resource: unknown, shouldGenerate: 0 | 1 | 2): StableRecordIdentifier | undefined {\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(`Identifiers: ${shouldGenerate ? 'Generating' : 'Peeking'} Identifier`, resource);\n }\n // short circuit if we're already the stable version\n if (isStableIdentifier(resource)) {\n if (DEBUG) {\n // TODO should we instead just treat this case as a new generation skipping the short circuit?\n if (!this._cache.resources.has(resource.lid) || this._cache.resources.get(resource.lid) !== resource) {\n throw new Error(`The supplied identifier ${JSON.stringify(resource)} does not belong to this store instance`);\n }\n }\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: cache HIT - Stable ${resource.lid}`);\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n return resource;\n }\n\n // the resource is unknown, ask the application to identify this data for us\n const lid = this._generate(resource, 'record');\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: ${lid ? 'no ' : ''}lid ${lid ? lid + ' ' : ''}determined for resource`, resource);\n }\n\n let identifier: StableRecordIdentifier | null = /*#__NOINLINE__*/ getIdentifierFromLid(this._cache, lid, resource);\n if (identifier !== null) {\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n return identifier;\n }\n\n if (shouldGenerate === 0) {\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n return;\n }\n\n // if we still don't have an identifier, time to generate one\n if (shouldGenerate === 2) {\n (resource as StableRecordIdentifier).lid = lid;\n (resource as StableRecordIdentifier)[CACHE_OWNER] = this._id;\n identifier = /*#__NOINLINE__*/ makeStableRecordIdentifier(resource as StableRecordIdentifier, 'record', false);\n } else {\n // we lie a bit here as a memory optimization\n const keyInfo = this._keyInfoForResource(resource, null) as StableRecordIdentifier;\n keyInfo.lid = lid;\n keyInfo[CACHE_OWNER] = this._id;\n identifier = /*#__NOINLINE__*/ makeStableRecordIdentifier(keyInfo, 'record', false);\n }\n\n addResourceToCache(this._cache, identifier);\n\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n\n return identifier;\n }\n\n /**\n * allows us to peek without generating when needed\n * useful for the \"create\" case when we need to see if\n * we are accidentally overwritting something\n *\n * @param resource\n * @return {StableRecordIdentifier | undefined}\n * @private\n */\n peekRecordIdentifier(resource: ResourceIdentifierObject | Identifier): StableRecordIdentifier | undefined {\n return this._getRecordIdentifier(resource, 0);\n }\n\n /**\n Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.\n Returns `null` if the request does not have a `cacheKey` or `url`.\n\n @param request\n @return {StableDocumentIdentifier | null}\n @public\n */\n getOrCreateDocumentIdentifier(request: ImmutableRequestInfo): StableDocumentIdentifier | null {\n let cacheKey: string | null | undefined = request.cacheOptions?.key;\n\n if (!cacheKey) {\n cacheKey = this._generate(request, 'document');\n }\n\n if (!cacheKey) {\n return null;\n }\n\n let identifier = this._cache.documents.get(cacheKey);\n\n if (identifier === undefined) {\n identifier = { lid: cacheKey };\n if (DEBUG) {\n Object.freeze(identifier);\n }\n DOCUMENTS.add(identifier);\n this._cache.documents.set(cacheKey, identifier);\n }\n\n return identifier;\n }\n\n /**\n Returns the Identifier for the given Resource, creates one if it does not yet exist.\n\n Specifically this means that we:\n\n - validate the `id` `type` and `lid` combo against known identifiers\n - return an object with an `lid` that is stable (repeated calls with the same\n `id` + `type` or `lid` will return the same `lid` value)\n - this referential stability of the object itself is guaranteed\n\n @param resource\n @return {StableRecordIdentifier}\n @public\n */\n getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T> {\n return this._getRecordIdentifier(resource as unknown, 1) as NarrowIdentifierIfPossible<T>;\n }\n\n /**\n Returns a new Identifier for the supplied data. Call this method to generate\n an identifier when a new resource is being created local to the client and\n potentially does not have an `id`.\n\n Delegates generation to the user supplied `GenerateMethod` if one has been provided\n with the signature `generateMethod({ type }, 'record')`.\n\n @param data\n @return {StableRecordIdentifier}\n @public\n */\n createIdentifierForNewRecord(data: { type: string; id?: string | null }): StableRecordIdentifier {\n const newLid = this._generate(data, 'record');\n const identifier = /*#__NOINLINE__*/ makeStableRecordIdentifier(\n { id: data.id || null, type: data.type, lid: newLid, [CACHE_OWNER]: this._id },\n 'record',\n true\n );\n\n // populate our unique table\n if (DEBUG) {\n if (this._cache.resources.has(identifier.lid)) {\n throw new Error(`The lid generated for the new record is not unique as it matches an existing identifier`);\n }\n }\n\n /*#__NOINLINE__*/ addResourceToCache(this._cache, identifier);\n\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: created identifier ${String(identifier)} for newly generated resource`, data);\n }\n\n return identifier;\n }\n\n /**\n Provides the opportunity to update secondary lookup tables for existing identifiers\n Called after an identifier created with `createIdentifierForNewRecord` has been\n committed.\n\n Assigned `id` to an `Identifier` if `id` has not previously existed; however,\n attempting to change the `id` or calling update without providing an `id` when\n one is missing will throw an error.\n\n - sets `id` (if `id` was previously `null`)\n - `lid` and `type` MUST NOT be altered post creation\n\n If a merge occurs, it is possible the returned identifier does not match the originally\n provided identifier. In this case the abandoned identifier will go through the usual\n `forgetRecordIdentifier` codepaths.\n\n @param identifierObject\n @param data\n @return {StableRecordIdentifier}\n @public\n */\n updateRecordIdentifier(identifierObject: RecordIdentifier, data: unknown): StableRecordIdentifier {\n let identifier = this.getOrCreateRecordIdentifier(identifierObject);\n\n const keyInfo = this._keyInfoForResource(data, identifier);\n let existingIdentifier = /*#__NOINLINE__*/ detectMerge(this._cache, keyInfo, identifier, data);\n const hadLid = hasLid(data);\n\n if (!existingIdentifier) {\n // If the incoming type does not match the identifier type, we need to create an identifier for the incoming\n // data so we can merge the incoming data with the existing identifier, see #7325 and #7363\n if (identifier.type !== keyInfo.type) {\n if (hadLid) {\n // Strip the lid to ensure we force a new identifier creation\n delete (data as { lid?: string }).lid;\n }\n existingIdentifier = this.getOrCreateRecordIdentifier(data);\n }\n }\n\n if (existingIdentifier) {\n const generatedIdentifier = identifier;\n identifier = this._mergeRecordIdentifiers(keyInfo, generatedIdentifier, existingIdentifier, data);\n\n // make sure that the `lid` on the data we are processing matches the lid we kept\n if (hadLid) {\n data.lid = identifier.lid;\n }\n\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(\n `Identifiers: merged identifiers ${generatedIdentifier.lid} and ${existingIdentifier.lid} for resource into ${identifier.lid}`,\n data\n );\n }\n }\n\n const id = identifier.id;\n /*#__NOINLINE__*/ performRecordIdentifierUpdate(identifier, keyInfo, data, this._update);\n const newId = identifier.id;\n\n // add to our own secondary lookup table\n if (id !== newId && newId !== null) {\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(\n `Identifiers: updated id for identifier ${identifier.lid} from '${String(id)}' to '${String(\n newId\n )}' for resource`,\n data\n );\n }\n\n const typeSet = this._cache.resourcesByType[identifier.type];\n assert(`Expected to find a typeSet for ${identifier.type}`, typeSet);\n typeSet.id.set(newId, identifier);\n\n if (id !== null) {\n typeSet.id.delete(id);\n }\n } else if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: updated identifier ${identifier.lid} resource`, data);\n }\n\n return identifier;\n }\n\n /**\n * @private\n */\n _mergeRecordIdentifiers(\n keyInfo: KeyInfo,\n identifier: StableRecordIdentifier,\n existingIdentifier: StableRecordIdentifier,\n data: unknown\n ): StableRecordIdentifier {\n assert(`Expected keyInfo to contain an id`, hasId(keyInfo));\n // delegate determining which identifier to keep to the configured MergeMethod\n const kept = this._merge(identifier, existingIdentifier, data);\n const abandoned = kept === identifier ? existingIdentifier : identifier;\n\n // get any backreferences before forgetting this identifier, as it will be removed from the cache\n // and we will no longer be able to find them\n const abandonedBackReferences = this._cache.polymorphicLidBackMap.get(abandoned.lid);\n // delete the backreferences for the abandoned identifier so that forgetRecordIdentifier\n // does not try to remove them.\n if (abandonedBackReferences) this._cache.polymorphicLidBackMap.delete(abandoned.lid);\n\n // cleanup the identifier we no longer need\n this.forgetRecordIdentifier(abandoned);\n\n // ensure a secondary cache entry for the original lid for the abandoned identifier\n this._cache.resources.set(abandoned.lid, kept);\n\n // backReferences let us know which other identifiers are pointing at this identifier\n // so we can delete them later if we forget this identifier\n const keptBackReferences = this._cache.polymorphicLidBackMap.get(kept.lid) ?? [];\n keptBackReferences.push(abandoned.lid);\n\n // update the backreferences from the abandoned identifier to be for the kept identifier\n if (abandonedBackReferences) {\n abandonedBackReferences.forEach((lid) => {\n keptBackReferences.push(lid);\n this._cache.resources.set(lid, kept);\n });\n }\n\n this._cache.polymorphicLidBackMap.set(kept.lid, keptBackReferences);\n return kept;\n }\n\n /**\n Provides the opportunity to eliminate an identifier from secondary lookup tables\n as well as eliminates it from ember-data's own lookup tables and book keeping.\n\n Useful when a record has been deleted and the deletion has been persisted and\n we do not care about the record anymore. Especially useful when an `id` of a\n deleted record might be reused later for a new record.\n\n @param identifierObject\n @public\n */\n forgetRecordIdentifier(identifierObject: RecordIdentifier): void {\n const identifier = this.getOrCreateRecordIdentifier(identifierObject);\n const typeSet = this._cache.resourcesByType[identifier.type];\n assert(`Expected to find a typeSet for ${identifier.type}`, typeSet);\n\n if (identifier.id !== null) {\n typeSet.id.delete(identifier.id);\n }\n this._cache.resources.delete(identifier.lid);\n typeSet.lid.delete(identifier.lid);\n\n const backReferences = this._cache.polymorphicLidBackMap.get(identifier.lid);\n if (backReferences) {\n backReferences.forEach((lid) => {\n this._cache.resources.delete(lid);\n });\n this._cache.polymorphicLidBackMap.delete(identifier.lid);\n }\n\n if (DEBUG) {\n identifier[DEBUG_STALE_CACHE_OWNER] = identifier[CACHE_OWNER];\n }\n identifier[CACHE_OWNER] = undefined;\n this._forget(identifier, 'record');\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: released identifier ${identifierObject.lid}`);\n }\n }\n\n destroy() {\n NEW_IDENTIFIERS.clear();\n this._cache.documents.forEach((identifier) => {\n DOCUMENTS.delete(identifier);\n });\n this._reset();\n }\n}\n\nfunction makeStableRecordIdentifier(\n recordIdentifier: {\n type: string;\n id: string | null;\n lid: string;\n [CACHE_OWNER]: number | undefined;\n },\n bucket: IdentifierBucket,\n clientOriginated: boolean\n): StableRecordIdentifier {\n if (DEBUG) {\n // we enforce immutability in dev\n // but preserve our ability to do controlled updates to the reference\n let wrapper = {\n type: recordIdentifier.type,\n lid: recordIdentifier.lid,\n get id() {\n return recordIdentifier.id;\n },\n } as StableRecordIdentifier;\n const proto = {\n get [CACHE_OWNER](): number | undefined {\n return recordIdentifier[CACHE_OWNER];\n },\n set [CACHE_OWNER](value: number) {\n recordIdentifier[CACHE_OWNER] = value;\n },\n get [DEBUG_STALE_CACHE_OWNER](): number | undefined {\n return (recordIdentifier as StableRecordIdentifier)[DEBUG_STALE_CACHE_OWNER];\n },\n set [DEBUG_STALE_CACHE_OWNER](value: number | undefined) {\n (recordIdentifier as StableRecordIdentifier)[DEBUG_STALE_CACHE_OWNER] = value;\n },\n get [DEBUG_CLIENT_ORIGINATED]() {\n return clientOriginated;\n },\n get [DEBUG_IDENTIFIER_BUCKET]() {\n return bucket;\n },\n };\n Object.defineProperty(proto, 'toString', {\n enumerable: false,\n value: () => {\n const { type, id, lid } = recordIdentifier;\n return `${clientOriginated ? '[CLIENT_ORIGINATED] ' : ''}${String(type)}:${String(id)} (${lid})`;\n },\n });\n Object.defineProperty(proto, 'toJSON', {\n enumerable: false,\n value: () => {\n const { type, id, lid } = recordIdentifier;\n return { type, id, lid };\n },\n });\n Object.setPrototypeOf(wrapper, proto);\n DEBUG_MAP.set(wrapper, recordIdentifier);\n wrapper = freeze(wrapper);\n return wrapper;\n }\n\n return recordIdentifier;\n}\n\nfunction performRecordIdentifierUpdate(\n identifier: StableRecordIdentifier,\n keyInfo: KeyInfo,\n data: unknown,\n updateFn: UpdateMethod\n) {\n if (DEBUG) {\n const { id, type } = keyInfo;\n\n // get the mutable instance behind our proxy wrapper\n const wrapper = identifier;\n identifier = DEBUG_MAP.get(wrapper)!;\n\n if (hasLid(data)) {\n const lid = data.lid;\n if (lid !== identifier.lid) {\n throw new Error(\n `The 'lid' for a RecordIdentifier cannot be updated once it has been created. Attempted to set lid for '${wrapper.lid}' to '${lid}'.`\n );\n }\n }\n\n if (id && identifier.id !== null && identifier.id !== id) {\n // here we warn and ignore, as this may be a mistake, but we allow the user\n // to have multiple cache-keys pointing at a single lid so we cannot error\n warn(\n `The 'id' for a RecordIdentifier should not be updated once it has been set. Attempted to set id for '${wrapper.lid}' to '${id}'.`,\n false,\n { id: 'ember-data:multiple-ids-for-identifier' }\n );\n }\n\n // TODO consider just ignoring here to allow flexible polymorphic support\n if (type && type !== identifier.type) {\n throw new Error(\n `The 'type' for a RecordIdentifier cannot be updated once it has been set. Attempted to set type for '${wrapper.lid}' to '${type}'.`\n );\n }\n\n updateFn(wrapper, data, 'record');\n } else {\n updateFn(identifier, data, 'record');\n }\n\n // upgrade the ID, this is a \"one time only\" ability\n // for the multiple-cache-key scenario we \"could\"\n // use a heuristic to guess the best id for display\n // (usually when `data.id` is available and `data.attributes` is not)\n if ((data as ExistingResourceObject).id !== undefined) {\n identifier.id = coerceId((data as ExistingResourceObject).id);\n }\n}\n\nfunction detectMerge(\n cache: StableCache,\n keyInfo: KeyInfo,\n identifier: StableRecordIdentifier,\n data: unknown\n): StableRecordIdentifier | false {\n const newId = keyInfo.id;\n const { id, type, lid } = identifier;\n const typeSet = cache.resourcesByType[identifier.type];\n\n // if the IDs are present but do not match\n // then check if we have an existing identifier\n // for the newer ID.\n if (id !== null && id !== newId && newId !== null) {\n const existingIdentifier = typeSet && typeSet.id.get(newId);\n\n return existingIdentifier !== undefined ? existingIdentifier : false;\n } else {\n const newType = keyInfo.type;\n\n // If the ids and type are the same but lid is not the same, we should trigger a merge of the identifiers\n // we trigger a merge of the identifiers\n // though probably we should just throw an error here\n if (id !== null && id === newId && newType === type && hasLid(data) && data.lid !== lid) {\n return getIdentifierFromLid(cache, data.lid, data) || false;\n\n // If the lids are the same, and ids are the same, but types are different we should trigger a merge of the identifiers\n } else if (id !== null && id === newId && newType && newType !== type && hasLid(data) && data.lid === lid) {\n const newTypeSet = cache.resourcesByType[newType];\n const existingIdentifier = newTypeSet && newTypeSet.id.get(newId);\n\n return existingIdentifier !== undefined ? existingIdentifier : false;\n }\n }\n\n return false;\n}\n\nfunction getIdentifierFromLid(cache: StableCache, lid: string, resource: unknown): StableRecordIdentifier | null {\n const identifier = cache.resources.get(lid);\n if (LOG_IDENTIFIERS) {\n // eslint-disable-next-line no-console\n console.log(`Identifiers: cache ${identifier ? 'HIT' : 'MISS'} - Non-Stable ${lid}`, resource);\n }\n return identifier || null;\n}\n\nfunction addResourceToCache(cache: StableCache, identifier: StableRecordIdentifier): void {\n cache.resources.set(identifier.lid, identifier);\n let typeSet = cache.resourcesByType[identifier.type];\n\n if (!typeSet) {\n typeSet = { lid: new Map(), id: new Map() };\n cache.resourcesByType[identifier.type] = typeSet;\n }\n\n typeSet.lid.set(identifier.lid, identifier);\n if (identifier.id) {\n typeSet.id.set(identifier.id, identifier);\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport { getOrSetGlobal } from '../../../../types/-private.ts';\nimport { ARRAY_SIGNAL, consumeSignal, createSignal, notifySignal, OBJECT_SIGNAL, type SignalRef } from './configure.ts';\n\nexport type { SignalRef };\nexport { ARRAY_SIGNAL, OBJECT_SIGNAL };\n/**\n * A WarpDriveSignal is a wrapper around a framework specific or TC39 signal\n * that enables us to store and manage the signal in a universal way.\n *\n * WarpDrive uses signals to manage three separate concepts:\n *\n * - as a `storage` for a value local to the object that we want to be reactive\n * (see `@local` schema field for an example)\n * - as a `gate` for a memoized getter that we want to act as a reactive property\n * but whose value is computed/pulled from a non-reactive source elsewhere\n * and whose latest value is stored in the signal\n * (see `field` schema field for an example)\n * - as a `gate` with a manually managed value updated on pull when `isStale` is true\n *\n *\n * It offers\n *\n * - a non-reactive way to access/update the current value\n * - a non-reactive way to mark the signal as dirtied\n * - a non-reactive way to store content for why the signal was dirtied\n * - access to the underlying Signal(s) in-use\n *\n * For debugging:\n * - the \"key\" or \"name\" of the signal\n * - the \"object identity\" or \"context\" to which the signal is attached\n *\n * @internal\n */\nexport interface WarpDriveSignal {\n /**\n * The \"key\" or \"name\" of the signal.\n * This is usually (but not always) the name of a property\n * on the object to which the signal is attached.\n *\n * This is used for debugging purposes.\n * It is not used for any other purpose.\n *\n * @internal\n */\n key: string | symbol;\n\n /**\n * The \"object identity\" or \"context\" to which the\n * signal is attached.\n *\n * This is used for debugging purposes.\n * It is not used for any other purpose.\n *\n * @internal\n */\n context: object;\n\n /**\n * The underlying signal(s) in-use.\n *\n * Generally, this is a single signal.\n *\n * In some cases multiple signals need to be condensed,\n * such as to support legacy Ember Array APIs or to\n * support reactive-objects shared between the code of\n * multiple frameworks.\n *\n * In such cases, this value may be an array.\n *\n * e.g. (pseudo-code for Ember):\n *\n * setupSignals({\n * createSignal: (obj, key, initialValue) => {\n * if (isArraySignal(key)) {\n * return [\n * tagForProperty(obj, key),\n * tagForProperty(obj, '[]'),\n * tagForProperty(obj, 'length'),\n * ];\n * }\n * return tagForProperty(obj, key);\n * },\n *\n * consumeSignal: (signal) => {\n * if (Array.isArray(signal)) {\n * signal.forEach((s) => consumeTag(s));\n * } else {\n * consumeTag(signal);\n * }\n * },\n *\n * dirtySignal: (signal) => {\n * if (Array.isArray(signal)) {\n * signal.forEach((s) => dirtyTag(s));\n * } else {\n * dirtyTag(signal);\n * }\n * },\n * });\n *\n * @internal\n */\n signal: SignalRef;\n\n /**\n * The last \"value\" computed for this signal when\n * a signal is also used for storage.\n *\n * @internal\n */\n value: unknown;\n\n /**\n * Whether ths signal is known to have been dirtied.\n * This is useful *both* when manually managing the\n * `value` cache and when using the signal as a\n * \"gate\"\n *\n * @internal\n */\n isStale: boolean;\n}\n\n/**\n * We attach signals to their context object via\n * a Map attached to the object via this symbol.\n *\n * This allows us to store multiple signals\n * on the same object with smaller memory\n * overhead and no WeakMap lookups.\n *\n * Performance sensitive objects should\n * pre-warm their shape by assigning this\n * during initialization.\n *\n * ```ts\n * initializeSignalStore(obj);\n * ```\n *\n * @internal\n */\nexport const Signals = getOrSetGlobal('Signals', Symbol('Signals'));\nexport type SignalStore = Map<string | symbol, WarpDriveSignal>;\n\n/**\n * A type util to recast the object as having a signal store.\n *\n * @internal\n */\nexport function upgradeWithSignals<T extends object>(obj: T): asserts obj is T & { [Signals]: SignalStore } {}\n\n/**\n * A util that will create a signal store on the object\n * if it does not already exist and returns the associated\n * signal store.\n *\n * @internal\n */\nexport function withSignalStore<T extends object>(obj: T) {\n upgradeWithSignals(obj);\n if (obj[Signals] === undefined) {\n initializeSignalStore(obj);\n }\n return obj[Signals];\n}\n\n/**\n * A util that will create a signal store on the object\n * if it does not already exist.\n *\n * Useful for pre-warming the shape of an object to ensure\n * a key-transition to add it is not required later.\n *\n * @internal\n */\nexport function initializeSignalStore<T extends object>(obj: T): asserts obj is T & { [Signals]: SignalStore } {\n upgradeWithSignals(obj);\n assert(`Signal store already exists on object`, obj[Signals] === undefined);\n obj[Signals] = new Map();\n}\n\nexport function createInternalSignal(\n signals: SignalStore,\n obj: object,\n key: string | symbol,\n initialValue: unknown\n): WarpDriveSignal {\n const warpDriveSignal = {\n key,\n context: obj,\n signal: createSignal(obj, key),\n value: initialValue,\n isStale: false,\n };\n\n signals.set(key, warpDriveSignal);\n\n return warpDriveSignal;\n}\n\nexport function getOrCreateInternalSignal(\n signals: SignalStore,\n obj: object,\n key: string | symbol,\n initialValue: unknown\n): WarpDriveSignal {\n let signal = peekInternalSignal(signals, key);\n if (!signal) {\n signal = createInternalSignal(signals, obj, key, initialValue);\n }\n return signal;\n}\n\nexport function peekInternalSignal(\n signals: SignalStore | undefined,\n key: string | symbol\n): WarpDriveSignal | undefined {\n return signals?.get(key);\n}\n\nexport function consumeInternalSignal(signal: WarpDriveSignal) {\n consumeSignal(signal.signal);\n}\n\nexport function notifyInternalSignal(signal: WarpDriveSignal | undefined) {\n if (signal) {\n signal.isStale = true;\n notifySignal(signal.signal);\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport { createMemo } from './configure.ts';\nimport type { Signals, SignalStore, WarpDriveSignal } from './internal.ts';\nimport {\n consumeInternalSignal,\n createInternalSignal,\n getOrCreateInternalSignal,\n notifyInternalSignal,\n peekInternalSignal,\n withSignalStore,\n} from './internal.ts';\n\n/**\n * Creates a signal for the key/object pairing and subscribes to the signal.\n *\n * Use when you need to ensure a signal exists and is subscribed to.\n *\n * @internal\n */\nexport function entangleSignal<T extends object>(\n signals: SignalStore,\n obj: T,\n key: string | symbol,\n initialValue: unknown\n): WarpDriveSignal {\n let signal = peekInternalSignal(signals, key);\n if (!signal) {\n signal = createInternalSignal(signals, obj, key, initialValue);\n }\n\n consumeInternalSignal(signal);\n return signal;\n}\n\nfunction createSignalDescriptor(key: string | symbol, intialValue: unknown) {\n return {\n enumerable: true,\n configurable: false,\n get(this: { [Signals]: SignalStore }) {\n const signals = withSignalStore(this);\n return entangleSignal(signals, this, key, intialValue).value;\n },\n set(this: { [Signals]: SignalStore }, value: unknown) {\n const signals = withSignalStore(this);\n const signal = getOrCreateInternalSignal(signals, this, key, intialValue);\n\n if (signal.value !== value) {\n signal.value = value;\n notifyInternalSignal(signal);\n }\n },\n };\n}\n\n/**\n * define an enumerable signal property.\n *\n * Akin to Object.defineProperty.\n *\n * The signal will be lazily created when accessed and scoped to the\n * instance of the object.\n *\n * @internal\n */\nexport function defineSignal<T extends object>(obj: T, key: string, v?: unknown) {\n Object.defineProperty(obj, key, createSignalDescriptor(key, v));\n}\n\n/**\n * Define a non-enumerable signal property.\n *\n * @internal\n */\nexport function defineNonEnumerableSignal<T extends object>(obj: T, key: string, v?: unknown) {\n const desc = createSignalDescriptor(key, v);\n desc.enumerable = false;\n Object.defineProperty(obj, key, desc);\n}\n\nexport function memoized<T extends object, K extends keyof T & string>(\n target: T,\n key: K,\n descriptor: PropertyDescriptor\n) {\n // Error on `@memoized()`, `@memoized(...args)`, and `@memoized propName = value;`\n assert(\n 'You attempted to use @memoized(), which is not necessary nor supported. Remove the parentheses and you will be good to go!',\n target !== undefined\n );\n assert(\n `You attempted to use @memoized on with ${arguments.length > 1 ? 'arguments' : 'an argument'} ( @memoized(${Array.from(\n arguments\n )\n .map((d) => `'${d}'`)\n .join(\n ', '\n )}), which is not supported. Dependencies are automatically tracked, so you can just use ${'`@memoized`'}`,\n typeof target === 'object' && typeof key === 'string' && typeof descriptor === 'object' && arguments.length === 3\n );\n assert(\n `The @memoized decorator must be applied to getters. '${key}' is not a getter.`,\n typeof descriptor.get === 'function'\n );\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const getter = descriptor.get;\n descriptor.get = function () {\n const signals = withSignalStore(this);\n\n let memoSignal = signals.get(key);\n if (!memoSignal) {\n memoSignal = createMemo(this, key, getter.bind(this)) as unknown as WarpDriveSignal;\n signals.set(key, memoSignal);\n }\n return (memoSignal as unknown as () => unknown)();\n };\n\n return descriptor;\n}\n\nexport function gate<T extends object, K extends keyof T & string>(_target: T, key: K, desc: PropertyDescriptor) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const getter = desc.get as (this: T) => unknown;\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const setter = desc.set as (this: T, v: unknown) => void;\n\n desc.get = function (this: T) {\n const signals = withSignalStore(this);\n let signal = peekInternalSignal(signals, key);\n if (!signal) {\n signal = createInternalSignal(signals, this, key, getter.call(this));\n } else if (signal.isStale) {\n signal.isStale = false;\n signal.value = getter.call(this);\n }\n\n consumeInternalSignal(signal);\n return signal.value;\n };\n\n if (setter) {\n desc.set = function (this: T, v: unknown) {\n const signals = withSignalStore(this);\n let signal = peekInternalSignal(signals, key);\n if (!signal) {\n // we can't use `v` as initialValue here because setters don't\n // return the value and the final value may be different\n // than what the setter was called with.\n signal = createInternalSignal(signals, this, key, undefined);\n signal.isStale = true;\n }\n setter.call(this, v);\n // when a gate is set, we do not notify the signal\n // as its update is controlled externally.\n };\n }\n return desc;\n}\n\nexport function defineGate<T extends object>(obj: T, key: string, desc: PropertyDescriptor) {\n const options = Object.assign({ enumerable: true, configurable: false }, gate(obj, key as keyof T & string, desc));\n Object.defineProperty(obj, key, options);\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { DocumentCacheOperation } from '../../store/-private/managers/notification-manager.ts';\nimport {\n notifyInternalSignal,\n peekInternalSignal,\n withSignalStore,\n} from '../../store/-private/new-core-tmp/reactivity/internal.ts';\nimport { defineGate } from '../../store/-private/new-core-tmp/reactivity/signal.ts';\nimport type { Store } from '../../store/-private/store-service.ts';\nimport type { StableRecordIdentifier } from '../../types.ts';\nimport type { StableDocumentIdentifier } from '../../types/identifier.ts';\nimport type { ImmutableRequestInfo, RequestInfo } from '../../types/request.ts';\nimport { withBrand } from '../../types/request.ts';\nimport type { CollectionResourceDataDocument, ResourceDocument } from '../../types/spec/document.ts';\nimport type { Link, Meta, PaginationLinks } from '../../types/spec/json-api-raw.ts';\nimport type { Mutable } from '../../types/utils.ts';\n\nfunction urlFromLink(link: Link): string {\n if (typeof link === 'string') return link;\n return link.href;\n}\n\n/**\n * A Document is a class that wraps the response content from a request to the API\n * returned by `Cache.put` or `Cache.peek`, converting resource-identifiers into\n * record instances.\n *\n * It is not directly instantiated by the user, and its properties should not\n * be directly modified. Whether individual properties are mutable or not is\n * determined by the record instance itself.\n *\n * @public\n * @hideconstructor\n */\nexport class ReactiveDocument<T> {\n /**\n * The links object for this document, if any\n *\n * e.g.\n *\n * ```\n * {\n * self: '/articles?page[number]=3',\n * }\n * ```\n *\n * @property links\n * @type {Object|undefined} - a links object\n * @public\n */\n declare readonly links?: PaginationLinks;\n /**\n * The primary data for this document, if any.\n *\n * If this document has no primary data (e.g. because it is an error document)\n * this property will be `undefined`.\n *\n * For collections this will be an array of record instances,\n * for single resource requests it will be a single record instance or null.\n *\n * @property data\n * @public\n * @type {Object|Array<object>|null|undefined} - a data object\n */\n declare readonly data?: T;\n\n /**\n * The errors returned by the API for this request, if any\n *\n * @property errors\n * @public\n * @type {Object|undefined} - an errors object\n */\n declare readonly errors?: object[];\n\n /**\n * The meta object for this document, if any\n *\n * @property meta\n * @public\n * @type {Object|undefined} - a meta object\n */\n declare readonly meta?: Meta;\n\n /**\n * The identifier associated with this document, if any\n *\n * @property identifier\n * @public\n * @type {StableDocumentIdentifier|null}\n */\n declare readonly identifier: StableDocumentIdentifier | null;\n\n declare protected readonly _store: Store;\n declare protected readonly _localCache: { document: ResourceDocument; request: ImmutableRequestInfo } | null;\n\n constructor(\n store: Store,\n identifier: StableDocumentIdentifier | null,\n localCache: { document: ResourceDocument; request: ImmutableRequestInfo } | null\n ) {\n this._store = store;\n this._localCache = localCache;\n this.identifier = identifier;\n const signals = withSignalStore(this);\n\n // TODO if we ever enable auto-cleanup of the cache, we will need to tear this down\n // in a destroy method\n if (identifier) {\n store.notifications.subscribe(\n identifier,\n (_identifier: StableDocumentIdentifier, type: DocumentCacheOperation) => {\n switch (type) {\n case 'updated':\n // FIXME in the case of a collection we need to notify it's length\n // and have it recalc\n notifyInternalSignal(peekInternalSignal(signals, 'data'));\n notifyInternalSignal(peekInternalSignal(signals, 'links'));\n notifyInternalSignal(peekInternalSignal(signals, 'meta'));\n notifyInternalSignal(peekInternalSignal(signals, 'errors'));\n break;\n case 'added':\n case 'removed':\n case 'invalidated':\n case 'state':\n break;\n }\n }\n );\n }\n }\n\n async #request(\n link: keyof PaginationLinks,\n options: RequestInfo<ReactiveDocument<T>, T> = withBrand<ReactiveDocument<T>>({ url: '', method: 'GET' })\n ): Promise<ReactiveDocument<T> | null> {\n const href = this.links?.[link];\n if (!href) {\n return null;\n }\n\n options.method = options.method || 'GET';\n Object.assign(options, { url: urlFromLink(href) });\n const response = await this._store.request<ReactiveDocument<T>>(options);\n\n return response.content;\n }\n\n /**\n * Fetches the related link for this document, returning a promise that resolves\n * with the document when the request completes. If no related link is present,\n * will fallback to the self link if present\n *\n * @public\n * @param {Object} options\n * @return {Promise<Document>}\n */\n fetch(\n options: RequestInfo<ReactiveDocument<T>, T> = withBrand<ReactiveDocument<T>>({ url: '', method: 'GET' })\n ): Promise<ReactiveDocument<T>> {\n assert(`No self or related link`, this.links?.related || this.links?.self);\n options.cacheOptions = options.cacheOptions || {};\n options.cacheOptions.key = this.identifier?.lid;\n return this.#request(this.links.related ? 'related' : 'self', options) as Promise<ReactiveDocument<T>>;\n }\n\n /**\n * Fetches the next link for this document, returning a promise that resolves\n * with the new document when the request completes, or null if there is no\n * next link.\n *\n * @public\n * @param {Object} options\n * @return {Promise<Document | null>}\n */\n next(options?: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null> {\n return this.#request('next', options);\n }\n\n /**\n * Fetches the prev link for this document, returning a promise that resolves\n * with the new document when the request completes, or null if there is no\n * prev link.\n *\n * @public\n * @param {Object} options\n * @return {Promise<Document | null>}\n */\n prev(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null> {\n return this.#request('prev', options);\n }\n\n /**\n * Fetches the first link for this document, returning a promise that resolves\n * with the new document when the request completes, or null if there is no\n * first link.\n *\n * @public\n * @param {Object} options\n * @return {Promise<Document | null>}\n */\n first(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null> {\n return this.#request('first', options);\n }\n\n /**\n * Fetches the last link for this document, returning a promise that resolves\n * with the new document when the request completes, or null if there is no\n * last link.\n *\n * @public\n * @param {Object} options\n * @return {Promise<Document | null>}\n */\n last(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null> {\n return this.#request('last', options);\n }\n\n /**\n * Implemented for `JSON.stringify` support.\n *\n * Returns the JSON representation of the document wrapper.\n *\n * This is a shallow serialization, it does not deeply serialize\n * the document's contents, leaving that to the individual record\n * instances to determine how to do, if at all.\n *\n * @public\n * @return\n */\n toJSON(): object {\n const data: Mutable<Partial<ReactiveDocument<T>>> = {};\n data.identifier = this.identifier;\n if (this.data !== undefined) {\n data.data = this.data;\n }\n if (this.links !== undefined) {\n data.links = this.links;\n }\n if (this.errors !== undefined) {\n data.errors = this.errors;\n }\n if (this.meta !== undefined) {\n data.meta = this.meta;\n }\n return data;\n }\n}\n\ndefineGate(ReactiveDocument.prototype, 'errors', {\n get<T>(this: ReactiveDocument<T>): object[] | undefined {\n const { identifier } = this;\n\n if (!identifier) {\n const { document } = this._localCache!;\n if ('errors' in document) {\n return document.errors;\n }\n return;\n }\n\n const doc = this._store.cache.peek(identifier);\n assert(`No cache data was found for the document '${identifier.lid}'`, doc);\n return 'errors' in doc ? doc.errors : undefined;\n },\n});\ndefineGate(ReactiveDocument.prototype, 'data', {\n get<T>(this: ReactiveDocument<T>) {\n const { identifier, _localCache } = this;\n\n const doc = identifier ? this._store.cache.peek(identifier) : _localCache!.document;\n assert(`No cache data was found for the document '${identifier?.lid ?? '<uncached document>'}'`, doc);\n const data = 'data' in doc ? (doc.data as T | undefined) : undefined;\n\n if (Array.isArray(data)) {\n return this._store.recordArrayManager.getCollection({\n type: identifier ? identifier.lid : _localCache!.request.url,\n identifiers: data.slice(),\n doc: identifier ? undefined : (doc as CollectionResourceDataDocument),\n identifier: identifier ?? null,\n }) as T;\n } else if (data) {\n return this._store.peekRecord(data as unknown as StableRecordIdentifier) as T;\n } else {\n return data;\n }\n },\n});\ndefineGate(ReactiveDocument.prototype, 'links', {\n get<T>(this: ReactiveDocument<T>) {\n const { identifier } = this;\n\n if (!identifier) {\n return this._localCache!.document.links;\n }\n const data = this._store.cache.peek(identifier);\n assert(`No cache data was found for the document '${identifier.lid}'`, data);\n return data.links;\n },\n});\ndefineGate(ReactiveDocument.prototype, 'meta', {\n get<T>(this: ReactiveDocument<T>): Meta | undefined {\n const { identifier } = this;\n\n if (!identifier) {\n return this._localCache!.document.meta;\n }\n const data = this._store.cache.peek(identifier);\n assert(`No cache data was found for the document '${identifier.lid}'`, data);\n return data.meta;\n },\n});\n","type SCOPE = 'notify' | 'reactive-ui' | 'graph' | 'request' | 'cache';\n\nconst TEXT_COLORS = {\n TEXT: 'inherit',\n notify: ['white', 'white', 'inherit', 'magenta', 'inherit'],\n 'reactive-ui': ['white', 'white', 'inherit', 'magenta', 'inherit'],\n graph: ['white', 'white', 'inherit', 'magenta', 'inherit'],\n request: ['white', 'white', 'inherit', 'magenta', 'inherit'],\n cache: ['white', 'white', 'inherit', 'magenta', 'inherit'],\n};\nconst BG_COLORS = {\n TEXT: 'transparent',\n notify: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],\n 'reactive-ui': ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],\n graph: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],\n request: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],\n cache: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],\n};\nconst NOTIFY_BORDER = {\n TEXT: 0,\n notify: [3, 2, 0, 0, 0],\n 'reactive-ui': [3, 2, 0, 0, 0],\n graph: [3, 2, 0, 0, 0],\n request: [3, 2, 0, 0, 0],\n cache: [3, 2, 0, 0, 0],\n};\n\nconst LIGHT_DARK_ALT: Record<string, string> = {\n lightgreen: 'green',\n green: 'lightgreen',\n};\n\nfunction badge(isLight: boolean, color: string, bgColor: string, border: number) {\n return [\n `color: ${correctColor(isLight, color)}; background-color: ${correctColor(isLight, bgColor)}; padding: ${border}px ${2 * border}px; border-radius: ${border}px;`,\n `color: ${TEXT_COLORS.TEXT}; background-color: ${BG_COLORS.TEXT};`,\n ];\n}\n\nfunction colorForBucket(isLight: boolean, scope: SCOPE, bucket: string) {\n if (scope === 'notify') {\n return bucket === 'added'\n ? badge(isLight, 'lightgreen', 'transparent', 0)\n : bucket === 'removed'\n ? badge(isLight, 'red', 'transparent', 0)\n : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);\n }\n if (scope === 'reactive-ui') {\n return bucket === 'created'\n ? badge(isLight, 'lightgreen', 'transparent', 0)\n : bucket === 'disconnected'\n ? badge(isLight, 'red', 'transparent', 0)\n : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);\n }\n if (scope === 'cache') {\n return bucket === 'inserted'\n ? badge(isLight, 'lightgreen', 'transparent', 0)\n : bucket === 'removed'\n ? badge(isLight, 'red', 'transparent', 0)\n : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);\n }\n\n return badge(isLight, TEXT_COLORS[scope][3], BG_COLORS[scope][3], NOTIFY_BORDER[scope][3]);\n}\n\nexport function logGroup(scope: 'cache', prefix: string, type: string, lid: string, bucket: string, key: string): void;\nexport function logGroup(\n scope: 'reactive-ui',\n prefix: string,\n type: string,\n lid: string,\n bucket: string,\n key: ''\n): void;\nexport function logGroup(scope: 'notify', prefix: string, type: string, lid: string, bucket: string, key: string): void;\nexport function logGroup(\n scope: SCOPE,\n prefix: string,\n subScop1: string,\n subScop2: string,\n subScop3: string,\n subScop4: string\n): void {\n // eslint-disable-next-line no-console\n console.groupCollapsed(..._log(scope, prefix, subScop1, subScop2, subScop3, subScop4));\n}\n\nexport function log(scope: 'cache', prefix: string, type: string, lid: string, bucket: string, key: string): void;\nexport function log(scope: 'reactive-ui', prefix: string, type: string, lid: string, bucket: string, key: ''): void;\nexport function log(scope: 'notify', prefix: string, type: string, lid: string, bucket: string, key: string): void;\nexport function log(\n scope: SCOPE,\n prefix: string,\n subScop1: string,\n subScop2: string,\n subScop3: string,\n subScop4: string\n): void {\n // eslint-disable-next-line no-console\n console.log(..._log(scope, prefix, subScop1, subScop2, subScop3, subScop4));\n}\n\nfunction correctColor(isLight: boolean, color: string) {\n if (!isLight) {\n return color;\n }\n return color in LIGHT_DARK_ALT ? LIGHT_DARK_ALT[color] : color;\n}\n\nfunction isLightMode() {\n if (window?.matchMedia?.('(prefers-color-scheme: light)').matches) {\n return true;\n }\n return false;\n}\n\nfunction _log(\n scope: SCOPE,\n prefix: string,\n subScop1: string,\n subScop2: string,\n subScop3: string,\n subScop4: string\n): string[] {\n const isLight = isLightMode();\n switch (scope) {\n case 'reactive-ui':\n case 'notify': {\n const scopePath = prefix ? `[${prefix}] ${scope}` : scope;\n const path = subScop4 ? `${subScop3}.${subScop4}` : subScop3;\n return [\n `%c@warp%c-%cdrive%c %c${scopePath}%c %c${subScop1}%c %c${subScop2}%c %c${path}%c`,\n ...badge(isLight, 'lightgreen', 'transparent', 0),\n ...badge(isLight, 'magenta', 'transparent', 0),\n ...badge(isLight, TEXT_COLORS[scope][0], BG_COLORS[scope][0], NOTIFY_BORDER[scope][0]),\n ...badge(isLight, TEXT_COLORS[scope][1], BG_COLORS[scope][1], NOTIFY_BORDER[scope][1]),\n ...badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]),\n ...colorForBucket(isLight, scope, path),\n ];\n }\n case 'cache': {\n const scopePath = prefix ? `${scope} (${prefix})` : scope;\n return [\n `%c@warp%c-%cdrive%c %c${scopePath}%c %c${subScop1}%c %c${subScop2}%c %c${subScop3}%c %c${subScop4}%c`,\n ...badge(isLight, 'lightgreen', 'transparent', 0),\n ...badge(isLight, 'magenta', 'transparent', 0),\n ...badge(isLight, TEXT_COLORS[scope][0], BG_COLORS[scope][0], NOTIFY_BORDER[scope][0]),\n ...badge(isLight, TEXT_COLORS[scope][1], BG_COLORS[scope][1], NOTIFY_BORDER[scope][1]),\n ...badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]),\n ...colorForBucket(isLight, scope, subScop3),\n ...badge(isLight, TEXT_COLORS[scope][4], BG_COLORS[scope][4], NOTIFY_BORDER[scope][4]),\n ];\n }\n }\n return [];\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { SingleResourceDocument } from '../../../types/spec/json-api-raw.ts';\nimport type { OpaqueRecordInstance } from '../../-types/q/record-instance.ts';\nimport type { NotificationType } from '../managers/notification-manager.ts';\nimport { defineSignal } from '../new-core-tmp/reactivity/signal.ts';\nimport type { Store } from '../store-service.ts';\n\n/**\n A `RecordReference` is a low-level API that allows users and\n addon authors to perform meta-operations on a record.\n\n @class RecordReference\n @public\n*/\nexport default class RecordReference {\n declare store: Store;\n // unsubscribe token given to us by the notification manager\n ___token!: object;\n ___identifier: StableRecordIdentifier;\n\n declare _ref: number;\n\n constructor(store: Store, identifier: StableRecordIdentifier) {\n this.store = store;\n this.___identifier = identifier;\n this.___token = store.notifications.subscribe(\n identifier,\n (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n\n destroy() {\n this.store.notifications.unsubscribe(this.___token);\n }\n\n get type(): string {\n return this.identifier().type;\n }\n\n /**\n The `id` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.id(); // '1'\n ```\n\n @public\n @return {String} The id of the record.\n */\n id() {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._ref; // consume the tracked prop\n return this.___identifier.id;\n }\n\n /**\n The `identifier` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.identifier(); // '1'\n ```\n\n @public\n @return {String} The identifier of the record.\n */\n identifier(): StableRecordIdentifier {\n return this.___identifier;\n }\n\n /**\n How the reference will be looked up when it is loaded. Currently\n this always returns `identity` to signify that a record will be\n loaded by its `type` and `id`.\n\n Example\n\n ```javascript\n const userRef = store.getReference('user', 1);\n\n userRef.remoteType(); // 'identity'\n ```\n\n @public\n @return {String} 'identity'\n */\n remoteType(): 'identity' {\n return 'identity';\n }\n\n /**\n This API allows you to provide a reference with new data. The\n simplest usage of this API is similar to `store.push`: you provide a\n normalized hash of data and the object represented by the reference\n will update.\n\n If you pass a promise to `push`, Ember Data will not ask the adapter\n for the data if another attempt to fetch it is made in the\n interim. When the promise resolves, the underlying object is updated\n with the new data, and the promise returned by *this function* is resolved\n with that object.\n\n For example, `recordReference.push(promise)` will be resolved with a\n record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one\n @return a promise for the value (record or relationship)\n */\n push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance> {\n // TODO @deprecate pushing unresolved payloads\n return Promise.resolve(objectOrPromise).then((data) => {\n return this.store.push(data);\n });\n }\n\n /**\n If the entity referred to by the reference is already loaded, it is\n present as `reference.value`. Otherwise the value returned by this function\n is `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```\n\n @public\n @return {Model} the record for this RecordReference\n */\n value(): OpaqueRecordInstance | null {\n return this.store.peekRecord(this.___identifier);\n }\n\n /**\n Triggers a fetch for the backing entity based on its `remoteType`\n (see `remoteType` definitions per reference type).\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // load user (via store.find)\n userRef.load().then(...)\n ```\n\n @public\n @return {Promise<record>} the record for this RecordReference\n */\n load() {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id);\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n\n /**\n Reloads the record if it is already loaded. If the record is not\n loaded it will load the record via `store.findRecord`\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // or trigger a reload\n userRef.reload().then(...)\n ```\n\n @public\n @return {Promise<record>} the record for this RecordReference\n */\n reload() {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id, { reload: true });\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n}\n\ndefineSignal(RecordReference.prototype, '_ref');\n","import { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { CacheCapabilitiesManager as StoreWrapper } from '../../-types/q/cache-capabilities-manager.ts';\nimport type { SchemaService } from '../../-types/q/schema-service.ts';\nimport type { IdentifierCache } from '../caches/identifier-cache.ts';\nimport { isDocumentIdentifier, isStableIdentifier } from '../caches/identifier-cache.ts';\nimport type { Store } from '../store-service.ts';\nimport type { NotificationType } from './notification-manager.ts';\n\nexport interface CacheCapabilitiesManager {\n getSchemaDefinitionService(): SchemaService;\n}\nexport class CacheCapabilitiesManager implements StoreWrapper {\n declare _willNotify: boolean;\n declare _pendingNotifies: Map<StableRecordIdentifier, Set<string>>;\n declare _store: Store;\n\n constructor(_store: Store) {\n this._store = _store;\n this._willNotify = false;\n this._pendingNotifies = new Map();\n }\n\n get identifierCache(): IdentifierCache {\n return this._store.identifierCache;\n }\n\n _scheduleNotification(identifier: StableRecordIdentifier, key: string) {\n let pending = this._pendingNotifies.get(identifier);\n\n if (!pending) {\n pending = new Set();\n this._pendingNotifies.set(identifier, pending);\n }\n pending.add(key);\n\n if (this._willNotify === true) {\n return;\n }\n\n this._willNotify = true;\n // it's possible a cache adhoc notifies us,\n // in which case we sync flush\n if (this._store._cbs) {\n this._store._schedule('notify', () => this._flushNotifications());\n } else {\n // TODO @runspired determine if relationship mutations should schedule\n // into join/run vs immediate flush\n this._flushNotifications();\n }\n }\n\n _flushNotifications(): void {\n if (this._willNotify === false) {\n return;\n }\n\n const pending = this._pendingNotifies;\n this._pendingNotifies = new Map();\n this._willNotify = false;\n\n pending.forEach((set, identifier) => {\n set.forEach((key) => {\n this._store.notifications.notify(identifier, 'relationships', key);\n });\n });\n }\n\n notifyChange(identifier: StableRecordIdentifier, namespace: 'added' | 'removed', key: null): void;\n notifyChange(identifier: StableDocumentIdentifier, namespace: 'added' | 'updated' | 'removed', key: null): void;\n notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key: string | null): void;\n notifyChange(\n identifier: StableRecordIdentifier | StableDocumentIdentifier,\n namespace: NotificationType | 'added' | 'removed' | 'updated',\n key: string | null\n ): void {\n assert(`Expected a stable identifier`, isStableIdentifier(identifier) || isDocumentIdentifier(identifier));\n\n // TODO do we still get value from this?\n if (namespace === 'relationships' && key) {\n this._scheduleNotification(identifier as StableRecordIdentifier, key);\n return;\n }\n\n // @ts-expect-error\n this._store.notifications.notify(identifier, namespace, key);\n }\n\n get schema() {\n return this._store.schema;\n }\n\n setRecordId(identifier: StableRecordIdentifier, id: string) {\n assert(`Expected a stable identifier`, isStableIdentifier(identifier));\n this._store._instanceCache.setRecordId(identifier, id);\n }\n\n hasRecord(identifier: StableRecordIdentifier): boolean {\n return Boolean(this._store._instanceCache.peek(identifier));\n }\n\n disconnectRecord(identifier: StableRecordIdentifier): void {\n assert(`Expected a stable identifier`, isStableIdentifier(identifier));\n this._store._instanceCache.disconnect(identifier);\n this._pendingNotifies.delete(identifier);\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function () {\n // FIXME add deprecation for this\n return this._store.schema;\n };\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { Cache } from '../../../types/cache.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { OpaqueRecordInstance } from '../../-types/q/record-instance';\n\n/*\n * Returns the Cache instance associated with a given\n * Model or Identifier\n */\n\nexport const CacheForIdentifierCache = getOrSetGlobal(\n 'CacheForIdentifierCache',\n new Map<StableRecordIdentifier | OpaqueRecordInstance, Cache>()\n);\n\nexport function setCacheFor(identifier: StableRecordIdentifier | OpaqueRecordInstance, cache: Cache): void {\n assert(\n `Illegal set of identifier`,\n !CacheForIdentifierCache.has(identifier) || CacheForIdentifierCache.get(identifier) === cache\n );\n CacheForIdentifierCache.set(identifier, cache);\n}\n\nexport function removeRecordDataFor(identifier: StableRecordIdentifier | OpaqueRecordInstance): void {\n CacheForIdentifierCache.delete(identifier);\n}\n\nexport function peekCache(instance: StableRecordIdentifier): Cache | null;\nexport function peekCache(instance: OpaqueRecordInstance): Cache;\nexport function peekCache(instance: StableRecordIdentifier | OpaqueRecordInstance): Cache | null {\n if (CacheForIdentifierCache.has(instance as StableRecordIdentifier)) {\n return CacheForIdentifierCache.get(instance as StableRecordIdentifier) as Cache;\n }\n\n return null;\n}\n","import { warn } from '@ember/debug';\n\nimport { LOG_INSTANCE_CACHE } from '@warp-drive/core/build-config/debugging';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport { ReactiveDocument } from '../../../reactive/-private/document.ts';\nimport { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { Cache } from '../../../types/cache.ts';\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { Value } from '../../../types/json/raw.ts';\nimport type { TypedRecordInstance, TypeFromInstance, TypeFromInstanceOrString } from '../../../types/record.ts';\nimport type { LegacyRelationshipField as RelationshipSchema } from '../../../types/schema/fields.ts';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n InnerRelationshipDocument,\n} from '../../../types/spec/json-api-raw.ts';\nimport type { OpaqueRecordInstance } from '../../-types/q/record-instance.ts';\nimport { log, logGroup } from '../debug/utils.ts';\nimport RecordReference from '../legacy-model-support/record-reference.ts';\nimport { CacheCapabilitiesManager } from '../managers/cache-capabilities-manager.ts';\nimport type { CacheManager } from '../managers/cache-manager.ts';\nimport type { CreateRecordProperties, Store } from '../store-service.ts';\nimport { ensureStringId } from '../utils/coerce-id.ts';\nimport { CacheForIdentifierCache, removeRecordDataFor, setCacheFor } from './cache-utils.ts';\n\ntype Destroyable = {\n isDestroyed: boolean;\n isDestroying: boolean;\n destroy(): void;\n};\n\nfunction isDestroyable(record: OpaqueRecordInstance): record is Destroyable {\n return Boolean(record && typeof record === 'object' && typeof (record as Destroyable).destroy === 'function');\n}\n\nconst RecordCache = getOrSetGlobal('RecordCache', new Map<OpaqueRecordInstance, StableRecordIdentifier>());\n\nexport function peekRecordIdentifier(record: OpaqueRecordInstance): StableRecordIdentifier | undefined {\n return RecordCache.get(record);\n}\n\n/**\n Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)\n assigned to the given record instance.\n\n ```js\n import { recordIdentifierFor } from \"@ember-data/store\";\n // ... gain access to a record, for instance with peekRecord or findRecord\n const record = store.peekRecord(\"user\", \"1\");\n // get the identifier for the record (see docs for StableRecordIdentifier)\n const identifier = recordIdentifierFor(record);\n // access the identifier's properties.\n const { id, type, lid } = identifier;\n ```\n\n @public\n @param {Object} record a record instance previously obstained from the store.\n @return {StableRecordIdentifier}\n */\nexport function recordIdentifierFor<T extends TypedRecordInstance>(\n record: T\n): StableRecordIdentifier<TypeFromInstance<T>>;\nexport function recordIdentifierFor(record: OpaqueRecordInstance): StableRecordIdentifier;\nexport function recordIdentifierFor<T>(record: T): StableRecordIdentifier<TypeFromInstanceOrString<T>> {\n assert(`${String(record)} is not a record instantiated by @ember-data/store`, RecordCache.has(record));\n return RecordCache.get(record)! as StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n}\n\nexport function setRecordIdentifier(record: OpaqueRecordInstance, identifier: StableRecordIdentifier): void {\n if (DEBUG) {\n if (RecordCache.has(record) && RecordCache.get(record) !== identifier) {\n throw new Error(`${String(record)} was already assigned an identifier`);\n }\n }\n\n /*\n It would be nice to do a reverse check here that an identifier has not\n previously been assigned a record; however, unload + rematerialization\n prevents us from having a great way of doing so when CustomRecordClasses\n don't necessarily give us access to a `isDestroyed` for dematerialized\n instance.\n */\n\n RecordCache.set(record, identifier);\n}\n\nexport const StoreMap = getOrSetGlobal('StoreMap', new Map<OpaqueRecordInstance, Store>());\n\n/**\n * We may eventually make this public, but its likely better for this to be killed off\n * @internal\n */\nexport function storeFor(record: OpaqueRecordInstance): Store | undefined {\n const store = StoreMap.get(record);\n\n assert(\n `A record in a disconnected state cannot utilize the store. This typically means the record has been destroyed, most commonly by unloading it.`,\n store\n );\n return store;\n}\n\ntype Caches = {\n record: Map<StableRecordIdentifier, OpaqueRecordInstance>;\n reference: WeakMap<StableRecordIdentifier, RecordReference>;\n document: Map<\n StableDocumentIdentifier,\n ReactiveDocument<OpaqueRecordInstance | OpaqueRecordInstance[] | null | undefined>\n >;\n};\n\nexport class InstanceCache {\n declare store: Store;\n declare cache: Cache;\n declare _storeWrapper: CacheCapabilitiesManager;\n\n declare __cacheManager: CacheManager;\n declare __instances: Caches;\n\n constructor(store: Store) {\n this.store = store;\n this.__instances = {\n record: new Map(),\n reference: new WeakMap(),\n document: new Map(),\n };\n\n this._storeWrapper = new CacheCapabilitiesManager(this.store);\n\n store.identifierCache.__configureMerge(\n (identifier: StableRecordIdentifier, matchedIdentifier: StableRecordIdentifier, resourceData: unknown) => {\n let keptIdentifier = identifier;\n if (identifier.id !== matchedIdentifier.id) {\n // @ts-expect-error TODO this needs to be fixed\n keptIdentifier = 'id' in resourceData && identifier.id === resourceData.id ? identifier : matchedIdentifier;\n } else if (identifier.type !== matchedIdentifier.type) {\n keptIdentifier = // @ts-expect-error TODO this needs to be fixed\n 'type' in resourceData && identifier.type === resourceData.type ? identifier : matchedIdentifier;\n }\n const staleIdentifier = identifier === keptIdentifier ? matchedIdentifier : identifier;\n\n // check for duplicate entities\n const keptHasRecord = this.__instances.record.has(keptIdentifier);\n const staleHasRecord = this.__instances.record.has(staleIdentifier);\n\n // we cannot merge entities when both have records\n // (this may not be strictly true, we could probably swap the cache data the record points at)\n if (keptHasRecord && staleHasRecord) {\n // TODO we probably don't need to throw these errors anymore\n // we can probably just \"swap\" what data source the abandoned\n // record points at so long as\n // it itself is not retained by the store in any way.\n // @ts-expect-error TODO this needs to be fixed\n if ('id' in resourceData) {\n throw new Error(\n `Failed to update the 'id' for the RecordIdentifier '${identifier.type}:${String(identifier.id)} (${\n identifier.lid\n })' to '${String(resourceData.id)}', because that id is already in use by '${\n matchedIdentifier.type\n }:${String(matchedIdentifier.id)} (${matchedIdentifier.lid})'`\n );\n }\n\n assert(\n `Failed to update the RecordIdentifier '${identifier.type}:${String(identifier.id)} (${\n identifier.lid\n })' to merge with the detected duplicate identifier '${matchedIdentifier.type}:${String(\n matchedIdentifier.id\n )} (${String(matchedIdentifier.lid)})'`\n );\n }\n\n this.store.cache.patch({\n op: 'mergeIdentifiers',\n record: staleIdentifier,\n value: keptIdentifier,\n });\n\n /*\n TODO @runspired consider adding this to make polymorphism even nicer\n if (identifier.type !== matchedIdentifier.type) {\n this.store._graph?.registerPolymorphicType(identifier.type, matchedIdentifier.type);\n }\n */\n\n this.unloadRecord(staleIdentifier);\n return keptIdentifier;\n }\n );\n }\n peek(identifier: StableRecordIdentifier): Cache | OpaqueRecordInstance | undefined {\n return this.__instances.record.get(identifier);\n }\n\n getDocument<T>(identifier: StableDocumentIdentifier): ReactiveDocument<T> {\n let doc = this.__instances.document.get(identifier);\n if (!doc) {\n doc = new ReactiveDocument<T>(this.store, identifier, null);\n this.__instances.document.set(identifier, doc);\n }\n return doc as ReactiveDocument<T>;\n }\n\n getRecord(identifier: StableRecordIdentifier, properties?: CreateRecordProperties): OpaqueRecordInstance {\n let record = this.__instances.record.get(identifier);\n\n if (!record) {\n assert(\n `Cannot create a new record instance while the store is being destroyed`,\n !this.store.isDestroying && !this.store.isDestroyed\n );\n const cache = this.store.cache;\n setCacheFor(identifier, cache);\n\n record = this.store.instantiateRecord(identifier, properties || {});\n\n setRecordIdentifier(record, identifier);\n setCacheFor(record, cache);\n StoreMap.set(record, this.store);\n this.__instances.record.set(identifier, record);\n\n if (LOG_INSTANCE_CACHE) {\n logGroup('reactive-ui', '', identifier.type, identifier.lid, 'created', '');\n // eslint-disable-next-line no-console\n console.log({ properties });\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n }\n\n return record;\n }\n\n getReference(identifier: StableRecordIdentifier) {\n const cache = this.__instances.reference;\n let reference = cache.get(identifier);\n\n if (!reference) {\n reference = new RecordReference(this.store, identifier);\n cache.set(identifier, reference);\n }\n return reference;\n }\n\n recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted = false) {\n const cache = this.cache;\n if (!cache) {\n return false;\n }\n const isNew = cache.isNew(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n // if we are new we must consider ourselves loaded\n if (isNew) {\n return !cache.isDeleted(identifier);\n }\n // even if we have a past request, if we are now empty we are not loaded\n // typically this is true after an unloadRecord call\n\n // if we are not empty, not new && we have a fulfilled request then we are loaded\n // we should consider allowing for something to be loaded that is simply \"not empty\".\n // which is how RecordState currently handles this case; however, RecordState is buggy\n // in that it does not account for unloading.\n return filterDeleted && cache.isDeletionCommitted(identifier) ? false : !isEmpty;\n }\n\n disconnect(identifier: StableRecordIdentifier) {\n const record = this.__instances.record.get(identifier);\n assert(\n 'Cannot destroy record while it is still materialized',\n !isDestroyable(record) || record.isDestroyed || record.isDestroying\n );\n\n this.store._graph?.remove(identifier);\n\n this.store.identifierCache.forgetRecordIdentifier(identifier);\n removeRecordDataFor(identifier);\n this.store._requestCache._clearEntries(identifier);\n if (LOG_INSTANCE_CACHE) {\n log('reactive-ui', '', identifier.type, identifier.lid, 'disconnected', '');\n }\n }\n\n unloadRecord(identifier: StableRecordIdentifier) {\n if (DEBUG) {\n const requests = this.store.getRequestStateService().getPendingRequestsForRecord(identifier);\n if (\n requests.some((req) => {\n return req.type === 'mutation';\n })\n ) {\n assert(`You can only unload a record which is not inFlight. '${String(identifier)}'`);\n }\n }\n if (LOG_INSTANCE_CACHE) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(`InstanceCache: unloading record for ${String(identifier)}`);\n }\n\n // TODO is this join still necessary?\n this.store._join(() => {\n const record = this.__instances.record.get(identifier);\n const cache = this.cache;\n\n if (record) {\n this.store.teardownRecord(record);\n this.__instances.record.delete(identifier);\n StoreMap.delete(record);\n RecordCache.delete(record);\n removeRecordDataFor(record);\n\n if (LOG_INSTANCE_CACHE) {\n // eslint-disable-next-line no-console\n console.log(`InstanceCache: destroyed record for ${String(identifier)}`);\n }\n }\n\n if (cache) {\n cache.unloadRecord(identifier);\n removeRecordDataFor(identifier);\n if (LOG_INSTANCE_CACHE) {\n // eslint-disable-next-line no-console\n console.log(`InstanceCache: destroyed cache for ${String(identifier)}`);\n }\n } else {\n this.disconnect(identifier);\n }\n\n this.store._requestCache._clearEntries(identifier);\n if (LOG_INSTANCE_CACHE) {\n // eslint-disable-next-line no-console\n console.log(`InstanceCache: unloaded RecordData for ${String(identifier)}`);\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n });\n }\n\n clear(type?: string) {\n const cache = this.store.identifierCache._cache;\n if (type === undefined) {\n // it would be cool if we could just de-ref cache here\n // but probably would require WeakRef models to do so.\n cache.resources.forEach((identifier) => {\n this.unloadRecord(identifier);\n });\n } else {\n const typeCache = cache.resourcesByType;\n const identifiers = typeCache[type]?.lid;\n if (identifiers) {\n identifiers.forEach((identifier) => {\n // if (rds.has(identifier)) {\n this.unloadRecord(identifier);\n // }\n // TODO we don't remove the identifier, should we?\n });\n }\n }\n }\n\n // TODO this should move into something coordinating operations\n setRecordId(identifier: StableRecordIdentifier, id: string) {\n const { type, lid } = identifier;\n const oldId = identifier.id;\n\n // ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)\n assert(\n `'${type}' was saved to the server, but the response does not have an id and your record does not either.`,\n !(id === null && oldId === null)\n );\n\n // ID absolutely can't be different than oldID if oldID is not null\n // TODO this assertion and restriction may not strictly be needed in the identifiers world\n assert(\n `Cannot update the id for '${type}:${lid}' from '${String(oldId)}' to '${id}'.`,\n !(oldId !== null && id !== oldId)\n );\n\n // ID can be null if oldID is not null (altered ID in response for a record)\n // however, this is more than likely a developer error.\n if (oldId !== null && id === null) {\n warn(\n `Your ${type} record was saved to the server, but the response does not have an id.`,\n !(oldId !== null && id === null)\n );\n return;\n }\n\n if (LOG_INSTANCE_CACHE) {\n // eslint-disable-next-line no-console\n console.log(`InstanceCache: updating id to '${id}' for record ${String(identifier)}`);\n }\n\n const existingIdentifier = this.store.identifierCache.peekRecordIdentifier({ type, id });\n assert(\n `'${type}' was saved to the server, but the response returned the new id '${id}', which has already been used with another record.'`,\n !existingIdentifier || existingIdentifier === identifier\n );\n\n if (identifier.id === null) {\n // TODO potentially this needs to handle merged result\n this.store.identifierCache.updateRecordIdentifier(identifier, { type, id });\n }\n\n // TODO update resource cache if needed ?\n // TODO handle consequences of identifier merge for notifications\n this.store.notifications.notify(identifier, 'identity');\n }\n}\n\nfunction _resourceIsFullDeleted(identifier: StableRecordIdentifier, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nexport function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/*\n When a find request is triggered on the store, the user can optionally pass in\n attributes and relationships to be preloaded. These are meant to behave as if they\n came back from the server, except the user obtained them out of band and is informing\n the store of their existence. The most common use case is for supporting client side\n nested URLs, such as `/posts/1/comments/2` so the user can do\n `store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.\n\n Preloaded data can be attributes and relationships passed in either as IDs or as actual\n models.\n */\ntype PreloadRelationshipValue = OpaqueRecordInstance | string;\nexport function preloadData(store: Store, identifier: StableRecordIdentifier, preload: Record<string, Value>) {\n const jsonPayload: Partial<ExistingResourceObject> = {};\n //TODO(Igor) consider the polymorphic case\n const schemas = store.schema;\n const fields = schemas.fields(identifier);\n Object.keys(preload).forEach((key) => {\n const preloadValue = preload[key];\n\n const field = fields.get(key);\n if (field && (field.kind === 'hasMany' || field.kind === 'belongsTo')) {\n if (!jsonPayload.relationships) {\n jsonPayload.relationships = {};\n }\n jsonPayload.relationships[key] = preloadRelationship(field, preloadValue);\n } else {\n if (!jsonPayload.attributes) {\n jsonPayload.attributes = {};\n }\n jsonPayload.attributes[key] = preloadValue;\n }\n });\n const cache = store.cache;\n const hasRecord = Boolean(store._instanceCache.peek(identifier));\n cache.upsert(identifier, jsonPayload, hasRecord);\n}\n\nfunction preloadRelationship(\n schema: RelationshipSchema,\n preloadValue: PreloadRelationshipValue | null | Array<PreloadRelationshipValue>\n): InnerRelationshipDocument<ExistingResourceIdentifierObject> {\n const relatedType = schema.type;\n\n if (schema.kind === 'hasMany') {\n assert('You need to pass in an array to set a hasMany property on a record', Array.isArray(preloadValue));\n return { data: preloadValue.map((value) => _convertPreloadRelationshipToJSON(value, relatedType)) };\n }\n\n assert('You should not pass in an array to set a belongsTo property on a record', !Array.isArray(preloadValue));\n return { data: preloadValue ? _convertPreloadRelationshipToJSON(preloadValue, relatedType) : null };\n}\n\n/*\n findRecord('user', '1', { preload: { friends: ['1'] }});\n findRecord('user', '1', { preload: { friends: [record] }});\n*/\nfunction _convertPreloadRelationshipToJSON(\n value: OpaqueRecordInstance | string,\n type: string\n): ExistingResourceIdentifierObject {\n if (typeof value === 'string' || typeof value === 'number') {\n return { type, id: ensureStringId(value) };\n }\n // TODO if not a record instance assert it's an identifier\n // and allow identifiers to be used\n return recordIdentifierFor(value) as ExistingResourceIdentifierObject;\n}\n\nexport function _clearCaches() {\n RecordCache.clear();\n StoreMap.clear();\n CacheForIdentifierCache.clear();\n}\n","import { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { TypedRecordInstance, TypeFromInstance } from '../../../types/record.ts';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '../../../types/schema/fields.ts';\nimport type { KeyOrString, ModelSchema } from '../../-types/q/ds-model.ts';\nimport type { Store } from '../store-service.ts';\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = getOrSetGlobal('AvailableShims', new WeakMap<Store, Record<string, ShimModelClass>>());\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\n// Mimics the static apis of @ember-data/model\nexport default class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n if (schema.kind === 'attribute' || schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(callback: (key: K, attribute: LegacyAttributeField) => void, binding?: T) {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ) {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(callback: (key: K, type: string | null) => void, binding?: T) {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n","import type { Cache, ChangedAttributesHash, RelationshipDiff } from '../../../types/cache.ts';\nimport type { Change } from '../../../types/cache/change.ts';\nimport type { MergeOperation } from '../../../types/cache/operations.ts';\nimport type { CollectionRelationship, ResourceRelationship } from '../../../types/cache/relationship.ts';\nimport type { LocalRelationshipOperation } from '../../../types/graph.ts';\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { Value } from '../../../types/json/raw.ts';\nimport type { StructuredDataDocument, StructuredDocument } from '../../../types/request.ts';\nimport type { ResourceDocument, SingleResourceDataDocument } from '../../../types/spec/document.ts';\nimport type { ApiError } from '../../../types/spec/error.ts';\nimport type { StoreRequestContext } from '../cache-handler/handler.ts';\n\n/**\n * The CacheManager wraps a Cache enforcing that only\n * the public API surface area is exposed.\n *\n * Hence, it is the value of `Store.cache`, wrapping\n * the cache instance returned by `Store.createCache`.\n *\n * It handles translating between cache versions when\n * necessary, for instance when a Store is configured\n * to use both a v1 and a v2 cache depending on some\n * heuristic.\n *\n * Starting with the v2 spec, the cache is designed such\n * that it must be implemented as a singleton.\n *\n * @class CacheManager\n * @public\n */\nexport class CacheManager implements Cache {\n version = '2' as const;\n\n #cache: Cache;\n\n constructor(cache: Cache) {\n this.#cache = cache;\n }\n\n // Cache Management\n // ================\n\n /**\n * Cache the response to a request\n *\n * Unlike `store.push` which has UPSERT\n * semantics, `put` has `replace` semantics similar to\n * the `http` method `PUT`\n *\n * the individually cacheable\n * e resource data it may contain\n * should upsert, but the document data surrounding it should\n * fully replace any existing information\n *\n * Note that in order to support inserting arbitrary data\n * to the cache that did not originate from a request `put`\n * should expect to sometimes encounter a document with only\n * a `content` member and therefor must not assume the existence\n * of `request` and `response` on the document.\n *\n * @param {StructuredDocument} doc\n * @return {ResourceDocument}\n * @public\n */\n put<T>(doc: StructuredDocument<T> | { content: T }): ResourceDocument {\n return this.#cache.put(doc);\n }\n\n /**\n * Perform an operation on the cache to update the remote state.\n *\n * Note: currently the only valid operation is a MergeOperation\n * which occurs when a collision of identifiers is detected.\n *\n * @public\n * @param op the operation to perform\n * @return {void}\n */\n patch(op: MergeOperation): void {\n this.#cache.patch(op);\n }\n\n /**\n * Update resource data with a local mutation. Currently supports operations\n * on relationships only.\n *\n * @public\n * @param mutation\n */\n mutate(mutation: LocalRelationshipOperation): void {\n this.#cache.mutate(mutation);\n }\n\n /**\n * Peek resource data from the Cache.\n *\n * In development, if the return value\n * is JSON the return value\n * will be deep-cloned and deep-frozen\n * to prevent mutation thereby enforcing cache\n * Immutability.\n *\n * This form of peek is useful for implementations\n * that want to feed raw-data from cache to the UI\n * or which want to interact with a blob of data\n * directly from the presentation cache.\n *\n * An implementation might want to do this because\n * de-referencing records which read from their own\n * blob is generally safer because the record does\n * not require retaining connections to the Store\n * and Cache to present data on a per-field basis.\n *\n * This generally takes the place of `getAttr` as\n * an API and may even take the place of `getRelationship`\n * depending on implementation specifics, though this\n * latter usage is less recommended due to the advantages\n * of the Graph handling necessary entanglements and\n * notifications for relational data.\n *\n * @public\n * @param {StableRecordIdentifier | StableDocumentIdentifier} identifier\n * @return {ResourceDocument | ResourceBlob | null} the known resource data\n */\n peek(identifier: StableRecordIdentifier): unknown;\n peek(identifier: StableDocumentIdentifier): ResourceDocument | null;\n peek(identifier: StableRecordIdentifier | StableDocumentIdentifier): unknown {\n return this.#cache.peek(identifier);\n }\n\n peekRemoteState(identifier: StableRecordIdentifier): unknown;\n peekRemoteState(identifier: StableDocumentIdentifier): ResourceDocument | null;\n peekRemoteState(identifier: StableRecordIdentifier | StableDocumentIdentifier): unknown {\n return this.#cache.peekRemoteState(identifier);\n }\n /**\n * Peek the Cache for the existing request data associated with\n * a cacheable request\n *\n * @param {StableDocumentIdentifier}\n * @return {StableDocumentIdentifier | null}\n * @public\n */\n peekRequest(identifier: StableDocumentIdentifier): StructuredDocument<ResourceDocument> | null {\n return this.#cache.peekRequest(identifier);\n }\n\n /**\n * Push resource data from a remote source into the cache for this identifier\n *\n * @public\n * @param identifier\n * @param data\n * @param hasRecord\n * @return {void | string[]} if `hasRecord` is true then calculated key changes should be returned\n */\n upsert(identifier: StableRecordIdentifier, data: unknown, hasRecord: boolean): void | string[] {\n return this.#cache.upsert(identifier, data, hasRecord);\n }\n\n // Cache Forking Support\n // =====================\n\n /**\n * Create a fork of the cache from the current state.\n *\n * Applications should typically not call this method themselves,\n * preferring instead to fork at the Store level, which will\n * utilize this method to fork the cache.\n *\n * @public\n * @return {Promise<Cache>}\n */\n fork(): Promise<Cache> {\n return this.#cache.fork();\n }\n\n /**\n * Merge a fork back into a parent Cache.\n *\n * Applications should typically not call this method themselves,\n * preferring instead to merge at the Store level, which will\n * utilize this method to merge the caches.\n *\n * @param {Cache} cache\n * @public\n * @return {Promise<void>}\n */\n merge(cache: Cache): Promise<void> {\n return this.#cache.merge(cache);\n }\n\n /**\n * Generate the list of changes applied to all\n * record in the store.\n *\n * Each individual resource or document that has\n * been mutated should be described as an individual\n * `Change` entry in the returned array.\n *\n * A `Change` is described by an object containing up to\n * three properties: (1) the `identifier` of the entity that\n * changed; (2) the `op` code of that change being one of\n * `upsert` or `remove`, and if the op is `upsert` a `patch`\n * containing the data to merge into the cache for the given\n * entity.\n *\n * This `patch` is opaque to the Store but should be understood\n * by the Cache and may expect to be utilized by an Adapter\n * when generating data during a `save` operation.\n *\n * It is generally recommended that the `patch` contain only\n * the updated state, ignoring fields that are unchanged\n *\n * ```ts\n * interface Change {\n * identifier: StableRecordIdentifier | StableDocumentIdentifier;\n * op: 'upsert' | 'remove';\n * patch?: unknown;\n * }\n * ```\n *\n * @public\n */\n diff(): Promise<Change[]> {\n return this.#cache.diff();\n }\n\n // SSR Support\n // ===========\n\n /**\n * Serialize the entire contents of the Cache into a Stream\n * which may be fed back into a new instance of the same Cache\n * via `cache.hydrate`.\n *\n * @return {Promise<ReadableStream>}\n * @public\n */\n dump(): Promise<ReadableStream<unknown>> {\n return this.#cache.dump();\n }\n\n /**\n * hydrate a Cache from a Stream with content previously serialized\n * from another instance of the same Cache, resolving when hydration\n * is complete.\n *\n * This method should expect to be called both in the context of restoring\n * the Cache during application rehydration after SSR **AND** at unknown\n * times during the lifetime of an already booted application when it is\n * desired to bulk-load additional information into the cache. This latter\n * behavior supports optimizing pre/fetching of data for route transitions\n * via data-only SSR modes.\n *\n * @param {ReadableStream} stream\n * @return {Promise<void>}\n * @public\n */\n hydrate(stream: ReadableStream<unknown>): Promise<void> {\n return this.#cache.hydrate(stream);\n }\n\n // Cache\n // =====\n\n // Resource Support\n // ================\n\n /**\n * [LIFECYCLE] Signal to the cache that a new record has been instantiated on the client\n *\n * It returns properties from options that should be set on the record during the create\n * process. This return value behavior is deprecated.\n *\n * @public\n * @param identifier\n * @param options\n */\n clientDidCreate(identifier: StableRecordIdentifier, options?: Record<string, unknown>): Record<string, unknown> {\n return this.#cache.clientDidCreate(identifier, options);\n }\n\n /**\n * [LIFECYCLE] Signals to the cache that a resource\n * will be part of a save transaction.\n *\n * @public\n * @param identifier\n */\n willCommit(identifier: StableRecordIdentifier, context: StoreRequestContext): void {\n this.#cache.willCommit(identifier, context);\n }\n\n /**\n * [LIFECYCLE] Signals to the cache that a resource\n * was successfully updated as part of a save transaction.\n *\n * @public\n * @param identifier\n * @param data\n */\n didCommit(identifier: StableRecordIdentifier, result: StructuredDataDocument<unknown>): SingleResourceDataDocument {\n return this.#cache.didCommit(identifier, result);\n }\n\n /**\n * [LIFECYCLE] Signals to the cache that a resource\n * was update via a save transaction failed.\n *\n * @public\n * @param identifier\n * @param errors\n */\n commitWasRejected(identifier: StableRecordIdentifier, errors?: ApiError[]): void {\n this.#cache.commitWasRejected(identifier, errors);\n }\n\n /**\n * [LIFECYCLE] Signals to the cache that all data for a resource\n * should be cleared.\n *\n * @public\n * @param identifier\n */\n unloadRecord(identifier: StableRecordIdentifier): void {\n this.#cache.unloadRecord(identifier);\n }\n\n // Granular Resource Data APIs\n // ===========================\n\n /**\n * Retrieve the data for an attribute from the cache\n *\n * @public\n * @param identifier\n * @param propertyName\n * @return {unknown}\n */\n getAttr(identifier: StableRecordIdentifier, propertyName: string): Value | undefined {\n return this.#cache.getAttr(identifier, propertyName);\n }\n\n /**\n * Retrieve the remote state for an attribute from the cache\n *\n * @public\n * @param identifier\n * @param propertyName\n * @return {unknown}\n */\n getRemoteAttr(identifier: StableRecordIdentifier, propertyName: string): Value | undefined {\n return this.#cache.getRemoteAttr(identifier, propertyName);\n }\n\n /**\n * Mutate the data for an attribute in the cache\n *\n * @public\n * @param identifier\n * @param propertyName\n * @param value\n */\n setAttr(identifier: StableRecordIdentifier, propertyName: string, value: Value): void {\n this.#cache.setAttr(identifier, propertyName, value);\n }\n\n /**\n * Query the cache for the changed attributes of a resource.\n *\n * @public\n * @param identifier\n * @return\n */\n changedAttrs(identifier: StableRecordIdentifier): ChangedAttributesHash {\n return this.#cache.changedAttrs(identifier);\n }\n\n /**\n * Query the cache for whether any mutated attributes exist\n *\n * @public\n * @param identifier\n * @return {Boolean}\n */\n hasChangedAttrs(identifier: StableRecordIdentifier): boolean {\n return this.#cache.hasChangedAttrs(identifier);\n }\n\n /**\n * Tell the cache to discard any uncommitted mutations to attributes\n *\n * @public\n * @param identifier\n * @return the names of attributes that were restored\n */\n rollbackAttrs(identifier: StableRecordIdentifier): string[] {\n return this.#cache.rollbackAttrs(identifier);\n }\n\n // Relationships\n // =============\n\n /**\n * Query the cache for the changes to relationships of a resource.\n *\n * Returns a map of relationship names to RelationshipDiff objects.\n *\n * ```ts\n * type RelationshipDiff =\n | {\n kind: 'collection';\n remoteState: StableRecordIdentifier[];\n additions: Set<StableRecordIdentifier>;\n removals: Set<StableRecordIdentifier>;\n localState: StableRecordIdentifier[];\n reordered: boolean;\n }\n | {\n kind: 'resource';\n remoteState: StableRecordIdentifier | null;\n localState: StableRecordIdentifier | null;\n };\n ```\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @return {Map<string, RelationshipDiff>}\n */\n changedRelationships(identifier: StableRecordIdentifier): Map<string, RelationshipDiff> {\n return this.#cache.changedRelationships(identifier);\n }\n\n /**\n * Query the cache for whether any mutated attributes exist\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @return {Boolean}\n */\n hasChangedRelationships(identifier: StableRecordIdentifier): boolean {\n return this.#cache.hasChangedRelationships(identifier);\n }\n\n /**\n * Tell the cache to discard any uncommitted mutations to relationships.\n *\n * This will also discard the change on any appropriate inverses.\n *\n * This method is a candidate to become a mutation\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @return {String[]} the names of relationships that were restored\n */\n rollbackRelationships(identifier: StableRecordIdentifier): string[] {\n return this.#cache.rollbackRelationships(identifier);\n }\n\n /**\n * Query the cache for the current state of a relationship property\n *\n * @public\n * @param identifier\n * @param propertyName\n * @return resource relationship object\n */\n getRelationship(\n identifier: StableRecordIdentifier,\n propertyName: string\n ): ResourceRelationship | CollectionRelationship {\n return this.#cache.getRelationship(identifier, propertyName);\n }\n\n /**\n * Query the cache for the remote state of a relationship property\n *\n * @public\n * @param identifier\n * @param propertyName\n * @return resource relationship object\n */\n getRemoteRelationship(\n identifier: StableRecordIdentifier,\n propertyName: string\n ): ResourceRelationship | CollectionRelationship {\n return this.#cache.getRemoteRelationship(identifier, propertyName);\n }\n\n // Resource State\n // ===============\n\n /**\n * Update the cache state for the given resource to be marked as locally deleted,\n * or remove such a mark.\n *\n * @public\n * @param identifier\n * @param isDeleted\n */\n setIsDeleted(identifier: StableRecordIdentifier, isDeleted: boolean): void {\n this.#cache.setIsDeleted(identifier, isDeleted);\n }\n\n /**\n * Query the cache for any validation errors applicable to the given resource.\n *\n * @public\n * @param identifier\n * @return\n */\n getErrors(identifier: StableRecordIdentifier): ApiError[] {\n return this.#cache.getErrors(identifier);\n }\n\n /**\n * Query the cache for whether a given resource has any available data\n *\n * @public\n * @param identifier\n * @return {Boolean}\n */\n isEmpty(identifier: StableRecordIdentifier): boolean {\n return this.#cache.isEmpty(identifier);\n }\n\n /**\n * Query the cache for whether a given resource was created locally and not\n * yet persisted.\n *\n * @public\n * @param identifier\n * @return {Boolean}\n */\n isNew(identifier: StableRecordIdentifier): boolean {\n return this.#cache.isNew(identifier);\n }\n\n /**\n * Query the cache for whether a given resource is marked as deleted (but not\n * necessarily persisted yet).\n *\n * @public\n * @param identifier\n * @return {Boolean}\n */\n isDeleted(identifier: StableRecordIdentifier): boolean {\n return this.#cache.isDeleted(identifier);\n }\n\n /**\n * Query the cache for whether a given resource has been deleted and that deletion\n * has also been persisted.\n *\n * @public\n * @param identifier\n * @return {Boolean}\n */\n isDeletionCommitted(identifier: StableRecordIdentifier): boolean {\n return this.#cache.isDeletionCommitted(identifier);\n }\n}\n","import { LOG_METRIC_COUNTS, LOG_NOTIFICATIONS } from '@warp-drive/core/build-config/debugging';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport { isDocumentIdentifier, isStableIdentifier } from '../caches/identifier-cache.ts';\nimport { log } from '../debug/utils.ts';\nimport { willSyncFlushWatchers } from '../new-core-tmp/reactivity/configure.ts';\nimport type { Store } from '../store-service.ts';\n\nexport type UnsubscribeToken = object;\n\nexport type CacheOperation = 'added' | 'removed' | 'updated' | 'state';\nexport type DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';\n\nfunction isCacheOperationValue(value: NotificationType | DocumentCacheOperation): value is DocumentCacheOperation {\n return (\n value === 'added' || value === 'state' || value === 'updated' || value === 'removed' || value === 'invalidated'\n );\n}\n\nexport type NotificationType = 'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | CacheOperation;\n\nexport interface NotificationCallback {\n (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;\n (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n // (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;\n}\n\nexport interface ResourceOperationCallback {\n // resource updates\n (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n}\n\nexport interface DocumentOperationCallback {\n // document updates\n (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;\n}\n\nfunction count(label: string) {\n // @ts-expect-error\n // eslint-disable-next-line\n globalThis.__WarpDriveMetricCountData[label] = (globalThis.__WarpDriveMetricCountData[label] || 0) + 1;\n}\n\nfunction asInternalToken(token: unknown): asserts token is {\n for: StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document';\n} & (NotificationCallback | ResourceOperationCallback | DocumentOperationCallback) {\n assert(`Expected a token with a 'for' property`, token && typeof token === 'function' && 'for' in token);\n}\n\nfunction _unsubscribe(\n token: UnsubscribeToken,\n cache: Map<\n 'resource' | 'document' | StableDocumentIdentifier | StableRecordIdentifier,\n Array<NotificationCallback | ResourceOperationCallback | DocumentOperationCallback>\n >\n) {\n asInternalToken(token);\n const identifier = token.for;\n if (LOG_NOTIFICATIONS) {\n if (!identifier) {\n // eslint-disable-next-line no-console\n console.log('Passed unknown unsubscribe token to unsubscribe', identifier);\n }\n }\n if (identifier) {\n const callbacks = cache.get(identifier);\n if (!callbacks) {\n return;\n }\n\n const index = callbacks.indexOf(token);\n if (index === -1) {\n assert(`Cannot unsubscribe a token that is not subscribed`, index !== -1);\n return;\n }\n\n callbacks.splice(index, 1);\n }\n}\n\n/**\n * The NotificationManager provides the ability to subscribe to\n * changes to Cache state.\n *\n * This Feature is what allows WarpDrive to create subscriptions that\n * work with any framework or change-notification system.\n *\n * @class NotificationManager\n * @public\n */\nexport default class NotificationManager {\n declare store: Store;\n declare isDestroyed: boolean;\n declare _buffered: Map<StableDocumentIdentifier | StableRecordIdentifier, [string, string | undefined][]>;\n declare _cache: Map<\n StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document',\n Array<NotificationCallback | ResourceOperationCallback | DocumentOperationCallback>\n >;\n declare _hasFlush: boolean;\n declare _onFlushCB?: () => void;\n\n constructor(store: Store) {\n this.store = store;\n this.isDestroyed = false;\n this._buffered = new Map();\n this._hasFlush = false;\n this._cache = new Map();\n }\n\n /**\n * Subscribe to changes for a given resource identifier, resource addition/removal, or document addition/removal.\n *\n * ```ts\n * export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';\n *\n * export interface NotificationCallback {\n * (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;\n * (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n * (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;\n * }\n * export interface ResourceOperationCallback {\n * // resource updates\n * (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n * }\n * export interface DocumentOperationCallback {\n * // document updates\n * (identifier: StableDocumentIdentifier, notificationType: CacheOperation): void;\n * }\n * ```\n *\n * @public\n * @param {StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'} identifier\n * @param {NotificationCallback | ResourceOperationCallback | DocumentOperationCallback} callback\n * @return {UnsubscribeToken} an opaque token to be used with unsubscribe\n */\n subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;\n subscribe(identifier: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;\n subscribe(identifier: 'document' | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;\n subscribe(\n identifier: StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document',\n callback: NotificationCallback | ResourceOperationCallback | DocumentOperationCallback\n ): UnsubscribeToken {\n assert(\n `Expected to receive a stable Identifier to subscribe to`,\n identifier === 'resource' ||\n identifier === 'document' ||\n isStableIdentifier(identifier) ||\n isDocumentIdentifier(identifier)\n );\n let callbacks = this._cache.get(identifier);\n assert(`expected to receive a valid callback`, typeof callback === 'function');\n assert(`cannot subscribe with the same callback twice`, !callbacks || !callbacks.includes(callback));\n // we use the callback as the cancellation token\n //@ts-expect-error\n callback.for = identifier;\n\n if (!callbacks) {\n callbacks = [];\n this._cache.set(identifier, callbacks);\n }\n\n callbacks.push(callback);\n return callback;\n }\n\n /**\n * remove a previous subscription\n *\n * @public\n * @param {UnsubscribeToken} token\n */\n unsubscribe(token: UnsubscribeToken) {\n if (!this.isDestroyed) {\n _unsubscribe(token, this._cache);\n }\n }\n\n /**\n * Custom Caches and Application Code should not call this method directly.\n *\n * @param identifier\n * @param value\n * @param key\n * @return {Boolean} whether a notification was delivered to any subscribers\n * @private\n */\n notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;\n notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;\n notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;\n notify(\n identifier: StableRecordIdentifier | StableDocumentIdentifier,\n value: NotificationType | CacheOperation | DocumentCacheOperation,\n key?: string\n ): boolean {\n assert(\n `Notify does not accept a key argument for the namespace '${value}'. Received key '${key || ''}'.`,\n !key || value === 'attributes' || value === 'relationships'\n );\n if (!isStableIdentifier(identifier) && !isDocumentIdentifier(identifier)) {\n if (LOG_NOTIFICATIONS) {\n // eslint-disable-next-line no-console\n console.log(\n `Notifying: Expected to receive a stable Identifier to notify '${value}' '${key || ''}' with, but ${String(\n identifier\n )} is not in the cache`,\n identifier\n );\n }\n return false;\n }\n\n const hasSubscribers = Boolean(this._cache.get(identifier)?.length);\n\n if (isCacheOperationValue(value) || hasSubscribers) {\n let buffer = this._buffered.get(identifier);\n if (!buffer) {\n buffer = [];\n this._buffered.set(identifier, buffer);\n }\n buffer.push([value, key]);\n\n if (LOG_METRIC_COUNTS) {\n count(`notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);\n }\n if (!this._scheduleNotify()) {\n if (LOG_NOTIFICATIONS) {\n log(\n 'notify',\n 'buffered',\n `${'type' in identifier ? identifier.type : 'document'}`,\n identifier.lid,\n `${value}`,\n key || ''\n );\n }\n }\n } else {\n if (LOG_NOTIFICATIONS) {\n log(\n 'notify',\n 'discarded',\n `${'type' in identifier ? identifier.type : 'document'}`,\n identifier.lid,\n `${value}`,\n key || ''\n );\n }\n if (LOG_METRIC_COUNTS) {\n count(`DISCARDED notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);\n }\n }\n\n return hasSubscribers;\n }\n\n _onNextFlush(cb: () => void) {\n this._onFlushCB = cb;\n }\n\n _scheduleNotify(): boolean {\n const asyncFlush = this.store._enableAsyncFlush;\n\n if (this._hasFlush) {\n if (asyncFlush !== false && !willSyncFlushWatchers()) {\n return false;\n }\n }\n\n if (asyncFlush && !willSyncFlushWatchers()) {\n this._hasFlush = true;\n return false;\n }\n\n this._flush();\n return true;\n }\n\n _flush() {\n const buffered = this._buffered;\n if (buffered.size) {\n this._buffered = new Map();\n buffered.forEach((states, identifier) => {\n states.forEach((args) => {\n // @ts-expect-error\n this._flushNotification(identifier, args[0], args[1]);\n });\n });\n }\n\n this._hasFlush = false;\n this._onFlushCB?.();\n this._onFlushCB = undefined;\n }\n\n _flushNotification(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;\n _flushNotification(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n _flushNotification(identifier: StableRecordIdentifier | StableDocumentIdentifier, value: CacheOperation): boolean;\n _flushNotification(\n identifier: StableRecordIdentifier | StableDocumentIdentifier,\n value: NotificationType | CacheOperation,\n key?: string\n ): boolean {\n if (LOG_NOTIFICATIONS) {\n log(\n 'notify',\n '',\n `${'type' in identifier ? identifier.type : 'document'}`,\n identifier.lid,\n `${value}`,\n key || ''\n );\n }\n\n // TODO for documents this will need to switch based on Identifier kind\n if (isCacheOperationValue(value)) {\n const callbackMap = this._cache.get(isDocumentIdentifier(identifier) ? 'document' : 'resource') as Array<\n ResourceOperationCallback | DocumentOperationCallback\n >;\n\n if (callbackMap) {\n callbackMap.forEach((cb: ResourceOperationCallback | DocumentOperationCallback) => {\n cb(identifier as StableRecordIdentifier, value);\n });\n }\n }\n\n const callbacks = this._cache.get(identifier);\n if (!callbacks || !callbacks.length) {\n return false;\n }\n callbacks.forEach((cb) => {\n // @ts-expect-error overload doesn't narrow within body\n cb(identifier, value, key);\n });\n return true;\n }\n\n destroy() {\n this.isDestroyed = true;\n this._cache.clear();\n }\n}\n","import { assert } from '@warp-drive/build-config/macros';\n\nimport type { SignalStore, WarpDriveSignal } from '../../../store/-private/new-core-tmp/reactivity/internal';\nimport {\n consumeInternalSignal,\n getOrCreateInternalSignal,\n} from '../../../store/-private/new-core-tmp/reactivity/internal';\nimport type { ExtensionDef } from '../schema';\n\nexport type ProxiedMethod = (...args: unknown[]) => unknown;\nexport function expectNever(value: never) {}\n\nexport function isExtensionProp(\n extensions: Map<string | symbol, ExtensionDef> | null,\n prop: string | number | symbol\n): prop is string | symbol {\n return Boolean(extensions && typeof prop !== 'number' && extensions.has(prop));\n}\n\nexport function performObjectExtensionGet(\n receiver: object,\n extensions: Map<string | symbol, ExtensionDef>,\n signals: SignalStore,\n prop: string | symbol\n) {\n const desc = extensions.get(prop)!;\n switch (desc.kind) {\n case 'method': {\n return desc.fn;\n }\n case 'readonly-value': {\n return desc.value;\n }\n case 'mutable-value': {\n const signal = getOrCreateInternalSignal(signals, receiver, prop, desc.value);\n // we don't consume this signal, since its not a true local.\n return signal.value;\n }\n case 'readonly-field':\n case 'mutable-field': {\n return desc.get.call(receiver);\n }\n case 'writeonly-field': {\n assert(`Cannot get extended field ${String(prop)} as its definition has only a setter`);\n return undefined;\n }\n default: {\n expectNever(desc);\n assert(`Unhandled extension kind ${(desc as { kind: string }).kind}`);\n return undefined;\n }\n }\n}\n\nexport function performExtensionSet(\n receiver: object,\n extensions: Map<string | symbol, ExtensionDef>,\n signals: SignalStore,\n prop: string | symbol,\n value: unknown\n): boolean {\n const desc = extensions.get(prop)!;\n switch (desc.kind) {\n case 'method':\n case 'readonly-value':\n case 'readonly-field':\n assert(`Cannot set extension field ${String(prop)} as it is a ${desc.kind}`);\n return false;\n case 'mutable-value': {\n const signal = getOrCreateInternalSignal(signals, receiver, prop, desc.value);\n if (signal.value !== value) {\n // we don't notify this signal, since its not a true local.\n signal.value = value;\n }\n return true;\n }\n case 'writeonly-field':\n case 'mutable-field': {\n desc.set.call(receiver, value);\n return true;\n }\n default: {\n expectNever(desc);\n assert(`Unhandled extension kind ${(desc as { kind: string }).kind}`);\n return false;\n }\n }\n}\n\nexport function performArrayExtensionGet(\n receiver: object,\n extensions: Map<string | symbol, ExtensionDef>,\n signals: SignalStore,\n prop: string | symbol,\n _SIGNAL: WarpDriveSignal,\n boundFns: Map<string | symbol | number, ProxiedMethod>,\n transaction: (v: boolean) => void\n) {\n const desc = extensions.get(prop)!;\n switch (desc.kind) {\n case 'method': {\n let fn = boundFns.get(prop);\n\n if (fn === undefined) {\n fn = function () {\n consumeInternalSignal(_SIGNAL);\n transaction(true);\n const result = Reflect.apply(desc.fn, receiver, arguments) as unknown;\n transaction(false);\n return result;\n };\n\n boundFns.set(prop, fn);\n }\n\n return fn;\n }\n case 'mutable-field':\n case 'readonly-field': {\n return desc.get.call(receiver);\n }\n case 'readonly-value': {\n return desc.value;\n }\n case 'mutable-value': {\n const signal = getOrCreateInternalSignal(signals, receiver, prop, desc.value);\n // we don't consume this signal, since its not a true local.\n return signal.value;\n }\n case 'writeonly-field': {\n assert(`Cannot get extended field ${String(prop)} as its definition has only a setter`);\n return undefined;\n }\n default: {\n expectNever(desc);\n assert(`Unhandled extension kind ${(desc as { kind: string }).kind}`);\n return undefined;\n }\n }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*\n We redefine Proxy because the native Proxy type treats the `target` and\n `receiver` as the same type incorrectly.\n\n We ported this from Typescript's own Proxy types on 3/10/2024.\n*/\ninterface ProxyHandler<T extends object> {\n /**\n * A trap method for a function call.\n * @param target The original callable object which is being proxied.\n * @internal\n */\n apply?(target: T, thisArg: any, argArray: any[]): any;\n\n /**\n * A trap for the `new` operator.\n * @param target The original object which is being proxied.\n * @param newTarget The constructor that was originally called.\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n construct?(target: T, argArray: any[], newTarget: Function): object;\n\n /**\n * A trap for `Object.defineProperty()`.\n * @param target The original object which is being proxied.\n * @return A `Boolean` indicating whether or not the property has been defined.\n * @internal\n */\n defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;\n\n /**\n * A trap for the `delete` operator.\n * @param target The original object which is being proxied.\n * @param p The name or `Symbol` of the property to delete.\n * @return A `Boolean` indicating whether or not the property was deleted.\n * @internal\n */\n deleteProperty?(target: T, p: string | symbol): boolean;\n\n /**\n * A trap for getting a property value.\n * @param target The original object which is being proxied.\n * @param p The name or `Symbol` of the property to get.\n * @param receiver The proxy or an object that inherits from the proxy.\n * @internal\n */\n get?(target: T, p: string | symbol, receiver: any): any;\n\n /**\n * A trap for `Object.getOwnPropertyDescriptor()`.\n * @param target The original object which is being proxied.\n * @param p The name of the property whose description should be retrieved.\n * @internal\n */\n getOwnPropertyDescriptor?(target: T, p: string | symbol): PropertyDescriptor | undefined;\n\n /**\n * A trap for the `[[GetPrototypeOf]]` internal method.\n * @param target The original object which is being proxied.\n * @internal\n */\n getPrototypeOf?(target: T): object | null;\n\n /**\n * A trap for the `in` operator.\n * @param target The original object which is being proxied.\n * @param p The name or `Symbol` of the property to check for existence.\n * @internal\n */\n has?(target: T, p: string | symbol): boolean;\n\n /**\n * A trap for `Object.isExtensible()`.\n * @param target The original object which is being proxied.\n * @internal\n */\n isExtensible?(target: T): boolean;\n\n /**\n * A trap for `Reflect.ownKeys()`.\n * @param target The original object which is being proxied.\n * @internal\n */\n ownKeys?(target: T): ArrayLike<string | symbol>;\n\n /**\n * A trap for `Object.preventExtensions()`.\n * @param target The original object which is being proxied.\n * @internal\n */\n preventExtensions?(target: T): boolean;\n\n /**\n * A trap for setting a property value.\n * @param target The original object which is being proxied.\n * @param p The name or `Symbol` of the property to set.\n * @param receiver The object to which the assignment was originally directed.\n * @return A `Boolean` indicating whether or not the property was set.\n * @internal\n */\n set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;\n\n /**\n * A trap for `Object.setPrototypeOf()`.\n * @param target The original object which is being proxied.\n * @param newPrototype The object's new prototype or `null`.\n * @internal\n */\n setPrototypeOf?(target: T, v: object | null): boolean;\n}\n\ninterface ProxyConstructor {\n /**\n * Creates a revocable Proxy object.\n * @param target A target object to wrap with Proxy.\n * @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.\n * @internal\n */\n revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void };\n\n /**\n * Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the\n * original object, but which may redefine fundamental Object operations like getting, setting, and defining\n * properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.\n * @param target A target object to wrap with Proxy.\n * @param handler An object whose properties define the behavior of Proxy when an operation is attempted on it.\n * @internal\n */\n new <TSource extends object, TTarget extends object>(target: TSource, handler: ProxyHandler<TSource>): TTarget;\n}\n\nexport const NativeProxy: ProxyConstructor = Proxy as unknown as ProxyConstructor;\n","import { DEPRECATE_COMPUTED_CHAINS } from '@warp-drive/core/build-config/deprecations';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport {\n isExtensionProp,\n performArrayExtensionGet,\n performExtensionSet,\n} from '../../../reactive/-private/fields/extension.ts';\nimport type { BaseFinderOptions } from '../../../types';\nimport { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { LocalRelationshipOperation } from '../../../types/graph.ts';\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { TypeFromInstanceOrString } from '../../../types/record.ts';\nimport type { ImmutableRequestInfo } from '../../../types/request.ts';\nimport type { LegacyHasManyField, LinksModeHasManyField } from '../../../types/schema/fields.ts';\nimport type { Links, PaginationLinks } from '../../../types/spec/json-api-raw.ts';\nimport type { OpaqueRecordInstance } from '../../-types/q/record-instance.ts';\nimport { isStableIdentifier } from '../caches/identifier-cache.ts';\nimport { recordIdentifierFor } from '../caches/instance-cache.ts';\nimport type { RecordArrayManager } from '../managers/record-array-manager.ts';\nimport type { WarpDriveSignal } from '../new-core-tmp/reactivity/internal.ts';\nimport {\n ARRAY_SIGNAL,\n consumeInternalSignal,\n notifyInternalSignal,\n withSignalStore,\n} from '../new-core-tmp/reactivity/internal.ts';\nimport { defineSignal, entangleSignal } from '../new-core-tmp/reactivity/signal.ts';\nimport type { Store } from '../store-service.ts';\nimport { NativeProxy } from './native-proxy-type-fix.ts';\n\ntype KeyType = string | symbol | number;\nconst ARRAY_GETTER_METHODS = new Set<KeyType>([\n Symbol.iterator,\n 'concat',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'flat',\n 'flatMap',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'reduce',\n 'reduceRight',\n 'slice',\n 'some',\n 'values',\n]);\nconst ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);\nconst SYNC_PROPS = new Set<KeyType>(['[]', 'length', 'links', 'meta']);\nfunction isArrayGetter<T>(prop: KeyType): prop is keyof Array<T> {\n return ARRAY_GETTER_METHODS.has(prop);\n}\nfunction isArraySetter<T>(prop: KeyType): prop is keyof Array<T> {\n return ARRAY_SETTER_METHODS.has(prop);\n}\nfunction isSelfProp<T extends object>(self: T, prop: KeyType): prop is Exclude<keyof T, number> {\n return prop in self;\n}\n\nexport const SOURCE = getOrSetGlobal('#source', Symbol('#source'));\nexport const MUTATE = getOrSetGlobal('#update', Symbol('#update'));\nconst IS_COLLECTION = getOrSetGlobal('IS_COLLECTION', Symbol.for('Collection'));\n\nfunction convertToInt(prop: KeyType): number | null {\n if (typeof prop === 'symbol') return null;\n\n const num = Number(prop);\n\n if (isNaN(num)) return null;\n\n return num % 1 === 0 ? num : null;\n}\n\ntype ProxiedMethod = (...args: unknown[]) => unknown;\n\nexport type IdentifierArrayCreateOptions<T = unknown> = {\n identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];\n type?: TypeFromInstanceOrString<T>;\n store: Store;\n allowMutation: boolean;\n manager: MinimumManager;\n field?: LegacyHasManyField | LinksModeHasManyField;\n links?: Links | PaginationLinks | null;\n meta?: Record<string, unknown> | null;\n identifier?: StableDocumentIdentifier | null;\n};\n\ninterface PrivateState {\n links: Links | PaginationLinks | null;\n meta: Record<string, unknown> | null;\n}\ntype ForEachCB<T> = (record: T, index: number, context: typeof NativeProxy<StableRecordIdentifier[], T[]>) => void;\nfunction safeForEach<T>(\n instance: typeof NativeProxy<StableRecordIdentifier[], T[]>,\n arr: StableRecordIdentifier[],\n store: Store,\n callback: ForEachCB<T>,\n target: unknown\n) {\n if (target === undefined) {\n target = null;\n }\n // clone to prevent mutation\n arr = arr.slice();\n assert('`forEach` expects a function as first argument.', typeof callback === 'function');\n\n // because we retrieveLatest above we need not worry if array is mutated during iteration\n // by unloadRecord/rollbackAttributes\n // push/add/removeObject may still be problematic\n // but this is a more traditionally expected forEach bug.\n const length = arr.length; // we need to access length to ensure we are consumed\n\n for (let index = 0; index < length; index++) {\n callback.call(target, store._instanceCache.getRecord(arr[index]) as T, index, instance);\n }\n\n return instance;\n}\n\ntype PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;\n\ntype PromiseManyArray<T> = {\n length: number;\n content: IdentifierArray<T> | null;\n promise: Promise<IdentifierArray<T>> | null;\n} & PromiseTo<IdentifierArray<T>>;\n\nexport type MinimumManager = {\n _syncArray: (array: IdentifierArray) => void;\n mutate?(mutation: LocalRelationshipOperation): void;\n reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;\n};\n\n/**\n A record array is an array that contains records of a certain type (or modelName).\n The record array materializes records as needed when they are retrieved for the first\n time. You should not create record arrays yourself. Instead, an instance of\n `RecordArray` or its subclasses will be returned by your application's store\n in response to queries.\n\n This class should not be imported and instantiated by consuming applications.\n\n @class RecordArray\n @public\n*/\nexport interface IdentifierArray<T = unknown> extends Omit<Array<T>, '[]'> {\n [MUTATE]?(\n target: StableRecordIdentifier[],\n receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: WarpDriveSignal\n ): unknown;\n}\n\n// these are \"internally\" mutable, they should not be mutated by consumers\n// though this is not currently enforced.\n//\n// all of these should become gated by field-type as they shouldn't be available\n// on request results or non-legacy relationships.\nconst MUTABLE_PROPS = [\n '_updatingPromise',\n 'isDestroying',\n 'isDestroyed',\n 'query',\n 'isUpdating',\n 'isLoaded',\n 'meta',\n 'links',\n 'isAsync',\n 'isPolymorphic',\n 'identifier',\n 'cache',\n '_inverseIsAsync',\n 'key',\n 'DEPRECATED_CLASS_NAME',\n];\n\nexport class IdentifierArray<T = unknown> {\n declare DEPRECATED_CLASS_NAME: string;\n /**\n The flag to signal a `RecordArray` is currently loading data.\n Example\n ```javascript\n let people = store.peekAll('person');\n people.isUpdating; // false\n people.update();\n people.isUpdating; // true\n ```\n @property isUpdating\n @public\n @type Boolean\n */\n declare isUpdating: boolean;\n isLoaded = true;\n isDestroying = false;\n isDestroyed = false;\n _updatingPromise: Promise<IdentifierArray<T>> | null = null;\n readonly identifier: StableDocumentIdentifier | null;\n\n declare [IS_COLLECTION]: boolean;\n declare [ARRAY_SIGNAL]: WarpDriveSignal;\n declare [SOURCE]: StableRecordIdentifier[];\n\n declare links: Links | PaginationLinks | null;\n declare meta: Record<string, unknown> | null;\n declare modelName?: TypeFromInstanceOrString<T>;\n /**\n The store that created this record array.\n\n @property store\n @private\n @type Store\n */\n declare store: Store;\n declare _manager: MinimumManager;\n\n destroy(clear: boolean) {\n this.isDestroying = !clear;\n // changing the reference breaks the Proxy\n // this[SOURCE] = [];\n this[SOURCE].length = 0;\n notifyInternalSignal(this[ARRAY_SIGNAL]);\n this.isDestroyed = !clear;\n }\n\n constructor(options: IdentifierArrayCreateOptions<T>) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n this.modelName = options.type;\n this.store = options.store;\n this._manager = options.manager;\n this.identifier = options.identifier || null;\n this[SOURCE] = options.identifiers;\n this[IS_COLLECTION] = true;\n\n // we attach the signal storage to the class\n // so that its easier to find debugging.\n const signals = withSignalStore(this);\n const store = options.store;\n const boundFns = new Map<KeyType, ProxiedMethod>();\n const PrivateState: PrivateState = {\n links: options.links || null,\n meta: options.meta || null,\n };\n let transaction = false;\n\n // when a mutation occurs\n // we track all mutations within the call\n // and forward them as one\n let _SIGNAL: WarpDriveSignal = null as unknown as WarpDriveSignal;\n const extensions =\n options.field && this.store.schema.CAUTION_MEGA_DANGER_ZONE_arrayExtensions\n ? this.store.schema.CAUTION_MEGA_DANGER_ZONE_arrayExtensions(options.field)\n : null;\n\n const proxy = new NativeProxy<StableRecordIdentifier[], T[]>(this[SOURCE], {\n get<R extends typeof NativeProxy<StableRecordIdentifier[], T[]>>(\n target: StableRecordIdentifier[],\n prop: keyof R,\n receiver: R\n ): unknown {\n const index = convertToInt(prop);\n if (_SIGNAL.isStale && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {\n options.manager._syncArray(receiver as unknown as IdentifierArray);\n _SIGNAL.isStale = false;\n }\n\n if (index !== null) {\n const identifier = target[index];\n if (!transaction) {\n consumeInternalSignal(_SIGNAL);\n }\n return identifier && store._instanceCache.getRecord(identifier);\n }\n\n if (prop === ARRAY_SIGNAL) {\n return _SIGNAL;\n }\n\n if (prop === 'length') {\n return consumeInternalSignal(_SIGNAL), target.length;\n }\n\n if (prop === 'meta') return consumeInternalSignal(_SIGNAL), PrivateState.meta;\n if (prop === 'links') return consumeInternalSignal(_SIGNAL), PrivateState.links;\n if (prop === '[]') return consumeInternalSignal(_SIGNAL), receiver;\n\n if (isArrayGetter(prop)) {\n let fn = boundFns.get(prop);\n\n if (fn === undefined) {\n if (prop === 'forEach') {\n fn = function () {\n consumeInternalSignal(_SIGNAL);\n transaction = true;\n const result = safeForEach(receiver, target, store, arguments[0] as ForEachCB<T>, arguments[1]);\n transaction = false;\n return result;\n };\n } else {\n fn = function () {\n consumeInternalSignal(_SIGNAL);\n // array functions must run through Reflect to work properly\n // binding via other means will not work.\n transaction = true;\n const result = Reflect.apply(target[prop] as ProxiedMethod, receiver, arguments) as unknown;\n transaction = false;\n return result;\n };\n }\n\n boundFns.set(prop, fn);\n }\n\n return fn;\n }\n\n if (isArraySetter(prop)) {\n let fn = boundFns.get(prop);\n\n if (fn === undefined) {\n fn = function () {\n // array functions must run through Reflect to work properly\n // binding via other means will not work.\n if (!options.allowMutation) {\n assert(`Mutating this array of records via ${String(prop)} is not allowed.`, options.allowMutation);\n return;\n }\n const args: unknown[] = Array.prototype.slice.call(arguments);\n assert(`Cannot start a new array transaction while a previous transaction is underway`, !transaction);\n transaction = true;\n const result = self[MUTATE]!(target, receiver, prop as string, args, _SIGNAL);\n transaction = false;\n return result;\n };\n\n boundFns.set(prop, fn);\n }\n\n return fn;\n }\n\n if (isSelfProp(self, prop)) {\n if (prop === SOURCE) {\n return self[prop];\n }\n\n let fn = boundFns.get(prop);\n if (fn) return fn;\n\n const outcome: unknown = self[prop];\n\n if (typeof outcome === 'function') {\n fn = function () {\n consumeInternalSignal(_SIGNAL);\n // array functions must run through Reflect to work properly\n // binding via other means will not work.\n return Reflect.apply(outcome as ProxiedMethod, receiver, arguments) as unknown;\n };\n\n boundFns.set(prop, fn);\n return fn;\n }\n\n return consumeInternalSignal(_SIGNAL), outcome;\n }\n\n if (isExtensionProp(extensions, prop)) {\n return performArrayExtensionGet(\n receiver,\n extensions!,\n signals,\n prop,\n _SIGNAL,\n boundFns,\n (v: boolean) => void (transaction = v)\n );\n }\n\n return target[prop as keyof StableRecordIdentifier[]];\n },\n\n // FIXME: Should this get a generic like get above?\n set(\n target: StableRecordIdentifier[],\n prop: KeyType,\n value: unknown,\n receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>\n ): boolean {\n if (!options.allowMutation && !MUTABLE_PROPS.includes(prop as string)) {\n assert(`Mutating ${String(prop)} on this Array is not allowed.`, options.allowMutation);\n return false;\n }\n if (prop === 'length') {\n if (!transaction && value === 0) {\n transaction = true;\n self[MUTATE]!(target, receiver, 'length 0', [], _SIGNAL);\n transaction = false;\n return true;\n } else if (transaction) {\n return Reflect.set(target, prop, value);\n } else {\n assert(`unexpected length set`);\n }\n }\n if (prop === 'links') {\n PrivateState.links = (value || null) as PaginationLinks | Links | null;\n return true;\n }\n if (prop === 'meta') {\n PrivateState.meta = (value || null) as Record<string, unknown> | null;\n return true;\n }\n\n if (isExtensionProp(extensions, prop)) {\n return performExtensionSet(receiver, extensions!, signals, prop, value);\n }\n\n const index = convertToInt(prop);\n\n // we do not allow \"holey\" arrays and so if the index is\n // greater than length then we will disallow setting it.\n // however, there is a special case for \"unshift\" with more than\n // one item being inserted since current items will be moved to the\n // new indices first.\n // we \"loosely\" detect this by just checking whether we are in\n // a transaction.\n if (index === null || index > target.length) {\n if (index !== null && transaction) {\n const identifier = recordIdentifierFor(value);\n assert(`Cannot set index ${index} past the end of the array.`, isStableIdentifier(identifier));\n target[index] = identifier;\n return true;\n } else if (isSelfProp(self, prop)) {\n // @ts-expect-error not all properties are indeces and we can't safely cast\n self[prop] = value;\n return true;\n }\n return false;\n }\n\n const original: StableRecordIdentifier | undefined = target[index];\n const newIdentifier = extractIdentifierFromRecord(value);\n assert(`Expected a record`, isStableIdentifier(newIdentifier));\n // We generate \"transactions\" whenever a setter method on the array\n // is called and might bulk update multiple array cells. Fundamentally,\n // all array operations decompose into individual cell replacements.\n // e.g. a push is really a \"replace cell at next index with new value\"\n // or a splice is \"shift all values left/right by X and set out of new\n // bounds cells to undefined\"\n //\n // so, if we are in a transaction, then this is not a user generated change\n // but one generated by a setter method. In this case we want to only apply\n // the change to the target array and not call the MUTATE method.\n // If there is no transaction though, then this means the user themselves has\n // directly changed the value of a specific index and we need to thus generate\n // a mutation for that change.\n // e.g. \"arr.push(newVal)\" is handled by a \"addToRelatedRecords\" mutation within\n // a transaction.\n // while \"arr[arr.length] = newVal;\" is handled by this replace cell code path.\n if (!transaction) {\n self[MUTATE]!(target, receiver, 'replace cell', [index, original, newIdentifier], _SIGNAL);\n } else {\n target[index] = newIdentifier;\n }\n\n return true;\n },\n\n deleteProperty(target: StableRecordIdentifier[], prop: string | symbol): boolean {\n assert(`Deleting keys on managed arrays is disallowed`, transaction);\n if (!transaction) {\n return false;\n }\n return Reflect.deleteProperty(target, prop);\n },\n\n getPrototypeOf() {\n return Array.prototype as unknown as IdentifierArray<T>;\n },\n }) as IdentifierArray<T>;\n\n if (DEBUG) {\n Object.defineProperty(this, '__SHOW_ME_THE_DATA_(debug mode only)__', {\n enumerable: false,\n configurable: true,\n get() {\n return proxy.slice();\n },\n });\n }\n\n // we entangle the signal on the returned proxy since that is\n // the object that other code will be interfacing with.\n _SIGNAL = entangleSignal(signals, proxy, ARRAY_SIGNAL, undefined);\n\n return proxy;\n }\n\n /**\n Used to get the latest version of all of the records in this array\n from the adapter.\n\n Example\n\n ```javascript\n let people = store.peekAll('person');\n people.isUpdating; // false\n\n people.update().then(function() {\n people.isUpdating; // false\n });\n\n people.isUpdating; // true\n ```\n\n @public\n */\n update(): Promise<IdentifierArray<T>> {\n if (this.isUpdating) {\n return this._updatingPromise!;\n }\n\n this.isUpdating = true;\n\n const updatingPromise = this._update();\n void updatingPromise.finally(() => {\n this._updatingPromise = null;\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n this.isUpdating = false;\n });\n\n this._updatingPromise = updatingPromise;\n\n return updatingPromise;\n }\n\n /*\n Update this Array and return a promise which resolves once the update\n is finished.\n */\n _update(): Promise<IdentifierArray<T>> {\n assert(`_update cannot be used with this array`, this.modelName);\n // @ts-expect-error typescript is unable to handle the complexity of\n // T = unknown, modelName = string\n // T extends TypedRecordInstance, modelName = TypeFromInstance<T>\n // both being valid options to pass through here.\n return this.store.findAll<T>(this.modelName, { reload: true });\n }\n\n // TODO deprecate\n /**\n Saves all of the records in the `RecordArray`.\n\n Example\n\n ```javascript\n let messages = store.peekAll('message');\n messages.forEach(function(message) {\n message.hasBeenSeen = true;\n });\n messages.save();\n ```\n\n @public\n @return {Promise<IdentifierArray>} promise\n */\n save(): Promise<IdentifierArray> {\n const promise = Promise.all(this.map((record) => this.store.saveRecord(record))).then(() => this);\n\n return promise;\n }\n}\n\n// this will error if someone tries to call\n// A(identifierArray) since it is not configurable\n// which is preferable to the `meta` override we used\n// before which required importing all of Ember\nconst desc = {\n enumerable: true,\n configurable: false,\n get: function () {\n // here to support computed chains\n // and {{#each}}\n if (DEPRECATE_COMPUTED_CHAINS) {\n return this;\n }\n },\n};\n// compat(desc);\nObject.defineProperty(IdentifierArray.prototype, '[]', desc);\n\ndefineSignal(IdentifierArray.prototype, 'isUpdating', false);\n\nexport type CollectionCreateOptions = IdentifierArrayCreateOptions & {\n manager: RecordArrayManager;\n query: ImmutableRequestInfo | Record<string, unknown> | null;\n isLoaded: boolean;\n};\n\nexport class Collection<T = unknown> extends IdentifierArray<T> {\n query: ImmutableRequestInfo | Record<string, unknown> | null = null;\n declare _manager: RecordArrayManager;\n\n constructor(options: CollectionCreateOptions) {\n super(options as IdentifierArrayCreateOptions);\n this.query = options.query || null;\n this.isLoaded = options.isLoaded || false;\n }\n\n _update(): Promise<Collection<T>> {\n const { store, query } = this;\n\n // TODO save options from initial request?\n assert(`update cannot be used with this array`, this.modelName);\n assert(`update cannot be used with no query`, query);\n // @ts-expect-error typescript is unable to handle the complexity of\n // T = unknown, modelName = string\n // T extends TypedRecordInstance, modelName = TypeFromInstance<T>\n // both being valid options to pass through here.\n const promise = store.query<T>(this.modelName, query as Record<string, unknown>, { _recordArray: this });\n\n return promise;\n }\n\n destroy(clear: boolean) {\n super.destroy(clear);\n this._manager._managed.delete(this);\n this._manager._pending.delete(this);\n }\n}\n// trick the proxy \"in\" check\nCollection.prototype.query = null;\n\n// Ensure instanceof works correctly\n// Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);\n\ntype PromiseProxyRecord = { then(): void; content: OpaqueRecordInstance | null | undefined };\n\nfunction assertRecordPassedToHasMany(record: OpaqueRecordInstance | PromiseProxyRecord) {\n assert(\n `All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`,\n (function () {\n try {\n recordIdentifierFor(record);\n return true;\n } catch {\n return false;\n }\n })()\n );\n}\n\nfunction extractIdentifierFromRecord(record: PromiseProxyRecord | OpaqueRecordInstance | null) {\n if (!record) {\n return null;\n }\n\n assertRecordPassedToHasMany(record);\n return recordIdentifierFor(record);\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { LocalRelationshipOperation } from '../../../types/graph.ts';\nimport type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { ImmutableRequestInfo } from '../../../types/request.ts';\nimport type { CollectionResourceDocument } from '../../../types/spec/json-api-raw.ts';\nimport { ARRAY_SIGNAL, notifyInternalSignal } from '../new-core-tmp/reactivity/internal.ts';\nimport type { CollectionCreateOptions } from '../record-arrays/identifier-array.ts';\nimport { Collection, IdentifierArray, SOURCE } from '../record-arrays/identifier-array.ts';\nimport type { Store } from '../store-service.ts';\nimport type { CacheOperation, DocumentCacheOperation, UnsubscribeToken } from './notification-manager.ts';\n\nconst FAKE_ARR = getOrSetGlobal('FAKE_ARR', {});\nconst SLICE_BATCH_SIZE = 1200;\n/**\n * This is a clever optimization.\n *\n * clever optimizations rarely stand the test of time, so if you're\n * ever curious or think something better is possible please benchmark\n * and discuss. The benchmark for this at the time of writing is in\n * `scripts/benchmark-push.js`\n *\n * This approach turns out to be 150x faster in Chrome and node than\n * simply using push or concat. It's highly susceptible to the specifics\n * of the batch size, and may require tuning.\n *\n * Clever optimizations should always come with a `why`. This optimization\n * exists for two reasons.\n *\n * 1) array.push(...objects) and Array.prototype.push.apply(arr, objects)\n * are susceptible to stack overflows. The size of objects at which this\n * occurs varies by environment, browser, and current stack depth and memory\n * pressure; however, it occurs in all browsers in fairly pristine conditions\n * somewhere around 125k to 200k elements. Since WarpDrive regularly encounters\n * arrays larger than this in size, we cannot use push.\n *\n * 2) `array.concat` or simply setting the array to a new reference is often an\n * easier approach; however, native Proxy to an array cannot swap it's target array\n * and attempts at juggling multiple array sources have proven to be victim to a number\n * of browser implementation bugs. Should these bugs be addressed then we could\n * simplify to using `concat`, however, do note this is currently 150x faster\n * than concat, and due to the overloaded signature of concat will likely always\n * be faster.\n *\n * Sincerely,\n * - runspired (Chris Thoburn) 08/21/2022\n *\n * @function fastPush\n * @internal\n * @param target the array to push into\n * @param source the items to push into target\n */\nexport function fastPush<T>(target: T[], source: T[]) {\n let startLength = 0;\n const newLength = source.length;\n while (newLength - startLength > SLICE_BATCH_SIZE) {\n // eslint-disable-next-line prefer-spread\n target.push.apply(target, source.slice(startLength, startLength + SLICE_BATCH_SIZE));\n startLength += SLICE_BATCH_SIZE;\n }\n // eslint-disable-next-line prefer-spread\n target.push.apply(target, source.slice(startLength));\n}\n\ntype ChangeSet = Map<StableRecordIdentifier, 'add' | 'del'>;\n\n/**\n @class RecordArrayManager\n @internal\n*/\nexport class RecordArrayManager {\n declare store: Store;\n declare isDestroying: boolean;\n declare isDestroyed: boolean;\n declare _set: Map<IdentifierArray, Set<StableRecordIdentifier>>;\n declare _live: Map<string, IdentifierArray>;\n declare _managed: Set<IdentifierArray>;\n declare _pending: Map<IdentifierArray, ChangeSet>;\n declare _identifiers: Map<StableRecordIdentifier, Set<Collection>>;\n declare _staged: Map<string, ChangeSet>;\n declare _subscription: UnsubscribeToken;\n declare _documentSubscription: UnsubscribeToken;\n declare _keyedArrays: Map<string, Collection>;\n declare _visibilitySet: Map<StableRecordIdentifier, boolean>;\n\n constructor(options: { store: Store }) {\n this.store = options.store;\n this.isDestroying = false;\n this.isDestroyed = false;\n this._live = new Map();\n this._managed = new Set();\n this._pending = new Map();\n this._staged = new Map();\n this._keyedArrays = new Map();\n this._identifiers = new Map();\n this._set = new Map();\n this._visibilitySet = new Map();\n\n this._subscription = this.store.notifications.subscribe(\n 'document',\n (identifier: StableDocumentIdentifier, type: DocumentCacheOperation) => {\n if (type === 'updated' && this._keyedArrays.has(identifier.lid)) {\n const array = this._keyedArrays.get(identifier.lid)!;\n this.dirtyArray(array, 0, true);\n }\n }\n );\n\n this._subscription = this.store.notifications.subscribe(\n 'resource',\n (identifier: StableRecordIdentifier, type: CacheOperation) => {\n if (type === 'added') {\n this._visibilitySet.set(identifier, true);\n this.identifierAdded(identifier);\n } else if (type === 'removed') {\n this._visibilitySet.set(identifier, false);\n this.identifierRemoved(identifier);\n } else if (type === 'state') {\n this.identifierChanged(identifier);\n }\n }\n );\n }\n\n _syncArray(array: IdentifierArray | Collection) {\n const pending = this._pending.get(array);\n const isRequestArray = isCollection(array);\n\n if ((!isRequestArray && !pending) || this.isDestroying || this.isDestroyed) {\n return;\n }\n\n // first flush any staged changes\n if (pending) {\n sync(array, pending, this._set.get(array)!);\n this._pending.delete(array);\n }\n\n // then pull new state if required\n if (isRequestArray) {\n const signal = array[ARRAY_SIGNAL];\n\n // we only need to rebuild the array from cache if a full sync is required\n // due to notification that the cache has changed\n if (signal.value === 'cache-sync') {\n const doc = this.store.cache.peek(array.identifier);\n assert(`Expected to find a document for ${array.identifier.lid} but found none`, doc);\n const data = !('data' in doc) || !Array.isArray(doc.data) ? [] : doc.data;\n // TODO technically we should destroy here if\n // !('data' in doc) || !Array.isArray(doc.data)\n // is true.\n this.populateManagedArray(array, data, null);\n }\n }\n }\n\n mutate(mutation: LocalRelationshipOperation): void {\n this.store.cache.mutate(mutation);\n }\n\n /**\n Get the `RecordArray` for a modelName, which contains all loaded records of\n given modelName.\n\n @internal\n @param {String} modelName\n @return {RecordArray}\n */\n liveArrayFor(type: string): IdentifierArray {\n let array = this._live.get(type);\n const identifiers: StableRecordIdentifier[] = [];\n const staged = this._staged.get(type);\n if (staged) {\n staged.forEach((value, key) => {\n if (value === 'add') {\n identifiers.push(key);\n }\n });\n this._staged.delete(type);\n }\n\n if (!array) {\n array = new IdentifierArray({\n type,\n identifiers,\n store: this.store,\n allowMutation: false,\n manager: this,\n });\n this._live.set(type, array);\n this._set.set(array, new Set(identifiers));\n }\n\n return array;\n }\n\n getCollection(config: {\n type?: string;\n query?: ImmutableRequestInfo | Record<string, unknown>;\n identifiers?: StableRecordIdentifier[];\n doc?: CollectionResourceDocument;\n identifier?: StableDocumentIdentifier | null;\n }): Collection {\n if (config.identifier && this._keyedArrays.has(config.identifier.lid)) {\n return this._keyedArrays.get(config.identifier.lid)!;\n }\n\n const options: CollectionCreateOptions = {\n type: config.type,\n identifier: config.identifier || null,\n links: config.doc?.links || null,\n meta: config.doc?.meta || null,\n query: config.query || null,\n identifiers: config.identifiers || [],\n isLoaded: !!config.identifiers?.length,\n allowMutation: false,\n store: this.store,\n manager: this,\n };\n const array = new Collection(options);\n this._managed.add(array);\n this._set.set(array, new Set(options.identifiers || []));\n\n if (config.identifier) {\n this._keyedArrays.set(config.identifier.lid, array);\n }\n\n if (config.identifiers) {\n associate(this._identifiers, array, config.identifiers);\n }\n\n return array;\n }\n\n dirtyArray(array: IdentifierArray, delta: number, shouldSyncFromCache: boolean): void {\n if (array === FAKE_ARR) {\n return;\n }\n const signal = array[ARRAY_SIGNAL];\n if (!signal.isStale || delta > 0) {\n notifyInternalSignal(signal);\n\n // when the cache has updated for our array, we need to\n // do a full rebuild of the array\n signal.value = shouldSyncFromCache ? 'cache-sync' : 'patch';\n }\n }\n\n _getPendingFor(\n identifier: StableRecordIdentifier,\n includeManaged: boolean,\n isRemove?: boolean\n ): Map<IdentifierArray, ChangeSet> | void {\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n\n const liveArray = this._live.get(identifier.type);\n const allPending = this._pending;\n const pending: Map<IdentifierArray, ChangeSet> = new Map();\n\n if (includeManaged) {\n const managed = this._identifiers.get(identifier);\n if (managed) {\n managed.forEach((arr) => {\n let changes = allPending.get(arr);\n if (!changes) {\n changes = new Map();\n allPending.set(arr, changes);\n }\n pending.set(arr, changes);\n });\n }\n }\n\n // during unloadAll we can ignore removes since we've already\n // cleared the array.\n if (liveArray && liveArray[SOURCE].length === 0 && isRemove) {\n const pendingLive = allPending.get(liveArray);\n if (!pendingLive || pendingLive.size === 0) {\n return pending;\n }\n }\n\n if (!liveArray) {\n // start building a changeset for when we eventually\n // do have a live array\n let changes = this._staged.get(identifier.type);\n if (!changes) {\n changes = new Map();\n this._staged.set(identifier.type, changes);\n }\n pending.set(FAKE_ARR as IdentifierArray, changes);\n } else {\n let changes = allPending.get(liveArray);\n if (!changes) {\n changes = new Map();\n allPending.set(liveArray, changes);\n }\n pending.set(liveArray, changes);\n }\n\n return pending;\n }\n\n populateManagedArray(\n array: Collection,\n identifiers: StableRecordIdentifier[],\n payload: CollectionResourceDocument | null\n ) {\n this._pending.delete(array);\n const source = array[SOURCE];\n assert(\n `The new state of the collection should not be using the same array reference as the original state.`,\n source !== identifiers\n );\n const old = source.slice();\n source.length = 0;\n fastPush(source, identifiers);\n this._set.set(array, new Set(identifiers));\n\n if (!isCollection(array)) {\n notifyInternalSignal(array[ARRAY_SIGNAL]);\n array.meta = payload?.meta || null;\n array.links = payload?.links || null;\n }\n array.isLoaded = true;\n\n disassociate(this._identifiers, array, old);\n associate(this._identifiers, array, identifiers);\n }\n\n identifierAdded(identifier: StableRecordIdentifier): void {\n const changeSets = this._getPendingFor(identifier, false);\n if (changeSets) {\n changeSets.forEach((changes, array) => {\n const existing = changes.get(identifier);\n if (existing === 'del') {\n changes.delete(identifier);\n } else {\n changes.set(identifier, 'add');\n\n this.dirtyArray(array, changes.size, false);\n }\n });\n }\n }\n\n identifierRemoved(identifier: StableRecordIdentifier): void {\n const changeSets = this._getPendingFor(identifier, true, true);\n if (changeSets) {\n changeSets.forEach((changes, array) => {\n const existing = changes.get(identifier);\n if (existing === 'add') {\n changes.delete(identifier);\n } else {\n changes.set(identifier, 'del');\n\n this.dirtyArray(array, changes.size, false);\n }\n });\n }\n }\n\n identifierChanged(identifier: StableRecordIdentifier): void {\n const newState = this.store._instanceCache.recordIsLoaded(identifier, true);\n\n // if the change matches the most recent direct added/removed\n // state, then we can ignore it\n if (this._visibilitySet.get(identifier) === newState) {\n return;\n }\n\n if (newState) {\n this.identifierAdded(identifier);\n } else {\n this.identifierRemoved(identifier);\n }\n }\n\n clear(isClear = true) {\n this._live.forEach((array) => array.destroy(isClear));\n this._managed.forEach((array) => array.destroy(isClear));\n this._managed.clear();\n this._identifiers.clear();\n this._pending.clear();\n this._set.forEach((set) => set.clear());\n this._visibilitySet.clear();\n }\n\n destroy() {\n this.isDestroying = true;\n this.clear(false);\n this._live.clear();\n this.isDestroyed = true;\n this.store.notifications.unsubscribe(this._subscription);\n }\n}\n\nfunction associate(\n ArraysCache: Map<StableRecordIdentifier, Set<Collection>>,\n array: Collection,\n identifiers: StableRecordIdentifier[]\n) {\n for (let i = 0; i < identifiers.length; i++) {\n const identifier = identifiers[i];\n let cache = ArraysCache.get(identifier);\n if (!cache) {\n cache = new Set();\n ArraysCache.set(identifier, cache);\n }\n cache.add(array);\n }\n}\n\nfunction disassociate(\n ArraysCache: Map<StableRecordIdentifier, Set<Collection>>,\n array: Collection,\n identifiers: StableRecordIdentifier[]\n) {\n for (let i = 0; i < identifiers.length; i++) {\n disassociateIdentifier(ArraysCache, array, identifiers[i]);\n }\n}\n\nexport function disassociateIdentifier(\n ArraysCache: Map<StableRecordIdentifier, Set<Collection>>,\n array: Collection,\n identifier: StableRecordIdentifier\n) {\n const cache = ArraysCache.get(identifier);\n if (cache) {\n cache.delete(array);\n }\n}\n\nfunction sync(\n array: IdentifierArray,\n changes: Map<StableRecordIdentifier, 'add' | 'del'>,\n arraySet: Set<StableRecordIdentifier>\n) {\n const state = array[SOURCE];\n const adds: StableRecordIdentifier[] = [];\n const removes: StableRecordIdentifier[] = [];\n changes.forEach((value, key) => {\n if (value === 'add') {\n // likely we want to keep a Set along-side\n if (arraySet.has(key)) {\n return;\n }\n adds.push(key);\n arraySet.add(key);\n } else {\n if (arraySet.has(key)) {\n removes.push(key);\n arraySet.delete(key);\n }\n }\n });\n if (removes.length) {\n if (removes.length === state.length) {\n state.length = 0;\n // changing the reference breaks the Proxy\n // state = array[SOURCE] = [];\n } else {\n removes.forEach((i) => {\n const index = state.indexOf(i);\n if (index !== -1) {\n state.splice(index, 1);\n arraySet.delete(i);\n }\n });\n }\n }\n\n if (adds.length) {\n fastPush(state, adds);\n // changing the reference breaks the Proxy\n // else we could do this\n /*\n if (state.length === 0) {\n array[SOURCE] = adds;\n } else {\n array[SOURCE] = state.concat(adds);\n }\n */\n }\n}\n\nfunction isCollection(\n array: IdentifierArray | Collection\n): array is Collection & { identifier: StableDocumentIdentifier } {\n return array.identifier !== null;\n}\n","import { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport { getOrSetGlobal } from '../../../types/-private.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { FindRecordOptions } from '../../-types/q/store.ts';\nimport type { Store } from '../store-service.ts';\n\nconst Touching = getOrSetGlobal('Touching', Symbol('touching'));\nexport const RequestPromise = getOrSetGlobal('RequestPromise', Symbol('promise'));\nconst EMPTY_ARR: RequestCacheRequestState[] = DEBUG ? (Object.freeze([]) as unknown as RequestCacheRequestState[]) : [];\n\nexport interface Operation {\n op: string;\n options: FindRecordOptions | undefined;\n recordIdentifier: StableRecordIdentifier;\n}\n\nexport interface FindRecordQuery extends Operation {\n op: 'findRecord';\n}\n\nexport interface SaveRecordMutation extends Operation {\n op: 'saveRecord';\n}\n\nexport interface Request {\n data: Operation[];\n options?: Record<string, unknown>;\n}\n\nexport type RequestStates = 'pending' | 'fulfilled' | 'rejected';\n\nexport interface RequestCacheRequestState {\n state: RequestStates;\n type: 'query' | 'mutation';\n request: Request;\n response?: Response;\n}\n\nexport interface Response {\n // rawData: unknown;\n data: unknown;\n}\n\ninterface InternalRequest extends RequestCacheRequestState {\n [Touching]: StableRecordIdentifier[];\n [RequestPromise]?: Promise<unknown>;\n}\n\ntype RecordOperation = FindRecordQuery | SaveRecordMutation;\nexport type RequestSubscription = (requestState: RequestCacheRequestState) => void;\n\nfunction hasRecordIdentifier(op: Operation): op is RecordOperation {\n return 'recordIdentifier' in op;\n}\n\n/**\n * The RequestStateService is used to track the state of requests\n * for fetching or updating known resource identifies that are inflight.\n *\n * @class RequestStateService\n * @public\n */\nexport class RequestStateService {\n _pending: Map<StableRecordIdentifier, InternalRequest[]> = new Map();\n _done: Map<StableRecordIdentifier, InternalRequest[]> = new Map();\n _subscriptions: Map<StableRecordIdentifier, RequestSubscription[]> = new Map();\n _toFlush: InternalRequest[] = [];\n _store: Store;\n\n constructor(store: Store) {\n this._store = store;\n }\n\n _clearEntries(identifier: StableRecordIdentifier) {\n this._done.delete(identifier);\n }\n\n _enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T> {\n const query = queryRequest.data[0];\n if (hasRecordIdentifier(query)) {\n const identifier = query.recordIdentifier;\n const type = query.op === 'saveRecord' ? ('mutation' as const) : ('query' as const);\n if (!this._pending.has(identifier)) {\n this._pending.set(identifier, []);\n }\n const request: InternalRequest = {\n state: 'pending',\n request: queryRequest,\n type,\n } as InternalRequest;\n request[Touching] = [query.recordIdentifier];\n request[RequestPromise] = promise;\n this._pending.get(identifier)!.push(request);\n this._triggerSubscriptions(request);\n return promise.then(\n (result) => {\n this._dequeue(identifier, request);\n const finalizedRequest = {\n state: 'fulfilled',\n request: queryRequest,\n type,\n response: { data: result },\n } as InternalRequest;\n finalizedRequest[Touching] = request[Touching];\n this._addDone(finalizedRequest);\n this._triggerSubscriptions(finalizedRequest);\n return result;\n },\n (error) => {\n this._dequeue(identifier, request);\n const finalizedRequest = {\n state: 'rejected',\n request: queryRequest,\n type,\n response: { data: error },\n } as InternalRequest;\n finalizedRequest[Touching] = request[Touching];\n this._addDone(finalizedRequest);\n this._triggerSubscriptions(finalizedRequest);\n throw error;\n }\n );\n }\n assert(`Expected a well formed query`);\n }\n\n _triggerSubscriptions(req: InternalRequest): void {\n if (req.state === 'pending') {\n this._flushRequest(req);\n return;\n }\n this._toFlush.push(req);\n\n if (this._toFlush.length === 1) {\n this._store.notifications._onNextFlush(() => {\n this._flush();\n });\n }\n }\n\n _flush(): void {\n this._toFlush.forEach((req) => {\n this._flushRequest(req);\n });\n this._toFlush = [];\n }\n\n _flushRequest(req: InternalRequest): void {\n req[Touching].forEach((identifier: StableRecordIdentifier) => {\n const subscriptions = this._subscriptions.get(identifier);\n if (subscriptions) {\n subscriptions.forEach((callback) => callback(req));\n }\n });\n }\n\n _dequeue(identifier: StableRecordIdentifier, request: InternalRequest) {\n const pending = this._pending.get(identifier)!;\n this._pending.set(\n identifier,\n pending.filter((req) => req !== request)\n );\n }\n\n _addDone(request: InternalRequest) {\n request[Touching].forEach((identifier) => {\n // TODO add support for multiple\n const requestDataOp = request.request.data[0].op;\n let requests = this._done.get(identifier);\n\n if (requests) {\n requests = requests.filter((req) => {\n // TODO add support for multiple\n let data: Operation;\n if (Array.isArray(req.request.data)) {\n data = req.request.data[0];\n } else {\n data = req.request.data;\n }\n return data.op !== requestDataOp;\n });\n }\n requests = requests || [];\n requests.push(request);\n this._done.set(identifier, requests);\n });\n }\n\n /**\n * Subscribe to requests for a given resource identity.\n *\n * The callback will receive the current state of the request.\n *\n * ```ts\n * interface RequestState {\n * state: 'pending' | 'fulfilled' | 'rejected';\n * type: 'query' | 'mutation';\n * request: Request;\n * response?: { data: unknown };\n * }\n * ```\n *\n * Note: It should be considered dangerous to use this API for more than simple\n * state derivation or debugging. The `request` and `response` properties are poorly\n * spec'd and may change unexpectedly when shifting what Handlers are in use or how\n * requests are issued from the Store.\n *\n * We expect to revisit this API in the near future as we continue to refine the\n * RequestManager ergonomics, as a simpler but more powerful direct integration\n * with the RequestManager for these purposes is likely to be a better long-term\n * design.\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @param {(state: RequestCacheRequestState) => void} callback\n */\n subscribeForRecord(identifier: StableRecordIdentifier, callback: RequestSubscription) {\n let subscriptions = this._subscriptions.get(identifier);\n if (!subscriptions) {\n subscriptions = [];\n this._subscriptions.set(identifier, subscriptions);\n }\n subscriptions.push(callback);\n }\n\n /**\n * Retrieve all active requests for a given resource identity.\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @return {RequestCacheRequestState[]} an array of request states for any pending requests for the given identifier\n */\n getPendingRequestsForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState[] {\n return this._pending.get(identifier) || EMPTY_ARR;\n }\n\n /**\n * Retrieve the last completed request for a given resource identity.\n *\n * @public\n * @param {StableRecordIdentifier} identifier\n * @return {RequestCacheRequestState | null} the state of the most recent request for the given identifier\n */\n getLastRequestForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState | null {\n const requests = this._done.get(identifier);\n if (requests) {\n return requests[requests.length - 1];\n }\n return null;\n }\n}\n","export function isNonEmptyString(str: unknown): str is string {\n return Boolean(str && typeof str === 'string');\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from '../../../types/spec/json-api-raw.ts';\nimport { isStableIdentifier } from '../caches/identifier-cache.ts';\nimport { coerceId } from './coerce-id.ts';\nimport { isNonEmptyString } from './is-non-empty-string.ts';\n\nexport function constructResource(type: ResourceIdentifierObject): ResourceIdentifierObject;\nexport function constructResource(type: string, id: string, lid: string): ExistingResourceIdentifierObject;\nexport function constructResource(\n type: string | undefined,\n id: null | undefined,\n lid: string\n): ExistingResourceIdentifierObject;\nexport function constructResource(type: string, id: string, lid?: string | null): ExistingResourceIdentifierObject;\nexport function constructResource(\n type: string,\n id?: string | number | null,\n lid?: string | null\n): ResourceIdentifierObject;\nexport function constructResource(\n type: string | ResourceIdentifierObject | undefined,\n id?: string | number | null,\n lid?: string | null\n): ResourceIdentifierObject | ExistingResourceIdentifierObject {\n if (typeof type === 'object' && type !== null) {\n const resource = type;\n if (isStableIdentifier(resource)) {\n return resource;\n }\n if ('id' in resource) {\n resource.id = coerceId(resource.id);\n }\n\n assert(\n 'Expected either id or lid to be a valid string',\n ('id' in resource && isNonEmptyString(resource.id)) || isNonEmptyString(resource.lid)\n );\n assert('if id is present, the type must be a string', !('id' in resource) || typeof resource.type === 'string');\n\n return resource;\n } else {\n const trueId = coerceId(id);\n if (!isNonEmptyString(trueId)) {\n if (isNonEmptyString(lid)) {\n return { lid };\n }\n throw new Error('Expected either id or lid to be a valid string');\n }\n\n assert('type must be a string', typeof type === 'string');\n\n if (isNonEmptyString(lid)) {\n return { type, id: trueId, lid };\n }\n\n return { type, id: trueId };\n }\n}\n","// this import location is deprecated but breaks in 4.8 and older\nimport { deprecate } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport {\n __INTERNAL_LOG_NATIVE_MAP_SET_COUNTS,\n LOG_METRIC_COUNTS,\n LOG_REQUESTS,\n} from '@warp-drive/core/build-config/debugging';\nimport {\n DEPRECATE_STORE_EXTENDS_EMBER_OBJECT,\n ENABLE_LEGACY_SCHEMA_SERVICE,\n} from '@warp-drive/core/build-config/deprecations';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { Graph } from '../../graph/-private.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ReactiveDocument } from '../../reactive/-private/document.ts';\nimport type { Future } from '../../request.ts';\nimport type { RequestManager } from '../../request/-private/manager.ts';\nimport type { Cache } from '../../types/cache.ts';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '../../types/identifier.ts';\nimport type { TypedRecordInstance, TypeFromInstance } from '../../types/record.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { CacheOptions, RequestInfo } from '../../types/request.ts';\nimport { EnableHydration, SkipCache } from '../../types/request.ts';\nimport { getRuntimeConfig, setLogging } from '../../types/runtime.ts';\nimport type { ResourceDocument } from '../../types/spec/document.ts';\nimport type {\n CollectionResourceDocument,\n EmptyResourceDocument,\n JsonApiDocument,\n ResourceIdentifierObject,\n SingleResourceDocument,\n} from '../../types/spec/json-api-raw.ts';\nimport type { Type } from '../../types/symbols.ts';\nimport type { CacheCapabilitiesManager } from '../-types/q/cache-capabilities-manager.ts';\nimport type { ModelSchema } from '../-types/q/ds-model.ts';\nimport type { OpaqueRecordInstance } from '../-types/q/record-instance.ts';\nimport type { SchemaService } from '../-types/q/schema-service.ts';\nimport type { FindAllOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions } from '../-types/q/store.ts';\nimport type { StoreRequestInput } from './cache-handler/handler.ts';\nimport type { CachePolicy } from './cache-handler/types.ts';\nimport { IdentifierCache } from './caches/identifier-cache.ts';\nimport {\n InstanceCache,\n peekRecordIdentifier,\n preloadData,\n recordIdentifierFor,\n resourceIsFullyDeleted,\n storeFor,\n} from './caches/instance-cache.ts';\nimport type RecordReference from './legacy-model-support/record-reference.ts';\nimport { getShimClass } from './legacy-model-support/shim-model-class.ts';\nimport { CacheManager } from './managers/cache-manager.ts';\nimport NotificationManager from './managers/notification-manager.ts';\nimport { RecordArrayManager } from './managers/record-array-manager.ts';\nimport { RequestPromise, RequestStateService } from './network/request-cache.ts';\nimport type { Collection, IdentifierArray } from './record-arrays/identifier-array.ts';\nimport { coerceId, ensureStringId } from './utils/coerce-id.ts';\nimport { constructResource } from './utils/construct-resource.ts';\nimport { normalizeModelName } from './utils/normalize-model-name.ts';\n// @ts-expect-error adding to globalThis\nglobalThis.setWarpDriveLogging = setLogging;\n\n// @ts-expect-error adding to globalThis\nglobalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;\n\nif (LOG_METRIC_COUNTS) {\n // @ts-expect-error adding to globalThis\n // eslint-disable-next-line\n globalThis.__WarpDriveMetricCountData = globalThis.__WarpDriveMetricCountData || {};\n\n // @ts-expect-error adding to globalThis\n globalThis.getWarpDriveMetricCounts = () => {\n // @ts-expect-error\n // eslint-disable-next-line\n return structuredClone(globalThis.__WarpDriveMetricCountData);\n };\n\n // @ts-expect-error adding to globalThis\n globalThis.resetWarpDriveMetricCounts = () => {\n // @ts-expect-error\n globalThis.__WarpDriveMetricCountData = {};\n };\n\n if (__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS) {\n // @ts-expect-error adding to globalThis\n globalThis.__primitiveInstanceId = 0;\n\n function interceptAndLog(\n klassName: 'Set' | 'Map' | 'WeakSet' | 'WeakMap',\n methodName: 'add' | 'set' | 'delete' | 'has' | 'get' | 'constructor'\n ) {\n const klass = globalThis[klassName];\n\n if (methodName === 'constructor') {\n const instantiationLabel = `new ${klassName}()`;\n // @ts-expect-error\n globalThis[klassName] = class extends klass {\n // @ts-expect-error\n constructor(...args) {\n // eslint-disable-next-line\n super(...args);\n // @ts-expect-error\n\n const instanceId = globalThis.__primitiveInstanceId++;\n // @ts-expect-error\n // eslint-disable-next-line\n globalThis.__WarpDriveMetricCountData[instantiationLabel] =\n // @ts-expect-error\n // eslint-disable-next-line\n (globalThis.__WarpDriveMetricCountData[instantiationLabel] || 0) + 1;\n // @ts-expect-error\n this.instanceName = `${klassName}:${instanceId} - ${new Error().stack?.split('\\n')[2]}`;\n }\n };\n } else {\n // @ts-expect-error\n // eslint-disable-next-line\n const original = klass.prototype[methodName];\n const logName = `${klassName}.${methodName}`;\n\n // @ts-expect-error\n klass.prototype[methodName] = function (...args) {\n // @ts-expect-error\n // eslint-disable-next-line\n globalThis.__WarpDriveMetricCountData[logName] = (globalThis.__WarpDriveMetricCountData[logName] || 0) + 1;\n // @ts-expect-error\n const { instanceName } = this;\n if (!instanceName) {\n // @ts-expect-error\n const instanceId = globalThis.__primitiveInstanceId++;\n // @ts-expect-error\n this.instanceName = `${klassName}.${methodName}:${instanceId} - ${new Error().stack?.split('\\n')[2]}`;\n }\n const instanceLogName = `${logName} (${instanceName})`;\n // @ts-expect-error\n // eslint-disable-next-line\n globalThis.__WarpDriveMetricCountData[instanceLogName] =\n // @ts-expect-error\n // eslint-disable-next-line\n (globalThis.__WarpDriveMetricCountData[instanceLogName] || 0) + 1;\n // eslint-disable-next-line\n return original.apply(this, args);\n };\n }\n }\n\n interceptAndLog('Set', 'constructor');\n interceptAndLog('Set', 'add');\n interceptAndLog('Set', 'delete');\n interceptAndLog('Set', 'has');\n interceptAndLog('Set', 'set');\n interceptAndLog('Set', 'get');\n\n interceptAndLog('Map', 'constructor');\n interceptAndLog('Map', 'set');\n interceptAndLog('Map', 'delete');\n interceptAndLog('Map', 'has');\n interceptAndLog('Map', 'add');\n interceptAndLog('Map', 'get');\n\n interceptAndLog('WeakSet', 'constructor');\n interceptAndLog('WeakSet', 'add');\n interceptAndLog('WeakSet', 'delete');\n interceptAndLog('WeakSet', 'has');\n interceptAndLog('WeakSet', 'set');\n interceptAndLog('WeakSet', 'get');\n\n interceptAndLog('WeakMap', 'constructor');\n interceptAndLog('WeakMap', 'set');\n interceptAndLog('WeakMap', 'delete');\n interceptAndLog('WeakMap', 'has');\n interceptAndLog('WeakMap', 'add');\n interceptAndLog('WeakMap', 'get');\n }\n}\n\nexport { storeFor };\n\n// We inline this list of methods to avoid importing EmberObject\ntype EmberObjectKey =\n | '_debugContainerKey'\n | '_super'\n | 'addObserver'\n | 'cacheFor'\n | 'concatenatedProperties'\n | 'decrementProperty'\n | 'destroy'\n | 'get'\n | 'getProperties'\n | 'incrementProperty'\n | 'init'\n | 'isDestroyed'\n | 'isDestroying'\n | 'mergedProperties'\n | 'notifyPropertyChange'\n | 'removeObserver'\n | 'reopen'\n | 'set'\n | 'setProperties'\n | 'toggleProperty'\n | 'toString'\n | 'willDestroy';\n\ntype DSModelKeys =\n | '___(unique) Symbol(Store)'\n | '___private_notifications'\n | '___recordState'\n | '_createSnapshot'\n | 'adapterError'\n | 'attr'\n | 'belongsTo'\n | 'changedAttributes'\n | 'currentState'\n | 'deleteRecord'\n | 'destroyRecord'\n | 'dirtyType'\n | 'eachAttribute'\n | 'eachRelationship'\n | 'errors'\n | 'hasDirtyAttributes'\n | 'hasMany'\n | 'inverseFor'\n | 'isDeleted'\n | 'isEmpty'\n | 'isError'\n | 'isLoaded'\n | 'isLoading'\n | 'isNew'\n | 'isReloading'\n | 'isSaving'\n | 'isValid'\n | 'relationshipFor'\n | 'reload'\n | 'rollbackAttributes'\n | 'save'\n | 'serialize'\n | 'store'\n | 'unloadRecord';\n\ntype CompatStore = Store & {\n adapterFor?: (\n type: string,\n _allowMissing?: boolean\n ) => undefined | { generateIdForRecord?(store: Store, type: string, properties: object): string };\n};\nfunction upgradeStore(store: Store): asserts store is CompatStore {}\n\ntype DownlevelArrays<T> = T extends Array<infer U> ? U[] : T;\ntype AwaitedKeys<T> = { [K in keyof T & string]: DownlevelArrays<Awaited<T[K]>> };\n\n// `AwaitedKeys` is needed here to resolve any promise types like `PromiseBelongsTo`.\ntype FilteredKeys<T> = AwaitedKeys<Omit<T, typeof Type | EmberObjectKey | DSModelKeys | 'constructor'>>;\n\ntype MaybeHasId = { id?: string | null };\n/**\n * Currently only records that extend object can be created via\n * store.createRecord. This is a limitation of the current API,\n * but can be worked around by creating a new identifier, running\n * the cache.clientDidCreate method, and then peeking the record\n * for the identifier.\n *\n * To assign primary key to a record during creation, only `id` will\n * work correctly for `store.createRecord`, other primary key may be\n * handled by updating the record after creation or using the flow\n * described above.\n *\n * TODO: These are limitations we want to (and can) address. If you\n * have need of lifting these limitations, please open an issue.\n *\n */\nexport type CreateRecordProperties<T = MaybeHasId & Record<string, unknown>> = T extends TypedRecordInstance\n ? Partial<FilteredKeys<T>>\n : T extends MaybeHasId\n ? MaybeHasId & Partial<FilteredKeys<T>>\n : MaybeHasId & Record<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nconst EmptyClass = class {\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(args?: unknown) {}\n};\nconst _BaseClass = macroCondition(dependencySatisfies('ember-source', '*'))\n ? DEPRECATE_STORE_EXTENDS_EMBER_OBJECT\n ? (importSync('@ember/object') as typeof EmptyClass)\n : EmptyClass\n : EmptyClass;\n\nconst BaseClass = (_BaseClass as unknown as { default?: typeof EmptyClass }).default\n ? ((_BaseClass as unknown as { default?: typeof EmptyClass }).default as typeof EmptyClass)\n : _BaseClass;\n\nif (BaseClass !== EmptyClass) {\n deprecate(\n `The Store class extending from EmberObject is deprecated.\nPlease remove usage of EmberObject APIs and mark your class as not requiring it.\n\nTo mark the class as no longer extending from EmberObject, in ember-cli-build.js\nset the following config:\n\n\\`\\`\\`js\nconst app = new EmberApp(defaults, {\n emberData: {\n deprecations: {\n DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false\n }\n }\n});\n\\`\\`\\`\n`,\n false,\n {\n id: 'ember-data:deprecate-store-extends-ember-object',\n until: '6.0',\n for: 'ember-data',\n url: 'https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n }\n );\n}\n\nexport interface Store {\n createCache(capabilities: CacheCapabilitiesManager): Cache;\n\n /**\n * A hook which an app or addon may implement. Called when\n * the Store is attempting to create a Record Instance for\n * a resource.\n *\n * This hook can be used to select or instantiate any desired\n * mechanism of presenting cache data to the ui for access\n * mutation, and interaction.\n *\n * @param identifier - The Resource CacheKey\n * @param createRecordArgs - An object containing any properties passed to `store.createRecord`\n * @return A record instance\n * @public\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n instantiateRecord<T>(\n identifier: StableRecordIdentifier,\n createRecordArgs: { [key: string]: unknown }\n ): OpaqueRecordInstance;\n\n /**\n * A hook which an app or addon may implement. Called when\n * the Store is destroying a Record Instance. This hook should\n * be used to teardown any custom record instances instantiated\n * with `instantiateRecord`.\n *\n * @public\n * @param record\n */\n teardownRecord(record: OpaqueRecordInstance): void;\n\n /**\n * This hook enables an app to supply a SchemaService\n * for use when information about a resource's schema needs\n * to be queried.\n *\n * This method will only be called once to instantiate the singleton\n * service, which can then be accessed via `store.schema`.\n *\n * For Example, to use the default SchemaService for ReactiveResource\n *\n * ```ts\n * import { SchemaService } from '@warp-drive/schema-record';\n *\n * class extends Store {\n * createSchemaService() {\n * return new SchemaService();\n * }\n * }\n * ```\n *\n * Or to use the SchemaService for @ember-data/model\n *\n * ```ts\n * import { buildSchema } from '@ember-data/model';\n *\n * class extends Store {\n * createSchemaService() {\n * return buildSchema(this);\n * }\n * }\n * ```\n *\n * If you wish to chain services, you must either\n * instantiate each schema source directly or super to retrieve\n * an existing service. For convenience, when migrating from\n * `@ember-data/model` to `@warp-drive/schema-record` a\n * SchemaService is provided that handles this transition\n * for you:\n *\n * ```ts\n * import { DelegatingSchemaService } from '@ember-data/model/migration-support';\n * import { SchemaService } from '@warp-drive/schema-record';\n *\n * class extends Store {\n * createSchemaService() {\n * const schema = new SchemaService();\n * return new DelegatingSchemaService(this, schema);\n * }\n * }\n * ```\n *\n * When using the DelegateSchemaService, the schema will first\n * be sourced from directly registered schemas, then will fallback\n * to sourcing a schema from available models if no schema is found.\n *\n * @return {SchemaService}\n * @public\n */\n createSchemaService(): SchemaService;\n\n /**\n * DEPRECATED - Use the property `store.schema` instead.\n *\n * Provides access to the SchemaDefinitionService instance\n * for this Store instance.\n *\n * The SchemaDefinitionService can be used to query for\n * information about the schema of a resource.\n *\n * @deprecated\n * @public\n */\n getSchemaDefinitionService(): SchemaService;\n\n /**\n * DEPRECATED - Use `createSchemaService` instead.\n *\n * Allows an app to register a custom SchemaService\n * for use when information about a resource's schema needs\n * to be queried.\n *\n * This method can only be called more than once, but only one schema\n * definition service may exist. Therefore if you wish to chain services\n * you must lookup the existing service and close over it with the new\n * service by accessing `store.schema` prior to registration.\n *\n * For Example:\n *\n * ```ts\n * import Store from '@ember-data/store';\n *\n * class SchemaDelegator {\n * constructor(schema) {\n * this._schema = schema;\n * }\n *\n * hasResource(resource: { type: string }): boolean {\n * if (AbstractSchemas.has(resource.type)) {\n * return true;\n * }\n * return this._schema.hasResource(resource);\n * }\n *\n * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n * return this._schema.attributesDefinitionFor(identifier);\n * }\n *\n * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n * const schema = AbstractSchemas.get(identifier.type);\n * return schema || this._schema.relationshipsDefinitionFor(identifier);\n * }\n * }\n *\n * export default class extends Store {\n * constructor(...args) {\n * super(...args);\n *\n * const schema = this.createSchemaService();\n * this.registerSchemaDefinitionService(new SchemaDelegator(schema));\n * }\n * }\n * ```\n *\n * @param {SchemaService} schema\n * @deprecated\n * @public\n */\n registerSchemaDefinitionService(schema: SchemaService): void;\n\n /**\n * DEPRECATED - Use `createSchemaService` instead.\n *\n * Allows an app to register a custom SchemaService\n * for use when information about a resource's schema needs\n * to be queried.\n *\n * This method can only be called more than once, but only one schema\n * definition service may exist. Therefore if you wish to chain services\n * you must lookup the existing service and close over it with the new\n * service by accessing `store.schema` prior to registration.\n *\n * For Example:\n *\n * ```ts\n * import Store from '@ember-data/store';\n *\n * class SchemaDelegator {\n * constructor(schema) {\n * this._schema = schema;\n * }\n *\n * hasResource(resource: { type: string }): boolean {\n * if (AbstractSchemas.has(resource.type)) {\n * return true;\n * }\n * return this._schema.hasResource(resource);\n * }\n *\n * attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n * return this._schema.attributesDefinitionFor(identifier);\n * }\n *\n * relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n * const schema = AbstractSchemas.get(identifier.type);\n * return schema || this._schema.relationshipsDefinitionFor(identifier);\n * }\n * }\n *\n * export default class extends Store {\n * constructor(...args) {\n * super(...args);\n *\n * const schema = this.schema;\n * this.registerSchema(new SchemaDelegator(schema));\n * }\n * }\n * ```\n *\n * @param {SchemaService} schema\n * @deprecated\n * @public\n */\n registerSchema(schema: SchemaService): void;\n}\n\n/**\n * ```ts\n * import { Store } from '@warp-drive/core';\n * ```\n *\n * The `Store` is the central piece of the ***Warp*Drive** experience. It connects\n * requests for data with schemas, caching and reactivity.\n *\n * While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they\n * require far more than basic fetch management. For this reason it's often best to start with a `Store`\n * even when you aren't sure yet.\n *\n * Most projects will only have a single `Store`, though using multiple distinct stores\n * is possible.\n *\n * @public\n * @hideconstructor\n */\nexport class Store extends BaseClass {\n /** @internal */\n declare readonly recordArrayManager: RecordArrayManager;\n\n /**\n * Provides access to the NotificationManager associated\n * with this Store instance.\n *\n * The NotificationManager can be used to subscribe to\n * changes to the cache.\n *\n * @public\n */\n declare readonly notifications: NotificationManager;\n\n /**\n * Provides access to the SchemaService instance\n * for this Store instance.\n *\n * The SchemaService can be used to query for\n * information about the schema of a resource.\n *\n * @public\n */\n get schema(): ReturnType<this['createSchemaService']> {\n if (!this._schema) {\n this._schema = this.createSchemaService();\n }\n return this._schema as ReturnType<this['createSchemaService']>;\n }\n /** @internal */\n declare _schema: SchemaService;\n\n /**\n * Provides access to the IdentifierCache instance\n * for this store.\n *\n * The IdentifierCache can be used to generate or\n * retrieve a stable unique identifier for any resource.\n *\n * @public\n */\n declare readonly identifierCache: IdentifierCache;\n /**\n * Provides access to the requestManager instance associated\n * with this Store instance.\n *\n * When using `ember-data` this property is automatically\n * set to an instance of `RequestManager`. When not using `ember-data`\n * you must configure this property yourself, either by declaring\n * it as a service or by initializing it.\n *\n * ```ts\n * import Store, { CacheHandler } from '@ember-data/store';\n * import RequestManager from '@ember-data/request';\n * import Fetch from '@ember-data/request/fetch';\n *\n * class extends Store {\n * requestManager = new RequestManager()\n * .use([Fetch])\n * .useCache(CacheHandler);\n * }\n * ```\n *\n * @public\n */\n declare requestManager: RequestManager;\n\n /**\n * A Property which an App may set to provide a CachePolicy\n * to control when a cached request becomes stale.\n *\n * Note, when defined, these methods will only be invoked if a\n * cache key exists for the request, either because the request\n * contains `cacheOptions.key` or because the [IdentifierCache](/ember-data/release/classes/IdentifierCache)\n * was able to generate a key for the request using the configured\n * [generation method](/ember-data/release/functions/@ember-data%2Fstore/setIdentifierGenerationMethod).\n *\n * `isSoftExpired` will only be invoked if `isHardExpired` returns `false`.\n *\n * ```ts\n * store.lifetimes = {\n * // make the request and ignore the current cache state\n * isHardExpired(identifier: StableDocumentIdentifier): boolean {\n * return false;\n * }\n *\n * // make the request in the background if true, return cache state\n * isSoftExpired(identifier: StableDocumentIdentifier): boolean {\n * return false;\n * }\n * }\n * ```\n *\n * @public\n */\n declare lifetimes?: CachePolicy;\n\n // Private\n /** @internal */\n declare _graph?: Graph;\n /** @internal */\n declare _requestCache: RequestStateService;\n /** @internal */\n declare _instanceCache: InstanceCache;\n /** @internal */\n declare _cbs: { coalesce?: () => void; sync?: () => void; notify?: () => void } | null;\n /** @internal */\n declare _forceShim: boolean;\n /**\n * Async flush buffers notifications until flushed\n * by finalization of a future configured by store.request\n *\n * This is useful for ensuring that notifications are delivered\n * prior to the promise resolving but without risk of promise\n * interleaving.\n *\n * @internal\n */\n declare _enableAsyncFlush: boolean | null;\n\n // DEBUG-only properties\n /** @internal */\n declare DISABLE_WAITER?: boolean;\n /** @internal */\n declare _isDestroying: boolean;\n /** @internal */\n declare _isDestroyed: boolean;\n\n /** @internal */\n get isDestroying(): boolean {\n return this._isDestroying;\n }\n /** @internal */\n set isDestroying(value: boolean) {\n this._isDestroying = value;\n }\n /** @internal */\n get isDestroyed(): boolean {\n return this._isDestroyed;\n }\n /** @internal */\n set isDestroyed(value: boolean) {\n this._isDestroyed = value;\n }\n\n /**\n @private\n */\n constructor(createArgs?: unknown) {\n super(createArgs);\n Object.assign(this, createArgs);\n\n this.identifierCache = new IdentifierCache();\n\n this.notifications = new NotificationManager(this);\n\n // private but maybe useful to be here, somewhat intimate\n this.recordArrayManager = new RecordArrayManager({ store: this });\n\n // private\n this._requestCache = new RequestStateService(this);\n this._instanceCache = new InstanceCache(this);\n\n this.isDestroying = false;\n this.isDestroyed = false;\n }\n\n /** @internal */\n _run(cb: () => void) {\n assert(`WarpDrive should never encounter a nested run`, !this._cbs);\n const _cbs: { coalesce?: () => void; sync?: () => void; notify?: () => void } = (this._cbs = {});\n if (DEBUG) {\n try {\n cb();\n if (_cbs.coalesce) {\n _cbs.coalesce();\n }\n if (_cbs.sync) {\n _cbs.sync();\n }\n if (_cbs.notify) {\n _cbs.notify();\n }\n } finally {\n this._cbs = null;\n }\n } else {\n cb();\n if (_cbs.coalesce) {\n _cbs.coalesce();\n }\n if (_cbs.sync) {\n _cbs.sync();\n }\n if (_cbs.notify) {\n _cbs.notify();\n }\n this._cbs = null;\n }\n }\n\n /**\n * Executes the callback, ensurng that any work that calls\n * store._schedule is executed after in the right order.\n *\n * When queues already exist, scheduled callbacks will\n * join the existing queue.\n *\n * @internal\n */\n _join(cb: () => void): void {\n if (this._cbs) {\n cb();\n } else {\n this._run(cb);\n }\n }\n\n /** @internal */\n _schedule(name: 'coalesce' | 'sync' | 'notify', cb: () => void): void {\n assert(`WarpDrive expects to schedule only when there is an active run`, !!this._cbs);\n assert(`WarpDrive expects only one flush per queue name, cannot schedule ${name}`, !this._cbs[name]);\n\n this._cbs[name] = cb;\n }\n\n /**\n * Retrieve the RequestStateService instance\n * associated with this Store.\n *\n * This can be used to query the status of requests\n * that have been initiated for a given identifier.\n *\n * @return {RequestStateService}\n * @public\n */\n getRequestStateService(): RequestStateService {\n return this._requestCache;\n }\n\n /** @internal */\n _getAllPending(): (Promise<unknown[]> & { length: number }) | void {\n if (TESTING) {\n const all: Promise<unknown>[] = [];\n const pending = this._requestCache._pending;\n\n pending.forEach((requests) => {\n all.push(...requests.map((v) => v[RequestPromise]!));\n });\n this.requestManager._pending.forEach((v) => all.push(v));\n const promise: Promise<unknown[]> & { length: number } = Promise.allSettled(all) as Promise<unknown[]> & {\n length: number;\n };\n promise.length = all.length;\n return promise;\n }\n }\n\n /**\n * ::: tip 💡 For a more complete overview see the [Request Guide](/guides/2-requests/1-overview)\n * :::\n *\n * Issue a request via the configured {@link RequestManager},\n * inserting the response into the {@link Store.cache | cache} and handing\n * back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}\n *\n * #### Request Cache Keys\n *\n * Only {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/GET | GET} requests with a url or requests with an explicit\n * {@link CacheOptions.key | cache key} will have the request result\n * and document cached.\n *\n * The cache key used is {@link RequestInfo.cacheOptions | RequestInfo.cacheOptions.key}\n * if present, falling back to {@link RequestInfo.url}.\n *\n * Params are not serialized as part of the cache-key, so\n * either ensure they are already in the url or utilize\n * `requestConfig.cacheOptions.key`. For queries issued\n * via the {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST | POST} method `requestConfig.cacheOptions.key`\n * MUST be supplied for the document to be cached.\n *\n * #### Requesting Without a Cache Key\n *\n * Resource data within the request is always updated in the cache,\n * regardless of whether a cache key is present for the request.\n *\n * #### Fulfilling From Cache\n *\n * When a cache-key is determined, the request may fulfill\n * from cache provided the cache is not stale.\n *\n * Cache staleness is determined by the configured {@link CachePolicy}\n * with priority given to the {@link CacheOptions.reload} and\n * {@link CacheOptions.backgroundReload} on the request if present.\n *\n * If the cache data has soft expired or the request asks for a background\n * reload, the request will fulfill from cache if possible and\n * make a non-blocking request in the background to update the cache.\n *\n * If the cache data has hard expired or the request asks for a reload,\n * the request will not fulfill from cache and will make a blocking\n * request to update the cache.\n *\n * #### The Response\n *\n * The primary difference between {@link RequestManager.request} and `store.request`\n * is that `store.request` will convert the response into a {@link ReactiveDocument}\n * containing {@link Store.instantiateRecord | ReactiveResources}.\n *\n * @public\n */\n request<RT, T = unknown>(requestConfig: StoreRequestInput<RT, T>): Future<RT> {\n // we lazily set the cache handler when we issue the first request\n // because constructor doesn't allow for this to run after\n // the user has had the chance to set the prop.\n const opts: {\n store: Store;\n disableTestWaiter?: boolean;\n [EnableHydration]: boolean;\n records?: StableRecordIdentifier[];\n } = {\n store: this,\n [EnableHydration]: requestConfig[EnableHydration] ?? true,\n };\n\n if (requestConfig.records) {\n const identifierCache = this.identifierCache;\n opts.records = requestConfig.records.map((r) => identifierCache.getOrCreateRecordIdentifier(r));\n }\n\n if (TESTING) {\n if (this.DISABLE_WAITER) {\n opts.disableTestWaiter =\n typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;\n }\n }\n\n if (LOG_REQUESTS) {\n let options: unknown;\n try {\n options = JSON.parse(JSON.stringify(requestConfig));\n } catch {\n options = requestConfig;\n }\n // eslint-disable-next-line no-console\n console.log(\n `request: [[START]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${\n requestConfig.op || '<unknown operation>'\n } ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`,\n options\n );\n }\n\n const request = Object.assign({}, requestConfig, opts);\n const future = this.requestManager.request(request);\n\n future.onFinalize(() => {\n if (LOG_REQUESTS) {\n // eslint-disable-next-line no-console\n console.log(\n `request: [[FINALIZE]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${\n requestConfig.op || '<unknown operation>'\n } ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`\n );\n }\n // skip flush for legacy belongsTo\n if (requestConfig.op === 'findBelongsTo' && !requestConfig.url) {\n return;\n }\n this.notifications._flush();\n });\n\n return future;\n }\n\n /**\n Returns the schema for a particular resource type (modelName).\n\n When used with Model from @ember-data/model the return is the model class,\n but this is not guaranteed.\n\n If looking to query attribute or relationship information it is\n recommended to use `getSchemaDefinitionService` instead. This method\n should be considered legacy and exists primarily to continue to support\n Adapter/Serializer APIs which expect it's return value in their method\n signatures.\n\n The class of a model might be useful if you want to get a list of all the\n relationship names of the model, see\n [`relationshipNames`](/ember-data/release/classes/Model?anchor=relationshipNames)\n for example.\n\n @public\n @deprecated\n @param {String} type\n @return {ModelSchema}\n */\n modelFor<T>(type: TypeFromInstance<T>): ModelSchema<T>;\n modelFor(type: string): ModelSchema;\n modelFor<T>(type: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ModelSchema<T> {\n // FIXME add deprecation and deprecation stripping\n // FIXME/TODO update RFC to remove this method\n if (DEBUG) {\n assertDestroyedStoreOnly(this, 'modelFor');\n }\n assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n\n return getShimClass<T>(this, type);\n }\n\n /**\n Create a new record in the current store. The properties passed\n to this method are set on the newly created record.\n\n To create a new instance of a `Post`:\n\n ```js\n store.createRecord('post', {\n title: 'Ember is awesome!'\n });\n ```\n\n To create a new instance of a `Post` that has a relationship with a `User` record:\n\n ```js\n let user = this.store.peekRecord('user', '1');\n store.createRecord('post', {\n title: 'Ember is awesome!',\n user: user\n });\n ```\n\n @public\n @param {String} type the name of the resource\n @param {Object} inputProperties a hash of properties to set on the\n newly created record.\n @return {Model} record\n */\n createRecord<T>(type: TypeFromInstance<T>, inputProperties: CreateRecordProperties<T>): T;\n createRecord(type: string, inputProperties: CreateRecordProperties): OpaqueRecordInstance;\n createRecord(type: string, inputProperties: CreateRecordProperties): OpaqueRecordInstance {\n if (DEBUG) {\n assertDestroyingStore(this, 'createRecord');\n }\n assert(`You need to pass a model name to the store's createRecord method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n // This is wrapped in a `run.join` so that in test environments users do not need to manually wrap\n // calls to `createRecord`. The run loop usage here is because we batch the joining and updating\n // of record-arrays via ember's run loop, not our own.\n //\n // to remove this, we would need to move to a new `async` API.\n let record!: OpaqueRecordInstance;\n this._join(() => {\n const normalizedModelName = normalizeModelName(type);\n const properties = { ...inputProperties };\n\n // If the passed properties do not include a primary key,\n // give the adapter an opportunity to generate one. Typically,\n // client-side ID generators will use something like uuid.js\n // to avoid conflicts.\n let id: string | null = null;\n\n if (properties.id === null || properties.id === undefined) {\n upgradeStore(this);\n const adapter = this.adapterFor?.(normalizedModelName, true);\n\n if (adapter && adapter.generateIdForRecord) {\n id = properties.id = coerceId(adapter.generateIdForRecord(this, normalizedModelName, properties));\n } else {\n id = properties.id = null;\n }\n } else {\n id = properties.id = coerceId(properties.id);\n }\n\n const resource = { type: normalizedModelName, id };\n\n if (resource.id) {\n const identifier = this.identifierCache.peekRecordIdentifier(resource as ResourceIdentifierObject);\n\n assert(\n `The id ${String(properties.id)} has already been used with another '${normalizedModelName}' record.`,\n !identifier\n );\n }\n\n const identifier = this.identifierCache.createIdentifierForNewRecord(resource);\n const cache = this.cache;\n\n const createOptions = normalizeProperties(this, identifier, properties);\n const resultProps = cache.clientDidCreate(identifier, createOptions);\n\n record = this._instanceCache.getRecord(identifier, resultProps);\n });\n return record;\n }\n\n /**\n For symmetry, a record can be deleted via the store.\n\n Example\n\n ```javascript\n let post = store.createRecord('post', {\n title: 'Ember is awesome!'\n });\n\n store.deleteRecord(post);\n ```\n\n @public\n @param {unknown} record\n */\n deleteRecord<T>(record: T): void {\n if (DEBUG) {\n assertDestroyingStore(this, 'deleteRecord');\n }\n\n const identifier = peekRecordIdentifier(record);\n const cache = this.cache;\n assert(`expected the record to be connected to a cache`, identifier);\n this._join(() => {\n cache.setIsDeleted(identifier, true);\n\n if (cache.isNew(identifier)) {\n this._instanceCache.unloadRecord(identifier);\n }\n });\n }\n\n /**\n For symmetry, a record can be unloaded via the store.\n This will cause the record to be destroyed and freed up for garbage collection.\n\n Example\n\n ```javascript\n const { content: { data: post } } = await store.request(findRecord({ type: 'post', id: '1' }));\n store.unloadRecord(post);\n ```\n\n @public\n @param {Model} record\n */\n unloadRecord<T>(record: T): void {\n if (DEBUG) {\n assertDestroyingStore(this, 'unloadRecord');\n }\n const identifier = peekRecordIdentifier(record);\n if (identifier) {\n this._instanceCache.unloadRecord(identifier);\n }\n }\n\n /**\n This method returns a record for a given identifier or type and id combination.\n\n The `findRecord` method will always resolve its promise with the same\n object for a given identifier or type and `id`.\n\n The `findRecord` method will always return a **promise** that will be\n resolved with the record.\n\n **Example 1**\n\n ```js [app/routes/post.js]\n export default class PostRoute extends Route {\n model({ post_id }) {\n return this.store.findRecord('post', post_id);\n }\n }\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```js [app/routes/post.js]\n export default class PostRoute extends Route {\n model({ post_id: id }) {\n return this.store.findRecord({ type: 'post', id });\n }\n }\n ```\n\n **Example 3**\n\n If you have previously received an lid via an Identifier for this record, and the record\n has already been assigned an id, you can find the record again using just the lid.\n\n ```js [app/routes/post.js]\n store.findRecord({ lid });\n ```\n\n If the record is not yet available, the store will ask the adapter's `findRecord`\n method to retrieve and supply the necessary data. If the record is already present\n in the store, it depends on the reload behavior _when_ the returned promise\n resolves.\n\n ### Preloading\n\n You can optionally `preload` specific attributes and relationships that you know of\n by passing them via the passed `options`.\n\n For example, if your Ember route looks like `/posts/1/comments/2` and your API route\n for the comment also looks like `/posts/1/comments/2` if you want to fetch the comment\n without also fetching the post you can pass in the post to the `findRecord` call:\n\n ```js [app/routes/post-comments.js]\n export default class PostRoute extends Route {\n model({ post_id, comment_id: id }) {\n return this.store.findRecord({ type: 'comment', id, { preload: { post: post_id }} });\n }\n }\n ```\n\n In your adapter you can then access this id without triggering a network request via the\n snapshot:\n\n ```js [app/adapters/application.js]\n export default class Adapter {\n\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'comment')\n let postId = snapshot.belongsTo('post', { id: true });\n\n return fetch(`./posts/${postId}/comments/${id}`)\n .then(response => response.json())\n }\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n This could also be achieved by supplying the post id to the adapter via the adapterOptions\n property on the options hash.\n\n ```js [app/routes/post-comments.js]\n export default class PostRoute extends Route {\n model({ post_id, comment_id: id }) {\n return this.store.findRecord({ type: 'comment', id, { adapterOptions: { post: post_id }} });\n }\n }\n ```\n\n ```js [app/adapters/application.js]\n export default class Adapter {\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'comment')\n let postId = snapshot.adapterOptions.post;\n\n return fetch(`./posts/${postId}/comments/${id}`)\n .then(response => response.json())\n }\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n If you have access to the post model you can also pass the model itself to preload:\n\n ```javascript\n let post = await store.findRecord('post', '1');\n let comment = await store.findRecord('comment', '2', { post: myPostModel });\n ```\n\n ### Reloading\n\n The reload behavior is configured either via the passed `options` hash or\n the result of the adapter's `shouldReloadRecord`.\n\n If `{ reload: true }` is passed or `adapter.shouldReloadRecord` evaluates\n to `true`, then the returned promise resolves once the adapter returns\n data, regardless if the requested record is already in the store:\n\n ```js\n store.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n });\n\n // adapter#findRecord resolves with\n // [\n // {\n // id: 1,\n // type: 'post',\n // revision: 2\n // }\n // ]\n store.findRecord('post', '1', { reload: true }).then(function(post) {\n post.revision; // 2\n });\n ```\n\n If no reload is indicated via the above mentioned ways, then the promise\n immediately resolves with the cached version in the store.\n\n ### Background Reloading\n\n Optionally, if `adapter.shouldBackgroundReloadRecord` evaluates to `true`,\n then a background reload is started, which updates the records' data, once\n it is available:\n\n ```js\n // app/adapters/post.js\n import ApplicationAdapter from \"./application\";\n\n export default class PostAdapter extends ApplicationAdapter {\n shouldReloadRecord(store, snapshot) {\n return false;\n },\n\n shouldBackgroundReloadRecord(store, snapshot) {\n return true;\n }\n });\n\n // ...\n\n store.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n });\n\n let blogPost = store.findRecord('post', '1').then(function(post) {\n post.revision; // 1\n });\n\n // later, once adapter#findRecord resolved with\n // [\n // {\n // id: 1,\n // type: 'post',\n // revision: 2\n // }\n // ]\n\n blogPost.revision; // 2\n ```\n\n If you would like to force or prevent background reloading, you can set a\n boolean value for `backgroundReload` in the options object for\n `findRecord`.\n\n ```js [app/routes/post/edit.js]\n export default class PostEditRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { backgroundReload: false });\n }\n }\n ```\n\n If you pass an object on the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot\n\n ```js [app/routes/post/edit.js]\n export default class PostEditRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, {\n adapterOptions: { subscribe: false }\n });\n }\n }\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findRecord(store, type, id, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n See [peekRecord](../methods/peekRecord?anchor=peekRecord) to get the cached version of a record.\n\n ### Retrieving Related Model Records\n\n If you use an adapter such as Ember's default\n [`JSONAPIAdapter`](/ember-data/release/classes/JSONAPIAdapter)\n that supports the [JSON API specification](http://jsonapi.org/) and if your server\n endpoint supports the use of an\n ['include' query parameter](http://jsonapi.org/format/#fetching-includes),\n you can use `findRecord()` or `findAll()` to automatically retrieve additional records related to\n the one you request by supplying an `include` parameter in the `options` object.\n\n For example, given a `post` model that has a `hasMany` relationship with a `comment`\n model, when we retrieve a specific post we can have the server also return that post's\n comments in the same request:\n\n ```js [app/routes/post.js]\n export default class PostRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: ['comments'] });\n }\n }\n ```\n\n ```js [app/adapters/application.js]\n export default class Adapter {\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'post')\n let includes = snapshot.adapterOptions.include;\n\n return fetch(`./posts/${postId}?include=${includes}`)\n .then(response => response.json())\n }\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n In this case, the post's comments would then be available in your template as\n `model.comments`.\n\n Multiple relationships can be requested using an `include` parameter consisting of a\n list of relationship names, while nested relationships can be specified\n using a dot-separated sequence of relationship names. So to request both the post's\n comments and the authors of those comments the request would look like this:\n\n ```js [app/routes/post.js]\n export default class PostRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: ['comments','comments.author'] });\n }\n }\n ```\n\n ### Retrieving Specific Fields by Type\n\n If your server endpoint supports the use of a ['fields' query parameter](https://jsonapi.org/format/#fetching-sparse-fieldsets),\n you can use pass those fields through to your server. At this point in time, this requires a few manual steps on your part.\n\n 1. Implement `buildQuery` in your adapter.\n\n ```js [app/adapters/application.js]\n buildQuery(snapshot) {\n let query = super.buildQuery(...arguments);\n\n let { fields } = snapshot.adapterOptions;\n\n if (fields) {\n query.fields = fields;\n }\n\n return query;\n }\n ```\n\n 2. Then pass through the applicable fields to your `findRecord` request.\n\n Given a `post` model with attributes body, title, publishDate and meta, you can retrieve a filtered list of attributes.\n\n ```js [app/routes/post.js]\n export default class extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title' } });\n }\n }\n ```\n\n Moreover, you can filter attributes on related models as well. If a `post` has a `belongsTo` relationship to a user,\n just include the relationship key and attributes.\n\n ```js [app/routes/post.js]\n export default class extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title', user: 'name,email' } });\n }\n }\n ```\n\n @since 1.13.0\n @public\n @param {String|object} type - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {(String|Integer|Object)} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param {Object} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return {Promise} promise\n */\n findRecord<T>(type: TypeFromInstance<T>, id: string | number, options?: FindRecordOptions<T>): Promise<T>;\n findRecord(type: string, id: string | number, options?: FindRecordOptions): Promise<unknown>;\n findRecord<T>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordOptions<T>): Promise<T>;\n findRecord(resource: ResourceIdentifierObject, options?: FindRecordOptions): Promise<unknown>;\n findRecord(\n resource: string | ResourceIdentifierObject,\n id?: string | number | FindRecordOptions,\n options?: FindRecordOptions\n ): Promise<unknown> {\n if (DEBUG) {\n assertDestroyingStore(this, 'findRecord');\n }\n\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = id as FindRecordOptions | undefined;\n } else {\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(id as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);\n options = options || {};\n\n if (options.preload) {\n // force reload if we preload to ensure we don't resolve the promise\n // until we are complete, else we will end up background-reloading\n // even for initial load.\n if (!this._instanceCache.recordIsLoaded(identifier)) {\n options.reload = true;\n }\n this._join(() => {\n preloadData(this, identifier, options.preload!);\n });\n }\n\n const promise = this.request<OpaqueRecordInstance>({\n op: 'findRecord',\n data: {\n record: identifier,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => {\n return document.content;\n });\n }\n\n /**\n Get the reference for the specified record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', '1');\n\n // check if the user is loaded\n let isLoaded = userRef.value() !== null;\n\n // get the record of the reference (null if not yet available)\n let user = userRef.value();\n\n // get the identifier of the reference\n if (userRef.remoteType() === 'id') {\n let id = userRef.id();\n }\n\n // load user (via store.find)\n userRef.load().then(...)\n\n // or trigger a reload\n userRef.reload().then(...)\n\n // provide data for reference\n userRef.push({ id: 1, username: '@user' }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param {String|object} resource - modelName (string) or Identifier (object)\n @param {String|Integer} id\n @since 2.5.0\n @return {RecordReference}\n */\n // TODO @deprecate getReference (and references generally)\n getReference(resource: string | ResourceIdentifierObject, id: string | number): RecordReference {\n if (DEBUG) {\n assertDestroyingStore(this, 'getReference');\n }\n\n let resourceIdentifier: ResourceIdentifierObject;\n if (arguments.length === 1 && isMaybeIdentifier(resource)) {\n resourceIdentifier = resource;\n } else {\n const type = normalizeModelName(resource as string);\n const normalizedId = ensureStringId(id);\n resourceIdentifier = constructResource(type, normalizedId);\n }\n\n assert(\n 'getReference expected to receive either a resource identifier or type and id as arguments',\n isMaybeIdentifier(resourceIdentifier)\n );\n\n const identifier: StableRecordIdentifier = this.identifierCache.getOrCreateRecordIdentifier(resourceIdentifier);\n\n return this._instanceCache.getReference(identifier);\n }\n\n /**\n Get a record by a given type and ID without triggering a fetch.\n\n This method will synchronously return the record if it is available in the store,\n otherwise it will return `null`. A record is available if it has been fetched earlier, or\n pushed manually into the store.\n\n See [findRecord](../methods/findRecord?anchor=findRecord) if you would like to request this record from the backend.\n\n _Note: This is a synchronous method and does not return a promise._\n\n **Example 1**\n\n ```js\n let post = store.peekRecord('post', '1');\n\n post.id; // '1'\n ```\n\n `peekRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n **Example 2**\n\n ```js\n let post = store.peekRecord({ type: 'post', id });\n post.id; // '1'\n ```\n\n If you have previously received an lid from an Identifier for this record, you can lookup the record again using\n just the lid.\n\n **Example 3**\n\n ```js\n let post = store.peekRecord({ lid });\n post.id; // '1'\n ```\n\n\n @since 1.13.0\n @public\n @param {String|object} modelName - either a string representing the modelName or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {String|Integer} id - optional only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved.\n @return {Model|null} record\n */\n peekRecord<T>(type: TypeFromInstance<T>, id: string | number): T | null;\n peekRecord(type: string, id: string | number): unknown | null;\n peekRecord<T>(identifier: ResourceIdentifierObject<TypeFromInstance<T>>): T | null;\n peekRecord(identifier: ResourceIdentifierObject): unknown | null;\n peekRecord<T = OpaqueRecordInstance>(identifier: ResourceIdentifierObject | string, id?: string | number): T | null {\n if (arguments.length === 1 && isMaybeIdentifier(identifier)) {\n const stableIdentifier = this.identifierCache.peekRecordIdentifier(identifier);\n const isLoaded = stableIdentifier && this._instanceCache.recordIsLoaded(stableIdentifier);\n // TODO come up with a better mechanism for determining if we have data and could peek.\n // this is basically an \"are we not empty\" query.\n return isLoaded ? (this._instanceCache.getRecord(stableIdentifier) as T) : null;\n }\n\n if (DEBUG) {\n assertDestroyingStore(this, 'peekRecord');\n }\n\n assert(`You need to pass a model name to the store's peekRecord method`, identifier);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(\n identifier\n )}`,\n typeof identifier === 'string'\n );\n\n const type = normalizeModelName(identifier);\n const normalizedId = ensureStringId(id);\n const resource = { type, id: normalizedId };\n const stableIdentifier = this.identifierCache.peekRecordIdentifier(resource);\n const isLoaded = stableIdentifier && this._instanceCache.recordIsLoaded(stableIdentifier);\n\n return isLoaded ? (this._instanceCache.getRecord(stableIdentifier) as T) : null;\n }\n\n /**\n This method delegates a query to the adapter. This is the one place where\n adapter-level semantics are exposed to the application.\n\n Each time this method is called a new request is made through the adapter.\n\n Exposing queries this way seems preferable to creating an abstract query\n language for all server-side queries, and then require all adapters to\n implement them.\n\n ---\n\n If you do something like this:\n\n ```javascript\n store.query('person', { page: 1 });\n ```\n\n The request made to the server will look something like this:\n\n ```\n GET \"/api/v1/person?page=1\"\n ```\n\n ---\n\n If you do something like this:\n\n ```javascript\n store.query('person', { ids: ['1', '2', '3'] });\n ```\n\n The request made to the server will look something like this:\n\n ```\n GET \"/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3\"\n decoded: \"/api/v1/person?ids[]=1&ids[]=2&ids[]=3\"\n ```\n\n This method returns a promise, which is resolved with a\n [`Collection`](/ember-data/release/classes/Collection)\n once the server returns.\n\n @since 1.13.0\n @public\n @param {String} type the name of the resource\n @param {Object} query a query to be used by the adapter\n @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {Promise} promise\n */\n query<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryOptions): Promise<Collection<T>>;\n query(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<Collection>;\n query(type: string, query: LegacyResourceQuery, options: QueryOptions = {}): Promise<Collection> {\n if (DEBUG) {\n assertDestroyingStore(this, 'query');\n }\n assert(`You need to pass a model name to the store's query method`, type);\n assert(`You need to pass a query hash to the store's query method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<Collection>({\n op: 'query',\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n }\n\n /**\n This method makes a request for one record, where the `id` is not known\n beforehand (if the `id` is known, use [`findRecord`](../methods/findRecord?anchor=findRecord)\n instead).\n\n This method can be used when it is certain that the server will return a\n single object for the primary data.\n\n Each time this method is called a new request is made through the adapter.\n\n Let's assume our API provides an endpoint for the currently logged in user\n via:\n\n ```\n // GET /api/current_user\n {\n user: {\n id: 1234,\n username: 'admin'\n }\n }\n ```\n\n Since the specific `id` of the `user` is not known beforehand, we can use\n `queryRecord` to get the user:\n\n ```javascript\n store.queryRecord('user', {}).then(function(user) {\n let username = user.username;\n // do thing\n });\n ```\n\n The request is made through the adapters' `queryRecord`:\n\n ```js [app/adapters/user.js]\n import Adapter from '@ember-data/adapter';\n import $ from 'jquery';\n\n export default class UserAdapter extends Adapter {\n queryRecord(modelName, query) {\n return $.getJSON('/api/current_user');\n }\n }\n ```\n\n Note: the primary use case for `store.queryRecord` is when a single record\n is queried and the `id` is not known beforehand. In all other cases\n `store.query` and using the first item of the array is likely the preferred\n way:\n\n ```\n // GET /users?username=unique\n {\n data: [{\n id: 1234,\n type: 'user',\n attributes: {\n username: \"unique\"\n }\n }]\n }\n ```\n\n ```javascript\n store.query('user', { username: 'unique' }).then(function(users) {\n return users.firstObject;\n }).then(function(user) {\n let id = user.id;\n });\n ```\n\n This method returns a promise, which resolves with the found record.\n\n If the adapter returns no data for the primary data of the payload, then\n `queryRecord` resolves with `null`:\n\n ```\n // GET /users?username=unique\n {\n data: null\n }\n ```\n\n ```javascript\n store.queryRecord('user', { username: 'unique' }).then(function(user) {\n // user is null\n });\n ```\n\n @since 1.13.0\n @public\n @param {String} type\n @param {Object} query an opaque query to be used by the adapter\n @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord\n @return {Promise} promise which resolves with the found record or `null`\n */\n queryRecord<T>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryOptions): Promise<T | null>;\n queryRecord(type: string, query: LegacyResourceQuery, options?: QueryOptions): Promise<unknown | null>;\n queryRecord(\n type: string,\n query: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<OpaqueRecordInstance | null> {\n if (DEBUG) {\n assertDestroyingStore(this, 'queryRecord');\n }\n assert(`You need to pass a model name to the store's queryRecord method`, type);\n assert(`You need to pass a query hash to the store's queryRecord method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<OpaqueRecordInstance | null>({\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n }\n\n /**\n `findAll` asks the adapter's `findAll` method to find the records for the\n given type, and returns a promise which will resolve with all records of\n this type present in the store, even if the adapter only returns a subset\n of them.\n\n ```js [app/routes/authors.js]\n export default class AuthorsRoute extends Route {\n model(params) {\n return this.store.findAll('author');\n }\n }\n ```\n\n _When_ the returned promise resolves depends on the reload behavior,\n configured via the passed `options` hash and the result of the adapter's\n `shouldReloadAll` method.\n\n ### Reloading\n\n If `{ reload: true }` is passed or `adapter.shouldReloadAll` evaluates to\n `true`, then the returned promise resolves once the adapter returns data,\n regardless if there are already records in the store:\n\n ```js\n store.push({\n data: {\n id: 'first',\n type: 'author'\n }\n });\n\n // adapter#findAll resolves with\n // [\n // {\n // id: 'second',\n // type: 'author'\n // }\n // ]\n store.findAll('author', { reload: true }).then(function(authors) {\n authors.getEach('id'); // ['first', 'second']\n });\n ```\n\n If no reload is indicated via the above mentioned ways, then the promise\n immediately resolves with all the records currently loaded in the store.\n\n ### Background Reloading\n\n Optionally, if `adapter.shouldBackgroundReloadAll` evaluates to `true`,\n then a background reload is started. Once this resolves, the array with\n which the promise resolves, is updated automatically so it contains all the\n records in the store:\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n shouldReloadAll(store, snapshotsArray) {\n return false;\n },\n\n shouldBackgroundReloadAll(store, snapshotsArray) {\n return true;\n }\n });\n\n // ...\n\n store.push({\n data: {\n id: 'first',\n type: 'author'\n }\n });\n\n let allAuthors;\n store.findAll('author').then(function(authors) {\n authors.getEach('id'); // ['first']\n\n allAuthors = authors;\n });\n\n // later, once adapter#findAll resolved with\n // [\n // {\n // id: 'second',\n // type: 'author'\n // }\n // ]\n\n allAuthors.getEach('id'); // ['first', 'second']\n ```\n\n If you would like to force or prevent background reloading, you can set a\n boolean value for `backgroundReload` in the options object for\n `findAll`.\n\n ```js [app/routes/post/edit.js]\n export default class PostEditRoute extends Route {\n model() {\n return this.store.findAll('post', { backgroundReload: false });\n }\n }\n ```\n\n If you pass an object on the `adapterOptions` property of the options\n argument it will be passed to you adapter via the `snapshotRecordArray`\n\n ```js [app/routes/posts.js]\n export default class PostsRoute extends Route {\n model(params) {\n return this.store.findAll('post', {\n adapterOptions: { subscribe: false }\n });\n }\n }\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class UserAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n See [peekAll](../methods/peekAll?anchor=peekAll) to get an array of current records in the\n store, without waiting until a reload is finished.\n\n ### Retrieving Related Model Records\n\n If you use an adapter such as Ember's default\n [`JSONAPIAdapter`](/ember-data/release/classes/JSONAPIAdapter)\n that supports the [JSON API specification](http://jsonapi.org/) and if your server\n endpoint supports the use of an\n ['include' query parameter](http://jsonapi.org/format/#fetching-includes),\n you can use `findAll()` to automatically retrieve additional records related to\n those requested by supplying an `include` parameter in the `options` object.\n\n For example, given a `post` model that has a `hasMany` relationship with a `comment`\n model, when we retrieve all of the post records we can have the server also return\n all of the posts' comments in the same request:\n\n ```js [app/routes/posts.js]\n export default class PostsRoute extends Route {\n model() {\n return this.store.findAll('post', { include: ['comments'] });\n }\n }\n ```\n Multiple relationships can be requested using an `include` parameter consisting of a\n list or relationship names, while nested relationships can be specified\n using a dot-separated sequence of relationship names. So to request both the posts'\n comments and the authors of those comments the request would look like this:\n\n ```js [app/routes/posts.js]\n export default class PostsRoute extends Route {\n model() {\n return this.store.findAll('post', { include: ['comments','comments.author'] });\n }\n }\n ```\n\n See [query](../methods/query?anchor=query) to only get a subset of records from the server.\n\n @since 1.13.0\n @public\n @param {String} type the name of the resource\n @param {Object} options\n @return {Promise} promise\n */\n findAll<T>(type: TypeFromInstance<T>, options?: FindAllOptions<T>): Promise<IdentifierArray<T>>;\n findAll(type: string, options?: FindAllOptions): Promise<IdentifierArray>;\n findAll<T>(type: TypeFromInstance<T> | string, options: FindAllOptions = {}): Promise<IdentifierArray<T>> {\n if (DEBUG) {\n assertDestroyingStore(this, 'findAll');\n }\n assert(`You need to pass a model name to the store's findAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<IdentifierArray<T>>({\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n }\n\n /**\n This method returns a filtered array that contains all of the\n known records for a given type in the store.\n\n Note that because it's just a filter, the result will contain any\n locally created records of the type, however, it will not make a\n request to the backend to retrieve additional records. If you\n would like to request all the records from the backend please use\n [store.findAll](../methods/findAll?anchor=findAll).\n\n Also note that multiple calls to `peekAll` for a given type will always\n return the same `RecordArray`.\n\n Example\n\n ```javascript\n let localPosts = store.peekAll('post');\n ```\n\n @since 1.13.0\n @public\n @param {String} type the name of the resource\n @return {RecordArray}\n */\n peekAll<T>(type: TypeFromInstance<T>): IdentifierArray<T>;\n peekAll(type: string): IdentifierArray;\n peekAll(type: string): IdentifierArray {\n if (DEBUG) {\n assertDestroyingStore(this, 'peekAll');\n }\n assert(`You need to pass a model name to the store's peekAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return this.recordArrayManager.liveArrayFor(normalizeModelName(type));\n }\n\n /**\n This method unloads all records in the store.\n It schedules unloading to happen during the next run loop.\n\n Optionally you can pass a type which unload all records for a given type.\n\n ```javascript\n store.unloadAll();\n store.unloadAll('post');\n ```\n\n @param {String} type the name of the resource\n @public\n */\n unloadAll<T>(type: TypeFromInstance<T>): void;\n unloadAll(type?: string): void;\n unloadAll(type?: string) {\n if (DEBUG) {\n assertDestroyedStoreOnly(this, 'unloadAll');\n }\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(type)}`,\n !type || typeof type === 'string'\n );\n\n this._join(() => {\n if (type === undefined) {\n // destroy the graph before unloadAll\n // since then we avoid churning relationships\n // during unload\n this._graph?.identifiers.clear();\n\n this.recordArrayManager.clear();\n this._instanceCache.clear();\n } else {\n this._instanceCache.clear(normalizeModelName(type));\n }\n });\n }\n\n /**\n Push some data for a given type into the store.\n\n This method expects normalized [JSON API](http://jsonapi.org/) document. This means you have to follow [JSON API specification](http://jsonapi.org/format/) with few minor adjustments:\n - record's `type` should always be in singular, dasherized form\n - members (properties) should be camelCased\n\n [Your primary data should be wrapped inside `data` property](http://jsonapi.org/format/#document-top-level):\n\n ```js\n store.push({\n data: {\n // primary data for single record of type `Person`\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n }\n });\n ```\n\n [Demo.](http://ember-twiddle.com/fb99f18cd3b4d3e2a4c7)\n\n `data` property can also hold an array (of records):\n\n ```js\n store.push({\n data: [\n // an array of records\n {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n },\n {\n id: '2',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n }\n }\n ]\n });\n ```\n\n [Demo.](http://ember-twiddle.com/69cdbeaa3702159dc355)\n\n There are some typical properties for `JSONAPI` payload:\n * `id` - mandatory, unique record's key\n * `type` - mandatory string which matches `model`'s dasherized name in singular form\n * `attributes` - object which holds data for record attributes - `attr`'s declared in model\n * `relationships` - object which must contain any of the following properties under each relationships' respective key (example path is `relationships.achievements.data`):\n - [`links`](http://jsonapi.org/format/#document-links)\n - [`data`](http://jsonapi.org/format/#document-resource-object-linkage) - place for primary data\n - [`meta`](http://jsonapi.org/format/#document-meta) - object which contains meta-information about relationship\n\n For this model:\n\n ```js [app/models/person.js]\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class PersonRoute extends Route {\n @attr('string') firstName;\n @attr('string') lastName;\n\n @hasMany('person') children;\n }\n ```\n\n To represent the children as IDs:\n\n ```js\n {\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n data: [\n {\n id: '2',\n type: 'person'\n },\n {\n id: '3',\n type: 'person'\n },\n {\n id: '4',\n type: 'person'\n }\n ]\n }\n }\n }\n }\n ```\n\n [Demo.](http://ember-twiddle.com/343e1735e034091f5bde)\n\n To represent the children relationship as a URL:\n\n ```js\n {\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n links: {\n related: '/people/1/children'\n }\n }\n }\n }\n }\n ```\n\n If you're streaming data or implementing an adapter, make sure\n that you have converted the incoming data into this form. The\n store's [normalize](../methods/normalize?anchor=normalize) method is a convenience\n helper for converting a json payload into the form Ember Data\n expects.\n\n ```js\n store.push(store.normalize('person', data));\n ```\n\n This method can be used both to push in brand new\n records, as well as to update existing records.\n\n @public\n @param {Object} data\n @return the record(s) that was created or\n updated.\n */\n push(data: EmptyResourceDocument): null;\n push<T>(data: SingleResourceDocument<TypeFromInstance<T>>): T;\n push(data: SingleResourceDocument): OpaqueRecordInstance;\n push<T>(data: CollectionResourceDocument<TypeFromInstance<T>>): T[];\n push(data: CollectionResourceDocument): OpaqueRecordInstance[];\n push(data: JsonApiDocument): OpaqueRecordInstance | OpaqueRecordInstance[] | null {\n if (DEBUG) {\n assertDestroyingStore(this, 'push');\n }\n const pushed = this._push(data, false);\n\n if (Array.isArray(pushed)) {\n return pushed.map((identifier) => this._instanceCache.getRecord(identifier));\n }\n\n if (pushed === null) {\n return null;\n }\n\n return this._instanceCache.getRecord(pushed);\n }\n\n /**\n Push some data in the form of a json-api document into the store,\n without creating materialized records.\n\n @private\n @param {Object} jsonApiDoc\n @return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded\n */\n _push(\n jsonApiDoc: JsonApiDocument,\n asyncFlush?: boolean\n ): StableExistingRecordIdentifier | StableExistingRecordIdentifier[] | null {\n if (DEBUG) {\n assertDestroyingStore(this, '_push');\n }\n if (asyncFlush) {\n this._enableAsyncFlush = true;\n }\n\n let ret!: ResourceDocument;\n this._join(() => {\n ret = this.cache.put({ content: jsonApiDoc });\n });\n\n this._enableAsyncFlush = null;\n\n return 'data' in ret ? ret.data : null;\n }\n\n /**\n * Trigger a save for a Record.\n *\n * Returns a promise resolving with the same record when the save is complete.\n *\n * @public\n * @param {unknown} record\n * @param options\n * @return {Promise<record>}\n */\n saveRecord<T>(record: T, options: Record<string, unknown> = {}): Promise<T> {\n if (DEBUG) {\n assertDestroyingStore(this, 'saveRecord');\n }\n assert(`Unable to initiate save for a record in a disconnected state`, storeFor(record));\n const identifier = recordIdentifierFor(record);\n const cache = this.cache;\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we reject here to prevent bad things.\n return Promise.reject(new Error(`Record Is Disconnected`));\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n this._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(this._instanceCache, identifier)) {\n return Promise.resolve(record);\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n const request = {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n\n return this.request<T>(request).then((document) => document.content);\n }\n\n /**\n * Instantiation hook allowing applications or addons to configure the store\n * to utilize a custom Cache implementation.\n *\n * This hook should not be called directly by consuming applications or libraries.\n * Use `Store.cache` to access the Cache instance.\n *\n * @public\n * @param storeWrapper\n * @return {Cache}\n */\n\n /**\n * Returns the cache instance associated to this Store, instantiates the Cache\n * if necessary via `Store.createCache`\n *\n * @property cache\n * @type {Cache}\n * @public\n */\n get cache(): ReturnType<this['createCache']> {\n let { cache } = this._instanceCache;\n if (!cache) {\n cache = this._instanceCache.cache = this.createCache(this._instanceCache._storeWrapper);\n if (DEBUG) {\n cache = new CacheManager(cache);\n }\n }\n\n return cache as ReturnType<this['createCache']>;\n }\n\n destroy(): void {\n if (this.isDestroyed) {\n // @ember/test-helpers will call destroy multiple times\n return;\n }\n this.isDestroying = true;\n\n this._graph?.destroy();\n this._graph = undefined;\n\n this.notifications.destroy();\n this.recordArrayManager.destroy();\n this.identifierCache.destroy();\n\n this.unloadAll();\n this.isDestroyed = true;\n }\n\n static create(args?: Record<string, unknown>) {\n return new this(args);\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n Store.prototype.getSchemaDefinitionService = function (): SchemaService {\n assert(`You must registerSchemaDefinitionService with the store to use custom model classes`, this._schema);\n deprecate(`Use \\`store.schema\\` instead of \\`store.getSchemaDefinitionService()\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n return this._schema;\n };\n Store.prototype.registerSchemaDefinitionService = function (schema: SchemaService) {\n deprecate(`Use \\`store.createSchemaService\\` instead of \\`store.registerSchemaDefinitionService()\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n this._schema = schema;\n };\n Store.prototype.registerSchema = function (schema: SchemaService) {\n deprecate(`Use \\`store.createSchemaService\\` instead of \\`store.registerSchema()\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n this._schema = schema;\n };\n}\n\nlet assertDestroyingStore: (store: Store, method: string) => void;\nlet assertDestroyedStoreOnly: (store: Store, method: string) => void;\n\nif (DEBUG) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n assertDestroyingStore = function assertDestroyingStore(store: Store, method: string) {\n assert(\n `Attempted to call store.${method}(), but the store instance has already been destroyed.`,\n !(store.isDestroying || store.isDestroyed)\n );\n };\n // eslint-disable-next-line @typescript-eslint/no-shadow\n assertDestroyedStoreOnly = function assertDestroyedStoreOnly(store: Store, method: string) {\n assert(\n `Attempted to call store.${method}(), but the store instance has already been destroyed.`,\n !store.isDestroyed\n );\n };\n}\n\nfunction isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\n );\n}\n\nfunction normalizeProperties(\n store: Store,\n identifier: StableRecordIdentifier,\n properties?: { [key: string]: unknown }\n): { [key: string]: unknown } | undefined {\n // assert here\n if (properties !== undefined) {\n if ('id' in properties) {\n assert(`expected id to be a string or null`, properties.id !== undefined);\n }\n assert(\n `You passed '${typeof properties}' as properties for record creation instead of an object.`,\n typeof properties === 'object' && properties !== null\n );\n\n const { type } = identifier;\n\n // convert relationship Records to RecordDatas before passing to RecordData\n const defs = store.schema.fields({ type });\n\n if (defs.size) {\n const keys = Object.keys(properties);\n\n for (let i = 0; i < keys.length; i++) {\n const prop = keys[i];\n const field = defs.get(prop);\n\n if (!field) continue;\n\n if (field.kind === 'hasMany') {\n if (DEBUG) {\n assertRecordsPassedToHasMany(properties[prop] as OpaqueRecordInstance[]);\n }\n properties[prop] = extractIdentifiersFromRecords(properties[prop] as OpaqueRecordInstance[]);\n } else if (field.kind === 'belongsTo') {\n properties[prop] = extractIdentifierFromRecord(properties[prop]);\n }\n }\n }\n }\n return properties;\n}\n\nfunction assertRecordsPassedToHasMany(records: OpaqueRecordInstance[]) {\n assert(`You must pass an array of records to set a hasMany relationship`, Array.isArray(records));\n assert(\n `All elements of a hasMany relationship must be instances of Model, you passed ${records\n .map((r) => `${typeof r}`)\n .join(', ')}`,\n (function () {\n return records.every((record) => {\n try {\n recordIdentifierFor(record);\n return true;\n } catch {\n return false;\n }\n });\n })()\n );\n}\n\nfunction extractIdentifiersFromRecords(records: OpaqueRecordInstance[]): StableRecordIdentifier[] {\n return records.map((record) => extractIdentifierFromRecord(record)) as StableRecordIdentifier[];\n}\n\ntype PromiseProxyRecord = { then(): void; content: OpaqueRecordInstance | null | undefined };\n\nfunction extractIdentifierFromRecord(recordOrPromiseRecord: PromiseProxyRecord | OpaqueRecordInstance | null) {\n if (!recordOrPromiseRecord) {\n return null;\n }\n const extract = recordIdentifierFor;\n\n return extract(recordOrPromiseRecord);\n}\n","import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_MANY_ARRAY_DUPLICATES } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { BaseFinderOptions, ModelSchema, StableRecordIdentifier } from '../../../types.ts';\nimport type { Cache } from '../../../types/cache.ts';\nimport type {\n OpaqueRecordInstance,\n TypedRecordInstance,\n TypeFromInstance,\n TypeFromInstanceOrString,\n} from '../../../types/record.ts';\nimport type { LegacyHasManyField, LinksModeHasManyField } from '../../../types/schema/fields.ts';\nimport type { Links, PaginationLinks } from '../../../types/spec/json-api-raw.ts';\nimport { isStableIdentifier } from '../caches/identifier-cache.ts';\nimport { recordIdentifierFor } from '../caches/instance-cache.ts';\nimport { ARRAY_SIGNAL, notifyInternalSignal, type WarpDriveSignal } from '../new-core-tmp/reactivity/internal.ts';\nimport type { CreateRecordProperties, Store } from '../store-service.ts';\nimport type { MinimumManager } from './identifier-array.ts';\nimport { IdentifierArray, MUTATE, SOURCE } from './identifier-array.ts';\nimport type { NativeProxy } from './native-proxy-type-fix.ts';\n\ntype IdentifierArrayCreateOptions = ConstructorParameters<typeof IdentifierArray>[0];\n\nexport interface ManyArrayCreateArgs<T> {\n identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];\n type: TypeFromInstanceOrString<T>;\n store: Store;\n allowMutation: boolean;\n manager: MinimumManager;\n field?: LegacyHasManyField | LinksModeHasManyField;\n identifier: StableRecordIdentifier;\n cache: Cache;\n meta: Record<string, unknown> | null;\n links: Links | PaginationLinks | null;\n key: string;\n isPolymorphic: boolean;\n isAsync: boolean;\n _inverseIsAsync: boolean;\n isLoaded: boolean;\n}\n/**\n A `ManyArray` is a `MutableArray` that represents the contents of a has-many\n relationship.\n\n The `ManyArray` is instantiated lazily the first time the relationship is\n requested.\n\n This class is not intended to be directly instantiated by consuming applications.\n\n ### Inverses\n\n Often, the relationships in Ember Data applications will have\n an inverse. For example, imagine the following models are\n defined:\n\n ```js [app/models/post.js]\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment') comments;\n }\n ```\n\n ```js [app/models/comment.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class CommentModel extends Model {\n @belongsTo('post') post;\n }\n ```\n\n If you created a new instance of `Post` and added\n a `Comment` record to its `comments` has-many\n relationship, you would expect the comment's `post`\n property to be set to the post that contained\n the has-many.\n\n We call the record to which a relationship belongs-to the\n relationship's _owner_.\n\n @class ManyArray\n @public\n*/\nexport class RelatedCollection<T = unknown> extends IdentifierArray<T> {\n declare isAsync: boolean;\n /**\n The loading state of this array\n\n @property isLoaded\n @type {Boolean}\n @public\n */\n\n declare isLoaded: boolean;\n /**\n `true` if the relationship is polymorphic, `false` otherwise.\n\n @property isPolymorphic\n @type {Boolean}\n @private\n */\n declare isPolymorphic: boolean;\n declare _inverseIsAsync: boolean;\n /**\n Metadata associated with the request for async hasMany relationships.\n\n Example\n\n Given that the server returns the following JSON payload when fetching a\n hasMany relationship:\n\n ```js\n {\n \"comments\": [{\n \"id\": 1,\n \"comment\": \"This is the first comment\",\n }, {\n // ...\n }],\n\n \"meta\": {\n \"page\": 1,\n \"total\": 5\n }\n }\n ```\n\n You can then access the meta data via the `meta` property:\n\n ```js\n let comments = await post.comments;\n let meta = comments.meta;\n\n // meta.page => 1\n // meta.total => 5\n ```\n\n @property meta\n @type {Object | null}\n @public\n */\n declare meta: Record<string, unknown> | null;\n /**\n * Retrieve the links for this relationship\n *\n @property links\n @type {Object | null}\n @public\n */\n declare links: Links | PaginationLinks | null;\n declare identifier: StableRecordIdentifier;\n declare cache: Cache;\n declare _manager: MinimumManager;\n declare store: Store;\n declare key: string;\n declare type: ModelSchema;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n\n constructor(options: ManyArrayCreateArgs<T>) {\n super(options as unknown as IdentifierArrayCreateOptions);\n this.isLoaded = options.isLoaded || false;\n this.isAsync = options.isAsync || false;\n this.isPolymorphic = options.isPolymorphic || false;\n this.identifier = options.identifier;\n this.key = options.key;\n }\n\n [MUTATE](\n target: StableRecordIdentifier[],\n receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>,\n prop: string,\n args: unknown[],\n _SIGNAL: WarpDriveSignal\n ): unknown {\n switch (prop) {\n case 'length 0': {\n Reflect.set(target, 'length', 0);\n mutateReplaceRelatedRecords(this, [], _SIGNAL);\n return true;\n }\n case 'replace cell': {\n const [index, prior, value] = args as [number, StableRecordIdentifier, StableRecordIdentifier];\n target[index] = value;\n mutateReplaceRelatedRecord(this, { value, prior, index }, _SIGNAL);\n return true;\n }\n case 'push': {\n const newValues = extractIdentifiersFromRecords(args);\n\n assertNoDuplicates(\n this,\n target,\n (currentState) => currentState.push(...newValues),\n `Cannot push duplicates to a hasMany's state.`\n );\n\n if (DEPRECATE_MANY_ARRAY_DUPLICATES) {\n // dedupe\n const seen = new Set(target);\n const unique = new Set<OpaqueRecordInstance>();\n\n args.forEach((item) => {\n const identifier = recordIdentifierFor(item);\n if (!seen.has(identifier)) {\n seen.add(identifier);\n unique.add(item);\n }\n });\n\n const newArgs = Array.from(unique);\n const result = Reflect.apply(target[prop], receiver, newArgs) as OpaqueRecordInstance[];\n\n if (newArgs.length) {\n mutateAddToRelatedRecords(this, { value: extractIdentifiersFromRecords(newArgs) }, _SIGNAL);\n }\n return result;\n }\n\n // else, no dedupe, error on duplicates\n const result = Reflect.apply(target[prop], receiver, args) as OpaqueRecordInstance[];\n if (newValues.length) {\n mutateAddToRelatedRecords(this, { value: newValues }, _SIGNAL);\n }\n return result;\n }\n\n case 'pop': {\n const result: unknown = Reflect.apply(target[prop], receiver, args);\n if (result) {\n mutateRemoveFromRelatedRecords(this, { value: recordIdentifierFor(result as OpaqueRecordInstance) }, _SIGNAL);\n }\n return result;\n }\n\n case 'unshift': {\n const newValues = extractIdentifiersFromRecords(args);\n\n assertNoDuplicates(\n this,\n target,\n (currentState) => currentState.unshift(...newValues),\n `Cannot unshift duplicates to a hasMany's state.`\n );\n\n if (DEPRECATE_MANY_ARRAY_DUPLICATES) {\n // dedupe\n const seen = new Set(target);\n const unique = new Set<OpaqueRecordInstance>();\n\n args.forEach((item) => {\n const identifier = recordIdentifierFor(item);\n if (!seen.has(identifier)) {\n seen.add(identifier);\n unique.add(item);\n }\n });\n\n const newArgs = Array.from(unique);\n const result: unknown = Reflect.apply(target[prop], receiver, newArgs);\n\n if (newArgs.length) {\n mutateAddToRelatedRecords(this, { value: extractIdentifiersFromRecords(newArgs), index: 0 }, _SIGNAL);\n }\n return result;\n }\n\n // else, no dedupe, error on duplicates\n const result = Reflect.apply(target[prop], receiver, args) as OpaqueRecordInstance[];\n if (newValues.length) {\n mutateAddToRelatedRecords(this, { value: newValues, index: 0 }, _SIGNAL);\n }\n return result;\n }\n\n case 'shift': {\n const result: unknown = Reflect.apply(target[prop], receiver, args);\n\n if (result) {\n mutateRemoveFromRelatedRecords(\n this,\n { value: recordIdentifierFor(result as OpaqueRecordInstance), index: 0 },\n _SIGNAL\n );\n }\n return result;\n }\n\n case 'sort': {\n const result: unknown = Reflect.apply(target[prop], receiver, args);\n mutateSortRelatedRecords(this, (result as OpaqueRecordInstance[]).map(recordIdentifierFor), _SIGNAL);\n return result;\n }\n\n case 'splice': {\n const [start, deleteCount, ...adds] = args as [number, number, ...OpaqueRecordInstance[]];\n\n // detect a full replace\n if (start === 0 && deleteCount === this[SOURCE].length) {\n const newValues = extractIdentifiersFromRecords(adds);\n\n assertNoDuplicates(\n this,\n target,\n (currentState) => currentState.splice(start, deleteCount, ...newValues),\n `Cannot replace a hasMany's state with a new state that contains duplicates.`\n );\n\n if (DEPRECATE_MANY_ARRAY_DUPLICATES) {\n // dedupe\n const current = new Set(adds);\n const unique = Array.from(current);\n const newArgs = ([start, deleteCount] as unknown[]).concat(unique);\n\n const result = Reflect.apply(target[prop], receiver, newArgs) as OpaqueRecordInstance[];\n\n mutateReplaceRelatedRecords(this, extractIdentifiersFromRecords(unique), _SIGNAL);\n return result;\n }\n\n // else, no dedupe, error on duplicates\n const result = Reflect.apply(target[prop], receiver, args) as OpaqueRecordInstance[];\n mutateReplaceRelatedRecords(this, newValues, _SIGNAL);\n return result;\n }\n\n const newValues = extractIdentifiersFromRecords(adds);\n assertNoDuplicates(\n this,\n target,\n (currentState) => currentState.splice(start, deleteCount, ...newValues),\n `Cannot splice a hasMany's state with a new state that contains duplicates.`\n );\n\n if (DEPRECATE_MANY_ARRAY_DUPLICATES) {\n // dedupe\n const currentState = target.slice();\n currentState.splice(start, deleteCount);\n\n const seen = new Set(currentState);\n const unique: OpaqueRecordInstance[] = [];\n adds.forEach((item) => {\n const identifier = recordIdentifierFor(item);\n if (!seen.has(identifier)) {\n seen.add(identifier);\n unique.push(item);\n }\n });\n\n const newArgs = [start, deleteCount, ...unique];\n const result = Reflect.apply(target[prop], receiver, newArgs) as OpaqueRecordInstance[];\n\n if (deleteCount > 0) {\n mutateRemoveFromRelatedRecords(this, { value: result.map(recordIdentifierFor), index: start }, _SIGNAL);\n }\n\n if (unique.length > 0) {\n mutateAddToRelatedRecords(this, { value: extractIdentifiersFromRecords(unique), index: start }, _SIGNAL);\n }\n\n return result;\n }\n\n // else, no dedupe, error on duplicates\n const result = Reflect.apply(target[prop], receiver, args) as OpaqueRecordInstance[];\n if (deleteCount > 0) {\n mutateRemoveFromRelatedRecords(this, { value: result.map(recordIdentifierFor), index: start }, _SIGNAL);\n }\n if (newValues.length > 0) {\n mutateAddToRelatedRecords(this, { value: newValues, index: start }, _SIGNAL);\n }\n return result;\n }\n default:\n assert(`unable to convert ${prop} into a transaction that updates the cache state for this record array`);\n }\n }\n\n notify() {\n notifyInternalSignal(this[ARRAY_SIGNAL]);\n }\n\n /**\n Reloads all of the records in the manyArray. If the manyArray\n holds a relationship that was originally fetched using a links url\n WarpDrive will revisit the original links url to repopulate the\n relationship.\n\n If the ManyArray holds the result of a `store.query()` reload will\n re-run the original query.\n\n Example\n\n ```javascript\n let user = store.peekRecord('user', '1')\n await login(user);\n\n let permissions = await user.permissions;\n await permissions.reload();\n ```\n\n @public\n */\n reload(options?: BaseFinderOptions): Promise<this> {\n assert(\n `Expected the manager for ManyArray to implement reloadHasMany`,\n typeof this._manager.reloadHasMany === 'function'\n );\n // TODO this is odd, we don't ask the store for anything else like this?\n return this._manager.reloadHasMany<T>(this.key, options) as Promise<this>;\n }\n\n /**\n Create a child record within the owner\n\n @public\n @param {Object} hash\n @return {Model} record\n */\n createRecord(hash: CreateRecordProperties<T>): T {\n const { store } = this;\n assert(`Expected modelName to be set`, this.modelName);\n const record = store.createRecord<T>(this.modelName as TypeFromInstance<T>, hash);\n this.push(record);\n\n return record;\n }\n\n /**\n Saves all of the records in the `ManyArray`.\n\n Note: this API can only be used in legacy mode with a configured Adapter.\n\n Example\n\n ```javascript\n const { content: { data: inbox } } = await store.request(findRecord({ type: 'inbox', id: '1' }));\n\n let messages = await inbox.messages;\n messages.forEach((message) => {\n message.isRead = true;\n });\n messages.save();\n ```\n\n @public\n @return {PromiseArray} promise\n */\n declare save: () => Promise<IdentifierArray<T>>;\n\n /** @internal */\n destroy() {\n super.destroy(false);\n }\n}\nRelatedCollection.prototype.isAsync = false;\nRelatedCollection.prototype.isPolymorphic = false;\nRelatedCollection.prototype.identifier = null as unknown as StableRecordIdentifier;\nRelatedCollection.prototype.cache = null as unknown as Cache;\nRelatedCollection.prototype._inverseIsAsync = false;\nRelatedCollection.prototype.key = '';\nRelatedCollection.prototype.DEPRECATED_CLASS_NAME = 'ManyArray';\n\ntype PromiseProxyRecord = { then(): void; content: OpaqueRecordInstance | null | undefined };\n\nfunction assertRecordPassedToHasMany(record: OpaqueRecordInstance | PromiseProxyRecord) {\n assert(\n `All elements of a hasMany relationship must be instances of Model, you passed ${typeof record}`,\n (function () {\n try {\n recordIdentifierFor(record);\n return true;\n } catch {\n return false;\n }\n })()\n );\n}\n\nfunction extractIdentifiersFromRecords(records: OpaqueRecordInstance[]): StableRecordIdentifier[] {\n return records.map(extractIdentifierFromRecord);\n}\n\nfunction extractIdentifierFromRecord(recordOrPromiseRecord: PromiseProxyRecord | OpaqueRecordInstance) {\n assertRecordPassedToHasMany(recordOrPromiseRecord);\n return recordIdentifierFor(recordOrPromiseRecord);\n}\n\nfunction assertNoDuplicates<T>(\n collection: RelatedCollection<T>,\n target: StableRecordIdentifier[],\n callback: (currentState: StableRecordIdentifier[]) => void,\n reason: string\n) {\n const state = target.slice();\n callback(state);\n\n if (state.length !== new Set(state).size) {\n const duplicates = state.filter((currentValue, currentIndex) => state.indexOf(currentValue) !== currentIndex);\n\n if (DEPRECATE_MANY_ARRAY_DUPLICATES) {\n deprecate(\n `${reason} This behavior is deprecated. Found duplicates for the following records within the new state provided to \\`<${\n collection.identifier.type\n }:${collection.identifier.id || collection.identifier.lid}>.${collection.key}\\`\\n\\t- ${Array.from(\n new Set(duplicates)\n )\n .map((r) => (isStableIdentifier(r) ? r.lid : recordIdentifierFor(r).lid))\n .sort((a, b) => a.localeCompare(b))\n .join('\\n\\t- ')}`,\n false,\n {\n id: 'ember-data:deprecate-many-array-duplicates',\n for: 'ember-data',\n until: '6.0',\n since: {\n enabled: '5.3',\n available: '4.13',\n },\n }\n );\n } else {\n throw new Error(\n `${reason} Found duplicates for the following records within the new state provided to \\`<${\n collection.identifier.type\n }:${collection.identifier.id || collection.identifier.lid}>.${collection.key}\\`\\n\\t- ${Array.from(\n new Set(duplicates)\n )\n .map((r) => (isStableIdentifier(r) ? r.lid : recordIdentifierFor(r).lid))\n .sort((a, b) => a.localeCompare(b))\n .join('\\n\\t- ')}`\n );\n }\n }\n}\n\nfunction mutateAddToRelatedRecords<T>(\n collection: RelatedCollection<T>,\n operationInfo: { value: StableRecordIdentifier | StableRecordIdentifier[]; index?: number },\n _SIGNAL: WarpDriveSignal\n) {\n mutate(\n collection,\n {\n op: 'add',\n record: collection.identifier,\n field: collection.key,\n ...operationInfo,\n },\n _SIGNAL\n );\n}\n\nfunction mutateRemoveFromRelatedRecords<T>(\n collection: RelatedCollection<T>,\n operationInfo: { value: StableRecordIdentifier | StableRecordIdentifier[]; index?: number },\n _SIGNAL: WarpDriveSignal\n) {\n mutate(\n collection,\n {\n op: 'remove',\n record: collection.identifier,\n field: collection.key,\n ...operationInfo,\n },\n _SIGNAL\n );\n}\n\nfunction mutateReplaceRelatedRecord<T>(\n collection: RelatedCollection<T>,\n operationInfo: {\n value: StableRecordIdentifier;\n prior: StableRecordIdentifier;\n index: number;\n },\n _SIGNAL: WarpDriveSignal\n) {\n mutate(\n collection,\n {\n op: 'replaceRelatedRecord',\n record: collection.identifier,\n field: collection.key,\n ...operationInfo,\n },\n _SIGNAL\n );\n}\n\nfunction mutateReplaceRelatedRecords<T>(\n collection: RelatedCollection<T>,\n value: StableRecordIdentifier[],\n _SIGNAL: WarpDriveSignal\n) {\n mutate(\n collection,\n {\n op: 'replaceRelatedRecords',\n record: collection.identifier,\n field: collection.key,\n value,\n },\n _SIGNAL\n );\n}\n\nfunction mutateSortRelatedRecords<T>(\n collection: RelatedCollection<T>,\n value: StableRecordIdentifier[],\n _SIGNAL: WarpDriveSignal\n) {\n mutate(\n collection,\n {\n op: 'sortRelatedRecords',\n record: collection.identifier,\n field: collection.key,\n value,\n },\n _SIGNAL\n );\n}\n\nfunction mutate<T>(\n collection: RelatedCollection<T>,\n mutation: Parameters<Exclude<MinimumManager['mutate'], undefined>>[0],\n _SIGNAL: WarpDriveSignal\n) {\n assert(`Expected the manager for ManyArray to implement mutate`, typeof collection._manager.mutate === 'function');\n collection._manager.mutate(mutation);\n notifyInternalSignal(_SIGNAL);\n}\n","import { assert } from '@warp-drive/build-config/macros';\n\nimport type { Awaitable } from '../../../request.ts';\nimport { getPromiseResult, setPromiseResult } from '../../../request.ts';\nimport { defineSignal } from './reactivity/signal.ts';\n\nconst PromiseCache = new WeakMap<Awaitable, PromiseState>();\n\n/**\n * The state of a promise in the \"pending\"\n * state. This is the default initial state.\n *\n */\nexport interface PendingPromise {\n /**\n * The status of the promise.\n *\n */\n status: 'pending';\n\n /**\n * Whether the promise is pending.\n *\n */\n isPending: true;\n\n /**\n * Whether the promise is pending.\n *\n * @deprecated use `isPending` instead\n */\n isLoading: true;\n\n /**\n * Whether the promise has resolved\n * successfully.\n *\n */\n isSuccess: false;\n\n /**\n * Whether the promise has rejected\n * with an error.\n *\n */\n isError: false;\n\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n */\n value: null;\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n * @deprecated use `value` instead\n */\n result: null;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n *\n * @deprecated use `reason` instead\n */\n error: null;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n */\n reason: null;\n}\n\n/**\n * The state of a promise in the \"fulfilled\" state.\n * This is the state of a promise that has resolved\n * successfully.\n *\n */\nexport interface ResolvedPromise<T> {\n /**\n * The status of the promise.\n *\n */\n status: 'fulfilled';\n\n /**\n * Whether the promise is pending.\n *\n */\n isPending: false;\n\n /**\n * Whether the promise is pending.\n *\n * @deprecated use `isPending` instead\n */\n isLoading: false;\n /**\n * Whether the promise has resolved\n * successfully.\n *\n */\n isSuccess: true;\n\n /**\n * Whether the promise has rejected\n * with an error.\n *\n */\n isError: false;\n\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n */\n value: T;\n\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n * @deprecated use `value` instead\n */\n result: T;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n *\n * @deprecated use `reason` instead\n */\n error: null;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n */\n reason: null;\n}\n\n/**\n * The state of a promise in the \"rejected\" state.\n * This is the state of a promise that has rejected\n * with an error.\n *\n */\nexport interface RejectedPromise<E> {\n /**\n * The status of the promise.\n *\n */\n status: 'rejected';\n\n /**\n * Whether the promise is pending.\n *\n */\n isPending: false;\n\n /**\n * Whether the promise is pending.\n *\n * @deprecated use `isPending` instead\n */\n isLoading: false;\n\n /**\n * Whether the promise has resolved\n * successfully.\n *\n */\n isSuccess: false;\n\n /**\n * Whether the promise has rejected\n * with an error.\n *\n */\n isError: true;\n\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n */\n value: null;\n\n /**\n * Once the promise has resolved, this will\n * be the value the promise resolved to.\n *\n * @deprecated use `value` instead\n */\n result: null;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n *\n * @deprecated use `reason` instead\n */\n error: E;\n\n /**\n * Once the promise has rejected, this will\n * be the error the promise rejected with.\n *\n */\n reason: E;\n}\n\n/**\n * The state of a promise. This is the type that is returned\n * from `getPromiseState`.\n *\n * See also:\n * - {@link PendingPromise}\n * - {@link ResolvedPromise}\n * - {@link RejectedPromise}\n *\n */\nexport type PromiseState<T = unknown, E = unknown> = PendingPromise | ResolvedPromise<T> | RejectedPromise<E>;\n\nconst PromiseStateProto = {};\n\n// TODO introduce a new mechanism for defining multiple properties\n// that share a common signal\ndefineSignal(PromiseStateProto, 'reason', null);\ndefineSignal(PromiseStateProto, 'value', null);\ndefineSignal(PromiseStateProto, 'result', null);\ndefineSignal(PromiseStateProto, 'error', null);\ndefineSignal(PromiseStateProto, 'status', 'pending');\ndefineSignal(PromiseStateProto, 'isPending', true);\ndefineSignal(PromiseStateProto, 'isLoading', true);\ndefineSignal(PromiseStateProto, 'isSuccess', false);\ndefineSignal(PromiseStateProto, 'isError', false);\n\nexport function createPromiseState<T, E>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>> {\n const state = getPromiseResult<T, E>(promise);\n const promiseState = Object.create(PromiseStateProto) as PromiseState<T, E>;\n\n if (state) {\n if (state.isError) {\n promiseState.error = state.result;\n promiseState.reason = state.result;\n promiseState.status = 'rejected';\n promiseState.isError = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n } else {\n promiseState.result = state.result;\n promiseState.value = state.result;\n promiseState.status = 'fulfilled';\n promiseState.isSuccess = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n }\n } else {\n void promise.then(\n (result) => {\n setPromiseResult(promise, { isError: false, result });\n promiseState.result = result;\n promiseState.value = result;\n promiseState.status = 'fulfilled';\n promiseState.isSuccess = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n },\n (error: E) => {\n setPromiseResult(promise, { isError: true, result: error });\n promiseState.error = error;\n promiseState.reason = error;\n promiseState.status = 'rejected';\n promiseState.isError = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n }\n );\n }\n\n return promiseState;\n}\n\nconst LegacyPromiseProxy = Symbol.for('LegacyPromiseProxy');\ntype LegacyAwaitable<T, E> = { promise: Promise<T> | Awaitable<T, E>; [LegacyPromiseProxy]: true };\n\nfunction isLegacyAwaitable<T, E>(promise: object): promise is LegacyAwaitable<T, E> {\n return LegacyPromiseProxy in promise && 'promise' in promise && promise[LegacyPromiseProxy] === true;\n}\n\nfunction getPromise<T, E>(promise: Promise<T> | Awaitable<T, E> | LegacyAwaitable<T, E>): Promise<T> | Awaitable<T, E> {\n return isLegacyAwaitable(promise) ? promise.promise : promise;\n}\n\n/**\n * Returns a reactive state-machine for the provided promise or awaitable.\n *\n * Repeat calls to `getPromiseState` with the same promise will return the same state object\n * making is safe and easy to use in templates and JavaScript code to produce reactive\n * behaviors around promises.\n *\n * `getPromiseState` can be used in both JavaScript and Template contexts.\n *\n * ```ts\n * import { getPromiseState } from '@warp-drive/ember';\n *\n * const state = getPromiseState(promise);\n * ```\n *\n * For instance, we could write a getter on a component that updates whenever\n * the promise state advances or the promise changes, by combining the function\n * with the use of `@cached`\n *\n * ```ts\n * class Component {\n * @cached\n * get title() {\n * const state = getPromiseState(this.args.request);\n * if (state.isPending) {\n * return 'loading...';\n * }\n * if (state.isError) { return null; }\n * return state.result.title;\n * }\n * }\n * ```\n *\n * Or in a template as a helper:\n *\n * ```gjs\n * import { getPromiseState } from '@warp-drive/ember';\n *\n * <template>\n * {{#let (getPromiseState @request) as |state|}}\n * {{#if state.isPending}} <Spinner />\n * {{else if state.isError}} <ErrorForm @error={{state.error}} />\n * {{else}}\n * <h1>{{state.result.title}}</h1>\n * {{/if}}\n * {{/let}}\n * </template>\n * ```\n *\n * If looking to use in a template, consider also the `<Await />` component.\n *\n */\nexport function getPromiseState<T = unknown, E = unknown>(\n promise: Promise<T> | Awaitable<T, E>\n): Readonly<PromiseState<T, E>> {\n assert(`getPromiseState expects to be called with a promise: called with ${String(promise)}`, promise);\n const _promise = getPromise(promise);\n let state = PromiseCache.get(_promise) as PromiseState<T, E> | undefined;\n\n if (!state) {\n state = createPromiseState(_promise);\n PromiseCache.set(_promise, state);\n }\n\n return state;\n}\n","const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n","import { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { RequestManager, Store, StoreRequestInput } from '../../../index';\nimport type { Future } from '../../../request';\nimport type { StableDocumentIdentifier } from '../../../types/identifier';\nimport type { RequestInfo } from '../../../types/request';\nimport { EnableHydration } from '../../../types/request';\nimport { defineSignal, getRequestState, memoized } from '../../-private';\n\n// default to 30 seconds unavailable before we refresh\nconst DEFAULT_DEADLINE = 30_000;\nexport const DISPOSE = (Symbol.dispose || Symbol.for('dispose')) as unknown as '(symbol) dispose';\n\nfunction isNeverString(val: never): string {\n return val;\n}\n\ntype AutorefreshBehaviorType = 'online' | 'interval' | 'invalid';\ntype AutorefreshBehaviorCombos =\n | boolean\n | AutorefreshBehaviorType\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}`\n | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;\n\ntype ContentFeatures<RT> = {\n isOnline: boolean;\n isHidden: boolean;\n isRefreshing: boolean;\n refresh: () => Promise<void>;\n reload: () => Promise<void>;\n abort?: () => void;\n latestRequest?: Future<RT>;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface SubscriptionArgs<RT, T, E> {\n /**\n * The request to monitor. This should be a `Future` instance returned\n * by either the `store.request` or `store.requestManager.request` methods.\n *\n */\n request?: Future<RT>;\n\n /**\n * A query to use for the request. This should be an object that can be\n * passed to `store.request`. Use this in place of `@request` if you would\n * like the component to also initiate the request.\n *\n */\n query?: StoreRequestInput<RT, T>;\n\n /**\n * The autorefresh behavior for the request. This can be a boolean, or any\n * combination of the following values: `'online'`, `'interval'`, `'invalid'`.\n *\n * - `'online'`: Refresh the request when the browser comes back online\n * - `'interval'`: Refresh the request at a specified interval\n * - `'invalid'`: Refresh the request when the store emits an invalidation\n *\n * If `true`, this is equivalent to `'online,invalid'`.\n *\n * Defaults to `false`.\n *\n */\n autorefresh?: AutorefreshBehaviorCombos;\n\n /**\n * The number of milliseconds to wait before refreshing the request when the\n * browser comes back online or the network becomes available.\n *\n * This also controls the interval at which the request will be refreshed if\n * the `interval` autorefresh type is enabled.\n *\n * Defaults to `30_000` (30 seconds).\n *\n */\n autorefreshThreshold?: number;\n\n /**\n * The behavior of the request initiated by autorefresh. This can be one of\n * the following values:\n *\n * - `'refresh'`: Refresh the request in the background\n * - `'reload'`: Force a reload of the request\n * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to\n * reload, refresh, or do nothing.\n *\n * Defaults to `'policy'`.\n *\n */\n autorefreshBehavior?: 'refresh' | 'reload' | 'policy';\n}\n\n/**\n * A reactive class\n *\n * @hideconstructor\n */\nexport class RequestSubscription<RT, T, E> {\n /**\n * Whether the browser reports that the network is online.\n */\n declare isOnline: boolean;\n\n /**\n * Whether the browser reports that the tab is hidden.\n */\n declare isHidden: boolean;\n\n /**\n * Whether the component is currently refreshing the request.\n */\n declare isRefreshing: boolean;\n\n /**\n * The most recent blocking request that was made, typically\n * the result of a reload.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n declare private _localRequest: Future<RT> | undefined;\n\n /**\n * The most recent request that was made, typically due to either a\n * reload or a refresh.\n *\n * This will never be the original request passed as an arg to\n * the component.\n *\n * @internal\n */\n declare private _latestRequest: Future<RT> | undefined;\n\n /**\n * The time at which the network was reported as offline.\n *\n * @internal\n */\n declare private _unavailableStart: number | null;\n /** @internal */\n declare private _intervalStart: number | null;\n /** @internal */\n declare private _nextInterval: number | null;\n /** @internal */\n declare private _invalidated: boolean;\n /** @internal */\n declare private _isUpdating: boolean;\n /** @internal */\n declare private isDestroyed: boolean;\n\n /**\n * The event listener for network status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare private _onlineChanged: (event: Event) => void;\n\n /**\n * The event listener for visibility status changes,\n * cached to use the reference for removal.\n *\n * @internal\n */\n declare private _backgroundChanged: (event: Event) => void;\n\n /**\n * The last request passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare private _originalRequest: Future<RT> | undefined;\n\n /**\n * The last query passed as an arg to the component,\n * cached for comparison.\n *\n * @internal\n */\n declare private _originalQuery: StoreRequestInput<RT, T> | undefined;\n /** @internal */\n declare private _subscription: object | null;\n /** @internal */\n declare private _subscribedTo: object | null;\n /** @internal */\n declare private _args: SubscriptionArgs<RT, T, E>;\n /** @internal */\n declare store: Store | RequestManager;\n\n constructor(store: Store | RequestManager, args: SubscriptionArgs<RT, T, E>) {\n this._args = args;\n this.store = store;\n this._subscribedTo = null;\n this._subscription = null;\n this._intervalStart = null;\n this._invalidated = false;\n this._nextInterval = null;\n this.isDestroyed = false;\n\n this._installListeners();\n void this._beginPolling();\n }\n\n /**\n * @internal\n */\n private async _beginPolling() {\n // await the initial request\n try {\n if (!this.isIdle) {\n await this.request;\n }\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n } finally {\n if (!this.isDestroyed) {\n void this._scheduleInterval();\n }\n }\n }\n\n @memoized\n get isIdle() {\n const { request, query } = this._args;\n\n return Boolean(!request && !query);\n }\n\n @memoized\n get autorefreshTypes(): Set<AutorefreshBehaviorType> {\n const { autorefresh } = this._args;\n let types: AutorefreshBehaviorType[];\n\n if (autorefresh === true) {\n types = ['online', 'invalid'];\n } else if (typeof autorefresh === 'string') {\n types = autorefresh.split(',') as AutorefreshBehaviorType[];\n } else {\n types = [];\n }\n\n return new Set(types);\n }\n\n // we only run this function on component creation\n // and when an update is triggered, so it does not\n // react to changes in the autorefreshThreshold\n // or autorefresh args.\n //\n // if we need to react to those changes, we can\n // use a modifier or internal component or some\n // such to trigger a re-run of this function.\n private async _scheduleInterval() {\n const { autorefreshThreshold } = this._args;\n const hasValidThreshold = typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0;\n if (\n // dont schedule in SSR\n typeof window === 'undefined' ||\n // dont schedule without a threshold\n !hasValidThreshold ||\n // dont schedule if we weren't told to\n !this.autorefreshTypes.has('interval') ||\n // dont schedule if we're already scheduled\n this._intervalStart !== null\n ) {\n return;\n }\n\n // if we have a current request, wait for it to finish\n // before scheduling the next one\n if (this._latestRequest) {\n try {\n await this._latestRequest;\n } catch {\n // ignore errors here, we just want to wait for the request to finish\n }\n\n if (this.isDestroyed) {\n return;\n }\n }\n\n // setup the next interval\n this._intervalStart = Date.now();\n this._nextInterval = setTimeout(() => {\n this._maybeUpdate();\n }, autorefreshThreshold) as unknown as number;\n }\n\n private _clearInterval() {\n if (this._nextInterval) {\n clearTimeout(this._nextInterval);\n this._intervalStart = null;\n }\n }\n /**\n * @internal\n */\n private _updateSubscriptions() {\n if (this.isIdle) {\n return;\n }\n const requestId = this._request.lid;\n\n // if we're already subscribed to this request, we don't need to do anything\n if (this._subscribedTo === requestId) {\n return;\n }\n\n // if we're subscribed to a different request, we need to unsubscribe\n this._removeSubscriptions();\n\n // if we have a request, we need to subscribe to it\n const { store } = this;\n if (requestId && isStore(store)) {\n this._subscribedTo = requestId;\n\n this._subscription = store.notifications.subscribe(\n requestId,\n (_id: StableDocumentIdentifier, op: 'invalidated' | 'state' | 'added' | 'updated' | 'removed') => {\n // ignore subscription events that occur while our own component's request\n // is ocurring\n if (this._isUpdating) {\n return;\n }\n switch (op) {\n case 'invalidated': {\n // if we're subscribed to invalidations, we need to update\n if (this.autorefreshTypes.has('invalid')) {\n this._invalidated = true;\n this._maybeUpdate();\n }\n break;\n }\n case 'state': {\n const latest = store.requestManager._deduped.get(requestId);\n const priority = latest?.priority;\n const state = this.reqState;\n if (!priority) {\n // if there is no priority, we have completed whatever request\n // was occurring and so we are no longer refreshing (if we were)\n this.isRefreshing = false;\n } else if (priority.blocking && !state.isLoading) {\n // if we are blocking, there is an active request for this identity\n // that MUST be fulfilled from network (not cache).\n // Thus this is not \"refreshing\" because we should clear out and\n // block on this request.\n //\n // we receive state notifications when either a request initiates\n // or completes.\n //\n // In the completes case: we may receive the state notification\n // slightly before the request is finalized because the NotificationManager\n // may sync flush it (and thus deliver it before the microtask completes)\n //\n // In the initiates case: we aren't supposed to receive one unless there\n // is no other request in flight for this identity.\n //\n // However, there is a race condition here where the completed\n // notification can trigger an update that generates a new request\n // thus giving us an initiated notification before the older request\n // finalizes.\n //\n // When this occurs, if the triggered update happens to have caused\n // a new request to be made for the same identity AND that request\n // is the one passed into this component as the @request arg, then\n // getRequestState will return the state of the new request.\n // We can detect this by checking if the request state is \"loading\"\n // as outside of this case we would have a completed request.\n //\n // That is the reason for the `&& !state.isLoading` check above.\n\n // TODO should we just treat this as refreshing?\n this.isRefreshing = false;\n this._maybeUpdate('policy', true);\n } else {\n this.isRefreshing = true;\n }\n }\n }\n }\n );\n }\n }\n\n /**\n * @internal\n */\n private _removeSubscriptions() {\n if (this._subscription && isStore(this.store)) {\n this.store.notifications.unsubscribe(this._subscription);\n this._subscribedTo = null;\n this._subscription = null;\n }\n }\n\n /**\n * Install the event listeners for network and visibility changes.\n * This is only done in browser environments with a global `window`.\n *\n * @internal\n */\n private _installListeners() {\n if (typeof window === 'undefined') {\n return;\n }\n\n this.isOnline = window.navigator.onLine;\n this._unavailableStart = this.isOnline ? null : Date.now();\n this.isHidden = document.visibilityState === 'hidden';\n\n this._onlineChanged = (event: Event) => {\n this.isOnline = event.type === 'online';\n if (event.type === 'offline' && this._unavailableStart === null) {\n this._unavailableStart = Date.now();\n }\n this._maybeUpdate();\n };\n this._backgroundChanged = () => {\n const isHidden = document.visibilityState === 'hidden';\n this.isHidden = isHidden;\n\n if (isHidden && this._unavailableStart === null) {\n this._unavailableStart = Date.now();\n }\n\n this._maybeUpdate();\n };\n\n window.addEventListener('online', this._onlineChanged, { passive: true, capture: true });\n window.addEventListener('offline', this._onlineChanged, { passive: true, capture: true });\n document.addEventListener('visibilitychange', this._backgroundChanged, { passive: true, capture: true });\n }\n\n /**\n * If the network is online and the tab is visible, either reload or refresh the request\n * based on the component's configuration and the requested update mode.\n *\n * Valid modes are:\n *\n * - `'reload'`: Force a reload of the request.\n * - `'refresh'`: Refresh the request in the background.\n * - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.\n * - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.\n *\n * @internal\n */\n private _maybeUpdate(mode?: 'reload' | 'refresh' | 'policy' | '_invalidated', silent?: boolean): void {\n if (this.isIdle) {\n return;\n }\n const canAttempt = Boolean(this.isOnline && !this.isHidden && (mode || this.autorefreshTypes.size));\n\n if (!canAttempt) {\n if (!silent && mode && mode !== '_invalidated') {\n throw new Error(`Reload not available: the network is not online or the tab is hidden`);\n }\n\n return;\n }\n\n const { autorefreshTypes } = this;\n let shouldAttempt = this._invalidated || Boolean(mode);\n\n if (!shouldAttempt && autorefreshTypes.has('online')) {\n const { _unavailableStart } = this;\n const { autorefreshThreshold } = this._args;\n const deadline = typeof autorefreshThreshold === 'number' ? autorefreshThreshold : DEFAULT_DEADLINE;\n shouldAttempt = Boolean(_unavailableStart && Date.now() - _unavailableStart > deadline);\n }\n\n if (!shouldAttempt && autorefreshTypes.has('interval')) {\n const { _intervalStart } = this;\n const { autorefreshThreshold } = this._args;\n\n if (_intervalStart && typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0) {\n shouldAttempt = Boolean(Date.now() - _intervalStart >= autorefreshThreshold);\n }\n }\n\n this._unavailableStart = null;\n this._invalidated = false;\n\n if (shouldAttempt) {\n this._clearInterval();\n const request = Object.assign({}, this.reqState.request as unknown as RequestInfo<RT, T>);\n const realMode = mode === '_invalidated' ? null : mode;\n const val = realMode ?? this._args.autorefreshBehavior ?? 'policy';\n switch (val) {\n case 'reload':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { reload: true });\n break;\n case 'refresh':\n request.cacheOptions = Object.assign({}, request.cacheOptions, { backgroundReload: true });\n break;\n case 'policy':\n break;\n default:\n throw new Error(\n `Invalid ${mode ? 'update mode' : '@autorefreshBehavior'} for <Request />: ${isNeverString(val)}`\n );\n }\n\n const wasStoreRequest = request[EnableHydration] === true;\n assert(\n `Cannot supply a different store than was used to create the request`,\n !request.store || request.store === this.store\n );\n\n const store = (request.store as Store | undefined) || this.store;\n const requester = wasStoreRequest && 'requestManager' in store ? store.requestManager : store;\n\n this._isUpdating = true;\n this._latestRequest = requester.request(request);\n\n if (val !== 'refresh') {\n this._localRequest = this._latestRequest;\n }\n\n void this._scheduleInterval();\n void this._latestRequest.finally(() => {\n this._isUpdating = false;\n });\n } else {\n // TODO probably want this\n // void this.scheduleInterval();\n }\n }\n\n /**\n * Retry the request, reloading it from the server.\n */\n retry = async () => {\n this._maybeUpdate('reload');\n await this._localRequest;\n };\n\n /**\n * Refresh the request, updating it in the background.\n */\n refresh = async () => {\n this._maybeUpdate('refresh');\n await this._latestRequest;\n };\n\n /**\n * features to yield to the error slot of a component\n */\n @memoized\n get errorFeatures() {\n return {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n retry: this.retry,\n };\n }\n\n /**\n * features to yield to the content slot of a component\n */\n @memoized\n get contentFeatures() {\n const feat: ContentFeatures<RT> = {\n isHidden: this.isHidden,\n isOnline: this.isOnline,\n reload: this.retry,\n refresh: this.refresh,\n isRefreshing: this.isRefreshing,\n latestRequest: this._latestRequest,\n };\n\n if (feat.isRefreshing) {\n feat.abort = () => {\n this._latestRequest?.abort();\n };\n }\n\n return feat;\n }\n\n /**\n * The method to call when the component this subscription is attached to\n * unmounts.\n */\n [DISPOSE]() {\n this.isDestroyed = true;\n this._removeSubscriptions();\n\n if (typeof window === 'undefined') {\n return;\n }\n\n this._clearInterval();\n\n window.removeEventListener('online', this._onlineChanged, { passive: true, capture: true } as unknown as boolean);\n window.removeEventListener('offline', this._onlineChanged, { passive: true, capture: true } as unknown as boolean);\n document.removeEventListener('visibilitychange', this._backgroundChanged, {\n passive: true,\n capture: true,\n } as unknown as boolean);\n }\n\n /**\n * @internal\n */\n @memoized\n get _request(): Future<RT> {\n const { request, query } = this._args;\n assert(`Cannot use both @request and @query args with the <Request> component`, !request || !query);\n const { _localRequest, _originalRequest, _originalQuery } = this;\n const isOriginalRequest = request === _originalRequest && query === _originalQuery;\n\n if (_localRequest && isOriginalRequest) {\n return _localRequest;\n }\n\n // update state checks for the next time\n this._originalQuery = query;\n this._originalRequest = request;\n\n if (request) {\n return request;\n }\n assert(`You must provide either @request or an @query arg with the <Request> component`, query);\n // @ts-expect-error TODO investigate this\n return this.store.request(query);\n }\n\n @memoized\n get request(): Future<RT> {\n if (DEBUG) {\n try {\n const request = this._request;\n this._updateSubscriptions();\n return request;\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n throw new Error(`Unable to initialize the request`, { cause: e });\n }\n } else {\n const request = this._request;\n this._updateSubscriptions();\n return request;\n }\n }\n\n get reqState() {\n return getRequestState<RT, T, E>(this.request);\n }\n\n get result() {\n return this.reqState.result as RT;\n }\n}\n\ndefineSignal(RequestSubscription.prototype, 'isOnline', true);\ndefineSignal(RequestSubscription.prototype, 'isHidden', false);\ndefineSignal(RequestSubscription.prototype, 'isRefreshing', false);\ndefineSignal(RequestSubscription.prototype, '_localRequest', undefined);\ndefineSignal(RequestSubscription.prototype, '_latestRequest', undefined);\n\nfunction isStore(store: Store | RequestManager): store is Store {\n return 'requestManager' in store;\n}\n\nexport function createRequestSubscription<RT, T, E>(store: Store | RequestManager, args: SubscriptionArgs<RT, T, E>) {\n return new RequestSubscription(store, args);\n}\n","import type { Awaitable, Future } from '../../../request.ts';\nimport { getPromiseResult, setPromiseResult } from '../../../request.ts';\nimport type {\n ImmutableRequestInfo,\n ResponseInfo,\n StructuredDataDocument,\n StructuredErrorDocument,\n} from '../../../types/request.ts';\nimport type { PendingPromise, RejectedPromise, ResolvedPromise } from './promise-state.ts';\nimport { defineNonEnumerableSignal, defineSignal } from './reactivity/signal.ts';\n\nconst RequestCache = new WeakMap<Future<unknown>, RequestCacheRequestState>();\n\nfunction isAbortError(error: unknown): boolean {\n return error instanceof DOMException && error.name === 'AbortError';\n}\n\nasync function watchStream(stream: ReadableStream<Uint8Array>, state: RequestLoadingState): Promise<void> {\n const reader = stream.getReader();\n let bytesLoaded = 0;\n let shouldForward = state._stream !== null && state._stream.readable.locked;\n let isForwarding = shouldForward;\n let writer = state._stream?.writable.getWriter();\n const buffer = [];\n\n state._isPending = false;\n state._isStarted = true;\n state._startTime = performance.now();\n\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n break;\n }\n bytesLoaded += value.byteLength;\n state._bytesLoaded = bytesLoaded;\n state._lastPacketTime = performance.now();\n\n shouldForward = shouldForward || (state._stream !== null && state._stream.readable.locked);\n\n if (shouldForward) {\n if (!isForwarding) {\n isForwarding = true;\n writer = state._stream!.writable.getWriter();\n for (const item of buffer) {\n await writer.ready;\n await writer.write(item);\n }\n buffer.length = 0;\n }\n await writer!.ready;\n await writer!.write(value);\n } else {\n buffer.push(value);\n }\n }\n\n // if we are still forwarding, we need to close the writer\n if (isForwarding) {\n await writer!.ready;\n await writer!.close();\n } else if (state._stream) {\n // if we are not forwarding, we need to cancel the stream\n await state._stream.readable.cancel('The Stream Has Already Ended');\n state._stream = null;\n }\n\n const endTime = performance.now();\n state._endTime = endTime;\n state._isComplete = true;\n state._isStarted = false;\n}\n\n/**\n * Lazily consumes the stream of a request, providing a number of\n * reactive properties that can be used to build UIs that respond\n * to the progress of a request.\n *\n */\nexport class RequestLoadingState {\n declare _sizeHint: number;\n declare _bytesLoaded: number;\n declare _startTime: number;\n declare _endTime: number;\n declare _lastPacketTime: number;\n declare _isPending: boolean;\n declare _isStarted: boolean;\n declare _isComplete: boolean;\n declare _isCancelled: boolean;\n declare _isErrored: boolean;\n declare _error: Error | null;\n\n _stream: TransformStream | null = null;\n _future: Future<unknown>;\n _triggered = false;\n _trigger() {\n if (this._triggered) {\n return;\n }\n this._triggered = true;\n const future = this._future;\n const promise: Promise<ReadableStream<Uint8Array> | null> & { sizeHint?: number } = future.getStream();\n if (promise.sizeHint) {\n this._sizeHint = promise.sizeHint;\n }\n this.promise = promise.then(\n (stream) => {\n if (!stream) {\n this._isPending = false;\n this._isComplete = true;\n return;\n }\n return watchStream(stream, this);\n },\n (error: Error) => {\n this._isPending = false;\n this._isStarted = false;\n if (isAbortError(error)) {\n this._isCancelled = true;\n this._isComplete = true;\n }\n this._isErrored = true;\n this._error = error;\n }\n );\n }\n\n promise: Promise<void> | null = null;\n\n get isPending(): boolean {\n this._trigger();\n return this._isPending;\n }\n\n get sizeHint(): number {\n this._trigger();\n return this._sizeHint;\n }\n\n get stream(): ReadableStream | null {\n this._trigger();\n if (!this._stream) {\n if (this._isComplete || this._isCancelled || this._isErrored) {\n return null;\n }\n this._stream = new TransformStream();\n }\n return this._stream.readable;\n }\n\n get isStarted(): boolean {\n this._trigger();\n return this._isStarted;\n }\n\n get bytesLoaded(): number {\n this._trigger();\n return this._bytesLoaded;\n }\n\n get startTime(): number {\n this._trigger();\n return this._startTime;\n }\n\n get endTime(): number {\n this._trigger();\n return this._endTime;\n }\n\n get lastPacketTime(): number {\n this._trigger();\n return this._lastPacketTime;\n }\n\n get isComplete(): boolean {\n this._trigger();\n return this._isComplete;\n }\n\n get isCancelled(): boolean {\n this._trigger();\n return this._isCancelled;\n }\n\n get isErrored(): boolean {\n this._trigger();\n return this._isErrored;\n }\n\n get error(): Error | null {\n this._trigger();\n return this._error;\n }\n\n get elapsedTime(): number {\n return (this.endTime || this.lastPacketTime) - this.startTime;\n }\n\n get completedRatio(): number {\n return this.sizeHint ? this.bytesLoaded / this.sizeHint : 0;\n }\n\n get remainingRatio(): number {\n return 1 - this.completedRatio;\n }\n\n get duration(): number {\n return this.endTime - this.startTime;\n }\n\n get speed(): number {\n // bytes per second\n return this.bytesLoaded / (this.elapsedTime / 1000);\n }\n\n constructor(future: Future<unknown>) {\n this._future = future;\n }\n\n abort = (): void => {\n this._future.abort();\n };\n}\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_isPending', true);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_isStarted', false);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_isComplete', false);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_isCancelled', false);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_isErrored', false);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_error', null);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_sizeHint', 0);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_bytesLoaded', 0);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_startTime', 0);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_endTime', 0);\ndefineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);\n\n/**\n * The state of a request in the \"pending\"\n * state. This is the default initial state.\n *\n * Extends the {@link PendingPromise} interface.\n *\n */\nexport interface PendingRequest extends PendingPromise {\n /**\n * Whether the request is cancelled.\n *\n */\n isCancelled: false;\n\n loadingState: RequestLoadingState;\n request: null;\n response: null;\n}\n/**\n * The state of a request in the \"fulfilled\" state.\n * This is the state of a request that has resolved\n * successfully.\n *\n * Extends the {@link ResolvedPromise} interface.\n *\n */\nexport interface ResolvedRequest<RT, T> extends ResolvedPromise<RT> {\n /**\n * Whether the request is cancelled.\n *\n */\n isCancelled: false;\n\n loadingState: RequestLoadingState;\n request: ImmutableRequestInfo<RT, T> | null;\n response: Response | ResponseInfo | null;\n}\n/**\n * The state of a request in the \"rejected\" state.\n * This is the state of a request that has rejected\n * with an error.\n *\n * Extends the {@link RejectedPromise} interface.\n *\n */\nexport interface RejectedRequest<RT, T, E extends StructuredErrorDocument = StructuredErrorDocument>\n extends RejectedPromise<E> {\n /**\n * Whether the request is cancelled.\n *\n */\n isCancelled: false;\n\n loadingState: RequestLoadingState;\n request: ImmutableRequestInfo<RT, T> | null;\n response: Response | ResponseInfo | null;\n}\n/**\n * The state of a request in the \"cancelled\" state.\n * This is the state of a promise that has been\n * cancelled.\n *\n */\nexport interface CancelledRequest<RT, T, E extends StructuredErrorDocument = StructuredErrorDocument> {\n /**\n * The status of the request.\n *\n */\n status: 'cancelled';\n\n /**\n * Whether the request is pending.\n *\n */\n isPending: false;\n\n /**\n * Whether the request is pending.\n *\n */\n isLoading: false;\n\n /**\n * Whether the request has resolved\n * successfully.\n *\n */\n isSuccess: false;\n\n /**\n * Whether the request has rejected\n * with an error.\n *\n */\n isError: true;\n\n /**\n * Once the request has resolved, this will\n * be the value the request resolved to.\n *\n */\n value: null;\n /**\n * Once the request has resolved, this will\n * be the value the request resolved to.\n *\n * @deprecated use `value` instead\n */\n result: null;\n\n /**\n * Once the request has rejected, this will\n * be the error the request rejected with.\n *\n *\n * @deprecated use `reason` instead\n */\n error: E;\n\n /**\n * Once the request has rejected, this will\n * be the error the request rejected with.\n *\n */\n reason: E;\n\n /**\n * Whether the request is cancelled.\n *\n */\n isCancelled: true;\n\n loadingState: RequestLoadingState;\n request: ImmutableRequestInfo<RT, T> | null;\n response: Response | ResponseInfo | null;\n}\n\ninterface PrivateRequestState {\n _loadingState?: RequestLoadingState;\n _request: Future<unknown>;\n}\n\n/**\n * RequestState extends the concept of PromiseState to provide a reactive\n * wrapper for a request `Future` which allows you write declarative code\n * around a Future's control flow.\n *\n * It is useful in both Template and JavaScript contexts, allowing you\n * to quickly derive behaviors and data from pending, error and success\n * states.\n *\n * The key difference between a Promise and a Future is that Futures provide\n * access to a stream of their content, the identity of the request (if any)\n * as well as the ability to attempt to abort the request.\n *\n * ```ts\n * interface Future<T> extends Promise<T>> {\n * getStream(): Promise<ReadableStream>;\n * abort(): void;\n * lid: StableDocumentIdentifier | null;\n * }\n * ```\n *\n * These additional APIs allow us to craft even richer state experiences.\n *\n * To get the state of a request, use `getRequestState`.\n *\n * See also:\n * - {@link PendingRequest}\n * - {@link ResolvedRequest}\n * - {@link RejectedRequest}\n * - {@link CancelledRequest}\n *\n */\nexport type RequestCacheRequestState<\n RT = unknown,\n T = unknown,\n E extends StructuredErrorDocument = StructuredErrorDocument,\n> = PendingRequest | ResolvedRequest<RT, T> | RejectedRequest<RT, T, E> | CancelledRequest<RT, T, E>;\n\nconst RequestStateProto = {};\n\n// TODO introduce a new mechanism for defining multiple properties\n// that share a common signal\ndefineSignal(RequestStateProto, 'reason', null);\ndefineSignal(RequestStateProto, 'value', null);\ndefineSignal(RequestStateProto, 'result', null);\ndefineSignal(RequestStateProto, 'error', null);\ndefineSignal(RequestStateProto, 'status', 'pending');\ndefineSignal(RequestStateProto, 'isPending', true);\ndefineSignal(RequestStateProto, 'isLoading', true);\ndefineSignal(RequestStateProto, 'isSuccess', false);\ndefineSignal(RequestStateProto, 'isError', false);\ndefineSignal(RequestStateProto, 'request', null);\ndefineSignal(RequestStateProto, 'response', null);\n\nObject.defineProperty(RequestStateProto, 'isCancelled', {\n get(this: RequestCacheRequestState): boolean {\n return this.isError && isAbortError(this.reason);\n },\n});\nObject.defineProperty(RequestStateProto, 'loadingState', {\n get(this: RequestCacheRequestState & PrivateRequestState): RequestLoadingState {\n if (!this._loadingState) {\n this._loadingState = new RequestLoadingState(this._request);\n }\n\n return this._loadingState;\n },\n});\n\nexport function createRequestState<RT, T, E>(\n future: Future<RT>\n): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>> {\n const state = getPromiseResult(\n future as unknown as Awaitable<StructuredDataDocument<RT>, StructuredErrorDocument<E>>\n );\n const promiseState = Object.create(RequestStateProto) as RequestCacheRequestState<RT, T, StructuredErrorDocument<E>> &\n PrivateRequestState;\n promiseState._request = future;\n\n if (state) {\n if (state.isError) {\n promiseState.error = state.result;\n promiseState.reason = state.result;\n promiseState.status = 'rejected';\n promiseState.isError = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n promiseState.request = state.result.request as ImmutableRequestInfo<RT, T>;\n promiseState.response = state.result.response;\n } else {\n promiseState.result = state.result.content;\n promiseState.value = state.result.content;\n promiseState.status = 'fulfilled';\n promiseState.isSuccess = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n promiseState.request = state.result.request as ImmutableRequestInfo<RT, T>;\n promiseState.response = state.result.response;\n }\n } else {\n void future.then(\n (result) => {\n setPromiseResult(future, { isError: false, result });\n promiseState.result = result.content;\n promiseState.value = result.content;\n promiseState.status = 'fulfilled';\n promiseState.isSuccess = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n promiseState.request = result.request as ImmutableRequestInfo<RT, T>;\n promiseState.response = result.response;\n },\n (error: StructuredErrorDocument<E>) => {\n setPromiseResult(future, { isError: true, result: error });\n promiseState.error = error;\n promiseState.reason = error;\n promiseState.status = 'rejected';\n promiseState.isError = true;\n promiseState.isPending = false;\n promiseState.isLoading = false;\n promiseState.request = error.request as ImmutableRequestInfo<RT, T>;\n promiseState.response = error.response;\n }\n );\n }\n\n return promiseState;\n}\n\n/**\n * `getRequestState` can be used in both JavaScript and Template contexts.\n *\n * ```ts\n * import { getRequestState } from '@warp-drive/ember';\n *\n * const state = getRequestState(future);\n * ```\n *\n * For instance, we could write a getter on a component that updates whenever\n * the request state advances or the future changes, by combining the function\n * with the use of `@cached`\n *\n * ```ts\n * class Component {\n * @cached\n * get title() {\n * const state = getRequestState(this.args.request);\n * if (state.isPending) {\n * return 'loading...';\n * }\n * if (state.isError) { return null; }\n * return state.result.title;\n * }\n * }\n * ```\n *\n * Or in a template as a helper:\n *\n * ```gjs\n * import { getRequestState } from '@warp-drive/ember';\n *\n * <template>\n * {{#let (getRequestState @request) as |state|}}\n * {{#if state.isPending}}\n * <Spinner />\n * {{else if state.isError}}\n * <ErrorForm @error={{state.error}} />\n * {{else}}\n * <h1>{{state.result.title}}</h1>\n * {{/if}}\n * {{/let}}\n * </template>\n * ```\n *\n * If looking to use in a template, consider also the `<Request />` component\n * which offers a numbe of additional capabilities for requests *beyond* what\n * `RequestState` provides.\n *\n */\nexport function getRequestState<RT, T, E>(\n future: Future<RT>\n): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>> {\n let state = RequestCache.get(future);\n\n if (!state) {\n state = createRequestState<RT, T, E>(future);\n RequestCache.set(future, state);\n }\n\n return state as Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>>;\n}\n"],"names":["coerceId","id","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_ID","normalized","undefined","String","deprecate","JSON","stringify","until","for","since","available","enabled","env","DEBUG","test","Error","length","ensureStringId","isNaN","normalizeModelName","type","DEPRECATE_NON_STRICT_TYPES","result","dasherize","installPolyfill","isFastBoot","FastBoot","CRYPTO","require","globalThis","crypto","randomUUID","rng","rnds8","Uint8Array","getRandomValues","randomFillSync","byteToHex","i","toString","substr","bytesToUuid","buf","bth","join","uuidv4","rnds","isResource","resource","Boolean","hasProp","prop","hasLid","hasId","hasType","DOCUMENTS","getOrSetGlobal","Set","isStableIdentifier","identifier","CACHE_OWNER","isDocumentIdentifier","has","_crypto","polyfillUUID","freeze","obj","Object","setIdentifierGenerationMethod","method","setTransient","setIdentifierUpdateMethod","setIdentifierForgetMethod","setIdentifierResetMethod","setKeyInfoForResource","NEW_IDENTIFIERS","Map","IDENTIFIER_CACHE_ID","updateTypeIdMapping","typeMap","idMap","get","set","lid","defaultUpdateMethod","data","bucket","defaultKeyInfoMethod","known","defaultGenerationMethod","url","toUpperCase","defaultEmptyCallback","args","defaultMergeMethod","a","_b","_c","DEBUG_MAP","WeakMap","IdentifierCache","constructor","_generate","peekTransient","_update","_forget","_reset","_merge","_keyInfoForResource","_id","_cache","resources","resourcesByType","create","documents","polymorphicLidBackMap","__configureMerge","upgradeIdentifier","_getRecordIdentifier","shouldGenerate","activeLogging","LOG_IDENTIFIERS","debug","getWarpDriveRuntimeConfig","console","groupCollapsed","log","groupEnd","getIdentifierFromLid","makeStableRecordIdentifier","keyInfo","addResourceToCache","peekRecordIdentifier","getOrCreateDocumentIdentifier","request","cacheKey","cacheOptions","key","add","getOrCreateRecordIdentifier","createIdentifierForNewRecord","newLid","updateRecordIdentifier","identifierObject","existingIdentifier","detectMerge","hadLid","generatedIdentifier","_mergeRecordIdentifiers","performRecordIdentifierUpdate","newId","typeSet","delete","kept","abandoned","abandonedBackReferences","forgetRecordIdentifier","keptBackReferences","push","forEach","backReferences","DEBUG_STALE_CACHE_OWNER","destroy","clear","recordIdentifier","clientOriginated","wrapper","proto","value","DEBUG_CLIENT_ORIGINATED","DEBUG_IDENTIFIER_BUCKET","defineProperty","enumerable","setPrototypeOf","updateFn","warn","cache","newType","newTypeSet","Signals","Symbol","withSignalStore","initializeSignalStore","createInternalSignal","signals","initialValue","warpDriveSignal","context","signal","createSignal","isStale","getOrCreateInternalSignal","peekInternalSignal","consumeInternalSignal","consumeSignal","notifyInternalSignal","notifySignal","entangleSignal","createSignalDescriptor","intialValue","configurable","defineSignal","v","defineNonEnumerableSignal","desc","memoized","target","descriptor","arguments","Array","from","map","d","getter","memoSignal","createMemo","bind","gate","_target","setter","call","defineGate","options","assign","urlFromLink","link","href","ReactiveDocument","store","localCache","_store","_localCache","notifications","subscribe","_identifier","#request","withBrand","links","response","content","fetch","related","self","next","prev","first","last","toJSON","errors","meta","prototype","document","doc","peek","isArray","recordArrayManager","getCollection","identifiers","slice","peekRecord","TEXT_COLORS","TEXT","notify","graph","BG_COLORS","NOTIFY_BORDER","LIGHT_DARK_ALT","lightgreen","green","badge","isLight","color","bgColor","border","correctColor","colorForBucket","scope","logGroup","prefix","subScop1","subScop2","subScop3","subScop4","_log","isLightMode","window","matchMedia","matches","scopePath","path","RecordReference","___token","___identifier","_","notifiedKey","_ref","unsubscribe","remoteType","objectOrPromise","Promise","resolve","then","load","findRecord","reload","CacheCapabilitiesManager","_willNotify","_pendingNotifies","identifierCache","_scheduleNotification","pending","_cbs","_schedule","_flushNotifications","notifyChange","namespace","schema","setRecordId","_instanceCache","hasRecord","disconnectRecord","disconnect","ENABLE_LEGACY_SCHEMA_SERVICE","getSchemaDefinitionService","CacheForIdentifierCache","setCacheFor","removeRecordDataFor","peekCache","instance","isDestroyable","record","RecordCache","recordIdentifierFor","setRecordIdentifier","StoreMap","storeFor","InstanceCache","__instances","reference","_storeWrapper","matchedIdentifier","resourceData","keptIdentifier","staleIdentifier","keptHasRecord","staleHasRecord","patch","op","unloadRecord","getDocument","getRecord","properties","isDestroying","isDestroyed","instantiateRecord","LOG_INSTANCE_CACHE","getReference","recordIsLoaded","filterDeleted","isNew","isEmpty","isDeleted","isDeletionCommitted","_graph","remove","_requestCache","_clearEntries","requests","getRequestStateService","getPendingRequestsForRecord","some","req","_join","teardownRecord","typeCache","oldId","_resourceIsFullDeleted","resourceIsFullyDeleted","instanceCache","preloadData","preload","jsonPayload","schemas","fields","keys","preloadValue","field","kind","relationships","preloadRelationship","attributes","upsert","relatedType","_convertPreloadRelationshipToJSON","_clearCaches","AvailableShims","getShimClass","modelName","shims","shim","ShimModelClass","__store","fieldSchemas","attrs","relationshipsByName","rels","eachAttribute","callback","binding","eachRelationship","eachTransformedAttribute","CacheManager","version","put","mutate","mutation","peekRemoteState","peekRequest","fork","merge","diff","dump","hydrate","stream","clientDidCreate","willCommit","didCommit","commitWasRejected","getAttr","propertyName","getRemoteAttr","setAttr","changedAttrs","hasChangedAttrs","rollbackAttrs","changedRelationships","hasChangedRelationships","rollbackRelationships","getRelationship","getRemoteRelationship","setIsDeleted","getErrors","isCacheOperationValue","count","label","__WarpDriveMetricCountData","asInternalToken","token","_unsubscribe","LOG_NOTIFICATIONS","callbacks","index","indexOf","splice","NotificationManager","_buffered","_hasFlush","includes","hasSubscribers","buffer","LOG_METRIC_COUNTS","_scheduleNotify","_onNextFlush","cb","_onFlushCB","asyncFlush","_enableAsyncFlush","willSyncFlushWatchers","_flush","buffered","size","states","_flushNotification","callbackMap","isExtensionProp","extensions","performObjectExtensionGet","receiver","fn","performExtensionSet","performArrayExtensionGet","_SIGNAL","boundFns","transaction","Reflect","apply","NativeProxy","Proxy","ARRAY_GETTER_METHODS","iterator","ARRAY_SETTER_METHODS","SYNC_PROPS","isArrayGetter","isArraySetter","isSelfProp","SOURCE","MUTATE","IS_COLLECTION","convertToInt","num","Number","safeForEach","arr","MUTABLE_PROPS","IdentifierArray","isLoaded","_updatingPromise","ARRAY_SIGNAL","_manager","manager","PrivateState","CAUTION_MEGA_DANGER_ZONE_arrayExtensions","proxy","_syncArray","allowMutation","outcome","original","newIdentifier","extractIdentifierFromRecord","deleteProperty","getPrototypeOf","update","isUpdating","updatingPromise","finally","findAll","save","promise","all","saveRecord","DEPRECATE_COMPUTED_CHAINS","Collection","query","_recordArray","_managed","_pending","assertRecordPassedToHasMany","FAKE_ARR","SLICE_BATCH_SIZE","fastPush","source","startLength","newLength","RecordArrayManager","_live","_staged","_keyedArrays","_identifiers","_set","_visibilitySet","_subscription","array","dirtyArray","identifierAdded","identifierRemoved","identifierChanged","isRequestArray","isCollection","sync","populateManagedArray","liveArrayFor","staged","config","associate","delta","shouldSyncFromCache","_getPendingFor","includeManaged","isRemove","liveArray","allPending","managed","changes","pendingLive","payload","old","disassociate","changeSets","existing","newState","isClear","ArraysCache","disassociateIdentifier","arraySet","state","adds","removes","Touching","RequestPromise","EMPTY_ARR","hasRecordIdentifier","RequestStateService","_done","_subscriptions","_toFlush","_enqueue","queryRequest","_triggerSubscriptions","_dequeue","finalizedRequest","_addDone","error","_flushRequest","subscriptions","filter","requestDataOp","subscribeForRecord","getLastRequestForRecord","isNonEmptyString","str","constructResource","trueId","setWarpDriveLogging","setLogging","getRuntimeConfig","getWarpDriveMetricCounts","structuredClone","resetWarpDriveMetricCounts","__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS","__primitiveInstanceId","interceptAndLog","klassName","methodName","klass","instantiationLabel","instanceId","instanceName","stack","split","logName","instanceLogName","EmptyClass","_BaseClass","dependencySatisfies","DEPRECATE_STORE_EXTENDS_EMBER_OBJECT","importSync","BaseClass","default","Store","_schema","createSchemaService","_isDestroying","_isDestroyed","createArgs","_run","coalesce","name","_getAllPending","TESTING","requestManager","allSettled","requestConfig","opts","EnableHydration","records","r","DISABLE_WAITER","disableTestWaiter","LOG_REQUESTS","parse","future","onFinalize","modelFor","assertDestroyedStoreOnly","hasResource","createRecord","inputProperties","assertDestroyingStore","normalizedModelName","adapter","adapterFor","generateIdForRecord","createOptions","normalizeProperties","resultProps","deleteRecord","isMaybeIdentifier","normalizedId","SkipCache","resourceIdentifier","stableIdentifier","queryRecord","peekAll","unloadAll","pushed","_push","jsonApiDoc","ret","reject","operation","createCache","registerSchemaDefinitionService","registerSchema","maybeIdentifier","defs","assertRecordsPassedToHasMany","extractIdentifiersFromRecords","every","recordOrPromiseRecord","extract","RelatedCollection","isAsync","isPolymorphic","mutateReplaceRelatedRecords","prior","mutateReplaceRelatedRecord","newValues","assertNoDuplicates","currentState","DEPRECATE_MANY_ARRAY_DUPLICATES","seen","unique","item","newArgs","mutateAddToRelatedRecords","mutateRemoveFromRelatedRecords","unshift","mutateSortRelatedRecords","start","deleteCount","current","concat","reloadHasMany","hash","_inverseIsAsync","DEPRECATED_CLASS_NAME","collection","reason","duplicates","currentValue","currentIndex","sort","b","localeCompare","operationInfo","PromiseCache","PromiseStateProto","createPromiseState","getPromiseResult","promiseState","isError","status","isPending","isLoading","isSuccess","setPromiseResult","LegacyPromiseProxy","isLegacyAwaitable","getPromise","getPromiseState","_promise","decorateMethodV2","decorators","origDesc","getOwnPropertyDescriptor","decorator","initializer","DEFAULT_DEADLINE","DISPOSE","dispose","isNeverString","val","RequestSubscription","_args","_subscribedTo","_intervalStart","_invalidated","_nextInterval","_installListeners","_beginPolling","isIdle","_scheduleInterval","n","autorefreshTypes","autorefresh","types","autorefreshThreshold","hasValidThreshold","_latestRequest","Date","now","setTimeout","_maybeUpdate","_clearInterval","clearTimeout","_updateSubscriptions","requestId","_request","_removeSubscriptions","isStore","_isUpdating","latest","_deduped","priority","reqState","isRefreshing","blocking","isOnline","navigator","onLine","_unavailableStart","isHidden","visibilityState","_onlineChanged","event","_backgroundChanged","addEventListener","passive","capture","mode","silent","canAttempt","shouldAttempt","deadline","realMode","autorefreshBehavior","backgroundReload","wasStoreRequest","requester","_localRequest","retry","refresh","errorFeatures","contentFeatures","feat","latestRequest","abort","removeEventListener","_originalRequest","_originalQuery","isOriginalRequest","e","cause","getRequestState","createRequestSubscription","RequestCache","isAbortError","DOMException","watchStream","reader","getReader","bytesLoaded","shouldForward","_stream","readable","locked","isForwarding","writer","writable","getWriter","_isPending","_isStarted","_startTime","performance","done","read","byteLength","_bytesLoaded","_lastPacketTime","ready","write","close","cancel","endTime","_endTime","_isComplete","RequestLoadingState","_future","_triggered","_trigger","getStream","sizeHint","_sizeHint","_isCancelled","_isErrored","_error","TransformStream","isStarted","startTime","lastPacketTime","isComplete","isCancelled","isErrored","elapsedTime","completedRatio","remainingRatio","duration","speed","RequestStateProto","_loadingState","createRequestState"],"mappings":";;;;;;;;;;AAaO,SAASA,QAAQA,CAACC,EAAW,EAAiB;EACnD,IAAAC,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,uBAAA,CAA6B,EAAA;AAC3B,IAAA,IAAIC,UAAyB;IAC7B,IAAIN,EAAE,KAAK,IAAI,IAAIA,EAAE,KAAKO,SAAS,IAAIP,EAAE,KAAK,EAAE,EAAE;AAChDM,MAAAA,UAAU,GAAG,IAAI;AACnB,KAAC,MAAM;AACLA,MAAAA,UAAU,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WAAoB,KAAK;MAC7E,IAAIhN,MAAM,KAAK,UAAU,IAAKA,MAAM,KAAK,YAAY,IAAIgN,WAAW,KAAK,IAAK,EAAE;QAC9E,IAAI,CAACC,IAAI,EAAE;AACb;AACF,KACF,CAAC;AACH;AAEArI,EAAAA,OAAOA,GAAG;IACR,IAAI,CAACkE,KAAK,CAACI,aAAa,CAACgE,WAAW,CAAC,IAAI,CAACL,QAAQ,CAAC;AACrD;EAEA,IAAI/Q,IAAIA,GAAW;AACjB,IAAA,OAAO,IAAI,CAACuC,UAAU,EAAE,CAACvC,IAAI;AAC/B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMEzB,EAAAA,EAAEA,GAAG;AACH;IACA,IAAI,CAAC4S,IAAI,CAAC;AACV,IAAA,OAAO,IAAI,CAACH,aAAa,CAACzS,EAAE;AAC9B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMEgE,EAAAA,UAAUA,GAA2B;IACnC,OAAO,IAAI,CAACyO,aAAa;AAC3B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEK,EAAAA,UAAUA,GAAe;AACvB,IAAA,OAAO,UAAU;AACnB;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAOE3I,IAAIA,CAAC4I,eAAyE,EAAiC;AAC7G;IACA,OAAOC,OAAO,CAACC,OAAO,CAACF,eAAe,CAAC,CAACG,IAAI,CAAExN,IAAI,IAAK;AACrD,MAAA,OAAO,IAAI,CAAC+I,KAAK,CAACtE,IAAI,CAACzE,IAAI,CAAC;AAC9B,KAAC,CAAC;AACJ;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AACA;AACA;AACA;AACA;AACO,MAAMuY,YAAY,CAAkB;AACzCC,EAAAA,OAAO,GAAG,GAAG;AAEb,EAAA,MAAM;EAENvT,WAAWA,CAAC2E,KAAY,EAAE;AACxB,IAAA,IAAI,CAAC,MAAM,GAAGA,KAAK;AACrB;;AAEA;AACA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE6O,GAAGA,CAAIjK,GAA2C,EAAoB;IACpE,OAAO,IAAI,CAAC,MAAM,CAACiK,GAAG,CAACjK,GAAG,CAAC;AAC7B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE8F,KAAKA,CAACC,EAAkB,EAAQ;AAC9B,IAAA,IAAI,CAAC,MAAM,CAACD,KAAK,CAACC,EAAE,CAAC;AACvB;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEmE,MAAMA,CAACC,QAAoC,EAAQ;AACjD,IAAA,IAAI,CAAC,MAAM,CAACD,MAAM,CAACC,QAAQ,CAAC;AAC9B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGElK,IAAIA,CAAClM,UAA6D,EAAW;IAC3E,OAAO,IAAI,CAAC,MAAM,CAACkM,IAAI,CAAClM,UAAU,CAAC;AACrC;EAIAqW,eAAeA,CAACrW,UAA6D,EAAW;IACtF,OAAO,IAAI,CAAC,MAAM,CAACqW,eAAe,CAACrW,UAAU,CAAC;AAChD;AACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEsW,WAAWA,CAACtW,UAAoC,EAA+C;IAC7F,OAAO,IAAI,CAAC,MAAM,CAACsW,WAAW,CAACtW,UAAU,CAAC;AAC5C;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE4U,EAAAA,MAAMA,CAAC5U,UAAkC,EAAE0B,IAAa,EAAE0O,SAAkB,EAAmB;AAC7F,IAAA,OAAO,IAAI,CAAC,MAAM,CAACwE,MAAM,CAAC5U,UAAU,EAAE0B,IAAI,EAAE0O,SAAS,CAAC;AACxD;;AAEA;AACA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEmG,EAAAA,IAAIA,GAAmB;AACrB,IAAA,OAAO,IAAI,CAAC,MAAM,CAACA,IAAI,EAAE;AAC3B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,KAAKA,CAACnP,KAAY,EAAiB;IACjC,OAAO,IAAI,CAAC,MAAM,CAACmP,KAAK,CAACnP,KAAK,CAAC;AACjC;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEoP,EAAAA,IAAIA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAAC,MAAM,CAACA,IAAI,EAAE;AAC3B;;AAEA;AACA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,IAAIA,GAAqC;AACvC,IAAA,OAAO,IAAI,CAAC,MAAM,CAACA,IAAI,EAAE;AAC3B;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,MAA+B,EAAiB;IACtD,OAAO,IAAI,CAAC,MAAM,CAACD,OAAO,CAACC,MAAM,CAAC;AACpC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,eAAeA,CAAC7W,UAAkC,EAAEmK,OAAiC,EAA2B;IAC9G,OAAO,IAAI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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiFEoP,EAAAA,UAAUA,CACR/P,QAA2C,EAC3CrD,EAAwC,EACxCmO,OAA2B,EACT;IAClB,IAAAlO,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAc,GAAA,CAAAC,KAAA,CAAW,EAAA;AACT8oB,MAAAA,qBAA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+DAAA,CAAA,CAAA;AAAA;AAAA,KAAA,EAAEqgB,KAAK,CAAA,GAAA,EAAA;IAC/ExhB,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAc,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;AAAA,QAAA,MAAA,IAAAC,KAAA,CACE,CAAiGK,8FAAAA,EAAAA,IAAI,CAAE,CAAA,CAAA;AAAA;KACvG,EAAA,OAAOA,IAAI,KAAK,QAAQ,CAAA,GAAA,EAAA;AAG1B,IAAA,MAAM2f,OAAO,GAAG,IAAI,CAACzY,OAAO,CAA8B;AACxDqN,MAAAA,EAAE,EAAE,aAAa;AACjBtQ,MAAAA,IAAI,EAAE;AACJjE,QAAAA,IAAI,EAAED,kBAAkB,CAACC,IAAI,CAAC;QAC9BggB,KAAK;QACLtT,OAAO,EAAEA,OAAO,IAAI;OACrB;AACDtF,MAAAA,YAAY,EAAE;AAAE,QAAA,CAAC8hB,SAAS,GAAG;AAAK;AACpC,KAAC,CAAC;IAEF,OAAOvJ,OAAO,CAAClO,IAAI,CAAElD,QAAQ,IAAKA,QAAQ,CAACZ,OAAO,CAAC;AACrD;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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