@warp-drive/core 5.6.0-alpha.11
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/CHANGELOG.md +1 -0
- package/LICENSE.md +23 -0
- package/README.md +70 -0
- package/addon-main.cjs +5 -0
- package/cjs-dist/addon-shim.cjs +1 -0
- package/cjs-dist/cjs-set-config.cjs +1 -0
- package/declarations/build-config/babel-macros.d.ts +2 -0
- package/declarations/build-config/babel-macros.d.ts.map +1 -0
- package/declarations/build-config/canary-features.d.ts +2 -0
- package/declarations/build-config/canary-features.d.ts.map +1 -0
- package/declarations/build-config/debugging.d.ts +2 -0
- package/declarations/build-config/debugging.d.ts.map +1 -0
- package/declarations/build-config/deprecations.d.ts +2 -0
- package/declarations/build-config/deprecations.d.ts.map +1 -0
- package/declarations/build-config/env.d.ts +2 -0
- package/declarations/build-config/env.d.ts.map +1 -0
- package/declarations/build-config/macros.d.ts +2 -0
- package/declarations/build-config/macros.d.ts.map +1 -0
- package/declarations/build-config.d.ts +2 -0
- package/declarations/build-config.d.ts.map +1 -0
- package/declarations/configure.d.ts +8 -0
- package/declarations/configure.d.ts.map +1 -0
- package/declarations/graph/-private/-diff.d.ts +33 -0
- package/declarations/graph/-private/-diff.d.ts.map +1 -0
- package/declarations/graph/-private/-edge-definition.d.ts +149 -0
- package/declarations/graph/-private/-edge-definition.d.ts.map +1 -0
- package/declarations/graph/-private/-state.d.ts +10 -0
- package/declarations/graph/-private/-state.d.ts.map +1 -0
- package/declarations/graph/-private/-utils.d.ts +26 -0
- package/declarations/graph/-private/-utils.d.ts.map +1 -0
- package/declarations/graph/-private/coerce-id.d.ts +5 -0
- package/declarations/graph/-private/coerce-id.d.ts.map +1 -0
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +7 -0
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
- package/declarations/graph/-private/edges/collection.d.ts +40 -0
- package/declarations/graph/-private/edges/collection.d.ts.map +1 -0
- package/declarations/graph/-private/edges/implicit.d.ts +14 -0
- package/declarations/graph/-private/edges/implicit.d.ts.map +1 -0
- package/declarations/graph/-private/edges/resource.d.ts +25 -0
- package/declarations/graph/-private/edges/resource.d.ts.map +1 -0
- package/declarations/graph/-private/graph.d.ts +55 -0
- package/declarations/graph/-private/graph.d.ts.map +1 -0
- package/declarations/graph/-private/normalize-link.d.ts +3 -0
- package/declarations/graph/-private/normalize-link.d.ts.map +1 -0
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +5 -0
- package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +1 -0
- package/declarations/graph/-private/operations/merge-identifier.d.ts +4 -0
- package/declarations/graph/-private/operations/merge-identifier.d.ts.map +1 -0
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +5 -0
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +1 -0
- package/declarations/graph/-private/operations/replace-related-record.d.ts +4 -0
- package/declarations/graph/-private/operations/replace-related-record.d.ts.map +1 -0
- package/declarations/graph/-private/operations/replace-related-records.d.ts +8 -0
- package/declarations/graph/-private/operations/replace-related-records.d.ts.map +1 -0
- package/declarations/graph/-private/operations/update-relationship.d.ts +11 -0
- package/declarations/graph/-private/operations/update-relationship.d.ts.map +1 -0
- package/declarations/graph/-private.d.ts +14 -0
- package/declarations/graph/-private.d.ts.map +1 -0
- package/declarations/index.d.ts +15 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/reactive/-private/document.d.ts +147 -0
- package/declarations/reactive/-private/document.d.ts.map +1 -0
- package/declarations/reactive/-private/fields/compute.d.ts +40 -0
- package/declarations/reactive/-private/fields/compute.d.ts.map +1 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +23 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts.map +1 -0
- package/declarations/reactive/-private/fields/managed-object.d.ts +21 -0
- package/declarations/reactive/-private/fields/managed-object.d.ts.map +1 -0
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +20 -0
- package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +1 -0
- package/declarations/reactive/-private/hooks.d.ts +6 -0
- package/declarations/reactive/-private/hooks.d.ts.map +1 -0
- package/declarations/reactive/-private/record.d.ts +61 -0
- package/declarations/reactive/-private/record.d.ts.map +1 -0
- package/declarations/reactive/-private/schema.d.ts +180 -0
- package/declarations/reactive/-private/schema.d.ts.map +1 -0
- package/declarations/reactive/-private/symbols.d.ts +11 -0
- package/declarations/reactive/-private/symbols.d.ts.map +1 -0
- package/declarations/reactive/-private.d.ts +2 -0
- package/declarations/reactive/-private.d.ts.map +1 -0
- package/declarations/reactive.d.ts +5 -0
- package/declarations/reactive.d.ts.map +1 -0
- package/declarations/request/-private/context.d.ts +42 -0
- package/declarations/request/-private/context.d.ts.map +1 -0
- package/declarations/request/-private/debug.d.ts +5 -0
- package/declarations/request/-private/debug.d.ts.map +1 -0
- package/declarations/request/-private/fetch.d.ts +40 -0
- package/declarations/request/-private/fetch.d.ts.map +1 -0
- package/declarations/request/-private/future.d.ts +8 -0
- package/declarations/request/-private/future.d.ts.map +1 -0
- package/declarations/request/-private/manager.d.ts +160 -0
- package/declarations/request/-private/manager.d.ts.map +1 -0
- package/declarations/request/-private/promise-cache.d.ts +20 -0
- package/declarations/request/-private/promise-cache.d.ts.map +1 -0
- package/declarations/request/-private/types.d.ts +236 -0
- package/declarations/request/-private/types.d.ts.map +1 -0
- package/declarations/request/-private/utils.d.ts +16 -0
- package/declarations/request/-private/utils.d.ts.map +1 -0
- package/declarations/request.d.ts +6 -0
- package/declarations/request.d.ts.map +1 -0
- package/declarations/store/-private/cache-handler/handler.d.ts +57 -0
- package/declarations/store/-private/cache-handler/handler.d.ts.map +1 -0
- package/declarations/store/-private/cache-handler/types.d.ts +99 -0
- package/declarations/store/-private/cache-handler/types.d.ts.map +1 -0
- package/declarations/store/-private/cache-handler/utils.d.ts +32 -0
- package/declarations/store/-private/cache-handler/utils.d.ts.map +1 -0
- package/declarations/store/-private/caches/cache-utils.d.ts +9 -0
- package/declarations/store/-private/caches/cache-utils.d.ts.map +1 -0
- package/declarations/store/-private/caches/identifier-cache.d.ts +316 -0
- package/declarations/store/-private/caches/identifier-cache.d.ts.map +1 -0
- package/declarations/store/-private/caches/instance-cache.d.ts +65 -0
- package/declarations/store/-private/caches/instance-cache.d.ts.map +1 -0
- package/declarations/store/-private/caches/resource-utils.d.ts +10 -0
- package/declarations/store/-private/caches/resource-utils.d.ts.map +1 -0
- package/declarations/store/-private/debug/utils.d.ts +7 -0
- package/declarations/store/-private/debug/utils.d.ts.map +1 -0
- package/declarations/store/-private/default-cache-policy.d.ts +383 -0
- package/declarations/store/-private/default-cache-policy.d.ts.map +1 -0
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +164 -0
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +1 -0
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +17 -0
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +26 -0
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
- package/declarations/store/-private/managers/cache-manager.d.ts +428 -0
- package/declarations/store/-private/managers/cache-manager.d.ts.map +1 -0
- package/declarations/store/-private/managers/notification-manager.d.ts +93 -0
- package/declarations/store/-private/managers/notification-manager.d.ts.map +1 -0
- package/declarations/store/-private/managers/record-array-manager.d.ts +98 -0
- package/declarations/store/-private/managers/record-array-manager.d.ts.map +1 -0
- package/declarations/store/-private/network/request-cache.d.ts +104 -0
- package/declarations/store/-private/network/request-cache.d.ts.map +1 -0
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +255 -0
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +1 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +93 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -0
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +170 -0
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +1 -0
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +30 -0
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +1 -0
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +255 -0
- package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +1 -0
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +141 -0
- package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +1 -0
- package/declarations/store/-private/record-arrays/many-array.d.ts +199 -0
- package/declarations/store/-private/record-arrays/many-array.d.ts.map +1 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +116 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
- package/declarations/store/-private/store-service.d.ts +1597 -0
- package/declarations/store/-private/store-service.d.ts.map +1 -0
- package/declarations/store/-private/store-service.type-test.d.ts +2 -0
- package/declarations/store/-private/store-service.type-test.d.ts.map +1 -0
- package/declarations/store/-private/utils/coerce-id.d.ts +5 -0
- package/declarations/store/-private/utils/coerce-id.d.ts.map +1 -0
- package/declarations/store/-private/utils/construct-resource.d.ts +7 -0
- package/declarations/store/-private/utils/construct-resource.d.ts.map +1 -0
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +2 -0
- package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +1 -0
- package/declarations/store/-private/utils/normalize-model-name.d.ts +2 -0
- package/declarations/store/-private/utils/normalize-model-name.d.ts.map +1 -0
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +2 -0
- package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +1 -0
- package/declarations/store/-private.d.ts +27 -0
- package/declarations/store/-private.d.ts.map +1 -0
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +100 -0
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +1 -0
- package/declarations/store/-types/q/ds-model.d.ts +22 -0
- package/declarations/store/-types/q/ds-model.d.ts.map +1 -0
- package/declarations/store/-types/q/identifier.d.ts +21 -0
- package/declarations/store/-types/q/identifier.d.ts.map +1 -0
- package/declarations/store/-types/q/promise-proxies.d.ts +2 -0
- package/declarations/store/-types/q/promise-proxies.d.ts.map +1 -0
- package/declarations/store/-types/q/record-data-json-api.d.ts +31 -0
- package/declarations/store/-types/q/record-data-json-api.d.ts.map +1 -0
- package/declarations/store/-types/q/record-instance.d.ts +24 -0
- package/declarations/store/-types/q/record-instance.d.ts.map +1 -0
- package/declarations/store/-types/q/schema-service.d.ts +331 -0
- package/declarations/store/-types/q/schema-service.d.ts.map +1 -0
- package/declarations/store/-types/q/store.d.ts +35 -0
- package/declarations/store/-types/q/store.d.ts.map +1 -0
- package/declarations/store.d.ts +2 -0
- package/declarations/store.d.ts.map +1 -0
- package/declarations/types/-private.d.ts +14 -0
- package/declarations/types/-private.d.ts.map +1 -0
- package/declarations/types/cache/aliases.d.ts +2 -0
- package/declarations/types/cache/aliases.d.ts.map +1 -0
- package/declarations/types/cache/change.d.ts +7 -0
- package/declarations/types/cache/change.d.ts.map +1 -0
- package/declarations/types/cache/mutations.d.ts +39 -0
- package/declarations/types/cache/mutations.d.ts.map +1 -0
- package/declarations/types/cache/operations.d.ts +72 -0
- package/declarations/types/cache/operations.d.ts.map +1 -0
- package/declarations/types/cache/relationship.d.ts +14 -0
- package/declarations/types/cache/relationship.d.ts.map +1 -0
- package/declarations/types/cache.d.ts +492 -0
- package/declarations/types/cache.d.ts.map +1 -0
- package/declarations/types/graph.d.ts +48 -0
- package/declarations/types/graph.d.ts.map +1 -0
- package/declarations/types/identifier.d.ts +111 -0
- package/declarations/types/identifier.d.ts.map +1 -0
- package/declarations/types/json/raw.d.ts +7 -0
- package/declarations/types/json/raw.d.ts.map +1 -0
- package/declarations/types/params.d.ts +10 -0
- package/declarations/types/params.d.ts.map +1 -0
- package/declarations/types/record.d.ts +96 -0
- package/declarations/types/record.d.ts.map +1 -0
- package/declarations/types/record.type-test.d.ts +2 -0
- package/declarations/types/record.type-test.d.ts.map +1 -0
- package/declarations/types/request.d.ts +308 -0
- package/declarations/types/request.d.ts.map +1 -0
- package/declarations/types/request.type-test.d.ts +2 -0
- package/declarations/types/request.type-test.d.ts.map +1 -0
- package/declarations/types/runtime.d.ts +15 -0
- package/declarations/types/runtime.d.ts.map +1 -0
- package/declarations/types/schema/concepts.d.ts +17 -0
- package/declarations/types/schema/concepts.d.ts.map +1 -0
- package/declarations/types/schema/fields.d.ts +1674 -0
- package/declarations/types/schema/fields.d.ts.map +1 -0
- package/declarations/types/schema/fields.type-test.d.ts +2 -0
- package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
- package/declarations/types/spec/document.d.ts +31 -0
- package/declarations/types/spec/document.d.ts.map +1 -0
- package/declarations/types/spec/error.d.ts +19 -0
- package/declarations/types/spec/error.d.ts.map +1 -0
- package/declarations/types/spec/json-api-raw.d.ts +142 -0
- package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
- package/declarations/types/symbols.d.ts +79 -0
- package/declarations/types/symbols.d.ts.map +1 -0
- package/declarations/types/utils.d.ts +5 -0
- package/declarations/types/utils.d.ts.map +1 -0
- package/declarations/types.d.ts +12 -0
- package/declarations/types.d.ts.map +1 -0
- package/declarations/utils/string.d.ts +45 -0
- package/declarations/utils/string.d.ts.map +1 -0
- package/dist/build-config/babel-macros.js +1 -0
- package/dist/build-config/babel-macros.js.map +1 -0
- package/dist/build-config/canary-features.js +1 -0
- package/dist/build-config/canary-features.js.map +1 -0
- package/dist/build-config/debugging.js +1 -0
- package/dist/build-config/debugging.js.map +1 -0
- package/dist/build-config/deprecations.js +1 -0
- package/dist/build-config/deprecations.js.map +1 -0
- package/dist/build-config/env.js +1 -0
- package/dist/build-config/env.js.map +1 -0
- package/dist/build-config/macros.js +1 -0
- package/dist/build-config/macros.js.map +1 -0
- package/dist/build-config.js +1 -0
- package/dist/build-config.js.map +1 -0
- package/dist/configure-Bz49BEZQ.js +145 -0
- package/dist/configure-Bz49BEZQ.js.map +1 -0
- package/dist/configure.js +1 -0
- package/dist/configure.js.map +1 -0
- package/dist/context-DE5sFezZ.js +636 -0
- package/dist/context-DE5sFezZ.js.map +1 -0
- package/dist/graph/-private.js +3364 -0
- package/dist/graph/-private.js.map +1 -0
- package/dist/handler-DYUefHNU.js +339 -0
- package/dist/handler-DYUefHNU.js.map +1 -0
- package/dist/index.js +382 -0
- package/dist/index.js.map +1 -0
- package/dist/reactive/-private.js +1 -0
- package/dist/reactive/-private.js.map +1 -0
- package/dist/reactive.js +1802 -0
- package/dist/reactive.js.map +1 -0
- package/dist/request-state-Bv5CY_H0.js +7358 -0
- package/dist/request-state-Bv5CY_H0.js.map +1 -0
- package/dist/request.js +1 -0
- package/dist/request.js.map +1 -0
- package/dist/store/-private.js +3 -0
- package/dist/store/-private.js.map +1 -0
- package/dist/store.js +545 -0
- package/dist/store.js.map +1 -0
- package/dist/symbols-DyqeYQTe.js +44 -0
- package/dist/symbols-DyqeYQTe.js.map +1 -0
- package/dist/types/-private.js +79 -0
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache/aliases.js +0 -0
- package/dist/types/cache/aliases.js.map +1 -0
- package/dist/types/cache/change.js +0 -0
- package/dist/types/cache/change.js.map +1 -0
- package/dist/types/cache/mutations.js +0 -0
- package/dist/types/cache/mutations.js.map +1 -0
- package/dist/types/cache/operations.js +0 -0
- package/dist/types/cache/operations.js.map +1 -0
- package/dist/types/cache/relationship.js +0 -0
- package/dist/types/cache/relationship.js.map +1 -0
- package/dist/types/cache.js +0 -0
- package/dist/types/cache.js.map +1 -0
- package/dist/types/graph.js +0 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/identifier.js +89 -0
- package/dist/types/identifier.js.map +1 -0
- package/dist/types/json/raw.js +0 -0
- package/dist/types/json/raw.js.map +1 -0
- package/dist/types/params.js +0 -0
- package/dist/types/params.js.map +1 -0
- package/dist/types/record.js +64 -0
- package/dist/types/record.js.map +1 -0
- package/dist/types/request.js +33 -0
- package/dist/types/request.js.map +1 -0
- package/dist/types/runtime.js +34 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/schema/concepts.js +0 -0
- package/dist/types/schema/concepts.js.map +1 -0
- package/dist/types/schema/fields.js +470 -0
- package/dist/types/schema/fields.js.map +1 -0
- package/dist/types/schema/fields.type-test.js +0 -0
- package/dist/types/schema/fields.type-test.js.map +1 -0
- package/dist/types/spec/document.js +0 -0
- package/dist/types/spec/document.js.map +1 -0
- package/dist/types/spec/error.js +0 -0
- package/dist/types/spec/error.js.map +1 -0
- package/dist/types/spec/json-api-raw.js +0 -0
- package/dist/types/spec/json-api-raw.js.map +1 -0
- package/dist/types/symbols.js +84 -0
- package/dist/types/symbols.js.map +1 -0
- package/dist/types/utils.js +0 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.js +0 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/string.js +92 -0
- package/dist/utils/string.js.map +1 -0
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"-private.js","sources":["../../src/graph/-private/coerce-id.ts","../../src/graph/-private/-utils.ts","../../src/graph/-private/-edge-definition.ts","../../src/graph/-private/debug/assert-polymorphic-type.ts","../../src/graph/-private/operations/replace-related-records.ts","../../src/graph/-private/operations/replace-related-record.ts","../../src/graph/-private/-diff.ts","../../src/graph/-private/-state.ts","../../src/graph/-private/edges/collection.ts","../../src/graph/-private/edges/implicit.ts","../../src/graph/-private/edges/resource.ts","../../src/graph/-private/operations/add-to-related-records.ts","../../src/graph/-private/operations/merge-identifier.ts","../../src/graph/-private/operations/remove-from-related-records.ts","../../src/graph/-private/normalize-link.ts","../../src/graph/-private/operations/update-relationship.ts","../../src/graph/-private/graph.ts","../../src/graph/-private.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: Coercable): 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 { warn } from '@ember/debug';\n\nimport { LOG_GRAPH } from '@warp-drive/core/build-config/debugging';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { Store } from '../../store/-private.ts';\nimport { peekCache } from '../../store/-private.ts';\nimport type { CacheCapabilitiesManager } from '../../types.ts';\nimport type { UpdateResourceRelationshipOperation } from '../../types/cache/operations.ts';\nimport type { UpdateRelationshipOperation } from '../../types/graph.ts';\nimport type { StableRecordIdentifier } from '../../types/identifier.ts';\nimport type { ResourceIdentifierObject } from '../../types/spec/json-api-raw.ts';\nimport type { UpgradedMeta } from './-edge-definition.ts';\nimport { coerceId } from './coerce-id.ts';\nimport type { CollectionEdge } from './edges/collection.ts';\nimport type { ImplicitEdge } from './edges/implicit.ts';\nimport type { ResourceEdge } from './edges/resource.ts';\nimport type { Graph, GraphEdge } from './graph.ts';\n\nexport function getStore(wrapper: CacheCapabilitiesManager | { _store: Store }): Store {\n assert(`expected a private _store property`, '_store' in wrapper);\n return wrapper._store;\n}\n\nexport function expandingGet<T>(cache: Record<string, Record<string, T>>, key1: string, key2: string): T | undefined {\n const mainCache = (cache[key1] = cache[key1] || Object.create(null));\n return mainCache[key2];\n}\n\nexport function expandingSet<T>(cache: Record<string, Record<string, T>>, key1: string, key2: string, value: T): void {\n const mainCache = (cache[key1] = cache[key1] || Object.create(null));\n mainCache[key2] = value;\n}\n\nexport function assertValidRelationshipPayload(\n graph: Graph,\n op: UpdateRelationshipOperation | UpdateResourceRelationshipOperation\n) {\n const relationship = graph.get(op.record, op.field);\n assert(`Cannot update an implicit relationship`, isHasMany(relationship) || isBelongsTo(relationship));\n const payload = op.value;\n const { definition, identifier, state } = relationship;\n const { type } = identifier;\n const { field } = op;\n const { isAsync, kind } = definition;\n\n if (payload.links) {\n warn(\n `You pushed a record of type '${type}' with a relationship '${field}' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload. WarpDrive will treat this relationship as known-to-be-empty.`,\n isAsync || !!payload.data || state.hasReceivedData,\n {\n id: 'ds.store.push-link-for-sync-relationship',\n }\n );\n } else if (payload.data) {\n if (kind === 'belongsTo') {\n assert(\n `A ${type} record was pushed into the store with the value of ${field} being ${inspect(\n payload.data\n )}, but ${field} is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`,\n !Array.isArray(payload.data)\n );\n assertRelationshipData(getStore(graph.store), identifier, payload.data, definition);\n } else if (kind === 'hasMany') {\n assert(\n `A ${type} record was pushed into the store with the value of ${field} being '${inspect(\n payload.data\n )}', but ${field} is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.`,\n Array.isArray(payload.data)\n );\n if (Array.isArray(payload.data)) {\n for (let i = 0; i < payload.data.length; i++) {\n assertRelationshipData(getStore(graph.store), identifier, payload.data[i], definition);\n }\n }\n }\n }\n}\n\nfunction inspect(value: unknown) {\n const type = typeof value;\n if (value === null) {\n return 'null';\n }\n if (type !== 'object') {\n return type;\n }\n if (Array.isArray(value)) {\n return 'Array';\n }\n if (value instanceof Date) {\n return 'Date';\n }\n if (value instanceof RegExp) {\n return 'RegExp';\n }\n if (value instanceof Map) {\n return 'Map';\n }\n if (value instanceof Set) {\n return 'Set';\n }\n return 'object';\n}\n\nexport function isNew(identifier: StableRecordIdentifier): boolean {\n if (!identifier.id) {\n return true;\n }\n const cache = peekCache(identifier);\n return Boolean(cache?.isNew(identifier));\n}\n\nexport function isBelongsTo(relationship: GraphEdge): relationship is ResourceEdge {\n return relationship.definition.kind === 'belongsTo';\n}\n\nexport function isImplicit(relationship: GraphEdge): relationship is ImplicitEdge {\n return relationship.definition.isImplicit;\n}\n\nexport function isHasMany(relationship: GraphEdge): relationship is CollectionEdge {\n return relationship.definition.kind === 'hasMany';\n}\n\nexport function forAllRelatedIdentifiers(rel: GraphEdge, cb: (identifier: StableRecordIdentifier) => void): void {\n if (isBelongsTo(rel)) {\n if (rel.remoteState) {\n cb(rel.remoteState);\n }\n if (rel.localState && rel.localState !== rel.remoteState) {\n cb(rel.localState);\n }\n } else if (isHasMany(rel)) {\n // TODO\n // rel.remoteMembers.forEach(cb);\n // might be simpler if performance is not a concern\n for (let i = 0; i < rel.remoteState.length; i++) {\n const inverseIdentifier = rel.remoteState[i];\n cb(inverseIdentifier);\n }\n rel.additions?.forEach(cb);\n } else {\n rel.localMembers.forEach(cb);\n rel.remoteMembers.forEach((inverseIdentifier) => {\n if (!rel.localMembers.has(inverseIdentifier)) {\n cb(inverseIdentifier);\n }\n });\n }\n}\n\n/*\n Removes the given identifier from BOTH remote AND local state.\n\n This method is useful when either a deletion or a rollback on a new record\n needs to entirely purge itself from an inverse relationship.\n */\nexport function removeIdentifierCompletelyFromRelationship(\n graph: Graph,\n relationship: GraphEdge,\n value: StableRecordIdentifier,\n silenceNotifications?: boolean\n): void {\n if (isBelongsTo(relationship)) {\n if (relationship.remoteState === value) {\n relationship.remoteState = null;\n }\n\n if (relationship.localState === value) {\n relationship.localState = null;\n // This allows dematerialized inverses to be rematerialized\n // we shouldn't be notifying here though, figure out where\n // a notification was missed elsewhere.\n if (!silenceNotifications) {\n notifyChange(graph, relationship);\n }\n }\n } else if (isHasMany(relationship)) {\n relationship.remoteMembers.delete(value);\n relationship.additions?.delete(value);\n const wasInRemovals = relationship.removals?.delete(value);\n\n const canonicalIndex = relationship.remoteState.indexOf(value);\n if (canonicalIndex !== -1) {\n relationship.remoteState.splice(canonicalIndex, 1);\n }\n\n if (!wasInRemovals) {\n const currentIndex = relationship.localState?.indexOf(value);\n if (currentIndex !== -1 && currentIndex !== undefined) {\n relationship.localState!.splice(currentIndex, 1);\n // This allows dematerialized inverses to be rematerialized\n // we shouldn't be notifying here though, figure out where\n // a notification was missed elsewhere.\n if (!silenceNotifications) {\n notifyChange(graph, relationship);\n }\n }\n }\n } else {\n relationship.remoteMembers.delete(value);\n relationship.localMembers.delete(value);\n }\n}\n\nexport function notifyChange(graph: Graph, relationship: CollectionEdge | ResourceEdge): void {\n if (!relationship.accessed) {\n return;\n }\n\n const identifier = relationship.identifier;\n const key = relationship.definition.key;\n\n if (identifier === graph._removing) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`Graph: ignoring relationship change for removed identifier ${String(identifier)} ${key}`);\n }\n return;\n }\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`Graph: notifying relationship change for ${String(identifier)} ${key}`);\n }\n\n graph.store.notifyChange(identifier, 'relationships', key);\n}\n\nexport function assertRelationshipData(\n store: Store,\n identifier: StableRecordIdentifier,\n data: ResourceIdentifierObject,\n meta: UpgradedMeta\n) {\n assert(\n `A ${identifier.type} record was pushed into the store with the value of ${meta.key} being '${JSON.stringify(\n data\n )}', but ${\n meta.key\n } is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`,\n !Array.isArray(data)\n );\n assert(\n `Encountered a relationship identifier without a type for the ${meta.kind} relationship '${meta.key}' on <${\n identifier.type\n }:${String(identifier.id)}>, expected an identifier with type '${meta.type}' but found\\n\\n'${JSON.stringify(\n data,\n null,\n 2\n )}'\\n\\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`,\n data === null || ('type' in data && typeof data.type === 'string' && data.type.length)\n );\n assert(\n `Encountered a relationship identifier without an id for the ${meta.kind} relationship '${meta.key}' on <${\n identifier.type\n }:${String(identifier.id)}>, expected an identifier but found\\n\\n'${JSON.stringify(\n data,\n null,\n 2\n )}'\\n\\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`,\n data === null || !!coerceId(data.id)\n );\n if (data?.type === meta.type) {\n assert(\n `Missing Schema: Encountered a relationship identifier { type: '${data.type}', id: '${String(\n data.id\n )}' } for the '${identifier.type}.${meta.key}' ${meta.kind} relationship on <${identifier.type}:${String(\n identifier.id\n )}>, but no schema exists for that type.`,\n store.schema.hasResource(data)\n );\n } else {\n assert(\n `Missing Schema: Encountered a relationship identifier with type '${data.type}' for the ${\n meta.kind\n } relationship '${meta.key}' on <${identifier.type}:${String(\n identifier.id\n )}>, Expected an identifier with type '${meta.type}'. No schema was found for '${data.type}'.`,\n data === null || !data.type || store.schema.hasResource(data)\n );\n }\n}\n","import { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { Store } from '../../index.ts';\nimport type { StableRecordIdentifier } from '../../types.ts';\nimport type {\n CollectionField,\n FieldSchema,\n LegacyBelongsToField,\n LegacyHasManyField,\n ResourceField,\n} from '../../types/schema/fields.ts';\nimport { expandingGet, expandingSet, getStore } from './-utils.ts';\nimport { assertInheritedSchema } from './debug/assert-polymorphic-type.ts';\nimport type { Graph } from './graph.ts';\n\nexport type EdgeCache = Record<string, Record<string, EdgeDefinition | null>>;\n\nexport type RelationshipField = LegacyBelongsToField | LegacyHasManyField | ResourceField | CollectionField;\nexport type RelationshipFieldKind = RelationshipField['kind'];\nexport type CollectionKind = 'hasMany' | 'collection';\nexport type ResourceKind = 'belongsTo' | 'resource';\nexport const RELATIONSHIP_KINDS = ['belongsTo', 'hasMany', 'resource', 'collection'];\n\nexport function isLegacyField(field: FieldSchema): field is LegacyBelongsToField | LegacyHasManyField {\n return field.kind === 'belongsTo' || field.kind === 'hasMany';\n}\n\nexport function isRelationshipField(field: FieldSchema): field is RelationshipField {\n return RELATIONSHIP_KINDS.includes(field.kind);\n}\n\nexport function temporaryConvertToLegacy(\n field: ResourceField | CollectionField\n): LegacyBelongsToField | LegacyHasManyField {\n return {\n kind: field.kind === 'resource' ? 'belongsTo' : 'hasMany',\n name: field.name,\n type: field.type,\n options: Object.assign({}, { async: false, inverse: null, resetOnRemoteUpdate: false as const }, field.options),\n };\n}\n\n/**\n *\n * Given RHS (Right Hand Side)\n *\n * ```ts\n * class User extends Model {\n * @hasMany('animal', { async: false, inverse: 'owner' }) pets;\n * }\n * ```\n *\n * Given LHS (Left Hand Side)\n *\n * ```ts\n * class Animal extends Model {\n * @belongsTo('user', { async: false, inverse: 'pets' }) owner;\n * }\n * ```\n *\n * The UpgradedMeta for the RHS would be:\n *\n * ```ts\n * {\n * kind: 'hasMany',\n * key: 'pets',\n * type: 'animal',\n * isAsync: false,\n * isImplicit: false,\n * isCollection: true,\n * isPolymorphic: false,\n * inverseKind: 'belongsTo',\n * inverseKey: 'owner',\n * inverseType: 'user',\n * inverseIsAsync: false,\n * inverseIsImplicit: false,\n * inverseIsCollection: false,\n * inverseIsPolymorphic: false,\n * }\n * ```\n *\n * The UpgradeMeta for the LHS would be:\n *\n * ```ts\n * {\n * kind: 'belongsTo',\n * key: 'owner',\n * type: 'user',\n * isAsync: false,\n * isImplicit: false,\n * isCollection: false,\n * isPolymorphic: false,\n * inverseKind: 'hasMany',\n * inverseKey: 'pets',\n * inverseType: 'animal',\n * inverseIsAsync: false,\n * inverseIsImplicit: false,\n * inverseIsCollection: true,\n * inverseIsPolymorphic: false,\n * }\n * ```\n *\n *\n * @class UpgradedMeta\n * @internal\n */\nexport interface UpgradedMeta {\n kind: 'implicit' | RelationshipFieldKind;\n /**\n * The field name on `this` record\n *\n * @internal\n */\n key: string;\n /**\n * The `type` of the related record\n *\n * @internal\n */\n type: string;\n isAsync: boolean;\n isImplicit: boolean;\n isCollection: boolean;\n isPolymorphic: boolean;\n resetOnRemoteUpdate: boolean;\n isLinksMode: boolean;\n\n inverseKind: 'implicit' | RelationshipFieldKind;\n /**\n * The field name on the opposing record\n * @internal\n */\n inverseKey: string;\n /**\n * The `type` of `this` record\n * @internal\n */\n inverseType: string;\n inverseIsAsync: boolean;\n inverseIsImplicit: boolean;\n inverseIsCollection: boolean;\n inverseIsPolymorphic: boolean;\n inverseIsLinksMode: boolean;\n}\n\nexport interface EdgeDefinition {\n lhs_key: string;\n lhs_modelNames: string[];\n lhs_baseModelName: string;\n lhs_relationshipName: string;\n lhs_definition: UpgradedMeta;\n lhs_isPolymorphic: boolean;\n\n rhs_key: string;\n rhs_modelNames: string[];\n rhs_baseModelName: string;\n rhs_relationshipName: string;\n rhs_definition: UpgradedMeta | null;\n rhs_isPolymorphic: boolean;\n\n hasInverse: boolean;\n\n /**\n * Whether this relationship points back at the same type.\n *\n * If the relationship is polymorphic, this will be true if\n * it points back at the same abstract type.\n *\n * @internal\n */\n isSelfReferential: boolean;\n\n /**\n * If this is a reflexive relationship, this is true\n * if the relationship also points back at the same\n * field.\n *\n * @internal\n */\n isReflexive: boolean;\n}\n\nconst BOOL_LATER = null as unknown as boolean;\nconst STR_LATER = '';\nconst IMPLICIT_KEY_RAND = Date.now();\n\nfunction implicitKeyFor(type: string, key: string): string {\n return `implicit-${type}:${key}${IMPLICIT_KEY_RAND}`;\n}\n\nfunction syncMeta(definition: UpgradedMeta, inverseDefinition: UpgradedMeta) {\n definition.inverseKind = inverseDefinition.kind;\n definition.inverseKey = inverseDefinition.key;\n definition.inverseType = inverseDefinition.type;\n definition.inverseIsAsync = inverseDefinition.isAsync;\n definition.inverseIsCollection = inverseDefinition.isCollection;\n definition.inverseIsPolymorphic = inverseDefinition.isPolymorphic;\n definition.inverseIsImplicit = inverseDefinition.isImplicit;\n definition.inverseIsLinksMode = inverseDefinition.isLinksMode;\n const resetOnRemoteUpdate =\n definition.resetOnRemoteUpdate === false || inverseDefinition.resetOnRemoteUpdate === false ? false : true;\n definition.resetOnRemoteUpdate = resetOnRemoteUpdate;\n inverseDefinition.resetOnRemoteUpdate = resetOnRemoteUpdate;\n}\n\nfunction upgradeMeta(meta: RelationshipField): UpgradedMeta {\n if (!isLegacyField(meta)) {\n meta = temporaryConvertToLegacy(meta);\n }\n const niceMeta: UpgradedMeta = {} as UpgradedMeta;\n const options = meta.options;\n niceMeta.kind = meta.kind;\n niceMeta.key = meta.name;\n niceMeta.type = meta.type;\n assert(`Expected relationship definition to specify async`, typeof options?.async === 'boolean');\n niceMeta.isAsync = options.async;\n niceMeta.isImplicit = false;\n niceMeta.isCollection = meta.kind === 'hasMany';\n niceMeta.isPolymorphic = options && !!options.polymorphic;\n niceMeta.isLinksMode = options.linksMode ?? false;\n\n niceMeta.inverseKey = (options && options.inverse) || STR_LATER;\n niceMeta.inverseType = STR_LATER;\n niceMeta.inverseIsAsync = BOOL_LATER;\n niceMeta.inverseIsImplicit = (options && options.inverse === null) || BOOL_LATER;\n niceMeta.inverseIsCollection = BOOL_LATER;\n niceMeta.inverseIsLinksMode = BOOL_LATER;\n\n // prettier-ignore\n niceMeta.resetOnRemoteUpdate = !isLegacyField(meta) ? false\n : meta.options?.linksMode ? false\n : meta.options?.resetOnRemoteUpdate === false ? false\n : true;\n\n return niceMeta;\n}\n\nfunction assertConfiguration(info: EdgeDefinition, type: string, key: string) {\n if (DEBUG) {\n const isSelfReferential = info.isSelfReferential;\n\n if (isSelfReferential) {\n return true;\n }\n\n const _isRHS =\n key === info.rhs_relationshipName &&\n (type === info.rhs_baseModelName || // base or non-polymorphic\n // if the other side is polymorphic then we need to scan our modelNames\n (info.lhs_isPolymorphic && info.rhs_modelNames.includes(type))); // polymorphic\n const _isLHS =\n key === info.lhs_relationshipName &&\n (type === info.lhs_baseModelName || // base or non-polymorphic\n // if the other side is polymorphic then we need to scan our modelNames\n (info.rhs_isPolymorphic && info.lhs_modelNames.includes(type))); // polymorphic;\n\n if (!_isRHS && !_isLHS) {\n /*\n this occurs when we are likely polymorphic but not configured to be polymorphic\n most often due to extending a class that has a relationship definition on it.\n\n e.g.\n\n ```ts\n class Pet extends Model {\n @belongsTo('human', { async: false, inverse: 'pet' }) owner;\n }\n class Human extends Model {\n @belongsTo('pet', { async: false, inverse: 'owner' }) pet;\n }\n class Farmer extends Human {}\n ```\n\n In the above case, the following would trigger this error:\n\n ```ts\n let pet = store.createRecord('pet');\n let farmer = store.createRecord('farmer');\n farmer.pet = pet; // error\n ```\n\n The correct way to fix this is to specify the polymorphic option on Pet\n and to specify the abstract type 'human' on the Human base class.\n\n ```ts\n class Pet extends Model {\n @belongsTo('human', { async: false, inverse: 'pet', polymorphic: true }) owner;\n }\n class Human extends Model {\n @belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;\n }\n class Farmer extends Human {}\n ```\n\n Alternatively both Human and Farmer could declare the relationship, because relationship\n definitions are \"structural\".\n\n ```ts\n class Pet extends Model {\n @belongsTo('human', { async: false, inverse: 'pet', polymorphic: true }) owner;\n }\n class Human extends Model {\n @belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;\n }\n class Farmer extends Model {\n @belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;\n }\n ```\n\n */\n if (key === info.lhs_relationshipName && info.lhs_modelNames.includes(type)) {\n // parentIdentifier, parentDefinition, addedIdentifier, store\n assertInheritedSchema(info.lhs_definition, type);\n } else if (key === info.rhs_relationshipName && info.rhs_modelNames.includes(type)) {\n assertInheritedSchema(info.lhs_definition, type);\n }\n // OPEN AN ISSUE :: we would like to improve our errors but need to understand what corner case got us here\n throw new Error(\n `PLEASE OPEN AN ISSUE :: Found a relationship that is neither the LHS nor RHS of the same edge. This is not supported. Please report this to the WarpDrive team.`\n );\n }\n\n if (_isRHS && _isLHS) {\n // not sure how we get here but it's probably the result of some form of inheritance\n // without having specified polymorphism correctly leading to it not being self-referential\n // OPEN AN ISSUE :: we would like to improve our errors but need to understand what corner case got us here\n throw new Error(\n `PLEASE OPEN AN ISSUE :: Found a relationship that is both the LHS and RHS of the same edge but is not self-referential. This is not supported. Please report this to the WarpDrive team.`\n );\n }\n }\n}\n\nexport function isLHS(info: EdgeDefinition, type: string, key: string): boolean {\n const isSelfReferential = info.isSelfReferential;\n const isRelationship = key === info.lhs_relationshipName;\n\n if (DEBUG) {\n assertConfiguration(info, type, key);\n }\n\n if (isRelationship === true) {\n return (\n isSelfReferential === true || // itself\n type === info.lhs_baseModelName || // base or non-polymorphic\n // if the other side is polymorphic then we need to scan our modelNames\n (info.rhs_isPolymorphic && info.lhs_modelNames.includes(type)) // polymorphic\n );\n }\n\n return false;\n}\n\nexport function isRHS(info: EdgeDefinition, type: string, key: string): boolean {\n const isSelfReferential = info.isSelfReferential;\n const isRelationship = key === info.rhs_relationshipName;\n\n if (DEBUG) {\n assertConfiguration(info, type, key);\n }\n\n if (isRelationship === true) {\n return (\n isSelfReferential === true || // itself\n type === info.rhs_baseModelName || // base or non-polymorphic\n // if the other side is polymorphic then we need to scan our modelNames\n (info.lhs_isPolymorphic && info.rhs_modelNames.includes(type)) // polymorphic\n );\n }\n\n return false;\n}\n\nexport function upgradeDefinition(\n graph: Graph,\n identifier: StableRecordIdentifier,\n propertyName: string,\n isImplicit = false\n): EdgeDefinition | null {\n const cache = graph._definitionCache;\n const storeWrapper = graph.store;\n const polymorphicLookup = graph._potentialPolymorphicTypes;\n\n const { type } = identifier;\n let cached = /*#__NOINLINE__*/ expandingGet<EdgeDefinition | null>(cache, type, propertyName);\n\n // CASE: We have a cached resolution (null if no relationship exists)\n if (cached !== undefined) {\n return cached;\n }\n\n assert(\n `Expected to find relationship definition in the cache for the implicit relationship ${propertyName}`,\n !isImplicit\n );\n\n const relationships = storeWrapper.schema.fields(identifier);\n assert(`Expected to have a relationship definition for ${type} but none was found.`, relationships);\n const meta = relationships.get(propertyName);\n\n if (!meta) {\n // TODO potentially we should just be permissive here since this is an implicit relationship\n // and not require the lookup table to be populated\n if (polymorphicLookup[type]) {\n const altTypes = Object.keys(polymorphicLookup[type]);\n for (let i = 0; i < altTypes.length; i++) {\n const _cached = expandingGet<EdgeDefinition | null>(cache, altTypes[i], propertyName);\n if (_cached) {\n /*#__NOINLINE__*/ expandingSet<EdgeDefinition | null>(cache, type, propertyName, _cached);\n _cached.rhs_modelNames.push(type);\n return _cached;\n }\n }\n }\n\n // CASE: We don't have a relationship at all\n // we should only hit this in prod\n assert(`Expected a relationship schema for '${type}.${propertyName}', but no relationship schema was found.`, meta);\n\n cache[type][propertyName] = null;\n return null;\n }\n\n assert(`Expected ${propertyName} to be a relationship`, isRelationshipField(meta));\n const definition = /*#__NOINLINE__*/ upgradeMeta(meta);\n\n let inverseDefinition: UpgradedMeta | null;\n let inverseKey: string | null;\n const inverseType = definition.type;\n\n // CASE: Inverse is explicitly null\n if (definition.inverseKey === null) {\n // TODO probably dont need this assertion if polymorphic\n assert(`Expected the inverse model to exist`, getStore(storeWrapper).modelFor(inverseType));\n inverseDefinition = null;\n } else {\n inverseKey = /*#__NOINLINE__*/ inverseForRelationship(getStore(storeWrapper), identifier, propertyName);\n\n // CASE: If we are polymorphic, and we declared an inverse that is non-null\n // we must assume that the lack of inverseKey means that there is no\n // concrete type as the baseType, so we must construct and artificial\n // placeholder\n if (!inverseKey && definition.isPolymorphic && definition.inverseKey) {\n inverseDefinition = {\n kind: 'belongsTo', // this must be updated when we find the first belongsTo or hasMany definition that matches\n key: definition.inverseKey,\n type: type,\n isAsync: false, // this must be updated when we find the first belongsTo or hasMany definition that matches\n isImplicit: false,\n isCollection: false, // this must be updated when we find the first belongsTo or hasMany definition that matches\n isPolymorphic: false,\n } as UpgradedMeta; // the rest of the fields are populated by syncMeta\n\n // CASE: Inverse resolves to null\n } else if (!inverseKey) {\n inverseDefinition = null;\n } else {\n // CASE: We have an explicit inverse or were able to resolve one\n const inverseDefinitions = storeWrapper.schema.fields({ type: inverseType });\n assert(`Expected to have a relationship definition for ${inverseType} but none was found.`, inverseDefinitions);\n const metaFromInverse = inverseDefinitions.get(inverseKey);\n assert(\n `Expected a relationship schema for '${inverseType}.${inverseKey}' to match the inverse of '${type}.${propertyName}', but no relationship schema was found.`,\n metaFromInverse\n );\n assert(`Expected ${inverseKey} to be a relationship`, isRelationshipField(metaFromInverse));\n\n inverseDefinition = upgradeMeta(metaFromInverse);\n }\n }\n\n // CASE: We have no inverse\n if (!inverseDefinition) {\n // polish off meta\n inverseKey = /*#__NOINLINE__*/ implicitKeyFor(type, propertyName);\n inverseDefinition = {\n kind: 'implicit',\n key: inverseKey,\n type: type,\n isAsync: false,\n isImplicit: true,\n isCollection: true, // with implicits any number of records could point at us\n isPolymorphic: false,\n } as UpgradedMeta; // the rest of the fields are populated by syncMeta\n\n syncMeta(definition, inverseDefinition);\n syncMeta(inverseDefinition, definition);\n\n const info = {\n lhs_key: `${type}:${propertyName}`,\n lhs_modelNames: [type],\n lhs_baseModelName: type,\n lhs_relationshipName: propertyName,\n lhs_definition: definition,\n lhs_isPolymorphic: definition.isPolymorphic,\n\n rhs_key: inverseDefinition.key,\n rhs_modelNames: [inverseType],\n rhs_baseModelName: inverseType,\n rhs_relationshipName: inverseDefinition.key,\n rhs_definition: inverseDefinition,\n rhs_isPolymorphic: false,\n\n hasInverse: false,\n isSelfReferential: type === inverseType, // this could be wrong if we are self-referential but also polymorphic\n isReflexive: false, // we can't be reflexive if we don't define an inverse\n };\n\n expandingSet<EdgeDefinition | null>(cache, inverseType, inverseKey, info);\n expandingSet<EdgeDefinition | null>(cache, type, propertyName, info);\n return info;\n }\n\n // CASE: We do have an inverse\n const baseType = inverseDefinition.type;\n\n // TODO we want to assert this but this breaks all of our shoddily written tests\n /*\n if (DEBUG) {\n let inverseDoubleCheck = inverseFor(inverseRelationshipName, store);\n\n assert(`The ${inverseBaseModelName}:${inverseRelationshipName} relationship declares 'inverse: null', but it was resolved as the inverse for ${baseModelName}:${relationshipName}.`, inverseDoubleCheck);\n }\n */\n // CASE: We may have already discovered the inverse for the baseModelName\n // CASE: We have already discovered the inverse\n assert(\n `We should have determined an inverseKey by now, open an issue if this is hit`,\n typeof inverseKey! === 'string' && inverseKey.length > 0\n );\n cached = expandingGet(cache, baseType, propertyName) || expandingGet(cache, inverseType, inverseKey);\n\n if (cached) {\n // TODO this assert can be removed if the above assert is enabled\n assert(\n `The ${inverseType}:${inverseKey} relationship declares 'inverse: null', but it was resolved as the inverse for ${type}:${propertyName}.`,\n cached.hasInverse !== false\n );\n\n const _isLHS = cached.lhs_baseModelName === baseType;\n const modelNames = _isLHS ? cached.lhs_modelNames : cached.rhs_modelNames;\n // make this lookup easier in the future by caching the key\n modelNames.push(type);\n expandingSet<EdgeDefinition | null>(cache, type, propertyName, cached);\n\n return cached;\n }\n\n // this is our first time so polish off the metas\n syncMeta(definition, inverseDefinition);\n syncMeta(inverseDefinition, definition);\n\n const lhs_modelNames = [type];\n if (type !== baseType) {\n lhs_modelNames.push(baseType);\n }\n const isSelfReferential = baseType === inverseType;\n const info = {\n lhs_key: `${baseType}:${propertyName}`,\n lhs_modelNames,\n lhs_baseModelName: baseType,\n lhs_relationshipName: propertyName,\n lhs_definition: definition,\n lhs_isPolymorphic: definition.isPolymorphic,\n\n rhs_key: `${inverseType}:${inverseKey}`,\n rhs_modelNames: [inverseType],\n rhs_baseModelName: inverseType,\n rhs_relationshipName: inverseKey,\n rhs_definition: inverseDefinition,\n rhs_isPolymorphic: inverseDefinition.isPolymorphic,\n hasInverse: true,\n isSelfReferential,\n isReflexive: isSelfReferential && propertyName === inverseKey,\n };\n\n // Create entries for the baseModelName as well as modelName to speed up\n // inverse lookups\n expandingSet<EdgeDefinition | null>(cache, baseType, propertyName, info);\n expandingSet<EdgeDefinition | null>(cache, type, propertyName, info);\n\n // Greedily populate the inverse\n expandingSet<EdgeDefinition | null>(cache, inverseType, inverseKey, info);\n\n return info;\n}\n\nfunction inverseForRelationship(store: Store, identifier: StableRecordIdentifier | { type: string }, key: string) {\n const definition = store.schema.fields(identifier).get(key);\n if (!definition) {\n return null;\n }\n\n assert(`Expected ${key} to be a relationship`, isRelationshipField(definition));\n assert(\n `Expected the relationship defintion to specify the inverse type or null.`,\n definition.options?.inverse === null ||\n (typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)\n );\n return definition.options.inverse;\n}\n","/* eslint-disable @typescript-eslint/no-shadow */\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { CacheCapabilitiesManager } from '../../../types.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport {\n isLegacyField,\n isRelationshipField,\n temporaryConvertToLegacy,\n type UpgradedMeta,\n} from '../-edge-definition.ts';\n\n/*\n Assert that `addedRecord` has a valid type so it can be added to the\n relationship of the `record`.\n\n The assert basically checks if the `addedRecord` can be added to the\n relationship (specified via `relationshipMeta`) of the `record`.\n\n This utility should only be used internally, as both record parameters must\n be stable record identifiers and the `relationshipMeta` needs to be the meta\n information about the relationship, retrieved via\n `record.relationshipFor(key)`.\n*/\nlet assertPolymorphicType: (\n parentIdentifier: StableRecordIdentifier,\n parentDefinition: UpgradedMeta,\n addedIdentifier: StableRecordIdentifier,\n store: CacheCapabilitiesManager\n) => void;\nlet assertInheritedSchema: (definition: UpgradedMeta, type: string) => void;\n\nif (DEBUG) {\n function validateSchema(definition: UpgradedMeta, meta: PrintConfig) {\n const errors = new Map();\n\n if (definition.inverseKey !== meta.name) {\n errors.set('name', ` <---- should be '${definition.inverseKey}'`);\n }\n if (definition.inverseType !== meta.type) {\n errors.set('type', ` <---- should be '${definition.inverseType}'`);\n }\n if (definition.inverseKind !== meta.kind) {\n errors.set('type', ` <---- should be '${definition.inverseKind}'`);\n }\n if (definition.inverseIsAsync !== meta.options.async) {\n errors.set('async', ` <---- should be ${definition.inverseIsAsync}`);\n }\n if (definition.inverseIsPolymorphic && definition.inverseIsPolymorphic !== meta.options.polymorphic) {\n errors.set('polymorphic', ` <---- should be ${definition.inverseIsPolymorphic}`);\n }\n if (definition.key !== meta.options.inverse) {\n errors.set('inverse', ` <---- should be '${definition.key}'`);\n }\n if (definition.type !== meta.options.as) {\n errors.set('as', ` <---- should be '${definition.type}'`);\n }\n\n return errors;\n }\n\n type PrintConfig = {\n name: string;\n type: string;\n kind: string;\n options: {\n as?: string;\n async: boolean;\n polymorphic?: boolean;\n inverse: string | null;\n };\n };\n type RelationshipSchemaError = 'name' | 'type' | 'kind' | 'as' | 'async' | 'polymorphic' | 'inverse';\n\n function expectedSchema(definition: UpgradedMeta) {\n return printSchema({\n name: definition.inverseKey,\n type: definition.inverseType,\n kind: definition.inverseKind,\n options: {\n as: definition.type,\n async: definition.inverseIsAsync,\n polymorphic: definition.inverseIsPolymorphic || false,\n inverse: definition.key,\n },\n });\n }\n\n function printSchema(config: PrintConfig, errors?: Map<RelationshipSchemaError, string>) {\n return `\n\n\\`\\`\\`\n{\n ${config.name}: {\n name: '${config.name}',${errors?.get('name') || ''}\n type: '${config.type}',${errors?.get('type') || ''}\n kind: '${config.kind}',${errors?.get('kind') || ''}\n options: {\n as: '${config.options.as}',${errors?.get('as') || ''}\n async: ${config.options.async},${errors?.get('async') || ''}\n polymorphic: ${config.options.polymorphic},${errors?.get('polymorphic') || ''}\n inverse: '${config.options.inverse}'${errors?.get('inverse') || ''}\n }\n }\n}\n\\`\\`\\`\n\n`;\n }\n\n function metaFrom(definition: UpgradedMeta) {\n return {\n name: definition.key,\n type: definition.type,\n kind: definition.kind,\n options: {\n async: definition.isAsync,\n polymorphic: definition.isPolymorphic,\n inverse: definition.inverseKey,\n },\n };\n }\n function inverseMetaFrom(definition: UpgradedMeta) {\n return {\n name: definition.inverseKey,\n type: definition.inverseType,\n kind: definition.inverseKind,\n options: {\n as: definition.isPolymorphic ? definition.type : undefined,\n async: definition.inverseIsAsync,\n polymorphic: definition.inverseIsPolymorphic,\n inverse: definition.key,\n },\n };\n }\n function inverseDefinition(definition: UpgradedMeta): UpgradedMeta {\n return {\n key: definition.inverseKey,\n type: definition.inverseType,\n kind: definition.inverseKind,\n isAsync: definition.inverseIsAsync,\n isPolymorphic: true,\n isLinksMode: definition.isLinksMode,\n isCollection: definition.inverseIsCollection,\n isImplicit: definition.inverseIsImplicit,\n inverseKey: definition.key,\n inverseType: definition.type,\n inverseKind: definition.kind,\n inverseIsAsync: definition.isAsync,\n inverseIsPolymorphic: definition.isPolymorphic,\n inverseIsLinksMode: definition.inverseIsLinksMode,\n inverseIsImplicit: definition.isImplicit,\n inverseIsCollection: definition.isCollection,\n resetOnRemoteUpdate: definition.resetOnRemoteUpdate,\n };\n }\n function definitionWithPolymorphic(definition: UpgradedMeta) {\n return Object.assign({}, definition, { inverseIsPolymorphic: true });\n }\n\n assertInheritedSchema = function assertInheritedSchema(definition: UpgradedMeta, type: string) {\n const meta1 = metaFrom(definition);\n const meta2 = inverseMetaFrom(definition);\n const errors1 = validateSchema(inverseDefinition(definition), meta1);\n const errors2 = validateSchema(definitionWithPolymorphic(definition), meta2);\n\n if (errors2.size === 0 && errors1.size > 0) {\n throw new Error(\n `The schema for the relationship '${type}.${definition.key}' is not configured to satisfy '${\n definition.inverseType\n }' and thus cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${\n definition.type\n }.${\n definition.inverseKey\n }'\\n\\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${type}' should include:${printSchema(\n meta1,\n errors1\n )}`\n );\n } else if (errors1.size > 0) {\n throw new Error(\n `The schema for the relationship '${type}.${definition.key}' is not configured to satisfy '${\n definition.inverseType\n }' and thus cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${\n definition.type\n }.${\n definition.inverseKey\n }'\\n\\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${type}' should include:${printSchema(\n meta1,\n errors1\n )} and the relationships schema definition for '${definition.type}' should include:${printSchema(\n meta2,\n errors2\n )}`\n );\n } else if (errors2.size > 0) {\n throw new Error(\n `The schema for the relationship '${type}.${definition.key}' satisfies '${\n definition.inverseType\n }' but cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${\n definition.type\n }.${\n definition.inverseKey\n }' because that relationship is not polymorphic.\\n\\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${\n definition.type\n }' should include:${printSchema(meta2, errors2)}`\n );\n }\n };\n\n assertPolymorphicType = function assertPolymorphicType(\n parentIdentifier: StableRecordIdentifier,\n parentDefinition: UpgradedMeta,\n addedIdentifier: StableRecordIdentifier,\n store: CacheCapabilitiesManager\n ) {\n if (parentDefinition.inverseIsImplicit) {\n return;\n }\n if (parentDefinition.isPolymorphic) {\n let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);\n assert(\n `No '${parentDefinition.inverseKey}' field exists on '${\n addedIdentifier.type\n }'. To use this type in the polymorphic relationship '${parentDefinition.inverseType}.${\n parentDefinition.key\n }' the relationships schema definition for ${addedIdentifier.type} should include:${expectedSchema(\n parentDefinition\n )}`,\n meta\n );\n assert(\n `Expected the field ${parentDefinition.inverseKey} to be a relationship`,\n meta && isRelationshipField(meta)\n );\n meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);\n assert(\n `You should not specify both options.as and options.inverse as null on ${addedIdentifier.type}.${parentDefinition.inverseKey}, as if there is no inverse field there is no abstract type to conform to. You may have intended for this relationship to be polymorphic, or you may have mistakenly set inverse to null.`,\n !(meta.options.inverse === null && meta?.options.as?.length)\n );\n const errors = validateSchema(parentDefinition, meta);\n assert(\n `The schema for the relationship '${parentDefinition.inverseKey}' on '${\n addedIdentifier.type\n }' type does not correctly implement '${parentDefinition.type}' and thus cannot be assigned to the '${\n parentDefinition.key\n }' relationship in '${\n parentIdentifier.type\n }'. If using this record in this polymorphic relationship is desired, correct the errors in the schema shown below:${printSchema(\n meta,\n errors\n )}`,\n errors.size === 0\n );\n } else if (addedIdentifier.type !== parentDefinition.type) {\n // if we are not polymorphic\n // then the addedIdentifier.type must be the same as the parentDefinition.type\n let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);\n assert(\n `Expected the field ${parentDefinition.inverseKey} to be a relationship`,\n !meta || isRelationshipField(meta)\n );\n meta = meta && (isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta));\n if (meta?.options.as === parentDefinition.type) {\n // inverse is likely polymorphic but missing the polymorphic flag\n let meta = store.schema.fields({ type: parentDefinition.inverseType }).get(parentDefinition.key);\n assert(`Expected the field ${parentDefinition.key} to be a relationship`, meta && isRelationshipField(meta));\n meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);\n const errors = validateSchema(definitionWithPolymorphic(inverseDefinition(parentDefinition)), meta);\n assert(\n `The '<${addedIdentifier.type}>.${\n parentDefinition.inverseKey\n }' relationship cannot be used polymorphically because '<${parentDefinition.inverseType}>.${\n parentDefinition.key\n } is not a polymorphic relationship. To use this relationship in a polymorphic manner, fix the following schema issues on the relationships schema for '${\n parentDefinition.inverseType\n }':${printSchema(meta, errors)}`\n );\n } else {\n assert(\n `The '${addedIdentifier.type}' type does not implement '${parentDefinition.type}' and thus cannot be assigned to the '${parentDefinition.key}' relationship in '${parentIdentifier.type}'. If this relationship should be polymorphic, mark ${parentDefinition.inverseType}.${parentDefinition.key} as \\`polymorphic: true\\` and ${addedIdentifier.type}.${parentDefinition.inverseKey} as implementing it via \\`as: '${parentDefinition.type}'\\`.`\n );\n }\n }\n };\n}\n\nexport { assertPolymorphicType, assertInheritedSchema };\n","import { deprecate } from '@ember/debug';\n\nimport { DEBUG_RELATIONSHIP_NOTIFICATIONS, LOG_METRIC_COUNTS } from '@warp-drive/core/build-config/debugging';\nimport { DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE } 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 type { StableRecordIdentifier } from '../../../types.ts';\nimport type { ReplaceRelatedRecordsOperation } from '../../../types/graph.ts';\nimport { _add, _removeLocal, _removeRemote, diffCollection } from '../-diff.ts';\nimport { isBelongsTo, isHasMany, isNew, notifyChange } from '../-utils.ts';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type.ts';\nimport type { CollectionEdge } from '../edges/collection.ts';\nimport type { Graph } from '../graph.ts';\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\n/*\n case many:1\n ========\n In a bi-directional graph with Many:1 edges, adding a value\n results in up-to 3 discrete value transitions, while removing\n a value is only 2 transitions.\n\n For adding C to A\n If: A <<-> B, C <->> D is the initial state,\n and: B <->> A <<-> C, D is the final state\n\n then we would undergo the following transitions.\n\n add C to A\n remove C from D\n add A to C\n\n For removing B from A\n If: A <<-> B, C <->> D is the initial state,\n and: A, B, C <->> D is the final state\n\n then we would undergo the following transitions.\n\n remove B from A\n remove A from B\n\n case many:many\n ===========\n In a bi-directional graph with Many:Many edges, adding or\n removing a value requires only 2 value transitions.\n\n For Adding\n If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)\n And: D<<->>C<<->>A<<->>B is the final state\n\n Then we would undergo two transitions.\n\n add C to A.\n add A to C\n\n For Removing\n If: A<<->>B, C<<->>D is the initial state (double arrows representing the many side)\n And: A, B, C<<->>D is the final state\n\n Then we would undergo two transitions.\n\n remove B from A\n remove A from B\n\n case many:?\n ========\n In a uni-directional graph with Many:? edges (modeled in WarpDrive with `inverse:null`) with\n artificial (implicit) inverses, replacing a value results in 2 discrete value transitions.\n This is because a Many:? relationship is effectively Many:Many.\n */\nexport default function replaceRelatedRecords(graph: Graph, op: ReplaceRelatedRecordsOperation, isRemote: boolean) {\n if (isRemote) {\n replaceRelatedRecordsRemote(graph, op, isRemote);\n } else {\n replaceRelatedRecordsLocal(graph, op, isRemote);\n }\n}\n\nfunction replaceRelatedRecordsLocal(graph: Graph, op: ReplaceRelatedRecordsOperation, isRemote: boolean) {\n const identifiers = op.value;\n const relationship = graph.get(op.record, op.field);\n assert(`expected hasMany relationship`, isHasMany(relationship));\n\n relationship.state.hasReceivedData = true;\n const { additions, removals } = relationship;\n const { inverseKey, type } = relationship.definition;\n const { record } = op;\n const wasDirty = relationship.isDirty;\n let localBecameDirty = false;\n\n if (LOG_METRIC_COUNTS) {\n count(`replaceRelatedRecordsLocal ${'type' in record ? record.type : '<document>'} ${op.field}`);\n }\n\n const onAdd = (identifier: StableRecordIdentifier) => {\n // Since we are diffing against the remote state, we check\n // if our previous local state did not contain this identifier\n const removalsHas = removals?.has(identifier);\n if (removalsHas || !additions?.has(identifier)) {\n if (type !== identifier.type) {\n if (DEBUG) {\n assertPolymorphicType(relationship.identifier, relationship.definition, identifier, graph.store);\n }\n graph.registerPolymorphicType(type, identifier.type);\n }\n\n // we've added a record locally that wasn't in the local state before\n localBecameDirty = true;\n addToInverse(graph, identifier, inverseKey, op.record, isRemote);\n\n if (removalsHas) {\n removals!.delete(identifier);\n }\n }\n };\n\n const onRemove = (identifier: StableRecordIdentifier) => {\n // Since we are diffing against the remote state, we check\n // if our previous local state had contained this identifier\n const additionsHas = additions?.has(identifier);\n if (additionsHas || !removals?.has(identifier)) {\n // we've removed a record locally that was in the local state before\n localBecameDirty = true;\n removeFromInverse(graph, identifier, inverseKey, record, isRemote);\n\n if (additionsHas) {\n additions!.delete(identifier);\n }\n }\n };\n\n const diff = diffCollection(identifiers, relationship, onAdd, onRemove);\n\n // any additions no longer in the local state\n // also need to be removed from the inverse\n if (additions && additions.size > 0) {\n additions.forEach((identifier) => {\n if (!diff.add.has(identifier)) {\n localBecameDirty = true;\n onRemove(identifier);\n }\n });\n }\n\n // any removals no longer in the local state\n // also need to be added back to the inverse\n if (removals && removals.size > 0) {\n removals.forEach((identifier) => {\n if (!diff.del.has(identifier)) {\n localBecameDirty = true;\n onAdd(identifier);\n }\n });\n }\n\n const becameDirty = diff.changed || localBecameDirty;\n relationship.additions = diff.add;\n relationship.removals = diff.del;\n relationship.localState = diff.finalState;\n\n // we only notify if the localState changed and were not already dirty before\n // because if we were already dirty then we have already notified\n if (becameDirty && !wasDirty) {\n notifyChange(graph, relationship);\n }\n}\n\nfunction replaceRelatedRecordsRemote(graph: Graph, op: ReplaceRelatedRecordsOperation, isRemote: boolean) {\n const identifiers = op.value;\n const relationship = graph.get(op.record, op.field);\n\n if (LOG_METRIC_COUNTS) {\n count(`replaceRelatedRecordsRemote ${'type' in op.record ? op.record.type : '<document>'} ${op.field}`);\n }\n\n assert(\n `You can only '${op.op}' on a hasMany relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`,\n isHasMany(relationship)\n );\n if (isRemote) {\n graph._addToTransaction(relationship);\n }\n\n const wasDirty = relationship.isDirty;\n // if this is our first time receiving data\n // we need to mark the relationship as dirty\n // so that non-materializing APIs like `hasManyReference.value()`\n // will get notified and updated.\n if (!relationship.state.hasReceivedData) {\n relationship.isDirty = true;\n }\n relationship.state.hasReceivedData = true;\n\n // cache existing state\n const { definition } = relationship;\n\n const { type } = relationship.definition;\n\n const diff = diffCollection(\n identifiers,\n relationship,\n (identifier) => {\n if (type !== identifier.type) {\n if (DEBUG) {\n assertPolymorphicType(relationship.identifier, relationship.definition, identifier, graph.store);\n }\n graph.registerPolymorphicType(type, identifier.type);\n }\n // commit additions\n // TODO build this into the diff?\n // because we are not dirty if this was a committed local addition\n if (relationship.additions?.has(identifier)) {\n relationship.additions.delete(identifier);\n } else {\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n if (!relationship.isDirty) {\n // eslint-disable-next-line no-console\n console.log(\n `setting relationship to dirty because the remote addition was not in our previous list of local additions`\n );\n }\n }\n }\n addToInverse(graph, identifier, definition.inverseKey, op.record, isRemote);\n },\n (identifier) => {\n // commit removals\n // TODO build this into the diff?\n // because we are not dirty if this was a committed local addition\n if (relationship.removals?.has(identifier)) {\n relationship.removals.delete(identifier);\n } else {\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n if (!relationship.isDirty) {\n // eslint-disable-next-line no-console\n console.log(\n `setting relationship to dirty because the remote removal was not in our previous list of local removals`\n );\n }\n }\n }\n removeFromInverse(graph, identifier, definition.inverseKey, op.record, isRemote);\n }\n );\n\n // replace existing state\n relationship.remoteMembers = diff.finalSet;\n relationship.remoteState = diff.finalState;\n\n // changed also indicates a change in order\n if (diff.changed) {\n relationship.isDirty = true;\n }\n\n // TODO unsure if we need this but it\n // may allow us to more efficiently patch\n // the associated ManyArray\n relationship._diff = diff;\n\n if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n // only do this for legacy hasMany, not collection\n // and provide a way to incrementally migrate\n if (\n // we do not guard by diff.changed here\n // because we want to clear local changes even if\n // no change has occurred to preserve the legacy behavior\n relationship.definition.kind === 'hasMany' &&\n relationship.definition.resetOnRemoteUpdate !== false &&\n (diff.changed || wasDirty)\n ) {\n const deprecationInfo: {\n removals: StableRecordIdentifier[];\n additions: StableRecordIdentifier[];\n triggered: boolean;\n } = {\n removals: [],\n additions: [],\n triggered: false,\n };\n if (relationship.removals) {\n relationship.isDirty = true;\n relationship.removals.forEach((identifier) => {\n deprecationInfo.triggered = true;\n deprecationInfo.removals.push(identifier);\n // reverse the removal\n // if we are still in removals at this point then\n // we were not \"committed\" which means we are present\n // in the remoteMembers. So we \"add back\" on the inverse.\n addToInverse(graph, identifier, definition.inverseKey, op.record, false);\n });\n relationship.removals = null;\n }\n if (relationship.additions) {\n relationship.additions.forEach((identifier) => {\n // reverse the addition\n // if we are still in additions at this point then\n // we were not \"committed\" which means we are not present\n // in the remoteMembers. So we \"remove\" from the inverse.\n // however we only do this if we are not a \"new\" record.\n if (!isNew(identifier)) {\n deprecationInfo.triggered = true;\n deprecationInfo.additions.push(identifier);\n relationship.isDirty = true;\n relationship.additions!.delete(identifier);\n removeFromInverse(graph, identifier, definition.inverseKey, op.record, false);\n }\n });\n if (relationship.additions.size === 0) {\n relationship.additions = null;\n }\n }\n\n if (deprecationInfo.triggered) {\n deprecate(\n `WarpDrive is changing the default semantics of updates to the remote state of relationships.\\n\\nThe following local state was cleared from the <${\n relationship.identifier.type\n }>.${\n relationship.definition.key\n } hasMany relationship but will not be once this deprecation is resolved by opting into the new behavior:\\n\\n\\tAdded: [${deprecationInfo.additions\n .map((i) => i.lid)\n .join(', ')}]\\n\\tRemoved: [${deprecationInfo.removals.map((i) => i.lid).join(', ')}]`,\n false,\n {\n id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',\n for: 'ember-data',\n since: { enabled: '5.3', available: '4.13' },\n until: '6.0',\n url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state',\n }\n );\n }\n }\n }\n\n if (relationship.isDirty && !wasDirty) {\n flushCanonical(graph, relationship);\n }\n}\n\nexport function addToInverse(\n graph: Graph,\n identifier: StableRecordIdentifier,\n key: string,\n value: StableRecordIdentifier,\n isRemote: boolean\n) {\n const relationship = graph.get(identifier, key);\n const { type } = relationship.definition;\n\n if (type !== value.type) {\n if (DEBUG) {\n assertPolymorphicType(relationship.identifier, relationship.definition, value, graph.store);\n }\n graph.registerPolymorphicType(type, value.type);\n }\n\n if (isBelongsTo(relationship)) {\n relationship.state.hasReceivedData = true;\n relationship.state.isEmpty = false;\n\n if (isRemote) {\n graph._addToTransaction(relationship);\n if (relationship.remoteState !== null) {\n removeFromInverse(graph, relationship.remoteState, relationship.definition.inverseKey, identifier, isRemote);\n }\n relationship.remoteState = value;\n }\n\n if (relationship.localState !== value) {\n if (!isRemote && relationship.localState) {\n removeFromInverse(graph, relationship.localState, relationship.definition.inverseKey, identifier, isRemote);\n }\n relationship.localState = value;\n\n notifyChange(graph, relationship);\n }\n } else if (isHasMany(relationship)) {\n if (isRemote) {\n // TODO this needs to alert stuffs\n // And patch state better\n // This is almost definitely wrong\n // WARNING WARNING WARNING\n\n if (!relationship.remoteMembers.has(value)) {\n graph._addToTransaction(relationship);\n relationship.remoteState.push(value);\n relationship.remoteMembers.add(value);\n if (relationship.additions?.has(value)) {\n relationship.additions.delete(value);\n } else {\n relationship.isDirty = true;\n relationship.state.hasReceivedData = true;\n flushCanonical(graph, relationship);\n }\n }\n } else {\n // if we are not dirty but have a null localState then we\n // are mutating a relationship that has never been fetched\n // so we initialize localState to an empty array\n if (!relationship.isDirty && !relationship.localState) {\n relationship.localState = [];\n }\n\n if (_add(graph, identifier, relationship, value, null, isRemote)) {\n notifyChange(graph, relationship);\n }\n }\n } else {\n if (isRemote) {\n if (!relationship.remoteMembers.has(value)) {\n relationship.remoteMembers.add(value);\n relationship.localMembers.add(value);\n }\n } else {\n if (!relationship.localMembers.has(value)) {\n relationship.localMembers.add(value);\n }\n }\n }\n}\n\nexport function notifyInverseOfPotentialMaterialization(\n graph: Graph,\n identifier: StableRecordIdentifier,\n key: string,\n value: StableRecordIdentifier,\n isRemote: boolean\n) {\n const relationship = graph.get(identifier, key);\n if (isHasMany(relationship) && isRemote && relationship.remoteMembers.has(value)) {\n notifyChange(graph, relationship);\n }\n}\n\nexport function removeFromInverse(\n graph: Graph,\n identifier: StableRecordIdentifier,\n key: string,\n value: StableRecordIdentifier,\n isRemote: boolean\n) {\n const relationship = graph.get(identifier, key);\n\n if (isBelongsTo(relationship)) {\n relationship.state.isEmpty = true;\n if (isRemote) {\n graph._addToTransaction(relationship);\n relationship.remoteState = null;\n }\n if (relationship.localState === value) {\n relationship.localState = null;\n\n notifyChange(graph, relationship);\n }\n } else if (isHasMany(relationship)) {\n if (isRemote) {\n graph._addToTransaction(relationship);\n if (_removeRemote(relationship, value)) {\n notifyChange(graph, relationship);\n }\n } else {\n if (_removeLocal(relationship, value)) {\n notifyChange(graph, relationship);\n }\n }\n } else {\n if (isRemote) {\n relationship.remoteMembers.delete(value);\n relationship.localMembers.delete(value);\n } else {\n if (value && relationship.localMembers.has(value)) {\n relationship.localMembers.delete(value);\n }\n }\n }\n}\n\nfunction flushCanonical(graph: Graph, rel: CollectionEdge) {\n if (rel.accessed) {\n graph._scheduleLocalSync(rel);\n }\n}\n","import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE } 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 type { StableRecordIdentifier } from '../../../types.ts';\nimport type { ReplaceRelatedRecordOperation } from '../../../types/graph.ts';\nimport { isBelongsTo, isNew, notifyChange } from '../-utils.ts';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type.ts';\nimport type { Graph } from '../graph.ts';\nimport { addToInverse, notifyInverseOfPotentialMaterialization, removeFromInverse } from './replace-related-records.ts';\n\nexport default function replaceRelatedRecord(graph: Graph, op: ReplaceRelatedRecordOperation, isRemote = false) {\n const relationship = graph.get(op.record, op.field);\n assert(\n `You can only '${op.op}' on a belongsTo relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`,\n isBelongsTo(relationship)\n );\n if (isRemote) {\n graph._addToTransaction(relationship);\n }\n const { definition, state } = relationship;\n const prop = isRemote ? 'remoteState' : 'localState';\n const existingState: StableRecordIdentifier | null = relationship[prop];\n\n /*\n case 1:1\n ========\n In a bi-directional graph with 1:1 edges, replacing a value\n results in up-to 4 discrete value transitions.\n\n If: A <-> B, C <-> D is the initial state,\n and: A <-> C, B, D is the final state\n\n then we would undergo the following 4 transitions.\n\n remove A from B\n add C to A\n remove C from D\n add A to C\n\n case 1:many\n ===========\n In a bi-directional graph with 1:Many edges, replacing a value\n results in up-to 3 discrete value transitions.\n\n If: A<->>B<<->D, C<<->D is the initial state (double arrows representing the many side)\n And: A<->>C<<->D, B<<->D is the final state\n\n Then we would undergo three transitions.\n\n remove A from B\n add C to A.\n add A to C\n\n case 1:?\n ========\n In a uni-directional graph with 1:? edges (modeled in WarpDrive with `inverse:null`) with\n artificial (implicit) inverses, replacing a value results in up-to 3 discrete value transitions.\n This is because a 1:? relationship is effectively 1:many.\n\n If: A->B, C->B is the initial state\n And: A->C, C->B is the final state\n\n Then we would undergo three transitions.\n\n Remove A from B\n Add C to A\n Add A to C\n */\n\n // nothing for us to do\n if (op.value === existingState) {\n // if we were empty before but now know we are empty this needs to be true\n state.hasReceivedData = true;\n // if this is a remote update we still sync\n if (isRemote) {\n const { localState } = relationship;\n // don't sync if localState is a new record and our remoteState is null\n if (localState && isNew(localState) && !existingState) {\n return;\n }\n if (existingState && localState === existingState) {\n notifyInverseOfPotentialMaterialization(graph, existingState, definition.inverseKey, op.record, isRemote);\n } else if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n // if localState does not match existingState then we know\n // we have a local mutation that has not been persisted yet\n if (localState !== op.value && relationship.definition.resetOnRemoteUpdate !== false) {\n relationship.localState = existingState;\n\n deprecate(\n `WarpDrive is changing the default semantics of updates to the remote state of relationships.\\n\\nThe following local state was cleared from the <${\n relationship.identifier.type\n }>.${\n relationship.definition.key\n } belongsTo relationship but will not be once this deprecation is resolved:\\n\\n\\t${\n localState ? 'Added: ' + localState.lid + '\\n\\t' : ''\n }${existingState ? 'Removed: ' + existingState.lid : ''}`,\n false,\n {\n id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',\n for: 'ember-data',\n since: { enabled: '5.3', available: '4.13' },\n until: '6.0',\n url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state',\n }\n );\n\n notifyChange(graph, relationship);\n }\n }\n }\n return;\n }\n\n // remove this value from the inverse if required\n if (existingState) {\n removeFromInverse(graph, existingState, definition.inverseKey, op.record, isRemote);\n }\n\n // update value to the new value\n relationship[prop] = op.value;\n state.hasReceivedData = true;\n state.isEmpty = op.value === null;\n state.isStale = false;\n state.hasFailedLoadAttempt = false;\n\n if (op.value) {\n if (definition.type !== op.value.type) {\n // assert(\n // `The '<${definition.inverseType}>.${op.field}' relationship expects only '${definition.type}' records since it is not polymorphic. Received a Record of type '${op.value.type}'`,\n // definition.isPolymorphic\n // );\n\n // TODO this should now handle the deprecation warning if isPolymorphic is not set\n // but the record does turn out to be polymorphic\n // this should still assert if the user is relying on legacy inheritance/mixins to\n // provide polymorphic behavior and has not yet added the polymorphic flags\n if (DEBUG) {\n assertPolymorphicType(relationship.identifier, definition, op.value, graph.store);\n }\n\n graph.registerPolymorphicType(definition.type, op.value.type);\n }\n addToInverse(graph, op.value, definition.inverseKey, op.record, isRemote);\n }\n\n if (isRemote) {\n const { localState, remoteState } = relationship;\n if (localState && isNew(localState) && !remoteState) {\n return;\n }\n // when localState does not match the new remoteState and\n // localState === existingState then we had no local mutation\n // and we can safely sync the new remoteState to local\n if (localState !== remoteState && localState === existingState) {\n relationship.localState = remoteState;\n notifyChange(graph, relationship);\n // But when localState does not match the new remoteState and\n // and localState !== existingState then we know we have a local mutation\n // that has not been persisted yet.\n } else if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n if (\n localState !== remoteState &&\n localState !== existingState &&\n relationship.definition.resetOnRemoteUpdate !== false\n ) {\n relationship.localState = remoteState;\n\n deprecate(\n `WarpDrive is changing the default semantics of updates to the remote state of relationships.\\n\\nThe following local state was cleared from the <${\n relationship.identifier.type\n }>.${\n relationship.definition.key\n } belongsTo relationship but will not be once this deprecation is resolved:\\n\\n\\t${\n localState ? 'Added: ' + localState.lid + '\\n\\t' : ''\n }${existingState ? 'Removed: ' + existingState.lid : ''}`,\n false,\n {\n id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',\n for: 'ember-data',\n since: { enabled: '5.3', available: '4.13' },\n until: '6.0',\n url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state',\n }\n );\n\n notifyChange(graph, relationship);\n }\n }\n } else {\n notifyChange(graph, relationship);\n }\n}\n","import { deprecate } from '@ember/debug';\n\nimport { DEBUG_RELATIONSHIP_NOTIFICATIONS } from '@warp-drive/core/build-config/debugging';\nimport {\n DEPRECATE_NON_UNIQUE_PAYLOADS,\n DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE,\n} 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 type { StableRecordIdentifier } from '../../types/identifier.ts';\nimport { isBelongsTo, notifyChange } from './-utils.ts';\nimport { assertPolymorphicType } from './debug/assert-polymorphic-type.ts';\nimport type { CollectionEdge } from './edges/collection.ts';\nimport type { ResourceEdge } from './edges/resource.ts';\nimport type { Graph } from './graph.ts';\nimport replaceRelatedRecord from './operations/replace-related-record.ts';\nimport replaceRelatedRecords from './operations/replace-related-records.ts';\n\nfunction _deprecatedCompare<T>(\n priorLocalState: T[] | null,\n newState: T[],\n newMembers: Set<T>,\n prevState: T[],\n prevSet: Set<T>,\n onAdd: (v: T) => void,\n onDel: (v: T) => void,\n remoteClearsLocal: boolean\n): { duplicates: Map<T, number[]>; diff: Diff<T> } {\n const newLength = newState.length;\n const prevLength = prevState.length;\n const iterationLength = Math.max(newLength, prevLength);\n let changed: boolean = newMembers.size !== prevSet.size;\n let remoteOrderChanged = false;\n const added = new Set<T>();\n const removed = new Set<T>();\n const duplicates = new Map<T, number[]>();\n const finalSet = new Set<T>();\n const finalState: T[] = [];\n const priorLocalLength = priorLocalState?.length ?? 0;\n\n for (let i = 0, j = 0; i < iterationLength; i++) {\n let adv = false;\n let member: T | undefined;\n\n // accumulate anything added\n if (i < newLength) {\n member = newState[i];\n\n if (!finalSet.has(member)) {\n finalState[j] = member;\n finalSet.add(member);\n adv = true;\n\n if (!prevSet.has(member)) {\n // Avoid unnecessarily notifying a change that already exists locally\n if (i < priorLocalLength) {\n const priorLocalMember = priorLocalState![i];\n if (priorLocalMember !== member) {\n changed = true;\n }\n }\n added.add(member);\n onAdd(member);\n }\n } else {\n let list = duplicates.get(member);\n\n if (list === undefined) {\n list = [];\n duplicates.set(member, list);\n }\n\n list.push(i);\n }\n }\n\n // accumulate anything removed\n if (i < prevLength) {\n const prevMember = prevState[i];\n\n // detect reordering, adjusting index for duplicates\n // j is always less than i and so if i < prevLength, j < prevLength\n if (member !== prevState[j]) {\n // the new remote order does not match the current remote order\n // indicating a change in membership or reordering\n remoteOrderChanged = true;\n // however: if the new remote order matches the current local order\n // we can disregard the change notification generation so long as\n // we are not configured to reset on remote update (which is deprecated)\n if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n if (!remoteClearsLocal && i < priorLocalLength) {\n const priorLocalMember = priorLocalState![j];\n if (priorLocalMember !== member) {\n changed = true;\n }\n } else {\n changed = true;\n }\n } else {\n if (i < priorLocalLength) {\n const priorLocalMember = priorLocalState![j];\n if (priorLocalMember !== member) {\n changed = true;\n }\n } else {\n changed = true;\n }\n }\n\n // if remote order hasn't changed but local order differs\n // and we are configured to reset on remote update (which is deprecated)\n // then we still need to mark the relationship as changed\n } else if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n if (remoteClearsLocal) {\n if (!changed && j < priorLocalLength) {\n const priorLocalMember = priorLocalState![j];\n if (priorLocalMember !== member) {\n changed = true;\n }\n }\n }\n }\n\n if (!newMembers.has(prevMember)) {\n changed = true;\n removed.add(prevMember);\n onDel(prevMember);\n }\n } else if (adv && j < prevLength && member !== prevState[j]) {\n changed = true;\n }\n\n if (adv) {\n j++;\n }\n }\n\n const diff = {\n add: added,\n del: removed,\n finalState,\n finalSet,\n changed,\n remoteOrderChanged,\n };\n\n return {\n diff,\n duplicates,\n };\n}\n\nfunction _compare<T>(\n priorLocalState: T[] | null,\n finalState: T[],\n finalSet: Set<T>,\n prevState: T[],\n prevSet: Set<T>,\n onAdd: (v: T) => void,\n onDel: (v: T) => void,\n remoteClearsLocal: boolean\n): Diff<T> {\n const finalLength = finalState.length;\n const prevLength = prevState.length;\n const iterationLength = Math.max(finalLength, prevLength);\n const equalLength = priorLocalState ? finalLength === priorLocalState.length : finalLength === prevLength;\n let remoteOrderChanged = finalSet.size !== prevSet.size;\n let changed: boolean = priorLocalState ? finalSet.size !== priorLocalState.length : remoteOrderChanged;\n const added = new Set<T>();\n const removed = new Set<T>();\n const priorLocalLength = priorLocalState?.length ?? 0;\n\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n if (changed) {\n // console.log({\n // priorState: priorLocalState?.slice(),\n // finalState: finalState.slice(),\n // prevState: prevState.slice(),\n // });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n changed &&\n // eslint-disable-next-line no-console\n console.log(\n `changed because ${priorLocalState ? 'finalSet.size !== priorLocalState.length' : 'finalSet.size !== prevSet.size'}`\n );\n }\n\n for (let i = 0; i < iterationLength; i++) {\n let member: T | undefined;\n\n // accumulate anything added\n if (i < finalLength) {\n member = finalState[i];\n if (!prevSet.has(member)) {\n // Avoid unnecessarily notifying a change that already exists locally\n if (i < priorLocalLength) {\n const priorLocalMember = priorLocalState![i];\n if (priorLocalMember !== member) {\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n if (!changed) {\n // console.log({\n // priorLocalMember,\n // member,\n // i,\n // priorState: priorLocalState?.slice(),\n // finalState: finalState.slice(),\n // prevState: prevState.slice(),\n // });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console\n !changed && console.log(`changed because priorLocalMember !== member && !prevSet.has(member)`);\n }\n changed = true;\n }\n }\n added.add(member);\n onAdd(member);\n }\n }\n\n // accumulate anything removed\n if (i < prevLength) {\n const prevMember = prevState[i];\n\n // detect reordering\n if (equalLength && member !== prevMember) {\n // the new remote order does not match the current remote order\n // indicating a change in membership or reordering\n remoteOrderChanged = true;\n // however: if the new remote order matches the current local order\n // we can disregard the change notification generation so long as\n // we are not configured to reset on remote update (which is deprecated)\n\n if (i < priorLocalLength) {\n const priorLocalMember = priorLocalState![i];\n if (priorLocalMember !== member) {\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console\n !changed && console.log(`changed because priorLocalMember !== member && member !== prevMember`);\n }\n changed = true;\n }\n } else if (i < finalLength) {\n // if we have exceeded the length of priorLocalState and we are within the range\n // of the finalState then we must have changed\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console\n !changed && console.log(`changed because priorMember !== member && index >= priorLocalLength`);\n }\n changed = true;\n }\n\n // if remote order hasn't changed but local order differs\n // and we are configured to reset on remote update (which is deprecated)\n // then we still need to mark the relationship as changed\n } else if (DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE) {\n if (remoteClearsLocal) {\n if (equalLength && !changed && i < priorLocalLength) {\n const priorLocalMember = priorLocalState![i];\n if (priorLocalMember !== prevMember) {\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console\n !changed && console.log(`changed because priorLocalMember !== prevMember && remoteClearsLocal`);\n }\n changed = true;\n }\n }\n }\n }\n\n if (!finalSet.has(prevMember)) {\n // if we are within finalLength, we can only be \"changed\" if we've already exceeded\n // the index range of priorLocalState, as otherwise the previous member may still\n // be removed.\n //\n // prior local: [1, 2, 3, 4]\n // final state: [1, 2, 3]\n // prev remote state: [1, 2, 5, 3, 4]\n // i === 2\n // prevMember === 5\n // !finalSet.has(prevMember) === true\n //\n // because we will become changed at i===3,\n // we do not need to worry about becoming changed at i===2\n // as the arrays until now are still the same\n //\n // prior local: [1, 2, 3]\n // final state: [1, 2, 3, 4]\n // prev remote state: [1, 2, 5, 3, 4]\n // i === 2\n // prevMember === 5\n // !finalSet.has(prevMember) === true\n //\n // because we will become changed at i===3\n // we do not need to worry about becoming changed at i===2\n //\n // prior local: [1, 2, 3]\n // final state: [1, 2, 3]\n // prev remote state: [1, 2, 5, 3, 4]\n // i === 2\n // prevMember === 5\n // !finalSet.has(prevMember) === true\n //\n // because we have same length and same membership order\n // we do not need to worry about becoming changed at i===2\n //\n // if you do not have a priorLocalState you can't be changed\n // ergo, we never need to set changed in this branch.\n // this log can still be useful for debugging.\n if (DEBUG_RELATIONSHIP_NOTIFICATIONS) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n !changed &&\n // eslint-disable-next-line no-console\n console.log(`changed because i >= priorLocalLength && i < finalLength && !finalSet.has(prevMember)`);\n }\n //\n // we do still set remoteOrderChanged as it has\n remoteOrderChanged = true;\n removed.add(prevMember);\n onDel(prevMember);\n }\n }\n }\n\n return {\n add: added,\n del: removed,\n finalState,\n finalSet,\n changed,\n remoteOrderChanged,\n };\n}\n\ntype Diff<T> = {\n add: Set<T>;\n del: Set<T>;\n finalState: T[];\n finalSet: Set<T>;\n changed: boolean;\n remoteOrderChanged: boolean;\n};\n\nexport function diffCollection(\n finalState: StableRecordIdentifier[],\n relationship: CollectionEdge,\n onAdd: (v: StableRecordIdentifier) => void,\n onDel: (v: StableRecordIdentifier) => void\n): Diff<StableRecordIdentifier> {\n const finalSet = new Set(finalState);\n const { localState: priorLocalState, remoteState, remoteMembers } = relationship;\n\n if (DEPRECATE_NON_UNIQUE_PAYLOADS) {\n if (finalState.length !== finalSet.size) {\n const { diff, duplicates } = _deprecatedCompare(\n priorLocalState,\n finalState,\n finalSet,\n remoteState,\n remoteMembers,\n onAdd,\n onDel,\n relationship.definition.resetOnRemoteUpdate\n );\n\n if (DEBUG) {\n deprecate(\n `Expected all entries in the relationship ${relationship.definition.type}:${relationship.definition.key} to be unique, see log for a list of duplicate entry indeces`,\n false,\n {\n id: 'ember-data:deprecate-non-unique-relationship-entries',\n for: 'ember-data',\n until: '6.0',\n since: { available: '4.13', enabled: '5.3' },\n }\n );\n // eslint-disable-next-line no-console\n console.log(duplicates);\n }\n\n return diff;\n }\n } else {\n assert(\n `Expected all entries in the relationship to be unique, found duplicates`,\n finalState.length === finalSet.size\n );\n }\n\n return _compare(\n priorLocalState,\n finalState,\n finalSet,\n remoteState,\n remoteMembers,\n onAdd,\n onDel,\n relationship.definition.resetOnRemoteUpdate\n );\n}\n\nexport function computeLocalState(storage: CollectionEdge): StableRecordIdentifier[] {\n if (!storage.isDirty) {\n assert(`Expected localState to be present`, Array.isArray(storage.localState));\n return storage.localState;\n }\n\n const state = storage.remoteState.slice();\n\n storage.removals?.forEach((v) => {\n const index = state.indexOf(v);\n state.splice(index, 1);\n });\n\n storage.additions?.forEach((v) => {\n state.push(v);\n });\n storage.localState = state;\n storage.isDirty = false;\n\n return state;\n}\n\n/**\n * A function which attempts to add a value to the local state of a collection\n * relationship, and returns true if the value was added, or false if it was\n * already present.\n *\n * It will not generate a notification, will not update the relationships to dirty,\n * and will not update the inverse relationships, making it suitable for use as\n * an internal util to perform the just the addition to a specific side of a\n * relationship.\n *\n * @internal\n */\nexport function _add(\n graph: Graph,\n record: StableRecordIdentifier,\n relationship: CollectionEdge,\n value: StableRecordIdentifier,\n index: number | null,\n isRemote: boolean\n) {\n return !isRemote\n ? _addLocal(graph, record, relationship, value, index)\n : _addRemote(graph, record, relationship, value, index);\n}\n\nfunction _addRemote(\n graph: Graph,\n record: StableRecordIdentifier,\n relationship: CollectionEdge,\n value: StableRecordIdentifier,\n index: number | null\n) {\n assert(`expected an identifier to add to the collection relationship`, value);\n const { remoteMembers, additions, removals, remoteState } = relationship;\n\n assert(`Cannot add a resource that is already present`, !remoteMembers.has(value));\n if (remoteMembers.has(value)) {\n return false;\n }\n\n // add to the remote state\n remoteMembers.add(value);\n assert(\n `Cannot insert at an index that is not in bounds`,\n index === null || (index >= 0 && index < remoteState.length)\n );\n const hasValidIndex = index !== null && index >= 0 && index < remoteState.length;\n if (hasValidIndex) {\n remoteState.splice(index, 0, value);\n } else {\n remoteState.push(value);\n }\n\n // remove from additions if present\n if (additions?.has(value)) {\n additions.delete(value);\n\n // nothing more to do this was our state already\n return false;\n }\n\n assert(\n `Remote state indicated addition of a resource that was present only as a local mutation`,\n !removals?.has(value)\n );\n\n // if the relationship already needs to recalc, we don't bother\n // attempting to patch the localState\n if (relationship.isDirty) {\n return true;\n }\n\n // if we have existing localState\n // we attempt to patch it without blowing it away\n // as this is more efficient than recomputing\n // it allows us to preserve local ordering\n // to a small extent. Local ordering should not\n // be relied upon as any remote change could blow it away\n if (relationship.localState) {\n if (!hasValidIndex) {\n relationship.localState.push(value);\n } else if (index === 0) {\n relationship.localState.unshift(value);\n } else if (!removals?.size) {\n relationship.localState.splice(index, 0, value);\n } else {\n relationship.isDirty = true;\n }\n }\n\n return true;\n}\n\nfunction _addLocal(\n graph: Graph,\n record: StableRecordIdentifier,\n relationship: CollectionEdge,\n value: StableRecordIdentifier,\n index: number | null\n): boolean {\n const { remoteMembers, removals } = relationship;\n let additions = relationship.additions;\n const hasPresence = remoteMembers.has(value) || additions?.has(value);\n\n if (hasPresence && !removals?.has(value)) {\n assert(\n `Attempted to add the resource '${value.lid}' to the collection <${relationship.identifier.type}>.${relationship.definition.key} it was already in`,\n hasPresence && !removals?.has(value)\n );\n return false;\n }\n\n if (removals?.has(value)) {\n removals.delete(value);\n } else {\n if (!additions) {\n additions = relationship.additions = new Set();\n }\n\n relationship.state.hasReceivedData = true;\n additions.add(value);\n\n const { type } = relationship.definition;\n if (type !== value.type) {\n if (DEBUG) {\n assertPolymorphicType(record, relationship.definition, value, graph.store);\n }\n graph.registerPolymorphicType(value.type, type);\n }\n }\n\n // if we have existing localState\n // and we have an index\n // apply the change, as this is more efficient\n // than recomputing localState and\n // it allows us to preserve local ordering\n // to a small extend. Local ordering should not\n // be relied upon as any remote change will blow it away\n if (relationship.localState) {\n if (index !== null) {\n relationship.localState.splice(index, 0, value);\n } else {\n relationship.localState.push(value);\n }\n }\n\n return true;\n}\n\nexport function _remove(\n graph: Graph,\n record: StableRecordIdentifier,\n relationship: CollectionEdge,\n value: StableRecordIdentifier,\n index: number | null,\n isRemote: boolean\n): boolean {\n return !isRemote ? _removeLocal(relationship, value) : _removeRemote(relationship, value);\n}\n\nexport function _removeLocal(relationship: CollectionEdge, value: StableRecordIdentifier): boolean {\n assert(`expected an identifier to remove from the collection relationship`, value);\n const { remoteMembers, additions } = relationship;\n let removals = relationship.removals;\n const hasPresence = remoteMembers.has(value) || additions?.has(value);\n\n if (!hasPresence || removals?.has(value)) {\n assert(\n `Attempted to remove the resource '${value.lid}' from the collection <${relationship.identifier.type}>.${relationship.definition.key} but it was not present`,\n !hasPresence || removals?.has(value)\n );\n return false;\n }\n\n if (additions?.has(value)) {\n additions.delete(value);\n } else {\n if (!removals) {\n removals = relationship.removals = new Set();\n }\n\n removals.add(value);\n }\n\n // if we have existing localState\n // apply the change, as this is more efficient\n // than recomputing localState and\n // it allows us to preserve local ordering\n // to a small extend. Local ordering should not\n // be relied upon as any remote change will blow it away\n if (relationship.localState) {\n const index = relationship.localState.indexOf(value);\n assert(`Cannot remove a resource that is not present`, index !== -1);\n relationship.localState.splice(index, 1);\n }\n assert(\n `Expected relationship to be dirty when performing a local mutation`,\n relationship.localState || relationship.isDirty\n );\n\n return true;\n}\n\nexport function _removeRemote(relationship: CollectionEdge, value: StableRecordIdentifier): boolean {\n assert(`expected an identifier to remove from the collection relationship`, value);\n const { remoteMembers, additions, removals, remoteState } = relationship;\n\n assert(`Cannot remove a resource that is not present`, remoteMembers.has(value));\n if (!remoteMembers.has(value)) {\n return false;\n }\n\n // remove from remote state\n remoteMembers.delete(value);\n let index = remoteState.indexOf(value);\n assert(`Cannot remove a resource that is not present`, index !== -1);\n remoteState.splice(index, 1);\n\n // remove from removals if present\n if (removals?.has(value)) {\n removals.delete(value);\n\n // nothing more to do this was our state already\n return false;\n }\n\n assert(\n `Remote state indicated removal of a resource that was present only as a local mutation`,\n !additions?.has(value)\n );\n\n // if we have existing localState\n // and we have an index\n // apply the change, as this is more efficient\n // than recomputing localState and\n // it allows us to preserve local ordering\n // to a small extend. Local ordering should not\n // be relied upon as any remote change will blow it away\n if (relationship.localState) {\n index = relationship.localState.indexOf(value);\n assert(`Cannot remove a resource that is not present`, index !== -1);\n relationship.localState.splice(index, 1);\n }\n assert(\n `Expected relationship to be dirty when performing a local mutation`,\n relationship.localState || relationship.isDirty\n );\n\n return true;\n}\n\nexport function rollbackRelationship(\n graph: Graph,\n identifier: StableRecordIdentifier,\n field: string,\n relationship: CollectionEdge | ResourceEdge\n): void {\n if (isBelongsTo(relationship)) {\n replaceRelatedRecord(\n graph,\n {\n op: 'replaceRelatedRecord',\n record: identifier,\n field,\n value: relationship.remoteState,\n },\n false\n );\n } else {\n replaceRelatedRecords(\n graph,\n {\n op: 'replaceRelatedRecords',\n record: identifier,\n field,\n value: relationship.remoteState.slice(),\n },\n false\n );\n\n // when the change was a \"reorder\" only we wont have generated\n // a notification yet.\n // if we give rollback a unique operation we can use the ability of\n // diff to report a separate `remoteOrderChanged` flag to trigger this\n // if needed to avoid the duplicate.\n notifyChange(graph, relationship);\n }\n}\n","export interface RelationshipState {\n /*\n This flag indicates whether we should consider the content\n of this relationship \"known\".\n\n If we have no relationship knowledge, and the relationship\n is `async`, we will attempt to fetch the relationship on\n access if it is also stale.\n\n Snapshot uses this to tell the difference between unknown\n (`undefined`) or empty (`null`). The reason for this is that\n we wouldn't want to serialize unknown relationships as `null`\n as that might overwrite remote state.\n\n All relationships for a newly created (`store.createRecord()`) are\n considered known (`hasReceivedData === true`).\n\n true when\n => we receive a push with either new data or explicit empty (`[]` or `null`)\n => the relationship is a belongsTo and we have received data from\n the other side.\n\n false when\n => we have received no signal about what data belongs in this relationship\n => the relationship is a hasMany and we have only received data from\n the other side.\n */\n hasReceivedData: boolean;\n /*\n Flag that indicates whether an empty relationship is explicitly empty\n (signaled by push giving us an empty array or null relationship)\n e.g. an API response has told us that this relationship is empty.\n\n Thus far, it does not appear that we actually need this flag; however,\n @runspired has found it invaluable when debugging relationship tests\n to determine whether (and why if so) we are in an incorrect state.\n\n true when\n => we receive a push with explicit empty (`[]` or `null`)\n => we have received no signal about what data belongs in this relationship\n => on initial create (as no signal is known yet)\n\n false at all other times\n */\n\n isEmpty: boolean;\n /*\n This flag indicates whether we should\n re-fetch the relationship the next time\n it is accessed.\n\n The difference between this flag and `shouldForceReload`\n is in how we treat the presence of partially missing data:\n - for a forced reload, we will reload the link or EVERY record\n - for a stale reload, we will reload the link (if present) else only MISSING records\n\n Ideally these flags could be merged, but because we don't give the\n request layer the option of deciding how to resolve the data being queried\n we are forced to differentiate for now.\n\n It is also possible for a relationship to remain stale after a forced reload; however,\n in this case `state.hasFailedLoadAttempt` ought to be `true`.\n\n false when\n => cache.isNew(identifier) on initial setup\n => a previously triggered request has resolved\n => we get relationship data via push\n\n true when\n => !cache.isNew(identifier) on initial setup\n => an inverse has been unloaded\n => we get a new link for the relationship\n\n TODO @runspired unskip the acceptance tests and fix these flags\n */\n isStale: boolean;\n\n hasFailedLoadAttempt: boolean;\n /*\n This flag forces fetch. `true` for a single request once `reload()`\n has been called `false` at all other times.\n */\n shouldForceReload: boolean;\n /*\n This flag indicates whether we should\n **partially** re-fetch the relationship the\n next time it is accessed.\n\n false when\n => initial setup\n => a previously triggered request has resolved\n\n true when\n => an inverse has been unloaded\n */\n hasDematerializedInverse: boolean;\n\n // TODO do we want this anymore? Seems somewhat useful\n // especially if we rename to `hasUpdatedLink`\n // which would tell us slightly more about why the\n // relationship is stale\n // updatedLink: boolean;\n}\n\nexport function createState(): RelationshipState {\n return {\n hasReceivedData: false,\n isEmpty: true,\n isStale: false,\n hasFailedLoadAttempt: false,\n shouldForceReload: false,\n hasDematerializedInverse: false,\n };\n}\n","import type { CollectionRelationship } from '../../../types/cache/relationship.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { Links, Meta, PaginationLinks } from '../../../types/spec/json-api-raw.ts';\nimport { computeLocalState } from '../-diff.ts';\nimport type { UpgradedMeta } from '../-edge-definition.ts';\nimport type { RelationshipState } from '../-state.ts';\nimport { createState } from '../-state.ts';\n\nexport interface CollectionEdge {\n definition: UpgradedMeta;\n identifier: StableRecordIdentifier;\n state: RelationshipState;\n\n remoteMembers: Set<StableRecordIdentifier>;\n remoteState: StableRecordIdentifier[];\n\n additions: Set<StableRecordIdentifier> | null;\n removals: Set<StableRecordIdentifier> | null;\n\n meta: Meta | null;\n links: Links | PaginationLinks | null;\n\n localState: StableRecordIdentifier[] | null;\n /**\n * Whether the localState for this edge is out-of-sync\n * with the remoteState.\n *\n * if state.hasReceivedData=false we are also\n * not dirty since there is nothing to sync with.\n *\n */\n isDirty: boolean;\n transactionRef: number;\n /**\n * Whether data for this edge has been accessed at least once\n * via `graph.getData`\n *\n */\n accessed: boolean;\n\n _diff?: {\n add: Set<StableRecordIdentifier>;\n del: Set<StableRecordIdentifier>;\n };\n}\n\nexport function createCollectionEdge(definition: UpgradedMeta, identifier: StableRecordIdentifier): CollectionEdge {\n return {\n definition,\n identifier,\n state: createState(),\n remoteMembers: new Set(),\n remoteState: [],\n additions: null,\n removals: null,\n\n meta: null,\n links: null,\n\n localState: null,\n isDirty: false,\n transactionRef: 0,\n accessed: false,\n _diff: undefined,\n };\n}\n\nexport function legacyGetCollectionRelationshipData(\n source: CollectionEdge,\n getRemoteState: boolean\n): CollectionRelationship {\n source.accessed = true;\n const payload: CollectionRelationship = {};\n\n if (source.state.hasReceivedData) {\n payload.data = getRemoteState ? source.remoteState.slice() : computeLocalState(source);\n }\n\n if (source.links) {\n payload.links = source.links;\n }\n\n if (source.meta) {\n payload.meta = source.meta;\n }\n\n return payload;\n}\n","import type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { UpgradedMeta } from '../-edge-definition.ts';\n\nexport type ImplicitMeta = UpgradedMeta & { kind: 'implicit'; isImplicit: true };\n\nexport interface ImplicitEdge {\n definition: ImplicitMeta;\n identifier: StableRecordIdentifier;\n localMembers: Set<StableRecordIdentifier>;\n remoteMembers: Set<StableRecordIdentifier>;\n}\n\nexport function createImplicitEdge(definition: ImplicitMeta, identifier: StableRecordIdentifier): ImplicitEdge {\n return {\n definition,\n identifier,\n localMembers: new Set(),\n remoteMembers: new Set(),\n };\n}\n","import type { ResourceRelationship } from '../../../types/cache/relationship.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport type { Links, Meta, PaginationLinks } from '../../../types/spec/json-api-raw.ts';\nimport type { UpgradedMeta } from '../-edge-definition.ts';\nimport type { RelationshipState } from '../-state.ts';\nimport { createState } from '../-state.ts';\n\n/**\n * Stores the data for one side of a \"single\" resource relationship.\n *\n * @class ResourceEdge\n * @internal\n */\nexport interface ResourceEdge {\n definition: UpgradedMeta;\n identifier: StableRecordIdentifier;\n state: RelationshipState;\n localState: StableRecordIdentifier | null;\n remoteState: StableRecordIdentifier | null;\n meta: Meta | null;\n links: Links | PaginationLinks | null;\n transactionRef: number;\n accessed: boolean;\n}\n\nexport function createResourceEdge(definition: UpgradedMeta, identifier: StableRecordIdentifier): ResourceEdge {\n return {\n definition,\n identifier,\n state: createState(),\n transactionRef: 0,\n localState: null,\n remoteState: null,\n meta: null,\n links: null,\n accessed: false,\n };\n}\n\nexport function legacyGetResourceRelationshipData(source: ResourceEdge, getRemoteState: boolean): ResourceRelationship {\n source.accessed = true;\n let data: StableRecordIdentifier | null | undefined;\n const payload: ResourceRelationship = {};\n if (getRemoteState && source.remoteState) {\n data = source.remoteState;\n } else if (!getRemoteState && source.localState) {\n data = source.localState;\n }\n if (((getRemoteState && source.remoteState === null) || source.localState === null) && source.state.hasReceivedData) {\n data = null;\n }\n\n if (source.links) {\n payload.links = source.links;\n }\n if (data !== undefined) {\n payload.data = data;\n }\n if (source.meta) {\n payload.meta = source.meta;\n }\n\n return payload;\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { AddToResourceRelationshipMutation } from '../../../types/cache/mutations.ts';\nimport type { AddToResourceRelationshipOperation } from '../../../types/cache/operations.ts';\nimport type { ReplaceRelatedRecordOperation } from '../../../types/graph.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport { _add } from '../-diff.ts';\nimport { isBelongsTo, isHasMany, notifyChange } from '../-utils.ts';\nimport type { CollectionEdge } from '../edges/collection.ts';\nimport type { Graph } from '../graph.ts';\nimport replaceRelatedRecord from './replace-related-record.ts';\nimport { addToInverse } from './replace-related-records.ts';\n\nexport default function addToRelatedRecords(\n graph: Graph,\n op: AddToResourceRelationshipOperation | AddToResourceRelationshipMutation,\n isRemote: boolean\n) {\n const { record, value, index } = op;\n const relationship = graph.get(record, op.field);\n\n const _isBelongsTo = isBelongsTo(relationship);\n if (isRemote && _isBelongsTo) {\n if (value !== relationship.remoteState) {\n const newOp: ReplaceRelatedRecordOperation = {\n op: 'replaceRelatedRecord',\n record,\n field: op.field,\n value: value as StableRecordIdentifier,\n };\n return replaceRelatedRecord(graph, newOp, isRemote);\n }\n assert(\n `Expected '${value?.lid}' (the value to add) to NOT be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`,\n value === relationship.remoteState\n );\n return;\n }\n\n assert(\n `You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`,\n isHasMany(relationship)\n );\n\n // if we are not dirty but have a null localState then we\n // are mutating a relationship that has never been fetched\n // so we initialize localState to an empty array\n if (!relationship.isDirty && !relationship.localState) {\n relationship.localState = [];\n }\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n addRelatedRecord(graph, relationship, record, value[i], index !== undefined ? index + i : null, isRemote);\n }\n } else {\n addRelatedRecord(graph, relationship, record, value, index ?? null, isRemote);\n }\n\n notifyChange(graph, relationship);\n}\n\nfunction addRelatedRecord(\n graph: Graph,\n relationship: CollectionEdge,\n record: StableRecordIdentifier,\n value: StableRecordIdentifier,\n index: number | null,\n isRemote: boolean\n) {\n assert(`expected an identifier to add to the collection relationship`, value);\n\n if (_add(graph, record, relationship, value, index, isRemote)) {\n addToInverse(graph, value, relationship.definition.inverseKey, record, isRemote);\n }\n}\n","import type { MergeOperation } from '../../../types/cache/operations.ts';\nimport { forAllRelatedIdentifiers, isBelongsTo, isHasMany, notifyChange } from '../-utils.ts';\nimport type { CollectionEdge } from '../edges/collection.ts';\nimport type { ImplicitEdge } from '../edges/implicit.ts';\nimport type { ResourceEdge } from '../edges/resource.ts';\nimport type { Graph, GraphEdge } from '../graph.ts';\n\nexport function mergeIdentifier(graph: Graph, op: MergeOperation, relationships: Record<string, GraphEdge>) {\n Object.keys(relationships).forEach((key) => {\n const rel = relationships[key];\n if (!rel) {\n return;\n }\n mergeIdentifierForRelationship(graph, op, rel);\n });\n}\n\nfunction mergeIdentifierForRelationship(graph: Graph, op: MergeOperation, rel: GraphEdge): void {\n rel.identifier = op.value;\n forAllRelatedIdentifiers(rel, (identifier) => {\n const inverse = graph.get(identifier, rel.definition.inverseKey);\n mergeInRelationship(graph, inverse, op);\n });\n}\n\nfunction mergeInRelationship(graph: Graph, rel: GraphEdge, op: MergeOperation): void {\n if (isBelongsTo(rel)) {\n mergeBelongsTo(graph, rel, op);\n } else if (isHasMany(rel)) {\n mergeHasMany(graph, rel, op);\n } else {\n mergeImplicit(graph, rel, op);\n }\n}\n\nfunction mergeBelongsTo(graph: Graph, rel: ResourceEdge, op: MergeOperation): void {\n if (rel.remoteState === op.record) {\n rel.remoteState = op.value;\n }\n if (rel.localState === op.record) {\n rel.localState = op.value;\n notifyChange(graph, rel);\n }\n}\n\nfunction mergeHasMany(graph: Graph, rel: CollectionEdge, op: MergeOperation): void {\n if (rel.remoteMembers.has(op.record)) {\n rel.remoteMembers.delete(op.record);\n rel.remoteMembers.add(op.value);\n const index = rel.remoteState.indexOf(op.record);\n rel.remoteState.splice(index, 1, op.value);\n rel.isDirty = true;\n }\n if (rel.additions?.has(op.record)) {\n rel.additions.delete(op.record);\n rel.additions.add(op.value);\n rel.isDirty = true;\n }\n if (rel.removals?.has(op.record)) {\n rel.removals.delete(op.record);\n rel.removals.add(op.value);\n rel.isDirty = true;\n }\n if (rel.isDirty) {\n notifyChange(graph, rel);\n }\n}\n\nfunction mergeImplicit(graph: Graph, rel: ImplicitEdge, op: MergeOperation): void {\n if (rel.remoteMembers.has(op.record)) {\n rel.remoteMembers.delete(op.record);\n rel.remoteMembers.add(op.value);\n }\n if (rel.localMembers.has(op.record)) {\n rel.localMembers.delete(op.record);\n rel.localMembers.add(op.value);\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { RemoveFromResourceRelationshipMutation } from '../../../types/cache/mutations.ts';\nimport type { RemoveFromResourceRelationshipOperation } from '../../../types/cache/operations.ts';\nimport type { ReplaceRelatedRecordOperation } from '../../../types/graph.ts';\nimport type { StableRecordIdentifier } from '../../../types/identifier.ts';\nimport { _remove } from '../-diff.ts';\nimport { isBelongsTo, isHasMany, notifyChange } from '../-utils.ts';\nimport type { CollectionEdge } from '../edges/collection.ts';\nimport type { Graph } from '../graph.ts';\nimport replaceRelatedRecord from './replace-related-record.ts';\nimport { removeFromInverse } from './replace-related-records.ts';\n\nexport default function removeFromRelatedRecords(\n graph: Graph,\n op: RemoveFromResourceRelationshipOperation | RemoveFromResourceRelationshipMutation,\n isRemote: boolean\n) {\n const { record, value } = op;\n const relationship = graph.get(record, op.field);\n\n const _isBelongsTo = isBelongsTo(relationship);\n if (isRemote && _isBelongsTo) {\n if (value === relationship.remoteState) {\n const newOp: ReplaceRelatedRecordOperation = {\n op: 'replaceRelatedRecord',\n record,\n field: op.field,\n value: null,\n };\n return replaceRelatedRecord(graph, newOp, isRemote);\n }\n assert(\n `Expected '${(value as StableRecordIdentifier)?.lid}' (the value to remove) to be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`,\n value === relationship.remoteState\n );\n return;\n }\n\n assert(\n `You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`,\n isHasMany(relationship)\n );\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n removeRelatedRecord(graph, record, relationship, value[i], op.index ?? null, isRemote);\n }\n } else {\n removeRelatedRecord(graph, record, relationship, value, op.index ?? null, isRemote);\n }\n\n notifyChange(graph, relationship);\n}\n\nfunction removeRelatedRecord(\n graph: Graph,\n record: StableRecordIdentifier,\n relationship: CollectionEdge,\n value: StableRecordIdentifier,\n index: number | null,\n isRemote: boolean\n) {\n assert(`expected an identifier to remove from the collection relationship`, value);\n if (_remove(graph, record, relationship, value, index, isRemote)) {\n removeFromInverse(graph, value, relationship.definition.inverseKey, record, isRemote);\n }\n}\n","import type { Link, LinkObject } from '../../types/spec/json-api-raw.ts';\n\n/*\n This method normalizes a link to an \"links object\". If the passed link is\n already an object it's returned without any modifications.\n\n See http://jsonapi.org/format/#document-links for more information.\n*/\nexport default function _normalizeLink(link: Link): LinkObject | null {\n switch (typeof link) {\n case 'object':\n return link;\n case 'string':\n return { href: link };\n }\n}\n","import { warn } from '@ember/debug';\n\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport type { Store } from '../../../index.ts';\nimport type { StableRecordIdentifier } from '../../../types.ts';\nimport type { UpdateResourceRelationshipOperation } from '../../../types/cache/operations.ts';\nimport type { UpdateRelationshipOperation } from '../../../types/graph.ts';\nimport type {\n ExistingResourceIdentifierObject,\n NewResourceIdentifierObject,\n} from '../../../types/spec/json-api-raw.ts';\nimport { isBelongsTo, isHasMany, notifyChange } from '../-utils.ts';\nimport type { Graph } from '../graph.ts';\nimport _normalizeLink from '../normalize-link.ts';\n\ntype IdentifierCache = Store['identifierCache'];\n\n/*\n Updates the \"canonical\" or \"remote\" state of a relationship, replacing any existing\n state and blowing away any local changes (excepting new records).\n*/\nexport default function updateRelationshipOperation(\n graph: Graph,\n op: UpdateRelationshipOperation | UpdateResourceRelationshipOperation\n) {\n const relationship = graph.get(op.record, op.field);\n assert(`Cannot update an implicit relationship`, isHasMany(relationship) || isBelongsTo(relationship));\n const { definition, state, identifier } = relationship;\n const { isCollection } = definition;\n\n const payload = op.value;\n\n let hasRelationshipDataProperty = false;\n let hasUpdatedLink = false;\n\n if (payload.meta) {\n relationship.meta = payload.meta;\n }\n\n if (payload.data !== undefined) {\n hasRelationshipDataProperty = true;\n if (isCollection) {\n // TODO deprecate this case. We\n // have tests saying we support it.\n if (payload.data === null) {\n payload.data = [];\n }\n assert(`Expected an array`, Array.isArray(payload.data));\n const cache = graph.store.identifierCache;\n graph.update(\n {\n op: 'replaceRelatedRecords',\n record: identifier,\n field: op.field,\n value: upgradeIdentifiers(payload.data, cache),\n },\n true\n );\n } else {\n graph.update(\n {\n op: 'replaceRelatedRecord',\n record: identifier,\n field: op.field,\n value: payload.data\n ? graph.store.identifierCache.upgradeIdentifier(payload.data as ExistingResourceIdentifierObject)\n : null,\n },\n true\n );\n }\n } else if (definition.isAsync === false && !state.hasReceivedData) {\n hasRelationshipDataProperty = true;\n\n if (isCollection) {\n graph.update(\n {\n op: 'replaceRelatedRecords',\n record: identifier,\n field: op.field,\n value: [],\n },\n true\n );\n } else {\n graph.update(\n {\n op: 'replaceRelatedRecord',\n record: identifier,\n field: op.field,\n value: null,\n },\n true\n );\n }\n }\n\n if (payload.links) {\n const originalLinks = relationship.links;\n relationship.links = payload.links;\n if (payload.links.related) {\n const relatedLink = _normalizeLink(payload.links.related);\n const currentLink = originalLinks && originalLinks.related ? _normalizeLink(originalLinks.related) : null;\n const currentLinkHref = currentLink ? currentLink.href : null;\n\n if (relatedLink && relatedLink.href && relatedLink.href !== currentLinkHref) {\n warn(\n `You pushed a record of type '${identifier.type}' with a relationship '${definition.key}' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload. WarpDrive will treat this relationship as known-to-be-empty.`,\n definition.isAsync || state.hasReceivedData,\n {\n id: 'ds.store.push-link-for-sync-relationship',\n }\n );\n assert(\n `You have pushed a record of type '${identifier.type}' with '${definition.key}' as a link, but the value of that link is not a string.`,\n typeof relatedLink.href === 'string' || relatedLink.href === null\n );\n hasUpdatedLink = true;\n }\n }\n }\n\n /*\n Data being pushed into the relationship might contain only data or links,\n or a combination of both.\n\n IF contains only data\n IF contains both links and data\n state.isEmpty -> true if is empty array (has-many) or is null (belongs-to)\n state.hasReceivedData -> true\n hasDematerializedInverse -> false\n state.isStale -> false\n allInverseRecordsAreLoaded -> run-check-to-determine\n\n IF contains only links\n state.isStale -> true\n */\n relationship.state.hasFailedLoadAttempt = false;\n if (hasRelationshipDataProperty) {\n const relationshipIsEmpty = payload.data === null || (Array.isArray(payload.data) && payload.data.length === 0);\n\n // we don't need to notify here as the update op we pushed in above will notify once\n // membership is in the correct state.\n relationship.state.hasReceivedData = true;\n relationship.state.isStale = false;\n relationship.state.hasDematerializedInverse = false;\n relationship.state.isEmpty = relationshipIsEmpty;\n } else if (hasUpdatedLink) {\n // only notify stale if we have not previously received membership data.\n // within this same transaction\n // this prevents refetching when only one side of the relationship in the\n // payload contains the info while the other side contains just a link\n // this only works when the side with just a link is a belongsTo, as we\n // don't know if a hasMany has full information or not.\n // see #7049 for context.\n if (\n isCollection ||\n !relationship.state.hasReceivedData ||\n isStaleTransaction(relationship.transactionRef, graph._transaction)\n ) {\n relationship.state.isStale = true;\n\n notifyChange(graph, relationship);\n } else {\n relationship.state.isStale = false;\n }\n }\n}\n\nfunction isStaleTransaction(relationshipTransactionId: number, graphTransactionId: number | null) {\n return (\n relationshipTransactionId === 0 || // relationship has never notified\n graphTransactionId === null || // we are not in a transaction\n relationshipTransactionId < graphTransactionId // we are not part of the current transaction\n );\n}\n\nexport function upgradeIdentifiers(\n arr: (ExistingResourceIdentifierObject | NewResourceIdentifierObject | StableRecordIdentifier)[],\n cache: IdentifierCache\n): StableRecordIdentifier[] {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = cache.upgradeIdentifier(arr[i]);\n }\n return arr as StableRecordIdentifier[];\n}\n","import { LOG_GRAPH } 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 type { CacheCapabilitiesManager, StableRecordIdentifier } from '../../types.ts';\nimport { getOrSetGlobal, peekTransient, setTransient } from '../../types/-private.ts';\nimport type { RelationshipDiff } from '../../types/cache.ts';\nimport type { MergeOperation } from '../../types/cache/operations.ts';\nimport type { CollectionRelationship, ResourceRelationship } from '../../types/cache/relationship.ts';\nimport type {\n DeleteRecordOperation,\n LocalRelationshipOperation,\n RemoteRelationshipOperation,\n UnknownOperation,\n} from '../../types/graph.ts';\nimport { rollbackRelationship } from './-diff.ts';\nimport type { EdgeCache, UpgradedMeta } from './-edge-definition.ts';\nimport { isLHS, upgradeDefinition } from './-edge-definition.ts';\nimport {\n assertValidRelationshipPayload,\n forAllRelatedIdentifiers,\n getStore,\n isBelongsTo,\n isHasMany,\n isImplicit,\n isNew,\n notifyChange,\n removeIdentifierCompletelyFromRelationship,\n} from './-utils.ts';\nimport { type CollectionEdge, createCollectionEdge, legacyGetCollectionRelationshipData } from './edges/collection.ts';\nimport type { ImplicitEdge, ImplicitMeta } from './edges/implicit.ts';\nimport { createImplicitEdge } from './edges/implicit.ts';\nimport { createResourceEdge, legacyGetResourceRelationshipData, type ResourceEdge } from './edges/resource.ts';\nimport addToRelatedRecords from './operations/add-to-related-records.ts';\nimport { mergeIdentifier } from './operations/merge-identifier.ts';\nimport removeFromRelatedRecords from './operations/remove-from-related-records.ts';\nimport replaceRelatedRecord from './operations/replace-related-record.ts';\nimport replaceRelatedRecords from './operations/replace-related-records.ts';\nimport updateRelationshipOperation from './operations/update-relationship.ts';\n\nexport type GraphEdge = ImplicitEdge | CollectionEdge | ResourceEdge;\n\nexport const Graphs = getOrSetGlobal('Graphs', new Map<CacheCapabilitiesManager, Graph>());\n\ntype PendingOps = {\n belongsTo?: Map<string, Map<string, RemoteRelationshipOperation[]>>;\n hasMany?: Map<string, Map<string, RemoteRelationshipOperation[]>>;\n deletions: DeleteRecordOperation[];\n};\n\n/*\n * Graph acts as the cache for relationship data. It allows for\n * us to ask about and update relationships for a given Identifier\n * without requiring other objects for that Identifier to be\n * instantiated (such as `RecordData` or a `Record`)\n *\n * This also allows for us to make more substantive changes to relationships\n * with increasingly minor alterations to other portions of the internals\n * over time.\n *\n * The graph is made up of nodes and edges. Each unique identifier gets\n * its own node, which is a dictionary with a list of that node's edges\n * (or connections) to other nodes. In `Model` terms, a node represents a\n * record instance, with each key (an edge) in the dictionary correlating\n * to either a `hasMany` or `belongsTo` field on that record instance.\n *\n * The value for each key, or `edge` is the identifier(s) the node relates\n * to in the graph from that key.\n */\nexport class Graph {\n declare _definitionCache: EdgeCache;\n declare _metaCache: Record<string, Record<string, UpgradedMeta>>;\n declare _potentialPolymorphicTypes: Record<string, Record<string, boolean>>;\n declare identifiers: Map<StableRecordIdentifier, Record<string, GraphEdge>>;\n declare store: CacheCapabilitiesManager;\n declare isDestroyed: boolean;\n declare _willSyncRemote: boolean;\n declare _willSyncLocal: boolean;\n declare silenceNotifications: boolean;\n declare _pushedUpdates: PendingOps;\n declare _updatedRelationships: Set<CollectionEdge>;\n declare _transaction: number | null;\n declare _removing: StableRecordIdentifier | null;\n\n constructor(store: CacheCapabilitiesManager) {\n this._definitionCache = Object.create(null) as EdgeCache;\n this._metaCache = Object.create(null) as Record<string, Record<string, UpgradedMeta>>;\n this._potentialPolymorphicTypes = Object.create(null) as Record<string, Record<string, boolean>>;\n this.identifiers = new Map();\n this.store = store;\n this.isDestroyed = false;\n this._willSyncRemote = false;\n this._willSyncLocal = false;\n this._pushedUpdates = {\n belongsTo: undefined,\n hasMany: undefined,\n deletions: [],\n };\n this._updatedRelationships = new Set();\n this._transaction = null;\n this._removing = null;\n this.silenceNotifications = false;\n }\n\n has(identifier: StableRecordIdentifier, propertyName: string): boolean {\n const relationships = this.identifiers.get(identifier);\n if (!relationships) {\n return false;\n }\n return relationships[propertyName] !== undefined;\n }\n\n getDefinition(identifier: StableRecordIdentifier, propertyName: string): UpgradedMeta {\n let defs = this._metaCache[identifier.type];\n let meta: UpgradedMeta | null | undefined = defs?.[propertyName];\n if (!meta) {\n const info = /*#__NOINLINE__*/ upgradeDefinition(this, identifier, propertyName);\n assert(`Could not determine relationship information for ${identifier.type}.${propertyName}`, info !== null);\n\n // if (info.rhs_definition?.kind === 'implicit') {\n // we should possibly also do this\n // but it would result in being extremely permissive for other relationships by accident\n // this.registerPolymorphicType(info.rhs_baseModelName, identifier.type);\n // }\n\n meta = /*#__NOINLINE__*/ isLHS(info, identifier.type, propertyName) ? info.lhs_definition : info.rhs_definition!;\n defs = this._metaCache[identifier.type] = defs || {};\n defs[propertyName] = meta;\n }\n return meta;\n }\n\n get(identifier: StableRecordIdentifier, propertyName: string): GraphEdge {\n assert(`expected propertyName`, propertyName);\n let relationships = this.identifiers.get(identifier);\n if (!relationships) {\n relationships = Object.create(null) as Record<string, GraphEdge>;\n this.identifiers.set(identifier, relationships);\n }\n\n let relationship = relationships[propertyName];\n if (!relationship) {\n const meta = this.getDefinition(identifier, propertyName);\n\n if (meta.kind === 'belongsTo') {\n relationship = relationships[propertyName] = createResourceEdge(meta, identifier);\n } else if (meta.kind === 'hasMany') {\n relationship = relationships[propertyName] = createCollectionEdge(meta, identifier);\n } else {\n assert(`Expected kind to be implicit`, meta.kind === 'implicit' && meta.isImplicit === true);\n relationship = relationships[propertyName] = createImplicitEdge(meta as ImplicitMeta, identifier);\n }\n }\n\n return relationship;\n }\n\n getData(identifier: StableRecordIdentifier, propertyName: string): ResourceRelationship | CollectionRelationship {\n const relationship = this.get(identifier, propertyName);\n\n assert(`Cannot getData() on an implicit relationship`, !isImplicit(relationship));\n\n if (isBelongsTo(relationship)) {\n return legacyGetResourceRelationshipData(relationship, false);\n }\n\n return legacyGetCollectionRelationshipData(relationship, false);\n }\n\n getRemoteData(\n identifier: StableRecordIdentifier,\n propertyName: string\n ): ResourceRelationship | CollectionRelationship {\n const relationship = this.get(identifier, propertyName);\n\n assert(`Cannot getRemoteData() on an implicit relationship`, !isImplicit(relationship));\n\n if (isBelongsTo(relationship)) {\n return legacyGetResourceRelationshipData(relationship, true);\n }\n\n return legacyGetCollectionRelationshipData(relationship, true);\n }\n\n /*\n * Allows for the graph to dynamically discover polymorphic connections\n * without needing to walk prototype chains.\n *\n * Used by edges when an added `type` does not match the expected `type`\n * for that edge.\n *\n * Currently we assert before calling this. For a public API we will want\n * to call out to the schema manager to ask if we should consider these\n * types as equivalent for a given relationship.\n */\n registerPolymorphicType(type1: string, type2: string): void {\n const typeCache = this._potentialPolymorphicTypes;\n let t1 = typeCache[type1];\n if (!t1) {\n t1 = typeCache[type1] = Object.create(null) as Record<string, boolean>;\n }\n t1[type2] = true;\n\n let t2 = typeCache[type2];\n if (!t2) {\n t2 = typeCache[type2] = Object.create(null) as Record<string, boolean>;\n }\n t2[type1] = true;\n }\n\n /*\n TODO move this comment somewhere else\n implicit relationships are relationships which have not been declared but the inverse side exists on\n another record somewhere\n\n For example if there was:\n\n ```js [app/models/comment.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class Comment extends Model {\n @attr text;\n }\n ```\n\n and there is also:\n\n ```js [app/models/post.js]\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Post extends Model {\n @attr title;\n @hasMany('comment', { async: true, inverse: null }) comments;\n }\n ```\n\n Then we would have a implicit 'post' relationship for the comment record in order\n to be do things like remove the comment from the post if the comment were to be deleted.\n */\n\n isReleasable(identifier: StableRecordIdentifier): boolean {\n const relationships = this.identifiers.get(identifier);\n if (!relationships) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: RELEASABLE ${String(identifier)}`);\n }\n return true;\n }\n const keys = Object.keys(relationships);\n for (let i = 0; i < keys.length; i++) {\n const relationship: GraphEdge = relationships[keys[i]];\n // account for previously unloaded relationships\n // typically from a prior deletion of a record that pointed to this one implicitly\n if (relationship === undefined) {\n continue;\n }\n assert(`Expected a relationship`, relationship);\n if (relationship.definition.inverseIsAsync && !isNew(identifier)) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: <<NOT>> RELEASABLE ${String(identifier)}`);\n }\n return false;\n }\n }\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: RELEASABLE ${String(identifier)}`);\n }\n return true;\n }\n\n unload(identifier: StableRecordIdentifier, silenceNotifications?: boolean) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: unload ${String(identifier)}`);\n }\n const relationships = this.identifiers.get(identifier);\n\n if (relationships) {\n // cleans up the graph but retains some nodes\n // to allow for rematerialization\n Object.keys(relationships).forEach((key) => {\n const rel = relationships[key];\n if (!rel) {\n return;\n }\n /*#__NOINLINE__*/ destroyRelationship(this, rel, silenceNotifications);\n if (/*#__NOINLINE__*/ isImplicit(rel)) {\n // @ts-expect-error\n relationships[key] = undefined;\n }\n });\n }\n }\n\n _isDirty(identifier: StableRecordIdentifier, field: string): boolean {\n const relationships = this.identifiers.get(identifier);\n if (!relationships) {\n return false;\n }\n const relationship = relationships[field];\n if (!relationship) {\n return false;\n }\n if (isBelongsTo(relationship)) {\n return relationship.localState !== relationship.remoteState;\n } else if (isHasMany(relationship)) {\n const hasAdditions = relationship.additions !== null && relationship.additions.size > 0;\n const hasRemovals = relationship.removals !== null && relationship.removals.size > 0;\n return hasAdditions || hasRemovals || isReordered(relationship);\n }\n return false;\n }\n\n getChanged(identifier: StableRecordIdentifier): Map<string, RelationshipDiff> {\n const relationships = this.identifiers.get(identifier);\n const changed = new Map<string, RelationshipDiff>();\n\n if (!relationships) {\n return changed;\n }\n\n const keys = Object.keys(relationships);\n for (let i = 0; i < keys.length; i++) {\n const field = keys[i];\n const relationship = relationships[field];\n if (!relationship) {\n continue;\n }\n if (isBelongsTo(relationship)) {\n if (relationship.localState !== relationship.remoteState) {\n changed.set(field, {\n kind: 'resource',\n remoteState: relationship.remoteState,\n localState: relationship.localState,\n });\n }\n } else if (isHasMany(relationship)) {\n const hasAdditions = relationship.additions !== null && relationship.additions.size > 0;\n const hasRemovals = relationship.removals !== null && relationship.removals.size > 0;\n const reordered = isReordered(relationship);\n\n if (hasAdditions || hasRemovals || reordered) {\n changed.set(field, {\n kind: 'collection',\n additions: new Set(relationship.additions),\n removals: new Set(relationship.removals),\n remoteState: relationship.remoteState,\n localState: legacyGetCollectionRelationshipData(relationship, false).data || [],\n reordered,\n });\n }\n }\n }\n\n return changed;\n }\n\n hasChanged(identifier: StableRecordIdentifier): boolean {\n const relationships = this.identifiers.get(identifier);\n if (!relationships) {\n return false;\n }\n const keys = Object.keys(relationships);\n for (let i = 0; i < keys.length; i++) {\n if (this._isDirty(identifier, keys[i])) {\n return true;\n }\n }\n return false;\n }\n\n rollback(identifier: StableRecordIdentifier): string[] {\n const relationships = this.identifiers.get(identifier);\n const changed: string[] = [];\n if (!relationships) {\n return changed;\n }\n const keys = Object.keys(relationships);\n for (let i = 0; i < keys.length; i++) {\n const field = keys[i];\n const relationship = relationships[field];\n if (!relationship) {\n continue;\n }\n\n if (this._isDirty(identifier, field)) {\n rollbackRelationship(this, identifier, field, relationship as CollectionEdge | ResourceEdge);\n changed.push(field);\n }\n }\n\n return changed;\n }\n\n remove(identifier: StableRecordIdentifier) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: remove ${String(identifier)}`);\n }\n assert(`Cannot remove ${String(identifier)} while still removing ${String(this._removing)}`, !this._removing);\n this._removing = identifier;\n this.unload(identifier);\n this.identifiers.delete(identifier);\n this._removing = null;\n }\n\n /*\n * Remote state changes\n */\n push(op: RemoteRelationshipOperation) {\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: push ${String(op.record)}`, op);\n }\n if (op.op === 'deleteRecord') {\n this._pushedUpdates.deletions.push(op);\n } else {\n const definition = this.getDefinition(op.record, op.field);\n assert(`Cannot push a remote update for an implicit relationship`, definition.kind !== 'implicit');\n addPending(this._pushedUpdates, definition, op);\n }\n if (!this._willSyncRemote) {\n this._willSyncRemote = true;\n const store = getStore(this.store);\n if (!store._cbs) {\n store._run(() => this._flushRemoteQueue());\n } else {\n store._schedule('coalesce', () => this._flushRemoteQueue());\n }\n }\n }\n\n /*\n * Local state changes\n */\n update(op: RemoteRelationshipOperation | MergeOperation, isRemote: true): void;\n update(op: LocalRelationshipOperation, isRemote?: false): void;\n update(\n op: MergeOperation | LocalRelationshipOperation | RemoteRelationshipOperation | UnknownOperation,\n isRemote = false\n ): void {\n assert(\n `Cannot update an implicit relationship`,\n op.op === 'deleteRecord' || op.op === 'mergeIdentifiers' || !isImplicit(this.get(op.record, op.field))\n );\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`graph: update (${isRemote ? 'remote' : 'local'}) ${String(op.record)}`, op);\n }\n\n switch (op.op) {\n case 'mergeIdentifiers': {\n const relationships = this.identifiers.get(op.record);\n if (relationships) {\n /*#__NOINLINE__*/ mergeIdentifier(this, op, relationships);\n }\n break;\n }\n case 'update':\n case 'updateRelationship':\n assert(`Can only perform the operation updateRelationship on remote state`, isRemote);\n if (DEBUG) {\n // in debug, assert payload validity eagerly\n // TODO add deprecations/assertion here for duplicates\n assertValidRelationshipPayload(this, op);\n }\n /*#__NOINLINE__*/ updateRelationshipOperation(this, op);\n break;\n case 'deleteRecord': {\n assert(`Can only perform the operation deleteRelationship on remote state`, isRemote);\n const identifier = op.record;\n const relationships = this.identifiers.get(identifier);\n\n if (relationships) {\n Object.keys(relationships).forEach((key) => {\n const rel = relationships[key];\n if (!rel) {\n return;\n }\n // works together with the has check\n // @ts-expect-error\n relationships[key] = undefined;\n /*#__NOINLINE__*/ removeCompletelyFromInverse(this, rel);\n });\n this.identifiers.delete(identifier);\n }\n break;\n }\n case 'replaceRelatedRecord':\n /*#__NOINLINE__*/ replaceRelatedRecord(this, op, isRemote);\n break;\n case 'add':\n /*#__NOINLINE__*/ addToRelatedRecords(this, op, isRemote);\n break;\n case 'remove':\n /*#__NOINLINE__*/ removeFromRelatedRecords(this, op, isRemote);\n break;\n case 'replaceRelatedRecords':\n /*#__NOINLINE__*/ replaceRelatedRecords(this, op, isRemote);\n break;\n default:\n assert(`No local relationship update operation exists for '${op.op}'`);\n }\n }\n\n _scheduleLocalSync(relationship: CollectionEdge) {\n this._updatedRelationships.add(relationship);\n if (!this._willSyncLocal) {\n this._willSyncLocal = true;\n getStore(this.store)._schedule('sync', () => this._flushLocalQueue());\n }\n }\n\n _flushRemoteQueue() {\n if (!this._willSyncRemote) {\n return;\n }\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(`Graph: Initialized Transaction`);\n }\n let transactionRef = peekTransient<number>('transactionRef') ?? 0;\n this._transaction = ++transactionRef;\n setTransient('transactionRef', transactionRef);\n this._willSyncRemote = false;\n const updates = this._pushedUpdates;\n const { deletions, hasMany, belongsTo } = updates;\n updates.deletions = [];\n updates.hasMany = undefined;\n updates.belongsTo = undefined;\n\n for (let i = 0; i < deletions.length; i++) {\n this.update(deletions[i], true);\n }\n\n if (hasMany) {\n flushPending(this, hasMany);\n }\n if (belongsTo) {\n flushPending(this, belongsTo);\n }\n\n this._transaction = null;\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`Graph: transaction finalized`);\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n }\n\n _addToTransaction(relationship: CollectionEdge | ResourceEdge) {\n assert(`expected a transaction`, this._transaction !== null);\n if (LOG_GRAPH) {\n // eslint-disable-next-line no-console\n console.log(`Graph: ${String(relationship.identifier)} ${relationship.definition.key} added to transaction`);\n }\n relationship.transactionRef = this._transaction;\n }\n\n _flushLocalQueue() {\n if (!this._willSyncLocal) {\n return;\n }\n\n if (this.silenceNotifications) {\n this.silenceNotifications = false;\n this._updatedRelationships = new Set();\n return;\n }\n\n this._willSyncLocal = false;\n const updated = this._updatedRelationships;\n this._updatedRelationships = new Set();\n updated.forEach((rel) => notifyChange(this, rel));\n }\n\n destroy() {\n Graphs.delete(this.store);\n\n if (DEBUG) {\n Graphs.delete(getStore(this.store) as unknown as CacheCapabilitiesManager);\n if (Graphs.size) {\n Graphs.forEach((_, key) => {\n assert(\n `Memory Leak Detected, likely the test or app instance previous to this was not torn down properly`,\n !(key as unknown as { isDestroyed: boolean }).isDestroyed &&\n !(key as unknown as { isDestroying: boolean }).isDestroying\n );\n });\n }\n }\n\n this.identifiers.clear();\n this.store = null as unknown as CacheCapabilitiesManager;\n this.isDestroyed = true;\n }\n}\n\nfunction flushPending(graph: Graph, ops: Map<string, Map<string, RemoteRelationshipOperation[]>>) {\n ops.forEach((type) => {\n type.forEach((opList) => {\n flushPendingList(graph, opList);\n });\n });\n}\nfunction flushPendingList(graph: Graph, opList: RemoteRelationshipOperation[]) {\n for (let i = 0; i < opList.length; i++) {\n graph.update(opList[i], true);\n }\n}\n\n// Handle dematerialization for relationship `rel`. In all cases, notify the\n// relationship of the dematerialization: this is done so the relationship can\n// notify its inverse which needs to update state\n//\n// If the inverse is sync, unloading this record is treated as a client-side\n// delete, so we remove the inverse records from this relationship to\n// disconnect the graph. Because it's not async, we don't need to keep around\n// the identifier as an id-wrapper for references\nfunction destroyRelationship(graph: Graph, rel: GraphEdge, silenceNotifications?: boolean) {\n if (isImplicit(rel)) {\n if (graph.isReleasable(rel.identifier)) {\n /*#__NOINLINE__*/ removeCompletelyFromInverse(graph, rel);\n }\n return;\n }\n\n const { identifier } = rel;\n const { inverseKey } = rel.definition;\n\n if (!rel.definition.inverseIsImplicit) {\n /*#__NOINLINE__*/ forAllRelatedIdentifiers(rel, (inverseIdentifer: StableRecordIdentifier) =>\n /*#__NOINLINE__*/ notifyInverseOfDematerialization(\n graph,\n inverseIdentifer,\n inverseKey,\n identifier,\n silenceNotifications\n )\n );\n }\n\n if (!rel.definition.inverseIsImplicit && !rel.definition.inverseIsAsync) {\n rel.state.isStale = true;\n /*#__NOINLINE__*/ clearRelationship(rel);\n\n // necessary to clear relationships in the ui from dematerialized records\n // hasMany is managed by Model which calls `retreiveLatest` after\n // dematerializing the resource-cache instance.\n // but sync belongsTo requires this since they don't have a proxy to update.\n // so we have to notify so it will \"update\" to null.\n // we should discuss whether we still care about this, probably fine to just\n // leave the ui relationship populated since the record is destroyed and\n // internally we've fully cleaned up.\n if (!rel.definition.isAsync && !silenceNotifications) {\n /*#__NOINLINE__*/ notifyChange(graph, rel);\n }\n }\n}\n\nfunction notifyInverseOfDematerialization(\n graph: Graph,\n inverseIdentifier: StableRecordIdentifier,\n inverseKey: string,\n identifier: StableRecordIdentifier,\n silenceNotifications?: boolean\n) {\n if (!graph.has(inverseIdentifier, inverseKey)) {\n return;\n }\n\n const relationship = graph.get(inverseIdentifier, inverseKey);\n assert(`expected no implicit`, !isImplicit(relationship));\n\n // For remote members, it is possible that inverseRecordData has already been associated to\n // to another record. For such cases, do not dematerialize the inverseRecordData\n if (!isBelongsTo(relationship) || !relationship.localState || identifier === relationship.localState) {\n /*#__NOINLINE__*/ removeDematerializedInverse(graph, relationship, identifier, silenceNotifications);\n }\n}\n\nfunction clearRelationship(relationship: CollectionEdge | ResourceEdge) {\n if (isBelongsTo(relationship)) {\n relationship.localState = null;\n relationship.remoteState = null;\n relationship.state.hasReceivedData = false;\n relationship.state.isEmpty = true;\n } else {\n relationship.remoteMembers.clear();\n relationship.remoteState = [];\n relationship.additions = null;\n relationship.removals = null;\n relationship.localState = null;\n }\n}\n\nfunction removeDematerializedInverse(\n graph: Graph,\n relationship: CollectionEdge | ResourceEdge,\n inverseIdentifier: StableRecordIdentifier,\n silenceNotifications?: boolean\n) {\n if (isBelongsTo(relationship)) {\n const localInverse = relationship.localState;\n if (!relationship.definition.isAsync || (localInverse && isNew(localInverse))) {\n // unloading inverse of a sync relationship is treated as a client-side\n // delete, so actually remove the models don't merely invalidate the cp\n // cache.\n // if the record being unloaded only exists on the client, we similarly\n // treat it as a client side delete\n if (relationship.localState === localInverse && localInverse !== null) {\n relationship.localState = null;\n }\n\n if (relationship.remoteState === localInverse && localInverse !== null) {\n relationship.remoteState = null;\n relationship.state.hasReceivedData = true;\n relationship.state.isEmpty = true;\n if (relationship.localState && !isNew(relationship.localState)) {\n relationship.localState = null;\n }\n }\n } else {\n relationship.state.hasDematerializedInverse = true;\n }\n\n if (!silenceNotifications) {\n notifyChange(graph, relationship);\n }\n } else {\n if (!relationship.definition.isAsync || (inverseIdentifier && isNew(inverseIdentifier))) {\n // unloading inverse of a sync relationship is treated as a client-side\n // delete, so actually remove the models don't merely invalidate the cp\n // cache.\n // if the record being unloaded only exists on the client, we similarly\n // treat it as a client side delete\n /*#__NOINLINE__*/ removeIdentifierCompletelyFromRelationship(graph, relationship, inverseIdentifier);\n } else {\n relationship.state.hasDematerializedInverse = true;\n }\n\n if (!silenceNotifications) {\n notifyChange(graph, relationship);\n }\n }\n}\n\nfunction removeCompletelyFromInverse(graph: Graph, relationship: GraphEdge) {\n const { identifier } = relationship;\n const { inverseKey } = relationship.definition;\n\n forAllRelatedIdentifiers(relationship, (inverseIdentifier: StableRecordIdentifier) => {\n if (graph.has(inverseIdentifier, inverseKey)) {\n removeIdentifierCompletelyFromRelationship(graph, graph.get(inverseIdentifier, inverseKey), identifier);\n }\n });\n\n if (isBelongsTo(relationship)) {\n if (!relationship.definition.isAsync) {\n clearRelationship(relationship);\n }\n\n relationship.localState = null;\n } else if (isHasMany(relationship)) {\n if (!relationship.definition.isAsync) {\n clearRelationship(relationship);\n\n notifyChange(graph, relationship);\n }\n } else {\n relationship.remoteMembers.clear();\n relationship.localMembers.clear();\n }\n}\n\nfunction addPending(\n cache: PendingOps,\n definition: UpgradedMeta,\n op: RemoteRelationshipOperation & { field: string }\n): void {\n const cacheForKind = (cache[definition.kind as 'hasMany' | 'belongsTo'] =\n cache[definition.kind as 'hasMany' | 'belongsTo'] || new Map<string, Map<string, RemoteRelationshipOperation[]>>());\n\n let cacheForType = cacheForKind.get(definition.inverseType);\n if (!cacheForType) {\n cacheForType = new Map<string, RemoteRelationshipOperation[]>();\n cacheForKind.set(definition.inverseType, cacheForType);\n }\n\n let cacheForField = cacheForType.get(op.field);\n if (!cacheForField) {\n cacheForField = [];\n cacheForType.set(op.field, cacheForField);\n }\n\n cacheForField.push(op);\n}\n\nfunction isReordered(relationship: CollectionEdge): boolean {\n // if we are dirty we are never re-ordered because accessing\n // the state would flush away any reordering.\n if (relationship.isDirty) {\n return false;\n }\n\n const { remoteState, localState, additions, removals } = relationship;\n\n if (localState === null) {\n // the relationship has never been accessed, so it hasn't been reordered either\n return false;\n }\n\n for (let i = 0, j = 0; i < remoteState.length; i++) {\n const member = remoteState[i];\n const localMember = localState[j];\n\n if (member !== localMember) {\n if (removals && removals.has(member)) {\n // dont increment j because we want to skip this\n continue;\n }\n if (additions && additions.has(localMember)) {\n // increment j to skip this localMember\n // decrement i to repeat this remoteMember\n j++;\n i--;\n continue;\n }\n return true;\n }\n\n // if we made it here, increment j\n j++;\n }\n\n return false;\n}\n","/**\nProvides a performance tuned normalized graph for intelligently managing relationships between resources based on identity\n\nWhile this Graph is abstract, it currently is a private implementation required as a peer-dependency by the {JSON:API} Cache Implementation.\n\nWe intend to make this Graph public API after some additional iteration during the 5.x timeframe, until then all APIs should be considered experimental and unstable, not fit for direct application or 3rd party library usage.\n\n @module\n*/\nimport { DEBUG } from '@warp-drive/core/build-config/env';\n\nimport type { Store } from '../index.ts';\nimport type { CacheCapabilitiesManager } from '../types.ts';\nimport { getStore } from './-private/-utils.ts';\nimport { Graph, Graphs } from './-private/graph.ts';\n\nexport { isBelongsTo } from './-private/-utils.ts';\nexport type { CollectionEdge } from './-private/edges/collection.ts';\nexport type { ResourceEdge } from './-private/edges/resource.ts';\nexport type { ImplicitEdge } from './-private/edges/implicit.ts';\nexport type { GraphEdge } from './-private/graph.ts';\nexport type { UpgradedMeta } from './-private/-edge-definition.ts';\nexport type { Graph };\n\nfunction isStore(maybeStore: unknown): maybeStore is Store {\n return (maybeStore as Store)._instanceCache !== undefined;\n}\n\nfunction getWrapper(store: CacheCapabilitiesManager | Store): CacheCapabilitiesManager {\n return isStore(store) ? store._instanceCache._storeWrapper : store;\n}\n\nexport function peekGraph(store: CacheCapabilitiesManager | Store): Graph | undefined {\n return Graphs.get(getWrapper(store));\n}\nexport type peekGraph = typeof peekGraph;\n\nexport function graphFor(store: CacheCapabilitiesManager | Store): Graph {\n const wrapper = getWrapper(store);\n let graph = Graphs.get(wrapper);\n\n if (!graph) {\n graph = new Graph(wrapper);\n Graphs.set(wrapper, graph);\n getStore(wrapper)._graph = graph;\n\n if (DEBUG) {\n if (getStore(wrapper).isDestroying) {\n throw new Error(`Memory Leak Detected During Teardown`);\n }\n }\n }\n return graph;\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","getStore","wrapper","_store","expandingGet","cache","key1","key2","mainCache","Object","create","expandingSet","value","assertValidRelationshipPayload","graph","op","relationship","get","record","field","isHasMany","isBelongsTo","payload","definition","identifier","state","type","isAsync","kind","links","warn","data","hasReceivedData","inspect","Array","isArray","assertRelationshipData","store","i","Date","RegExp","Map","Set","isNew","peekCache","Boolean","isImplicit","forAllRelatedIdentifiers","rel","cb","remoteState","localState","inverseIdentifier","additions","forEach","localMembers","remoteMembers","has","removeIdentifierCompletelyFromRelationship","silenceNotifications","notifyChange","delete","wasInRemovals","removals","canonicalIndex","indexOf","splice","currentIndex","accessed","key","_removing","activeLogging","LOG_GRAPH","debug","globalThis","getWarpDriveRuntimeConfig","console","log","meta","schema","hasResource","RELATIONSHIP_KINDS","isLegacyField","isRelationshipField","includes","temporaryConvertToLegacy","name","options","assign","async","inverse","resetOnRemoteUpdate","BOOL_LATER","STR_LATER","IMPLICIT_KEY_RAND","now","implicitKeyFor","syncMeta","inverseDefinition","inverseKind","inverseKey","inverseType","inverseIsAsync","inverseIsCollection","isCollection","inverseIsPolymorphic","isPolymorphic","inverseIsImplicit","inverseIsLinksMode","isLinksMode","upgradeMeta","niceMeta","polymorphic","linksMode","assertConfiguration","info","isSelfReferential","_isRHS","rhs_relationshipName","rhs_baseModelName","lhs_isPolymorphic","rhs_modelNames","_isLHS","lhs_relationshipName","lhs_baseModelName","rhs_isPolymorphic","lhs_modelNames","assertInheritedSchema","lhs_definition","isLHS","isRelationship","upgradeDefinition","propertyName","_definitionCache","storeWrapper","polymorphicLookup","_potentialPolymorphicTypes","cached","relationships","fields","altTypes","keys","_cached","push","modelFor","inverseForRelationship","inverseDefinitions","metaFromInverse","lhs_key","rhs_key","rhs_definition","hasInverse","isReflexive","baseType","modelNames","assertPolymorphicType","validateSchema","errors","set","as","expectedSchema","printSchema","config","metaFrom","inverseMetaFrom","definitionWithPolymorphic","meta1","meta2","errors1","errors2","size","parentIdentifier","parentDefinition","addedIdentifier","count","label","__WarpDriveMetricCountData","replaceRelatedRecords","isRemote","replaceRelatedRecordsRemote","replaceRelatedRecordsLocal","identifiers","wasDirty","isDirty","localBecameDirty","LOG_METRIC_COUNTS","onAdd","removalsHas","registerPolymorphicType","addToInverse","onRemove","additionsHas","removeFromInverse","diff","diffCollection","add","del","becameDirty","changed","finalState","_addToTransaction","DEBUG_RELATIONSHIP_NOTIFICATIONS","finalSet","_diff","DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE","deprecationInfo","triggered","map","lid","join","url","flushCanonical","isEmpty","_add","notifyInverseOfPotentialMaterialization","_removeRemote","_removeLocal","_scheduleLocalSync","replaceRelatedRecord","prop","existingState","isStale","hasFailedLoadAttempt","_deprecatedCompare","priorLocalState","newState","newMembers","prevState","prevSet","onDel","remoteClearsLocal","newLength","prevLength","iterationLength","Math","max","remoteOrderChanged","added","removed","duplicates","priorLocalLength","j","adv","member","priorLocalMember","list","prevMember","_compare","finalLength","equalLength","DEPRECATE_NON_UNIQUE_PAYLOADS","computeLocalState","storage","slice","v","index","_addLocal","_addRemote","hasValidIndex","unshift","hasPresence","_remove","rollbackRelationship","createState","shouldForceReload","hasDematerializedInverse","createCollectionEdge","transactionRef","legacyGetCollectionRelationshipData","source","getRemoteState","createImplicitEdge","createResourceEdge","legacyGetResourceRelationshipData","addToRelatedRecords","_isBelongsTo","newOp","addRelatedRecord","mergeIdentifier","mergeIdentifierForRelationship","mergeInRelationship","mergeBelongsTo","mergeHasMany","mergeImplicit","removeFromRelatedRecords","removeRelatedRecord","_normalizeLink","link","href","updateRelationshipOperation","hasRelationshipDataProperty","hasUpdatedLink","identifierCache","update","upgradeIdentifiers","upgradeIdentifier","originalLinks","related","relatedLink","currentLink","currentLinkHref","relationshipIsEmpty","isStaleTransaction","_transaction","relationshipTransactionId","graphTransactionId","arr","Graphs","getOrSetGlobal","Graph","constructor","_metaCache","isDestroyed","_willSyncRemote","_willSyncLocal","_pushedUpdates","belongsTo","hasMany","deletions","_updatedRelationships","getDefinition","defs","getData","getRemoteData","type1","type2","typeCache","t1","t2","isReleasable","unload","destroyRelationship","_isDirty","hasAdditions","hasRemovals","isReordered","getChanged","reordered","hasChanged","rollback","remove","addPending","_cbs","_run","_flushRemoteQueue","_schedule","removeCompletelyFromInverse","_flushLocalQueue","groupCollapsed","peekTransient","setTransient","updates","flushPending","groupEnd","updated","destroy","_","isDestroying","clear","ops","opList","flushPendingList","inverseIdentifer","notifyInverseOfDematerialization","clearRelationship","removeDematerializedInverse","localInverse","cacheForKind","cacheForType","cacheForField","localMember","isStore","maybeStore","_instanceCache","getWrapper","_storeWrapper","peekGraph","graphFor","_graph"],"mappings":";;;;;;;;AAaO,SAASA,QAAQA,CAACC,EAA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