@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
|
@@ -2,39 +2,38 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { assertPrivateStore, waitFor, _deprecatingNormalize } from '@warp-drive/core/store/-private';
|
|
4
4
|
import '@warp-drive/core/reactive/-private';
|
|
5
|
-
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-
|
|
6
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
5
|
+
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-DbaSCSym.js";
|
|
7
6
|
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
8
7
|
const promise = Promise.resolve().then(() => {
|
|
9
8
|
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
10
9
|
const useLink = !link || typeof link === 'string';
|
|
11
10
|
const relatedLink = useLink ? link : link.href;
|
|
12
|
-
|
|
11
|
+
(test => {
|
|
13
12
|
if (!test) {
|
|
14
13
|
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
14
|
}
|
|
16
|
-
})(relatedLink)
|
|
17
|
-
|
|
15
|
+
})(relatedLink);
|
|
16
|
+
(test => {
|
|
18
17
|
if (!test) {
|
|
19
18
|
throw new Error(`Expected the adapter to implement 'findHasMany' but it does not`);
|
|
20
19
|
}
|
|
21
|
-
})(typeof adapter.findHasMany === 'function')
|
|
20
|
+
})(typeof adapter.findHasMany === 'function');
|
|
22
21
|
return adapter.findHasMany(store, snapshot, relatedLink, relationship);
|
|
23
22
|
});
|
|
24
23
|
return promise.then(adapterPayload => {
|
|
25
|
-
|
|
24
|
+
(test => {
|
|
26
25
|
if (!test) {
|
|
27
26
|
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
27
|
}
|
|
29
|
-
})(payloadIsNotBlank(adapterPayload))
|
|
28
|
+
})(payloadIsNotBlank(adapterPayload));
|
|
30
29
|
const modelClass = store.modelFor(relationship.type);
|
|
31
30
|
const serializer = store.serializerFor(relationship.type);
|
|
32
31
|
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findHasMany');
|
|
33
|
-
|
|
32
|
+
(test => {
|
|
34
33
|
if (!test) {
|
|
35
34
|
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
35
|
}
|
|
37
|
-
})('data' in payload && Array.isArray(payload.data))
|
|
36
|
+
})('data' in payload && Array.isArray(payload.data));
|
|
38
37
|
payload = syncRelationshipDataFromLink(store, payload, identifier, relationship);
|
|
39
38
|
return store._push(payload, true);
|
|
40
39
|
}, null);
|
|
@@ -42,35 +41,35 @@ function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
|
42
41
|
function _findBelongsTo(store, identifier, link, relationship, options) {
|
|
43
42
|
const promise = Promise.resolve().then(() => {
|
|
44
43
|
const adapter = store.adapterFor(identifier.type);
|
|
45
|
-
|
|
44
|
+
(test => {
|
|
46
45
|
if (!test) {
|
|
47
46
|
throw new Error(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`);
|
|
48
47
|
}
|
|
49
|
-
})(adapter)
|
|
50
|
-
|
|
48
|
+
})(adapter);
|
|
49
|
+
(test => {
|
|
51
50
|
if (!test) {
|
|
52
51
|
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
52
|
}
|
|
54
|
-
})(typeof adapter.findBelongsTo === 'function')
|
|
53
|
+
})(typeof adapter.findBelongsTo === 'function');
|
|
55
54
|
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
56
55
|
const useLink = !link || typeof link === 'string';
|
|
57
56
|
const relatedLink = useLink ? link : link.href;
|
|
58
|
-
|
|
57
|
+
(test => {
|
|
59
58
|
if (!test) {
|
|
60
59
|
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
60
|
}
|
|
62
|
-
})(relatedLink)
|
|
61
|
+
})(relatedLink);
|
|
63
62
|
return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);
|
|
64
63
|
});
|
|
65
64
|
return promise.then(adapterPayload => {
|
|
66
65
|
const modelClass = store.modelFor(relationship.type);
|
|
67
66
|
const serializer = store.serializerFor(relationship.type);
|
|
68
67
|
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findBelongsTo');
|
|
69
|
-
|
|
68
|
+
(test => {
|
|
70
69
|
if (!test) {
|
|
71
70
|
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
71
|
}
|
|
73
|
-
})('data' in payload && (payload.data === null || typeof payload.data === 'object' && !Array.isArray(payload.data)))
|
|
72
|
+
})('data' in payload && (payload.data === null || typeof payload.data === 'object' && !Array.isArray(payload.data)));
|
|
74
73
|
if (!payload.data && !payload.links && !payload.meta) {
|
|
75
74
|
return null;
|
|
76
75
|
}
|
|
@@ -143,7 +142,7 @@ function ensureRelationshipIsSetToParent(payload, parentIdentifier, store, paren
|
|
|
143
142
|
kind
|
|
144
143
|
} = inverse;
|
|
145
144
|
const relationshipData = relationships[inverseKey]?.data;
|
|
146
|
-
|
|
145
|
+
{
|
|
147
146
|
if (typeof relationshipData !== 'undefined' && !relationshipDataPointsToParent(relationshipData, parentIdentifier)) {
|
|
148
147
|
const inspect = function inspect(thing) {
|
|
149
148
|
return `'${JSON.stringify(thing)}'`;
|
|
@@ -163,11 +162,11 @@ function ensureRelationshipIsSetToParent(payload, parentIdentifier, store, paren
|
|
|
163
162
|
const relationshipFetched = `${expectedModel}.${parentRelationship.kind}("${parentRelationship.name}")`;
|
|
164
163
|
const includedRecord = `<${type}:${id}>`;
|
|
165
164
|
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
|
-
|
|
165
|
+
(test => {
|
|
167
166
|
{
|
|
168
167
|
throw new Error(message);
|
|
169
168
|
}
|
|
170
|
-
})()
|
|
169
|
+
})();
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
if (kind !== 'hasMany' || typeof relationshipData !== 'undefined') {
|
|
@@ -181,16 +180,16 @@ function inverseForRelationship(store, identifier, key) {
|
|
|
181
180
|
if (!definition) {
|
|
182
181
|
return null;
|
|
183
182
|
}
|
|
184
|
-
|
|
183
|
+
(test => {
|
|
185
184
|
if (!test) {
|
|
186
185
|
throw new Error(`Expected the field definition to be a relationship`);
|
|
187
186
|
}
|
|
188
|
-
})(definition.kind === 'hasMany' || definition.kind === 'belongsTo')
|
|
189
|
-
|
|
187
|
+
})(definition.kind === 'hasMany' || definition.kind === 'belongsTo');
|
|
188
|
+
(test => {
|
|
190
189
|
if (!test) {
|
|
191
190
|
throw new Error(`Expected the relationship defintion to specify the inverse type or null.`);
|
|
192
191
|
}
|
|
193
|
-
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)
|
|
192
|
+
})(definition.options?.inverse === null || typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0);
|
|
194
193
|
return definition.options.inverse;
|
|
195
194
|
}
|
|
196
195
|
function getInverse(store, parentIdentifier, parentRelationship, type) {
|
|
@@ -207,11 +206,11 @@ function getInverse(store, parentIdentifier, parentRelationship, type) {
|
|
|
207
206
|
const definition = store.schema.fields({
|
|
208
207
|
type
|
|
209
208
|
}).get(inverseKey);
|
|
210
|
-
|
|
209
|
+
(test => {
|
|
211
210
|
if (!test) {
|
|
212
211
|
throw new Error(`Expected the field definition to be a relationship`);
|
|
213
212
|
}
|
|
214
|
-
})(definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo'))
|
|
213
|
+
})(definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo'));
|
|
215
214
|
return {
|
|
216
215
|
inverseKey,
|
|
217
216
|
kind: definition.kind
|
|
@@ -249,11 +248,11 @@ function fixRelationshipData(relationshipData, relationshipKind, {
|
|
|
249
248
|
if (relationshipKind === 'hasMany') {
|
|
250
249
|
const relData = relationshipData || [];
|
|
251
250
|
if (relationshipData) {
|
|
252
|
-
|
|
251
|
+
(test => {
|
|
253
252
|
if (!test) {
|
|
254
253
|
throw new Error('expected the relationship data to be an array');
|
|
255
254
|
}
|
|
256
|
-
})(Array.isArray(relationshipData))
|
|
255
|
+
})(Array.isArray(relationshipData));
|
|
257
256
|
// these arrays could be massive so this is better than filter
|
|
258
257
|
// Note: this is potentially problematic if type/id are not in the
|
|
259
258
|
// same state of normalization.
|
|
@@ -281,6 +280,141 @@ function validateRelationshipEntry({
|
|
|
281
280
|
}) {
|
|
282
281
|
return !!id && id.toString() === parentModelID;
|
|
283
282
|
}
|
|
283
|
+
|
|
284
|
+
/*
|
|
285
|
+
These are the runtime implementations for the javascript macros that have
|
|
286
|
+
runtime implementations.
|
|
287
|
+
|
|
288
|
+
Not every macro has a runtime implementation, some only make sense in the
|
|
289
|
+
build and always run there.
|
|
290
|
+
|
|
291
|
+
Even when we have runtime implementations, we are still careful to emit static
|
|
292
|
+
errors during the build wherever possible, and runtime errors when necessary,
|
|
293
|
+
so that you're not surprised when you switch from runtime-mode to compile-time
|
|
294
|
+
mode.
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
// This is here as a compile target for `getConfig` and `getOwnConfig` when
|
|
298
|
+
// we're in runtime mode. This is not public API to call from your own code.
|
|
299
|
+
function config(packageRoot) {
|
|
300
|
+
return runtimeConfig.packages[packageRoot];
|
|
301
|
+
}
|
|
302
|
+
function getGlobalConfig() {
|
|
303
|
+
return runtimeConfig.global;
|
|
304
|
+
}
|
|
305
|
+
const runtimeConfig = initializeRuntimeMacrosConfig();
|
|
306
|
+
|
|
307
|
+
// this exists to be targeted by our babel plugin
|
|
308
|
+
function initializeRuntimeMacrosConfig() {
|
|
309
|
+
return {
|
|
310
|
+
"packages": {},
|
|
311
|
+
"global": {
|
|
312
|
+
"@embroider/macros": {
|
|
313
|
+
"isTesting": false
|
|
314
|
+
},
|
|
315
|
+
"WarpDrive": {
|
|
316
|
+
"debug": {
|
|
317
|
+
"DEBUG_RELATIONSHIP_NOTIFICATIONS": false,
|
|
318
|
+
"LOG_CACHE": false,
|
|
319
|
+
"LOG_CACHE_POLICY": false,
|
|
320
|
+
"LOG_GRAPH": false,
|
|
321
|
+
"LOG_IDENTIFIERS": false,
|
|
322
|
+
"LOG_INSTANCE_CACHE": false,
|
|
323
|
+
"LOG_METRIC_COUNTS": false,
|
|
324
|
+
"LOG_MUTATIONS": false,
|
|
325
|
+
"LOG_NOTIFICATIONS": false,
|
|
326
|
+
"LOG_OPERATIONS": false,
|
|
327
|
+
"LOG_PAYLOADS": false,
|
|
328
|
+
"LOG_REACT_SIGNAL_INTEGRATION": false,
|
|
329
|
+
"LOG_REQUESTS": false,
|
|
330
|
+
"LOG_REQUEST_STATUS": false,
|
|
331
|
+
"__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS": false
|
|
332
|
+
},
|
|
333
|
+
"polyfillUUID": false,
|
|
334
|
+
"includeDataAdapter": true,
|
|
335
|
+
"compatWith": null,
|
|
336
|
+
"deprecations": {
|
|
337
|
+
"DEPRECATE_CATCH_ALL": true,
|
|
338
|
+
"DEPRECATE_COMPUTED_CHAINS": true,
|
|
339
|
+
"DEPRECATE_EMBER_INFLECTOR": true,
|
|
340
|
+
"DEPRECATE_LEGACY_IMPORTS": true,
|
|
341
|
+
"DEPRECATE_MANY_ARRAY_DUPLICATES": true,
|
|
342
|
+
"DEPRECATE_NON_STRICT_ID": true,
|
|
343
|
+
"DEPRECATE_NON_STRICT_TYPES": true,
|
|
344
|
+
"DEPRECATE_NON_UNIQUE_PAYLOADS": true,
|
|
345
|
+
"DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE": true,
|
|
346
|
+
"DEPRECATE_STORE_EXTENDS_EMBER_OBJECT": true,
|
|
347
|
+
"DEPRECATE_TRACKING_PACKAGE": true,
|
|
348
|
+
"DISABLE_7X_DEPRECATIONS": true,
|
|
349
|
+
"ENABLE_LEGACY_REQUEST_METHODS": true,
|
|
350
|
+
"ENABLE_LEGACY_SCHEMA_SERVICE": true
|
|
351
|
+
},
|
|
352
|
+
"features": {
|
|
353
|
+
"ENFORCE_STRICT_RESOURCE_FINALIZATION": false,
|
|
354
|
+
"JSON_API_CACHE_VALIDATION_ERRORS": false,
|
|
355
|
+
"SAMPLE_FEATURE_FLAG": null
|
|
356
|
+
},
|
|
357
|
+
"activeLogging": {
|
|
358
|
+
"DEBUG_RELATIONSHIP_NOTIFICATIONS": true,
|
|
359
|
+
"LOG_CACHE": true,
|
|
360
|
+
"LOG_CACHE_POLICY": true,
|
|
361
|
+
"LOG_GRAPH": true,
|
|
362
|
+
"LOG_IDENTIFIERS": true,
|
|
363
|
+
"LOG_INSTANCE_CACHE": true,
|
|
364
|
+
"LOG_METRIC_COUNTS": true,
|
|
365
|
+
"LOG_MUTATIONS": true,
|
|
366
|
+
"LOG_NOTIFICATIONS": true,
|
|
367
|
+
"LOG_OPERATIONS": true,
|
|
368
|
+
"LOG_PAYLOADS": true,
|
|
369
|
+
"LOG_REACT_SIGNAL_INTEGRATION": true,
|
|
370
|
+
"LOG_REQUESTS": true,
|
|
371
|
+
"LOG_REQUEST_STATUS": true,
|
|
372
|
+
"__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS": true
|
|
373
|
+
},
|
|
374
|
+
"env": {
|
|
375
|
+
"TESTING": true,
|
|
376
|
+
"PRODUCTION": false,
|
|
377
|
+
"DEBUG": true,
|
|
378
|
+
"IS_RECORDING": false,
|
|
379
|
+
"IS_CI": true,
|
|
380
|
+
"SHOULD_RECORD": false
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function updaterMethods() {
|
|
387
|
+
return {
|
|
388
|
+
config,
|
|
389
|
+
getGlobalConfig,
|
|
390
|
+
setConfig(packageRoot, value) {
|
|
391
|
+
runtimeConfig.packages[packageRoot] = value;
|
|
392
|
+
},
|
|
393
|
+
setGlobalConfig(key, value) {
|
|
394
|
+
runtimeConfig.global[key] = value;
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// this is how runtime config can get injected at boot. I'm not sure yet if this
|
|
400
|
+
// should be public API, but we certainly need it internally to set things like
|
|
401
|
+
// the global fastboot.isRunning.
|
|
402
|
+
//
|
|
403
|
+
// consumers of this API push a function onto
|
|
404
|
+
// window._embroider_macros_runtime_config. The function is given four methods
|
|
405
|
+
// which allow it to read and write the per-package and global configs. The
|
|
406
|
+
// reason for allowing both read & write is that merging strategies are up to
|
|
407
|
+
// each consumers -- read first, then merge, then write.
|
|
408
|
+
//
|
|
409
|
+
// For an example user of this API, see where we generate
|
|
410
|
+
// embroider_macros_fastboot_init.js' in @embroider/core.
|
|
411
|
+
let updaters = typeof window !== 'undefined' ? window._embroider_macros_runtime_config : undefined;
|
|
412
|
+
if (updaters) {
|
|
413
|
+
let methods = updaterMethods();
|
|
414
|
+
for (let updater of updaters) {
|
|
415
|
+
updater(methods);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
284
418
|
const PotentialLegacyOperations = new Set(['findRecord', 'findAll', 'query', 'queryRecord', 'findBelongsTo', 'findHasMany', 'updateRecord', 'createRecord', 'deleteRecord']);
|
|
285
419
|
const LegacyNetworkHandler = {
|
|
286
420
|
request(context, next) {
|
|
@@ -339,18 +473,18 @@ function findBelongsTo(context) {
|
|
|
339
473
|
return pendingRequest;
|
|
340
474
|
}
|
|
341
475
|
if (useLink) {
|
|
342
|
-
|
|
476
|
+
(test => {
|
|
343
477
|
if (!test) {
|
|
344
478
|
throw new Error(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`);
|
|
345
479
|
}
|
|
346
|
-
})(links && links.related)
|
|
480
|
+
})(links && links.related);
|
|
347
481
|
return _findBelongsTo(store, record, links.related, field, options);
|
|
348
482
|
}
|
|
349
|
-
|
|
483
|
+
(test => {
|
|
350
484
|
if (!test) {
|
|
351
485
|
throw new Error(`Expected an identifier`);
|
|
352
486
|
}
|
|
353
|
-
})(Array.isArray(identifiers) && identifiers.length === 1)
|
|
487
|
+
})(Array.isArray(identifiers) && identifiers.length === 1);
|
|
354
488
|
const manager = store._fetchManager;
|
|
355
489
|
assertIdentifierHasId(identifier);
|
|
356
490
|
return options.reload ? manager.scheduleFetch(identifier, options, context.request) : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
@@ -381,30 +515,30 @@ function findHasMany(context) {
|
|
|
381
515
|
The usual use-case is for the server to register a URL as a link, and
|
|
382
516
|
then use that URL in the future to make a request for the relationship.
|
|
383
517
|
*/
|
|
384
|
-
|
|
518
|
+
(test => {
|
|
385
519
|
if (!test) {
|
|
386
520
|
throw new Error(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`);
|
|
387
521
|
}
|
|
388
|
-
})(adapter)
|
|
389
|
-
|
|
522
|
+
})(adapter);
|
|
523
|
+
(test => {
|
|
390
524
|
if (!test) {
|
|
391
525
|
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
526
|
}
|
|
393
|
-
})(typeof adapter.findHasMany === 'function')
|
|
394
|
-
|
|
527
|
+
})(typeof adapter.findHasMany === 'function');
|
|
528
|
+
(test => {
|
|
395
529
|
if (!test) {
|
|
396
530
|
throw new Error(`Expected a related link when calling store.findHasMany, found ${String(links)}`);
|
|
397
531
|
}
|
|
398
|
-
})(links && links.related)
|
|
532
|
+
})(links && links.related);
|
|
399
533
|
return _findHasMany(adapter, store, record, links.related, field, options);
|
|
400
534
|
}
|
|
401
535
|
|
|
402
536
|
// identifiers case
|
|
403
|
-
|
|
537
|
+
(test => {
|
|
404
538
|
if (!test) {
|
|
405
539
|
throw new Error(`Expected an array of identifiers to fetch`);
|
|
406
540
|
}
|
|
407
|
-
})(Array.isArray(identifiers))
|
|
541
|
+
})(Array.isArray(identifiers));
|
|
408
542
|
const fetches = new Array(identifiers.length);
|
|
409
543
|
const manager = store._fetchManager;
|
|
410
544
|
for (let i = 0; i < identifiers.length; i++) {
|
|
@@ -474,11 +608,11 @@ function adapterDidInvalidate(store, identifier, error) {
|
|
|
474
608
|
}
|
|
475
609
|
const cache = store.cache;
|
|
476
610
|
if (error.errors) {
|
|
477
|
-
|
|
611
|
+
(test => {
|
|
478
612
|
if (!test) {
|
|
479
613
|
throw new Error(`Expected the cache in use by resource ${String(identifier)} to have a getErrors(identifier) method for retrieving errors.`);
|
|
480
614
|
}
|
|
481
|
-
})(typeof cache.getErrors === 'function')
|
|
615
|
+
})(typeof cache.getErrors === 'function');
|
|
482
616
|
let jsonApiErrors = error.errors;
|
|
483
617
|
if (jsonApiErrors.length === 0) {
|
|
484
618
|
jsonApiErrors = [{
|
|
@@ -549,25 +683,19 @@ function findRecord(context) {
|
|
|
549
683
|
// Refetch the record if the adapter thinks the record is stale
|
|
550
684
|
if (typeof options.reload === 'undefined' && adapter.shouldReloadRecord && adapter.shouldReloadRecord(store, snapshot = store._fetchManager.createSnapshot(identifier, options))) {
|
|
551
685
|
assertIdentifierHasId(identifier);
|
|
552
|
-
|
|
686
|
+
{
|
|
553
687
|
promise = store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, {
|
|
554
688
|
reload: true
|
|
555
689
|
}), context.request);
|
|
556
|
-
} else {
|
|
557
|
-
options.reload = true;
|
|
558
|
-
promise = store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
559
690
|
}
|
|
560
691
|
} else {
|
|
561
692
|
// Trigger the background refetch if backgroundReload option is passed
|
|
562
693
|
if (options.backgroundReload !== false && (options.backgroundReload || !adapter.shouldBackgroundReloadRecord || adapter.shouldBackgroundReloadRecord(store, snapshot = snapshot || store._fetchManager.createSnapshot(identifier, options)))) {
|
|
563
694
|
assertIdentifierHasId(identifier);
|
|
564
|
-
|
|
695
|
+
{
|
|
565
696
|
void store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, {
|
|
566
697
|
backgroundReload: true
|
|
567
698
|
}), context.request);
|
|
568
|
-
} else {
|
|
569
|
-
options.backgroundReload = true;
|
|
570
|
-
void store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
571
699
|
}
|
|
572
700
|
}
|
|
573
701
|
|
|
@@ -588,16 +716,16 @@ function findAll(context) {
|
|
|
588
716
|
} = data;
|
|
589
717
|
assertPrivateStore(store);
|
|
590
718
|
const adapter = store.adapterFor(type);
|
|
591
|
-
|
|
719
|
+
(test => {
|
|
592
720
|
if (!test) {
|
|
593
721
|
throw new Error(`You tried to load all records but you have no adapter (for ${type})`);
|
|
594
722
|
}
|
|
595
|
-
})(adapter)
|
|
596
|
-
|
|
723
|
+
})(adapter);
|
|
724
|
+
(test => {
|
|
597
725
|
if (!test) {
|
|
598
726
|
throw new Error(`You tried to load all records but your adapter does not implement 'findAll'`);
|
|
599
727
|
}
|
|
600
|
-
})(typeof adapter.findAll === 'function')
|
|
728
|
+
})(typeof adapter.findAll === 'function');
|
|
601
729
|
|
|
602
730
|
// avoid initializing the liveArray just to set `isUpdating`
|
|
603
731
|
const maybeRecordArray = store.recordArrayManager._live.get(type);
|
|
@@ -622,16 +750,16 @@ function _findAll(adapter, store, type, snapshotArray, request, isAsyncFlush) {
|
|
|
622
750
|
const schema = store.modelFor(type);
|
|
623
751
|
let promise = Promise.resolve().then(() => adapter.findAll(store, schema, null, snapshotArray));
|
|
624
752
|
promise = promise.then(adapterPayload => {
|
|
625
|
-
|
|
753
|
+
(test => {
|
|
626
754
|
if (!test) {
|
|
627
755
|
throw new Error(`You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`);
|
|
628
756
|
}
|
|
629
|
-
})(payloadIsNotBlank(adapterPayload))
|
|
757
|
+
})(payloadIsNotBlank(adapterPayload));
|
|
630
758
|
const serializer = store.serializerFor(type);
|
|
631
759
|
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'findAll');
|
|
632
760
|
store._push(payload, isAsyncFlush);
|
|
633
761
|
snapshotArray._recordArray.isUpdating = false;
|
|
634
|
-
|
|
762
|
+
{
|
|
635
763
|
if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
|
|
636
764
|
// eslint-disable-next-line no-console
|
|
637
765
|
console.log(`request: findAll<${type}> background reload complete`);
|
|
@@ -639,7 +767,7 @@ function _findAll(adapter, store, type, snapshotArray, request, isAsyncFlush) {
|
|
|
639
767
|
}
|
|
640
768
|
return snapshotArray._recordArray;
|
|
641
769
|
});
|
|
642
|
-
|
|
770
|
+
{
|
|
643
771
|
if (!request.disableTestWaiter) {
|
|
644
772
|
promise = waitFor(promise);
|
|
645
773
|
}
|
|
@@ -661,25 +789,23 @@ function query(context) {
|
|
|
661
789
|
query
|
|
662
790
|
} = data;
|
|
663
791
|
const adapter = store.adapterFor(type);
|
|
664
|
-
|
|
792
|
+
(test => {
|
|
665
793
|
if (!test) {
|
|
666
794
|
throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
667
795
|
}
|
|
668
|
-
})(adapter)
|
|
669
|
-
|
|
796
|
+
})(adapter);
|
|
797
|
+
(test => {
|
|
670
798
|
if (!test) {
|
|
671
799
|
throw new Error(`You tried to make a query but your adapter does not implement 'query'`);
|
|
672
800
|
}
|
|
673
|
-
})(typeof adapter.query === 'function')
|
|
801
|
+
})(typeof adapter.query === 'function');
|
|
674
802
|
const recordArray = options._recordArray || store.recordArrayManager.getCollection({
|
|
675
803
|
type,
|
|
676
804
|
query
|
|
677
805
|
});
|
|
678
|
-
|
|
806
|
+
{
|
|
679
807
|
options = Object.assign({}, options);
|
|
680
808
|
delete options._recordArray;
|
|
681
|
-
} else {
|
|
682
|
-
delete options._recordArray;
|
|
683
809
|
}
|
|
684
810
|
const schema = store.modelFor(type);
|
|
685
811
|
const promise = Promise.resolve().then(() => adapter.query(store, schema, query, recordArray, options));
|
|
@@ -687,21 +813,21 @@ function query(context) {
|
|
|
687
813
|
const serializer = store.serializerFor(type);
|
|
688
814
|
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'query');
|
|
689
815
|
const identifiers = store._push(payload, true);
|
|
690
|
-
|
|
816
|
+
(test => {
|
|
691
817
|
if (!test) {
|
|
692
818
|
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
819
|
}
|
|
694
|
-
})(Array.isArray(identifiers))
|
|
820
|
+
})(Array.isArray(identifiers));
|
|
695
821
|
store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload);
|
|
696
822
|
return recordArray;
|
|
697
823
|
});
|
|
698
824
|
}
|
|
699
825
|
function assertSingleResourceDocument(payload) {
|
|
700
|
-
|
|
826
|
+
(test => {
|
|
701
827
|
if (!test) {
|
|
702
828
|
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
829
|
}
|
|
704
|
-
})(!Array.isArray(payload.data))
|
|
830
|
+
})(!Array.isArray(payload.data));
|
|
705
831
|
}
|
|
706
832
|
function queryRecord(context) {
|
|
707
833
|
const {
|
|
@@ -715,16 +841,16 @@ function queryRecord(context) {
|
|
|
715
841
|
options
|
|
716
842
|
} = data;
|
|
717
843
|
const adapter = store.adapterFor(type);
|
|
718
|
-
|
|
844
|
+
(test => {
|
|
719
845
|
if (!test) {
|
|
720
846
|
throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
721
847
|
}
|
|
722
|
-
})(adapter)
|
|
723
|
-
|
|
848
|
+
})(adapter);
|
|
849
|
+
(test => {
|
|
724
850
|
if (!test) {
|
|
725
851
|
throw new Error(`You tried to make a query but your adapter does not implement 'queryRecord'`);
|
|
726
852
|
}
|
|
727
|
-
})(typeof adapter.queryRecord === 'function')
|
|
853
|
+
})(typeof adapter.queryRecord === 'function');
|
|
728
854
|
const schema = store.modelFor(type);
|
|
729
855
|
const promise = Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options));
|
|
730
856
|
return promise.then(adapterPayload => {
|
|
@@ -763,21 +889,21 @@ function queryRecord(context) {
|
|
|
763
889
|
*/
|
|
764
890
|
|
|
765
891
|
function adapterFor(modelName, _allowMissing) {
|
|
766
|
-
|
|
892
|
+
(test => {
|
|
767
893
|
if (!test) {
|
|
768
894
|
throw new Error(`Attempted to call store.adapterFor(), but the store instance has already been destroyed.`);
|
|
769
895
|
}
|
|
770
|
-
})(!(this.isDestroying || this.isDestroyed))
|
|
771
|
-
|
|
896
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
897
|
+
(test => {
|
|
772
898
|
if (!test) {
|
|
773
899
|
throw new Error(`You need to pass a model name to the store's adapterFor method`);
|
|
774
900
|
}
|
|
775
|
-
})(modelName)
|
|
776
|
-
|
|
901
|
+
})(modelName);
|
|
902
|
+
(test => {
|
|
777
903
|
if (!test) {
|
|
778
904
|
throw new Error(`Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
779
905
|
}
|
|
780
|
-
})(typeof modelName === 'string')
|
|
906
|
+
})(typeof modelName === 'string');
|
|
781
907
|
this._adapterCache = this._adapterCache || Object.create(null);
|
|
782
908
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
783
909
|
const {
|
|
@@ -803,11 +929,11 @@ function adapterFor(modelName, _allowMissing) {
|
|
|
803
929
|
_adapterCache.application = adapter;
|
|
804
930
|
return adapter;
|
|
805
931
|
}
|
|
806
|
-
|
|
932
|
+
(test => {
|
|
807
933
|
if (!test) {
|
|
808
934
|
throw new Error(`No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`);
|
|
809
935
|
}
|
|
810
|
-
})(_allowMissing)
|
|
936
|
+
})(_allowMissing);
|
|
811
937
|
}
|
|
812
938
|
|
|
813
939
|
/**
|
|
@@ -826,21 +952,21 @@ function adapterFor(modelName, _allowMissing) {
|
|
|
826
952
|
@param modelName the record to serialize
|
|
827
953
|
*/
|
|
828
954
|
function serializerFor(modelName) {
|
|
829
|
-
|
|
955
|
+
(test => {
|
|
830
956
|
if (!test) {
|
|
831
957
|
throw new Error(`Attempted to call store.serializerFor(), but the store instance has already been destroyed.`);
|
|
832
958
|
}
|
|
833
|
-
})(!(this.isDestroying || this.isDestroyed))
|
|
834
|
-
|
|
959
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
960
|
+
(test => {
|
|
835
961
|
if (!test) {
|
|
836
962
|
throw new Error(`You need to pass a model name to the store's serializerFor method`);
|
|
837
963
|
}
|
|
838
|
-
})(modelName)
|
|
839
|
-
|
|
964
|
+
})(modelName);
|
|
965
|
+
(test => {
|
|
840
966
|
if (!test) {
|
|
841
967
|
throw new Error(`Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
842
968
|
}
|
|
843
|
-
})(typeof modelName === 'string')
|
|
969
|
+
})(typeof modelName === 'string');
|
|
844
970
|
this._serializerCache = this._serializerCache || Object.create(null);
|
|
845
971
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
846
972
|
const {
|
|
@@ -895,29 +1021,29 @@ function serializerFor(modelName) {
|
|
|
895
1021
|
*/
|
|
896
1022
|
// TODO @runspired @deprecate users should call normalize on the associated serializer directly
|
|
897
1023
|
function normalize(modelName, payload) {
|
|
898
|
-
|
|
1024
|
+
(test => {
|
|
899
1025
|
if (!test) {
|
|
900
1026
|
throw new Error(`Attempted to call store.normalize(), but the store instance has already been destroyed.`);
|
|
901
1027
|
}
|
|
902
|
-
})(!(this.isDestroying || this.isDestroyed))
|
|
903
|
-
|
|
1028
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
1029
|
+
(test => {
|
|
904
1030
|
if (!test) {
|
|
905
1031
|
throw new Error(`You need to pass a model name to the store's normalize method`);
|
|
906
1032
|
}
|
|
907
|
-
})(modelName)
|
|
908
|
-
|
|
1033
|
+
})(modelName);
|
|
1034
|
+
(test => {
|
|
909
1035
|
if (!test) {
|
|
910
1036
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`);
|
|
911
1037
|
}
|
|
912
|
-
})(typeof modelName === 'string')
|
|
1038
|
+
})(typeof modelName === 'string');
|
|
913
1039
|
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
914
1040
|
const serializer = this.serializerFor(normalizedModelName);
|
|
915
1041
|
const schema = this.modelFor(normalizedModelName);
|
|
916
|
-
|
|
1042
|
+
(test => {
|
|
917
1043
|
if (!test) {
|
|
918
1044
|
throw new Error(`You must define a normalize method in your serializer in order to call store.normalize`);
|
|
919
1045
|
}
|
|
920
|
-
})(typeof serializer?.normalize === 'function')
|
|
1046
|
+
})(typeof serializer?.normalize === 'function');
|
|
921
1047
|
return serializer.normalize(schema, payload);
|
|
922
1048
|
}
|
|
923
1049
|
|
|
@@ -978,19 +1104,19 @@ function normalize(modelName, payload) {
|
|
|
978
1104
|
*/
|
|
979
1105
|
// TODO @runspired @deprecate pushPayload in favor of looking up the serializer
|
|
980
1106
|
function pushPayload(modelName, inputPayload) {
|
|
981
|
-
|
|
1107
|
+
(test => {
|
|
982
1108
|
if (!test) {
|
|
983
1109
|
throw new Error(`Attempted to call store.pushPayload(), but the store instance has already been destroyed.`);
|
|
984
1110
|
}
|
|
985
|
-
})(!(this.isDestroying || this.isDestroyed))
|
|
1111
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
986
1112
|
const payload = inputPayload || modelName;
|
|
987
1113
|
const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : 'application';
|
|
988
1114
|
const serializer = this.serializerFor(normalizedModelName);
|
|
989
|
-
|
|
1115
|
+
(test => {
|
|
990
1116
|
if (!test) {
|
|
991
1117
|
throw new Error(`You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`);
|
|
992
1118
|
}
|
|
993
|
-
})(serializer && typeof serializer.pushPayload === 'function')
|
|
1119
|
+
})(serializer && typeof serializer.pushPayload === 'function');
|
|
994
1120
|
serializer.pushPayload(this, payload);
|
|
995
1121
|
}
|
|
996
1122
|
|