@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,9 +1,7 @@
|
|
|
1
1
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
2
|
-
import { warn } from '@ember/debug';
|
|
3
2
|
import { createDeferred } from '@warp-drive/core/request';
|
|
4
3
|
import { assertPrivateStore, waitFor, coerceId } from '@warp-drive/core/store/-private';
|
|
5
4
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
6
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
SnapshotRecordArray is not directly instantiable.
|
|
@@ -136,11 +134,11 @@ class SnapshotRecordArray {
|
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
136
|
function assertIdentifierHasId(identifier) {
|
|
139
|
-
|
|
137
|
+
(test => {
|
|
140
138
|
if (!test) {
|
|
141
139
|
throw new Error(`Attempted to schedule a fetch for a record without an id.`);
|
|
142
140
|
}
|
|
143
|
-
})(identifier && identifier.id !== null)
|
|
141
|
+
})(identifier && identifier.id !== null);
|
|
144
142
|
}
|
|
145
143
|
function iterateData(data, fn) {
|
|
146
144
|
if (Array.isArray(data)) {
|
|
@@ -166,7 +164,7 @@ function payloadIsNotBlank(adapterPayload) {
|
|
|
166
164
|
@internal
|
|
167
165
|
*/
|
|
168
166
|
function validateDocumentStructure(doc) {
|
|
169
|
-
|
|
167
|
+
{
|
|
170
168
|
const errors = [];
|
|
171
169
|
if (!doc || typeof doc !== 'object') {
|
|
172
170
|
errors.push('Top level of a JSON API document must be an object');
|
|
@@ -209,11 +207,11 @@ function validateDocumentStructure(doc) {
|
|
|
209
207
|
}
|
|
210
208
|
}
|
|
211
209
|
}
|
|
212
|
-
|
|
210
|
+
(test => {
|
|
213
211
|
if (!test) {
|
|
214
212
|
throw new Error(`Response must be normalized to a valid JSON API document:\n\t* ${errors.join('\n\t* ')}`);
|
|
215
213
|
}
|
|
216
|
-
})(errors.length === 0)
|
|
214
|
+
})(errors.length === 0);
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
217
|
function normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
|
|
@@ -326,11 +324,11 @@ class Snapshot {
|
|
|
326
324
|
*/
|
|
327
325
|
get record() {
|
|
328
326
|
const record = this._store.peekRecord(this.identifier);
|
|
329
|
-
|
|
327
|
+
(test => {
|
|
330
328
|
if (!test) {
|
|
331
329
|
throw new Error(`Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`);
|
|
332
330
|
}
|
|
333
|
-
})(record !== null)
|
|
331
|
+
})(record !== null);
|
|
334
332
|
return record;
|
|
335
333
|
}
|
|
336
334
|
|
|
@@ -370,11 +368,11 @@ class Snapshot {
|
|
|
370
368
|
if (keyName in this._attributes) {
|
|
371
369
|
return this._attributes[keyName];
|
|
372
370
|
}
|
|
373
|
-
|
|
371
|
+
(test => {
|
|
374
372
|
{
|
|
375
373
|
throw new Error(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`);
|
|
376
374
|
}
|
|
377
|
-
})()
|
|
375
|
+
})();
|
|
378
376
|
}
|
|
379
377
|
|
|
380
378
|
/**
|
|
@@ -461,31 +459,31 @@ class Snapshot {
|
|
|
461
459
|
const relationshipMeta = store.schema.fields({
|
|
462
460
|
type: this.modelName
|
|
463
461
|
}).get(keyName);
|
|
464
|
-
|
|
462
|
+
(test => {
|
|
465
463
|
if (!test) {
|
|
466
464
|
throw new Error(`Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`);
|
|
467
465
|
}
|
|
468
|
-
})(relationshipMeta && relationshipMeta.kind === 'belongsTo')
|
|
469
|
-
|
|
466
|
+
})(relationshipMeta && relationshipMeta.kind === 'belongsTo');
|
|
467
|
+
(test => {
|
|
470
468
|
if (!test) {
|
|
471
469
|
throw new Error(`snapshot.belongsTo only supported when using a cache that supports the graph`);
|
|
472
470
|
}
|
|
473
|
-
})(this._store._graph)
|
|
471
|
+
})(this._store._graph);
|
|
474
472
|
const {
|
|
475
473
|
identifier
|
|
476
474
|
} = this;
|
|
477
|
-
|
|
475
|
+
{
|
|
478
476
|
const relationship = this._store.schema.fields(identifier)?.get(keyName);
|
|
479
|
-
|
|
477
|
+
(test => {
|
|
480
478
|
if (!test) {
|
|
481
479
|
throw new Error(`You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but no such relationship was found.`);
|
|
482
480
|
}
|
|
483
|
-
})(relationship)
|
|
484
|
-
|
|
481
|
+
})(relationship);
|
|
482
|
+
(test => {
|
|
485
483
|
if (!test) {
|
|
486
484
|
throw new Error(`You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but that relationship is a hasMany.`);
|
|
487
485
|
}
|
|
488
|
-
})(relationship.kind === 'belongsTo')
|
|
486
|
+
})(relationship.kind === 'belongsTo');
|
|
489
487
|
}
|
|
490
488
|
const value = this._store.cache.getRelationship(identifier, keyName);
|
|
491
489
|
const data = value && value.data;
|
|
@@ -545,37 +543,37 @@ class Snapshot {
|
|
|
545
543
|
const relationshipMeta = store.schema.fields({
|
|
546
544
|
type: this.modelName
|
|
547
545
|
}).get(keyName);
|
|
548
|
-
|
|
546
|
+
(test => {
|
|
549
547
|
if (!test) {
|
|
550
548
|
throw new Error(`Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`);
|
|
551
549
|
}
|
|
552
|
-
})(relationshipMeta && relationshipMeta.kind === 'hasMany')
|
|
550
|
+
})(relationshipMeta && relationshipMeta.kind === 'hasMany');
|
|
553
551
|
|
|
554
552
|
// TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes
|
|
555
553
|
// this check is not a regression in behavior because relationships don't currently
|
|
556
554
|
// function without access to intimate API contracts between RecordData and Model.
|
|
557
555
|
// This is a requirement we should fix as soon as the relationship layer does not require
|
|
558
556
|
// this intimate API usage.
|
|
559
|
-
|
|
557
|
+
(test => {
|
|
560
558
|
if (!test) {
|
|
561
559
|
throw new Error(`snapshot.hasMany only supported when using a cache that supports the graph`);
|
|
562
560
|
}
|
|
563
|
-
})(this._store._graph)
|
|
561
|
+
})(this._store._graph);
|
|
564
562
|
const {
|
|
565
563
|
identifier
|
|
566
564
|
} = this;
|
|
567
|
-
|
|
565
|
+
{
|
|
568
566
|
const relationship = this._store.schema.fields(identifier)?.get(keyName);
|
|
569
|
-
|
|
567
|
+
(test => {
|
|
570
568
|
if (!test) {
|
|
571
569
|
throw new Error(`You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but no such relationship was found.`);
|
|
572
570
|
}
|
|
573
|
-
})(relationship)
|
|
574
|
-
|
|
571
|
+
})(relationship);
|
|
572
|
+
(test => {
|
|
575
573
|
if (!test) {
|
|
576
574
|
throw new Error(`You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but that relationship is a belongsTo.`);
|
|
577
575
|
}
|
|
578
|
-
})(relationship.kind === 'hasMany')
|
|
576
|
+
})(relationship.kind === 'hasMany');
|
|
579
577
|
}
|
|
580
578
|
const value = this._store.cache.getRelationship(identifier, keyName);
|
|
581
579
|
if (value.data) {
|
|
@@ -683,11 +681,11 @@ class Snapshot {
|
|
|
683
681
|
serialize(options) {
|
|
684
682
|
upgradeStore(this._store);
|
|
685
683
|
const serializer = this._store.serializerFor(this.modelName);
|
|
686
|
-
|
|
684
|
+
(test => {
|
|
687
685
|
if (!test) {
|
|
688
686
|
throw new Error(`Cannot serialize record, no serializer found`);
|
|
689
687
|
}
|
|
690
|
-
})(serializer)
|
|
688
|
+
})(serializer);
|
|
691
689
|
return serializer.serialize(this, options);
|
|
692
690
|
}
|
|
693
691
|
}
|
|
@@ -789,11 +787,11 @@ class FetchManager {
|
|
|
789
787
|
}
|
|
790
788
|
return identifier;
|
|
791
789
|
}, error => {
|
|
792
|
-
|
|
790
|
+
(test => {
|
|
793
791
|
if (!test) {
|
|
794
792
|
throw new Error(`Async Leak Detected: Expected the store to not be destroyed`);
|
|
795
793
|
}
|
|
796
|
-
})(!store.isDestroyed)
|
|
794
|
+
})(!store.isDestroyed);
|
|
797
795
|
const cache = store.cache;
|
|
798
796
|
if (!cache || cache.isEmpty(identifier) || isInitialLoad) {
|
|
799
797
|
let isReleasable = true;
|
|
@@ -831,7 +829,7 @@ class FetchManager {
|
|
|
831
829
|
fetchesById.set(identifier, requestsForIdentifier);
|
|
832
830
|
}
|
|
833
831
|
requestsForIdentifier.push(pendingFetchItem);
|
|
834
|
-
|
|
832
|
+
{
|
|
835
833
|
if (!request.disableTestWaiter) {
|
|
836
834
|
promise = waitFor(promise);
|
|
837
835
|
}
|
|
@@ -865,21 +863,18 @@ class FetchManager {
|
|
|
865
863
|
let promise;
|
|
866
864
|
if (isEmpty) {
|
|
867
865
|
assertIdentifierHasId(identifier);
|
|
868
|
-
|
|
866
|
+
{
|
|
869
867
|
promise = this.scheduleFetch(identifier, Object.assign({}, options, {
|
|
870
868
|
reload: true
|
|
871
869
|
}), request);
|
|
872
|
-
} else {
|
|
873
|
-
options.reload = true;
|
|
874
|
-
promise = this.scheduleFetch(identifier, options, request);
|
|
875
870
|
}
|
|
876
871
|
} else if (isLoading) {
|
|
877
872
|
promise = this.getPendingFetch(identifier, options);
|
|
878
|
-
|
|
873
|
+
(test => {
|
|
879
874
|
if (!test) {
|
|
880
875
|
throw new Error(`Expected to find a pending request for a record in the loading state, but found none`);
|
|
881
876
|
}
|
|
882
|
-
})(promise)
|
|
877
|
+
})(promise);
|
|
883
878
|
} else {
|
|
884
879
|
promise = Promise.resolve(identifier);
|
|
885
880
|
}
|
|
@@ -956,31 +951,31 @@ function _findMany(store, adapter, modelName, snapshots) {
|
|
|
956
951
|
const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still
|
|
957
952
|
const promise = Promise.resolve().then(() => {
|
|
958
953
|
const ids = snapshots.map(s => s.id);
|
|
959
|
-
|
|
954
|
+
(test => {
|
|
960
955
|
if (!test) {
|
|
961
956
|
throw new Error(`Cannot fetch a record without an id`);
|
|
962
957
|
}
|
|
963
|
-
})(ids.every(v => v !== null))
|
|
958
|
+
})(ids.every(v => v !== null));
|
|
964
959
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
965
|
-
|
|
960
|
+
(test => {
|
|
966
961
|
if (!test) {
|
|
967
962
|
throw new Error(`Expected this adapter to implement findMany for coalescing`);
|
|
968
963
|
}
|
|
969
|
-
})(adapter.findMany)
|
|
964
|
+
})(adapter.findMany);
|
|
970
965
|
const ret = adapter.findMany(store, modelClass, ids, snapshots);
|
|
971
|
-
|
|
966
|
+
(test => {
|
|
972
967
|
if (!test) {
|
|
973
968
|
throw new Error('adapter.findMany returned undefined, this was very likely a mistake');
|
|
974
969
|
}
|
|
975
|
-
})(ret !== undefined)
|
|
970
|
+
})(ret !== undefined);
|
|
976
971
|
return ret;
|
|
977
972
|
});
|
|
978
973
|
return promise.then(adapterPayload => {
|
|
979
|
-
|
|
974
|
+
(test => {
|
|
980
975
|
if (!test) {
|
|
981
976
|
throw new Error(`You made a 'findMany' request for '${modelName}' records with ids '[${snapshots.map(s => s.id).join(',')}]', but the adapter's response did not have any data`);
|
|
982
977
|
}
|
|
983
|
-
})(!!payloadIsNotBlank(adapterPayload))
|
|
978
|
+
})(!!payloadIsNotBlank(adapterPayload));
|
|
984
979
|
const serializer = store.serializerFor(modelName);
|
|
985
980
|
const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');
|
|
986
981
|
return payload;
|
|
@@ -1051,7 +1046,7 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
1051
1046
|
snapshotsById.forEach(snapshotArray => {
|
|
1052
1047
|
rejected.push(...snapshotArray);
|
|
1053
1048
|
});
|
|
1054
|
-
warn('Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ "' + [...snapshotsById.values()].map(r => r[0].id).join('", "') + '" ]', {
|
|
1049
|
+
console.warn('Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ "' + [...snapshotsById.values()].map(r => r[0].id).join('", "') + '" ]', {
|
|
1055
1050
|
id: 'ds.store.missing-records-from-adapter'
|
|
1056
1051
|
});
|
|
1057
1052
|
rejectFetchedItems(fetchMap, rejected);
|
|
@@ -1059,16 +1054,16 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
1059
1054
|
function _fetchRecord(store, adapter, fetchItem) {
|
|
1060
1055
|
const identifier = fetchItem.identifier;
|
|
1061
1056
|
const modelName = identifier.type;
|
|
1062
|
-
|
|
1057
|
+
(test => {
|
|
1063
1058
|
if (!test) {
|
|
1064
1059
|
throw new Error(`You tried to find a record but you have no adapter (for ${modelName})`);
|
|
1065
1060
|
}
|
|
1066
|
-
})(adapter)
|
|
1067
|
-
|
|
1061
|
+
})(adapter);
|
|
1062
|
+
(test => {
|
|
1068
1063
|
if (!test) {
|
|
1069
1064
|
throw new Error(`You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`);
|
|
1070
1065
|
}
|
|
1071
|
-
})(typeof adapter.findRecord === 'function')
|
|
1066
|
+
})(typeof adapter.findRecord === 'function');
|
|
1072
1067
|
const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);
|
|
1073
1068
|
const klass = store.modelFor(identifier.type);
|
|
1074
1069
|
const id = identifier.id;
|
|
@@ -1076,29 +1071,29 @@ function _fetchRecord(store, adapter, fetchItem) {
|
|
|
1076
1071
|
return adapter.findRecord(store, klass, identifier.id, snapshot);
|
|
1077
1072
|
});
|
|
1078
1073
|
promise = promise.then(adapterPayload => {
|
|
1079
|
-
|
|
1074
|
+
(test => {
|
|
1080
1075
|
if (!test) {
|
|
1081
1076
|
throw new Error(`Async Leak Detected: Expected the store to not be destroyed`);
|
|
1082
1077
|
}
|
|
1083
|
-
})(!(store.isDestroyed || store.isDestroying))
|
|
1084
|
-
|
|
1078
|
+
})(!(store.isDestroyed || store.isDestroying));
|
|
1079
|
+
(test => {
|
|
1085
1080
|
if (!test) {
|
|
1086
1081
|
throw new Error(`You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`);
|
|
1087
1082
|
}
|
|
1088
|
-
})(!!payloadIsNotBlank(adapterPayload))
|
|
1083
|
+
})(!!payloadIsNotBlank(adapterPayload));
|
|
1089
1084
|
const serializer = store.serializerFor(modelName);
|
|
1090
1085
|
const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');
|
|
1091
|
-
|
|
1086
|
+
(test => {
|
|
1092
1087
|
if (!test) {
|
|
1093
1088
|
throw new Error(`Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`);
|
|
1094
1089
|
}
|
|
1095
|
-
})(!Array.isArray(payload.data))
|
|
1096
|
-
|
|
1090
|
+
})(!Array.isArray(payload.data));
|
|
1091
|
+
(test => {
|
|
1097
1092
|
if (!test) {
|
|
1098
1093
|
throw new Error(`The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`);
|
|
1099
1094
|
}
|
|
1100
|
-
})('data' in payload && payload.data !== null && typeof payload.data === 'object')
|
|
1101
|
-
warn(`You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`, coerceId(payload.data.id) === coerceId(id), {
|
|
1095
|
+
})('data' in payload && payload.data !== null && typeof payload.data === 'object');
|
|
1096
|
+
console.warn(`You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`, coerceId(payload.data.id) === coerceId(id), {
|
|
1102
1097
|
id: 'ds.store.findRecord.id-mismatch'
|
|
1103
1098
|
});
|
|
1104
1099
|
return payload;
|
|
@@ -1115,11 +1110,11 @@ function _processCoalescedGroup(store, fetchMap, group, adapter, modelName) {
|
|
|
1115
1110
|
} else if (group.length === 1) {
|
|
1116
1111
|
_fetchRecord(store, adapter, fetchMap.get(group[0]));
|
|
1117
1112
|
} else {
|
|
1118
|
-
|
|
1113
|
+
(test => {
|
|
1119
1114
|
{
|
|
1120
1115
|
throw new Error("You cannot return an empty array from adapter's method groupRecordsForFindMany");
|
|
1121
1116
|
}
|
|
1122
|
-
})()
|
|
1117
|
+
})();
|
|
1123
1118
|
}
|
|
1124
1119
|
}
|
|
1125
1120
|
function _flushPendingFetchForType(store, pendingFetchMap, modelName) {
|
|
@@ -1175,23 +1170,23 @@ function _flushPendingSave(store, pending) {
|
|
|
1175
1170
|
const operation = options[SaveOp];
|
|
1176
1171
|
const modelName = snapshot.modelName;
|
|
1177
1172
|
const modelClass = store.modelFor(modelName);
|
|
1178
|
-
|
|
1173
|
+
(test => {
|
|
1179
1174
|
if (!test) {
|
|
1180
1175
|
throw new Error(`You tried to update a record but you have no adapter (for ${modelName})`);
|
|
1181
1176
|
}
|
|
1182
|
-
})(adapter)
|
|
1183
|
-
|
|
1177
|
+
})(adapter);
|
|
1178
|
+
(test => {
|
|
1184
1179
|
if (!test) {
|
|
1185
1180
|
throw new Error(`You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`);
|
|
1186
1181
|
}
|
|
1187
|
-
})(typeof adapter[operation] === 'function')
|
|
1182
|
+
})(typeof adapter[operation] === 'function');
|
|
1188
1183
|
let promise = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));
|
|
1189
1184
|
const serializer = store.serializerFor(modelName);
|
|
1190
|
-
|
|
1185
|
+
(test => {
|
|
1191
1186
|
if (!test) {
|
|
1192
1187
|
throw new Error(`Your adapter's '${operation}' method must return a value, but it returned 'undefined'`);
|
|
1193
1188
|
}
|
|
1194
|
-
})(promise !== undefined)
|
|
1189
|
+
})(promise !== undefined);
|
|
1195
1190
|
promise = promise.then(adapterPayload => {
|
|
1196
1191
|
if (adapterPayload) {
|
|
1197
1192
|
return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-
|
|
1
|
+
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-CPAZXrQU.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
2
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
2
|
|
|
4
3
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
5
4
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -103,11 +102,11 @@ function extendFn(ErrorClass) {
|
|
|
103
102
|
}
|
|
104
103
|
function extend(ParentErrorClass, defaultMessage) {
|
|
105
104
|
const ErrorClass = function (errors, message) {
|
|
106
|
-
|
|
105
|
+
(test => {
|
|
107
106
|
if (!test) {
|
|
108
107
|
throw new Error('`AdapterError` expects json-api formatted errors array.');
|
|
109
108
|
}
|
|
110
|
-
})(Array.isArray(errors || []))
|
|
109
|
+
})(Array.isArray(errors || []));
|
|
111
110
|
ParentErrorClass.call(this, errors, message || defaultMessage);
|
|
112
111
|
};
|
|
113
112
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
@@ -1,11 +1,150 @@
|
|
|
1
1
|
import { dasherize, pluralize } from '@warp-drive/utilities/string';
|
|
2
|
-
import
|
|
3
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
4
|
-
import { b as serializeIntoHash } from "../serialize-into-hash-BnYvPex3.js";
|
|
2
|
+
import { b as serializeIntoHash } from "../serialize-into-hash-CPAZXrQU.js";
|
|
5
3
|
import { RESTAdapter } from './rest.js';
|
|
6
4
|
|
|
7
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
6
|
|
|
7
|
+
/**
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
:::danger
|
|
11
|
+
⚠️ **This is LEGACY documentation** for a feature that is no longer encouraged to be used.
|
|
12
|
+
If starting a new app or thinking of implementing a new adapter, consider writing a
|
|
13
|
+
{@link Handler} instead to be used with the {@link RequestManager}
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
The `JSONAPIAdapter` is an adapter whichtransforms the store's
|
|
17
|
+
requests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).
|
|
18
|
+
|
|
19
|
+
## JSON API Conventions
|
|
20
|
+
|
|
21
|
+
The JSONAPIAdapter uses JSON API conventions for building the URL
|
|
22
|
+
for a record and selecting the HTTP verb to use with a request. The
|
|
23
|
+
actions you can take on a record map onto the following URLs in the
|
|
24
|
+
JSON API adapter:
|
|
25
|
+
|
|
26
|
+
<table>
|
|
27
|
+
<tr>
|
|
28
|
+
<th>
|
|
29
|
+
Action
|
|
30
|
+
</th>
|
|
31
|
+
<th>
|
|
32
|
+
HTTP Verb
|
|
33
|
+
</th>
|
|
34
|
+
<th>
|
|
35
|
+
URL
|
|
36
|
+
</th>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr>
|
|
39
|
+
<th>
|
|
40
|
+
`store.findRecord('post', 123)`
|
|
41
|
+
</th>
|
|
42
|
+
<td>
|
|
43
|
+
GET
|
|
44
|
+
</td>
|
|
45
|
+
<td>
|
|
46
|
+
/posts/123
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<th>
|
|
51
|
+
`store.findAll('post')`
|
|
52
|
+
</th>
|
|
53
|
+
<td>
|
|
54
|
+
GET
|
|
55
|
+
</td>
|
|
56
|
+
<td>
|
|
57
|
+
/posts
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
<tr>
|
|
61
|
+
<th>
|
|
62
|
+
Update `postRecord.save()`
|
|
63
|
+
</th>
|
|
64
|
+
<td>
|
|
65
|
+
PATCH
|
|
66
|
+
</td>
|
|
67
|
+
<td>
|
|
68
|
+
/posts/123
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
<tr>
|
|
72
|
+
<th>
|
|
73
|
+
Create `store.createRecord('post').save()`
|
|
74
|
+
</th>
|
|
75
|
+
<td>
|
|
76
|
+
POST
|
|
77
|
+
</td>
|
|
78
|
+
<td>
|
|
79
|
+
/posts
|
|
80
|
+
</td>
|
|
81
|
+
</tr>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>
|
|
84
|
+
Delete `postRecord.destroyRecord()`
|
|
85
|
+
</th>
|
|
86
|
+
<td>
|
|
87
|
+
DELETE
|
|
88
|
+
</td>
|
|
89
|
+
<td>
|
|
90
|
+
/posts/123
|
|
91
|
+
</td>
|
|
92
|
+
</tr>
|
|
93
|
+
</table>
|
|
94
|
+
|
|
95
|
+
## Success and failure
|
|
96
|
+
|
|
97
|
+
The JSONAPIAdapter will consider a success any response with a
|
|
98
|
+
status code of the 2xx family ("Success"), as well as 304 ("Not
|
|
99
|
+
Modified"). Any other status code will be considered a failure.
|
|
100
|
+
|
|
101
|
+
On success, the request promise will be resolved with the full
|
|
102
|
+
response payload.
|
|
103
|
+
|
|
104
|
+
Failed responses with status code 422 ("Unprocessable Entity") will
|
|
105
|
+
be considered "invalid". The response will be discarded, except for
|
|
106
|
+
the `errors` key. The request promise will be rejected with a
|
|
107
|
+
`InvalidError`. This error object will encapsulate the saved
|
|
108
|
+
`errors` value.
|
|
109
|
+
|
|
110
|
+
Any other status codes will be treated as an adapter error. The
|
|
111
|
+
request promise will be rejected, similarly to the invalid case,
|
|
112
|
+
but with an instance of `AdapterError` instead.
|
|
113
|
+
|
|
114
|
+
### Endpoint path customization
|
|
115
|
+
|
|
116
|
+
Endpoint paths can be prefixed with a `namespace` by setting the
|
|
117
|
+
namespace property on the adapter:
|
|
118
|
+
|
|
119
|
+
```js [app/adapters/application.js]
|
|
120
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
121
|
+
|
|
122
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
123
|
+
namespace = 'api/1';
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
Requests for the `person` model would now target `/api/1/people/1`.
|
|
127
|
+
|
|
128
|
+
### Host customization
|
|
129
|
+
|
|
130
|
+
An adapter can target other hosts by setting the `host` property.
|
|
131
|
+
|
|
132
|
+
```js [app/adapters/application.js]
|
|
133
|
+
import JSONAPIAdapter from '@warp-drive/legacy/adapter/json-api';
|
|
134
|
+
|
|
135
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
136
|
+
host = 'https://api.example.com';
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Requests for the `person` model would now target
|
|
141
|
+
`https://api.example.com/people/1`.
|
|
142
|
+
|
|
143
|
+
@since 1.13.0
|
|
144
|
+
@class JSONAPIAdapter
|
|
145
|
+
@public
|
|
146
|
+
@constructor
|
|
147
|
+
*/
|
|
9
148
|
class JSONAPIAdapter extends RESTAdapter {
|
|
10
149
|
_defaultContentType = 'application/vnd.api+json';
|
|
11
150
|
|
|
@@ -96,11 +235,11 @@ class JSONAPIAdapter extends RESTAdapter {
|
|
|
96
235
|
const data = serializeIntoHash(store, schema, snapshot);
|
|
97
236
|
const type = snapshot.modelName;
|
|
98
237
|
const id = snapshot.id;
|
|
99
|
-
|
|
238
|
+
(test => {
|
|
100
239
|
if (!test) {
|
|
101
240
|
throw new Error(`Attempted to update the ${type} record, but the record has no id`);
|
|
102
241
|
}
|
|
103
|
-
})(typeof id === 'string' && id.length > 0)
|
|
242
|
+
})(typeof id === 'string' && id.length > 0);
|
|
104
243
|
const url = this.buildURL(type, id, snapshot, 'updateRecord');
|
|
105
244
|
return this.ajax(url, 'PATCH', {
|
|
106
245
|
data: data
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { getOwner } from '@ember/application';
|
|
2
|
-
import { warn } from '@ember/debug';
|
|
3
2
|
import { computed } from '@ember/object';
|
|
4
3
|
import { Adapter, BuildURLMixin } from '../adapter.js';
|
|
5
|
-
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-
|
|
4
|
+
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-CPAZXrQU.js";
|
|
6
5
|
import { InvalidError, ServerError, ConflictError, NotFoundError, ForbiddenError, UnauthorizedError, AdapterError, TimeoutError, AbortError } from './error.js';
|
|
7
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
8
6
|
import { d as decorateMethodV2 } from "../runtime-BPCpkOf1-BKOwiRJp.js";
|
|
9
7
|
|
|
10
8
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -569,11 +567,11 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
569
567
|
findHasMany(store, snapshot, url, relationship) {
|
|
570
568
|
const id = snapshot.id;
|
|
571
569
|
const type = snapshot.modelName;
|
|
572
|
-
|
|
570
|
+
(test => {
|
|
573
571
|
if (!test) {
|
|
574
572
|
throw new Error(`Attempted to fetch the hasMany relationship for ${type}, but the record has no id`);
|
|
575
573
|
}
|
|
576
|
-
})(typeof id === 'string' && id.length > 0)
|
|
574
|
+
})(typeof id === 'string' && id.length > 0);
|
|
577
575
|
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findHasMany'));
|
|
578
576
|
return this.ajax(url, 'GET');
|
|
579
577
|
}
|
|
@@ -603,11 +601,11 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
603
601
|
findBelongsTo(store, snapshot, url, relationship) {
|
|
604
602
|
const id = snapshot.id;
|
|
605
603
|
const type = snapshot.modelName;
|
|
606
|
-
|
|
604
|
+
(test => {
|
|
607
605
|
if (!test) {
|
|
608
606
|
throw new Error(`Attempted to fetch the belongsTo relationship for ${type}, but the record has no id`);
|
|
609
607
|
}
|
|
610
|
-
})(typeof id === 'string' && id.length > 0)
|
|
608
|
+
})(typeof id === 'string' && id.length > 0);
|
|
611
609
|
url = this.urlPrefix(url, this.buildURL(type, id, snapshot, 'findBelongsTo'));
|
|
612
610
|
return this.ajax(url, 'GET');
|
|
613
611
|
}
|
|
@@ -650,11 +648,11 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
650
648
|
const data = serializeIntoHash(store, schema, snapshot, {});
|
|
651
649
|
const type = snapshot.modelName;
|
|
652
650
|
const id = snapshot.id;
|
|
653
|
-
|
|
651
|
+
(test => {
|
|
654
652
|
if (!test) {
|
|
655
653
|
throw new Error(`Attempted to update the ${type} record, but the record has no id`);
|
|
656
654
|
}
|
|
657
|
-
})(typeof id === 'string' && id.length > 0)
|
|
655
|
+
})(typeof id === 'string' && id.length > 0);
|
|
658
656
|
const url = this.buildURL(type, id, snapshot, 'updateRecord');
|
|
659
657
|
return this.ajax(url, 'PUT', {
|
|
660
658
|
data
|
|
@@ -673,21 +671,21 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
673
671
|
deleteRecord(store, schema, snapshot) {
|
|
674
672
|
const type = snapshot.modelName;
|
|
675
673
|
const id = snapshot.id;
|
|
676
|
-
|
|
674
|
+
(test => {
|
|
677
675
|
if (!test) {
|
|
678
676
|
throw new Error(`Attempted to delete the ${type} record, but the record has no id`);
|
|
679
677
|
}
|
|
680
|
-
})(typeof id === 'string' && id.length > 0)
|
|
678
|
+
})(typeof id === 'string' && id.length > 0);
|
|
681
679
|
return this.ajax(this.buildURL(type, id, snapshot, 'deleteRecord'), 'DELETE');
|
|
682
680
|
}
|
|
683
681
|
_stripIDFromURL(store, snapshot) {
|
|
684
682
|
const type = snapshot.modelName;
|
|
685
683
|
const id = snapshot.id;
|
|
686
|
-
|
|
684
|
+
(test => {
|
|
687
685
|
if (!test) {
|
|
688
686
|
throw new Error(`Attempted to strip the url from the ${type} record for coalescing, but the record has no id`);
|
|
689
687
|
}
|
|
690
|
-
})(typeof id === 'string' && id.length > 0)
|
|
688
|
+
})(typeof id === 'string' && id.length > 0);
|
|
691
689
|
const url = this.buildURL(type, id, snapshot);
|
|
692
690
|
const expandedURL = url.split('/');
|
|
693
691
|
// Case when the url is of the format ...something/:id
|
|
@@ -868,11 +866,11 @@ class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
868
866
|
@param {Object} options jQuery ajax options to be used for the ajax request
|
|
869
867
|
*/
|
|
870
868
|
_ajaxRequest(options) {
|
|
871
|
-
|
|
869
|
+
(test => {
|
|
872
870
|
if (!test) {
|
|
873
871
|
throw new Error('You must install jQuery globally when `useFetch` is false');
|
|
874
872
|
}
|
|
875
|
-
})(typeof jQuery !== 'undefined')
|
|
873
|
+
})(typeof jQuery !== 'undefined');
|
|
876
874
|
void jQuery.ajax(options);
|
|
877
875
|
}
|
|
878
876
|
_fetchRequest(options) {
|
|
@@ -1133,10 +1131,10 @@ function ajaxErrorHandler(adapter, jqXHR, errorThrown, requestData) {
|
|
|
1133
1131
|
const responseData = ajaxResponseData(jqXHR);
|
|
1134
1132
|
responseData.errorThrown = errorThrown;
|
|
1135
1133
|
const payload = adapter.parseErrorResponse(jqXHR.responseText);
|
|
1136
|
-
|
|
1134
|
+
{
|
|
1137
1135
|
const message = `The server returned an empty string for ${requestData.method} ${requestData.url}, which cannot be parsed into a valid JSON. Return either null or {}.`;
|
|
1138
1136
|
const validJSONString = !(responseData.textStatus === 'parsererror' && payload === '');
|
|
1139
|
-
warn(message, validJSONString, {
|
|
1137
|
+
console.warn(message, validJSONString, {
|
|
1140
1138
|
id: 'ds.adapter.returned-empty-string-as-JSON'
|
|
1141
1139
|
});
|
|
1142
1140
|
}
|