dineway 0.2.33 → 0.2.35
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/{activity-CfryM8jO.mjs → activity-BbtYp_4V.mjs} +2 -2
- package/dist/{activity-events-BVo9rMUz.mjs → activity-events-CiFN61xq.mjs} +1 -1
- package/dist/{actor-DrJJsvy6.mjs → actor-DxUAJgQX.mjs} +20 -6
- package/dist/{adapters-DHt3f2lu.d.mts → adapters-Rol-inz6.d.mts} +5 -7
- package/dist/after-BVaUn7bK.mjs +24 -0
- package/dist/{allowed-origins-DGSyhRCz.mjs → allowed-origins-Cp7BI3L9.mjs} +1 -1
- package/dist/api/route-utils.d.mts +10 -10
- package/dist/api/route-utils.mjs +23 -19
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/{api-CTf1SLmg.mjs → api-CwhrR7H5.mjs} +55 -1215
- package/dist/api-tokens-DA18zxza.mjs +3 -0
- package/dist/{api-tokens-CSomx-l3.mjs → api-tokens-OAgvq4xg.mjs} +1 -1
- package/dist/{apply-Bs2jXsms.mjs → apply-BTfAReIv.mjs} +109 -93
- package/dist/astro/index.d.mts +16 -12
- package/dist/astro/index.mjs +50 -9
- package/dist/astro/middleware/auth.d.mts +9 -9
- package/dist/astro/middleware/auth.mjs +29 -8
- package/dist/astro/middleware/redirect.mjs +8 -7
- package/dist/astro/middleware/request-context.mjs +17 -10
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +93 -71
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware/workers.d.mts +6 -0
- package/dist/astro/middleware/workers.mjs +8 -0
- package/dist/astro/middleware.mjs +287 -159
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -7
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -7
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
- package/dist/astro/routes/api/admin/briefing.mjs +25 -23
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +11 -10
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +11 -10
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +11 -10
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +22 -20
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +22 -20
- package/dist/astro/routes/api/admin/bylines/index.mjs +22 -20
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +18 -16
- package/dist/astro/routes/api/admin/comments/_id_.mjs +8 -7
- package/dist/astro/routes/api/admin/comments/bulk.mjs +14 -13
- package/dist/astro/routes/api/admin/comments/counts.mjs +8 -7
- package/dist/astro/routes/api/admin/comments/index.mjs +14 -13
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +42 -31
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +42 -31
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +47 -36
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +47 -36
- package/dist/astro/routes/api/admin/context/diff.mjs +46 -35
- package/dist/astro/routes/api/admin/context/index.mjs +47 -36
- package/dist/astro/routes/api/admin/context/stale.mjs +46 -35
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +42 -31
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +46 -35
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +46 -35
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +43 -32
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +7 -7
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +7 -7
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +71 -66
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +71 -66
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +63 -58
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +70 -65
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +70 -65
- package/dist/astro/routes/api/admin/plugins/index.mjs +63 -58
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +63 -58
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +70 -65
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +63 -58
- package/dist/astro/routes/api/admin/plugins/updates.mjs +63 -58
- package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +26 -23
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +39 -25
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +55 -43
- package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +10 -9
- package/dist/astro/routes/api/admin/review-requests/index.mjs +53 -41
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +63 -58
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +63 -58
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +20 -12
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +40 -32
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +7 -7
- package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -5
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/invite/index.mjs +9 -9
- package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -11
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -11
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +11 -11
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +5 -4
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +5 -4
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +7 -7
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +14 -13
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/passkey/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/setup-token/index.mjs +32 -23
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +32 -26
- package/dist/astro/routes/api/auth/signup/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/signup/request.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +73 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +91 -49
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +19 -16
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +24 -21
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +34 -22
- package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +34 -22
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +23 -19
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +8 -7
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +14 -13
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +14 -13
- package/dist/astro/routes/api/content/_collection_/trash.mjs +8 -8
- package/dist/astro/routes/api/dashboard.mjs +16 -11
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +25 -24
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +12 -11
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress/execute.mjs +50 -42
- package/dist/astro/routes/api/import/wordpress/media.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress/media.mjs +14 -14
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +51 -40
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +49 -38
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +29 -27
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +55 -47
- package/dist/astro/routes/api/integration/artifact.mjs +11 -8
- package/dist/astro/routes/api/integration/dispatch.mjs +17 -14
- package/dist/astro/routes/api/integrations/_provider_.mjs +11 -8
- package/dist/astro/routes/api/integrations/index.mjs +10 -7
- package/dist/astro/routes/api/manifest.mjs +5 -5
- package/dist/astro/routes/api/mcp.mjs +97 -88
- package/dist/astro/routes/api/media/_id_/confirm.mjs +12 -12
- package/dist/astro/routes/api/media/_id_.mjs +9 -9
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +13 -13
- package/dist/astro/routes/api/media.mjs +16 -16
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +47 -36
- package/dist/astro/routes/api/menus/_name_/items.mjs +47 -36
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +47 -36
- package/dist/astro/routes/api/menus/_name_/translations.mjs +47 -36
- package/dist/astro/routes/api/menus/_name_.mjs +47 -36
- package/dist/astro/routes/api/menus/index.mjs +47 -36
- package/dist/astro/routes/api/oauth/authorize.mjs +9 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +7 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +11 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +10 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +7 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +7 -6
- package/dist/astro/routes/api/oauth/token.mjs +8 -6
- package/dist/astro/routes/api/openapi.json.mjs +5 -5
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +15 -14
- package/dist/astro/routes/api/redirects/404s/summary.mjs +15 -14
- package/dist/astro/routes/api/redirects/_id_.mjs +47 -37
- package/dist/astro/routes/api/redirects/index.mjs +47 -37
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +65 -60
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +65 -60
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +65 -60
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +65 -60
- package/dist/astro/routes/api/schema/collections/index.mjs +65 -60
- package/dist/astro/routes/api/schema/index.mjs +12 -11
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +63 -58
- package/dist/astro/routes/api/schema/orphans/index.mjs +63 -58
- package/dist/astro/routes/api/search/enable.mjs +15 -14
- package/dist/astro/routes/api/search/index.mjs +14 -13
- package/dist/astro/routes/api/search/rebuild.mjs +15 -14
- package/dist/astro/routes/api/search/stats.mjs +9 -8
- package/dist/astro/routes/api/search/suggest.mjs +14 -13
- package/dist/astro/routes/api/sections/_slug_.mjs +47 -36
- package/dist/astro/routes/api/sections/index.mjs +47 -36
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings/reviews.mjs +11 -10
- package/dist/astro/routes/api/settings.mjs +47 -36
- package/dist/astro/routes/api/setup/admin-verify.mjs +14 -14
- package/dist/astro/routes/api/setup/admin.mjs +12 -12
- package/dist/astro/routes/api/setup/dev-bypass.mjs +35 -31
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +37 -33
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +11 -9
- package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +50 -39
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +50 -39
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +50 -39
- package/dist/astro/routes/api/taxonomies/index.mjs +50 -39
- package/dist/astro/routes/api/themes/preview.mjs +8 -6
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +46 -35
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +47 -36
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +47 -36
- package/dist/astro/routes/api/widget-areas/_name_.mjs +44 -33
- package/dist/astro/routes/api/widget-areas/index.mjs +47 -36
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +11 -10
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +20 -18
- package/dist/astro/routes/sitemap.xml.mjs +19 -17
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +4 -4
- package/dist/astro/types.d.mts +13 -13
- package/dist/atomic-authority-CnBQJ14T.mjs +33 -0
- package/dist/{audit-CYjfxG9i.mjs → audit-F5iWkbcJ.mjs} +11 -4
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-CITT8ZA_.mjs → auth-control-guard-DPOSBNFI.mjs} +1 -1
- package/dist/{authorize-KcI0pAfN.mjs → authorize-CXIjxIfC.mjs} +1 -1
- package/dist/{briefing-BgQTljQt.mjs → briefing-5zf0YZbR.mjs} +445 -447
- package/dist/{briefing-r3hXCDQC.mjs → briefing-DiupPvyN.mjs} +1 -1
- package/dist/{bundle-S6zx-V4D.mjs → bundle-DImnxo71.mjs} +3 -3
- package/dist/{byline-Ctil4rij.mjs → byline-DEZKlzD9.mjs} +107 -113
- package/dist/{byline-fields-51ja6JDa.d.mts → byline-fields-BO96fXLv.d.mts} +8 -8
- package/dist/{byline-fields-DiCyW6eQ.mjs → byline-fields-CY6V0ew1.mjs} +1 -1
- package/dist/{byline-fields-QpmruT5r.mjs → byline-fields-DGNKitg3.mjs} +3 -3
- package/dist/{byline-registry-rkr73qSE.mjs → byline-registry-CkuVVeJJ.mjs} +46 -76
- package/dist/{bylines-v_ZUQnR-.mjs → bylines-CXyKpVLQ.mjs} +6 -6
- package/dist/{bylines-BcuBpzVi.mjs → bylines-gSAfpHl4.mjs} +4 -4
- package/dist/{cache-V2BCplaY.mjs → cache-DZDOBJv3.mjs} +2 -2
- package/dist/{chunks-CnuL55JE.mjs → chunks-BnG3LPMN.mjs} +1 -1
- package/dist/cli/index.mjs +452 -263
- package/dist/cli/plugin-kit.d.mts +9 -9
- package/dist/cli/plugin-kit.mjs +2 -2
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +11 -11
- package/dist/client/index.mjs +2 -2
- package/dist/{client-factory-C-y9VZDX.mjs → client-factory-6vLLT06O.mjs} +1 -1
- package/dist/{comment-_nvJSS-A.mjs → comment-kgLTdtQD.mjs} +15 -8
- package/dist/{comment-reaction-DhVgJ17S.mjs → comment-reaction-Cun5eIXL.mjs} +1 -1
- package/dist/{comments-D4mIDjvA.mjs → comments-ZYK_cZvx.mjs} +1 -1
- package/dist/{content-CVCrcuvD.mjs → content-D9xKUSno.mjs} +287 -165
- package/dist/{content-refresh-QvBIyb_g.mjs → content-refresh-9M9cc55-.mjs} +170 -193
- package/dist/{context-JjKucxBm.mjs → context-BU8AbLmY.mjs} +2 -2
- package/dist/{context-MftkHbWx.mjs → context-C5lPtfeh.mjs} +95 -77
- package/dist/{context-route-helpers-e1APrqSm.mjs → context-route-helpers-CWAHJFl3.mjs} +2 -2
- package/dist/{cron-mGVPQ5e6.mjs → cron-BVYo08mi.mjs} +36 -32
- package/dist/d1-binding-D6HZa3ks.mjs +8 -0
- package/dist/d1-dialect-BBxPg6Om.mjs +48 -0
- package/dist/{dashboard-ZJ7sMcBI.mjs → dashboard-BnD5krLg.mjs} +5 -5
- package/dist/database/batch.d.mts +22 -0
- package/dist/database/batch.mjs +92 -0
- package/dist/database/d1/index.d.mts +18 -0
- package/dist/database/d1/index.mjs +8 -0
- package/dist/db/d1.d.mts +7 -0
- package/dist/db/d1.mjs +13 -0
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.mjs +10 -7
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +46 -3
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-eOcL5m0Q.mjs → device-flow-Prqg6ycD.mjs} +130 -94
- package/dist/{dialect-helpers-fk43GbDb.mjs → dialect-helpers-C6xtO-Ui.mjs} +1 -1
- package/dist/{discovery-CJkuHGhZ.mjs → discovery-CYcZJ1o3.mjs} +5 -5
- package/dist/{enrich-KErvJOuI.mjs → enrich-BjF-J4sF.mjs} +1 -1
- package/dist/{evidence-6IUv9ML3.mjs → evidence-krrA3uiG.mjs} +7 -7
- package/dist/{field-defs-cache-CwrIyZFT.mjs → field-defs-cache-BKKFFf_V.mjs} +5 -5
- package/dist/{forgeway-account-lYJ8iX3G.mjs → forgeway-account-CnWOIusE.mjs} +1 -1
- package/dist/{fts-manager-DX7ZkrCa.mjs → fts-manager-DA74x_uP.mjs} +72 -57
- package/dist/{hitl-requests-CmYVunm-.mjs → hitl-requests-CGjA1jND.mjs} +2 -2
- package/dist/{hitl-route-helpers-CRm537zS.mjs → hitl-route-helpers-BxSL0iZB.mjs} +5 -5
- package/dist/{import-DqRAgsKr.mjs → import-CayDCPaH.mjs} +9 -9
- package/dist/{index-Co7xtjkd.d.mts → index-mlJSqFkG.d.mts} +7 -4
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +103 -96
- package/dist/{integration-credentials-qudN6yRr.mjs → integration-credentials-Br16M1VE.mjs} +2 -2
- package/dist/{jsonld-BpvnSp2m.d.mts → jsonld-BUiFEiCZ.d.mts} +2 -2
- package/dist/{load-fCOciq0Q.mjs → load-B2oitobd.mjs} +1 -1
- package/dist/{loader-BDje8ME2.mjs → loader-Cgsx23wU.mjs} +4 -4
- package/dist/{manifest-schema-CfKD0thC.mjs → manifest-schema-DBXM_g8l.mjs} +1 -1
- package/dist/{mcp-reviewed-executor-DmhM3Cy6.mjs → mcp-reviewed-executor-RJ71uyQb.mjs} +7 -7
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +11 -11
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-dvRjj4po.mjs → media-BZqwtRTZ.mjs} +12 -4
- package/dist/{media-allowlist-DaG6lNoy.mjs → media-allowlist-CyByjUXh.mjs} +1 -1
- package/dist/{menus-CZbz5L_V.mjs → menus-2o-DVcwA.mjs} +8 -8
- package/dist/{menus-CpuR4Qkm.mjs → menus-5liJusbp.mjs} +138 -90
- package/dist/migrations-C7YXse7V.mjs +76 -0
- package/dist/oauth-authority-DOjME4Hh.mjs +43 -0
- package/dist/{oauth-authorization-Jf5e3azH.mjs → oauth-authorization-B_mmz7O2.mjs} +89 -98
- package/dist/{oauth-clients-tovQ4D4h.mjs → oauth-clients-Cr4pdIAE.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{object-cache-D51qOseS.mjs → object-cache-BGjIlY9s.mjs} +1 -1
- package/dist/page/index.d.mts +10 -10
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-IsGn-5lt.mjs → parse-BscLr3p2.mjs} +1 -1
- package/dist/plugin-utils.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-DXyLI3Hb.mjs → plugins-f48yrwfI.mjs} +35 -84
- package/dist/{policy-DKdNMv8y.mjs → policy-CrK1vl8l.mjs} +2 -2
- package/dist/{preview-BXmS1SXL.mjs → preview-E1xKZGsX.mjs} +2 -2
- package/dist/{provider-loader-DDq7R_RN.d.mts → provider-loader-H2wdGD0o.d.mts} +1 -1
- package/dist/{public-url-Ci7UbC0W.d.mts → public-url-CI700CW4.d.mts} +1 -1
- package/dist/{public-url-BQ9vf0AS.d.mts → public-url-zoO-QbN6.d.mts} +2 -2
- package/dist/{publication-authorization-C-vYPGD8.mjs → publication-authorization-Dq_20SZR.mjs} +458 -33
- package/dist/{query-DcB9uGTW.mjs → query-BkWWdxyb.mjs} +4 -4
- package/dist/{query-CrW2yI6G.mjs → query-D6oNo9iz.mjs} +15 -15
- package/dist/{rate-limit-DEkoxTsP.mjs → rate-limit-RaBJEgyt.mjs} +2 -2
- package/dist/{redirect-DG-o0CKV.mjs → redirect-HLI3wT5Y.mjs} +26 -14
- package/dist/{redirects-Bjp4iKJU.mjs → redirects-D16GFaOa.mjs} +5 -5
- package/dist/{redirects-N8gmWhVM.mjs → redirects-DpRiuRWn.mjs} +3 -3
- package/dist/{registry-D-IV_h50.mjs → registry-DcV93OL_.mjs} +183 -186
- package/dist/release-CZfAeyXm.mjs +5148 -0
- package/dist/request-context.d.mts +8 -0
- package/dist/{request-meta-BW0the1R.mjs → request-meta-C6yGqnGD.mjs} +1 -1
- package/dist/{resolve-pZ4NQM-X.mjs → resolve-CpOV2jt_.mjs} +1 -1
- package/dist/review-payload-LLIi1sxO.mjs +1386 -0
- package/dist/{review-requests-DICrYH2-.mjs → review-requests-BF2eEKr8.mjs} +93 -37
- package/dist/{review-requests-BTKfeWlS.mjs → review-requests-C7prIbCo.mjs} +2 -2
- package/dist/{review-route-helpers-DaZBBps8.mjs → review-route-helpers-BYx3Px90.mjs} +2 -2
- package/dist/{revision-De7OmYVD.mjs → revision-090sZyGc.mjs} +28 -22
- package/dist/revocation-DZ8e4JCS.mjs +53 -0
- package/dist/{runner-DJiRFyLI.mjs → runner-CVeq0266.mjs} +594 -491
- package/dist/{runner-Dye73myO.d.mts → runner-Cxl-vyk2.d.mts} +1 -1
- package/dist/{runs-DEujUDOj.mjs → runs-B8kCirJ6.mjs} +5 -5
- package/dist/runtime-env-v-1UXPAH.mjs +19 -0
- package/dist/runtime.d.mts +10 -10
- package/dist/runtime.mjs +5 -5
- package/dist/schema-DFeC5axi.mjs +8 -0
- package/dist/{search-DxUKN9Zz.mjs → search-C9qOBgvo.mjs} +4 -4
- package/dist/{secrets-AdCrGg1c.mjs → secrets-BP2YTPWn.mjs} +10 -11
- package/dist/{sections-BPFOEMK6.mjs → sections-CkoQY7Z9.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +29 -25
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +11 -10
- package/dist/{seo-GfovzqpU.mjs → seo-Bypxm1iD.mjs} +1 -1
- package/dist/{seo-DWHdo5aW.mjs → seo-DYpc_rQ1.mjs} +25 -15
- package/dist/{service-BrNKVCjC.mjs → service-DOFqfUVv.mjs} +46 -21
- package/dist/{service-DbgjHWyW.mjs → service-mJBl4ZP4.mjs} +2 -2
- package/dist/{session-user-D8WwGEPH.mjs → session-user-DacoiKrJ.mjs} +1 -1
- package/dist/{settings-BKEHw6Bu.mjs → settings-2p7TuNWG.mjs} +2 -2
- package/dist/{settings-CAsQLi0N.mjs → settings-DRFy8JQx.mjs} +8 -8
- package/dist/{setup-complete-CHCYS5KV.mjs → setup-complete-CWMnrNFN.mjs} +1 -1
- package/dist/{site-activity-7oezuHXK.mjs → site-activity-BrN2NviL.mjs} +11 -4
- package/dist/{site-context-CA7rbxux.mjs → site-context-D9oETfxF.mjs} +50 -37
- package/dist/{site-url-DoZf_jVj.mjs → site-url-DoTPKRND.mjs} +1 -1
- package/dist/state-D8AogXCV.mjs +30 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +3 -3
- package/dist/{store-c4qx3gVh.mjs → store-CjmmGlVw.mjs} +37 -12
- package/dist/submission-BLvkvewK.mjs +411 -0
- package/dist/{taxonomies-ALDiRQ84.mjs → taxonomies-C5ayPp3T.mjs} +3 -3
- package/dist/{taxonomies-93DV-1QT.mjs → taxonomies-DW6Fps-w.mjs} +7 -7
- package/dist/{taxonomy-BOBTJ_aE.mjs → taxonomy-DWxxLpp5.mjs} +3 -3
- package/dist/{tokens-c-qxNqzC.mjs → tokens-I3tSjoFI.mjs} +1 -1
- package/dist/{trusted-proxy-CdEl6g6B.mjs → trusted-proxy-CvDP0g0F.mjs} +4 -12
- package/dist/{types-6KmeXInJ.d.mts → types-BFoQ5a1v.d.mts} +1 -1
- package/dist/{types-BpSTdH1H.mjs → types-BqxIv8Il.mjs} +2 -2
- package/dist/{types-BRCUO8NR.d.mts → types-CVRNRAA5.d.mts} +1 -0
- package/dist/{types-CfpX1og5.d.mts → types-Tt_IGMno.d.mts} +360 -172
- package/dist/ui/server-runtime.d.mts +13 -13
- package/dist/ui/server-runtime.mjs +28 -26
- package/dist/{user-D0NJ7gYf.mjs → user-1-YV30lf.mjs} +2 -2
- package/dist/{utils-BK2efsHv.mjs → utils-BoWkoty8.mjs} +2 -2
- package/dist/{validate-CDWVODvc.d.mts → validate-CCOsvPg2.d.mts} +3 -3
- package/dist/{validate-C9g9iX3q.mjs → validate-CupwWNWL.mjs} +3 -3
- package/dist/version-DpT-k_Ny.mjs +6 -0
- package/dist/{widgets-Cm5Qx2Np.mjs → widgets-DbOctkXv.mjs} +3 -3
- package/dist/{wordpress-slugs-WdPZaVXf.mjs → wordpress-slugs-pQlLXbKn.mjs} +1 -1
- package/dist/{worker-Bhuu7eqS.mjs → worker-wjRq4FI9.mjs} +76 -47
- package/dist/workers-build-QVrquLLe.mjs +36 -0
- package/dist/{zod-generator-DS5oZNaL.mjs → zod-generator-BzACAoR5.mjs} +2 -2
- package/package.json +34 -8
- package/dist/after-BfniwgIf.mjs +0 -9
- package/dist/api-tokens-CmT83Bgj.mjs +0 -3
- package/dist/db/libsql-http.d.mts +0 -27
- package/dist/db/libsql-http.mjs +0 -29
- package/dist/libsql-dialect-CANq6UNI.mjs +0 -47
- package/dist/oauth-user-lookup-B451pZmd.mjs +0 -25
- package/dist/review-payload-f1L4lzQg.mjs +0 -111
- package/dist/revocation-CkTOhdlw.mjs +0 -42
- package/dist/schema-IjuRxkqq.mjs +0 -8
- package/dist/submission-C47cHBIg.mjs +0 -67
- package/dist/transaction-BGQgnwUi.mjs +0 -28
- package/dist/version-CJqc1mwj.mjs +0 -6
- /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
- /package/dist/{challenge-store-CDKfye2r.mjs → challenge-store-DFGsDtCj.mjs} +0 -0
- /package/dist/{components-DAq_4iPX.mjs → components-gMTtJqHg.mjs} +0 -0
- /package/dist/{config-CVssduLe.mjs → config-XW5tMrH8.mjs} +0 -0
- /package/dist/{content-index-names-Bbu1FY1r.mjs → content-index-names-CDc2IQIx.mjs} +0 -0
- /package/dist/{context-types-CPWAJRs5.mjs → context-types-DLD_HnKT.mjs} +0 -0
- /package/dist/{default-BeIzUa1e.mjs → default-w3MwLng7.mjs} +0 -0
- /package/dist/{email-console-Bfi_exVg.mjs → email-console-CpvgEN1w.mjs} +0 -0
- /package/dist/{error-DLg1H2LT.mjs → error-B-44r5TD.mjs} +0 -0
- /package/dist/{escape-C6lkys0j.mjs → escape-B1GM0yJU.mjs} +0 -0
- /package/dist/{experimental-workflows-B9x8delL.mjs → experimental-workflows-fzJHB3ZI.mjs} +0 -0
- /package/dist/{hash-jhbF98tT.mjs → hash-DvMZXj2L.mjs} +0 -0
- /package/dist/{media-url-CL3NzgLh.mjs → media-url-D-elxQjL.mjs} +0 -0
- /package/dist/{mime-CDTtL7jE.mjs → mime-D_ae-u_U.mjs} +0 -0
- /package/dist/{mode-DJeacFCZ.mjs → mode-BJwb_MgK.mjs} +0 -0
- /package/dist/{normalize-Ev3FiBMx.mjs → normalize-5rct_U0I.mjs} +0 -0
- /package/dist/{oauth-state-store-Do1a_o3H.mjs → oauth-state-store-D2H9hKcN.mjs} +0 -0
- /package/dist/{options-1dBRkoCl.mjs → options-BcqHWpc-.mjs} +0 -0
- /package/dist/{output-8j9oltTf.mjs → output-CdmbQioY.mjs} +0 -0
- /package/dist/{parser-C9rzPuSZ.mjs → parser-ehIlj32k.mjs} +0 -0
- /package/dist/{passkey-config-CRN44T04.mjs → passkey-config-sUQoLEj_.mjs} +0 -0
- /package/dist/{patterns-3XE9bU4r.mjs → patterns-CZ7D4y_R.mjs} +0 -0
- /package/dist/{placeholder-D03pGvqM.d.mts → placeholder-CQKI6vLd.d.mts} +0 -0
- /package/dist/{portable-text-BdRm4uZq.d.mts → portable-text-BE7nszX6.d.mts} +0 -0
- /package/dist/{portable-text-tIk9_uz_.mjs → portable-text-DH3Om_2D.mjs} +0 -0
- /package/dist/{process-cache-B-L-A9zg.mjs → process-cache-MHM4Sqzs.mjs} +0 -0
- /package/dist/{provider-loader-C4i82ll1.mjs → provider-loader-Dnv2neOu.mjs} +0 -0
- /package/dist/{public-discovery-CyDzK1-S.mjs → public-discovery-CTql6jdZ.mjs} +0 -0
- /package/dist/{public-url-BVIjzMo3.mjs → public-url-4sMO36Gw.mjs} +0 -0
- /package/dist/{public-url-oudwI7K0.mjs → public-url-DNt9A1yS.mjs} +0 -0
- /package/dist/{redirect-Dp5u-8dH.mjs → redirect-Cjjb5VYr.mjs} +0 -0
- /package/dist/{request-cache-BruBnFAR.mjs → request-cache-DPmV5nk4.mjs} +0 -0
- /package/dist/{seo-contributions-BAtRDXEQ.mjs → seo-contributions-atY3jZEV.mjs} +0 -0
- /package/dist/{service-DeX1PRNt.mjs → service-CeEi6nax.mjs} +0 -0
- /package/dist/{setup-nonce-D-CEYlw7.mjs → setup-nonce-BUmfCiY1.mjs} +0 -0
- /package/dist/{sidecar-client-Bw2C0XTf.mjs → sidecar-client-CbrX8nuw.mjs} +0 -0
- /package/dist/{slugify-KSsVD_D3.mjs → slugify-Di8Q_MFq.mjs} +0 -0
- /package/dist/{ssrf-C7tTSD1r.mjs → ssrf-COxLChKv.mjs} +0 -0
- /package/dist/{stable-hash-DF7R5eN8.mjs → stable-hash-DEtJgcp7.mjs} +0 -0
- /package/dist/{status-Bba6RbkS.mjs → status-DBSB6tdS.mjs} +0 -0
- /package/dist/{transport-ktLL9r2O.d.mts → transport-CZbtxgKZ.d.mts} +0 -0
- /package/dist/{transport-BddGhTAI.mjs → transport-aPKvM53n.mjs} +0 -0
- /package/dist/{types-CKIt_jmM.d.mts → types-1qU0-N1P.d.mts} +0 -0
- /package/dist/{types-BQZFeZjd.mjs → types-BKsk4nnM.mjs} +0 -0
- /package/dist/{types-CLMOusxP.d.mts → types-BWsEjujW.d.mts} +0 -0
- /package/dist/{types--3oJQ0hs.d.mts → types-CAD4OvmF.d.mts} +0 -0
- /package/dist/{types-BbkkkAb6.mjs → types-ChSk0dmw.mjs} +0 -0
- /package/dist/{types-C0DPvhR5.mjs → types-CyBH89BS.mjs} +0 -0
- /package/dist/{types-CU3Wn2HC.d.mts → types-DNPP-eu4.d.mts} +0 -0
- /package/dist/{types-CPaVj_GC.d.mts → types-SddyDti7.d.mts} +0 -0
- /package/dist/{url-C_pLSrGZ.mjs → url-Ce0qtSdB.mjs} +0 -0
- /package/dist/{url-Dumsft7G.mjs → url-DfqolpO2.mjs} +0 -0
- /package/dist/{validate-VPnKoIzW.mjs → validate-Co3j6T_K.mjs} +0 -0
|
@@ -1,343 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as isSiteContextType, t as SITE_CONTEXT_TYPES } from "./context-types-
|
|
6
|
-
import { n as SchemaRegistry } from "./registry-
|
|
7
|
-
import { a as getSiteSettingsWithDb } from "./settings-
|
|
1
|
+
import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
|
|
2
|
+
import { i as encodeCursor, r as decodeCursor } from "./types-BqxIv8Il.mjs";
|
|
3
|
+
import { t as SiteActivityRepository } from "./site-activity-BrN2NviL.mjs";
|
|
4
|
+
import { r as ReviewRequestRepository } from "./review-requests-BF2eEKr8.mjs";
|
|
5
|
+
import { n as isSiteContextType, t as SITE_CONTEXT_TYPES } from "./context-types-DLD_HnKT.mjs";
|
|
6
|
+
import { n as SchemaRegistry } from "./registry-DcV93OL_.mjs";
|
|
7
|
+
import { a as getSiteSettingsWithDb } from "./settings-DRFy8JQx.mjs";
|
|
8
8
|
import { sql } from "kysely";
|
|
9
9
|
import { ulid } from "ulidx";
|
|
10
10
|
|
|
11
|
-
//#region src/plugins/state.ts
|
|
12
|
-
function toPluginStatus(value) {
|
|
13
|
-
if (value === "active") return "active";
|
|
14
|
-
return "inactive";
|
|
15
|
-
}
|
|
16
|
-
function toPluginSource(value) {
|
|
17
|
-
if (value === "marketplace") return "marketplace";
|
|
18
|
-
return "config";
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Repository for plugin state in the database
|
|
22
|
-
*/
|
|
23
|
-
var PluginStateRepository = class {
|
|
24
|
-
constructor(db) {
|
|
25
|
-
this.db = db;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get state for a specific plugin
|
|
29
|
-
*/
|
|
30
|
-
async get(pluginId) {
|
|
31
|
-
const row = await this.db.selectFrom("_plugin_state").selectAll().where("plugin_id", "=", pluginId).executeTakeFirst();
|
|
32
|
-
if (!row) return null;
|
|
33
|
-
return {
|
|
34
|
-
pluginId: row.plugin_id,
|
|
35
|
-
status: toPluginStatus(row.status),
|
|
36
|
-
version: row.version,
|
|
37
|
-
installedAt: new Date(row.installed_at),
|
|
38
|
-
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
39
|
-
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
40
|
-
source: toPluginSource(row.source),
|
|
41
|
-
marketplaceVersion: row.marketplace_version ?? null,
|
|
42
|
-
displayName: row.display_name ?? null,
|
|
43
|
-
description: row.description ?? null
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get all plugin states
|
|
48
|
-
*/
|
|
49
|
-
async getAll() {
|
|
50
|
-
return (await this.db.selectFrom("_plugin_state").selectAll().execute()).map((row) => ({
|
|
51
|
-
pluginId: row.plugin_id,
|
|
52
|
-
status: toPluginStatus(row.status),
|
|
53
|
-
version: row.version,
|
|
54
|
-
installedAt: new Date(row.installed_at),
|
|
55
|
-
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
56
|
-
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
57
|
-
source: toPluginSource(row.source),
|
|
58
|
-
marketplaceVersion: row.marketplace_version ?? null,
|
|
59
|
-
displayName: row.display_name ?? null,
|
|
60
|
-
description: row.description ?? null
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Get all marketplace-installed plugin states
|
|
65
|
-
*/
|
|
66
|
-
async getMarketplacePlugins() {
|
|
67
|
-
return (await this.db.selectFrom("_plugin_state").selectAll().where("source", "=", "marketplace").execute()).map((row) => ({
|
|
68
|
-
pluginId: row.plugin_id,
|
|
69
|
-
status: toPluginStatus(row.status),
|
|
70
|
-
version: row.version,
|
|
71
|
-
installedAt: new Date(row.installed_at),
|
|
72
|
-
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
73
|
-
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
74
|
-
source: toPluginSource(row.source),
|
|
75
|
-
marketplaceVersion: row.marketplace_version ?? null,
|
|
76
|
-
displayName: row.display_name ?? null,
|
|
77
|
-
description: row.description ?? null
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Create or update plugin state
|
|
82
|
-
*/
|
|
83
|
-
async upsert(pluginId, version, status, opts) {
|
|
84
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
85
|
-
const existing = await this.get(pluginId);
|
|
86
|
-
if (existing) {
|
|
87
|
-
const updates = {
|
|
88
|
-
status,
|
|
89
|
-
version
|
|
90
|
-
};
|
|
91
|
-
if (status === "active" && existing.status !== "active") updates.activated_at = now;
|
|
92
|
-
else if (status === "inactive" && existing.status !== "inactive") updates.deactivated_at = now;
|
|
93
|
-
if (opts?.source) updates.source = opts.source;
|
|
94
|
-
if (opts?.marketplaceVersion !== void 0) updates.marketplace_version = opts.marketplaceVersion;
|
|
95
|
-
if (opts?.displayName !== void 0) updates.display_name = opts.displayName;
|
|
96
|
-
if (opts?.description !== void 0) updates.description = opts.description;
|
|
97
|
-
await this.db.updateTable("_plugin_state").set(updates).where("plugin_id", "=", pluginId).execute();
|
|
98
|
-
} else await this.db.insertInto("_plugin_state").values({
|
|
99
|
-
plugin_id: pluginId,
|
|
100
|
-
status,
|
|
101
|
-
version,
|
|
102
|
-
installed_at: now,
|
|
103
|
-
activated_at: status === "active" ? now : null,
|
|
104
|
-
deactivated_at: null,
|
|
105
|
-
data: null,
|
|
106
|
-
source: opts?.source ?? "config",
|
|
107
|
-
marketplace_version: opts?.marketplaceVersion ?? null,
|
|
108
|
-
display_name: opts?.displayName ?? null,
|
|
109
|
-
description: opts?.description ?? null
|
|
110
|
-
}).execute();
|
|
111
|
-
return await this.get(pluginId);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Enable a plugin
|
|
115
|
-
*/
|
|
116
|
-
async enable(pluginId, version) {
|
|
117
|
-
return this.upsert(pluginId, version, "active");
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Disable a plugin
|
|
121
|
-
*/
|
|
122
|
-
async disable(pluginId, version) {
|
|
123
|
-
return this.upsert(pluginId, version, "inactive");
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Delete plugin state
|
|
127
|
-
*/
|
|
128
|
-
async delete(pluginId) {
|
|
129
|
-
return ((await this.db.deleteFrom("_plugin_state").where("plugin_id", "=", pluginId).executeTakeFirst()).numDeletedRows ?? 0) > 0;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region src/api/handlers/plugins.ts
|
|
135
|
-
function marketplaceIconUrl(marketplaceUrl, pluginId) {
|
|
136
|
-
return `${marketplaceUrl}/api/v1/plugins/${encodeURIComponent(pluginId)}/icon`;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get plugin info from configured plugin and database state
|
|
140
|
-
*/
|
|
141
|
-
function buildPluginInfo(plugin, state, marketplaceUrl) {
|
|
142
|
-
const status = state?.status ?? "active";
|
|
143
|
-
const enabled = status === "active";
|
|
144
|
-
const isMarketplace = (state?.source ?? "config") === "marketplace";
|
|
145
|
-
return {
|
|
146
|
-
id: plugin.id,
|
|
147
|
-
name: state?.displayName || plugin.id,
|
|
148
|
-
version: plugin.version,
|
|
149
|
-
package: void 0,
|
|
150
|
-
enabled,
|
|
151
|
-
status,
|
|
152
|
-
source: state?.source ?? "config",
|
|
153
|
-
marketplaceVersion: state?.marketplaceVersion ?? void 0,
|
|
154
|
-
capabilities: plugin.capabilities,
|
|
155
|
-
hasAdminPages: (plugin.admin.pages?.length ?? 0) > 0,
|
|
156
|
-
hasDashboardWidgets: (plugin.admin.widgets?.length ?? 0) > 0,
|
|
157
|
-
hasHooks: Object.keys(plugin.hooks ?? {}).length > 0,
|
|
158
|
-
installedAt: state?.installedAt?.toISOString(),
|
|
159
|
-
activatedAt: state?.activatedAt?.toISOString() ?? void 0,
|
|
160
|
-
deactivatedAt: state?.deactivatedAt?.toISOString() ?? void 0,
|
|
161
|
-
description: state?.description ?? void 0,
|
|
162
|
-
iconUrl: isMarketplace && marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, plugin.id) : void 0
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function buildSandboxedPluginInfo(entry, state) {
|
|
166
|
-
const status = state?.status ?? "active";
|
|
167
|
-
const enabled = status === "active";
|
|
168
|
-
return {
|
|
169
|
-
id: entry.id,
|
|
170
|
-
name: state?.displayName || entry.id,
|
|
171
|
-
version: entry.version,
|
|
172
|
-
package: void 0,
|
|
173
|
-
enabled,
|
|
174
|
-
status,
|
|
175
|
-
source: "config",
|
|
176
|
-
sandboxed: true,
|
|
177
|
-
marketplaceVersion: void 0,
|
|
178
|
-
capabilities: entry.capabilities,
|
|
179
|
-
hasAdminPages: (entry.adminPages?.length ?? 0) > 0,
|
|
180
|
-
hasDashboardWidgets: (entry.adminWidgets?.length ?? 0) > 0,
|
|
181
|
-
hasHooks: false,
|
|
182
|
-
installedAt: state?.installedAt?.toISOString(),
|
|
183
|
-
activatedAt: state?.activatedAt?.toISOString() ?? void 0,
|
|
184
|
-
deactivatedAt: state?.deactivatedAt?.toISOString() ?? void 0,
|
|
185
|
-
description: state?.description ?? void 0
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* List all configured plugins with their state
|
|
190
|
-
*/
|
|
191
|
-
async function handlePluginList(db, configuredPlugins, sandboxedPluginEntries, marketplaceUrl) {
|
|
192
|
-
try {
|
|
193
|
-
const allStates = await new PluginStateRepository(db).getAll();
|
|
194
|
-
const stateMap = new Map(allStates.map((s) => [s.pluginId, s]));
|
|
195
|
-
const configuredIds = new Set(configuredPlugins.map((p) => p.id));
|
|
196
|
-
const items = configuredPlugins.map((plugin) => {
|
|
197
|
-
return buildPluginInfo(plugin, stateMap.get(plugin.id) ?? null, marketplaceUrl);
|
|
198
|
-
});
|
|
199
|
-
for (const entry of sandboxedPluginEntries) {
|
|
200
|
-
if (configuredIds.has(entry.id)) continue;
|
|
201
|
-
configuredIds.add(entry.id);
|
|
202
|
-
items.push(buildSandboxedPluginInfo(entry, stateMap.get(entry.id) ?? null));
|
|
203
|
-
}
|
|
204
|
-
for (const state of allStates) {
|
|
205
|
-
if (state.source !== "marketplace") continue;
|
|
206
|
-
if (configuredIds.has(state.pluginId)) continue;
|
|
207
|
-
items.push({
|
|
208
|
-
id: state.pluginId,
|
|
209
|
-
name: state.displayName || state.pluginId,
|
|
210
|
-
version: state.marketplaceVersion ?? state.version,
|
|
211
|
-
enabled: state.status === "active",
|
|
212
|
-
status: state.status,
|
|
213
|
-
source: "marketplace",
|
|
214
|
-
marketplaceVersion: state.marketplaceVersion ?? void 0,
|
|
215
|
-
capabilities: [],
|
|
216
|
-
hasAdminPages: false,
|
|
217
|
-
hasDashboardWidgets: false,
|
|
218
|
-
hasHooks: false,
|
|
219
|
-
installedAt: state.installedAt?.toISOString(),
|
|
220
|
-
activatedAt: state.activatedAt?.toISOString() ?? void 0,
|
|
221
|
-
deactivatedAt: state.deactivatedAt?.toISOString() ?? void 0,
|
|
222
|
-
description: state.description ?? void 0,
|
|
223
|
-
iconUrl: marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, state.pluginId) : void 0
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
success: true,
|
|
228
|
-
data: { items }
|
|
229
|
-
};
|
|
230
|
-
} catch {
|
|
231
|
-
return {
|
|
232
|
-
success: false,
|
|
233
|
-
error: {
|
|
234
|
-
code: "PLUGIN_LIST_ERROR",
|
|
235
|
-
message: "Failed to list plugins"
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get a single plugin's info
|
|
242
|
-
*/
|
|
243
|
-
async function handlePluginGet(db, configuredPlugins, sandboxedPluginEntries, pluginId, marketplaceUrl) {
|
|
244
|
-
try {
|
|
245
|
-
const stateRepo = new PluginStateRepository(db);
|
|
246
|
-
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
247
|
-
if (plugin) return {
|
|
248
|
-
success: true,
|
|
249
|
-
data: { item: buildPluginInfo(plugin, await stateRepo.get(pluginId), marketplaceUrl) }
|
|
250
|
-
};
|
|
251
|
-
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
252
|
-
if (sandboxed) return {
|
|
253
|
-
success: true,
|
|
254
|
-
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.get(pluginId)) }
|
|
255
|
-
};
|
|
256
|
-
return {
|
|
257
|
-
success: false,
|
|
258
|
-
error: {
|
|
259
|
-
code: "NOT_FOUND",
|
|
260
|
-
message: `Plugin not found: ${pluginId}`
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
} catch {
|
|
264
|
-
return {
|
|
265
|
-
success: false,
|
|
266
|
-
error: {
|
|
267
|
-
code: "PLUGIN_GET_ERROR",
|
|
268
|
-
message: "Failed to get plugin"
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Enable a plugin
|
|
275
|
-
*/
|
|
276
|
-
async function handlePluginEnable(db, configuredPlugins, sandboxedPluginEntries, pluginId) {
|
|
277
|
-
try {
|
|
278
|
-
const stateRepo = new PluginStateRepository(db);
|
|
279
|
-
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
280
|
-
if (plugin) return {
|
|
281
|
-
success: true,
|
|
282
|
-
data: { item: buildPluginInfo(plugin, await stateRepo.enable(pluginId, plugin.version)) }
|
|
283
|
-
};
|
|
284
|
-
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
285
|
-
if (sandboxed) return {
|
|
286
|
-
success: true,
|
|
287
|
-
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.enable(pluginId, sandboxed.version)) }
|
|
288
|
-
};
|
|
289
|
-
return {
|
|
290
|
-
success: false,
|
|
291
|
-
error: {
|
|
292
|
-
code: "NOT_FOUND",
|
|
293
|
-
message: `Plugin not found: ${pluginId}`
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
} catch {
|
|
297
|
-
return {
|
|
298
|
-
success: false,
|
|
299
|
-
error: {
|
|
300
|
-
code: "PLUGIN_ENABLE_ERROR",
|
|
301
|
-
message: "Failed to enable plugin"
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Disable a plugin
|
|
308
|
-
*/
|
|
309
|
-
async function handlePluginDisable(db, configuredPlugins, sandboxedPluginEntries, pluginId) {
|
|
310
|
-
try {
|
|
311
|
-
const stateRepo = new PluginStateRepository(db);
|
|
312
|
-
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
313
|
-
if (plugin) return {
|
|
314
|
-
success: true,
|
|
315
|
-
data: { item: buildPluginInfo(plugin, await stateRepo.disable(pluginId, plugin.version)) }
|
|
316
|
-
};
|
|
317
|
-
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
318
|
-
if (sandboxed) return {
|
|
319
|
-
success: true,
|
|
320
|
-
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.disable(pluginId, sandboxed.version)) }
|
|
321
|
-
};
|
|
322
|
-
return {
|
|
323
|
-
success: false,
|
|
324
|
-
error: {
|
|
325
|
-
code: "NOT_FOUND",
|
|
326
|
-
message: `Plugin not found: ${pluginId}`
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
} catch {
|
|
330
|
-
return {
|
|
331
|
-
success: false,
|
|
332
|
-
error: {
|
|
333
|
-
code: "PLUGIN_DISABLE_ERROR",
|
|
334
|
-
message: "Failed to disable plugin"
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
//#endregion
|
|
341
11
|
//#region src/database/repositories/context-entries.ts
|
|
342
12
|
var ContextRepository = class {
|
|
343
13
|
constructor(db) {
|
|
@@ -348,10 +18,7 @@ var ContextRepository = class {
|
|
|
348
18
|
const id = ulid();
|
|
349
19
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
350
20
|
const tags = normalizeTags(input.tags);
|
|
351
|
-
await
|
|
352
|
-
await trx.insertInto("_dineway_context_entries").values(toInsertableContextEntry(id, input, now)).execute();
|
|
353
|
-
await insertTags(trx, id, tags);
|
|
354
|
-
});
|
|
21
|
+
await atomicBatch(this.db, { statements: [this.db.insertInto("_dineway_context_entries").values(toInsertableContextEntry(id, input, now)).compile(), ...prepareTags(this.db, id, tags)] });
|
|
355
22
|
const entry = await this.findById(id);
|
|
356
23
|
if (!entry) throw new Error("Failed to create context entry");
|
|
357
24
|
return entry;
|
|
@@ -398,37 +65,39 @@ var ContextRepository = class {
|
|
|
398
65
|
const newId = ulid();
|
|
399
66
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
400
67
|
const tags = normalizeTags(input.tags);
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
68
|
+
const existing = await this.db.selectFrom("_dineway_context_entries").selectAll().where("id", "=", id).executeTakeFirst();
|
|
69
|
+
if (!existing || !existing.is_current) return null;
|
|
70
|
+
const contextType = input.contextType ?? existing.context_type;
|
|
71
|
+
validateContextType(contextType);
|
|
72
|
+
await atomicBatch(this.db, {
|
|
73
|
+
checks: [rowUnchanged("_dineway_context_entries", existing)],
|
|
74
|
+
statements: [
|
|
75
|
+
this.db.updateTable("_dineway_context_entries").set({
|
|
76
|
+
is_current: 0,
|
|
77
|
+
updated_at: now
|
|
78
|
+
}).where("id", "=", id).compile(),
|
|
79
|
+
this.db.insertInto("_dineway_context_entries").values(toInsertableContextEntry(newId, {
|
|
80
|
+
scope: input.scope ?? existing.scope,
|
|
81
|
+
contextType,
|
|
82
|
+
title: input.title,
|
|
83
|
+
body: input.body,
|
|
84
|
+
policyKey: input.policyKey ?? existing.policy_key,
|
|
85
|
+
sourceActivityId: input.sourceActivityId ?? existing.source_activity_id,
|
|
86
|
+
createdByActorType: input.createdByActorType,
|
|
87
|
+
createdByActorId: input.createdByActorId,
|
|
88
|
+
createdAuthMetadata: input.createdAuthMetadata,
|
|
89
|
+
supersedesId: existing.id,
|
|
90
|
+
version: existing.version + 1,
|
|
91
|
+
isCurrent: true,
|
|
92
|
+
validUntil: input.validUntil ?? existing.valid_until,
|
|
93
|
+
tags,
|
|
94
|
+
createdAt: input.createdAt,
|
|
95
|
+
updatedAt: input.createdAt
|
|
96
|
+
}, now)).compile(),
|
|
97
|
+
...prepareTags(this.db, newId, tags)
|
|
98
|
+
]
|
|
430
99
|
});
|
|
431
|
-
return
|
|
100
|
+
return this.findById(newId);
|
|
432
101
|
}
|
|
433
102
|
async review(id, input) {
|
|
434
103
|
const reviewedAt = input.reviewedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -563,92 +232,421 @@ var ContextRepository = class {
|
|
|
563
232
|
};
|
|
564
233
|
function toInsertableContextEntry(id, input, now) {
|
|
565
234
|
return {
|
|
566
|
-
id,
|
|
567
|
-
scope: input.scope,
|
|
568
|
-
context_type: input.contextType,
|
|
569
|
-
title: input.title,
|
|
570
|
-
body: input.body,
|
|
571
|
-
policy_key: input.policyKey ?? null,
|
|
572
|
-
source_activity_id: input.sourceActivityId ?? null,
|
|
573
|
-
created_by_actor_type: input.createdByActorType,
|
|
574
|
-
created_by_actor_id: input.createdByActorId,
|
|
575
|
-
created_auth_metadata: jsonOrNull(input.createdAuthMetadata),
|
|
576
|
-
supersedes_id: input.supersedesId ?? null,
|
|
577
|
-
version: input.version ?? 1,
|
|
578
|
-
is_current: input.isCurrent === false ? 0 : 1,
|
|
579
|
-
valid_until: input.validUntil ?? null,
|
|
580
|
-
reviewed_at: null,
|
|
581
|
-
reviewed_by_actor_type: null,
|
|
582
|
-
reviewed_by_actor_id: null,
|
|
583
|
-
review_note: null,
|
|
584
|
-
created_at: input.createdAt ?? now,
|
|
585
|
-
updated_at: input.updatedAt ?? input.createdAt ?? now
|
|
235
|
+
id,
|
|
236
|
+
scope: input.scope,
|
|
237
|
+
context_type: input.contextType,
|
|
238
|
+
title: input.title,
|
|
239
|
+
body: input.body,
|
|
240
|
+
policy_key: input.policyKey ?? null,
|
|
241
|
+
source_activity_id: input.sourceActivityId ?? null,
|
|
242
|
+
created_by_actor_type: input.createdByActorType,
|
|
243
|
+
created_by_actor_id: input.createdByActorId,
|
|
244
|
+
created_auth_metadata: jsonOrNull(input.createdAuthMetadata),
|
|
245
|
+
supersedes_id: input.supersedesId ?? null,
|
|
246
|
+
version: input.version ?? 1,
|
|
247
|
+
is_current: input.isCurrent === false ? 0 : 1,
|
|
248
|
+
valid_until: input.validUntil ?? null,
|
|
249
|
+
reviewed_at: null,
|
|
250
|
+
reviewed_by_actor_type: null,
|
|
251
|
+
reviewed_by_actor_id: null,
|
|
252
|
+
review_note: null,
|
|
253
|
+
created_at: input.createdAt ?? now,
|
|
254
|
+
updated_at: input.updatedAt ?? input.createdAt ?? now
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function prepareTags(db, entryId, tags) {
|
|
258
|
+
return tags.map((tag) => db.insertInto("_dineway_context_tags").values({
|
|
259
|
+
context_entry_id: entryId,
|
|
260
|
+
tag
|
|
261
|
+
}).compile());
|
|
262
|
+
}
|
|
263
|
+
function rowToContextEntry(row, tags) {
|
|
264
|
+
const contextType = row.context_type;
|
|
265
|
+
validateContextType(contextType);
|
|
266
|
+
return {
|
|
267
|
+
id: row.id,
|
|
268
|
+
scope: row.scope,
|
|
269
|
+
contextType,
|
|
270
|
+
title: row.title,
|
|
271
|
+
body: row.body,
|
|
272
|
+
policyKey: row.policy_key,
|
|
273
|
+
sourceActivityId: row.source_activity_id,
|
|
274
|
+
createdByActorType: row.created_by_actor_type,
|
|
275
|
+
createdByActorId: row.created_by_actor_id,
|
|
276
|
+
createdAuthMetadata: parseRecord(row.created_auth_metadata),
|
|
277
|
+
supersedesId: row.supersedes_id,
|
|
278
|
+
version: row.version,
|
|
279
|
+
isCurrent: row.is_current === 1,
|
|
280
|
+
validUntil: row.valid_until,
|
|
281
|
+
reviewedAt: row.reviewed_at,
|
|
282
|
+
reviewedByActorType: row.reviewed_by_actor_type,
|
|
283
|
+
reviewedByActorId: row.reviewed_by_actor_id,
|
|
284
|
+
reviewNote: row.review_note,
|
|
285
|
+
tags,
|
|
286
|
+
createdAt: row.created_at,
|
|
287
|
+
updatedAt: row.updated_at
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function validateContextType(value) {
|
|
291
|
+
if (!isSiteContextType(value)) throw new Error(`Invalid context type: ${value}`);
|
|
292
|
+
}
|
|
293
|
+
function normalizeTags(tags) {
|
|
294
|
+
if (!tags) return [];
|
|
295
|
+
return [...new Set(tags.map((tag) => tag.trim().toLowerCase()).filter((tag) => tag.length > 0))].toSorted();
|
|
296
|
+
}
|
|
297
|
+
function compareHistoryEntries(a, b) {
|
|
298
|
+
if (a.version !== b.version) return a.version - b.version;
|
|
299
|
+
const created = a.createdAt.localeCompare(b.createdAt);
|
|
300
|
+
if (created !== 0) return created;
|
|
301
|
+
return a.id.localeCompare(b.id);
|
|
302
|
+
}
|
|
303
|
+
function jsonOrNull(value) {
|
|
304
|
+
return value ? JSON.stringify(value) : null;
|
|
305
|
+
}
|
|
306
|
+
function parseRecord(value) {
|
|
307
|
+
if (!value) return null;
|
|
308
|
+
try {
|
|
309
|
+
const parsed = JSON.parse(value);
|
|
310
|
+
return isRecord(parsed) ? parsed : null;
|
|
311
|
+
} catch {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function isRecord(value) {
|
|
316
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
317
|
+
}
|
|
318
|
+
function clampLimit$1(value) {
|
|
319
|
+
return Math.min(Math.max(1, value ?? 50), 100);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/plugins/state.ts
|
|
324
|
+
function toPluginStatus(value) {
|
|
325
|
+
if (value === "active") return "active";
|
|
326
|
+
return "inactive";
|
|
327
|
+
}
|
|
328
|
+
function toPluginSource(value) {
|
|
329
|
+
if (value === "marketplace") return "marketplace";
|
|
330
|
+
return "config";
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Repository for plugin state in the database
|
|
334
|
+
*/
|
|
335
|
+
var PluginStateRepository = class {
|
|
336
|
+
constructor(db) {
|
|
337
|
+
this.db = db;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Get state for a specific plugin
|
|
341
|
+
*/
|
|
342
|
+
async get(pluginId) {
|
|
343
|
+
const row = await this.db.selectFrom("_plugin_state").selectAll().where("plugin_id", "=", pluginId).executeTakeFirst();
|
|
344
|
+
if (!row) return null;
|
|
345
|
+
return {
|
|
346
|
+
pluginId: row.plugin_id,
|
|
347
|
+
status: toPluginStatus(row.status),
|
|
348
|
+
version: row.version,
|
|
349
|
+
installedAt: new Date(row.installed_at),
|
|
350
|
+
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
351
|
+
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
352
|
+
source: toPluginSource(row.source),
|
|
353
|
+
marketplaceVersion: row.marketplace_version ?? null,
|
|
354
|
+
displayName: row.display_name ?? null,
|
|
355
|
+
description: row.description ?? null
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get all plugin states
|
|
360
|
+
*/
|
|
361
|
+
async getAll() {
|
|
362
|
+
return (await this.db.selectFrom("_plugin_state").selectAll().execute()).map((row) => ({
|
|
363
|
+
pluginId: row.plugin_id,
|
|
364
|
+
status: toPluginStatus(row.status),
|
|
365
|
+
version: row.version,
|
|
366
|
+
installedAt: new Date(row.installed_at),
|
|
367
|
+
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
368
|
+
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
369
|
+
source: toPluginSource(row.source),
|
|
370
|
+
marketplaceVersion: row.marketplace_version ?? null,
|
|
371
|
+
displayName: row.display_name ?? null,
|
|
372
|
+
description: row.description ?? null
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Get all marketplace-installed plugin states
|
|
377
|
+
*/
|
|
378
|
+
async getMarketplacePlugins() {
|
|
379
|
+
return (await this.db.selectFrom("_plugin_state").selectAll().where("source", "=", "marketplace").execute()).map((row) => ({
|
|
380
|
+
pluginId: row.plugin_id,
|
|
381
|
+
status: toPluginStatus(row.status),
|
|
382
|
+
version: row.version,
|
|
383
|
+
installedAt: new Date(row.installed_at),
|
|
384
|
+
activatedAt: row.activated_at ? new Date(row.activated_at) : null,
|
|
385
|
+
deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
|
|
386
|
+
source: toPluginSource(row.source),
|
|
387
|
+
marketplaceVersion: row.marketplace_version ?? null,
|
|
388
|
+
displayName: row.display_name ?? null,
|
|
389
|
+
description: row.description ?? null
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Create or update plugin state
|
|
394
|
+
*/
|
|
395
|
+
async upsert(pluginId, version, status, opts) {
|
|
396
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
397
|
+
const existing = await this.get(pluginId);
|
|
398
|
+
if (existing) {
|
|
399
|
+
const updates = {
|
|
400
|
+
status,
|
|
401
|
+
version
|
|
402
|
+
};
|
|
403
|
+
if (status === "active" && existing.status !== "active") updates.activated_at = now;
|
|
404
|
+
else if (status === "inactive" && existing.status !== "inactive") updates.deactivated_at = now;
|
|
405
|
+
if (opts?.source) updates.source = opts.source;
|
|
406
|
+
if (opts?.marketplaceVersion !== void 0) updates.marketplace_version = opts.marketplaceVersion;
|
|
407
|
+
if (opts?.displayName !== void 0) updates.display_name = opts.displayName;
|
|
408
|
+
if (opts?.description !== void 0) updates.description = opts.description;
|
|
409
|
+
await this.db.updateTable("_plugin_state").set(updates).where("plugin_id", "=", pluginId).execute();
|
|
410
|
+
} else await this.db.insertInto("_plugin_state").values({
|
|
411
|
+
plugin_id: pluginId,
|
|
412
|
+
status,
|
|
413
|
+
version,
|
|
414
|
+
installed_at: now,
|
|
415
|
+
activated_at: status === "active" ? now : null,
|
|
416
|
+
deactivated_at: null,
|
|
417
|
+
data: null,
|
|
418
|
+
source: opts?.source ?? "config",
|
|
419
|
+
marketplace_version: opts?.marketplaceVersion ?? null,
|
|
420
|
+
display_name: opts?.displayName ?? null,
|
|
421
|
+
description: opts?.description ?? null
|
|
422
|
+
}).execute();
|
|
423
|
+
return await this.get(pluginId);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Enable a plugin
|
|
427
|
+
*/
|
|
428
|
+
async enable(pluginId, version) {
|
|
429
|
+
return this.upsert(pluginId, version, "active");
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Disable a plugin
|
|
433
|
+
*/
|
|
434
|
+
async disable(pluginId, version) {
|
|
435
|
+
return this.upsert(pluginId, version, "inactive");
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Delete plugin state
|
|
439
|
+
*/
|
|
440
|
+
async delete(pluginId) {
|
|
441
|
+
return ((await this.db.deleteFrom("_plugin_state").where("plugin_id", "=", pluginId).executeTakeFirst()).numDeletedRows ?? 0) > 0;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/api/handlers/plugins.ts
|
|
447
|
+
function marketplaceIconUrl(marketplaceUrl, pluginId) {
|
|
448
|
+
return `${marketplaceUrl}/api/v1/plugins/${encodeURIComponent(pluginId)}/icon`;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Get plugin info from configured plugin and database state
|
|
452
|
+
*/
|
|
453
|
+
function buildPluginInfo(plugin, state, marketplaceUrl) {
|
|
454
|
+
const status = state?.status ?? "active";
|
|
455
|
+
const enabled = status === "active";
|
|
456
|
+
const isMarketplace = (state?.source ?? "config") === "marketplace";
|
|
457
|
+
return {
|
|
458
|
+
id: plugin.id,
|
|
459
|
+
name: state?.displayName || plugin.id,
|
|
460
|
+
version: plugin.version,
|
|
461
|
+
package: void 0,
|
|
462
|
+
enabled,
|
|
463
|
+
status,
|
|
464
|
+
source: state?.source ?? "config",
|
|
465
|
+
marketplaceVersion: state?.marketplaceVersion ?? void 0,
|
|
466
|
+
capabilities: plugin.capabilities,
|
|
467
|
+
hasAdminPages: (plugin.admin.pages?.length ?? 0) > 0,
|
|
468
|
+
hasDashboardWidgets: (plugin.admin.widgets?.length ?? 0) > 0,
|
|
469
|
+
hasHooks: Object.keys(plugin.hooks ?? {}).length > 0,
|
|
470
|
+
installedAt: state?.installedAt?.toISOString(),
|
|
471
|
+
activatedAt: state?.activatedAt?.toISOString() ?? void 0,
|
|
472
|
+
deactivatedAt: state?.deactivatedAt?.toISOString() ?? void 0,
|
|
473
|
+
description: state?.description ?? void 0,
|
|
474
|
+
iconUrl: isMarketplace && marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, plugin.id) : void 0
|
|
586
475
|
};
|
|
587
476
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
context_entry_id: entryId,
|
|
592
|
-
tag
|
|
593
|
-
}))).execute();
|
|
594
|
-
}
|
|
595
|
-
function rowToContextEntry(row, tags) {
|
|
596
|
-
const contextType = row.context_type;
|
|
597
|
-
validateContextType(contextType);
|
|
477
|
+
function buildSandboxedPluginInfo(entry, state) {
|
|
478
|
+
const status = state?.status ?? "active";
|
|
479
|
+
const enabled = status === "active";
|
|
598
480
|
return {
|
|
599
|
-
id:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
reviewNote: row.review_note,
|
|
617
|
-
tags,
|
|
618
|
-
createdAt: row.created_at,
|
|
619
|
-
updatedAt: row.updated_at
|
|
481
|
+
id: entry.id,
|
|
482
|
+
name: state?.displayName || entry.id,
|
|
483
|
+
version: entry.version,
|
|
484
|
+
package: void 0,
|
|
485
|
+
enabled,
|
|
486
|
+
status,
|
|
487
|
+
source: "config",
|
|
488
|
+
sandboxed: true,
|
|
489
|
+
marketplaceVersion: void 0,
|
|
490
|
+
capabilities: entry.capabilities,
|
|
491
|
+
hasAdminPages: (entry.adminPages?.length ?? 0) > 0,
|
|
492
|
+
hasDashboardWidgets: (entry.adminWidgets?.length ?? 0) > 0,
|
|
493
|
+
hasHooks: false,
|
|
494
|
+
installedAt: state?.installedAt?.toISOString(),
|
|
495
|
+
activatedAt: state?.activatedAt?.toISOString() ?? void 0,
|
|
496
|
+
deactivatedAt: state?.deactivatedAt?.toISOString() ?? void 0,
|
|
497
|
+
description: state?.description ?? void 0
|
|
620
498
|
};
|
|
621
499
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
function
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
500
|
+
/**
|
|
501
|
+
* List all configured plugins with their state
|
|
502
|
+
*/
|
|
503
|
+
async function handlePluginList(db, configuredPlugins, sandboxedPluginEntries, marketplaceUrl) {
|
|
504
|
+
try {
|
|
505
|
+
const allStates = await new PluginStateRepository(db).getAll();
|
|
506
|
+
const stateMap = new Map(allStates.map((s) => [s.pluginId, s]));
|
|
507
|
+
const configuredIds = new Set(configuredPlugins.map((p) => p.id));
|
|
508
|
+
const items = configuredPlugins.map((plugin) => {
|
|
509
|
+
return buildPluginInfo(plugin, stateMap.get(plugin.id) ?? null, marketplaceUrl);
|
|
510
|
+
});
|
|
511
|
+
for (const entry of sandboxedPluginEntries) {
|
|
512
|
+
if (configuredIds.has(entry.id)) continue;
|
|
513
|
+
configuredIds.add(entry.id);
|
|
514
|
+
items.push(buildSandboxedPluginInfo(entry, stateMap.get(entry.id) ?? null));
|
|
515
|
+
}
|
|
516
|
+
for (const state of allStates) {
|
|
517
|
+
if (state.source !== "marketplace") continue;
|
|
518
|
+
if (configuredIds.has(state.pluginId)) continue;
|
|
519
|
+
items.push({
|
|
520
|
+
id: state.pluginId,
|
|
521
|
+
name: state.displayName || state.pluginId,
|
|
522
|
+
version: state.marketplaceVersion ?? state.version,
|
|
523
|
+
enabled: state.status === "active",
|
|
524
|
+
status: state.status,
|
|
525
|
+
source: "marketplace",
|
|
526
|
+
marketplaceVersion: state.marketplaceVersion ?? void 0,
|
|
527
|
+
capabilities: [],
|
|
528
|
+
hasAdminPages: false,
|
|
529
|
+
hasDashboardWidgets: false,
|
|
530
|
+
hasHooks: false,
|
|
531
|
+
installedAt: state.installedAt?.toISOString(),
|
|
532
|
+
activatedAt: state.activatedAt?.toISOString() ?? void 0,
|
|
533
|
+
deactivatedAt: state.deactivatedAt?.toISOString() ?? void 0,
|
|
534
|
+
description: state.description ?? void 0,
|
|
535
|
+
iconUrl: marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, state.pluginId) : void 0
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
success: true,
|
|
540
|
+
data: { items }
|
|
541
|
+
};
|
|
542
|
+
} catch {
|
|
543
|
+
return {
|
|
544
|
+
success: false,
|
|
545
|
+
error: {
|
|
546
|
+
code: "PLUGIN_LIST_ERROR",
|
|
547
|
+
message: "Failed to list plugins"
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
637
551
|
}
|
|
638
|
-
|
|
639
|
-
|
|
552
|
+
/**
|
|
553
|
+
* Get a single plugin's info
|
|
554
|
+
*/
|
|
555
|
+
async function handlePluginGet(db, configuredPlugins, sandboxedPluginEntries, pluginId, marketplaceUrl) {
|
|
640
556
|
try {
|
|
641
|
-
const
|
|
642
|
-
|
|
557
|
+
const stateRepo = new PluginStateRepository(db);
|
|
558
|
+
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
559
|
+
if (plugin) return {
|
|
560
|
+
success: true,
|
|
561
|
+
data: { item: buildPluginInfo(plugin, await stateRepo.get(pluginId), marketplaceUrl) }
|
|
562
|
+
};
|
|
563
|
+
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
564
|
+
if (sandboxed) return {
|
|
565
|
+
success: true,
|
|
566
|
+
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.get(pluginId)) }
|
|
567
|
+
};
|
|
568
|
+
return {
|
|
569
|
+
success: false,
|
|
570
|
+
error: {
|
|
571
|
+
code: "NOT_FOUND",
|
|
572
|
+
message: `Plugin not found: ${pluginId}`
|
|
573
|
+
}
|
|
574
|
+
};
|
|
643
575
|
} catch {
|
|
644
|
-
return
|
|
576
|
+
return {
|
|
577
|
+
success: false,
|
|
578
|
+
error: {
|
|
579
|
+
code: "PLUGIN_GET_ERROR",
|
|
580
|
+
message: "Failed to get plugin"
|
|
581
|
+
}
|
|
582
|
+
};
|
|
645
583
|
}
|
|
646
584
|
}
|
|
647
|
-
|
|
648
|
-
|
|
585
|
+
/**
|
|
586
|
+
* Enable a plugin
|
|
587
|
+
*/
|
|
588
|
+
async function handlePluginEnable(db, configuredPlugins, sandboxedPluginEntries, pluginId) {
|
|
589
|
+
try {
|
|
590
|
+
const stateRepo = new PluginStateRepository(db);
|
|
591
|
+
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
592
|
+
if (plugin) return {
|
|
593
|
+
success: true,
|
|
594
|
+
data: { item: buildPluginInfo(plugin, await stateRepo.enable(pluginId, plugin.version)) }
|
|
595
|
+
};
|
|
596
|
+
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
597
|
+
if (sandboxed) return {
|
|
598
|
+
success: true,
|
|
599
|
+
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.enable(pluginId, sandboxed.version)) }
|
|
600
|
+
};
|
|
601
|
+
return {
|
|
602
|
+
success: false,
|
|
603
|
+
error: {
|
|
604
|
+
code: "NOT_FOUND",
|
|
605
|
+
message: `Plugin not found: ${pluginId}`
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
} catch {
|
|
609
|
+
return {
|
|
610
|
+
success: false,
|
|
611
|
+
error: {
|
|
612
|
+
code: "PLUGIN_ENABLE_ERROR",
|
|
613
|
+
message: "Failed to enable plugin"
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
}
|
|
649
617
|
}
|
|
650
|
-
|
|
651
|
-
|
|
618
|
+
/**
|
|
619
|
+
* Disable a plugin
|
|
620
|
+
*/
|
|
621
|
+
async function handlePluginDisable(db, configuredPlugins, sandboxedPluginEntries, pluginId) {
|
|
622
|
+
try {
|
|
623
|
+
const stateRepo = new PluginStateRepository(db);
|
|
624
|
+
const plugin = configuredPlugins.find((p) => p.id === pluginId);
|
|
625
|
+
if (plugin) return {
|
|
626
|
+
success: true,
|
|
627
|
+
data: { item: buildPluginInfo(plugin, await stateRepo.disable(pluginId, plugin.version)) }
|
|
628
|
+
};
|
|
629
|
+
const sandboxed = sandboxedPluginEntries.find((entry) => entry.id === pluginId);
|
|
630
|
+
if (sandboxed) return {
|
|
631
|
+
success: true,
|
|
632
|
+
data: { item: buildSandboxedPluginInfo(sandboxed, await stateRepo.disable(pluginId, sandboxed.version)) }
|
|
633
|
+
};
|
|
634
|
+
return {
|
|
635
|
+
success: false,
|
|
636
|
+
error: {
|
|
637
|
+
code: "NOT_FOUND",
|
|
638
|
+
message: `Plugin not found: ${pluginId}`
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
} catch {
|
|
642
|
+
return {
|
|
643
|
+
success: false,
|
|
644
|
+
error: {
|
|
645
|
+
code: "PLUGIN_DISABLE_ERROR",
|
|
646
|
+
message: "Failed to disable plugin"
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
}
|
|
652
650
|
}
|
|
653
651
|
|
|
654
652
|
//#endregion
|
|
@@ -1362,4 +1360,4 @@ function isCollectionSlug(value) {
|
|
|
1362
1360
|
}
|
|
1363
1361
|
|
|
1364
1362
|
//#endregion
|
|
1365
|
-
export { selectActiveBriefingContextEntries as a,
|
|
1363
|
+
export { selectActiveBriefingContextEntries as a, handlePluginGet as c, ContextRepository as d, parseSiteBriefingScope as i, handlePluginList as l, SiteBriefingError as n, handlePluginDisable as o, formatSiteBriefingText as r, handlePluginEnable as s, SiteBriefingAssembler as t, PluginStateRepository as u };
|