@warp-drive/legacy 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/dist/unpkg/{prod-deprecated/-private-B1pSSN52.js → dev/-private-DbaSCSym.js} +65 -70
- package/dist/unpkg/dev/adapter/-private.js +1 -1
- package/dist/unpkg/dev/adapter/error.js +2 -3
- package/dist/unpkg/dev/adapter/json-api.js +144 -5
- package/dist/unpkg/dev/adapter/rest.js +15 -17
- package/dist/unpkg/dev/adapter.js +9 -10
- package/dist/unpkg/dev/compat/-private.js +1 -1
- package/dist/unpkg/dev/compat/builders.js +30 -28
- package/dist/unpkg/dev/compat/extensions.js +4 -5
- package/dist/unpkg/dev/compat/utils.js +2 -3
- package/dist/unpkg/dev/compat.js +226 -100
- package/dist/unpkg/{dev-deprecated/errors-CIGPcDvd.js → dev/errors-DD96TBEs.js} +78 -82
- package/dist/unpkg/{dev-deprecated/hooks-QqRnX108.js → dev/hooks-CqWjNWeL.js} +14 -15
- package/dist/unpkg/dev/index.js +23 -21
- package/dist/unpkg/dev/{json-BNrV8EYG.js → json-CCU-ZQ4b.js} +6 -9
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +6 -34
- package/dist/unpkg/dev/model.js +57 -46
- package/dist/unpkg/{dev-deprecated/schema-provider-g5MfTj8n.js → dev/schema-provider-B8jiJOYC.js} +113 -222
- package/dist/unpkg/{prod/serialize-into-hash-BnYvPex3.js → dev/serialize-into-hash-CPAZXrQU.js} +16 -18
- package/dist/unpkg/dev/serializer/json-api.js +140 -19
- package/dist/unpkg/dev/serializer/json.js +1 -3
- package/dist/unpkg/dev/serializer/rest.js +12 -13
- package/dist/unpkg/dev/store.js +55 -55
- package/dist/unpkg/dev/util-DvanW33H.js +20 -0
- package/dist/unpkg/dev/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/dev-deprecated/{-private-B1pSSN52.js → -private-DbaSCSym.js} +65 -70
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/adapter/error.js +2 -3
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +144 -5
- package/dist/unpkg/dev-deprecated/adapter/rest.js +15 -17
- package/dist/unpkg/dev-deprecated/adapter.js +9 -10
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/compat/builders.js +30 -28
- package/dist/unpkg/dev-deprecated/compat/extensions.js +4 -5
- package/dist/unpkg/dev-deprecated/compat/utils.js +2 -3
- package/dist/unpkg/dev-deprecated/compat.js +226 -100
- package/dist/unpkg/{dev/errors-CIGPcDvd.js → dev-deprecated/errors-DEnabIZj.js} +78 -79
- package/dist/unpkg/{prod-deprecated/hooks-QqRnX108.js → dev-deprecated/hooks-CAll-Ets.js} +14 -15
- package/dist/unpkg/dev-deprecated/index.js +22 -21
- package/dist/unpkg/{prod-deprecated/json-BNrV8EYG.js → dev-deprecated/json-CCU-ZQ4b.js} +6 -9
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +7 -18
- package/dist/unpkg/dev-deprecated/model.js +58 -43
- package/dist/unpkg/{prod-deprecated/schema-provider-g5MfTj8n.js → dev-deprecated/schema-provider-k2qXQTBg.js} +114 -198
- package/dist/unpkg/{prod-deprecated/serialize-into-hash-BnYvPex3.js → dev-deprecated/serialize-into-hash-CPAZXrQU.js} +16 -18
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +140 -19
- package/dist/unpkg/dev-deprecated/serializer/json.js +1 -3
- package/dist/unpkg/dev-deprecated/serializer/rest.js +12 -13
- package/dist/unpkg/dev-deprecated/store.js +55 -55
- package/dist/unpkg/{prod-deprecated/util-Dul6TZts.js → dev-deprecated/util-CWr5WQOT.js} +2 -13
- package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +12 -0
- package/dist/unpkg/prod/{-private-B1pSSN52.js → -private-Cvf_97EG.js} +6 -246
- package/dist/unpkg/prod/adapter/-private.js +1 -1
- package/dist/unpkg/prod/adapter/error.js +0 -6
- package/dist/unpkg/prod/adapter/json-api.js +142 -8
- package/dist/unpkg/prod/adapter/rest.js +1 -40
- package/dist/unpkg/prod/adapter.js +7 -41
- package/dist/unpkg/prod/compat/-private.js +1 -1
- package/dist/unpkg/prod/compat/builders.js +4 -67
- package/dist/unpkg/prod/compat/extensions.js +0 -11
- package/dist/unpkg/prod/compat/utils.js +0 -6
- package/dist/unpkg/prod/compat.js +13 -307
- package/dist/unpkg/prod/{errors-CIGPcDvd.js → errors-CXnfnBfQ.js} +4 -256
- package/dist/unpkg/prod/hooks-DvyWhLNg.js +41 -0
- package/dist/unpkg/prod/index.js +9 -53
- package/dist/unpkg/prod/{json-BNrV8EYG.js → json-BYrUP8ao.js} +0 -16
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +3 -38
- package/dist/unpkg/prod/model.js +31 -105
- package/dist/unpkg/{dev/schema-provider-g5MfTj8n.js → prod/schema-provider-CHujJvA9.js} +20 -454
- package/dist/unpkg/{dev-deprecated/serialize-into-hash-BnYvPex3.js → prod/serialize-into-hash-DYU2egXl.js} +1 -47
- package/dist/unpkg/prod/serializer/json-api.js +124 -60
- package/dist/unpkg/prod/serializer/json.js +1 -3
- package/dist/unpkg/prod/serializer/rest.js +2 -35
- package/dist/unpkg/prod/store.js +4 -136
- package/dist/unpkg/prod/util-DvanW33H.js +20 -0
- package/dist/unpkg/prod/utils-BhvS1iTS.js +8 -0
- package/dist/unpkg/{dev/-private-B1pSSN52.js → prod-deprecated/-private-Cvf_97EG.js} +6 -246
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/adapter/error.js +0 -6
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +142 -8
- package/dist/unpkg/prod-deprecated/adapter/rest.js +1 -40
- package/dist/unpkg/prod-deprecated/adapter.js +7 -41
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/compat/builders.js +4 -67
- package/dist/unpkg/prod-deprecated/compat/extensions.js +0 -11
- package/dist/unpkg/prod-deprecated/compat/utils.js +0 -6
- package/dist/unpkg/prod-deprecated/compat.js +13 -307
- package/dist/unpkg/prod-deprecated/{errors-CIGPcDvd.js → errors-CG1SPYVg.js} +4 -253
- package/dist/unpkg/prod-deprecated/hooks-BIUBiNGR.js +41 -0
- package/dist/unpkg/prod-deprecated/index.js +8 -53
- package/dist/unpkg/{dev-deprecated/json-BNrV8EYG.js → prod-deprecated/json-BYrUP8ao.js} +0 -16
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +4 -22
- package/dist/unpkg/prod-deprecated/model.js +31 -102
- package/dist/unpkg/{prod/schema-provider-g5MfTj8n.js → prod-deprecated/schema-provider-BJ4TWnZf.js} +21 -412
- package/dist/unpkg/{dev/serialize-into-hash-BnYvPex3.js → prod-deprecated/serialize-into-hash-DYU2egXl.js} +1 -47
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +124 -60
- package/dist/unpkg/prod-deprecated/serializer/json.js +1 -3
- package/dist/unpkg/prod-deprecated/serializer/rest.js +2 -35
- package/dist/unpkg/prod-deprecated/store.js +4 -136
- package/dist/unpkg/{dev/util-Dul6TZts.js → prod-deprecated/util-B6cn-i93.js} +1 -13
- package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +11 -0
- package/package.json +14 -22
- package/dist/unpkg/dev/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
- package/dist/unpkg/dev/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
- package/dist/unpkg/dev/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
- package/dist/unpkg/dev/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
- package/dist/unpkg/dev/declarations/adapter/-private/utils/fetch.d.ts +0 -8
- package/dist/unpkg/dev/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/dist/unpkg/dev/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
- package/dist/unpkg/dev/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
- package/dist/unpkg/dev/declarations/adapter/-private.d.ts +0 -5
- package/dist/unpkg/dev/declarations/adapter/error.d.ts +0 -215
- package/dist/unpkg/dev/declarations/adapter/json-api.d.ts +0 -231
- package/dist/unpkg/dev/declarations/adapter/rest.d.ts +0 -815
- package/dist/unpkg/dev/declarations/adapter.d.ts +0 -770
- package/dist/unpkg/dev/declarations/compat/-private.d.ts +0 -13
- package/dist/unpkg/dev/declarations/compat/builders/find-all.d.ts +0 -35
- package/dist/unpkg/dev/declarations/compat/builders/find-record.d.ts +0 -56
- package/dist/unpkg/dev/declarations/compat/builders/query.d.ts +0 -66
- package/dist/unpkg/dev/declarations/compat/builders/save-record.d.ts +0 -34
- package/dist/unpkg/dev/declarations/compat/builders/utils.d.ts +0 -3
- package/dist/unpkg/dev/declarations/compat/builders.d.ts +0 -14
- package/dist/unpkg/dev/declarations/compat/extensions.d.ts +0 -59
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
- package/dist/unpkg/dev/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
- package/dist/unpkg/dev/declarations/compat/utils.d.ts +0 -137
- package/dist/unpkg/dev/declarations/compat.d.ts +0 -157
- package/dist/unpkg/dev/declarations/index.d.ts +0 -70
- package/dist/unpkg/dev/declarations/model/-private/attr.d.ts +0 -170
- package/dist/unpkg/dev/declarations/model/-private/belongs-to.d.ts +0 -174
- package/dist/unpkg/dev/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
- package/dist/unpkg/dev/declarations/model/-private/errors.d.ts +0 -289
- package/dist/unpkg/dev/declarations/model/-private/has-many.d.ts +0 -162
- package/dist/unpkg/dev/declarations/model/-private/hooks.d.ts +0 -10
- package/dist/unpkg/dev/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
- package/dist/unpkg/dev/declarations/model/-private/model-for-mixin.d.ts +0 -3
- package/dist/unpkg/dev/declarations/model/-private/model-methods.d.ts +0 -39
- package/dist/unpkg/dev/declarations/model/-private/model.d.ts +0 -1269
- package/dist/unpkg/dev/declarations/model/-private/notify-changes.d.ts +0 -4
- package/dist/unpkg/dev/declarations/model/-private/promise-belongs-to.d.ts +0 -40
- package/dist/unpkg/dev/declarations/model/-private/promise-many-array.d.ts +0 -124
- package/dist/unpkg/dev/declarations/model/-private/record-state.d.ts +0 -58
- package/dist/unpkg/dev/declarations/model/-private/references/belongs-to.d.ts +0 -498
- package/dist/unpkg/dev/declarations/model/-private/references/has-many.d.ts +0 -500
- package/dist/unpkg/dev/declarations/model/-private/schema-provider.d.ts +0 -56
- package/dist/unpkg/dev/declarations/model/-private/type-utils.d.ts +0 -57
- package/dist/unpkg/dev/declarations/model/-private/util.d.ts +0 -5
- package/dist/unpkg/dev/declarations/model/-private.d.ts +0 -8
- package/dist/unpkg/dev/declarations/model/migration-support.d.ts +0 -280
- package/dist/unpkg/dev/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
- package/dist/unpkg/dev/declarations/model-fragments/extensions/fragment.d.ts +0 -15
- package/dist/unpkg/dev/declarations/model-fragments/hooks/model-for.d.ts +0 -20
- package/dist/unpkg/dev/declarations/model-fragments/index.d.ts +0 -5
- package/dist/unpkg/dev/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
- package/dist/unpkg/dev/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
- package/dist/unpkg/dev/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
- package/dist/unpkg/dev/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
- package/dist/unpkg/dev/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
- package/dist/unpkg/dev/declarations/model-fragments.d.ts +0 -9
- package/dist/unpkg/dev/declarations/model.d.ts +0 -49
- package/dist/unpkg/dev/declarations/serializer/-private/embedded-records-mixin.d.ts +0 -91
- package/dist/unpkg/dev/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
- package/dist/unpkg/dev/declarations/serializer/-private/transforms/date.d.ts +0 -28
- package/dist/unpkg/dev/declarations/serializer/-private/transforms/number.d.ts +0 -29
- package/dist/unpkg/dev/declarations/serializer/-private/transforms/string.d.ts +0 -29
- package/dist/unpkg/dev/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/dist/unpkg/dev/declarations/serializer/-private/utils.d.ts +0 -3
- package/dist/unpkg/dev/declarations/serializer/json-api.d.ts +0 -123
- package/dist/unpkg/dev/declarations/serializer/json.d.ts +0 -75
- package/dist/unpkg/dev/declarations/serializer/rest.d.ts +0 -51
- package/dist/unpkg/dev/declarations/serializer/transform.d.ts +0 -5
- package/dist/unpkg/dev/declarations/serializer.d.ts +0 -254
- package/dist/unpkg/dev/declarations/store/-private.d.ts +0 -223
- package/dist/unpkg/dev/declarations/store.d.ts +0 -3
- package/dist/unpkg/dev/hooks-QqRnX108.js +0 -74
- package/dist/unpkg/dev/utils-Cqw9eRj5.js +0 -23
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/fetch.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/adapter/-private.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/adapter/error.d.ts +0 -215
- package/dist/unpkg/dev-deprecated/declarations/adapter/json-api.d.ts +0 -231
- package/dist/unpkg/dev-deprecated/declarations/adapter/rest.d.ts +0 -815
- package/dist/unpkg/dev-deprecated/declarations/adapter.d.ts +0 -770
- package/dist/unpkg/dev-deprecated/declarations/compat/-private.d.ts +0 -13
- package/dist/unpkg/dev-deprecated/declarations/compat/builders/find-all.d.ts +0 -35
- package/dist/unpkg/dev-deprecated/declarations/compat/builders/find-record.d.ts +0 -56
- package/dist/unpkg/dev-deprecated/declarations/compat/builders/query.d.ts +0 -66
- package/dist/unpkg/dev-deprecated/declarations/compat/builders/save-record.d.ts +0 -34
- package/dist/unpkg/dev-deprecated/declarations/compat/builders/utils.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/compat/builders.d.ts +0 -14
- package/dist/unpkg/dev-deprecated/declarations/compat/extensions.d.ts +0 -59
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
- package/dist/unpkg/dev-deprecated/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
- package/dist/unpkg/dev-deprecated/declarations/compat/utils.d.ts +0 -137
- package/dist/unpkg/dev-deprecated/declarations/compat.d.ts +0 -157
- package/dist/unpkg/dev-deprecated/declarations/index.d.ts +0 -70
- package/dist/unpkg/dev-deprecated/declarations/model/-private/attr.d.ts +0 -170
- package/dist/unpkg/dev-deprecated/declarations/model/-private/belongs-to.d.ts +0 -174
- package/dist/unpkg/dev-deprecated/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/model/-private/errors.d.ts +0 -289
- package/dist/unpkg/dev-deprecated/declarations/model/-private/has-many.d.ts +0 -162
- package/dist/unpkg/dev-deprecated/declarations/model/-private/hooks.d.ts +0 -10
- package/dist/unpkg/dev-deprecated/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
- package/dist/unpkg/dev-deprecated/declarations/model/-private/model-for-mixin.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/model/-private/model-methods.d.ts +0 -39
- package/dist/unpkg/dev-deprecated/declarations/model/-private/model.d.ts +0 -1269
- package/dist/unpkg/dev-deprecated/declarations/model/-private/notify-changes.d.ts +0 -4
- package/dist/unpkg/dev-deprecated/declarations/model/-private/promise-belongs-to.d.ts +0 -40
- package/dist/unpkg/dev-deprecated/declarations/model/-private/promise-many-array.d.ts +0 -124
- package/dist/unpkg/dev-deprecated/declarations/model/-private/record-state.d.ts +0 -58
- package/dist/unpkg/dev-deprecated/declarations/model/-private/references/belongs-to.d.ts +0 -498
- package/dist/unpkg/dev-deprecated/declarations/model/-private/references/has-many.d.ts +0 -500
- package/dist/unpkg/dev-deprecated/declarations/model/-private/schema-provider.d.ts +0 -56
- package/dist/unpkg/dev-deprecated/declarations/model/-private/type-utils.d.ts +0 -57
- package/dist/unpkg/dev-deprecated/declarations/model/-private/util.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/model/-private.d.ts +0 -8
- package/dist/unpkg/dev-deprecated/declarations/model/migration-support.d.ts +0 -280
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/extensions/fragment.d.ts +0 -15
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/hooks/model-for.d.ts +0 -20
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/index.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
- package/dist/unpkg/dev-deprecated/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/model-fragments.d.ts +0 -9
- package/dist/unpkg/dev-deprecated/declarations/model.d.ts +0 -49
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/embedded-records-mixin.d.ts +0 -91
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/transforms/date.d.ts +0 -28
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/transforms/number.d.ts +0 -29
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/transforms/string.d.ts +0 -29
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/dist/unpkg/dev-deprecated/declarations/serializer/-private/utils.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/declarations/serializer/json-api.d.ts +0 -123
- package/dist/unpkg/dev-deprecated/declarations/serializer/json.d.ts +0 -75
- package/dist/unpkg/dev-deprecated/declarations/serializer/rest.d.ts +0 -51
- package/dist/unpkg/dev-deprecated/declarations/serializer/transform.d.ts +0 -5
- package/dist/unpkg/dev-deprecated/declarations/serializer.d.ts +0 -254
- package/dist/unpkg/dev-deprecated/declarations/store/-private.d.ts +0 -223
- package/dist/unpkg/dev-deprecated/declarations/store.d.ts +0 -3
- package/dist/unpkg/dev-deprecated/util-Dul6TZts.js +0 -35
- package/dist/unpkg/dev-deprecated/utils-Cqw9eRj5.js +0 -23
- package/dist/unpkg/prod/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
- package/dist/unpkg/prod/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
- package/dist/unpkg/prod/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
- package/dist/unpkg/prod/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
- package/dist/unpkg/prod/declarations/adapter/-private/utils/fetch.d.ts +0 -8
- package/dist/unpkg/prod/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/dist/unpkg/prod/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
- package/dist/unpkg/prod/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
- package/dist/unpkg/prod/declarations/adapter/-private.d.ts +0 -5
- package/dist/unpkg/prod/declarations/adapter/error.d.ts +0 -215
- package/dist/unpkg/prod/declarations/adapter/json-api.d.ts +0 -231
- package/dist/unpkg/prod/declarations/adapter/rest.d.ts +0 -815
- package/dist/unpkg/prod/declarations/adapter.d.ts +0 -770
- package/dist/unpkg/prod/declarations/compat/-private.d.ts +0 -13
- package/dist/unpkg/prod/declarations/compat/builders/find-all.d.ts +0 -35
- package/dist/unpkg/prod/declarations/compat/builders/find-record.d.ts +0 -56
- package/dist/unpkg/prod/declarations/compat/builders/query.d.ts +0 -66
- package/dist/unpkg/prod/declarations/compat/builders/save-record.d.ts +0 -34
- package/dist/unpkg/prod/declarations/compat/builders/utils.d.ts +0 -3
- package/dist/unpkg/prod/declarations/compat/builders.d.ts +0 -14
- package/dist/unpkg/prod/declarations/compat/extensions.d.ts +0 -59
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
- package/dist/unpkg/prod/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
- package/dist/unpkg/prod/declarations/compat/utils.d.ts +0 -137
- package/dist/unpkg/prod/declarations/compat.d.ts +0 -157
- package/dist/unpkg/prod/declarations/index.d.ts +0 -70
- package/dist/unpkg/prod/declarations/model/-private/attr.d.ts +0 -170
- package/dist/unpkg/prod/declarations/model/-private/belongs-to.d.ts +0 -174
- package/dist/unpkg/prod/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
- package/dist/unpkg/prod/declarations/model/-private/errors.d.ts +0 -289
- package/dist/unpkg/prod/declarations/model/-private/has-many.d.ts +0 -162
- package/dist/unpkg/prod/declarations/model/-private/hooks.d.ts +0 -10
- package/dist/unpkg/prod/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
- package/dist/unpkg/prod/declarations/model/-private/model-for-mixin.d.ts +0 -3
- package/dist/unpkg/prod/declarations/model/-private/model-methods.d.ts +0 -39
- package/dist/unpkg/prod/declarations/model/-private/model.d.ts +0 -1269
- package/dist/unpkg/prod/declarations/model/-private/notify-changes.d.ts +0 -4
- package/dist/unpkg/prod/declarations/model/-private/promise-belongs-to.d.ts +0 -40
- package/dist/unpkg/prod/declarations/model/-private/promise-many-array.d.ts +0 -124
- package/dist/unpkg/prod/declarations/model/-private/record-state.d.ts +0 -58
- package/dist/unpkg/prod/declarations/model/-private/references/belongs-to.d.ts +0 -498
- package/dist/unpkg/prod/declarations/model/-private/references/has-many.d.ts +0 -500
- package/dist/unpkg/prod/declarations/model/-private/schema-provider.d.ts +0 -56
- package/dist/unpkg/prod/declarations/model/-private/type-utils.d.ts +0 -57
- package/dist/unpkg/prod/declarations/model/-private/util.d.ts +0 -5
- package/dist/unpkg/prod/declarations/model/-private.d.ts +0 -8
- package/dist/unpkg/prod/declarations/model/migration-support.d.ts +0 -280
- package/dist/unpkg/prod/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
- package/dist/unpkg/prod/declarations/model-fragments/extensions/fragment.d.ts +0 -15
- package/dist/unpkg/prod/declarations/model-fragments/hooks/model-for.d.ts +0 -20
- package/dist/unpkg/prod/declarations/model-fragments/index.d.ts +0 -5
- package/dist/unpkg/prod/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
- package/dist/unpkg/prod/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
- package/dist/unpkg/prod/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
- package/dist/unpkg/prod/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
- package/dist/unpkg/prod/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
- package/dist/unpkg/prod/declarations/model-fragments.d.ts +0 -9
- package/dist/unpkg/prod/declarations/model.d.ts +0 -49
- package/dist/unpkg/prod/declarations/serializer/-private/embedded-records-mixin.d.ts +0 -91
- package/dist/unpkg/prod/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
- package/dist/unpkg/prod/declarations/serializer/-private/transforms/date.d.ts +0 -28
- package/dist/unpkg/prod/declarations/serializer/-private/transforms/number.d.ts +0 -29
- package/dist/unpkg/prod/declarations/serializer/-private/transforms/string.d.ts +0 -29
- package/dist/unpkg/prod/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/dist/unpkg/prod/declarations/serializer/-private/utils.d.ts +0 -3
- package/dist/unpkg/prod/declarations/serializer/json-api.d.ts +0 -123
- package/dist/unpkg/prod/declarations/serializer/json.d.ts +0 -75
- package/dist/unpkg/prod/declarations/serializer/rest.d.ts +0 -51
- package/dist/unpkg/prod/declarations/serializer/transform.d.ts +0 -5
- package/dist/unpkg/prod/declarations/serializer.d.ts +0 -254
- package/dist/unpkg/prod/declarations/store/-private.d.ts +0 -223
- package/dist/unpkg/prod/declarations/store.d.ts +0 -3
- package/dist/unpkg/prod/hooks-QqRnX108.js +0 -74
- package/dist/unpkg/prod/util-Dul6TZts.js +0 -35
- package/dist/unpkg/prod/utils-Cqw9eRj5.js +0 -23
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/fetch.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/adapter/-private.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/adapter/error.d.ts +0 -215
- package/dist/unpkg/prod-deprecated/declarations/adapter/json-api.d.ts +0 -231
- package/dist/unpkg/prod-deprecated/declarations/adapter/rest.d.ts +0 -815
- package/dist/unpkg/prod-deprecated/declarations/adapter.d.ts +0 -770
- package/dist/unpkg/prod-deprecated/declarations/compat/-private.d.ts +0 -13
- package/dist/unpkg/prod-deprecated/declarations/compat/builders/find-all.d.ts +0 -35
- package/dist/unpkg/prod-deprecated/declarations/compat/builders/find-record.d.ts +0 -56
- package/dist/unpkg/prod-deprecated/declarations/compat/builders/query.d.ts +0 -66
- package/dist/unpkg/prod-deprecated/declarations/compat/builders/save-record.d.ts +0 -34
- package/dist/unpkg/prod-deprecated/declarations/compat/builders/utils.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/compat/builders.d.ts +0 -14
- package/dist/unpkg/prod-deprecated/declarations/compat/extensions.d.ts +0 -59
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
- package/dist/unpkg/prod-deprecated/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
- package/dist/unpkg/prod-deprecated/declarations/compat/utils.d.ts +0 -137
- package/dist/unpkg/prod-deprecated/declarations/compat.d.ts +0 -157
- package/dist/unpkg/prod-deprecated/declarations/index.d.ts +0 -70
- package/dist/unpkg/prod-deprecated/declarations/model/-private/attr.d.ts +0 -170
- package/dist/unpkg/prod-deprecated/declarations/model/-private/belongs-to.d.ts +0 -174
- package/dist/unpkg/prod-deprecated/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/model/-private/errors.d.ts +0 -289
- package/dist/unpkg/prod-deprecated/declarations/model/-private/has-many.d.ts +0 -162
- package/dist/unpkg/prod-deprecated/declarations/model/-private/hooks.d.ts +0 -10
- package/dist/unpkg/prod-deprecated/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
- package/dist/unpkg/prod-deprecated/declarations/model/-private/model-for-mixin.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/model/-private/model-methods.d.ts +0 -39
- package/dist/unpkg/prod-deprecated/declarations/model/-private/model.d.ts +0 -1269
- package/dist/unpkg/prod-deprecated/declarations/model/-private/notify-changes.d.ts +0 -4
- package/dist/unpkg/prod-deprecated/declarations/model/-private/promise-belongs-to.d.ts +0 -40
- package/dist/unpkg/prod-deprecated/declarations/model/-private/promise-many-array.d.ts +0 -124
- package/dist/unpkg/prod-deprecated/declarations/model/-private/record-state.d.ts +0 -58
- package/dist/unpkg/prod-deprecated/declarations/model/-private/references/belongs-to.d.ts +0 -498
- package/dist/unpkg/prod-deprecated/declarations/model/-private/references/has-many.d.ts +0 -500
- package/dist/unpkg/prod-deprecated/declarations/model/-private/schema-provider.d.ts +0 -56
- package/dist/unpkg/prod-deprecated/declarations/model/-private/type-utils.d.ts +0 -57
- package/dist/unpkg/prod-deprecated/declarations/model/-private/util.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/model/-private.d.ts +0 -8
- package/dist/unpkg/prod-deprecated/declarations/model/migration-support.d.ts +0 -280
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/extensions/fragment.d.ts +0 -15
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/hooks/model-for.d.ts +0 -20
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/index.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
- package/dist/unpkg/prod-deprecated/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/model-fragments.d.ts +0 -9
- package/dist/unpkg/prod-deprecated/declarations/model.d.ts +0 -49
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/embedded-records-mixin.d.ts +0 -91
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/transforms/date.d.ts +0 -28
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/transforms/number.d.ts +0 -29
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/transforms/string.d.ts +0 -29
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/dist/unpkg/prod-deprecated/declarations/serializer/-private/utils.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/declarations/serializer/json-api.d.ts +0 -123
- package/dist/unpkg/prod-deprecated/declarations/serializer/json.d.ts +0 -75
- package/dist/unpkg/prod-deprecated/declarations/serializer/rest.d.ts +0 -51
- package/dist/unpkg/prod-deprecated/declarations/serializer/transform.d.ts +0 -5
- package/dist/unpkg/prod-deprecated/declarations/serializer.d.ts +0 -254
- package/dist/unpkg/prod-deprecated/declarations/store/-private.d.ts +0 -223
- package/dist/unpkg/prod-deprecated/declarations/store.d.ts +0 -3
- package/dist/unpkg/prod-deprecated/utils-Cqw9eRj5.js +0 -23
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
import { getOwner } from '@ember/application';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
|
-
import { assertPrivateStore,
|
|
3
|
+
import { assertPrivateStore, _deprecatingNormalize } from '@warp-drive/core/store/-private';
|
|
4
4
|
import '@warp-drive/core/reactive/-private';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { n as normalizeResponseHelper, F as FetchManager, S as SaveOp, a as SnapshotRecordArray } from "./-private-Cvf_97EG.js";
|
|
6
|
+
function iterateData(data, fn) {
|
|
7
|
+
if (Array.isArray(data)) {
|
|
8
|
+
return data.map(fn);
|
|
9
|
+
} else {
|
|
10
|
+
return fn(data, 0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
7
13
|
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
8
14
|
const promise = Promise.resolve().then(() => {
|
|
9
15
|
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
10
16
|
const useLink = !link || typeof link === 'string';
|
|
11
17
|
const relatedLink = useLink ? link : link.href;
|
|
12
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
13
|
-
if (!test) {
|
|
14
|
-
throw new Error(`Attempted to load a hasMany relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findHasMany'`);
|
|
15
|
-
}
|
|
16
|
-
})(relatedLink) : {};
|
|
17
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
18
|
-
if (!test) {
|
|
19
|
-
throw new Error(`Expected the adapter to implement 'findHasMany' but it does not`);
|
|
20
|
-
}
|
|
21
|
-
})(typeof adapter.findHasMany === 'function') : {};
|
|
22
18
|
return adapter.findHasMany(store, snapshot, relatedLink, relationship);
|
|
23
19
|
});
|
|
24
20
|
return promise.then(adapterPayload => {
|
|
25
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
26
|
-
if (!test) {
|
|
27
|
-
throw new Error(`You made a 'findHasMany' request for a ${identifier.type}'s '${relationship.name}' relationship, using link '${JSON.stringify(link)}' , but the adapter's response did not have any data`);
|
|
28
|
-
}
|
|
29
|
-
})(payloadIsNotBlank(adapterPayload)) : {};
|
|
30
21
|
const modelClass = store.modelFor(relationship.type);
|
|
31
22
|
const serializer = store.serializerFor(relationship.type);
|
|
32
23
|
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findHasMany');
|
|
33
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
34
|
-
if (!test) {
|
|
35
|
-
throw new Error(`fetched the hasMany relationship '${relationship.name}' for ${identifier.type}:${identifier.id} with link '${JSON.stringify(link)}', but no data member is present in the response. If no data exists, the response should set { data: [] }`);
|
|
36
|
-
}
|
|
37
|
-
})('data' in payload && Array.isArray(payload.data)) : {};
|
|
38
24
|
payload = syncRelationshipDataFromLink(store, payload, identifier, relationship);
|
|
39
25
|
return store._push(payload, true);
|
|
40
26
|
}, null);
|
|
@@ -42,35 +28,15 @@ function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
|
42
28
|
function _findBelongsTo(store, identifier, link, relationship, options) {
|
|
43
29
|
const promise = Promise.resolve().then(() => {
|
|
44
30
|
const adapter = store.adapterFor(identifier.type);
|
|
45
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
46
|
-
if (!test) {
|
|
47
|
-
throw new Error(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`);
|
|
48
|
-
}
|
|
49
|
-
})(adapter) : {};
|
|
50
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
51
|
-
if (!test) {
|
|
52
|
-
throw new Error(`You tried to load a belongsTo relationship from a specified 'link' in the original payload but your adapter does not implement 'findBelongsTo'`);
|
|
53
|
-
}
|
|
54
|
-
})(typeof adapter.findBelongsTo === 'function') : {};
|
|
55
31
|
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
56
32
|
const useLink = !link || typeof link === 'string';
|
|
57
33
|
const relatedLink = useLink ? link : link.href;
|
|
58
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
59
|
-
if (!test) {
|
|
60
|
-
throw new Error(`Attempted to load a belongsTo relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findBelongsTo'`);
|
|
61
|
-
}
|
|
62
|
-
})(relatedLink) : {};
|
|
63
34
|
return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);
|
|
64
35
|
});
|
|
65
36
|
return promise.then(adapterPayload => {
|
|
66
37
|
const modelClass = store.modelFor(relationship.type);
|
|
67
38
|
const serializer = store.serializerFor(relationship.type);
|
|
68
39
|
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findBelongsTo');
|
|
69
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
70
|
-
if (!test) {
|
|
71
|
-
throw new Error(`fetched the belongsTo relationship '${relationship.name}' for ${identifier.type}:${identifier.id} with link '${JSON.stringify(link)}', but no data member is present in the response. If no data exists, the response should set { data: null }`);
|
|
72
|
-
}
|
|
73
|
-
})('data' in payload && (payload.data === null || typeof payload.data === 'object' && !Array.isArray(payload.data))) : {};
|
|
74
40
|
if (!payload.data && !payload.links && !payload.meta) {
|
|
75
41
|
return null;
|
|
76
42
|
}
|
|
@@ -93,7 +59,7 @@ function syncRelationshipDataFromLink(store, payload, parentIdentifier, relation
|
|
|
93
59
|
id,
|
|
94
60
|
type
|
|
95
61
|
} = data;
|
|
96
|
-
ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship
|
|
62
|
+
ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship);
|
|
97
63
|
return {
|
|
98
64
|
id,
|
|
99
65
|
type
|
|
@@ -143,33 +109,6 @@ function ensureRelationshipIsSetToParent(payload, parentIdentifier, store, paren
|
|
|
143
109
|
kind
|
|
144
110
|
} = inverse;
|
|
145
111
|
const relationshipData = relationships[inverseKey]?.data;
|
|
146
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
147
|
-
if (typeof relationshipData !== 'undefined' && !relationshipDataPointsToParent(relationshipData, parentIdentifier)) {
|
|
148
|
-
const inspect = function inspect(thing) {
|
|
149
|
-
return `'${JSON.stringify(thing)}'`;
|
|
150
|
-
};
|
|
151
|
-
const quotedType = inspect(type);
|
|
152
|
-
const quotedInverse = inspect(inverseKey);
|
|
153
|
-
const expected = inspect({
|
|
154
|
-
id: parentIdentifier.id,
|
|
155
|
-
type: parentIdentifier.type
|
|
156
|
-
});
|
|
157
|
-
const expectedModel = `${parentIdentifier.type}:${parentIdentifier.id}`;
|
|
158
|
-
const got = inspect(relationshipData);
|
|
159
|
-
const prefix = typeof index === 'number' ? `data[${index}]` : `data`;
|
|
160
|
-
const path = `${prefix}.relationships.${inverseKey}.data`;
|
|
161
|
-
const data = Array.isArray(relationshipData) ? relationshipData[0] : relationshipData;
|
|
162
|
-
const other = data ? `<${data.type}:${data.id}>` : null;
|
|
163
|
-
const relationshipFetched = `${expectedModel}.${parentRelationship.kind}("${parentRelationship.name}")`;
|
|
164
|
-
const includedRecord = `<${type}:${id}>`;
|
|
165
|
-
const message = [`Encountered mismatched relationship: Ember Data expected ${path} in the payload from ${relationshipFetched} to include ${expected} but got ${got} instead.\n`, `The ${includedRecord} record loaded at ${prefix} in the payload specified ${other} as its ${quotedInverse}, but should have specified ${expectedModel} (the record the relationship is being loaded from) as its ${quotedInverse} instead.`, `This could mean that the response for ${relationshipFetched} may have accidentally returned ${quotedType} records that aren't related to ${expectedModel} and could be related to a different ${parentIdentifier.type} record instead.`, `Ember Data has corrected the ${includedRecord} record's ${quotedInverse} relationship to ${expectedModel} so that ${relationshipFetched} will include ${includedRecord}.`, `Please update the response from the server or change your serializer to either ensure that the response for only includes ${quotedType} records that specify ${expectedModel} as their ${quotedInverse}, or omit the ${quotedInverse} relationship from the response.`].join('\n');
|
|
166
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
167
|
-
{
|
|
168
|
-
throw new Error(message);
|
|
169
|
-
}
|
|
170
|
-
})() : {};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
112
|
if (kind !== 'hasMany' || typeof relationshipData !== 'undefined') {
|
|
174
113
|
relationships[inverseKey] = relationships[inverseKey] || {};
|
|
175
114
|
relationships[inverseKey].data = fixRelationshipData(relationshipData ?? null, kind, parentIdentifier);
|
|
@@ -181,16 +120,6 @@ function inverseForRelationship(store, identifier, key) {
|
|
|
181
120
|
if (!definition) {
|
|
182
121
|
return null;
|
|
183
122
|
}
|
|
184
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
185
|
-
if (!test) {
|
|
186
|
-
throw new Error(`Expected the field definition to be a relationship`);
|
|
187
|
-
}
|
|
188
|
-
})(definition.kind === 'hasMany' || definition.kind === 'belongsTo') : {};
|
|
189
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
190
|
-
if (!test) {
|
|
191
|
-
throw new Error(`Expected the relationship defintion to specify the inverse type or null.`);
|
|
192
|
-
}
|
|
193
|
-
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0) : {};
|
|
194
123
|
return definition.options.inverse;
|
|
195
124
|
}
|
|
196
125
|
function getInverse(store, parentIdentifier, parentRelationship, type) {
|
|
@@ -207,36 +136,12 @@ function getInverse(store, parentIdentifier, parentRelationship, type) {
|
|
|
207
136
|
const definition = store.schema.fields({
|
|
208
137
|
type
|
|
209
138
|
}).get(inverseKey);
|
|
210
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
211
|
-
if (!test) {
|
|
212
|
-
throw new Error(`Expected the field definition to be a relationship`);
|
|
213
|
-
}
|
|
214
|
-
})(definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo')) : {};
|
|
215
139
|
return {
|
|
216
140
|
inverseKey,
|
|
217
141
|
kind: definition.kind
|
|
218
142
|
};
|
|
219
143
|
}
|
|
220
144
|
}
|
|
221
|
-
function relationshipDataPointsToParent(relationshipData, identifier) {
|
|
222
|
-
if (relationshipData === null) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
if (Array.isArray(relationshipData)) {
|
|
226
|
-
if (relationshipData.length === 0) {
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
for (let i = 0; i < relationshipData.length; i++) {
|
|
230
|
-
const entry = relationshipData[i];
|
|
231
|
-
if (validateRelationshipEntry(entry, identifier)) {
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
return validateRelationshipEntry(relationshipData, identifier);
|
|
237
|
-
}
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
145
|
function fixRelationshipData(relationshipData, relationshipKind, {
|
|
241
146
|
id,
|
|
242
147
|
type
|
|
@@ -249,11 +154,6 @@ function fixRelationshipData(relationshipData, relationshipKind, {
|
|
|
249
154
|
if (relationshipKind === 'hasMany') {
|
|
250
155
|
const relData = relationshipData || [];
|
|
251
156
|
if (relationshipData) {
|
|
252
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
253
|
-
if (!test) {
|
|
254
|
-
throw new Error('expected the relationship data to be an array');
|
|
255
|
-
}
|
|
256
|
-
})(Array.isArray(relationshipData)) : {};
|
|
257
157
|
// these arrays could be massive so this is better than filter
|
|
258
158
|
// Note: this is potentially problematic if type/id are not in the
|
|
259
159
|
// same state of normalization.
|
|
@@ -274,13 +174,6 @@ function fixRelationshipData(relationshipData, relationshipKind, {
|
|
|
274
174
|
}
|
|
275
175
|
return payload;
|
|
276
176
|
}
|
|
277
|
-
function validateRelationshipEntry({
|
|
278
|
-
id
|
|
279
|
-
}, {
|
|
280
|
-
id: parentModelID
|
|
281
|
-
}) {
|
|
282
|
-
return !!id && id.toString() === parentModelID;
|
|
283
|
-
}
|
|
284
177
|
const PotentialLegacyOperations = new Set(['findRecord', 'findAll', 'query', 'queryRecord', 'findBelongsTo', 'findHasMany', 'updateRecord', 'createRecord', 'deleteRecord']);
|
|
285
178
|
const LegacyNetworkHandler = {
|
|
286
179
|
request(context, next) {
|
|
@@ -339,20 +232,9 @@ function findBelongsTo(context) {
|
|
|
339
232
|
return pendingRequest;
|
|
340
233
|
}
|
|
341
234
|
if (useLink) {
|
|
342
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
343
|
-
if (!test) {
|
|
344
|
-
throw new Error(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`);
|
|
345
|
-
}
|
|
346
|
-
})(links && links.related) : {};
|
|
347
235
|
return _findBelongsTo(store, record, links.related, field, options);
|
|
348
236
|
}
|
|
349
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
350
|
-
if (!test) {
|
|
351
|
-
throw new Error(`Expected an identifier`);
|
|
352
|
-
}
|
|
353
|
-
})(Array.isArray(identifiers) && identifiers.length === 1) : {};
|
|
354
237
|
const manager = store._fetchManager;
|
|
355
|
-
assertIdentifierHasId(identifier);
|
|
356
238
|
return options.reload ? manager.scheduleFetch(identifier, options, context.request) : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
357
239
|
}
|
|
358
240
|
function findHasMany(context) {
|
|
@@ -372,45 +254,12 @@ function findHasMany(context) {
|
|
|
372
254
|
// link case
|
|
373
255
|
if (useLink) {
|
|
374
256
|
const adapter = store.adapterFor(record.type);
|
|
375
|
-
/*
|
|
376
|
-
If a relationship was originally populated by the adapter as a link
|
|
377
|
-
(as opposed to a list of IDs), this method is called when the
|
|
378
|
-
relationship is fetched.
|
|
379
|
-
The link (which is usually a URL) is passed through unchanged, so the
|
|
380
|
-
adapter can make whatever request it wants.
|
|
381
|
-
The usual use-case is for the server to register a URL as a link, and
|
|
382
|
-
then use that URL in the future to make a request for the relationship.
|
|
383
|
-
*/
|
|
384
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
385
|
-
if (!test) {
|
|
386
|
-
throw new Error(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`);
|
|
387
|
-
}
|
|
388
|
-
})(adapter) : {};
|
|
389
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
390
|
-
if (!test) {
|
|
391
|
-
throw new Error(`You tried to load a hasMany relationship from a specified 'link' in the original payload but your adapter does not implement 'findHasMany'`);
|
|
392
|
-
}
|
|
393
|
-
})(typeof adapter.findHasMany === 'function') : {};
|
|
394
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
395
|
-
if (!test) {
|
|
396
|
-
throw new Error(`Expected a related link when calling store.findHasMany, found ${String(links)}`);
|
|
397
|
-
}
|
|
398
|
-
})(links && links.related) : {};
|
|
399
257
|
return _findHasMany(adapter, store, record, links.related, field, options);
|
|
400
258
|
}
|
|
401
|
-
|
|
402
|
-
// identifiers case
|
|
403
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
404
|
-
if (!test) {
|
|
405
|
-
throw new Error(`Expected an array of identifiers to fetch`);
|
|
406
|
-
}
|
|
407
|
-
})(Array.isArray(identifiers)) : {};
|
|
408
259
|
const fetches = new Array(identifiers.length);
|
|
409
260
|
const manager = store._fetchManager;
|
|
410
261
|
for (let i = 0; i < identifiers.length; i++) {
|
|
411
262
|
const identifier = identifiers[i];
|
|
412
|
-
// TODO we probably can be lenient here and return from cache for the isNew case
|
|
413
|
-
assertIdentifierHasId(identifier);
|
|
414
263
|
fetches[i] = options.reload ? manager.scheduleFetch(identifier, options, context.request) : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
415
264
|
}
|
|
416
265
|
return Promise.all(fetches);
|
|
@@ -474,11 +323,6 @@ function adapterDidInvalidate(store, identifier, error) {
|
|
|
474
323
|
}
|
|
475
324
|
const cache = store.cache;
|
|
476
325
|
if (error.errors) {
|
|
477
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
478
|
-
if (!test) {
|
|
479
|
-
throw new Error(`Expected the cache in use by resource ${String(identifier)} to have a getErrors(identifier) method for retrieving errors.`);
|
|
480
|
-
}
|
|
481
|
-
})(typeof cache.getErrors === 'function') : {};
|
|
482
326
|
let jsonApiErrors = error.errors;
|
|
483
327
|
if (jsonApiErrors.length === 0) {
|
|
484
328
|
jsonApiErrors = [{
|
|
@@ -540,7 +384,6 @@ function findRecord(context) {
|
|
|
540
384
|
|
|
541
385
|
// Refetch if the reload option is passed
|
|
542
386
|
} else if (options.reload) {
|
|
543
|
-
assertIdentifierHasId(identifier);
|
|
544
387
|
promise = store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
545
388
|
} else {
|
|
546
389
|
let snapshot = null;
|
|
@@ -548,24 +391,14 @@ function findRecord(context) {
|
|
|
548
391
|
|
|
549
392
|
// Refetch the record if the adapter thinks the record is stale
|
|
550
393
|
if (typeof options.reload === 'undefined' && adapter.shouldReloadRecord && adapter.shouldReloadRecord(store, snapshot = store._fetchManager.createSnapshot(identifier, options))) {
|
|
551
|
-
|
|
552
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
553
|
-
promise = store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, {
|
|
554
|
-
reload: true
|
|
555
|
-
}), context.request);
|
|
556
|
-
} else {
|
|
394
|
+
{
|
|
557
395
|
options.reload = true;
|
|
558
396
|
promise = store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
559
397
|
}
|
|
560
398
|
} else {
|
|
561
399
|
// Trigger the background refetch if backgroundReload option is passed
|
|
562
400
|
if (options.backgroundReload !== false && (options.backgroundReload || !adapter.shouldBackgroundReloadRecord || adapter.shouldBackgroundReloadRecord(store, snapshot = snapshot || store._fetchManager.createSnapshot(identifier, options)))) {
|
|
563
|
-
|
|
564
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
565
|
-
void store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, {
|
|
566
|
-
backgroundReload: true
|
|
567
|
-
}), context.request);
|
|
568
|
-
} else {
|
|
401
|
+
{
|
|
569
402
|
options.backgroundReload = true;
|
|
570
403
|
void store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
571
404
|
}
|
|
@@ -588,16 +421,6 @@ function findAll(context) {
|
|
|
588
421
|
} = data;
|
|
589
422
|
assertPrivateStore(store);
|
|
590
423
|
const adapter = store.adapterFor(type);
|
|
591
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
592
|
-
if (!test) {
|
|
593
|
-
throw new Error(`You tried to load all records but you have no adapter (for ${type})`);
|
|
594
|
-
}
|
|
595
|
-
})(adapter) : {};
|
|
596
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
597
|
-
if (!test) {
|
|
598
|
-
throw new Error(`You tried to load all records but your adapter does not implement 'findAll'`);
|
|
599
|
-
}
|
|
600
|
-
})(typeof adapter.findAll === 'function') : {};
|
|
601
424
|
|
|
602
425
|
// avoid initializing the liveArray just to set `isUpdating`
|
|
603
426
|
const maybeRecordArray = store.recordArrayManager._live.get(type);
|
|
@@ -622,28 +445,12 @@ function _findAll(adapter, store, type, snapshotArray, request, isAsyncFlush) {
|
|
|
622
445
|
const schema = store.modelFor(type);
|
|
623
446
|
let promise = Promise.resolve().then(() => adapter.findAll(store, schema, null, snapshotArray));
|
|
624
447
|
promise = promise.then(adapterPayload => {
|
|
625
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
626
|
-
if (!test) {
|
|
627
|
-
throw new Error(`You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`);
|
|
628
|
-
}
|
|
629
|
-
})(payloadIsNotBlank(adapterPayload)) : {};
|
|
630
448
|
const serializer = store.serializerFor(type);
|
|
631
449
|
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'findAll');
|
|
632
450
|
store._push(payload, isAsyncFlush);
|
|
633
451
|
snapshotArray._recordArray.isUpdating = false;
|
|
634
|
-
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
|
|
635
|
-
if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
|
|
636
|
-
// eslint-disable-next-line no-console
|
|
637
|
-
console.log(`request: findAll<${type}> background reload complete`);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
452
|
return snapshotArray._recordArray;
|
|
641
453
|
});
|
|
642
|
-
if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
|
|
643
|
-
if (!request.disableTestWaiter) {
|
|
644
|
-
promise = waitFor(promise);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
454
|
return promise;
|
|
648
455
|
}
|
|
649
456
|
function query(context) {
|
|
@@ -661,24 +468,11 @@ function query(context) {
|
|
|
661
468
|
query
|
|
662
469
|
} = data;
|
|
663
470
|
const adapter = store.adapterFor(type);
|
|
664
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
665
|
-
if (!test) {
|
|
666
|
-
throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
667
|
-
}
|
|
668
|
-
})(adapter) : {};
|
|
669
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
670
|
-
if (!test) {
|
|
671
|
-
throw new Error(`You tried to make a query but your adapter does not implement 'query'`);
|
|
672
|
-
}
|
|
673
|
-
})(typeof adapter.query === 'function') : {};
|
|
674
471
|
const recordArray = options._recordArray || store.recordArrayManager.getCollection({
|
|
675
472
|
type,
|
|
676
473
|
query
|
|
677
474
|
});
|
|
678
|
-
|
|
679
|
-
options = Object.assign({}, options);
|
|
680
|
-
delete options._recordArray;
|
|
681
|
-
} else {
|
|
475
|
+
{
|
|
682
476
|
delete options._recordArray;
|
|
683
477
|
}
|
|
684
478
|
const schema = store.modelFor(type);
|
|
@@ -687,22 +481,10 @@ function query(context) {
|
|
|
687
481
|
const serializer = store.serializerFor(type);
|
|
688
482
|
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'query');
|
|
689
483
|
const identifiers = store._push(payload, true);
|
|
690
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
691
|
-
if (!test) {
|
|
692
|
-
throw new Error('The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.');
|
|
693
|
-
}
|
|
694
|
-
})(Array.isArray(identifiers)) : {};
|
|
695
484
|
store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload);
|
|
696
485
|
return recordArray;
|
|
697
486
|
});
|
|
698
487
|
}
|
|
699
|
-
function assertSingleResourceDocument(payload) {
|
|
700
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
701
|
-
if (!test) {
|
|
702
|
-
throw new Error(`Expected the primary data returned by the serializer for a 'queryRecord' response to be a single object or null but instead it was an array.`);
|
|
703
|
-
}
|
|
704
|
-
})(!Array.isArray(payload.data)) : {};
|
|
705
|
-
}
|
|
706
488
|
function queryRecord(context) {
|
|
707
489
|
const {
|
|
708
490
|
store,
|
|
@@ -715,22 +497,11 @@ function queryRecord(context) {
|
|
|
715
497
|
options
|
|
716
498
|
} = data;
|
|
717
499
|
const adapter = store.adapterFor(type);
|
|
718
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
719
|
-
if (!test) {
|
|
720
|
-
throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
721
|
-
}
|
|
722
|
-
})(adapter) : {};
|
|
723
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
724
|
-
if (!test) {
|
|
725
|
-
throw new Error(`You tried to make a query but your adapter does not implement 'queryRecord'`);
|
|
726
|
-
}
|
|
727
|
-
})(typeof adapter.queryRecord === 'function') : {};
|
|
728
500
|
const schema = store.modelFor(type);
|
|
729
501
|
const promise = Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options));
|
|
730
502
|
return promise.then(adapterPayload => {
|
|
731
503
|
const serializer = store.serializerFor(type);
|
|
732
504
|
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'queryRecord');
|
|
733
|
-
assertSingleResourceDocument(payload);
|
|
734
505
|
const identifier = store._push(payload, true);
|
|
735
506
|
return identifier ? store.peekRecord(identifier) : null;
|
|
736
507
|
});
|
|
@@ -763,21 +534,6 @@ function queryRecord(context) {
|
|
|
763
534
|
*/
|
|
764
535
|
|
|
765
536
|
function adapterFor(modelName, _allowMissing) {
|
|
766
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
767
|
-
if (!test) {
|
|
768
|
-
throw new Error(`Attempted to call store.adapterFor(), but the store instance has already been destroyed.`);
|
|
769
|
-
}
|
|
770
|
-
})(!(this.isDestroying || this.isDestroyed)) : {};
|
|
771
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
772
|
-
if (!test) {
|
|
773
|
-
throw new Error(`You need to pass a model name to the store's adapterFor method`);
|
|
774
|
-
}
|
|
775
|
-
})(modelName) : {};
|
|
776
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
777
|
-
if (!test) {
|
|
778
|
-
throw new Error(`Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
779
|
-
}
|
|
780
|
-
})(typeof modelName === 'string') : {};
|
|
781
537
|
this._adapterCache = this._adapterCache || Object.create(null);
|
|
782
538
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
783
539
|
const {
|
|
@@ -803,11 +559,6 @@ function adapterFor(modelName, _allowMissing) {
|
|
|
803
559
|
_adapterCache.application = adapter;
|
|
804
560
|
return adapter;
|
|
805
561
|
}
|
|
806
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
807
|
-
if (!test) {
|
|
808
|
-
throw new Error(`No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`);
|
|
809
|
-
}
|
|
810
|
-
})(_allowMissing) : {};
|
|
811
562
|
}
|
|
812
563
|
|
|
813
564
|
/**
|
|
@@ -826,21 +577,6 @@ function adapterFor(modelName, _allowMissing) {
|
|
|
826
577
|
@param modelName the record to serialize
|
|
827
578
|
*/
|
|
828
579
|
function serializerFor(modelName) {
|
|
829
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
830
|
-
if (!test) {
|
|
831
|
-
throw new Error(`Attempted to call store.serializerFor(), but the store instance has already been destroyed.`);
|
|
832
|
-
}
|
|
833
|
-
})(!(this.isDestroying || this.isDestroyed)) : {};
|
|
834
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
835
|
-
if (!test) {
|
|
836
|
-
throw new Error(`You need to pass a model name to the store's serializerFor method`);
|
|
837
|
-
}
|
|
838
|
-
})(modelName) : {};
|
|
839
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
840
|
-
if (!test) {
|
|
841
|
-
throw new Error(`Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
842
|
-
}
|
|
843
|
-
})(typeof modelName === 'string') : {};
|
|
844
580
|
this._serializerCache = this._serializerCache || Object.create(null);
|
|
845
581
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
846
582
|
const {
|
|
@@ -895,29 +631,9 @@ function serializerFor(modelName) {
|
|
|
895
631
|
*/
|
|
896
632
|
// TODO @runspired @deprecate users should call normalize on the associated serializer directly
|
|
897
633
|
function normalize(modelName, payload) {
|
|
898
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
899
|
-
if (!test) {
|
|
900
|
-
throw new Error(`Attempted to call store.normalize(), but the store instance has already been destroyed.`);
|
|
901
|
-
}
|
|
902
|
-
})(!(this.isDestroying || this.isDestroyed)) : {};
|
|
903
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
904
|
-
if (!test) {
|
|
905
|
-
throw new Error(`You need to pass a model name to the store's normalize method`);
|
|
906
|
-
}
|
|
907
|
-
})(modelName) : {};
|
|
908
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
909
|
-
if (!test) {
|
|
910
|
-
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`);
|
|
911
|
-
}
|
|
912
|
-
})(typeof modelName === 'string') : {};
|
|
913
634
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
914
635
|
const serializer = this.serializerFor(normalizedModelName);
|
|
915
636
|
const schema = this.modelFor(normalizedModelName);
|
|
916
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
917
|
-
if (!test) {
|
|
918
|
-
throw new Error(`You must define a normalize method in your serializer in order to call store.normalize`);
|
|
919
|
-
}
|
|
920
|
-
})(typeof serializer?.normalize === 'function') : {};
|
|
921
637
|
return serializer.normalize(schema, payload);
|
|
922
638
|
}
|
|
923
639
|
|
|
@@ -978,19 +694,9 @@ function normalize(modelName, payload) {
|
|
|
978
694
|
*/
|
|
979
695
|
// TODO @runspired @deprecate pushPayload in favor of looking up the serializer
|
|
980
696
|
function pushPayload(modelName, inputPayload) {
|
|
981
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
982
|
-
if (!test) {
|
|
983
|
-
throw new Error(`Attempted to call store.pushPayload(), but the store instance has already been destroyed.`);
|
|
984
|
-
}
|
|
985
|
-
})(!(this.isDestroying || this.isDestroyed)) : {};
|
|
986
697
|
const payload = inputPayload || modelName;
|
|
987
698
|
const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : 'application';
|
|
988
699
|
const serializer = this.serializerFor(normalizedModelName);
|
|
989
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
990
|
-
if (!test) {
|
|
991
|
-
throw new Error(`You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`);
|
|
992
|
-
}
|
|
993
|
-
})(serializer && typeof serializer.pushPayload === 'function') : {};
|
|
994
700
|
serializer.pushPayload(this, payload);
|
|
995
701
|
}
|
|
996
702
|
|