@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,5 @@
|
|
|
1
|
-
import { deprecate, warn } from '@ember/debug';
|
|
2
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
1
|
import { getOrSetGlobal, peekTransient, setTransient } from '../types/-private.js';
|
|
4
|
-
function coerceId(id) {
|
|
5
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_STRICT_ID)) {
|
|
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 => {
|
|
24
|
-
if (!test) {
|
|
25
|
-
throw new Error(`Resource IDs must be a non-empty string or null. Received '${String(id)}'.`);
|
|
26
|
-
}
|
|
27
|
-
})(id === null || typeof id === 'string' && id.length > 0) : {};
|
|
28
|
-
return id;
|
|
29
|
-
}
|
|
30
2
|
function getStore(wrapper) {
|
|
31
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
32
|
-
if (!test) {
|
|
33
|
-
throw new Error(`expected a private _store property`);
|
|
34
|
-
}
|
|
35
|
-
})('_store' in wrapper) : {};
|
|
36
3
|
return wrapper._store;
|
|
37
4
|
}
|
|
38
5
|
function expandingGet(cache, key1, key2) {
|
|
@@ -43,80 +10,6 @@ function expandingSet(cache, key1, key2, value) {
|
|
|
43
10
|
const mainCache = cache[key1] = cache[key1] || Object.create(null);
|
|
44
11
|
mainCache[key2] = value;
|
|
45
12
|
}
|
|
46
|
-
function assertValidRelationshipPayload(graph, op) {
|
|
47
|
-
const relationship = graph.get(op.record, op.field);
|
|
48
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
49
|
-
if (!test) {
|
|
50
|
-
throw new Error(`Cannot update an implicit relationship`);
|
|
51
|
-
}
|
|
52
|
-
})(isHasMany(relationship) || isBelongsTo(relationship)) : {};
|
|
53
|
-
const payload = op.value;
|
|
54
|
-
const {
|
|
55
|
-
definition,
|
|
56
|
-
identifier,
|
|
57
|
-
state
|
|
58
|
-
} = relationship;
|
|
59
|
-
const {
|
|
60
|
-
type
|
|
61
|
-
} = identifier;
|
|
62
|
-
const {
|
|
63
|
-
field
|
|
64
|
-
} = op;
|
|
65
|
-
const {
|
|
66
|
-
isAsync,
|
|
67
|
-
kind
|
|
68
|
-
} = definition;
|
|
69
|
-
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, {
|
|
71
|
-
id: 'ds.store.push-link-for-sync-relationship'
|
|
72
|
-
});
|
|
73
|
-
} else if (payload.data) {
|
|
74
|
-
if (kind === 'belongsTo') {
|
|
75
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
76
|
-
if (!test) {
|
|
77
|
-
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
|
-
}
|
|
79
|
-
})(!Array.isArray(payload.data)) : {};
|
|
80
|
-
assertRelationshipData(getStore(graph.store), identifier, payload.data, definition);
|
|
81
|
-
} else if (kind === 'hasMany') {
|
|
82
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
83
|
-
if (!test) {
|
|
84
|
-
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
|
-
}
|
|
86
|
-
})(Array.isArray(payload.data)) : {};
|
|
87
|
-
if (Array.isArray(payload.data)) {
|
|
88
|
-
for (let i = 0; i < payload.data.length; i++) {
|
|
89
|
-
assertRelationshipData(getStore(graph.store), identifier, payload.data[i], definition);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function inspect(value) {
|
|
96
|
-
const type = typeof value;
|
|
97
|
-
if (value === null) {
|
|
98
|
-
return 'null';
|
|
99
|
-
}
|
|
100
|
-
if (type !== 'object') {
|
|
101
|
-
return type;
|
|
102
|
-
}
|
|
103
|
-
if (Array.isArray(value)) {
|
|
104
|
-
return 'Array';
|
|
105
|
-
}
|
|
106
|
-
if (value instanceof Date) {
|
|
107
|
-
return 'Date';
|
|
108
|
-
}
|
|
109
|
-
if (value instanceof RegExp) {
|
|
110
|
-
return 'RegExp';
|
|
111
|
-
}
|
|
112
|
-
if (value instanceof Map) {
|
|
113
|
-
return 'Map';
|
|
114
|
-
}
|
|
115
|
-
if (value instanceof Set) {
|
|
116
|
-
return 'Set';
|
|
117
|
-
}
|
|
118
|
-
return 'object';
|
|
119
|
-
}
|
|
120
13
|
function checkIfNew(store, resourceKey) {
|
|
121
14
|
if (!resourceKey.id) {
|
|
122
15
|
return true;
|
|
@@ -211,59 +104,13 @@ function notifyChange(graph, relationship) {
|
|
|
211
104
|
const resourceKey = relationship.identifier;
|
|
212
105
|
const key = relationship.definition.key;
|
|
213
106
|
if (resourceKey === graph._removing) {
|
|
214
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
215
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
216
|
-
// eslint-disable-next-line no-console
|
|
217
|
-
console.log(`Graph: ignoring relationship change for removed identifier ${String(resourceKey)} ${key}`);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
107
|
return;
|
|
221
108
|
}
|
|
222
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
223
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
224
|
-
// eslint-disable-next-line no-console
|
|
225
|
-
console.log(`Graph: notifying relationship change for ${String(resourceKey)} ${key}`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
109
|
graph.store.notifyChange(resourceKey, 'relationships', key);
|
|
229
110
|
}
|
|
230
|
-
function assertRelationshipData(store, resourceKey, data, meta) {
|
|
231
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
232
|
-
if (!test) {
|
|
233
|
-
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
|
-
}
|
|
235
|
-
})(!Array.isArray(data)) : {};
|
|
236
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
237
|
-
if (!test) {
|
|
238
|
-
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
|
-
}
|
|
240
|
-
})(data === null || 'type' in data && typeof data.type === 'string' && data.type.length) : {};
|
|
241
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
242
|
-
if (!test) {
|
|
243
|
-
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
|
-
}
|
|
245
|
-
})(data === null || !!coerceId(data.id)) : {};
|
|
246
|
-
if (data?.type === meta.type) {
|
|
247
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
248
|
-
if (!test) {
|
|
249
|
-
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
|
-
}
|
|
251
|
-
})(store.schema.hasResource(data)) : {};
|
|
252
|
-
} else {
|
|
253
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
254
|
-
if (!test) {
|
|
255
|
-
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
|
-
}
|
|
257
|
-
})(data === null || !data.type || store.schema.hasResource(data)) : {};
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const RELATIONSHIP_KINDS = ['belongsTo', 'hasMany', 'resource', 'collection'];
|
|
261
111
|
function isLegacyField(field) {
|
|
262
112
|
return field.kind === 'belongsTo' || field.kind === 'hasMany';
|
|
263
113
|
}
|
|
264
|
-
function isRelationshipField(field) {
|
|
265
|
-
return RELATIONSHIP_KINDS.includes(field.kind);
|
|
266
|
-
}
|
|
267
114
|
function temporaryConvertToLegacy(field) {
|
|
268
115
|
return {
|
|
269
116
|
kind: field.kind === 'resource' ? 'belongsTo' : 'hasMany',
|
|
@@ -370,11 +217,6 @@ function upgradeMeta(meta) {
|
|
|
370
217
|
niceMeta.key = meta.sourceKey ?? meta.name;
|
|
371
218
|
niceMeta.name = meta.name;
|
|
372
219
|
niceMeta.type = meta.type;
|
|
373
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
374
|
-
if (!test) {
|
|
375
|
-
throw new Error(`Expected relationship definition to specify async`);
|
|
376
|
-
}
|
|
377
|
-
})(typeof options?.async === 'boolean') : {};
|
|
378
220
|
niceMeta.isAsync = options.async;
|
|
379
221
|
niceMeta.isImplicit = false;
|
|
380
222
|
niceMeta.isCollection = meta.kind === 'hasMany';
|
|
@@ -392,89 +234,9 @@ function upgradeMeta(meta) {
|
|
|
392
234
|
niceMeta.resetOnRemoteUpdate = !isLegacyField(meta) ? false : meta.options?.linksMode ? false : meta.options?.resetOnRemoteUpdate === false ? false : true;
|
|
393
235
|
return niceMeta;
|
|
394
236
|
}
|
|
395
|
-
function assertConfiguration(info, type, key) {
|
|
396
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
397
|
-
const isSelfReferential = info.isSelfReferential;
|
|
398
|
-
if (isSelfReferential) {
|
|
399
|
-
return true;
|
|
400
|
-
}
|
|
401
|
-
const _isRHS = key === info.rhs_relationshipName && (type === info.rhs_baseModelName ||
|
|
402
|
-
// base or non-polymorphic
|
|
403
|
-
// if the other side is polymorphic then we need to scan our modelNames
|
|
404
|
-
info.lhs_isPolymorphic && info.rhs_modelNames.includes(type)); // polymorphic
|
|
405
|
-
const _isLHS = key === info.lhs_relationshipName && (type === info.lhs_baseModelName ||
|
|
406
|
-
// base or non-polymorphic
|
|
407
|
-
// if the other side is polymorphic then we need to scan our modelNames
|
|
408
|
-
info.rhs_isPolymorphic && info.lhs_modelNames.includes(type)); // polymorphic;
|
|
409
|
-
|
|
410
|
-
if (!_isRHS && !_isLHS) {
|
|
411
|
-
/*
|
|
412
|
-
this occurs when we are likely polymorphic but not configured to be polymorphic
|
|
413
|
-
most often due to extending a class that has a relationship definition on it.
|
|
414
|
-
e.g.
|
|
415
|
-
```ts
|
|
416
|
-
class Pet extends Model {
|
|
417
|
-
@belongsTo('human', { async: false, inverse: 'pet' }) owner;
|
|
418
|
-
}
|
|
419
|
-
class Human extends Model {
|
|
420
|
-
@belongsTo('pet', { async: false, inverse: 'owner' }) pet;
|
|
421
|
-
}
|
|
422
|
-
class Farmer extends Human {}
|
|
423
|
-
```
|
|
424
|
-
In the above case, the following would trigger this error:
|
|
425
|
-
```ts
|
|
426
|
-
let pet = store.createRecord('pet');
|
|
427
|
-
let farmer = store.createRecord('farmer');
|
|
428
|
-
farmer.pet = pet; // error
|
|
429
|
-
```
|
|
430
|
-
The correct way to fix this is to specify the polymorphic option on Pet
|
|
431
|
-
and to specify the abstract type 'human' on the Human base class.
|
|
432
|
-
```ts
|
|
433
|
-
class Pet extends Model {
|
|
434
|
-
@belongsTo('human', { async: false, inverse: 'pet', polymorphic: true }) owner;
|
|
435
|
-
}
|
|
436
|
-
class Human extends Model {
|
|
437
|
-
@belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;
|
|
438
|
-
}
|
|
439
|
-
class Farmer extends Human {}
|
|
440
|
-
```
|
|
441
|
-
Alternatively both Human and Farmer could declare the relationship, because relationship
|
|
442
|
-
definitions are "structural".
|
|
443
|
-
```ts
|
|
444
|
-
class Pet extends Model {
|
|
445
|
-
@belongsTo('human', { async: false, inverse: 'pet', polymorphic: true }) owner;
|
|
446
|
-
}
|
|
447
|
-
class Human extends Model {
|
|
448
|
-
@belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;
|
|
449
|
-
}
|
|
450
|
-
class Farmer extends Model {
|
|
451
|
-
@belongsTo('pet', { async: false, inverse: 'owner', as: 'human' }) pet;
|
|
452
|
-
}
|
|
453
|
-
```
|
|
454
|
-
*/
|
|
455
|
-
if (key === info.lhs_relationshipName && info.lhs_modelNames.includes(type)) {
|
|
456
|
-
// parentIdentifier, parentDefinition, addedIdentifier, store
|
|
457
|
-
assertInheritedSchema(info.lhs_definition, type);
|
|
458
|
-
} else if (key === info.rhs_relationshipName && info.rhs_modelNames.includes(type)) {
|
|
459
|
-
assertInheritedSchema(info.lhs_definition, type);
|
|
460
|
-
}
|
|
461
|
-
// OPEN AN ISSUE :: we would like to improve our errors but need to understand what corner case got us here
|
|
462
|
-
throw new Error(`PLEASE OPEN AN ISSUE :: Found a relationship that is neither the LHS nor RHS of the same edge. This is not supported. Please report this to the WarpDrive team.`);
|
|
463
|
-
}
|
|
464
|
-
if (_isRHS && _isLHS) {
|
|
465
|
-
// not sure how we get here but it's probably the result of some form of inheritance
|
|
466
|
-
// without having specified polymorphism correctly leading to it not being self-referential
|
|
467
|
-
// OPEN AN ISSUE :: we would like to improve our errors but need to understand what corner case got us here
|
|
468
|
-
throw new Error(`PLEASE OPEN AN ISSUE :: Found a relationship that is both the LHS and RHS of the same edge but is not self-referential. This is not supported. Please report this to the WarpDrive team.`);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
237
|
function isLHS(info, type, key) {
|
|
473
238
|
const isSelfReferential = info.isSelfReferential;
|
|
474
239
|
const isRelationship = key === info.lhs_relationshipName;
|
|
475
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
476
|
-
assertConfiguration(info, type, key);
|
|
477
|
-
}
|
|
478
240
|
if (isRelationship === true) {
|
|
479
241
|
return isSelfReferential === true ||
|
|
480
242
|
// itself
|
|
@@ -499,18 +261,8 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
499
261
|
if (cached !== undefined) {
|
|
500
262
|
return cached;
|
|
501
263
|
}
|
|
502
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
503
|
-
if (!test) {
|
|
504
|
-
throw new Error(`Expected to find relationship definition in the cache for the implicit relationship ${propertyName}`);
|
|
505
|
-
}
|
|
506
|
-
})(!isImplicit) : {};
|
|
507
264
|
const relationships = storeWrapper.schema.fields(key);
|
|
508
265
|
const relationshipsBySourceKey = storeWrapper.schema.cacheFields?.(key) ?? relationships;
|
|
509
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
510
|
-
if (!test) {
|
|
511
|
-
throw new Error(`Expected to have a relationship definition for ${type} but none was found.`);
|
|
512
|
-
}
|
|
513
|
-
})(relationships) : {};
|
|
514
266
|
const meta = relationshipsBySourceKey.get(propertyName);
|
|
515
267
|
if (!meta) {
|
|
516
268
|
// TODO potentially we should just be permissive here since this is an implicit relationship
|
|
@@ -526,22 +278,9 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
526
278
|
}
|
|
527
279
|
}
|
|
528
280
|
}
|
|
529
|
-
|
|
530
|
-
// CASE: We don't have a relationship at all
|
|
531
|
-
// we should only hit this in prod
|
|
532
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
533
|
-
if (!test) {
|
|
534
|
-
throw new Error(`Expected a relationship schema for '${type}.${propertyName}', but no relationship schema was found.`);
|
|
535
|
-
}
|
|
536
|
-
})(meta) : {};
|
|
537
281
|
cache[type][propertyName] = null;
|
|
538
282
|
return null;
|
|
539
283
|
}
|
|
540
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
541
|
-
if (!test) {
|
|
542
|
-
throw new Error(`Expected ${propertyName} to be a relationship`);
|
|
543
|
-
}
|
|
544
|
-
})(isRelationshipField(meta)) : {};
|
|
545
284
|
const definition = /*#__NOINLINE__*/upgradeMeta(meta);
|
|
546
285
|
let inverseDefinition;
|
|
547
286
|
let inverseKey;
|
|
@@ -549,12 +288,6 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
549
288
|
|
|
550
289
|
// CASE: Inverse is explicitly null
|
|
551
290
|
if (definition.inverseKey === null) {
|
|
552
|
-
// TODO probably dont need this assertion if polymorphic
|
|
553
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
554
|
-
if (!test) {
|
|
555
|
-
throw new Error(`Expected the inverse model to exist`);
|
|
556
|
-
}
|
|
557
|
-
})(getStore(storeWrapper).modelFor(inverseType)) : {};
|
|
558
291
|
inverseDefinition = null;
|
|
559
292
|
} else {
|
|
560
293
|
inverseKey = /*#__NOINLINE__*/inverseForRelationship(getStore(storeWrapper), key, propertyName);
|
|
@@ -587,22 +320,7 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
587
320
|
const inverseDefinitions = storeWrapper.schema.fields({
|
|
588
321
|
type: inverseType
|
|
589
322
|
});
|
|
590
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
591
|
-
if (!test) {
|
|
592
|
-
throw new Error(`Expected to have a relationship definition for ${inverseType} but none was found.`);
|
|
593
|
-
}
|
|
594
|
-
})(inverseDefinitions) : {};
|
|
595
323
|
const metaFromInverse = inverseDefinitions.get(inverseKey);
|
|
596
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
597
|
-
if (!test) {
|
|
598
|
-
throw new Error(`Expected a relationship schema for '${inverseType}.${inverseKey}' to match the inverse of '${type}.${propertyName}', but no relationship schema was found.`);
|
|
599
|
-
}
|
|
600
|
-
})(metaFromInverse) : {};
|
|
601
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
602
|
-
if (!test) {
|
|
603
|
-
throw new Error(`Expected ${inverseKey} to be a relationship`);
|
|
604
|
-
}
|
|
605
|
-
})(isRelationshipField(metaFromInverse)) : {};
|
|
606
324
|
inverseDefinition = upgradeMeta(metaFromInverse);
|
|
607
325
|
}
|
|
608
326
|
}
|
|
@@ -649,29 +367,8 @@ function upgradeDefinition(graph, key, propertyName, isImplicit = false) {
|
|
|
649
367
|
|
|
650
368
|
// CASE: We do have an inverse
|
|
651
369
|
const baseType = inverseDefinition.type;
|
|
652
|
-
|
|
653
|
-
// TODO we want to assert this but this breaks all of our shoddily written tests
|
|
654
|
-
/*
|
|
655
|
-
if (DEBUG) {
|
|
656
|
-
let inverseDoubleCheck = inverseFor(inverseRelationshipName, store);
|
|
657
|
-
assert(`The ${inverseBaseModelName}:${inverseRelationshipName} relationship declares 'inverse: null', but it was resolved as the inverse for ${baseModelName}:${relationshipName}.`, inverseDoubleCheck);
|
|
658
|
-
}
|
|
659
|
-
*/
|
|
660
|
-
// CASE: We may have already discovered the inverse for the baseModelName
|
|
661
|
-
// CASE: We have already discovered the inverse
|
|
662
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
663
|
-
if (!test) {
|
|
664
|
-
throw new Error(`We should have determined an inverseKey by now, open an issue if this is hit`);
|
|
665
|
-
}
|
|
666
|
-
})(typeof inverseKey === 'string' && inverseKey.length > 0) : {};
|
|
667
370
|
cached = expandingGet(cache, baseType, propertyName) || expandingGet(cache, inverseType, inverseKey);
|
|
668
371
|
if (cached) {
|
|
669
|
-
// TODO this assert can be removed if the above assert is enabled
|
|
670
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
671
|
-
if (!test) {
|
|
672
|
-
throw new Error(`The ${inverseType}:${inverseKey} relationship declares 'inverse: null', but it was resolved as the inverse for ${type}:${propertyName}.`);
|
|
673
|
-
}
|
|
674
|
-
})(cached.hasInverse !== false) : {};
|
|
675
372
|
const _isLHS = cached.lhs_baseModelName === baseType;
|
|
676
373
|
const modelNames = _isLHS ? cached.lhs_modelNames : cached.rhs_modelNames;
|
|
677
374
|
// make this lookup easier in the future by caching the key
|
|
@@ -721,220 +418,9 @@ function inverseForRelationship(store, resourceKey, key) {
|
|
|
721
418
|
if (!definition) {
|
|
722
419
|
return null;
|
|
723
420
|
}
|
|
724
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
725
|
-
if (!test) {
|
|
726
|
-
throw new Error(`Expected ${key} to be a relationship`);
|
|
727
|
-
}
|
|
728
|
-
})(isRelationshipField(definition)) : {};
|
|
729
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
730
|
-
if (!test) {
|
|
731
|
-
throw new Error(`Expected the relationship defintion to specify the inverse type or null.`);
|
|
732
|
-
}
|
|
733
|
-
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0) : {};
|
|
734
421
|
return definition.options.inverse;
|
|
735
422
|
}
|
|
736
423
|
|
|
737
|
-
/* eslint-disable @typescript-eslint/no-shadow */
|
|
738
|
-
|
|
739
|
-
let assertPolymorphicType;
|
|
740
|
-
let assertInheritedSchema;
|
|
741
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
742
|
-
function validateSchema(definition, meta) {
|
|
743
|
-
const errors = new Map();
|
|
744
|
-
if (definition.inverseKey !== meta.name) {
|
|
745
|
-
errors.set('name', ` <---- should be '${definition.inverseKey}'`);
|
|
746
|
-
}
|
|
747
|
-
if (definition.inverseType !== meta.type) {
|
|
748
|
-
errors.set('type', ` <---- should be '${definition.inverseType}'`);
|
|
749
|
-
}
|
|
750
|
-
if (definition.inverseKind !== meta.kind) {
|
|
751
|
-
errors.set('type', ` <---- should be '${definition.inverseKind}'`);
|
|
752
|
-
}
|
|
753
|
-
if (definition.inverseIsAsync !== meta.options.async) {
|
|
754
|
-
errors.set('async', ` <---- should be ${definition.inverseIsAsync}`);
|
|
755
|
-
}
|
|
756
|
-
if (definition.inverseIsPolymorphic && definition.inverseIsPolymorphic !== meta.options.polymorphic) {
|
|
757
|
-
errors.set('polymorphic', ` <---- should be ${definition.inverseIsPolymorphic}`);
|
|
758
|
-
}
|
|
759
|
-
if (definition.key !== meta.options.inverse) {
|
|
760
|
-
errors.set('inverse', ` <---- should be '${definition.key}'`);
|
|
761
|
-
}
|
|
762
|
-
if (definition.type !== meta.options.as) {
|
|
763
|
-
errors.set('as', ` <---- should be '${definition.type}'`);
|
|
764
|
-
}
|
|
765
|
-
return errors;
|
|
766
|
-
}
|
|
767
|
-
function expectedSchema(definition) {
|
|
768
|
-
return printSchema({
|
|
769
|
-
name: definition.inverseKey,
|
|
770
|
-
type: definition.inverseType,
|
|
771
|
-
kind: definition.inverseKind,
|
|
772
|
-
options: {
|
|
773
|
-
as: definition.type,
|
|
774
|
-
async: definition.inverseIsAsync,
|
|
775
|
-
polymorphic: definition.inverseIsPolymorphic || false,
|
|
776
|
-
inverse: definition.key
|
|
777
|
-
}
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
function printSchema(config, errors) {
|
|
781
|
-
return `
|
|
782
|
-
|
|
783
|
-
\`\`\`
|
|
784
|
-
{
|
|
785
|
-
${config.name}: {
|
|
786
|
-
name: '${config.name}',${errors?.get('name') || ''}
|
|
787
|
-
type: '${config.type}',${errors?.get('type') || ''}
|
|
788
|
-
kind: '${config.kind}',${errors?.get('kind') || ''}
|
|
789
|
-
options: {
|
|
790
|
-
as: '${config.options.as}',${errors?.get('as') || ''}
|
|
791
|
-
async: ${config.options.async},${errors?.get('async') || ''}
|
|
792
|
-
polymorphic: ${config.options.polymorphic},${errors?.get('polymorphic') || ''}
|
|
793
|
-
inverse: '${config.options.inverse}'${errors?.get('inverse') || ''}
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
\`\`\`
|
|
798
|
-
|
|
799
|
-
`;
|
|
800
|
-
}
|
|
801
|
-
function metaFrom(definition) {
|
|
802
|
-
return {
|
|
803
|
-
name: definition.key,
|
|
804
|
-
type: definition.type,
|
|
805
|
-
kind: definition.kind,
|
|
806
|
-
options: {
|
|
807
|
-
async: definition.isAsync,
|
|
808
|
-
polymorphic: definition.isPolymorphic,
|
|
809
|
-
inverse: definition.inverseKey
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
function inverseMetaFrom(definition) {
|
|
814
|
-
return {
|
|
815
|
-
name: definition.inverseKey,
|
|
816
|
-
type: definition.inverseType,
|
|
817
|
-
kind: definition.inverseKind,
|
|
818
|
-
options: {
|
|
819
|
-
as: definition.isPolymorphic ? definition.type : undefined,
|
|
820
|
-
async: definition.inverseIsAsync,
|
|
821
|
-
polymorphic: definition.inverseIsPolymorphic,
|
|
822
|
-
inverse: definition.key
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
function inverseDefinition(definition) {
|
|
827
|
-
return {
|
|
828
|
-
key: definition.inverseKey,
|
|
829
|
-
name: definition.inverseName,
|
|
830
|
-
type: definition.inverseType,
|
|
831
|
-
kind: definition.inverseKind,
|
|
832
|
-
isAsync: definition.inverseIsAsync,
|
|
833
|
-
isPolymorphic: true,
|
|
834
|
-
isLinksMode: definition.isLinksMode,
|
|
835
|
-
isCollection: definition.inverseIsCollection,
|
|
836
|
-
isImplicit: definition.inverseIsImplicit,
|
|
837
|
-
inverseKey: definition.key,
|
|
838
|
-
inverseName: definition.name,
|
|
839
|
-
inverseType: definition.type,
|
|
840
|
-
inverseKind: definition.kind,
|
|
841
|
-
inverseIsAsync: definition.isAsync,
|
|
842
|
-
inverseIsPolymorphic: definition.isPolymorphic,
|
|
843
|
-
inverseIsLinksMode: definition.inverseIsLinksMode,
|
|
844
|
-
inverseIsImplicit: definition.isImplicit,
|
|
845
|
-
inverseIsCollection: definition.isCollection,
|
|
846
|
-
resetOnRemoteUpdate: definition.resetOnRemoteUpdate
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
function definitionWithPolymorphic(definition) {
|
|
850
|
-
return Object.assign({}, definition, {
|
|
851
|
-
inverseIsPolymorphic: true
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
assertInheritedSchema = function assertInheritedSchema(definition, type) {
|
|
855
|
-
const meta1 = metaFrom(definition);
|
|
856
|
-
const meta2 = inverseMetaFrom(definition);
|
|
857
|
-
const errors1 = validateSchema(inverseDefinition(definition), meta1);
|
|
858
|
-
const errors2 = validateSchema(definitionWithPolymorphic(definition), meta2);
|
|
859
|
-
if (errors2.size === 0 && errors1.size > 0) {
|
|
860
|
-
throw new Error(`The schema for the relationship '${type}.${definition.key}' is not configured to satisfy '${definition.inverseType}' and thus cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${definition.type}.${definition.inverseKey}'\n\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${type}' should include:${printSchema(meta1, errors1)}`);
|
|
861
|
-
} else if (errors1.size > 0) {
|
|
862
|
-
throw new Error(`The schema for the relationship '${type}.${definition.key}' is not configured to satisfy '${definition.inverseType}' and thus cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${definition.type}.${definition.inverseKey}'\n\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${type}' should include:${printSchema(meta1, errors1)} and the relationships schema definition for '${definition.type}' should include:${printSchema(meta2, errors2)}`);
|
|
863
|
-
} else if (errors2.size > 0) {
|
|
864
|
-
throw new Error(`The schema for the relationship '${type}.${definition.key}' satisfies '${definition.inverseType}' but cannot utilize the '${definition.inverseType}.${definition.key}' relationship to connect with '${definition.type}.${definition.inverseKey}' because that relationship is not polymorphic.\n\nIf using this relationship in a polymorphic manner is desired, the relationships schema definition for '${definition.type}' should include:${printSchema(meta2, errors2)}`);
|
|
865
|
-
}
|
|
866
|
-
};
|
|
867
|
-
assertPolymorphicType = function assertPolymorphicType(parentIdentifier, parentDefinition, addedIdentifier, store) {
|
|
868
|
-
if (parentDefinition.inverseIsImplicit) {
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
if (parentDefinition.isPolymorphic) {
|
|
872
|
-
let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);
|
|
873
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
874
|
-
if (!test) {
|
|
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
|
-
}
|
|
877
|
-
})(meta) : {};
|
|
878
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
879
|
-
if (!test) {
|
|
880
|
-
throw new Error(`Expected the field ${parentDefinition.inverseKey} to be a relationship`);
|
|
881
|
-
}
|
|
882
|
-
})(meta && isRelationshipField(meta)) : {};
|
|
883
|
-
meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);
|
|
884
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
885
|
-
if (!test) {
|
|
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
|
-
}
|
|
888
|
-
})(!(meta.options.inverse === null && meta?.options.as?.length)) : {};
|
|
889
|
-
const errors = validateSchema(parentDefinition, meta);
|
|
890
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
891
|
-
if (!test) {
|
|
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
|
-
}
|
|
894
|
-
})(errors.size === 0) : {};
|
|
895
|
-
} else if (addedIdentifier.type !== parentDefinition.type) {
|
|
896
|
-
// if we are not polymorphic
|
|
897
|
-
// then the addedIdentifier.type must be the same as the parentDefinition.type
|
|
898
|
-
let meta = store.schema.fields(addedIdentifier).get(parentDefinition.inverseKey);
|
|
899
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
900
|
-
if (!test) {
|
|
901
|
-
throw new Error(`Expected the field ${parentDefinition.inverseKey} to be a relationship`);
|
|
902
|
-
}
|
|
903
|
-
})(!meta || isRelationshipField(meta)) : {};
|
|
904
|
-
meta = meta && (isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta));
|
|
905
|
-
if (meta?.options.as === parentDefinition.type) {
|
|
906
|
-
// inverse is likely polymorphic but missing the polymorphic flag
|
|
907
|
-
let meta = store.schema.fields({
|
|
908
|
-
type: parentDefinition.inverseType
|
|
909
|
-
}).get(parentDefinition.key);
|
|
910
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
911
|
-
if (!test) {
|
|
912
|
-
throw new Error(`Expected the field ${parentDefinition.key} to be a relationship`);
|
|
913
|
-
}
|
|
914
|
-
})(meta && isRelationshipField(meta)) : {};
|
|
915
|
-
meta = isLegacyField(meta) ? meta : temporaryConvertToLegacy(meta);
|
|
916
|
-
const errors = validateSchema(definitionWithPolymorphic(inverseDefinition(parentDefinition)), meta);
|
|
917
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
918
|
-
{
|
|
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
|
-
}
|
|
921
|
-
})() : {};
|
|
922
|
-
} else {
|
|
923
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
924
|
-
{
|
|
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
|
-
}
|
|
927
|
-
})() : {};
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
function count(label) {
|
|
933
|
-
// @ts-expect-error
|
|
934
|
-
// eslint-disable-next-line
|
|
935
|
-
globalThis.__WarpDriveMetricCountData[label] = (globalThis.__WarpDriveMetricCountData[label] || 0) + 1;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
424
|
/*
|
|
939
425
|
case many:1
|
|
940
426
|
========
|
|
@@ -1000,11 +486,6 @@ function replaceRelatedRecords(graph, op, isRemote) {
|
|
|
1000
486
|
function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
1001
487
|
const resourceKeys = op.value;
|
|
1002
488
|
const relationship = graph.get(op.record, op.field);
|
|
1003
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1004
|
-
if (!test) {
|
|
1005
|
-
throw new Error(`expected hasMany relationship`);
|
|
1006
|
-
}
|
|
1007
|
-
})(isHasMany(relationship)) : {};
|
|
1008
489
|
relationship.state.hasReceivedData = true;
|
|
1009
490
|
const {
|
|
1010
491
|
additions,
|
|
@@ -1019,20 +500,12 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
|
1019
500
|
} = op;
|
|
1020
501
|
const wasDirty = relationship.isDirty;
|
|
1021
502
|
let localBecameDirty = false;
|
|
1022
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
|
|
1023
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
1024
|
-
count(`replaceRelatedRecordsLocal ${'type' in record ? record.type : '<document>'} ${op.field}`);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
503
|
const onAdd = resourceKey => {
|
|
1028
504
|
// Since we are diffing against the remote state, we check
|
|
1029
505
|
// if our previous local state did not contain this ResourceKey
|
|
1030
506
|
const removalsHas = removals?.has(resourceKey);
|
|
1031
507
|
if (removalsHas || !additions?.has(resourceKey)) {
|
|
1032
508
|
if (type !== resourceKey.type) {
|
|
1033
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1034
|
-
assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
|
|
1035
|
-
}
|
|
1036
509
|
graph.registerPolymorphicType(type, resourceKey.type);
|
|
1037
510
|
}
|
|
1038
511
|
|
|
@@ -1094,16 +567,6 @@ function replaceRelatedRecordsLocal(graph, op, isRemote) {
|
|
|
1094
567
|
function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
1095
568
|
const resourceKeys = op.value;
|
|
1096
569
|
const relationship = graph.get(op.record, op.field);
|
|
1097
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
|
|
1098
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
1099
|
-
count(`replaceRelatedRecordsRemote ${'type' in op.record ? op.record.type : '<document>'} ${op.field}`);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1103
|
-
if (!test) {
|
|
1104
|
-
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
1105
|
-
}
|
|
1106
|
-
})(isHasMany(relationship)) : {};
|
|
1107
570
|
if (isRemote) {
|
|
1108
571
|
graph._addToTransaction(relationship);
|
|
1109
572
|
}
|
|
@@ -1126,9 +589,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1126
589
|
} = relationship.definition;
|
|
1127
590
|
const diff = diffCollection(resourceKeys, relationship, resourceKey => {
|
|
1128
591
|
if (type !== resourceKey.type) {
|
|
1129
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1130
|
-
assertPolymorphicType(relationship.identifier, relationship.definition, resourceKey, graph.store);
|
|
1131
|
-
}
|
|
1132
592
|
graph.registerPolymorphicType(type, resourceKey.type);
|
|
1133
593
|
}
|
|
1134
594
|
// commit additions
|
|
@@ -1136,15 +596,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1136
596
|
// because we are not dirty if this was a committed local addition
|
|
1137
597
|
if (relationship.additions?.has(resourceKey)) {
|
|
1138
598
|
relationship.additions.delete(resourceKey);
|
|
1139
|
-
} else {
|
|
1140
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1141
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1142
|
-
if (!relationship.isDirty) {
|
|
1143
|
-
// eslint-disable-next-line no-console
|
|
1144
|
-
console.log(`setting relationship to dirty because the remote addition was not in our previous list of local additions`);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
599
|
}
|
|
1149
600
|
addToInverse(graph, resourceKey, definition.inverseKey, op.record, isRemote);
|
|
1150
601
|
}, resourceKey => {
|
|
@@ -1153,15 +604,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1153
604
|
// because we are not dirty if this was a committed local addition
|
|
1154
605
|
if (relationship.removals?.has(resourceKey)) {
|
|
1155
606
|
relationship.removals.delete(resourceKey);
|
|
1156
|
-
} else {
|
|
1157
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1158
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1159
|
-
if (!relationship.isDirty) {
|
|
1160
|
-
// eslint-disable-next-line no-console
|
|
1161
|
-
console.log(`setting relationship to dirty because the remote removal was not in our previous list of local removals`);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
607
|
}
|
|
1166
608
|
removeFromInverse(graph, resourceKey, definition.inverseKey, op.record, isRemote);
|
|
1167
609
|
});
|
|
@@ -1179,65 +621,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1179
621
|
// may allow us to more efficiently patch
|
|
1180
622
|
// the associated ManyArray
|
|
1181
623
|
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
624
|
if (relationship.isDirty && !wasDirty) {
|
|
1242
625
|
flushCanonical(graph, relationship);
|
|
1243
626
|
}
|
|
@@ -1248,9 +631,6 @@ function addToInverse(graph, resourceKey, key, value, isRemote) {
|
|
|
1248
631
|
type
|
|
1249
632
|
} = relationship.definition;
|
|
1250
633
|
if (type !== value.type) {
|
|
1251
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1252
|
-
assertPolymorphicType(relationship.identifier, relationship.definition, value, graph.store);
|
|
1253
|
-
}
|
|
1254
634
|
graph.registerPolymorphicType(type, value.type);
|
|
1255
635
|
}
|
|
1256
636
|
if (isBelongsTo(relationship)) {
|
|
@@ -1360,11 +740,6 @@ function flushCanonical(graph, rel) {
|
|
|
1360
740
|
}
|
|
1361
741
|
function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
1362
742
|
const relationship = graph.get(op.record, op.field);
|
|
1363
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1364
|
-
if (!test) {
|
|
1365
|
-
throw new Error(`You can only '${op.op}' on a belongsTo relationship. ${op.record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
1366
|
-
}
|
|
1367
|
-
})(isBelongsTo(relationship)) : {};
|
|
1368
743
|
if (isRemote) {
|
|
1369
744
|
graph._addToTransaction(relationship);
|
|
1370
745
|
}
|
|
@@ -1425,23 +800,6 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1425
800
|
}
|
|
1426
801
|
if (existingState && localState === existingState) {
|
|
1427
802
|
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
803
|
}
|
|
1446
804
|
}
|
|
1447
805
|
return;
|
|
@@ -1469,9 +827,7 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1469
827
|
// but the record does turn out to be polymorphic
|
|
1470
828
|
// this should still assert if the user is relying on legacy inheritance/mixins to
|
|
1471
829
|
// provide polymorphic behavior and has not yet added the polymorphic flags
|
|
1472
|
-
|
|
1473
|
-
assertPolymorphicType(relationship.identifier, definition, op.value, graph.store);
|
|
1474
|
-
}
|
|
830
|
+
|
|
1475
831
|
graph.registerPolymorphicType(definition.type, op.value.type);
|
|
1476
832
|
}
|
|
1477
833
|
addToInverse(graph, op.value, definition.inverseKey, op.record, isRemote);
|
|
@@ -1493,141 +849,11 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1493
849
|
// But when localState does not match the new remoteState and
|
|
1494
850
|
// and localState !== existingState then we know we have a local mutation
|
|
1495
851
|
// 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
852
|
}
|
|
1512
853
|
} else {
|
|
1513
854
|
notifyChange(graph, relationship);
|
|
1514
855
|
}
|
|
1515
856
|
}
|
|
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
857
|
function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onAdd, onDel, remoteClearsLocal) {
|
|
1632
858
|
const finalLength = finalState.length;
|
|
1633
859
|
const prevLength = prevState.length;
|
|
@@ -1638,14 +864,6 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1638
864
|
const added = new Set();
|
|
1639
865
|
const removed = new Set();
|
|
1640
866
|
const priorLocalLength = priorLocalState?.length ?? 0;
|
|
1641
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1642
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1643
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1644
|
-
changed &&
|
|
1645
|
-
// eslint-disable-next-line no-console
|
|
1646
|
-
console.log(`changed because ${priorLocalState ? 'finalSet.size !== priorLocalState.length' : 'finalSet.size !== prevSet.size'}`);
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
867
|
for (let i = 0; i < iterationLength; i++) {
|
|
1650
868
|
let member;
|
|
1651
869
|
|
|
@@ -1657,12 +875,6 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1657
875
|
if (i < priorLocalLength) {
|
|
1658
876
|
const priorLocalMember = priorLocalState[i];
|
|
1659
877
|
if (priorLocalMember !== member) {
|
|
1660
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1661
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1662
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1663
|
-
!changed && console.log(`changed because priorLocalMember !== member && !prevSet.has(member)`);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
878
|
changed = true;
|
|
1667
879
|
}
|
|
1668
880
|
}
|
|
@@ -1687,44 +899,18 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1687
899
|
if (i < priorLocalLength) {
|
|
1688
900
|
const priorLocalMember = priorLocalState[i];
|
|
1689
901
|
if (priorLocalMember !== member) {
|
|
1690
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.DEBUG_RELATIONSHIP_NOTIFICATIONS)) {
|
|
1691
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1692
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1693
|
-
!changed && console.log(`changed because priorLocalMember !== member && member !== prevMember`);
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
902
|
changed = true;
|
|
1697
903
|
}
|
|
1698
904
|
} else if (i < finalLength) {
|
|
1699
905
|
// if we have exceeded the length of priorLocalState and we are within the range
|
|
1700
906
|
// of the finalState then we must have changed
|
|
1701
|
-
|
|
1702
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1703
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, no-console
|
|
1704
|
-
!changed && console.log(`changed because priorMember !== member && index >= priorLocalLength`);
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
907
|
+
|
|
1707
908
|
changed = true;
|
|
1708
909
|
}
|
|
1709
910
|
|
|
1710
911
|
// if remote order hasn't changed but local order differs
|
|
1711
912
|
// and we are configured to reset on remote update (which is deprecated)
|
|
1712
913
|
// 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
914
|
}
|
|
1729
915
|
if (!finalSet.has(prevMember)) {
|
|
1730
916
|
// if we are within finalLength, we can only be "changed" if we've already exceeded
|
|
@@ -1765,14 +951,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1765
951
|
// if you do not have a priorLocalState you can't be changed
|
|
1766
952
|
// ergo, we never need to set changed in this branch.
|
|
1767
953
|
// this log can still be useful for debugging.
|
|
1768
|
-
|
|
1769
|
-
if (getGlobalConfig().WarpDrive.debug.DEBUG_RELATIONSHIP_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.DEBUG_RELATIONSHIP_NOTIFICATIONS) {
|
|
1770
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1771
|
-
!changed &&
|
|
1772
|
-
// eslint-disable-next-line no-console
|
|
1773
|
-
console.log(`changed because i >= priorLocalLength && i < finalLength && !finalSet.has(prevMember)`);
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
954
|
+
|
|
1776
955
|
//
|
|
1777
956
|
// we do still set remoteOrderChanged as it has
|
|
1778
957
|
remoteOrderChanged = true;
|
|
@@ -1797,43 +976,10 @@ function diffCollection(finalState, relationship, onAdd, onDel) {
|
|
|
1797
976
|
remoteState,
|
|
1798
977
|
remoteMembers
|
|
1799
978
|
} = relationship;
|
|
1800
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_UNIQUE_PAYLOADS)) {
|
|
1801
|
-
if (finalState.length !== finalSet.size) {
|
|
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 => {
|
|
1823
|
-
if (!test) {
|
|
1824
|
-
throw new Error(`Expected all entries in the relationship to be unique, found duplicates`);
|
|
1825
|
-
}
|
|
1826
|
-
})(finalState.length === finalSet.size) : {};
|
|
1827
|
-
}
|
|
1828
979
|
return _compare(priorLocalState, finalState, finalSet, remoteState, remoteMembers, onAdd, onDel, relationship.definition.resetOnRemoteUpdate);
|
|
1829
980
|
}
|
|
1830
981
|
function computeLocalState(storage) {
|
|
1831
982
|
if (!storage.isDirty) {
|
|
1832
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1833
|
-
if (!test) {
|
|
1834
|
-
throw new Error(`Expected localState to be present`);
|
|
1835
|
-
}
|
|
1836
|
-
})(Array.isArray(storage.localState)) : {};
|
|
1837
983
|
return storage.localState;
|
|
1838
984
|
}
|
|
1839
985
|
const state = storage.remoteState.slice();
|
|
@@ -1865,33 +1011,18 @@ function _add(graph, record, relationship, value, index, isRemote) {
|
|
|
1865
1011
|
return !isRemote ? _addLocal(graph, record, relationship, value, index) : _addRemote(graph, record, relationship, value, index);
|
|
1866
1012
|
}
|
|
1867
1013
|
function _addRemote(graph, record, relationship, value, index) {
|
|
1868
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1869
|
-
if (!test) {
|
|
1870
|
-
throw new Error(`expected an identifier to add to the collection relationship`);
|
|
1871
|
-
}
|
|
1872
|
-
})(value) : {};
|
|
1873
1014
|
const {
|
|
1874
1015
|
remoteMembers,
|
|
1875
1016
|
additions,
|
|
1876
1017
|
removals,
|
|
1877
1018
|
remoteState
|
|
1878
1019
|
} = relationship;
|
|
1879
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1880
|
-
if (!test) {
|
|
1881
|
-
throw new Error(`Cannot add a resource that is already present`);
|
|
1882
|
-
}
|
|
1883
|
-
})(!remoteMembers.has(value)) : {};
|
|
1884
1020
|
if (remoteMembers.has(value)) {
|
|
1885
1021
|
return false;
|
|
1886
1022
|
}
|
|
1887
1023
|
|
|
1888
1024
|
// add to the remote state
|
|
1889
1025
|
remoteMembers.add(value);
|
|
1890
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1891
|
-
if (!test) {
|
|
1892
|
-
throw new Error(`Cannot insert at an index that is not in bounds`);
|
|
1893
|
-
}
|
|
1894
|
-
})(index === null || index >= 0 && index < remoteState.length) : {};
|
|
1895
1026
|
const hasValidIndex = index !== null && index >= 0 && index < remoteState.length;
|
|
1896
1027
|
if (hasValidIndex) {
|
|
1897
1028
|
remoteState.splice(index, 0, value);
|
|
@@ -1906,11 +1037,6 @@ function _addRemote(graph, record, relationship, value, index) {
|
|
|
1906
1037
|
// nothing more to do this was our state already
|
|
1907
1038
|
return false;
|
|
1908
1039
|
}
|
|
1909
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1910
|
-
if (!test) {
|
|
1911
|
-
throw new Error(`Remote state indicated addition of a resource that was present only as a local mutation`);
|
|
1912
|
-
}
|
|
1913
|
-
})(!removals?.has(value)) : {};
|
|
1914
1040
|
|
|
1915
1041
|
// if the relationship already needs to recalc, we don't bother
|
|
1916
1042
|
// attempting to patch the localState
|
|
@@ -1945,11 +1071,6 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1945
1071
|
let additions = relationship.additions;
|
|
1946
1072
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
1947
1073
|
if (hasPresence && !removals?.has(value)) {
|
|
1948
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1949
|
-
if (!test) {
|
|
1950
|
-
throw new Error(`Attempted to add the resource '${value.lid}' to the collection <${relationship.identifier.type}>.${relationship.definition.key} it was already in`);
|
|
1951
|
-
}
|
|
1952
|
-
})(hasPresence && !removals?.has(value)) : {};
|
|
1953
1074
|
return false;
|
|
1954
1075
|
}
|
|
1955
1076
|
if (removals?.has(value)) {
|
|
@@ -1964,9 +1085,6 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1964
1085
|
type
|
|
1965
1086
|
} = relationship.definition;
|
|
1966
1087
|
if (type !== value.type) {
|
|
1967
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1968
|
-
assertPolymorphicType(record, relationship.definition, value, graph.store);
|
|
1969
|
-
}
|
|
1970
1088
|
graph.registerPolymorphicType(value.type, type);
|
|
1971
1089
|
}
|
|
1972
1090
|
}
|
|
@@ -1991,11 +1109,6 @@ function _remove(graph, record, relationship, value, index, isRemote) {
|
|
|
1991
1109
|
return !isRemote ? _removeLocal(relationship, value) : _removeRemote(relationship, value);
|
|
1992
1110
|
}
|
|
1993
1111
|
function _removeLocal(relationship, value) {
|
|
1994
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1995
|
-
if (!test) {
|
|
1996
|
-
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
1997
|
-
}
|
|
1998
|
-
})(value) : {};
|
|
1999
1112
|
const {
|
|
2000
1113
|
remoteMembers,
|
|
2001
1114
|
additions
|
|
@@ -2003,11 +1116,6 @@ function _removeLocal(relationship, value) {
|
|
|
2003
1116
|
let removals = relationship.removals;
|
|
2004
1117
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
2005
1118
|
if (!hasPresence || removals?.has(value)) {
|
|
2006
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2007
|
-
if (!test) {
|
|
2008
|
-
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
|
-
}
|
|
2010
|
-
})(!hasPresence || removals?.has(value)) : {};
|
|
2011
1119
|
return false;
|
|
2012
1120
|
}
|
|
2013
1121
|
if (additions?.has(value)) {
|
|
@@ -2027,37 +1135,17 @@ function _removeLocal(relationship, value) {
|
|
|
2027
1135
|
// be relied upon as any remote change will blow it away
|
|
2028
1136
|
if (relationship.localState) {
|
|
2029
1137
|
const index = relationship.localState.indexOf(value);
|
|
2030
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2031
|
-
if (!test) {
|
|
2032
|
-
throw new Error(`Cannot remove a resource that is not present`);
|
|
2033
|
-
}
|
|
2034
|
-
})(index !== -1) : {};
|
|
2035
1138
|
relationship.localState.splice(index, 1);
|
|
2036
1139
|
}
|
|
2037
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2038
|
-
if (!test) {
|
|
2039
|
-
throw new Error(`Expected relationship to be dirty when performing a local mutation`);
|
|
2040
|
-
}
|
|
2041
|
-
})(relationship.localState || relationship.isDirty) : {};
|
|
2042
1140
|
return true;
|
|
2043
1141
|
}
|
|
2044
1142
|
function _removeRemote(relationship, value) {
|
|
2045
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2046
|
-
if (!test) {
|
|
2047
|
-
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
2048
|
-
}
|
|
2049
|
-
})(value) : {};
|
|
2050
1143
|
const {
|
|
2051
1144
|
remoteMembers,
|
|
2052
1145
|
additions,
|
|
2053
1146
|
removals,
|
|
2054
1147
|
remoteState
|
|
2055
1148
|
} = relationship;
|
|
2056
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2057
|
-
if (!test) {
|
|
2058
|
-
throw new Error(`Cannot remove a resource that is not present`);
|
|
2059
|
-
}
|
|
2060
|
-
})(remoteMembers.has(value)) : {};
|
|
2061
1149
|
if (!remoteMembers.has(value)) {
|
|
2062
1150
|
return false;
|
|
2063
1151
|
}
|
|
@@ -2065,11 +1153,6 @@ function _removeRemote(relationship, value) {
|
|
|
2065
1153
|
// remove from remote state
|
|
2066
1154
|
remoteMembers.delete(value);
|
|
2067
1155
|
let index = remoteState.indexOf(value);
|
|
2068
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2069
|
-
if (!test) {
|
|
2070
|
-
throw new Error(`Cannot remove a resource that is not present`);
|
|
2071
|
-
}
|
|
2072
|
-
})(index !== -1) : {};
|
|
2073
1156
|
remoteState.splice(index, 1);
|
|
2074
1157
|
|
|
2075
1158
|
// remove from removals if present
|
|
@@ -2079,11 +1162,6 @@ function _removeRemote(relationship, value) {
|
|
|
2079
1162
|
// nothing more to do this was our state already
|
|
2080
1163
|
return false;
|
|
2081
1164
|
}
|
|
2082
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2083
|
-
if (!test) {
|
|
2084
|
-
throw new Error(`Remote state indicated removal of a resource that was present only as a local mutation`);
|
|
2085
|
-
}
|
|
2086
|
-
})(!additions?.has(value)) : {};
|
|
2087
1165
|
|
|
2088
1166
|
// if we have existing localState
|
|
2089
1167
|
// and we have an index
|
|
@@ -2094,31 +1172,19 @@ function _removeRemote(relationship, value) {
|
|
|
2094
1172
|
// be relied upon as any remote change will blow it away
|
|
2095
1173
|
if (relationship.localState) {
|
|
2096
1174
|
index = relationship.localState.indexOf(value);
|
|
2097
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2098
|
-
if (!test) {
|
|
2099
|
-
throw new Error(`Cannot remove a resource that is not present`);
|
|
2100
|
-
}
|
|
2101
|
-
})(index !== -1) : {};
|
|
2102
1175
|
relationship.localState.splice(index, 1);
|
|
2103
1176
|
}
|
|
2104
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2105
|
-
if (!test) {
|
|
2106
|
-
throw new Error(`Expected relationship to be dirty when performing a local mutation`);
|
|
2107
|
-
}
|
|
2108
|
-
})(relationship.localState || relationship.isDirty) : {};
|
|
2109
1177
|
return true;
|
|
2110
1178
|
}
|
|
2111
1179
|
function rollbackRelationship(graph, key, field, relationship) {
|
|
2112
1180
|
if (isBelongsTo(relationship)) {
|
|
2113
1181
|
replaceRelatedRecord(graph, {
|
|
2114
|
-
op: 'replaceRelatedRecord',
|
|
2115
1182
|
record: key,
|
|
2116
1183
|
field,
|
|
2117
1184
|
value: relationship.remoteState
|
|
2118
1185
|
}, false);
|
|
2119
1186
|
} else {
|
|
2120
1187
|
replaceRelatedRecords(graph, {
|
|
2121
|
-
op: 'replaceRelatedRecords',
|
|
2122
1188
|
record: key,
|
|
2123
1189
|
field,
|
|
2124
1190
|
value: relationship.remoteState.slice()
|
|
@@ -2268,25 +1334,14 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2268
1334
|
if (isRemote && _isBelongsTo) {
|
|
2269
1335
|
if (value !== relationship.remoteState) {
|
|
2270
1336
|
const newOp = {
|
|
2271
|
-
op: 'replaceRelatedRecord',
|
|
2272
1337
|
record,
|
|
2273
1338
|
field: op.field,
|
|
2274
1339
|
value: value
|
|
2275
1340
|
};
|
|
2276
1341
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2277
1342
|
}
|
|
2278
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2279
|
-
if (!test) {
|
|
2280
|
-
throw new Error(`Expected '${value?.lid}' (the value to add) to NOT be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`);
|
|
2281
|
-
}
|
|
2282
|
-
})(value === relationship.remoteState) : {};
|
|
2283
1343
|
return;
|
|
2284
1344
|
}
|
|
2285
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2286
|
-
if (!test) {
|
|
2287
|
-
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
2288
|
-
}
|
|
2289
|
-
})(isHasMany(relationship)) : {};
|
|
2290
1345
|
|
|
2291
1346
|
// if we are not dirty but have a null localState then we
|
|
2292
1347
|
// are mutating a relationship that has never been fetched
|
|
@@ -2304,11 +1359,6 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2304
1359
|
notifyChange(graph, relationship);
|
|
2305
1360
|
}
|
|
2306
1361
|
function addRelatedRecord(graph, relationship, record, value, index, isRemote) {
|
|
2307
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2308
|
-
if (!test) {
|
|
2309
|
-
throw new Error(`expected an identifier to add to the collection relationship`);
|
|
2310
|
-
}
|
|
2311
|
-
})(value) : {};
|
|
2312
1362
|
if (_add(graph, record, relationship, value, index, isRemote)) {
|
|
2313
1363
|
addToInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2314
1364
|
}
|
|
@@ -2389,25 +1439,14 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2389
1439
|
if (isRemote && _isBelongsTo) {
|
|
2390
1440
|
if (value === relationship.remoteState) {
|
|
2391
1441
|
const newOp = {
|
|
2392
|
-
op: 'replaceRelatedRecord',
|
|
2393
1442
|
record,
|
|
2394
1443
|
field: op.field,
|
|
2395
1444
|
value: null
|
|
2396
1445
|
};
|
|
2397
1446
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2398
1447
|
}
|
|
2399
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2400
|
-
if (!test) {
|
|
2401
|
-
throw new Error(`Expected '${value?.lid}' (the value to remove) to be the same as the remote state '${relationship.remoteState?.lid ?? '<null>'}'`);
|
|
2402
|
-
}
|
|
2403
|
-
})(value === relationship.remoteState) : {};
|
|
2404
1448
|
return;
|
|
2405
1449
|
}
|
|
2406
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2407
|
-
if (!test) {
|
|
2408
|
-
throw new Error(`You can only '${op.op}' on a hasMany relationship. ${record.type}.${op.field} is a ${relationship.definition.kind}`);
|
|
2409
|
-
}
|
|
2410
|
-
})(isHasMany(relationship)) : {};
|
|
2411
1450
|
if (Array.isArray(value)) {
|
|
2412
1451
|
for (let i = 0; i < value.length; i++) {
|
|
2413
1452
|
removeRelatedRecord(graph, record, relationship, value[i], op.index ?? null, isRemote);
|
|
@@ -2418,11 +1457,6 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2418
1457
|
notifyChange(graph, relationship);
|
|
2419
1458
|
}
|
|
2420
1459
|
function removeRelatedRecord(graph, record, relationship, value, index, isRemote) {
|
|
2421
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2422
|
-
if (!test) {
|
|
2423
|
-
throw new Error(`expected an identifier to remove from the collection relationship`);
|
|
2424
|
-
}
|
|
2425
|
-
})(value) : {};
|
|
2426
1460
|
if (_remove(graph, record, relationship, value, index, isRemote)) {
|
|
2427
1461
|
removeFromInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2428
1462
|
}
|
|
@@ -2451,11 +1485,6 @@ function _normalizeLink(link) {
|
|
|
2451
1485
|
*/
|
|
2452
1486
|
function updateRelationshipOperation(graph, op) {
|
|
2453
1487
|
const relationship = graph.get(op.record, op.field);
|
|
2454
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2455
|
-
if (!test) {
|
|
2456
|
-
throw new Error(`Cannot update an implicit relationship`);
|
|
2457
|
-
}
|
|
2458
|
-
})(isHasMany(relationship) || isBelongsTo(relationship)) : {};
|
|
2459
1488
|
const {
|
|
2460
1489
|
definition,
|
|
2461
1490
|
state,
|
|
@@ -2478,11 +1507,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2478
1507
|
if (payload.data === null) {
|
|
2479
1508
|
payload.data = [];
|
|
2480
1509
|
}
|
|
2481
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2482
|
-
if (!test) {
|
|
2483
|
-
throw new Error(`Expected an array`);
|
|
2484
|
-
}
|
|
2485
|
-
})(Array.isArray(payload.data)) : {};
|
|
2486
1510
|
const cache = graph.store.cacheKeyManager;
|
|
2487
1511
|
graph.update({
|
|
2488
1512
|
op: 'replaceRelatedRecords',
|
|
@@ -2524,14 +1548,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2524
1548
|
const currentLink = originalLinks && originalLinks.related ? _normalizeLink(originalLinks.related) : null;
|
|
2525
1549
|
const currentLinkHref = currentLink ? currentLink.href : null;
|
|
2526
1550
|
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, {
|
|
2528
|
-
id: 'ds.store.push-link-for-sync-relationship'
|
|
2529
|
-
});
|
|
2530
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2531
|
-
if (!test) {
|
|
2532
|
-
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
|
-
}
|
|
2534
|
-
})(typeof relatedLink.href === 'string' || relatedLink.href === null) : {};
|
|
2535
1551
|
hasUpdatedLink = true;
|
|
2536
1552
|
}
|
|
2537
1553
|
}
|
|
@@ -2643,11 +1659,6 @@ class Graph {
|
|
|
2643
1659
|
let meta = defs?.[propertyName];
|
|
2644
1660
|
if (!meta) {
|
|
2645
1661
|
const info = /*#__NOINLINE__*/upgradeDefinition(this, resourceKey, propertyName);
|
|
2646
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2647
|
-
if (!test) {
|
|
2648
|
-
throw new Error(`Could not determine relationship information for ${resourceKey.type}.${propertyName}`);
|
|
2649
|
-
}
|
|
2650
|
-
})(info !== null) : {};
|
|
2651
1662
|
|
|
2652
1663
|
// if (info.rhs_definition?.kind === 'implicit') {
|
|
2653
1664
|
// we should possibly also do this
|
|
@@ -2662,11 +1673,6 @@ class Graph {
|
|
|
2662
1673
|
return meta;
|
|
2663
1674
|
}
|
|
2664
1675
|
get(resourceKey, propertyName) {
|
|
2665
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2666
|
-
if (!test) {
|
|
2667
|
-
throw new Error(`expected propertyName`);
|
|
2668
|
-
}
|
|
2669
|
-
})(propertyName) : {};
|
|
2670
1676
|
let relationships = this.identifiers.get(resourceKey);
|
|
2671
1677
|
if (!relationships) {
|
|
2672
1678
|
relationships = Object.create(null);
|
|
@@ -2680,11 +1686,6 @@ class Graph {
|
|
|
2680
1686
|
} else if (meta.kind === 'hasMany') {
|
|
2681
1687
|
relationship = relationships[propertyName] = createCollectionEdge(meta, resourceKey);
|
|
2682
1688
|
} else {
|
|
2683
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2684
|
-
if (!test) {
|
|
2685
|
-
throw new Error(`Expected kind to be implicit`);
|
|
2686
|
-
}
|
|
2687
|
-
})(meta.kind === 'implicit' && meta.isImplicit === true) : {};
|
|
2688
1689
|
relationship = relationships[propertyName] = createImplicitEdge(meta, resourceKey);
|
|
2689
1690
|
}
|
|
2690
1691
|
}
|
|
@@ -2692,11 +1693,6 @@ class Graph {
|
|
|
2692
1693
|
}
|
|
2693
1694
|
getData(resourceKey, propertyName) {
|
|
2694
1695
|
const relationship = this.get(resourceKey, propertyName);
|
|
2695
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2696
|
-
if (!test) {
|
|
2697
|
-
throw new Error(`Cannot getData() on an implicit relationship`);
|
|
2698
|
-
}
|
|
2699
|
-
})(!isImplicit(relationship)) : {};
|
|
2700
1696
|
if (isBelongsTo(relationship)) {
|
|
2701
1697
|
return legacyGetResourceRelationshipData(relationship, false);
|
|
2702
1698
|
}
|
|
@@ -2704,11 +1700,6 @@ class Graph {
|
|
|
2704
1700
|
}
|
|
2705
1701
|
getRemoteData(resourceKey, propertyName) {
|
|
2706
1702
|
const relationship = this.get(resourceKey, propertyName);
|
|
2707
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2708
|
-
if (!test) {
|
|
2709
|
-
throw new Error(`Cannot getRemoteData() on an implicit relationship`);
|
|
2710
|
-
}
|
|
2711
|
-
})(!isImplicit(relationship)) : {};
|
|
2712
1703
|
if (isBelongsTo(relationship)) {
|
|
2713
1704
|
return legacyGetResourceRelationshipData(relationship, true);
|
|
2714
1705
|
}
|
|
@@ -2742,12 +1733,6 @@ class Graph {
|
|
|
2742
1733
|
isReleasable(resourceKey) {
|
|
2743
1734
|
const relationships = this.identifiers.get(resourceKey);
|
|
2744
1735
|
if (!relationships) {
|
|
2745
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2746
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2747
|
-
// eslint-disable-next-line no-console
|
|
2748
|
-
console.log(`graph: RELEASABLE ${String(resourceKey)}`);
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
1736
|
return true;
|
|
2752
1737
|
}
|
|
2753
1738
|
const keys = Object.keys(relationships);
|
|
@@ -2758,36 +1743,13 @@ class Graph {
|
|
|
2758
1743
|
if (relationship === undefined) {
|
|
2759
1744
|
continue;
|
|
2760
1745
|
}
|
|
2761
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2762
|
-
if (!test) {
|
|
2763
|
-
throw new Error(`Expected a relationship`);
|
|
2764
|
-
}
|
|
2765
|
-
})(relationship) : {};
|
|
2766
1746
|
if (relationship.definition.inverseIsAsync && !checkIfNew(this._realStore, resourceKey)) {
|
|
2767
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2768
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2769
|
-
// eslint-disable-next-line no-console
|
|
2770
|
-
console.log(`graph: <<NOT>> RELEASABLE ${String(resourceKey)}`);
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
1747
|
return false;
|
|
2774
1748
|
}
|
|
2775
1749
|
}
|
|
2776
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2777
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2778
|
-
// eslint-disable-next-line no-console
|
|
2779
|
-
console.log(`graph: RELEASABLE ${String(resourceKey)}`);
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
1750
|
return true;
|
|
2783
1751
|
}
|
|
2784
1752
|
unload(resourceKey, silenceNotifications) {
|
|
2785
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2786
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2787
|
-
// eslint-disable-next-line no-console
|
|
2788
|
-
console.log(`graph: unload ${String(resourceKey)}`);
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
1753
|
const relationships = this.identifiers.get(resourceKey);
|
|
2792
1754
|
if (relationships) {
|
|
2793
1755
|
// cleans up the graph but retains some nodes
|
|
@@ -2897,17 +1859,6 @@ class Graph {
|
|
|
2897
1859
|
return changed;
|
|
2898
1860
|
}
|
|
2899
1861
|
remove(resourceKey) {
|
|
2900
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2901
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2902
|
-
// eslint-disable-next-line no-console
|
|
2903
|
-
console.log(`graph: remove ${String(resourceKey)}`);
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
2906
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2907
|
-
if (!test) {
|
|
2908
|
-
throw new Error(`Cannot remove ${String(resourceKey)} while still removing ${String(this._removing)}`);
|
|
2909
|
-
}
|
|
2910
|
-
})(!this._removing) : {};
|
|
2911
1862
|
this._removing = resourceKey;
|
|
2912
1863
|
this.unload(resourceKey);
|
|
2913
1864
|
this.identifiers.delete(resourceKey);
|
|
@@ -2918,21 +1869,10 @@ class Graph {
|
|
|
2918
1869
|
* Remote state changes
|
|
2919
1870
|
*/
|
|
2920
1871
|
push(op) {
|
|
2921
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2922
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2923
|
-
// eslint-disable-next-line no-console
|
|
2924
|
-
console.log(`graph: push ${String(op.record)}`, op);
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
1872
|
if (op.op === 'deleteRecord') {
|
|
2928
1873
|
this._pushedUpdates.deletions.push(op);
|
|
2929
1874
|
} else {
|
|
2930
1875
|
const definition = this.getDefinition(op.record, op.field);
|
|
2931
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2932
|
-
if (!test) {
|
|
2933
|
-
throw new Error(`Cannot push a remote update for an implicit relationship`);
|
|
2934
|
-
}
|
|
2935
|
-
})(definition.kind !== 'implicit') : {};
|
|
2936
1876
|
addPending(this._pushedUpdates, definition, op);
|
|
2937
1877
|
}
|
|
2938
1878
|
if (!this._willSyncRemote) {
|
|
@@ -2951,17 +1891,6 @@ class Graph {
|
|
|
2951
1891
|
*/
|
|
2952
1892
|
|
|
2953
1893
|
update(op, isRemote = false) {
|
|
2954
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2955
|
-
if (!test) {
|
|
2956
|
-
throw new Error(`Cannot update an implicit relationship`);
|
|
2957
|
-
}
|
|
2958
|
-
})(op.op === 'deleteRecord' || op.op === 'mergeIdentifiers' || !isImplicit(this.get(op.record, op.field))) : {};
|
|
2959
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
2960
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
2961
|
-
// eslint-disable-next-line no-console
|
|
2962
|
-
console.log(`graph: update (${isRemote ? 'remote' : 'local'}) ${String(op.record)}`, op);
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
1894
|
switch (op.op) {
|
|
2966
1895
|
case 'mergeIdentifiers':
|
|
2967
1896
|
{
|
|
@@ -2973,26 +1902,10 @@ class Graph {
|
|
|
2973
1902
|
}
|
|
2974
1903
|
case 'update':
|
|
2975
1904
|
case 'updateRelationship':
|
|
2976
|
-
|
|
2977
|
-
if (!test) {
|
|
2978
|
-
throw new Error(`Can only perform the operation updateRelationship on remote state`);
|
|
2979
|
-
}
|
|
2980
|
-
})(isRemote) : {};
|
|
2981
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
2982
|
-
// in debug, assert payload validity eagerly
|
|
2983
|
-
// TODO add deprecations/assertion here for duplicates
|
|
2984
|
-
assertValidRelationshipPayload(this, op);
|
|
2985
|
-
}
|
|
2986
|
-
/*#__NOINLINE__*/
|
|
2987
|
-
updateRelationshipOperation(this, op);
|
|
1905
|
+
/*#__NOINLINE__*/updateRelationshipOperation(this, op);
|
|
2988
1906
|
break;
|
|
2989
1907
|
case 'deleteRecord':
|
|
2990
1908
|
{
|
|
2991
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2992
|
-
if (!test) {
|
|
2993
|
-
throw new Error(`Can only perform the operation deleteRelationship on remote state`);
|
|
2994
|
-
}
|
|
2995
|
-
})(isRemote) : {};
|
|
2996
1909
|
const identifier = op.record;
|
|
2997
1910
|
const relationships = this.identifiers.get(identifier);
|
|
2998
1911
|
if (relationships) {
|
|
@@ -3023,12 +1936,6 @@ class Graph {
|
|
|
3023
1936
|
case 'replaceRelatedRecords':
|
|
3024
1937
|
/*#__NOINLINE__*/replaceRelatedRecords(this, op, isRemote);
|
|
3025
1938
|
break;
|
|
3026
|
-
default:
|
|
3027
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
3028
|
-
{
|
|
3029
|
-
throw new Error(`No local relationship update operation exists for '${op.op}'`);
|
|
3030
|
-
}
|
|
3031
|
-
})() : {};
|
|
3032
1939
|
}
|
|
3033
1940
|
}
|
|
3034
1941
|
_scheduleLocalSync(relationship) {
|
|
@@ -3042,12 +1949,6 @@ class Graph {
|
|
|
3042
1949
|
if (!this._willSyncRemote) {
|
|
3043
1950
|
return;
|
|
3044
1951
|
}
|
|
3045
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
3046
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3047
|
-
// eslint-disable-next-line no-console
|
|
3048
|
-
console.groupCollapsed(`Graph: Initialized Transaction`);
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
1952
|
let transactionRef = peekTransient('transactionRef') ?? 0;
|
|
3052
1953
|
this._transaction = ++transactionRef;
|
|
3053
1954
|
setTransient('transactionRef', transactionRef);
|
|
@@ -3071,27 +1972,8 @@ class Graph {
|
|
|
3071
1972
|
flushPending(this, belongsTo);
|
|
3072
1973
|
}
|
|
3073
1974
|
this._transaction = null;
|
|
3074
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
3075
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3076
|
-
// eslint-disable-next-line no-console
|
|
3077
|
-
console.log(`Graph: transaction finalized`);
|
|
3078
|
-
// eslint-disable-next-line no-console
|
|
3079
|
-
console.groupEnd();
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
1975
|
}
|
|
3083
1976
|
_addToTransaction(relationship) {
|
|
3084
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
3085
|
-
if (!test) {
|
|
3086
|
-
throw new Error(`expected a transaction`);
|
|
3087
|
-
}
|
|
3088
|
-
})(this._transaction !== null) : {};
|
|
3089
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_GRAPH)) {
|
|
3090
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_GRAPH || globalThis.getWarpDriveRuntimeConfig().debug.LOG_GRAPH) {
|
|
3091
|
-
// eslint-disable-next-line no-console
|
|
3092
|
-
console.log(`Graph: ${String(relationship.identifier)} ${relationship.definition.key} added to transaction`);
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
1977
|
relationship.transactionRef = this._transaction;
|
|
3096
1978
|
}
|
|
3097
1979
|
_flushLocalQueue() {
|
|
@@ -3110,18 +1992,6 @@ class Graph {
|
|
|
3110
1992
|
}
|
|
3111
1993
|
destroy() {
|
|
3112
1994
|
Graphs.delete(this.store);
|
|
3113
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
3114
|
-
Graphs.delete(getStore(this.store));
|
|
3115
|
-
if (Graphs.size) {
|
|
3116
|
-
Graphs.forEach((_, key) => {
|
|
3117
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
3118
|
-
if (!test) {
|
|
3119
|
-
throw new Error(`Memory Leak Detected, likely the test or app instance previous to this was not torn down properly`);
|
|
3120
|
-
}
|
|
3121
|
-
})(!key.isDestroyed && !key.isDestroying) : {};
|
|
3122
|
-
});
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
1995
|
this.identifiers.clear();
|
|
3126
1996
|
this.store = null;
|
|
3127
1997
|
this.isDestroyed = true;
|
|
@@ -3187,11 +2057,6 @@ function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey,
|
|
|
3187
2057
|
return;
|
|
3188
2058
|
}
|
|
3189
2059
|
const relationship = graph.get(inverseIdentifier, inverseKey);
|
|
3190
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
3191
|
-
if (!test) {
|
|
3192
|
-
throw new Error(`expected no implicit`);
|
|
3193
|
-
}
|
|
3194
|
-
})(!isImplicit(relationship)) : {};
|
|
3195
2060
|
|
|
3196
2061
|
// For remote members, it is possible that inverseRecordData has already been associated to
|
|
3197
2062
|
// to another record. For such cases, do not dematerialize the inverseRecordData
|
|
@@ -3363,11 +2228,6 @@ function graphFor(store) {
|
|
|
3363
2228
|
graph = new Graph(wrapper);
|
|
3364
2229
|
Graphs.set(wrapper, graph);
|
|
3365
2230
|
getStore(wrapper)._graph = graph;
|
|
3366
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
3367
|
-
if (getStore(wrapper).isDestroying) {
|
|
3368
|
-
throw new Error(`Memory Leak Detected During Teardown`);
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3371
2231
|
}
|
|
3372
2232
|
return graph;
|
|
3373
2233
|
}
|