@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
package/dist/unpkg/prod-deprecated/{model-fragments-DSqu0ptR.js → model-fragments-ZM4k_mT3.js}
RENAMED
|
@@ -24,6 +24,8 @@ function withArrayDefaults(arrayName, primitiveType) {
|
|
|
24
24
|
* Used as a helper to setup the relevant parts of a fragment schema
|
|
25
25
|
* and add extensions etc.
|
|
26
26
|
*
|
|
27
|
+
* @summary Legacy ModelFragments migration helper that builds a `schema-object` field for a single `fragment:`
|
|
28
|
+
* type with the `ember-object` and `fragment` extensions.
|
|
27
29
|
* @param fragmentType The type of the fragment
|
|
28
30
|
* @param fragmentName The optional name of the fragment. If not provided, it will default to the fragmentType.
|
|
29
31
|
* @returns The schema for a fragment
|
|
@@ -43,6 +45,8 @@ function withFragmentDefaults(fragmentType, fragmentName) {
|
|
|
43
45
|
* Used as a helper to setup the relevant parts of a fragment-array
|
|
44
46
|
* schema and add extensions etc.
|
|
45
47
|
*
|
|
48
|
+
* @summary Legacy ModelFragments migration helper that builds a `schema-array` field of `fragment:` items,
|
|
49
|
+
* defaulting to an empty array, with Ember and fragment-array extensions.
|
|
46
50
|
* @param fragmentArrayType The type of the fragment-array
|
|
47
51
|
* @param fragmentArrayName The name of the fragment-array
|
|
48
52
|
* @returns The schema for a fragment-array
|
|
@@ -70,6 +74,8 @@ function withFragmentArrayDefaults(fragmentArrayType, fragmentArrayName) {
|
|
|
70
74
|
* migrated from `Model`, applying the `ember-object` and `fragment` object
|
|
71
75
|
* extensions and a default `@id` identity field.
|
|
72
76
|
*
|
|
77
|
+
* @summary Legacy ModelFragments migration helper that completes a legacy resource schema with an `id` identity,
|
|
78
|
+
* `Model` defaults, and the `ember-object` and `fragment` extensions.
|
|
73
79
|
* @param schema the partial legacy resource schema to complete
|
|
74
80
|
* @returns the completed resource schema
|
|
75
81
|
*/
|
|
@@ -89,6 +95,9 @@ function withLegacy(schema) {
|
|
|
89
95
|
/**
|
|
90
96
|
* The features added to an array resource by {@link FragmentArrayExtension}, providing
|
|
91
97
|
* a subset of the legacy `ModelFragments` fragment-array API for migrated resources.
|
|
98
|
+
*
|
|
99
|
+
* @summary Legacy `ModelFragments`-compatible array API, such as `addFragment`, `removeFragment`, and
|
|
100
|
+
* `rollbackAttributes`, for reactive arrays migrated off fragments.
|
|
92
101
|
*/
|
|
93
102
|
var FragmentArray = class {
|
|
94
103
|
static {
|
|
@@ -153,6 +162,9 @@ var FragmentArray = class {
|
|
|
153
162
|
/**
|
|
154
163
|
* A schema extension that adds the {@link FragmentArray} API to migrated
|
|
155
164
|
* `ModelFragments` array resources.
|
|
165
|
+
*
|
|
166
|
+
* @summary Legacy schema extension named `fragment-array` that adds the `FragmentArray` API to reactive arrays
|
|
167
|
+
* migrated from `ModelFragments`.
|
|
156
168
|
*/
|
|
157
169
|
const FragmentArrayExtension = {
|
|
158
170
|
kind: "array",
|
|
@@ -165,6 +177,9 @@ const FragmentArrayExtension = {
|
|
|
165
177
|
/**
|
|
166
178
|
* The features added to an object resource by {@link FragmentExtension}, providing
|
|
167
179
|
* a subset of the legacy `ModelFragments` fragment API for migrated resources.
|
|
180
|
+
*
|
|
181
|
+
* @summary Legacy `ModelFragments`-compatible object API, such as `hasDirtyAttributes`, `isFragment`, and
|
|
182
|
+
* `rollbackAttributes`, for reactive objects migrated off fragments.
|
|
168
183
|
*/
|
|
169
184
|
var Fragment = class {
|
|
170
185
|
static {
|
|
@@ -224,6 +239,9 @@ var Fragment = class {
|
|
|
224
239
|
/**
|
|
225
240
|
* A schema extension that adds the {@link Fragment} API to migrated
|
|
226
241
|
* `ModelFragments` object resources.
|
|
242
|
+
*
|
|
243
|
+
* @summary Legacy schema extension named `fragment` that adds the `Fragment` API to reactive objects migrated from
|
|
244
|
+
* `ModelFragments`.
|
|
227
245
|
*/
|
|
228
246
|
const FragmentExtension = {
|
|
229
247
|
kind: "object",
|
|
@@ -237,6 +255,8 @@ const FragmentExtension = {
|
|
|
237
255
|
* Registers the {@link FragmentExtension}/{@link FragmentArrayExtension} schema
|
|
238
256
|
* extensions on the given `SchemaService`, enabling ModelFragments migration support.
|
|
239
257
|
*
|
|
258
|
+
* @summary Legacy setup function that registers the fragment and fragment-array schema extensions on a
|
|
259
|
+
* `SchemaService` to support migrating off ModelFragments.
|
|
240
260
|
* @public
|
|
241
261
|
*/
|
|
242
262
|
function registerFragmentExtensions(schema) {
|
|
@@ -325,10 +345,12 @@ function fragmentsModelFor(modelName) {
|
|
|
325
345
|
* type when ModelFragments support is enabled and no real `Model` subclass
|
|
326
346
|
* is registered for that type.
|
|
327
347
|
*
|
|
348
|
+
* @summary Legacy `store.modelFor` fallback that returns a schema-backed `ShimModelClass` for a type when
|
|
349
|
+
* ModelFragments support is on and no `Model` class exists.
|
|
328
350
|
* @public
|
|
329
351
|
*/
|
|
330
352
|
const modelFor = fragmentsModelFor;
|
|
331
353
|
|
|
332
354
|
//#endregion
|
|
333
355
|
export { FragmentExtension as a, withLegacy as c, withArrayDefaults as d, Fragment as i, withFragmentArrayDefaults as l, modelFor as n, FragmentArray as o, registerFragmentExtensions as r, FragmentArrayExtension as s, fragmentsModelFor as t, withFragmentDefaults as u };
|
|
334
|
-
//# sourceMappingURL=model-fragments-
|
|
356
|
+
//# sourceMappingURL=model-fragments-ZM4k_mT3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-fragments-ZM4k_mT3.js","names":["cached","tracked","Context","g","i","n","FragmentArray","prototype","isDestroying","isDestroyed","hasDirtyAttributes","array","context","path","resourceKey","store","record","peekRecord","root","at","changedAttributes","addFragment","fragment","addObject","createFragment","pushObject","removeFragment","index","indexOf","splice","rollbackAttributes","FragmentArrayExtension","kind","name","features","i","cached","tracked","Context","g","i","n","Fragment","prototype","isDestroying","isDestroyed","hasDirtyAttributes","path","resourceKey","store","record","peekRecord","root","at","changedAttributes","isFragment","$type","field","type","rollbackAttributes","oldValue","cache","getRemoteAttr","setAttr","FragmentExtension","kind","name","features","i","FragmentArrayExtension","FragmentExtension","registerFragmentExtensions","schema","CAUTION_MEGA_DANGER_ZONE_registerExtension","initialize","application","store","lookup","console","warn","name"],"sources":["../../../src/model-fragments/utilities/with-array-defaults.ts","../../../src/model-fragments/utilities/with-fragment-defaults.ts","../../../src/model-fragments/utilities/with-fragment-array-defaults.ts","../../../src/model-fragments/utilities/with-legacy.ts","../../../src/model-fragments/extensions/fragment-array.ts","../../../src/model-fragments/extensions/fragment.ts","../../../src/model-fragments/instance-initializers/fragment-extensions.ts","../../../src/model-fragments/hooks/model-for.ts"],"sourcesContent":["/**\n * Used as a helper to setup the relevant parts of an array\n * schema and add extensions etc.\n *\n * @summary Legacy ModelFragments migration helper that builds an `array` schema field preconfigured with the\n * `ember-object`, `ember-array-like`, and `fragment-array` extensions.\n * @param arrayName The name of the array\n * @param primitiveType The primitive type of items in the array (optional)\n * @returns The schema for an array\n */\nexport function withArrayDefaults<ArrayName extends string, PrimitiveType extends string>(\n arrayName: ArrayName,\n primitiveType?: PrimitiveType\n): PrimitiveType extends undefined\n ? {\n /**\n * This field is an `'array'` schema field.\n */\n kind: 'array';\n /**\n * The name of the array field.\n */\n name: ArrayName;\n /**\n * The array's item type, `'array'` since no `primitiveType` was given.\n */\n type: 'array';\n /**\n * The schema options for this array field.\n */\n options: {\n /**\n * The registered array-schema extensions to apply to this array.\n */\n arrayExtensions: string[];\n };\n }\n : {\n /**\n * This field is an `'array'` schema field.\n */\n kind: 'array';\n /**\n * The name of the array field.\n */\n name: ArrayName;\n /**\n * The array's item type, derived from `primitiveType`.\n */\n type: `array:${PrimitiveType}`;\n /**\n * The schema options for this array field.\n */\n options: {\n /**\n * The registered array-schema extensions to apply to this array.\n */\n arrayExtensions: string[];\n };\n };\n\nexport function withArrayDefaults<ArrayName extends string, PrimitiveType extends string>(\n arrayName: ArrayName,\n primitiveType?: PrimitiveType\n) {\n const type = primitiveType ? (`array:${primitiveType}` as const) : ('array' as const);\n return {\n kind: 'array' as const,\n name: arrayName,\n type,\n options: {\n arrayExtensions: ['ember-object', 'ember-array-like', 'fragment-array'],\n },\n };\n}\n","/**\n * Used as a helper to setup the relevant parts of a fragment schema\n * and add extensions etc.\n *\n * @summary Legacy ModelFragments migration helper that builds a `schema-object` field for a single `fragment:`\n * type with the `ember-object` and `fragment` extensions.\n * @param fragmentType The type of the fragment\n * @param fragmentName The optional name of the fragment. If not provided, it will default to the fragmentType.\n * @returns The schema for a fragment\n */\nexport function withFragmentDefaults<FragmentType extends string, FragmentName extends string>(\n fragmentType: FragmentType,\n fragmentName?: FragmentName\n): {\n /**\n * This field is a `'schema-object'` field, a single fragment.\n */\n kind: 'schema-object';\n /**\n * The resource type of the fragment.\n */\n type: `fragment:${FragmentType}`;\n /**\n * The name of the fragment field.\n */\n name: FragmentType | FragmentName;\n /**\n * The schema options for this fragment field.\n */\n options: {\n /**\n * The registered object-schema extensions to apply to this fragment.\n */\n objectExtensions: string[];\n };\n} {\n return {\n kind: 'schema-object' as const,\n type: `fragment:${fragmentType}` as const,\n name: fragmentName ?? fragmentType,\n options: {\n objectExtensions: ['ember-object', 'fragment'],\n },\n };\n}\n","import { pluralize, singularize } from '@warp-drive/utilities/string';\n\n/**\n * Used as a helper to setup the relevant parts of a fragment-array\n * schema and add extensions etc.\n *\n * @summary Legacy ModelFragments migration helper that builds a `schema-array` field of `fragment:` items,\n * defaulting to an empty array, with Ember and fragment-array extensions.\n * @param fragmentArrayType The type of the fragment-array\n * @param fragmentArrayName The name of the fragment-array\n * @returns The schema for a fragment-array\n */\nexport function withFragmentArrayDefaults<FragmentArrayType extends string, FragmentArrayName extends string>(\n fragmentArrayType: FragmentArrayType,\n fragmentArrayName?: FragmentArrayName\n): {\n /**\n * This field is a `'schema-array'` field, an array of fragments.\n */\n kind: 'schema-array';\n /**\n * The resource type of the fragments contained in this array.\n */\n type: `fragment:${string}`;\n /**\n * The name of the fragment-array field.\n */\n name: string;\n /**\n * The schema options for this fragment-array field.\n */\n options: {\n /**\n * The registered array-schema extensions to apply to this array.\n */\n arrayExtensions: string[];\n /**\n * Whether the array defaults to a non-null empty array when unset.\n */\n defaultValue: boolean;\n };\n} {\n return {\n kind: 'schema-array' as const,\n type: `fragment:${singularize(fragmentArrayType)}` as const,\n name: fragmentArrayName ?? pluralize(fragmentArrayType),\n options: {\n arrayExtensions: ['ember-object', 'ember-array-like', 'fragment-array'],\n defaultValue: true,\n },\n };\n}\n","import type { LegacyResourceSchema, ResourceSchema } from '@warp-drive/core/types/schema/fields';\nimport type { WithPartial } from '@warp-drive/core/types/utils';\n\nimport { withDefaults } from '../../model/migration-support';\n\n/**\n * Used as a helper to setup the relevant parts of a legacy resource schema\n * migrated from `Model`, applying the `ember-object` and `fragment` object\n * extensions and a default `@id` identity field.\n *\n * @summary Legacy ModelFragments migration helper that completes a legacy resource schema with an `id` identity,\n * `Model` defaults, and the `ember-object` and `fragment` extensions.\n * @param schema the partial legacy resource schema to complete\n * @returns the completed resource schema\n */\nexport function withLegacy(schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>): ResourceSchema {\n return withDefaults({\n ...schema,\n identity: { kind: '@id', name: 'id' },\n objectExtensions: ['ember-object', 'fragment'],\n });\n}\n","import { cached, tracked } from '@glimmer/tracking';\n\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension } from '@warp-drive/core/reactive';\nimport { Context, type ManagedArray } from '@warp-drive/core/reactive/-private';\n\nimport type Model from '../../model.ts';\nimport type { WithFragmentArray } from '../index.ts';\nimport type { Fragment } from './fragment.ts';\n\n/**\n * The features added to an array resource by {@link FragmentArrayExtension}, providing\n * a subset of the legacy `ModelFragments` fragment-array API for migrated resources.\n *\n * @summary Legacy `ModelFragments`-compatible array API, such as `addFragment`, `removeFragment`, and\n * `rollbackAttributes`, for reactive arrays migrated off fragments.\n */\nexport class FragmentArray<T extends Fragment> {\n // We might want to check the parent values once we move this code to warp-drive.\n /**\n * Whether this fragment array is in the process of being destroyed.\n */\n @tracked isDestroying = false;\n /**\n * Whether this fragment array has been destroyed.\n */\n @tracked isDestroyed = false;\n\n /**\n * Whether this fragment array (or any of its members) has uncommitted changes.\n */\n @cached\n get hasDirtyAttributes(): boolean {\n const array = this as unknown as ManagedArray;\n const context = array[Context];\n const { path, resourceKey, store } = context;\n const record = store.peekRecord(resourceKey) as Model;\n\n if (record.hasDirtyAttributes && path) {\n const root = path.at(0) as string;\n return root in record.changedAttributes();\n }\n\n return false;\n }\n\n /**\n * Adds an existing fragment to this array, if one was given.\n */\n addFragment(fragment?: T): Fragment[] | undefined {\n if (!fragment) {\n return;\n }\n\n return (this as unknown as WithFragmentArray<T>).addObject(fragment);\n }\n\n /**\n * Appends a new fragment to the end of this array, if one was given.\n */\n createFragment(fragment?: T): Fragment | undefined {\n if (!fragment) {\n return;\n }\n\n return (this as unknown as WithFragmentArray<T>).pushObject(fragment);\n }\n\n /**\n * Removes the given fragment from this array, if present.\n */\n removeFragment(fragment?: T): void {\n if (!fragment) {\n return;\n }\n\n const index = (this as unknown as WithFragmentArray<T>).indexOf(fragment);\n\n if (index !== -1) {\n (this as unknown as WithFragmentArray<T>).splice(index, 1);\n }\n }\n\n /**\n * Reverts each member fragment's attribute back to its last known remote value.\n */\n rollbackAttributes(): void {\n for (const fragment of this as unknown as WithFragmentArray<T>) {\n // @ts-expect-error TODO: fix these types\n fragment?.rollbackAttributes?.();\n }\n }\n}\n\n/**\n * A schema extension that adds the {@link FragmentArray} API to migrated\n * `ModelFragments` array resources.\n *\n * @summary Legacy schema extension named `fragment-array` that adds the `FragmentArray` API to reactive arrays\n * migrated from `ModelFragments`.\n */\nexport const FragmentArrayExtension: {\n /**\n * This extension applies to `'array'` schemas.\n */\n kind: 'array';\n /**\n * The registered name of this extension.\n */\n name: 'fragment-array';\n /**\n * The features ({@link FragmentArray}) added by this extension.\n */\n features: typeof FragmentArray;\n} = {\n kind: 'array' as const,\n name: 'fragment-array' as const,\n features: FragmentArray,\n} satisfies CAUTION_MEGA_DANGER_ZONE_Extension;\n\nexport default FragmentArrayExtension;\n","import { cached, tracked } from '@glimmer/tracking';\n\nimport type { CAUTION_MEGA_DANGER_ZONE_Extension } from '@warp-drive/core/reactive';\nimport type { PrivateReactiveResource } from '@warp-drive/core/reactive/-private';\nimport { Context } from '@warp-drive/core/reactive/-private';\nimport type { Value } from '@warp-drive/core/types/json/raw';\n\nimport type Model from '../../model.ts';\n\n/**\n * The features added to an object resource by {@link FragmentExtension}, providing\n * a subset of the legacy `ModelFragments` fragment API for migrated resources.\n *\n * @summary Legacy `ModelFragments`-compatible object API, such as `hasDirtyAttributes`, `isFragment`, and\n * `rollbackAttributes`, for reactive objects migrated off fragments.\n */\nexport class Fragment {\n // We might want to check the parent values once we move this code to warp-drive.\n /**\n * Whether this fragment is in the process of being destroyed.\n */\n @tracked isDestroying = false;\n /**\n * Whether this fragment has been destroyed.\n */\n @tracked isDestroyed = false;\n\n /**\n * Whether this fragment (or the attribute it is rooted at) has uncommitted changes.\n */\n @cached\n get hasDirtyAttributes(): boolean {\n const { path, resourceKey, store } = (this as unknown as PrivateReactiveResource)[Context];\n const record = store.peekRecord(resourceKey) as Model;\n\n if (record.hasDirtyAttributes && path) {\n const root = path.at(0) as string;\n return root in record.changedAttributes();\n }\n\n return false;\n }\n\n /**\n * Always `true`. Used to distinguish fragments from other resources.\n */\n get isFragment() {\n return true;\n }\n\n /**\n * The resource type of this fragment, if known.\n */\n get $type(): string | null | undefined {\n const { field } = (this as unknown as PrivateReactiveResource)[Context];\n return field?.type;\n }\n\n /**\n * Reverts this fragment's attribute back to its last known remote value.\n */\n rollbackAttributes(this: PrivateReactiveResource): void {\n const { path, resourceKey, store } = this[Context];\n\n if (path) {\n const oldValue = store.cache.getRemoteAttr(resourceKey, path) as Value;\n store.cache.setAttr(resourceKey, path, oldValue);\n }\n }\n}\n\n/**\n * A schema extension that adds the {@link Fragment} API to migrated\n * `ModelFragments` object resources.\n *\n * @summary Legacy schema extension named `fragment` that adds the `Fragment` API to reactive objects migrated from\n * `ModelFragments`.\n */\nexport const FragmentExtension: {\n /**\n * This extension applies to `'object'` schemas.\n */\n kind: 'object';\n /**\n * The registered name of this extension.\n */\n name: 'fragment';\n /**\n * The features ({@link Fragment}) added by this extension.\n */\n features: typeof Fragment;\n} = {\n kind: 'object' as const,\n name: 'fragment' as const,\n features: Fragment,\n} satisfies CAUTION_MEGA_DANGER_ZONE_Extension;\n\nexport default FragmentExtension;\n","import type ApplicationInstance from '@ember/application/instance';\n\nimport type { Store } from '@warp-drive/core';\nimport type { SchemaService } from '@warp-drive/core/types';\n\nimport FragmentArrayExtension from '../extensions/fragment-array.ts';\nimport FragmentExtension from '../extensions/fragment.ts';\n\n/**\n * Registers the {@link FragmentExtension}/{@link FragmentArrayExtension} schema\n * extensions on the given `SchemaService`, enabling ModelFragments migration support.\n *\n * @summary Legacy setup function that registers the fragment and fragment-array schema extensions on a\n * `SchemaService` to support migrating off ModelFragments.\n * @public\n */\nexport function registerFragmentExtensions(schema: SchemaService): void {\n schema.CAUTION_MEGA_DANGER_ZONE_registerExtension?.(FragmentExtension);\n schema.CAUTION_MEGA_DANGER_ZONE_registerExtension?.(FragmentArrayExtension);\n}\n\nexport function initialize(application: ApplicationInstance): void {\n const store = application.lookup('service:store') as Store | undefined;\n\n if (store) {\n registerFragmentExtensions(store.schema);\n } else {\n // oxlint-disable-next-line no-console\n console.warn(\n 'No store service was found, you will need to call `registerFragmentExtensions` manually in your app.'\n );\n }\n}\n\nexport default {\n name: 'fragment-extensions',\n // the cast is required for isolatedDeclarations to determine this default\n // export's type without inference, even though it's a no-op for `tsc`'s checker\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion\n initialize: initialize as (application: ApplicationInstance) => void,\n};\n","import type { Store } from '@warp-drive/core';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\n\ntype KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;\n\n// if modelFor turns out to be a bottleneck we should replace with a Map\n// and clear it during store teardown.\nconst AvailableShims = new WeakMap<Store, Record<string, ShimModelClass>>();\n\nexport function getShimClass<T>(\n store: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n let shims = AvailableShims.get(store);\n\n if (!shims) {\n shims = Object.create(null) as Record<string, ShimModelClass>;\n AvailableShims.set(store, shims);\n }\n\n let shim = shims[modelName];\n if (shim === undefined) {\n shim = shims[modelName] = new ShimModelClass<unknown>(store, modelName);\n }\n\n return shim;\n}\n\nconst AttributeKinds = ['field', 'attribute', 'object', 'array', 'schema-object', 'schema-array'] as const;\n\n// Mimics the static apis of @warp-drive/legacy/model\nexport class ShimModelClass<T = unknown> implements ModelSchema<T> {\n declare __store: Store;\n declare modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;\n constructor(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string) {\n this.__store = store;\n this.modelName = modelName;\n }\n\n get fields(): Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'> {\n const fields = new Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>();\n const fieldSchemas = this.__store.schema.fields({ type: this.modelName });\n\n fieldSchemas.forEach((schema, key) => {\n // @ts-expect-error checking if a string is a valid string\n if (AttributeKinds.includes(schema.kind)) {\n fields.set(key as KeyOrString<T>, 'attribute');\n } else if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n fields.set(key as KeyOrString<T>, schema.kind);\n }\n });\n\n return fields;\n }\n\n get attributes(): Map<KeyOrString<T>, LegacyAttributeField> {\n const attrs = new Map<KeyOrString<T>, LegacyAttributeField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n attrs.set(key as KeyOrString<T>, schema);\n // @ts-expect-error checking if a string is a valid string\n } else if (AttributeKinds.includes(schema.kind)) {\n attrs.set(key as KeyOrString<T>, {\n kind: 'attribute',\n name: key,\n type: null,\n options: (schema.options ?? {}) as Record<string, Value>,\n });\n }\n });\n\n return attrs;\n }\n\n get relationshipsByName(): Map<KeyOrString<T>, LegacyRelationshipField> {\n const rels = new Map<KeyOrString<T>, LegacyRelationshipField>();\n const fields = this.__store.schema.fields({ type: this.modelName });\n\n fields.forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n rels.set(key as KeyOrString<T>, schema);\n }\n });\n\n return rels;\n }\n\n eachAttribute<K extends KeyOrString<T>>(\n callback: (key: K, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n this.attributes.forEach((schema, key) => {\n callback.call(binding, key as K, schema);\n });\n }\n\n eachRelationship<K extends KeyOrString<T>>(\n callback: (key: K, relationship: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'belongsTo' || schema.kind === 'hasMany') {\n callback.call(binding, key as K, schema);\n }\n });\n }\n\n eachTransformedAttribute<K extends KeyOrString<T>>(\n callback: (key: K, type: string | null) => void,\n binding?: T\n ): void {\n this.__store.schema.fields({ type: this.modelName }).forEach((schema, key) => {\n if (schema.kind === 'attribute') {\n const type = schema.type;\n if (type) callback.call(binding, key as K, type);\n }\n });\n }\n}\n\nexport function fragmentsModelFor<T extends TypedRecordInstance>(\n this: Store,\n modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string\n): ShimModelClass<T> {\n return getShimClass(this, modelName);\n}\n\n/**\n * The `modelFor` fallback used to construct a `ShimModelClass` schema for a\n * type when ModelFragments support is enabled and no real `Model` subclass\n * is registered for that type.\n *\n * @summary Legacy `store.modelFor` fallback that returns a schema-backed `ShimModelClass` for a type when\n * ModelFragments support is on and no `Model` class exists.\n * @public\n */\nexport const modelFor: typeof fragmentsModelFor = fragmentsModelFor;\n"],"mappings":";;;;;;;AA6DA,SAAgB,kBACd,WACA,eACA;CAEA,OAAO;EACL,MAAM;EACN,MAAM;EACN,MAJW,gBAAiB,SAAS,kBAA6B;EAKlE,SAAS,EACP,iBAAiB;GAAC;GAAgB;GAAoB;EAAgB,EACxE;CACF;AACF;;;;;;;;;;;;;;AChEA,SAAgB,qBACd,cACA,cAuBA;CACA,OAAO;EACL,MAAM;EACN,MAAM,YAAY;EAClB,MAAM,gBAAgB;EACtB,SAAS,EACP,kBAAkB,CAAC,gBAAgB,UAAU,EAC/C;CACF;AACF;;;;;;;;;;;;;;AChCA,SAAgB,0BACd,mBACA,mBA2BA;CACA,OAAO;EACL,MAAM;EACN,MAAM,YAAY,YAAY,iBAAiB;EAC/C,MAAM,qBAAqB,UAAU,iBAAiB;EACtD,SAAS;GACP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AO,IAAI,IAA6C;EAG9D,AAFe,KAAK,QAAQ,OAAO,OAAO,EAAE,MAAM,KAAK,UAAU,CAE5D,CAAC,CAAC,SAAS,QAAQ,QAAQ;GAC9B,IAAI,OAAO,SAAS,eAAe,OAAO,SAAS,WACjD,KAAK,IAAI,KAAuB,MAAM;EAE1C,CAAC;EAED,OAAO;CACT;CAEA,cACE,UACA,SACM;EACN,KAAK,WAAW,SAAS,QAAQ,QAAQ;GACvC,SAAS,KAAK,SAAS,KAAU,MAAM;EACzC,CAAC;CACH;CAEA,iBACE,UACA,SACM;EACN,KAAK,QAAQ,OAAO,OAAO,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,QAAQ,QAAQ;GAC5E,IAAI,OAAO,SAAS,eAAe,OAAO,SAAS,WACjD,SAAS,KAAK,SAAS,KAAU,MAAM;EAE3C,CAAC;CACH;CAEA,yBACE,UACA,SACM;EACN,KAAK,QAAQ,OAAO,OAAO,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,QAAQ,QAAQ;GAC5E,IAAI,OAAO,SAAS,aAAa;IAC/B,MAAM,OAAO,OAAO;IACpB,IAAI,MAAM,SAAS,KAAK,SAAS,KAAU,IAAI;GACjD;EACF,CAAC;CACH;AACF;AAEA,SAAgB,kBAEd,WACmB;CACnB,OAAO,aAAa,MAAM,SAAS;AACrC;;;;;;;;;;AAWA,MAAa,WAAqC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as FragmentExtension, c as withLegacy, d as withArrayDefaults, i as Fragment, l as withFragmentArrayDefaults, n as modelFor, o as FragmentArray, r as registerFragmentExtensions, s as FragmentArrayExtension, u as withFragmentDefaults } from "./model-fragments-
|
|
1
|
+
import { a as FragmentExtension, c as withLegacy, d as withArrayDefaults, i as Fragment, l as withFragmentArrayDefaults, n as modelFor, o as FragmentArray, r as registerFragmentExtensions, s as FragmentArrayExtension, u as withFragmentDefaults } from "./model-fragments-ZM4k_mT3.js";
|
|
2
2
|
|
|
3
3
|
export { Fragment, FragmentArray, FragmentArrayExtension, FragmentExtension, modelFor, registerFragmentExtensions, withArrayDefaults, withFragmentArrayDefaults, withFragmentDefaults, withLegacy };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as normalizeModelName, t as isElementDescriptor } from "./util-CQQdHX3n.js";
|
|
2
|
-
import { r as lookupLegacySupport } from "./errors-
|
|
3
|
-
import { n as getModelFactory } from "./schema-provider-
|
|
2
|
+
import { r as lookupLegacySupport } from "./errors-DIOUcGAT.js";
|
|
3
|
+
import { n as getModelFactory } from "./schema-provider-NWVqBEkW.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";
|
|
@@ -156,6 +156,8 @@ return new this();
|
|
|
156
156
|
}
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
@summary Legacy `Model` decorator that declares an attribute field, optionally converted by a named transform and
|
|
160
|
+
given a `defaultValue`.
|
|
159
161
|
@public
|
|
160
162
|
@param type the attribute type
|
|
161
163
|
@param options a hash of options
|
|
@@ -346,6 +348,8 @@ Polymorphic to polymorphic relationships are supported. Both sides of the relati
|
|
|
346
348
|
must be declared as polymorphic, and the `as` option must be used to declare the abstract
|
|
347
349
|
type each record satisfies on both sides.
|
|
348
350
|
|
|
351
|
+
@summary Legacy `Model` decorator that declares a to-one relationship to another resource type, configured with
|
|
352
|
+
required `async` and `inverse` options.
|
|
349
353
|
@public
|
|
350
354
|
@param type the name of the related resource
|
|
351
355
|
@param options a hash of options
|
|
@@ -535,6 +539,8 @@ Polymorphic to polymorphic relationships are supported. Both sides of the relati
|
|
|
535
539
|
must be declared as polymorphic, and the `as` option must be used to declare the abstract
|
|
536
540
|
type each record satisfies on both sides.
|
|
537
541
|
|
|
542
|
+
@summary Legacy `Model` decorator that declares a to-many relationship to another resource type, configured with
|
|
543
|
+
required `async` and `inverse` options.
|
|
538
544
|
@public
|
|
539
545
|
@param type the name of the related resource
|
|
540
546
|
@param options a hash of options
|
|
@@ -550,6 +556,8 @@ function hasMany(type, options) {
|
|
|
550
556
|
* this to your store's `instantiateRecord` method when configuring the
|
|
551
557
|
* store to use `Model` for schema/record instantiation.
|
|
552
558
|
*
|
|
559
|
+
* @summary Legacy store hook that creates a `Model` instance for a resource key using the `Model` class registered
|
|
560
|
+
* for its type.
|
|
553
561
|
* @public
|
|
554
562
|
*/
|
|
555
563
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
@@ -570,6 +578,7 @@ function instantiateRecord(identifier, createRecordArgs) {
|
|
|
570
578
|
* to your store's `teardownRecord` method when configuring the store to
|
|
571
579
|
* use `Model` for schema/record instantiation.
|
|
572
580
|
*
|
|
581
|
+
* @summary Legacy store hook that destroys a `Model` instance when the store releases its record.
|
|
573
582
|
* @public
|
|
574
583
|
*/
|
|
575
584
|
function teardownRecord(record) {
|
|
@@ -580,6 +589,8 @@ function teardownRecord(record) {
|
|
|
580
589
|
* as `store.modelFor(type)` when the store is configured to use `Model`.
|
|
581
590
|
* Returns the `Model` subclass registered for the given type, if any.
|
|
582
591
|
*
|
|
592
|
+
* @summary Legacy `store.modelFor` implementation that returns the `Model` class registered for a resource type, if
|
|
593
|
+
* there is one.
|
|
583
594
|
* @public
|
|
584
595
|
*/
|
|
585
596
|
/**
|
|
@@ -601,4 +612,4 @@ function secretInit(record, identifier, store) {
|
|
|
601
612
|
|
|
602
613
|
//#endregion
|
|
603
614
|
export { belongsTo as a, hasMany as i, modelFor as n, attr as o, teardownRecord as r, instantiateRecord as t };
|
|
604
|
-
//# sourceMappingURL=model-
|
|
615
|
+
//# sourceMappingURL=model-wzHTp8Up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-wzHTp8Up.js","names":["computed","recordIdentifierFor","RecordStore","isElementDescriptor","_attr","type","options","undefined","meta","kind","isAttribute","sourceKey","key","get","isDestroyed","isDestroying","cache","getAttr","set","value","identifier","cacheKey","currentValue","setAttr","isValid","errors","remove","currentState","cleanErrorRequests","attr","desc","args","computed","assertPrivateStore","RecordStore","lookupLegacySupport","isElementDescriptor","normalizeModelName","_belongsTo","type","options","meta","kind","name","sourceKey","get","key","isDestroying","isDestroyed","support","getBelongsTo","set","value","_join","setDirtyBelongsTo","belongsTo","computed","assertPrivateStore","RecordStore","dasherize","singularize","lookupLegacySupport","isElementDescriptor","normalizeType","type","result","console","warn","_hasMany","options","meta","kind","name","sourceKey","get","key","isDestroying","isDestroyed","getHasMany","set","records","support","manyArray","getManyArray","_join","splice","length","hasMany","getOwner","setOwner","assertPrivateStore","setRecordIdentifier","StoreMap","getModelFactory","normalizeModelName","recast","context","instantiateRecord","identifier","createRecordArgs","type","createOptions","_createProps","_secretInit","store","cb","secretInit","factory","class","create","teardownRecord","record","destroy","modelFor","modelName","maybeFactory","klass","ignoreType","isModel","_forceShim","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,SAASI,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,OAAOZ,SAAS;EACda,IAAiBD,KAAa;GAQ5B,IAAI,KAAKE,eAAe,KAAKC,cAC3B;GAGF,OADc,KAAKb,YAAY,CAACc,MACnBC,QAAQhB,oBAAoB,IAAI,GAAGO,KAAKG,aAAaC,GAAG;EACvE;EACAM,IAAiBN,KAAaO,OAAc;GAQ1C,MAAMC,aAAanB,oBAAoB,IAAI;GAK3C,MAAMe,QAAQ,KAAKd,YAAY,CAACc;GAChC,MAAMK,WAAWb,KAAKG,aAAaC;GAGnC,IADqBI,MAAMC,QAAQG,YAAYC,QAC3CC,MAAiBH,OAAO;IAC1BH,MAAMO,QAAQH,YAAYC,UAAUF,KAAK;IAEzC,IAAI,CAAC,KAAKK,SAAS;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EACpBC,cAAcH,oBAAoB,CAAC;EAEnCI,aAAa;GACXL;GACAM,OAAO;GACPC,IAAIC;EACN;CACF;CAGAjB,SAASY,eAAeb,SAAS,IAAI,CAAE;CAIvC,OAHgBK,gBAAgB,MAAMO,IAG/BO,CAAO,CAACC,MAAMC,OAAOR,aAAa;AAC3C;;;;;;;;;AAUA,SAAgBS,eAAeC,QAAqB;CAKlDA,OAAOC,QAAQ;AACjB;;;;;;;;;;;;;;;AAkBA,SAAgBC,SAAyBC,WAA6D;CACpGxB,mBAAmB,IAAI;CAYvB,MAAMU,OAAON,mBAAmBoB,SAAS;CACzC,MAAMC,eAAetB,gBAAgB,MAAMO,IAAI;CAC/C,MAAMgB,QAAQD,gBAAgBA,aAAaP,QAAQO,aAAaP,QAAQ;CAGxE,IAAI,EADe,CAACQ,SAAS,CAACA,MAAME,WAAW,KAAKC,aAElD,OAAOH;AAGX;AAEA,SAASV,WAAWK,QAAeb,YAAyBM,OAAoB;CAC9Eb,oBAAoBoB,QAAQb,UAAU;CACtCN,SAAS4B,IAAIT,QAAQP,KAAK;AAC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as belongsTo, i as hasMany, n as modelFor, o as attr, r as teardownRecord, t as instantiateRecord } from "./model-
|
|
2
|
-
import { i as restoreDeprecatedModelRequestBehaviors, r as Model, t as buildSchema } from "./schema-provider-
|
|
1
|
+
import { a as belongsTo, i as hasMany, n as modelFor, o as attr, r as teardownRecord, t as instantiateRecord } from "./model-wzHTp8Up.js";
|
|
2
|
+
import { i as restoreDeprecatedModelRequestBehaviors, r as Model, t as buildSchema } from "./schema-provider-NWVqBEkW.js";
|
|
3
3
|
|
|
4
4
|
export { Model, Model as default, attr, belongsTo, buildSchema, hasMany, instantiateRecord, modelFor, restoreDeprecatedModelRequestBehaviors, teardownRecord };
|
package/dist/unpkg/prod-deprecated/{schema-provider-CTLbab33.js → schema-provider-NWVqBEkW.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as FetchManager, t as upgradeStore } from "./-private-DG7eJX0Y.js";
|
|
2
2
|
import { n as normalizeModelName } from "./util-CQQdHX3n.js";
|
|
3
|
-
import { i as releaseLegacySupport, n as LEGACY_SUPPORT, r as lookupLegacySupport, t as Errors } from "./errors-
|
|
3
|
+
import { i as releaseLegacySupport, n as LEGACY_SUPPORT, r as lookupLegacySupport, t as Errors } from "./errors-DIOUcGAT.js";
|
|
4
4
|
import { n as decorateMethodV2 } from "./runtime--fcdnjmJ-DMTJ0Kb3.js";
|
|
5
5
|
import { recordIdentifierFor, storeFor } from "@warp-drive/core";
|
|
6
6
|
import { getOwner } from "@ember/application";
|
|
@@ -479,6 +479,8 @@ function computeOnce(target, propertyName, desc) {
|
|
|
479
479
|
* the class to use as the reactive object for data of resource
|
|
480
480
|
* of that type.
|
|
481
481
|
*
|
|
482
|
+
* @summary Legacy base class whose subclasses both define a resource type's schema with `attr`, `belongsTo` and
|
|
483
|
+
* `hasMany` and serve as its reactive record.
|
|
482
484
|
* @public
|
|
483
485
|
* @noInheritDoc
|
|
484
486
|
* @hideconstructor
|
|
@@ -1457,6 +1459,9 @@ defineGate(Model.prototype, "isReloading", {
|
|
|
1457
1459
|
* `destroyRecord`, and `reload` onto the given `Model` subclass, for
|
|
1458
1460
|
* apps that have not yet migrated off of the deprecated
|
|
1459
1461
|
* `ENABLE_LEGACY_REQUEST_METHODS` behaviors.
|
|
1462
|
+
*
|
|
1463
|
+
* @summary Legacy opt-in that restores the pre-`RequestManager` `save`, `destroyRecord`, `reload`, and `isReloading`
|
|
1464
|
+
* onto a `Model` class without deprecation warnings.
|
|
1460
1465
|
*/
|
|
1461
1466
|
function restoreDeprecatedModelRequestBehaviors(ModelKlass) {
|
|
1462
1467
|
ModelKlass.prototype.save = _save;
|
|
@@ -1604,6 +1609,8 @@ ModelSchemaProvider.prototype.relationshipsDefinitionFor = function(resource) {
|
|
|
1604
1609
|
* the result of this to your store's `createSchemaService` method when
|
|
1605
1610
|
* configuring the store to use `Model` for schema information.
|
|
1606
1611
|
*
|
|
1612
|
+
* @summary Legacy factory for a schema service that reads resource schemas from an app's `Model` classes, returned from
|
|
1613
|
+
* the store's `createSchemaService` hook.
|
|
1607
1614
|
* @public
|
|
1608
1615
|
*/
|
|
1609
1616
|
function buildSchema(store) {
|
|
@@ -1628,4 +1635,4 @@ function getModelFactory(store, type) {
|
|
|
1628
1635
|
|
|
1629
1636
|
//#endregion
|
|
1630
1637
|
export { save as _, RecordState as a, _save as c, createSnapshot as d, deleteRecord as f, rollbackAttributes as g, reload as h, restoreDeprecatedModelRequestBehaviors as i, belongsTo as l, hasMany as m, getModelFactory as n, _destroyRecord as o, destroyRecord as p, Model as r, _reload as s, buildSchema as t, changedAttributes as u, serialize as v, unloadRecord as y };
|
|
1631
|
-
//# sourceMappingURL=schema-provider-
|
|
1638
|
+
//# sourceMappingURL=schema-provider-NWVqBEkW.js.map
|