@warp-drive/legacy 5.10.0-alpha.2 → 5.10.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -8
- package/blueprints/adapter/files/__root__/__path__/__name__.js +1 -0
- package/blueprints/adapter/index.js +27 -0
- package/blueprints/adapter-test/index.js +33 -0
- package/blueprints/adapter-test/qunit-files/__root__/__path__/__test__.js +1 -0
- package/blueprints/model/HELP.md +26 -0
- package/blueprints/model/files/__root__/__path__/__name__.js +1 -0
- package/blueprints/model/index.js +27 -0
- package/blueprints/model-test/index.js +33 -0
- package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +1 -0
- package/blueprints/serializer/files/__root__/__path__/__name__.js +1 -0
- package/blueprints/serializer/index.js +27 -0
- package/blueprints/serializer-test/index.js +33 -0
- package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +1 -0
- package/blueprints/transform/files/__root__/__path__/__name__.js +1 -0
- package/blueprints/transform/index.js +17 -0
- package/blueprints/transform-test/index.js +33 -0
- package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +1 -0
- package/dist/{-private-DccRZQsm.js → -private-0_Oc-M3x.js} +10 -17
- package/dist/-private-0_Oc-M3x.js.map +1 -0
- package/dist/{-private-DQ6Iap2t.js → -private-L2BtGGYa.js} +8 -14
- package/dist/{-private-DQ6Iap2t.js.map → -private-L2BtGGYa.js.map} +1 -1
- package/dist/adapter/-private.d.ts +2 -12
- package/dist/adapter/-private.d.ts.map +1 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.d.ts +1 -1
- package/dist/adapter/error.js +54 -2
- package/dist/adapter/error.js.map +1 -1
- package/dist/adapter/json-api.d.ts +5 -5
- package/dist/adapter/json-api.d.ts.map +1 -1
- package/dist/adapter/json-api.js +10 -4
- package/dist/adapter/json-api.js.map +1 -1
- package/dist/adapter/rest.d.ts +1 -1
- package/dist/adapter/rest.js +23 -5
- package/dist/adapter/rest.js.map +1 -1
- package/dist/{adapter-eYo2pIuM.js → adapter-AwGvdMSZ.js} +45 -6
- package/dist/adapter-AwGvdMSZ.js.map +1 -0
- package/dist/{adapter-CARrK3-8.d.ts → adapter-DvDVeaCc.d.ts} +9 -6
- package/dist/adapter-DvDVeaCc.d.ts.map +1 -0
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.js +1 -1
- package/dist/compat/-private.d.ts +1 -1
- package/dist/compat/-private.js +1 -1
- package/dist/compat/builders.d.ts +10 -8
- package/dist/compat/builders.d.ts.map +1 -1
- package/dist/compat/builders.js +15 -9
- package/dist/compat/builders.js.map +1 -1
- package/dist/compat/extensions.d.ts +1 -1
- package/dist/compat/extensions.js +23 -2
- package/dist/compat/extensions.js.map +1 -1
- package/dist/compat/utils.d.ts +17 -2
- package/dist/compat/utils.d.ts.map +1 -1
- package/dist/compat/utils.js +19 -2
- package/dist/compat/utils.js.map +1 -1
- package/dist/{compat-DcHVxuuZ.js → compat-C-yQnbkF.js} +61 -8
- package/dist/compat-C-yQnbkF.js.map +1 -0
- package/dist/{compat-BbNNmTM-.d.ts → compat-DoWEarkU.d.ts} +30 -17
- package/dist/compat-DoWEarkU.d.ts.map +1 -0
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +1 -1
- package/dist/{error-CzkyXr1Q.d.ts → error-798wGD3r.d.ts} +49 -3
- package/dist/error-798wGD3r.d.ts.map +1 -0
- package/dist/{errors-CS110tMl.js → errors-BEExAZtv.js} +42 -32
- package/dist/errors-BEExAZtv.js.map +1 -0
- package/dist/{extensions-DumNm4dA.d.ts → extensions-DcEz1lKv.d.ts} +18 -3
- package/dist/extensions-DcEz1lKv.d.ts.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/{json-BXNPTlcH.js → json-Baaga4BP.js} +10 -5
- package/dist/json-Baaga4BP.js.map +1 -0
- package/dist/model/-private.d.ts +1 -1
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.d.ts +19 -4
- package/dist/model/migration-support.d.ts.map +1 -1
- package/dist/model/migration-support.js +25 -7
- package/dist/model/migration-support.js.map +1 -1
- package/dist/{model-DWH9f__L.js → model-Be-e84FX.js} +19 -12
- package/dist/model-Be-e84FX.js.map +1 -0
- package/dist/{model-62hn5_PD.d.ts → model-DAdY1ibr.d.ts} +13 -26
- package/dist/model-DAdY1ibr.d.ts.map +1 -0
- package/dist/{unpkg/dev-deprecated/model-fragments-DSqu0ptR.js → model-fragments-DCHMDr5f.js} +32 -18
- package/dist/model-fragments-DCHMDr5f.js.map +1 -0
- package/dist/model-fragments.d.ts +31 -19
- package/dist/model-fragments.d.ts.map +1 -1
- package/dist/model-fragments.js +1 -1
- package/dist/model.d.ts +12 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -2
- package/dist/{rest-0NhtexIq.d.ts → rest-CmFneLJH.d.ts} +18 -8
- package/dist/rest-CmFneLJH.d.ts.map +1 -0
- package/dist/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
- package/dist/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
- package/dist/{schema-provider-DguGmQDS.js → schema-provider-BAB8DyMr.js} +22 -21
- package/dist/schema-provider-BAB8DyMr.js.map +1 -0
- package/dist/serializer/json-api.d.ts +1 -2
- package/dist/serializer/json-api.d.ts.map +1 -1
- package/dist/serializer/json-api.js +7 -3
- package/dist/serializer/json-api.js.map +1 -1
- package/dist/serializer/json.d.ts +2 -2
- package/dist/serializer/json.d.ts.map +1 -1
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.d.ts +4 -4
- package/dist/serializer/rest.d.ts.map +1 -1
- package/dist/serializer/rest.js +12 -5
- package/dist/serializer/rest.js.map +1 -1
- package/dist/serializer/transform.d.ts +9 -10
- package/dist/serializer/transform.d.ts.map +1 -1
- package/dist/serializer/transform.js +14 -10
- package/dist/serializer/transform.js.map +1 -1
- package/dist/serializer.d.ts +2 -2
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +42 -3
- package/dist/serializer.js.map +1 -1
- package/dist/{store-C4qYzXei.js → store-BLKEsJyw.js} +13 -7
- package/dist/store-BLKEsJyw.js.map +1 -0
- package/dist/store.d.ts +3 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -1
- package/dist/unpkg/dev/{-private-CrEyBE-B.js → -private-BprUAEe_.js} +8 -14
- package/dist/unpkg/{dev-deprecated/-private-CrEyBE-B.js.map → dev/-private-BprUAEe_.js.map} +1 -1
- package/dist/unpkg/dev/{-private-vOhxVExH.js → -private-Dch4SxkU.js} +10 -17
- package/dist/unpkg/dev/-private-Dch4SxkU.js.map +1 -0
- package/dist/unpkg/dev/adapter/-private.js +1 -1
- package/dist/unpkg/dev/adapter/error.js +54 -2
- package/dist/unpkg/dev/adapter/error.js.map +1 -1
- package/dist/unpkg/dev/adapter/json-api.js +10 -4
- package/dist/unpkg/dev/adapter/json-api.js.map +1 -1
- package/dist/unpkg/dev/adapter/rest.js +23 -5
- package/dist/unpkg/dev/adapter/rest.js.map +1 -1
- package/dist/unpkg/dev/{adapter-oLwyr47q.js → adapter-BAn4SeUA.js} +45 -6
- package/dist/unpkg/dev/adapter-BAn4SeUA.js.map +1 -0
- package/dist/unpkg/dev/adapter.js +1 -1
- package/dist/unpkg/dev/compat/-private.js +1 -1
- package/dist/unpkg/dev/compat/builders.js +15 -9
- package/dist/unpkg/dev/compat/builders.js.map +1 -1
- package/dist/unpkg/dev/compat/extensions.js +23 -2
- package/dist/unpkg/dev/compat/extensions.js.map +1 -1
- package/dist/unpkg/dev/compat/utils.js +19 -2
- package/dist/unpkg/dev/compat/utils.js.map +1 -1
- package/dist/unpkg/dev/{compat-DNQT2TQx.js → compat-BdovRRzQ.js} +62 -10
- package/dist/unpkg/dev/compat-BdovRRzQ.js.map +1 -0
- package/dist/unpkg/dev/compat.js +1 -1
- package/dist/unpkg/dev/{errors-DnzvLM2A.js → errors-CGvbM6WH.js} +42 -32
- package/dist/unpkg/dev/errors-CGvbM6WH.js.map +1 -0
- package/dist/unpkg/dev/index.js +25 -7
- package/dist/unpkg/dev/index.js.map +1 -1
- package/dist/unpkg/{dev-deprecated/json-DDJji3V3.js → dev/json-BlSBe84o.js} +10 -5
- package/dist/unpkg/dev/json-BlSBe84o.js.map +1 -0
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +24 -6
- package/dist/unpkg/dev/model/migration-support.js.map +1 -1
- package/dist/unpkg/dev/{model-BxPIR7m2.js → model-QCZr8eec.js} +19 -12
- package/dist/unpkg/dev/model-QCZr8eec.js.map +1 -0
- package/dist/{model-fragments-DSqu0ptR.js → unpkg/dev/model-fragments-DCHMDr5f.js} +32 -18
- package/dist/unpkg/dev/model-fragments-DCHMDr5f.js.map +1 -0
- package/dist/unpkg/dev/model-fragments.js +1 -1
- package/dist/unpkg/dev/model.js +2 -2
- package/dist/unpkg/dev/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
- package/dist/unpkg/dev/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
- package/dist/unpkg/dev/{schema-provider-CI_a48ja.js → schema-provider-IMFO9Kgw.js} +18 -17
- package/dist/unpkg/dev/schema-provider-IMFO9Kgw.js.map +1 -0
- package/dist/unpkg/dev/serializer/json-api.js +7 -3
- package/dist/unpkg/dev/serializer/json-api.js.map +1 -1
- package/dist/unpkg/dev/serializer/json.js +1 -1
- package/dist/unpkg/dev/serializer/rest.js +12 -5
- package/dist/unpkg/dev/serializer/rest.js.map +1 -1
- package/dist/unpkg/dev/serializer/transform.js +14 -10
- package/dist/unpkg/dev/serializer/transform.js.map +1 -1
- package/dist/unpkg/dev/serializer.js +42 -3
- package/dist/unpkg/dev/serializer.js.map +1 -1
- package/dist/unpkg/dev/{store-D_V8-HQl.js → store-BiXsLLAu.js} +13 -7
- package/dist/unpkg/dev/store-BiXsLLAu.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/{util-dSKEgQDp.js → util-CI7b4vAE.js} +2 -3
- package/dist/unpkg/dev/{util-dSKEgQDp.js.map → util-CI7b4vAE.js.map} +1 -1
- package/dist/unpkg/{prod/utils-DYC9utVJ.js → dev/utils-_O0MjUTU.js} +2 -3
- package/dist/unpkg/dev/{utils-DYC9utVJ.js.map → utils-_O0MjUTU.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{-private-CrEyBE-B.js → -private-BprUAEe_.js} +8 -14
- package/dist/unpkg/{dev/-private-CrEyBE-B.js.map → dev-deprecated/-private-BprUAEe_.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{-private-vOhxVExH.js → -private-Dch4SxkU.js} +10 -17
- package/dist/unpkg/dev-deprecated/-private-Dch4SxkU.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/adapter/error.js +54 -2
- package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -1
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +10 -4
- package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js +23 -5
- package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{adapter-oLwyr47q.js → adapter-BAn4SeUA.js} +45 -6
- package/dist/unpkg/dev-deprecated/adapter-BAn4SeUA.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1 -1
- package/dist/unpkg/dev-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/compat/builders.js +15 -9
- package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -1
- package/dist/unpkg/dev-deprecated/compat/extensions.js +23 -2
- package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -1
- package/dist/unpkg/dev-deprecated/compat/utils.js +19 -2
- package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{compat-CeT0PnVX.js → compat-CPVriwH0.js} +62 -10
- package/dist/unpkg/dev-deprecated/compat-CPVriwH0.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat.js +1 -1
- package/dist/unpkg/dev-deprecated/{errors-jHQESeNQ.js → errors-yPc7D7r3.js} +42 -32
- package/dist/unpkg/dev-deprecated/errors-yPc7D7r3.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +25 -7
- package/dist/unpkg/dev-deprecated/index.js.map +1 -1
- package/dist/unpkg/{dev/json-DDJji3V3.js → dev-deprecated/json-BlSBe84o.js} +10 -5
- package/dist/unpkg/dev-deprecated/json-BlSBe84o.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +24 -6
- package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{model-BeGORt6h.js → model-B0ZNLaHO.js} +19 -12
- package/dist/unpkg/dev-deprecated/model-B0ZNLaHO.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/model-fragments-DSqu0ptR.js → dev-deprecated/model-fragments-DCHMDr5f.js} +32 -18
- package/dist/unpkg/dev-deprecated/model-fragments-DCHMDr5f.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model-fragments.js +1 -1
- package/dist/unpkg/dev-deprecated/model.js +2 -2
- package/dist/unpkg/dev-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
- package/dist/unpkg/dev-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{schema-provider-NmtdR4n_.js → schema-provider-DGWYnFno.js} +18 -17
- package/dist/unpkg/dev-deprecated/schema-provider-DGWYnFno.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +7 -3
- package/dist/unpkg/dev-deprecated/serializer/json-api.js.map +1 -1
- package/dist/unpkg/dev-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/dev-deprecated/serializer/rest.js +12 -5
- package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -1
- package/dist/unpkg/dev-deprecated/serializer/transform.js +14 -10
- package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -1
- package/dist/unpkg/dev-deprecated/serializer.js +42 -3
- package/dist/unpkg/dev-deprecated/serializer.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{store-BCOLSC6z.js → store-Ci8k7Lh6.js} +13 -7
- package/dist/unpkg/dev-deprecated/store-Ci8k7Lh6.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/{util-CXA3RNYH.js → util-DL_8JecH.js} +2 -3
- package/dist/unpkg/dev-deprecated/{util-CXA3RNYH.js.map → util-DL_8JecH.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/{utils-DQkMqhDv.js → utils-DyGjRZ14.js} +2 -3
- package/dist/unpkg/dev-deprecated/{utils-DQkMqhDv.js.map → utils-DyGjRZ14.js.map} +1 -1
- package/dist/unpkg/{prod-deprecated/-private-B4bxoTuK.js → prod/-private-Dc9yg98O.js} +8 -14
- package/dist/unpkg/{prod-deprecated/-private-B4bxoTuK.js.map → prod/-private-Dc9yg98O.js.map} +1 -1
- package/dist/unpkg/prod/{-private-SfXkkHKd.js → -private-DuRzYAyW.js} +9 -15
- package/dist/unpkg/prod/-private-DuRzYAyW.js.map +1 -0
- package/dist/unpkg/prod/adapter/-private.js +1 -1
- package/dist/unpkg/prod/adapter/error.js +54 -2
- package/dist/unpkg/prod/adapter/error.js.map +1 -1
- package/dist/unpkg/prod/adapter/json-api.js +10 -4
- package/dist/unpkg/prod/adapter/json-api.js.map +1 -1
- package/dist/unpkg/prod/adapter/rest.js +23 -5
- package/dist/unpkg/prod/adapter/rest.js.map +1 -1
- package/dist/unpkg/prod/{adapter-DQ9UA7FC.js → adapter-D0HCLrwm.js} +45 -6
- package/dist/unpkg/prod/adapter-D0HCLrwm.js.map +1 -0
- package/dist/unpkg/prod/adapter.js +1 -1
- package/dist/unpkg/prod/compat/-private.js +1 -1
- package/dist/unpkg/prod/compat/builders.js +15 -9
- package/dist/unpkg/prod/compat/builders.js.map +1 -1
- package/dist/unpkg/prod/compat/extensions.js +23 -2
- package/dist/unpkg/prod/compat/extensions.js.map +1 -1
- package/dist/unpkg/prod/compat/utils.js +19 -2
- package/dist/unpkg/prod/compat/utils.js.map +1 -1
- package/dist/unpkg/{prod-deprecated/compat-DxiVkCUb.js → prod/compat-PrUuencH.js} +62 -10
- package/dist/unpkg/prod/compat-PrUuencH.js.map +1 -0
- package/dist/unpkg/prod/compat.js +1 -1
- package/dist/unpkg/prod/{errors-DQDfNqVx.js → errors-Bw8niCo8.js} +38 -27
- package/dist/unpkg/prod/errors-Bw8niCo8.js.map +1 -0
- package/dist/unpkg/prod/index.js +25 -7
- package/dist/unpkg/prod/index.js.map +1 -1
- package/dist/unpkg/prod/{json-BD1kRTfB.js → json-D1bH8enA.js} +10 -5
- package/dist/unpkg/prod/json-D1bH8enA.js.map +1 -0
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +24 -6
- package/dist/unpkg/prod/model/migration-support.js.map +1 -1
- package/dist/unpkg/prod/{model-CYMA-e_S.js → model-QtC0IWbE.js} +19 -12
- package/dist/unpkg/prod/model-QtC0IWbE.js.map +1 -0
- package/dist/unpkg/prod/model-fragments-DCHMDr5f.js +348 -0
- package/dist/unpkg/prod/model-fragments-DCHMDr5f.js.map +1 -0
- package/dist/unpkg/prod/model-fragments.js +1 -1
- package/dist/unpkg/prod/model.js +2 -2
- package/dist/unpkg/prod/runtime--fcdnjmJ-5yaSpa-d.js +52 -0
- package/dist/unpkg/prod/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
- package/dist/unpkg/prod/{schema-provider-05U1H-Kl.js → schema-provider-DPOzTa8e.js} +18 -17
- package/dist/unpkg/prod/schema-provider-DPOzTa8e.js.map +1 -0
- package/dist/unpkg/prod/serializer/json-api.js +7 -3
- package/dist/unpkg/prod/serializer/json-api.js.map +1 -1
- package/dist/unpkg/prod/serializer/json.js +1 -1
- package/dist/unpkg/prod/serializer/rest.js +12 -5
- package/dist/unpkg/prod/serializer/rest.js.map +1 -1
- package/dist/unpkg/prod/serializer/transform.js +14 -10
- package/dist/unpkg/prod/serializer/transform.js.map +1 -1
- package/dist/unpkg/prod/serializer.js +42 -3
- package/dist/unpkg/prod/serializer.js.map +1 -1
- package/dist/unpkg/{prod-deprecated/store-0L2CkYzh.js → prod/store-BsSkzWgk.js} +13 -7
- package/dist/unpkg/{prod-deprecated/store-0L2CkYzh.js.map → prod/store-BsSkzWgk.js.map} +1 -1
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/{util-dSKEgQDp.js → util-CI7b4vAE.js} +2 -3
- package/dist/unpkg/prod/{util-dSKEgQDp.js.map → util-CI7b4vAE.js.map} +1 -1
- package/dist/unpkg/{dev/utils-DYC9utVJ.js → prod/utils-_O0MjUTU.js} +2 -3
- package/dist/unpkg/prod/{utils-DYC9utVJ.js.map → utils-_O0MjUTU.js.map} +1 -1
- package/dist/unpkg/{prod/-private-B4bxoTuK.js → prod-deprecated/-private-Dc9yg98O.js} +8 -14
- package/dist/unpkg/{prod/-private-B4bxoTuK.js.map → prod-deprecated/-private-Dc9yg98O.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{-private-SfXkkHKd.js → -private-DuRzYAyW.js} +9 -15
- package/dist/unpkg/prod-deprecated/-private-DuRzYAyW.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/adapter/error.js +54 -2
- package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -1
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +10 -4
- package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js +23 -5
- package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{adapter-DQ9UA7FC.js → adapter-D0HCLrwm.js} +45 -6
- package/dist/unpkg/prod-deprecated/adapter-D0HCLrwm.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1 -1
- package/dist/unpkg/prod-deprecated/compat/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/compat/builders.js +15 -9
- package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -1
- package/dist/unpkg/prod-deprecated/compat/extensions.js +23 -2
- package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -1
- package/dist/unpkg/prod-deprecated/compat/utils.js +19 -2
- package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -1
- package/dist/unpkg/{prod/compat-DxiVkCUb.js → prod-deprecated/compat-PrUuencH.js} +62 -10
- package/dist/unpkg/prod-deprecated/compat-PrUuencH.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat.js +1 -1
- package/dist/unpkg/prod-deprecated/{errors-ii4L43_1.js → errors-D20lKboZ.js} +38 -27
- package/dist/unpkg/prod-deprecated/errors-D20lKboZ.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +25 -7
- package/dist/unpkg/prod-deprecated/index.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{json-BD1kRTfB.js → json-D1bH8enA.js} +10 -5
- package/dist/unpkg/prod-deprecated/json-D1bH8enA.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +24 -6
- package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{model-D3oCPHtM.js → model-B946S2pl.js} +19 -12
- package/dist/unpkg/prod-deprecated/model-B946S2pl.js.map +1 -0
- package/dist/unpkg/{dev/model-fragments-DSqu0ptR.js → prod-deprecated/model-fragments-DCHMDr5f.js} +32 -18
- package/dist/unpkg/prod-deprecated/model-fragments-DCHMDr5f.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +1 -1
- package/dist/unpkg/prod-deprecated/model.js +2 -2
- package/dist/unpkg/prod-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js → runtime--fcdnjmJ-5yaSpa-d.js} +2 -3
- package/dist/unpkg/prod-deprecated/{runtime--fcdnjmJ-DMTJ0Kb3.js.map → runtime--fcdnjmJ-5yaSpa-d.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{schema-provider-CKH_bnnS.js → schema-provider-xcaytn9y.js} +18 -17
- package/dist/unpkg/prod-deprecated/schema-provider-xcaytn9y.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +7 -3
- package/dist/unpkg/prod-deprecated/serializer/json-api.js.map +1 -1
- package/dist/unpkg/prod-deprecated/serializer/json.js +1 -1
- package/dist/unpkg/prod-deprecated/serializer/rest.js +12 -5
- package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -1
- package/dist/unpkg/prod-deprecated/serializer/transform.js +14 -10
- package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -1
- package/dist/unpkg/prod-deprecated/serializer.js +42 -3
- package/dist/unpkg/prod-deprecated/serializer.js.map +1 -1
- package/dist/unpkg/{prod/store-RGGc1ilN.js → prod-deprecated/store-Dsw2f4s-.js} +13 -7
- package/dist/unpkg/{prod/store-RGGc1ilN.js.map → prod-deprecated/store-Dsw2f4s-.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/{util-CQQdHX3n.js → util-CVu5_VeN.js} +2 -3
- package/dist/unpkg/prod-deprecated/{util-CQQdHX3n.js.map → util-CVu5_VeN.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{utils-BMI_JwFP.js → utils-z1h-zTls.js} +2 -3
- package/dist/unpkg/prod-deprecated/{utils-BMI_JwFP.js.map → utils-z1h-zTls.js.map} +1 -1
- package/dist/{util-Bnx8nm-D.js → util-fMuLguoj.js} +2 -3
- package/dist/{util-Bnx8nm-D.js.map → util-fMuLguoj.js.map} +1 -1
- package/dist/{utils-ZAytYep8.js → utils-UqBsN9IU.js} +2 -3
- package/dist/{utils-ZAytYep8.js.map → utils-UqBsN9IU.js.map} +1 -1
- package/logos/README.md +1 -1
- package/package.json +17 -12
- package/dist/-private-DccRZQsm.js.map +0 -1
- package/dist/adapter-CARrK3-8.d.ts.map +0 -1
- package/dist/adapter-eYo2pIuM.js.map +0 -1
- package/dist/compat-BbNNmTM-.d.ts.map +0 -1
- package/dist/compat-DcHVxuuZ.js.map +0 -1
- package/dist/error-CzkyXr1Q.d.ts.map +0 -1
- package/dist/errors-CS110tMl.js.map +0 -1
- package/dist/extensions-DumNm4dA.d.ts.map +0 -1
- package/dist/json-BXNPTlcH.js.map +0 -1
- package/dist/model-62hn5_PD.d.ts.map +0 -1
- package/dist/model-DWH9f__L.js.map +0 -1
- package/dist/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/rest-0NhtexIq.d.ts.map +0 -1
- package/dist/schema-provider-DguGmQDS.js.map +0 -1
- package/dist/store-C4qYzXei.js.map +0 -1
- package/dist/unpkg/dev/-private-vOhxVExH.js.map +0 -1
- package/dist/unpkg/dev/adapter-oLwyr47q.js.map +0 -1
- package/dist/unpkg/dev/compat-DNQT2TQx.js.map +0 -1
- package/dist/unpkg/dev/errors-DnzvLM2A.js.map +0 -1
- package/dist/unpkg/dev/json-DDJji3V3.js.map +0 -1
- package/dist/unpkg/dev/model-BxPIR7m2.js.map +0 -1
- package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/dev/schema-provider-CI_a48ja.js.map +0 -1
- package/dist/unpkg/dev/store-D_V8-HQl.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-vOhxVExH.js.map +0 -1
- package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +0 -1
- package/dist/unpkg/dev-deprecated/compat-CeT0PnVX.js.map +0 -1
- package/dist/unpkg/dev-deprecated/errors-jHQESeNQ.js.map +0 -1
- package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +0 -1
- package/dist/unpkg/dev-deprecated/model-BeGORt6h.js.map +0 -1
- package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/dev-deprecated/schema-provider-NmtdR4n_.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-BCOLSC6z.js.map +0 -1
- package/dist/unpkg/prod/-private-SfXkkHKd.js.map +0 -1
- package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +0 -1
- package/dist/unpkg/prod/compat-DxiVkCUb.js.map +0 -1
- package/dist/unpkg/prod/errors-DQDfNqVx.js.map +0 -1
- package/dist/unpkg/prod/json-BD1kRTfB.js.map +0 -1
- package/dist/unpkg/prod/model-CYMA-e_S.js.map +0 -1
- package/dist/unpkg/prod/model-fragments-DSqu0ptR.js +0 -334
- package/dist/unpkg/prod/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/prod/runtime--fcdnjmJ-DMTJ0Kb3.js +0 -53
- package/dist/unpkg/prod/schema-provider-05U1H-Kl.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-SfXkkHKd.js.map +0 -1
- package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +0 -1
- package/dist/unpkg/prod-deprecated/compat-DxiVkCUb.js.map +0 -1
- package/dist/unpkg/prod-deprecated/errors-ii4L43_1.js.map +0 -1
- package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +0 -1
- package/dist/unpkg/prod-deprecated/model-D3oCPHtM.js.map +0 -1
- package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/prod-deprecated/schema-provider-CKH_bnnS.js.map +0 -1
package/dist/compat/utils.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
//#region src/compat/utils.d.ts
|
|
2
1
|
type Reporter = (type: "formatted-id" | "formatted-type", actual: unknown, expected: unknown) => void;
|
|
3
2
|
/**
|
|
4
3
|
* Configure a function to be called when an id or type
|
|
5
4
|
* changes during normalization. This is useful for instrumenting
|
|
6
5
|
* to discover places where usage in the app is not consistent.
|
|
7
6
|
*
|
|
7
|
+
* @summary Legacy migration helper that registers a callback invoked whenever `formattedId` or `formattedType`
|
|
8
|
+
* has to change the id or type it was given.
|
|
8
9
|
* @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
|
|
9
10
|
* @public
|
|
10
11
|
*/
|
|
@@ -14,6 +15,8 @@ export declare function configureMismatchReporter(fn: Reporter): void;
|
|
|
14
15
|
* fails validation. This is useful for instrumenting
|
|
15
16
|
* to discover places where usage in the app is not consistent.
|
|
16
17
|
*
|
|
18
|
+
* @summary Legacy migration helper that registers a callback invoked when an id or type passed to these utilities
|
|
19
|
+
* fails validation.
|
|
17
20
|
* @param fn - a function which takes a message and a condition
|
|
18
21
|
* @public
|
|
19
22
|
*/
|
|
@@ -28,6 +31,8 @@ export declare function configureAssertFn(fn: (message: string, condition: unkno
|
|
|
28
31
|
* the configured mismatch reporter and assert functions will
|
|
29
32
|
* be called.
|
|
30
33
|
*
|
|
34
|
+
* @summary Legacy migration helper that replaces the singularize-and-dasherize function `formattedType` and
|
|
35
|
+
* `isEquivType` use to normalize resource types.
|
|
31
36
|
* @param fn - a function which takes a string and returns a string
|
|
32
37
|
* @public
|
|
33
38
|
*/
|
|
@@ -57,6 +62,8 @@ export declare function configureTypeNormalization(fn: (type: string) => string)
|
|
|
57
62
|
* formattedType('PostComment'); // => 'post-comment'
|
|
58
63
|
* ```
|
|
59
64
|
*
|
|
65
|
+
* @summary Legacy migration helper that normalizes a resource type to the singular dasherized form the cache
|
|
66
|
+
* expects, such as `'PostComments'` to `'post-comment'`.
|
|
60
67
|
* @param type the potentially un-normalized type
|
|
61
68
|
* @return the normalized type
|
|
62
69
|
* @public
|
|
@@ -78,6 +85,8 @@ export declare function formattedType<T extends string>(type: T | string): T;
|
|
|
78
85
|
* formattedId(null); // => null
|
|
79
86
|
* ```
|
|
80
87
|
*
|
|
88
|
+
* @summary Legacy migration helper that normalizes a resource id to the `string` or `null` the cache expects,
|
|
89
|
+
* asserting on invalid ids such as `''` or `0`.
|
|
81
90
|
* @param id the potentially un-normalized id
|
|
82
91
|
* @return the normalized id
|
|
83
92
|
* @public
|
|
@@ -89,6 +98,8 @@ export declare function formattedId(id: string | number | null): string | null;
|
|
|
89
98
|
* Like {@link formattedId}, but asserts that `id` is not `null` rather
|
|
90
99
|
* than allowing and passing through `null`.
|
|
91
100
|
*
|
|
101
|
+
* @summary Legacy migration helper that normalizes a resource id to a string like `formattedId`, but asserts that
|
|
102
|
+
* it is not `null`.
|
|
92
103
|
* @public
|
|
93
104
|
*/
|
|
94
105
|
export declare function expectId(id: string | number): string;
|
|
@@ -118,6 +129,8 @@ export declare function expectId(id: null): never;
|
|
|
118
129
|
* isEquivType('posts', null); // false
|
|
119
130
|
* ```
|
|
120
131
|
*
|
|
132
|
+
* @summary Legacy migration helper that reports whether two resource types match after normalization, so
|
|
133
|
+
* `'posts'` and `'post'` are equivalent.
|
|
121
134
|
* @param expected a potentially unnormalized type to match against
|
|
122
135
|
* @param actual a potentially unnormalized type to match against
|
|
123
136
|
* @return true if the types are equivalent
|
|
@@ -140,11 +153,13 @@ export declare function isEquivType(expected: string, actual: string): boolean;
|
|
|
140
153
|
* isEquivId(1, null); // false
|
|
141
154
|
* ```
|
|
142
155
|
*
|
|
156
|
+
* @summary Legacy migration helper that reports whether two resource ids match after normalization, so `1` and
|
|
157
|
+
* `'1'` are equivalent.
|
|
143
158
|
* @param expected a potentially un-normalized id to match against
|
|
144
159
|
* @param actual a potentially un-normalized id to match against
|
|
145
160
|
* @return true if the ids are equivalent
|
|
146
161
|
* @public
|
|
147
162
|
*/
|
|
148
163
|
export declare function isEquivId(expected: string | number, actual: string | number | null): boolean;
|
|
149
|
-
|
|
164
|
+
export {};
|
|
150
165
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/compat/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/compat/utils.ts"],"mappings":"A,KAgBK,YAAY,yCAAyC,iBAAiB;;;;;;;;;;;wBA4B3D,0BAA0B,IAAI;;;;;;;;;;;wBAc9B,kBAAkB,KAAK,iBAAiB;;;;;;;;;;;;;;;;wBAmBxC,2BAA2B,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqChC,cAAc,kBAAkB,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;wBAyCnD,YAAY;wBACZ,YAAY;wBACZ,YAAY;;;;;;;;;wBA4BZ,SAAS;;;;;;wBAMT,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCT,YAAY,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;wBAqC9B,UAAU,2BAA2B"}
|
package/dist/compat/utils.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
2
2
|
import { dasherize, singularize } from "@warp-drive/utilities/string";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/compat/utils.ts
|
|
5
5
|
/**
|
|
6
6
|
Utilities for helping to migrate to stricter
|
|
7
7
|
and more consistent use of IDs and types.
|
|
8
8
|
|
|
9
|
+
@summary Legacy helpers that normalize, compare, and report mismatched resource ids and types while migrating to
|
|
10
|
+
stricter formats.
|
|
9
11
|
@module
|
|
10
12
|
*/
|
|
11
13
|
let MismatchReporter = function() {};
|
|
@@ -24,6 +26,8 @@ let NormalizedType = (str) => {
|
|
|
24
26
|
* changes during normalization. This is useful for instrumenting
|
|
25
27
|
* to discover places where usage in the app is not consistent.
|
|
26
28
|
*
|
|
29
|
+
* @summary Legacy migration helper that registers a callback invoked whenever `formattedId` or `formattedType`
|
|
30
|
+
* has to change the id or type it was given.
|
|
27
31
|
* @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
|
|
28
32
|
* @public
|
|
29
33
|
*/
|
|
@@ -35,6 +39,8 @@ function configureMismatchReporter(fn) {
|
|
|
35
39
|
* fails validation. This is useful for instrumenting
|
|
36
40
|
* to discover places where usage in the app is not consistent.
|
|
37
41
|
*
|
|
42
|
+
* @summary Legacy migration helper that registers a callback invoked when an id or type passed to these utilities
|
|
43
|
+
* fails validation.
|
|
38
44
|
* @param fn - a function which takes a message and a condition
|
|
39
45
|
* @public
|
|
40
46
|
*/
|
|
@@ -51,6 +57,8 @@ function configureAssertFn(fn) {
|
|
|
51
57
|
* the configured mismatch reporter and assert functions will
|
|
52
58
|
* be called.
|
|
53
59
|
*
|
|
60
|
+
* @summary Legacy migration helper that replaces the singularize-and-dasherize function `formattedType` and
|
|
61
|
+
* `isEquivType` use to normalize resource types.
|
|
54
62
|
* @param fn - a function which takes a string and returns a string
|
|
55
63
|
* @public
|
|
56
64
|
*/
|
|
@@ -83,6 +91,8 @@ const NORMALIZED_TYPES = /* @__PURE__ */ new Map();
|
|
|
83
91
|
* formattedType('PostComment'); // => 'post-comment'
|
|
84
92
|
* ```
|
|
85
93
|
*
|
|
94
|
+
* @summary Legacy migration helper that normalizes a resource type to the singular dasherized form the cache
|
|
95
|
+
* expects, such as `'PostComments'` to `'post-comment'`.
|
|
86
96
|
* @param type the potentially un-normalized type
|
|
87
97
|
* @return the normalized type
|
|
88
98
|
* @public
|
|
@@ -116,6 +126,8 @@ function formattedType(type) {
|
|
|
116
126
|
* formattedId(null); // => null
|
|
117
127
|
* ```
|
|
118
128
|
*
|
|
129
|
+
* @summary Legacy migration helper that normalizes a resource id to the `string` or `null` the cache expects,
|
|
130
|
+
* asserting on invalid ids such as `''` or `0`.
|
|
119
131
|
* @param id the potentially un-normalized id
|
|
120
132
|
* @return the normalized id
|
|
121
133
|
* @public
|
|
@@ -133,6 +145,8 @@ function formattedId(id) {
|
|
|
133
145
|
* Like {@link formattedId}, but asserts that `id` is not `null` rather
|
|
134
146
|
* than allowing and passing through `null`.
|
|
135
147
|
*
|
|
148
|
+
* @summary Legacy migration helper that normalizes a resource id to a string like `formattedId`, but asserts that
|
|
149
|
+
* it is not `null`.
|
|
136
150
|
* @public
|
|
137
151
|
*/
|
|
138
152
|
/**
|
|
@@ -164,6 +178,8 @@ function expectId(id) {
|
|
|
164
178
|
* isEquivType('posts', null); // false
|
|
165
179
|
* ```
|
|
166
180
|
*
|
|
181
|
+
* @summary Legacy migration helper that reports whether two resource types match after normalization, so
|
|
182
|
+
* `'posts'` and `'post'` are equivalent.
|
|
167
183
|
* @param expected a potentially unnormalized type to match against
|
|
168
184
|
* @param actual a potentially unnormalized type to match against
|
|
169
185
|
* @return true if the types are equivalent
|
|
@@ -196,6 +212,8 @@ function isEquivType(expected, actual) {
|
|
|
196
212
|
* isEquivId(1, null); // false
|
|
197
213
|
* ```
|
|
198
214
|
*
|
|
215
|
+
* @summary Legacy migration helper that reports whether two resource ids match after normalization, so `1` and
|
|
216
|
+
* `'1'` are equivalent.
|
|
199
217
|
* @param expected a potentially un-normalized id to match against
|
|
200
218
|
* @param actual a potentially un-normalized id to match against
|
|
201
219
|
* @return true if the ids are equivalent
|
|
@@ -214,6 +232,5 @@ function isEquivId(expected, actual) {
|
|
|
214
232
|
return expected === actual || formattedId(expected) === formattedId(actual);
|
|
215
233
|
}
|
|
216
234
|
|
|
217
|
-
//#endregion
|
|
218
235
|
export { configureAssertFn, configureMismatchReporter, configureTypeNormalization, expectId, formattedId, formattedType, isEquivId, isEquivType };
|
|
219
236
|
//# sourceMappingURL=utils.js.map
|
package/dist/compat/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["dasherize","singularize","macroCondition","getGlobalConfig","MismatchReporter","_AssertFn","AssertFn","message","condition","WarpDrive","env","DEBUG","test","Error","NormalizedType","str","configureMismatchReporter","fn","configureAssertFn","configureTypeNormalization","NORMALIZED_TYPES","Map","formattedType","type","undefined","length","normalized","get","set","formattedId","id","formatted","String","expectId","isEquivType","expected","actual","isEquivId"],"sources":["../../src/compat/utils.ts"],"sourcesContent":["/**\n Utilities for helping to migrate to stricter\n and more consistent use of IDs and types.\n\n @module\n*/\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { dasherize, singularize } from '@warp-drive/utilities/string';\n\ninterface AssertFunc {\n (desc: string, condition: unknown): asserts condition;\n (desc: string): never;\n}\n\ntype Reporter = (type: 'formatted-id' | 'formatted-type', actual: unknown, expected: unknown) => void;\ntype Normalizer = (type: string) => string;\n\nlet MismatchReporter: Reporter = function () {};\n\n// TODO: @runspired This pattern prevents AssertFn from being removed in production builds\n// but we should enable that if we can.\nlet _AssertFn: (message: string, condition: unknown) => void = function () {};\nconst AssertFn: AssertFunc = ((message: string, condition: unknown) => {\n if (!condition) {\n _AssertFn(message, condition);\n }\n assert(message, condition);\n}) as unknown as AssertFunc;\nlet NormalizedType: Normalizer = (str: string) => {\n return singularize(dasherize(str));\n};\n\n/**\n * Configure a function to be called when an id or type\n * changes during normalization. This is useful for instrumenting\n * to discover places where usage in the app is not consistent.\n *\n * @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value\n * @public\n */\nexport function configureMismatchReporter(fn: Reporter): void {\n MismatchReporter = fn;\n}\n\n/**\n * Configure a function to be called when an id or type\n * fails validation. This is useful for instrumenting\n * to discover places where usage in the app is not consistent.\n *\n * @param fn - a function which takes a message and a condition\n * @public\n */\nexport function configureAssertFn(fn: (message: string, condition: unknown) => void): void {\n _AssertFn = fn;\n}\n\n/**\n * Configure a function to be called to normalize\n * a resource type string. Used by both formattedType\n * and isEquivType to ensure consistent normalization\n * during comparison.\n *\n * If validation fails or the type turns out be unnormalized\n * the configured mismatch reporter and assert functions will\n * be called.\n *\n * @param fn - a function which takes a string and returns a string\n * @public\n */\nexport function configureTypeNormalization(fn: (type: string) => string): void {\n NormalizedType = fn;\n}\n\nconst NORMALIZED_TYPES = new Map<string, string>();\n\n/**\n * Converts a potentially unnormalized type into the format expected\n * by our WarpDrive Cache. Currently this is singular-dasherized.\n *\n * you should not rely on this function to give you an exact format\n * for display purposes. Formatting for display should be handled\n * differently if the exact format matters.\n *\n * Asserts invalid types (undefined, null, '') in dev.\n *\n * **Usage**\n *\n * ```js\n * import formattedType from 'soxhub-client/helpers/formatted-type';\n *\n * formattedType('post'); // => 'post'\n * formattedType('posts'); // => 'post'\n * formattedType('Posts'); // => 'post'\n * formattedType('post-comment'); // => 'post-comment'\n * formattedType('post-comments'); // => 'post-comment'\n * formattedType('post_comment'); // => 'post-comment'\n * formattedType('postComment'); // => 'post-comment'\n * formattedType('PostComment'); // => 'post-comment'\n * ```\n *\n * @param type the potentially un-normalized type\n * @return the normalized type\n * @public\n */\nexport function formattedType<T extends string>(type: T | string): T {\n AssertFn('formattedType: type must not be null', type !== null);\n AssertFn('formattedType: type must not be undefined', type !== undefined);\n AssertFn('formattedType: type must be a string', typeof type === 'string');\n AssertFn('formattedType: type must not be empty', type.length > 0);\n let normalized = NORMALIZED_TYPES.get(type);\n\n if (normalized === undefined) {\n normalized = NormalizedType(type);\n NORMALIZED_TYPES.set(type, normalized);\n }\n\n if (normalized !== type) {\n MismatchReporter('formatted-type', type, normalized);\n }\n\n return normalized as T;\n}\n\n/**\n * Format an id to the format expected by the WarpDrive Cache.\n * Currently this means that id should be `string | null`.\n *\n * Asserts invalid IDs (undefined, '', 0, '0') in dev.\n *\n * **Usage**\n *\n * ```js\n * import formattedId from 'client/utils/formatted-id';\n *\n * formattedId('1'); // => '1'\n * formattedId(1); // => '1'\n * formattedId(null); // => null\n *\t```\n *\n * @param id the potentially un-normalized id\n * @return the normalized id\n * @public\n */\nexport function formattedId(id: string | number): string;\nexport function formattedId(id: null): null;\nexport function formattedId(id: string | number | null): string | null;\nexport function formattedId(id: string | number | null): string | null {\n AssertFn('formattedId: id must not be undefined', id !== undefined);\n AssertFn(\n 'formattedId: id must be a number, string or null',\n typeof id === 'number' || typeof id === 'string' || id === null\n );\n AssertFn(\n 'formattedId: id must not be empty',\n typeof id === 'number' || id === null || (typeof id === 'string' && id.length > 0)\n );\n AssertFn('formattedId: id must not be 0', id !== '0' && id !== 0);\n\n const formatted = id === null ? null : String(id);\n if (formatted !== id) {\n MismatchReporter('formatted-id', id, formatted);\n }\n return id === null ? null : String(id);\n}\n\n/**\n * Like {@link formattedId}, but asserts that `id` is not `null` rather\n * than allowing and passing through `null`.\n *\n * @public\n */\nexport function expectId(id: string | number): string;\n/**\n * Throws, since `id` is `null`.\n *\n * @public\n */\nexport function expectId(id: null): never;\nexport function expectId(id: string | number | null): string {\n AssertFn('expectId: id must not be null', id !== null);\n\n return formattedId(id);\n}\n\n/**\n * Compares two types for strict equality, converting them to\n * the format expected by the WarpDrive Cache to ensure\n * differences in format are accounted for in the comparison.\n *\n * Asserts when expected or actual are invalid types in dev.\n * Expected may never be null.\n *\n * ```js\n * isEquivType('posts', 'post'); // true\n * isEquivType('post', 'post'); // true\n * isEquivType('posts', 'posts'); // true\n * isEquivType('post-comment', 'postComment'); // true\n * isEquivType('post-comment', 'PostComment'); // true\n * isEquivType('post-comment', 'post_comment'); // true\n * isEquivType('post-comment', 'post-comment'); // true\n * isEquivType('post-comment', 'post'); // false\n * isEquivType('posts', null); // false\n * ```\n *\n * @param expected a potentially unnormalized type to match against\n * @param actual a potentially unnormalized type to match against\n * @return true if the types are equivalent\n * @public\n */\nexport function isEquivType(expected: string, actual: string): boolean {\n AssertFn('isEquivType: Expected type must not be null', expected !== null);\n AssertFn('isEquivType: Expected type must not be undefined', expected !== undefined);\n AssertFn('isEquivType: Expected type must be a string', typeof expected === 'string');\n AssertFn('isEquivType: Expected type must not be empty', expected.length > 0);\n\n AssertFn('isEquivType: Actual type must not be null', actual !== null);\n AssertFn('isEquivType: Actual type must not be undefined', actual !== undefined);\n AssertFn('isEquivType: Actual type must be a string', typeof actual === 'string');\n AssertFn('isEquivType: Actual type must not be empty', actual.length > 0);\n\n return expected === actual || formattedType(expected) === formattedType(actual);\n}\n\n/**\n * Compares two IDs for strict equality, converting them to\n * the format expected by the WarpDrive Cache to ensure\n * differences in format are accounted for in the comparison.\n *\n * Asserts when expected or actual are invalid IDs in dev.\n * Expected may never be null.\n *\n * ```js\n * isEquivId('1', 1); // true\n * isEquivId('2', '2'); // true\n * isEquivId(3, '3'); // true\n * isEquivId(4, '3'); // false\n * isEquivId(1, null); // false\n * ```\n *\n * @param expected a potentially un-normalized id to match against\n * @param actual a potentially un-normalized id to match against\n * @return true if the ids are equivalent\n * @public\n */\nexport function isEquivId(expected: string | number, actual: string | number | null): boolean {\n AssertFn('isEquivId: Expected id must not be null', expected !== null);\n AssertFn('isEquivId: Expected id must not be undefined', expected !== undefined);\n AssertFn(\n 'isEquivId: Expected id must be a number or string',\n typeof expected === 'number' || typeof expected === 'string'\n );\n AssertFn(\n 'isEquivId: Expected id must not be empty',\n typeof expected === 'number' || (typeof expected === 'string' && expected.length > 0)\n );\n AssertFn('isEquivId: Expected id must not be 0', expected !== '0' && expected !== 0);\n\n AssertFn('isEquivId: Actual id must not be undefined', actual !== undefined);\n AssertFn(\n 'isEquivId: Actual id must be a number, string or null',\n typeof actual === 'number' || typeof actual === 'string' || actual === null\n );\n AssertFn(\n 'isEquivId: Actual id must not be empty',\n actual === null || typeof actual === 'number' || (typeof actual === 'string' && actual.length > 0)\n );\n AssertFn('isEquivId: Actual id must not be 0', actual !== '0' && actual !== 0);\n\n return expected === actual || formattedId(expected) === formattedId(actual);\n}\n"],"mappings":";;;;;;;;;;AAiBA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8B,WAAWZ,MAAS;CAC3ElB,SACE,yDACA,OAAO8B,WAAW,YAAY,OAAOA,WAAW,YAAYA,WAAW,IACzE;CACA9B,SACE,0CACA8B,WAAW,QAAQ,OAAOA,WAAW,YAAa,OAAOA,WAAW,YAAYA,OAAOX,SAAS,CAClG;CACAnB,SAAS,sCAAsC8B,WAAW,OAAOA,WAAW,CAAC;CAE7E,OAAOD,aAAaC,UAAUP,YAAYM,QAAQ,MAAMN,YAAYO,MAAM;AAC5E"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["dasherize","singularize","macroCondition","getGlobalConfig","MismatchReporter","_AssertFn","AssertFn","message","condition","WarpDrive","env","DEBUG","test","Error","NormalizedType","str","configureMismatchReporter","fn","configureAssertFn","configureTypeNormalization","NORMALIZED_TYPES","Map","formattedType","type","undefined","length","normalized","get","set","formattedId","id","formatted","String","expectId","isEquivType","expected","actual","isEquivId"],"sources":["../../src/compat/utils.ts"],"sourcesContent":["/**\n Utilities for helping to migrate to stricter\n and more consistent use of IDs and types.\n\n @summary Legacy helpers that normalize, compare, and report mismatched resource ids and types while migrating to\n stricter formats.\n @module\n*/\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { dasherize, singularize } from '@warp-drive/utilities/string';\n\ninterface AssertFunc {\n (desc: string, condition: unknown): asserts condition;\n (desc: string): never;\n}\n\ntype Reporter = (type: 'formatted-id' | 'formatted-type', actual: unknown, expected: unknown) => void;\ntype Normalizer = (type: string) => string;\n\nlet MismatchReporter: Reporter = function () {};\n\n// TODO: @runspired This pattern prevents AssertFn from being removed in production builds\n// but we should enable that if we can.\nlet _AssertFn: (message: string, condition: unknown) => void = function () {};\nconst AssertFn: AssertFunc = ((message: string, condition: unknown) => {\n if (!condition) {\n _AssertFn(message, condition);\n }\n assert(message, condition);\n}) as unknown as AssertFunc;\nlet NormalizedType: Normalizer = (str: string) => {\n return singularize(dasherize(str));\n};\n\n/**\n * Configure a function to be called when an id or type\n * changes during normalization. This is useful for instrumenting\n * to discover places where usage in the app is not consistent.\n *\n * @summary Legacy migration helper that registers a callback invoked whenever `formattedId` or `formattedType`\n * has to change the id or type it was given.\n * @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value\n * @public\n */\nexport function configureMismatchReporter(fn: Reporter): void {\n MismatchReporter = fn;\n}\n\n/**\n * Configure a function to be called when an id or type\n * fails validation. This is useful for instrumenting\n * to discover places where usage in the app is not consistent.\n *\n * @summary Legacy migration helper that registers a callback invoked when an id or type passed to these utilities\n * fails validation.\n * @param fn - a function which takes a message and a condition\n * @public\n */\nexport function configureAssertFn(fn: (message: string, condition: unknown) => void): void {\n _AssertFn = fn;\n}\n\n/**\n * Configure a function to be called to normalize\n * a resource type string. Used by both formattedType\n * and isEquivType to ensure consistent normalization\n * during comparison.\n *\n * If validation fails or the type turns out be unnormalized\n * the configured mismatch reporter and assert functions will\n * be called.\n *\n * @summary Legacy migration helper that replaces the singularize-and-dasherize function `formattedType` and\n * `isEquivType` use to normalize resource types.\n * @param fn - a function which takes a string and returns a string\n * @public\n */\nexport function configureTypeNormalization(fn: (type: string) => string): void {\n NormalizedType = fn;\n}\n\nconst NORMALIZED_TYPES = new Map<string, string>();\n\n/**\n * Converts a potentially unnormalized type into the format expected\n * by our WarpDrive Cache. Currently this is singular-dasherized.\n *\n * you should not rely on this function to give you an exact format\n * for display purposes. Formatting for display should be handled\n * differently if the exact format matters.\n *\n * Asserts invalid types (undefined, null, '') in dev.\n *\n * **Usage**\n *\n * ```js\n * import formattedType from 'soxhub-client/helpers/formatted-type';\n *\n * formattedType('post'); // => 'post'\n * formattedType('posts'); // => 'post'\n * formattedType('Posts'); // => 'post'\n * formattedType('post-comment'); // => 'post-comment'\n * formattedType('post-comments'); // => 'post-comment'\n * formattedType('post_comment'); // => 'post-comment'\n * formattedType('postComment'); // => 'post-comment'\n * formattedType('PostComment'); // => 'post-comment'\n * ```\n *\n * @summary Legacy migration helper that normalizes a resource type to the singular dasherized form the cache\n * expects, such as `'PostComments'` to `'post-comment'`.\n * @param type the potentially un-normalized type\n * @return the normalized type\n * @public\n */\nexport function formattedType<T extends string>(type: T | string): T {\n AssertFn('formattedType: type must not be null', type !== null);\n AssertFn('formattedType: type must not be undefined', type !== undefined);\n AssertFn('formattedType: type must be a string', typeof type === 'string');\n AssertFn('formattedType: type must not be empty', type.length > 0);\n let normalized = NORMALIZED_TYPES.get(type);\n\n if (normalized === undefined) {\n normalized = NormalizedType(type);\n NORMALIZED_TYPES.set(type, normalized);\n }\n\n if (normalized !== type) {\n MismatchReporter('formatted-type', type, normalized);\n }\n\n return normalized as T;\n}\n\n/**\n * Format an id to the format expected by the WarpDrive Cache.\n * Currently this means that id should be `string | null`.\n *\n * Asserts invalid IDs (undefined, '', 0, '0') in dev.\n *\n * **Usage**\n *\n * ```js\n * import formattedId from 'client/utils/formatted-id';\n *\n * formattedId('1'); // => '1'\n * formattedId(1); // => '1'\n * formattedId(null); // => null\n *\t```\n *\n * @summary Legacy migration helper that normalizes a resource id to the `string` or `null` the cache expects,\n * asserting on invalid ids such as `''` or `0`.\n * @param id the potentially un-normalized id\n * @return the normalized id\n * @public\n */\nexport function formattedId(id: string | number): string;\nexport function formattedId(id: null): null;\nexport function formattedId(id: string | number | null): string | null;\nexport function formattedId(id: string | number | null): string | null {\n AssertFn('formattedId: id must not be undefined', id !== undefined);\n AssertFn(\n 'formattedId: id must be a number, string or null',\n typeof id === 'number' || typeof id === 'string' || id === null\n );\n AssertFn(\n 'formattedId: id must not be empty',\n typeof id === 'number' || id === null || (typeof id === 'string' && id.length > 0)\n );\n AssertFn('formattedId: id must not be 0', id !== '0' && id !== 0);\n\n const formatted = id === null ? null : String(id);\n if (formatted !== id) {\n MismatchReporter('formatted-id', id, formatted);\n }\n return id === null ? null : String(id);\n}\n\n/**\n * Like {@link formattedId}, but asserts that `id` is not `null` rather\n * than allowing and passing through `null`.\n *\n * @summary Legacy migration helper that normalizes a resource id to a string like `formattedId`, but asserts that\n * it is not `null`.\n * @public\n */\nexport function expectId(id: string | number): string;\n/**\n * Throws, since `id` is `null`.\n *\n * @public\n */\nexport function expectId(id: null): never;\nexport function expectId(id: string | number | null): string {\n AssertFn('expectId: id must not be null', id !== null);\n\n return formattedId(id);\n}\n\n/**\n * Compares two types for strict equality, converting them to\n * the format expected by the WarpDrive Cache to ensure\n * differences in format are accounted for in the comparison.\n *\n * Asserts when expected or actual are invalid types in dev.\n * Expected may never be null.\n *\n * ```js\n * isEquivType('posts', 'post'); // true\n * isEquivType('post', 'post'); // true\n * isEquivType('posts', 'posts'); // true\n * isEquivType('post-comment', 'postComment'); // true\n * isEquivType('post-comment', 'PostComment'); // true\n * isEquivType('post-comment', 'post_comment'); // true\n * isEquivType('post-comment', 'post-comment'); // true\n * isEquivType('post-comment', 'post'); // false\n * isEquivType('posts', null); // false\n * ```\n *\n * @summary Legacy migration helper that reports whether two resource types match after normalization, so\n * `'posts'` and `'post'` are equivalent.\n * @param expected a potentially unnormalized type to match against\n * @param actual a potentially unnormalized type to match against\n * @return true if the types are equivalent\n * @public\n */\nexport function isEquivType(expected: string, actual: string): boolean {\n AssertFn('isEquivType: Expected type must not be null', expected !== null);\n AssertFn('isEquivType: Expected type must not be undefined', expected !== undefined);\n AssertFn('isEquivType: Expected type must be a string', typeof expected === 'string');\n AssertFn('isEquivType: Expected type must not be empty', expected.length > 0);\n\n AssertFn('isEquivType: Actual type must not be null', actual !== null);\n AssertFn('isEquivType: Actual type must not be undefined', actual !== undefined);\n AssertFn('isEquivType: Actual type must be a string', typeof actual === 'string');\n AssertFn('isEquivType: Actual type must not be empty', actual.length > 0);\n\n return expected === actual || formattedType(expected) === formattedType(actual);\n}\n\n/**\n * Compares two IDs for strict equality, converting them to\n * the format expected by the WarpDrive Cache to ensure\n * differences in format are accounted for in the comparison.\n *\n * Asserts when expected or actual are invalid IDs in dev.\n * Expected may never be null.\n *\n * ```js\n * isEquivId('1', 1); // true\n * isEquivId('2', '2'); // true\n * isEquivId(3, '3'); // true\n * isEquivId(4, '3'); // false\n * isEquivId(1, null); // false\n * ```\n *\n * @summary Legacy migration helper that reports whether two resource ids match after normalization, so `1` and\n * `'1'` are equivalent.\n * @param expected a potentially un-normalized id to match against\n * @param actual a potentially un-normalized id to match against\n * @return true if the ids are equivalent\n * @public\n */\nexport function isEquivId(expected: string | number, actual: string | number | null): boolean {\n AssertFn('isEquivId: Expected id must not be null', expected !== null);\n AssertFn('isEquivId: Expected id must not be undefined', expected !== undefined);\n AssertFn(\n 'isEquivId: Expected id must be a number or string',\n typeof expected === 'number' || typeof expected === 'string'\n );\n AssertFn(\n 'isEquivId: Expected id must not be empty',\n typeof expected === 'number' || (typeof expected === 'string' && expected.length > 0)\n );\n AssertFn('isEquivId: Expected id must not be 0', expected !== '0' && expected !== 0);\n\n AssertFn('isEquivId: Actual id must not be undefined', actual !== undefined);\n AssertFn(\n 'isEquivId: Actual id must be a number, string or null',\n typeof actual === 'number' || typeof actual === 'string' || actual === null\n );\n AssertFn(\n 'isEquivId: Actual id must not be empty',\n actual === null || typeof actual === 'number' || (typeof actual === 'string' && actual.length > 0)\n );\n AssertFn('isEquivId: Actual id must not be 0', actual !== '0' && actual !== 0);\n\n return expected === actual || formattedId(expected) === formattedId(actual);\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAII,mBAA6B,WAAY,CAAC;AAI9C,IAAIC,YAA2D,WAAY,CAAC;AAC5E,MAAMC,YAAyBC,SAAiBC,cAAuB;CACrE,IAAI,CAACA,WACHH,UAAUE,SAASC,SAAS;CAE9BN,eAAAC,gBAAA,CAAA,CAAAM,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAON,OAAO;CAAA,EAAA,CAAEC,SAAS;AAC3B;AACA,IAAIM,kBAA8BC,QAAgB;CAChD,OAAOd,YAAYD,UAAUe,GAAG,CAAC;AACnC;;;;;;;;;;;AAYA,SAAgBC,0BAA0BC,IAAoB;CAC5Db,mBAAmBa;AACrB;;;;;;;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as payloadIsNotBlank, t as upgradeStore } from "./-private-
|
|
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-0_Oc-M3x.js";
|
|
2
2
|
import { recordIdentifierFor } from "@warp-drive/core";
|
|
3
3
|
import { getOwner } from "@ember/application";
|
|
4
4
|
import { _deprecatingNormalize, assertPrivateStore } from "@warp-drive/core/store/-private";
|
|
5
5
|
import { waitFor } from "@warp-drive/core/signals/-leaked";
|
|
6
6
|
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/compat/legacy-network-handler/legacy-data-fetch.ts
|
|
9
9
|
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
10
10
|
/* @__PURE__ */ upgradeStore(store);
|
|
11
11
|
return Promise.resolve().then(() => {
|
|
@@ -192,8 +192,7 @@ function validateRelationshipEntry({ id }, { id: parentModelID }) {
|
|
|
192
192
|
return !!id && id.toString() === parentModelID;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
//#region src/compat/legacy-network-handler/legacy-network-handler.ts
|
|
195
|
+
// src/compat/legacy-network-handler/legacy-network-handler.ts
|
|
197
196
|
const PotentialLegacyOperations = /* @__PURE__ */ new Set([
|
|
198
197
|
"findRecord",
|
|
199
198
|
"findAll",
|
|
@@ -211,6 +210,9 @@ const PotentialLegacyOperations = /* @__PURE__ */ new Set([
|
|
|
211
210
|
* `deleteRecord` requests using the store's configured {@link MinimumAdapterInterface | adapter}
|
|
212
211
|
* and {@link MinimumSerializerInterface | serializer}, passing any other
|
|
213
212
|
* request through to the next handler unchanged.
|
|
213
|
+
*
|
|
214
|
+
* @summary Legacy `RequestManager` handler that fulfills find, query, create, update, and delete operations through
|
|
215
|
+
* the store's adapters and serializers, passing other requests along.
|
|
214
216
|
*/
|
|
215
217
|
const LegacyNetworkHandler = { request(context, next) {
|
|
216
218
|
if (context.request.url || !context.request.op || !PotentialLegacyOperations.has(context.request.op)) return next(context.request);
|
|
@@ -491,17 +493,57 @@ function queryRecord(context) {
|
|
|
491
493
|
});
|
|
492
494
|
}
|
|
493
495
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
+
// src/compat.ts
|
|
497
|
+
/**
|
|
498
|
+
* Helps an app migrate incrementally from legacy EmberData patterns to modern ***Warp*Drive**.
|
|
499
|
+
*
|
|
500
|
+
* ## Why it exists
|
|
501
|
+
*
|
|
502
|
+
* While migrating, you may need to:
|
|
503
|
+
*
|
|
504
|
+
* - keep Adapters and Serializers working on a Store whose requests go through the
|
|
505
|
+
* {@link RequestManager}
|
|
506
|
+
* - keep the deprecated request methods such as `store.findRecord` and `store.query`, which
|
|
507
|
+
* Adapters fulfill, working while you move calls to `store.request`
|
|
508
|
+
* - adopt modern patterns one piece at a time rather than all at once
|
|
509
|
+
*
|
|
510
|
+
* ## What it provides
|
|
511
|
+
*
|
|
512
|
+
* - {@link LegacyNetworkHandler}, a request handler that fulfills those legacy requests through
|
|
513
|
+
* the store's Adapters and Serializers and passes every other request along
|
|
514
|
+
* - {@link adapterFor}, {@link serializerFor}, {@link normalize}, {@link pushPayload} and
|
|
515
|
+
* {@link serializeRecord}, the store methods for working with Adapters and Serializers, and
|
|
516
|
+
* {@link LegacyStoreCompat}, the Store type that includes them
|
|
517
|
+
*
|
|
518
|
+
* The Store that [useLegacyStore](/api/@warp-drive/legacy/functions/useLegacyStore) produces
|
|
519
|
+
* adds `LegacyNetworkHandler` to its RequestManager unless `linksMode` is `true`. The hooks
|
|
520
|
+
* that present `Model` instances live in [@warp-drive/legacy/model](/api/@warp-drive/legacy/model/),
|
|
521
|
+
* not here.
|
|
522
|
+
*
|
|
523
|
+
* ## When to use it
|
|
524
|
+
*
|
|
525
|
+
* Only during a migration from legacy EmberData to modern ***Warp*Drive**. It lets you adopt
|
|
526
|
+
* modern patterns incrementally while your existing Adapters and Serializers keep working. For
|
|
527
|
+
* incremental migration strategies, see the [Migration Guide](/upgrading/v5/) and the
|
|
528
|
+
* [Two Store Migration Strategy](/upgrading/v5/two-store-migration).
|
|
529
|
+
*
|
|
530
|
+
* @module
|
|
531
|
+
* @summary Legacy store support for adapters and serializers: the `LegacyNetworkHandler` plus store methods such as
|
|
532
|
+
* `adapterFor`, `serializerFor`, `normalize` and `pushPayload`.
|
|
533
|
+
*/
|
|
496
534
|
/**
|
|
497
535
|
* Extends the signature of {@link Store} with additional
|
|
498
536
|
* methods available when using the legacy network layer.
|
|
499
537
|
*
|
|
538
|
+
* @summary Legacy `Store` type extended with `adapterFor`, `serializerFor`, `normalize`, `pushPayload`, and
|
|
539
|
+
* `serializeRecord` from the adapter and serializer network layer.
|
|
500
540
|
* @public
|
|
501
541
|
* @noInheritDoc
|
|
502
542
|
* @legacy
|
|
503
543
|
*/
|
|
504
544
|
/**
|
|
545
|
+
* @summary Deprecated alias of `LegacyStoreCompat`, the `Store` type extended with legacy adapter and serializer
|
|
546
|
+
* methods.
|
|
505
547
|
* @deprecated - use {@link LegacyStoreCompat} instead
|
|
506
548
|
*/
|
|
507
549
|
/**
|
|
@@ -513,6 +555,8 @@ If no `person` adapter is found, this method will look
|
|
|
513
555
|
for an `application` adapter (the default adapter for
|
|
514
556
|
your entire application).
|
|
515
557
|
|
|
558
|
+
@summary Legacy store method that returns the cached adapter for a model type, falling back to the `application`
|
|
559
|
+
adapter.
|
|
516
560
|
@public
|
|
517
561
|
@param modelName
|
|
518
562
|
*/
|
|
@@ -560,6 +604,8 @@ your entire application).
|
|
|
560
604
|
If a serializer cannot be found on the adapter, it will fall back
|
|
561
605
|
to an instance of `JSONSerializer`.
|
|
562
606
|
|
|
607
|
+
@summary Legacy store method that returns the cached serializer for a model type, falling back to the
|
|
608
|
+
`application` serializer, or `null` if neither exists.
|
|
563
609
|
@public
|
|
564
610
|
@param modelName the record to serialize
|
|
565
611
|
*/
|
|
@@ -612,6 +658,8 @@ store.push(store.normalize(modelName, data));
|
|
|
612
658
|
});
|
|
613
659
|
```
|
|
614
660
|
|
|
661
|
+
@summary Legacy store method that converts a raw payload into the normalized document `store.push` expects, using
|
|
662
|
+
the serializer for the given model type.
|
|
615
663
|
@legacy
|
|
616
664
|
@public
|
|
617
665
|
@param modelName The name of the model type for this payload
|
|
@@ -687,6 +735,8 @@ store.pushPayload(pushData); // Will use the application serializer
|
|
|
687
735
|
store.pushPayload('post', pushData); // Will use the post serializer
|
|
688
736
|
```
|
|
689
737
|
|
|
738
|
+
@summary Legacy store method that pushes a raw payload into the store after the application serializer, or the
|
|
739
|
+
given model type's serializer, normalizes it.
|
|
690
740
|
@public
|
|
691
741
|
@param modelName Optionally, a model type used to determine which serializer will be used
|
|
692
742
|
@param inputPayload
|
|
@@ -707,6 +757,8 @@ function pushPayload(modelName, inputPayload) {
|
|
|
707
757
|
/**
|
|
708
758
|
* Serializes a record using the store's legacy network layer, as with
|
|
709
759
|
* {@link LegacyStoreCompat.serializeRecord | store.serializeRecord}.
|
|
760
|
+
*
|
|
761
|
+
* @summary Legacy store method that serializes a record into a payload using its model type's serializer.
|
|
710
762
|
*/
|
|
711
763
|
function serializeRecord(record, options) {
|
|
712
764
|
/* @__PURE__ */ upgradeStore(this);
|
|
@@ -716,6 +768,8 @@ function serializeRecord(record, options) {
|
|
|
716
768
|
/**
|
|
717
769
|
* Destroys any adapters/serializers the legacy network layer has created
|
|
718
770
|
* for this store, invoked when the store itself is destroyed.
|
|
771
|
+
*
|
|
772
|
+
* @summary Legacy store teardown hook that destroys every adapter and serializer instance the store has cached.
|
|
719
773
|
*/
|
|
720
774
|
function cleanup() {
|
|
721
775
|
/* @__PURE__ */ upgradeStore(this);
|
|
@@ -729,6 +783,5 @@ function cleanup() {
|
|
|
729
783
|
}
|
|
730
784
|
}
|
|
731
785
|
|
|
732
|
-
//#endregion
|
|
733
786
|
export { serializeRecord as a, pushPayload as i, cleanup as n, serializerFor as o, normalize as r, LegacyNetworkHandler as s, adapterFor as t };
|
|
734
|
-
//# sourceMappingURL=compat-
|
|
787
|
+
//# sourceMappingURL=compat-C-yQnbkF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat-C-yQnbkF.js","names":["upgradeStore","iterateData","payloadIsNotBlank","normalizeResponseHelper","getGlobalConfig","macroCondition","_findHasMany","adapter","store","identifier","link","relationship","options","promise","Promise","resolve","then","snapshot","_fetchManager","createSnapshot","useLink","relatedLink","href","WarpDrive","env","DEBUG","test","Error","findHasMany","adapterPayload","type","name","JSON","stringify","modelClass","modelFor","serializer","serializerFor","payload","id","Array","isArray","data","syncRelationshipDataFromLink","_push","_findBelongsTo","adapterFor","findBelongsTo","links","meta","parentIdentifier","relationshipData","index","ensureRelationshipIsSetToParent","relatedDataHash","parentPayload","relationships","included","push","parentRelationship","inverse","getInverse","inverseKey","kind","relationshipDataPointsToParent","inspect","thing","quotedType","quotedInverse","expected","expectedModel","got","prefix","path","other","relationshipFetched","includedRecord","message","join","fixRelationshipData","inverseForRelationship","key","definition","schema","fields","get","length","lhs_relationshipName","parentType","i","entry","validateRelationshipEntry","relationshipKind","parentRelationshipData","relData","found","find","v","Object","assign","parentModelID","toString","waitFor","assertPrivateStore","upgradeStore","FetchManager","SaveOp","assertIdentifierHasId","_findBelongsTo","_findHasMany","payloadIsNotBlank","normalizeResponseHelper","SnapshotRecordArray","getGlobalConfig","macroCondition","PotentialLegacyOperations","Set","LegacyNetworkHandler","request","context","next","url","op","has","store","_fetchManager","findRecord","findAll","query","queryRecord","findBelongsTo","findHasMany","saveRecord","data","records","identifiers","options","record","links","useLink","field","identifier","pendingRequest","getPendingFetch","WarpDrive","env","DEBUG","test","Error","String","related","Array","isArray","length","manager","reload","scheduleFetch","fetchDataIfNeededForIdentifier","adapter","adapterFor","type","fetches","i","Promise","all","operation","cache","willCommit","saveOptions","Object","assign","fetchManagerPromise","scheduleSave","then","payload","result","_join","didCommit","content","lifetimes","didRequest","status","peekRecord","catch","e","err","adapterDidInvalidate","error","isAdapterError","code","serializer","serializerFor","extractErrors","errorsHash","modelFor","id","errors","errorsHashToArray","getErrors","jsonApiErrors","title","detail","source","pointer","commitWasRejected","makeArray","value","PRIMARY_ATTRIBUTE_KEY","out","keys","forEach","key","messages","push","promise","_instanceCache","recordIsLoaded","snapshot","shouldReloadRecord","createSnapshot","backgroundReload","shouldBackgroundReloadRecord","resolve","maybeRecordArray","recordArrayManager","_live","get","snapshotArray","shouldReload","shouldReloadAll","fetch","isUpdating","_findAll","peekAll","shouldBackgroundReloadAll","isAsyncFlush","schema","adapterPayload","_push","_recordArray","activeLogging","LOG_REQUESTS","debug","globalThis","getWarpDriveRuntimeConfig","console","log","TESTING","disableTestWaiter","recordArray","getCollection","populateManagedArray","assertSingleResourceDocument","getOwner","recordIdentifierFor","_deprecatingNormalize","FetchManager","upgradeStore","macroCondition","getGlobalConfig","LegacyNetworkHandler","adapterFor","modelName","_allowMissing","WarpDrive","env","DEBUG","test","Error","isDestroying","isDestroyed","_adapterCache","Object","create","normalizedModelName","adapter","owner","lookup","undefined","application","serializerFor","_serializerCache","serializer","normalize","payload","schema","modelFor","pushPayload","inputPayload","serializeRecord","record","options","_fetchManager","createSnapshot","serialize","cleanup","adapterName","destroy","serializerName"],"sources":["../src/compat/legacy-network-handler/legacy-data-fetch.ts","../src/compat/legacy-network-handler/legacy-network-handler.ts","../src/compat.ts"],"sourcesContent":["import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { BaseFinderOptions } from '@warp-drive/core/types';\nimport type { PersistedResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core/types/schema/fields';\nimport type { ExistingResourceObject, JsonApiDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { iterateData, payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\n\nexport function _findHasMany(\n adapter: MinimumAdapterInterface,\n store: Store,\n identifier: ResourceKey,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n): Promise<PersistedResourceKey[]> {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `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'`,\n relatedLink\n );\n assert(\n `Expected the adapter to implement 'findHasMany' but it does not`,\n typeof adapter.findHasMany === 'function'\n );\n return adapter.findHasMany(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findHasMany' request for a ${identifier.type}'s '${\n relationship.name\n }' relationship, using link '${JSON.stringify(link)}' , but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n const modelClass = store.modelFor(relationship.type);\n\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findHasMany');\n\n assert(\n `fetched the hasMany relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: [] }`,\n 'data' in payload && Array.isArray(payload.data)\n );\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n return store._push(payload, true) as PersistedResourceKey[];\n }, null);\n}\n\nexport function _findBelongsTo(\n store: Store,\n identifier: ResourceKey,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n): Promise<PersistedResourceKey | null> {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const adapter = store.adapterFor(identifier.type);\n assert(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`, adapter);\n assert(\n `You tried to load a belongsTo relationship from a specified 'link' in the original payload but your adapter does not implement 'findBelongsTo'`,\n typeof adapter.findBelongsTo === 'function'\n );\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `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'`,\n relatedLink\n );\n return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n const modelClass = store.modelFor(relationship.type);\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findBelongsTo');\n\n assert(\n `fetched the belongsTo relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: null }`,\n 'data' in payload && (payload.data === null || (typeof payload.data === 'object' && !Array.isArray(payload.data)))\n );\n\n if (!payload.data && !payload.links && !payload.meta) {\n return null;\n }\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n\n return store._push(payload, true) as PersistedResourceKey | null;\n }, null);\n}\n\n// sync\n// iterate over records in payload.data\n// for each record\n// assert that record.relationships[inverse] is either undefined (so we can fix it)\n// or provide a data: {id, type} that matches the record that requested it\n// return the relationship data for the parent\nfunction syncRelationshipDataFromLink(\n store: Store,\n payload: JsonApiDocument,\n parentIdentifier: ResourceIdentity,\n relationship: RelationshipSchema\n) {\n // ensure the right hand side (incoming payload) points to the parent record that\n // requested this relationship\n const relationshipData = payload.data\n ? iterateData(payload.data, (data, index) => {\n const { id, type } = data;\n ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship, index);\n return { id, type };\n })\n : null;\n\n const relatedDataHash = {} as JsonApiDocument;\n\n if ('meta' in payload) {\n relatedDataHash.meta = payload.meta;\n }\n if ('links' in payload) {\n relatedDataHash.links = payload.links;\n }\n if ('data' in payload) {\n relatedDataHash.data = relationshipData;\n }\n\n // now, push the left hand side (the parent record) to ensure things are in sync, since\n // the payload will be pushed with store._push\n const parentPayload = {\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n relationships: {\n [relationship.name]: relatedDataHash,\n },\n };\n\n if (!Array.isArray(payload.included)) {\n payload.included = [];\n }\n payload.included.push(parentPayload);\n\n return payload;\n}\n\ntype ResourceIdentity = { id: string; type: string };\ntype RelationshipData = ResourceIdentity | ResourceIdentity[] | null;\n\nfunction ensureRelationshipIsSetToParent(\n payload: ExistingResourceObject,\n parentIdentifier: ResourceIdentity,\n store: Store,\n parentRelationship: RelationshipSchema,\n index: number\n) {\n const { id, type } = payload;\n\n if (!payload.relationships) {\n payload.relationships = {};\n }\n const { relationships } = payload;\n\n const inverse = getInverse(store, parentIdentifier, parentRelationship, type);\n if (inverse) {\n const { inverseKey, kind } = inverse;\n\n const relationshipData = relationships[inverseKey]?.data;\n\n if (DEBUG) {\n if (\n typeof relationshipData !== 'undefined' &&\n !relationshipDataPointsToParent(relationshipData, parentIdentifier)\n ) {\n const inspect = function inspect(thing: unknown) {\n return `'${JSON.stringify(thing)}'`;\n };\n const quotedType = inspect(type);\n const quotedInverse = inspect(inverseKey);\n const expected = inspect({\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n });\n const expectedModel = `${parentIdentifier.type}:${parentIdentifier.id}`;\n const got = inspect(relationshipData);\n const prefix = typeof index === 'number' ? `data[${index}]` : `data`;\n const path = `${prefix}.relationships.${inverseKey}.data`;\n const data = Array.isArray(relationshipData) ? relationshipData[0] : relationshipData;\n const other = data ? `<${data.type}:${data.id}>` : null;\n const relationshipFetched = `${expectedModel}.${parentRelationship.kind}(\"${parentRelationship.name}\")`;\n const includedRecord = `<${type}:${id}>`;\n const message = [\n `Encountered mismatched relationship: WarpDrive expected ${path} in the payload from ${relationshipFetched} to include ${expected} but got ${got} instead.\\n`,\n `The ${includedRecord} record loaded at ${prefix} in the payload specified ${other} as its ${quotedInverse}, but should have specified ${expectedModel} (the record the relationship is being loaded from) as its ${quotedInverse} instead.`,\n `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.`,\n `WarpDrive has corrected the ${includedRecord} record's ${quotedInverse} relationship to ${expectedModel} so that ${relationshipFetched} will include ${includedRecord}.`,\n `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.`,\n ].join('\\n');\n\n assert(message);\n }\n }\n\n if (kind !== 'hasMany' || typeof relationshipData !== 'undefined') {\n relationships[inverseKey] = relationships[inverseKey] || {};\n relationships[inverseKey].data = fixRelationshipData(relationshipData ?? null, kind, parentIdentifier);\n }\n }\n}\n\nfunction inverseForRelationship(store: Store, identifier: { type: string; id?: string }, key: string) {\n const definition = store.schema.fields(identifier).get(key);\n if (!definition) {\n return null;\n }\n assert(\n `Expected the field definition to be a relationship`,\n definition.kind === 'hasMany' || definition.kind === 'belongsTo'\n );\n assert(\n `Expected the relationship defintion to specify the inverse type or null.`,\n definition.options?.inverse === null ||\n (typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)\n );\n return definition.options.inverse;\n}\n\nfunction getInverse(\n store: Store,\n parentIdentifier: ResourceIdentity,\n parentRelationship: RelationshipSchema,\n type: string\n) {\n const { name: lhs_relationshipName } = parentRelationship;\n const { type: parentType } = parentIdentifier;\n const inverseKey = inverseForRelationship(store, { type: parentType }, lhs_relationshipName);\n\n if (inverseKey) {\n const definition = store.schema.fields({ type }).get(inverseKey);\n assert(\n `Expected the field definition to be a relationship`,\n definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo')\n );\n return {\n inverseKey,\n kind: definition.kind,\n };\n }\n}\n\nfunction relationshipDataPointsToParent(relationshipData: RelationshipData, identifier: ResourceIdentity): boolean {\n if (relationshipData === null) {\n return false;\n }\n\n if (Array.isArray(relationshipData)) {\n if (relationshipData.length === 0) {\n return false;\n }\n for (let i = 0; i < relationshipData.length; i++) {\n const entry = relationshipData[i];\n if (validateRelationshipEntry(entry, identifier)) {\n return true;\n }\n }\n } else {\n return validateRelationshipEntry(relationshipData, identifier);\n }\n\n return false;\n}\n\nfunction fixRelationshipData(\n relationshipData: RelationshipData,\n relationshipKind: 'hasMany' | 'belongsTo',\n { id, type }: ResourceIdentity\n) {\n const parentRelationshipData = {\n id,\n type,\n };\n\n let payload: { type: string; id: string } | { type: string; id: string }[];\n\n if (relationshipKind === 'hasMany') {\n const relData = (relationshipData as { type: string; id: string }[]) || [];\n if (relationshipData) {\n assert('expected the relationship data to be an array', Array.isArray(relationshipData));\n // these arrays could be massive so this is better than filter\n // Note: this is potentially problematic if type/id are not in the\n // same state of normalization.\n const found = relationshipData.find((v) => {\n return v.type === parentRelationshipData.type && v.id === parentRelationshipData.id;\n });\n if (!found) {\n relData.push(parentRelationshipData);\n }\n } else {\n relData.push(parentRelationshipData);\n }\n payload = relData;\n } else {\n const relData = (relationshipData as { type: string; id: string }) || {};\n Object.assign(relData, parentRelationshipData);\n payload = relData;\n }\n\n return payload;\n}\n\nfunction validateRelationshipEntry({ id }: ResourceIdentity, { id: parentModelID }: ResourceIdentity): boolean {\n return !!id && id.toString() === parentModelID;\n}\n","import type { Store, StoreRequestContext } from '@warp-drive/core';\nimport { LOG_REQUESTS } from '@warp-drive/core/build-config/debugging';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { Future, Handler, NextFn } from '@warp-drive/core/request';\nimport { waitFor } from '@warp-drive/core/signals/-leaked';\nimport { assertPrivateStore, type LegacyQueryArray } from '@warp-drive/core/store/-private';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { PersistedResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { ImmutableRequestInfo, StructuredDataDocument } from '@warp-drive/core/types/request';\nimport type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core/types/schema/fields';\nimport type { SingleResourceDataDocument } from '@warp-drive/core/types/spec/document';\nimport type { ApiError } from '@warp-drive/core/types/spec/error';\nimport type {\n CollectionResourceDocument,\n JsonApiDocument,\n Links,\n PaginationLinks,\n SingleResourceDocument,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { FetchManager, SaveOp } from './fetch-manager.ts';\nimport { assertIdentifierHasId } from './identifier-has-id.ts';\nimport { _findBelongsTo, _findHasMany } from './legacy-data-fetch.ts';\nimport { payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\nimport { SnapshotRecordArray } from './snapshot-record-array.ts';\nimport type { Snapshot } from './snapshot.ts';\n\ntype AdapterErrors = Error & { errors?: unknown[]; isAdapterError?: true; code?: string };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nconst PotentialLegacyOperations = new Set([\n 'findRecord',\n 'findAll',\n 'query',\n 'queryRecord',\n 'findBelongsTo',\n 'findHasMany',\n 'updateRecord',\n 'createRecord',\n 'deleteRecord',\n]);\n\n/**\n * A {@link Handler} that fulfills legacy `findRecord`/`findAll`/`query`/\n * `queryRecord`/`findBelongsTo`/`findHasMany`/`createRecord`/`updateRecord`/\n * `deleteRecord` requests using the store's configured {@link MinimumAdapterInterface | adapter}\n * and {@link MinimumSerializerInterface | serializer}, passing any other\n * request through to the next handler unchanged.\n *\n * @summary Legacy `RequestManager` handler that fulfills find, query, create, update, and delete operations through\n * the store's adapters and serializers, passing other requests along.\n */\nexport const LegacyNetworkHandler: Handler = {\n request<T>(context: StoreRequestContext, next: NextFn<T>): Future<T> | Promise<StructuredDataDocument<T>> {\n // if we are not a legacy request, move on\n if (context.request.url || !context.request.op || !PotentialLegacyOperations.has(context.request.op)) {\n return next(context.request);\n }\n\n const { store } = context.request;\n upgradeStore(store);\n if (!store._fetchManager) {\n store._fetchManager = new FetchManager(store);\n }\n\n switch (context.request.op) {\n case 'findRecord':\n return findRecord(context);\n case 'findAll':\n return findAll(context);\n case 'query':\n return query(context);\n case 'queryRecord':\n return queryRecord(context);\n case 'findBelongsTo':\n return findBelongsTo(context);\n case 'findHasMany':\n return findHasMany(context);\n case 'updateRecord':\n return saveRecord(context);\n case 'createRecord':\n return saveRecord(context);\n case 'deleteRecord':\n return saveRecord(context);\n default:\n return next(context.request);\n }\n },\n};\n\nfunction findBelongsTo<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: ResourceKey;\n options: Record<string, unknown>;\n links?: Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n const identifier = identifiers?.[0];\n upgradeStore(store);\n\n // short circuit if we are already loading\n const pendingRequest = identifier && store._fetchManager.getPendingFetch(identifier as PersistedResourceKey, options);\n if (pendingRequest) {\n return pendingRequest as Promise<T>;\n }\n\n if (useLink) {\n assert(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`, links && links.related);\n return _findBelongsTo(store, record, links.related, field, options) as Promise<T>;\n }\n\n assert(`Expected an identifier`, Array.isArray(identifiers) && identifiers.length === 1);\n\n const manager = store._fetchManager;\n assertIdentifierHasId(identifier);\n\n return options.reload\n ? (manager.scheduleFetch(identifier, options, context.request) as Promise<T>)\n : (manager.fetchDataIfNeededForIdentifier(identifier, options, context.request) as Promise<T>);\n}\n\nfunction findHasMany<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: ResourceKey;\n options: Record<string, unknown>;\n links?: PaginationLinks | Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n upgradeStore(store);\n\n // link case\n if (useLink) {\n const adapter = store.adapterFor(record.type);\n /*\n If a relationship was originally populated by the adapter as a link\n (as opposed to a list of IDs), this method is called when the\n relationship is fetched.\n\n The link (which is usually a URL) is passed through unchanged, so the\n adapter can make whatever request it wants.\n\n The usual use-case is for the server to register a URL as a link, and\n then use that URL in the future to make a request for the relationship.\n */\n assert(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`, adapter);\n assert(\n `You tried to load a hasMany relationship from a specified 'link' in the original payload but your adapter does not implement 'findHasMany'`,\n typeof adapter.findHasMany === 'function'\n );\n assert(`Expected a related link when calling store.findHasMany, found ${String(links)}`, links && links.related);\n\n return _findHasMany(adapter, store, record, links.related, field, options) as Promise<T>;\n }\n\n // identifiers case\n assert(`Expected an array of identifiers to fetch`, Array.isArray(identifiers));\n const fetches = new Array<globalThis.Promise<ResourceKey>>(identifiers.length);\n const manager = store._fetchManager;\n\n for (let i = 0; i < identifiers.length; i++) {\n const identifier = identifiers[i];\n // TODO we probably can be lenient here and return from cache for the isNew case\n assertIdentifierHasId(identifier);\n fetches[i] = options.reload\n ? manager.scheduleFetch(identifier, options, context.request)\n : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n }\n\n return Promise.all(fetches) as Promise<T>;\n}\n\nfunction saveRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, op: operation } = context.request;\n const { options, record: identifier } = data as { record: ResourceKey; options: Record<string, unknown> };\n\n upgradeStore(store);\n assertPrivateStore(store);\n\n store.cache.willCommit(identifier, context);\n\n const saveOptions = Object.assign(\n { [SaveOp]: operation as 'updateRecord' | 'deleteRecord' | 'createRecord' },\n options\n );\n const fetchManagerPromise = store._fetchManager.scheduleSave(identifier, saveOptions);\n\n return fetchManagerPromise\n .then((payload) => {\n let result: SingleResourceDataDocument;\n store._join(() => {\n // @ts-expect-error we don't have access to a response in legacy\n result = store.cache.didCommit(identifier, { request: context.request, content: payload });\n });\n\n // blatantly lie if we were a createRecord request\n // to give some semblance of cache-control to the\n // CachePolicy while legacy is still around\n if (store.lifetimes?.didRequest && operation === 'createRecord') {\n store.lifetimes.didRequest(context.request, { status: 201 } as Response, null, store);\n }\n return store.peekRecord(result!.data!);\n })\n .catch((e: unknown) => {\n let err = e;\n if (!e) {\n err = new Error(`Unknown Error Occurred During Request`);\n } else if (typeof e === 'string') {\n err = new Error(e);\n }\n adapterDidInvalidate(store, identifier, err as Error);\n throw err;\n }) as Promise<T>;\n}\n\nfunction adapterDidInvalidate(\n store: Store,\n identifier: ResourceKey,\n error: Error & { errors?: ApiError[]; isAdapterError?: true; code?: string }\n) {\n upgradeStore(store);\n if (error && error.isAdapterError === true && error.code === 'InvalidError') {\n const serializer = store.serializerFor(identifier.type) as SerializerWithParseErrors;\n\n // TODO @deprecate extractErrors being called\n // TODO remove extractErrors from the default serializers.\n if (serializer && typeof serializer.extractErrors === 'function') {\n const errorsHash = serializer.extractErrors(\n store,\n store.modelFor(identifier.type),\n error,\n identifier.id\n ) as Record<string, string | string[]>;\n error.errors = errorsHashToArray(errorsHash);\n }\n }\n const cache = store.cache;\n\n if (error.errors) {\n assert(\n `Expected the cache in use by resource ${String(\n identifier\n )} to have a getErrors(identifier) method for retrieving errors.`,\n typeof cache.getErrors === 'function'\n );\n\n let jsonApiErrors: ApiError[] = error.errors;\n if (jsonApiErrors.length === 0) {\n jsonApiErrors = [{ title: 'Invalid Error', detail: '', source: { pointer: '/data' } }];\n }\n cache.commitWasRejected(identifier, jsonApiErrors);\n } else {\n cache.commitWasRejected(identifier);\n }\n}\n\nfunction makeArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction errorsHashToArray(errors: Record<string, string | string[]>): ApiError[] {\n const out: ApiError[] = [];\n\n if (errors) {\n Object.keys(errors).forEach((key) => {\n const messages = makeArray(errors[key]);\n for (let i = 0; i < messages.length; i++) {\n let title = 'Invalid Attribute';\n let pointer = `/data/attributes/${key}`;\n if (key === PRIMARY_ATTRIBUTE_KEY) {\n title = 'Invalid Document';\n pointer = `/data`;\n }\n out.push({\n title: title,\n detail: messages[i],\n source: {\n pointer: pointer,\n },\n });\n }\n });\n }\n\n return out;\n}\n\nfunction findRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { record: identifier, options } = data as {\n record: PersistedResourceKey;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n assertPrivateStore(store);\n let promise: Promise<ResourceKey>;\n\n // if not loaded start loading\n if (!store._instanceCache.recordIsLoaded(identifier)) {\n promise = store._fetchManager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n\n // Refetch if the reload option is passed\n } else if (options.reload) {\n assertIdentifierHasId(identifier);\n\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n } else {\n let snapshot: Snapshot | null = null;\n const adapter = store.adapterFor(identifier.type);\n\n // Refetch the record if the adapter thinks the record is stale\n if (\n typeof options.reload === 'undefined' &&\n adapter.shouldReloadRecord &&\n adapter.shouldReloadRecord(store, (snapshot = store._fetchManager.createSnapshot(identifier, options)))\n ) {\n assertIdentifierHasId(identifier);\n if (DEBUG) {\n promise = store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { reload: true }),\n context.request\n );\n } else {\n options.reload = true;\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n } else {\n // Trigger the background refetch if backgroundReload option is passed\n if (\n options.backgroundReload !== false &&\n (options.backgroundReload ||\n !adapter.shouldBackgroundReloadRecord ||\n adapter.shouldBackgroundReloadRecord(\n store,\n snapshot || store._fetchManager.createSnapshot(identifier, options)\n ))\n ) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n void store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { backgroundReload: true }),\n context.request\n );\n } else {\n options.backgroundReload = true;\n void store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n }\n\n // Return the cached record\n promise = Promise.resolve(identifier);\n }\n }\n\n return promise.then((i: ResourceKey) => store.peekRecord(i)) as Promise<T>;\n}\n\nfunction findAll<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { type, options } = data as {\n type: string;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n assertPrivateStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to load all records but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to load all records but your adapter does not implement 'findAll'`,\n typeof adapter.findAll === 'function'\n );\n\n // avoid initializing the liveArray just to set `isUpdating`\n const maybeRecordArray = store.recordArrayManager._live.get(type);\n const snapshotArray = new SnapshotRecordArray(store, type, options);\n\n const shouldReload =\n options.reload ||\n (options.reload !== false &&\n ((adapter.shouldReloadAll && adapter.shouldReloadAll(store, snapshotArray)) ||\n (!adapter.shouldReloadAll && snapshotArray.length === 0)));\n\n let fetch: Promise<T> | undefined;\n if (shouldReload) {\n // oxlint-disable-next-line no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n fetch = _findAll(adapter, store, type, snapshotArray, context.request, true);\n } else {\n fetch = Promise.resolve(store.peekAll(type)) as Promise<T>;\n\n if (\n options.backgroundReload ||\n (options.backgroundReload !== false &&\n (!adapter.shouldBackgroundReloadAll || adapter.shouldBackgroundReloadAll(store, snapshotArray)))\n ) {\n // oxlint-disable-next-line no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n void _findAll(adapter, store, type, snapshotArray, context.request, false);\n }\n }\n\n return fetch;\n}\n\nfunction _findAll<T>(\n adapter: MinimumAdapterInterface,\n store: Store,\n type: string,\n snapshotArray: SnapshotRecordArray,\n request: ImmutableRequestInfo,\n isAsyncFlush: boolean\n): Promise<T> {\n const schema = store.modelFor(type);\n let promise: Promise<T> = Promise.resolve().then(() =>\n adapter.findAll(store, schema, null, snapshotArray)\n ) as Promise<T>;\n\n promise = promise.then((adapterPayload: T) => {\n assert(\n `You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n upgradeStore(store);\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'findAll');\n\n store._push(payload, isAsyncFlush);\n snapshotArray._recordArray.isUpdating = false;\n\n if (LOG_REQUESTS) {\n // oxlint-disable-next-line no-console\n console.log(`request: findAll<${type}> background reload complete`);\n }\n return snapshotArray._recordArray;\n }) as Promise<T>;\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n promise = waitFor(promise);\n }\n }\n\n return promise;\n}\n\nfunction query<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n upgradeStore(store);\n assertPrivateStore(store);\n let { options } = data as {\n options: { _recordArray?: LegacyQueryArray; adapterOptions?: Record<string, unknown> };\n };\n // oxlint-disable-next-line no-shadow\n const { type, query } = data as {\n type: string;\n query: Record<string, unknown>;\n options: { _recordArray?: LegacyQueryArray; adapterOptions?: Record<string, unknown> };\n };\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(`You tried to make a query but your adapter does not implement 'query'`, typeof adapter.query === 'function');\n\n const recordArray =\n options._recordArray ||\n store.recordArrayManager.getCollection({\n type,\n query,\n });\n\n if (DEBUG) {\n options = Object.assign({}, options);\n delete options._recordArray;\n } else {\n delete options._recordArray;\n }\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.query(store, schema, query, recordArray, options));\n\n return promise.then((adapterPayload) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'query');\n const identifiers = store._push(payload, true);\n\n assert(\n '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.',\n Array.isArray(identifiers)\n );\n\n store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload as CollectionResourceDocument);\n\n return recordArray;\n }) as Promise<T>;\n}\n\nfunction assertSingleResourceDocument(payload: JsonApiDocument): asserts payload is SingleResourceDocument {\n assert(\n `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.`,\n !Array.isArray(payload.data)\n );\n}\n\nfunction queryRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n // oxlint-disable-next-line no-shadow\n const { type, query, options } = data as { type: string; query: Record<string, unknown>; options: object };\n upgradeStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to make a query but your adapter does not implement 'queryRecord'`,\n typeof adapter.queryRecord === 'function'\n );\n\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options)) as Promise<T>;\n\n return promise.then((adapterPayload: T) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(\n serializer,\n store,\n schema,\n adapterPayload as Record<string, unknown>,\n null,\n 'queryRecord'\n );\n\n assertSingleResourceDocument(payload);\n\n const identifier = store._push(payload, true) as ResourceKey;\n return identifier ? store.peekRecord(identifier) : null;\n }) as Promise<T>;\n}\n","/**\n * Helps an app migrate incrementally from legacy EmberData patterns to modern ***Warp*Drive**.\n *\n * ## Why it exists\n *\n * While migrating, you may need to:\n *\n * - keep Adapters and Serializers working on a Store whose requests go through the\n * {@link RequestManager}\n * - keep the deprecated request methods such as `store.findRecord` and `store.query`, which\n * Adapters fulfill, working while you move calls to `store.request`\n * - adopt modern patterns one piece at a time rather than all at once\n *\n * ## What it provides\n *\n * - {@link LegacyNetworkHandler}, a request handler that fulfills those legacy requests through\n * the store's Adapters and Serializers and passes every other request along\n * - {@link adapterFor}, {@link serializerFor}, {@link normalize}, {@link pushPayload} and\n * {@link serializeRecord}, the store methods for working with Adapters and Serializers, and\n * {@link LegacyStoreCompat}, the Store type that includes them\n *\n * The Store that [useLegacyStore](/api/@warp-drive/legacy/functions/useLegacyStore) produces\n * adds `LegacyNetworkHandler` to its RequestManager unless `linksMode` is `true`. The hooks\n * that present `Model` instances live in [@warp-drive/legacy/model](/api/@warp-drive/legacy/model/),\n * not here.\n *\n * ## When to use it\n *\n * Only during a migration from legacy EmberData to modern ***Warp*Drive**. It lets you adopt\n * modern patterns incrementally while your existing Adapters and Serializers keep working. For\n * incremental migration strategies, see the [Migration Guide](/upgrading/v5/) and the\n * [Two Store Migration Strategy](/upgrading/v5/two-store-migration).\n *\n * @module\n * @summary Legacy store support for adapters and serializers: the `LegacyNetworkHandler` plus store methods such as\n * `adapterFor`, `serializerFor`, `normalize` and `pushPayload`.\n */\n\nimport { getOwner } from '@ember/application';\n\n// RequestManager is imported only so the @module comment can {@link} it.\n// oxlint-disable-next-line no-unused-vars\nimport { recordIdentifierFor, type RequestManager, type Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { _deprecatingNormalize } from '@warp-drive/core/store/-private';\nimport type { ObjectValue } from '@warp-drive/core/types/json/raw';\nimport type { SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { FetchManager, upgradeStore } from './compat/-private.ts';\nimport type {\n AdapterPayload,\n MinimumAdapterInterface,\n} from './compat/legacy-network-handler/minimum-adapter-interface.ts';\nimport type {\n MinimumSerializerInterface,\n SerializerOptions,\n} from './compat/legacy-network-handler/minimum-serializer-interface.ts';\n\nexport { LegacyNetworkHandler } from './compat/legacy-network-handler/legacy-network-handler.ts';\n\nexport type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };\n\n/**\n * Extends the signature of {@link Store} with additional\n * methods available when using the legacy network layer.\n *\n * @summary Legacy `Store` type extended with `adapterFor`, `serializerFor`, `normalize`, `pushPayload`, and\n * `serializeRecord` from the adapter and serializer network layer.\n * @public\n * @noInheritDoc\n * @legacy\n */\nexport interface LegacyStoreCompat extends Store {\n /**\n * @private\n */\n _fetchManager: FetchManager;\n\n /**\n * Returns the adapter instance for the given model type, instantiating\n * it (and caching the instance) if necessary. See {@link adapterFor}.\n */\n adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\n /**\n * Same as the single-argument overload, but returns `undefined` instead\n * of throwing/asserting when `_allowMissing` is `true` and no adapter\n * is found.\n */\n adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\n\n /**\n * Returns the serializer instance for the given model type, instantiating\n * it (and caching the instance) if necessary. See {@link serializerFor}.\n */\n serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;\n\n /**\n * Normalizes a payload for the given model type using its serializer.\n * See {@link normalize}.\n */\n normalize(modelName: string, payload: ObjectValue): ObjectValue;\n\n /**\n * Pushes a payload into the store using the appropriate serializer to\n * normalize it first. See {@link pushPayload}.\n */\n pushPayload(modelName: string, payload: ObjectValue): void;\n\n /**\n * Serializes a record using its serializer. See {@link serializeRecord}.\n */\n serializeRecord(record: unknown, options?: SerializerOptions): unknown;\n\n /**\n * @private\n */\n _adapterCache: Record<string, MinimumAdapterInterface & { store: Store }>;\n /**\n * @private\n */\n _serializerCache: Record<string, MinimumSerializerInterface & { store: Store }>;\n}\n\n/**\n * @summary Deprecated alias of `LegacyStoreCompat`, the `Store` type extended with legacy adapter and serializer\n * methods.\n * @deprecated - use {@link LegacyStoreCompat} instead\n */\nexport type CompatStore = LegacyStoreCompat;\n\n/**\n Returns an instance of the adapter for a given type. For\n example, `adapterFor('person')` will return an instance of\n the adapter located at `app/adapters/person.js`\n\n If no `person` adapter is found, this method will look\n for an `application` adapter (the default adapter for\n your entire application).\n\n @summary Legacy store method that returns the cached adapter for a model type, falling back to the `application`\n adapter.\n @public\n @param modelName\n*/\nexport function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\nexport function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\nexport function adapterFor(this: Store, modelName: string, _allowMissing?: true): MinimumAdapterInterface | undefined {\n assert(\n `Attempted to call store.adapterFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's adapterFor method`, modelName);\n assert(\n `Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._adapterCache =\n this._adapterCache || (Object.create(null) as Record<string, MinimumAdapterInterface & { store: Store }>);\n\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _adapterCache } = this;\n let adapter: (MinimumAdapterInterface & { store: Store }) | undefined = _adapterCache[normalizedModelName];\n if (adapter) {\n return adapter;\n }\n\n const owner = getOwner(this)!;\n\n // name specific adapter\n adapter = owner.lookup(`adapter:${normalizedModelName}`) as (MinimumAdapterInterface & { store: Store }) | undefined;\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n return adapter;\n }\n\n // no adapter found for the specific name, fallback and check for application adapter\n adapter = _adapterCache.application || owner.lookup('adapter:application');\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n _adapterCache.application = adapter;\n return adapter;\n }\n\n assert(\n `No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`,\n _allowMissing\n );\n}\n\n/**\n Returns an instance of the serializer for a given type. For\n example, `serializerFor('person')` will return an instance of\n `App.PersonSerializer`.\n\n If no `App.PersonSerializer` is found, this method will look\n for an `App.ApplicationSerializer` (the default serializer for\n your entire application).\n\n If a serializer cannot be found on the adapter, it will fall back\n to an instance of `JSONSerializer`.\n\n @summary Legacy store method that returns the cached serializer for a model type, falling back to the\n `application` serializer, or `null` if neither exists.\n @public\n @param modelName the record to serialize\n */\nexport function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null {\n assert(\n `Attempted to call store.serializerFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's serializerFor method`, modelName);\n assert(\n `Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._serializerCache =\n this._serializerCache || (Object.create(null) as Record<string, MinimumSerializerInterface & { store: Store }>);\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _serializerCache } = this;\n let serializer: (MinimumSerializerInterface & { store: Store }) | undefined = _serializerCache[normalizedModelName];\n if (serializer) {\n return serializer;\n }\n\n // by name\n const owner = getOwner(this)!;\n serializer = owner.lookup(`serializer:${normalizedModelName}`) as\n | (MinimumSerializerInterface & { store: Store })\n | undefined;\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n return serializer;\n }\n\n // no serializer found for the specific model, fallback and check for application serializer\n serializer = _serializerCache.application || owner.lookup('serializer:application');\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n _serializerCache.application = serializer;\n return serializer;\n }\n\n return null;\n}\n\n/**\n `normalize` converts a json payload into the normalized form expected by\n {@link Store.push | push} using the serializer specified by `modelName`\n\n :::warning\n Generally it would be better to invoke the serializer yourself directly,\n or write a more specialized normalization utility.\n :::\n\n Example\n\n ```js\n socket.on('message', function(message) {\n let modelName = message.model;\n let data = message.data;\n store.push(store.normalize(modelName, data));\n });\n ```\n\n @summary Legacy store method that converts a raw payload into the normalized document `store.push` expects, using\n the serializer for the given model type.\n @legacy\n @public\n @param modelName The name of the model type for this payload\n @return The normalized payload\n*/\n// TODO @runspired @deprecate users should call normalize on the associated serializer directly\nexport function normalize(this: Store, modelName: string, payload: ObjectValue): SingleResourceDocument {\n upgradeStore(this);\n assert(\n `Attempted to call store.normalize(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's normalize method`, modelName);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`,\n typeof modelName === 'string'\n );\n const normalizedModelName = _deprecatingNormalize(modelName);\n const serializer = this.serializerFor(normalizedModelName);\n const schema = this.modelFor(normalizedModelName);\n assert(\n `You must define a normalize method in your serializer in order to call store.normalize`,\n typeof serializer?.normalize === 'function'\n );\n return serializer.normalize(schema, payload);\n}\n\n/**\n Push some raw data into the store.\n\n This method can be used both to push in brand new\n records, as well as to update existing records. You\n can push in more than one type of object at once.\n All objects should be in the format expected by the\n serializer.\n\n ```js [app/serializers/application.js]\n import RESTSerializer from '@warp-drive/legacy/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```js\n let pushData = {\n posts: [\n { id: 1, postTitle: \"Great post\", commentIds: [2] }\n ],\n comments: [\n { id: 2, commentBody: \"Insightful comment\" }\n ]\n }\n\n store.pushPayload(pushData);\n ```\n\n By default, the data will be deserialized using a default\n serializer (the application serializer if it exists).\n\n Alternatively, `pushPayload` will accept a model type which\n will determine which serializer will process the payload.\n\n ```js [app/serializers/application.js]\n import RESTSerializer from '@warp-drive/legacy/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@warp-drive/legacy/serializer/json';\n\n export default JSONSerializer;\n ```\n\n ```js\n store.pushPayload(pushData); // Will use the application serializer\n store.pushPayload('post', pushData); // Will use the post serializer\n ```\n\n @summary Legacy store method that pushes a raw payload into the store after the application serializer, or the\n given model type's serializer, normalizes it.\n @public\n @param modelName Optionally, a model type used to determine which serializer will be used\n @param inputPayload\n */\n// TODO @runspired @deprecate pushPayload in favor of looking up the serializer\nexport function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void {\n upgradeStore(this);\n assert(\n `Attempted to call store.pushPayload(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n const payload: ObjectValue = inputPayload || (modelName as unknown as ObjectValue);\n const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : 'application';\n const serializer = this.serializerFor(normalizedModelName);\n\n assert(\n `You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`,\n serializer && typeof serializer.pushPayload === 'function'\n );\n serializer.pushPayload(this, payload);\n}\n\n/**\n * Serializes a record using the store's legacy network layer, as with\n * {@link LegacyStoreCompat.serializeRecord | store.serializeRecord}.\n *\n * @summary Legacy store method that serializes a record into a payload using its model type's serializer.\n */\n// TODO @runspired @deprecate records should implement their own serialization if desired\nexport function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown {\n upgradeStore(this);\n // TODO we used to check if the record was destroyed here\n if (!this._fetchManager) {\n this._fetchManager = new FetchManager(this);\n }\n\n return this._fetchManager.createSnapshot(recordIdentifierFor(record)).serialize(options);\n}\n\n/**\n * Destroys any adapters/serializers the legacy network layer has created\n * for this store, invoked when the store itself is destroyed.\n *\n * @summary Legacy store teardown hook that destroys every adapter and serializer instance the store has cached.\n */\nexport function cleanup(this: Store): void {\n upgradeStore(this);\n // enqueue destruction of any adapters/serializers we have created\n for (const adapterName in this._adapterCache) {\n const adapter = this._adapterCache[adapterName];\n if (typeof adapter.destroy === 'function') {\n adapter.destroy();\n }\n }\n\n for (const serializerName in this._serializerCache) {\n const serializer = this._serializerCache[serializerName];\n if (typeof serializer.destroy === 'function') {\n serializer.destroy();\n }\n }\n}\n"],"mappings":";;;;;;;;AAaA,SAAgBM,aACdC,SACAC,OACAC,YACAC,MACAC,cACAC,SACiC;CACjCZ,6BAAaQ,KAAK;CAgBlB,OAfgBM,QAAQC,QAAQ,CAAC,CAACC,WAAW;EAC3C,MAAMC,WAAWT,MAAMU,cAAcC,eAAeV,YAAYG,OAAO;EAEvE,MAAMS,cADU,CAACX,QAAQ,OAAOA,SAAS,WACXA,OAAOA,KAAKY;EAC1CjB,eAAAD,gBAAA,CAAA,CAAAmB,UAAAC,IAAAC,KAAA,OAAAC,SAAA;GAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,yMAAyM;EAAA,EAAA,CACzMN,WAAW;EAEbhB,eAAAD,gBAAA,CAAA,CAAAmB,UAAAC,IAAAC,KAAA,OAAAC,SAAA;GAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,iEAAiE;EAAA,EAAA,CACjE,OAAOpB,QAAQqB,gBAAgB,UAAU;EAE3C,OAAOrB,QAAQqB,YAAYpB,OAAOS,UAAUI,a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