@warp-drive/legacy 5.10.0-alpha.10 → 5.10.0-alpha.13
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 -1
- package/blueprints/adapter/index.js +8 -4
- package/blueprints/adapter-test/index.js +0 -2
- package/blueprints/adapter-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/model/files/__root__/__path__/__name__.js +1 -1
- package/blueprints/model/index.js +9 -3
- package/blueprints/model-test/index.js +0 -2
- package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/serializer/files/__root__/__path__/__name__.js +1 -1
- package/blueprints/serializer/index.js +8 -4
- package/blueprints/serializer-test/index.js +0 -2
- package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/transform/files/__root__/__path__/__name__.js +1 -1
- package/blueprints/transform/index.js +6 -1
- package/blueprints/transform-test/index.js +0 -2
- package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/dist/-private-BE7RaJCw.js.map +1 -1
- package/dist/adapter/-private.d.ts +2 -2
- package/dist/adapter/error.d.ts +1 -1
- package/dist/adapter/error.js +53 -0
- package/dist/adapter/error.js.map +1 -1
- package/dist/adapter/json-api.d.ts +5 -3
- package/dist/adapter/json-api.d.ts.map +1 -1
- package/dist/adapter/json-api.js +8 -1
- package/dist/adapter/json-api.js.map +1 -1
- package/dist/adapter/rest.d.ts +1 -1
- package/dist/adapter/rest.js +20 -1
- package/dist/adapter/rest.js.map +1 -1
- package/dist/{adapter-eYo2pIuM.js → adapter-BNC6wlWu.js} +42 -1
- package/dist/adapter-BNC6wlWu.js.map +1 -0
- package/dist/{adapter-CARrK3-8.d.ts → adapter-D3A8ixjz.d.ts} +9 -2
- package/dist/adapter-D3A8ixjz.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/builders.d.ts +10 -0
- package/dist/compat/builders.d.ts.map +1 -1
- package/dist/compat/builders.js +10 -0
- package/dist/compat/builders.js.map +1 -1
- package/dist/compat/extensions.d.ts +1 -1
- package/dist/compat/extensions.js +22 -0
- package/dist/compat/extensions.js.map +1 -1
- package/dist/compat/utils.d.ts +16 -0
- package/dist/compat/utils.d.ts.map +1 -1
- package/dist/compat/utils.js +18 -0
- package/dist/compat/utils.js.map +1 -1
- package/dist/{compat-BbNNmTM-.d.ts → compat-BZlQ-5eI.d.ts} +30 -1
- package/dist/compat-BZlQ-5eI.d.ts.map +1 -0
- package/dist/{compat-DWgmYX8T.js → compat-Da5y9AsM.js} +57 -1
- package/dist/compat-Da5y9AsM.js.map +1 -0
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +1 -1
- package/dist/{error-CzkyXr1Q.d.ts → error-Ba1cMaWG.d.ts} +49 -1
- package/dist/error-Ba1cMaWG.d.ts.map +1 -0
- package/dist/{errors-BlrR6--x.js → errors-BI0Xugyo.js} +3 -1
- package/dist/errors-BI0Xugyo.js.map +1 -0
- package/dist/{extensions-DumNm4dA.d.ts → extensions-fwdnX9n4.d.ts} +18 -1
- package/dist/extensions-fwdnX9n4.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/{json-BXNPTlcH.js → json-n2XHdV_P.js} +8 -1
- package/dist/json-n2XHdV_P.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 +18 -2
- package/dist/model/migration-support.d.ts.map +1 -1
- package/dist/model/migration-support.js +21 -3
- package/dist/model/migration-support.js.map +1 -1
- package/dist/{model-62hn5_PD.d.ts → model-BPVLf-rp.d.ts} +11 -2
- package/dist/model-BPVLf-rp.d.ts.map +1 -0
- package/dist/{model-C9l1mRs6.js → model-DdlhdL9V.js} +14 -3
- package/dist/model-DdlhdL9V.js.map +1 -0
- package/dist/{unpkg/dev-deprecated/model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
- package/dist/model-fragments-ZM4k_mT3.js.map +1 -0
- package/dist/model-fragments.d.ts +31 -1
- package/dist/model-fragments.d.ts.map +1 -1
- package/dist/model-fragments.js +1 -1
- package/dist/model.d.ts +12 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -2
- package/dist/{rest-0NhtexIq.d.ts → rest-ddU-K5eS.d.ts} +18 -4
- package/dist/rest-ddU-K5eS.d.ts.map +1 -0
- package/dist/{schema-provider-waPfuoKq.js → schema-provider-Dyjpau2P.js} +13 -6
- package/dist/schema-provider-Dyjpau2P.js.map +1 -0
- package/dist/serializer/json-api.d.ts +1 -0
- package/dist/serializer/json-api.d.ts.map +1 -1
- package/dist/serializer/json-api.js +6 -1
- package/dist/serializer/json-api.js.map +1 -1
- package/dist/serializer/json.d.ts +2 -0
- package/dist/serializer/json.d.ts.map +1 -1
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.d.ts +4 -0
- package/dist/serializer/rest.d.ts.map +1 -1
- package/dist/serializer/rest.js +10 -1
- package/dist/serializer/rest.js.map +1 -1
- package/dist/serializer/transform.d.ts +9 -0
- package/dist/serializer/transform.d.ts.map +1 -1
- package/dist/serializer/transform.js +9 -0
- package/dist/serializer/transform.js.map +1 -1
- package/dist/serializer.d.ts +2 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +40 -0
- package/dist/serializer.js.map +1 -1
- package/dist/{store-C4qYzXei.js → store-CMUcaXRp.js} +9 -1
- package/dist/store-CMUcaXRp.js.map +1 -0
- package/dist/store.d.ts +3 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -1
- package/dist/unpkg/dev/-private-BWBRzgZO.js.map +1 -1
- package/dist/unpkg/dev/adapter/error.js +53 -0
- package/dist/unpkg/dev/adapter/error.js.map +1 -1
- package/dist/unpkg/dev/adapter/json-api.js +8 -1
- package/dist/unpkg/dev/adapter/json-api.js.map +1 -1
- package/dist/unpkg/dev/adapter/rest.js +20 -1
- package/dist/unpkg/dev/adapter/rest.js.map +1 -1
- package/dist/unpkg/{dev-deprecated/adapter-oLwyr47q.js → dev/adapter-CLkSBRpr.js} +42 -1
- package/dist/unpkg/dev/adapter-CLkSBRpr.js.map +1 -0
- package/dist/unpkg/dev/adapter.js +1 -1
- package/dist/unpkg/dev/compat/builders.js +10 -0
- package/dist/unpkg/dev/compat/builders.js.map +1 -1
- package/dist/unpkg/dev/compat/extensions.js +22 -0
- package/dist/unpkg/dev/compat/extensions.js.map +1 -1
- package/dist/unpkg/dev/compat/utils.js +18 -0
- package/dist/unpkg/dev/compat/utils.js.map +1 -1
- package/dist/unpkg/dev/{compat-BIv7BiG_.js → compat-BEO8cSlC.js} +57 -1
- package/dist/unpkg/dev/compat-BEO8cSlC.js.map +1 -0
- package/dist/unpkg/dev/compat.js +1 -1
- package/dist/unpkg/dev/{errors-Dv8RCLdU.js → errors-TUXPdiG8.js} +3 -1
- package/dist/unpkg/dev/errors-TUXPdiG8.js.map +1 -0
- package/dist/unpkg/dev/index.js +24 -5
- package/dist/unpkg/dev/index.js.map +1 -1
- package/dist/unpkg/dev/{json-DDJji3V3.js → json-CN-WCWwk.js} +8 -1
- package/dist/unpkg/dev/json-CN-WCWwk.js.map +1 -0
- package/dist/unpkg/dev/model/-private.js +1 -1
- package/dist/unpkg/dev/model/migration-support.js +20 -2
- package/dist/unpkg/dev/model/migration-support.js.map +1 -1
- package/dist/unpkg/dev/{model-CRYi4C3z.js → model-OQxvzZu6.js} +14 -3
- package/dist/unpkg/dev/model-OQxvzZu6.js.map +1 -0
- package/dist/unpkg/dev/{model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
- package/dist/unpkg/dev/model-fragments-ZM4k_mT3.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/{schema-provider-BYjTpV6C.js → schema-provider-Qxo5AVFM.js} +9 -2
- package/dist/unpkg/dev/schema-provider-Qxo5AVFM.js.map +1 -0
- package/dist/unpkg/dev/serializer/json-api.js +6 -1
- 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 +10 -1
- package/dist/unpkg/dev/serializer/rest.js.map +1 -1
- package/dist/unpkg/dev/serializer/transform.js +9 -0
- package/dist/unpkg/dev/serializer/transform.js.map +1 -1
- package/dist/unpkg/dev/serializer.js +40 -0
- package/dist/unpkg/dev/serializer.js.map +1 -1
- package/dist/unpkg/dev/{store-D_V8-HQl.js → store-DPzaVp5e.js} +9 -1
- package/dist/unpkg/dev/store-DPzaVp5e.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev-deprecated/-private-BWBRzgZO.js.map +1 -1
- package/dist/unpkg/dev-deprecated/adapter/error.js +53 -0
- package/dist/unpkg/dev-deprecated/adapter/error.js.map +1 -1
- package/dist/unpkg/dev-deprecated/adapter/json-api.js +8 -1
- package/dist/unpkg/dev-deprecated/adapter/json-api.js.map +1 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js +20 -1
- package/dist/unpkg/dev-deprecated/adapter/rest.js.map +1 -1
- package/dist/unpkg/{dev/adapter-oLwyr47q.js → dev-deprecated/adapter-CLkSBRpr.js} +42 -1
- package/dist/unpkg/dev-deprecated/adapter-CLkSBRpr.js.map +1 -0
- package/dist/unpkg/dev-deprecated/adapter.js +1 -1
- package/dist/unpkg/dev-deprecated/compat/builders.js +10 -0
- package/dist/unpkg/dev-deprecated/compat/builders.js.map +1 -1
- package/dist/unpkg/dev-deprecated/compat/extensions.js +22 -0
- package/dist/unpkg/dev-deprecated/compat/extensions.js.map +1 -1
- package/dist/unpkg/dev-deprecated/compat/utils.js +18 -0
- package/dist/unpkg/dev-deprecated/compat/utils.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{compat-BpJgmr75.js → compat-diBpt972.js} +57 -1
- package/dist/unpkg/dev-deprecated/compat-diBpt972.js.map +1 -0
- package/dist/unpkg/dev-deprecated/compat.js +1 -1
- package/dist/unpkg/dev-deprecated/{errors-__7EyX3m.js → errors-CLRhQKym.js} +3 -1
- package/dist/unpkg/dev-deprecated/errors-CLRhQKym.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +24 -5
- package/dist/unpkg/dev-deprecated/index.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{json-DDJji3V3.js → json-CN-WCWwk.js} +8 -1
- package/dist/unpkg/dev-deprecated/json-CN-WCWwk.js.map +1 -0
- package/dist/unpkg/dev-deprecated/model/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/model/migration-support.js +20 -2
- package/dist/unpkg/dev-deprecated/model/migration-support.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{model-BYzXxf9f.js → model-DIvuaUiJ.js} +14 -3
- package/dist/unpkg/dev-deprecated/model-DIvuaUiJ.js.map +1 -0
- package/dist/{model-fragments-DSqu0ptR.js → unpkg/dev-deprecated/model-fragments-ZM4k_mT3.js} +23 -1
- package/dist/unpkg/dev-deprecated/model-fragments-ZM4k_mT3.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/{schema-provider-BM9FSxvx.js → schema-provider-DHS8XOdK.js} +9 -2
- package/dist/unpkg/dev-deprecated/schema-provider-DHS8XOdK.js.map +1 -0
- package/dist/unpkg/dev-deprecated/serializer/json-api.js +6 -1
- 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 +10 -1
- package/dist/unpkg/dev-deprecated/serializer/rest.js.map +1 -1
- package/dist/unpkg/dev-deprecated/serializer/transform.js +9 -0
- package/dist/unpkg/dev-deprecated/serializer/transform.js.map +1 -1
- package/dist/unpkg/dev-deprecated/serializer.js +40 -0
- package/dist/unpkg/dev-deprecated/serializer.js.map +1 -1
- package/dist/unpkg/dev-deprecated/{store-BCOLSC6z.js → store-D4taw4YF.js} +9 -1
- package/dist/unpkg/dev-deprecated/store-D4taw4YF.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/prod/-private-DG7eJX0Y.js.map +1 -1
- package/dist/unpkg/prod/adapter/error.js +53 -0
- package/dist/unpkg/prod/adapter/error.js.map +1 -1
- package/dist/unpkg/prod/adapter/json-api.js +8 -1
- package/dist/unpkg/prod/adapter/json-api.js.map +1 -1
- package/dist/unpkg/prod/adapter/rest.js +20 -1
- package/dist/unpkg/prod/adapter/rest.js.map +1 -1
- package/dist/unpkg/prod/{adapter-DQ9UA7FC.js → adapter-BCGjVOaE.js} +42 -1
- package/dist/unpkg/prod/adapter-BCGjVOaE.js.map +1 -0
- package/dist/unpkg/prod/adapter.js +1 -1
- package/dist/unpkg/prod/compat/builders.js +10 -0
- package/dist/unpkg/prod/compat/builders.js.map +1 -1
- package/dist/unpkg/prod/compat/extensions.js +22 -0
- package/dist/unpkg/prod/compat/extensions.js.map +1 -1
- package/dist/unpkg/prod/compat/utils.js +18 -0
- package/dist/unpkg/prod/compat/utils.js.map +1 -1
- package/dist/unpkg/prod/{compat-BM3u_d5-.js → compat-DFMtpQGs.js} +57 -1
- package/dist/unpkg/prod/compat-DFMtpQGs.js.map +1 -0
- package/dist/unpkg/prod/compat.js +1 -1
- package/dist/unpkg/prod/{errors-BhnSZApj.js → errors-CImmK4OM.js} +3 -1
- package/dist/unpkg/prod/errors-CImmK4OM.js.map +1 -0
- package/dist/unpkg/prod/index.js +24 -5
- package/dist/unpkg/prod/index.js.map +1 -1
- package/dist/unpkg/{prod-deprecated/json-BD1kRTfB.js → prod/json-CNq5Z0Xq.js} +8 -1
- package/dist/unpkg/prod/json-CNq5Z0Xq.js.map +1 -0
- package/dist/unpkg/prod/model/-private.js +1 -1
- package/dist/unpkg/prod/model/migration-support.js +20 -2
- package/dist/unpkg/prod/model/migration-support.js.map +1 -1
- package/dist/unpkg/prod/{model-CDyejvo3.js → model-_HpfLmtZ.js} +14 -3
- package/dist/unpkg/prod/model-_HpfLmtZ.js.map +1 -0
- package/dist/unpkg/prod/model-fragments-ZM4k_mT3.js +356 -0
- package/dist/unpkg/prod/model-fragments-ZM4k_mT3.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/{schema-provider-Co3gCBMj.js → schema-provider-DEe5vZ8b.js} +9 -2
- package/dist/unpkg/prod/schema-provider-DEe5vZ8b.js.map +1 -0
- package/dist/unpkg/prod/serializer/json-api.js +6 -1
- 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 +10 -1
- package/dist/unpkg/prod/serializer/rest.js.map +1 -1
- package/dist/unpkg/prod/serializer/transform.js +9 -0
- package/dist/unpkg/prod/serializer/transform.js.map +1 -1
- package/dist/unpkg/prod/serializer.js +40 -0
- package/dist/unpkg/prod/serializer.js.map +1 -1
- package/dist/unpkg/prod/{store-RGGc1ilN.js → store-ILh6zPA0.js} +9 -1
- package/dist/unpkg/prod/{store-RGGc1ilN.js.map → store-ILh6zPA0.js.map} +1 -1
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod-deprecated/-private-DG7eJX0Y.js.map +1 -1
- package/dist/unpkg/prod-deprecated/adapter/error.js +53 -0
- package/dist/unpkg/prod-deprecated/adapter/error.js.map +1 -1
- package/dist/unpkg/prod-deprecated/adapter/json-api.js +8 -1
- package/dist/unpkg/prod-deprecated/adapter/json-api.js.map +1 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js +20 -1
- package/dist/unpkg/prod-deprecated/adapter/rest.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{adapter-DQ9UA7FC.js → adapter-BCGjVOaE.js} +42 -1
- package/dist/unpkg/prod-deprecated/adapter-BCGjVOaE.js.map +1 -0
- package/dist/unpkg/prod-deprecated/adapter.js +1 -1
- package/dist/unpkg/prod-deprecated/compat/builders.js +10 -0
- package/dist/unpkg/prod-deprecated/compat/builders.js.map +1 -1
- package/dist/unpkg/prod-deprecated/compat/extensions.js +22 -0
- package/dist/unpkg/prod-deprecated/compat/extensions.js.map +1 -1
- package/dist/unpkg/prod-deprecated/compat/utils.js +18 -0
- package/dist/unpkg/prod-deprecated/compat/utils.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{compat-BM3u_d5-.js → compat-DFMtpQGs.js} +57 -1
- package/dist/unpkg/prod-deprecated/compat-DFMtpQGs.js.map +1 -0
- package/dist/unpkg/prod-deprecated/compat.js +1 -1
- package/dist/unpkg/prod-deprecated/{errors-BX8zhQS4.js → errors-DIOUcGAT.js} +3 -1
- package/dist/unpkg/prod-deprecated/errors-DIOUcGAT.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +24 -5
- package/dist/unpkg/prod-deprecated/index.js.map +1 -1
- package/dist/unpkg/{prod/json-BD1kRTfB.js → prod-deprecated/json-CNq5Z0Xq.js} +8 -1
- package/dist/unpkg/prod-deprecated/json-CNq5Z0Xq.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/model/migration-support.js +20 -2
- package/dist/unpkg/prod-deprecated/model/migration-support.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js} +23 -1
- package/dist/unpkg/prod-deprecated/model-fragments-ZM4k_mT3.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model-fragments.js +1 -1
- package/dist/unpkg/prod-deprecated/{model-qeqVBN2l.js → model-wzHTp8Up.js} +14 -3
- package/dist/unpkg/prod-deprecated/model-wzHTp8Up.js.map +1 -0
- package/dist/unpkg/prod-deprecated/model.js +2 -2
- package/dist/unpkg/prod-deprecated/{schema-provider-CTLbab33.js → schema-provider-NWVqBEkW.js} +9 -2
- package/dist/unpkg/prod-deprecated/schema-provider-NWVqBEkW.js.map +1 -0
- package/dist/unpkg/prod-deprecated/serializer/json-api.js +6 -1
- 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 +10 -1
- package/dist/unpkg/prod-deprecated/serializer/rest.js.map +1 -1
- package/dist/unpkg/prod-deprecated/serializer/transform.js +9 -0
- package/dist/unpkg/prod-deprecated/serializer/transform.js.map +1 -1
- package/dist/unpkg/prod-deprecated/serializer.js +40 -0
- package/dist/unpkg/prod-deprecated/serializer.js.map +1 -1
- package/dist/unpkg/prod-deprecated/{store-0L2CkYzh.js → store-CB_rVlXv.js} +9 -1
- package/dist/unpkg/prod-deprecated/{store-0L2CkYzh.js.map → store-CB_rVlXv.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/package.json +12 -9
- 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-DWgmYX8T.js.map +0 -1
- package/dist/error-CzkyXr1Q.d.ts.map +0 -1
- package/dist/errors-BlrR6--x.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-C9l1mRs6.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-waPfuoKq.js.map +0 -1
- package/dist/store-C4qYzXei.js.map +0 -1
- package/dist/unpkg/dev/adapter-oLwyr47q.js.map +0 -1
- package/dist/unpkg/dev/compat-BIv7BiG_.js.map +0 -1
- package/dist/unpkg/dev/errors-Dv8RCLdU.js.map +0 -1
- package/dist/unpkg/dev/json-DDJji3V3.js.map +0 -1
- package/dist/unpkg/dev/model-CRYi4C3z.js.map +0 -1
- package/dist/unpkg/dev/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/dev/schema-provider-BYjTpV6C.js.map +0 -1
- package/dist/unpkg/dev/store-D_V8-HQl.js.map +0 -1
- package/dist/unpkg/dev-deprecated/adapter-oLwyr47q.js.map +0 -1
- package/dist/unpkg/dev-deprecated/compat-BpJgmr75.js.map +0 -1
- package/dist/unpkg/dev-deprecated/errors-__7EyX3m.js.map +0 -1
- package/dist/unpkg/dev-deprecated/json-DDJji3V3.js.map +0 -1
- package/dist/unpkg/dev-deprecated/model-BYzXxf9f.js.map +0 -1
- package/dist/unpkg/dev-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/dev-deprecated/schema-provider-BM9FSxvx.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-BCOLSC6z.js.map +0 -1
- package/dist/unpkg/prod/adapter-DQ9UA7FC.js.map +0 -1
- package/dist/unpkg/prod/compat-BM3u_d5-.js.map +0 -1
- package/dist/unpkg/prod/errors-BhnSZApj.js.map +0 -1
- package/dist/unpkg/prod/json-BD1kRTfB.js.map +0 -1
- package/dist/unpkg/prod/model-CDyejvo3.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/schema-provider-Co3gCBMj.js.map +0 -1
- package/dist/unpkg/prod-deprecated/adapter-DQ9UA7FC.js.map +0 -1
- package/dist/unpkg/prod-deprecated/compat-BM3u_d5-.js.map +0 -1
- package/dist/unpkg/prod-deprecated/errors-BX8zhQS4.js.map +0 -1
- package/dist/unpkg/prod-deprecated/json-BD1kRTfB.js.map +0 -1
- package/dist/unpkg/prod-deprecated/model-fragments-DSqu0ptR.js.map +0 -1
- package/dist/unpkg/prod-deprecated/model-qeqVBN2l.js.map +0 -1
- package/dist/unpkg/prod-deprecated/schema-provider-CTLbab33.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-D4taw4YF.js","names":["defineSignal","assertPrivateStore","ensureStringId","recordIdentifierFor","getOrSetGlobal","preloadData","store","identifier","preload","jsonPayload","schemas","schema","fields","Object","keys","forEach","key","preloadValue","field","get","kind","relationships","preloadRelationship","attributes","cache","hasRecord","Boolean","_instanceCache","peek","upsert","relatedType","type","test","Error","Array","isArray","data","map","value","_convertPreloadRelationshipToJSON","id","_resourceIsFullDeleted","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","RecordReference","___token","___identifier","constructor","notifications","subscribe","_","bucket","notifiedKey","_ref","destroy","unsubscribe","remoteType","push","objectOrPromise","Promise","resolve","then","peekRecord","load","findRecord","reload","prototype","AvailableShims","WeakMap","getShimClass","modelName","shims","create","set","shim","undefined","ShimModelClass","__store","Map","fieldSchemas","attrs","relationshipsByName","rels","eachAttribute","callback","binding","call","eachRelationship","eachTransformedAttribute","assertPrivateStore","constructResource","ensureStringId","recordIdentifierFor","storeFor","SkipCache","isMaybeIdentifier","normalizeModelName","getShimClass","preloadData","RecordReference","resourceIsFullyDeleted","restoreDeprecatedStoreBehaviors","StoreKlass","prototype","findRecord","resource","id","options","test","Error","isDestroying","isDestroyed","type","normalizedId","identifier","cacheKeyManager","getOrCreateRecordIdentifier","preload","_instanceCache","recordIsLoaded","reload","_join","promise","request","op","data","record","cacheOptions","then","document","content","findAll","query","queryRecord","getReference","resourceIdentifier","arguments","length","cache","upgradeInstanceCaches","__instances","reference","get","set","modelFor","schema","hasResource","saveRecord","Promise","reject","lid","resolve","operation","isNew","isDeleted","records","withReferences","WeakMap"],"sources":["../../../src/store/-private.ts","../../../src/store.ts"],"sourcesContent":["import type { NotificationType } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { defineSignal } from '@warp-drive/core/signals/-leaked';\nimport {\n assertPrivateStore,\n ensureStringId,\n type InstanceCache,\n recordIdentifierFor,\n} from '@warp-drive/core/store/-private';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { NewResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type {\n LegacyAttributeField,\n LegacyRelationshipField,\n LegacyRelationshipField as RelationshipSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport type {\n ExistingResourceIdentifierObject,\n ExistingResourceObject,\n InnerRelationshipDocument,\n SingleResourceDocument,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { Store } from '../store.ts';\n\n/*\n When a find request is triggered on the store, the user can optionally pass in\n attributes and relationships to be preloaded. These are meant to behave as if they\n came back from the server, except the user obtained them out of band and is informing\n the store of their existence. The most common use case is for supporting client side\n nested URLs, such as `/posts/1/comments/2` so the user can do\n `store.findRecord('comment', 2, { preload: { post: 1 } })` without having to fetch the post.\n\n Preloaded data can be attributes and relationships passed in either as IDs or as actual\n models.\n */\ntype PreloadRelationshipValue = OpaqueRecordInstance | string;\nexport function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void {\n const jsonPayload: Partial<ExistingResourceObject> = {};\n //TODO(Igor) consider the polymorphic case\n const schemas = store.schema;\n const fields = schemas.fields(identifier);\n Object.keys(preload).forEach((key) => {\n const preloadValue = preload[key];\n\n const field = fields.get(key);\n if (field && (field.kind === 'hasMany' || field.kind === 'belongsTo')) {\n if (!jsonPayload.relationships) {\n jsonPayload.relationships = {};\n }\n jsonPayload.relationships[key] = preloadRelationship(field, preloadValue);\n } else {\n if (!jsonPayload.attributes) {\n jsonPayload.attributes = {};\n }\n jsonPayload.attributes[key] = preloadValue;\n }\n });\n const cache = store.cache;\n assertPrivateStore(store);\n const hasRecord = Boolean(store._instanceCache.peek(identifier));\n cache.upsert(identifier, jsonPayload, hasRecord);\n}\n\nfunction preloadRelationship(\n schema: RelationshipSchema,\n preloadValue: PreloadRelationshipValue | null | Array<PreloadRelationshipValue>\n): InnerRelationshipDocument<ExistingResourceIdentifierObject> {\n const relatedType = schema.type;\n\n if (schema.kind === 'hasMany') {\n assert('You need to pass in an array to set a hasMany property on a record', Array.isArray(preloadValue));\n return { data: preloadValue.map((value) => _convertPreloadRelationshipToJSON(value, relatedType)) };\n }\n\n assert('You should not pass in an array to set a belongsTo property on a record', !Array.isArray(preloadValue));\n return { data: preloadValue ? _convertPreloadRelationshipToJSON(preloadValue, relatedType) : null };\n}\n\n/*\n findRecord('user', '1', { preload: { friends: ['1'] }});\n findRecord('user', '1', { preload: { friends: [record] }});\n*/\nfunction _convertPreloadRelationshipToJSON(\n value: OpaqueRecordInstance | string,\n type: string\n): ExistingResourceIdentifierObject {\n if (typeof value === 'string' || typeof value === 'number') {\n return { type, id: ensureStringId(value) };\n }\n // TODO if not a record instance assert it's an identifier\n // and allow identifiers to be used\n return recordIdentifierFor(value) as ExistingResourceIdentifierObject;\n}\n\nexport interface BaseFinderOptions {\n reload?: boolean;\n backgroundReload?: boolean;\n include?: string | string[];\n adapterOptions?: Record<string, unknown>;\n}\nexport interface FindRecordOptions extends BaseFinderOptions {\n /**\n * Data to preload into the store before the request is made.\n * This feature is *highly* discouraged and has no corresponding\n * feature when using builders and handlers.\n *\n * Excepting relationships: the data should be in the form of a\n * JSON object where the keys are fields on the record and the value\n * is the raw value to be added to the cache.\n *\n * Relationships can either be provided as string IDs from which\n * an identifier will be built base upon the relationship's expected\n * resource type, or be record instances from which the identifier\n * will be extracted.\n *\n */\n preload?: Record<string, Value>;\n}\n\nexport type QueryOptions = {\n [K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;\n};\n\nexport type FindAllOptions = BaseFinderOptions;\nexport type LegacyResourceQuery = {\n include?: string | string[];\n [key: string]: Value | undefined;\n};\n\nexport type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;\n\n/**\n * Minimum subset of static schema methods and properties on the\n * \"model\" class.\n *\n * Only used when using the legacy schema-service implementation\n * for @ember-data/model or when wrapping schema for legacy\n * Adapters/Serializers.\n *\n */\nexport interface ModelSchema<T = unknown> {\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;\n attributes: Map<KeyOrString<T>, LegacyAttributeField>;\n relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;\n eachAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void;\n eachRelationship<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void;\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (this: ModelSchema<T>, key: K, type: string | null) => void,\n binding?: T\n ): void;\n}\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nexport function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n A `RecordReference` is a low-level API that allows users and\n addon authors to perform meta-operations on a record.\n\n @hideconstructor\n @public\n*/\nexport class RecordReference {\n /** @internal */\n declare private store: Store;\n // unsubscribe token given to us by the notification manager\n /** @internal */\n private ___token!: object;\n /** @internal */\n private ___identifier: ResourceKey;\n /** @internal */\n declare private _ref: number;\n\n constructor(store: Store, identifier: ResourceKey) {\n this.store = store;\n this.___identifier = identifier;\n this.___token = store.notifications.subscribe(\n identifier,\n (_: ResourceKey, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n\n /** @internal */\n destroy(): void {\n this.store.notifications.unsubscribe(this.___token);\n }\n\n get type(): string {\n return this.identifier().type;\n }\n\n /**\n The `id` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.id(); // '1'\n ```\n\n @public\n @return The id of the record.\n */\n id(): string | null {\n // oxlint-disable-next-line no-unused-expressions\n this._ref; // consume the tracked prop\n return this.___identifier.id;\n }\n\n /**\n The `identifier` of the record that this reference refers to.\n\n Together, the `type` and `id` properties form a composite key for\n the identity map.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.identifier(); // '1'\n ```\n\n @public\n @return The identifier of the record.\n */\n identifier(): ResourceKey {\n return this.___identifier;\n }\n\n /**\n How the reference will be looked up when it is loaded. Currently\n this always returns `identity` to signify that a record will be\n loaded by its `type` and `id`.\n\n Example\n\n ```javascript\n const userRef = store.getReference('user', 1);\n\n userRef.remoteType(); // 'identity'\n ```\n\n @public\n */\n remoteType(): 'identity' {\n return 'identity';\n }\n\n /**\n This API allows you to provide a reference with new data. The\n simplest usage of this API is similar to `store.push`: you provide a\n normalized hash of data and the object represented by the reference\n will update.\n\n If you pass a promise to `push`, WarpDrive will not ask the adapter\n for the data if another attempt to fetch it is made in the\n interim. When the promise resolves, the underlying object is updated\n with the new data, and the promise returned by *this function* is resolved\n with that object.\n\n For example, `recordReference.push(promise)` will be resolved with a\n record.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```\n\n @public\n @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one\n @return a promise for the value (record or relationship)\n */\n push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance> {\n // TODO @deprecate pushing unresolved payloads\n return Promise.resolve(objectOrPromise).then((data) => {\n return this.store.push(data);\n });\n }\n\n /**\n If the entity referred to by the reference is already loaded, it is\n present as `reference.value`. Otherwise the value returned by this function\n is `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```\n\n @public\n @return the record for this RecordReference\n */\n value(): OpaqueRecordInstance | null {\n return this.store.peekRecord(this.___identifier);\n }\n\n /**\n Triggers a fetch for the backing entity based on its `remoteType`\n (see `remoteType` definitions per reference type).\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // load user (via store.find)\n userRef.load().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n load(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id);\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n\n /**\n Reloads the record if it is already loaded. If the record is not\n loaded it will load the record via `store.findRecord`\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // or trigger a reload\n userRef.reload().then(...)\n ```\n\n @public\n @return the record for this RecordReference\n */\n reload(): Promise<unknown> {\n const id = this.id();\n if (id !== null) {\n return this.store.findRecord(this.type, id, { reload: true });\n }\n assert(`Unable to fetch record of type ${this.type} without an id`);\n }\n}\n\ndefineSignal(RecordReference.prototype, '_ref');\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = getOrSetGlobal('AvailableShims', new WeakMap<Store, Record<string, ShimModelClass>>());\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\n// Mimics the static apis of @ember-data/model\nexport class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n if (schema.kind === 'attribute' || schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(\n callback: (key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (key: K, type: string | null) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n","/**\n * @module\n * @summary Legacy `restoreDeprecatedStoreBehaviors`, which restores the adapter-based `findRecord`, `findAll`, `query`,\n * `saveRecord` and related methods onto a `Store` class.\n */\n\nimport type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyLiveArray, LegacyQueryArray, PrivateStore } from '@warp-drive/core/store/-private';\nimport {\n assertPrivateStore,\n constructResource,\n ensureStringId,\n recordIdentifierFor,\n storeFor,\n} from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { isMaybeIdentifier } from './compat/builders/utils.ts';\nimport { normalizeModelName } from './model/-private/util.ts';\nimport type {\n FindAllOptions,\n FindRecordOptions,\n LegacyResourceQuery,\n ModelSchema,\n QueryOptions,\n} from './store/-private.ts';\nimport { getShimClass, preloadData, RecordReference, resourceIsFullyDeleted } from './store/-private.ts';\n\n/**\n * Restores the deprecated `findRecord`/`findAll`/`query`/`queryRecord`/\n * `findBelongsTo`/`findHasMany`/`createRecord`/`deleteRecord`/`saveRecord`\n * legacy-network-layer implementations of these methods onto the given\n * `Store` subclass, for apps that have not yet migrated to the\n * `RequestManager`-based equivalents.\n *\n * @summary Legacy opt-in that restores the adapter-based `findRecord`, `findAll`, `query`, `saveRecord`, and related\n * methods onto a `Store` class.\n */\nexport function restoreDeprecatedStoreBehaviors(StoreKlass: typeof Store): void {\n StoreKlass.prototype.findRecord = function (\n resource: string | ResourceIdentifierObject,\n id?: string | number | FindRecordOptions,\n options?: FindRecordOptions\n ): Promise<unknown> {\n assert(\n `Attempted to call store.findRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = id as FindRecordOptions;\n } else {\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(id as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);\n options = options || {};\n assertPrivateStore(this);\n\n if (options.preload) {\n // force reload if we preload to ensure we don't resolve the promise\n // until we are complete, else we will end up background-reloading\n // even for initial load.\n if (!this._instanceCache.recordIsLoaded(identifier)) {\n options.reload = true;\n }\n this._join(() => {\n preloadData(this, identifier, options.preload!);\n });\n }\n\n const promise = this.request<OpaqueRecordInstance>({\n op: 'findRecord',\n data: {\n record: identifier,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => {\n return document.content;\n });\n };\n\n StoreKlass.prototype.findAll = function <T>(\n type: TypeFromInstance<T> | string,\n options: FindAllOptions = {}\n ): Promise<LegacyLiveArray<T>> {\n assert(\n `Attempted to call store.findAll(), 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 findAll method`, type);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyLiveArray<T>>({\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.query = function (\n type: string,\n query: LegacyResourceQuery,\n options: QueryOptions = {}\n ): Promise<LegacyQueryArray> {\n assert(\n `Attempted to call store.query(), 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 query method`, type);\n assert(`You need to pass a query hash to the store's query method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<LegacyQueryArray>({\n op: 'query',\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n StoreKlass.prototype.queryRecord = function (\n type: string,\n query: Record<string, unknown>,\n options?: QueryOptions\n ): Promise<OpaqueRecordInstance | null> {\n assert(\n `Attempted to call store.queryRecord(), 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 queryRecord method`, type);\n assert(`You need to pass a query hash to the store's queryRecord method`, query);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n const promise = this.request<OpaqueRecordInstance | null>({\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n });\n\n return promise.then((document) => document.content);\n };\n\n // do not put a ts-expect-error here, because typedoc will fail to\n // build due to this error only occurring when references are in use in the editor.\n // The return statement below casts to `PrivateStore['getReference']`'s return\n // type rather than annotating this function `: RecordReference` directly,\n // since this package's `RecordReference` and core's `deprecated/-private.ts`\n // copy are structurally identical but nominally distinct classes (TS treats\n // their private fields as separate brands); casting only the return value\n // (instead of the whole function) keeps `this` contextually typed from the\n // assignment target below.\n StoreKlass.prototype.getReference = function (resource: string | ResourceIdentifierObject, id: string | number) {\n assert(\n `Attempted to call store.getReference(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n let resourceIdentifier: ResourceIdentifierObject;\n if (arguments.length === 1 && isMaybeIdentifier(resource)) {\n resourceIdentifier = resource;\n } else {\n const type = normalizeModelName(resource as string);\n const normalizedId = ensureStringId(id);\n resourceIdentifier = constructResource(type, normalizedId);\n }\n\n assert(\n 'getReference expected to receive either a resource identifier or type and id as arguments',\n isMaybeIdentifier(resourceIdentifier)\n );\n\n const identifier: ResourceKey = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);\n assertPrivateStore(this);\n\n const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;\n let reference = cache.get(identifier);\n\n if (!reference) {\n reference = new RecordReference(this, identifier);\n cache.set(identifier, reference);\n }\n return reference;\n };\n\n StoreKlass.prototype.modelFor = function <T>(\n type: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n ): ModelSchema<T> {\n assert(`Attempted to call store.modelFor(), but the store instance has already been destroyed.`, !this.isDestroyed);\n assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n\n return getShimClass<T>(this, type);\n };\n\n StoreKlass.prototype.saveRecord = function <T>(record: T, options: Record<string, unknown> = {}): Promise<T> {\n assert(\n `Attempted to call store.saveRecord(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`Unable to initiate save for a record in a disconnected state`, storeFor(record, true));\n const identifier = recordIdentifierFor(record);\n const cache = this.cache;\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we reject here to prevent bad things.\n return Promise.reject(new Error(`Record Is Disconnected`));\n }\n assertPrivateStore(this);\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n this._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(this._instanceCache, identifier)) {\n return Promise.resolve(record);\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n const request = {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n\n return this.request<T>(request).then((document) => document.content);\n };\n}\n\nexport type { Store };\n\ntype Caches = PrivateStore['_instanceCache']['__instances'];\nfunction upgradeInstanceCaches(cache: Caches): Caches & { reference: WeakMap<ResourceKey, RecordReference> } {\n const withReferences = cache as Caches & { reference: WeakMap<ResourceKey, RecordReference> };\n if (!withReferences.reference) {\n withReferences.reference = new WeakMap();\n }\n\n return withReferences;\n}\n"],"mappings":";;;;;;;;AAwCA,SAAgBK,YAAYC,OAAcC,YAA4BC,SAAsC;CAC1G,MAAMC,cAA+C,CAAC;CAGtD,MAAMG,SADUN,MAAMK,OACCC,OAAOL,UAAU;CACxCM,OAAOC,KAAKN,OAAO,CAAC,CAACO,SAASC,QAAQ;EACpC,MAAMC,eAAeT,QAAQQ;EAE7B,MAAME,QAAQN,OAAOO,IAAIH,GAAG;EAC5B,IAAIE,UAAUA,MAAME,SAAS,aAAaF,MAAME,SAAS,cAAc;GACrE,IAAI,CAACX,YAAYY,eACfZ,YAAYY,gBAAgB,CAAC;GAE/BZ,YAAYY,cAAcL,OAAOM,oBAAoBJ,OAAOD,YAAY;EAC1E,OAAO;GACL,IAAI,CAACR,YAAYc,YACfd,YAAYc,aAAa,CAAC;GAE5Bd,YAAYc,WAAWP,OAAOC;EAChC;CACF,CAAC;CACD,MAAMO,QAAQlB,MAAMkB;CACpBvB,mBAAmBK,KAAK;CACxB,MAAMmB,YAAYC,QAAQpB,MAAMqB,eAAeC,KAAKrB,UAAU,CAAC;CAC/DiB,MAAMK,OAAOtB,YAAYE,aAAagB,SAAS;AACjD;AAEA,SAASH,oBACPX,QACAM,cAC6D;CAC7D,MAAMa,cAAcnB,OAAOoB;CAE3B,IAAIpB,OAAOS,SAAS,WAAW;EAC7B,EAAAY,SAAA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AAGjC,YAAY,KAAK;EACpC;EAEA,OAAO,KAAK6B,QAAWA,OAAO,CAAC,CAACK,MAAMC,aAAaA,SAASC,OAAO;CACrE;AACF;AAKA,SAASS,sBAAsBD,OAA8E;CAC3G,MAAMkB,iBAAiBlB;CACvB,IAAI,CAACkB,eAAef,WAClBe,eAAef,4BAAY,IAAIgB,QAAQ;CAGzC,OAAOD;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"-private-DG7eJX0Y.js","names":["Context","upgradeStore","SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","_fetchManager","LiveArrayContext","source","map","identifier","createSnapshot","assertIdentifierHasId","identifier","validateDocumentStructure","doc","normalizeResponseHelper","serializer","store","modelClass","payload","id","requestType","normalizedResponse","normalizeResponse","assertPrivateStore","upgradeStore","Snapshot","constructor","options","identifier","store","_store","__attributes","_belongsToRelationships","Object","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","modelName","type","_attributes","id","adapterOptions","include","cache","_changedAttributes","changedAttrs","record","peekRecord","attributes","eachAttribute","key","meta","getAttr","isNew","attr","keyName","changedAttributes","changedAttributeKeys","keys","i","length","slice","belongsTo","returnModeIsId","result","relationshipMeta","schema","fields","get","value","getRelationship","data","inverseIdentifier","cacheKeyManager","getOrCreateRecordIdentifier","undefined","isDeleted","_fetchManager","createSnapshot","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","forEach","member","push","callback","binding","modelFor","modelSchema","field","kind","call","eachRelationship","serialize","serializer","serializerFor","createDeferred","waitFor","assertPrivateStore","coerceId","getOrSetGlobal","upgradeStore","assertIdentifierHasId","payloadIsNotBlank","normalizeResponseHelper","Snapshot","SaveOp","Symbol","FetchManager","constructor","store","_store","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","createSnapshot","identifier","options","scheduleSave","resolver","query","op","recordIdentifier","queryRequest","data","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","modelName","type","pendingFetchItem","resolverPromise","isInitialLoad","_instanceCache","recordIsLoaded","then","payload","Array","isArray","lid","potentiallyNewIm","_push","reload","error","cache","isEmpty","isReleasable","_graph","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","get","set","requestsForIdentifier","push","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","forEach","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","destroy","instanceCache","isNew","isDeleted","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","length","arrCurrent","toSorted","split","sort","arrExisting","join","i","includes","optionsSatisfies","Object","keys","existingOptions","adapterOptions","include","_findMany","adapter","snapshots","modelClass","modelFor","ids","map","s","id","ret","findMany","adapterPayload","serializer","serializerFor","rejectFetchedItems","fetchMap","l","pair","reject","Error","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","included","resources","resource","delete","rejected","snapshotArray","console","warn","values","_fetchRecord","_fetchManager","klass","findRecord","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"sources":["../../../src/compat/legacy-network-handler/snapshot-record-array.ts","../../../src/compat/legacy-network-handler/identifier-has-id.ts","../../../src/compat/legacy-network-handler/serializer-response.ts","../../../src/compat/legacy-network-handler/snapshot.ts","../../../src/compat/legacy-network-handler/fetch-manager.ts","../../../src/compat/-private.ts"],"sourcesContent":["import type { Store } from '@warp-drive/core';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport type { LegacyLiveArray, PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@warp-drive/core/types';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\n\nimport { upgradeStore } from '../-private.ts';\nimport type { Snapshot } from './snapshot.ts';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @hideconstructor\n @public\n*/\nexport class SnapshotRecordArray {\n /**\n * An array of snapshots\n *\n * @internal\n */\n declare private _snapshots: Snapshot[] | null;\n\n /** @internal */\n declare private _type: ModelSchema | null;\n\n /**\n * The ResourceType of the underlying records for the {@link Snapshot | Snapshots} in the array\n */\n declare modelName: string;\n\n /** @internal */\n declare private __store: Store;\n\n /**\n * A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n */\n declare adapterOptions?: Record<string, unknown>;\n /**\n * The relationships to include for this request.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n */\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @private\n @constructor\n @param {Store} store\n @param {String} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n this._snapshots = null;\n this.modelName = type;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @internal\n */\n get _recordArray(): LegacyLiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @public\n @return Array of snapshots\n */\n snapshots(): Snapshot[] {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n const LiveArrayContext = (this._recordArray as unknown as PrivateReactiveResourceArray)[Context];\n this._snapshots = LiveArrayContext.source.map((identifier: ResourceKey) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport type { PersistedResourceKey } from '@warp-drive/core/types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is PersistedResourceKey {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as PersistedResourceKey).id !== null\n );\n}\n","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 { ModelSchema } from '@warp-drive/core/types';\nimport type { JsonApiDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface.ts';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","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 { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions } from '@warp-drive/core/types';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n For serialization of records in modern paradigms, request data from\n the cache or off the record directly.\n\n @hideconstructor\n @public\n*/\nexport class Snapshot<R = unknown> {\n /** @internal */\n declare private __attributes: Record<keyof R & string, unknown> | null;\n /** @internal */\n declare private _belongsToRelationships: Record<string, Snapshot>;\n /** @internal */\n declare private _belongsToIds: Record<string, RecordId>;\n /** @internal */\n declare private _hasManyRelationships: Record<string, Snapshot[]>;\n /** @internal */\n declare private _hasManyIds: Record<string, RecordId[]>;\n /** @internal */\n declare private _changedAttributes: ChangedAttributesHash;\n /** @internal */\n declare private _store: Store;\n\n /**\n The unique ResourceKey associated with this Snapshot.\n\n @public\n */\n declare identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n\n /**\n The ResourceType of the underlying record for this Snapshot, as a string.\n\n @public\n */\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @public\n */\n declare id: string | null;\n\n /**\n If `include` was passed to the options for the request, the value\n would be available here.\n\n @public\n */\n declare include?: string | string[];\n\n /**\n The adapterOptions passed to the request which generated this Snapshot, if any\n\n @public\n */\n declare adapterOptions?: Record<string, unknown>;\n\n constructor(\n options: FindRecordOptions,\n identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n assertPrivateStore(store);\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // oxlint-disable-next-line no-unused-expressions\n this._attributes;\n }\n\n this.id = identifier.id;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n this.modelName = identifier.type;\n\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n ```js\n const someValue = snapshot.record.someProp;\n ```\n\n @property record\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n /** @internal */\n private get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const cache = this._store.cache;\n\n this.eachAttribute((key: string, meta: LegacyAttributeField) => {\n attributes[key] = cache.getAttr(identifier, key);\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @return The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n ::: warning ⚠️ WARNING\n Attributes are SHALLOW copied from the cache.\n Because they are NOT deep copied from the cache, mutating\n any object or array fields will cause unintended side-effects\n and bugs.\n :::\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @return All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @return All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```js\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return A snapshot or ID of a known relationship or null if the\n relationship is known but unset. undefined will be returned if the\n contents of the relationship are unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(`snapshot.belongsTo only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.kind === 'belongsTo'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.cacheKeyManager.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(`snapshot.hasMany only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.kind === 'hasMany'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.cacheKeyManager.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate attributes. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachAttribute(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate relationships. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachRelationship(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @return an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { createDeferred } from '@warp-drive/core/request';\nimport { waitFor } from '@warp-drive/core/signals/-leaked';\nimport type {\n FindRecordQuery,\n InstanceCache,\n PrivateRequestStateService,\n PrivateStore,\n Request,\n SaveRecordMutation,\n} from '@warp-drive/core/store/-private';\nimport { assertPrivateStore, coerceId } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { PersistedResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core/types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { assertIdentifierHasId } from './identifier-has-id.ts';\nimport { payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\nimport { Snapshot } from './snapshot.ts';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp: '___(unique) Symbol(SaveOp)' = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: PersistedResourceKey;\n queryRequest: Request;\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<PersistedResourceKey>;\n}\n\ninterface PendingSaveItem {\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: ResourceKey;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\n/**\n * @private\n */\nexport class FetchManager {\n /**\n * @internal\n */\n declare isDestroyed: boolean;\n /** @internal */\n declare private requestCache: PrivateRequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n /**\n * @internal\n */\n declare _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n\n /** @internal */\n declare private _store: PrivateStore;\n\n constructor(store: Store) {\n assertPrivateStore(store);\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: ResourceKey<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: ResourceKey, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: ResourceKey, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @private\n */\n scheduleSave(identifier: ResourceKey, options: FetchMutationOptions): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (store._graph) {\n const graph = store._graph;\n if (!cache) {\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n promise = waitFor(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions\n ): Promise<PersistedResourceKey> | undefined {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches(): void {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: PersistedResourceKey,\n options: FindRecordOptions | undefined = {},\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<PersistedResourceKey>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy(): void {\n this.isDestroyed = true;\n }\n}\n\n/**\n * This type exists for internal use only for\n * where intimate contracts still exist either for\n * the Test Suite or for Legacy code.\n *\n * @private\n */\nexport interface PrivateFetchManager extends FetchManager {\n _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: ResourceKey): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n // toSorted for the array branch: these arrays belong to the request options\n // the caller passed us, sorting them in place would reorder their state.\n const arrCurrent = Array.isArray(current) ? current.toSorted() : current.split(',').sort();\n const arrExisting = Array.isArray(existing) ? existing.toSorted() : existing.split(',').sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // oxlint-disable-next-line typescript/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n });\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<PersistedResourceKey, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type { Store } from '@warp-drive/core';\n\nimport type { CompatStore } from '../compat.ts';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of WarpDrive.\n *\n @module\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array.ts';\nexport { SaveOp } from './legacy-network-handler/fetch-manager.ts';\nexport { FetchManager } from './legacy-network-handler/fetch-manager.ts';\nexport { Snapshot } from './legacy-network-handler/snapshot.ts';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAaE,sBAAb,MAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE/BC,YAAYC,OAAcC,MAAcC,UAA0B,CAAC,GAAG;EACpE,KAAKC,UAAUH;EACf,KAAKI,aAAa;EAClB,KAAKC,YAAYJ;EACjB,KAAKK,iBAAiBJ,QAAQI;EAC9B,KAAKC,UAAUL,QAAQK;CACzB;;;;;CAOA,IAAIC,eAAgC;EAClC,OAAO,KAAKL,QAAQM,QAAQ,KAAKJ,SAAS;CAC5C;;;;;;;;;;;;;CAiBA,IAAIK,SAAiB;EACnB,OAAO,KAAKF,aAAaE;CAC3B;;;;;;;;;;;;;;;;;;;;;;;CA6BAC,YAAwB;EACtB,IAAI,KAAKP,eAAe,MACtB,OAAO,KAAKA;EAEdP,6BAAa,KAAKM,OAAO;EAEzB,MAAM,EAAES,kBAAkB,KAAKT;EAC/B,MAAMU,mBAAoB,KAAKL,aAAyDZ;EACxF,KAAKQ,aAAaS,iBAAiBC,OAAOC,KAAKC,eAC7CJ,cAAcK,eAAeD,UAAU,CACzC;EAEA,OAAO,KAAKZ;CACd;AACF;;;;AC9JA,SAAgBc,sBAAsBC,YAAiE,CAKvG;;;;AC6DA,SAAgBG,wBACdC,YACAC,OACAC,YACAC,SACAC,IACAC,aACiB;CAOjB,OAN2BL,aACvBA,WAAWO,kBAAkBN,OAAOC,YAAYC,SAASC,IAAIC,WAAW,IACxEF;AAKN;;;;;;;;;;;;;;;;;;ACrDA,IAAaO,WAAb,MAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DjCC,YACEC,SACAC,YACAC,OACA;EACA,KAAKC,SAASD;EAEd,KAAKE,eAAe;EACpB,KAAKC,0BAA0BC,OAAOC,OAAO,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EtI,UAAUN,UAAUH,YAAYC,YAAY8I;CACpDhK,6BAAaS,KAAK;CAClB,MAAMuG,UAAUvG,MAAMgJ,WAAWxI,WAAWoB,IAAI;CAChD,MAAM4H,YAAY/I,QAAQb;CAE1B,MAAM+B,YAAYV,SAASU;CAC3B,MAAM8E,aAAazG,MAAM0G,SAAS/E,SAAS;CAQ3C,IAAIN,UAAmC+B,QAAQC,QAAQ,CAAC,CAACnB,WAAWqE,QAAQiD,UAAU,CAACxJ,OAAOyG,YAAYxF,QAAQ,CAAC;CACnH,MAAMiG,aAA+ClH,MAAMmH,cAAcxF,SAAS;CAOlFN,UAAUA,QAAQa,MAAM+E,mBAAmB;EACzC,IAAIA,gBACF,OAAOvH,wBAAwBwH,YAAYlH,OAAOyG,YAAYQ,gBAAgBhG,SAAS6F,IAAI0C,SAAS;CAExG,CAAC;CAED7I,SAAS0C,QAAQhC,OAAO;AAC1B;;;;ACjoBA,SAAgB,aAAa,OAA4C,CAAC"}
|
|
1
|
+
{"version":3,"file":"-private-DG7eJX0Y.js","names":["Context","upgradeStore","SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","_fetchManager","LiveArrayContext","source","map","identifier","createSnapshot","assertIdentifierHasId","identifier","validateDocumentStructure","doc","normalizeResponseHelper","serializer","store","modelClass","payload","id","requestType","normalizedResponse","normalizeResponse","assertPrivateStore","upgradeStore","Snapshot","constructor","options","identifier","store","_store","__attributes","_belongsToRelationships","Object","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","modelName","type","_attributes","id","adapterOptions","include","cache","_changedAttributes","changedAttrs","record","peekRecord","attributes","eachAttribute","key","meta","getAttr","isNew","attr","keyName","changedAttributes","changedAttributeKeys","keys","i","length","slice","belongsTo","returnModeIsId","result","relationshipMeta","schema","fields","get","value","getRelationship","data","inverseIdentifier","cacheKeyManager","getOrCreateRecordIdentifier","undefined","isDeleted","_fetchManager","createSnapshot","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","forEach","member","push","callback","binding","modelFor","modelSchema","field","kind","call","eachRelationship","serialize","serializer","serializerFor","createDeferred","waitFor","assertPrivateStore","coerceId","getOrSetGlobal","upgradeStore","assertIdentifierHasId","payloadIsNotBlank","normalizeResponseHelper","Snapshot","SaveOp","Symbol","FetchManager","constructor","store","_store","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","createSnapshot","identifier","options","scheduleSave","resolver","query","op","recordIdentifier","queryRequest","data","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","modelName","type","pendingFetchItem","resolverPromise","isInitialLoad","_instanceCache","recordIsLoaded","then","payload","Array","isArray","lid","potentiallyNewIm","_push","reload","error","cache","isEmpty","isReleasable","_graph","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","get","set","requestsForIdentifier","push","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","forEach","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","destroy","instanceCache","isNew","isDeleted","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","length","arrCurrent","toSorted","split","sort","arrExisting","join","i","includes","optionsSatisfies","Object","keys","existingOptions","adapterOptions","include","_findMany","adapter","snapshots","modelClass","modelFor","ids","map","s","id","ret","findMany","adapterPayload","serializer","serializerFor","rejectFetchedItems","fetchMap","l","pair","reject","Error","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","included","resources","resource","delete","rejected","snapshotArray","console","warn","values","_fetchRecord","_fetchManager","klass","findRecord","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation","SnapshotRecordArray","SaveOp","FetchManager","Snapshot","upgradeStore","store"],"sources":["../../../src/compat/legacy-network-handler/snapshot-record-array.ts","../../../src/compat/legacy-network-handler/identifier-has-id.ts","../../../src/compat/legacy-network-handler/serializer-response.ts","../../../src/compat/legacy-network-handler/snapshot.ts","../../../src/compat/legacy-network-handler/fetch-manager.ts","../../../src/compat/-private.ts"],"sourcesContent":["import type { Store } from '@warp-drive/core';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport type { LegacyLiveArray, PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@warp-drive/core/types';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\n\nimport { upgradeStore } from '../-private.ts';\nimport type { Snapshot } from './snapshot.ts';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @hideconstructor\n @public\n*/\nexport class SnapshotRecordArray {\n /**\n * An array of snapshots\n *\n * @internal\n */\n declare private _snapshots: Snapshot[] | null;\n\n /** @internal */\n declare private _type: ModelSchema | null;\n\n /**\n * The ResourceType of the underlying records for the {@link Snapshot | Snapshots} in the array\n */\n declare modelName: string;\n\n /** @internal */\n declare private __store: Store;\n\n /**\n * A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n */\n declare adapterOptions?: Record<string, unknown>;\n /**\n * The relationships to include for this request.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n */\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @private\n @constructor\n @param {Store} store\n @param {String} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n this._snapshots = null;\n this.modelName = type;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @internal\n */\n get _recordArray(): LegacyLiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @public\n @return Array of snapshots\n */\n snapshots(): Snapshot[] {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n const LiveArrayContext = (this._recordArray as unknown as PrivateReactiveResourceArray)[Context];\n this._snapshots = LiveArrayContext.source.map((identifier: ResourceKey) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport type { PersistedResourceKey } from '@warp-drive/core/types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is PersistedResourceKey {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as PersistedResourceKey).id !== null\n );\n}\n","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 { ModelSchema } from '@warp-drive/core/types';\nimport type { JsonApiDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface.ts';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","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 { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions } from '@warp-drive/core/types';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n For serialization of records in modern paradigms, request data from\n the cache or off the record directly.\n\n @hideconstructor\n @public\n*/\nexport class Snapshot<R = unknown> {\n /** @internal */\n declare private __attributes: Record<keyof R & string, unknown> | null;\n /** @internal */\n declare private _belongsToRelationships: Record<string, Snapshot>;\n /** @internal */\n declare private _belongsToIds: Record<string, RecordId>;\n /** @internal */\n declare private _hasManyRelationships: Record<string, Snapshot[]>;\n /** @internal */\n declare private _hasManyIds: Record<string, RecordId[]>;\n /** @internal */\n declare private _changedAttributes: ChangedAttributesHash;\n /** @internal */\n declare private _store: Store;\n\n /**\n The unique ResourceKey associated with this Snapshot.\n\n @public\n */\n declare identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n\n /**\n The ResourceType of the underlying record for this Snapshot, as a string.\n\n @public\n */\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @public\n */\n declare id: string | null;\n\n /**\n If `include` was passed to the options for the request, the value\n would be available here.\n\n @public\n */\n declare include?: string | string[];\n\n /**\n The adapterOptions passed to the request which generated this Snapshot, if any\n\n @public\n */\n declare adapterOptions?: Record<string, unknown>;\n\n constructor(\n options: FindRecordOptions,\n identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n assertPrivateStore(store);\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // oxlint-disable-next-line no-unused-expressions\n this._attributes;\n }\n\n this.id = identifier.id;\n this.adapterOptions = options.adapterOptions;\n this.include = options.include;\n this.modelName = identifier.type;\n\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n ```js\n const someValue = snapshot.record.someProp;\n ```\n\n @property record\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n /** @internal */\n private get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const cache = this._store.cache;\n\n this.eachAttribute((key: string, meta: LegacyAttributeField) => {\n attributes[key] = cache.getAttr(identifier, key);\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @return The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n ::: warning ⚠️ WARNING\n Attributes are SHALLOW copied from the cache.\n Because they are NOT deep copied from the cache, mutating\n any object or array fields will cause unintended side-effects\n and bugs.\n :::\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @return All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```js\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @return All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```js\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return A snapshot or ID of a known relationship or null if the\n relationship is known but unset. undefined will be returned if the\n contents of the relationship are unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(`snapshot.belongsTo only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.kind === 'belongsTo'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.cacheKeyManager.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @public\n @return An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(`snapshot.hasMany only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.kind === 'hasMany'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.cacheKeyManager.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate attributes. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachAttribute(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @param callback the callback to execute\n @param binding the optional value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipField) => void, binding?: unknown): void {\n // if the store has a modelFor implementation, we use it to iterate relationships. This allows\n // a custom \"ModelSchema\" class for legacy serializers to adapt to new fields if desired.\n if (typeof this._store.modelFor === 'function') {\n const modelSchema = this._store.modelFor(this.identifier.type);\n modelSchema.eachRelationship(callback, binding);\n } else {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @return an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { createDeferred } from '@warp-drive/core/request';\nimport { waitFor } from '@warp-drive/core/signals/-leaked';\nimport type {\n FindRecordQuery,\n InstanceCache,\n PrivateRequestStateService,\n PrivateStore,\n Request,\n SaveRecordMutation,\n} from '@warp-drive/core/store/-private';\nimport { assertPrivateStore, coerceId } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { PersistedResourceKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core/types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { assertIdentifierHasId } from './identifier-has-id.ts';\nimport { payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\nimport { Snapshot } from './snapshot.ts';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp: '___(unique) Symbol(SaveOp)' = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: PersistedResourceKey;\n queryRequest: Request;\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<PersistedResourceKey>;\n}\n\ninterface PendingSaveItem {\n // oxlint-disable-next-line typescript/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: ResourceKey;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\n/**\n * @private\n */\nexport class FetchManager {\n /**\n * @internal\n */\n declare isDestroyed: boolean;\n /** @internal */\n declare private requestCache: PrivateRequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n /**\n * @internal\n */\n declare _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n\n /** @internal */\n declare private _store: PrivateStore;\n\n constructor(store: Store) {\n assertPrivateStore(store);\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: ResourceKey<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: ResourceKey, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: ResourceKey, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @private\n */\n scheduleSave(identifier: ResourceKey, options: FetchMutationOptions): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (store._graph) {\n const graph = store._graph;\n if (!cache) {\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n promise = waitFor(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(\n identifier: PersistedResourceKey,\n options: FindRecordOptions\n ): Promise<PersistedResourceKey> | undefined {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches(): void {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: PersistedResourceKey,\n options: FindRecordOptions | undefined = {},\n request: ImmutableRequestInfo\n ): Promise<PersistedResourceKey> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<PersistedResourceKey>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy(): void {\n this.isDestroyed = true;\n }\n}\n\n/**\n * This type exists for internal use only for\n * where intimate contracts still exist either for\n * the Test Suite or for Legacy code.\n *\n * @private\n */\nexport interface PrivateFetchManager extends FetchManager {\n _pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: ResourceKey): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n // toSorted for the array branch: these arrays belong to the request options\n // the caller passed us, sorting them in place would reorder their state.\n const arrCurrent = Array.isArray(current) ? current.toSorted() : current.split(',').sort();\n const arrExisting = Array.isArray(existing) ? existing.toSorted() : existing.split(',').sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // oxlint-disable-next-line typescript/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n });\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<PersistedResourceKey, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type { Store } from '@warp-drive/core';\n\nimport type { CompatStore } from '../compat.ts';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of WarpDrive.\n *\n * @summary Legacy internals of the adapter-based network layer, such as `Snapshot` and `FetchManager`, shared across\n * the legacy packages.\n @module\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array.ts';\nexport { SaveOp } from './legacy-network-handler/fetch-manager.ts';\nexport { FetchManager } from './legacy-network-handler/fetch-manager.ts';\nexport { Snapshot } from './legacy-network-handler/snapshot.ts';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,IAAaE,sBAAb,MAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE/BC,YAAYC,OAAcC,MAAcC,UAA0B,CAAC,GAAG;EACpE,KAAKC,UAAUH;EACf,KAAKI,aAAa;EAClB,KAAKC,YAAYJ;EACjB,KAAKK,iBAAiBJ,QAAQI;EAC9B,KAAKC,UAAUL,QAAQK;CACzB;;;;;CAOA,IAAIC,eAAgC;EAClC,OAAO,KAAKL,QAAQM,QAAQ,KAAKJ,SAAS;CAC5C;;;;;;;;;;;;;CAiBA,IAAIK,SAAiB;EACnB,OAAO,KAAKF,aAAaE;CAC3B;;;;;;;;;;;;;;;;;;;;;;;CA6BAC,YAAwB;EACtB,IAAI,KAAKP,eAAe,MACtB,OAAO,KAAKA;EAEdP,6BAAa,KAAKM,OAAO;EAEzB,MAAM,EAAES,kBAAkB,KAAKT;EAC/B,MAAMU,mBAAoB,KAAKL,aAAyDZ;EACxF,KAAKQ,aAAaS,iBAAiBC,OAAOC,KAAKC,eAC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