@warp-drive/core 5.8.0-alpha.37 → 5.8.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/index.d.ts +0 -4
- package/dist/{index-D4si_DxB.js → index-BKcD4JZK.js} +12 -8
- package/dist/index.js +1 -1
- package/dist/reactive.js +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/types/-private.js +1 -1
- package/dist/unpkg/{prod-deprecated/symbols-sql1_mdx.js → dev/-private-3C1OkYtZ.js} +1 -1
- package/dist/unpkg/{dev-deprecated/configure-C3x8YXzL.js → dev/configure-BC66sfNO.js} +13 -11
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/graph/-private.js +206 -449
- package/dist/unpkg/dev/{index-D4si_DxB.js → index-DqhXrNZ_.js} +741 -1327
- package/dist/unpkg/dev/index.js +5 -7
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +4 -6
- package/dist/unpkg/{dev-deprecated/request-oqoLC9rz.js → dev/request-CA9K0gXq.js} +10 -16
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/runtime-DGG4CvlW.js +135 -0
- package/dist/unpkg/dev/store/-private.js +56 -2
- package/dist/unpkg/dev/store.js +558 -1
- package/dist/unpkg/dev/types/-private.js +5 -15
- package/dist/unpkg/dev/types/identifier.js +1 -3
- package/dist/unpkg/dev/utils/string.js +5 -6
- package/dist/unpkg/dev-deprecated/{symbols-sql1_mdx.js → -private-3C1OkYtZ.js} +1 -1
- package/dist/unpkg/{prod-deprecated/configure-C3x8YXzL.js → dev-deprecated/configure-BC66sfNO.js} +13 -11
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +216 -264
- package/dist/unpkg/dev-deprecated/{index-D4si_DxB.js → index-BBlq5is_.js} +834 -805
- package/dist/unpkg/dev-deprecated/index.js +4 -7
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +4 -6
- package/dist/unpkg/{prod-deprecated/request-oqoLC9rz.js → dev-deprecated/request-CA9K0gXq.js} +10 -16
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/runtime-DfhJzpZH.js +135 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +2 -2
- package/dist/unpkg/dev-deprecated/store.js +558 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +5 -15
- package/dist/unpkg/dev-deprecated/types/identifier.js +1 -3
- package/dist/unpkg/dev-deprecated/utils/string.js +5 -6
- package/dist/unpkg/{dev/symbols-sql1_mdx.js → prod/-private-3C1OkYtZ.js} +1 -1
- package/dist/unpkg/prod/{configure-C3x8YXzL.js → configure-C0C1LpG6.js} +5 -28
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +4 -1144
- package/dist/unpkg/prod/handler-LAyD1Y5l.js +1619 -0
- package/dist/unpkg/prod/hooks-BfiqDg3O.js +26 -0
- package/dist/unpkg/prod/index.js +481 -8
- package/dist/unpkg/prod/promise-state-ipG60SdD.js +6738 -0
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +5 -7
- package/dist/unpkg/prod/request-CN2LxbYX.js +437 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/store/-private.js +127 -2
- package/dist/unpkg/prod/store.js +437 -1
- package/dist/unpkg/prod/types/-private.js +4 -34
- package/dist/unpkg/prod/types/identifier.js +2 -4
- package/dist/unpkg/prod/utils/string.js +0 -20
- package/dist/unpkg/{prod/symbols-sql1_mdx.js → prod-deprecated/-private-3C1OkYtZ.js} +1 -1
- package/dist/unpkg/{dev/configure-C3x8YXzL.js → prod-deprecated/configure-BQ8CpIcW.js} +4 -27
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +12 -979
- package/dist/unpkg/prod-deprecated/handler-D639oFvl.js +334 -0
- package/dist/unpkg/prod-deprecated/hooks-DGvi9teJ.js +26 -0
- package/dist/unpkg/prod-deprecated/index.js +481 -8
- package/dist/unpkg/prod-deprecated/{index-D4si_DxB.js → promise-state-CYvoIPna.js} +278 -3566
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +4 -7
- package/dist/unpkg/prod-deprecated/request-CN2LxbYX.js +437 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/store/-private.js +89 -2
- package/dist/unpkg/prod-deprecated/store.js +437 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +4 -34
- package/dist/unpkg/prod-deprecated/types/identifier.js +2 -4
- package/dist/unpkg/prod-deprecated/utils/string.js +0 -20
- package/package.json +11 -19
- package/dist/unpkg/dev/declarations/build-config/babel-macros.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config/canary-features.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config/debugging.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config/deprecations.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config/env.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config/macros.d.ts +0 -1
- package/dist/unpkg/dev/declarations/build-config.d.ts +0 -18
- package/dist/unpkg/dev/declarations/configure.d.ts +0 -7
- package/dist/unpkg/dev/declarations/graph/-private/-diff.d.ts +0 -19
- package/dist/unpkg/dev/declarations/graph/-private/-edge-definition.d.ts +0 -149
- package/dist/unpkg/dev/declarations/graph/-private/-state.d.ts +0 -9
- package/dist/unpkg/dev/declarations/graph/-private/-utils.d.ts +0 -25
- package/dist/unpkg/dev/declarations/graph/-private/coerce-id.d.ts +0 -4
- package/dist/unpkg/dev/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
- package/dist/unpkg/dev/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/dist/unpkg/dev/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/dist/unpkg/dev/declarations/graph/-private/edges/resource.d.ts +0 -23
- package/dist/unpkg/dev/declarations/graph/-private/graph.d.ts +0 -56
- package/dist/unpkg/dev/declarations/graph/-private/normalize-link.d.ts +0 -2
- package/dist/unpkg/dev/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/dist/unpkg/dev/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/dist/unpkg/dev/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/dist/unpkg/dev/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/dist/unpkg/dev/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
- package/dist/unpkg/dev/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
- package/dist/unpkg/dev/declarations/graph/-private.d.ts +0 -13
- package/dist/unpkg/dev/declarations/index.d.ts +0 -100
- package/dist/unpkg/dev/declarations/reactive/-private/default-mode.d.ts +0 -73
- package/dist/unpkg/dev/declarations/reactive/-private/document.d.ts +0 -142
- package/dist/unpkg/dev/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/dist/unpkg/dev/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
- package/dist/unpkg/dev/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
- package/dist/unpkg/dev/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
- package/dist/unpkg/dev/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/dist/unpkg/dev/declarations/reactive/-private/hooks.d.ts +0 -5
- package/dist/unpkg/dev/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/array-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/local-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/object-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
- package/dist/unpkg/dev/declarations/reactive/-private/record.d.ts +0 -83
- package/dist/unpkg/dev/declarations/reactive/-private/schema.d.ts +0 -326
- package/dist/unpkg/dev/declarations/reactive/-private/symbols.d.ts +0 -5
- package/dist/unpkg/dev/declarations/reactive/-private.d.ts +0 -2
- package/dist/unpkg/dev/declarations/reactive.d.ts +0 -287
- package/dist/unpkg/dev/declarations/request/-private/context.d.ts +0 -39
- package/dist/unpkg/dev/declarations/request/-private/debug.d.ts +0 -4
- package/dist/unpkg/dev/declarations/request/-private/fetch.d.ts +0 -33
- package/dist/unpkg/dev/declarations/request/-private/future.d.ts +0 -7
- package/dist/unpkg/dev/declarations/request/-private/manager.d.ts +0 -158
- package/dist/unpkg/dev/declarations/request/-private/promise-cache.d.ts +0 -28
- package/dist/unpkg/dev/declarations/request/-private/types.d.ts +0 -234
- package/dist/unpkg/dev/declarations/request/-private/utils.d.ts +0 -57
- package/dist/unpkg/dev/declarations/request.d.ts +0 -52
- package/dist/unpkg/dev/declarations/store/-private/cache-handler/handler.d.ts +0 -56
- package/dist/unpkg/dev/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/dist/unpkg/dev/declarations/store/-private/cache-handler/utils.d.ts +0 -31
- package/dist/unpkg/dev/declarations/store/-private/caches/instance-cache.d.ts +0 -58
- package/dist/unpkg/dev/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/dist/unpkg/dev/declarations/store/-private/debug/utils.d.ts +0 -7
- package/dist/unpkg/dev/declarations/store/-private/default-cache-policy.d.ts +0 -387
- package/dist/unpkg/dev/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
- package/dist/unpkg/dev/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
- package/dist/unpkg/dev/declarations/store/-private/managers/cache-manager.d.ts +0 -380
- package/dist/unpkg/dev/declarations/store/-private/managers/notification-manager.d.ts +0 -83
- package/dist/unpkg/dev/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
- package/dist/unpkg/dev/declarations/store/-private/network/request-cache.d.ts +0 -103
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -264
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -138
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -154
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -56
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -372
- package/dist/unpkg/dev/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -177
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
- package/dist/unpkg/dev/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
- package/dist/unpkg/dev/declarations/store/-private/store-service.d.ts +0 -874
- package/dist/unpkg/dev/declarations/store/-private/utils/coerce-id.d.ts +0 -4
- package/dist/unpkg/dev/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/dist/unpkg/dev/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/dist/unpkg/dev/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/dist/unpkg/dev/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/dist/unpkg/dev/declarations/store/-private.d.ts +0 -29
- package/dist/unpkg/dev/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
- package/dist/unpkg/dev/declarations/store/-types/q/identifier.d.ts +0 -23
- package/dist/unpkg/dev/declarations/store/-types/q/record-instance.d.ts +0 -22
- package/dist/unpkg/dev/declarations/store/-types/q/store.d.ts +0 -31
- package/dist/unpkg/dev/declarations/store/deprecated/-private.d.ts +0 -223
- package/dist/unpkg/dev/declarations/store/deprecated/store.d.ts +0 -784
- package/dist/unpkg/dev/declarations/store.d.ts +0 -2
- package/dist/unpkg/dev/declarations/types/-private.d.ts +0 -22
- package/dist/unpkg/dev/declarations/types/cache/aliases.d.ts +0 -1
- package/dist/unpkg/dev/declarations/types/cache/change.d.ts +0 -6
- package/dist/unpkg/dev/declarations/types/cache/mutations.d.ts +0 -38
- package/dist/unpkg/dev/declarations/types/cache/operations.d.ts +0 -168
- package/dist/unpkg/dev/declarations/types/cache/relationship.d.ts +0 -13
- package/dist/unpkg/dev/declarations/types/cache.d.ts +0 -429
- package/dist/unpkg/dev/declarations/types/graph.d.ts +0 -47
- package/dist/unpkg/dev/declarations/types/identifier.d.ts +0 -86
- package/dist/unpkg/dev/declarations/types/json/raw.d.ts +0 -6
- package/dist/unpkg/dev/declarations/types/params.d.ts +0 -8
- package/dist/unpkg/dev/declarations/types/record.d.ts +0 -269
- package/dist/unpkg/dev/declarations/types/request.d.ts +0 -367
- package/dist/unpkg/dev/declarations/types/runtime.d.ts +0 -14
- package/dist/unpkg/dev/declarations/types/schema/concepts.d.ts +0 -23
- package/dist/unpkg/dev/declarations/types/schema/fields.d.ts +0 -2200
- package/dist/unpkg/dev/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/dist/unpkg/dev/declarations/types/schema/schema-service.d.ts +0 -380
- package/dist/unpkg/dev/declarations/types/spec/document.d.ts +0 -67
- package/dist/unpkg/dev/declarations/types/spec/error.d.ts +0 -18
- package/dist/unpkg/dev/declarations/types/spec/json-api-raw.d.ts +0 -139
- package/dist/unpkg/dev/declarations/types/symbols.d.ts +0 -78
- package/dist/unpkg/dev/declarations/types/utils.d.ts +0 -5
- package/dist/unpkg/dev/declarations/types.d.ts +0 -11
- package/dist/unpkg/dev/declarations/utils/string.d.ts +0 -47
- package/dist/unpkg/dev/default-cache-policy-D7_u4YRH.js +0 -572
- package/dist/unpkg/dev/request-oqoLC9rz.js +0 -725
- package/dist/unpkg/dev-deprecated/declarations/build-config/babel-macros.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config/canary-features.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config/debugging.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config/deprecations.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config/env.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config/macros.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/build-config.d.ts +0 -18
- package/dist/unpkg/dev-deprecated/declarations/configure.d.ts +0 -7
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/-diff.d.ts +0 -19
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/-edge-definition.d.ts +0 -149
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/-state.d.ts +0 -9
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/-utils.d.ts +0 -25
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/coerce-id.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/edges/resource.d.ts +0 -23
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/graph.d.ts +0 -56
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/normalize-link.d.ts +0 -2
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
- package/dist/unpkg/dev-deprecated/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
- package/dist/unpkg/dev-deprecated/declarations/graph/-private.d.ts +0 -13
- package/dist/unpkg/dev-deprecated/declarations/index.d.ts +0 -100
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/default-mode.d.ts +0 -73
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/document.d.ts +0 -142
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/hooks.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/array-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/local-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/object-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/record.d.ts +0 -83
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/schema.d.ts +0 -326
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private/symbols.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/reactive/-private.d.ts +0 -2
- package/dist/unpkg/dev-deprecated/declarations/reactive.d.ts +0 -287
- package/dist/unpkg/dev-deprecated/declarations/request/-private/context.d.ts +0 -39
- package/dist/unpkg/dev-deprecated/declarations/request/-private/debug.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/request/-private/fetch.d.ts +0 -33
- package/dist/unpkg/dev-deprecated/declarations/request/-private/future.d.ts +0 -7
- package/dist/unpkg/dev-deprecated/declarations/request/-private/manager.d.ts +0 -158
- package/dist/unpkg/dev-deprecated/declarations/request/-private/promise-cache.d.ts +0 -28
- package/dist/unpkg/dev-deprecated/declarations/request/-private/types.d.ts +0 -234
- package/dist/unpkg/dev-deprecated/declarations/request/-private/utils.d.ts +0 -57
- package/dist/unpkg/dev-deprecated/declarations/request.d.ts +0 -52
- package/dist/unpkg/dev-deprecated/declarations/store/-private/cache-handler/handler.d.ts +0 -56
- package/dist/unpkg/dev-deprecated/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/dist/unpkg/dev-deprecated/declarations/store/-private/cache-handler/utils.d.ts +0 -31
- package/dist/unpkg/dev-deprecated/declarations/store/-private/caches/instance-cache.d.ts +0 -58
- package/dist/unpkg/dev-deprecated/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/dist/unpkg/dev-deprecated/declarations/store/-private/debug/utils.d.ts +0 -7
- package/dist/unpkg/dev-deprecated/declarations/store/-private/default-cache-policy.d.ts +0 -387
- package/dist/unpkg/dev-deprecated/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
- package/dist/unpkg/dev-deprecated/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
- package/dist/unpkg/dev-deprecated/declarations/store/-private/managers/cache-manager.d.ts +0 -380
- package/dist/unpkg/dev-deprecated/declarations/store/-private/managers/notification-manager.d.ts +0 -83
- package/dist/unpkg/dev-deprecated/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
- package/dist/unpkg/dev-deprecated/declarations/store/-private/network/request-cache.d.ts +0 -103
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -264
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -138
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -154
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -56
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -372
- package/dist/unpkg/dev-deprecated/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -177
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
- package/dist/unpkg/dev-deprecated/declarations/store/-private/store-service.d.ts +0 -874
- package/dist/unpkg/dev-deprecated/declarations/store/-private/utils/coerce-id.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/store/-private.d.ts +0 -29
- package/dist/unpkg/dev-deprecated/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
- package/dist/unpkg/dev-deprecated/declarations/store/-types/q/identifier.d.ts +0 -23
- package/dist/unpkg/dev-deprecated/declarations/store/-types/q/record-instance.d.ts +0 -22
- package/dist/unpkg/dev-deprecated/declarations/store/-types/q/store.d.ts +0 -31
- package/dist/unpkg/dev-deprecated/declarations/store/deprecated/-private.d.ts +0 -223
- package/dist/unpkg/dev-deprecated/declarations/store/deprecated/store.d.ts +0 -784
- package/dist/unpkg/dev-deprecated/declarations/store.d.ts +0 -2
- package/dist/unpkg/dev-deprecated/declarations/types/-private.d.ts +0 -22
- package/dist/unpkg/dev-deprecated/declarations/types/cache/aliases.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/types/cache/change.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/types/cache/mutations.d.ts +0 -38
- package/dist/unpkg/dev-deprecated/declarations/types/cache/operations.d.ts +0 -168
- package/dist/unpkg/dev-deprecated/declarations/types/cache/relationship.d.ts +0 -13
- package/dist/unpkg/dev-deprecated/declarations/types/cache.d.ts +0 -429
- package/dist/unpkg/dev-deprecated/declarations/types/graph.d.ts +0 -47
- package/dist/unpkg/dev-deprecated/declarations/types/identifier.d.ts +0 -86
- package/dist/unpkg/dev-deprecated/declarations/types/json/raw.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/types/params.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/types/record.d.ts +0 -269
- package/dist/unpkg/dev-deprecated/declarations/types/request.d.ts +0 -367
- package/dist/unpkg/dev-deprecated/declarations/types/runtime.d.ts +0 -14
- package/dist/unpkg/dev-deprecated/declarations/types/schema/concepts.d.ts +0 -23
- package/dist/unpkg/dev-deprecated/declarations/types/schema/fields.d.ts +0 -2200
- package/dist/unpkg/dev-deprecated/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/types/schema/schema-service.d.ts +0 -380
- package/dist/unpkg/dev-deprecated/declarations/types/spec/document.d.ts +0 -67
- package/dist/unpkg/dev-deprecated/declarations/types/spec/error.d.ts +0 -18
- package/dist/unpkg/dev-deprecated/declarations/types/spec/json-api-raw.d.ts +0 -139
- package/dist/unpkg/dev-deprecated/declarations/types/symbols.d.ts +0 -78
- package/dist/unpkg/dev-deprecated/declarations/types/utils.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/types.d.ts +0 -11
- package/dist/unpkg/dev-deprecated/declarations/utils/string.d.ts +0 -47
- package/dist/unpkg/dev-deprecated/default-cache-policy-D7_u4YRH.js +0 -572
- package/dist/unpkg/prod/declarations/build-config/babel-macros.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config/canary-features.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config/debugging.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config/deprecations.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config/env.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config/macros.d.ts +0 -1
- package/dist/unpkg/prod/declarations/build-config.d.ts +0 -18
- package/dist/unpkg/prod/declarations/configure.d.ts +0 -7
- package/dist/unpkg/prod/declarations/graph/-private/-diff.d.ts +0 -19
- package/dist/unpkg/prod/declarations/graph/-private/-edge-definition.d.ts +0 -149
- package/dist/unpkg/prod/declarations/graph/-private/-state.d.ts +0 -9
- package/dist/unpkg/prod/declarations/graph/-private/-utils.d.ts +0 -25
- package/dist/unpkg/prod/declarations/graph/-private/coerce-id.d.ts +0 -4
- package/dist/unpkg/prod/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
- package/dist/unpkg/prod/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/dist/unpkg/prod/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/dist/unpkg/prod/declarations/graph/-private/edges/resource.d.ts +0 -23
- package/dist/unpkg/prod/declarations/graph/-private/graph.d.ts +0 -56
- package/dist/unpkg/prod/declarations/graph/-private/normalize-link.d.ts +0 -2
- package/dist/unpkg/prod/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/dist/unpkg/prod/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/dist/unpkg/prod/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/dist/unpkg/prod/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/dist/unpkg/prod/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
- package/dist/unpkg/prod/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
- package/dist/unpkg/prod/declarations/graph/-private.d.ts +0 -13
- package/dist/unpkg/prod/declarations/index.d.ts +0 -100
- package/dist/unpkg/prod/declarations/reactive/-private/default-mode.d.ts +0 -73
- package/dist/unpkg/prod/declarations/reactive/-private/document.d.ts +0 -142
- package/dist/unpkg/prod/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/dist/unpkg/prod/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
- package/dist/unpkg/prod/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
- package/dist/unpkg/prod/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
- package/dist/unpkg/prod/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/dist/unpkg/prod/declarations/reactive/-private/hooks.d.ts +0 -5
- package/dist/unpkg/prod/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/array-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/local-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/object-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
- package/dist/unpkg/prod/declarations/reactive/-private/record.d.ts +0 -83
- package/dist/unpkg/prod/declarations/reactive/-private/schema.d.ts +0 -326
- package/dist/unpkg/prod/declarations/reactive/-private/symbols.d.ts +0 -5
- package/dist/unpkg/prod/declarations/reactive/-private.d.ts +0 -2
- package/dist/unpkg/prod/declarations/reactive.d.ts +0 -287
- package/dist/unpkg/prod/declarations/request/-private/context.d.ts +0 -39
- package/dist/unpkg/prod/declarations/request/-private/debug.d.ts +0 -4
- package/dist/unpkg/prod/declarations/request/-private/fetch.d.ts +0 -33
- package/dist/unpkg/prod/declarations/request/-private/future.d.ts +0 -7
- package/dist/unpkg/prod/declarations/request/-private/manager.d.ts +0 -158
- package/dist/unpkg/prod/declarations/request/-private/promise-cache.d.ts +0 -28
- package/dist/unpkg/prod/declarations/request/-private/types.d.ts +0 -234
- package/dist/unpkg/prod/declarations/request/-private/utils.d.ts +0 -57
- package/dist/unpkg/prod/declarations/request.d.ts +0 -52
- package/dist/unpkg/prod/declarations/store/-private/cache-handler/handler.d.ts +0 -56
- package/dist/unpkg/prod/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/dist/unpkg/prod/declarations/store/-private/cache-handler/utils.d.ts +0 -31
- package/dist/unpkg/prod/declarations/store/-private/caches/instance-cache.d.ts +0 -58
- package/dist/unpkg/prod/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/dist/unpkg/prod/declarations/store/-private/debug/utils.d.ts +0 -7
- package/dist/unpkg/prod/declarations/store/-private/default-cache-policy.d.ts +0 -387
- package/dist/unpkg/prod/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
- package/dist/unpkg/prod/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
- package/dist/unpkg/prod/declarations/store/-private/managers/cache-manager.d.ts +0 -380
- package/dist/unpkg/prod/declarations/store/-private/managers/notification-manager.d.ts +0 -83
- package/dist/unpkg/prod/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
- package/dist/unpkg/prod/declarations/store/-private/network/request-cache.d.ts +0 -103
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -264
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -138
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -154
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -56
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -372
- package/dist/unpkg/prod/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -177
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
- package/dist/unpkg/prod/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
- package/dist/unpkg/prod/declarations/store/-private/store-service.d.ts +0 -874
- package/dist/unpkg/prod/declarations/store/-private/utils/coerce-id.d.ts +0 -4
- package/dist/unpkg/prod/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/dist/unpkg/prod/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/dist/unpkg/prod/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/dist/unpkg/prod/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/dist/unpkg/prod/declarations/store/-private.d.ts +0 -29
- package/dist/unpkg/prod/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
- package/dist/unpkg/prod/declarations/store/-types/q/identifier.d.ts +0 -23
- package/dist/unpkg/prod/declarations/store/-types/q/record-instance.d.ts +0 -22
- package/dist/unpkg/prod/declarations/store/-types/q/store.d.ts +0 -31
- package/dist/unpkg/prod/declarations/store/deprecated/-private.d.ts +0 -223
- package/dist/unpkg/prod/declarations/store/deprecated/store.d.ts +0 -784
- package/dist/unpkg/prod/declarations/store.d.ts +0 -2
- package/dist/unpkg/prod/declarations/types/-private.d.ts +0 -22
- package/dist/unpkg/prod/declarations/types/cache/aliases.d.ts +0 -1
- package/dist/unpkg/prod/declarations/types/cache/change.d.ts +0 -6
- package/dist/unpkg/prod/declarations/types/cache/mutations.d.ts +0 -38
- package/dist/unpkg/prod/declarations/types/cache/operations.d.ts +0 -168
- package/dist/unpkg/prod/declarations/types/cache/relationship.d.ts +0 -13
- package/dist/unpkg/prod/declarations/types/cache.d.ts +0 -429
- package/dist/unpkg/prod/declarations/types/graph.d.ts +0 -47
- package/dist/unpkg/prod/declarations/types/identifier.d.ts +0 -86
- package/dist/unpkg/prod/declarations/types/json/raw.d.ts +0 -6
- package/dist/unpkg/prod/declarations/types/params.d.ts +0 -8
- package/dist/unpkg/prod/declarations/types/record.d.ts +0 -269
- package/dist/unpkg/prod/declarations/types/request.d.ts +0 -367
- package/dist/unpkg/prod/declarations/types/runtime.d.ts +0 -14
- package/dist/unpkg/prod/declarations/types/schema/concepts.d.ts +0 -23
- package/dist/unpkg/prod/declarations/types/schema/fields.d.ts +0 -2200
- package/dist/unpkg/prod/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/dist/unpkg/prod/declarations/types/schema/schema-service.d.ts +0 -380
- package/dist/unpkg/prod/declarations/types/spec/document.d.ts +0 -67
- package/dist/unpkg/prod/declarations/types/spec/error.d.ts +0 -18
- package/dist/unpkg/prod/declarations/types/spec/json-api-raw.d.ts +0 -139
- package/dist/unpkg/prod/declarations/types/symbols.d.ts +0 -78
- package/dist/unpkg/prod/declarations/types/utils.d.ts +0 -5
- package/dist/unpkg/prod/declarations/types.d.ts +0 -11
- package/dist/unpkg/prod/declarations/utils/string.d.ts +0 -47
- package/dist/unpkg/prod/default-cache-policy-D7_u4YRH.js +0 -572
- package/dist/unpkg/prod/index-D4si_DxB.js +0 -11746
- package/dist/unpkg/prod/request-oqoLC9rz.js +0 -725
- package/dist/unpkg/prod-deprecated/declarations/build-config/babel-macros.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config/canary-features.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config/debugging.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config/deprecations.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config/env.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config/macros.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/build-config.d.ts +0 -18
- package/dist/unpkg/prod-deprecated/declarations/configure.d.ts +0 -7
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/-diff.d.ts +0 -19
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/-edge-definition.d.ts +0 -149
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/-state.d.ts +0 -9
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/-utils.d.ts +0 -25
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/coerce-id.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/edges/resource.d.ts +0 -23
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/graph.d.ts +0 -56
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/normalize-link.d.ts +0 -2
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
- package/dist/unpkg/prod-deprecated/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
- package/dist/unpkg/prod-deprecated/declarations/graph/-private.d.ts +0 -13
- package/dist/unpkg/prod-deprecated/declarations/index.d.ts +0 -100
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/default-mode.d.ts +0 -73
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/document.d.ts +0 -142
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/hooks.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/array-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/local-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/object-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/record.d.ts +0 -83
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/schema.d.ts +0 -326
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private/symbols.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/reactive/-private.d.ts +0 -2
- package/dist/unpkg/prod-deprecated/declarations/reactive.d.ts +0 -287
- package/dist/unpkg/prod-deprecated/declarations/request/-private/context.d.ts +0 -39
- package/dist/unpkg/prod-deprecated/declarations/request/-private/debug.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/request/-private/fetch.d.ts +0 -33
- package/dist/unpkg/prod-deprecated/declarations/request/-private/future.d.ts +0 -7
- package/dist/unpkg/prod-deprecated/declarations/request/-private/manager.d.ts +0 -158
- package/dist/unpkg/prod-deprecated/declarations/request/-private/promise-cache.d.ts +0 -28
- package/dist/unpkg/prod-deprecated/declarations/request/-private/types.d.ts +0 -234
- package/dist/unpkg/prod-deprecated/declarations/request/-private/utils.d.ts +0 -57
- package/dist/unpkg/prod-deprecated/declarations/request.d.ts +0 -52
- package/dist/unpkg/prod-deprecated/declarations/store/-private/cache-handler/handler.d.ts +0 -56
- package/dist/unpkg/prod-deprecated/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/dist/unpkg/prod-deprecated/declarations/store/-private/cache-handler/utils.d.ts +0 -31
- package/dist/unpkg/prod-deprecated/declarations/store/-private/caches/instance-cache.d.ts +0 -58
- package/dist/unpkg/prod-deprecated/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/dist/unpkg/prod-deprecated/declarations/store/-private/debug/utils.d.ts +0 -7
- package/dist/unpkg/prod-deprecated/declarations/store/-private/default-cache-policy.d.ts +0 -387
- package/dist/unpkg/prod-deprecated/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
- package/dist/unpkg/prod-deprecated/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
- package/dist/unpkg/prod-deprecated/declarations/store/-private/managers/cache-manager.d.ts +0 -380
- package/dist/unpkg/prod-deprecated/declarations/store/-private/managers/notification-manager.d.ts +0 -83
- package/dist/unpkg/prod-deprecated/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
- package/dist/unpkg/prod-deprecated/declarations/store/-private/network/request-cache.d.ts +0 -103
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -264
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -138
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -154
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -56
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -372
- package/dist/unpkg/prod-deprecated/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -177
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
- package/dist/unpkg/prod-deprecated/declarations/store/-private/store-service.d.ts +0 -874
- package/dist/unpkg/prod-deprecated/declarations/store/-private/utils/coerce-id.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/store/-private.d.ts +0 -29
- package/dist/unpkg/prod-deprecated/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
- package/dist/unpkg/prod-deprecated/declarations/store/-types/q/identifier.d.ts +0 -23
- package/dist/unpkg/prod-deprecated/declarations/store/-types/q/record-instance.d.ts +0 -22
- package/dist/unpkg/prod-deprecated/declarations/store/-types/q/store.d.ts +0 -31
- package/dist/unpkg/prod-deprecated/declarations/store/deprecated/-private.d.ts +0 -223
- package/dist/unpkg/prod-deprecated/declarations/store/deprecated/store.d.ts +0 -784
- package/dist/unpkg/prod-deprecated/declarations/store.d.ts +0 -2
- package/dist/unpkg/prod-deprecated/declarations/types/-private.d.ts +0 -22
- package/dist/unpkg/prod-deprecated/declarations/types/cache/aliases.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/types/cache/change.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/types/cache/mutations.d.ts +0 -38
- package/dist/unpkg/prod-deprecated/declarations/types/cache/operations.d.ts +0 -168
- package/dist/unpkg/prod-deprecated/declarations/types/cache/relationship.d.ts +0 -13
- package/dist/unpkg/prod-deprecated/declarations/types/cache.d.ts +0 -429
- package/dist/unpkg/prod-deprecated/declarations/types/graph.d.ts +0 -47
- package/dist/unpkg/prod-deprecated/declarations/types/identifier.d.ts +0 -86
- package/dist/unpkg/prod-deprecated/declarations/types/json/raw.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/types/params.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/types/record.d.ts +0 -269
- package/dist/unpkg/prod-deprecated/declarations/types/request.d.ts +0 -367
- package/dist/unpkg/prod-deprecated/declarations/types/runtime.d.ts +0 -14
- package/dist/unpkg/prod-deprecated/declarations/types/schema/concepts.d.ts +0 -23
- package/dist/unpkg/prod-deprecated/declarations/types/schema/fields.d.ts +0 -2200
- package/dist/unpkg/prod-deprecated/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/types/schema/schema-service.d.ts +0 -380
- package/dist/unpkg/prod-deprecated/declarations/types/spec/document.d.ts +0 -67
- package/dist/unpkg/prod-deprecated/declarations/types/spec/error.d.ts +0 -18
- package/dist/unpkg/prod-deprecated/declarations/types/spec/json-api-raw.d.ts +0 -139
- package/dist/unpkg/prod-deprecated/declarations/types/symbols.d.ts +0 -78
- package/dist/unpkg/prod-deprecated/declarations/types/utils.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/types.d.ts +0 -11
- package/dist/unpkg/prod-deprecated/declarations/utils/string.d.ts +0 -47
- package/dist/unpkg/prod-deprecated/default-cache-policy-D7_u4YRH.js +0 -572
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
1
|
+
import { g as getGlobalConfig } from "../runtime-DGG4CvlW.js";
|
|
3
2
|
import { getOrSetGlobal, peekTransient, setTransient } from '../types/-private.js';
|
|
3
|
+
|
|
4
|
+
// Used by the store to normalize IDs entering the store. Despite the fact
|
|
5
|
+
// that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
|
|
6
|
+
// it is important that internally we use strings, since IDs may be serialized
|
|
7
|
+
// and lose type information. For example, Ember's router may put a record's
|
|
8
|
+
// ID into the URL, and if we later try to deserialize that URL and find the
|
|
9
|
+
// corresponding record, we will not know if it is a string or a number.
|
|
4
10
|
function coerceId(id) {
|
|
5
|
-
|
|
6
|
-
let normalized;
|
|
7
|
-
if (id === null || id === undefined || id === '') {
|
|
8
|
-
normalized = null;
|
|
9
|
-
} else {
|
|
10
|
-
normalized = String(id);
|
|
11
|
-
}
|
|
12
|
-
deprecate(`The resource id '<${typeof id}> ${String(id)} ' is not normalized. Update your application code to use '${JSON.stringify(normalized)}' instead.`, normalized === id, {
|
|
13
|
-
id: 'ember-data:deprecate-non-strict-id',
|
|
14
|
-
until: '6.0',
|
|
15
|
-
for: 'ember-data',
|
|
16
|
-
since: {
|
|
17
|
-
available: '4.13',
|
|
18
|
-
enabled: '5.3'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return normalized;
|
|
22
|
-
}
|
|
23
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
11
|
+
(test => {
|
|
24
12
|
if (!test) {
|
|
25
13
|
throw new Error(`Resource IDs must be a non-empty string or null. Received '${String(id)}'.`);
|
|
26
14
|
}
|
|
27
|
-
})(id === null || typeof id === 'string' && id.length > 0)
|
|
15
|
+
})(id === null || typeof id === 'string' && id.length > 0);
|
|
28
16
|
return id;
|
|
29
17
|
}
|
|
30
18
|
function getStore(wrapper) {
|
|
31
|
-
|
|
19
|
+
(test => {
|
|
32
20
|
if (!test) {
|
|
33
21
|
throw new Error(`expected a private _store property`);
|
|
34
22
|
}
|
|
35
|
-
})('_store' in wrapper)
|
|
23
|
+
})('_store' in wrapper);
|
|
36
24
|
return wrapper._store;
|
|
37
25
|
}
|
|
38
26
|
function expandingGet(cache, key1, key2) {
|
|
@@ -45,11 +33,11 @@ function expandingSet(cache, key1, key2, value) {
|
|
|
45
33
|
}
|
|
46
34
|
function assertValidRelationshipPayload(graph, op) {
|
|
47
35
|
const relationship = graph.get(op.record, op.field);
|
|
48
|
-
|
|
36
|
+
(test => {
|
|
49
37
|
if (!test) {
|
|
50
38
|
throw new Error(`Cannot update an implicit relationship`);
|
|
51
39
|
}
|
|
52
|
-
})(isHasMany(relationship) || isBelongsTo(relationship))
|
|
40
|
+
})(isHasMany(relationship) || isBelongsTo(relationship));
|
|
53
41
|
const payload = op.value;
|
|
54
42
|
const {
|
|
55
43
|
definition,
|
|
@@ -67,23 +55,23 @@ function assertValidRelationshipPayload(graph, op) {
|
|
|
67
55
|
kind
|
|
68
56
|
} = definition;
|
|
69
57
|
if (payload.links) {
|
|
70
|
-
warn(`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.`, isAsync || !!payload.data || state.hasReceivedData, {
|
|
58
|
+
console.warn(`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.`, isAsync || !!payload.data || state.hasReceivedData, {
|
|
71
59
|
id: 'ds.store.push-link-for-sync-relationship'
|
|
72
60
|
});
|
|
73
61
|
} else if (payload.data) {
|
|
74
62
|
if (kind === 'belongsTo') {
|
|
75
|
-
|
|
63
|
+
(test => {
|
|
76
64
|
if (!test) {
|
|
77
65
|
throw new Error(`A ${type} record was pushed into the store with the value of ${field} being ${inspect(payload.data)}, but ${field} is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`);
|
|
78
66
|
}
|
|
79
|
-
})(!Array.isArray(payload.data))
|
|
67
|
+
})(!Array.isArray(payload.data));
|
|
80
68
|
assertRelationshipData(getStore(graph.store), identifier, payload.data, definition);
|
|
81
69
|
} else if (kind === 'hasMany') {
|
|
82
|
-
|
|
70
|
+
(test => {
|
|
83
71
|
if (!test) {
|
|
84
72
|
throw new Error(`A ${type} record was pushed into the store with the value of ${field} being '${inspect(payload.data)}', but ${field} is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.`);
|
|
85
73
|
}
|
|
86
|
-
})(Array.isArray(payload.data))
|
|
74
|
+
})(Array.isArray(payload.data));
|
|
87
75
|
if (Array.isArray(payload.data)) {
|
|
88
76
|
for (let i = 0; i < payload.data.length; i++) {
|
|
89
77
|
assertRelationshipData(getStore(graph.store), identifier, payload.data[i], definition);
|
|
@@ -211,7 +199,7 @@ function notifyChange(graph, relationship) {
|
|
|
211
199
|
const resourceKey = relationship.identifier;
|
|
212
200
|
const key = relationship.definition.key;
|
|
213
201
|
if (resourceKey === graph._removing) {
|
|
214
|
-
|
|
202
|
+
{
|
|
215
203
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
216
204
|
// eslint-disable-next-line no-console
|
|
217
205
|
console.log(`Graph: ignoring relationship change for removed identifier ${String(resourceKey)} ${key}`);
|
|
@@ -219,7 +207,7 @@ function notifyChange(graph, relationship) {
|
|
|
219
207
|
}
|
|
220
208
|
return;
|
|
221
209
|
}
|
|
222
|
-
|
|
210
|
+
{
|
|
223
211
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
224
212
|
// eslint-disable-next-line no-console
|
|
225
213
|
console.log(`Graph: notifying relationship change for ${String(resourceKey)} ${key}`);
|
|
@@ -228,33 +216,33 @@ function notifyChange(graph, relationship) {
|
|
|
228
216
|
graph.store.notifyChange(resourceKey, 'relationships', key);
|
|
229
217
|
}
|
|
230
218
|
function assertRelationshipData(store, resourceKey, data, meta) {
|
|
231
|
-
|
|
219
|
+
(test => {
|
|
232
220
|
if (!test) {
|
|
233
221
|
throw new Error(`A ${resourceKey.type} record was pushed into the store with the value of ${meta.key} being '${JSON.stringify(data)}', but ${meta.key} is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.`);
|
|
234
222
|
}
|
|
235
|
-
})(!Array.isArray(data))
|
|
236
|
-
|
|
223
|
+
})(!Array.isArray(data));
|
|
224
|
+
(test => {
|
|
237
225
|
if (!test) {
|
|
238
226
|
throw new Error(`Encountered a relationship identifier without a type for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, expected an identifier with type '${meta.type}' but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
|
|
239
227
|
}
|
|
240
|
-
})(data === null || 'type' in data && typeof data.type === 'string' && data.type.length)
|
|
241
|
-
|
|
228
|
+
})(data === null || 'type' in data && typeof data.type === 'string' && data.type.length);
|
|
229
|
+
(test => {
|
|
242
230
|
if (!test) {
|
|
243
231
|
throw new Error(`Encountered a relationship identifier without an id for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, expected an identifier but found\n\n'${JSON.stringify(data, null, 2)}'\n\nPlease check your serializer and make sure it is serializing the relationship payload into a JSON API format.`);
|
|
244
232
|
}
|
|
245
|
-
})(data === null || !!coerceId(data.id))
|
|
233
|
+
})(data === null || !!coerceId(data.id));
|
|
246
234
|
if (data?.type === meta.type) {
|
|
247
|
-
|
|
235
|
+
(test => {
|
|
248
236
|
if (!test) {
|
|
249
237
|
throw new Error(`Missing Schema: Encountered a relationship identifier { type: '${data.type}', id: '${String(data.id)}' } for the '${resourceKey.type}.${meta.key}' ${meta.kind} relationship on <${resourceKey.type}:${String(resourceKey.id)}>, but no schema exists for that type.`);
|
|
250
238
|
}
|
|
251
|
-
})(store.schema.hasResource(data))
|
|
239
|
+
})(store.schema.hasResource(data));
|
|
252
240
|
} else {
|
|
253
|
-
|
|
241
|
+
(test => {
|
|
254
242
|
if (!test) {
|
|
255
243
|
throw new Error(`Missing Schema: Encountered a relationship identifier with type '${data.type}' for the ${meta.kind} relationship '${meta.key}' on <${resourceKey.type}:${String(resourceKey.id)}>, Expected an identifier with type '${meta.type}'. No schema was found for '${data.type}'.`);
|
|
256
244
|
}
|
|
257
|
-
})(data === null || !data.type || store.schema.hasResource(data))
|
|
245
|
+
})(data === null || !data.type || store.schema.hasResource(data));
|
|
258
246
|
}
|
|
259
247
|
}
|
|
260
248
|
const RELATIONSHIP_KINDS = ['belongsTo', 'hasMany', 'resource', 'collection'];
|
|
@@ -370,11 +358,11 @@ function upgradeMeta(meta) {
|
|
|
370
358
|
niceMeta.key = meta.sourceKey ?? meta.name;
|
|
371
359
|
niceMeta.name = meta.name;
|
|
372
360
|
niceMeta.type = meta.type;
|
|
373
|
-
|
|
361
|
+
(test => {
|
|
374
362
|
if (!test) {
|
|
375
363
|
throw new Error(`Expected relationship definition to specify async`);
|
|
376
364
|
}
|
|
377
|
-
})(typeof options?.async === 'boolean')
|
|
365
|
+
})(typeof options?.async === 'boolean');
|
|
378
366
|
niceMeta.isAsync = options.async;
|
|
379
367
|
niceMeta.isImplicit = false;
|
|
380
368
|
niceMeta.isCollection = meta.kind === 'hasMany';
|
|
@@ -393,7 +381,7 @@ function upgradeMeta(meta) {
|
|
|
393
381
|
return niceMeta;
|
|
394
382
|
}
|
|
395
383
|
function assertConfiguration(info, type, key) {
|
|
396
|
-
|
|
384
|
+
{
|
|
397
385
|
const isSelfReferential = info.isSelfReferential;
|
|
398
386
|
if (isSelfReferential) {
|
|
399
387
|
return true;
|
|
@@ -472,7 +460,7 @@ function assertConfiguration(info, type, key) {
|
|
|
472
460
|
function isLHS(info, type, key) {
|
|
473
461
|
const isSelfReferential = info.isSelfReferential;
|
|
474
462
|
const isRelationship = key === info.lhs_relationshipName;
|
|
475
|
-
|
|
463
|
+
{
|
|
476
464
|
assertConfiguration(info, type, key);
|
|
477
465
|
}
|
|
478
466
|
if (isRelationship === true) {
|
|
@@ -499,18 +487,18 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
499
487
|
if (cached !== undefined) {
|
|
500
488
|
return cached;
|
|
501
489
|
}
|
|
502
|
-
|
|
490
|
+
(test => {
|
|
503
491
|
if (!test) {
|
|
504
492
|
throw new Error(`Expected to find relationship definition in the cache for the implicit relationship ${propertyName}`);
|
|
505
493
|
}
|
|
506
|
-
})(!isImplicit)
|
|
494
|
+
})(!isImplicit);
|
|
507
495
|
const relationships = storeWrapper.schema.fields(key);
|
|
508
496
|
const relationshipsBySourceKey = storeWrapper.schema.cacheFields?.(key) ?? relationships;
|
|
509
|
-
|
|
497
|
+
(test => {
|
|
510
498
|
if (!test) {
|
|
511
499
|
throw new Error(`Expected to have a relationship definition for ${type} but none was found.`);
|
|
512
500
|
}
|
|
513
|
-
})(relationships)
|
|
501
|
+
})(relationships);
|
|
514
502
|
const meta = relationshipsBySourceKey.get(propertyName);
|
|
515
503
|
if (!meta) {
|
|
516
504
|
// TODO potentially we should just be permissive here since this is an implicit relationship
|
|
@@ -529,19 +517,19 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
529
517
|
|
|
530
518
|
// CASE: We don't have a relationship at all
|
|
531
519
|
// we should only hit this in prod
|
|
532
|
-
|
|
520
|
+
(test => {
|
|
533
521
|
if (!test) {
|
|
534
522
|
throw new Error(`Expected a relationship schema for '${type}.${propertyName}', but no relationship schema was found.`);
|
|
535
523
|
}
|
|
536
|
-
})(meta)
|
|
524
|
+
})(meta);
|
|
537
525
|
cache[type][propertyName] = null;
|
|
538
526
|
return null;
|
|
539
527
|
}
|
|
540
|
-
|
|
528
|
+
(test => {
|
|
541
529
|
if (!test) {
|
|
542
530
|
throw new Error(`Expected ${propertyName} to be a relationship`);
|
|
543
531
|
}
|
|
544
|
-
})(isRelationshipField(meta))
|
|
532
|
+
})(isRelationshipField(meta));
|
|
545
533
|
const definition = /*#__NOINLINE__*/upgradeMeta(meta);
|
|
546
534
|
let inverseDefinition;
|
|
547
535
|
let inverseKey;
|
|
@@ -550,11 +538,11 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
550
538
|
// CASE: Inverse is explicitly null
|
|
551
539
|
if (definition.inverseKey === null) {
|
|
552
540
|
// TODO probably dont need this assertion if polymorphic
|
|
553
|
-
|
|
541
|
+
(test => {
|
|
554
542
|
if (!test) {
|
|
555
543
|
throw new Error(`Expected the inverse model to exist`);
|
|
556
544
|
}
|
|
557
|
-
})(getStore(storeWrapper).modelFor(inverseType))
|
|
545
|
+
})(getStore(storeWrapper).modelFor(inverseType));
|
|
558
546
|
inverseDefinition = null;
|
|
559
547
|
} else {
|
|
560
548
|
inverseKey = /*#__NOINLINE__*/inverseForRelationship(getStore(storeWrapper), key, propertyName);
|
|
@@ -587,22 +575,22 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
587
575
|
const inverseDefinitions = storeWrapper.schema.fields({
|
|
588
576
|
type: inverseType
|
|
589
577
|
});
|
|
590
|
-
|
|
578
|
+
(test => {
|
|
591
579
|
if (!test) {
|
|
592
580
|
throw new Error(`Expected to have a relationship definition for ${inverseType} but none was found.`);
|
|
593
581
|
}
|
|
594
|
-
})(inverseDefinitions)
|
|
582
|
+
})(inverseDefinitions);
|
|
595
583
|
const metaFromInverse = inverseDefinitions.get(inverseKey);
|
|
596
|
-
|
|
584
|
+
(test => {
|
|
597
585
|
if (!test) {
|
|
598
586
|
throw new Error(`Expected a relationship schema for '${inverseType}.${inverseKey}' to match the inverse of '${type}.${propertyName}', but no relationship schema was found.`);
|
|
599
587
|
}
|
|
600
|
-
})(metaFromInverse)
|
|
601
|
-
|
|
588
|
+
})(metaFromInverse);
|
|
589
|
+
(test => {
|
|
602
590
|
if (!test) {
|
|
603
591
|
throw new Error(`Expected ${inverseKey} to be a relationship`);
|
|
604
592
|
}
|
|
605
|
-
})(isRelationshipField(metaFromInverse))
|
|
593
|
+
})(isRelationshipField(metaFromInverse));
|
|
606
594
|
inverseDefinition = upgradeMeta(metaFromInverse);
|
|
607
595
|
}
|
|
608
596
|
}
|
|
@@ -659,19 +647,19 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
659
647
|
*/
|
|
660
648
|
// CASE: We may have already discovered the inverse for the baseModelName
|
|
661
649
|
// CASE: We have already discovered the inverse
|
|
662
|
-
|
|
650
|
+
(test => {
|
|
663
651
|
if (!test) {
|
|
664
652
|
throw new Error(`We should have determined an inverseKey by now, open an issue if this is hit`);
|
|
665
653
|
}
|
|
666
|
-
})(typeof inverseKey === 'string' && inverseKey.length > 0)
|
|
654
|
+
})(typeof inverseKey === 'string' && inverseKey.length > 0);
|
|
667
655
|
cached = expandingGet(cache, baseType, propertyName) || expandingGet(cache, inverseType, inverseKey);
|
|
668
656
|
if (cached) {
|
|
669
657
|
// TODO this assert can be removed if the above assert is enabled
|
|
670
|
-
|
|
658
|
+
(test => {
|
|
671
659
|
if (!test) {
|
|
672
660
|
throw new Error(`The ${inverseType}:${inverseKey} relationship declares 'inverse: null', but it was resolved as the inverse for ${type}:${propertyName}.`);
|
|
673
661
|
}
|
|
674
|
-
})(cached.hasInverse !== false)
|
|
662
|
+
})(cached.hasInverse !== false);
|
|
675
663
|
const _isLHS = cached.lhs_baseModelName === baseType;
|
|
676
664
|
const modelNames = _isLHS ? cached.lhs_modelNames : cached.rhs_modelNames;
|
|
677
665
|
// make this lookup easier in the future by caching the key
|
|
@@ -721,24 +709,36 @@ function inverseForRelationship(store, resourceKey, key) {
|
|
|
721
709
|
if (!definition) {
|
|
722
710
|
return null;
|
|
723
711
|
}
|
|
724
|
-
|
|
712
|
+
(test => {
|
|
725
713
|
if (!test) {
|
|
726
714
|
throw new Error(`Expected ${key} to be a relationship`);
|
|
727
715
|
}
|
|
728
|
-
})(isRelationshipField(definition))
|
|
729
|
-
|
|
716
|
+
})(isRelationshipField(definition));
|
|
717
|
+
(test => {
|
|
730
718
|
if (!test) {
|
|
731
719
|
throw new Error(`Expected the relationship defintion to specify the inverse type or null.`);
|
|
732
720
|
}
|
|
733
|
-
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)
|
|
721
|
+
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0);
|
|
734
722
|
return definition.options.inverse;
|
|
735
723
|
}
|
|
736
724
|
|
|
737
725
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
738
726
|
|
|
727
|
+
/*
|
|
728
|
+
Assert that `addedRecord` has a valid type so it can be added to the
|
|
729
|
+
relationship of the `record`.
|
|
730
|
+
|
|
731
|
+
The assert basically checks if the `addedRecord` can be added to the
|
|
732
|
+
relationship (specified via `relationshipMeta`) of the `record`.
|
|
733
|
+
|
|
734
|
+
This utility should only be used internally, as both record parameters must
|
|
735
|
+
be ResourceKeys and the `relationshipMeta` needs to be the meta
|
|
736
|
+
information about the relationship, retrieved via
|
|
737
|
+
`record.relationshipFor(key)`.
|
|
738
|
+
*/
|
|
739
739
|
let assertPolymorphicType;
|
|
740
740
|
let assertInheritedSchema;
|
|
741
|
-
|
|
741
|
+
{
|
|
742
742
|
function validateSchema(definition, meta) {
|
|
743
743
|
const errors = new Map();
|
|
744
744
|
if (definition.inverseKey !== meta.name) {
|
|
@@ -870,61 +870,61 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
870
870
|
}
|
|
871
871
|
if (parentDefinition.isPolymorphic) {
|
|
872
872
|
let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);
|
|
873
|
-
|
|
873
|
+
(test => {
|
|
874
874
|
if (!test) {
|
|
875
875
|
throw new Error(`No '${parentDefinition.inverseKey}' field exists on '${addedIdentifier.type}'. To use this type in the polymorphic relationship '${parentDefinition.inverseType}.${parentDefinition.key}' the relationships schema definition for ${addedIdentifier.type} should include:${expectedSchema(parentDefinition)}`);
|
|
876
876
|
}
|
|
877
|
-
})(meta)
|
|
878
|
-
|
|
877
|
+
})(meta);
|
|
878
|
+
(test => {
|
|
879
879
|
if (!test) {
|
|
880
880
|
throw new Error(`Expected the field ${parentDefinition.inverseKey} to be a relationship`);
|
|
881
881
|
}
|
|
882
|
-
})(meta && isRelationshipField(meta))
|
|
882
|
+
})(meta && isRelationshipField(meta));
|
|
883
883
|
meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);
|
|
884
|
-
|
|
884
|
+
(test => {
|
|
885
885
|
if (!test) {
|
|
886
886
|
throw new Error(`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.`);
|
|
887
887
|
}
|
|
888
|
-
})(!(meta.options.inverse === null && meta?.options.as?.length))
|
|
888
|
+
})(!(meta.options.inverse === null && meta?.options.as?.length));
|
|
889
889
|
const errors = validateSchema(parentDefinition, meta);
|
|
890
|
-
|
|
890
|
+
(test => {
|
|
891
891
|
if (!test) {
|
|
892
892
|
throw new Error(`The schema for the relationship '${parentDefinition.inverseKey}' on '${addedIdentifier.type}' type does not correctly implement '${parentDefinition.type}' and thus cannot be assigned to the '${parentDefinition.key}' relationship in '${parentIdentifier.type}'. If using this record in this polymorphic relationship is desired, correct the errors in the schema shown below:${printSchema(meta, errors)}`);
|
|
893
893
|
}
|
|
894
|
-
})(errors.size === 0)
|
|
894
|
+
})(errors.size === 0);
|
|
895
895
|
} else if (addedIdentifier.type !== parentDefinition.type) {
|
|
896
896
|
// if we are not polymorphic
|
|
897
897
|
// then the addedIdentifier.type must be the same as the parentDefinition.type
|
|
898
898
|
let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);
|
|
899
|
-
|
|
899
|
+
(test => {
|
|
900
900
|
if (!test) {
|
|
901
901
|
throw new Error(`Expected the field ${parentDefinition.inverseKey} to be a relationship`);
|
|
902
902
|
}
|
|
903
|
-
})(!meta || isRelationshipField(meta))
|
|
903
|
+
})(!meta || isRelationshipField(meta));
|
|
904
904
|
meta = meta && (isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta));
|
|
905
905
|
if (meta?.options.as === parentDefinition.type) {
|
|
906
906
|
// inverse is likely polymorphic but missing the polymorphic flag
|
|
907
907
|
let meta = store.schema.fields({
|
|
908
908
|
type: parentDefinition.inverseType
|
|
909
909
|
}).get(parentDefinition.key);
|
|
910
|
-
|
|
910
|
+
(test => {
|
|
911
911
|
if (!test) {
|
|
912
912
|
throw new Error(`Expected the field ${parentDefinition.key} to be a relationship`);
|
|
913
913
|
}
|
|
914
|
-
})(meta && isRelationshipField(meta))
|
|
914
|
+
})(meta && isRelationshipField(meta));
|
|
915
915
|
meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);
|
|
916
916
|
const errors = validateSchema(definitionWithPolymorphic(inverseDefinition(parentDefinition)), meta);
|
|
917
|
-
|
|
917
|
+
(test => {
|
|
918
918
|
{
|
|
919
919
|
throw new Error(`The '<${addedIdentifier.type}>.${parentDefinition.inverseKey}' relationship cannot be used polymorphically because '<${parentDefinition.inverseType}>.${parentDefinition.key} is not a polymorphic relationship. To use this relationship in a polymorphic manner, fix the following schema issues on the relationships schema for '${parentDefinition.inverseType}':${printSchema(meta, errors)}`);
|
|
920
920
|
}
|
|
921
|
-
})()
|
|
921
|
+
})();
|
|
922
922
|
} else {
|
|
923
|
-
|
|
923
|
+
(test => {
|
|
924
924
|
{
|
|
925
925
|
throw new Error(`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}'\`.`);
|
|
926
926
|
}
|
|
927
|
-
})()
|
|
927
|
+
})();
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
930
|
};
|
|
@@ -1000,11 +1000,11 @@ function replaceRelatedRecords(graph, op, isRemote) {
|
|
|
1000
1000
|
function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
1001
1001
|
const resourceKeys = op.value;
|
|
1002
1002
|
const relationship = graph.get(op.record, op.field);
|
|
1003
|
-
|
|
1003
|
+
(test => {
|
|
1004
1004
|
if (!test) {
|
|
1005
1005
|
throw new Error(`expected hasMany relationship`);
|
|
1006
1006
|
}
|
|
1007
|
-
})(isHasMany(relationship))
|
|
1007
|
+
})(isHasMany(relationship));
|
|
1008
1008
|
relationship.state.hasReceivedData = true;
|
|
1009
1009
|
const {
|
|
1010
1010
|
additions,
|
|
@@ -1019,7 +1019,7 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
|
1019
1019
|
} = op;
|
|
1020
1020
|
const wasDirty = relationship.isDirty;
|
|
1021
1021
|
let localBecameDirty = false;
|
|
1022
|
-
|
|
1022
|
+
{
|
|
1023
1023
|
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
1024
1024
|
count(`replaceRelatedRecordsLocal ${'type' in record ? record.type : '<document>'} ${op.field}`);
|
|
1025
1025
|
}
|
|
@@ -1030,7 +1030,7 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
|
1030
1030
|
const removalsHas = removals?.has(resourceKey);
|
|
1031
1031
|
if (removalsHas || !additions?.has(resourceKey)) {
|
|
1032
1032
|
if (type !== resourceKey.type) {
|
|
1033
|
-
|
|
1033
|
+
{
|
|
1034
1034
|
assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
|
|
1035
1035
|
}
|
|
1036
1036
|
graph.registerPolymorphicType(type, resourceKey.type);
|
|
@@ -1094,16 +1094,16 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
|
1094
1094
|
function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
1095
1095
|
const resourceKeys = op.value;
|
|
1096
1096
|
const relationship = graph.get(op.record, op.field);
|
|
1097
|
-
|
|
1097
|
+
{
|
|
1098
1098
|
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
1099
1099
|
count(`replaceRelatedRecordsRemote ${'type' in op.record ? op.record.type : '<document>'} ${op.field}`);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
|
|
1102
|
+
(test => {
|
|
1103
1103
|
if (!test) {
|
|
1104
1104
|
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
1105
1105
|
}
|
|
1106
|
-
})(isHasMany(relationship))
|
|
1106
|
+
})(isHasMany(relationship));
|
|
1107
1107
|
if (isRemote) {
|
|
1108
1108
|
graph._addToTransaction(relationship);
|
|
1109
1109
|
}
|
|
@@ -1126,7 +1126,7 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1126
1126
|
} = relationship.definition;
|
|
1127
1127
|
const diff = diffCollection(resourceKeys, relationship, resourceKey => {
|
|
1128
1128
|
if (type !== resourceKey.type) {
|
|
1129
|
-
|
|
1129
|
+
{
|
|
1130
1130
|
assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
|
|
1131
1131
|
}
|
|
1132
1132
|
graph.registerPolymorphicType(type, resourceKey.type);
|
|
@@ -1137,7 +1137,7 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1137
1137
|
if (relationship.additions?.has(resourceKey)) {
|
|
1138
1138
|
relationship.additions.delete(resourceKey);
|
|
1139
1139
|
} else {
|
|
1140
|
-
|
|
1140
|
+
{
|
|
1141
1141
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1142
1142
|
if (!relationship.isDirty) {
|
|
1143
1143
|
// eslint-disable-next-line no-console
|
|
@@ -1154,7 +1154,7 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1154
1154
|
if (relationship.removals?.has(resourceKey)) {
|
|
1155
1155
|
relationship.removals.delete(resourceKey);
|
|
1156
1156
|
} else {
|
|
1157
|
-
|
|
1157
|
+
{
|
|
1158
1158
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1159
1159
|
if (!relationship.isDirty) {
|
|
1160
1160
|
// eslint-disable-next-line no-console
|
|
@@ -1179,65 +1179,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1179
1179
|
// may allow us to more efficiently patch
|
|
1180
1180
|
// the associated ManyArray
|
|
1181
1181
|
relationship._diff = diff;
|
|
1182
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1183
|
-
// only do this for legacy hasMany, not collection
|
|
1184
|
-
// and provide a way to incrementally migrate
|
|
1185
|
-
if (
|
|
1186
|
-
// we do not guard by diff.changed here
|
|
1187
|
-
// because we want to clear local changes even if
|
|
1188
|
-
// no change has occurred to preserve the legacy behavior
|
|
1189
|
-
relationship.definition.kind === 'hasMany' && relationship.definition.resetOnRemoteUpdate !== false && (diff.changed || wasDirty)) {
|
|
1190
|
-
const deprecationInfo = {
|
|
1191
|
-
removals: [],
|
|
1192
|
-
additions: [],
|
|
1193
|
-
triggered: false
|
|
1194
|
-
};
|
|
1195
|
-
if (relationship.removals) {
|
|
1196
|
-
relationship.isDirty = true;
|
|
1197
|
-
relationship.removals.forEach(resourceKey => {
|
|
1198
|
-
deprecationInfo.triggered = true;
|
|
1199
|
-
deprecationInfo.removals.push(resourceKey);
|
|
1200
|
-
// reverse the removal
|
|
1201
|
-
// if we are still in removals at this point then
|
|
1202
|
-
// we were not "committed" which means we are present
|
|
1203
|
-
// in the remoteMembers. So we "add back" on the inverse.
|
|
1204
|
-
addToInverse(graph, resourceKey, definition.inverseKey, op.record, false);
|
|
1205
|
-
});
|
|
1206
|
-
relationship.removals = null;
|
|
1207
|
-
}
|
|
1208
|
-
if (relationship.additions) {
|
|
1209
|
-
relationship.additions.forEach(resourceKey => {
|
|
1210
|
-
// reverse the addition
|
|
1211
|
-
// if we are still in additions at this point then
|
|
1212
|
-
// we were not "committed" which means we are not present
|
|
1213
|
-
// in the remoteMembers. So we "remove" from the inverse.
|
|
1214
|
-
// however we only do this if we are not a "new" record.
|
|
1215
|
-
if (!checkIfNew(graph._realStore, resourceKey)) {
|
|
1216
|
-
deprecationInfo.triggered = true;
|
|
1217
|
-
deprecationInfo.additions.push(resourceKey);
|
|
1218
|
-
relationship.isDirty = true;
|
|
1219
|
-
relationship.additions.delete(resourceKey);
|
|
1220
|
-
removeFromInverse(graph, resourceKey, definition.inverseKey, op.record, false);
|
|
1221
|
-
}
|
|
1222
|
-
});
|
|
1223
|
-
if (relationship.additions.size === 0) {
|
|
1224
|
-
relationship.additions = null;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
if (deprecationInfo.triggered) {
|
|
1228
|
-
deprecate(`WarpDrive is changing the default semantics of updates to the remote state of relationships.\n\nThe following local state was cleared from the <${relationship.identifier.type}>.${relationship.definition.key} hasMany relationship but will not be once this deprecation is resolved by opting into the new behavior:\n\n\tAdded: [${deprecationInfo.additions.map(i => i.lid).join(', ')}]\n\tRemoved: [${deprecationInfo.removals.map(i => i.lid).join(', ')}]`, false, {
|
|
1229
|
-
id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',
|
|
1230
|
-
for: 'ember-data',
|
|
1231
|
-
since: {
|
|
1232
|
-
enabled: '5.3',
|
|
1233
|
-
available: '4.13'
|
|
1234
|
-
},
|
|
1235
|
-
until: '6.0',
|
|
1236
|
-
url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state'
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
1182
|
if (relationship.isDirty && !wasDirty) {
|
|
1242
1183
|
flushCanonical(graph, relationship);
|
|
1243
1184
|
}
|
|
@@ -1248,7 +1189,7 @@ function addToInverse(graph, resourceKey, key, value, isRemote) {
|
|
|
1248
1189
|
type
|
|
1249
1190
|
} = relationship.definition;
|
|
1250
1191
|
if (type !== value.type) {
|
|
1251
|
-
|
|
1192
|
+
{
|
|
1252
1193
|
assertPolymorphicType(relationship.identifier, relationship.definition, value, graph.store);
|
|
1253
1194
|
}
|
|
1254
1195
|
graph.registerPolymorphicType(type, value.type);
|
|
@@ -1360,11 +1301,11 @@ function flushCanonical(graph, rel) {
|
|
|
1360
1301
|
}
|
|
1361
1302
|
function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
1362
1303
|
const relationship = graph.get(op.record, op.field);
|
|
1363
|
-
|
|
1304
|
+
(test => {
|
|
1364
1305
|
if (!test) {
|
|
1365
1306
|
throw new Error(`You can only '${op.op}' on a belongsTo relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
1366
1307
|
}
|
|
1367
|
-
})(isBelongsTo(relationship))
|
|
1308
|
+
})(isBelongsTo(relationship));
|
|
1368
1309
|
if (isRemote) {
|
|
1369
1310
|
graph._addToTransaction(relationship);
|
|
1370
1311
|
}
|
|
@@ -1425,23 +1366,6 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1425
1366
|
}
|
|
1426
1367
|
if (existingState && localState === existingState) {
|
|
1427
1368
|
notifyInverseOfPotentialMaterialization(graph, existingState, definition.inverseKey, op.record, isRemote);
|
|
1428
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1429
|
-
// if localState does not match existingState then we know
|
|
1430
|
-
// we have a local mutation that has not been persisted yet
|
|
1431
|
-
if (localState !== op.value && relationship.definition.resetOnRemoteUpdate !== false) {
|
|
1432
|
-
relationship.localState = existingState;
|
|
1433
|
-
deprecate(`WarpDrive is changing the default semantics of updates to the remote state of relationships.\n\nThe following local state was cleared from the <${relationship.identifier.type}>.${relationship.definition.key} belongsTo relationship but will not be once this deprecation is resolved:\n\n\t${localState ? 'Added: ' + localState.lid + '\n\t' : ''}${existingState ? 'Removed: ' + existingState.lid : ''}`, false, {
|
|
1434
|
-
id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',
|
|
1435
|
-
for: 'ember-data',
|
|
1436
|
-
since: {
|
|
1437
|
-
enabled: '5.3',
|
|
1438
|
-
available: '4.13'
|
|
1439
|
-
},
|
|
1440
|
-
until: '6.0',
|
|
1441
|
-
url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state'
|
|
1442
|
-
});
|
|
1443
|
-
notifyChange(graph, relationship);
|
|
1444
|
-
}
|
|
1445
1369
|
}
|
|
1446
1370
|
}
|
|
1447
1371
|
return;
|
|
@@ -1469,7 +1393,7 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1469
1393
|
// but the record does turn out to be polymorphic
|
|
1470
1394
|
// this should still assert if the user is relying on legacy inheritance/mixins to
|
|
1471
1395
|
// provide polymorphic behavior and has not yet added the polymorphic flags
|
|
1472
|
-
|
|
1396
|
+
{
|
|
1473
1397
|
assertPolymorphicType(relationship.identifier, definition, op.value, graph.store);
|
|
1474
1398
|
}
|
|
1475
1399
|
graph.registerPolymorphicType(definition.type, op.value.type);
|
|
@@ -1493,141 +1417,11 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1493
1417
|
// But when localState does not match the new remoteState and
|
|
1494
1418
|
// and localState !== existingState then we know we have a local mutation
|
|
1495
1419
|
// that has not been persisted yet.
|
|
1496
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1497
|
-
if (localState !== remoteState && localState !== existingState && relationship.definition.resetOnRemoteUpdate !== false) {
|
|
1498
|
-
relationship.localState = remoteState;
|
|
1499
|
-
deprecate(`WarpDrive is changing the default semantics of updates to the remote state of relationships.\n\nThe following local state was cleared from the <${relationship.identifier.type}>.${relationship.definition.key} belongsTo relationship but will not be once this deprecation is resolved:\n\n\t${localState ? 'Added: ' + localState.lid + '\n\t' : ''}${existingState ? 'Removed: ' + existingState.lid : ''}`, false, {
|
|
1500
|
-
id: 'ember-data:deprecate-relationship-remote-update-clearing-local-state',
|
|
1501
|
-
for: 'ember-data',
|
|
1502
|
-
since: {
|
|
1503
|
-
enabled: '5.3',
|
|
1504
|
-
available: '4.13'
|
|
1505
|
-
},
|
|
1506
|
-
until: '6.0',
|
|
1507
|
-
url: 'https://deprecations.emberjs.com/v5.x#ember-data-deprecate-relationship-remote-update-clearing-local-state'
|
|
1508
|
-
});
|
|
1509
|
-
notifyChange(graph, relationship);
|
|
1510
|
-
}
|
|
1511
1420
|
}
|
|
1512
1421
|
} else {
|
|
1513
1422
|
notifyChange(graph, relationship);
|
|
1514
1423
|
}
|
|
1515
1424
|
}
|
|
1516
|
-
function _deprecatedCompare(priorLocalState, newState, newMembers, prevState, prevSet, onAdd, onDel, remoteClearsLocal) {
|
|
1517
|
-
const newLength = newState.length;
|
|
1518
|
-
const prevLength = prevState.length;
|
|
1519
|
-
const iterationLength = Math.max(newLength, prevLength);
|
|
1520
|
-
let changed = newMembers.size !== prevSet.size;
|
|
1521
|
-
let remoteOrderChanged = false;
|
|
1522
|
-
const added = new Set();
|
|
1523
|
-
const removed = new Set();
|
|
1524
|
-
const duplicates = new Map();
|
|
1525
|
-
const finalSet = new Set();
|
|
1526
|
-
const finalState = [];
|
|
1527
|
-
const priorLocalLength = priorLocalState?.length ?? 0;
|
|
1528
|
-
for (let i = 0, j = 0; i < iterationLength; i++) {
|
|
1529
|
-
let adv = false;
|
|
1530
|
-
let member;
|
|
1531
|
-
|
|
1532
|
-
// accumulate anything added
|
|
1533
|
-
if (i < newLength) {
|
|
1534
|
-
member = newState[i];
|
|
1535
|
-
if (!finalSet.has(member)) {
|
|
1536
|
-
finalState[j] = member;
|
|
1537
|
-
finalSet.add(member);
|
|
1538
|
-
adv = true;
|
|
1539
|
-
if (!prevSet.has(member)) {
|
|
1540
|
-
// Avoid unnecessarily notifying a change that already exists locally
|
|
1541
|
-
if (i < priorLocalLength) {
|
|
1542
|
-
const priorLocalMember = priorLocalState[i];
|
|
1543
|
-
if (priorLocalMember !== member) {
|
|
1544
|
-
changed = true;
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
added.add(member);
|
|
1548
|
-
onAdd(member);
|
|
1549
|
-
}
|
|
1550
|
-
} else {
|
|
1551
|
-
let list = duplicates.get(member);
|
|
1552
|
-
if (list === undefined) {
|
|
1553
|
-
list = [];
|
|
1554
|
-
duplicates.set(member, list);
|
|
1555
|
-
}
|
|
1556
|
-
list.push(i);
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
// accumulate anything removed
|
|
1561
|
-
if (i < prevLength) {
|
|
1562
|
-
const prevMember = prevState[i];
|
|
1563
|
-
|
|
1564
|
-
// detect reordering, adjusting index for duplicates
|
|
1565
|
-
// j is always less than i and so if i < prevLength, j < prevLength
|
|
1566
|
-
if (member !== prevState[j]) {
|
|
1567
|
-
// the new remote order does not match the current remote order
|
|
1568
|
-
// indicating a change in membership or reordering
|
|
1569
|
-
remoteOrderChanged = true;
|
|
1570
|
-
// however: if the new remote order matches the current local order
|
|
1571
|
-
// we can disregard the change notification generation so long as
|
|
1572
|
-
// we are not configured to reset on remote update (which is deprecated)
|
|
1573
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1574
|
-
if (!remoteClearsLocal && i < priorLocalLength) {
|
|
1575
|
-
const priorLocalMember = priorLocalState[j];
|
|
1576
|
-
if (priorLocalMember !== member) {
|
|
1577
|
-
changed = true;
|
|
1578
|
-
}
|
|
1579
|
-
} else {
|
|
1580
|
-
changed = true;
|
|
1581
|
-
}
|
|
1582
|
-
} else {
|
|
1583
|
-
if (i < priorLocalLength) {
|
|
1584
|
-
const priorLocalMember = priorLocalState[j];
|
|
1585
|
-
if (priorLocalMember !== member) {
|
|
1586
|
-
changed = true;
|
|
1587
|
-
}
|
|
1588
|
-
} else {
|
|
1589
|
-
changed = true;
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
// if remote order hasn't changed but local order differs
|
|
1594
|
-
// and we are configured to reset on remote update (which is deprecated)
|
|
1595
|
-
// then we still need to mark the relationship as changed
|
|
1596
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1597
|
-
if (remoteClearsLocal) {
|
|
1598
|
-
if (!changed && j < priorLocalLength) {
|
|
1599
|
-
const priorLocalMember = priorLocalState[j];
|
|
1600
|
-
if (priorLocalMember !== member) {
|
|
1601
|
-
changed = true;
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
if (!newMembers.has(prevMember)) {
|
|
1607
|
-
changed = true;
|
|
1608
|
-
removed.add(prevMember);
|
|
1609
|
-
onDel(prevMember);
|
|
1610
|
-
}
|
|
1611
|
-
} else if (adv && j < prevLength && member !== prevState[j]) {
|
|
1612
|
-
changed = true;
|
|
1613
|
-
}
|
|
1614
|
-
if (adv) {
|
|
1615
|
-
j++;
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
const diff = {
|
|
1619
|
-
add: added,
|
|
1620
|
-
del: removed,
|
|
1621
|
-
finalState,
|
|
1622
|
-
finalSet,
|
|
1623
|
-
changed,
|
|
1624
|
-
remoteOrderChanged
|
|
1625
|
-
};
|
|
1626
|
-
return {
|
|
1627
|
-
diff,
|
|
1628
|
-
duplicates
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
1425
|
function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onAdd, onDel, remoteClearsLocal) {
|
|
1632
1426
|
const finalLength = finalState.length;
|
|
1633
1427
|
const prevLength = prevState.length;
|
|
@@ -1638,7 +1432,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1638
1432
|
const added = new Set();
|
|
1639
1433
|
const removed = new Set();
|
|
1640
1434
|
const priorLocalLength = priorLocalState?.length ?? 0;
|
|
1641
|
-
|
|
1435
|
+
{
|
|
1642
1436
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1643
1437
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1644
1438
|
changed &&
|
|
@@ -1657,7 +1451,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1657
1451
|
if (i < priorLocalLength) {
|
|
1658
1452
|
const priorLocalMember = priorLocalState[i];
|
|
1659
1453
|
if (priorLocalMember !== member) {
|
|
1660
|
-
|
|
1454
|
+
{
|
|
1661
1455
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1662
1456
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1663
1457
|
!changed && console.log(`changed because priorLocalMember !== member && !prevSet.has(member)`);
|
|
@@ -1687,7 +1481,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1687
1481
|
if (i < priorLocalLength) {
|
|
1688
1482
|
const priorLocalMember = priorLocalState[i];
|
|
1689
1483
|
if (priorLocalMember !== member) {
|
|
1690
|
-
|
|
1484
|
+
{
|
|
1691
1485
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1692
1486
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1693
1487
|
!changed && console.log(`changed because priorLocalMember !== member && member !== prevMember`);
|
|
@@ -1698,7 +1492,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1698
1492
|
} else if (i < finalLength) {
|
|
1699
1493
|
// if we have exceeded the length of priorLocalState and we are within the range
|
|
1700
1494
|
// of the finalState then we must have changed
|
|
1701
|
-
|
|
1495
|
+
{
|
|
1702
1496
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1703
1497
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1704
1498
|
!changed && console.log(`changed because priorMember !== member && index >= priorLocalLength`);
|
|
@@ -1710,21 +1504,6 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1710
1504
|
// if remote order hasn't changed but local order differs
|
|
1711
1505
|
// and we are configured to reset on remote update (which is deprecated)
|
|
1712
1506
|
// then we still need to mark the relationship as changed
|
|
1713
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE)) {
|
|
1714
|
-
if (remoteClearsLocal) {
|
|
1715
|
-
if (equalLength && !changed && i < priorLocalLength) {
|
|
1716
|
-
const priorLocalMember = priorLocalState[i];
|
|
1717
|
-
if (priorLocalMember !== prevMember) {
|
|
1718
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1719
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1720
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1721
|
-
!changed && console.log(`changed because priorLocalMember !== prevMember && remoteClearsLocal`);
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
changed = true;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
1507
|
}
|
|
1729
1508
|
if (!finalSet.has(prevMember)) {
|
|
1730
1509
|
// if we are within finalLength, we can only be "changed" if we've already exceeded
|
|
@@ -1765,15 +1544,14 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1765
1544
|
// if you do not have a priorLocalState you can't be changed
|
|
1766
1545
|
// ergo, we never need to set changed in this branch.
|
|
1767
1546
|
// this log can still be useful for debugging.
|
|
1768
|
-
|
|
1547
|
+
{
|
|
1769
1548
|
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1770
1549
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1771
1550
|
!changed &&
|
|
1772
1551
|
// eslint-disable-next-line no-console
|
|
1773
1552
|
console.log(`changed because i >= priorLocalLength && i < finalLength && !finalSet.has(prevMember)`);
|
|
1774
1553
|
}
|
|
1775
|
-
}
|
|
1776
|
-
//
|
|
1554
|
+
} //
|
|
1777
1555
|
// we do still set remoteOrderChanged as it has
|
|
1778
1556
|
remoteOrderChanged = true;
|
|
1779
1557
|
removed.add(prevMember);
|
|
@@ -1797,43 +1575,22 @@ function diffCollection(finalState, relationship, onAdd, onDel) {
|
|
|
1797
1575
|
remoteState,
|
|
1798
1576
|
remoteMembers
|
|
1799
1577
|
} = relationship;
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
const {
|
|
1803
|
-
diff,
|
|
1804
|
-
duplicates
|
|
1805
|
-
} = _deprecatedCompare(priorLocalState, finalState, finalSet, remoteState, remoteMembers, onAdd, onDel, relationship.definition.resetOnRemoteUpdate);
|
|
1806
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1807
|
-
deprecate(`Expected all entries in the relationship ${relationship.definition.type}:${relationship.definition.key} to be unique, see log for a list of duplicate entry indeces`, false, {
|
|
1808
|
-
id: 'ember-data:deprecate-non-unique-relationship-entries',
|
|
1809
|
-
for: 'ember-data',
|
|
1810
|
-
until: '6.0',
|
|
1811
|
-
since: {
|
|
1812
|
-
available: '4.13',
|
|
1813
|
-
enabled: '5.3'
|
|
1814
|
-
}
|
|
1815
|
-
});
|
|
1816
|
-
// eslint-disable-next-line no-console
|
|
1817
|
-
console.log(duplicates);
|
|
1818
|
-
}
|
|
1819
|
-
return diff;
|
|
1820
|
-
}
|
|
1821
|
-
} else {
|
|
1822
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1578
|
+
{
|
|
1579
|
+
(test => {
|
|
1823
1580
|
if (!test) {
|
|
1824
1581
|
throw new Error(`Expected all entries in the relationship to be unique, found duplicates`);
|
|
1825
1582
|
}
|
|
1826
|
-
})(finalState.length === finalSet.size)
|
|
1583
|
+
})(finalState.length === finalSet.size);
|
|
1827
1584
|
}
|
|
1828
1585
|
return _compare(priorLocalState, finalState, finalSet, remoteState, remoteMembers, onAdd, onDel, relationship.definition.resetOnRemoteUpdate);
|
|
1829
1586
|
}
|
|
1830
1587
|
function computeLocalState(storage) {
|
|
1831
1588
|
if (!storage.isDirty) {
|
|
1832
|
-
|
|
1589
|
+
(test => {
|
|
1833
1590
|
if (!test) {
|
|
1834
1591
|
throw new Error(`Expected localState to be present`);
|
|
1835
1592
|
}
|
|
1836
|
-
})(Array.isArray(storage.localState))
|
|
1593
|
+
})(Array.isArray(storage.localState));
|
|
1837
1594
|
return storage.localState;
|
|
1838
1595
|
}
|
|
1839
1596
|
const state = storage.remoteState.slice();
|
|
@@ -1865,33 +1622,33 @@ function _add(graph, record, relationship, value, index, isRemote) {
|
|
|
1865
1622
|
return !isRemote ? _addLocal(graph, record, relationship, value, index) : _addRemote(graph, record, relationship, value, index);
|
|
1866
1623
|
}
|
|
1867
1624
|
function _addRemote(graph, record, relationship, value, index) {
|
|
1868
|
-
|
|
1625
|
+
(test => {
|
|
1869
1626
|
if (!test) {
|
|
1870
1627
|
throw new Error(`expected an identifier to add to the collection relationship`);
|
|
1871
1628
|
}
|
|
1872
|
-
})(value)
|
|
1629
|
+
})(value);
|
|
1873
1630
|
const {
|
|
1874
1631
|
remoteMembers,
|
|
1875
1632
|
additions,
|
|
1876
1633
|
removals,
|
|
1877
1634
|
remoteState
|
|
1878
1635
|
} = relationship;
|
|
1879
|
-
|
|
1636
|
+
(test => {
|
|
1880
1637
|
if (!test) {
|
|
1881
1638
|
throw new Error(`Cannot add a resource that is already present`);
|
|
1882
1639
|
}
|
|
1883
|
-
})(!remoteMembers.has(value))
|
|
1640
|
+
})(!remoteMembers.has(value));
|
|
1884
1641
|
if (remoteMembers.has(value)) {
|
|
1885
1642
|
return false;
|
|
1886
1643
|
}
|
|
1887
1644
|
|
|
1888
1645
|
// add to the remote state
|
|
1889
1646
|
remoteMembers.add(value);
|
|
1890
|
-
|
|
1647
|
+
(test => {
|
|
1891
1648
|
if (!test) {
|
|
1892
1649
|
throw new Error(`Cannot insert at an index that is not in bounds`);
|
|
1893
1650
|
}
|
|
1894
|
-
})(index === null || index >= 0 && index < remoteState.length)
|
|
1651
|
+
})(index === null || index >= 0 && index < remoteState.length);
|
|
1895
1652
|
const hasValidIndex = index !== null && index >= 0 && index < remoteState.length;
|
|
1896
1653
|
if (hasValidIndex) {
|
|
1897
1654
|
remoteState.splice(index, 0, value);
|
|
@@ -1906,11 +1663,11 @@ function _addRemote(graph, record, relationship, value, index) {
|
|
|
1906
1663
|
// nothing more to do this was our state already
|
|
1907
1664
|
return false;
|
|
1908
1665
|
}
|
|
1909
|
-
|
|
1666
|
+
(test => {
|
|
1910
1667
|
if (!test) {
|
|
1911
1668
|
throw new Error(`Remote state indicated addition of a resource that was present only as a local mutation`);
|
|
1912
1669
|
}
|
|
1913
|
-
})(!removals?.has(value))
|
|
1670
|
+
})(!removals?.has(value));
|
|
1914
1671
|
|
|
1915
1672
|
// if the relationship already needs to recalc, we don't bother
|
|
1916
1673
|
// attempting to patch the localState
|
|
@@ -1945,11 +1702,11 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1945
1702
|
let additions = relationship.additions;
|
|
1946
1703
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
1947
1704
|
if (hasPresence && !removals?.has(value)) {
|
|
1948
|
-
|
|
1705
|
+
(test => {
|
|
1949
1706
|
if (!test) {
|
|
1950
1707
|
throw new Error(`Attempted to add the resource '${value.lid}' to the collection <${relationship.identifier.type}>.${relationship.definition.key} it was already in`);
|
|
1951
1708
|
}
|
|
1952
|
-
})(hasPresence && !removals?.has(value))
|
|
1709
|
+
})(hasPresence && !removals?.has(value));
|
|
1953
1710
|
return false;
|
|
1954
1711
|
}
|
|
1955
1712
|
if (removals?.has(value)) {
|
|
@@ -1964,7 +1721,7 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1964
1721
|
type
|
|
1965
1722
|
} = relationship.definition;
|
|
1966
1723
|
if (type !== value.type) {
|
|
1967
|
-
|
|
1724
|
+
{
|
|
1968
1725
|
assertPolymorphicType(record, relationship.definition, value, graph.store);
|
|
1969
1726
|
}
|
|
1970
1727
|
graph.registerPolymorphicType(value.type, type);
|
|
@@ -1991,11 +1748,11 @@ function _remove(graph, record, relationship, value, index, isRemote) {
|
|
|
1991
1748
|
return !isRemote ? _removeLocal(relationship, value) : _removeRemote(relationship, value);
|
|
1992
1749
|
}
|
|
1993
1750
|
function _removeLocal(relationship, value) {
|
|
1994
|
-
|
|
1751
|
+
(test => {
|
|
1995
1752
|
if (!test) {
|
|
1996
1753
|
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
1997
1754
|
}
|
|
1998
|
-
})(value)
|
|
1755
|
+
})(value);
|
|
1999
1756
|
const {
|
|
2000
1757
|
remoteMembers,
|
|
2001
1758
|
additions
|
|
@@ -2003,11 +1760,11 @@ function _removeLocal(relationship, value) {
|
|
|
2003
1760
|
let removals = relationship.removals;
|
|
2004
1761
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
2005
1762
|
if (!hasPresence || removals?.has(value)) {
|
|
2006
|
-
|
|
1763
|
+
(test => {
|
|
2007
1764
|
if (!test) {
|
|
2008
1765
|
throw new Error(`Attempted to remove the resource '${value.lid}' from the collection <${relationship.identifier.type}>.${relationship.definition.key} but it was not present`);
|
|
2009
1766
|
}
|
|
2010
|
-
})(!hasPresence || removals?.has(value))
|
|
1767
|
+
})(!hasPresence || removals?.has(value));
|
|
2011
1768
|
return false;
|
|
2012
1769
|
}
|
|
2013
1770
|
if (additions?.has(value)) {
|
|
@@ -2027,37 +1784,37 @@ function _removeLocal(relationship, value) {
|
|
|
2027
1784
|
// be relied upon as any remote change will blow it away
|
|
2028
1785
|
if (relationship.localState) {
|
|
2029
1786
|
const index = relationship.localState.indexOf(value);
|
|
2030
|
-
|
|
1787
|
+
(test => {
|
|
2031
1788
|
if (!test) {
|
|
2032
1789
|
throw new Error(`Cannot remove a resource that is not present`);
|
|
2033
1790
|
}
|
|
2034
|
-
})(index !== -1)
|
|
1791
|
+
})(index !== -1);
|
|
2035
1792
|
relationship.localState.splice(index, 1);
|
|
2036
1793
|
}
|
|
2037
|
-
|
|
1794
|
+
(test => {
|
|
2038
1795
|
if (!test) {
|
|
2039
1796
|
throw new Error(`Expected relationship to be dirty when performing a local mutation`);
|
|
2040
1797
|
}
|
|
2041
|
-
})(relationship.localState || relationship.isDirty)
|
|
1798
|
+
})(relationship.localState || relationship.isDirty);
|
|
2042
1799
|
return true;
|
|
2043
1800
|
}
|
|
2044
1801
|
function _removeRemote(relationship, value) {
|
|
2045
|
-
|
|
1802
|
+
(test => {
|
|
2046
1803
|
if (!test) {
|
|
2047
1804
|
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
2048
1805
|
}
|
|
2049
|
-
})(value)
|
|
1806
|
+
})(value);
|
|
2050
1807
|
const {
|
|
2051
1808
|
remoteMembers,
|
|
2052
1809
|
additions,
|
|
2053
1810
|
removals,
|
|
2054
1811
|
remoteState
|
|
2055
1812
|
} = relationship;
|
|
2056
|
-
|
|
1813
|
+
(test => {
|
|
2057
1814
|
if (!test) {
|
|
2058
1815
|
throw new Error(`Cannot remove a resource that is not present`);
|
|
2059
1816
|
}
|
|
2060
|
-
})(remoteMembers.has(value))
|
|
1817
|
+
})(remoteMembers.has(value));
|
|
2061
1818
|
if (!remoteMembers.has(value)) {
|
|
2062
1819
|
return false;
|
|
2063
1820
|
}
|
|
@@ -2065,11 +1822,11 @@ function _removeRemote(relationship, value) {
|
|
|
2065
1822
|
// remove from remote state
|
|
2066
1823
|
remoteMembers.delete(value);
|
|
2067
1824
|
let index = remoteState.indexOf(value);
|
|
2068
|
-
|
|
1825
|
+
(test => {
|
|
2069
1826
|
if (!test) {
|
|
2070
1827
|
throw new Error(`Cannot remove a resource that is not present`);
|
|
2071
1828
|
}
|
|
2072
|
-
})(index !== -1)
|
|
1829
|
+
})(index !== -1);
|
|
2073
1830
|
remoteState.splice(index, 1);
|
|
2074
1831
|
|
|
2075
1832
|
// remove from removals if present
|
|
@@ -2079,11 +1836,11 @@ function _removeRemote(relationship, value) {
|
|
|
2079
1836
|
// nothing more to do this was our state already
|
|
2080
1837
|
return false;
|
|
2081
1838
|
}
|
|
2082
|
-
|
|
1839
|
+
(test => {
|
|
2083
1840
|
if (!test) {
|
|
2084
1841
|
throw new Error(`Remote state indicated removal of a resource that was present only as a local mutation`);
|
|
2085
1842
|
}
|
|
2086
|
-
})(!additions?.has(value))
|
|
1843
|
+
})(!additions?.has(value));
|
|
2087
1844
|
|
|
2088
1845
|
// if we have existing localState
|
|
2089
1846
|
// and we have an index
|
|
@@ -2094,18 +1851,18 @@ function _removeRemote(relationship, value) {
|
|
|
2094
1851
|
// be relied upon as any remote change will blow it away
|
|
2095
1852
|
if (relationship.localState) {
|
|
2096
1853
|
index = relationship.localState.indexOf(value);
|
|
2097
|
-
|
|
1854
|
+
(test => {
|
|
2098
1855
|
if (!test) {
|
|
2099
1856
|
throw new Error(`Cannot remove a resource that is not present`);
|
|
2100
1857
|
}
|
|
2101
|
-
})(index !== -1)
|
|
1858
|
+
})(index !== -1);
|
|
2102
1859
|
relationship.localState.splice(index, 1);
|
|
2103
1860
|
}
|
|
2104
|
-
|
|
1861
|
+
(test => {
|
|
2105
1862
|
if (!test) {
|
|
2106
1863
|
throw new Error(`Expected relationship to be dirty when performing a local mutation`);
|
|
2107
1864
|
}
|
|
2108
|
-
})(relationship.localState || relationship.isDirty)
|
|
1865
|
+
})(relationship.localState || relationship.isDirty);
|
|
2109
1866
|
return true;
|
|
2110
1867
|
}
|
|
2111
1868
|
function rollbackRelationship(graph, key, field, relationship) {
|
|
@@ -2275,18 +2032,18 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2275
2032
|
};
|
|
2276
2033
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2277
2034
|
}
|
|
2278
|
-
|
|
2035
|
+
(test => {
|
|
2279
2036
|
if (!test) {
|
|
2280
2037
|
throw new Error(`Expected '${value?.lid}' (the value to add) to NOT be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`);
|
|
2281
2038
|
}
|
|
2282
|
-
})(value === relationship.remoteState)
|
|
2039
|
+
})(value === relationship.remoteState);
|
|
2283
2040
|
return;
|
|
2284
2041
|
}
|
|
2285
|
-
|
|
2042
|
+
(test => {
|
|
2286
2043
|
if (!test) {
|
|
2287
2044
|
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
2288
2045
|
}
|
|
2289
|
-
})(isHasMany(relationship))
|
|
2046
|
+
})(isHasMany(relationship));
|
|
2290
2047
|
|
|
2291
2048
|
// if we are not dirty but have a null localState then we
|
|
2292
2049
|
// are mutating a relationship that has never been fetched
|
|
@@ -2304,11 +2061,11 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2304
2061
|
notifyChange(graph, relationship);
|
|
2305
2062
|
}
|
|
2306
2063
|
function addRelatedRecord(graph, relationship, record, value, index, isRemote) {
|
|
2307
|
-
|
|
2064
|
+
(test => {
|
|
2308
2065
|
if (!test) {
|
|
2309
2066
|
throw new Error(`expected an identifier to add to the collection relationship`);
|
|
2310
2067
|
}
|
|
2311
|
-
})(value)
|
|
2068
|
+
})(value);
|
|
2312
2069
|
if (_add(graph, record, relationship, value, index, isRemote)) {
|
|
2313
2070
|
addToInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2314
2071
|
}
|
|
@@ -2396,18 +2153,18 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2396
2153
|
};
|
|
2397
2154
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2398
2155
|
}
|
|
2399
|
-
|
|
2156
|
+
(test => {
|
|
2400
2157
|
if (!test) {
|
|
2401
2158
|
throw new Error(`Expected '${value?.lid}' (the value to remove) to be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`);
|
|
2402
2159
|
}
|
|
2403
|
-
})(value === relationship.remoteState)
|
|
2160
|
+
})(value === relationship.remoteState);
|
|
2404
2161
|
return;
|
|
2405
2162
|
}
|
|
2406
|
-
|
|
2163
|
+
(test => {
|
|
2407
2164
|
if (!test) {
|
|
2408
2165
|
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
2409
2166
|
}
|
|
2410
|
-
})(isHasMany(relationship))
|
|
2167
|
+
})(isHasMany(relationship));
|
|
2411
2168
|
if (Array.isArray(value)) {
|
|
2412
2169
|
for (let i = 0; i < value.length; i++) {
|
|
2413
2170
|
removeRelatedRecord(graph, record, relationship, value[i], op.index ?? null, isRemote);
|
|
@@ -2418,11 +2175,11 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2418
2175
|
notifyChange(graph, relationship);
|
|
2419
2176
|
}
|
|
2420
2177
|
function removeRelatedRecord(graph, record, relationship, value, index, isRemote) {
|
|
2421
|
-
|
|
2178
|
+
(test => {
|
|
2422
2179
|
if (!test) {
|
|
2423
2180
|
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
2424
2181
|
}
|
|
2425
|
-
})(value)
|
|
2182
|
+
})(value);
|
|
2426
2183
|
if (_remove(graph, record, relationship, value, index, isRemote)) {
|
|
2427
2184
|
removeFromInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2428
2185
|
}
|
|
@@ -2451,11 +2208,11 @@ function _normalizeLink(link) {
|
|
|
2451
2208
|
*/
|
|
2452
2209
|
function updateRelationshipOperation(graph, op) {
|
|
2453
2210
|
const relationship = graph.get(op.record, op.field);
|
|
2454
|
-
|
|
2211
|
+
(test => {
|
|
2455
2212
|
if (!test) {
|
|
2456
2213
|
throw new Error(`Cannot update an implicit relationship`);
|
|
2457
2214
|
}
|
|
2458
|
-
})(isHasMany(relationship) || isBelongsTo(relationship))
|
|
2215
|
+
})(isHasMany(relationship) || isBelongsTo(relationship));
|
|
2459
2216
|
const {
|
|
2460
2217
|
definition,
|
|
2461
2218
|
state,
|
|
@@ -2478,11 +2235,11 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2478
2235
|
if (payload.data === null) {
|
|
2479
2236
|
payload.data = [];
|
|
2480
2237
|
}
|
|
2481
|
-
|
|
2238
|
+
(test => {
|
|
2482
2239
|
if (!test) {
|
|
2483
2240
|
throw new Error(`Expected an array`);
|
|
2484
2241
|
}
|
|
2485
|
-
})(Array.isArray(payload.data))
|
|
2242
|
+
})(Array.isArray(payload.data));
|
|
2486
2243
|
const cache = graph.store.cacheKeyManager;
|
|
2487
2244
|
graph.update({
|
|
2488
2245
|
op: 'replaceRelatedRecords',
|
|
@@ -2524,14 +2281,14 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2524
2281
|
const currentLink = originalLinks && originalLinks.related ? _normalizeLink(originalLinks.related) : null;
|
|
2525
2282
|
const currentLinkHref = currentLink ? currentLink.href : null;
|
|
2526
2283
|
if (relatedLink && relatedLink.href && relatedLink.href !== currentLinkHref) {
|
|
2527
|
-
warn(`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.`, definition.isAsync || state.hasReceivedData, {
|
|
2284
|
+
console.warn(`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.`, definition.isAsync || state.hasReceivedData, {
|
|
2528
2285
|
id: 'ds.store.push-link-for-sync-relationship'
|
|
2529
2286
|
});
|
|
2530
|
-
|
|
2287
|
+
(test => {
|
|
2531
2288
|
if (!test) {
|
|
2532
2289
|
throw new Error(`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.`);
|
|
2533
2290
|
}
|
|
2534
|
-
})(typeof relatedLink.href === 'string' || relatedLink.href === null)
|
|
2291
|
+
})(typeof relatedLink.href === 'string' || relatedLink.href === null);
|
|
2535
2292
|
hasUpdatedLink = true;
|
|
2536
2293
|
}
|
|
2537
2294
|
}
|
|
@@ -2643,11 +2400,11 @@ class Graph {
|
|
|
2643
2400
|
let meta = defs?.[propertyName];
|
|
2644
2401
|
if (!meta) {
|
|
2645
2402
|
const info = /*#__NOINLINE__*/upgradeDefinition(this, resourceKey, propertyName);
|
|
2646
|
-
|
|
2403
|
+
(test => {
|
|
2647
2404
|
if (!test) {
|
|
2648
2405
|
throw new Error(`Could not determine relationship information for ${resourceKey.type}.${propertyName}`);
|
|
2649
2406
|
}
|
|
2650
|
-
})(info !== null)
|
|
2407
|
+
})(info !== null);
|
|
2651
2408
|
|
|
2652
2409
|
// if (info.rhs_definition?.kind === 'implicit') {
|
|
2653
2410
|
// we should possibly also do this
|
|
@@ -2662,11 +2419,11 @@ class Graph {
|
|
|
2662
2419
|
return meta;
|
|
2663
2420
|
}
|
|
2664
2421
|
get(resourceKey, propertyName) {
|
|
2665
|
-
|
|
2422
|
+
(test => {
|
|
2666
2423
|
if (!test) {
|
|
2667
2424
|
throw new Error(`expected propertyName`);
|
|
2668
2425
|
}
|
|
2669
|
-
})(propertyName)
|
|
2426
|
+
})(propertyName);
|
|
2670
2427
|
let relationships = this.identifiers.get(resourceKey);
|
|
2671
2428
|
if (!relationships) {
|
|
2672
2429
|
relationships = Object.create(null);
|
|
@@ -2680,11 +2437,11 @@ class Graph {
|
|
|
2680
2437
|
} else if (meta.kind === 'hasMany') {
|
|
2681
2438
|
relationship = relationships[propertyName] = createCollectionEdge(meta, resourceKey);
|
|
2682
2439
|
} else {
|
|
2683
|
-
|
|
2440
|
+
(test => {
|
|
2684
2441
|
if (!test) {
|
|
2685
2442
|
throw new Error(`Expected kind to be implicit`);
|
|
2686
2443
|
}
|
|
2687
|
-
})(meta.kind === 'implicit' && meta.isImplicit === true)
|
|
2444
|
+
})(meta.kind === 'implicit' && meta.isImplicit === true);
|
|
2688
2445
|
relationship = relationships[propertyName] = createImplicitEdge(meta, resourceKey);
|
|
2689
2446
|
}
|
|
2690
2447
|
}
|
|
@@ -2692,11 +2449,11 @@ class Graph {
|
|
|
2692
2449
|
}
|
|
2693
2450
|
getData(resourceKey, propertyName) {
|
|
2694
2451
|
const relationship = this.get(resourceKey, propertyName);
|
|
2695
|
-
|
|
2452
|
+
(test => {
|
|
2696
2453
|
if (!test) {
|
|
2697
2454
|
throw new Error(`Cannot getData() on an implicit relationship`);
|
|
2698
2455
|
}
|
|
2699
|
-
})(!isImplicit(relationship))
|
|
2456
|
+
})(!isImplicit(relationship));
|
|
2700
2457
|
if (isBelongsTo(relationship)) {
|
|
2701
2458
|
return legacyGetResourceRelationshipData(relationship, false);
|
|
2702
2459
|
}
|
|
@@ -2704,11 +2461,11 @@ class Graph {
|
|
|
2704
2461
|
}
|
|
2705
2462
|
getRemoteData(resourceKey, propertyName) {
|
|
2706
2463
|
const relationship = this.get(resourceKey, propertyName);
|
|
2707
|
-
|
|
2464
|
+
(test => {
|
|
2708
2465
|
if (!test) {
|
|
2709
2466
|
throw new Error(`Cannot getRemoteData() on an implicit relationship`);
|
|
2710
2467
|
}
|
|
2711
|
-
})(!isImplicit(relationship))
|
|
2468
|
+
})(!isImplicit(relationship));
|
|
2712
2469
|
if (isBelongsTo(relationship)) {
|
|
2713
2470
|
return legacyGetResourceRelationshipData(relationship, true);
|
|
2714
2471
|
}
|
|
@@ -2742,7 +2499,7 @@ class Graph {
|
|
|
2742
2499
|
isReleasable(resourceKey) {
|
|
2743
2500
|
const relationships = this.identifiers.get(resourceKey);
|
|
2744
2501
|
if (!relationships) {
|
|
2745
|
-
|
|
2502
|
+
{
|
|
2746
2503
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2747
2504
|
// eslint-disable-next-line no-console
|
|
2748
2505
|
console.log(`graph: RELEASABLE ${String(resourceKey)}`);
|
|
@@ -2758,13 +2515,13 @@ class Graph {
|
|
|
2758
2515
|
if (relationship === undefined) {
|
|
2759
2516
|
continue;
|
|
2760
2517
|
}
|
|
2761
|
-
|
|
2518
|
+
(test => {
|
|
2762
2519
|
if (!test) {
|
|
2763
2520
|
throw new Error(`Expected a relationship`);
|
|
2764
2521
|
}
|
|
2765
|
-
})(relationship)
|
|
2522
|
+
})(relationship);
|
|
2766
2523
|
if (relationship.definition.inverseIsAsync && !checkIfNew(this._realStore, resourceKey)) {
|
|
2767
|
-
|
|
2524
|
+
{
|
|
2768
2525
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2769
2526
|
// eslint-disable-next-line no-console
|
|
2770
2527
|
console.log(`graph: <<NOT>> RELEASABLE ${String(resourceKey)}`);
|
|
@@ -2773,7 +2530,7 @@ class Graph {
|
|
|
2773
2530
|
return false;
|
|
2774
2531
|
}
|
|
2775
2532
|
}
|
|
2776
|
-
|
|
2533
|
+
{
|
|
2777
2534
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2778
2535
|
// eslint-disable-next-line no-console
|
|
2779
2536
|
console.log(`graph: RELEASABLE ${String(resourceKey)}`);
|
|
@@ -2782,7 +2539,7 @@ class Graph {
|
|
|
2782
2539
|
return true;
|
|
2783
2540
|
}
|
|
2784
2541
|
unload(resourceKey, silenceNotifications) {
|
|
2785
|
-
|
|
2542
|
+
{
|
|
2786
2543
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2787
2544
|
// eslint-disable-next-line no-console
|
|
2788
2545
|
console.log(`graph: unload ${String(resourceKey)}`);
|
|
@@ -2897,17 +2654,17 @@ class Graph {
|
|
|
2897
2654
|
return changed;
|
|
2898
2655
|
}
|
|
2899
2656
|
remove(resourceKey) {
|
|
2900
|
-
|
|
2657
|
+
{
|
|
2901
2658
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2902
2659
|
// eslint-disable-next-line no-console
|
|
2903
2660
|
console.log(`graph: remove ${String(resourceKey)}`);
|
|
2904
2661
|
}
|
|
2905
2662
|
}
|
|
2906
|
-
|
|
2663
|
+
(test => {
|
|
2907
2664
|
if (!test) {
|
|
2908
2665
|
throw new Error(`Cannot remove ${String(resourceKey)} while still removing ${String(this._removing)}`);
|
|
2909
2666
|
}
|
|
2910
|
-
})(!this._removing)
|
|
2667
|
+
})(!this._removing);
|
|
2911
2668
|
this._removing = resourceKey;
|
|
2912
2669
|
this.unload(resourceKey);
|
|
2913
2670
|
this.identifiers.delete(resourceKey);
|
|
@@ -2918,7 +2675,7 @@ class Graph {
|
|
|
2918
2675
|
* Remote state changes
|
|
2919
2676
|
*/
|
|
2920
2677
|
push(op) {
|
|
2921
|
-
|
|
2678
|
+
{
|
|
2922
2679
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2923
2680
|
// eslint-disable-next-line no-console
|
|
2924
2681
|
console.log(`graph: push ${String(op.record)}`, op);
|
|
@@ -2928,11 +2685,11 @@ class Graph {
|
|
|
2928
2685
|
this._pushedUpdates.deletions.push(op);
|
|
2929
2686
|
} else {
|
|
2930
2687
|
const definition = this.getDefinition(op.record, op.field);
|
|
2931
|
-
|
|
2688
|
+
(test => {
|
|
2932
2689
|
if (!test) {
|
|
2933
2690
|
throw new Error(`Cannot push a remote update for an implicit relationship`);
|
|
2934
2691
|
}
|
|
2935
|
-
})(definition.kind !== 'implicit')
|
|
2692
|
+
})(definition.kind !== 'implicit');
|
|
2936
2693
|
addPending(this._pushedUpdates, definition, op);
|
|
2937
2694
|
}
|
|
2938
2695
|
if (!this._willSyncRemote) {
|
|
@@ -2951,12 +2708,12 @@ class Graph {
|
|
|
2951
2708
|
*/
|
|
2952
2709
|
|
|
2953
2710
|
update(op, isRemote = false) {
|
|
2954
|
-
|
|
2711
|
+
(test => {
|
|
2955
2712
|
if (!test) {
|
|
2956
2713
|
throw new Error(`Cannot update an implicit relationship`);
|
|
2957
2714
|
}
|
|
2958
|
-
})(op.op === 'deleteRecord' || op.op === 'mergeIdentifiers' || !isImplicit(this.get(op.record, op.field)))
|
|
2959
|
-
|
|
2715
|
+
})(op.op === 'deleteRecord' || op.op === 'mergeIdentifiers' || !isImplicit(this.get(op.record, op.field)));
|
|
2716
|
+
{
|
|
2960
2717
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2961
2718
|
// eslint-disable-next-line no-console
|
|
2962
2719
|
console.log(`graph: update (${isRemote ? 'remote' : 'local'}) ${String(op.record)}`, op);
|
|
@@ -2973,12 +2730,12 @@ class Graph {
|
|
|
2973
2730
|
}
|
|
2974
2731
|
case 'update':
|
|
2975
2732
|
case 'updateRelationship':
|
|
2976
|
-
|
|
2733
|
+
(test => {
|
|
2977
2734
|
if (!test) {
|
|
2978
2735
|
throw new Error(`Can only perform the operation updateRelationship on remote state`);
|
|
2979
2736
|
}
|
|
2980
|
-
})(isRemote)
|
|
2981
|
-
|
|
2737
|
+
})(isRemote);
|
|
2738
|
+
{
|
|
2982
2739
|
// in debug, assert payload validity eagerly
|
|
2983
2740
|
// TODO add deprecations/assertion here for duplicates
|
|
2984
2741
|
assertValidRelationshipPayload(this, op);
|
|
@@ -2988,11 +2745,11 @@ class Graph {
|
|
|
2988
2745
|
break;
|
|
2989
2746
|
case 'deleteRecord':
|
|
2990
2747
|
{
|
|
2991
|
-
|
|
2748
|
+
(test => {
|
|
2992
2749
|
if (!test) {
|
|
2993
2750
|
throw new Error(`Can only perform the operation deleteRelationship on remote state`);
|
|
2994
2751
|
}
|
|
2995
|
-
})(isRemote)
|
|
2752
|
+
})(isRemote);
|
|
2996
2753
|
const identifier = op.record;
|
|
2997
2754
|
const relationships = this.identifiers.get(identifier);
|
|
2998
2755
|
if (relationships) {
|
|
@@ -3024,11 +2781,11 @@ class Graph {
|
|
|
3024
2781
|
/*#__NOINLINE__*/replaceRelatedRecords(this, op, isRemote);
|
|
3025
2782
|
break;
|
|
3026
2783
|
default:
|
|
3027
|
-
|
|
2784
|
+
(test => {
|
|
3028
2785
|
{
|
|
3029
2786
|
throw new Error(`No local relationship update operation exists for '${op.op}'`);
|
|
3030
2787
|
}
|
|
3031
|
-
})()
|
|
2788
|
+
})();
|
|
3032
2789
|
}
|
|
3033
2790
|
}
|
|
3034
2791
|
_scheduleLocalSync(relationship) {
|
|
@@ -3042,7 +2799,7 @@ class Graph {
|
|
|
3042
2799
|
if (!this._willSyncRemote) {
|
|
3043
2800
|
return;
|
|
3044
2801
|
}
|
|
3045
|
-
|
|
2802
|
+
{
|
|
3046
2803
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3047
2804
|
// eslint-disable-next-line no-console
|
|
3048
2805
|
console.groupCollapsed(`Graph: Initialized Transaction`);
|
|
@@ -3071,7 +2828,7 @@ class Graph {
|
|
|
3071
2828
|
flushPending(this, belongsTo);
|
|
3072
2829
|
}
|
|
3073
2830
|
this._transaction = null;
|
|
3074
|
-
|
|
2831
|
+
{
|
|
3075
2832
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3076
2833
|
// eslint-disable-next-line no-console
|
|
3077
2834
|
console.log(`Graph: transaction finalized`);
|
|
@@ -3081,12 +2838,12 @@ class Graph {
|
|
|
3081
2838
|
}
|
|
3082
2839
|
}
|
|
3083
2840
|
_addToTransaction(relationship) {
|
|
3084
|
-
|
|
2841
|
+
(test => {
|
|
3085
2842
|
if (!test) {
|
|
3086
2843
|
throw new Error(`expected a transaction`);
|
|
3087
2844
|
}
|
|
3088
|
-
})(this._transaction !== null)
|
|
3089
|
-
|
|
2845
|
+
})(this._transaction !== null);
|
|
2846
|
+
{
|
|
3090
2847
|
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3091
2848
|
// eslint-disable-next-line no-console
|
|
3092
2849
|
console.log(`Graph: ${String(relationship.identifier)} ${relationship.definition.key} added to transaction`);
|
|
@@ -3110,15 +2867,15 @@ class Graph {
|
|
|
3110
2867
|
}
|
|
3111
2868
|
destroy() {
|
|
3112
2869
|
Graphs.delete(this.store);
|
|
3113
|
-
|
|
2870
|
+
{
|
|
3114
2871
|
Graphs.delete(getStore(this.store));
|
|
3115
2872
|
if (Graphs.size) {
|
|
3116
2873
|
Graphs.forEach((_, key) => {
|
|
3117
|
-
|
|
2874
|
+
(test => {
|
|
3118
2875
|
if (!test) {
|
|
3119
2876
|
throw new Error(`Memory Leak Detected, likely the test or app instance previous to this was not torn down properly`);
|
|
3120
2877
|
}
|
|
3121
|
-
})(!key.isDestroyed && !key.isDestroying)
|
|
2878
|
+
})(!key.isDestroyed && !key.isDestroying);
|
|
3122
2879
|
});
|
|
3123
2880
|
}
|
|
3124
2881
|
}
|
|
@@ -3187,11 +2944,11 @@ function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey,
|
|
|
3187
2944
|
return;
|
|
3188
2945
|
}
|
|
3189
2946
|
const relationship = graph.get(inverseIdentifier, inverseKey);
|
|
3190
|
-
|
|
2947
|
+
(test => {
|
|
3191
2948
|
if (!test) {
|
|
3192
2949
|
throw new Error(`expected no implicit`);
|
|
3193
2950
|
}
|
|
3194
|
-
})(!isImplicit(relationship))
|
|
2951
|
+
})(!isImplicit(relationship));
|
|
3195
2952
|
|
|
3196
2953
|
// For remote members, it is possible that inverseRecordData has already been associated to
|
|
3197
2954
|
// to another record. For such cases, do not dematerialize the inverseRecordData
|
|
@@ -3363,7 +3120,7 @@ function graphFor(store) {
|
|
|
3363
3120
|
graph = new Graph(wrapper);
|
|
3364
3121
|
Graphs.set(wrapper, graph);
|
|
3365
3122
|
getStore(wrapper)._graph = graph;
|
|
3366
|
-
|
|
3123
|
+
{
|
|
3367
3124
|
if (getStore(wrapper).isDestroying) {
|
|
3368
3125
|
throw new Error(`Memory Leak Detected During Teardown`);
|
|
3369
3126
|
}
|