@plumix/core 0.5.0 → 0.7.0
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/dist/cache/embedded-tags.d.ts +5 -0
- package/dist/cache/embedded-tags.d.ts.map +1 -0
- package/dist/cache/embedded-tags.js +30 -0
- package/dist/cache/embedded-tags.js.map +1 -0
- package/dist/context/app.d.ts +12 -0
- package/dist/context/app.d.ts.map +1 -1
- package/dist/context/app.js +10 -4
- package/dist/context/app.js.map +1 -1
- package/dist/context/memo.d.ts +22 -0
- package/dist/context/memo.d.ts.map +1 -0
- package/dist/context/memo.js +27 -0
- package/dist/context/memo.js.map +1 -0
- package/dist/context/traced-slots.d.ts +17 -0
- package/dist/context/traced-slots.d.ts.map +1 -0
- package/dist/context/traced-slots.js +57 -0
- package/dist/context/traced-slots.js.map +1 -0
- package/dist/entries/read-service.d.ts +6 -0
- package/dist/entries/read-service.d.ts.map +1 -1
- package/dist/entries/read-service.js +19 -3
- package/dist/entries/read-service.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/errors.d.ts +7 -1
- package/dist/plugin/errors.d.ts.map +1 -1
- package/dist/plugin/errors.js +5 -0
- package/dist/plugin/errors.js.map +1 -1
- package/dist/plugin/fields/builder.d.ts +106 -0
- package/dist/plugin/fields/builder.d.ts.map +1 -0
- package/dist/plugin/fields/builder.js +162 -0
- package/dist/plugin/fields/builder.js.map +1 -0
- package/dist/plugin/fields/color.d.ts +78 -18
- package/dist/plugin/fields/color.d.ts.map +1 -1
- package/dist/plugin/fields/color.js +116 -25
- package/dist/plugin/fields/color.js.map +1 -1
- package/dist/plugin/fields/condition.d.ts +40 -0
- package/dist/plugin/fields/condition.d.ts.map +1 -0
- package/dist/plugin/fields/condition.js +115 -0
- package/dist/plugin/fields/condition.js.map +1 -0
- package/dist/plugin/fields/contributions.d.ts +233 -0
- package/dist/plugin/fields/contributions.d.ts.map +1 -0
- package/dist/plugin/fields/contributions.js +1 -0
- package/dist/plugin/fields/contributions.js.map +1 -0
- package/dist/plugin/fields/entry.d.ts +24 -20
- package/dist/plugin/fields/entry.d.ts.map +1 -1
- package/dist/plugin/fields/entry.js +13 -21
- package/dist/plugin/fields/entry.js.map +1 -1
- package/dist/plugin/fields/errors.d.ts +23 -11
- package/dist/plugin/fields/errors.d.ts.map +1 -1
- package/dist/plugin/fields/errors.js +20 -13
- package/dist/plugin/fields/errors.js.map +1 -1
- package/dist/plugin/fields/group.d.ts +90 -0
- package/dist/plugin/fields/group.d.ts.map +1 -0
- package/dist/plugin/fields/group.js +124 -0
- package/dist/plugin/fields/group.js.map +1 -0
- package/dist/plugin/fields/index.d.ts +22 -45
- package/dist/plugin/fields/index.d.ts.map +1 -1
- package/dist/plugin/fields/index.js +25 -30
- package/dist/plugin/fields/index.js.map +1 -1
- package/dist/plugin/fields/json.d.ts +71 -9
- package/dist/plugin/fields/json.d.ts.map +1 -1
- package/dist/plugin/fields/json.js +110 -16
- package/dist/plugin/fields/json.js.map +1 -1
- package/dist/plugin/fields/link.d.ts +96 -0
- package/dist/plugin/fields/link.d.ts.map +1 -0
- package/dist/plugin/fields/link.js +160 -0
- package/dist/plugin/fields/link.js.map +1 -0
- package/dist/plugin/fields/number.d.ts +86 -13
- package/dist/plugin/fields/number.d.ts.map +1 -1
- package/dist/plugin/fields/number.js +133 -20
- package/dist/plugin/fields/number.js.map +1 -1
- package/dist/plugin/fields/range.d.ts +101 -17
- package/dist/plugin/fields/range.d.ts.map +1 -1
- package/dist/plugin/fields/range.js +153 -38
- package/dist/plugin/fields/range.js.map +1 -1
- package/dist/plugin/fields/reference.d.ts +171 -0
- package/dist/plugin/fields/reference.d.ts.map +1 -0
- package/dist/plugin/fields/reference.js +193 -0
- package/dist/plugin/fields/reference.js.map +1 -0
- package/dist/plugin/fields/repeater.d.ts +111 -8
- package/dist/plugin/fields/repeater.d.ts.map +1 -1
- package/dist/plugin/fields/repeater.js +157 -66
- package/dist/plugin/fields/repeater.js.map +1 -1
- package/dist/plugin/fields/richtext-validate.d.ts +7 -0
- package/dist/plugin/fields/richtext-validate.d.ts.map +1 -1
- package/dist/plugin/fields/richtext-validate.js +11 -5
- package/dist/plugin/fields/richtext-validate.js.map +1 -1
- package/dist/plugin/fields/richtext.d.ts +78 -12
- package/dist/plugin/fields/richtext.d.ts.map +1 -1
- package/dist/plugin/fields/richtext.js +121 -26
- package/dist/plugin/fields/richtext.js.map +1 -1
- package/dist/plugin/fields/select.d.ts +150 -10
- package/dist/plugin/fields/select.d.ts.map +1 -1
- package/dist/plugin/fields/select.js +205 -17
- package/dist/plugin/fields/select.js.map +1 -1
- package/dist/plugin/fields/sub-fields.d.ts +12 -0
- package/dist/plugin/fields/sub-fields.d.ts.map +1 -0
- package/dist/plugin/fields/sub-fields.js +62 -0
- package/dist/plugin/fields/sub-fields.js.map +1 -0
- package/dist/plugin/fields/temporal.d.ts +124 -0
- package/dist/plugin/fields/temporal.d.ts.map +1 -0
- package/dist/plugin/fields/temporal.js +180 -0
- package/dist/plugin/fields/temporal.js.map +1 -0
- package/dist/plugin/fields/term.d.ts +11 -16
- package/dist/plugin/fields/term.d.ts.map +1 -1
- package/dist/plugin/fields/term.js +11 -19
- package/dist/plugin/fields/term.js.map +1 -1
- package/dist/plugin/fields/toggle.d.ts +97 -0
- package/dist/plugin/fields/toggle.d.ts.map +1 -0
- package/dist/plugin/fields/toggle.js +135 -0
- package/dist/plugin/fields/toggle.js.map +1 -0
- package/dist/plugin/fields/user.d.ts +14 -26
- package/dist/plugin/fields/user.d.ts.map +1 -1
- package/dist/plugin/fields/user.js +11 -25
- package/dist/plugin/fields/user.js.map +1 -1
- package/dist/plugin/lookup.d.ts +74 -10
- package/dist/plugin/lookup.d.ts.map +1 -1
- package/dist/plugin/manifest.d.ts +319 -160
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +94 -4
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/setup-context.d.ts +10 -4
- package/dist/plugin/setup-context.d.ts.map +1 -1
- package/dist/plugin/setup-context.js +10 -3
- package/dist/plugin/setup-context.js.map +1 -1
- package/dist/plugin/validation/meta-box-fields.d.ts.map +1 -1
- package/dist/plugin/validation/meta-box-fields.js +16 -0
- package/dist/plugin/validation/meta-box-fields.js.map +1 -1
- package/dist/route/render/asset-manifest.d.ts +1 -1
- package/dist/route/render/asset-manifest.d.ts.map +1 -1
- package/dist/route/render/asset-manifest.js +7 -1
- package/dist/route/render/asset-manifest.js.map +1 -1
- package/dist/route/render/build-resolved-entries.d.ts.map +1 -1
- package/dist/route/render/build-resolved-entries.js +25 -12
- package/dist/route/render/build-resolved-entries.js.map +1 -1
- package/dist/route/render/render-template.d.ts +1 -1
- package/dist/route/render/render-template.d.ts.map +1 -1
- package/dist/route/render/render-template.js +50 -23
- package/dist/route/render/render-template.js.map +1 -1
- package/dist/route/render/template-builders.d.ts +15 -10
- package/dist/route/render/template-builders.d.ts.map +1 -1
- package/dist/route/render/template-builders.js.map +1 -1
- package/dist/rpc/base.d.ts +7 -0
- package/dist/rpc/base.d.ts.map +1 -1
- package/dist/rpc/errors.d.ts +7 -0
- package/dist/rpc/errors.d.ts.map +1 -1
- package/dist/rpc/errors.js +16 -0
- package/dist/rpc/errors.js.map +1 -1
- package/dist/rpc/meta/core.d.ts +92 -14
- package/dist/rpc/meta/core.d.ts.map +1 -1
- package/dist/rpc/meta/core.js +524 -406
- package/dist/rpc/meta/core.js.map +1 -1
- package/dist/rpc/meta/field-messages.d.ts +67 -0
- package/dist/rpc/meta/field-messages.d.ts.map +1 -0
- package/dist/rpc/meta/field-messages.js +67 -0
- package/dist/rpc/meta/field-messages.js.map +1 -0
- package/dist/rpc/meta/field-pipeline.d.ts +52 -0
- package/dist/rpc/meta/field-pipeline.d.ts.map +1 -0
- package/dist/rpc/meta/field-pipeline.js +501 -0
- package/dist/rpc/meta/field-pipeline.js.map +1 -0
- package/dist/rpc/procedures/auth/allowed-domains/create.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/create.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/delete.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/index.d.ts +28 -0
- package/dist/rpc/procedures/auth/allowed-domains/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/update.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/update.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/admin-list.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/admin-list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/admin-revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/admin-revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/create.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/create.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/index.d.ts +35 -0
- package/dist/rpc/procedures/auth/api-tokens/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/delete.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/credentials/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/rename.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/rename.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/approve.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/approve.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/deny.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/deny.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/device-flow/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/lookup.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/index.d.ts +154 -0
- package/dist/rpc/procedures/auth/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/login-links.d.ts +7 -0
- package/dist/rpc/procedures/auth/login-links.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/mailer/index.d.ts +7 -0
- package/dist/rpc/procedures/auth/mailer/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/mailer/test-send.d.ts +7 -0
- package/dist/rpc/procedures/auth/mailer/test-send.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/oauth-providers.d.ts +7 -0
- package/dist/rpc/procedures/auth/oauth-providers.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/session.d.ts +7 -0
- package/dist/rpc/procedures/auth/session.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/sessions/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/revoke-others.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/revoke-others.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/activity.d.ts +7 -0
- package/dist/rpc/procedures/entry/activity.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/bulk.d.ts +21 -0
- package/dist/rpc/procedures/entry/bulk.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create-preview-link.d.ts +7 -0
- package/dist/rpc/procedures/entry/create-preview-link.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create.d.ts +8 -1
- package/dist/rpc/procedures/entry/create.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create.js +8 -8
- package/dist/rpc/procedures/entry/create.js.map +1 -1
- package/dist/rpc/procedures/entry/dashboard.d.ts +14 -0
- package/dist/rpc/procedures/entry/dashboard.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/delete-permanent.d.ts +7 -0
- package/dist/rpc/procedures/entry/delete-permanent.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/discard-draft.d.ts +7 -0
- package/dist/rpc/procedures/entry/discard-draft.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/duplicate.d.ts +7 -0
- package/dist/rpc/procedures/entry/duplicate.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/duplicate.js +2 -2
- package/dist/rpc/procedures/entry/duplicate.js.map +1 -1
- package/dist/rpc/procedures/entry/get.d.ts +7 -0
- package/dist/rpc/procedures/entry/get.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/get.js +2 -2
- package/dist/rpc/procedures/entry/get.js.map +1 -1
- package/dist/rpc/procedures/entry/index.d.ts +156 -2
- package/dist/rpc/procedures/entry/index.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/list.d.ts +7 -0
- package/dist/rpc/procedures/entry/list.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/lookup.d.ts +8 -2
- package/dist/rpc/procedures/entry/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/lookup.js +74 -12
- package/dist/rpc/procedures/entry/lookup.js.map +1 -1
- package/dist/rpc/procedures/entry/meta.d.ts +37 -3
- package/dist/rpc/procedures/entry/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/meta.js +63 -7
- package/dist/rpc/procedures/entry/meta.js.map +1 -1
- package/dist/rpc/procedures/entry/publish.d.ts +7 -0
- package/dist/rpc/procedures/entry/publish.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/publish.js +6 -4
- package/dist/rpc/procedures/entry/publish.js.map +1 -1
- package/dist/rpc/procedures/entry/refresh-block-loader.d.ts +7 -0
- package/dist/rpc/procedures/entry/refresh-block-loader.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/restore.d.ts +7 -0
- package/dist/rpc/procedures/entry/restore.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/revisions.d.ts +56 -0
- package/dist/rpc/procedures/entry/revisions.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/schemas.d.ts +2 -2
- package/dist/rpc/procedures/entry/schemas.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/schemas.js +9 -2
- package/dist/rpc/procedures/entry/schemas.js.map +1 -1
- package/dist/rpc/procedures/entry/trash.d.ts +7 -0
- package/dist/rpc/procedures/entry/trash.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/update.d.ts +8 -1
- package/dist/rpc/procedures/entry/update.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/update.js +77 -18
- package/dist/rpc/procedures/entry/update.js.map +1 -1
- package/dist/rpc/procedures/lookup/index.d.ts +14 -0
- package/dist/rpc/procedures/lookup/index.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/list.d.ts +7 -0
- package/dist/rpc/procedures/lookup/list.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/resolve.d.ts +7 -0
- package/dist/rpc/procedures/lookup/resolve.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/resolve.js +1 -1
- package/dist/rpc/procedures/lookup/resolve.js.map +1 -1
- package/dist/rpc/procedures/lookup.errors.d.ts +2 -1
- package/dist/rpc/procedures/lookup.errors.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup.errors.js +3 -0
- package/dist/rpc/procedures/lookup.errors.js.map +1 -1
- package/dist/rpc/procedures/search/index.d.ts +7 -0
- package/dist/rpc/procedures/search/index.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/get.d.ts +7 -0
- package/dist/rpc/procedures/settings/get.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/index.d.ts +14 -0
- package/dist/rpc/procedures/settings/index.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/upsert.d.ts +7 -0
- package/dist/rpc/procedures/settings/upsert.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/upsert.js +9 -0
- package/dist/rpc/procedures/settings/upsert.js.map +1 -1
- package/dist/rpc/procedures/term/create.d.ts +7 -0
- package/dist/rpc/procedures/term/create.d.ts.map +1 -1
- package/dist/rpc/procedures/term/create.js +3 -3
- package/dist/rpc/procedures/term/create.js.map +1 -1
- package/dist/rpc/procedures/term/delete.d.ts +7 -0
- package/dist/rpc/procedures/term/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/term/get.d.ts +7 -0
- package/dist/rpc/procedures/term/get.d.ts.map +1 -1
- package/dist/rpc/procedures/term/index.d.ts +35 -0
- package/dist/rpc/procedures/term/index.d.ts.map +1 -1
- package/dist/rpc/procedures/term/list.d.ts +7 -0
- package/dist/rpc/procedures/term/list.d.ts.map +1 -1
- package/dist/rpc/procedures/term/lookup.d.ts +7 -2
- package/dist/rpc/procedures/term/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/term/lookup.js +29 -8
- package/dist/rpc/procedures/term/lookup.js.map +1 -1
- package/dist/rpc/procedures/term/meta.d.ts +3 -2
- package/dist/rpc/procedures/term/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/term/meta.js +7 -5
- package/dist/rpc/procedures/term/meta.js.map +1 -1
- package/dist/rpc/procedures/term/update.d.ts +7 -0
- package/dist/rpc/procedures/term/update.d.ts.map +1 -1
- package/dist/rpc/procedures/term/update.js +4 -4
- package/dist/rpc/procedures/term/update.js.map +1 -1
- package/dist/rpc/procedures/user/cancel-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/cancel-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/delete.d.ts +7 -0
- package/dist/rpc/procedures/user/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/user/disable.d.ts +7 -0
- package/dist/rpc/procedures/user/disable.d.ts.map +1 -1
- package/dist/rpc/procedures/user/enable.d.ts +7 -0
- package/dist/rpc/procedures/user/enable.d.ts.map +1 -1
- package/dist/rpc/procedures/user/get.d.ts +7 -0
- package/dist/rpc/procedures/user/get.d.ts.map +1 -1
- package/dist/rpc/procedures/user/get.js +2 -2
- package/dist/rpc/procedures/user/get.js.map +1 -1
- package/dist/rpc/procedures/user/index.d.ts +77 -0
- package/dist/rpc/procedures/user/index.d.ts.map +1 -1
- package/dist/rpc/procedures/user/invite.d.ts +7 -0
- package/dist/rpc/procedures/user/invite.d.ts.map +1 -1
- package/dist/rpc/procedures/user/list.d.ts +7 -0
- package/dist/rpc/procedures/user/list.d.ts.map +1 -1
- package/dist/rpc/procedures/user/lookup.d.ts +6 -2
- package/dist/rpc/procedures/user/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/user/lookup.js +29 -0
- package/dist/rpc/procedures/user/lookup.js.map +1 -1
- package/dist/rpc/procedures/user/meta.d.ts +3 -2
- package/dist/rpc/procedures/user/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/user/meta.js +7 -5
- package/dist/rpc/procedures/user/meta.js.map +1 -1
- package/dist/rpc/procedures/user/pending-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/pending-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/request-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/request-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/set-locale.d.ts +7 -0
- package/dist/rpc/procedures/user/set-locale.d.ts.map +1 -1
- package/dist/rpc/procedures/user/update.d.ts +7 -0
- package/dist/rpc/procedures/user/update.d.ts.map +1 -1
- package/dist/rpc/procedures/user/update.js +4 -4
- package/dist/rpc/procedures/user/update.js.map +1 -1
- package/dist/rpc/router.d.ts +457 -2
- package/dist/rpc/router.d.ts.map +1 -1
- package/dist/rpc/validation.d.ts +1 -0
- package/dist/rpc/validation.d.ts.map +1 -1
- package/dist/rpc/validation.js +1 -0
- package/dist/rpc/validation.js.map +1 -1
- package/dist/runtime/dispatcher.d.ts.map +1 -1
- package/dist/runtime/dispatcher.js +90 -39
- package/dist/runtime/dispatcher.js.map +1 -1
- package/dist/seo/feed.d.ts.map +1 -1
- package/dist/seo/feed.js +7 -1
- package/dist/seo/feed.js.map +1 -1
- package/dist/settings-core.js +1 -1
- package/dist/settings-core.js.map +1 -1
- package/dist/telemetry-otel.d.ts +29 -0
- package/dist/telemetry-otel.d.ts.map +1 -0
- package/dist/telemetry-otel.js +218 -0
- package/dist/telemetry-otel.js.map +1 -0
- package/dist/template-deps-core.d.ts.map +1 -1
- package/dist/template-deps-core.js +31 -14
- package/dist/template-deps-core.js.map +1 -1
- package/dist/template-deps.d.ts.map +1 -1
- package/dist/template-deps.js +12 -8
- package/dist/template-deps.js.map +1 -1
- package/dist/template-registry.d.ts +0 -16
- package/dist/template-registry.d.ts.map +1 -1
- package/dist/terms/read-service.js +2 -2
- package/dist/terms/read-service.js.map +1 -1
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4 -0
- package/dist/test/index.js.map +1 -1
- package/dist/test/traced-context.d.ts +17 -0
- package/dist/test/traced-context.d.ts.map +1 -0
- package/dist/test/traced-context.js +28 -0
- package/dist/test/traced-context.js.map +1 -0
- package/package.json +6 -2
- package/dist/plugin/fields/checkbox.d.ts +0 -19
- package/dist/plugin/fields/checkbox.d.ts.map +0 -1
- package/dist/plugin/fields/checkbox.js +0 -20
- package/dist/plugin/fields/checkbox.js.map +0 -1
- package/dist/plugin/fields/date.d.ts +0 -24
- package/dist/plugin/fields/date.d.ts.map +0 -1
- package/dist/plugin/fields/date.js +0 -23
- package/dist/plugin/fields/date.js.map +0 -1
- package/dist/plugin/fields/datetime.d.ts +0 -26
- package/dist/plugin/fields/datetime.d.ts.map +0 -1
- package/dist/plugin/fields/datetime.js +0 -25
- package/dist/plugin/fields/datetime.js.map +0 -1
- package/dist/plugin/fields/email.d.ts +0 -17
- package/dist/plugin/fields/email.d.ts.map +0 -1
- package/dist/plugin/fields/email.js +0 -18
- package/dist/plugin/fields/email.js.map +0 -1
- package/dist/plugin/fields/entry-list.d.ts +0 -28
- package/dist/plugin/fields/entry-list.d.ts.map +0 -1
- package/dist/plugin/fields/entry-list.js +0 -31
- package/dist/plugin/fields/entry-list.js.map +0 -1
- package/dist/plugin/fields/multiselect.d.ts +0 -21
- package/dist/plugin/fields/multiselect.d.ts.map +0 -1
- package/dist/plugin/fields/multiselect.js +0 -43
- package/dist/plugin/fields/multiselect.js.map +0 -1
- package/dist/plugin/fields/password.d.ts +0 -24
- package/dist/plugin/fields/password.d.ts.map +0 -1
- package/dist/plugin/fields/password.js +0 -25
- package/dist/plugin/fields/password.js.map +0 -1
- package/dist/plugin/fields/radio.d.ts +0 -16
- package/dist/plugin/fields/radio.d.ts.map +0 -1
- package/dist/plugin/fields/radio.js +0 -17
- package/dist/plugin/fields/radio.js.map +0 -1
- package/dist/plugin/fields/repeater-validate.d.ts +0 -34
- package/dist/plugin/fields/repeater-validate.d.ts.map +0 -1
- package/dist/plugin/fields/repeater-validate.js +0 -104
- package/dist/plugin/fields/repeater-validate.js.map +0 -1
- package/dist/plugin/fields/term-list.d.ts +0 -27
- package/dist/plugin/fields/term-list.d.ts.map +0 -1
- package/dist/plugin/fields/term-list.js +0 -30
- package/dist/plugin/fields/term-list.js.map +0 -1
- package/dist/plugin/fields/text.d.ts +0 -37
- package/dist/plugin/fields/text.d.ts.map +0 -1
- package/dist/plugin/fields/text.js +0 -31
- package/dist/plugin/fields/text.js.map +0 -1
- package/dist/plugin/fields/textarea.d.ts +0 -20
- package/dist/plugin/fields/textarea.d.ts.map +0 -1
- package/dist/plugin/fields/textarea.js +0 -21
- package/dist/plugin/fields/textarea.js.map +0 -1
- package/dist/plugin/fields/time.d.ts +0 -24
- package/dist/plugin/fields/time.d.ts.map +0 -1
- package/dist/plugin/fields/time.js +0 -23
- package/dist/plugin/fields/time.js.map +0 -1
- package/dist/plugin/fields/url.d.ts +0 -17
- package/dist/plugin/fields/url.d.ts.map +0 -1
- package/dist/plugin/fields/url.js +0 -18
- package/dist/plugin/fields/url.js.map +0 -1
- package/dist/plugin/fields/user-list.d.ts +0 -29
- package/dist/plugin/fields/user-list.d.ts.map +0 -1
- package/dist/plugin/fields/user-list.js +0 -31
- package/dist/plugin/fields/user-list.js.map +0 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { EntryStatus } from "../../db/schema/entries.js";
|
|
2
|
+
import type { UserRole } from "../../db/schema/users.js";
|
|
3
|
+
import type { Label } from "../../i18n/label.js";
|
|
4
|
+
import type { ReferenceHydrationShapes } from "../lookup.js";
|
|
5
|
+
import type { EntryListMetaBoxField, EntryReferenceMetaBoxField, FieldBuilder, MetaBoxFieldSpan, MetaBoxFieldValidate, ReferenceReadProjection, TermListMetaBoxField, TermReferenceMetaBoxField, UserListMetaBoxField, UserMetaBoxField } from "../manifest.js";
|
|
6
|
+
import type { MetaFieldCondition, MetaFieldConditionRule } from "./condition.js";
|
|
7
|
+
/**
|
|
8
|
+
* The hydrated read shape for a reference `kind`, sourced from the
|
|
9
|
+
* shared {@link ReferenceHydrationShapes} registry so the builder's
|
|
10
|
+
* default read type tracks whatever the adapter actually resolves.
|
|
11
|
+
* Plugin-registered kinds augment that registry; an unregistered kind
|
|
12
|
+
* folds to `never`.
|
|
13
|
+
*/
|
|
14
|
+
type ReferenceSummaryOf<Kind extends string> = Kind extends keyof ReferenceHydrationShapes ? ReferenceHydrationShapes[Kind] : never;
|
|
15
|
+
/** One read element: the hydrated summary by default, the bare id after `.returns("id")`. */
|
|
16
|
+
type ReferenceReadItem<Summary, Returns extends "id" | "hydrated"> = Returns extends "id" ? string : Summary;
|
|
17
|
+
/**
|
|
18
|
+
* The phantom read type. Single references are *always* optional — a
|
|
19
|
+
* live target can be deleted after the id is written, so even a
|
|
20
|
+
* `.required()` field reads `undefined` for an orphan. Multi references
|
|
21
|
+
* read a dense array (orphans drop out); the array itself is present
|
|
22
|
+
* once `.required()` guarantees a write, optional otherwise.
|
|
23
|
+
*/
|
|
24
|
+
type ReferenceReadValue<Summary, Multiple extends boolean, Required extends boolean, Returns extends "id" | "hydrated"> = Multiple extends true ? Required extends true ? readonly ReferenceReadItem<Summary, Returns>[] : readonly ReferenceReadItem<Summary, Returns>[] | undefined : ReferenceReadItem<Summary, Returns> | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The phantom stored shape — bare ids, what `whereMeta` addresses.
|
|
27
|
+
* `.required()` narrows away `undefined` (write-enforced); the read
|
|
28
|
+
* projection (`.returns()`) never touches it.
|
|
29
|
+
*/
|
|
30
|
+
type ReferenceStoredValue<Multiple extends boolean, Required extends boolean> = Multiple extends true ? Required extends true ? readonly string[] : readonly string[] | undefined : Required extends true ? string : string | undefined;
|
|
31
|
+
/** The compiled field variant a `(kind, cardinality)` pair builds to. */
|
|
32
|
+
type ReferenceFieldOf<Kind extends string, Multiple extends boolean> = Kind extends "entry" ? Multiple extends true ? EntryListMetaBoxField : EntryReferenceMetaBoxField : Kind extends "term" ? Multiple extends true ? TermListMetaBoxField : TermReferenceMetaBoxField : Kind extends "user" ? Multiple extends true ? UserListMetaBoxField : UserMetaBoxField : never;
|
|
33
|
+
interface ReferenceFieldState {
|
|
34
|
+
readonly visibleWhen?: MetaFieldCondition;
|
|
35
|
+
readonly label?: Label;
|
|
36
|
+
readonly description?: Label;
|
|
37
|
+
readonly default?: string | readonly string[];
|
|
38
|
+
readonly required?: true;
|
|
39
|
+
readonly multiple?: true;
|
|
40
|
+
readonly returns?: ReferenceReadProjection;
|
|
41
|
+
readonly max?: number;
|
|
42
|
+
readonly span?: MetaBoxFieldSpan;
|
|
43
|
+
readonly capability?: string;
|
|
44
|
+
readonly showInApi?: true;
|
|
45
|
+
readonly sanitize?: (value: unknown) => unknown;
|
|
46
|
+
readonly validate?: MetaBoxFieldValidate;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fluent chain shared by the core reference fields (`entry`, `term`,
|
|
50
|
+
* `user`). Immutable — every call returns a fresh instance. The type
|
|
51
|
+
* parameters are the declaration's compile-time state:
|
|
52
|
+
*
|
|
53
|
+
* - `Kind` selects the adapter and, through {@link ReferenceSummaryOf},
|
|
54
|
+
* the hydrated read shape; it also gates the kind-specific scope
|
|
55
|
+
* chains (`.roles()` on `user`, `.status()` / `.includeTrashed()` on
|
|
56
|
+
* `entry`);
|
|
57
|
+
* - `K` is the literal field key;
|
|
58
|
+
* - `Multiple` flips storage + read type to arrays (`.multiple()`);
|
|
59
|
+
* - `Required` narrows the stored shape and, for multi fields, the read
|
|
60
|
+
* type (`.required()`);
|
|
61
|
+
* - `Returns` swaps the hydrated read for the bare id (`.returns("id")`).
|
|
62
|
+
*
|
|
63
|
+
* All phantom — nothing at runtime carries them. Reads default to the
|
|
64
|
+
* hydrated summary so the typed value never lies about what the read
|
|
65
|
+
* pipeline resolves. The scope object lives on the runtime instance,
|
|
66
|
+
* seeded by the factory and refined by the scope chains.
|
|
67
|
+
*/
|
|
68
|
+
export declare class ReferenceFieldBuilder<Kind extends string, K extends string = string, Multiple extends boolean = false, Required extends boolean = false, Returns extends "id" | "hydrated" = "hydrated"> implements FieldBuilder {
|
|
69
|
+
#private;
|
|
70
|
+
/** Phantom literal key of the field — type-level only, never assigned. */
|
|
71
|
+
readonly _key: K;
|
|
72
|
+
/** Phantom read type — hydrated summary by default, id after `.returns("id")`. */
|
|
73
|
+
readonly _value: ReferenceReadValue<ReferenceSummaryOf<Kind>, Multiple, Required, Returns>;
|
|
74
|
+
/** Phantom stored shape — bare ids; `.required()` narrows optionality. */
|
|
75
|
+
readonly _stored: ReferenceStoredValue<Multiple, Required>;
|
|
76
|
+
/** Phantom cardinality marker backing the compile-time gate on `.multiple()` / `.max()`. */
|
|
77
|
+
readonly _multiple: Multiple;
|
|
78
|
+
constructor(kind: Kind, key: string, scope: Record<string, unknown>, state?: ReferenceFieldState);
|
|
79
|
+
/**
|
|
80
|
+
* Store an array of ids instead of a single one (`type` flips to
|
|
81
|
+
* `json`, reads become a dense array). Declare cardinality before
|
|
82
|
+
* `.required()` narrows the shapes — the `this`-type gate keeps a
|
|
83
|
+
* post-narrowing `.multiple()` from compiling.
|
|
84
|
+
*/
|
|
85
|
+
multiple(this: ReferenceFieldBuilder<Kind, K, false, false, Returns>): ReferenceFieldBuilder<Kind, K, true, false, Returns>;
|
|
86
|
+
/**
|
|
87
|
+
* Cap the array length — multi-value fields only. Carried on the
|
|
88
|
+
* definition and the wire; the constraint walker enforces it server-side.
|
|
89
|
+
*/
|
|
90
|
+
max(this: ReferenceFieldBuilder<Kind, K, true, Required, Returns>, max: number): ReferenceFieldBuilder<Kind, K, true, Required, Returns>;
|
|
91
|
+
/**
|
|
92
|
+
* Read the bare stored id(s) instead of the hydrated summary — opts
|
|
93
|
+
* this field out of the read-time hydration join. Storage and the
|
|
94
|
+
* write contract are unaffected.
|
|
95
|
+
*/
|
|
96
|
+
returns(shape: "id"): ReferenceFieldBuilder<Kind, K, Multiple, Required, "id">;
|
|
97
|
+
/**
|
|
98
|
+
* Mark the field required — enforced at write time by the constraint
|
|
99
|
+
* walker. Narrows the stored shape; a single reference's read stays
|
|
100
|
+
* optional (targets can orphan after the write).
|
|
101
|
+
*/
|
|
102
|
+
required(): ReferenceFieldBuilder<Kind, K, Multiple, true, Returns>;
|
|
103
|
+
/**
|
|
104
|
+
* Restrict an `entry` reference to a lifecycle status (supersedes the
|
|
105
|
+
* `includeTrashed` default). Public-render consumers pass `"published"`
|
|
106
|
+
* so drafts never surface.
|
|
107
|
+
*/
|
|
108
|
+
status(this: ReferenceFieldBuilder<"entry", K, Multiple, Required, Returns>, status: EntryStatus): ReferenceFieldBuilder<"entry", K, Multiple, Required, Returns>;
|
|
109
|
+
/** Surface trashed entries in an `entry` reference (default: hidden). */
|
|
110
|
+
includeTrashed(this: ReferenceFieldBuilder<"entry", K, Multiple, Required, Returns>): ReferenceFieldBuilder<"entry", K, Multiple, Required, Returns>;
|
|
111
|
+
/** Restrict a `user` reference to these roles (absent → any role). */
|
|
112
|
+
roles(this: ReferenceFieldBuilder<"user", K, Multiple, Required, Returns>, roles: readonly UserRole[]): ReferenceFieldBuilder<"user", K, Multiple, Required, Returns>;
|
|
113
|
+
/** Surface disabled accounts in a `user` reference (default: hidden). */
|
|
114
|
+
includeDisabled(this: ReferenceFieldBuilder<"user", K, Multiple, Required, Returns>): ReferenceFieldBuilder<"user", K, Multiple, Required, Returns>;
|
|
115
|
+
/** Override the derived (humanized-key) label. */
|
|
116
|
+
label(label: Label): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
117
|
+
/** Help text rendered under the label. */
|
|
118
|
+
description(description: Label): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
119
|
+
/**
|
|
120
|
+
* Prefill for absent keys — a stored id (or id array for multi
|
|
121
|
+
* fields), seeded into the admin form. Purely a form/decode seed:
|
|
122
|
+
* a reference read stays optional regardless (the default id can
|
|
123
|
+
* itself orphan).
|
|
124
|
+
*/
|
|
125
|
+
default(value: Multiple extends true ? readonly string[] : string): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
126
|
+
/**
|
|
127
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
128
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
129
|
+
*/
|
|
130
|
+
span(span: MetaBoxFieldSpan): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
131
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
132
|
+
capability(capability: string): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
133
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
134
|
+
showInApi(): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
135
|
+
/** Rule factory: this field's stored id equals `value`. */
|
|
136
|
+
is(value: string): MetaFieldConditionRule;
|
|
137
|
+
/** Rule factory: this field's stored id differs from `value`. */
|
|
138
|
+
isNot(value: string): MetaFieldConditionRule;
|
|
139
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
140
|
+
isEmpty(): MetaFieldConditionRule;
|
|
141
|
+
/** Rule factory: this field has a value. */
|
|
142
|
+
isNotEmpty(): MetaFieldConditionRule;
|
|
143
|
+
/** Rule factory: the selection includes `id` — multi-value only. */
|
|
144
|
+
contains(this: ReferenceFieldBuilder<Kind, K, true, Required, Returns>, id: string): MetaFieldConditionRule;
|
|
145
|
+
/** Rule factory: the selection does not include `id` — multi-value only. */
|
|
146
|
+
notContains(this: ReferenceFieldBuilder<Kind, K, true, Required, Returns>, id: string): MetaFieldConditionRule;
|
|
147
|
+
/**
|
|
148
|
+
* Show this field only when every rule passes (one AND group) — rules
|
|
149
|
+
* come from sibling fields' condition factories. Replaces any
|
|
150
|
+
* previously declared condition; `.orVisibleWhen()` adds alternatives.
|
|
151
|
+
*/
|
|
152
|
+
visibleWhen(...rules: MetaFieldConditionRule[]): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
153
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
154
|
+
orVisibleWhen(...rules: MetaFieldConditionRule[]): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
155
|
+
/**
|
|
156
|
+
* Normalising transform, applied after coercion and before
|
|
157
|
+
* persistence. Receives the stored id(s) — the read-time hydration is
|
|
158
|
+
* a separate, later step.
|
|
159
|
+
*/
|
|
160
|
+
sanitize(sanitize: (value: unknown) => unknown): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
161
|
+
/**
|
|
162
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
163
|
+
* message (sync or async). Runs after `.sanitize()` and the
|
|
164
|
+
* declarative constraints.
|
|
165
|
+
*/
|
|
166
|
+
validate(validate: MetaBoxFieldValidate): ReferenceFieldBuilder<Kind, K, Multiple, Required, Returns>;
|
|
167
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
168
|
+
build(): ReferenceFieldOf<Kind, Multiple>;
|
|
169
|
+
}
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EAEvB,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;GAMG;AACH,KAAK,kBAAkB,CAAC,IAAI,SAAS,MAAM,IACzC,IAAI,SAAS,MAAM,wBAAwB,GACvC,wBAAwB,CAAC,IAAI,CAAC,GAC9B,KAAK,CAAC;AAEZ,6FAA6F;AAC7F,KAAK,iBAAiB,CACpB,OAAO,EACP,OAAO,SAAS,IAAI,GAAG,UAAU,IAC/B,OAAO,SAAS,IAAI,GAAG,MAAM,GA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|
|
4
|
+
* Fluent chain shared by the core reference fields (`entry`, `term`,
|
|
5
|
+
* `user`). Immutable — every call returns a fresh instance. The type
|
|
6
|
+
* parameters are the declaration's compile-time state:
|
|
7
|
+
*
|
|
8
|
+
* - `Kind` selects the adapter and, through {@link ReferenceSummaryOf},
|
|
9
|
+
* the hydrated read shape; it also gates the kind-specific scope
|
|
10
|
+
* chains (`.roles()` on `user`, `.status()` / `.includeTrashed()` on
|
|
11
|
+
* `entry`);
|
|
12
|
+
* - `K` is the literal field key;
|
|
13
|
+
* - `Multiple` flips storage + read type to arrays (`.multiple()`);
|
|
14
|
+
* - `Required` narrows the stored shape and, for multi fields, the read
|
|
15
|
+
* type (`.required()`);
|
|
16
|
+
* - `Returns` swaps the hydrated read for the bare id (`.returns("id")`).
|
|
17
|
+
*
|
|
18
|
+
* All phantom — nothing at runtime carries them. Reads default to the
|
|
19
|
+
* hydrated summary so the typed value never lies about what the read
|
|
20
|
+
* pipeline resolves. The scope object lives on the runtime instance,
|
|
21
|
+
* seeded by the factory and refined by the scope chains.
|
|
22
|
+
*/
|
|
23
|
+
export class ReferenceFieldBuilder {
|
|
24
|
+
#kind;
|
|
25
|
+
#key;
|
|
26
|
+
#scope;
|
|
27
|
+
#state;
|
|
28
|
+
constructor(kind, key, scope, state = {}) {
|
|
29
|
+
this.#kind = kind;
|
|
30
|
+
this.#key = key;
|
|
31
|
+
this.#scope = scope;
|
|
32
|
+
this.#state = state;
|
|
33
|
+
}
|
|
34
|
+
#fork(patch, scopePatch) {
|
|
35
|
+
return new _a(this.#kind, this.#key, scopePatch ? { ...this.#scope, ...scopePatch } : this.#scope, { ...this.#state, ...patch });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Store an array of ids instead of a single one (`type` flips to
|
|
39
|
+
* `json`, reads become a dense array). Declare cardinality before
|
|
40
|
+
* `.required()` narrows the shapes — the `this`-type gate keeps a
|
|
41
|
+
* post-narrowing `.multiple()` from compiling.
|
|
42
|
+
*/
|
|
43
|
+
multiple() {
|
|
44
|
+
return this.#fork({ multiple: true });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cap the array length — multi-value fields only. Carried on the
|
|
48
|
+
* definition and the wire; the constraint walker enforces it server-side.
|
|
49
|
+
*/
|
|
50
|
+
max(max) {
|
|
51
|
+
return this.#fork({ max });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Read the bare stored id(s) instead of the hydrated summary — opts
|
|
55
|
+
* this field out of the read-time hydration join. Storage and the
|
|
56
|
+
* write contract are unaffected.
|
|
57
|
+
*/
|
|
58
|
+
returns(shape) {
|
|
59
|
+
return this.#fork({ returns: shape });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Mark the field required — enforced at write time by the constraint
|
|
63
|
+
* walker. Narrows the stored shape; a single reference's read stays
|
|
64
|
+
* optional (targets can orphan after the write).
|
|
65
|
+
*/
|
|
66
|
+
required() {
|
|
67
|
+
return this.#fork({ required: true });
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Restrict an `entry` reference to a lifecycle status (supersedes the
|
|
71
|
+
* `includeTrashed` default). Public-render consumers pass `"published"`
|
|
72
|
+
* so drafts never surface.
|
|
73
|
+
*/
|
|
74
|
+
status(status) {
|
|
75
|
+
return this.#fork({}, { status });
|
|
76
|
+
}
|
|
77
|
+
/** Surface trashed entries in an `entry` reference (default: hidden). */
|
|
78
|
+
includeTrashed() {
|
|
79
|
+
return this.#fork({}, { includeTrashed: true });
|
|
80
|
+
}
|
|
81
|
+
/** Restrict a `user` reference to these roles (absent → any role). */
|
|
82
|
+
roles(roles) {
|
|
83
|
+
return this.#fork({}, { roles });
|
|
84
|
+
}
|
|
85
|
+
/** Surface disabled accounts in a `user` reference (default: hidden). */
|
|
86
|
+
includeDisabled() {
|
|
87
|
+
return this.#fork({}, { includeDisabled: true });
|
|
88
|
+
}
|
|
89
|
+
/** Override the derived (humanized-key) label. */
|
|
90
|
+
label(label) {
|
|
91
|
+
return this.#fork({ label });
|
|
92
|
+
}
|
|
93
|
+
/** Help text rendered under the label. */
|
|
94
|
+
description(description) {
|
|
95
|
+
return this.#fork({ description });
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Prefill for absent keys — a stored id (or id array for multi
|
|
99
|
+
* fields), seeded into the admin form. Purely a form/decode seed:
|
|
100
|
+
* a reference read stays optional regardless (the default id can
|
|
101
|
+
* itself orphan).
|
|
102
|
+
*/
|
|
103
|
+
default(value) {
|
|
104
|
+
return this.#fork({ default: value });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
108
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
109
|
+
*/
|
|
110
|
+
span(span) {
|
|
111
|
+
return this.#fork({ span });
|
|
112
|
+
}
|
|
113
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
114
|
+
capability(capability) {
|
|
115
|
+
return this.#fork({ capability });
|
|
116
|
+
}
|
|
117
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
118
|
+
showInApi() {
|
|
119
|
+
return this.#fork({ showInApi: true });
|
|
120
|
+
}
|
|
121
|
+
/** Rule factory: this field's stored id equals `value`. */
|
|
122
|
+
is(value) {
|
|
123
|
+
return { key: this.#key, op: "eq", value };
|
|
124
|
+
}
|
|
125
|
+
/** Rule factory: this field's stored id differs from `value`. */
|
|
126
|
+
isNot(value) {
|
|
127
|
+
return { key: this.#key, op: "neq", value };
|
|
128
|
+
}
|
|
129
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
130
|
+
isEmpty() {
|
|
131
|
+
return { key: this.#key, op: "empty" };
|
|
132
|
+
}
|
|
133
|
+
/** Rule factory: this field has a value. */
|
|
134
|
+
isNotEmpty() {
|
|
135
|
+
return { key: this.#key, op: "not_empty" };
|
|
136
|
+
}
|
|
137
|
+
/** Rule factory: the selection includes `id` — multi-value only. */
|
|
138
|
+
contains(id) {
|
|
139
|
+
return { key: this.#key, op: "contains", value: id };
|
|
140
|
+
}
|
|
141
|
+
/** Rule factory: the selection does not include `id` — multi-value only. */
|
|
142
|
+
notContains(id) {
|
|
143
|
+
return { key: this.#key, op: "not_contains", value: id };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Show this field only when every rule passes (one AND group) — rules
|
|
147
|
+
* come from sibling fields' condition factories. Replaces any
|
|
148
|
+
* previously declared condition; `.orVisibleWhen()` adds alternatives.
|
|
149
|
+
*/
|
|
150
|
+
visibleWhen(...rules) {
|
|
151
|
+
return this.#fork({ visibleWhen: [rules] });
|
|
152
|
+
}
|
|
153
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
154
|
+
orVisibleWhen(...rules) {
|
|
155
|
+
return this.#fork({
|
|
156
|
+
visibleWhen: [...(this.#state.visibleWhen ?? []), rules],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Normalising transform, applied after coercion and before
|
|
161
|
+
* persistence. Receives the stored id(s) — the read-time hydration is
|
|
162
|
+
* a separate, later step.
|
|
163
|
+
*/
|
|
164
|
+
sanitize(sanitize) {
|
|
165
|
+
return this.#fork({ sanitize });
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
169
|
+
* message (sync or async). Runs after `.sanitize()` and the
|
|
170
|
+
* declarative constraints.
|
|
171
|
+
*/
|
|
172
|
+
validate(validate) {
|
|
173
|
+
return this.#fork({ validate });
|
|
174
|
+
}
|
|
175
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
176
|
+
build() {
|
|
177
|
+
const { multiple, ...state } = this.#state;
|
|
178
|
+
const target = multiple
|
|
179
|
+
? { kind: this.#kind, scope: this.#scope, multiple: true }
|
|
180
|
+
: { kind: this.#kind, scope: this.#scope };
|
|
181
|
+
const field = {
|
|
182
|
+
...state,
|
|
183
|
+
key: this.#key,
|
|
184
|
+
label: state.label ?? humanizeFieldKey(this.#key),
|
|
185
|
+
type: multiple ? "json" : "string",
|
|
186
|
+
inputType: multiple ? `${this.#kind}List` : this.#kind,
|
|
187
|
+
referenceTarget: target,
|
|
188
|
+
};
|
|
189
|
+
return field;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
_a = ReferenceFieldBuilder;
|
|
193
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/plugin/fields/reference.ts"],"names":[],"mappings":";AAqBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAwFhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,qBAAqB;IAqBvB,KAAK,CAAO;IACZ,IAAI,CAAS;IACb,MAAM,CAA0B;IAChC,MAAM,CAAsB;IAErC,YACE,IAAU,EACV,GAAW,EACX,KAA8B,EAC9B,QAA6B,EAAE;QAE/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAKH,KAAmC,EACnC,UAAoC;QAEpC,OAAO,IAAI,EAAqB,CAC9B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,IAAI,EACT,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAC5D,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,CAC7B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QAGN,OAAO,IAAI,CAAC,KAAK,CAAuB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;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M,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;YACtD,eAAe,EAAE,MAAM;SACxB,CAAC;QACF,OAAO,KAAyC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -1,16 +1,119 @@
|
|
|
1
1
|
import type { Label } from "../../i18n/label.js";
|
|
2
|
-
import type { MetaBoxField, MetaBoxFieldSpan, RepeaterMetaBoxField } from "../manifest.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly
|
|
2
|
+
import type { FieldBuilder, MetaBoxField, MetaBoxFieldInput, MetaBoxFieldSpan, RepeaterDialogSize, RepeaterLayout, RepeaterMetaBoxField } from "../manifest.js";
|
|
3
|
+
import type { MetaFieldCondition, MetaFieldConditionRule } from "./condition.js";
|
|
4
|
+
import type { InferFields, InferStoredFields } from "./contributions.js";
|
|
5
|
+
interface RepeaterFieldState {
|
|
6
|
+
readonly subFields: readonly MetaBoxField[];
|
|
7
|
+
readonly visibleWhen?: MetaFieldCondition;
|
|
8
|
+
readonly label?: Label;
|
|
7
9
|
readonly description?: Label;
|
|
8
|
-
readonly
|
|
10
|
+
readonly required?: true;
|
|
9
11
|
readonly span?: MetaBoxFieldSpan;
|
|
10
12
|
readonly capability?: string;
|
|
11
|
-
readonly
|
|
13
|
+
readonly showInApi?: true;
|
|
12
14
|
readonly min?: number;
|
|
13
15
|
readonly max?: number;
|
|
16
|
+
readonly addLabel?: Label;
|
|
17
|
+
readonly layout?: RepeaterLayout;
|
|
18
|
+
readonly collapsed?: string;
|
|
19
|
+
readonly dialogSize?: RepeaterDialogSize;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Entry point of the `repeater()` chain — only `.fields()` is available
|
|
23
|
+
* until the row schema is declared, so a repeater without sub-fields
|
|
24
|
+
* can't reach `build()` (registration surfaces require a `build`
|
|
25
|
+
* method), and `.collapsed()` can be typed against the declared keys.
|
|
26
|
+
*/
|
|
27
|
+
export declare class RepeaterFieldSeed<K extends string = string> {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(key: K);
|
|
30
|
+
/**
|
|
31
|
+
* Declare the row schema — infers the typed row shape. Sub-fields may
|
|
32
|
+
* be any registered field type, including nested repeaters and
|
|
33
|
+
* groups; types recurse. Validated eagerly (key shape, uniqueness,
|
|
34
|
+
* prototype-pollution guard).
|
|
35
|
+
*/
|
|
36
|
+
fields<const F extends readonly MetaBoxFieldInput[]>(fields: F): RepeaterFieldBuilder<F, K>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fluent chain for repeater fields. Immutable — every call returns a
|
|
40
|
+
* fresh instance, so a shared base chain can be forked without
|
|
41
|
+
* aliasing.
|
|
42
|
+
*
|
|
43
|
+
* `F` is the declared row-schema tuple (drives the recursive row type
|
|
44
|
+
* and `.collapsed()` key typing); `K` is the literal field key; `V` is
|
|
45
|
+
* the phantom read type — `readonly InferFields<F>[] | undefined`,
|
|
46
|
+
* narrowed to the non-optional array by `.required()`; `S` is the
|
|
47
|
+
* phantom stored shape (`InferStoredFields<F>` rows). All purely
|
|
48
|
+
* type-level — nothing at runtime carries them.
|
|
49
|
+
*/
|
|
50
|
+
export declare class RepeaterFieldBuilder<F extends readonly MetaBoxFieldInput[], K extends string = string, V = readonly InferFields<F>[] | undefined, S = readonly InferStoredFields<F>[] | undefined> implements FieldBuilder<RepeaterMetaBoxField> {
|
|
51
|
+
#private;
|
|
52
|
+
/** Phantom literal key of the field — type-level only, never assigned. */
|
|
53
|
+
readonly _key: K;
|
|
54
|
+
/** Phantom read type of the field — type-level only, never assigned. */
|
|
55
|
+
readonly _value: V;
|
|
56
|
+
/** Phantom stored shape of the field — type-level only, never assigned. */
|
|
57
|
+
readonly _stored: S;
|
|
58
|
+
constructor(key: string, state: RepeaterFieldState);
|
|
59
|
+
/** Override the derived (humanized-key) label. */
|
|
60
|
+
label(label: Label): RepeaterFieldBuilder<F, K, V, S>;
|
|
61
|
+
/** Help text rendered under the label. */
|
|
62
|
+
description(description: Label): RepeaterFieldBuilder<F, K, V, S>;
|
|
63
|
+
/** Minimum row count — enforced server-side by the constraint walker. */
|
|
64
|
+
min(min: number): RepeaterFieldBuilder<F, K, V, S>;
|
|
65
|
+
/** Maximum row count — enforced server-side and by the admin add button. */
|
|
66
|
+
max(max: number): RepeaterFieldBuilder<F, K, V, S>;
|
|
67
|
+
/** Custom label for the admin add-row button. */
|
|
68
|
+
addLabel(addLabel: Label): RepeaterFieldBuilder<F, K, V, S>;
|
|
69
|
+
/** Admin row layout — see {@link RepeaterLayout}. */
|
|
70
|
+
layout(layout: RepeaterLayout): RepeaterFieldBuilder<F, K, V, S>;
|
|
71
|
+
/**
|
|
72
|
+
* Width of the row-editor dialog — see {@link RepeaterDialogSize}.
|
|
73
|
+
* Widen it for dense, multi-column rows; default `md`.
|
|
74
|
+
*/
|
|
75
|
+
dialogSize(dialogSize: RepeaterDialogSize): RepeaterFieldBuilder<F, K, V, S>;
|
|
76
|
+
/**
|
|
77
|
+
* Make rows collapsible in the admin, labelling each collapsed row by
|
|
78
|
+
* the chosen sub-field's stored value. The key is typed against the
|
|
79
|
+
* declared row schema, so a nonexistent sub-field is a compile error.
|
|
80
|
+
*/
|
|
81
|
+
collapsed(subFieldKey: keyof InferFields<F> & string): RepeaterFieldBuilder<F, K, V, S>;
|
|
82
|
+
/** Mark the field required — narrows the read/stored types to the
|
|
83
|
+
* non-optional array (rejects zero rows server-side). */
|
|
84
|
+
required(): RepeaterFieldBuilder<F, K, readonly InferFields<F>[], readonly InferStoredFields<F>[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
87
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
88
|
+
*/
|
|
89
|
+
span(span: MetaBoxFieldSpan): RepeaterFieldBuilder<F, K, V, S>;
|
|
90
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
91
|
+
capability(capability: string): RepeaterFieldBuilder<F, K, V, S>;
|
|
92
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
93
|
+
showInApi(): RepeaterFieldBuilder<F, K, V, S>;
|
|
94
|
+
/** Rule factory: this repeater has no rows (unset or cleared). */
|
|
95
|
+
isEmpty(): MetaFieldConditionRule;
|
|
96
|
+
/** Rule factory: this repeater has at least one row. */
|
|
97
|
+
isNotEmpty(): MetaFieldConditionRule;
|
|
98
|
+
/**
|
|
99
|
+
* Show this field only when every rule passes (one AND group) —
|
|
100
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
101
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
102
|
+
* alternatives.
|
|
103
|
+
*/
|
|
104
|
+
visibleWhen(...rules: MetaFieldConditionRule[]): RepeaterFieldBuilder<F, K, V, S>;
|
|
105
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
106
|
+
orVisibleWhen(...rules: MetaFieldConditionRule[]): RepeaterFieldBuilder<F, K, V, S>;
|
|
107
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
108
|
+
build(): RepeaterMetaBoxField;
|
|
14
109
|
}
|
|
15
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Repeatable list of structured rows —
|
|
112
|
+
* `repeater("links").fields([text("label"), url("href")])`. Only
|
|
113
|
+
* `.fields()` is available on the bare constructor; the returned
|
|
114
|
+
* builder carries row-count bounds (`.min()`/`.max()`), UX affordances
|
|
115
|
+
* (`.addLabel()`, `.layout()`, `.collapsed()`), and the universal chain.
|
|
116
|
+
*/
|
|
117
|
+
export declare function repeater<K extends string>(key: K): RepeaterFieldSeed<K>;
|
|
118
|
+
export {};
|
|
16
119
|
//# sourceMappingURL=repeater.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeater.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/repeater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB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