@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,7 +621,7 @@ 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
|
-
|
|
624
|
+
{
|
|
1183
625
|
// only do this for legacy hasMany, not collection
|
|
1184
626
|
// and provide a way to incrementally migrate
|
|
1185
627
|
if (
|
|
@@ -1187,16 +629,9 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1187
629
|
// because we want to clear local changes even if
|
|
1188
630
|
// no change has occurred to preserve the legacy behavior
|
|
1189
631
|
relationship.definition.kind === 'hasMany' && relationship.definition.resetOnRemoteUpdate !== false && (diff.changed || wasDirty)) {
|
|
1190
|
-
const deprecationInfo = {
|
|
1191
|
-
removals: [],
|
|
1192
|
-
additions: [],
|
|
1193
|
-
triggered: false
|
|
1194
|
-
};
|
|
1195
632
|
if (relationship.removals) {
|
|
1196
633
|
relationship.isDirty = true;
|
|
1197
634
|
relationship.removals.forEach(resourceKey => {
|
|
1198
|
-
deprecationInfo.triggered = true;
|
|
1199
|
-
deprecationInfo.removals.push(resourceKey);
|
|
1200
635
|
// reverse the removal
|
|
1201
636
|
// if we are still in removals at this point then
|
|
1202
637
|
// we were not "committed" which means we are present
|
|
@@ -1213,8 +648,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1213
648
|
// in the remoteMembers. So we "remove" from the inverse.
|
|
1214
649
|
// however we only do this if we are not a "new" record.
|
|
1215
650
|
if (!checkIfNew(graph._realStore, resourceKey)) {
|
|
1216
|
-
deprecationInfo.triggered = true;
|
|
1217
|
-
deprecationInfo.additions.push(resourceKey);
|
|
1218
651
|
relationship.isDirty = true;
|
|
1219
652
|
relationship.additions.delete(resourceKey);
|
|
1220
653
|
removeFromInverse(graph, resourceKey, definition.inverseKey, op.record, false);
|
|
@@ -1224,18 +657,6 @@ function replaceRelatedRecordsRemote(graph, op, isRemote) {
|
|
|
1224
657
|
relationship.additions = null;
|
|
1225
658
|
}
|
|
1226
659
|
}
|
|
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
660
|
}
|
|
1240
661
|
}
|
|
1241
662
|
if (relationship.isDirty && !wasDirty) {
|
|
@@ -1248,9 +669,6 @@ function addToInverse(graph, resourceKey, key, value, isRemote) {
|
|
|
1248
669
|
type
|
|
1249
670
|
} = relationship.definition;
|
|
1250
671
|
if (type !== value.type) {
|
|
1251
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1252
|
-
assertPolymorphicType(relationship.identifier, relationship.definition, value, graph.store);
|
|
1253
|
-
}
|
|
1254
672
|
graph.registerPolymorphicType(type, value.type);
|
|
1255
673
|
}
|
|
1256
674
|
if (isBelongsTo(relationship)) {
|
|
@@ -1360,11 +778,6 @@ function flushCanonical(graph, rel) {
|
|
|
1360
778
|
}
|
|
1361
779
|
function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
1362
780
|
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
781
|
if (isRemote) {
|
|
1369
782
|
graph._addToTransaction(relationship);
|
|
1370
783
|
}
|
|
@@ -1425,21 +838,11 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1425
838
|
}
|
|
1426
839
|
if (existingState && localState === existingState) {
|
|
1427
840
|
notifyInverseOfPotentialMaterialization(graph, existingState, definition.inverseKey, op.record, isRemote);
|
|
1428
|
-
} else
|
|
841
|
+
} else {
|
|
1429
842
|
// if localState does not match existingState then we know
|
|
1430
843
|
// we have a local mutation that has not been persisted yet
|
|
1431
844
|
if (localState !== op.value && relationship.definition.resetOnRemoteUpdate !== false) {
|
|
1432
845
|
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
846
|
notifyChange(graph, relationship);
|
|
1444
847
|
}
|
|
1445
848
|
}
|
|
@@ -1469,9 +872,7 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1469
872
|
// but the record does turn out to be polymorphic
|
|
1470
873
|
// this should still assert if the user is relying on legacy inheritance/mixins to
|
|
1471
874
|
// provide polymorphic behavior and has not yet added the polymorphic flags
|
|
1472
|
-
|
|
1473
|
-
assertPolymorphicType(relationship.identifier, definition, op.value, graph.store);
|
|
1474
|
-
}
|
|
875
|
+
|
|
1475
876
|
graph.registerPolymorphicType(definition.type, op.value.type);
|
|
1476
877
|
}
|
|
1477
878
|
addToInverse(graph, op.value, definition.inverseKey, op.record, isRemote);
|
|
@@ -1493,19 +894,9 @@ function replaceRelatedRecord(graph, op, isRemote = false) {
|
|
|
1493
894
|
// But when localState does not match the new remoteState and
|
|
1494
895
|
// and localState !== existingState then we know we have a local mutation
|
|
1495
896
|
// that has not been persisted yet.
|
|
1496
|
-
} else
|
|
897
|
+
} else {
|
|
1497
898
|
if (localState !== remoteState && localState !== existingState && relationship.definition.resetOnRemoteUpdate !== false) {
|
|
1498
899
|
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
900
|
notifyChange(graph, relationship);
|
|
1510
901
|
}
|
|
1511
902
|
}
|
|
@@ -1570,7 +961,7 @@ function _deprecatedCompare(priorLocalState, newState, newMembers, prevState, pr
|
|
|
1570
961
|
// however: if the new remote order matches the current local order
|
|
1571
962
|
// we can disregard the change notification generation so long as
|
|
1572
963
|
// we are not configured to reset on remote update (which is deprecated)
|
|
1573
|
-
|
|
964
|
+
{
|
|
1574
965
|
if (!remoteClearsLocal && i < priorLocalLength) {
|
|
1575
966
|
const priorLocalMember = priorLocalState[j];
|
|
1576
967
|
if (priorLocalMember !== member) {
|
|
@@ -1579,21 +970,12 @@ function _deprecatedCompare(priorLocalState, newState, newMembers, prevState, pr
|
|
|
1579
970
|
} else {
|
|
1580
971
|
changed = true;
|
|
1581
972
|
}
|
|
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
973
|
}
|
|
1592
974
|
|
|
1593
975
|
// if remote order hasn't changed but local order differs
|
|
1594
976
|
// and we are configured to reset on remote update (which is deprecated)
|
|
1595
977
|
// then we still need to mark the relationship as changed
|
|
1596
|
-
} else
|
|
978
|
+
} else {
|
|
1597
979
|
if (remoteClearsLocal) {
|
|
1598
980
|
if (!changed && j < priorLocalLength) {
|
|
1599
981
|
const priorLocalMember = priorLocalState[j];
|
|
@@ -1638,14 +1020,6 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1638
1020
|
const added = new Set();
|
|
1639
1021
|
const removed = new Set();
|
|
1640
1022
|
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
1023
|
for (let i = 0; i < iterationLength; i++) {
|
|
1650
1024
|
let member;
|
|
1651
1025
|
|
|
@@ -1657,12 +1031,6 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1657
1031
|
if (i < priorLocalLength) {
|
|
1658
1032
|
const priorLocalMember = priorLocalState[i];
|
|
1659
1033
|
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
1034
|
changed = true;
|
|
1667
1035
|
}
|
|
1668
1036
|
}
|
|
@@ -1687,40 +1055,23 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1687
1055
|
if (i < priorLocalLength) {
|
|
1688
1056
|
const priorLocalMember = priorLocalState[i];
|
|
1689
1057
|
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
1058
|
changed = true;
|
|
1697
1059
|
}
|
|
1698
1060
|
} else if (i < finalLength) {
|
|
1699
1061
|
// if we have exceeded the length of priorLocalState and we are within the range
|
|
1700
1062
|
// 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
|
-
}
|
|
1063
|
+
|
|
1707
1064
|
changed = true;
|
|
1708
1065
|
}
|
|
1709
1066
|
|
|
1710
1067
|
// if remote order hasn't changed but local order differs
|
|
1711
1068
|
// and we are configured to reset on remote update (which is deprecated)
|
|
1712
1069
|
// then we still need to mark the relationship as changed
|
|
1713
|
-
} else
|
|
1070
|
+
} else {
|
|
1714
1071
|
if (remoteClearsLocal) {
|
|
1715
1072
|
if (equalLength && !changed && i < priorLocalLength) {
|
|
1716
1073
|
const priorLocalMember = priorLocalState[i];
|
|
1717
1074
|
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
1075
|
changed = true;
|
|
1725
1076
|
}
|
|
1726
1077
|
}
|
|
@@ -1765,14 +1116,7 @@ function _compare(priorLocalState, finalState, finalSet, prevState, prevSet, onA
|
|
|
1765
1116
|
// if you do not have a priorLocalState you can't be changed
|
|
1766
1117
|
// ergo, we never need to set changed in this branch.
|
|
1767
1118
|
// 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
|
-
}
|
|
1119
|
+
|
|
1776
1120
|
//
|
|
1777
1121
|
// we do still set remoteOrderChanged as it has
|
|
1778
1122
|
remoteOrderChanged = true;
|
|
@@ -1797,43 +1141,18 @@ function diffCollection(finalState, relationship, onAdd, onDel) {
|
|
|
1797
1141
|
remoteState,
|
|
1798
1142
|
remoteMembers
|
|
1799
1143
|
} = relationship;
|
|
1800
|
-
|
|
1144
|
+
{
|
|
1801
1145
|
if (finalState.length !== finalSet.size) {
|
|
1802
1146
|
const {
|
|
1803
|
-
diff
|
|
1804
|
-
duplicates
|
|
1147
|
+
diff
|
|
1805
1148
|
} = _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
1149
|
return diff;
|
|
1820
1150
|
}
|
|
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
1151
|
}
|
|
1828
1152
|
return _compare(priorLocalState, finalState, finalSet, remoteState, remoteMembers, onAdd, onDel, relationship.definition.resetOnRemoteUpdate);
|
|
1829
1153
|
}
|
|
1830
1154
|
function computeLocalState(storage) {
|
|
1831
1155
|
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
1156
|
return storage.localState;
|
|
1838
1157
|
}
|
|
1839
1158
|
const state = storage.remoteState.slice();
|
|
@@ -1865,33 +1184,18 @@ function _add(graph, record, relationship, value, index, isRemote) {
|
|
|
1865
1184
|
return !isRemote ? _addLocal(graph, record, relationship, value, index) : _addRemote(graph, record, relationship, value, index);
|
|
1866
1185
|
}
|
|
1867
1186
|
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
1187
|
const {
|
|
1874
1188
|
remoteMembers,
|
|
1875
1189
|
additions,
|
|
1876
1190
|
removals,
|
|
1877
1191
|
remoteState
|
|
1878
1192
|
} = 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
1193
|
if (remoteMembers.has(value)) {
|
|
1885
1194
|
return false;
|
|
1886
1195
|
}
|
|
1887
1196
|
|
|
1888
1197
|
// add to the remote state
|
|
1889
1198
|
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
1199
|
const hasValidIndex = index !== null && index >= 0 && index < remoteState.length;
|
|
1896
1200
|
if (hasValidIndex) {
|
|
1897
1201
|
remoteState.splice(index, 0, value);
|
|
@@ -1906,11 +1210,6 @@ function _addRemote(graph, record, relationship, value, index) {
|
|
|
1906
1210
|
// nothing more to do this was our state already
|
|
1907
1211
|
return false;
|
|
1908
1212
|
}
|
|
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
1213
|
|
|
1915
1214
|
// if the relationship already needs to recalc, we don't bother
|
|
1916
1215
|
// attempting to patch the localState
|
|
@@ -1945,11 +1244,6 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1945
1244
|
let additions = relationship.additions;
|
|
1946
1245
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
1947
1246
|
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
1247
|
return false;
|
|
1954
1248
|
}
|
|
1955
1249
|
if (removals?.has(value)) {
|
|
@@ -1964,9 +1258,6 @@ function _addLocal(graph, record, relationship, value, index) {
|
|
|
1964
1258
|
type
|
|
1965
1259
|
} = relationship.definition;
|
|
1966
1260
|
if (type !== value.type) {
|
|
1967
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
1968
|
-
assertPolymorphicType(record, relationship.definition, value, graph.store);
|
|
1969
|
-
}
|
|
1970
1261
|
graph.registerPolymorphicType(value.type, type);
|
|
1971
1262
|
}
|
|
1972
1263
|
}
|
|
@@ -1991,11 +1282,6 @@ function _remove(graph, record, relationship, value, index, isRemote) {
|
|
|
1991
1282
|
return !isRemote ? _removeLocal(relationship, value) : _removeRemote(relationship, value);
|
|
1992
1283
|
}
|
|
1993
1284
|
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
1285
|
const {
|
|
2000
1286
|
remoteMembers,
|
|
2001
1287
|
additions
|
|
@@ -2003,11 +1289,6 @@ function _removeLocal(relationship, value) {
|
|
|
2003
1289
|
let removals = relationship.removals;
|
|
2004
1290
|
const hasPresence = remoteMembers.has(value) || additions?.has(value);
|
|
2005
1291
|
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
1292
|
return false;
|
|
2012
1293
|
}
|
|
2013
1294
|
if (additions?.has(value)) {
|
|
@@ -2027,37 +1308,17 @@ function _removeLocal(relationship, value) {
|
|
|
2027
1308
|
// be relied upon as any remote change will blow it away
|
|
2028
1309
|
if (relationship.localState) {
|
|
2029
1310
|
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
1311
|
relationship.localState.splice(index, 1);
|
|
2036
1312
|
}
|
|
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
1313
|
return true;
|
|
2043
1314
|
}
|
|
2044
1315
|
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
1316
|
const {
|
|
2051
1317
|
remoteMembers,
|
|
2052
1318
|
additions,
|
|
2053
1319
|
removals,
|
|
2054
1320
|
remoteState
|
|
2055
1321
|
} = 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
1322
|
if (!remoteMembers.has(value)) {
|
|
2062
1323
|
return false;
|
|
2063
1324
|
}
|
|
@@ -2065,11 +1326,6 @@ function _removeRemote(relationship, value) {
|
|
|
2065
1326
|
// remove from remote state
|
|
2066
1327
|
remoteMembers.delete(value);
|
|
2067
1328
|
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
1329
|
remoteState.splice(index, 1);
|
|
2074
1330
|
|
|
2075
1331
|
// remove from removals if present
|
|
@@ -2079,11 +1335,6 @@ function _removeRemote(relationship, value) {
|
|
|
2079
1335
|
// nothing more to do this was our state already
|
|
2080
1336
|
return false;
|
|
2081
1337
|
}
|
|
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
1338
|
|
|
2088
1339
|
// if we have existing localState
|
|
2089
1340
|
// and we have an index
|
|
@@ -2094,31 +1345,19 @@ function _removeRemote(relationship, value) {
|
|
|
2094
1345
|
// be relied upon as any remote change will blow it away
|
|
2095
1346
|
if (relationship.localState) {
|
|
2096
1347
|
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
1348
|
relationship.localState.splice(index, 1);
|
|
2103
1349
|
}
|
|
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
1350
|
return true;
|
|
2110
1351
|
}
|
|
2111
1352
|
function rollbackRelationship(graph, key, field, relationship) {
|
|
2112
1353
|
if (isBelongsTo(relationship)) {
|
|
2113
1354
|
replaceRelatedRecord(graph, {
|
|
2114
|
-
op: 'replaceRelatedRecord',
|
|
2115
1355
|
record: key,
|
|
2116
1356
|
field,
|
|
2117
1357
|
value: relationship.remoteState
|
|
2118
1358
|
}, false);
|
|
2119
1359
|
} else {
|
|
2120
1360
|
replaceRelatedRecords(graph, {
|
|
2121
|
-
op: 'replaceRelatedRecords',
|
|
2122
1361
|
record: key,
|
|
2123
1362
|
field,
|
|
2124
1363
|
value: relationship.remoteState.slice()
|
|
@@ -2268,25 +1507,14 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2268
1507
|
if (isRemote && _isBelongsTo) {
|
|
2269
1508
|
if (value !== relationship.remoteState) {
|
|
2270
1509
|
const newOp = {
|
|
2271
|
-
op: 'replaceRelatedRecord',
|
|
2272
1510
|
record,
|
|
2273
1511
|
field: op.field,
|
|
2274
1512
|
value: value
|
|
2275
1513
|
};
|
|
2276
1514
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2277
1515
|
}
|
|
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
1516
|
return;
|
|
2284
1517
|
}
|
|
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
1518
|
|
|
2291
1519
|
// if we are not dirty but have a null localState then we
|
|
2292
1520
|
// are mutating a relationship that has never been fetched
|
|
@@ -2304,11 +1532,6 @@ function addToRelatedRecords(graph, op, isRemote) {
|
|
|
2304
1532
|
notifyChange(graph, relationship);
|
|
2305
1533
|
}
|
|
2306
1534
|
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
1535
|
if (_add(graph, record, relationship, value, index, isRemote)) {
|
|
2313
1536
|
addToInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2314
1537
|
}
|
|
@@ -2389,25 +1612,14 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2389
1612
|
if (isRemote && _isBelongsTo) {
|
|
2390
1613
|
if (value === relationship.remoteState) {
|
|
2391
1614
|
const newOp = {
|
|
2392
|
-
op: 'replaceRelatedRecord',
|
|
2393
1615
|
record,
|
|
2394
1616
|
field: op.field,
|
|
2395
1617
|
value: null
|
|
2396
1618
|
};
|
|
2397
1619
|
return replaceRelatedRecord(graph, newOp, isRemote);
|
|
2398
1620
|
}
|
|
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
1621
|
return;
|
|
2405
1622
|
}
|
|
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
1623
|
if (Array.isArray(value)) {
|
|
2412
1624
|
for (let i = 0; i < value.length; i++) {
|
|
2413
1625
|
removeRelatedRecord(graph, record, relationship, value[i], op.index ?? null, isRemote);
|
|
@@ -2418,11 +1630,6 @@ function removeFromRelatedRecords(graph, op, isRemote) {
|
|
|
2418
1630
|
notifyChange(graph, relationship);
|
|
2419
1631
|
}
|
|
2420
1632
|
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
1633
|
if (_remove(graph, record, relationship, value, index, isRemote)) {
|
|
2427
1634
|
removeFromInverse(graph, value, relationship.definition.inverseKey, record, isRemote);
|
|
2428
1635
|
}
|
|
@@ -2451,11 +1658,6 @@ function _normalizeLink(link) {
|
|
|
2451
1658
|
*/
|
|
2452
1659
|
function updateRelationshipOperation(graph, op) {
|
|
2453
1660
|
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
1661
|
const {
|
|
2460
1662
|
definition,
|
|
2461
1663
|
state,
|
|
@@ -2478,11 +1680,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2478
1680
|
if (payload.data === null) {
|
|
2479
1681
|
payload.data = [];
|
|
2480
1682
|
}
|
|
2481
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2482
|
-
if (!test) {
|
|
2483
|
-
throw new Error(`Expected an array`);
|
|
2484
|
-
}
|
|
2485
|
-
})(Array.isArray(payload.data)) : {};
|
|
2486
1683
|
const cache = graph.store.cacheKeyManager;
|
|
2487
1684
|
graph.update({
|
|
2488
1685
|
op: 'replaceRelatedRecords',
|
|
@@ -2524,14 +1721,6 @@ function updateRelationshipOperation(graph, op) {
|
|
|
2524
1721
|
const currentLink = originalLinks && originalLinks.related ? _normalizeLink(originalLinks.related) : null;
|
|
2525
1722
|
const currentLinkHref = currentLink ? currentLink.href : null;
|
|
2526
1723
|
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
1724
|
hasUpdatedLink = true;
|
|
2536
1725
|
}
|
|
2537
1726
|
}
|
|
@@ -2643,11 +1832,6 @@ class Graph {
|
|
|
2643
1832
|
let meta = defs?.[propertyName];
|
|
2644
1833
|
if (!meta) {
|
|
2645
1834
|
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
1835
|
|
|
2652
1836
|
// if (info.rhs_definition?.kind === 'implicit') {
|
|
2653
1837
|
// we should possibly also do this
|
|
@@ -2662,11 +1846,6 @@ class Graph {
|
|
|
2662
1846
|
return meta;
|
|
2663
1847
|
}
|
|
2664
1848
|
get(resourceKey, propertyName) {
|
|
2665
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2666
|
-
if (!test) {
|
|
2667
|
-
throw new Error(`expected propertyName`);
|
|
2668
|
-
}
|
|
2669
|
-
})(propertyName) : {};
|
|
2670
1849
|
let relationships = this.identifiers.get(resourceKey);
|
|
2671
1850
|
if (!relationships) {
|
|
2672
1851
|
relationships = Object.create(null);
|
|
@@ -2680,11 +1859,6 @@ class Graph {
|
|
|
2680
1859
|
} else if (meta.kind === 'hasMany') {
|
|
2681
1860
|
relationship = relationships[propertyName] = createCollectionEdge(meta, resourceKey);
|
|
2682
1861
|
} 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
1862
|
relationship = relationships[propertyName] = createImplicitEdge(meta, resourceKey);
|
|
2689
1863
|
}
|
|
2690
1864
|
}
|
|
@@ -2692,11 +1866,6 @@ class Graph {
|
|
|
2692
1866
|
}
|
|
2693
1867
|
getData(resourceKey, propertyName) {
|
|
2694
1868
|
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
1869
|
if (isBelongsTo(relationship)) {
|
|
2701
1870
|
return legacyGetResourceRelationshipData(relationship, false);
|
|
2702
1871
|
}
|
|
@@ -2704,11 +1873,6 @@ class Graph {
|
|
|
2704
1873
|
}
|
|
2705
1874
|
getRemoteData(resourceKey, propertyName) {
|
|
2706
1875
|
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
1876
|
if (isBelongsTo(relationship)) {
|
|
2713
1877
|
return legacyGetResourceRelationshipData(relationship, true);
|
|
2714
1878
|
}
|
|
@@ -2742,12 +1906,6 @@ class Graph {
|
|
|
2742
1906
|
isReleasable(resourceKey) {
|
|
2743
1907
|
const relationships = this.identifiers.get(resourceKey);
|
|
2744
1908
|
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
1909
|
return true;
|
|
2752
1910
|
}
|
|
2753
1911
|
const keys = Object.keys(relationships);
|
|
@@ -2758,36 +1916,13 @@ class Graph {
|
|
|
2758
1916
|
if (relationship === undefined) {
|
|
2759
1917
|
continue;
|
|
2760
1918
|
}
|
|
2761
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2762
|
-
if (!test) {
|
|
2763
|
-
throw new Error(`Expected a relationship`);
|
|
2764
|
-
}
|
|
2765
|
-
})(relationship) : {};
|
|
2766
1919
|
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
1920
|
return false;
|
|
2774
1921
|
}
|
|
2775
1922
|
}
|
|
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
1923
|
return true;
|
|
2783
1924
|
}
|
|
2784
1925
|
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
1926
|
const relationships = this.identifiers.get(resourceKey);
|
|
2792
1927
|
if (relationships) {
|
|
2793
1928
|
// cleans up the graph but retains some nodes
|
|
@@ -2897,17 +2032,6 @@ class Graph {
|
|
|
2897
2032
|
return changed;
|
|
2898
2033
|
}
|
|
2899
2034
|
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
2035
|
this._removing = resourceKey;
|
|
2912
2036
|
this.unload(resourceKey);
|
|
2913
2037
|
this.identifiers.delete(resourceKey);
|
|
@@ -2918,21 +2042,10 @@ class Graph {
|
|
|
2918
2042
|
* Remote state changes
|
|
2919
2043
|
*/
|
|
2920
2044
|
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
2045
|
if (op.op === 'deleteRecord') {
|
|
2928
2046
|
this._pushedUpdates.deletions.push(op);
|
|
2929
2047
|
} else {
|
|
2930
2048
|
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
2049
|
addPending(this._pushedUpdates, definition, op);
|
|
2937
2050
|
}
|
|
2938
2051
|
if (!this._willSyncRemote) {
|
|
@@ -2951,17 +2064,6 @@ class Graph {
|
|
|
2951
2064
|
*/
|
|
2952
2065
|
|
|
2953
2066
|
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
2067
|
switch (op.op) {
|
|
2966
2068
|
case 'mergeIdentifiers':
|
|
2967
2069
|
{
|
|
@@ -2973,26 +2075,10 @@ class Graph {
|
|
|
2973
2075
|
}
|
|
2974
2076
|
case 'update':
|
|
2975
2077
|
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);
|
|
2078
|
+
/*#__NOINLINE__*/updateRelationshipOperation(this, op);
|
|
2988
2079
|
break;
|
|
2989
2080
|
case 'deleteRecord':
|
|
2990
2081
|
{
|
|
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
2082
|
const identifier = op.record;
|
|
2997
2083
|
const relationships = this.identifiers.get(identifier);
|
|
2998
2084
|
if (relationships) {
|
|
@@ -3023,12 +2109,6 @@ class Graph {
|
|
|
3023
2109
|
case 'replaceRelatedRecords':
|
|
3024
2110
|
/*#__NOINLINE__*/replaceRelatedRecords(this, op, isRemote);
|
|
3025
2111
|
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
2112
|
}
|
|
3033
2113
|
}
|
|
3034
2114
|
_scheduleLocalSync(relationship) {
|
|
@@ -3042,12 +2122,6 @@ class Graph {
|
|
|
3042
2122
|
if (!this._willSyncRemote) {
|
|
3043
2123
|
return;
|
|
3044
2124
|
}
|
|
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
2125
|
let transactionRef = peekTransient('transactionRef') ?? 0;
|
|
3052
2126
|
this._transaction = ++transactionRef;
|
|
3053
2127
|
setTransient('transactionRef', transactionRef);
|
|
@@ -3071,27 +2145,8 @@ class Graph {
|
|
|
3071
2145
|
flushPending(this, belongsTo);
|
|
3072
2146
|
}
|
|
3073
2147
|
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
2148
|
}
|
|
3083
2149
|
_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
2150
|
relationship.transactionRef = this._transaction;
|
|
3096
2151
|
}
|
|
3097
2152
|
_flushLocalQueue() {
|
|
@@ -3110,18 +2165,6 @@ class Graph {
|
|
|
3110
2165
|
}
|
|
3111
2166
|
destroy() {
|
|
3112
2167
|
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
2168
|
this.identifiers.clear();
|
|
3126
2169
|
this.store = null;
|
|
3127
2170
|
this.isDestroyed = true;
|
|
@@ -3187,11 +2230,6 @@ function notifyInverseOfDematerialization(graph, inverseIdentifier, inverseKey,
|
|
|
3187
2230
|
return;
|
|
3188
2231
|
}
|
|
3189
2232
|
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
2233
|
|
|
3196
2234
|
// For remote members, it is possible that inverseRecordData has already been associated to
|
|
3197
2235
|
// to another record. For such cases, do not dematerialize the inverseRecordData
|
|
@@ -3363,11 +2401,6 @@ function graphFor(store) {
|
|
|
3363
2401
|
graph = new Graph(wrapper);
|
|
3364
2402
|
Graphs.set(wrapper, graph);
|
|
3365
2403
|
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
2404
|
}
|
|
3372
2405
|
return graph;
|
|
3373
2406
|
}
|