@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as lookupLegacySupport, t as Errors } from "../errors-
|
|
2
|
-
import { _ as save, a as RecordState, c as _save, d as createSnapshot, f as deleteRecord, g as rollbackAttributes, h as reload, l as belongsTo, m as hasMany, o as _destroyRecord, p as destroyRecord, s as _reload, t as buildSchema, u as changedAttributes, v as serialize, y as unloadRecord } from "../schema-provider-
|
|
1
|
+
import { r as lookupLegacySupport, t as Errors } from "../errors-BI0Xugyo.js";
|
|
2
|
+
import { _ as save, a as RecordState, c as _save, d as createSnapshot, f as deleteRecord, g as rollbackAttributes, h as reload, l as belongsTo, m as hasMany, o as _destroyRecord, p as destroyRecord, s as _reload, t as buildSchema, u as changedAttributes, v as serialize, y as unloadRecord } from "../schema-provider-Dyjpau2P.js";
|
|
3
3
|
import "./-private.js";
|
|
4
4
|
import { recordIdentifierFor } from "@warp-drive/core";
|
|
5
5
|
import { assertPrivateStore } from "@warp-drive/core/store/-private";
|
|
@@ -28,12 +28,17 @@ import { Type } from "@warp-drive/core/types/symbols";
|
|
|
28
28
|
* additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone
|
|
29
29
|
* to assist in more rapidly adopting modern WarpDrive features.
|
|
30
30
|
*
|
|
31
|
+
* @summary Legacy helpers for migrating from `Model` to `ReactiveResource`: LegacyMode schema defaults, derivations,
|
|
32
|
+
* types, and a schema service that serves both at once.
|
|
31
33
|
* @module
|
|
32
34
|
*/
|
|
33
35
|
/**
|
|
34
36
|
* Adds the `Model`-style `belongsTo`/`hasMany` reference methods to a
|
|
35
37
|
* {@link TypedRecordInstance}, for use when migrating a resource from
|
|
36
38
|
* `Model` to a schema-based record while preserving these APIs.
|
|
39
|
+
*
|
|
40
|
+
* @summary Legacy type that adds the `Model`-style `belongsTo` and `hasMany` reference methods to a typed record
|
|
41
|
+
* migrating from `Model` to a schema-based record.
|
|
37
42
|
*/
|
|
38
43
|
const LegacyFields = [
|
|
39
44
|
"_createSnapshot",
|
|
@@ -102,6 +107,8 @@ const LegacyFields = [
|
|
|
102
107
|
* }>
|
|
103
108
|
* ```
|
|
104
109
|
*
|
|
110
|
+
* @summary Legacy type that adds the `Model`-style state flags and methods (`save`, `isNew`, `errors`, etc.) that
|
|
111
|
+
* `withDefaults` provides to a LegacyMode record type.
|
|
105
112
|
*/
|
|
106
113
|
const LegacySupport = getOrSetGlobal("LegacySupport", /* @__PURE__ */ new WeakMap());
|
|
107
114
|
function legacySupport(record, options, prop) {
|
|
@@ -197,6 +204,8 @@ legacySupport[Type] = "@legacy";
|
|
|
197
204
|
* registerDerivations(schema);
|
|
198
205
|
* ```
|
|
199
206
|
*
|
|
207
|
+
* @summary Legacy helper that marks a resource schema as LegacyMode and adds the fields that give its records
|
|
208
|
+
* `Model`-like state and methods.
|
|
200
209
|
* @param schema The schema to add legacy support to.
|
|
201
210
|
* @return The schema with legacy support added.
|
|
202
211
|
* @public
|
|
@@ -254,6 +263,9 @@ function withDefaults(schema) {
|
|
|
254
263
|
* ]
|
|
255
264
|
* });
|
|
256
265
|
* ```
|
|
266
|
+
*
|
|
267
|
+
* @summary Legacy alternative to `withDefaults` that makes a LegacyMode schema whose `save`, `reload`, and
|
|
268
|
+
* `destroyRecord` run without deprecation warnings.
|
|
257
269
|
*/
|
|
258
270
|
function withRestoredDeprecatedModelRequestBehaviors(schema) {
|
|
259
271
|
schema.legacy = true;
|
|
@@ -296,6 +308,8 @@ function withRestoredDeprecatedModelRequestBehaviors(schema) {
|
|
|
296
308
|
* This must be called in order to use the fields added by {@link withDefaults} or
|
|
297
309
|
* {@link withRestoredDeprecatedModelRequestBehaviors}.
|
|
298
310
|
*
|
|
311
|
+
* @summary Legacy setup that registers the derivation, relationship behaviors, and extension a schema service needs to
|
|
312
|
+
* support LegacyMode records.
|
|
299
313
|
* @param schema The schema service to register the derivations with.
|
|
300
314
|
* @public
|
|
301
315
|
*/
|
|
@@ -346,7 +360,7 @@ function registerDerivations(schema) {
|
|
|
346
360
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
347
361
|
until: "6.0",
|
|
348
362
|
for: "@warp-drive/core",
|
|
349
|
-
url: "https://
|
|
363
|
+
url: "https://warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
350
364
|
since: {
|
|
351
365
|
enabled: "5.7",
|
|
352
366
|
available: "5.7"
|
|
@@ -388,11 +402,15 @@ function registerDerivations(schema) {
|
|
|
388
402
|
* All calls to register resources, derivations, transformations, hash functions
|
|
389
403
|
* etc. will be delegated to the primary schema service.
|
|
390
404
|
*
|
|
405
|
+
* @summary Legacy schema service that serves a resource's schema from the primary service when it has one, and
|
|
406
|
+
* otherwise from its `Model` class, for incremental migration.
|
|
391
407
|
* @class DelegatingSchemaService
|
|
392
408
|
* @public
|
|
393
409
|
*/
|
|
394
410
|
/**
|
|
395
411
|
* See the {@link DelegatingSchemaService | class documentation above} for usage.
|
|
412
|
+
* @summary Legacy schema service that serves a resource's schema from the primary service when it has one, and
|
|
413
|
+
* otherwise from its `Model` class, for incremental migration.
|
|
396
414
|
*/
|
|
397
415
|
var DelegatingSchemaService = class {
|
|
398
416
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-support.js","names":["deprecate","recordIdentifierFor","Context","notifyInternalSignal","assertPrivateStore","getOrSetGlobal","Type","Errors","lookupLegacySupport","_destroyRecord","_reload","_save","belongsTo","changedAttributes","createSnapshot","deleteRecord","destroyRecord","hasMany","reload","rollbackAttributes","save","serialize","unloadRecord","RecordState","buildSchema","getGlobalConfig","macroCondition","LegacyFields","LegacySupport","WeakMap","legacySupport","record","options","prop","state","get","set","suppressDeprecation","Boolean","currentState","adapterError","_constructor","isModel","name","type","modelName","recordState","dirtyType","errors","create","__record","isDirty","isDeleted","isEmpty","isError","isLoaded","isLoading","isNew","isSaving","isValid","WarpDrive","env","DEBUG","test","Error","withDefaults","schema","legacy","identity","kind","forEach","field","fields","push","defaultValue","objectExtensions","withRestoredDeprecatedModelRequestBehaviors","registerDerivations","registerDerivation","_registerMode","store","cacheKey","getBelongsTo","value","_join","setDirtyBelongsTo","getHasMany","support","manyArray","getManyArray","splice","length","notify","_manyArrayCache","hasPromise","_relationshipPromisesCache","signal","CAUTION_MEGA_DANGER_ZONE_registerExtension","features","isReloading","id","until","for","url","since","enabled","available","_isReloading","v","DelegatingSchemaService","_preferred","_secondary","constructor","isDelegated","resource","hasResource","resourceTypes","Array","from","Set","concat","hasTrait","resourceHasTrait","trait","cacheFields","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","CAUTION_MEGA_DANGER_ZONE_hasExtension","ext","extension","CAUTION_MEGA_DANGER_ZONE_resourceExtensions","CAUTION_MEGA_DANGER_ZONE_objectExtensions","resolvedType","CAUTION_MEGA_DANGER_ZONE_arrayExtensions","mode","kinds","_kind","assertPrivate","service","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"sources":["../../src/model/migration-support.ts"],"sourcesContent":["/**\n * This module provides support for migrating away from @warp-drive/legacy/model\n * to ReactiveResource from @warp-drive/core/reactive.\n *\n * It includes:\n *\n * - A `withDefaults` function to assist in creating a schema in LegacyMode\n * - A `registerDerivations` function to register the derivations necessary to support LegacyMode\n * - A `DelegatingSchemaService` that can be used to provide a schema service that works with both\n * @warp-drive/legacy/model and @warp-drive/core/reactive simultaneously for migration purposes.\n * - A `WithLegacy` type util that can be used to create a type that includes the legacy\n * properties and methods of a record.\n *\n * Using LegacyMode features on a ReactiveResource *requires* the use of these derivations and schema\n * additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone\n * to assist in more rapidly adopting modern WarpDrive features.\n *\n * @module\n */\nimport { deprecate } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { recordIdentifierFor } from '@warp-drive/core';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from '@warp-drive/core/reactive';\nimport type { ExtensibleField } from '@warp-drive/core/reactive/-private';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport { notifyInternalSignal } from '@warp-drive/core/signals/-leaked';\nimport type { PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { SchemaService } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { ObjectValue } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core/types/schema/concepts';\nimport type {\n ArrayField,\n CacheableFieldSchema,\n DerivedField,\n FieldSchema,\n GenericField,\n HashField,\n IdentityField,\n LegacyBelongsToField,\n LegacyHasManyField,\n LegacyResourceSchema,\n ObjectField,\n ObjectSchema,\n ResourceSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport { Type } from '@warp-drive/core/types/symbols';\nimport type { WithPartial } from '@warp-drive/core/types/utils';\n\nimport type { Snapshot } from '../compat/-private.ts';\nimport { Errors, lookupLegacySupport } from './-private.ts';\nimport type { MinimalLegacyRecord } from './-private/model-methods.ts';\nimport {\n _destroyRecord,\n _reload,\n _save,\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './-private/model-methods.ts';\nimport RecordState from './-private/record-state.ts';\nimport type BelongsToReference from './-private/references/belongs-to.ts';\nimport type HasManyReference from './-private/references/has-many.ts';\nimport { buildSchema } from './-private/schema-provider.ts';\nimport type { _MaybeBelongsToFields, MaybeHasManyFields } from './-private/type-utils.ts';\n\n/**\n * Adds the `Model`-style `belongsTo`/`hasMany` reference methods to a\n * {@link TypedRecordInstance}, for use when migrating a resource from\n * `Model` to a schema-based record while preserving these APIs.\n */\nexport type WithLegacyDerivations<T extends TypedRecordInstance> = T &\n MinimalLegacyRecord & {\n /**\n * see {@link belongsTo}\n */\n belongsTo: typeof belongsTo;\n /**\n * see {@link hasMany}\n */\n hasMany: typeof hasMany;\n };\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ninterface LegacyModeRecord<T extends TypedRecordInstance> {\n id: string | null;\n\n serialize(options?: Record<string, unknown>): unknown;\n destroyRecord(options?: Record<string, unknown>): Promise<this>;\n unloadRecord(): void;\n changedAttributes(): ChangedAttributesHash;\n rollbackAttributes(): void;\n _createSnapshot(): Snapshot<T>;\n save(options?: Record<string, unknown>): Promise<this>;\n reload(options?: Record<string, unknown>): Promise<T>;\n belongsTo<K extends _MaybeBelongsToFields<T>>(prop: K): BelongsToReference<T, K>;\n hasMany<K extends MaybeHasManyFields<T>>(prop: K): HasManyReference<T, K>;\n deleteRecord(): void;\n\n adapterError: unknown;\n constructor: { modelName: TypeFromInstance<T> };\n currentState: RecordState;\n dirtyType: 'deleted' | 'created' | 'updated' | '';\n errors: unknown;\n hasDirtyAttributes: boolean;\n isDeleted: boolean;\n isEmpty: boolean;\n isError: boolean;\n isLoaded: boolean;\n isLoading: boolean;\n isDestroying: boolean;\n isDestroyed: boolean;\n isNew: boolean;\n isSaving: boolean;\n isValid: boolean;\n}\n\n// 'isDestroying', 'isDestroyed'\nconst LegacyFields = [\n '_createSnapshot',\n 'adapterError',\n 'belongsTo',\n 'changedAttributes',\n 'constructor',\n 'currentState',\n 'deleteRecord',\n 'destroyRecord',\n 'dirtyType',\n 'errors',\n 'hasDirtyAttributes',\n 'hasMany',\n 'isDeleted',\n 'isEmpty',\n 'isError',\n 'isLoaded',\n 'isLoading',\n 'isNew',\n 'isSaving',\n 'isValid',\n 'reload',\n 'rollbackAttributes',\n 'save',\n 'serialize',\n 'unloadRecord',\n] as const;\n\n/**\n * A Type utility that enables quickly adding type information for the fields\n * defined by `import { withDefaults } from '@warp-drive/legacy/model/migration-support'`.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';\n * import { Type } from '@warp-drive/core/types/symbols';\n * import type { HasMany } from '@@warp-drive/legacy/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n */\nexport type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;\n\nconst LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap<MinimalLegacyRecord, Record<string, unknown>>());\n\nfunction legacySupport(record: MinimalLegacyRecord, options: ObjectValue | null, prop: string): unknown {\n let state = LegacySupport.get(record);\n if (!state) {\n state = {};\n LegacySupport.set(record, state);\n }\n const suppressDeprecation = Boolean(options && options.suppressDeprecation);\n\n switch (prop) {\n case '_createSnapshot':\n // FIXME should be deprecated too?\n return createSnapshot;\n case 'adapterError':\n // FIXME should be deprecated too?\n return record.currentState.adapterError;\n case 'belongsTo':\n return belongsTo;\n case 'changedAttributes':\n return changedAttributes;\n case 'constructor':\n return (state._constructor = state._constructor || {\n isModel: true,\n name: `Record<${recordIdentifierFor(record).type}>`,\n modelName: recordIdentifierFor(record).type,\n });\n case 'currentState':\n return (state.recordState = state.recordState || new RecordState(record));\n case 'deleteRecord':\n return deleteRecord;\n case 'destroyRecord':\n return suppressDeprecation ? _destroyRecord : destroyRecord;\n case 'dirtyType':\n return record.currentState.dirtyType;\n case 'errors':\n // FIXME should be deprecated too?\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n return (state.errors = state.errors || Errors.create({ __record: record }));\n case 'hasDirtyAttributes':\n return record.currentState.isDirty;\n case 'hasMany':\n return hasMany;\n case 'isDeleted':\n return record.currentState.isDeleted;\n case 'isEmpty':\n return record.currentState.isEmpty;\n case 'isError':\n return record.currentState.isError;\n case 'isLoaded':\n return record.currentState.isLoaded;\n case 'isLoading':\n return record.currentState.isLoading;\n case 'isNew':\n return record.currentState.isNew;\n case 'isSaving':\n return record.currentState.isSaving;\n case 'isValid':\n return record.currentState.isValid;\n case 'reload':\n return suppressDeprecation ? _reload : reload;\n case 'rollbackAttributes':\n return rollbackAttributes;\n case 'save':\n return suppressDeprecation ? _save : save;\n case 'serialize':\n // FIXME should be deprecated too? (is somewhat deprecated via store.serializeRecord)\n return serialize;\n case 'unloadRecord':\n return unloadRecord;\n default:\n assert(`${prop} is not a supported legacy field`, false);\n }\n}\nlegacySupport[Type] = '@legacy';\n\n/**\n * A function which adds the necessary fields to a schema and marks it as\n * being in LegacyMode. This is used to support the legacy features of\n * @warp-drive/legacy/model while migrating to WarpDrive.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';\n * import { Type } from '@warp-drive/core/types/symbols';\n * import type { HasMany } from '@warp-drive/legacy/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n * Using this function require registering the derivations\n * it requires with the schema service.\n *\n * ```ts\n * import { registerDerivations } from '@warp-drive/legacy/model/migration-support';\n *\n * registerDerivations(schema);\n * ```\n *\n * @param schema The schema to add legacy support to.\n * @return The schema with legacy support added.\n * @public\n */\nexport function withDefaults(schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>): LegacyResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n });\n });\n schema.fields.push({\n name: '_isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.objectExtensions = schema.objectExtensions || [];\n schema.objectExtensions.push('deprecated-model-behaviors');\n return schema as LegacyResourceSchema;\n}\n\n/**\n * Adds the necessasary fields to the schema for supporting\n * the deprecated request methods on LegacyMode schemas.\n *\n * Use this instead of `withDefaults` to add the fields\n * and behaviors necessary to support Model-Like capabilities.\n *\n * ```ts\n * import { withRestoredDeprecatedModelRequestBehaviors } from '@warp-drive/legacy/model/migration-support';\n *\n * export const UserSchema = withRestoredDeprecatedModelRequestBehaviors({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * ]\n * });\n * ```\n */\nexport function withRestoredDeprecatedModelRequestBehaviors(\n schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>\n): LegacyResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n options: { suppressDeprecation: true },\n });\n });\n schema.fields.push({\n name: 'isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n return schema as LegacyResourceSchema;\n}\n\n/**\n * A function which registers the necessary derivations to support\n * the LegacyMode features of @warp-drive/legacy/model while migrating to WarpDrive.\n *\n * This must be called in order to use the fields added by {@link withDefaults} or\n * {@link withRestoredDeprecatedModelRequestBehaviors}.\n *\n * @param schema The schema service to register the derivations with.\n * @public\n */\nexport function registerDerivations(schema: SchemaService): void {\n schema.registerDerivation(legacySupport);\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n schema._registerMode('@legacy', {\n belongsTo: {\n get(store: Store, record: object, cacheKey: ResourceKey, field: LegacyBelongsToField) {\n // FIXME field.name here should likely be field.sourceKey || field.name\n return lookupLegacySupport(record as unknown as MinimalLegacyRecord).getBelongsTo(field.name);\n },\n set(store: Store, record: object, cacheKey: ResourceKey, field: LegacyBelongsToField, value: unknown) {\n assertPrivateStore(store);\n store._join(() => {\n // FIXME field.name here should likely be field.sourceKey || field.name\n lookupLegacySupport(record as unknown as MinimalLegacyRecord).setDirtyBelongsTo(field.name, value);\n });\n },\n },\n hasMany: {\n get(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField) {\n // FIXME field.name here should likely be field.sourceKey || field.name\n return lookupLegacySupport(record as unknown as MinimalLegacyRecord).getHasMany(field.name);\n },\n set(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField, value: unknown[]) {\n assertPrivateStore(store);\n store._join(() => {\n const support = lookupLegacySupport(record as unknown as MinimalLegacyRecord);\n // FIXME field.name here should likely be field.sourceKey || field.name\n const manyArray = support.getManyArray(field.name);\n\n manyArray.splice(0, manyArray.length, ...value);\n });\n },\n notify(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField): boolean {\n const support = lookupLegacySupport(record as unknown as MinimalLegacyRecord);\n // FIXME field.name here should likely be field.sourceKey || field.name\n const manyArray = support && support._manyArrayCache[field.name];\n const hasPromise = support && (support._relationshipPromisesCache[field.name] as Promise<unknown> | undefined);\n\n if (manyArray && hasPromise) {\n // do nothing, we will notify the ManyArray directly\n // once the fetch has completed.\n return false;\n }\n\n if (manyArray) {\n notifyInternalSignal((manyArray as unknown as PrivateReactiveResourceArray)[Context].signal);\n\n return true;\n }\n\n return false;\n },\n },\n });\n\n schema.CAUTION_MEGA_DANGER_ZONE_registerExtension!({\n name: 'deprecated-model-behaviors',\n kind: 'object',\n features: {\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n get isReloading() {\n deprecate(\n `record.isReloading is deprecated, please use store.request and either <Request> or getRequuestState to keep track of the request state instead.`,\n false,\n {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n }\n );\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-return\n return this._isReloading;\n },\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n set isReloading(v) {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n this._isReloading = v;\n },\n },\n });\n}\n\n/**\n * A class which provides a schema service that delegates between\n * a primary schema service and one that supports legacy model\n * classes as its schema source.\n *\n * When the primary schema service has a schema for the given\n * resource, it will be used. Otherwise, the fallback schema\n * service will be used.\n *\n * This can be used when incrementally migrating from Models to\n * ReactiveResources by enabling unmigrated Models to continue to\n * provide their own schema information to the application.\n *\n * ```ts\n * import { DelegatingSchemaService } from '@warp-drive/legacy/model/migration-support';\n * import { SchemaService } from '@warp-drive/core/reactive';\n *\n * class AppStore extends Store {\n * createSchemaService() {\n * const schema = new SchemaService();\n * return new DelegatingSchemaService(this, schema);\n * }\n * }\n * ```\n *\n * All calls to register resources, derivations, transformations, hash functions\n * etc. will be delegated to the primary schema service.\n *\n * @class DelegatingSchemaService\n * @public\n */\nexport interface DelegatingSchemaService {\n /**\n * Delegates to whichever of the primary/fallback schema services has a\n * schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.\n */\n attributesDefinitionFor?(resource: ResourceKey | { type: string }): AttributesSchema;\n /**\n * Delegates to whichever of the primary/fallback schema services has a\n * schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.\n */\n relationshipsDefinitionFor?(resource: ResourceKey | { type: string }): RelationshipsSchema;\n /**\n * Whether either the primary or fallback schema service has a schema\n * for the given type.\n */\n doesTypeExist?(type: string): boolean;\n}\n/**\n * See the {@link DelegatingSchemaService | class documentation above} for usage.\n */\nexport class DelegatingSchemaService implements SchemaService {\n /** @internal */\n _preferred!: SchemaService;\n /** @internal */\n _secondary!: SchemaService;\n\n constructor(store: Store, schema: SchemaService) {\n this._preferred = schema;\n this._secondary = buildSchema(store);\n }\n\n /**\n * Whether the given resource's schema is being served by the fallback\n * (legacy Model-derived) schema service rather than the primary one.\n */\n isDelegated(resource: ResourceKey | { type: string }): boolean {\n return !this._preferred.hasResource(resource) && this._secondary.hasResource(resource);\n }\n\n resourceTypes(): Readonly<string[]> {\n return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));\n }\n\n hasResource(resource: ResourceKey | { type: string }): boolean {\n return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);\n }\n hasTrait(type: string): boolean {\n if (this._preferred.hasResource({ type })) {\n return this._preferred.hasTrait(type);\n }\n return this._secondary.hasTrait(type);\n }\n resourceHasTrait(resource: ResourceKey | { type: string }, trait: string): boolean {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resourceHasTrait(resource, trait);\n }\n return this._secondary.resourceHasTrait(resource, trait);\n }\n fields(resource: ResourceKey | { type: string }): Map<string, FieldSchema> {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.fields(resource);\n }\n return this._secondary.fields(resource);\n }\n cacheFields?(resource: { type: string }): Map<string, Exclude<CacheableFieldSchema, IdentityField>> {\n if (this._preferred.hasResource?.(resource)) {\n // @ts-expect-error\n return this._preferred.cacheFields?.(resource);\n }\n\n // @ts-expect-error\n return this._secondary.cacheFields?.(resource);\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n return this._preferred.transformation(field);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n return this._preferred.hashFn(field);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n return this._preferred.derivation(field);\n }\n resource(resource: ResourceKey | { type: string }): ResourceSchema | ObjectSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): void {\n this._preferred.registerResource(schema);\n }\n registerTransformation(transform: Transformation): void {\n this._preferred.registerTransformation(transform);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n this._preferred.registerDerivation(derivation);\n }\n registerHashFn(hashFn: HashFn): void {\n this._preferred.registerHashFn(hashFn);\n }\n\n CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: { kind: 'object' | 'array'; name: string }): boolean {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_hasExtension!(ext);\n }\n\n CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void {\n this._preferred.CAUTION_MEGA_DANGER_ZONE_registerExtension!(extension);\n }\n\n CAUTION_MEGA_DANGER_ZONE_resourceExtensions(\n resource: ResourceKey | { type: string }\n ): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_resourceExtensions!(resource);\n }\n\n CAUTION_MEGA_DANGER_ZONE_objectExtensions(\n field: ExtensibleField,\n resolvedType: string | null\n ): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_objectExtensions!(field, resolvedType);\n }\n\n CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_arrayExtensions!(field);\n }\n\n /**\n * This is an internal method used to register behaviors for legacy mode.\n * It is not intended for public use.\n *\n * We do think a generalized `kind` registration system would be useful,\n * but we have not yet designed it.\n *\n * See https://github.com/warp-drive-data/warp-drive/issues/9534\n *\n * @internal\n */\n _registerMode(mode: string, kinds: unknown): void {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n this._preferred._registerMode(mode, kinds);\n }\n\n /**\n * This is an internal method used to enable legacy behaviors for legacy mode.\n * It is not intended for public use.\n *\n * We do think a generalized `kind` registration system would be useful,\n * but we have not yet designed it.\n *\n * See https://github.com/warp-drive-data/warp-drive/issues/9534\n *\n * @internal\n */\n _kind(mode: string, kind: 'belongsTo' | 'hasMany'): () => unknown {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n return this._preferred._kind(mode, kind) as () => unknown;\n }\n}\n\n/**\n * @internal\n */\nexport interface PrivateDelegatingSchemaService extends DelegatingSchemaService {\n _preferred: SchemaService;\n _secondary: SchemaService;\n}\nfunction assertPrivate(service: DelegatingSchemaService): asserts service is PrivateDelegatingSchemaService {}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n DelegatingSchemaService.prototype.attributesDefinitionFor = function (resource: ResourceKey | { type: string }) {\n assertPrivate(this);\n if (this._preferred.hasResource(resource)) {\n return this._preferred.attributesDefinitionFor!(resource);\n }\n\n return this._secondary.attributesDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (resource: ResourceKey | { type: string }) {\n assertPrivate(this);\n if (this._preferred.hasResource(resource)) {\n return this._preferred.relationshipsDefinitionFor!(resource);\n }\n\n return this._secondary.relationshipsDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.doesTypeExist = function (type: string) {\n assertPrivate(this);\n return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuIA,MAAM2B,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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BAAyBnC,QAAQ;CAC1D;CACAL,wBAAwBuC,UAAUE,6BAA6B,SAAUpC,UAA0C;EAEjH,IAAI,KAAKJ,WAAWK,YAAYD,QAAQ,GACtC,OAAO,KAAKJ,WAAWwC,2BAA4BpC,QAAQ;EAG7D,OAAO,KAAKH,WAAWuC,2BAA4BpC,QAAQ;CAC7D;CACAL,wBAAwBuC,UAAUG,gBAAgB,SAAU3G,MAAc;EAExE,OAAO,KAAKkE,WAAWyC,gBAAgB3G,IAAI,KAAK,KAAKmE,WAAWwC,gBAAgB3G,IAAI,KAAK;CAC3F;AACF"}
|
|
1
|
+
{"version":3,"file":"migration-support.js","names":["deprecate","recordIdentifierFor","Context","notifyInternalSignal","assertPrivateStore","getOrSetGlobal","Type","Errors","lookupLegacySupport","_destroyRecord","_reload","_save","belongsTo","changedAttributes","createSnapshot","deleteRecord","destroyRecord","hasMany","reload","rollbackAttributes","save","serialize","unloadRecord","RecordState","buildSchema","getGlobalConfig","macroCondition","LegacyFields","LegacySupport","WeakMap","legacySupport","record","options","prop","state","get","set","suppressDeprecation","Boolean","currentState","adapterError","_constructor","isModel","name","type","modelName","recordState","dirtyType","errors","create","__record","isDirty","isDeleted","isEmpty","isError","isLoaded","isLoading","isNew","isSaving","isValid","WarpDrive","env","DEBUG","test","Error","withDefaults","schema","legacy","identity","kind","forEach","field","fields","push","defaultValue","objectExtensions","withRestoredDeprecatedModelRequestBehaviors","registerDerivations","registerDerivation","_registerMode","store","cacheKey","getBelongsTo","value","_join","setDirtyBelongsTo","getHasMany","support","manyArray","getManyArray","splice","length","notify","_manyArrayCache","hasPromise","_relationshipPromisesCache","signal","CAUTION_MEGA_DANGER_ZONE_registerExtension","features","isReloading","id","until","for","url","since","enabled","available","_isReloading","v","DelegatingSchemaService","_preferred","_secondary","constructor","isDelegated","resource","hasResource","resourceTypes","Array","from","Set","concat","hasTrait","resourceHasTrait","trait","cacheFields","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","CAUTION_MEGA_DANGER_ZONE_hasExtension","ext","extension","CAUTION_MEGA_DANGER_ZONE_resourceExtensions","CAUTION_MEGA_DANGER_ZONE_objectExtensions","resolvedType","CAUTION_MEGA_DANGER_ZONE_arrayExtensions","mode","kinds","_kind","assertPrivate","service","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"sources":["../../src/model/migration-support.ts"],"sourcesContent":["/**\n * This module provides support for migrating away from @warp-drive/legacy/model\n * to ReactiveResource from @warp-drive/core/reactive.\n *\n * It includes:\n *\n * - A `withDefaults` function to assist in creating a schema in LegacyMode\n * - A `registerDerivations` function to register the derivations necessary to support LegacyMode\n * - A `DelegatingSchemaService` that can be used to provide a schema service that works with both\n * @warp-drive/legacy/model and @warp-drive/core/reactive simultaneously for migration purposes.\n * - A `WithLegacy` type util that can be used to create a type that includes the legacy\n * properties and methods of a record.\n *\n * Using LegacyMode features on a ReactiveResource *requires* the use of these derivations and schema\n * additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone\n * to assist in more rapidly adopting modern WarpDrive features.\n *\n * @summary Legacy helpers for migrating from `Model` to `ReactiveResource`: LegacyMode schema defaults, derivations,\n * types, and a schema service that serves both at once.\n * @module\n */\nimport { deprecate } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { recordIdentifierFor } from '@warp-drive/core';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from '@warp-drive/core/reactive';\nimport type { ExtensibleField } from '@warp-drive/core/reactive/-private';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport { notifyInternalSignal } from '@warp-drive/core/signals/-leaked';\nimport type { PrivateReactiveResourceArray } from '@warp-drive/core/store/-private';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { SchemaService } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { ObjectValue } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core/types/schema/concepts';\nimport type {\n ArrayField,\n CacheableFieldSchema,\n DerivedField,\n FieldSchema,\n GenericField,\n HashField,\n IdentityField,\n LegacyBelongsToField,\n LegacyHasManyField,\n LegacyResourceSchema,\n ObjectField,\n ObjectSchema,\n ResourceSchema,\n} from '@warp-drive/core/types/schema/fields';\nimport { Type } from '@warp-drive/core/types/symbols';\nimport type { WithPartial } from '@warp-drive/core/types/utils';\n\nimport type { Snapshot } from '../compat/-private.ts';\nimport { Errors, lookupLegacySupport } from './-private.ts';\nimport type { MinimalLegacyRecord } from './-private/model-methods.ts';\nimport {\n _destroyRecord,\n _reload,\n _save,\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './-private/model-methods.ts';\nimport RecordState from './-private/record-state.ts';\nimport type BelongsToReference from './-private/references/belongs-to.ts';\nimport type HasManyReference from './-private/references/has-many.ts';\nimport { buildSchema } from './-private/schema-provider.ts';\nimport type { _MaybeBelongsToFields, MaybeHasManyFields } from './-private/type-utils.ts';\n\n/**\n * Adds the `Model`-style `belongsTo`/`hasMany` reference methods to a\n * {@link TypedRecordInstance}, for use when migrating a resource from\n * `Model` to a schema-based record while preserving these APIs.\n *\n * @summary Legacy type that adds the `Model`-style `belongsTo` and `hasMany` reference methods to a typed record\n * migrating from `Model` to a schema-based record.\n */\nexport type WithLegacyDerivations<T extends TypedRecordInstance> = T &\n MinimalLegacyRecord & {\n /**\n * see {@link belongsTo}\n */\n belongsTo: typeof belongsTo;\n /**\n * see {@link hasMany}\n */\n hasMany: typeof hasMany;\n };\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ninterface LegacyModeRecord<T extends TypedRecordInstance> {\n id: string | null;\n\n serialize(options?: Record<string, unknown>): unknown;\n destroyRecord(options?: Record<string, unknown>): Promise<this>;\n unloadRecord(): void;\n changedAttributes(): ChangedAttributesHash;\n rollbackAttributes(): void;\n _createSnapshot(): Snapshot<T>;\n save(options?: Record<string, unknown>): Promise<this>;\n reload(options?: Record<string, unknown>): Promise<T>;\n belongsTo<K extends _MaybeBelongsToFields<T>>(prop: K): BelongsToReference<T, K>;\n hasMany<K extends MaybeHasManyFields<T>>(prop: K): HasManyReference<T, K>;\n deleteRecord(): void;\n\n adapterError: unknown;\n constructor: { modelName: TypeFromInstance<T> };\n currentState: RecordState;\n dirtyType: 'deleted' | 'created' | 'updated' | '';\n errors: unknown;\n hasDirtyAttributes: boolean;\n isDeleted: boolean;\n isEmpty: boolean;\n isError: boolean;\n isLoaded: boolean;\n isLoading: boolean;\n isDestroying: boolean;\n isDestroyed: boolean;\n isNew: boolean;\n isSaving: boolean;\n isValid: boolean;\n}\n\n// 'isDestroying', 'isDestroyed'\nconst LegacyFields = [\n '_createSnapshot',\n 'adapterError',\n 'belongsTo',\n 'changedAttributes',\n 'constructor',\n 'currentState',\n 'deleteRecord',\n 'destroyRecord',\n 'dirtyType',\n 'errors',\n 'hasDirtyAttributes',\n 'hasMany',\n 'isDeleted',\n 'isEmpty',\n 'isError',\n 'isLoaded',\n 'isLoading',\n 'isNew',\n 'isSaving',\n 'isValid',\n 'reload',\n 'rollbackAttributes',\n 'save',\n 'serialize',\n 'unloadRecord',\n] as const;\n\n/**\n * A Type utility that enables quickly adding type information for the fields\n * defined by `import { withDefaults } from '@warp-drive/legacy/model/migration-support'`.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';\n * import { Type } from '@warp-drive/core/types/symbols';\n * import type { HasMany } from '@@warp-drive/legacy/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n * @summary Legacy type that adds the `Model`-style state flags and methods (`save`, `isNew`, `errors`, etc.) that\n * `withDefaults` provides to a LegacyMode record type.\n */\nexport type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;\n\nconst LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap<MinimalLegacyRecord, Record<string, unknown>>());\n\nfunction legacySupport(record: MinimalLegacyRecord, options: ObjectValue | null, prop: string): unknown {\n let state = LegacySupport.get(record);\n if (!state) {\n state = {};\n LegacySupport.set(record, state);\n }\n const suppressDeprecation = Boolean(options && options.suppressDeprecation);\n\n switch (prop) {\n case '_createSnapshot':\n // FIXME should be deprecated too?\n return createSnapshot;\n case 'adapterError':\n // FIXME should be deprecated too?\n return record.currentState.adapterError;\n case 'belongsTo':\n return belongsTo;\n case 'changedAttributes':\n return changedAttributes;\n case 'constructor':\n return (state._constructor = state._constructor || {\n isModel: true,\n name: `Record<${recordIdentifierFor(record).type}>`,\n modelName: recordIdentifierFor(record).type,\n });\n case 'currentState':\n return (state.recordState = state.recordState || new RecordState(record));\n case 'deleteRecord':\n return deleteRecord;\n case 'destroyRecord':\n return suppressDeprecation ? _destroyRecord : destroyRecord;\n case 'dirtyType':\n return record.currentState.dirtyType;\n case 'errors':\n // FIXME should be deprecated too?\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n return (state.errors = state.errors || Errors.create({ __record: record }));\n case 'hasDirtyAttributes':\n return record.currentState.isDirty;\n case 'hasMany':\n return hasMany;\n case 'isDeleted':\n return record.currentState.isDeleted;\n case 'isEmpty':\n return record.currentState.isEmpty;\n case 'isError':\n return record.currentState.isError;\n case 'isLoaded':\n return record.currentState.isLoaded;\n case 'isLoading':\n return record.currentState.isLoading;\n case 'isNew':\n return record.currentState.isNew;\n case 'isSaving':\n return record.currentState.isSaving;\n case 'isValid':\n return record.currentState.isValid;\n case 'reload':\n return suppressDeprecation ? _reload : reload;\n case 'rollbackAttributes':\n return rollbackAttributes;\n case 'save':\n return suppressDeprecation ? _save : save;\n case 'serialize':\n // FIXME should be deprecated too? (is somewhat deprecated via store.serializeRecord)\n return serialize;\n case 'unloadRecord':\n return unloadRecord;\n default:\n assert(`${prop} is not a supported legacy field`, false);\n }\n}\nlegacySupport[Type] = '@legacy';\n\n/**\n * A function which adds the necessary fields to a schema and marks it as\n * being in LegacyMode. This is used to support the legacy features of\n * @warp-drive/legacy/model while migrating to WarpDrive.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@warp-drive/legacy/model/migration-support';\n * import { Type } from '@warp-drive/core/types/symbols';\n * import type { HasMany } from '@warp-drive/legacy/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n * Using this function require registering the derivations\n * it requires with the schema service.\n *\n * ```ts\n * import { registerDerivations } from '@warp-drive/legacy/model/migration-support';\n *\n * registerDerivations(schema);\n * ```\n *\n * @summary Legacy helper that marks a resource schema as LegacyMode and adds the fields that give its records\n * `Model`-like state and methods.\n * @param schema The schema to add legacy support to.\n * @return The schema with legacy support added.\n * @public\n */\nexport function withDefaults(schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>): LegacyResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n });\n });\n schema.fields.push({\n name: '_isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.objectExtensions = schema.objectExtensions || [];\n schema.objectExtensions.push('deprecated-model-behaviors');\n return schema as LegacyResourceSchema;\n}\n\n/**\n * Adds the necessasary fields to the schema for supporting\n * the deprecated request methods on LegacyMode schemas.\n *\n * Use this instead of `withDefaults` to add the fields\n * and behaviors necessary to support Model-Like capabilities.\n *\n * ```ts\n * import { withRestoredDeprecatedModelRequestBehaviors } from '@warp-drive/legacy/model/migration-support';\n *\n * export const UserSchema = withRestoredDeprecatedModelRequestBehaviors({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * ]\n * });\n * ```\n *\n * @summary Legacy alternative to `withDefaults` that makes a LegacyMode schema whose `save`, `reload`, and\n * `destroyRecord` run without deprecation warnings.\n */\nexport function withRestoredDeprecatedModelRequestBehaviors(\n schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>\n): LegacyResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n options: { suppressDeprecation: true },\n });\n });\n schema.fields.push({\n name: 'isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n return schema as LegacyResourceSchema;\n}\n\n/**\n * A function which registers the necessary derivations to support\n * the LegacyMode features of @warp-drive/legacy/model while migrating to WarpDrive.\n *\n * This must be called in order to use the fields added by {@link withDefaults} or\n * {@link withRestoredDeprecatedModelRequestBehaviors}.\n *\n * @summary Legacy setup that registers the derivation, relationship behaviors, and extension a schema service needs to\n * support LegacyMode records.\n * @param schema The schema service to register the derivations with.\n * @public\n */\nexport function registerDerivations(schema: SchemaService): void {\n schema.registerDerivation(legacySupport);\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n schema._registerMode('@legacy', {\n belongsTo: {\n get(store: Store, record: object, cacheKey: ResourceKey, field: LegacyBelongsToField) {\n // FIXME field.name here should likely be field.sourceKey || field.name\n return lookupLegacySupport(record as unknown as MinimalLegacyRecord).getBelongsTo(field.name);\n },\n set(store: Store, record: object, cacheKey: ResourceKey, field: LegacyBelongsToField, value: unknown) {\n assertPrivateStore(store);\n store._join(() => {\n // FIXME field.name here should likely be field.sourceKey || field.name\n lookupLegacySupport(record as unknown as MinimalLegacyRecord).setDirtyBelongsTo(field.name, value);\n });\n },\n },\n hasMany: {\n get(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField) {\n // FIXME field.name here should likely be field.sourceKey || field.name\n return lookupLegacySupport(record as unknown as MinimalLegacyRecord).getHasMany(field.name);\n },\n set(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField, value: unknown[]) {\n assertPrivateStore(store);\n store._join(() => {\n const support = lookupLegacySupport(record as unknown as MinimalLegacyRecord);\n // FIXME field.name here should likely be field.sourceKey || field.name\n const manyArray = support.getManyArray(field.name);\n\n manyArray.splice(0, manyArray.length, ...value);\n });\n },\n notify(store: Store, record: object, cacheKey: ResourceKey, field: LegacyHasManyField): boolean {\n const support = lookupLegacySupport(record as unknown as MinimalLegacyRecord);\n // FIXME field.name here should likely be field.sourceKey || field.name\n const manyArray = support && support._manyArrayCache[field.name];\n const hasPromise = support && (support._relationshipPromisesCache[field.name] as Promise<unknown> | undefined);\n\n if (manyArray && hasPromise) {\n // do nothing, we will notify the ManyArray directly\n // once the fetch has completed.\n return false;\n }\n\n if (manyArray) {\n notifyInternalSignal((manyArray as unknown as PrivateReactiveResourceArray)[Context].signal);\n\n return true;\n }\n\n return false;\n },\n },\n });\n\n schema.CAUTION_MEGA_DANGER_ZONE_registerExtension!({\n name: 'deprecated-model-behaviors',\n kind: 'object',\n features: {\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n get isReloading() {\n deprecate(\n `record.isReloading is deprecated, please use store.request and either <Request> or getRequuestState to keep track of the request state instead.`,\n false,\n {\n id: 'warp-drive:deprecate-legacy-request-methods',\n until: '6.0',\n for: '@warp-drive/core',\n url: 'https://warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',\n since: {\n enabled: '5.7',\n available: '5.7',\n },\n }\n );\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-return\n return this._isReloading;\n },\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n set isReloading(v) {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-assignment\n this._isReloading = v;\n },\n },\n });\n}\n\n/**\n * A class which provides a schema service that delegates between\n * a primary schema service and one that supports legacy model\n * classes as its schema source.\n *\n * When the primary schema service has a schema for the given\n * resource, it will be used. Otherwise, the fallback schema\n * service will be used.\n *\n * This can be used when incrementally migrating from Models to\n * ReactiveResources by enabling unmigrated Models to continue to\n * provide their own schema information to the application.\n *\n * ```ts\n * import { DelegatingSchemaService } from '@warp-drive/legacy/model/migration-support';\n * import { SchemaService } from '@warp-drive/core/reactive';\n *\n * class AppStore extends Store {\n * createSchemaService() {\n * const schema = new SchemaService();\n * return new DelegatingSchemaService(this, schema);\n * }\n * }\n * ```\n *\n * All calls to register resources, derivations, transformations, hash functions\n * etc. will be delegated to the primary schema service.\n *\n * @summary Legacy schema service that serves a resource's schema from the primary service when it has one, and\n * otherwise from its `Model` class, for incremental migration.\n * @class DelegatingSchemaService\n * @public\n */\nexport interface DelegatingSchemaService {\n /**\n * Delegates to whichever of the primary/fallback schema services has a\n * schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.\n */\n attributesDefinitionFor?(resource: ResourceKey | { type: string }): AttributesSchema;\n /**\n * Delegates to whichever of the primary/fallback schema services has a\n * schema for the resource, preferring the primary. See {@link DelegatingSchemaService.isDelegated | isDelegated}.\n */\n relationshipsDefinitionFor?(resource: ResourceKey | { type: string }): RelationshipsSchema;\n /**\n * Whether either the primary or fallback schema service has a schema\n * for the given type.\n */\n doesTypeExist?(type: string): boolean;\n}\n/**\n * See the {@link DelegatingSchemaService | class documentation above} for usage.\n * @summary Legacy schema service that serves a resource's schema from the primary service when it has one, and\n * otherwise from its `Model` class, for incremental migration.\n */\nexport class DelegatingSchemaService implements SchemaService {\n /** @internal */\n _preferred!: SchemaService;\n /** @internal */\n _secondary!: SchemaService;\n\n constructor(store: Store, schema: SchemaService) {\n this._preferred = schema;\n this._secondary = buildSchema(store);\n }\n\n /**\n * Whether the given resource's schema is being served by the fallback\n * (legacy Model-derived) schema service rather than the primary one.\n */\n isDelegated(resource: ResourceKey | { type: string }): boolean {\n return !this._preferred.hasResource(resource) && this._secondary.hasResource(resource);\n }\n\n resourceTypes(): Readonly<string[]> {\n return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));\n }\n\n hasResource(resource: ResourceKey | { type: string }): boolean {\n return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);\n }\n hasTrait(type: string): boolean {\n if (this._preferred.hasResource({ type })) {\n return this._preferred.hasTrait(type);\n }\n return this._secondary.hasTrait(type);\n }\n resourceHasTrait(resource: ResourceKey | { type: string }, trait: string): boolean {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resourceHasTrait(resource, trait);\n }\n return this._secondary.resourceHasTrait(resource, trait);\n }\n fields(resource: ResourceKey | { type: string }): Map<string, FieldSchema> {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.fields(resource);\n }\n return this._secondary.fields(resource);\n }\n cacheFields?(resource: { type: string }): Map<string, Exclude<CacheableFieldSchema, IdentityField>> {\n if (this._preferred.hasResource?.(resource)) {\n // @ts-expect-error\n return this._preferred.cacheFields?.(resource);\n }\n\n // @ts-expect-error\n return this._secondary.cacheFields?.(resource);\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n return this._preferred.transformation(field);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n return this._preferred.hashFn(field);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n return this._preferred.derivation(field);\n }\n resource(resource: ResourceKey | { type: string }): ResourceSchema | ObjectSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): void {\n this._preferred.registerResource(schema);\n }\n registerTransformation(transform: Transformation): void {\n this._preferred.registerTransformation(transform);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n this._preferred.registerDerivation(derivation);\n }\n registerHashFn(hashFn: HashFn): void {\n this._preferred.registerHashFn(hashFn);\n }\n\n CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: { kind: 'object' | 'array'; name: string }): boolean {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_hasExtension!(ext);\n }\n\n CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void {\n this._preferred.CAUTION_MEGA_DANGER_ZONE_registerExtension!(extension);\n }\n\n CAUTION_MEGA_DANGER_ZONE_resourceExtensions(\n resource: ResourceKey | { type: string }\n ): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_resourceExtensions!(resource);\n }\n\n CAUTION_MEGA_DANGER_ZONE_objectExtensions(\n field: ExtensibleField,\n resolvedType: string | null\n ): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_objectExtensions!(field, resolvedType);\n }\n\n CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension['features'] {\n return this._preferred.CAUTION_MEGA_DANGER_ZONE_arrayExtensions!(field);\n }\n\n /**\n * This is an internal method used to register behaviors for legacy mode.\n * It is not intended for public use.\n *\n * We do think a generalized `kind` registration system would be useful,\n * but we have not yet designed it.\n *\n * See https://github.com/warp-drive-data/warp-drive/issues/9534\n *\n * @internal\n */\n _registerMode(mode: string, kinds: unknown): void {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n this._preferred._registerMode(mode, kinds);\n }\n\n /**\n * This is an internal method used to enable legacy behaviors for legacy mode.\n * It is not intended for public use.\n *\n * We do think a generalized `kind` registration system would be useful,\n * but we have not yet designed it.\n *\n * See https://github.com/warp-drive-data/warp-drive/issues/9534\n *\n * @internal\n */\n _kind(mode: string, kind: 'belongsTo' | 'hasMany'): () => unknown {\n // @ts-expect-error\n // oxlint-disable-next-line typescript/no-unsafe-call\n return this._preferred._kind(mode, kind) as () => unknown;\n }\n}\n\n/**\n * @internal\n */\nexport interface PrivateDelegatingSchemaService extends DelegatingSchemaService {\n _preferred: SchemaService;\n _secondary: SchemaService;\n}\nfunction assertPrivate(service: DelegatingSchemaService): asserts service is PrivateDelegatingSchemaService {}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n DelegatingSchemaService.prototype.attributesDefinitionFor = function (resource: ResourceKey | { type: string }) {\n assertPrivate(this);\n if (this._preferred.hasResource(resource)) {\n return this._preferred.attributesDefinitionFor!(resource);\n }\n\n return this._secondary.attributesDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (resource: ResourceKey | { type: string }) {\n assertPrivate(this);\n if (this._preferred.hasResource(resource)) {\n return this._preferred.relationshipsDefinitionFor!(resource);\n }\n\n return this._secondary.relationshipsDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.doesTypeExist = function (type: string) {\n assertPrivate(this);\n return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,MAAM2B,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDhB,MAAMC,gBAAgBvB,eAAe,iCAAiB,IAAIwB,QAAsD,CAAC;AAEjH,SAASC,cAAcC,QAA6BC,SAA6BC,MAAuB;CACtG,IAAIC,QAAQN,cAAcO,IAAIJ,MAAM;CACpC,IAAI,CAACG,OAAO;EACVA,QAAQ,CAAC;EACTN,cAAcQ,IAAIL,QAAQG,KAAK;CACjC;CACA,MAAMG,sBAAsBC,QAAQN,WAAWA,QAAQK,mBAAmB;CAE1E,QAAQJ,MAAR;EACE,KAAK,mBAEH,OAAOnB;EACT,KAAK,gBAEH,OAAOiB,OAAOQ,aAAaC;EAC7B,KAAK,aACH,OAAO5B;EACT,KAAK,qBACH,OAAOC;EACT,KAAK,eACH,OAAQqB,MAAMO,eAAeP,MAAMO,gBAAgB;GACjDC,SAAS;G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CvB,QAAQ;CAC9E;CAEAwB,0CACEnE,OACAoE,cACuC;EACvC,OAAO,KAAK7B,WAAW4B,0CAA2CnE,OAAOoE,YAAY;CACvF;CAEAC,yCAAyCrE,OAA+D;EACtG,OAAO,KAAKuC,WAAW8B,yCAA0CrE,KAAK;CACxE;;;;;;;;;;;;CAaAQ,cAAc8D,MAAcC,OAAsB;EAGhD,KAAKhC,WAAW/B,cAAc8D,MAAMC,KAAK;CAC3C;;;;;;;;;;;;CAaAC,MAAMF,MAAcxE,MAA8C;EAGhE,OAAO,KAAKyC,WAAWiC,MAAMF,MAAMxE,IAAI;CACzC;AACF;AAWA,IAAA3C,eAAAD,gBAAA,CAAA,CAAAmC,UAAAsF,aAAAC,4BAAA,GAAkC;CAChCtC,wBAAwBuC,UAAUC,0BAA0B,SAAUnC,UAA0C;EAE9G,IAAI,KAAKJ,WAAWK,YAAYD,QAAQ,GACtC,OAAO,KAAKJ,WAAWuC,wBAAyBnC,QAAQ;EAG1D,OAAO,KAAKH,WAAWsC,wBAAyBnC,QAAQ;CAC1D;CACAL,wBAAwBuC,UAAUE,6BAA6B,SAAUpC,UAA0C;EAEjH,IAAI,KAAKJ,WAAWK,YAAYD,QAAQ,GACtC,OAAO,KAAKJ,WAAWwC,2BAA4BpC,QAAQ;EAG7D,OAAO,KAAKH,WAAWuC,2BAA4BpC,QAAQ;CAC7D;CACAL,wBAAwBuC,UAAUG,gBAAgB,SAAU3G,MAAc;EAExE,OAAO,KAAKkE,WAAWyC,gBAAgB3G,IAAI,KAAK,KAAKmE,WAAWwC,gBAAgB3G,IAAI,KAAK;CAC3F;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as Snapshot } from "./compat-
|
|
1
|
+
import { m as Snapshot } from "./compat-BZlQ-5eI.js";
|
|
2
2
|
import { Store } from "@warp-drive/core";
|
|
3
3
|
import { LegacyManyArray, PrivateStore, RelatedCollection } from "@warp-drive/core/store/-private";
|
|
4
4
|
import EmberObject from "@ember/object";
|
|
@@ -200,6 +200,8 @@ Polymorphic to polymorphic relationships are supported. Both sides of the relati
|
|
|
200
200
|
must be declared as polymorphic, and the `as` option must be used to declare the abstract
|
|
201
201
|
type each record satisfies on both sides.
|
|
202
202
|
|
|
203
|
+
@summary Legacy `Model` decorator that declares a to-one relationship to another resource type, configured with
|
|
204
|
+
required `async` and `inverse` options.
|
|
203
205
|
@public
|
|
204
206
|
@param type the name of the related resource
|
|
205
207
|
@param options a hash of options
|
|
@@ -234,6 +236,8 @@ In your JS code you should resolve the promise first.
|
|
|
234
236
|
const comments = await post.comments;
|
|
235
237
|
```
|
|
236
238
|
|
|
239
|
+
@summary Legacy promise-like, iterable proxy returned by an async `hasMany` on a `Model`, which templates can
|
|
240
|
+
consume while the related records load.
|
|
237
241
|
@public
|
|
238
242
|
*/
|
|
239
243
|
declare class PromiseManyArray<T = unknown> {
|
|
@@ -2238,6 +2242,8 @@ interface Model {
|
|
|
2238
2242
|
* the class to use as the reactive object for data of resource
|
|
2239
2243
|
* of that type.
|
|
2240
2244
|
*
|
|
2245
|
+
* @summary Legacy base class whose subclasses both define a resource type's schema with `attr`, `belongsTo` and
|
|
2246
|
+
* `hasMany` and serve as its reactive record.
|
|
2241
2247
|
* @public
|
|
2242
2248
|
* @noInheritDoc
|
|
2243
2249
|
* @hideconstructor
|
|
@@ -3100,8 +3106,11 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
3100
3106
|
* `destroyRecord`, and `reload` onto the given `Model` subclass, for
|
|
3101
3107
|
* apps that have not yet migrated off of the deprecated
|
|
3102
3108
|
* `ENABLE_LEGACY_REQUEST_METHODS` behaviors.
|
|
3109
|
+
*
|
|
3110
|
+
* @summary Legacy opt-in that restores the pre-`RequestManager` `save`, `destroyRecord`, `reload`, and `isReloading`
|
|
3111
|
+
* onto a `Model` class without deprecation warnings.
|
|
3103
3112
|
*/
|
|
3104
3113
|
declare function restoreDeprecatedModelRequestBehaviors(ModelKlass: typeof Model): void;
|
|
3105
3114
|
//#endregion
|
|
3106
3115
|
export { belongsTo$1 as S, HasManyReference as _, RecordState as a, RelationshipDecorator as b, hasMany as c, MaybeHasManyFields as d, MaybeRelationshipFields as f, lookupLegacySupport as g, LEGACY_SUPPORT as h, Errors as i, BelongsToReference as l, PromiseBelongsTo as m, ModelStore as n, MinimalLegacyRecord as o, _MaybeBelongsToFields as p, restoreDeprecatedModelRequestBehaviors as r, belongsTo as s, Model as t, MaybeBelongsToFields as u, PromiseManyArray as v, RelationshipOptions as x, NoNull as y };
|
|
3107
|
-
//# sourceMappingURL=model-
|
|
3116
|
+
//# sourceMappingURL=model-BPVLf-rp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-BPVLf-rp.d.ts","names":["belongsTo","ManyArray","ResourceKey","ManyArray","ResourceKey"],"sources":["../src/model/-private/belongs-to.ts","../src/model/-private/promise-many-array.ts","../src/model/-private/references/has-many.ts","../src/model/-private/legacy-relationships-support.ts","../src/model/-private/promise-belongs-to.ts","../src/model/-private/type-utils.ts","../src/model/-private/references/belongs-to.ts","../src/model/-private/model-methods.ts","../src/model/-private/record-state.ts","../src/model/-private/errors.ts","../src/model/-private/model.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAeY,UAAU,qBAAqB;KAE/B,oBAAoB,GAAG;EACjC,OAAO;EACP,iBAAiB,UAAU,iCAAiC,OAAO;EACnE;EACA;EACA;EACA;;;;;;;;;;;;;;;;;;;;;EAsBA;;KAGU,OAAO,KAAK,QAAQ;KAQpB,sBAAsB,MAAM,MAAM,QAAQ,MAAM,aAAa,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmPhEA;iBACAA,YAAU;iBACVA,YAAU,GACxB,MAAM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Ae,OAChD,WAAA,MAAiB,eAAe,KAAK,cAAc,uBAAuB,iBAAiB,uBAC3F,UAAU;;;;;;SAiBL;;;;;;;;;;;iBA2DO,uCAAuC,mBAAmB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as normalizeModelName, t as isElementDescriptor } from "./util-Bnx8nm-D.js";
|
|
2
|
-
import { r as lookupLegacySupport } from "./errors-
|
|
3
|
-
import { n as getModelFactory } from "./schema-provider-
|
|
2
|
+
import { r as lookupLegacySupport } from "./errors-BI0Xugyo.js";
|
|
3
|
+
import { n as getModelFactory } from "./schema-provider-Dyjpau2P.js";
|
|
4
4
|
import { recordIdentifierFor } from "@warp-drive/core";
|
|
5
5
|
import { getOwner, setOwner } from "@ember/application";
|
|
6
6
|
import { StoreMap, assertPrivateStore, setRecordIdentifier } from "@warp-drive/core/store/-private";
|
|
@@ -167,6 +167,8 @@ return new this();
|
|
|
167
167
|
}
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
+
@summary Legacy `Model` decorator that declares an attribute field, optionally converted by a named transform and
|
|
171
|
+
given a `defaultValue`.
|
|
170
172
|
@public
|
|
171
173
|
@param type the attribute type
|
|
172
174
|
@param options a hash of options
|
|
@@ -375,6 +377,8 @@ Polymorphic to polymorphic relationships are supported. Both sides of the relati
|
|
|
375
377
|
must be declared as polymorphic, and the `as` option must be used to declare the abstract
|
|
376
378
|
type each record satisfies on both sides.
|
|
377
379
|
|
|
380
|
+
@summary Legacy `Model` decorator that declares a to-one relationship to another resource type, configured with
|
|
381
|
+
required `async` and `inverse` options.
|
|
378
382
|
@public
|
|
379
383
|
@param type the name of the related resource
|
|
380
384
|
@param options a hash of options
|
|
@@ -592,6 +596,8 @@ Polymorphic to polymorphic relationships are supported. Both sides of the relati
|
|
|
592
596
|
must be declared as polymorphic, and the `as` option must be used to declare the abstract
|
|
593
597
|
type each record satisfies on both sides.
|
|
594
598
|
|
|
599
|
+
@summary Legacy `Model` decorator that declares a to-many relationship to another resource type, configured with
|
|
600
|
+
required `async` and `inverse` options.
|
|
595
601
|
@public
|
|
596
602
|
@param type the name of the related resource
|
|
597
603
|
@param options a hash of options
|
|
@@ -610,6 +616,8 @@ function hasMany(type, options) {
|
|
|
610
616
|
* this to your store's `instantiateRecord` method when configuring the
|
|
611
617
|
* store to use `Model` for schema/record instantiation.
|
|
612
618
|
*
|
|
619
|
+
* @summary Legacy store hook that creates a `Model` instance for a resource key using the `Model` class registered
|
|
620
|
+
* for its type.
|
|
613
621
|
* @public
|
|
614
622
|
*/
|
|
615
623
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
@@ -634,6 +642,7 @@ function instantiateRecord(identifier, createRecordArgs) {
|
|
|
634
642
|
* to your store's `teardownRecord` method when configuring the store to
|
|
635
643
|
* use `Model` for schema/record instantiation.
|
|
636
644
|
*
|
|
645
|
+
* @summary Legacy store hook that destroys a `Model` instance when the store releases its record.
|
|
637
646
|
* @public
|
|
638
647
|
*/
|
|
639
648
|
function teardownRecord(record) {
|
|
@@ -647,6 +656,8 @@ function teardownRecord(record) {
|
|
|
647
656
|
* as `store.modelFor(type)` when the store is configured to use `Model`.
|
|
648
657
|
* Returns the `Model` subclass registered for the given type, if any.
|
|
649
658
|
*
|
|
659
|
+
* @summary Legacy `store.modelFor` implementation that returns the `Model` class registered for a resource type, if
|
|
660
|
+
* there is one.
|
|
650
661
|
* @public
|
|
651
662
|
*/
|
|
652
663
|
/**
|
|
@@ -680,4 +691,4 @@ function secretInit(record, identifier, store) {
|
|
|
680
691
|
|
|
681
692
|
//#endregion
|
|
682
693
|
export { belongsTo as a, hasMany as i, modelFor as n, attr as o, teardownRecord as r, instantiateRecord as t };
|
|
683
|
-
//# sourceMappingURL=model-
|
|
694
|
+
//# sourceMappingURL=model-DdlhdL9V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-DdlhdL9V.js","names":["computed","recordIdentifierFor","RecordStore","isElementDescriptor","getGlobalConfig","macroCondition","_attr","type","options","undefined","meta","kind","isAttribute","sourceKey","key","get","WarpDrive","env","DEBUG","includes","Error","constructor","toString","isDestroyed","isDestroying","cache","getAttr","set","value","identifier","test","id","lid","currentState","isDeleted","cacheKey","currentValue","setAttr","isValid","errors","remove","cleanErrorRequests","attr","desc","args","warn","computed","assertPrivateStore","RecordStore","lookupLegacySupport","isElementDescriptor","normalizeModelName","getGlobalConfig","macroCondition","_belongsTo","type","options","WarpDrive","env","DEBUG","test","Error","async","inverse","length","meta","kind","name","sourceKey","get","key","isDestroying","isDestroyed","support","includes","constructor","toString","Object","prototype","hasOwnProperty","call","identifier","id","getBelongsTo","set","value","_join","setDirtyBelongsTo","belongsTo","arguments","deprecate","computed","assertPrivateStore","RecordStore","dasherize","singularize","lookupLegacySupport","isElementDescriptor","getGlobalConfig","macroCondition","normalizeType","type","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","id","until","for","since","available","enabled","_hasMany","options","env","DEBUG","test","Error","async","meta","kind","name","sourceKey","get","key","includes","constructor","toString","isDestroying","isDestroyed","getHasMany","set","records","support","manyArray","getManyArray","Array","isArray","_join","splice","length","hasMany","arguments","getOwner","setOwner","assertPrivateStore","setRecordIdentifier","StoreMap","getModelFactory","normalizeModelName","macroCondition","getGlobalConfig","recast","context","instantiateRecord","identifier","createRecordArgs","type","createOptions","_createProps","_secretInit","store","cb","secretInit","factory","WarpDrive","env","DEBUG","test","Error","class","create","teardownRecord","record","destroy","modelFor","modelName","isDestroyed","isDestroying","length","maybeFactory","klass","ignoreType","isModel","_forceShim","schema","hasResource","set"],"sources":["../src/model/-private/attr.ts","../src/model/-private/belongs-to.ts","../src/model/-private/has-many.ts","../src/model/-private/hooks.ts"],"sourcesContent":["import { computed } from '@ember/object';\n\nimport { recordIdentifierFor } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { ArrayValue, ObjectValue, PrimitiveValue, Value } from '@warp-drive/core/types/json/raw';\nimport { RecordStore, type TransformName } from '@warp-drive/core/types/symbols';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { Transform } from '../../serializer/transform.ts';\nimport type { Model } from './model.ts';\nimport type { DecoratorPropertyDescriptor } from './util.ts';\nimport { isElementDescriptor } from './util.ts';\n/**\n * Options provided to the attr decorator are\n * supplied to the associated transform. Any\n * key-value pair is valid; however, it is highly\n * recommended to only use statically defined values\n * that could be serialized to JSON.\n *\n * If no transform is provided, the only valid\n * option is `defaultValue`.\n *\n * Examples:\n *\n * ```ts\n * class User extends Model {\n * @attr('string', { defaultValue: 'Anonymous' }) name;\n * @attr('date', { defaultValue: () => new Date() }) createdAt;\n * @attr({ defaultValue: () => ({}) }) preferences;\n * @attr('boolean') hasVerifiedEmail;\n * @attr address;\n * }\n *\n * @class NOTATHING\n */\nexport type AttrOptions<DV = PrimitiveValue | object | unknown[]> = {\n /**\n * The default value for this attribute.\n *\n * Default values can be provided as a value or a function that will be\n * executed to generate the default value.\n *\n * Default values *should not* be stateful (object, arrays, etc.) as\n * they will be shared across all instances of the record.\n *\n */\n defaultValue?: DV extends PrimitiveValue ? DV : () => DV;\n\n /**\n * The name of the field as returned by the API and inserted into the\n * cache if it differs from the name of the decorated property.\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`, then the\n * property should be named `firstName` and `sourceKey` should be set\n * to `'first-name'`.\n *\n * This option is only needed when the value differs from the property name.\n */\n sourceKey?: string;\n};\n\nfunction _attr(type?: string | AttrOptions, options?: AttrOptions) {\n if (typeof type === 'object') {\n options = type;\n type = undefined;\n } else {\n options = options || {};\n }\n\n const meta = {\n type: type,\n kind: 'attribute',\n isAttribute: true,\n options: options,\n sourceKey: options.sourceKey,\n key: null,\n };\n\n return computed({\n get(this: Model, key: string) {\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`\n );\n }\n }\n if (this.isDestroyed || this.isDestroying) {\n return;\n }\n const cache = this[RecordStore].cache;\n return cache.getAttr(recordIdentifierFor(this), meta.sourceKey ?? key);\n },\n set(this: Model, key: string, value: Value) {\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`\n );\n }\n }\n const identifier = recordIdentifierFor(this);\n assert(\n `Attempted to set '${key}' on the deleted record ${identifier.type}:${identifier.id} (${identifier.lid})`,\n !this.currentState.isDeleted\n );\n const cache = this[RecordStore].cache;\n const cacheKey = meta.sourceKey ?? key;\n\n const currentValue = cache.getAttr(identifier, cacheKey);\n if (currentValue !== value) {\n cache.setAttr(identifier, cacheKey, value);\n\n if (!this.isValid) {\n const { errors } = this;\n\n if (errors.get(key)) {\n errors.remove(key);\n this.currentState.cleanErrorRequests();\n }\n }\n }\n\n return value;\n },\n }).meta(meta);\n}\n\n// NOTE: Usage of Explicit ANY\n// -------------------------------------------------------------------\n// any is required here because we are the maximal not the minimal\n// subset of options allowed. If we used unknown, object, or\n// Record<string, unknown> we would get type errors when we try to\n// assert against a more specific implementation with precise options.\n// -------------------------------------------------------------------\n\ntype LooseTransformInstance<V, Raw, Name extends string> = {\n /**\n * value type must match the return type of the deserialize method\n *\n */\n // see note on Explicit ANY above\n // oxlint-disable-next-line typescript/no-explicit-any\n serialize: (value: V, options: any) => Raw;\n /**\n * defaultValue type must match the return type of the deserialize method\n *\n */\n // see note on Explicit ANY above\n // oxlint-disable-next-line typescript/no-explicit-any\n deserialize: (value: Raw, options: any) => V;\n\n [TransformName]: Name;\n};\nexport type TransformHasType = { [TransformName]: string };\n\nexport type TypedTransformInstance<V, T extends string> =\n | LooseTransformInstance<V, string, T>\n | LooseTransformInstance<V, number, T>\n | LooseTransformInstance<V, boolean, T>\n | LooseTransformInstance<V, null, T>\n | LooseTransformInstance<V, ObjectValue, T>\n | LooseTransformInstance<V, ArrayValue, T>\n | LooseTransformInstance<V, string | null, T>\n | LooseTransformInstance<V, number | null, T>\n | LooseTransformInstance<V, boolean | null, T>\n | LooseTransformInstance<V, ObjectValue | null, T>\n | LooseTransformInstance<V, ArrayValue | null, T>;\n\n// see note on Explicit ANY above\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type GetMaybeDeserializeValue<T> = T extends { deserialize: (...args: any[]) => unknown }\n ? ReturnType<T['deserialize']>\n : never;\n\nexport type TypeFromInstance<T> = T extends TransformHasType ? T[typeof TransformName] : never;\nexport type ExtractOptions<T extends TypedTransformInstance<GetMaybeDeserializeValue<T>, TypeFromInstance<T>>> =\n Parameters<T['deserialize']>[1] & Parameters<T['serialize']>[1] & AttrOptions<ReturnType<T['deserialize']>>;\nexport type OptionsFromInstance<T> =\n TypeFromInstance<T> extends never\n ? never\n : GetMaybeDeserializeValue<T> extends never\n ? never\n : T extends TypedTransformInstance<GetMaybeDeserializeValue<T>, TypeFromInstance<T>>\n ? Parameters<T['deserialize']>[1] & Parameters<T['serialize']>[1] & AttrOptions<ReturnType<T['deserialize']>>\n : never;\n\n/**\n * The return type of `void` is a lie to appease TypeScript. The actual return type\n * is a descriptor, but typescript incorrectly insists that decorator functions return\n * `void` or `any`.\n *\n */\nexport type DataDecorator = (target: object, key: string, desc?: DecoratorPropertyDescriptor) => void;\n\n/**\n `attr` defines an attribute on a {@link Model}.\n By default, attributes are passed through as-is, however you can specify an\n optional type to have the value automatically transformed.\n WarpDrive ships with four basic transform types: `string`, `number`,\n `boolean` and `date`. You can define your own transforms by subclassing\n {@link Transform}.\n\n Note that you cannot use `attr` to define an attribute of `id`.\n\n `attr` takes an optional hash as a second parameter, currently\n supported options are:\n\n - `defaultValue`: Pass a string or a function to be called to set the attribute\n to a default value if and only if the key is absent from the payload response.\n\n Example\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('string') username;\n @attr('string') email;\n @attr('boolean', { defaultValue: false }) verified;\n }\n ```\n\n Default value can also be a function. This is useful it you want to return\n a new object for each attribute.\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('string') username;\n @attr('string') email;\n\n @attr({\n defaultValue() {\n return {};\n }\n })\n settings;\n }\n ```\n\n The `options` hash is passed as second argument to a transforms'\n `serialize` and `deserialize` method. This allows to configure a\n transformation and adapt the corresponding value, based on the config:\n\n ```js [app/models/post.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @attr('text', {\n uppercase: true\n })\n text;\n }\n ```\n\n ```js [app/transforms/text.js]\n export default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n @summary Legacy `Model` decorator that declares an attribute field, optionally converted by a named transform and\n given a `defaultValue`.\n @public\n @param type the attribute type\n @param options a hash of options\n*/\nexport function attr(): DataDecorator;\nexport function attr<T>(type: TypeFromInstance<T>): DataDecorator;\nexport function attr(type: string): DataDecorator;\nexport function attr(options: AttrOptions): DataDecorator;\nexport function attr<T>(type: TypeFromInstance<T>, options?: OptionsFromInstance<T>): DataDecorator;\nexport function attr(type: string, options?: AttrOptions & object): DataDecorator;\nexport function attr(target: object, key: string | symbol, desc?: PropertyDescriptor): void; // see note on DataDecorator for why void\nexport function attr(\n type?: string | AttrOptions | object,\n options?: (AttrOptions & object) | string | symbol,\n desc?: PropertyDescriptor\n): DataDecorator | void {\n const args = [type, options, desc];\n // see note on DataDecorator for why void\n return isElementDescriptor(args) ? (_attr()(...args) as void) : _attr(type, options as object);\n}\n","import { warn } from '@ember/debug';\nimport { computed } from '@ember/object';\n\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\n\nimport { lookupLegacySupport } from './legacy-relationships-support.ts';\nimport type { MinimalLegacyRecord } from './model-methods.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { Model } from './model.ts';\nimport { isElementDescriptor, normalizeModelName } from './util.ts';\n\nexport type IsUnknown<T> = unknown extends T ? true : false;\n\nexport type RelationshipOptions<T, Async extends boolean> = {\n async: Async;\n inverse: null | (IsUnknown<T> extends true ? string : keyof NoNull<T> & string);\n polymorphic?: boolean;\n as?: string;\n linksMode?: true;\n resetOnRemoteUpdate?: boolean;\n\n /**\n * The name of the field as returned by the API and inserted into the\n * cache if it differs from the name of the decorated property.\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * relationships: {\n * 'best-friend': { data: { type: 'user', id: '1' } }\n * }\n * }\n * ```\n *\n * But the app desires to use `record.bestFriend`, then the property\n * should be named `bestFriend` and `sourceKey` should be set to\n * `'best-friend'`.\n *\n * This option is only needed when the value differs from the property name.\n */\n sourceKey?: string;\n};\n\nexport type NoNull<T> = Exclude<T, null>;\n// type BelongsToDecoratorObject<getT> = {\n// get: () => getT;\n// // set: (value: Awaited<getT>) => void;\n// set: (value: getT) => void;\n// // init: () => getT;\n// };\n// oxlint-disable-next-line no-unused-vars\nexport type RelationshipDecorator<T> = <This>(target: This, key: string, desc?: PropertyDescriptor) => void; // BelongsToDecoratorObject<getT>;\n\nfunction _belongsTo<T, Async extends boolean>(\n type: string,\n options: RelationshipOptions<T, Async>\n): RelationshipDecorator<T> {\n assert(\n `Expected options.async from @belongsTo('${type}', options) to be a boolean`,\n options && typeof options.async === 'boolean'\n );\n assert(\n `Expected options.inverse from @belongsTo('${type}', options) to be either null or the string type of the related resource.`,\n options.inverse === null || (typeof options.inverse === 'string' && options.inverse.length > 0)\n );\n\n const meta = {\n type: normalizeModelName(type),\n options: options,\n kind: 'belongsTo',\n name: '<Unknown BelongsTo>',\n sourceKey: options.sourceKey,\n };\n\n return computed({\n get<R extends MinimalLegacyRecord>(this: R, key: string) {\n // this is a legacy behavior we may not carry into a new model setup\n // it's better to error on disconnected records so users find errors\n // in their logic.\n if (this.isDestroying || this.isDestroyed) {\n return null;\n }\n const support = lookupLegacySupport(this);\n\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`\n );\n }\n if (Object.prototype.hasOwnProperty.call(options, 'serialize')) {\n warn(\n `You provided a serialize option on the \"${key}\" property in the \"${support.identifier.type}\" class, this belongs in the serializer. See Serializer and it's implementations https://api.emberjs.com/ember-data/release/classes/Serializer`,\n false,\n {\n id: 'ds.model.serialize-option-in-belongs-to',\n }\n );\n }\n\n if (Object.prototype.hasOwnProperty.call(options, 'embedded')) {\n warn(\n `You provided an embedded option on the \"${key}\" property in the \"${support.identifier.type}\" class, this belongs in the serializer. See EmbeddedRecordsMixin https://api.emberjs.com/ember-data/release/classes/EmbeddedRecordsMixin`,\n false,\n {\n id: 'ds.model.embedded-option-in-belongs-to',\n }\n );\n }\n }\n\n return support.getBelongsTo(key);\n },\n set<R extends MinimalLegacyRecord>(this: R, key: string, value: unknown) {\n assert(`Cannot set belongsTo relationship ${key} on a destroyed record`, !this.isDestroying && !this.isDestroyed);\n if (this.isDestroying || this.isDestroyed) {\n return null;\n }\n const support = lookupLegacySupport(this);\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`\n );\n }\n }\n assertPrivateStore(this[RecordStore]);\n this[RecordStore]._join(() => {\n support.setDirtyBelongsTo(key, value);\n });\n\n return support.getBelongsTo(key);\n },\n }).meta(meta);\n}\n\n/**\n `belongsTo` is used to define One-To-One and One-To-Many, and One-To-None\n relationships on a {@link Model}.\n\n `belongsTo` takes a configuration hash as a second parameter, currently\n supported options are:\n\n - `async`: (*required*) A boolean value used to declare whether this is a sync (false) or async (true) relationship.\n - `inverse`: (*required*) A string used to identify the inverse property on a related model, or `null`.\n - `polymorphic`: (*optional*) A boolean value to mark the relationship as polymorphic\n - `as`: (*optional*) A string used to declare the abstract type \"this\" record satisfies for polymorphism.\n\n ### Examples\n\n To declare a **one-to-many** (or many-to-many) relationship, use\n `belongsTo` in combination with `hasMany`:\n\n ```js\n // app/models/comment.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Comment extends Model {\n @belongsTo('post', { async: false, inverse: 'comments' }) post;\n }\n\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('comment', { async: false, inverse: 'post' }) comments;\n }\n ```\n\n To declare a **one-to-one** relationship with managed inverses, use `belongsTo` for both sides:\n\n ```js\n // app/models/author.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Author extends Model {\n @belongsTo('address', { async: true, inverse: 'owner' }) address;\n }\n\n // app/models/address.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Address extends Model {\n @belongsTo('author', { async: true, inverse: 'address' }) owner;\n }\n ```\n\n To declare a **one-to-one** relationship without managed inverses, use `belongsTo` for both sides\n with `null` as the inverse:\n\n ```js\n // app/models/author.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Author extends Model {\n @belongsTo('address', { async: true, inverse: null }) address;\n }\n\n // app/models/address.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Address extends Model {\n @belongsTo('author', { async: true, inverse: null }) owner;\n }\n ```\n\n To declare a one-to-none relationship between two models, use\n `belongsTo` with inverse set to `null` on just one side::\n\n ```js\n // app/models/person.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Person extends Model {\n @belongsTo('person', { async: false, inverse: null }) bestFriend;\n }\n ```\n\n #### Sync vs Async Relationships\n\n WarpDrive fulfills relationships using resource data available in\n the cache.\n\n Sync relationships point directly to the known related resources.\n\n When a relationship is declared as async, if any of the known related\n resources have not been loaded, they will be fetched. The property\n on the record when accessed provides a promise that resolves once\n all resources are loaded.\n\n Async relationships may take advantage of links. On access, if the related\n link has not been loaded, or if any known resources are not available in\n the cache, the fresh state will be fetched using the link.\n\n In contrast to async relationship, accessing a sync relationship\n will error on access when any of the known related resources have\n not been loaded.\n\n If you are using `links` with sync relationships, you have to use\n the BelongsTo reference API to fetch or refresh related resources\n that aren't loaded. For instance, for a `bestFriend` relationship:\n\n ```js\n person.belongsTo('bestFriend').reload();\n ```\n\n #### Polymorphic Relationships\n\n To declare a polymorphic relationship, use `hasMany` with the `polymorphic`\n option set to `true`:\n\n ```js\n // app/models/comment.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Comment extends Model {\n @belongsTo('commentable', { async: false, inverse: 'comments', polymorphic: true }) parent;\n }\n ```\n\n `'commentable'` here is referred to as the \"abstract type\" for the polymorphic\n relationship.\n\n Polymorphic relationships with `inverse: null` will accept any type of record as their content.\n Polymorphic relationships with `inverse` set to a string will only accept records with a matching\n inverse relationships declaring itself as satisfying the abstract type.\n\n Below, 'as' is used to declare the that 'post' record satisfies the abstract type 'commentable'\n for this relationship.\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('comment', { async: false, inverse: 'parent', as: 'commentable' }) comments;\n }\n ```\n\n Note: every Model that declares an inverse to a polymorphic relationship must\n declare itself exactly the same. This is because polymorphism is based on structural\n traits.\n\n Polymorphic to polymorphic relationships are supported. Both sides of the relationship\n must be declared as polymorphic, and the `as` option must be used to declare the abstract\n type each record satisfies on both sides.\n\n @summary Legacy `Model` decorator that declares a to-one relationship to another resource type, configured with\n required `async` and `inverse` options.\n @public\n @param type the name of the related resource\n @param options a hash of options\n*/\n\nexport function belongsTo(): never;\nexport function belongsTo(type: string): never;\nexport function belongsTo<T>(\n type: TypeFromInstance<NoNull<T>>,\n options: RelationshipOptions<T, boolean>\n): RelationshipDecorator<T>;\n// export function belongsTo<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(\n// type: TypeFromInstance<NoNull<T>>,\n// options: RelationshipOptions<T, true>\n// ): RelationshipDecorator<K>;\nexport function belongsTo(type: string, options: RelationshipOptions<unknown, boolean>): RelationshipDecorator<unknown>;\nexport function belongsTo<T>(\n type?: TypeFromInstance<NoNull<T>>,\n options?: RelationshipOptions<T, boolean>\n): RelationshipDecorator<T> {\n if (DEBUG) {\n assert(\n `belongsTo must be invoked with a type and options. Did you mean \\`@belongsTo(${type}, { async: false, inverse: null })\\`?`,\n !isElementDescriptor(arguments as unknown as unknown[])\n );\n }\n return _belongsTo(type!, options!);\n}\n","import { deprecate } from '@ember/debug';\nimport { computed } from '@ember/object';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore } from '@warp-drive/core/store/-private';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\nimport { dasherize, singularize } from '@warp-drive/utilities/string';\n\nimport type { NoNull, RelationshipDecorator, RelationshipOptions } from './belongs-to.ts';\nimport { lookupLegacySupport } from './legacy-relationships-support.ts';\nimport type { MinimalLegacyRecord } from './model-methods.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { Model } from './model.ts';\nimport { isElementDescriptor } from './util.ts';\n\nfunction normalizeType(type: string) {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = singularize(dasherize(type));\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n\nfunction _hasMany<T, Async extends boolean>(\n type: string,\n options: RelationshipOptions<T, Async>\n): RelationshipDecorator<T> {\n assert(`Expected hasMany options.async to be a boolean`, options && typeof options.async === 'boolean');\n\n // Metadata about relationships is stored on the meta of\n // the relationship. This is used for introspection and\n // serialization. Note that `key` is populated lazily\n // the first time the CP is called.\n const meta = {\n type: normalizeType(type),\n options,\n kind: 'hasMany',\n name: '<Unknown BelongsTo>',\n sourceKey: options.sourceKey,\n };\n\n return computed({\n get<R extends MinimalLegacyRecord>(this: R, key: string) {\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`\n );\n }\n }\n if (this.isDestroying || this.isDestroyed) {\n return [];\n }\n return lookupLegacySupport(this).getHasMany(key);\n },\n set<R extends MinimalLegacyRecord>(this: R, key: string, records: T[]) {\n if (DEBUG) {\n if (['currentState'].includes(key)) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`\n );\n }\n }\n const support = lookupLegacySupport(this);\n const manyArray = support.getManyArray(key);\n assert(`You must pass an array of records to set a hasMany relationship`, Array.isArray(records));\n\n assertPrivateStore(this[RecordStore]);\n this[RecordStore]._join(() => {\n manyArray.splice(0, manyArray.length, ...records);\n });\n\n return support.getHasMany(key);\n },\n }).meta(meta);\n}\n\n/**\n `hasMany` is used to define Many-To-One and Many-To-Many, and Many-To-None\n relationships on a {@link Model}.\n\n `hasMany` takes a configuration hash as a second parameter, currently\n supported options are:\n\n - `async`: (*required*) A boolean value used to declare whether this is a sync (false) or async (true) relationship.\n - `inverse`: (*required*) A string used to identify the inverse property on a related model, or `null`.\n - `polymorphic`: (*optional*) A boolean value to mark the relationship as polymorphic\n - `as`: (*optional*) A string used to declare the abstract type \"this\" record satisfies for polymorphism.\n\n ### Examples\n\n To declare a **many-to-one** (or one-to-many) relationship, use\n `belongsTo` in combination with `hasMany`:\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('comment', { async: false, inverse: 'post' }) comments;\n }\n\n\n // app/models/comment.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Comment extends Model {\n @belongsTo('post', { async: false, inverse: 'comments' }) post;\n }\n ```\n\n To declare a **many-to-many** relationship with managed inverses, use `hasMany` for both sides:\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('tag', { async: true, inverse: 'posts' }) tags;\n }\n\n // app/models/tag.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Tag extends Model {\n @hasMany('post', { async: true, inverse: 'tags' }) posts;\n }\n ```\n\n To declare a **many-to-many** relationship without managed inverses, use `hasMany` for both sides\n with `null` as the inverse:\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('tag', { async: true, inverse: null }) tags;\n }\n\n // app/models/tag.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Tag extends Model {\n @hasMany('post', { async: true, inverse: null }) posts;\n }\n ```\n\n To declare a many-to-none relationship between two models, use\n `hasMany` with inverse set to `null` on just one side::\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('category', { async: true, inverse: null }) categories;\n }\n ```\n\n #### Sync vs Async Relationships\n\n WarpDrive fulfills relationships using resource data available in\n the cache.\n\n Sync relationships point directly to the known related resources.\n\n When a relationship is declared as async, if any of the known related\n resources have not been loaded, they will be fetched. The property\n on the record when accessed provides a promise that resolves once\n all resources are loaded.\n\n Async relationships may take advantage of links. On access, if the related\n link has not been loaded, or if any known resources are not available in\n the cache, the fresh state will be fetched using the link.\n\n In contrast to async relationship, accessing a sync relationship\n will error on access when any of the known related resources have\n not been loaded.\n\n If you are using `links` with sync relationships, you have to use\n the HasMany reference API to fetch or refresh related resources\n that aren't loaded. For instance, for a `comments` relationship:\n\n ```js\n post.hasMany('comments').reload();\n ```\n\n #### Polymorphic Relationships\n\n To declare a polymorphic relationship, use `hasMany` with the `polymorphic`\n option set to `true`:\n\n ```js\n // app/models/comment.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class Comment extends Model {\n @belongsTo('commentable', { async: false, inverse: 'comments', polymorphic: true }) parent;\n }\n ```\n\n `'commentable'` here is referred to as the \"abstract type\" for the polymorphic\n relationship.\n\n Polymorphic relationships with `inverse: null` will accept any type of record as their content.\n Polymorphic relationships with `inverse` set to a string will only accept records with a matching\n inverse relationships declaring itself as satisfying the abstract type.\n\n Below, 'as' is used to declare the that 'post' record satisfies the abstract type 'commentable'\n for this relationship.\n\n ```js\n // app/models/post.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class Post extends Model {\n @hasMany('comment', { async: false, inverse: 'parent', as: 'commentable' }) comments;\n }\n ```\n\n Note: every Model that declares an inverse to a polymorphic relationship must\n declare itself exactly the same. This is because polymorphism is based on structural\n traits.\n\n Polymorphic to polymorphic relationships are supported. Both sides of the relationship\n must be declared as polymorphic, and the `as` option must be used to declare the abstract\n type each record satisfies on both sides.\n\n @summary Legacy `Model` decorator that declares a to-many relationship to another resource type, configured with\n required `async` and `inverse` options.\n @public\n @param type the name of the related resource\n @param options a hash of options\n*/\nexport function hasMany(): never;\nexport function hasMany(type: string): never;\nexport function hasMany<T>(\n type: TypeFromInstance<NoNull<T>>,\n options: RelationshipOptions<T, boolean>\n): RelationshipDecorator<T>;\n// export function hasMany<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(\n// type: TypeFromInstance<NoNull<T>>,\n// options: RelationshipOptions<T, true>\n// ): RelationshipDecorator<K>;\nexport function hasMany(type: string, options: RelationshipOptions<unknown, boolean>): RelationshipDecorator<unknown>;\nexport function hasMany<T>(\n type?: TypeFromInstance<NoNull<T>>,\n options?: RelationshipOptions<T, boolean>\n): RelationshipDecorator<T> {\n if (DEBUG) {\n assert(\n `hasMany must be invoked with a type and options. Did you mean \\`@hasMany(${type}, { async: false, inverse: null })\\`?`,\n !isElementDescriptor(arguments as unknown as unknown[])\n );\n }\n return _hasMany(type!, options!);\n}\n","import { getOwner, setOwner } from '@ember/application';\n\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { assertPrivateStore, setRecordIdentifier, type Store, StoreMap } from '@warp-drive/core/store/-private';\nimport type { ResourceKey } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance, TypeFromInstanceOrString } from '@warp-drive/core/types/record';\n\nimport type { Model, ModelStore } from './model.ts';\nimport { getModelFactory } from './schema-provider.ts';\nimport { normalizeModelName } from './util.ts';\n\nfunction recast(context: Store): asserts context is ModelStore {}\n\n/**\n * The `instantiateRecord` hook implementation for use with `Model`. Pass\n * this to your store's `instantiateRecord` method when configuring the\n * store to use `Model` for schema/record instantiation.\n *\n * @summary Legacy store hook that creates a `Model` instance for a resource key using the `Model` class registered\n * for its type.\n * @public\n */\nexport function instantiateRecord(\n this: Store,\n identifier: ResourceKey,\n createRecordArgs?: { [key: string]: unknown }\n): Model {\n const type = identifier.type;\n\n recast(this);\n\n // TODO deprecate allowing unknown args setting\n const createOptions = {\n _createProps: createRecordArgs ?? {},\n // TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for\n _secretInit: {\n identifier,\n store: this,\n cb: secretInit,\n },\n };\n\n // ensure that `getOwner(this)` works inside a model instance\n setOwner(createOptions, getOwner(this)!);\n const factory = getModelFactory(this, type);\n\n assert(`No model was found for '${type}'`, factory);\n return factory.class.create(createOptions);\n}\n\n/**\n * The `teardownRecord` hook implementation for use with `Model`. Pass this\n * to your store's `teardownRecord` method when configuring the store to\n * use `Model` for schema/record instantiation.\n *\n * @summary Legacy store hook that destroys a `Model` instance when the store releases its record.\n * @public\n */\nexport function teardownRecord(record: Model): void {\n assert(\n `expected to receive an instance of Model from @warp-drive/legacy/model. If using a custom model make sure you implement teardownRecord`,\n 'destroy' in record\n );\n record.destroy();\n}\n\n/**\n * The `modelFor` implementation for use with `Model`, exposed on the store\n * as `store.modelFor(type)` when the store is configured to use `Model`.\n * Returns the `Model` subclass registered for the given type, if any.\n *\n * @summary Legacy `store.modelFor` implementation that returns the `Model` class registered for a resource type, if\n * there is one.\n * @public\n */\nexport function modelFor<T>(type: TypeFromInstance<T>): typeof Model | void;\n/**\n * Overload accepting a raw type string instead of a typed record instance.\n *\n * @public\n */\nexport function modelFor(type: string): typeof Model | void;\nexport function modelFor<T>(this: Store, modelName: TypeFromInstanceOrString<T>): typeof Model | void {\n assertPrivateStore(this);\n assert(\n `Attempted to call store.modelFor(), but the store instance has already been destroyed.`,\n !this.isDestroyed && !this.isDestroying\n );\n assert(`You need to pass a model name to the store's modelFor method`, modelName);\n assert(\n `Please pass a proper model name to the store's modelFor method`,\n typeof modelName === 'string' && modelName.length\n );\n recast(this);\n\n const type = normalizeModelName(modelName);\n const maybeFactory = getModelFactory(this, type);\n const klass = maybeFactory && maybeFactory.class ? maybeFactory.class : null;\n\n const ignoreType = !klass || !klass.isModel || this._forceShim;\n if (!ignoreType) {\n return klass;\n }\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n}\n\nfunction secretInit(record: Model, identifier: ResourceKey, store: Store): void {\n setRecordIdentifier(record, identifier);\n StoreMap.set(record, store);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAASM,MAAMC,MAA6BC,SAAuB;CACjE,IAAI,OAAOD,SAAS,UAAU;EAC5BC,UAAUD;EACVA,OAAOE;CACT,OACED,UAAUA,WAAW,CAAC;CAGxB,MAAME,OAAO;EACLH;EACNI,MAAM;EACNC,aAAa;EACJJ;EACTK,WAAWL,QAAQK;EACnBC,KAAK;CACP;CAEA,OAAOd,SAAS;EACde,IAAiBD,KAAa;GAC5B,IAAAT,eAAAD,gBAAA,CAAA,CAAAY,UAAAC,IAAAC,KAAA,GACE;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