@warp-drive/legacy 5.9.0-beta.0 → 5.9.0-beta.2
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/README.md +6 -0
- package/dist/-private-DQ6Iap2t.js +193 -0
- package/dist/-private-DQ6Iap2t.js.map +1 -0
- package/dist/-private-DccRZQsm.js +904 -0
- package/dist/-private-DccRZQsm.js.map +1 -0
- package/dist/adapter/-private.d.ts +33 -0
- package/dist/adapter/-private.d.ts.map +1 -0
- package/dist/adapter/-private.js +3 -1
- package/dist/adapter/error.d.ts +2 -0
- package/dist/adapter/error.js +425 -311
- package/dist/adapter/error.js.map +1 -0
- package/{declarations → dist}/adapter/json-api.d.ts +31 -19
- package/dist/adapter/json-api.d.ts.map +1 -0
- package/dist/adapter/json-api.js +265 -131
- package/dist/adapter/json-api.js.map +1 -0
- package/dist/adapter/rest.d.ts +2 -0
- package/dist/adapter/rest.js +937 -1100
- package/dist/adapter/rest.js.map +1 -0
- package/dist/adapter-CARrK3-8.d.ts +784 -0
- package/dist/adapter-CARrK3-8.d.ts.map +1 -0
- package/dist/adapter-eYo2pIuM.js +1130 -0
- package/dist/adapter-eYo2pIuM.js.map +1 -0
- package/dist/adapter.d.ts +2 -0
- package/dist/adapter.js +1 -1251
- package/dist/compat/-private.d.ts +2 -0
- package/dist/compat/-private.js +3 -1
- package/dist/compat/builders.d.ts +169 -0
- package/dist/compat/builders.d.ts.map +1 -0
- package/dist/compat/builders.js +205 -246
- package/dist/compat/builders.js.map +1 -0
- package/dist/compat/extensions.d.ts +2 -0
- package/dist/compat/extensions.js +271 -233
- package/dist/compat/extensions.js.map +1 -0
- package/dist/compat/utils.d.ts +151 -0
- package/dist/compat/utils.d.ts.map +1 -0
- package/dist/compat/utils.js +189 -194
- package/dist/compat/utils.js.map +1 -0
- package/dist/compat-BbNNmTM-.d.ts +1386 -0
- package/dist/compat-BbNNmTM-.d.ts.map +1 -0
- package/dist/compat-DcHVxuuZ.js +734 -0
- package/dist/compat-DcHVxuuZ.js.map +1 -0
- package/dist/compat.d.ts +2 -0
- package/dist/compat.js +1 -1019
- package/dist/error-CzkyXr1Q.d.ts +435 -0
- package/dist/error-CzkyXr1Q.d.ts.map +1 -0
- package/dist/errors-BEEsrHbl.js +2134 -0
- package/dist/errors-BEEsrHbl.js.map +1 -0
- package/dist/extensions-DumNm4dA.d.ts +102 -0
- package/dist/extensions-DumNm4dA.d.ts.map +1 -0
- package/dist/index.d.ts +243 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +271 -188
- package/dist/index.js.map +1 -0
- package/dist/json-BXNPTlcH.js +1106 -0
- package/dist/json-BXNPTlcH.js.map +1 -0
- package/dist/model/-private.d.ts +3 -0
- package/dist/model/-private.js +3 -1
- package/dist/model/migration-support.d.ts +335 -0
- package/dist/model/migration-support.d.ts.map +1 -0
- package/dist/model/migration-support.js +506 -564
- package/dist/model/migration-support.js.map +1 -0
- package/dist/model-62hn5_PD.d.ts +3107 -0
- package/dist/model-62hn5_PD.d.ts.map +1 -0
- package/dist/model-DcXZdNMu.js +683 -0
- package/dist/model-DcXZdNMu.js.map +1 -0
- package/dist/model-fragments-DSqu0ptR.js +334 -0
- package/dist/model-fragments-DSqu0ptR.js.map +1 -0
- package/dist/model-fragments.d.ts +294 -0
- package/dist/model-fragments.d.ts.map +1 -0
- package/dist/model-fragments.js +2 -75
- package/dist/model.d.ts +404 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +3 -666
- package/{declarations/adapter/rest.d.ts → dist/rest-0NhtexIq.d.ts} +187 -103
- package/dist/rest-0NhtexIq.d.ts.map +1 -0
- package/dist/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
- package/dist/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
- package/dist/schema-provider-H4zNXtry.js +1929 -0
- package/dist/schema-provider-H4zNXtry.js.map +1 -0
- package/{declarations → dist}/serializer/json-api.d.ts +4 -1
- package/dist/serializer/json-api.d.ts.map +1 -0
- package/dist/serializer/json-api.js +527 -514
- package/dist/serializer/json-api.js.map +1 -0
- package/{declarations → dist}/serializer/json.d.ts +3 -0
- package/dist/serializer/json.d.ts.map +1 -0
- package/dist/serializer/json.js +3 -6
- package/{declarations/serializer/-private/embedded-records-mixin.d.ts → dist/serializer/rest.d.ts} +56 -1
- package/dist/serializer/rest.d.ts.map +1 -0
- package/dist/serializer/rest.js +958 -1200
- package/dist/serializer/rest.js.map +1 -0
- package/dist/serializer/transform.d.ts +313 -0
- package/dist/serializer/transform.d.ts.map +1 -0
- package/dist/serializer/transform.js +283 -260
- package/dist/serializer/transform.js.map +1 -0
- package/dist/serializer.d.ts +151 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +205 -208
- package/dist/serializer.js.map +1 -0
- package/dist/store-C4qYzXei.js +473 -0
- package/dist/store-C4qYzXei.js.map +1 -0
- package/dist/store.d.ts +13 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +1 -635
- package/dist/unpkg/dev/-private-CrEyBE-B.js +189 -0
- package/dist/unpkg/dev/-private-CrEyBE-B.js.map +1 -0
- package/dist/unpkg/dev/-private-vOhxVExH.js +896 -0
- package/dist/unpkg/dev/-private-vOhxVExH.js.map +1 -0
- package/dist/unpkg/dev/adapter/-private.js +3 -1
- package/dist/unpkg/dev/adapter/error.js +424 -310
- package/dist/unpkg/dev/adapter/error.js.map +1 -0
- package/dist/unpkg/dev/adapter/json-api.js +239 -245
- package/dist/unpkg/dev/adapter/json-api.js.map +1 -0
- package/dist/unpkg/dev/adapter/rest.js +935 -1098
- package/dist/unpkg/dev/adapter/rest.js.map +1 -0
- package/dist/unpkg/dev/adapter-oLwyr47q.js +1129 -0
- package/dist/unpkg/dev/adapter-oLwyr47q.js.map +1 -0
- package/dist/unpkg/dev/adapter.js +1 -1250
- package/dist/unpkg/dev/compat/-private.js +3 -1
- package/dist/unpkg/dev/compat/builders.js +204 -248
- package/dist/unpkg/dev/compat/builders.js.map +1 -0
- package/dist/unpkg/dev/compat/extensions.js +270 -232
- package/dist/unpkg/dev/compat/extensions.js.map +1 -0
- package/dist/unpkg/dev/compat/utils.js +188 -193
- package/dist/unpkg/dev/compat/utils.js.map +1 -0
- package/dist/unpkg/dev/compat-D48B8sXv.js +825 -0
- package/dist/unpkg/dev/compat-D48B8sXv.js.map +1 -0
- package/dist/unpkg/dev/compat.js +1 -1145
- package/dist/unpkg/dev/errors-8GnRWcxo.js +2127 -0
- package/dist/unpkg/dev/errors-8GnRWcxo.js.map +1 -0
- package/dist/unpkg/dev/index.js +270 -190
- package/dist/unpkg/dev/index.js.map +1 -0
- package/dist/unpkg/dev/json-DDJji3V3.js +1104 -0
- package/dist/unpkg/dev/json-DDJji3V3.js.map +1 -0
- package/dist/unpkg/dev/model/-private.js +3 -1
- package/dist/unpkg/dev/model/migration-support.js +483 -537
- package/dist/unpkg/dev/model/migration-support.js.map +1 -0
- package/dist/unpkg/dev/model-LK7ethC5.js +655 -0
- package/dist/unpkg/dev/model-LK7ethC5.js.map +1 -0
- package/dist/unpkg/dev/model-fragments-DSqu0ptR.js +334 -0
- package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +1 -0
- package/dist/unpkg/dev/model-fragments.js +2 -75
- package/dist/unpkg/dev/model.js +3 -677
- package/dist/unpkg/dev/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
- package/dist/unpkg/dev/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
- package/dist/unpkg/dev/schema-provider-CRzoMoTO.js +1834 -0
- package/dist/unpkg/dev/schema-provider-CRzoMoTO.js.map +1 -0
- package/dist/unpkg/dev/serializer/json-api.js +514 -629
- package/dist/unpkg/dev/serializer/json-api.js.map +1 -0
- package/dist/unpkg/dev/serializer/json.js +3 -4
- package/dist/unpkg/dev/serializer/rest.js +954 -1197
- package/dist/unpkg/dev/serializer/rest.js.map +1 -0
- package/dist/unpkg/dev/serializer/transform.js +283 -260
- package/dist/unpkg/dev/serializer/transform.js.map +1 -0
- package/dist/unpkg/dev/serializer.js +205 -208
- package/dist/unpkg/dev/serializer.js.map +1 -0
- package/dist/unpkg/dev/store-D_V8-HQl.js +472 -0
- package/dist/unpkg/dev/store-D_V8-HQl.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -635
- package/dist/unpkg/dev/util-dSKEgQDp.js +12 -0
- package/dist/unpkg/dev/util-dSKEgQDp.js.map +1 -0
- package/dist/unpkg/dev/utils-DYC9utVJ.js +11 -0
- package/dist/unpkg/dev/utils-DYC9utVJ.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js +189 -0
- package/dist/unpkg/dev-deprecated/-private-CrEyBE-B.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js +896 -0
- package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/adapter/error.js +424 -310
- package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +239 -245
- package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/rest.js +935 -1098
- package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js +1129 -0
- package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1 -1250
- package/dist/unpkg/dev-deprecated/compat/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/compat/builders.js +204 -248
- package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js +270 -232
- package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js +188 -193
- package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat-DGSurLh7.js +825 -0
- package/dist/unpkg/dev-deprecated/compat-DGSurLh7.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat.js +1 -1145
- package/dist/unpkg/dev-deprecated/errors-0ydn94s0.js +2128 -0
- package/dist/unpkg/dev-deprecated/errors-0ydn94s0.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +270 -189
- package/dist/unpkg/dev-deprecated/index.js.map +1 -0
- package/dist/unpkg/dev-deprecated/json-DDJji3V3.js +1104 -0
- package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +494 -554
- package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-C1ts6Mod.js +660 -0
- package/dist/unpkg/dev-deprecated/model-C1ts6Mod.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js +334 -0
- package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +2 -75
- package/dist/unpkg/dev-deprecated/model.js +3 -681
- package/dist/unpkg/dev-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
- package/dist/unpkg/dev-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
- package/dist/unpkg/dev-deprecated/schema-provider-D2ESMsA8.js +1835 -0
- package/dist/unpkg/dev-deprecated/schema-provider-D2ESMsA8.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +514 -629
- package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/json.js +3 -4
- package/dist/unpkg/dev-deprecated/serializer/rest.js +954 -1197
- package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js +283 -260
- package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer.js +205 -208
- package/dist/unpkg/dev-deprecated/serializer.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js +472 -0
- package/dist/unpkg/dev-deprecated/store-BX7GvXC_.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -635
- package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js +18 -0
- package/dist/unpkg/dev-deprecated/util-9mgEBJ3W.js.map +1 -0
- package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js +17 -0
- package/dist/unpkg/dev-deprecated/utils-Cl86-e7F.js.map +1 -0
- package/dist/unpkg/prod/-private-B4bxoTuK.js +160 -0
- package/dist/unpkg/prod/-private-B4bxoTuK.js.map +1 -0
- package/dist/unpkg/prod/-private-SfXkkHKd.js +745 -0
- package/dist/unpkg/prod/-private-SfXkkHKd.js.map +1 -0
- package/dist/unpkg/prod/adapter/-private.js +3 -1
- package/dist/unpkg/prod/adapter/error.js +421 -305
- package/dist/unpkg/prod/adapter/error.js.map +1 -0
- package/dist/unpkg/prod/adapter/json-api.js +236 -240
- package/dist/unpkg/prod/adapter/json-api.js.map +1 -0
- package/dist/unpkg/prod/adapter/rest.js +911 -1061
- package/dist/unpkg/prod/adapter/rest.js.map +1 -0
- package/dist/unpkg/prod/adapter-DQ9UA7FC.js +1111 -0
- package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +1 -0
- package/dist/unpkg/prod/adapter.js +1 -1217
- package/dist/unpkg/prod/compat/-private.js +3 -1
- package/dist/unpkg/prod/compat/builders.js +165 -183
- package/dist/unpkg/prod/compat/builders.js.map +1 -0
- package/dist/unpkg/prod/compat/extensions.js +258 -222
- package/dist/unpkg/prod/compat/extensions.js.map +1 -0
- package/dist/unpkg/prod/compat/utils.js +185 -188
- package/dist/unpkg/prod/compat/utils.js.map +1 -0
- package/dist/unpkg/prod/compat-DxiVkCUb.js +547 -0
- package/dist/unpkg/prod/compat-DxiVkCUb.js.map +1 -0
- package/dist/unpkg/prod/compat.js +1 -725
- package/dist/unpkg/prod/errors-CVXWrUjP.js +1977 -0
- package/dist/unpkg/prod/errors-CVXWrUjP.js.map +1 -0
- package/dist/unpkg/prod/index.js +249 -146
- package/dist/unpkg/prod/index.js.map +1 -0
- package/dist/unpkg/prod/json-BD1kRTfB.js +1080 -0
- package/dist/unpkg/prod/json-BD1kRTfB.js.map +1 -0
- package/dist/unpkg/prod/model/-private.js +3 -1
- package/dist/unpkg/prod/model/migration-support.js +479 -530
- package/dist/unpkg/prod/model/migration-support.js.map +1 -0
- package/dist/unpkg/prod/model-D3WMsNNE.js +603 -0
- package/dist/unpkg/prod/model-D3WMsNNE.js.map +1 -0
- package/dist/unpkg/prod/model-fragments-DSqu0ptR.js +334 -0
- package/dist/unpkg/prod/model-fragments-DSqu0ptR.js.map +1 -0
- package/dist/unpkg/prod/model-fragments.js +2 -75
- package/dist/unpkg/prod/model.js +3 -592
- package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
- package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
- package/dist/unpkg/prod/schema-provider-_pimTZ3P.js +1622 -0
- package/dist/unpkg/prod/schema-provider-_pimTZ3P.js.map +1 -0
- package/dist/unpkg/prod/serializer/json-api.js +497 -587
- package/dist/unpkg/prod/serializer/json-api.js.map +1 -0
- package/dist/unpkg/prod/serializer/json.js +3 -4
- package/dist/unpkg/prod/serializer/rest.js +938 -1167
- package/dist/unpkg/prod/serializer/rest.js.map +1 -0
- package/dist/unpkg/prod/serializer/transform.js +283 -260
- package/dist/unpkg/prod/serializer/transform.js.map +1 -0
- package/dist/unpkg/prod/serializer.js +205 -208
- package/dist/unpkg/prod/serializer.js.map +1 -0
- package/dist/unpkg/prod/store-RGGc1ilN.js +392 -0
- package/dist/unpkg/prod/store-RGGc1ilN.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -503
- package/dist/unpkg/prod/util-dSKEgQDp.js +12 -0
- package/dist/unpkg/prod/util-dSKEgQDp.js.map +1 -0
- package/dist/unpkg/prod/utils-DYC9utVJ.js +11 -0
- package/dist/unpkg/prod/utils-DYC9utVJ.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js +160 -0
- package/dist/unpkg/prod-deprecated/-private-B4bxoTuK.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js +745 -0
- package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +3 -1
- package/dist/unpkg/prod-deprecated/adapter/error.js +421 -305
- package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +236 -240
- package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/rest.js +911 -1061
- package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -0
- package/{declarations/adapter.d.ts → dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js} +451 -110
- package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1 -1217
- package/dist/unpkg/prod-deprecated/compat/-private.js +3 -1
- package/dist/unpkg/prod-deprecated/compat/builders.js +165 -183
- package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js +258 -222
- package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js +185 -188
- package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js +547 -0
- package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat.js +1 -725
- package/dist/unpkg/prod-deprecated/errors-9LXqpfRd.js +1978 -0
- package/dist/unpkg/prod-deprecated/errors-9LXqpfRd.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +249 -145
- package/dist/unpkg/prod-deprecated/index.js.map +1 -0
- package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js +1080 -0
- package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +3 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +490 -547
- package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-aiVrr1fz.js +604 -0
- package/dist/unpkg/prod-deprecated/model-aiVrr1fz.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js +334 -0
- package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +2 -75
- package/dist/unpkg/prod-deprecated/model.js +3 -595
- package/dist/unpkg/prod-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js +53 -0
- package/dist/unpkg/prod-deprecated/runtime--fcdnjmJ-DMTJ0Kb3.js.map +1 -0
- package/dist/unpkg/prod-deprecated/schema-provider-DyfSd9Cv.js +1635 -0
- package/dist/unpkg/prod-deprecated/schema-provider-DyfSd9Cv.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +497 -587
- package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/json.js +3 -4
- package/dist/unpkg/prod-deprecated/serializer/rest.js +938 -1167
- package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js +283 -260
- package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer.js +205 -208
- package/dist/unpkg/prod-deprecated/serializer.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js +392 -0
- package/dist/unpkg/prod-deprecated/store-0L2CkYzh.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -503
- package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js +14 -0
- package/dist/unpkg/prod-deprecated/util-CQQdHX3n.js.map +1 -0
- package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js +13 -0
- package/dist/unpkg/prod-deprecated/utils-BMI_JwFP.js.map +1 -0
- package/dist/util-Bnx8nm-D.js +29 -0
- package/dist/util-Bnx8nm-D.js.map +1 -0
- package/dist/utils-ZAytYep8.js +28 -0
- package/dist/utils-ZAytYep8.js.map +1 -0
- package/package.json +21 -25
- package/declarations/adapter/-private/build-url-mixin.d.ts +0 -33
- package/declarations/adapter/-private/fastboot-interface.d.ts +0 -8
- package/declarations/adapter/-private/utils/continue-on-reject.d.ts +0 -1
- package/declarations/adapter/-private/utils/determine-body-promise.d.ts +0 -4
- package/declarations/adapter/-private/utils/fetch.d.ts +0 -8
- package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +0 -6
- package/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -5
- package/declarations/adapter/-private.d.ts +0 -5
- package/declarations/adapter/error.d.ts +0 -215
- package/declarations/compat/-private.d.ts +0 -13
- package/declarations/compat/builders/find-all.d.ts +0 -35
- package/declarations/compat/builders/find-record.d.ts +0 -56
- package/declarations/compat/builders/query.d.ts +0 -66
- package/declarations/compat/builders/save-record.d.ts +0 -34
- package/declarations/compat/builders/utils.d.ts +0 -3
- package/declarations/compat/builders.d.ts +0 -14
- package/declarations/compat/extensions.d.ts +0 -59
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -55
- package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +0 -2
- package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +0 -11
- package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +0 -5
- package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +0 -2
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -524
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -213
- package/declarations/compat/legacy-network-handler/serializer-response.d.ts +0 -6
- package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +0 -110
- package/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -255
- package/declarations/compat/utils.d.ts +0 -137
- package/declarations/compat.d.ts +0 -157
- package/declarations/index.d.ts +0 -102
- package/declarations/model/-private/attr.d.ts +0 -170
- package/declarations/model/-private/belongs-to.d.ts +0 -174
- package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -5
- package/declarations/model/-private/errors.d.ts +0 -289
- package/declarations/model/-private/has-many.d.ts +0 -162
- package/declarations/model/-private/hooks.d.ts +0 -10
- package/declarations/model/-private/legacy-relationships-support.d.ts +0 -47
- package/declarations/model/-private/model-for-mixin.d.ts +0 -3
- package/declarations/model/-private/model-methods.d.ts +0 -39
- package/declarations/model/-private/model.d.ts +0 -1228
- package/declarations/model/-private/notify-changes.d.ts +0 -4
- package/declarations/model/-private/promise-belongs-to.d.ts +0 -40
- package/declarations/model/-private/promise-many-array.d.ts +0 -106
- package/declarations/model/-private/record-state.d.ts +0 -58
- package/declarations/model/-private/references/belongs-to.d.ts +0 -488
- package/declarations/model/-private/references/has-many.d.ts +0 -498
- package/declarations/model/-private/schema-provider.d.ts +0 -56
- package/declarations/model/-private/type-utils.d.ts +0 -57
- package/declarations/model/-private/util.d.ts +0 -5
- package/declarations/model/-private.d.ts +0 -8
- package/declarations/model/migration-support.d.ts +0 -280
- package/declarations/model-fragments/extensions/fragment-array.d.ts +0 -16
- package/declarations/model-fragments/extensions/fragment.d.ts +0 -15
- package/declarations/model-fragments/hooks/model-for.d.ts +0 -20
- package/declarations/model-fragments/index.d.ts +0 -5
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -9
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -15
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -20
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -19
- package/declarations/model-fragments/utilities/with-legacy.d.ts +0 -3
- package/declarations/model-fragments.d.ts +0 -9
- package/declarations/model.d.ts +0 -49
- package/declarations/serializer/-private/transforms/boolean.d.ts +0 -47
- package/declarations/serializer/-private/transforms/date.d.ts +0 -28
- package/declarations/serializer/-private/transforms/number.d.ts +0 -29
- package/declarations/serializer/-private/transforms/string.d.ts +0 -29
- package/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/declarations/serializer/-private/utils.d.ts +0 -3
- package/declarations/serializer/rest.d.ts +0 -51
- package/declarations/serializer/transform.d.ts +0 -5
- package/declarations/serializer.d.ts +0 -254
- package/declarations/store/-private.d.ts +0 -223
- package/declarations/store.d.ts +0 -3
- package/dist/-private-BG3bMiKp.js +0 -1211
- package/dist/errors-Cz5KrzBk.js +0 -2566
- package/dist/hooks-D6diaM34.js +0 -74
- package/dist/json-ChdEfB0X.js +0 -1259
- package/dist/model-for-CqXsIKws.js +0 -221
- package/dist/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/schema-provider-DJCV_6AF.js +0 -2295
- package/dist/serialize-into-hash-DPZYoF-i.js +0 -261
- package/dist/unpkg/dev/-private-DtjBbEgy.js +0 -1206
- package/dist/unpkg/dev/errors-DmGGJr3T.js +0 -2562
- package/dist/unpkg/dev/hooks-CkYiE6Ud.js +0 -73
- package/dist/unpkg/dev/json-Cu1LNgmQ.js +0 -1256
- package/dist/unpkg/dev/model-for-CqXsIKws.js +0 -221
- package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/dev/schema-provider-DDVYxmUV.js +0 -2186
- package/dist/unpkg/dev/serialize-into-hash-B2xDbuo5.js +0 -259
- package/dist/unpkg/dev/util-DvanW33H.js +0 -20
- package/dist/unpkg/dev/utils-BhvS1iTS.js +0 -8
- package/dist/unpkg/dev-deprecated/-private-DtjBbEgy.js +0 -1206
- package/dist/unpkg/dev-deprecated/errors-Spt6ubMd.js +0 -2565
- package/dist/unpkg/dev-deprecated/hooks-DOXegvhL.js +0 -73
- package/dist/unpkg/dev-deprecated/json-Cu1LNgmQ.js +0 -1256
- package/dist/unpkg/dev-deprecated/model-for-CqXsIKws.js +0 -221
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/dev-deprecated/schema-provider-BP6_8N-V.js +0 -2211
- package/dist/unpkg/dev-deprecated/serialize-into-hash-B2xDbuo5.js +0 -259
- package/dist/unpkg/dev-deprecated/util-CWr5WQOT.js +0 -24
- package/dist/unpkg/dev-deprecated/utils-C9PJehtL.js +0 -12
- package/dist/unpkg/prod/-private-BdyZaGEh.js +0 -971
- package/dist/unpkg/prod/errors-BGVFCBmi.js +0 -2314
- package/dist/unpkg/prod/hooks-BztVA_x0.js +0 -41
- package/dist/unpkg/prod/json-BWrZ5546.js +0 -1243
- package/dist/unpkg/prod/model-for-CqXsIKws.js +0 -221
- package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/prod/schema-provider-DJtD_8jZ.js +0 -1861
- package/dist/unpkg/prod/serialize-into-hash-DGlzQteF.js +0 -215
- package/dist/unpkg/prod/util-DvanW33H.js +0 -20
- package/dist/unpkg/prod/utils-BhvS1iTS.js +0 -8
- package/dist/unpkg/prod-deprecated/-private-BdyZaGEh.js +0 -971
- package/dist/unpkg/prod-deprecated/errors-CdDaK81x.js +0 -2317
- package/dist/unpkg/prod-deprecated/hooks-yId87yyG.js +0 -41
- package/dist/unpkg/prod-deprecated/json-BWrZ5546.js +0 -1243
- package/dist/unpkg/prod-deprecated/model-for-CqXsIKws.js +0 -221
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/prod-deprecated/schema-provider-CjX55uSY.js +0 -1904
- package/dist/unpkg/prod-deprecated/serialize-into-hash-DGlzQteF.js +0 -215
- package/dist/unpkg/prod-deprecated/util-B6cn-i93.js +0 -23
- package/dist/unpkg/prod-deprecated/utils-BUWwQwCh.js +0 -11
- package/dist/util-Dul6TZts.js +0 -35
- package/dist/utils-Cqw9eRj5.js +0 -23
|
@@ -1,3 +1,404 @@
|
|
|
1
|
+
import { r as initializeDeferredDecorator, t as decorateFieldV2 } from "./runtime--fcdnjmJ-DMTJ0Kb3.js";
|
|
2
|
+
import EmberObject from "@ember/object";
|
|
3
|
+
import { camelize, pluralize } from "@warp-drive/utilities/string";
|
|
4
|
+
import * as s from "@ember/service";
|
|
5
|
+
import Mixin from "@ember/object/mixin";
|
|
6
|
+
|
|
7
|
+
//#region src/adapter/-private/build-url-mixin.ts
|
|
8
|
+
/**
|
|
9
|
+
* The methods provided by the `BuildURLMixin` mixin (see the exported
|
|
10
|
+
* `BuildURLMixin` {@link Mixin} below).
|
|
11
|
+
*
|
|
12
|
+
* See also {@link MixtBuildURLMixin}, the interface used to type `this`
|
|
13
|
+
* within these methods.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
Builds a URL for a given type and optional ID.
|
|
17
|
+
|
|
18
|
+
By default, it pluralizes the type's name (for example, 'post'
|
|
19
|
+
becomes 'posts' and 'person' becomes 'people'). To override the
|
|
20
|
+
pluralization see [pathForType](./pathForType?anchor=pathForType).
|
|
21
|
+
|
|
22
|
+
If an ID is specified, it adds the ID to the path generated
|
|
23
|
+
for the type, separated by a `/`.
|
|
24
|
+
|
|
25
|
+
When called by `RESTAdapter.findMany()` the `id` and `snapshot` parameters
|
|
26
|
+
will be arrays of ids and snapshots.
|
|
27
|
+
|
|
28
|
+
@public
|
|
29
|
+
@param {String} modelName
|
|
30
|
+
@param {(String|Array|Object)} id single id or array of ids or query
|
|
31
|
+
@param {(Snapshot|SnapshotRecordArray)} snapshot single snapshot or array of snapshots
|
|
32
|
+
@param {String} requestType
|
|
33
|
+
@param {Object} query object of query parameters to send for query requests.
|
|
34
|
+
@return {String} url
|
|
35
|
+
*/
|
|
36
|
+
function buildURL(modelName, id, snapshot, requestType, query) {
|
|
37
|
+
switch (requestType) {
|
|
38
|
+
case "findRecord": return this.urlForFindRecord(id, modelName, snapshot);
|
|
39
|
+
case "findAll": return this.urlForFindAll(modelName, snapshot);
|
|
40
|
+
case "query": return this.urlForQuery(query || {}, modelName);
|
|
41
|
+
case "queryRecord": return this.urlForQueryRecord(query || {}, modelName);
|
|
42
|
+
case "findMany": return this.urlForFindMany(id, modelName, snapshot);
|
|
43
|
+
case "findHasMany": return this.urlForFindHasMany(id, modelName, snapshot);
|
|
44
|
+
case "findBelongsTo": return this.urlForFindBelongsTo(id, modelName, snapshot);
|
|
45
|
+
case "createRecord": return this.urlForCreateRecord(modelName, snapshot);
|
|
46
|
+
case "updateRecord": return this.urlForUpdateRecord(id, modelName, snapshot);
|
|
47
|
+
case "deleteRecord": return this.urlForDeleteRecord(id, modelName, snapshot);
|
|
48
|
+
default: return this._buildURL(modelName, id);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
@private
|
|
53
|
+
@param {String} modelName
|
|
54
|
+
@param {String} id
|
|
55
|
+
@return {String} url
|
|
56
|
+
*/
|
|
57
|
+
function _buildURL(modelName, id) {
|
|
58
|
+
let path;
|
|
59
|
+
const url = [];
|
|
60
|
+
const { host } = this;
|
|
61
|
+
const prefix = this.urlPrefix();
|
|
62
|
+
if (modelName) {
|
|
63
|
+
path = this.pathForType(modelName);
|
|
64
|
+
if (path) url.push(path);
|
|
65
|
+
}
|
|
66
|
+
if (id) url.push(encodeURIComponent(id));
|
|
67
|
+
if (prefix) url.unshift(prefix);
|
|
68
|
+
let urlString = url.join("/");
|
|
69
|
+
if (!host && urlString && urlString.charAt(0) !== "/") urlString = "/" + urlString;
|
|
70
|
+
return urlString;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
Builds a URL for a `store.findRecord(type, id)` call.
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
|
|
77
|
+
```js [app/adapters/user.js]
|
|
78
|
+
import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';
|
|
79
|
+
|
|
80
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
81
|
+
urlForFindRecord(id, modelName, snapshot) {
|
|
82
|
+
let baseUrl = this.buildURL(modelName, id, snapshot);
|
|
83
|
+
return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
@public
|
|
89
|
+
@param {String} id
|
|
90
|
+
@param {String} modelName
|
|
91
|
+
@param {Snapshot} snapshot
|
|
92
|
+
@return {String} url
|
|
93
|
+
|
|
94
|
+
*/
|
|
95
|
+
function urlForFindRecord(id, modelName, snapshot) {
|
|
96
|
+
return this._buildURL(modelName, id);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
Builds a URL for a `store.findAll(type)` call.
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
|
|
103
|
+
```js [app/adapters/comment.js]
|
|
104
|
+
import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';
|
|
105
|
+
|
|
106
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
107
|
+
urlForFindAll(modelName, snapshot) {
|
|
108
|
+
let baseUrl = this.buildURL(modelName);
|
|
109
|
+
return `${baseUrl}/data/comments.json`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
@public
|
|
115
|
+
@param {String} modelName
|
|
116
|
+
@param {SnapshotRecordArray} snapshot
|
|
117
|
+
@return {String} url
|
|
118
|
+
*/
|
|
119
|
+
function urlForFindAll(modelName, snapshots) {
|
|
120
|
+
return this._buildURL(modelName);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
Builds a URL for a `store.query(type, query)` call.
|
|
124
|
+
|
|
125
|
+
Example:
|
|
126
|
+
|
|
127
|
+
```js [app/adapters/application.js]
|
|
128
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
129
|
+
|
|
130
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
131
|
+
host = 'https://api.github.com';
|
|
132
|
+
urlForQuery (query, modelName) {
|
|
133
|
+
switch(modelName) {
|
|
134
|
+
case 'repo':
|
|
135
|
+
return `https://api.github.com/orgs/${query.orgId}/repos`;
|
|
136
|
+
default:
|
|
137
|
+
return super.urlForQuery(...arguments);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
@public
|
|
144
|
+
@param {Object} query
|
|
145
|
+
@param {String} modelName
|
|
146
|
+
@return {String} url
|
|
147
|
+
*/
|
|
148
|
+
function urlForQuery(query, modelName) {
|
|
149
|
+
return this._buildURL(modelName);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
Builds a URL for a `store.queryRecord(type, query)` call.
|
|
153
|
+
|
|
154
|
+
Example:
|
|
155
|
+
|
|
156
|
+
```js [app/adapters/application.js]
|
|
157
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
158
|
+
|
|
159
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
160
|
+
urlForQueryRecord({ slug }, modelName) {
|
|
161
|
+
let baseUrl = this.buildURL();
|
|
162
|
+
return `${baseUrl}/${encodeURIComponent(slug)}`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
@public
|
|
168
|
+
@param {Object} query
|
|
169
|
+
@param {String} modelName
|
|
170
|
+
@return {String} url
|
|
171
|
+
*/
|
|
172
|
+
function urlForQueryRecord(query, modelName) {
|
|
173
|
+
return this._buildURL(modelName);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
Builds a URL for coalescing multiple `store.findRecord(type, id)`
|
|
177
|
+
records into 1 request when the adapter's `coalesceFindRequests`
|
|
178
|
+
property is `true`.
|
|
179
|
+
|
|
180
|
+
Example:
|
|
181
|
+
|
|
182
|
+
```js [app/adapters/application.js]
|
|
183
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
184
|
+
|
|
185
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
186
|
+
urlForFindMany(ids, modelName) {
|
|
187
|
+
let baseUrl = this.buildURL();
|
|
188
|
+
return `${baseUrl}/coalesce`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
@public
|
|
194
|
+
@param {Array} ids
|
|
195
|
+
@param {String} modelName
|
|
196
|
+
@param {Array} snapshots
|
|
197
|
+
@return {String} url
|
|
198
|
+
*/
|
|
199
|
+
function urlForFindMany(ids, modelName, snapshots) {
|
|
200
|
+
return this._buildURL(modelName);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
Builds a URL for fetching an async `hasMany` relationship when a URL
|
|
204
|
+
is not provided by the server.
|
|
205
|
+
|
|
206
|
+
Example:
|
|
207
|
+
|
|
208
|
+
```js [app/adapters/application.js]
|
|
209
|
+
import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';
|
|
210
|
+
|
|
211
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
212
|
+
urlForFindHasMany(id, modelName, snapshot) {
|
|
213
|
+
let baseUrl = this.buildURL(modelName, id);
|
|
214
|
+
return `${baseUrl}/relationships`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
@public
|
|
220
|
+
@param {String} id
|
|
221
|
+
@param {String} modelName
|
|
222
|
+
@param {Snapshot} snapshot
|
|
223
|
+
@return {String} url
|
|
224
|
+
*/
|
|
225
|
+
function urlForFindHasMany(id, modelName, snapshot) {
|
|
226
|
+
return this._buildURL(modelName, id);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
Builds a URL for fetching an async `belongsTo` relationship when a url
|
|
230
|
+
is not provided by the server.
|
|
231
|
+
|
|
232
|
+
Example:
|
|
233
|
+
|
|
234
|
+
```js [app/adapters/application.js]
|
|
235
|
+
import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';
|
|
236
|
+
|
|
237
|
+
export default class ApplicationAdapter extends JSONAPIAdapter {
|
|
238
|
+
urlForFindBelongsTo(id, modelName, snapshot) {
|
|
239
|
+
let baseUrl = this.buildURL(modelName, id);
|
|
240
|
+
return `${baseUrl}/relationships`;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
@public
|
|
246
|
+
@param {String} id
|
|
247
|
+
@param {String} modelName
|
|
248
|
+
@param {Snapshot} snapshot
|
|
249
|
+
@return {String} url
|
|
250
|
+
*/
|
|
251
|
+
function urlForFindBelongsTo(id, modelName, snapshot) {
|
|
252
|
+
return this._buildURL(modelName, id);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
Builds a URL for a `record.save()` call when the record was created
|
|
256
|
+
locally using `store.createRecord()`.
|
|
257
|
+
|
|
258
|
+
Example:
|
|
259
|
+
|
|
260
|
+
```js [app/adapters/application.js]
|
|
261
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
262
|
+
|
|
263
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
264
|
+
urlForCreateRecord(modelName, snapshot) {
|
|
265
|
+
return super.urlForCreateRecord(...arguments) + '/new';
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
@public
|
|
271
|
+
@param {String} modelName
|
|
272
|
+
@param {Snapshot} snapshot
|
|
273
|
+
@return {String} url
|
|
274
|
+
*/
|
|
275
|
+
function urlForCreateRecord(modelName, snapshot) {
|
|
276
|
+
return this._buildURL(modelName);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
Builds a URL for a `record.save()` call when the record has been updated locally.
|
|
280
|
+
|
|
281
|
+
Example:
|
|
282
|
+
|
|
283
|
+
```js [app/adapters/application.js]
|
|
284
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
285
|
+
|
|
286
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
287
|
+
urlForUpdateRecord(id, modelName, snapshot) {
|
|
288
|
+
return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
@public
|
|
294
|
+
@param {String} id
|
|
295
|
+
@param {String} modelName
|
|
296
|
+
@param {Snapshot} snapshot
|
|
297
|
+
@return {String} url
|
|
298
|
+
*/
|
|
299
|
+
function urlForUpdateRecord(id, modelName, snapshot) {
|
|
300
|
+
return this._buildURL(modelName, id);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
Builds a URL for a `record.save()` call when the record has been deleted locally.
|
|
304
|
+
|
|
305
|
+
Example:
|
|
306
|
+
|
|
307
|
+
```js [app/adapters/application.js]
|
|
308
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
309
|
+
|
|
310
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
311
|
+
urlForDeleteRecord(id, modelName, snapshot) {
|
|
312
|
+
return super.urlForDeleteRecord(...arguments) + '/destroy';
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
@public
|
|
318
|
+
@param {String} id
|
|
319
|
+
@param {String} modelName
|
|
320
|
+
@param {Snapshot} snapshot
|
|
321
|
+
@return {String} url
|
|
322
|
+
*/
|
|
323
|
+
function urlForDeleteRecord(id, modelName, snapshot) {
|
|
324
|
+
return this._buildURL(modelName, id);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
@private
|
|
328
|
+
@param {String} path
|
|
329
|
+
@param {String} parentURL
|
|
330
|
+
@return {String} urlPrefix
|
|
331
|
+
*/
|
|
332
|
+
function urlPrefix(path, parentURL) {
|
|
333
|
+
const { namespace } = this;
|
|
334
|
+
let { host } = this;
|
|
335
|
+
if (!host || host === "/") host = "";
|
|
336
|
+
if (path) {
|
|
337
|
+
if (/^\/\//.test(path) || /http(s)?:\/\//.test(path)) return path;
|
|
338
|
+
else if (path.charAt(0) === "/") return `${host}${path}`;
|
|
339
|
+
else return `${parentURL}/${path}`;
|
|
340
|
+
}
|
|
341
|
+
const url = [];
|
|
342
|
+
if (host) url.push(host);
|
|
343
|
+
if (namespace) url.push(namespace);
|
|
344
|
+
return url.join("/");
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
Determines the pathname for a given type.
|
|
348
|
+
|
|
349
|
+
By default, it pluralizes the type's name (for example,
|
|
350
|
+
'post' becomes 'posts' and 'person' becomes 'people').
|
|
351
|
+
|
|
352
|
+
### Pathname customization
|
|
353
|
+
|
|
354
|
+
For example, if you have an object `LineItem` with an
|
|
355
|
+
endpoint of `/line_items/`.
|
|
356
|
+
|
|
357
|
+
```js [app/adapters/application.js]
|
|
358
|
+
import { RESTAdapter } from '@warp-drive/legacy/adapter/rest';
|
|
359
|
+
import { undesrcore, pluralize } from '<app-name>/utils/string-utils';
|
|
360
|
+
|
|
361
|
+
export default class ApplicationAdapter extends RESTAdapter {
|
|
362
|
+
pathForType(modelName) {
|
|
363
|
+
return pluralize(underscore(modelName));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
@public
|
|
369
|
+
@param {String} modelName
|
|
370
|
+
@return {String} path
|
|
371
|
+
**/
|
|
372
|
+
function pathForType(modelName) {
|
|
373
|
+
const camelized = camelize(modelName);
|
|
374
|
+
return pluralize(camelized);
|
|
375
|
+
}
|
|
376
|
+
const mixinProps = {
|
|
377
|
+
buildURL,
|
|
378
|
+
_buildURL,
|
|
379
|
+
urlForFindRecord,
|
|
380
|
+
urlForFindAll,
|
|
381
|
+
urlForQueryRecord,
|
|
382
|
+
urlForQuery,
|
|
383
|
+
urlForFindMany,
|
|
384
|
+
urlForFindHasMany,
|
|
385
|
+
urlForFindBelongsTo,
|
|
386
|
+
urlForCreateRecord,
|
|
387
|
+
urlForDeleteRecord,
|
|
388
|
+
urlForUpdateRecord,
|
|
389
|
+
urlPrefix,
|
|
390
|
+
pathForType
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* The `Mixin` implementation of {@link BuildURLMixin}, ready to be applied
|
|
394
|
+
* to an `EmberObject` subclass such as an `Adapter`.
|
|
395
|
+
*
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
const BuildURLMixin = Mixin.create(mixinProps);
|
|
399
|
+
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/adapter.ts
|
|
1
402
|
/**
|
|
2
403
|
* ## Overview
|
|
3
404
|
*
|
|
@@ -182,11 +583,7 @@ customization, and maintenance than attempting to override methods in these adap
|
|
|
182
583
|
|
|
183
584
|
@module
|
|
184
585
|
*/
|
|
185
|
-
|
|
186
|
-
import type { Store } from "@warp-drive/core";
|
|
187
|
-
import type { ModelSchema } from "@warp-drive/core/types";
|
|
188
|
-
import type { AdapterPayload, MinimumAdapterInterface, SerializerOptions } from "./compat.js";
|
|
189
|
-
import type { Snapshot, SnapshotRecordArray } from "./compat/-private.js";
|
|
586
|
+
const service = s.service ?? s.inject;
|
|
190
587
|
/**
|
|
191
588
|
An adapter is an object that receives requests from a store and
|
|
192
589
|
translates them into the appropriate action to take against your
|
|
@@ -243,23 +640,28 @@ included REST adapter.
|
|
|
243
640
|
|
|
244
641
|
@public
|
|
245
642
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
643
|
+
var Adapter = class extends EmberObject {
|
|
644
|
+
static {
|
|
645
|
+
decorateFieldV2(this.prototype, "store", [service]);
|
|
646
|
+
}
|
|
647
|
+
#store = (initializeDeferredDecorator(this, "store"), void 0);
|
|
648
|
+
/**
|
|
649
|
+
* The Store service instance that owns this Adapter.
|
|
650
|
+
*/
|
|
651
|
+
/**
|
|
652
|
+
* @private
|
|
653
|
+
*/
|
|
249
654
|
/**
|
|
250
655
|
The `findRecord()` method is invoked when the store is asked for a record that
|
|
251
656
|
has not previously been loaded. In response to `findRecord()` being called, you
|
|
252
657
|
should query your persistence layer for a record with the given ID. The `findRecord`
|
|
253
658
|
method should return a promise that will resolve to a JavaScript object that will be
|
|
254
659
|
normalized by the serializer.
|
|
255
|
-
|
|
256
660
|
Here is an example of the `findRecord` implementation:
|
|
257
|
-
|
|
258
661
|
```js [app/adapters/application.js]
|
|
259
662
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
260
663
|
import RSVP from 'RSVP';
|
|
261
664
|
import $ from 'jquery';
|
|
262
|
-
|
|
263
665
|
export default class ApplicationAdapter extends Adapter {
|
|
264
666
|
findRecord(store, type, id, snapshot) {
|
|
265
667
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -272,20 +674,16 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
272
674
|
}
|
|
273
675
|
}
|
|
274
676
|
```
|
|
275
|
-
|
|
276
677
|
@public
|
|
277
678
|
*/
|
|
278
|
-
findRecord(store
|
|
679
|
+
findRecord(store, type, id, snapshot) {}
|
|
279
680
|
/**
|
|
280
681
|
The `findAll()` method is used to retrieve all records for a given type.
|
|
281
|
-
|
|
282
682
|
Example
|
|
283
|
-
|
|
284
683
|
```js [app/adapters/application.js]
|
|
285
684
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
286
685
|
import RSVP from 'RSVP';
|
|
287
686
|
import $ from 'jquery';
|
|
288
|
-
|
|
289
687
|
export default class ApplicationAdapter extends Adapter {
|
|
290
688
|
findAll(store, type) {
|
|
291
689
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -298,21 +696,17 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
298
696
|
}
|
|
299
697
|
}
|
|
300
698
|
```
|
|
301
|
-
|
|
302
699
|
@param neverSet a value is never provided to this argument
|
|
303
700
|
@public
|
|
304
701
|
*/
|
|
305
|
-
findAll(store
|
|
702
|
+
findAll(store, type, neverSet, snapshotRecordArray) {}
|
|
306
703
|
/**
|
|
307
704
|
This method is called when you call `query` on the store.
|
|
308
|
-
|
|
309
705
|
Example
|
|
310
|
-
|
|
311
706
|
```js [app/adapters/application.js]
|
|
312
707
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
313
708
|
import RSVP from 'RSVP';
|
|
314
709
|
import $ from 'jquery';
|
|
315
|
-
|
|
316
710
|
export default class ApplicationAdapter extends Adapter {
|
|
317
711
|
query(store, type, query) {
|
|
318
712
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -325,25 +719,19 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
325
719
|
}
|
|
326
720
|
}
|
|
327
721
|
```
|
|
328
|
-
|
|
329
722
|
@public
|
|
330
723
|
*/
|
|
331
|
-
query(store
|
|
724
|
+
query(store, type, query) {}
|
|
332
725
|
/**
|
|
333
726
|
The `queryRecord()` method is invoked when the store is asked for a single
|
|
334
727
|
record through a query object.
|
|
335
|
-
|
|
336
728
|
In response to `queryRecord()` being called, you should always fetch fresh
|
|
337
729
|
data. Once found, you can asynchronously call the store's `push()` method
|
|
338
730
|
to push the record into the store.
|
|
339
|
-
|
|
340
731
|
Here is an example `queryRecord` implementation:
|
|
341
|
-
|
|
342
732
|
Example
|
|
343
|
-
|
|
344
733
|
```js [app/adapters/application.js]
|
|
345
734
|
import { Adapter, BuildURLMixin } from '@warp-drive/legacy/adapter';
|
|
346
|
-
|
|
347
735
|
export default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {
|
|
348
736
|
queryRecord(store, type, query) {
|
|
349
737
|
return fetch(`/${type.modelName}`, { body: JSON.stringify(query) })
|
|
@@ -351,35 +739,29 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
351
739
|
}
|
|
352
740
|
}
|
|
353
741
|
```
|
|
354
|
-
|
|
355
742
|
@public
|
|
356
743
|
*/
|
|
357
|
-
queryRecord(store
|
|
744
|
+
queryRecord(store, type, query, adapterOptions) {}
|
|
358
745
|
/**
|
|
359
746
|
If the globally unique IDs for your records should be generated on the client,
|
|
360
747
|
implement the `generateIdForRecord()` method. This method will be invoked
|
|
361
748
|
each time you create a new record, and the value returned from it will be
|
|
362
749
|
assigned to the record's `primaryKey`.
|
|
363
|
-
|
|
364
750
|
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
|
|
365
751
|
of the record will be set by the server, and your adapter will update the store
|
|
366
752
|
with the new ID when it calls `didCreateRecord()`. Only implement this method if
|
|
367
753
|
you intend to generate record IDs on the client-side.
|
|
368
|
-
|
|
369
754
|
The `generateIdForRecord()` method will be invoked with the requesting store as
|
|
370
755
|
the first parameter and the newly created record as the second parameter:
|
|
371
|
-
|
|
372
756
|
```javascript
|
|
373
757
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
374
758
|
import { v4 } from 'uuid';
|
|
375
|
-
|
|
376
759
|
export default class ApplicationAdapter extends Adapter {
|
|
377
760
|
generateIdForRecord(store, type, inputProperties) {
|
|
378
761
|
return v4();
|
|
379
762
|
}
|
|
380
763
|
}
|
|
381
764
|
```
|
|
382
|
-
|
|
383
765
|
@param {Store} store
|
|
384
766
|
@param {Model} type the Model class of the record
|
|
385
767
|
@param {Object} inputProperties a hash of properties to set on the
|
|
@@ -389,42 +771,34 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
389
771
|
*/
|
|
390
772
|
/**
|
|
391
773
|
Proxies to the serializer's `serialize` method.
|
|
392
|
-
|
|
393
774
|
Example
|
|
394
|
-
|
|
395
775
|
```js [app/adapters/application.js]
|
|
396
776
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
397
|
-
|
|
398
777
|
export default class ApplicationAdapter extends Adapter {
|
|
399
778
|
createRecord(store, type, snapshot) {
|
|
400
779
|
let data = this.serialize(snapshot, { includeId: true });
|
|
401
780
|
let url = `/${type.modelName}`;
|
|
402
|
-
|
|
403
781
|
// ...
|
|
404
782
|
}
|
|
405
783
|
}
|
|
406
784
|
```
|
|
407
|
-
|
|
408
785
|
@public
|
|
409
786
|
*/
|
|
410
|
-
serialize(snapshot
|
|
787
|
+
serialize(snapshot, options) {
|
|
788
|
+
return snapshot.serialize(options);
|
|
789
|
+
}
|
|
411
790
|
/**
|
|
412
791
|
Implement this method in a subclass to handle the creation of
|
|
413
792
|
new records.
|
|
414
|
-
|
|
415
793
|
Serializes the record and sends it to the server.
|
|
416
|
-
|
|
417
794
|
Example
|
|
418
|
-
|
|
419
795
|
```js [app/adapters/application.js]
|
|
420
796
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
421
797
|
import RSVP from 'RSVP';
|
|
422
798
|
import $ from 'jquery';
|
|
423
|
-
|
|
424
799
|
export default class ApplicationAdapter extends Adapter {
|
|
425
800
|
createRecord(store, type, snapshot) {
|
|
426
801
|
let data = this.serialize(snapshot, { includeId: true });
|
|
427
|
-
|
|
428
802
|
return new RSVP.Promise(function (resolve, reject) {
|
|
429
803
|
$.ajax({
|
|
430
804
|
type: 'POST',
|
|
@@ -441,16 +815,13 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
441
815
|
}
|
|
442
816
|
}
|
|
443
817
|
```
|
|
444
|
-
|
|
445
818
|
@public
|
|
446
819
|
*/
|
|
447
|
-
createRecord(store
|
|
820
|
+
createRecord(store, type, snapshot) {}
|
|
448
821
|
/**
|
|
449
822
|
Implement this method in a subclass to handle the updating of
|
|
450
823
|
a record.
|
|
451
|
-
|
|
452
824
|
Serializes the record update and sends it to the server.
|
|
453
|
-
|
|
454
825
|
The updateRecord method is expected to return a promise that will
|
|
455
826
|
resolve with the serialized record. This allows the backend to
|
|
456
827
|
inform the WarpDrive store the current state of this record after
|
|
@@ -458,19 +829,15 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
458
829
|
the updateRecord promise can also resolve with `undefined` and the
|
|
459
830
|
WarpDrive store will assume all of the updates were successfully
|
|
460
831
|
applied on the backend.
|
|
461
|
-
|
|
462
832
|
Example
|
|
463
|
-
|
|
464
833
|
```js [app/adapters/application.js]
|
|
465
834
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
466
835
|
import RSVP from 'RSVP';
|
|
467
836
|
import $ from 'jquery';
|
|
468
|
-
|
|
469
837
|
export default class ApplicationAdapter extends Adapter {
|
|
470
838
|
updateRecord(store, type, snapshot) {
|
|
471
839
|
let data = this.serialize(snapshot, { includeId: true });
|
|
472
840
|
let id = snapshot.id;
|
|
473
|
-
|
|
474
841
|
return new RSVP.Promise(function(resolve, reject) {
|
|
475
842
|
$.ajax({
|
|
476
843
|
type: 'PUT',
|
|
@@ -487,32 +854,26 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
487
854
|
}
|
|
488
855
|
}
|
|
489
856
|
```
|
|
490
|
-
|
|
491
857
|
@param {Store} store
|
|
492
858
|
@param {Model} type the Model class of the record
|
|
493
859
|
@param {Snapshot} snapshot
|
|
494
860
|
@return {Promise} promise
|
|
495
861
|
@public
|
|
496
862
|
*/
|
|
497
|
-
updateRecord(store
|
|
863
|
+
updateRecord(store, type, snapshot) {}
|
|
498
864
|
/**
|
|
499
865
|
Implement this method in a subclass to handle the deletion of
|
|
500
866
|
a record.
|
|
501
|
-
|
|
502
867
|
Sends a delete request for the record to the server.
|
|
503
|
-
|
|
504
868
|
Example
|
|
505
|
-
|
|
506
869
|
```js [app/adapters/application.js]
|
|
507
870
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
508
871
|
import RSVP from 'RSVP';
|
|
509
872
|
import $ from 'jquery';
|
|
510
|
-
|
|
511
873
|
export default class ApplicationAdapter extends Adapter {
|
|
512
874
|
deleteRecord(store, type, snapshot) {
|
|
513
875
|
let data = this.serialize(snapshot, { includeId: true });
|
|
514
876
|
let id = snapshot.id;
|
|
515
|
-
|
|
516
877
|
return new RSVP.Promise(function(resolve, reject) {
|
|
517
878
|
$.ajax({
|
|
518
879
|
type: 'DELETE',
|
|
@@ -529,36 +890,38 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
529
890
|
}
|
|
530
891
|
}
|
|
531
892
|
```
|
|
532
|
-
|
|
533
893
|
@param {Store} store
|
|
534
894
|
@param {Model} type the Model class of the record
|
|
535
895
|
@param {Snapshot} snapshot
|
|
536
896
|
@return {Promise} promise
|
|
537
897
|
@public
|
|
538
898
|
*/
|
|
539
|
-
deleteRecord(store
|
|
899
|
+
deleteRecord(store, type, snapshot) {}
|
|
540
900
|
/**
|
|
541
901
|
By default the store will try to coalesce all `findRecord` calls within the same runloop
|
|
542
902
|
into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.
|
|
543
903
|
You can opt out of this behaviour by either not implementing the findMany hook or by setting
|
|
544
904
|
coalesceFindRequests to false.
|
|
545
|
-
|
|
546
905
|
@property coalesceFindRequests
|
|
547
906
|
@public
|
|
548
907
|
@type {Boolean}
|
|
549
908
|
*/
|
|
550
|
-
get coalesceFindRequests()
|
|
551
|
-
|
|
909
|
+
get coalesceFindRequests() {
|
|
910
|
+
const coalesceFindRequests = this._coalesceFindRequests;
|
|
911
|
+
if (typeof coalesceFindRequests === "boolean") return coalesceFindRequests;
|
|
912
|
+
return this._coalesceFindRequests = true;
|
|
913
|
+
}
|
|
914
|
+
set coalesceFindRequests(value) {
|
|
915
|
+
this._coalesceFindRequests = value;
|
|
916
|
+
}
|
|
552
917
|
/**
|
|
553
918
|
The store will call `findMany` instead of multiple `findRecord`
|
|
554
919
|
requests to find multiple records at once if coalesceFindRequests
|
|
555
920
|
is true.
|
|
556
|
-
|
|
557
921
|
```js [app/adapters/application.js]
|
|
558
922
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
559
923
|
import RSVP from 'RSVP';
|
|
560
924
|
import $ from 'jquery';
|
|
561
|
-
|
|
562
925
|
export default class ApplicationAdapter extends Adapter {
|
|
563
926
|
findMany(store, type, ids, snapshots) {
|
|
564
927
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -577,7 +940,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
577
940
|
}
|
|
578
941
|
}
|
|
579
942
|
```
|
|
580
|
-
|
|
581
943
|
@param {Store} store
|
|
582
944
|
@param {Model} type the Model class of the records
|
|
583
945
|
@param {Array} ids
|
|
@@ -588,38 +950,33 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
588
950
|
/**
|
|
589
951
|
Organize records into groups, each of which is to be passed to separate
|
|
590
952
|
calls to `findMany`.
|
|
591
|
-
|
|
592
953
|
For example, if your API has nested URLs that depend on the parent, you will
|
|
593
954
|
want to group records by their parent.
|
|
594
|
-
|
|
595
955
|
The default implementation returns the records as a single group.
|
|
596
|
-
|
|
597
956
|
@public
|
|
598
957
|
@param {Store} store
|
|
599
958
|
@param {Array} snapshots
|
|
600
959
|
@return {Array} an array of arrays of records, each of which is to be
|
|
601
960
|
loaded separately by `findMany`.
|
|
602
961
|
*/
|
|
603
|
-
groupRecordsForFindMany(store
|
|
962
|
+
groupRecordsForFindMany(store, snapshots) {
|
|
963
|
+
return [snapshots];
|
|
964
|
+
}
|
|
604
965
|
/**
|
|
605
966
|
This method is used by the store to determine if the store should
|
|
606
967
|
reload a record from the adapter when a record is requested by
|
|
607
968
|
`store.findRecord`.
|
|
608
|
-
|
|
609
969
|
If this method returns `true`, the store will re-fetch a record from
|
|
610
970
|
the adapter. If this method returns `false`, the store will resolve
|
|
611
971
|
immediately using the cached record.
|
|
612
|
-
|
|
613
972
|
For example, if you are building an events ticketing system, in which users
|
|
614
973
|
can only reserve tickets for 20 minutes at a time, and want to ensure that
|
|
615
974
|
in each route you have data that is no more than 20 minutes old you could
|
|
616
975
|
write:
|
|
617
|
-
|
|
618
976
|
```javascript
|
|
619
977
|
shouldReloadRecord(store, ticketSnapshot) {
|
|
620
978
|
let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');
|
|
621
979
|
let timeDiff = moment().diff(lastAccessedAt, 'minutes');
|
|
622
|
-
|
|
623
980
|
if (timeDiff > 20) {
|
|
624
981
|
return true;
|
|
625
982
|
} else {
|
|
@@ -627,49 +984,42 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
627
984
|
}
|
|
628
985
|
}
|
|
629
986
|
```
|
|
630
|
-
|
|
631
987
|
This method would ensure that whenever you do `store.findRecord('ticket',
|
|
632
988
|
id)` you will always get a ticket that is no more than 20 minutes old. In
|
|
633
989
|
case the cached version is more than 20 minutes old, `findRecord` will not
|
|
634
990
|
resolve until you fetched the latest version.
|
|
635
|
-
|
|
636
991
|
By default this hook returns `false`, as most UIs should not block user
|
|
637
992
|
interactions while waiting on data update.
|
|
638
|
-
|
|
639
993
|
Note that, with default settings, `shouldBackgroundReloadRecord` will always
|
|
640
994
|
re-fetch the records in the background even if `shouldReloadRecord` returns
|
|
641
995
|
`false`. You can override `shouldBackgroundReloadRecord` if this does not
|
|
642
996
|
suit your use case.
|
|
643
|
-
|
|
644
997
|
@since 1.13.0
|
|
645
998
|
@param {Store} store
|
|
646
999
|
@param {Snapshot} snapshot
|
|
647
1000
|
@return {Boolean}
|
|
648
1001
|
@public
|
|
649
1002
|
*/
|
|
650
|
-
shouldReloadRecord(store
|
|
1003
|
+
shouldReloadRecord(store, snapshot) {
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
651
1006
|
/**
|
|
652
1007
|
This method is used by the store to determine if the store should
|
|
653
1008
|
reload all records from the adapter when records are requested by
|
|
654
1009
|
`store.findAll`.
|
|
655
|
-
|
|
656
1010
|
If this method returns `true`, the store will re-fetch all records from
|
|
657
1011
|
the adapter. If this method returns `false`, the store will resolve
|
|
658
1012
|
immediately using the cached records.
|
|
659
|
-
|
|
660
1013
|
For example, if you are building an events ticketing system, in which users
|
|
661
1014
|
can only reserve tickets for 20 minutes at a time, and want to ensure that
|
|
662
1015
|
in each route you have data that is no more than 20 minutes old you could
|
|
663
1016
|
write:
|
|
664
|
-
|
|
665
1017
|
```javascript
|
|
666
1018
|
shouldReloadAll(store, snapshotArray) {
|
|
667
1019
|
let snapshots = snapshotArray.snapshots();
|
|
668
|
-
|
|
669
1020
|
return snapshots.any((ticketSnapshot) => {
|
|
670
1021
|
let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');
|
|
671
1022
|
let timeDiff = moment().diff(lastAccessedAt, 'minutes');
|
|
672
|
-
|
|
673
1023
|
if (timeDiff > 20) {
|
|
674
1024
|
return true;
|
|
675
1025
|
} else {
|
|
@@ -678,93 +1028,84 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
678
1028
|
});
|
|
679
1029
|
}
|
|
680
1030
|
```
|
|
681
|
-
|
|
682
1031
|
This method would ensure that whenever you do `store.findAll('ticket')` you
|
|
683
1032
|
will always get a list of tickets that are no more than 20 minutes old. In
|
|
684
1033
|
case a cached version is more than 20 minutes old, `findAll` will not
|
|
685
1034
|
resolve until you fetched the latest versions.
|
|
686
|
-
|
|
687
1035
|
By default, this method returns `true` if the passed `snapshotRecordArray`
|
|
688
1036
|
is empty (meaning that there are no records locally available yet),
|
|
689
1037
|
otherwise, it returns `false`.
|
|
690
|
-
|
|
691
1038
|
Note that, with default settings, `shouldBackgroundReloadAll` will always
|
|
692
1039
|
re-fetch all the records in the background even if `shouldReloadAll` returns
|
|
693
1040
|
`false`. You can override `shouldBackgroundReloadAll` if this does not suit
|
|
694
1041
|
your use case.
|
|
695
|
-
|
|
696
1042
|
@since 1.13.0
|
|
697
1043
|
@param {Store} store
|
|
698
1044
|
@param {SnapshotRecordArray} snapshotRecordArray
|
|
699
1045
|
@return {Boolean}
|
|
700
1046
|
@public
|
|
701
1047
|
*/
|
|
702
|
-
shouldReloadAll(store
|
|
1048
|
+
shouldReloadAll(store, snapshotRecordArray) {
|
|
1049
|
+
return !snapshotRecordArray.length;
|
|
1050
|
+
}
|
|
703
1051
|
/**
|
|
704
1052
|
This method is used by the store to determine if the store should
|
|
705
1053
|
reload a record after the `store.findRecord` method resolves a
|
|
706
1054
|
cached record.
|
|
707
|
-
|
|
708
1055
|
This method is *only* checked by the store when the store is
|
|
709
1056
|
returning a cached record.
|
|
710
|
-
|
|
711
1057
|
If this method returns `true` the store will re-fetch a record from
|
|
712
1058
|
the adapter.
|
|
713
|
-
|
|
714
1059
|
For example, if you do not want to fetch complex data over a mobile
|
|
715
1060
|
connection, or if the network is down, you can implement
|
|
716
1061
|
`shouldBackgroundReloadRecord` as follows:
|
|
717
|
-
|
|
718
1062
|
```javascript
|
|
719
1063
|
shouldBackgroundReloadRecord(store, snapshot) {
|
|
720
1064
|
let { downlink, effectiveType } = navigator.connection;
|
|
721
|
-
|
|
722
1065
|
return downlink > 0 && effectiveType === '4g';
|
|
723
1066
|
}
|
|
724
1067
|
```
|
|
725
|
-
|
|
726
1068
|
By default, this hook returns `true` so the data for the record is updated
|
|
727
1069
|
in the background.
|
|
728
|
-
|
|
729
1070
|
@since 1.13.0
|
|
730
1071
|
@param {Store} store
|
|
731
1072
|
@param {Snapshot} snapshot
|
|
732
1073
|
@return {Boolean}
|
|
733
1074
|
@public
|
|
734
1075
|
*/
|
|
735
|
-
shouldBackgroundReloadRecord(store
|
|
1076
|
+
shouldBackgroundReloadRecord(store, snapshot) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
736
1079
|
/**
|
|
737
1080
|
This method is used by the store to determine if the store should
|
|
738
1081
|
reload a record array after the `store.findAll` method resolves
|
|
739
1082
|
with a cached record array.
|
|
740
|
-
|
|
741
1083
|
This method is *only* checked by the store when the store is
|
|
742
1084
|
returning a cached record array.
|
|
743
|
-
|
|
744
1085
|
If this method returns `true` the store will re-fetch all records
|
|
745
1086
|
from the adapter.
|
|
746
|
-
|
|
747
1087
|
For example, if you do not want to fetch complex data over a mobile
|
|
748
1088
|
connection, or if the network is down, you can implement
|
|
749
1089
|
`shouldBackgroundReloadAll` as follows:
|
|
750
|
-
|
|
751
1090
|
```javascript
|
|
752
1091
|
shouldBackgroundReloadAll(store, snapshotArray) {
|
|
753
1092
|
let { downlink, effectiveType } = navigator.connection;
|
|
754
|
-
|
|
755
1093
|
return downlink > 0 && effectiveType === '4g';
|
|
756
1094
|
}
|
|
757
1095
|
```
|
|
758
|
-
|
|
759
1096
|
By default this method returns `true`, indicating that a background reload
|
|
760
1097
|
should always be triggered.
|
|
761
|
-
|
|
762
1098
|
@since 1.13.0
|
|
763
1099
|
@param {Store} store
|
|
764
1100
|
@param {SnapshotRecordArray} snapshotRecordArray
|
|
765
1101
|
@return {Boolean}
|
|
766
1102
|
@public
|
|
767
1103
|
*/
|
|
768
|
-
shouldBackgroundReloadAll(store
|
|
769
|
-
|
|
770
|
-
|
|
1104
|
+
shouldBackgroundReloadAll(store, snapshotRecordArray) {
|
|
1105
|
+
return true;
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
//#endregion
|
|
1110
|
+
export { BuildURLMixin as n, Adapter as t };
|
|
1111
|
+
//# sourceMappingURL=adapter-DQ9UA7FC.js.map
|