@warp-drive/legacy 5.9.0-alpha.21 → 5.9.0-alpha.22
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/-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 +422 -453
- package/dist/adapter/error.js.map +1 -0
- package/{declarations → dist}/adapter/json-api.d.ts +30 -29
- package/dist/adapter/json-api.d.ts.map +1 -0
- package/dist/adapter/json-api.js +265 -143
- package/dist/adapter/json-api.js.map +1 -0
- package/dist/adapter/rest.d.ts +2 -0
- package/dist/adapter/rest.js +937 -1136
- 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-XgLAkYVs.js +1130 -0
- package/dist/adapter-XgLAkYVs.js.map +1 -0
- package/dist/adapter.d.ts +2 -0
- package/dist/adapter.js +1 -1248
- 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 -245
- package/dist/compat/builders.js.map +1 -0
- package/dist/compat/extensions.d.ts +2 -0
- package/dist/compat/extensions.js +265 -304
- 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 +187 -206
- 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-g__Pfy2S.js +734 -0
- package/dist/compat-g__Pfy2S.js.map +1 -0
- package/dist/compat.d.ts +2 -0
- package/dist/compat.js +1 -1036
- package/dist/error-CzkyXr1Q.d.ts +435 -0
- package/dist/error-CzkyXr1Q.d.ts.map +1 -0
- package/dist/errors-LQhmDVdd.js +2134 -0
- package/dist/errors-LQhmDVdd.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 +267 -339
- 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 +504 -575
- 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-BtIEHqYZ.js +683 -0
- package/dist/model-BtIEHqYZ.js.map +1 -0
- package/dist/model-fragments-Dpn9285r.js +334 -0
- package/dist/model-fragments-Dpn9285r.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 -94
- package/dist/model.d.ts +404 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +3 -670
- package/{declarations/adapter/rest.d.ts → dist/rest-0NhtexIq.d.ts} +183 -173
- package/dist/rest-0NhtexIq.d.ts.map +1 -0
- package/dist/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
- package/dist/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
- package/dist/schema-provider-DsKuB5Wb.js +1929 -0
- package/dist/schema-provider-DsKuB5Wb.js.map +1 -0
- package/{declarations → dist}/serializer/json-api.d.ts +3 -0
- package/dist/serializer/json-api.d.ts.map +1 -0
- package/dist/serializer/json-api.js +527 -519
- 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 -1199
- 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 -308
- 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 -205
- 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 -641
- 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 +421 -452
- package/dist/unpkg/dev/adapter/error.js.map +1 -0
- package/dist/unpkg/dev/adapter/json-api.js +239 -257
- package/dist/unpkg/dev/adapter/json-api.js.map +1 -0
- package/dist/unpkg/dev/adapter/rest.js +935 -1134
- package/dist/unpkg/dev/adapter/rest.js.map +1 -0
- package/dist/unpkg/dev/adapter-Cw0uSl8d.js +1129 -0
- package/dist/unpkg/dev/adapter-Cw0uSl8d.js.map +1 -0
- package/dist/unpkg/dev/adapter.js +1 -1247
- package/dist/unpkg/dev/compat/-private.js +3 -1
- package/dist/unpkg/dev/compat/builders.js +204 -247
- package/dist/unpkg/dev/compat/builders.js.map +1 -0
- package/dist/unpkg/dev/compat/extensions.js +264 -303
- package/dist/unpkg/dev/compat/extensions.js.map +1 -0
- package/dist/unpkg/dev/compat/utils.js +186 -205
- package/dist/unpkg/dev/compat/utils.js.map +1 -0
- package/dist/unpkg/dev/compat-CeyxXB7K.js +825 -0
- package/dist/unpkg/dev/compat-CeyxXB7K.js.map +1 -0
- package/dist/unpkg/dev/compat.js +1 -1178
- package/dist/unpkg/dev/errors-1javxsPo.js +2127 -0
- package/dist/unpkg/dev/errors-1javxsPo.js.map +1 -0
- package/dist/unpkg/dev/index.js +266 -344
- 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 +481 -549
- package/dist/unpkg/dev/model/migration-support.js.map +1 -0
- package/dist/unpkg/dev/model-C9Xb1R1x.js +655 -0
- package/dist/unpkg/dev/model-C9Xb1R1x.js.map +1 -0
- package/dist/unpkg/dev/model-fragments-Dpn9285r.js +334 -0
- package/dist/unpkg/dev/model-fragments-Dpn9285r.js.map +1 -0
- package/dist/unpkg/dev/model-fragments.js +2 -94
- package/dist/unpkg/dev/model.js +3 -681
- package/dist/unpkg/dev/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
- package/dist/unpkg/dev/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
- package/dist/unpkg/dev/schema-provider-Dy6c1J5f.js +1834 -0
- package/dist/unpkg/dev/schema-provider-Dy6c1J5f.js.map +1 -0
- package/dist/unpkg/dev/serializer/json-api.js +514 -634
- 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 -1196
- package/dist/unpkg/dev/serializer/rest.js.map +1 -0
- package/dist/unpkg/dev/serializer/transform.js +283 -308
- package/dist/unpkg/dev/serializer/transform.js.map +1 -0
- package/dist/unpkg/dev/serializer.js +205 -205
- 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 -649
- 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 +421 -452
- package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +239 -257
- package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/rest.js +935 -1134
- package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter-Cw0uSl8d.js +1129 -0
- package/dist/unpkg/dev-deprecated/adapter-Cw0uSl8d.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1 -1247
- package/dist/unpkg/dev-deprecated/compat/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/compat/builders.js +204 -247
- package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js +264 -303
- package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js +186 -205
- package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat-DmAgB2NS.js +825 -0
- package/dist/unpkg/dev-deprecated/compat-DmAgB2NS.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat.js +1 -1178
- package/dist/unpkg/dev-deprecated/errors-C4_aOhY5.js +2128 -0
- package/dist/unpkg/dev-deprecated/errors-C4_aOhY5.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +266 -343
- 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 +492 -566
- package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-CvSMYkgs.js +660 -0
- package/dist/unpkg/dev-deprecated/model-CvSMYkgs.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-fragments-Dpn9285r.js +334 -0
- package/dist/unpkg/dev-deprecated/model-fragments-Dpn9285r.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +2 -94
- package/dist/unpkg/dev-deprecated/model.js +3 -685
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
- package/dist/unpkg/dev-deprecated/schema-provider-Cqttza94.js +1835 -0
- package/dist/unpkg/dev-deprecated/schema-provider-Cqttza94.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +514 -634
- 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 -1196
- package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js +283 -308
- package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer.js +205 -205
- 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 -649
- 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 +418 -447
- package/dist/unpkg/prod/adapter/error.js.map +1 -0
- package/dist/unpkg/prod/adapter/json-api.js +236 -252
- package/dist/unpkg/prod/adapter/json-api.js.map +1 -0
- package/dist/unpkg/prod/adapter/rest.js +911 -1097
- package/dist/unpkg/prod/adapter/rest.js.map +1 -0
- package/dist/unpkg/prod/adapter-Wnk7jizX.js +1111 -0
- package/dist/unpkg/prod/adapter-Wnk7jizX.js.map +1 -0
- package/dist/unpkg/prod/adapter.js +1 -1214
- package/dist/unpkg/prod/compat/-private.js +3 -1
- package/dist/unpkg/prod/compat/builders.js +165 -182
- package/dist/unpkg/prod/compat/builders.js.map +1 -0
- package/dist/unpkg/prod/compat/extensions.js +252 -283
- package/dist/unpkg/prod/compat/extensions.js.map +1 -0
- package/dist/unpkg/prod/compat/utils.js +183 -200
- package/dist/unpkg/prod/compat/utils.js.map +1 -0
- package/dist/unpkg/prod/compat-CJ87MzDn.js +547 -0
- package/dist/unpkg/prod/compat-CJ87MzDn.js.map +1 -0
- package/dist/unpkg/prod/compat.js +1 -742
- package/dist/unpkg/prod/errors-Co7YWHoA.js +1977 -0
- package/dist/unpkg/prod/errors-Co7YWHoA.js.map +1 -0
- package/dist/unpkg/prod/index.js +245 -308
- 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 +477 -542
- package/dist/unpkg/prod/model/migration-support.js.map +1 -0
- package/dist/unpkg/prod/model-BzoOmtka.js +603 -0
- package/dist/unpkg/prod/model-BzoOmtka.js.map +1 -0
- package/dist/unpkg/prod/model-fragments-Dpn9285r.js +334 -0
- package/dist/unpkg/prod/model-fragments-Dpn9285r.js.map +1 -0
- package/dist/unpkg/prod/model-fragments.js +2 -94
- package/dist/unpkg/prod/model.js +3 -596
- package/dist/unpkg/prod/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
- package/dist/unpkg/prod/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
- package/dist/unpkg/prod/schema-provider-CKZcqWyP.js +1622 -0
- package/dist/unpkg/prod/schema-provider-CKZcqWyP.js.map +1 -0
- package/dist/unpkg/prod/serializer/json-api.js +497 -592
- 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 -1166
- package/dist/unpkg/prod/serializer/rest.js.map +1 -0
- package/dist/unpkg/prod/serializer/transform.js +283 -308
- package/dist/unpkg/prod/serializer/transform.js.map +1 -0
- package/dist/unpkg/prod/serializer.js +205 -205
- 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 -517
- 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 +418 -447
- package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +236 -252
- package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/rest.js +911 -1097
- package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -0
- package/{declarations/adapter.d.ts → dist/unpkg/prod-deprecated/adapter-Wnk7jizX.js} +445 -110
- package/dist/unpkg/prod-deprecated/adapter-Wnk7jizX.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1 -1214
- package/dist/unpkg/prod-deprecated/compat/-private.js +3 -1
- package/dist/unpkg/prod-deprecated/compat/builders.js +165 -182
- package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js +252 -283
- package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js +183 -200
- package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat-CJ87MzDn.js +547 -0
- package/dist/unpkg/prod-deprecated/compat-CJ87MzDn.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat.js +1 -742
- package/dist/unpkg/prod-deprecated/errors-C-opde61.js +1978 -0
- package/dist/unpkg/prod-deprecated/errors-C-opde61.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +245 -307
- 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 +488 -559
- package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-C0bTXzGn.js +604 -0
- package/dist/unpkg/prod-deprecated/model-C0bTXzGn.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments-Dpn9285r.js +334 -0
- package/dist/unpkg/prod-deprecated/model-fragments-Dpn9285r.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +2 -94
- package/dist/unpkg/prod-deprecated/model.js +3 -599
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js +53 -0
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BgO3Lyjx.js.map +1 -0
- package/dist/unpkg/prod-deprecated/schema-provider-lH3qP5tw.js +1635 -0
- package/dist/unpkg/prod-deprecated/schema-provider-lH3qP5tw.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +497 -592
- 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 -1166
- package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js +283 -308
- package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer.js +205 -205
- 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 -517
- 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 +13 -13
- package/declarations/adapter/-private/build-url-mixin.d.ts +0 -189
- 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 -431
- package/declarations/compat/-private.d.ts +0 -13
- package/declarations/compat/builders/find-all.d.ts +0 -34
- 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 -99
- 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 -9
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -528
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +0 -220
- 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 -148
- package/declarations/compat.d.ts +0 -189
- package/declarations/index.d.ts +0 -244
- package/declarations/model/-private/attr.d.ts +0 -191
- package/declarations/model/-private/belongs-to.d.ts +0 -195
- 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 -36
- 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 -1279
- 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 -130
- 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 -66
- 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 -306
- package/declarations/model-fragments/extensions/fragment-array.d.ts +0 -54
- package/declarations/model-fragments/extensions/fragment.d.ts +0 -50
- package/declarations/model-fragments/hooks/model-for.d.ts +0 -27
- package/declarations/model-fragments/index.d.ts +0 -13
- package/declarations/model-fragments/instance-initializers/fragment-extensions.d.ts +0 -15
- package/declarations/model-fragments/utilities/with-array-defaults.d.ts +0 -56
- package/declarations/model-fragments/utilities/with-fragment-array-defaults.d.ts +0 -38
- package/declarations/model-fragments/utilities/with-fragment-defaults.d.ts +0 -34
- package/declarations/model-fragments/utilities/with-legacy.d.ts +0 -11
- package/declarations/model-fragments.d.ts +0 -9
- package/declarations/model.d.ts +0 -49
- package/declarations/serializer/-private/transforms/boolean.d.ts +0 -60
- package/declarations/serializer/-private/transforms/date.d.ts +0 -42
- package/declarations/serializer/-private/transforms/number.d.ts +0 -42
- package/declarations/serializer/-private/transforms/string.d.ts +0 -42
- package/declarations/serializer/-private/transforms/transform.d.ts +0 -118
- package/declarations/serializer/-private/utils.d.ts +0 -27
- package/declarations/serializer/rest.d.ts +0 -51
- package/declarations/serializer/transform.d.ts +0 -5
- package/declarations/serializer.d.ts +0 -252
- package/declarations/store/-private.d.ts +0 -223
- package/declarations/store.d.ts +0 -10
- package/dist/-private-BG3bMiKp.js +0 -1211
- package/dist/errors-DZKA206g.js +0 -2589
- package/dist/hooks-BvOqJBei.js +0 -105
- package/dist/json-DU8m1pGf.js +0 -1336
- package/dist/model-for-CXkJw59V.js +0 -297
- package/dist/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/schema-provider-DtPOp0d7.js +0 -2382
- package/dist/serialize-into-hash-DPZYoF-i.js +0 -261
- package/dist/unpkg/dev/-private-DtjBbEgy.js +0 -1206
- package/dist/unpkg/dev/errors-DngRU-If.js +0 -2585
- package/dist/unpkg/dev/hooks-UuiLxWxS.js +0 -104
- package/dist/unpkg/dev/json-K2Y9z6MN.js +0 -1333
- package/dist/unpkg/dev/model-for-CXkJw59V.js +0 -297
- package/dist/unpkg/dev/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/dev/schema-provider-0D7f-QOn.js +0 -2272
- 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-Bzidntpi.js +0 -2588
- package/dist/unpkg/dev-deprecated/hooks-DVXhMW14.js +0 -104
- package/dist/unpkg/dev-deprecated/json-K2Y9z6MN.js +0 -1333
- package/dist/unpkg/dev-deprecated/model-for-CXkJw59V.js +0 -297
- package/dist/unpkg/dev-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/dev-deprecated/schema-provider-ZwO5_fZw.js +0 -2292
- 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-B-PWeYlW.js +0 -2337
- package/dist/unpkg/prod/hooks-Bx-zBziU.js +0 -72
- package/dist/unpkg/prod/json-Qewu-UN9.js +0 -1300
- package/dist/unpkg/prod/model-for-CXkJw59V.js +0 -297
- package/dist/unpkg/prod/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/prod/schema-provider-BgRqk8i9.js +0 -1951
- 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-Dl2J9d1D.js +0 -2340
- package/dist/unpkg/prod-deprecated/hooks-Cm60wWTf.js +0 -72
- package/dist/unpkg/prod-deprecated/json-Qewu-UN9.js +0 -1300
- package/dist/unpkg/prod-deprecated/model-for-CXkJw59V.js +0 -297
- package/dist/unpkg/prod-deprecated/runtime-BPCpkOf1-BKOwiRJp.js +0 -65
- package/dist/unpkg/prod-deprecated/schema-provider-Dh6tRqVI.js +0 -1980
- 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-BPCpkOf1-BgO3Lyjx.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,29 +640,28 @@ included REST adapter.
|
|
|
243
640
|
|
|
244
641
|
@public
|
|
245
642
|
*/
|
|
246
|
-
|
|
643
|
+
var Adapter = class extends EmberObject {
|
|
644
|
+
static {
|
|
645
|
+
decorateFieldV2(this.prototype, "store", [service]);
|
|
646
|
+
}
|
|
647
|
+
#store = (initializeDeferredDecorator(this, "store"), void 0);
|
|
247
648
|
/**
|
|
248
649
|
* The Store service instance that owns this Adapter.
|
|
249
650
|
*/
|
|
250
|
-
store: Store;
|
|
251
651
|
/**
|
|
252
652
|
* @private
|
|
253
653
|
*/
|
|
254
|
-
_coalesceFindRequests: boolean;
|
|
255
654
|
/**
|
|
256
655
|
The `findRecord()` method is invoked when the store is asked for a record that
|
|
257
656
|
has not previously been loaded. In response to `findRecord()` being called, you
|
|
258
657
|
should query your persistence layer for a record with the given ID. The `findRecord`
|
|
259
658
|
method should return a promise that will resolve to a JavaScript object that will be
|
|
260
659
|
normalized by the serializer.
|
|
261
|
-
|
|
262
660
|
Here is an example of the `findRecord` implementation:
|
|
263
|
-
|
|
264
661
|
```js [app/adapters/application.js]
|
|
265
662
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
266
663
|
import RSVP from 'RSVP';
|
|
267
664
|
import $ from 'jquery';
|
|
268
|
-
|
|
269
665
|
export default class ApplicationAdapter extends Adapter {
|
|
270
666
|
findRecord(store, type, id, snapshot) {
|
|
271
667
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -278,20 +674,16 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
278
674
|
}
|
|
279
675
|
}
|
|
280
676
|
```
|
|
281
|
-
|
|
282
677
|
@public
|
|
283
678
|
*/
|
|
284
|
-
findRecord(store
|
|
679
|
+
findRecord(store, type, id, snapshot) {}
|
|
285
680
|
/**
|
|
286
681
|
The `findAll()` method is used to retrieve all records for a given type.
|
|
287
|
-
|
|
288
682
|
Example
|
|
289
|
-
|
|
290
683
|
```js [app/adapters/application.js]
|
|
291
684
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
292
685
|
import RSVP from 'RSVP';
|
|
293
686
|
import $ from 'jquery';
|
|
294
|
-
|
|
295
687
|
export default class ApplicationAdapter extends Adapter {
|
|
296
688
|
findAll(store, type) {
|
|
297
689
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -304,21 +696,17 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
304
696
|
}
|
|
305
697
|
}
|
|
306
698
|
```
|
|
307
|
-
|
|
308
699
|
@param neverSet a value is never provided to this argument
|
|
309
700
|
@public
|
|
310
701
|
*/
|
|
311
|
-
findAll(store
|
|
702
|
+
findAll(store, type, neverSet, snapshotRecordArray) {}
|
|
312
703
|
/**
|
|
313
704
|
This method is called when you call `query` on the store.
|
|
314
|
-
|
|
315
705
|
Example
|
|
316
|
-
|
|
317
706
|
```js [app/adapters/application.js]
|
|
318
707
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
319
708
|
import RSVP from 'RSVP';
|
|
320
709
|
import $ from 'jquery';
|
|
321
|
-
|
|
322
710
|
export default class ApplicationAdapter extends Adapter {
|
|
323
711
|
query(store, type, query) {
|
|
324
712
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -331,25 +719,19 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
331
719
|
}
|
|
332
720
|
}
|
|
333
721
|
```
|
|
334
|
-
|
|
335
722
|
@public
|
|
336
723
|
*/
|
|
337
|
-
query(store
|
|
724
|
+
query(store, type, query) {}
|
|
338
725
|
/**
|
|
339
726
|
The `queryRecord()` method is invoked when the store is asked for a single
|
|
340
727
|
record through a query object.
|
|
341
|
-
|
|
342
728
|
In response to `queryRecord()` being called, you should always fetch fresh
|
|
343
729
|
data. Once found, you can asynchronously call the store's `push()` method
|
|
344
730
|
to push the record into the store.
|
|
345
|
-
|
|
346
731
|
Here is an example `queryRecord` implementation:
|
|
347
|
-
|
|
348
732
|
Example
|
|
349
|
-
|
|
350
733
|
```js [app/adapters/application.js]
|
|
351
734
|
import { Adapter, BuildURLMixin } from '@warp-drive/legacy/adapter';
|
|
352
|
-
|
|
353
735
|
export default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {
|
|
354
736
|
queryRecord(store, type, query) {
|
|
355
737
|
return fetch(`/${type.modelName}`, { body: JSON.stringify(query) })
|
|
@@ -357,35 +739,29 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
357
739
|
}
|
|
358
740
|
}
|
|
359
741
|
```
|
|
360
|
-
|
|
361
742
|
@public
|
|
362
743
|
*/
|
|
363
|
-
queryRecord(store
|
|
744
|
+
queryRecord(store, type, query, adapterOptions) {}
|
|
364
745
|
/**
|
|
365
746
|
If the globally unique IDs for your records should be generated on the client,
|
|
366
747
|
implement the `generateIdForRecord()` method. This method will be invoked
|
|
367
748
|
each time you create a new record, and the value returned from it will be
|
|
368
749
|
assigned to the record's `primaryKey`.
|
|
369
|
-
|
|
370
750
|
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
|
|
371
751
|
of the record will be set by the server, and your adapter will update the store
|
|
372
752
|
with the new ID when it calls `didCreateRecord()`. Only implement this method if
|
|
373
753
|
you intend to generate record IDs on the client-side.
|
|
374
|
-
|
|
375
754
|
The `generateIdForRecord()` method will be invoked with the requesting store as
|
|
376
755
|
the first parameter and the newly created record as the second parameter:
|
|
377
|
-
|
|
378
756
|
```javascript
|
|
379
757
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
380
758
|
import { v4 } from 'uuid';
|
|
381
|
-
|
|
382
759
|
export default class ApplicationAdapter extends Adapter {
|
|
383
760
|
generateIdForRecord(store, type, inputProperties) {
|
|
384
761
|
return v4();
|
|
385
762
|
}
|
|
386
763
|
}
|
|
387
764
|
```
|
|
388
|
-
|
|
389
765
|
@param {Store} store
|
|
390
766
|
@param {Model} type the Model class of the record
|
|
391
767
|
@param {Object} inputProperties a hash of properties to set on the
|
|
@@ -395,42 +771,34 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
395
771
|
*/
|
|
396
772
|
/**
|
|
397
773
|
Proxies to the serializer's `serialize` method.
|
|
398
|
-
|
|
399
774
|
Example
|
|
400
|
-
|
|
401
775
|
```js [app/adapters/application.js]
|
|
402
776
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
403
|
-
|
|
404
777
|
export default class ApplicationAdapter extends Adapter {
|
|
405
778
|
createRecord(store, type, snapshot) {
|
|
406
779
|
let data = this.serialize(snapshot, { includeId: true });
|
|
407
780
|
let url = `/${type.modelName}`;
|
|
408
|
-
|
|
409
781
|
// ...
|
|
410
782
|
}
|
|
411
783
|
}
|
|
412
784
|
```
|
|
413
|
-
|
|
414
785
|
@public
|
|
415
786
|
*/
|
|
416
|
-
serialize(snapshot
|
|
787
|
+
serialize(snapshot, options) {
|
|
788
|
+
return snapshot.serialize(options);
|
|
789
|
+
}
|
|
417
790
|
/**
|
|
418
791
|
Implement this method in a subclass to handle the creation of
|
|
419
792
|
new records.
|
|
420
|
-
|
|
421
793
|
Serializes the record and sends it to the server.
|
|
422
|
-
|
|
423
794
|
Example
|
|
424
|
-
|
|
425
795
|
```js [app/adapters/application.js]
|
|
426
796
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
427
797
|
import RSVP from 'RSVP';
|
|
428
798
|
import $ from 'jquery';
|
|
429
|
-
|
|
430
799
|
export default class ApplicationAdapter extends Adapter {
|
|
431
800
|
createRecord(store, type, snapshot) {
|
|
432
801
|
let data = this.serialize(snapshot, { includeId: true });
|
|
433
|
-
|
|
434
802
|
return new RSVP.Promise(function (resolve, reject) {
|
|
435
803
|
$.ajax({
|
|
436
804
|
type: 'POST',
|
|
@@ -447,16 +815,13 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
447
815
|
}
|
|
448
816
|
}
|
|
449
817
|
```
|
|
450
|
-
|
|
451
818
|
@public
|
|
452
819
|
*/
|
|
453
|
-
createRecord(store
|
|
820
|
+
createRecord(store, type, snapshot) {}
|
|
454
821
|
/**
|
|
455
822
|
Implement this method in a subclass to handle the updating of
|
|
456
823
|
a record.
|
|
457
|
-
|
|
458
824
|
Serializes the record update and sends it to the server.
|
|
459
|
-
|
|
460
825
|
The updateRecord method is expected to return a promise that will
|
|
461
826
|
resolve with the serialized record. This allows the backend to
|
|
462
827
|
inform the WarpDrive store the current state of this record after
|
|
@@ -464,19 +829,15 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
464
829
|
the updateRecord promise can also resolve with `undefined` and the
|
|
465
830
|
WarpDrive store will assume all of the updates were successfully
|
|
466
831
|
applied on the backend.
|
|
467
|
-
|
|
468
832
|
Example
|
|
469
|
-
|
|
470
833
|
```js [app/adapters/application.js]
|
|
471
834
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
472
835
|
import RSVP from 'RSVP';
|
|
473
836
|
import $ from 'jquery';
|
|
474
|
-
|
|
475
837
|
export default class ApplicationAdapter extends Adapter {
|
|
476
838
|
updateRecord(store, type, snapshot) {
|
|
477
839
|
let data = this.serialize(snapshot, { includeId: true });
|
|
478
840
|
let id = snapshot.id;
|
|
479
|
-
|
|
480
841
|
return new RSVP.Promise(function(resolve, reject) {
|
|
481
842
|
$.ajax({
|
|
482
843
|
type: 'PUT',
|
|
@@ -493,32 +854,26 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
493
854
|
}
|
|
494
855
|
}
|
|
495
856
|
```
|
|
496
|
-
|
|
497
857
|
@param {Store} store
|
|
498
858
|
@param {Model} type the Model class of the record
|
|
499
859
|
@param {Snapshot} snapshot
|
|
500
860
|
@return {Promise} promise
|
|
501
861
|
@public
|
|
502
862
|
*/
|
|
503
|
-
updateRecord(store
|
|
863
|
+
updateRecord(store, type, snapshot) {}
|
|
504
864
|
/**
|
|
505
865
|
Implement this method in a subclass to handle the deletion of
|
|
506
866
|
a record.
|
|
507
|
-
|
|
508
867
|
Sends a delete request for the record to the server.
|
|
509
|
-
|
|
510
868
|
Example
|
|
511
|
-
|
|
512
869
|
```js [app/adapters/application.js]
|
|
513
870
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
514
871
|
import RSVP from 'RSVP';
|
|
515
872
|
import $ from 'jquery';
|
|
516
|
-
|
|
517
873
|
export default class ApplicationAdapter extends Adapter {
|
|
518
874
|
deleteRecord(store, type, snapshot) {
|
|
519
875
|
let data = this.serialize(snapshot, { includeId: true });
|
|
520
876
|
let id = snapshot.id;
|
|
521
|
-
|
|
522
877
|
return new RSVP.Promise(function(resolve, reject) {
|
|
523
878
|
$.ajax({
|
|
524
879
|
type: 'DELETE',
|
|
@@ -535,36 +890,38 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
535
890
|
}
|
|
536
891
|
}
|
|
537
892
|
```
|
|
538
|
-
|
|
539
893
|
@param {Store} store
|
|
540
894
|
@param {Model} type the Model class of the record
|
|
541
895
|
@param {Snapshot} snapshot
|
|
542
896
|
@return {Promise} promise
|
|
543
897
|
@public
|
|
544
898
|
*/
|
|
545
|
-
deleteRecord(store
|
|
899
|
+
deleteRecord(store, type, snapshot) {}
|
|
546
900
|
/**
|
|
547
901
|
By default the store will try to coalesce all `findRecord` calls within the same runloop
|
|
548
902
|
into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.
|
|
549
903
|
You can opt out of this behaviour by either not implementing the findMany hook or by setting
|
|
550
904
|
coalesceFindRequests to false.
|
|
551
|
-
|
|
552
905
|
@property coalesceFindRequests
|
|
553
906
|
@public
|
|
554
907
|
@type {Boolean}
|
|
555
908
|
*/
|
|
556
|
-
get coalesceFindRequests()
|
|
557
|
-
|
|
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
|
+
}
|
|
558
917
|
/**
|
|
559
918
|
The store will call `findMany` instead of multiple `findRecord`
|
|
560
919
|
requests to find multiple records at once if coalesceFindRequests
|
|
561
920
|
is true.
|
|
562
|
-
|
|
563
921
|
```js [app/adapters/application.js]
|
|
564
922
|
import { Adapter } from '@warp-drive/legacy/adapter';
|
|
565
923
|
import RSVP from 'RSVP';
|
|
566
924
|
import $ from 'jquery';
|
|
567
|
-
|
|
568
925
|
export default class ApplicationAdapter extends Adapter {
|
|
569
926
|
findMany(store, type, ids, snapshots) {
|
|
570
927
|
return new RSVP.Promise(function(resolve, reject) {
|
|
@@ -583,7 +940,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
583
940
|
}
|
|
584
941
|
}
|
|
585
942
|
```
|
|
586
|
-
|
|
587
943
|
@param {Store} store
|
|
588
944
|
@param {Model} type the Model class of the records
|
|
589
945
|
@param {Array} ids
|
|
@@ -594,38 +950,33 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
594
950
|
/**
|
|
595
951
|
Organize records into groups, each of which is to be passed to separate
|
|
596
952
|
calls to `findMany`.
|
|
597
|
-
|
|
598
953
|
For example, if your API has nested URLs that depend on the parent, you will
|
|
599
954
|
want to group records by their parent.
|
|
600
|
-
|
|
601
955
|
The default implementation returns the records as a single group.
|
|
602
|
-
|
|
603
956
|
@public
|
|
604
957
|
@param {Store} store
|
|
605
958
|
@param {Array} snapshots
|
|
606
959
|
@return {Array} an array of arrays of records, each of which is to be
|
|
607
960
|
loaded separately by `findMany`.
|
|
608
961
|
*/
|
|
609
|
-
groupRecordsForFindMany(store
|
|
962
|
+
groupRecordsForFindMany(store, snapshots) {
|
|
963
|
+
return [snapshots];
|
|
964
|
+
}
|
|
610
965
|
/**
|
|
611
966
|
This method is used by the store to determine if the store should
|
|
612
967
|
reload a record from the adapter when a record is requested by
|
|
613
968
|
`store.findRecord`.
|
|
614
|
-
|
|
615
969
|
If this method returns `true`, the store will re-fetch a record from
|
|
616
970
|
the adapter. If this method returns `false`, the store will resolve
|
|
617
971
|
immediately using the cached record.
|
|
618
|
-
|
|
619
972
|
For example, if you are building an events ticketing system, in which users
|
|
620
973
|
can only reserve tickets for 20 minutes at a time, and want to ensure that
|
|
621
974
|
in each route you have data that is no more than 20 minutes old you could
|
|
622
975
|
write:
|
|
623
|
-
|
|
624
976
|
```javascript
|
|
625
977
|
shouldReloadRecord(store, ticketSnapshot) {
|
|
626
978
|
let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');
|
|
627
979
|
let timeDiff = moment().diff(lastAccessedAt, 'minutes');
|
|
628
|
-
|
|
629
980
|
if (timeDiff > 20) {
|
|
630
981
|
return true;
|
|
631
982
|
} else {
|
|
@@ -633,49 +984,42 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
633
984
|
}
|
|
634
985
|
}
|
|
635
986
|
```
|
|
636
|
-
|
|
637
987
|
This method would ensure that whenever you do `store.findRecord('ticket',
|
|
638
988
|
id)` you will always get a ticket that is no more than 20 minutes old. In
|
|
639
989
|
case the cached version is more than 20 minutes old, `findRecord` will not
|
|
640
990
|
resolve until you fetched the latest version.
|
|
641
|
-
|
|
642
991
|
By default this hook returns `false`, as most UIs should not block user
|
|
643
992
|
interactions while waiting on data update.
|
|
644
|
-
|
|
645
993
|
Note that, with default settings, `shouldBackgroundReloadRecord` will always
|
|
646
994
|
re-fetch the records in the background even if `shouldReloadRecord` returns
|
|
647
995
|
`false`. You can override `shouldBackgroundReloadRecord` if this does not
|
|
648
996
|
suit your use case.
|
|
649
|
-
|
|
650
997
|
@since 1.13.0
|
|
651
998
|
@param {Store} store
|
|
652
999
|
@param {Snapshot} snapshot
|
|
653
1000
|
@return {Boolean}
|
|
654
1001
|
@public
|
|
655
1002
|
*/
|
|
656
|
-
shouldReloadRecord(store
|
|
1003
|
+
shouldReloadRecord(store, snapshot) {
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
657
1006
|
/**
|
|
658
1007
|
This method is used by the store to determine if the store should
|
|
659
1008
|
reload all records from the adapter when records are requested by
|
|
660
1009
|
`store.findAll`.
|
|
661
|
-
|
|
662
1010
|
If this method returns `true`, the store will re-fetch all records from
|
|
663
1011
|
the adapter. If this method returns `false`, the store will resolve
|
|
664
1012
|
immediately using the cached records.
|
|
665
|
-
|
|
666
1013
|
For example, if you are building an events ticketing system, in which users
|
|
667
1014
|
can only reserve tickets for 20 minutes at a time, and want to ensure that
|
|
668
1015
|
in each route you have data that is no more than 20 minutes old you could
|
|
669
1016
|
write:
|
|
670
|
-
|
|
671
1017
|
```javascript
|
|
672
1018
|
shouldReloadAll(store, snapshotArray) {
|
|
673
1019
|
let snapshots = snapshotArray.snapshots();
|
|
674
|
-
|
|
675
1020
|
return snapshots.any((ticketSnapshot) => {
|
|
676
1021
|
let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');
|
|
677
1022
|
let timeDiff = moment().diff(lastAccessedAt, 'minutes');
|
|
678
|
-
|
|
679
1023
|
if (timeDiff > 20) {
|
|
680
1024
|
return true;
|
|
681
1025
|
} else {
|
|
@@ -684,93 +1028,84 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
684
1028
|
});
|
|
685
1029
|
}
|
|
686
1030
|
```
|
|
687
|
-
|
|
688
1031
|
This method would ensure that whenever you do `store.findAll('ticket')` you
|
|
689
1032
|
will always get a list of tickets that are no more than 20 minutes old. In
|
|
690
1033
|
case a cached version is more than 20 minutes old, `findAll` will not
|
|
691
1034
|
resolve until you fetched the latest versions.
|
|
692
|
-
|
|
693
1035
|
By default, this method returns `true` if the passed `snapshotRecordArray`
|
|
694
1036
|
is empty (meaning that there are no records locally available yet),
|
|
695
1037
|
otherwise, it returns `false`.
|
|
696
|
-
|
|
697
1038
|
Note that, with default settings, `shouldBackgroundReloadAll` will always
|
|
698
1039
|
re-fetch all the records in the background even if `shouldReloadAll` returns
|
|
699
1040
|
`false`. You can override `shouldBackgroundReloadAll` if this does not suit
|
|
700
1041
|
your use case.
|
|
701
|
-
|
|
702
1042
|
@since 1.13.0
|
|
703
1043
|
@param {Store} store
|
|
704
1044
|
@param {SnapshotRecordArray} snapshotRecordArray
|
|
705
1045
|
@return {Boolean}
|
|
706
1046
|
@public
|
|
707
1047
|
*/
|
|
708
|
-
shouldReloadAll(store
|
|
1048
|
+
shouldReloadAll(store, snapshotRecordArray) {
|
|
1049
|
+
return !snapshotRecordArray.length;
|
|
1050
|
+
}
|
|
709
1051
|
/**
|
|
710
1052
|
This method is used by the store to determine if the store should
|
|
711
1053
|
reload a record after the `store.findRecord` method resolves a
|
|
712
1054
|
cached record.
|
|
713
|
-
|
|
714
1055
|
This method is *only* checked by the store when the store is
|
|
715
1056
|
returning a cached record.
|
|
716
|
-
|
|
717
1057
|
If this method returns `true` the store will re-fetch a record from
|
|
718
1058
|
the adapter.
|
|
719
|
-
|
|
720
1059
|
For example, if you do not want to fetch complex data over a mobile
|
|
721
1060
|
connection, or if the network is down, you can implement
|
|
722
1061
|
`shouldBackgroundReloadRecord` as follows:
|
|
723
|
-
|
|
724
1062
|
```javascript
|
|
725
1063
|
shouldBackgroundReloadRecord(store, snapshot) {
|
|
726
1064
|
let { downlink, effectiveType } = navigator.connection;
|
|
727
|
-
|
|
728
1065
|
return downlink > 0 && effectiveType === '4g';
|
|
729
1066
|
}
|
|
730
1067
|
```
|
|
731
|
-
|
|
732
1068
|
By default, this hook returns `true` so the data for the record is updated
|
|
733
1069
|
in the background.
|
|
734
|
-
|
|
735
1070
|
@since 1.13.0
|
|
736
1071
|
@param {Store} store
|
|
737
1072
|
@param {Snapshot} snapshot
|
|
738
1073
|
@return {Boolean}
|
|
739
1074
|
@public
|
|
740
1075
|
*/
|
|
741
|
-
shouldBackgroundReloadRecord(store
|
|
1076
|
+
shouldBackgroundReloadRecord(store, snapshot) {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
742
1079
|
/**
|
|
743
1080
|
This method is used by the store to determine if the store should
|
|
744
1081
|
reload a record array after the `store.findAll` method resolves
|
|
745
1082
|
with a cached record array.
|
|
746
|
-
|
|
747
1083
|
This method is *only* checked by the store when the store is
|
|
748
1084
|
returning a cached record array.
|
|
749
|
-
|
|
750
1085
|
If this method returns `true` the store will re-fetch all records
|
|
751
1086
|
from the adapter.
|
|
752
|
-
|
|
753
1087
|
For example, if you do not want to fetch complex data over a mobile
|
|
754
1088
|
connection, or if the network is down, you can implement
|
|
755
1089
|
`shouldBackgroundReloadAll` as follows:
|
|
756
|
-
|
|
757
1090
|
```javascript
|
|
758
1091
|
shouldBackgroundReloadAll(store, snapshotArray) {
|
|
759
1092
|
let { downlink, effectiveType } = navigator.connection;
|
|
760
|
-
|
|
761
1093
|
return downlink > 0 && effectiveType === '4g';
|
|
762
1094
|
}
|
|
763
1095
|
```
|
|
764
|
-
|
|
765
1096
|
By default this method returns `true`, indicating that a background reload
|
|
766
1097
|
should always be triggered.
|
|
767
|
-
|
|
768
1098
|
@since 1.13.0
|
|
769
1099
|
@param {Store} store
|
|
770
1100
|
@param {SnapshotRecordArray} snapshotRecordArray
|
|
771
1101
|
@return {Boolean}
|
|
772
1102
|
@public
|
|
773
1103
|
*/
|
|
774
|
-
shouldBackgroundReloadAll(store
|
|
775
|
-
|
|
776
|
-
|
|
1104
|
+
shouldBackgroundReloadAll(store, snapshotRecordArray) {
|
|
1105
|
+
return true;
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
//#endregion
|
|
1110
|
+
export { BuildURLMixin as n, Adapter as t };
|
|
1111
|
+
//# sourceMappingURL=adapter-Wnk7jizX.js.map
|