@warp-drive/legacy 5.10.0-alpha.12 → 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 +7 -0
- 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 +4 -2
- package/dist/adapter/json-api.d.ts.map +1 -1
- package/dist/adapter/json-api.js +7 -0
- 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 +23 -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 +7 -0
- 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 +23 -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 +7 -0
- 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 +23 -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 +7 -0
- 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 +23 -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 +7 -0
- 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 +23 -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 +9 -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":"adapter-D3A8ixjz.d.ts","names":[],"sources":["../src/adapter/-private/build-url-mixin.ts","../src/adapter.ts"],"mappings":";;;;;;;;;;;;;;;;UA4BiB;;;;;;;;;;;;;;;EAef,SAAA,MACQ,mBACN,mBACA,YACA,UAAU,UACV;;;;;;EAOF,SAAA,MACQ,mBACN,mBACA,UACA,UAAU,qBACV;;;;;;EAOF,SAAA,MACQ,mBACN,mBACA,UACA,gBACA,sBACA,OAAO;;;;;;EAOT,SAAA,MACQ,mBACN,mBACA,UACA,gBACA,4BACA,OAAO;;;;;;;;;EAUT,SAAA,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,qBAAqB"}
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as BuildURLMixin, t as Adapter } from "./adapter-
|
|
1
|
+
import { n as BuildURLMixin, t as Adapter } from "./adapter-D3A8ixjz.js";
|
|
2
2
|
export { Adapter, BuildURLMixin };
|
package/dist/adapter.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as FetchManager, f as SaveOp, m as Snapshot, p as SnapshotRecordArray, u as upgradeStore } from "../compat-
|
|
1
|
+
import { d as FetchManager, f as SaveOp, m as Snapshot, p as SnapshotRecordArray, u as upgradeStore } from "../compat-BZlQ-5eI.js";
|
|
2
2
|
export { FetchManager, SaveOp, Snapshot, SnapshotRecordArray, upgradeStore };
|
|
@@ -22,6 +22,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
22
22
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
23
23
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
24
24
|
|
|
25
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.findAll`, easing
|
|
26
|
+
migration off adapters and serializers.
|
|
25
27
|
@deprecated
|
|
26
28
|
@public
|
|
27
29
|
@param type the name of the resource
|
|
@@ -68,6 +70,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
68
70
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
69
71
|
To that end, these builders are deprecated and will be removed in a future version of Warp Drive.
|
|
70
72
|
|
|
73
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.findRecord`, taking a
|
|
74
|
+
type and id or a resource identifier.
|
|
71
75
|
@deprecated
|
|
72
76
|
@public
|
|
73
77
|
@param resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
@@ -100,6 +104,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
100
104
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
101
105
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
102
106
|
|
|
107
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.query`, returning the
|
|
108
|
+
records matching a query object.
|
|
103
109
|
@deprecated
|
|
104
110
|
@public
|
|
105
111
|
@param type the name of the resource
|
|
@@ -127,6 +133,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
127
133
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
128
134
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
129
135
|
|
|
136
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.queryRecord`, returning
|
|
137
|
+
a single record or `null` for a query object.
|
|
130
138
|
@deprecated
|
|
131
139
|
@public
|
|
132
140
|
@param type the name of the resource
|
|
@@ -157,6 +165,8 @@ All `@ember-data/legacy-compat` builders exist to enable you to migrate your cod
|
|
|
157
165
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
158
166
|
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
159
167
|
|
|
168
|
+
@summary Deprecated legacy builder for a `store.request` config that creates, updates, or deletes a record
|
|
169
|
+
through adapters, like the legacy `store.saveRecord`.
|
|
160
170
|
@deprecated
|
|
161
171
|
@public
|
|
162
172
|
@param {Object} record a record to save
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","names":[],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"mappings":";;;;;;KASK,oBAAoB,2BAA2B,kBAAkB;EACpE;EACA;IACE,MAAM;IACN,SAAS;;GAEV,oBAAoB;;KAGlB,wBAAwB
|
|
1
|
+
{"version":3,"file":"builders.d.ts","names":[],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"mappings":";;;;;;KASK,oBAAoB,2BAA2B,kBAAkB;EACpE;EACA;IACE,MAAM;IACN,SAAS;;GAEV,oBAAoB;;KAGlB,wBAAwB;;;;;;;;;;;;;;;;;;iBAmBb,eAAe,UAAU,qBACvC,MAAM,iBAAiB,IACvB,UAAU,wBACT,oBAAoB,iBAAiB,IAAI;iBAC5B,eAAe,cAAc,UAAU,wBAAwB;;;KC9B1E,uBAAuB,2BAA2B,gBAAgB;EACrE;EACA;IACE,QAAQ,yBAAyB;IACjC,SAAS;;GAEV,oBAAoB;;KAGlB,2BAA2B,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCrB,kBAAkB,UAAU,qBAC1C,MAAM,iBAAiB,IACvB,YACA,UAAU,2BACT,uBAAuB,iBAAiB,IAAI;iBAC/B,kBAAkB,cAAc,YAAY,UAAU,2BAA2B;iBACjF,kBAAkB,UAAU,qBAC1C,UAAU,yBAAyB,iBAAiB,KACpD,UAAU,2BACT,uBAAuB,iBAAiB,IAAI;iBAC/B,kBACd,UAAU,0BACV,UAAU,2BACT;;;KC9DE,kBAAkB,2BAA2B,kBAAkB;EAClE;EACA;IACE,MAAM;IACN,OAAO;IACP,SAAS;;GAEV,oBAAoB;;KAGlB,sBAAsB;;;;;;;;;;;;;;;;;;;iBAoBX,aAAa,UAAU,qBACrC,MAAM,iBAAiB,IACvB,OAAO,qBACP,UAAU,sBACT,kBAAkB,iBAAiB,IAAI;iBAC1B,aACd,cACA,OAAO,qBACP,UAAU,sBACT;KAwBE,wBAAwB,2BAA2B,gBAAgB;EACtE;EACA;IACE,MAAM;IACN,OAAO;IACP,SAAS;;GAEV,oBAAoB;;;;;;;;;;;;;;;;;;;;iBAqBP,mBAAmB,UAAU,qBAC3C,MAAM,iBAAiB,IACvB,OAAO,qBACP,UAAU,sBACT,wBAAwB,iBAAiB,IAAI;iBAChC,mBACd,cACA,OAAO,qBACP,UAAU,sBACT;;;KCpGE,uBAAuB,2BAA2B,gBAAgB;EACrE;EACA;IACE,QAAQ,YAAY;IACpB,SAAS;;EAEX,UAAU,YAAY;GACrB,oBAAoB;;KAGlB,2BAA2B;;;;;;;;;;;;;;;;;;iBA4BhB,kBAAkB,UAAU,qBAC1C,QAAQ,GACR,UAAS,0BACR,uBAAuB,iBAAiB,IAAI"}
|
package/dist/compat/builders.js
CHANGED
|
@@ -14,6 +14,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
14
14
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
15
15
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
16
16
|
|
|
17
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.findAll`, easing
|
|
18
|
+
migration off adapters and serializers.
|
|
17
19
|
@deprecated
|
|
18
20
|
@public
|
|
19
21
|
@param type the name of the resource
|
|
@@ -66,6 +68,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
66
68
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
67
69
|
To that end, these builders are deprecated and will be removed in a future version of Warp Drive.
|
|
68
70
|
|
|
71
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.findRecord`, taking a
|
|
72
|
+
type and id or a resource identifier.
|
|
69
73
|
@deprecated
|
|
70
74
|
@public
|
|
71
75
|
@param resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
@@ -111,6 +115,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
111
115
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
112
116
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
113
117
|
|
|
118
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.query`, returning the
|
|
119
|
+
records matching a query object.
|
|
114
120
|
@deprecated
|
|
115
121
|
@public
|
|
116
122
|
@param type the name of the resource
|
|
@@ -147,6 +153,8 @@ All `@warp-drive/legacy/compat` builders exist to enable you to migrate your cod
|
|
|
147
153
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
148
154
|
To that end, these builders are deprecated and will be removed in a future version of WarpDrive.
|
|
149
155
|
|
|
156
|
+
@summary Deprecated legacy builder for a `store.request` config that behaves like `store.queryRecord`, returning
|
|
157
|
+
a single record or `null` for a query object.
|
|
150
158
|
@deprecated
|
|
151
159
|
@public
|
|
152
160
|
@param type the name of the resource
|
|
@@ -193,6 +201,8 @@ All `@ember-data/legacy-compat` builders exist to enable you to migrate your cod
|
|
|
193
201
|
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
194
202
|
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
195
203
|
|
|
204
|
+
@summary Deprecated legacy builder for a `store.request` config that creates, updates, or deletes a record
|
|
205
|
+
through adapters, like the legacy `store.saveRecord`.
|
|
196
206
|
@deprecated
|
|
197
207
|
@public
|
|
198
208
|
@param {Object} record a record to save
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","names":["SkipCache","normalizeModelName","macroCondition","getGlobalConfig","findAllBuilder","type","options","WarpDrive","env","DEBUG","test","Error","op","data","cacheOptions","constructResource","ensureStringId","SkipCache","isMaybeIdentifier","normalizeModelName","macroCondition","getGlobalConfig","findRecordBuilder","resource","idOrOptions","options","WarpDrive","env","DEBUG","test","Error","type","normalizedId","preload","op","data","record","cacheOptions","SkipCache","normalizeModelName","macroCondition","getGlobalConfig","queryBuilder","type","query","options","WarpDrive","env","DEBUG","test","Error","op","data","cacheOptions","queryRecordBuilder","recordIdentifierFor","storeFor","assertPrivateStore","SkipCache","macroCondition","getGlobalConfig","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","record","options","store","WarpDrive","env","DEBUG","test","Error","lid","_instanceCache","recordIsLoaded","operation","op","data","records","cacheOptions"],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"sourcesContent":["import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { FindAllOptions } from '@warp-drive/core/types';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { normalizeModelName } from './utils.ts';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions = FindAllOptions;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @deprecated\n @public\n @param type the name of the resource\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { constructResource, ensureStringId } from '@warp-drive/core/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@warp-drive/core/types';\nimport type { 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';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils.ts';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@warp-drive/legacy/compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@warp-drive/legacy/compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Warp Drive.\n\n @deprecated\n @public\n @param resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param options - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyResourceQuery, QueryOptions } from '@warp-drive/core/types';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { normalizeModelName } from './utils.ts';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @deprecated\n @public\n @param type the name of the resource\n @param query a query to be used by the adapter\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @deprecated\n @public\n @param type the name of the resource\n @param query a query to be used by the adapter\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import { recordIdentifierFor, storeFor, type StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore, type InstanceCache } from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: ResourceKey<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [ResourceKey<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @deprecated\n @public\n @param {Object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record, true);\n assertPrivateStore(store);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgBI,eAAeC,MAAcC,UAAiC,CAAC,GAAwB;CACrGJ,eAAAC,gBAAA,CAAA,CAAAI,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,sDAAsD;CAAA,EAAA,CAAEN,IAAI;CACnEH,eAAAC,gBAAA,CAAA,CAAAI,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,mFAAmFN,MAAM;CAAA,EAAA,CACzF,OAAOA,SAAS,QAAQ;CAG1B,OAAO;EACLO,IAAI;EACJC,MAAM;GACJR,MAAMJ,mBAAmBI,IAAI;GAC7BC,SAASA,WAAW,CAAC;EACvB;EACAQ,cAAc,GAAGd,YAAY,KAAK;CACpC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACeA,SAAgBsB,kBACdC,UACAC,aACAC,SACwB;CACxBL,eAAAC,gBAAA,CAAA,CAAAK,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,qGAAqG;CAAA,EAAA,CACrGP,QAAQ;CAEV,IAAIL,kBAAkBK,QAAQ,GA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A,EAAA,CAAEL,KAAK;CAC5E,MAAMV,aAAaP,oBAAuBe,MAAM;CAEhD,IAAI,CAACR,YAGH,MAAM,IAAIe,MAAM,wBAAwB;CAE1ClB,eAAAC,gBAAA,CAAA,CAAAa,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,0DAA0Df,WAAWgB,KAAK;CAAA,EAAA,CAC1EN,MAAMO,eAAeC,eAAelB,UAAU,CAAC;CAGjD,IAAIK,uBAAuBK,MAAMO,gBAAgBjB,UAAU,GACzD,MAAM,IAAIe,MAAM,oDAAoD;CAGtE,IAAI,CAACN,SACHA,UAAU,CAAC;CAEb,IAAIU,YAA8D;CAElE,MAAMlB,QAAQS,MAAMT;CACpB,IAAIA,MAAME,MAAMH,UAAU,GACxBmB,YAAY;MACP,IAAIlB,MAAMG,UAAUJ,UAAU,GACnCmB,YAAY;CAGd,OAAO;EACLC,IAAID;EACJE,MAAM;GACJZ;GACAD,QAAQR;EACV;EACAsB,SAAS,CAACtB,UAAU;EACpBuB,cAAc,GAAG3B,YAAY,KAAK;CACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"builders.js","names":["SkipCache","normalizeModelName","macroCondition","getGlobalConfig","findAllBuilder","type","options","WarpDrive","env","DEBUG","test","Error","op","data","cacheOptions","constructResource","ensureStringId","SkipCache","isMaybeIdentifier","normalizeModelName","macroCondition","getGlobalConfig","findRecordBuilder","resource","idOrOptions","options","WarpDrive","env","DEBUG","test","Error","type","normalizedId","preload","op","data","record","cacheOptions","SkipCache","normalizeModelName","macroCondition","getGlobalConfig","queryBuilder","type","query","options","WarpDrive","env","DEBUG","test","Error","op","data","cacheOptions","queryRecordBuilder","recordIdentifierFor","storeFor","assertPrivateStore","SkipCache","macroCondition","getGlobalConfig","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","record","options","store","WarpDrive","env","DEBUG","test","Error","lid","_instanceCache","recordIsLoaded","operation","op","data","records","cacheOptions"],"sources":["../../src/compat/builders/find-all.ts","../../src/compat/builders/find-record.ts","../../src/compat/builders/query.ts","../../src/compat/builders/save-record.ts"],"sourcesContent":["import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { FindAllOptions } from '@warp-drive/core/types';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { normalizeModelName } from './utils.ts';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions = FindAllOptions;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @summary Deprecated legacy builder for a `store.request` config that behaves like `store.findAll`, easing\n migration off adapters and serializers.\n @deprecated\n @public\n @param type the name of the resource\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { constructResource, ensureStringId } from '@warp-drive/core/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@warp-drive/core/types';\nimport type { 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';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils.ts';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@warp-drive/legacy/compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@warp-drive/legacy/compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Warp Drive.\n\n @summary Deprecated legacy builder for a `store.request` config that behaves like `store.findRecord`, taking a\n type and id or a resource identifier.\n @deprecated\n @public\n @param resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param options - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import type { StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { LegacyResourceQuery, QueryOptions } from '@warp-drive/core/types';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\nimport { normalizeModelName } from './utils.ts';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @summary Deprecated legacy builder for a `store.request` config that behaves like `store.query`, returning the\n records matching a query object.\n @deprecated\n @public\n @param type the name of the resource\n @param query a query to be used by the adapter\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@warp-drive/legacy/compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of WarpDrive.\n\n @summary Deprecated legacy builder for a `store.request` config that behaves like `store.queryRecord`, returning\n a single record or `null` for a query object.\n @deprecated\n @public\n @param type the name of the resource\n @param query a query to be used by the adapter\n @param options optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","import { recordIdentifierFor, storeFor, type StoreRequestInput } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore, type InstanceCache } from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport { SkipCache } from '@warp-drive/core/types/request';\nimport type { RequestSignature } from '@warp-drive/core/types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: ResourceKey<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [ResourceKey<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: ResourceKey, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @summary Deprecated legacy builder for a `store.request` config that creates, updates, or deletes a record\n through adapters, like the legacy `store.saveRecord`.\n @deprecated\n @public\n @param {Object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record, true);\n assertPrivateStore(store);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgBI,eAAeC,MAAcC,UAAiC,CAAC,GAAwB;CACrGJ,eAAAC,gBAAA,CAAA,CAAAI,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,sDAAsD;CAAA,EAAA,CAAEN,IAAI;CACnEH,eAAAC,gBAAA,CAAA,CAAAI,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,mFAAmFN,MAAM;CAAA,EAAA,CACzF,OAAOA,SAAS,QAAQ;CAG1B,OAAO;EACLO,IAAI;EACJC,MAAM;GACJR,MAAMJ,mBAAmBI,IAAI;GAC7BC,SAASA,WAAW,CAAC;EACvB;EACAQ,cAAc,GAAGd,YAAY,KAAK;CACpC;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACeA,SAAgBsB,kBACdC,UACAC,aACAC,SACwB;CACxBL,eAAAC,gBAAA,CAAA,CAAAK,UAAAC,IAAAC,KAAA,OAAAC,SA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Bb,eAAAC,gBAAA,CAAA,CAAAa,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,8DAA8D;CAAA,EAAA,CAAEL,KAAK;CAC5E,MAAMV,aAAaP,oBAAuBe,MAAM;CAEhD,IAAI,CAACR,YAGH,MAAM,IAAIe,MAAM,wBAAwB;CAE1ClB,eAAAC,gBAAA,CAAA,CAAAa,UAAAC,IAAAC,KAAA,OAAAC,SAAA;EAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,0DAA0Df,WAAWgB,KAAK;CAAA,EAAA,CAC1EN,MAAMO,eAAeC,eAAelB,UAAU,CAAC;CAGjD,IAAIK,uBAAuBK,MAAMO,gBAAgBjB,UAAU,GACzD,MAAM,IAAIe,MAAM,oDAAoD;CAGtE,IAAI,CAACN,SACHA,UAAU,CAAC;CAEb,IAAIU,YAA8D;CAElE,MAAMlB,QAAQS,MAAMT;CACpB,IAAIA,MAAME,MAAMH,UAAU,GACxBmB,YAAY;MACP,IAAIlB,MAAMG,UAAUJ,UAAU,GACnCmB,YAAY;CAGd,OAAO;EACLC,IAAID;EACJE,MAAM;GACJZ;GACAD,QAAQR;EACV;EACAsB,SAAS,CAACtB,UAAU;EACpBuB,cAAc,GAAG3B,YAAY,KAAK;CACpC;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as WithArrayLike, i as EmberObjectExtension, n as EmberArrayLikeExtension, o as WithEmberObject, r as EmberObjectArrayExtension, t as ArrayType } from "../extensions-
|
|
1
|
+
import { a as WithArrayLike, i as EmberObjectExtension, n as EmberArrayLikeExtension, o as WithEmberObject, r as EmberObjectArrayExtension, t as ArrayType } from "../extensions-fwdnX9n4.js";
|
|
2
2
|
export { ArrayType, EmberArrayLikeExtension, EmberObjectArrayExtension, EmberObjectExtension, WithArrayLike, WithEmberObject };
|
|
@@ -4,6 +4,11 @@ import { addObserver, removeObserver } from "@ember/object/observers";
|
|
|
4
4
|
import { compare } from "@ember/utils";
|
|
5
5
|
|
|
6
6
|
//#region src/compat/extensions.ts
|
|
7
|
+
/**
|
|
8
|
+
* @module
|
|
9
|
+
* @summary Legacy schema extensions that give reactive objects and arrays the classic `EmberObject` and Ember array
|
|
10
|
+
* APIs, such as `get`, `set` and `mapBy`, plus matching types.
|
|
11
|
+
*/
|
|
7
12
|
const EmberObjectFeatures = {};
|
|
8
13
|
[
|
|
9
14
|
"addObserver",
|
|
@@ -56,6 +61,9 @@ const EmberObjectFeatures = {};
|
|
|
56
61
|
* `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,
|
|
57
62
|
* `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)
|
|
58
63
|
* to reactive array resources.
|
|
64
|
+
*
|
|
65
|
+
* @summary Legacy schema extension that gives reactive arrays the classic `EmberObject` API such as `get`, `set`,
|
|
66
|
+
* and observers, to ease migration from Ember objects.
|
|
59
67
|
*/
|
|
60
68
|
const EmberObjectArrayExtension = {
|
|
61
69
|
kind: "array",
|
|
@@ -67,6 +75,9 @@ const EmberObjectArrayExtension = {
|
|
|
67
75
|
* `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,
|
|
68
76
|
* `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)
|
|
69
77
|
* to reactive object resources.
|
|
78
|
+
*
|
|
79
|
+
* @summary Legacy schema extension that gives reactive objects the classic `EmberObject` API such as `get`, `set`,
|
|
80
|
+
* and observers, to ease migration from Ember objects.
|
|
70
81
|
*/
|
|
71
82
|
const EmberObjectExtension = {
|
|
72
83
|
kind: "object",
|
|
@@ -259,6 +270,9 @@ const EmberArrayLikeFeatures = {
|
|
|
259
270
|
* A schema extension that adds Ember's classic `MutableArray`/`Enumerable`
|
|
260
271
|
* style methods (`pushObject`, `removeObject`, `mapBy`, `filterBy`,
|
|
261
272
|
* `sortBy`, `firstObject`, `lastObject`, etc.) to reactive array resources.
|
|
273
|
+
*
|
|
274
|
+
* @summary Legacy schema extension that gives reactive arrays Ember array methods such as `pushObject`, `mapBy`,
|
|
275
|
+
* `filterBy`, and `firstObject`.
|
|
262
276
|
*/
|
|
263
277
|
const EmberArrayLikeExtension = {
|
|
264
278
|
kind: "array",
|
|
@@ -267,14 +281,22 @@ const EmberArrayLikeExtension = {
|
|
|
267
281
|
};
|
|
268
282
|
/**
|
|
269
283
|
* Extracts the element type of an array type, or `never` if `T` is not an array.
|
|
284
|
+
*
|
|
285
|
+
* @summary Type utility resolving to the element type of an array type, or `never` for non-arrays.
|
|
270
286
|
*/
|
|
271
287
|
/**
|
|
272
288
|
* Adds the classic `EmberObject` API (as registered by {@link EmberObjectExtension}/
|
|
273
289
|
* {@link EmberObjectArrayExtension}) to the type of a reactive resource.
|
|
290
|
+
*
|
|
291
|
+
* @summary Legacy type that adds the classic `EmberObject` methods to a reactive resource type using
|
|
292
|
+
* `EmberObjectExtension` or `EmberObjectArrayExtension`.
|
|
274
293
|
*/
|
|
275
294
|
/**
|
|
276
295
|
* Adds Ember's classic array-like API (as registered by {@link EmberArrayLikeExtension})
|
|
277
296
|
* to the type of a reactive array resource.
|
|
297
|
+
*
|
|
298
|
+
* @summary Legacy type that adds Ember array methods such as `mapBy` and `firstObject` to a reactive array type
|
|
299
|
+
* using `EmberArrayLikeExtension`.
|
|
278
300
|
*/
|
|
279
301
|
//#endregion
|
|
280
302
|
export { EmberArrayLikeExtension, EmberObjectArrayExtension, EmberObjectExtension };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.js","names":["get","getProperties","notifyPropertyChange","set","setProperties","addObserver","removeObserver","compare","macroCondition","getGlobalConfig","EmberObjectFeatures","EmberObjectMethods","forEach","method","delegatedMethod","args","Error","keyName","decrement","WarpDrive","env","DEBUG","test","isNaN","parseFloat","isFinite","increment","String","key","EmberObjectArrayExtension","kind","name","features","EmberObjectExtension","EmberArrayLikeFeatures","addObject","obj","index","indexOf","push","addObjects","objs","popObject","pop","pushObject","pushObjects","shiftObject","shift","unshiftObject","unshift","unshiftObjects","objectAt","arrIndex","Math","sign","length","objectsAt","indices","map","removeAt","splice","insertAt","removeObject","removeObjects","toArray","slice","replace","idx","amt","objects","clear","setObjects","Array","isArray","reverseObjects","reverse","compact","filter","v","undefined","any","callback","target","some","isAny","prop","value","hasValue","arguments","isEvery","every","getEach","mapBy","findBy","find","val","Boolean","filterBy","record","sortBy","sortKeys","sort","a","b","i","propA","propB","compareValue","invoke","addArrayObserver","removeArrayObserver","arrayContentWillChange","arrayContentDidChange","reject","apply","rejectBy","setEach","item","uniq","from","Set","uniqBy","seen","result","has","add","without","newArr","firstObject","at","lastObject","EmberArrayLikeExtension"],"sources":["../../src/compat/extensions.ts"],"sourcesContent":["import {\n type default as EmberObject,\n get,\n getProperties,\n notifyPropertyChange,\n set,\n setProperties,\n} from '@ember/object';\nimport { addObserver, removeObserver } from '@ember/object/observers';\nimport { compare } from '@ember/utils';\n\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension } from '@warp-drive/core/reactive';\n\nconst EmberObjectFeatures = {};\nconst EmberObjectMethods = [\n 'addObserver',\n 'cacheFor',\n 'decrementProperty',\n 'get',\n 'getProperties',\n 'incrementProperty',\n 'notifyPropertyChange',\n 'removeObserver',\n 'set',\n 'setProperties',\n 'toggleProperty',\n] as const;\nEmberObjectMethods.forEach((method) => {\n EmberObjectFeatures[method] = function delegatedMethod(...args: unknown[]): unknown {\n switch (method) {\n case 'addObserver':\n return (addObserver as (...args: unknown[]) => unknown)(this, ...args);\n case 'cacheFor':\n throw new Error('cacheFor has been removed and will not be replaced');\n case 'decrementProperty': {\n const keyName = args[0] as string;\n const decrement = (args[1] as number) ?? 1;\n assert(\n 'Must pass a numeric value to decrementProperty',\n (typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)\n );\n return set(this, keyName, ((get(this, keyName) as number) || 0) - decrement);\n }\n case 'get':\n // the cast is required: without it, TS resolves `get` to an overload whose\n // parameter list isn't a rest/tuple, and the spread below fails to typecheck\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion\n return (get as (...args: unknown[]) => unknown)(this, ...args);\n case 'getProperties':\n return (getProperties as (...args: unknown[]) => unknown)(this, ...args);\n case 'incrementProperty': {\n const keyName = args[0] as string;\n const increment = (args[1] as number) ?? 1;\n assert(\n 'Must pass a numeric value to incrementProperty',\n !isNaN(parseFloat(String(increment))) && isFinite(increment)\n );\n return set(this, keyName, (parseFloat(get(this, keyName) as string) || 0) + increment);\n }\n case 'notifyPropertyChange':\n return (notifyPropertyChange as (...args: unknown[]) => unknown)(this, ...args);\n case 'removeObserver':\n return (removeObserver as (...args: unknown[]) => unknown)(this, ...args);\n case 'set':\n return (set as (...args: unknown[]) => unknown)(this, ...args);\n case 'setProperties':\n return (setProperties as (...args: unknown[]) => unknown)(this, ...args);\n case 'toggleProperty': {\n const key = args[0] as string;\n return set(this, key, !get(this, key));\n }\n }\n };\n});\n/**\n * A schema extension that adds the classic `EmberObject` API (`get`, `set`,\n * `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,\n * `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)\n * to reactive array resources.\n */\nexport const EmberObjectArrayExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'array',\n name: 'ember-object' as const,\n features: EmberObjectFeatures,\n};\n/**\n * A schema extension that adds the classic `EmberObject` API (`get`, `set`,\n * `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,\n * `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)\n * to reactive object resources.\n */\nexport const EmberObjectExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'object',\n name: 'ember-object' as const,\n features: EmberObjectFeatures,\n};\n\nconst EmberArrayLikeFeatures = {\n addObject<T>(this: T[], obj: T): T[] {\n const index = this.indexOf(obj);\n if (index === -1) {\n this.push(obj);\n }\n return this;\n },\n\n addObjects<T>(this: T[], objs: T[]): T[] {\n objs.forEach((obj: T) => {\n const index = this.indexOf(obj);\n if (index === -1) {\n this.push(obj);\n }\n });\n return this;\n },\n\n popObject<T>(this: T[]): T | undefined {\n return this.pop();\n },\n\n pushObject<T>(this: T[], obj: T): T {\n this.push(obj);\n return obj;\n },\n\n pushObjects<T>(this: T[], objs: T[]): T[] {\n this.push(...objs);\n return this;\n },\n\n shiftObject<T>(this: T[]): NonNullable<T> {\n return this.shift()!;\n },\n\n unshiftObject<T>(this: T[], obj: T): T {\n this.unshift(obj);\n return obj;\n },\n\n unshiftObjects<T>(this: T[], objs: T[]): T[] {\n this.unshift(...objs);\n return this;\n },\n\n objectAt<T>(this: T[], index: number): T {\n //For negative index values go back from the end of the array\n const arrIndex = Math.sign(index) === -1 ? this.length + index : index;\n\n return this[arrIndex];\n },\n\n objectsAt<T>(this: T[], indices: number[]): T[] {\n // @ts-expect-error adding MutableArray method\n // oxlint-disable-next-line typescript/no-unsafe-return, typescript/no-unsafe-call\n return indices.map((index) => this.objectAt(index)!);\n },\n\n removeAt<T>(this: T[], index: number): T[] {\n this.splice(index, 1);\n return this;\n },\n\n insertAt<T>(this: T[], index: number, obj: T): T[] {\n this.splice(index, 0, obj);\n return this;\n },\n\n removeObject<T>(this: T[], obj: T): T[] {\n const index = this.indexOf(obj);\n if (index !== -1) {\n this.splice(index, 1);\n }\n return this;\n },\n\n removeObjects<T>(this: T[], objs: T[]): T[] {\n objs.forEach((obj) => {\n const index = this.indexOf(obj);\n if (index !== -1) {\n this.splice(index, 1);\n }\n });\n return this;\n },\n\n toArray<T>(this: T[]): T[] {\n return this.slice();\n },\n\n replace<T>(this: T[], idx: number, amt: number, objects?: T[]): void {\n if (objects) {\n this.splice(idx, amt, ...objects);\n } else {\n this.splice(idx, amt);\n }\n },\n\n clear<T>(this: T[]): T[] {\n this.splice(0, this.length);\n return this;\n },\n\n setObjects<T>(this: T[], objects: T[]): T[] {\n assert(`setObjects expects to receive an array as its argument`, Array.isArray(objects));\n this.splice(0, this.length);\n this.push(...objects);\n return this;\n },\n\n reverseObjects<T>(this: T[]): T[] {\n this.reverse();\n return this;\n },\n\n compact<T>(this: T[]): (T & {})[] {\n return this.filter((v) => v !== null && v !== undefined);\n },\n\n any<T>(this: T[], callback: Parameters<Array<T>['some']>[0], target?: unknown): boolean {\n return this.some(callback, target);\n },\n\n isAny<T>(this: T[], prop: string, value: unknown): boolean {\n const hasValue = arguments.length === 2;\n return (this as unknown as Array<Record<string, unknown>>).some((v) =>\n hasValue ? v[prop] === value : v[prop] === true\n );\n },\n\n isEvery<T>(this: T[], prop: string, value: unknown): boolean {\n const hasValue = arguments.length === 2;\n return (this as unknown as Array<Record<string, unknown>>).every((v) =>\n hasValue ? v[prop] === value : v[prop] === true\n );\n },\n\n getEach<T>(this: T[], key: string): unknown[] {\n return this.map((value) => get(value, key));\n },\n\n mapBy<T>(this: T[], key: string): unknown[] {\n return this.map((value) => get(value, key));\n },\n\n findBy<T>(this: T[], key: string, value?: unknown): T | undefined {\n if (arguments.length === 2) {\n return this.find((val) => {\n return get(val, key) === value;\n });\n } else {\n return this.find((val) => Boolean(get(val, key)));\n }\n },\n\n filterBy<T>(this: T[], key: string, value?: unknown): T[] {\n if (arguments.length === 2) {\n return this.filter((record) => {\n return get(record, key) === value;\n });\n }\n\n return this.filter((record) => {\n return Boolean(get(record, key));\n });\n },\n\n sortBy<T>(this: T[], ...sortKeys: string[]): T[] {\n return this.slice().sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n const key = sortKeys[i];\n\n const propA = get(a, key);\n\n const propB = get(b, key);\n // return 1 or -1 else continue to the next sortKey\n const compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n },\n\n invoke<T>(this: T[], key: string, ...args: unknown[]): unknown[] {\n return (this as unknown as Array<Record<string, unknown>>).map((value) =>\n (value[key] as (...args: unknown[]) => unknown)(...args)\n );\n },\n\n addArrayObserver<T>(this: T[]): void {},\n\n removeArrayObserver<T>(this: T[]): void {},\n\n arrayContentWillChange<T>(this: T[]): void {},\n\n arrayContentDidChange<T>(this: T[]): void {},\n\n reject<T>(this: T[], callback: Parameters<Array<T>['filter']>[0], target?: unknown): T[] {\n assert('`reject` expects a function as first argument.', typeof callback === 'function');\n\n return this.filter((...args) => {\n return !callback.apply(target, args);\n });\n },\n\n rejectBy<T>(this: T[], key: string, value?: unknown): T[] {\n if (arguments.length === 2) {\n return this.filter((record) => {\n return get(record, key) !== value;\n });\n }\n\n return this.filter((record) => {\n return !get(record, key);\n });\n },\n\n setEach<T>(this: T[], key: string, value: unknown): void {\n (this as unknown as Array<Record<string, unknown>>).forEach((item) => set(item, key, value));\n },\n\n uniq<T>(this: T[]): T[] {\n return Array.from(new Set(this));\n },\n\n uniqBy<T>(this: T[], key: string): T[] {\n const seen = new Set();\n const result: T[] = [];\n this.forEach((item) => {\n const value = get(item, key);\n if (seen.has(value)) {\n return;\n }\n seen.add(value);\n result.push(item);\n });\n return result;\n },\n\n without<T>(this: T[], value: T): T[] {\n const newArr = this.slice();\n const index = this.indexOf(value);\n if (index !== -1) {\n newArr.splice(index, 1);\n }\n\n return newArr;\n },\n\n get firstObject(): unknown {\n return (this as unknown as unknown[]).at(0);\n },\n\n get lastObject(): unknown {\n return (this as unknown as unknown[]).at(-1);\n },\n};\n\n/**\n * A schema extension that adds Ember's classic `MutableArray`/`Enumerable`\n * style methods (`pushObject`, `removeObject`, `mapBy`, `filterBy`,\n * `sortBy`, `firstObject`, `lastObject`, etc.) to reactive array resources.\n */\nexport const EmberArrayLikeExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'array',\n name: 'ember-array-like' as const,\n features: EmberArrayLikeFeatures,\n};\n\n/**\n * Extracts the element type of an array type, or `never` if `T` is not an array.\n */\nexport type ArrayType<T> = T extends ReadonlyArray<infer U> ? U : never;\n/**\n * Adds the classic `EmberObject` API (as registered by {@link EmberObjectExtension}/\n * {@link EmberObjectArrayExtension}) to the type of a reactive resource.\n */\nexport type WithEmberObject<T> = T & Pick<T & EmberObject, ArrayType<typeof EmberObjectMethods>>;\n\n/**\n * Adds Ember's classic array-like API (as registered by {@link EmberArrayLikeExtension})\n * to the type of a reactive array resource.\n */\nexport type WithArrayLike<T> =\n T extends Array<infer U>\n ? U &\n Omit<typeof EmberArrayLikeFeatures, 'firstObject' | 'lastObject'> & {\n /**\n * the first member of the array, or `undefined` if the array is empty\n */\n firstObject: T | undefined;\n /**\n * the last member of the array, or `undefined` if the array is empty\n */\n lastObject: T | undefined;\n }\n : T[] &\n Omit<typeof EmberArrayLikeFeatures, 'firstObject' | 'lastObject'> & {\n /**\n * the first member of the array, or `undefined` if the array is empty\n */\n firstObject: T | undefined;\n /**\n * the last member of the array, or `undefined` if the array is empty\n */\n lastObject: T | undefined;\n };\n"],"mappings":";;;;;;AAcA,MAAMU,sBAAsB,CAAC;AAc7BC;CAZE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEFA,CAAkB,CAACC,SAASC,WAAW;CACrCH,oBAAoBG,UAAU,SAASC,gBAAgB,GAAGC,MAA0B;EAClF,QAAQF,QAAR;GACE,KAAK,eACH,OAAQR,YAAgD,MAAM,GAAGU,IAAI;GACvE,KAAK,YACH,MAAM,IAAIC,MAAM,oDAAoD;GACtE,KAAK,qBAAqB;IACxB,MAAMC,UAAUF,KAAK;IACrB,MAAMG,YAAaH,KAAK,MAAiB;IACzCP,eAAAC,gBAAA,CAAA,CAAAU,UAAAC,IAAAC,KAAA,OAAAC,SAAA;KAAA,IAAA,CAAAA,MAAA,MAAA,IAAAN,MACE,gDAAgD;IAAA,EAAA,EAC/C,OAAOE,cAAc,YAAY,CAACK,MAAMC,WAAWN,SAAS,CAAC,MAAMO,SAASP,SAAS,CAAC;IAEzF,OAAOf,IAAI,MAAMc,UAAWjB,IAAI,MAAMiB,OAAO,KAAgB,KAAKC,SAAS;GAC7E;GACA,KAAK,OAIH,OAAQlB,IAAwC,MAAM,GAAGe,IAAI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AQnE,IAAI;EACrC,CAAC;CACH;CAEAoG,SAAuBvF,KAAa0D,OAAsB;EACxD,IAAIE,UAAUjC,WAAW,GACvB,OAAO,KAAKsB,QAAQqB,WAAW;GAC7B,OAAOlG,IAAIkG,QAAQtE,GAAG,MAAM0D;EAC9B,CAAC;EAGH,OAAO,KAAKT,QAAQqB,WAAW;GAC7B,OAAO,CAAClG,IAAIkG,QAAQtE,GAAG;EACzB,CAAC;CACH;CAEAwF,QAAsBxF,KAAa0D,OAAsB;EACtD,KAAmD1E,SAASyG,SAASlH,IAAIkH,MAAMzF,KAAK0D,KAAK,CAAC;CAC7F;CAEAgC,OAAwB;EACtB,OAAO9C,MAAM+C,KAAK,IAAIC,IAAI,IAAI,CAAC;CACjC;CAEAC,OAAqB7F,KAAkB;EACrC,MAAM8F,uBAAO,IAAIF,IAAI;EACrB,MAAMG,SAAc,CAAA;EACpB,KAAK/G,SAASyG,SAAS;GACrB,MAAM/B,QAAQtF,IAAIqH,MAAMzF,GAAG;GAC3B,IAAI8F,KAAKE,IAAItC,KAAK,GAChB;GAEFoC,KAAKG,IAAIvC,KAAK;GACdqC,OAAOpF,KAAK8E,IAAI;EAClB,CAAC;EACD,OAAOM;CACT;CAEAG,QAAsBxC,OAAe;EACnC,MAAMyC,SAAS,KAAK9D,MAAM;EAC1B,MAAM5B,QAAQ,KAAKC,QAAQgD,KAAK;EAChC,IAAIjD,UAAU,IACZ0F,OAAOnE,OAAOvB,OAAO,CAAC;EAGxB,OAAO0F;CACT;CAEA,IAAIC,cAAuB;EACzB,OAAQ,KAA8BC,GAAG,CAAC;CAC5C;CAEA,IAAIC,aAAsB;EACxB,OAAQ,KAA8BD,GAAG,EAAE;CAC7C;AACF;;;;;;AAOA,MAAaE,0BAA8D;CACzErG,MAAM;CACNC,MAAM;CACNC,UAAUE;AACZ"}
|
|
1
|
+
{"version":3,"file":"extensions.js","names":["get","getProperties","notifyPropertyChange","set","setProperties","addObserver","removeObserver","compare","macroCondition","getGlobalConfig","EmberObjectFeatures","EmberObjectMethods","forEach","method","delegatedMethod","args","Error","keyName","decrement","WarpDrive","env","DEBUG","test","isNaN","parseFloat","isFinite","increment","String","key","EmberObjectArrayExtension","kind","name","features","EmberObjectExtension","EmberArrayLikeFeatures","addObject","obj","index","indexOf","push","addObjects","objs","popObject","pop","pushObject","pushObjects","shiftObject","shift","unshiftObject","unshift","unshiftObjects","objectAt","arrIndex","Math","sign","length","objectsAt","indices","map","removeAt","splice","insertAt","removeObject","removeObjects","toArray","slice","replace","idx","amt","objects","clear","setObjects","Array","isArray","reverseObjects","reverse","compact","filter","v","undefined","any","callback","target","some","isAny","prop","value","hasValue","arguments","isEvery","every","getEach","mapBy","findBy","find","val","Boolean","filterBy","record","sortBy","sortKeys","sort","a","b","i","propA","propB","compareValue","invoke","addArrayObserver","removeArrayObserver","arrayContentWillChange","arrayContentDidChange","reject","apply","rejectBy","setEach","item","uniq","from","Set","uniqBy","seen","result","has","add","without","newArr","firstObject","at","lastObject","EmberArrayLikeExtension"],"sources":["../../src/compat/extensions.ts"],"sourcesContent":["/**\n * @module\n * @summary Legacy schema extensions that give reactive objects and arrays the classic `EmberObject` and Ember array\n * APIs, such as `get`, `set` and `mapBy`, plus matching types.\n */\n\nimport {\n type default as EmberObject,\n get,\n getProperties,\n notifyPropertyChange,\n set,\n setProperties,\n} from '@ember/object';\nimport { addObserver, removeObserver } from '@ember/object/observers';\nimport { compare } from '@ember/utils';\n\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension } from '@warp-drive/core/reactive';\n\nconst EmberObjectFeatures = {};\nconst EmberObjectMethods = [\n 'addObserver',\n 'cacheFor',\n 'decrementProperty',\n 'get',\n 'getProperties',\n 'incrementProperty',\n 'notifyPropertyChange',\n 'removeObserver',\n 'set',\n 'setProperties',\n 'toggleProperty',\n] as const;\nEmberObjectMethods.forEach((method) => {\n EmberObjectFeatures[method] = function delegatedMethod(...args: unknown[]): unknown {\n switch (method) {\n case 'addObserver':\n return (addObserver as (...args: unknown[]) => unknown)(this, ...args);\n case 'cacheFor':\n throw new Error('cacheFor has been removed and will not be replaced');\n case 'decrementProperty': {\n const keyName = args[0] as string;\n const decrement = (args[1] as number) ?? 1;\n assert(\n 'Must pass a numeric value to decrementProperty',\n (typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)\n );\n return set(this, keyName, ((get(this, keyName) as number) || 0) - decrement);\n }\n case 'get':\n // the cast is required: without it, TS resolves `get` to an overload whose\n // parameter list isn't a rest/tuple, and the spread below fails to typecheck\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion\n return (get as (...args: unknown[]) => unknown)(this, ...args);\n case 'getProperties':\n return (getProperties as (...args: unknown[]) => unknown)(this, ...args);\n case 'incrementProperty': {\n const keyName = args[0] as string;\n const increment = (args[1] as number) ?? 1;\n assert(\n 'Must pass a numeric value to incrementProperty',\n !isNaN(parseFloat(String(increment))) && isFinite(increment)\n );\n return set(this, keyName, (parseFloat(get(this, keyName) as string) || 0) + increment);\n }\n case 'notifyPropertyChange':\n return (notifyPropertyChange as (...args: unknown[]) => unknown)(this, ...args);\n case 'removeObserver':\n return (removeObserver as (...args: unknown[]) => unknown)(this, ...args);\n case 'set':\n return (set as (...args: unknown[]) => unknown)(this, ...args);\n case 'setProperties':\n return (setProperties as (...args: unknown[]) => unknown)(this, ...args);\n case 'toggleProperty': {\n const key = args[0] as string;\n return set(this, key, !get(this, key));\n }\n }\n };\n});\n/**\n * A schema extension that adds the classic `EmberObject` API (`get`, `set`,\n * `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,\n * `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)\n * to reactive array resources.\n *\n * @summary Legacy schema extension that gives reactive arrays the classic `EmberObject` API such as `get`, `set`,\n * and observers, to ease migration from Ember objects.\n */\nexport const EmberObjectArrayExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'array',\n name: 'ember-object' as const,\n features: EmberObjectFeatures,\n};\n/**\n * A schema extension that adds the classic `EmberObject` API (`get`, `set`,\n * `getProperties`, `setProperties`, `incrementProperty`, `decrementProperty`,\n * `toggleProperty`, `notifyPropertyChange`, `addObserver`, `removeObserver`)\n * to reactive object resources.\n *\n * @summary Legacy schema extension that gives reactive objects the classic `EmberObject` API such as `get`, `set`,\n * and observers, to ease migration from Ember objects.\n */\nexport const EmberObjectExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'object',\n name: 'ember-object' as const,\n features: EmberObjectFeatures,\n};\n\nconst EmberArrayLikeFeatures = {\n addObject<T>(this: T[], obj: T): T[] {\n const index = this.indexOf(obj);\n if (index === -1) {\n this.push(obj);\n }\n return this;\n },\n\n addObjects<T>(this: T[], objs: T[]): T[] {\n objs.forEach((obj: T) => {\n const index = this.indexOf(obj);\n if (index === -1) {\n this.push(obj);\n }\n });\n return this;\n },\n\n popObject<T>(this: T[]): T | undefined {\n return this.pop();\n },\n\n pushObject<T>(this: T[], obj: T): T {\n this.push(obj);\n return obj;\n },\n\n pushObjects<T>(this: T[], objs: T[]): T[] {\n this.push(...objs);\n return this;\n },\n\n shiftObject<T>(this: T[]): NonNullable<T> {\n return this.shift()!;\n },\n\n unshiftObject<T>(this: T[], obj: T): T {\n this.unshift(obj);\n return obj;\n },\n\n unshiftObjects<T>(this: T[], objs: T[]): T[] {\n this.unshift(...objs);\n return this;\n },\n\n objectAt<T>(this: T[], index: number): T {\n //For negative index values go back from the end of the array\n const arrIndex = Math.sign(index) === -1 ? this.length + index : index;\n\n return this[arrIndex];\n },\n\n objectsAt<T>(this: T[], indices: number[]): T[] {\n // @ts-expect-error adding MutableArray method\n // oxlint-disable-next-line typescript/no-unsafe-return, typescript/no-unsafe-call\n return indices.map((index) => this.objectAt(index)!);\n },\n\n removeAt<T>(this: T[], index: number): T[] {\n this.splice(index, 1);\n return this;\n },\n\n insertAt<T>(this: T[], index: number, obj: T): T[] {\n this.splice(index, 0, obj);\n return this;\n },\n\n removeObject<T>(this: T[], obj: T): T[] {\n const index = this.indexOf(obj);\n if (index !== -1) {\n this.splice(index, 1);\n }\n return this;\n },\n\n removeObjects<T>(this: T[], objs: T[]): T[] {\n objs.forEach((obj) => {\n const index = this.indexOf(obj);\n if (index !== -1) {\n this.splice(index, 1);\n }\n });\n return this;\n },\n\n toArray<T>(this: T[]): T[] {\n return this.slice();\n },\n\n replace<T>(this: T[], idx: number, amt: number, objects?: T[]): void {\n if (objects) {\n this.splice(idx, amt, ...objects);\n } else {\n this.splice(idx, amt);\n }\n },\n\n clear<T>(this: T[]): T[] {\n this.splice(0, this.length);\n return this;\n },\n\n setObjects<T>(this: T[], objects: T[]): T[] {\n assert(`setObjects expects to receive an array as its argument`, Array.isArray(objects));\n this.splice(0, this.length);\n this.push(...objects);\n return this;\n },\n\n reverseObjects<T>(this: T[]): T[] {\n this.reverse();\n return this;\n },\n\n compact<T>(this: T[]): (T & {})[] {\n return this.filter((v) => v !== null && v !== undefined);\n },\n\n any<T>(this: T[], callback: Parameters<Array<T>['some']>[0], target?: unknown): boolean {\n return this.some(callback, target);\n },\n\n isAny<T>(this: T[], prop: string, value: unknown): boolean {\n const hasValue = arguments.length === 2;\n return (this as unknown as Array<Record<string, unknown>>).some((v) =>\n hasValue ? v[prop] === value : v[prop] === true\n );\n },\n\n isEvery<T>(this: T[], prop: string, value: unknown): boolean {\n const hasValue = arguments.length === 2;\n return (this as unknown as Array<Record<string, unknown>>).every((v) =>\n hasValue ? v[prop] === value : v[prop] === true\n );\n },\n\n getEach<T>(this: T[], key: string): unknown[] {\n return this.map((value) => get(value, key));\n },\n\n mapBy<T>(this: T[], key: string): unknown[] {\n return this.map((value) => get(value, key));\n },\n\n findBy<T>(this: T[], key: string, value?: unknown): T | undefined {\n if (arguments.length === 2) {\n return this.find((val) => {\n return get(val, key) === value;\n });\n } else {\n return this.find((val) => Boolean(get(val, key)));\n }\n },\n\n filterBy<T>(this: T[], key: string, value?: unknown): T[] {\n if (arguments.length === 2) {\n return this.filter((record) => {\n return get(record, key) === value;\n });\n }\n\n return this.filter((record) => {\n return Boolean(get(record, key));\n });\n },\n\n sortBy<T>(this: T[], ...sortKeys: string[]): T[] {\n return this.slice().sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n const key = sortKeys[i];\n\n const propA = get(a, key);\n\n const propB = get(b, key);\n // return 1 or -1 else continue to the next sortKey\n const compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n },\n\n invoke<T>(this: T[], key: string, ...args: unknown[]): unknown[] {\n return (this as unknown as Array<Record<string, unknown>>).map((value) =>\n (value[key] as (...args: unknown[]) => unknown)(...args)\n );\n },\n\n addArrayObserver<T>(this: T[]): void {},\n\n removeArrayObserver<T>(this: T[]): void {},\n\n arrayContentWillChange<T>(this: T[]): void {},\n\n arrayContentDidChange<T>(this: T[]): void {},\n\n reject<T>(this: T[], callback: Parameters<Array<T>['filter']>[0], target?: unknown): T[] {\n assert('`reject` expects a function as first argument.', typeof callback === 'function');\n\n return this.filter((...args) => {\n return !callback.apply(target, args);\n });\n },\n\n rejectBy<T>(this: T[], key: string, value?: unknown): T[] {\n if (arguments.length === 2) {\n return this.filter((record) => {\n return get(record, key) !== value;\n });\n }\n\n return this.filter((record) => {\n return !get(record, key);\n });\n },\n\n setEach<T>(this: T[], key: string, value: unknown): void {\n (this as unknown as Array<Record<string, unknown>>).forEach((item) => set(item, key, value));\n },\n\n uniq<T>(this: T[]): T[] {\n return Array.from(new Set(this));\n },\n\n uniqBy<T>(this: T[], key: string): T[] {\n const seen = new Set();\n const result: T[] = [];\n this.forEach((item) => {\n const value = get(item, key);\n if (seen.has(value)) {\n return;\n }\n seen.add(value);\n result.push(item);\n });\n return result;\n },\n\n without<T>(this: T[], value: T): T[] {\n const newArr = this.slice();\n const index = this.indexOf(value);\n if (index !== -1) {\n newArr.splice(index, 1);\n }\n\n return newArr;\n },\n\n get firstObject(): unknown {\n return (this as unknown as unknown[]).at(0);\n },\n\n get lastObject(): unknown {\n return (this as unknown as unknown[]).at(-1);\n },\n};\n\n/**\n * A schema extension that adds Ember's classic `MutableArray`/`Enumerable`\n * style methods (`pushObject`, `removeObject`, `mapBy`, `filterBy`,\n * `sortBy`, `firstObject`, `lastObject`, etc.) to reactive array resources.\n *\n * @summary Legacy schema extension that gives reactive arrays Ember array methods such as `pushObject`, `mapBy`,\n * `filterBy`, and `firstObject`.\n */\nexport const EmberArrayLikeExtension: CAUTION_MEGA_DANGER_ZONE_Extension = {\n kind: 'array',\n name: 'ember-array-like' as const,\n features: EmberArrayLikeFeatures,\n};\n\n/**\n * Extracts the element type of an array type, or `never` if `T` is not an array.\n *\n * @summary Type utility resolving to the element type of an array type, or `never` for non-arrays.\n */\nexport type ArrayType<T> = T extends ReadonlyArray<infer U> ? U : never;\n/**\n * Adds the classic `EmberObject` API (as registered by {@link EmberObjectExtension}/\n * {@link EmberObjectArrayExtension}) to the type of a reactive resource.\n *\n * @summary Legacy type that adds the classic `EmberObject` methods to a reactive resource type using\n * `EmberObjectExtension` or `EmberObjectArrayExtension`.\n */\nexport type WithEmberObject<T> = T & Pick<T & EmberObject, ArrayType<typeof EmberObjectMethods>>;\n\n/**\n * Adds Ember's classic array-like API (as registered by {@link EmberArrayLikeExtension})\n * to the type of a reactive array resource.\n *\n * @summary Legacy type that adds Ember array methods such as `mapBy` and `firstObject` to a reactive array type\n * using `EmberArrayLikeExtension`.\n */\nexport type WithArrayLike<T> =\n T extends Array<infer U>\n ? U &\n Omit<typeof EmberArrayLikeFeatures, 'firstObject' | 'lastObject'> & {\n /**\n * the first member of the array, or `undefined` if the array is empty\n */\n firstObject: T | undefined;\n /**\n * the last member of the array, or `undefined` if the array is empty\n */\n lastObject: T | undefined;\n }\n : T[] &\n Omit<typeof EmberArrayLikeFeatures, 'firstObject' | 'lastObject'> & {\n /**\n * the first member of the array, or `undefined` if the array is empty\n */\n firstObject: T | undefined;\n /**\n * the last member of the array, or `undefined` if the array is empty\n */\n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CAEAC,OAAqB7F,KAAkB;EACrC,MAAM8F,uBAAO,IAAIF,IAAI;EACrB,MAAMG,SAAc,CAAA;EACpB,KAAK/G,SAASyG,SAAS;GACrB,MAAM/B,QAAQtF,IAAIqH,MAAMzF,GAAG;GAC3B,IAAI8F,KAAKE,IAAItC,KAAK,GAChB;GAEFoC,KAAKG,IAAIvC,KAAK;GACdqC,OAAOpF,KAAK8E,IAAI;EAClB,CAAC;EACD,OAAOM;CACT;CAEAG,QAAsBxC,OAAe;EACnC,MAAMyC,SAAS,KAAK9D,MAAM;EAC1B,MAAM5B,QAAQ,KAAKC,QAAQgD,KAAK;EAChC,IAAIjD,UAAU,IACZ0F,OAAOnE,OAAOvB,OAAO,CAAC;EAGxB,OAAO0F;CACT;CAEA,IAAIC,cAAuB;EACzB,OAAQ,KAA8BC,GAAG,CAAC;CAC5C;CAEA,IAAIC,aAAsB;EACxB,OAAQ,KAA8BD,GAAG,EAAE;CAC7C;AACF;;;;;;;;;AAUA,MAAaE,0BAA8D;CACzErG,MAAM;CACNC,MAAM;CACNC,UAAUE;AACZ"}
|
package/dist/compat/utils.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ type Reporter = (type: "formatted-id" | "formatted-type", actual: unknown, expec
|
|
|
5
5
|
* changes during normalization. This is useful for instrumenting
|
|
6
6
|
* to discover places where usage in the app is not consistent.
|
|
7
7
|
*
|
|
8
|
+
* @summary Legacy migration helper that registers a callback invoked whenever `formattedId` or `formattedType`
|
|
9
|
+
* has to change the id or type it was given.
|
|
8
10
|
* @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
|
|
9
11
|
* @public
|
|
10
12
|
*/
|
|
@@ -14,6 +16,8 @@ export declare function configureMismatchReporter(fn: Reporter): void;
|
|
|
14
16
|
* fails validation. This is useful for instrumenting
|
|
15
17
|
* to discover places where usage in the app is not consistent.
|
|
16
18
|
*
|
|
19
|
+
* @summary Legacy migration helper that registers a callback invoked when an id or type passed to these utilities
|
|
20
|
+
* fails validation.
|
|
17
21
|
* @param fn - a function which takes a message and a condition
|
|
18
22
|
* @public
|
|
19
23
|
*/
|
|
@@ -28,6 +32,8 @@ export declare function configureAssertFn(fn: (message: string, condition: unkno
|
|
|
28
32
|
* the configured mismatch reporter and assert functions will
|
|
29
33
|
* be called.
|
|
30
34
|
*
|
|
35
|
+
* @summary Legacy migration helper that replaces the singularize-and-dasherize function `formattedType` and
|
|
36
|
+
* `isEquivType` use to normalize resource types.
|
|
31
37
|
* @param fn - a function which takes a string and returns a string
|
|
32
38
|
* @public
|
|
33
39
|
*/
|
|
@@ -57,6 +63,8 @@ export declare function configureTypeNormalization(fn: (type: string) => string)
|
|
|
57
63
|
* formattedType('PostComment'); // => 'post-comment'
|
|
58
64
|
* ```
|
|
59
65
|
*
|
|
66
|
+
* @summary Legacy migration helper that normalizes a resource type to the singular dasherized form the cache
|
|
67
|
+
* expects, such as `'PostComments'` to `'post-comment'`.
|
|
60
68
|
* @param type the potentially un-normalized type
|
|
61
69
|
* @return the normalized type
|
|
62
70
|
* @public
|
|
@@ -78,6 +86,8 @@ export declare function formattedType<T extends string>(type: T | string): T;
|
|
|
78
86
|
* formattedId(null); // => null
|
|
79
87
|
* ```
|
|
80
88
|
*
|
|
89
|
+
* @summary Legacy migration helper that normalizes a resource id to the `string` or `null` the cache expects,
|
|
90
|
+
* asserting on invalid ids such as `''` or `0`.
|
|
81
91
|
* @param id the potentially un-normalized id
|
|
82
92
|
* @return the normalized id
|
|
83
93
|
* @public
|
|
@@ -89,6 +99,8 @@ export declare function formattedId(id: string | number | null): string | null;
|
|
|
89
99
|
* Like {@link formattedId}, but asserts that `id` is not `null` rather
|
|
90
100
|
* than allowing and passing through `null`.
|
|
91
101
|
*
|
|
102
|
+
* @summary Legacy migration helper that normalizes a resource id to a string like `formattedId`, but asserts that
|
|
103
|
+
* it is not `null`.
|
|
92
104
|
* @public
|
|
93
105
|
*/
|
|
94
106
|
export declare function expectId(id: string | number): string;
|
|
@@ -118,6 +130,8 @@ export declare function expectId(id: null): never;
|
|
|
118
130
|
* isEquivType('posts', null); // false
|
|
119
131
|
* ```
|
|
120
132
|
*
|
|
133
|
+
* @summary Legacy migration helper that reports whether two resource types match after normalization, so
|
|
134
|
+
* `'posts'` and `'post'` are equivalent.
|
|
121
135
|
* @param expected a potentially unnormalized type to match against
|
|
122
136
|
* @param actual a potentially unnormalized type to match against
|
|
123
137
|
* @return true if the types are equivalent
|
|
@@ -140,6 +154,8 @@ export declare function isEquivType(expected: string, actual: string): boolean;
|
|
|
140
154
|
* isEquivId(1, null); // false
|
|
141
155
|
* ```
|
|
142
156
|
*
|
|
157
|
+
* @summary Legacy migration helper that reports whether two resource ids match after normalization, so `1` and
|
|
158
|
+
* `'1'` are equivalent.
|
|
143
159
|
* @param expected a potentially un-normalized id to match against
|
|
144
160
|
* @param actual a potentially un-normalized id to match against
|
|
145
161
|
* @return true if the ids are equivalent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/compat/utils.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/compat/utils.ts"],"mappings":";KAgBK,YAAY,yCAAyC,iBAAiB;;;;;;;;;;;wBA4B3D,0BAA0B,IAAI;;;;;;;;;;;wBAc9B,kBAAkB,KAAK,iBAAiB;;;;;;;;;;;;;;;;wBAmBxC,2BAA2B,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqChC,cAAc,kBAAkB,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;wBAyCnD,YAAY;wBACZ,YAAY;wBACZ,YAAY;;;;;;;;;wBA4BZ,SAAS;;;;;;wBAMT,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCT,YAAY,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;wBAqC9B,UAAU,2BAA2B"}
|
package/dist/compat/utils.js
CHANGED
|
@@ -6,6 +6,8 @@ import { dasherize, singularize } from "@warp-drive/utilities/string";
|
|
|
6
6
|
Utilities for helping to migrate to stricter
|
|
7
7
|
and more consistent use of IDs and types.
|
|
8
8
|
|
|
9
|
+
@summary Legacy helpers that normalize, compare, and report mismatched resource ids and types while migrating to
|
|
10
|
+
stricter formats.
|
|
9
11
|
@module
|
|
10
12
|
*/
|
|
11
13
|
let MismatchReporter = function() {};
|
|
@@ -24,6 +26,8 @@ let NormalizedType = (str) => {
|
|
|
24
26
|
* changes during normalization. This is useful for instrumenting
|
|
25
27
|
* to discover places where usage in the app is not consistent.
|
|
26
28
|
*
|
|
29
|
+
* @summary Legacy migration helper that registers a callback invoked whenever `formattedId` or `formattedType`
|
|
30
|
+
* has to change the id or type it was given.
|
|
27
31
|
* @param fn - a function which takes a mismatch-type ('formatted-id' | 'formatted-type'), actual, and expected value
|
|
28
32
|
* @public
|
|
29
33
|
*/
|
|
@@ -35,6 +39,8 @@ function configureMismatchReporter(fn) {
|
|
|
35
39
|
* fails validation. This is useful for instrumenting
|
|
36
40
|
* to discover places where usage in the app is not consistent.
|
|
37
41
|
*
|
|
42
|
+
* @summary Legacy migration helper that registers a callback invoked when an id or type passed to these utilities
|
|
43
|
+
* fails validation.
|
|
38
44
|
* @param fn - a function which takes a message and a condition
|
|
39
45
|
* @public
|
|
40
46
|
*/
|
|
@@ -51,6 +57,8 @@ function configureAssertFn(fn) {
|
|
|
51
57
|
* the configured mismatch reporter and assert functions will
|
|
52
58
|
* be called.
|
|
53
59
|
*
|
|
60
|
+
* @summary Legacy migration helper that replaces the singularize-and-dasherize function `formattedType` and
|
|
61
|
+
* `isEquivType` use to normalize resource types.
|
|
54
62
|
* @param fn - a function which takes a string and returns a string
|
|
55
63
|
* @public
|
|
56
64
|
*/
|
|
@@ -83,6 +91,8 @@ const NORMALIZED_TYPES = /* @__PURE__ */ new Map();
|
|
|
83
91
|
* formattedType('PostComment'); // => 'post-comment'
|
|
84
92
|
* ```
|
|
85
93
|
*
|
|
94
|
+
* @summary Legacy migration helper that normalizes a resource type to the singular dasherized form the cache
|
|
95
|
+
* expects, such as `'PostComments'` to `'post-comment'`.
|
|
86
96
|
* @param type the potentially un-normalized type
|
|
87
97
|
* @return the normalized type
|
|
88
98
|
* @public
|
|
@@ -116,6 +126,8 @@ function formattedType(type) {
|
|
|
116
126
|
* formattedId(null); // => null
|
|
117
127
|
* ```
|
|
118
128
|
*
|
|
129
|
+
* @summary Legacy migration helper that normalizes a resource id to the `string` or `null` the cache expects,
|
|
130
|
+
* asserting on invalid ids such as `''` or `0`.
|
|
119
131
|
* @param id the potentially un-normalized id
|
|
120
132
|
* @return the normalized id
|
|
121
133
|
* @public
|
|
@@ -133,6 +145,8 @@ function formattedId(id) {
|
|
|
133
145
|
* Like {@link formattedId}, but asserts that `id` is not `null` rather
|
|
134
146
|
* than allowing and passing through `null`.
|
|
135
147
|
*
|
|
148
|
+
* @summary Legacy migration helper that normalizes a resource id to a string like `formattedId`, but asserts that
|
|
149
|
+
* it is not `null`.
|
|
136
150
|
* @public
|
|
137
151
|
*/
|
|
138
152
|
/**
|
|
@@ -164,6 +178,8 @@ function expectId(id) {
|
|
|
164
178
|
* isEquivType('posts', null); // false
|
|
165
179
|
* ```
|
|
166
180
|
*
|
|
181
|
+
* @summary Legacy migration helper that reports whether two resource types match after normalization, so
|
|
182
|
+
* `'posts'` and `'post'` are equivalent.
|
|
167
183
|
* @param expected a potentially unnormalized type to match against
|
|
168
184
|
* @param actual a potentially unnormalized type to match against
|
|
169
185
|
* @return true if the types are equivalent
|
|
@@ -196,6 +212,8 @@ function isEquivType(expected, actual) {
|
|
|
196
212
|
* isEquivId(1, null); // false
|
|
197
213
|
* ```
|
|
198
214
|
*
|
|
215
|
+
* @summary Legacy migration helper that reports whether two resource ids match after normalization, so `1` and
|
|
216
|
+
* `'1'` are equivalent.
|
|
199
217
|
* @param expected a potentially un-normalized id to match against
|
|
200
218
|
* @param actual a potentially un-normalized id to match against
|
|
201
219
|
* @return true if the ids are equivalent
|