@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
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
import { a as normalizeResponseHelper, c as assertIdentifierHasId, l as SnapshotRecordArray, n as FetchManager, o as iterateData, r as SaveOp, s as payloadIsNotBlank, t as upgradeStore } from "./-private-vOhxVExH.js";
|
|
2
|
+
import { recordIdentifierFor } from "@warp-drive/core";
|
|
3
|
+
import { getOwner } from "@ember/application";
|
|
4
|
+
import { _deprecatingNormalize, assertPrivateStore } from "@warp-drive/core/store/-private";
|
|
5
|
+
import { waitFor } from "@warp-drive/core/signals/-leaked";
|
|
6
|
+
|
|
7
|
+
//#region src/compat/legacy-network-handler/legacy-data-fetch.ts
|
|
8
|
+
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
9
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
10
|
+
return Promise.resolve().then(() => {
|
|
11
|
+
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
12
|
+
const relatedLink = !link || typeof link === "string" ? link : link.href;
|
|
13
|
+
((test) => {
|
|
14
|
+
if (!test) throw new Error(`Attempted to load a hasMany relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findHasMany'`);
|
|
15
|
+
})(relatedLink);
|
|
16
|
+
((test) => {
|
|
17
|
+
if (!test) throw new Error(`Expected the adapter to implement 'findHasMany' but it does not`);
|
|
18
|
+
})(typeof adapter.findHasMany === "function");
|
|
19
|
+
return adapter.findHasMany(store, snapshot, relatedLink, relationship);
|
|
20
|
+
}).then((adapterPayload) => {
|
|
21
|
+
((test) => {
|
|
22
|
+
if (!test) throw new Error(`You made a 'findHasMany' request for a ${identifier.type}'s '${relationship.name}' relationship, using link '${JSON.stringify(link)}' , but the adapter's response did not have any data`);
|
|
23
|
+
})(payloadIsNotBlank(adapterPayload));
|
|
24
|
+
const modelClass = store.modelFor(relationship.type);
|
|
25
|
+
const serializer = store.serializerFor(relationship.type);
|
|
26
|
+
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, "findHasMany");
|
|
27
|
+
((test) => {
|
|
28
|
+
if (!test) throw new Error(`fetched the hasMany relationship '${relationship.name}' for ${identifier.type}:${identifier.id} with link '${JSON.stringify(link)}', but no data member is present in the response. If no data exists, the response should set { data: [] }`);
|
|
29
|
+
})("data" in payload && Array.isArray(payload.data));
|
|
30
|
+
payload = syncRelationshipDataFromLink(store, payload, identifier, relationship);
|
|
31
|
+
return store._push(payload, true);
|
|
32
|
+
}, null);
|
|
33
|
+
}
|
|
34
|
+
function _findBelongsTo(store, identifier, link, relationship, options) {
|
|
35
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
36
|
+
return Promise.resolve().then(() => {
|
|
37
|
+
const adapter = store.adapterFor(identifier.type);
|
|
38
|
+
((test) => {
|
|
39
|
+
if (!test) throw new Error(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`);
|
|
40
|
+
})(adapter);
|
|
41
|
+
((test) => {
|
|
42
|
+
if (!test) throw new Error(`You tried to load a belongsTo relationship from a specified 'link' in the original payload but your adapter does not implement 'findBelongsTo'`);
|
|
43
|
+
})(typeof adapter.findBelongsTo === "function");
|
|
44
|
+
const snapshot = store._fetchManager.createSnapshot(identifier, options);
|
|
45
|
+
const relatedLink = !link || typeof link === "string" ? link : link.href;
|
|
46
|
+
((test) => {
|
|
47
|
+
if (!test) throw new Error(`Attempted to load a belongsTo relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findBelongsTo'`);
|
|
48
|
+
})(relatedLink);
|
|
49
|
+
return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);
|
|
50
|
+
}).then((adapterPayload) => {
|
|
51
|
+
const modelClass = store.modelFor(relationship.type);
|
|
52
|
+
const serializer = store.serializerFor(relationship.type);
|
|
53
|
+
let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, "findBelongsTo");
|
|
54
|
+
((test) => {
|
|
55
|
+
if (!test) throw new Error(`fetched the belongsTo relationship '${relationship.name}' for ${identifier.type}:${identifier.id} with link '${JSON.stringify(link)}', but no data member is present in the response. If no data exists, the response should set { data: null }`);
|
|
56
|
+
})("data" in payload && (payload.data === null || typeof payload.data === "object" && !Array.isArray(payload.data)));
|
|
57
|
+
if (!payload.data && !payload.links && !payload.meta) return null;
|
|
58
|
+
payload = syncRelationshipDataFromLink(store, payload, identifier, relationship);
|
|
59
|
+
return store._push(payload, true);
|
|
60
|
+
}, null);
|
|
61
|
+
}
|
|
62
|
+
function syncRelationshipDataFromLink(store, payload, parentIdentifier, relationship) {
|
|
63
|
+
const relationshipData = payload.data ? iterateData(payload.data, (data, index) => {
|
|
64
|
+
const { id, type } = data;
|
|
65
|
+
ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship, index);
|
|
66
|
+
return {
|
|
67
|
+
id,
|
|
68
|
+
type
|
|
69
|
+
};
|
|
70
|
+
}) : null;
|
|
71
|
+
const relatedDataHash = {};
|
|
72
|
+
if ("meta" in payload) relatedDataHash.meta = payload.meta;
|
|
73
|
+
if ("links" in payload) relatedDataHash.links = payload.links;
|
|
74
|
+
if ("data" in payload) relatedDataHash.data = relationshipData;
|
|
75
|
+
const parentPayload = {
|
|
76
|
+
id: parentIdentifier.id,
|
|
77
|
+
type: parentIdentifier.type,
|
|
78
|
+
relationships: { [relationship.name]: relatedDataHash }
|
|
79
|
+
};
|
|
80
|
+
if (!Array.isArray(payload.included)) payload.included = [];
|
|
81
|
+
payload.included.push(parentPayload);
|
|
82
|
+
return payload;
|
|
83
|
+
}
|
|
84
|
+
function ensureRelationshipIsSetToParent(payload, parentIdentifier, store, parentRelationship, index) {
|
|
85
|
+
const { id, type } = payload;
|
|
86
|
+
if (!payload.relationships) payload.relationships = {};
|
|
87
|
+
const { relationships } = payload;
|
|
88
|
+
const inverse = getInverse(store, parentIdentifier, parentRelationship, type);
|
|
89
|
+
if (inverse) {
|
|
90
|
+
const { inverseKey, kind } = inverse;
|
|
91
|
+
const relationshipData = relationships[inverseKey]?.data;
|
|
92
|
+
if (typeof relationshipData !== "undefined" && !relationshipDataPointsToParent(relationshipData, parentIdentifier)) {
|
|
93
|
+
const inspect = function inspect(thing) {
|
|
94
|
+
return `'${JSON.stringify(thing)}'`;
|
|
95
|
+
};
|
|
96
|
+
const quotedType = inspect(type);
|
|
97
|
+
const quotedInverse = inspect(inverseKey);
|
|
98
|
+
const expected = inspect({
|
|
99
|
+
id: parentIdentifier.id,
|
|
100
|
+
type: parentIdentifier.type
|
|
101
|
+
});
|
|
102
|
+
const expectedModel = `${parentIdentifier.type}:${parentIdentifier.id}`;
|
|
103
|
+
const got = inspect(relationshipData);
|
|
104
|
+
const prefix = typeof index === "number" ? `data[${index}]` : `data`;
|
|
105
|
+
const path = `${prefix}.relationships.${inverseKey}.data`;
|
|
106
|
+
const data = Array.isArray(relationshipData) ? relationshipData[0] : relationshipData;
|
|
107
|
+
const other = data ? `<${data.type}:${data.id}>` : null;
|
|
108
|
+
const relationshipFetched = `${expectedModel}.${parentRelationship.kind}("${parentRelationship.name}")`;
|
|
109
|
+
const includedRecord = `<${type}:${id}>`;
|
|
110
|
+
const message = [
|
|
111
|
+
`Encountered mismatched relationship: WarpDrive expected ${path} in the payload from ${relationshipFetched} to include ${expected} but got ${got} instead.\n`,
|
|
112
|
+
`The ${includedRecord} record loaded at ${prefix} in the payload specified ${other} as its ${quotedInverse}, but should have specified ${expectedModel} (the record the relationship is being loaded from) as its ${quotedInverse} instead.`,
|
|
113
|
+
`This could mean that the response for ${relationshipFetched} may have accidentally returned ${quotedType} records that aren't related to ${expectedModel} and could be related to a different ${parentIdentifier.type} record instead.`,
|
|
114
|
+
`WarpDrive has corrected the ${includedRecord} record's ${quotedInverse} relationship to ${expectedModel} so that ${relationshipFetched} will include ${includedRecord}.`,
|
|
115
|
+
`Please update the response from the server or change your serializer to either ensure that the response for only includes ${quotedType} records that specify ${expectedModel} as their ${quotedInverse}, or omit the ${quotedInverse} relationship from the response.`
|
|
116
|
+
].join("\n");
|
|
117
|
+
((test) => {
|
|
118
|
+
if (!test) throw new Error(message);
|
|
119
|
+
})(false);
|
|
120
|
+
}
|
|
121
|
+
if (kind !== "hasMany" || typeof relationshipData !== "undefined") {
|
|
122
|
+
relationships[inverseKey] = relationships[inverseKey] || {};
|
|
123
|
+
relationships[inverseKey].data = fixRelationshipData(relationshipData ?? null, kind, parentIdentifier);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function inverseForRelationship(store, identifier, key) {
|
|
128
|
+
const definition = store.schema.fields(identifier).get(key);
|
|
129
|
+
if (!definition) return null;
|
|
130
|
+
((test) => {
|
|
131
|
+
if (!test) throw new Error(`Expected the field definition to be a relationship`);
|
|
132
|
+
})(definition.kind === "hasMany" || definition.kind === "belongsTo");
|
|
133
|
+
((test) => {
|
|
134
|
+
if (!test) throw new Error(`Expected the relationship defintion to specify the inverse type or null.`);
|
|
135
|
+
})(definition.options?.inverse === null || typeof definition.options?.inverse === "string" && definition.options.inverse.length > 0);
|
|
136
|
+
return definition.options.inverse;
|
|
137
|
+
}
|
|
138
|
+
function getInverse(store, parentIdentifier, parentRelationship, type) {
|
|
139
|
+
const { name: lhs_relationshipName } = parentRelationship;
|
|
140
|
+
const { type: parentType } = parentIdentifier;
|
|
141
|
+
const inverseKey = inverseForRelationship(store, { type: parentType }, lhs_relationshipName);
|
|
142
|
+
if (inverseKey) {
|
|
143
|
+
const definition = store.schema.fields({ type }).get(inverseKey);
|
|
144
|
+
((test) => {
|
|
145
|
+
if (!test) throw new Error(`Expected the field definition to be a relationship`);
|
|
146
|
+
})(definition && (definition.kind === "hasMany" || definition.kind === "belongsTo"));
|
|
147
|
+
return {
|
|
148
|
+
inverseKey,
|
|
149
|
+
kind: definition.kind
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function relationshipDataPointsToParent(relationshipData, identifier) {
|
|
154
|
+
if (relationshipData === null) return false;
|
|
155
|
+
if (Array.isArray(relationshipData)) {
|
|
156
|
+
if (relationshipData.length === 0) return false;
|
|
157
|
+
for (let i = 0; i < relationshipData.length; i++) {
|
|
158
|
+
const entry = relationshipData[i];
|
|
159
|
+
if (validateRelationshipEntry(entry, identifier)) return true;
|
|
160
|
+
}
|
|
161
|
+
} else return validateRelationshipEntry(relationshipData, identifier);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function fixRelationshipData(relationshipData, relationshipKind, { id, type }) {
|
|
165
|
+
const parentRelationshipData = {
|
|
166
|
+
id,
|
|
167
|
+
type
|
|
168
|
+
};
|
|
169
|
+
let payload = null;
|
|
170
|
+
if (relationshipKind === "hasMany") {
|
|
171
|
+
const relData = relationshipData || [];
|
|
172
|
+
if (relationshipData) {
|
|
173
|
+
((test) => {
|
|
174
|
+
if (!test) throw new Error("expected the relationship data to be an array");
|
|
175
|
+
})(Array.isArray(relationshipData));
|
|
176
|
+
if (!relationshipData.find((v) => {
|
|
177
|
+
return v.type === parentRelationshipData.type && v.id === parentRelationshipData.id;
|
|
178
|
+
})) relData.push(parentRelationshipData);
|
|
179
|
+
} else relData.push(parentRelationshipData);
|
|
180
|
+
payload = relData;
|
|
181
|
+
} else {
|
|
182
|
+
const relData = relationshipData || {};
|
|
183
|
+
Object.assign(relData, parentRelationshipData);
|
|
184
|
+
payload = relData;
|
|
185
|
+
}
|
|
186
|
+
return payload;
|
|
187
|
+
}
|
|
188
|
+
function validateRelationshipEntry({ id }, { id: parentModelID }) {
|
|
189
|
+
return !!id && id.toString() === parentModelID;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region ../../node_modules/.pnpm/@embroi_8c5bde00dfb478e637d05be822ff1428/node_modules/@embroider/macros/src/addon/runtime.js
|
|
194
|
+
function config(packageRoot) {
|
|
195
|
+
return runtimeConfig.packages[packageRoot];
|
|
196
|
+
}
|
|
197
|
+
function getGlobalConfig() {
|
|
198
|
+
return runtimeConfig.global;
|
|
199
|
+
}
|
|
200
|
+
const runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};
|
|
201
|
+
runtimeConfig.packages ||= {};
|
|
202
|
+
runtimeConfig.global ||= {};
|
|
203
|
+
const localConfig = initializeRuntimeMacrosConfig();
|
|
204
|
+
Object.assign(runtimeConfig.packages, localConfig.packages);
|
|
205
|
+
Object.assign(runtimeConfig.global, localConfig.global);
|
|
206
|
+
function initializeRuntimeMacrosConfig() {
|
|
207
|
+
return {
|
|
208
|
+
"packages": {},
|
|
209
|
+
"global": {
|
|
210
|
+
"@embroider/macros": { "isTesting": false },
|
|
211
|
+
"WarpDrive": {
|
|
212
|
+
"debug": {
|
|
213
|
+
"DEBUG_RELATIONSHIP_NOTIFICATIONS": false,
|
|
214
|
+
"LOG_CACHE": false,
|
|
215
|
+
"LOG_CACHE_POLICY": false,
|
|
216
|
+
"LOG_GRAPH": false,
|
|
217
|
+
"LOG_IDENTIFIERS": false,
|
|
218
|
+
"LOG_INSTANCE_CACHE": false,
|
|
219
|
+
"LOG_METRIC_COUNTS": false,
|
|
220
|
+
"LOG_MUTATIONS": false,
|
|
221
|
+
"LOG_NOTIFICATIONS": false,
|
|
222
|
+
"LOG_OPERATIONS": false,
|
|
223
|
+
"LOG_PAYLOADS": false,
|
|
224
|
+
"LOG_REACT_SIGNAL_INTEGRATION": false,
|
|
225
|
+
"LOG_REQUESTS": false,
|
|
226
|
+
"LOG_REQUEST_STATUS": false,
|
|
227
|
+
"__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS": false
|
|
228
|
+
},
|
|
229
|
+
"polyfillUUID": false,
|
|
230
|
+
"includeDataAdapter": true,
|
|
231
|
+
"compatWith": "99.0",
|
|
232
|
+
"deprecations": {
|
|
233
|
+
"DEPRECATE_CATCH_ALL": false,
|
|
234
|
+
"DEPRECATE_COMPUTED_CHAINS": false,
|
|
235
|
+
"DEPRECATE_EMBER_INFLECTOR": false,
|
|
236
|
+
"DEPRECATE_LEGACY_IMPORTS": false,
|
|
237
|
+
"DEPRECATE_MANY_ARRAY_DUPLICATES": false,
|
|
238
|
+
"DEPRECATE_NON_STRICT_ID": false,
|
|
239
|
+
"DEPRECATE_NON_STRICT_TYPES": false,
|
|
240
|
+
"DEPRECATE_NON_UNIQUE_PAYLOADS": false,
|
|
241
|
+
"DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE": false,
|
|
242
|
+
"DEPRECATE_STORE_EXTENDS_EMBER_OBJECT": false,
|
|
243
|
+
"DEPRECATE_TRACKING_PACKAGE": false,
|
|
244
|
+
"DISABLE_7X_DEPRECATIONS": false,
|
|
245
|
+
"ENABLE_LEGACY_REQUEST_METHODS": false,
|
|
246
|
+
"ENABLE_LEGACY_SCHEMA_SERVICE": false
|
|
247
|
+
},
|
|
248
|
+
"features": {
|
|
249
|
+
"ENFORCE_STRICT_RESOURCE_FINALIZATION": false,
|
|
250
|
+
"JSON_API_CACHE_VALIDATION_ERRORS": false,
|
|
251
|
+
"SAMPLE_FEATURE_FLAG": null
|
|
252
|
+
},
|
|
253
|
+
"activeLogging": {
|
|
254
|
+
"DEBUG_RELATIONSHIP_NOTIFICATIONS": true,
|
|
255
|
+
"LOG_CACHE": true,
|
|
256
|
+
"LOG_CACHE_POLICY": true,
|
|
257
|
+
"LOG_GRAPH": true,
|
|
258
|
+
"LOG_IDENTIFIERS": true,
|
|
259
|
+
"LOG_INSTANCE_CACHE": true,
|
|
260
|
+
"LOG_METRIC_COUNTS": true,
|
|
261
|
+
"LOG_MUTATIONS": true,
|
|
262
|
+
"LOG_NOTIFICATIONS": true,
|
|
263
|
+
"LOG_OPERATIONS": true,
|
|
264
|
+
"LOG_PAYLOADS": true,
|
|
265
|
+
"LOG_REACT_SIGNAL_INTEGRATION": true,
|
|
266
|
+
"LOG_REQUESTS": true,
|
|
267
|
+
"LOG_REQUEST_STATUS": true,
|
|
268
|
+
"__INTERNAL_LOG_NATIVE_MAP_SET_COUNTS": true
|
|
269
|
+
},
|
|
270
|
+
"env": {
|
|
271
|
+
"TESTING": true,
|
|
272
|
+
"PRODUCTION": false,
|
|
273
|
+
"DEBUG": true,
|
|
274
|
+
"IS_RECORDING": false,
|
|
275
|
+
"IS_CI": true,
|
|
276
|
+
"SHOULD_RECORD": false
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function updaterMethods() {
|
|
283
|
+
return {
|
|
284
|
+
config,
|
|
285
|
+
getGlobalConfig,
|
|
286
|
+
setConfig(packageRoot, value) {
|
|
287
|
+
runtimeConfig.packages[packageRoot] = value;
|
|
288
|
+
},
|
|
289
|
+
setGlobalConfig(key, value) {
|
|
290
|
+
runtimeConfig.global[key] = value;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
let updaters = typeof window !== "undefined" ? window._embroider_macros_runtime_config : void 0;
|
|
295
|
+
if (updaters) {
|
|
296
|
+
let methods = updaterMethods();
|
|
297
|
+
for (let updater of updaters) updater(methods);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/compat/legacy-network-handler/legacy-network-handler.ts
|
|
302
|
+
const PotentialLegacyOperations = /* @__PURE__ */ new Set([
|
|
303
|
+
"findRecord",
|
|
304
|
+
"findAll",
|
|
305
|
+
"query",
|
|
306
|
+
"queryRecord",
|
|
307
|
+
"findBelongsTo",
|
|
308
|
+
"findHasMany",
|
|
309
|
+
"updateRecord",
|
|
310
|
+
"createRecord",
|
|
311
|
+
"deleteRecord"
|
|
312
|
+
]);
|
|
313
|
+
/**
|
|
314
|
+
* A {@link Handler} that fulfills legacy `findRecord`/`findAll`/`query`/
|
|
315
|
+
* `queryRecord`/`findBelongsTo`/`findHasMany`/`createRecord`/`updateRecord`/
|
|
316
|
+
* `deleteRecord` requests using the store's configured {@link MinimumAdapterInterface | adapter}
|
|
317
|
+
* and {@link MinimumSerializerInterface | serializer}, passing any other
|
|
318
|
+
* request through to the next handler unchanged.
|
|
319
|
+
*/
|
|
320
|
+
const LegacyNetworkHandler = { request(context, next) {
|
|
321
|
+
if (context.request.url || !context.request.op || !PotentialLegacyOperations.has(context.request.op)) return next(context.request);
|
|
322
|
+
const { store } = context.request;
|
|
323
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
324
|
+
if (!store._fetchManager) store._fetchManager = new FetchManager(store);
|
|
325
|
+
switch (context.request.op) {
|
|
326
|
+
case "findRecord": return findRecord(context);
|
|
327
|
+
case "findAll": return findAll(context);
|
|
328
|
+
case "query": return query(context);
|
|
329
|
+
case "queryRecord": return queryRecord(context);
|
|
330
|
+
case "findBelongsTo": return findBelongsTo(context);
|
|
331
|
+
case "findHasMany": return findHasMany(context);
|
|
332
|
+
case "updateRecord": return saveRecord(context);
|
|
333
|
+
case "createRecord": return saveRecord(context);
|
|
334
|
+
case "deleteRecord": return saveRecord(context);
|
|
335
|
+
default: return next(context.request);
|
|
336
|
+
}
|
|
337
|
+
} };
|
|
338
|
+
function findBelongsTo(context) {
|
|
339
|
+
const { store, data, records: identifiers } = context.request;
|
|
340
|
+
const { options, record, links, useLink, field } = data;
|
|
341
|
+
const identifier = identifiers?.[0];
|
|
342
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
343
|
+
const pendingRequest = identifier && store._fetchManager.getPendingFetch(identifier, options);
|
|
344
|
+
if (pendingRequest) return pendingRequest;
|
|
345
|
+
if (useLink) {
|
|
346
|
+
((test) => {
|
|
347
|
+
if (!test) throw new Error(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`);
|
|
348
|
+
})(links && links.related);
|
|
349
|
+
return _findBelongsTo(store, record, links.related, field, options);
|
|
350
|
+
}
|
|
351
|
+
((test) => {
|
|
352
|
+
if (!test) throw new Error(`Expected an identifier`);
|
|
353
|
+
})(Array.isArray(identifiers) && identifiers.length === 1);
|
|
354
|
+
const manager = store._fetchManager;
|
|
355
|
+
assertIdentifierHasId(identifier);
|
|
356
|
+
return options.reload ? manager.scheduleFetch(identifier, options, context.request) : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
357
|
+
}
|
|
358
|
+
function findHasMany(context) {
|
|
359
|
+
const { store, data, records: identifiers } = context.request;
|
|
360
|
+
const { options, record, links, useLink, field } = data;
|
|
361
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
362
|
+
if (useLink) {
|
|
363
|
+
const adapter = store.adapterFor(record.type);
|
|
364
|
+
((test) => {
|
|
365
|
+
if (!test) throw new Error(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`);
|
|
366
|
+
})(adapter);
|
|
367
|
+
((test) => {
|
|
368
|
+
if (!test) throw new Error(`You tried to load a hasMany relationship from a specified 'link' in the original payload but your adapter does not implement 'findHasMany'`);
|
|
369
|
+
})(typeof adapter.findHasMany === "function");
|
|
370
|
+
((test) => {
|
|
371
|
+
if (!test) throw new Error(`Expected a related link when calling store.findHasMany, found ${String(links)}`);
|
|
372
|
+
})(links && links.related);
|
|
373
|
+
return _findHasMany(adapter, store, record, links.related, field, options);
|
|
374
|
+
}
|
|
375
|
+
((test) => {
|
|
376
|
+
if (!test) throw new Error(`Expected an array of identifiers to fetch`);
|
|
377
|
+
})(Array.isArray(identifiers));
|
|
378
|
+
const fetches = new Array(identifiers.length);
|
|
379
|
+
const manager = store._fetchManager;
|
|
380
|
+
for (let i = 0; i < identifiers.length; i++) {
|
|
381
|
+
const identifier = identifiers[i];
|
|
382
|
+
assertIdentifierHasId(identifier);
|
|
383
|
+
fetches[i] = options.reload ? manager.scheduleFetch(identifier, options, context.request) : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
384
|
+
}
|
|
385
|
+
return Promise.all(fetches);
|
|
386
|
+
}
|
|
387
|
+
function saveRecord(context) {
|
|
388
|
+
const { store, data, op: operation } = context.request;
|
|
389
|
+
const { options, record: identifier } = data;
|
|
390
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
391
|
+
assertPrivateStore(store);
|
|
392
|
+
store.cache.willCommit(identifier, context);
|
|
393
|
+
const saveOptions = Object.assign({ [SaveOp]: operation }, options);
|
|
394
|
+
return store._fetchManager.scheduleSave(identifier, saveOptions).then((payload) => {
|
|
395
|
+
let result;
|
|
396
|
+
store._join(() => {
|
|
397
|
+
result = store.cache.didCommit(identifier, {
|
|
398
|
+
request: context.request,
|
|
399
|
+
content: payload
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
if (store.lifetimes?.didRequest && operation === "createRecord") store.lifetimes.didRequest(context.request, { status: 201 }, null, store);
|
|
403
|
+
return store.peekRecord(result.data);
|
|
404
|
+
}).catch((e) => {
|
|
405
|
+
let err = e;
|
|
406
|
+
if (!e) err = /* @__PURE__ */ new Error(`Unknown Error Occurred During Request`);
|
|
407
|
+
else if (typeof e === "string") err = new Error(e);
|
|
408
|
+
adapterDidInvalidate(store, identifier, err);
|
|
409
|
+
throw err;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function adapterDidInvalidate(store, identifier, error) {
|
|
413
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
414
|
+
if (error && error.isAdapterError === true && error.code === "InvalidError") {
|
|
415
|
+
const serializer = store.serializerFor(identifier.type);
|
|
416
|
+
if (serializer && typeof serializer.extractErrors === "function") error.errors = errorsHashToArray(serializer.extractErrors(store, store.modelFor(identifier.type), error, identifier.id));
|
|
417
|
+
}
|
|
418
|
+
const cache = store.cache;
|
|
419
|
+
if (error.errors) {
|
|
420
|
+
((test) => {
|
|
421
|
+
if (!test) throw new Error(`Expected the cache in use by resource ${String(identifier)} to have a getErrors(identifier) method for retrieving errors.`);
|
|
422
|
+
})(typeof cache.getErrors === "function");
|
|
423
|
+
let jsonApiErrors = error.errors;
|
|
424
|
+
if (jsonApiErrors.length === 0) jsonApiErrors = [{
|
|
425
|
+
title: "Invalid Error",
|
|
426
|
+
detail: "",
|
|
427
|
+
source: { pointer: "/data" }
|
|
428
|
+
}];
|
|
429
|
+
cache.commitWasRejected(identifier, jsonApiErrors);
|
|
430
|
+
} else cache.commitWasRejected(identifier);
|
|
431
|
+
}
|
|
432
|
+
function makeArray(value) {
|
|
433
|
+
return Array.isArray(value) ? value : [value];
|
|
434
|
+
}
|
|
435
|
+
const PRIMARY_ATTRIBUTE_KEY = "base";
|
|
436
|
+
function errorsHashToArray(errors) {
|
|
437
|
+
const out = [];
|
|
438
|
+
if (errors) Object.keys(errors).forEach((key) => {
|
|
439
|
+
const messages = makeArray(errors[key]);
|
|
440
|
+
for (let i = 0; i < messages.length; i++) {
|
|
441
|
+
let title = "Invalid Attribute";
|
|
442
|
+
let pointer = `/data/attributes/${key}`;
|
|
443
|
+
if (key === PRIMARY_ATTRIBUTE_KEY) {
|
|
444
|
+
title = "Invalid Document";
|
|
445
|
+
pointer = `/data`;
|
|
446
|
+
}
|
|
447
|
+
out.push({
|
|
448
|
+
title,
|
|
449
|
+
detail: messages[i],
|
|
450
|
+
source: { pointer }
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return out;
|
|
455
|
+
}
|
|
456
|
+
function findRecord(context) {
|
|
457
|
+
const { store, data } = context.request;
|
|
458
|
+
const { record: identifier, options } = data;
|
|
459
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
460
|
+
assertPrivateStore(store);
|
|
461
|
+
let promise;
|
|
462
|
+
if (!store._instanceCache.recordIsLoaded(identifier)) promise = store._fetchManager.fetchDataIfNeededForIdentifier(identifier, options, context.request);
|
|
463
|
+
else if (options.reload) {
|
|
464
|
+
assertIdentifierHasId(identifier);
|
|
465
|
+
promise = store._fetchManager.scheduleFetch(identifier, options, context.request);
|
|
466
|
+
} else {
|
|
467
|
+
let snapshot = null;
|
|
468
|
+
const adapter = store.adapterFor(identifier.type);
|
|
469
|
+
if (typeof options.reload === "undefined" && adapter.shouldReloadRecord && adapter.shouldReloadRecord(store, snapshot = store._fetchManager.createSnapshot(identifier, options))) {
|
|
470
|
+
assertIdentifierHasId(identifier);
|
|
471
|
+
promise = store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), context.request);
|
|
472
|
+
} else {
|
|
473
|
+
if (options.backgroundReload !== false && (options.backgroundReload || !adapter.shouldBackgroundReloadRecord || adapter.shouldBackgroundReloadRecord(store, snapshot = snapshot || store._fetchManager.createSnapshot(identifier, options)))) {
|
|
474
|
+
assertIdentifierHasId(identifier);
|
|
475
|
+
store._fetchManager.scheduleFetch(identifier, Object.assign({}, options, { backgroundReload: true }), context.request);
|
|
476
|
+
}
|
|
477
|
+
promise = Promise.resolve(identifier);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return promise.then((i) => store.peekRecord(i));
|
|
481
|
+
}
|
|
482
|
+
function findAll(context) {
|
|
483
|
+
const { store, data } = context.request;
|
|
484
|
+
const { type, options } = data;
|
|
485
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
486
|
+
assertPrivateStore(store);
|
|
487
|
+
const adapter = store.adapterFor(type);
|
|
488
|
+
((test) => {
|
|
489
|
+
if (!test) throw new Error(`You tried to load all records but you have no adapter (for ${type})`);
|
|
490
|
+
})(adapter);
|
|
491
|
+
((test) => {
|
|
492
|
+
if (!test) throw new Error(`You tried to load all records but your adapter does not implement 'findAll'`);
|
|
493
|
+
})(typeof adapter.findAll === "function");
|
|
494
|
+
const maybeRecordArray = store.recordArrayManager._live.get(type);
|
|
495
|
+
const snapshotArray = new SnapshotRecordArray(store, type, options);
|
|
496
|
+
const shouldReload = options.reload || options.reload !== false && (adapter.shouldReloadAll && adapter.shouldReloadAll(store, snapshotArray) || !adapter.shouldReloadAll && snapshotArray.length === 0);
|
|
497
|
+
let fetch;
|
|
498
|
+
if (shouldReload) {
|
|
499
|
+
maybeRecordArray && (maybeRecordArray.isUpdating = true);
|
|
500
|
+
fetch = _findAll(adapter, store, type, snapshotArray, context.request, true);
|
|
501
|
+
} else {
|
|
502
|
+
fetch = Promise.resolve(store.peekAll(type));
|
|
503
|
+
if (options.backgroundReload || options.backgroundReload !== false && (!adapter.shouldBackgroundReloadAll || adapter.shouldBackgroundReloadAll(store, snapshotArray))) {
|
|
504
|
+
maybeRecordArray && (maybeRecordArray.isUpdating = true);
|
|
505
|
+
_findAll(adapter, store, type, snapshotArray, context.request, false);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return fetch;
|
|
509
|
+
}
|
|
510
|
+
function _findAll(adapter, store, type, snapshotArray, request, isAsyncFlush) {
|
|
511
|
+
const schema = store.modelFor(type);
|
|
512
|
+
let promise = Promise.resolve().then(() => adapter.findAll(store, schema, null, snapshotArray));
|
|
513
|
+
promise = promise.then((adapterPayload) => {
|
|
514
|
+
((test) => {
|
|
515
|
+
if (!test) throw new Error(`You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`);
|
|
516
|
+
})(payloadIsNotBlank(adapterPayload));
|
|
517
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
518
|
+
const serializer = store.serializerFor(type);
|
|
519
|
+
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, "findAll");
|
|
520
|
+
store._push(payload, isAsyncFlush);
|
|
521
|
+
snapshotArray._recordArray.isUpdating = false;
|
|
522
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) console.log(`request: findAll<${type}> background reload complete`);
|
|
523
|
+
return snapshotArray._recordArray;
|
|
524
|
+
});
|
|
525
|
+
if (!request.disableTestWaiter) promise = waitFor(promise);
|
|
526
|
+
return promise;
|
|
527
|
+
}
|
|
528
|
+
function query(context) {
|
|
529
|
+
const { store, data } = context.request;
|
|
530
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
531
|
+
assertPrivateStore(store);
|
|
532
|
+
let { options } = data;
|
|
533
|
+
const { type, query } = data;
|
|
534
|
+
const adapter = store.adapterFor(type);
|
|
535
|
+
((test) => {
|
|
536
|
+
if (!test) throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
537
|
+
})(adapter);
|
|
538
|
+
((test) => {
|
|
539
|
+
if (!test) throw new Error(`You tried to make a query but your adapter does not implement 'query'`);
|
|
540
|
+
})(typeof adapter.query === "function");
|
|
541
|
+
const recordArray = options._recordArray || store.recordArrayManager.getCollection({
|
|
542
|
+
type,
|
|
543
|
+
query
|
|
544
|
+
});
|
|
545
|
+
options = Object.assign({}, options);
|
|
546
|
+
delete options._recordArray;
|
|
547
|
+
const schema = store.modelFor(type);
|
|
548
|
+
return Promise.resolve().then(() => adapter.query(store, schema, query, recordArray, options)).then((adapterPayload) => {
|
|
549
|
+
const serializer = store.serializerFor(type);
|
|
550
|
+
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, "query");
|
|
551
|
+
const identifiers = store._push(payload, true);
|
|
552
|
+
((test) => {
|
|
553
|
+
if (!test) throw new Error("The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.");
|
|
554
|
+
})(Array.isArray(identifiers));
|
|
555
|
+
store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload);
|
|
556
|
+
return recordArray;
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
function assertSingleResourceDocument(payload) {
|
|
560
|
+
((test) => {
|
|
561
|
+
if (!test) throw new Error(`Expected the primary data returned by the serializer for a 'queryRecord' response to be a single object or null but instead it was an array.`);
|
|
562
|
+
})(!Array.isArray(payload.data));
|
|
563
|
+
}
|
|
564
|
+
function queryRecord(context) {
|
|
565
|
+
const { store, data } = context.request;
|
|
566
|
+
const { type, query, options } = data;
|
|
567
|
+
/* @__PURE__ */ upgradeStore(store);
|
|
568
|
+
const adapter = store.adapterFor(type);
|
|
569
|
+
((test) => {
|
|
570
|
+
if (!test) throw new Error(`You tried to make a query but you have no adapter (for ${type})`);
|
|
571
|
+
})(adapter);
|
|
572
|
+
((test) => {
|
|
573
|
+
if (!test) throw new Error(`You tried to make a query but your adapter does not implement 'queryRecord'`);
|
|
574
|
+
})(typeof adapter.queryRecord === "function");
|
|
575
|
+
const schema = store.modelFor(type);
|
|
576
|
+
return Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options)).then((adapterPayload) => {
|
|
577
|
+
const serializer = store.serializerFor(type);
|
|
578
|
+
const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, "queryRecord");
|
|
579
|
+
assertSingleResourceDocument(payload);
|
|
580
|
+
const identifier = store._push(payload, true);
|
|
581
|
+
return identifier ? store.peekRecord(identifier) : null;
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/compat.ts
|
|
587
|
+
/**
|
|
588
|
+
* Extends the signature of {@link Store} with additional
|
|
589
|
+
* methods available when using the legacy network layer.
|
|
590
|
+
*
|
|
591
|
+
* @public
|
|
592
|
+
* @noInheritDoc
|
|
593
|
+
* @legacy
|
|
594
|
+
*/
|
|
595
|
+
/**
|
|
596
|
+
* @deprecated - use {@link LegacyStoreCompat} instead
|
|
597
|
+
*/
|
|
598
|
+
/**
|
|
599
|
+
Returns an instance of the adapter for a given type. For
|
|
600
|
+
example, `adapterFor('person')` will return an instance of
|
|
601
|
+
the adapter located at `app/adapters/person.js`
|
|
602
|
+
|
|
603
|
+
If no `person` adapter is found, this method will look
|
|
604
|
+
for an `application` adapter (the default adapter for
|
|
605
|
+
your entire application).
|
|
606
|
+
|
|
607
|
+
@public
|
|
608
|
+
@param modelName
|
|
609
|
+
*/
|
|
610
|
+
function adapterFor(modelName, _allowMissing) {
|
|
611
|
+
((test) => {
|
|
612
|
+
if (!test) throw new Error(`Attempted to call store.adapterFor(), but the store instance has already been destroyed.`);
|
|
613
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
614
|
+
((test) => {
|
|
615
|
+
if (!test) throw new Error(`You need to pass a model name to the store's adapterFor method`);
|
|
616
|
+
})(modelName);
|
|
617
|
+
((test) => {
|
|
618
|
+
if (!test) throw new Error(`Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
619
|
+
})(typeof modelName === "string");
|
|
620
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
621
|
+
this._adapterCache = this._adapterCache || Object.create(null);
|
|
622
|
+
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
623
|
+
const { _adapterCache } = this;
|
|
624
|
+
let adapter = _adapterCache[normalizedModelName];
|
|
625
|
+
if (adapter) return adapter;
|
|
626
|
+
const owner = getOwner(this);
|
|
627
|
+
adapter = owner.lookup(`adapter:${normalizedModelName}`);
|
|
628
|
+
if (adapter !== void 0) {
|
|
629
|
+
_adapterCache[normalizedModelName] = adapter;
|
|
630
|
+
return adapter;
|
|
631
|
+
}
|
|
632
|
+
adapter = _adapterCache.application || owner.lookup("adapter:application");
|
|
633
|
+
if (adapter !== void 0) {
|
|
634
|
+
_adapterCache[normalizedModelName] = adapter;
|
|
635
|
+
_adapterCache.application = adapter;
|
|
636
|
+
return adapter;
|
|
637
|
+
}
|
|
638
|
+
((test) => {
|
|
639
|
+
if (!test) throw new Error(`No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`);
|
|
640
|
+
})(_allowMissing);
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
Returns an instance of the serializer for a given type. For
|
|
644
|
+
example, `serializerFor('person')` will return an instance of
|
|
645
|
+
`App.PersonSerializer`.
|
|
646
|
+
|
|
647
|
+
If no `App.PersonSerializer` is found, this method will look
|
|
648
|
+
for an `App.ApplicationSerializer` (the default serializer for
|
|
649
|
+
your entire application).
|
|
650
|
+
|
|
651
|
+
If a serializer cannot be found on the adapter, it will fall back
|
|
652
|
+
to an instance of `JSONSerializer`.
|
|
653
|
+
|
|
654
|
+
@public
|
|
655
|
+
@param modelName the record to serialize
|
|
656
|
+
*/
|
|
657
|
+
function serializerFor(modelName) {
|
|
658
|
+
((test) => {
|
|
659
|
+
if (!test) throw new Error(`Attempted to call store.serializerFor(), but the store instance has already been destroyed.`);
|
|
660
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
661
|
+
((test) => {
|
|
662
|
+
if (!test) throw new Error(`You need to pass a model name to the store's serializerFor method`);
|
|
663
|
+
})(modelName);
|
|
664
|
+
((test) => {
|
|
665
|
+
if (!test) throw new Error(`Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`);
|
|
666
|
+
})(typeof modelName === "string");
|
|
667
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
668
|
+
this._serializerCache = this._serializerCache || Object.create(null);
|
|
669
|
+
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
670
|
+
const { _serializerCache } = this;
|
|
671
|
+
let serializer = _serializerCache[normalizedModelName];
|
|
672
|
+
if (serializer) return serializer;
|
|
673
|
+
const owner = getOwner(this);
|
|
674
|
+
serializer = owner.lookup(`serializer:${normalizedModelName}`);
|
|
675
|
+
if (serializer !== void 0) {
|
|
676
|
+
_serializerCache[normalizedModelName] = serializer;
|
|
677
|
+
return serializer;
|
|
678
|
+
}
|
|
679
|
+
serializer = _serializerCache.application || owner.lookup("serializer:application");
|
|
680
|
+
if (serializer !== void 0) {
|
|
681
|
+
_serializerCache[normalizedModelName] = serializer;
|
|
682
|
+
_serializerCache.application = serializer;
|
|
683
|
+
return serializer;
|
|
684
|
+
}
|
|
685
|
+
return null;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
`normalize` converts a json payload into the normalized form expected by
|
|
689
|
+
{@link Store.push | push} using the serializer specified by `modelName`
|
|
690
|
+
|
|
691
|
+
:::warning
|
|
692
|
+
Generally it would be better to invoke the serializer yourself directly,
|
|
693
|
+
or write a more specialized normalization utility.
|
|
694
|
+
:::
|
|
695
|
+
|
|
696
|
+
Example
|
|
697
|
+
|
|
698
|
+
```js
|
|
699
|
+
socket.on('message', function(message) {
|
|
700
|
+
let modelName = message.model;
|
|
701
|
+
let data = message.data;
|
|
702
|
+
store.push(store.normalize(modelName, data));
|
|
703
|
+
});
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
@legacy
|
|
707
|
+
@public
|
|
708
|
+
@param modelName The name of the model type for this payload
|
|
709
|
+
@return The normalized payload
|
|
710
|
+
*/
|
|
711
|
+
function normalize(modelName, payload) {
|
|
712
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
713
|
+
((test) => {
|
|
714
|
+
if (!test) throw new Error(`Attempted to call store.normalize(), but the store instance has already been destroyed.`);
|
|
715
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
716
|
+
((test) => {
|
|
717
|
+
if (!test) throw new Error(`You need to pass a model name to the store's normalize method`);
|
|
718
|
+
})(modelName);
|
|
719
|
+
((test) => {
|
|
720
|
+
if (!test) throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`);
|
|
721
|
+
})(typeof modelName === "string");
|
|
722
|
+
const normalizedModelName = _deprecatingNormalize(modelName);
|
|
723
|
+
const serializer = this.serializerFor(normalizedModelName);
|
|
724
|
+
const schema = this.modelFor(normalizedModelName);
|
|
725
|
+
((test) => {
|
|
726
|
+
if (!test) throw new Error(`You must define a normalize method in your serializer in order to call store.normalize`);
|
|
727
|
+
})(typeof serializer?.normalize === "function");
|
|
728
|
+
return serializer.normalize(schema, payload);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
Push some raw data into the store.
|
|
732
|
+
|
|
733
|
+
This method can be used both to push in brand new
|
|
734
|
+
records, as well as to update existing records. You
|
|
735
|
+
can push in more than one type of object at once.
|
|
736
|
+
All objects should be in the format expected by the
|
|
737
|
+
serializer.
|
|
738
|
+
|
|
739
|
+
```js [app/serializers/application.js]
|
|
740
|
+
import RESTSerializer from '@warp-drive/legacy/serializer/rest';
|
|
741
|
+
|
|
742
|
+
export default class ApplicationSerializer extends RESTSerializer;
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
```js
|
|
746
|
+
let pushData = {
|
|
747
|
+
posts: [
|
|
748
|
+
{ id: 1, postTitle: "Great post", commentIds: [2] }
|
|
749
|
+
],
|
|
750
|
+
comments: [
|
|
751
|
+
{ id: 2, commentBody: "Insightful comment" }
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
store.pushPayload(pushData);
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
By default, the data will be deserialized using a default
|
|
759
|
+
serializer (the application serializer if it exists).
|
|
760
|
+
|
|
761
|
+
Alternatively, `pushPayload` will accept a model type which
|
|
762
|
+
will determine which serializer will process the payload.
|
|
763
|
+
|
|
764
|
+
```js [app/serializers/application.js]
|
|
765
|
+
import RESTSerializer from '@warp-drive/legacy/serializer/rest';
|
|
766
|
+
|
|
767
|
+
export default class ApplicationSerializer extends RESTSerializer;
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
```js [app/serializers/post.js]
|
|
771
|
+
import JSONSerializer from '@warp-drive/legacy/serializer/json';
|
|
772
|
+
|
|
773
|
+
export default JSONSerializer;
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
```js
|
|
777
|
+
store.pushPayload(pushData); // Will use the application serializer
|
|
778
|
+
store.pushPayload('post', pushData); // Will use the post serializer
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
@public
|
|
782
|
+
@param modelName Optionally, a model type used to determine which serializer will be used
|
|
783
|
+
@param inputPayload
|
|
784
|
+
*/
|
|
785
|
+
function pushPayload(modelName, inputPayload) {
|
|
786
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
787
|
+
((test) => {
|
|
788
|
+
if (!test) throw new Error(`Attempted to call store.pushPayload(), but the store instance has already been destroyed.`);
|
|
789
|
+
})(!(this.isDestroying || this.isDestroyed));
|
|
790
|
+
const payload = inputPayload || modelName;
|
|
791
|
+
const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : "application";
|
|
792
|
+
const serializer = this.serializerFor(normalizedModelName);
|
|
793
|
+
((test) => {
|
|
794
|
+
if (!test) throw new Error(`You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`);
|
|
795
|
+
})(serializer && typeof serializer.pushPayload === "function");
|
|
796
|
+
serializer.pushPayload(this, payload);
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Serializes a record using the store's legacy network layer, as with
|
|
800
|
+
* {@link LegacyStoreCompat.serializeRecord | store.serializeRecord}.
|
|
801
|
+
*/
|
|
802
|
+
function serializeRecord(record, options) {
|
|
803
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
804
|
+
if (!this._fetchManager) this._fetchManager = new FetchManager(this);
|
|
805
|
+
return this._fetchManager.createSnapshot(recordIdentifierFor(record)).serialize(options);
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Destroys any adapters/serializers the legacy network layer has created
|
|
809
|
+
* for this store, invoked when the store itself is destroyed.
|
|
810
|
+
*/
|
|
811
|
+
function cleanup() {
|
|
812
|
+
/* @__PURE__ */ upgradeStore(this);
|
|
813
|
+
for (const adapterName in this._adapterCache) {
|
|
814
|
+
const adapter = this._adapterCache[adapterName];
|
|
815
|
+
if (typeof adapter.destroy === "function") adapter.destroy();
|
|
816
|
+
}
|
|
817
|
+
for (const serializerName in this._serializerCache) {
|
|
818
|
+
const serializer = this._serializerCache[serializerName];
|
|
819
|
+
if (typeof serializer.destroy === "function") serializer.destroy();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
//#endregion
|
|
824
|
+
export { serializeRecord as a, pushPayload as i, cleanup as n, serializerFor as o, normalize as r, LegacyNetworkHandler as s, adapterFor as t };
|
|
825
|
+
//# sourceMappingURL=compat-CeyxXB7K.js.map
|