dineway 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/{activity-DUaz_w7p.mjs → activity-BDMlkpYY.mjs} +2 -2
- package/dist/{activity-events-CJDvE2uc.mjs → activity-events-DEYmJhWd.mjs} +1 -1
- package/dist/{allowed-origins--OwHHiY8.mjs → allowed-origins-VLgv2PL1.mjs} +1 -1
- package/dist/api/route-utils.d.mts +9 -9
- package/dist/api/route-utils.mjs +13 -13
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/api/schemas/index.mjs +3 -3
- package/dist/{api-B4PHIF4V.mjs → api-BFey0dOt.mjs} +15 -15
- package/dist/{api-tokens-tbK_sORH.mjs → api-tokens-C4K9eocv.mjs} +1 -1
- package/dist/{apply-DjTqq6Ae.mjs → apply-DHT0l398.mjs} +18 -18
- package/dist/astro/index.d.mts +10 -10
- package/dist/astro/index.mjs +11 -3
- package/dist/astro/middleware/auth.d.mts +8 -8
- package/dist/astro/middleware/auth.mjs +6 -6
- package/dist/astro/middleware/redirect.mjs +5 -5
- package/dist/astro/middleware/request-context.mjs +2 -2
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +78 -76
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/briefing.mjs +16 -16
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +2 -2
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +6 -6
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +6 -6
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +13 -13
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +13 -13
- package/dist/astro/routes/api/admin/bylines/index.mjs +13 -13
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +23 -23
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +23 -23
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +28 -28
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +28 -28
- package/dist/astro/routes/api/admin/context/diff.mjs +27 -27
- package/dist/astro/routes/api/admin/context/index.mjs +28 -28
- package/dist/astro/routes/api/admin/context/stale.mjs +27 -27
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +23 -23
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +27 -27
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +27 -27
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +24 -24
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +50 -47
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +50 -47
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +42 -39
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +49 -46
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +49 -46
- package/dist/astro/routes/api/admin/plugins/index.mjs +42 -39
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +42 -39
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +49 -46
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +42 -39
- package/dist/astro/routes/api/admin/plugins/updates.mjs +42 -39
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +28 -28
- package/dist/astro/routes/api/admin/review-requests/index.mjs +28 -28
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +42 -39
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +42 -39
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
- package/dist/astro/routes/api/admin/users/index.mjs +5 -5
- package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
- package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
- package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +7 -7
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
- package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
- package/dist/astro/routes/api/auth/setup-token/index.mjs +5 -5
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
- package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +12 -12
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +11 -11
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +15 -15
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +15 -15
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +12 -12
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- 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 +17 -17
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +8 -8
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +8 -8
- package/dist/astro/routes/api/import/wordpress/execute.mjs +32 -32
- package/dist/astro/routes/api/import/wordpress/media.d.mts +8 -8
- package/dist/astro/routes/api/import/wordpress/media.mjs +9 -9
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +31 -31
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +9 -9
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +28 -28
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +20 -20
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +8 -8
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +36 -36
- package/dist/astro/routes/api/integrations/_provider_.d.mts +8 -0
- package/dist/astro/routes/api/integrations/_provider_.mjs +51 -0
- package/dist/astro/routes/api/integrations/index.d.mts +7 -0
- package/dist/astro/routes/api/integrations/index.mjs +24 -0
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/mcp.mjs +232 -312
- package/dist/astro/routes/api/media/_id_/confirm.mjs +8 -8
- package/dist/astro/routes/api/media/_id_.mjs +6 -6
- 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 +9 -9
- package/dist/astro/routes/api/media.mjs +9 -9
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +28 -28
- package/dist/astro/routes/api/menus/_name_/items.mjs +28 -28
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +28 -28
- package/dist/astro/routes/api/menus/_name_/translations.mjs +28 -28
- package/dist/astro/routes/api/menus/_name_.mjs +28 -28
- package/dist/astro/routes/api/menus/index.mjs +28 -28
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +4 -4
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +9 -9
- package/dist/astro/routes/api/redirects/404s/summary.mjs +9 -9
- package/dist/astro/routes/api/redirects/_id_.mjs +29 -29
- package/dist/astro/routes/api/redirects/index.mjs +29 -29
- 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 +44 -41
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +44 -41
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +44 -41
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +44 -41
- package/dist/astro/routes/api/schema/collections/index.mjs +44 -41
- package/dist/astro/routes/api/schema/index.mjs +7 -7
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +42 -39
- package/dist/astro/routes/api/schema/orphans/index.mjs +42 -39
- package/dist/astro/routes/api/search/enable.mjs +10 -10
- package/dist/astro/routes/api/search/index.mjs +9 -9
- package/dist/astro/routes/api/search/rebuild.mjs +10 -10
- package/dist/astro/routes/api/search/stats.mjs +6 -6
- package/dist/astro/routes/api/search/suggest.mjs +9 -9
- package/dist/astro/routes/api/sections/_slug_.mjs +28 -28
- package/dist/astro/routes/api/sections/index.mjs +28 -28
- package/dist/astro/routes/api/settings/email.mjs +3 -3
- package/dist/astro/routes/api/settings.mjs +28 -28
- package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
- package/dist/astro/routes/api/setup/admin.mjs +9 -9
- package/dist/astro/routes/api/setup/dev-bypass.mjs +23 -23
- package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
- package/dist/astro/routes/api/setup/index.mjs +24 -24
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +6 -6
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +31 -31
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +31 -31
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +31 -31
- package/dist/astro/routes/api/taxonomies/index.mjs +31 -31
- package/dist/astro/routes/api/themes/preview.mjs +4 -4
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- 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 +27 -27
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +28 -28
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +28 -28
- package/dist/astro/routes/api/widget-areas/_name_.mjs +25 -25
- package/dist/astro/routes/api/widget-areas/index.mjs +28 -28
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +5 -5
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +7 -7
- package/dist/astro/routes/sitemap.xml.mjs +5 -5
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +2 -2
- package/dist/astro/types.d.mts +11 -11
- package/dist/{audit-B2pRxZ20.mjs → audit-BzhwRVym.mjs} +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-D71jourk.mjs → auth-control-guard-B_Dx-epW.mjs} +1 -1
- package/dist/{authorize-ZXPGPwKn.mjs → authorize-D6MkRtPw.mjs} +1 -1
- package/dist/{briefing-kRhegBoF.mjs → briefing-Cl70iEH5.mjs} +1 -1
- package/dist/{briefing-0rf-su3-.mjs → briefing-GFhLTLJo.mjs} +5 -5
- package/dist/{bundle-CEcdUa1s.mjs → bundle-CIrUlrkQ.mjs} +2 -2
- package/dist/{byline-7xR185Ly.mjs → byline-BJa1MyKB.mjs} +4 -4
- package/dist/{byline-fields-Ckeqd1OY.d.mts → byline-fields-sRHzS0aM.d.mts} +24 -24
- package/dist/{byline-fields-WN7RQT4q.mjs → byline-fields-yT4herdN.mjs} +1 -1
- package/dist/{bylines-C-EL6dh3.mjs → bylines-B53Saxdb.mjs} +3 -3
- package/dist/{bylines-CmZFCMr0.mjs → bylines-kixFoaRV.mjs} +5 -5
- package/dist/{cache-DkVCKGio.mjs → cache-fpisdt5Q.mjs} +1 -1
- package/dist/{chunks-ChGNDY8r.mjs → chunks-DX_b8_4Z.mjs} +1 -1
- package/dist/cli/index.mjs +626 -589
- package/dist/cli/plugin-kit.mjs +2 -2
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.mjs +2 -2
- package/dist/{client-factory-BDD9azPJ.mjs → client-factory-DEtHApCc.mjs} +93 -3
- package/dist/{comment-DFALgsJD.mjs → comment-B88XcvU1.mjs} +1 -1
- package/dist/{comment-reaction-C37bf99u.mjs → comment-reaction-Ckn6vCmB.mjs} +1 -1
- package/dist/{comments-B3NwDBxl.mjs → comments-BDXsbL7z.mjs} +1 -1
- package/dist/{content-DJcAYFhz.mjs → content-Cbl8HbIR.mjs} +2 -2
- package/dist/{content-refresh-B4ZCmxgd.mjs → content-refresh-BmkilU5M.mjs} +2 -2
- package/dist/{context-DnpXcp6Y.mjs → context-AJNd0tcG.mjs} +2 -2
- package/dist/{context-fSCYLL3c.mjs → context-DT0tIsfw.mjs} +8 -8
- package/dist/{context-route-helpers-CI8XzcsK.mjs → context-route-helpers-DhP--tTq.mjs} +2 -2
- package/dist/{dashboard-D0nj5oWg.mjs → dashboard-YvDEYbS3.mjs} +4 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-BJe6VEhP.mjs → device-flow-BKKeobcV.mjs} +4 -4
- package/dist/{error-CSVaQNZy.mjs → error-BW9f_ynq.mjs} +16 -2
- package/dist/{field-defs-cache-DL-T2XVS.mjs → field-defs-cache-CiXP3eO3.mjs} +1 -1
- package/dist/{fts-manager-ewTGohf4.mjs → fts-manager-Zo9uhGel.mjs} +1 -1
- package/dist/{hitl-requests-DEFj8e6u.mjs → hitl-requests-Bee8Cjj8.mjs} +2 -2
- package/dist/{hitl-route-helpers-C23JHaWz.mjs → hitl-route-helpers-DtHaKGgm.mjs} +5 -5
- package/dist/{import-CXXL5pip.mjs → import-C-zxnT89.mjs} +7 -7
- package/dist/{index-DcnOCD1e.d.mts → index-DybFmYtZ.d.mts} +3 -3
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +71 -69
- package/dist/integration-credentials-D3ZneN0L.mjs +49 -0
- package/dist/{jsonld-DzKbhRZ4.d.mts → jsonld-B9A2e0yv.d.mts} +2 -2
- package/dist/{load-CFtJRT3c.mjs → load-Cuiyh8LT.mjs} +1 -1
- package/dist/{loader-aWkkc1_o.mjs → loader-WHf22FwU.mjs} +2 -2
- package/dist/{manifest-schema-uA6pRFXi.mjs → manifest-schema-DKa3ZaJL.mjs} +1 -1
- package/dist/{mcp-reviewed-executor-Dn52L_yY.mjs → mcp-reviewed-executor-DnlF7mIL.mjs} +4 -4
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +10 -10
- package/dist/media/local-runtime.mjs +2 -2
- package/dist/{media-CVMOoywq.mjs → media-B4m-cnmj.mjs} +1 -1
- package/dist/{menus-CmyIkRG5.mjs → menus-LYALU2Mf.mjs} +1 -1
- package/dist/{menus-CCG2z5um.mjs → menus-oYfViqfE.mjs} +5 -5
- package/dist/{oauth-authorization-B9H7X85L.mjs → oauth-authorization-CX7aa8Ph.mjs} +4 -4
- package/dist/{oauth-clients-Dwl32-Uj.mjs → oauth-clients-D9Gg0WjF.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/page/index.d.mts +9 -9
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-i15EFSAE.mjs → parse-B-Y84oJl.mjs} +1 -1
- package/dist/plugin-utils.d.mts +8 -8
- package/dist/plugins/adapt-sandbox-entry.d.mts +8 -8
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-CPA2PtfY.mjs → plugins-B7-4Okii.mjs} +5 -5
- package/dist/{preview-BjedZm8G.mjs → preview-BMIReQGc.mjs} +2 -2
- package/dist/{provider-loader-DC2JdWeO.d.mts → provider-loader-BIbIiz0P.d.mts} +1 -1
- package/dist/{public-url-DQJCnYi9.d.mts → public-url-C8QUncg3.d.mts} +1 -1
- package/dist/{publication-authorization-RKiHXKtq.mjs → publication-authorization-BVQ5rCAF.mjs} +6 -6
- package/dist/{query-DEv5x6yB.mjs → query-C_m8sn-S.mjs} +12 -12
- package/dist/{query-C2U5u5_p.mjs → query-DNczixZr.mjs} +2 -2
- package/dist/{rate-limit-DglsAJSw.mjs → rate-limit-oUGexQO1.mjs} +2 -2
- package/dist/{redirect-ubhEqQCQ.mjs → redirect-DoDgOWIA.mjs} +1 -1
- package/dist/{redirects-xs2yahLq.mjs → redirects-CrP6U4hZ.mjs} +3 -3
- package/dist/{redirects-Bhpm8bRe.mjs → redirects-E_B6hvuz.mjs} +2 -2
- package/dist/{registry-BYYyb2tF.mjs → registry-SEJqFliS.mjs} +4 -4
- package/dist/{request-meta-CFe1tW2M.mjs → request-meta-DHFIzWcf.mjs} +1 -1
- package/dist/{review-requests-CTWGnWUt.mjs → review-requests-CObSuTYU.mjs} +1 -1
- package/dist/{review-requests-D42VEP1l.mjs → review-requests-Cu9051_B.mjs} +1 -1
- package/dist/{review-route-helpers-C31vO6SI.mjs → review-route-helpers-Dp_7PH8r.mjs} +2 -2
- package/dist/{runner-D6hzs8L9.d.mts → runner-Bcy5w0vj.d.mts} +1 -1
- package/dist/{runner-BgmttQmD.mjs → runner-BfWbi9YY.mjs} +461 -446
- package/dist/runtime.d.mts +9 -9
- package/dist/runtime.mjs +3 -3
- package/dist/schema-Dk_N31V4.mjs +8 -0
- package/dist/{search-DUKgZUlm.mjs → search-BXEQepxL.mjs} +3 -3
- package/dist/{sections-DvFgsnda.mjs → sections-DxvEF6Bj.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +17 -17
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.mjs +1 -1
- package/dist/{seo-BU8MLCS9.mjs → seo-D1RiaooQ.mjs} +1 -1
- package/dist/service-DbHMAoiN.mjs +347 -0
- package/dist/{service-FL3fB0Rx.mjs → service-QdG0YHws.mjs} +2 -2
- package/dist/{settings-EzADu-dd.mjs → settings-Dje-PHXo.mjs} +2 -2
- package/dist/{settings-BECcAIRH.mjs → settings-SVDAB7_W.mjs} +2 -2
- package/dist/{site-activity-h8smOlYI.mjs → site-activity-BVK40wCy.mjs} +1 -1
- package/dist/{site-context-B8T1kpUP.mjs → site-context-CzaEGizi.mjs} +13 -13
- 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 +1 -1
- package/dist/store-CCfMD6nw.mjs +262 -0
- package/dist/{taxonomies-BiM9NtgW.mjs → taxonomies-DuhGjBa8.mjs} +3 -3
- package/dist/{taxonomies-DSnY5nOa.mjs → taxonomies-WVnFki0o.mjs} +5 -5
- package/dist/{taxonomy-0k_vRVsD.mjs → taxonomy-CCo2plmV.mjs} +2 -2
- package/dist/{types-DuQn1G7-.d.mts → types-BFeoAIHl.d.mts} +13 -0
- package/dist/{types-ChxYDRvx.mjs → types-Bshd_6wQ.mjs} +1 -1
- package/dist/{types-opjX_kz6.d.mts → types-GtwhHAg8.d.mts} +1 -1
- package/dist/{types-DwoUifGE.d.mts → types-JovwyJFE.d.mts} +28 -27
- package/dist/ui/server-runtime.d.mts +12 -12
- package/dist/ui/server-runtime.mjs +19 -19
- package/dist/{user-BH-n01y3.mjs → user-Bcvr5ihC.mjs} +2 -2
- package/dist/{validate-CbVFoJgc.d.mts → validate-YiX3rly5.d.mts} +3 -3
- package/dist/{validate-D1HL-oLR.mjs → validate-qKzI3BCv.mjs} +1 -1
- package/dist/version-O6Zw1eqK.mjs +6 -0
- package/dist/{widgets-BZrLrNgS.mjs → widgets-DyGcotPM.mjs} +2 -2
- package/dist/{zod-generator-C7AsLpSB.mjs → zod-generator-Cr3SiHsc.mjs} +1 -1
- package/package.json +8 -6
- package/dist/forgeway-seo-client-G5ddhVHd.mjs +0 -456
- package/dist/project-env-DKibmuP8.mjs +0 -95
- package/dist/schema-DUtnZxjZ.mjs +0 -8
- package/dist/version-C3iVRuaF.mjs +0 -6
- /package/dist/{actor-0QJ1Gbtf.mjs → actor-DA7yL9Yp.mjs} +0 -0
- /package/dist/{adapters-BiRymx02.d.mts → adapters-DnMDRQ4e.d.mts} +0 -0
- /package/dist/{api-tokens-Ypaly90d.mjs → api-tokens-D4tcY8R6.mjs} +0 -0
- /package/dist/{challenge-store-D5pSY2S1.mjs → challenge-store-BMkL2kmt.mjs} +0 -0
- /package/dist/{components-DImzlLhb.mjs → components-D0w9MzQe.mjs} +0 -0
- /package/dist/{cron-B1SL_lsb.mjs → cron-D_c3WUPN.mjs} +0 -0
- /package/dist/{default-D4Vygcy_.mjs → default-BxoI3SoK.mjs} +0 -0
- /package/dist/{email-console-Bp0r68iF.mjs → email-console-BEMwuxhV.mjs} +0 -0
- /package/dist/{escape-DN4Qmjsl.mjs → escape-smSUOb7u.mjs} +0 -0
- /package/dist/{experimental-workflows-GVhUgzEs.mjs → experimental-workflows-CgO73K4e.mjs} +0 -0
- /package/dist/{media-allowlist-zDNJmXCo.mjs → media-allowlist-BQyIBPzd.mjs} +0 -0
- /package/dist/{media-url-BdoLPvg8.mjs → media-url-B6d-yVI6.mjs} +0 -0
- /package/dist/{mode-C8yZnIlR.mjs → mode-DPC7segX.mjs} +0 -0
- /package/dist/{oauth-state-store-CndT35iw.mjs → oauth-state-store-DPVzeoyY.mjs} +0 -0
- /package/dist/{oauth-user-lookup-CMehAaKs.mjs → oauth-user-lookup-3E5jlXrr.mjs} +0 -0
- /package/dist/{output-DhBe5_Pi.mjs → output-BbqsKnS_.mjs} +0 -0
- /package/dist/{parser-06LLLL4E.mjs → parser-DX_c5iG3.mjs} +0 -0
- /package/dist/{passkey-config-NYukYGed.mjs → passkey-config-DE_0EGEP.mjs} +0 -0
- /package/dist/{placeholder-DkWkXfDI.d.mts → placeholder-C6ZjZcmJ.d.mts} +0 -0
- /package/dist/{portable-text-E79LyjGo.d.mts → portable-text-Ehqj3I_y.d.mts} +0 -0
- /package/dist/{portable-text-BASHceim.mjs → portable-text-y8QVqTzd.mjs} +0 -0
- /package/dist/{provider-loader-BtfrrzfD.mjs → provider-loader-BeQcnPN1.mjs} +0 -0
- /package/dist/{public-url-Cp6hyjVR.mjs → public-url-BA-7LKvQ.mjs} +0 -0
- /package/dist/{redirect-DrbEmU9a.mjs → redirect-CZFAqHLr.mjs} +0 -0
- /package/dist/{resolve-DE71WcL9.mjs → resolve-B6BpqwAR.mjs} +0 -0
- /package/dist/{secrets-ZV5rd8yV.mjs → secrets-CpGpyGcO.mjs} +0 -0
- /package/dist/{seo-contributions-GnCuL1ML.mjs → seo-contributions-Ci8_12_r.mjs} +0 -0
- /package/dist/{session-user-Ct6GBLvn.mjs → session-user-BwliEFp0.mjs} +0 -0
- /package/dist/{setup-complete-Da0axZEE.mjs → setup-complete-PvF8I7Oh.mjs} +0 -0
- /package/dist/{setup-nonce-BtkKnvxQ.mjs → setup-nonce-DkpYROqg.mjs} +0 -0
- /package/dist/{sidecar-client-Ctzfyyp-.mjs → sidecar-client-dt5fv23q.mjs} +0 -0
- /package/dist/{site-url-DJEid0ml.mjs → site-url-DfYDZyWl.mjs} +0 -0
- /package/dist/{ssrf-FJqwQzj4.mjs → ssrf-BZHvtFEv.mjs} +0 -0
- /package/dist/{status-NqWOSFAD.mjs → status-BN40hMpr.mjs} +0 -0
- /package/dist/{tokens-BDQU29Vd.mjs → tokens-DIzhPT80.mjs} +0 -0
- /package/dist/{transport-D9pKAzFP.d.mts → transport-BZ3aqdu7.d.mts} +0 -0
- /package/dist/{transport-C46KHLMP.mjs → transport-D0dLIuDC.mjs} +0 -0
- /package/dist/{trusted-proxy-Dm7Mxvt6.mjs → trusted-proxy-czZuby6G.mjs} +0 -0
- /package/dist/{types-Cw0PeCT_.d.mts → types-BsTXSvKG.d.mts} +0 -0
- /package/dist/{types-BLQCz46p.d.mts → types-CDcuRd4z.d.mts} +0 -0
- /package/dist/{types-A8fPOJnl.mjs → types-CK0r-Xq4.mjs} +0 -0
- /package/dist/{types-g0zMtraY.d.mts → types-S9VIopdY.d.mts} +0 -0
- /package/dist/{types-wFu80FrO.d.mts → types-YxFz4lDr.d.mts} +0 -0
- /package/dist/{types-mVVgRPaU.mjs → types-gvNBqijt.mjs} +0 -0
- /package/dist/{types-B_FlxIIl.d.mts → types-ywmuDETA.d.mts} +0 -0
- /package/dist/{url-EMAguGVk.mjs → url-D282S1Zw.mjs} +0 -0
- /package/dist/{utils-D1SrKGtP.mjs → utils-B7gemXz5.mjs} +0 -0
- /package/dist/{wordpress-slugs-C3PWcowq.mjs → wordpress-slugs-D_LfQCan.mjs} +0 -0
package/dist/cli/index.mjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as runMigrations, n as getMigrationStatus, t as getMigrationFingerprint } from "../runner-
|
|
2
|
+
import { i as runMigrations, n as getMigrationStatus, t as getMigrationFingerprint } from "../runner-BfWbi9YY.mjs";
|
|
3
3
|
import { t as createDatabase } from "../connection-CiJWiWya.mjs";
|
|
4
4
|
import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
|
|
5
5
|
import { l as listTablesLike } from "../dialect-helpers-fk43GbDb.mjs";
|
|
6
6
|
import { n as getI18nConfig, r as isI18nEnabled } from "../config-CVssduLe.mjs";
|
|
7
7
|
import { i as encodeBase64url } from "../base64-F8-DUraK.mjs";
|
|
8
|
-
import "../types-
|
|
9
|
-
import { o as isMissingTableError } from "../loader-
|
|
8
|
+
import "../types-Bshd_6wQ.mjs";
|
|
9
|
+
import { o as isMissingTableError } from "../loader-WHf22FwU.mjs";
|
|
10
10
|
import "../object-cache-D51qOseS.mjs";
|
|
11
11
|
import { n as slugify } from "../slugify-KSsVD_D3.mjs";
|
|
12
|
-
import { t as ContentRepository } from "../content-
|
|
13
|
-
import { t as MediaRepository } from "../media-
|
|
14
|
-
import { t as TaxonomyRepository } from "../taxonomy-
|
|
12
|
+
import { t as ContentRepository } from "../content-Cbl8HbIR.mjs";
|
|
13
|
+
import { t as MediaRepository } from "../media-B4m-cnmj.mjs";
|
|
14
|
+
import { t as TaxonomyRepository } from "../taxonomy-CCo2plmV.mjs";
|
|
15
15
|
import { t as OptionsRepository } from "../options-DQPTH5n0.mjs";
|
|
16
|
-
import "../redirect-
|
|
16
|
+
import "../redirect-DoDgOWIA.mjs";
|
|
17
17
|
import "../request-cache-CBFjCwSt.mjs";
|
|
18
18
|
import "../byline-registry-Ba54M74c.mjs";
|
|
19
|
-
import "../field-defs-cache-
|
|
20
|
-
import { t as BylineRepository } from "../byline-
|
|
21
|
-
import "../content-refresh-
|
|
22
|
-
import "../fts-manager-
|
|
23
|
-
import { n as SchemaRegistry } from "../registry-
|
|
24
|
-
import "../settings-
|
|
25
|
-
import { n as VERSION } from "../version-
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { t as
|
|
30
|
-
import { t as
|
|
31
|
-
import {
|
|
32
|
-
import { n as
|
|
19
|
+
import "../field-defs-cache-CiXP3eO3.mjs";
|
|
20
|
+
import { t as BylineRepository } from "../byline-BJa1MyKB.mjs";
|
|
21
|
+
import "../content-refresh-BmkilU5M.mjs";
|
|
22
|
+
import "../fts-manager-Zo9uhGel.mjs";
|
|
23
|
+
import { n as SchemaRegistry } from "../registry-SEJqFliS.mjs";
|
|
24
|
+
import "../settings-SVDAB7_W.mjs";
|
|
25
|
+
import { n as VERSION } from "../version-O6Zw1eqK.mjs";
|
|
26
|
+
import { i as parseEncryptionKeys, n as fingerprintKey, r as generateEncryptionKey, t as DinewaySecretsError } from "../secrets-CpGpyGcO.mjs";
|
|
27
|
+
import { t as IntegrationCredentialStore } from "../store-CCfMD6nw.mjs";
|
|
28
|
+
import { a as reconcileManifestAccess, i as pluginManifestSchema } from "../manifest-schema-DKa3ZaJL.mjs";
|
|
29
|
+
import { n as resolveAndValidateExternalUrl, t as SsrfError } from "../ssrf-BZHvtFEv.mjs";
|
|
30
|
+
import { t as validateSeed } from "../validate-qKzI3BCv.mjs";
|
|
31
|
+
import { t as applySeed } from "../apply-DHT0l398.mjs";
|
|
32
|
+
import { _ as readForgewayCredentials, a as InvalidForgewayAccountCredentialsError, c as getForgewayDinewayAccount, d as normalizeForgewayEmail, f as readStoredForgewayAccount, g as listForgewayCredentials, h as sendForgewayAccountLoginLink, i as DEFAULT_FORGEWAY_API_BASE_URL, l as normalizeDinewayWebUrl, m as removeStoredForgewayAccount, n as DinewayToolsService, o as completeForgewayAccountLogin, p as refreshForgewayAccountCredentials, r as DEFAULT_DINEWAY_WEB_URL, s as createForgewayAccountClient, t as DinewayToolsError, u as normalizeForgewayApiUrl, v as writeForgewayCredentials } from "../service-DbHMAoiN.mjs";
|
|
33
|
+
import { n as output, t as configureOutputMode } from "../output-BbqsKnS_.mjs";
|
|
33
34
|
import { createHeaderAwareFetch, isRedirectResponse, resolveCustomHeaders } from "../client/external-auth-headers.mjs";
|
|
34
|
-
import { t as convertDataForRead } from "../portable-text-
|
|
35
|
-
import { a as
|
|
36
|
-
import { a as resolveDinewayBaseUrl, n as ensureProjectGitignoreDinewayLocalState, o as resolveDinewayToken, r as ensureProjectGitignoreEntry, s as upsertProjectEnv, t as DEFAULT_DINEWAY_URL } from "../project-env-DKibmuP8.mjs";
|
|
35
|
+
import { t as convertDataForRead } from "../portable-text-y8QVqTzd.mjs";
|
|
36
|
+
import { _ as saveMarketplaceCredential, a as ensureProjectGitignoreDinewayLocalState, c as resolveDinewayBaseUrl, d as getCredentials, f as getMarketplaceCredential, g as saveCredentials, h as resolveCredentialKey, i as DEFAULT_DINEWAY_URL, l as resolveDinewayToken, m as removeMarketplaceCredential, n as connectionArgs, o as ensureProjectGitignoreEntry, p as removeCredentials, r as createClientFromArgs, s as readProjectEnv, u as upsertProjectEnv } from "../client-factory-DEtHApCc.mjs";
|
|
37
37
|
import { LocalStorage } from "../storage/local.mjs";
|
|
38
|
-
import { r as fileExists$11, t as bundleCommand } from "../bundle-
|
|
38
|
+
import { r as fileExists$11, t as bundleCommand } from "../bundle-CIrUlrkQ.mjs";
|
|
39
39
|
import { createRequire } from "node:module";
|
|
40
40
|
import { createHash } from "node:crypto";
|
|
41
41
|
import { sql } from "kysely";
|
|
@@ -48,134 +48,10 @@ import { defineCommand, runCommand, runMain } from "citty";
|
|
|
48
48
|
import { createInterface } from "node:readline/promises";
|
|
49
49
|
import consola, { consola as consola$1 } from "consola";
|
|
50
50
|
import pc from "picocolors";
|
|
51
|
-
import { ForgewayClient } from "@forgeway/sdk";
|
|
52
51
|
import { access, mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
53
52
|
import { spawn } from "node:child_process";
|
|
54
53
|
import { parse } from "parse5";
|
|
55
54
|
|
|
56
|
-
//#region src/cli/forgeway-account.ts
|
|
57
|
-
const TRAILING_SLASH_PATTERN$1 = /\/$/;
|
|
58
|
-
const SHADOW_EMAIL_PATTERN$1 = /^shadow_[a-f0-9]{16}@dineway\.ai$/i;
|
|
59
|
-
const DEFAULT_FORGEWAY_API_BASE_URL = "https://api.dineway.ai";
|
|
60
|
-
const DEFAULT_DINEWAY_WEB_URL = "https://dineway.ai";
|
|
61
|
-
function normalizeForgewayApiUrl(value) {
|
|
62
|
-
return (value || DEFAULT_FORGEWAY_API_BASE_URL).replace(TRAILING_SLASH_PATTERN$1, "");
|
|
63
|
-
}
|
|
64
|
-
function normalizeDinewayWebUrl(value) {
|
|
65
|
-
return (value || DEFAULT_DINEWAY_WEB_URL).replace(TRAILING_SLASH_PATTERN$1, "");
|
|
66
|
-
}
|
|
67
|
-
function normalizeForgewayEmail(value) {
|
|
68
|
-
return value?.trim().toLowerCase() ?? "";
|
|
69
|
-
}
|
|
70
|
-
function isShadowForgewayEmail(email) {
|
|
71
|
-
return Boolean(email && SHADOW_EMAIL_PATTERN$1.test(email));
|
|
72
|
-
}
|
|
73
|
-
function createForgewayAccountClient(platformApiUrl, accessToken) {
|
|
74
|
-
return new ForgewayClient({
|
|
75
|
-
baseUrl: normalizeForgewayApiUrl(platformApiUrl),
|
|
76
|
-
accessToken,
|
|
77
|
-
isServerMode: true,
|
|
78
|
-
auth: { detectOAuthCallback: false }
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function normalizeForgewayUser$1(user) {
|
|
82
|
-
if (!user?.id || !user.email) throw new Error("Forgeway session response did not include a user email.");
|
|
83
|
-
return {
|
|
84
|
-
id: user.id,
|
|
85
|
-
name: user.profile?.name ?? user.name ?? user.email,
|
|
86
|
-
email: user.email,
|
|
87
|
-
avatarUrl: user.profile?.avatar_url ?? user.avatarUrl ?? user.avatar_url ?? null,
|
|
88
|
-
emailVerified: user.emailVerified ?? user.email_verified ?? false
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function assertFormalForgewayUser(user) {
|
|
92
|
-
if (!user || user.emailVerified !== true || isShadowForgewayEmail(user.email)) throw new Error("Dineway account commands require a verified Forgeway account.");
|
|
93
|
-
return user;
|
|
94
|
-
}
|
|
95
|
-
async function readStoredForgewayAccount(lookup = {}) {
|
|
96
|
-
const platformApiUrl = normalizeForgewayApiUrl(lookup.platformApiUrl);
|
|
97
|
-
const email = normalizeForgewayEmail(lookup.email);
|
|
98
|
-
if (email) return readForgewayCredentials({
|
|
99
|
-
platformApiUrl,
|
|
100
|
-
email
|
|
101
|
-
});
|
|
102
|
-
const stored = await readForgewayCredentials({ platformApiUrl });
|
|
103
|
-
if (stored) return stored;
|
|
104
|
-
const accounts = (await listForgewayCredentials(platformApiUrl)).filter((credentials) => {
|
|
105
|
-
try {
|
|
106
|
-
assertFormalForgewayUser(credentials.user);
|
|
107
|
-
return true;
|
|
108
|
-
} catch {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return accounts.length === 1 ? accounts[0] ?? null : null;
|
|
113
|
-
}
|
|
114
|
-
async function refreshForgewayAccountCredentials(credentials) {
|
|
115
|
-
const user = assertFormalForgewayUser(credentials.user);
|
|
116
|
-
if (!credentials.refreshToken) throw new Error("Stored Forgeway account is missing a refresh token. Run `dineway account login`.");
|
|
117
|
-
const { data, error } = await createForgewayAccountClient(credentials.platformApiUrl).auth.refreshSession({ refreshToken: credentials.refreshToken });
|
|
118
|
-
if (error || !data?.accessToken) throw new Error(error?.message || "Failed to refresh Forgeway account. Run `dineway account login`.");
|
|
119
|
-
const refreshedUser = normalizeForgewayUser$1(data.user);
|
|
120
|
-
if (normalizeForgewayEmail(refreshedUser.email) !== normalizeForgewayEmail(user.email)) throw new Error("Forgeway refresh returned credentials for a different account.");
|
|
121
|
-
const updated = {
|
|
122
|
-
...credentials,
|
|
123
|
-
platformApiUrl: normalizeForgewayApiUrl(credentials.platformApiUrl),
|
|
124
|
-
accessToken: data.accessToken,
|
|
125
|
-
refreshToken: data.refreshToken ?? credentials.refreshToken,
|
|
126
|
-
user: {
|
|
127
|
-
...refreshedUser,
|
|
128
|
-
emailVerified: true
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
await writeForgewayCredentials(updated, {
|
|
132
|
-
platformApiUrl: updated.platformApiUrl,
|
|
133
|
-
email: updated.user?.email
|
|
134
|
-
});
|
|
135
|
-
return updated;
|
|
136
|
-
}
|
|
137
|
-
async function sendForgewayAccountLoginLink(input) {
|
|
138
|
-
const platformApiUrl = normalizeForgewayApiUrl(input.platformApiUrl);
|
|
139
|
-
const webUrl = normalizeDinewayWebUrl(input.webUrl);
|
|
140
|
-
const redirectTo = new URL("/cli-auth", webUrl).toString();
|
|
141
|
-
const { error } = await createForgewayAccountClient(platformApiUrl).auth.sendPasswordlessSignInEmail({
|
|
142
|
-
email: input.email,
|
|
143
|
-
redirectTo
|
|
144
|
-
});
|
|
145
|
-
if (error) throw new Error(error.message || "Failed to send Forgeway account sign-in link.");
|
|
146
|
-
}
|
|
147
|
-
async function completeForgewayAccountLogin(input) {
|
|
148
|
-
const platformApiUrl = normalizeForgewayApiUrl(input.platformApiUrl);
|
|
149
|
-
const { data, error } = await createForgewayAccountClient(platformApiUrl).auth.signInWithPasswordlessToken({ token: input.token });
|
|
150
|
-
if (error || !data?.accessToken || !data.refreshToken) throw new Error(error?.message || "Forgeway sign-in token is invalid or expired.");
|
|
151
|
-
const user = normalizeForgewayUser$1(data.user);
|
|
152
|
-
if (input.email && normalizeForgewayEmail(user.email) !== normalizeForgewayEmail(input.email)) throw new Error("Forgeway sign-in returned credentials for a different email.");
|
|
153
|
-
const credentials = {
|
|
154
|
-
platformApiUrl,
|
|
155
|
-
accessToken: data.accessToken,
|
|
156
|
-
refreshToken: data.refreshToken,
|
|
157
|
-
user: {
|
|
158
|
-
...user,
|
|
159
|
-
emailVerified: true
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
await writeForgewayCredentials(credentials, {
|
|
163
|
-
platformApiUrl,
|
|
164
|
-
email: credentials.user?.email
|
|
165
|
-
});
|
|
166
|
-
return credentials;
|
|
167
|
-
}
|
|
168
|
-
async function getForgewayDinewayAccount(credentials) {
|
|
169
|
-
const refreshed = await refreshForgewayAccountCredentials(credentials);
|
|
170
|
-
const { data, error } = await createForgewayAccountClient(refreshed.platformApiUrl, refreshed.accessToken).dineway.getAccount();
|
|
171
|
-
if (error || !data) throw new Error(error?.message || "Failed to fetch Dineway account status from Forgeway.");
|
|
172
|
-
return {
|
|
173
|
-
credentials: refreshed,
|
|
174
|
-
account: data
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
55
|
//#region src/cli/commands/account.ts
|
|
180
56
|
async function promptLine(question) {
|
|
181
57
|
const readline = createInterface({
|
|
@@ -237,12 +113,14 @@ const accountLoginCommand = defineCommand({
|
|
|
237
113
|
consola$1.error("Email is required.");
|
|
238
114
|
process.exit(2);
|
|
239
115
|
}
|
|
116
|
+
let validatingStoredAccount = false;
|
|
240
117
|
try {
|
|
241
118
|
const existing = await readStoredForgewayAccount({
|
|
242
119
|
platformApiUrl,
|
|
243
120
|
email
|
|
244
121
|
});
|
|
245
122
|
if (existing && !args.token && !args["send-link"]) {
|
|
123
|
+
validatingStoredAccount = true;
|
|
246
124
|
const { account } = await getForgewayDinewayAccount(existing);
|
|
247
125
|
if (args.json) outputAccountJson({
|
|
248
126
|
loggedIn: true,
|
|
@@ -290,6 +168,15 @@ const accountLoginCommand = defineCommand({
|
|
|
290
168
|
consola$1.info(`Hosted sites: ${account.sites.usedHostedSites.toLocaleString()} / ${account.sites.hostedSiteLimitLabel}`);
|
|
291
169
|
}
|
|
292
170
|
} catch (error) {
|
|
171
|
+
if (validatingStoredAccount && error instanceof InvalidForgewayAccountCredentialsError) {
|
|
172
|
+
await removeStoredForgewayAccount({
|
|
173
|
+
platformApiUrl,
|
|
174
|
+
email
|
|
175
|
+
});
|
|
176
|
+
consola$1.error("Stored Dineway account credentials were invalid and have been cleared.");
|
|
177
|
+
consola$1.info(`Run ${pc.cyan(`dineway account login --email ${email}`)} again to sign in.`);
|
|
178
|
+
process.exit(2);
|
|
179
|
+
}
|
|
293
180
|
consola$1.error(error instanceof Error ? error.message : "Dineway account login failed");
|
|
294
181
|
process.exit(2);
|
|
295
182
|
}
|
|
@@ -1699,6 +1586,66 @@ const flyTarget = {
|
|
|
1699
1586
|
}
|
|
1700
1587
|
};
|
|
1701
1588
|
|
|
1589
|
+
//#endregion
|
|
1590
|
+
//#region src/cli/commands/deploy/utils/config.ts
|
|
1591
|
+
const DINEWAY_DIR_NAME = ".dineway";
|
|
1592
|
+
const DEPLOY_STATE_FILE_NAME = "deploy.json";
|
|
1593
|
+
function deployStatePath(cwd) {
|
|
1594
|
+
return join(cwd, DINEWAY_DIR_NAME, DEPLOY_STATE_FILE_NAME);
|
|
1595
|
+
}
|
|
1596
|
+
function emptyDeployState() {
|
|
1597
|
+
return { version: 1 };
|
|
1598
|
+
}
|
|
1599
|
+
async function readDeployPackageJson(cwd) {
|
|
1600
|
+
const content = await readFile(join(cwd, "package.json"), "utf-8");
|
|
1601
|
+
return JSON.parse(content);
|
|
1602
|
+
}
|
|
1603
|
+
async function readDeployState(cwd) {
|
|
1604
|
+
try {
|
|
1605
|
+
const content = await readFile(deployStatePath(cwd), "utf-8");
|
|
1606
|
+
return {
|
|
1607
|
+
...emptyDeployState(),
|
|
1608
|
+
...JSON.parse(content),
|
|
1609
|
+
version: 1
|
|
1610
|
+
};
|
|
1611
|
+
} catch (error) {
|
|
1612
|
+
if (error && typeof error === "object" && error.code === "ENOENT") return emptyDeployState();
|
|
1613
|
+
throw error;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
async function writeDeployState(cwd, state) {
|
|
1617
|
+
await mkdir(join(cwd, DINEWAY_DIR_NAME), { recursive: true });
|
|
1618
|
+
await writeFile(deployStatePath(cwd), JSON.stringify({
|
|
1619
|
+
...state,
|
|
1620
|
+
version: 1
|
|
1621
|
+
}, null, " ") + "\n", "utf-8");
|
|
1622
|
+
}
|
|
1623
|
+
async function readSavedDeployTarget(cwd) {
|
|
1624
|
+
return (await readDeployState(cwd)).target;
|
|
1625
|
+
}
|
|
1626
|
+
async function writeDeployTarget(cwd, target) {
|
|
1627
|
+
await writeDeployState(cwd, {
|
|
1628
|
+
...await readDeployState(cwd),
|
|
1629
|
+
target
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
async function readForgewayDeployMetadata(cwd) {
|
|
1633
|
+
return (await readDeployState(cwd)).targets?.forgeway ?? {};
|
|
1634
|
+
}
|
|
1635
|
+
async function writeForgewayDeployMetadata(cwd, metadata) {
|
|
1636
|
+
const state = await readDeployState(cwd);
|
|
1637
|
+
await writeDeployState(cwd, {
|
|
1638
|
+
...state,
|
|
1639
|
+
targets: {
|
|
1640
|
+
...state.targets,
|
|
1641
|
+
forgeway: {
|
|
1642
|
+
...state.targets?.forgeway,
|
|
1643
|
+
...metadata
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1702
1649
|
//#endregion
|
|
1703
1650
|
//#region src/cli/commands/deploy/targets/forgeway.ts
|
|
1704
1651
|
const DEFAULT_DINEWAY_API_BASE_URL = "https://api.dineway.ai";
|
|
@@ -3550,7 +3497,7 @@ const devCommand = defineCommand({
|
|
|
3550
3497
|
const remoteUrl = pkg.dineway?.url || process.env.DINEWAY_URL;
|
|
3551
3498
|
if (!remoteUrl) consola.warn("No remote URL configured. Set DINEWAY_URL or dineway.url in package.json");
|
|
3552
3499
|
else try {
|
|
3553
|
-
const { createClientFromArgs } = await import("../client-factory-
|
|
3500
|
+
const { createClientFromArgs } = await import("../client-factory-DEtHApCc.mjs").then((n) => n.t);
|
|
3554
3501
|
const client = createClientFromArgs({ url: remoteUrl });
|
|
3555
3502
|
const schema = await client.schemaExport();
|
|
3556
3503
|
const types = await client.schemaTypes();
|
|
@@ -4256,6 +4203,76 @@ async function getTaxonomyAssignments(taxonomyRepo, collection, entryId) {
|
|
|
4256
4203
|
return result;
|
|
4257
4204
|
}
|
|
4258
4205
|
|
|
4206
|
+
//#endregion
|
|
4207
|
+
//#region src/integration-credentials/environment-import.ts
|
|
4208
|
+
const INTEGRATION_CREDENTIAL_IMPORT_MARKER = "dineway:integration_credentials_environment_import_v1";
|
|
4209
|
+
const INTEGRATION_TOKEN_ENV_SOURCES = [
|
|
4210
|
+
["akta", "AKTA_API_KEY"],
|
|
4211
|
+
["apify", "APIFY_API_TOKEN"],
|
|
4212
|
+
["apollo", "APOLLO_API_KEY"],
|
|
4213
|
+
["bundle-social", "BUNDLE_SOCIAL_API_KEY"],
|
|
4214
|
+
["context.dev", "CONTEXT_DEV_API_KEY"],
|
|
4215
|
+
["elevenlabs", "ELEVENLABS_API_KEY"],
|
|
4216
|
+
["exa", "EXA_API_KEY"],
|
|
4217
|
+
["firecrawl", "FIRECRAWL_API_KEY"],
|
|
4218
|
+
["google-places", "GOOGLE_PLACES_API_KEY"],
|
|
4219
|
+
["minimax", "MINIMAX_API_KEY"],
|
|
4220
|
+
["pdl", "PDL_API_KEY"],
|
|
4221
|
+
["semrush", "SEMRUSH_V4_API_KEY"],
|
|
4222
|
+
["tabapi", "TABAPI_API_KEY"],
|
|
4223
|
+
["tikhub", "TIKHUB_API_KEY"]
|
|
4224
|
+
];
|
|
4225
|
+
async function importIntegrationCredentialsFromEnvironment(db, env) {
|
|
4226
|
+
if (await new OptionsRepository(db).exists(INTEGRATION_CREDENTIAL_IMPORT_MARKER)) return {
|
|
4227
|
+
status: "already_completed",
|
|
4228
|
+
providers: []
|
|
4229
|
+
};
|
|
4230
|
+
const credentials = collectEnvironmentCredentials(env);
|
|
4231
|
+
const keys = await parseEncryptionKeys(env.DINEWAY_ENCRYPTION_KEY);
|
|
4232
|
+
if (credentials.length > 0 && (!keys || keys.length === 0)) throw new DinewaySecretsError("DINEWAY_ENCRYPTION_KEY is required to import Integration credentials.", "ENCRYPTION_KEY_REQUIRED");
|
|
4233
|
+
await db.transaction().execute(async (trx) => {
|
|
4234
|
+
const store = new IntegrationCredentialStore(trx, { keys: keys ?? [] });
|
|
4235
|
+
for (const entry of credentials) await store.set(entry.provider, entry.credential, "environment");
|
|
4236
|
+
await new OptionsRepository(trx).set(INTEGRATION_CREDENTIAL_IMPORT_MARKER, {
|
|
4237
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4238
|
+
providerCount: credentials.length
|
|
4239
|
+
});
|
|
4240
|
+
});
|
|
4241
|
+
return {
|
|
4242
|
+
status: credentials.length > 0 ? "imported" : "completed_empty",
|
|
4243
|
+
providers: credentials.map((entry) => entry.provider)
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4246
|
+
function collectEnvironmentCredentials(env) {
|
|
4247
|
+
const credentials = [];
|
|
4248
|
+
for (const [provider, variable] of INTEGRATION_TOKEN_ENV_SOURCES) {
|
|
4249
|
+
const value = nonEmpty(env[variable]);
|
|
4250
|
+
if (value) credentials.push({
|
|
4251
|
+
provider,
|
|
4252
|
+
credential: {
|
|
4253
|
+
type: "token",
|
|
4254
|
+
value
|
|
4255
|
+
}
|
|
4256
|
+
});
|
|
4257
|
+
}
|
|
4258
|
+
const username = nonEmpty(env.DATAFORSEO_LOGIN);
|
|
4259
|
+
const password = nonEmpty(env.DATAFORSEO_PASSWORD);
|
|
4260
|
+
if (username && !password || !username && password) throw new DinewaySecretsError("DATAFORSEO_LOGIN and DATAFORSEO_PASSWORD must both be set for the initial Integration import.", "INCOMPLETE_INTEGRATION_CREDENTIAL");
|
|
4261
|
+
if (username && password) credentials.push({
|
|
4262
|
+
provider: "dataforseo",
|
|
4263
|
+
credential: {
|
|
4264
|
+
type: "basic",
|
|
4265
|
+
username,
|
|
4266
|
+
password
|
|
4267
|
+
}
|
|
4268
|
+
});
|
|
4269
|
+
return credentials;
|
|
4270
|
+
}
|
|
4271
|
+
function nonEmpty(value) {
|
|
4272
|
+
const trimmed = value?.trim();
|
|
4273
|
+
return trimmed ? trimmed : null;
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4259
4276
|
//#endregion
|
|
4260
4277
|
//#region src/cli/commands/init.ts
|
|
4261
4278
|
/**
|
|
@@ -4354,6 +4371,17 @@ const initCommand = defineCommand({
|
|
|
4354
4371
|
await db.destroy();
|
|
4355
4372
|
process.exit(1);
|
|
4356
4373
|
}
|
|
4374
|
+
try {
|
|
4375
|
+
const imported = await importIntegrationCredentialsFromEnvironment(db, {
|
|
4376
|
+
...readProjectEnv(cwd),
|
|
4377
|
+
...process.env
|
|
4378
|
+
});
|
|
4379
|
+
if (imported.status === "imported") consola.success(`Imported Integration configuration for ${imported.providers.length} providers`);
|
|
4380
|
+
} catch (error) {
|
|
4381
|
+
consola.error("Integration configuration import failed. No provider credentials were stored.", error);
|
|
4382
|
+
await db.destroy();
|
|
4383
|
+
process.exit(1);
|
|
4384
|
+
}
|
|
4357
4385
|
const alreadyInitialized = await isAlreadyInitialized(db);
|
|
4358
4386
|
if (alreadyInitialized && !args.force) {
|
|
4359
4387
|
await db.destroy();
|
|
@@ -5463,7 +5491,7 @@ const publishCommand = defineCommand({
|
|
|
5463
5491
|
const pluginDir = resolve(args.dir);
|
|
5464
5492
|
try {
|
|
5465
5493
|
const { runCommand } = await import("citty");
|
|
5466
|
-
const { bundleCommand } = await import("../bundle-
|
|
5494
|
+
const { bundleCommand } = await import("../bundle-CIrUlrkQ.mjs").then((n) => n.n);
|
|
5467
5495
|
await runCommand(bundleCommand, { rawArgs: ["--dir", pluginDir] });
|
|
5468
5496
|
} catch {
|
|
5469
5497
|
consola.error("Build failed");
|
|
@@ -6939,31 +6967,6 @@ const jsonArgs = { json: {
|
|
|
6939
6967
|
type: "boolean",
|
|
6940
6968
|
description: "Output as JSON"
|
|
6941
6969
|
} };
|
|
6942
|
-
const hostedProviderArgs = {
|
|
6943
|
-
...jsonArgs,
|
|
6944
|
-
"force-refresh": {
|
|
6945
|
-
type: "boolean",
|
|
6946
|
-
description: "Bypass Forgeway SEO provider cache"
|
|
6947
|
-
}
|
|
6948
|
-
};
|
|
6949
|
-
const dataForSeoCommonArgs = {
|
|
6950
|
-
...hostedProviderArgs,
|
|
6951
|
-
"location-code": {
|
|
6952
|
-
type: "string",
|
|
6953
|
-
description: "DataForSEO location code",
|
|
6954
|
-
default: "2840"
|
|
6955
|
-
},
|
|
6956
|
-
"language-code": {
|
|
6957
|
-
type: "string",
|
|
6958
|
-
description: "DataForSEO language code",
|
|
6959
|
-
default: "en"
|
|
6960
|
-
},
|
|
6961
|
-
device: {
|
|
6962
|
-
type: "string",
|
|
6963
|
-
description: "Device type: desktop or mobile",
|
|
6964
|
-
default: "desktop"
|
|
6965
|
-
}
|
|
6966
|
-
};
|
|
6967
6970
|
function toStringValue(value) {
|
|
6968
6971
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
6969
6972
|
}
|
|
@@ -6973,9 +6976,6 @@ function toNumberValue(value, fallback) {
|
|
|
6973
6976
|
const parsed = Number(raw);
|
|
6974
6977
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
6975
6978
|
}
|
|
6976
|
-
function forceRefresh(args) {
|
|
6977
|
-
return args["force-refresh"] === true;
|
|
6978
|
-
}
|
|
6979
6979
|
function formats(value) {
|
|
6980
6980
|
const raw = toStringValue(value);
|
|
6981
6981
|
if (!raw) return void 0;
|
|
@@ -7078,420 +7078,13 @@ const crawlCommand = defineCommand({
|
|
|
7078
7078
|
}
|
|
7079
7079
|
}) }
|
|
7080
7080
|
});
|
|
7081
|
-
function
|
|
7082
|
-
const normalized = toStringValue(value) ?? "desktop";
|
|
7083
|
-
if (normalized === "desktop" || normalized === "mobile") return normalized;
|
|
7084
|
-
throw new Error("device must be desktop or mobile.");
|
|
7085
|
-
}
|
|
7086
|
-
function aiScrapePlatform(value) {
|
|
7087
|
-
const normalized = toStringValue(value) ?? "chat_gpt";
|
|
7088
|
-
if (normalized === "chat_gpt" || normalized === "gemini" || normalized === "perplexity") return normalized;
|
|
7089
|
-
throw new Error("platform must be chat_gpt, gemini, or perplexity.");
|
|
7090
|
-
}
|
|
7091
|
-
function aiMentionPlatform(value) {
|
|
7092
|
-
const normalized = toStringValue(value) ?? "google";
|
|
7093
|
-
if (normalized === "google" || normalized === "chat_gpt") return normalized;
|
|
7094
|
-
throw new Error("platform must be google or chat_gpt.");
|
|
7095
|
-
}
|
|
7096
|
-
function dataForSeoBase(args) {
|
|
7097
|
-
return {
|
|
7098
|
-
locationCode: toNumberValue(args["location-code"], 2840),
|
|
7099
|
-
languageCode: toStringValue(args["language-code"]) ?? "en",
|
|
7100
|
-
device: dataForSeoDevice(args.device),
|
|
7101
|
-
forceRefresh: forceRefresh(args)
|
|
7102
|
-
};
|
|
7103
|
-
}
|
|
7104
|
-
function createSeoCommand(options = {}) {
|
|
7105
|
-
const providerService = options.providerService ?? new SeoProviderEvidenceService(new ForgewaySeoGatewayClient());
|
|
7106
|
-
async function runSeoRequest(args, resource, request) {
|
|
7107
|
-
configureOutputMode(args);
|
|
7108
|
-
try {
|
|
7109
|
-
output(await request(), args);
|
|
7110
|
-
} catch (error) {
|
|
7111
|
-
if (await handleCliPaywall({
|
|
7112
|
-
error,
|
|
7113
|
-
resource,
|
|
7114
|
-
context: { providerPath: resource }
|
|
7115
|
-
})) process.exit(2);
|
|
7116
|
-
consola$1.error(error instanceof Error ? error.message : "Unknown error");
|
|
7117
|
-
process.exit(1);
|
|
7118
|
-
}
|
|
7119
|
-
}
|
|
7120
|
-
const firecrawlCommand = defineCommand({
|
|
7121
|
-
meta: {
|
|
7122
|
-
name: "firecrawl",
|
|
7123
|
-
description: "Forgeway-hosted Firecrawl workflows"
|
|
7124
|
-
},
|
|
7125
|
-
subCommands: {
|
|
7126
|
-
scrape: defineCommand({
|
|
7127
|
-
meta: {
|
|
7128
|
-
name: "scrape",
|
|
7129
|
-
description: "Scrape one URL through Forgeway-hosted Firecrawl"
|
|
7130
|
-
},
|
|
7131
|
-
args: {
|
|
7132
|
-
url: {
|
|
7133
|
-
type: "positional",
|
|
7134
|
-
description: "URL to scrape",
|
|
7135
|
-
required: true
|
|
7136
|
-
},
|
|
7137
|
-
...hostedProviderArgs,
|
|
7138
|
-
formats: {
|
|
7139
|
-
type: "string",
|
|
7140
|
-
description: "Comma-separated Firecrawl formats",
|
|
7141
|
-
default: "markdown"
|
|
7142
|
-
},
|
|
7143
|
-
"only-main-content": {
|
|
7144
|
-
type: "boolean",
|
|
7145
|
-
description: "Return main content only",
|
|
7146
|
-
default: true
|
|
7147
|
-
},
|
|
7148
|
-
"timeout-ms": {
|
|
7149
|
-
type: "string",
|
|
7150
|
-
description: "Provider timeout in milliseconds",
|
|
7151
|
-
default: "60000"
|
|
7152
|
-
}
|
|
7153
|
-
},
|
|
7154
|
-
async run({ args }) {
|
|
7155
|
-
await runSeoRequest(args, "/api/firecrawl/scrape", () => providerService.firecrawlScrape({
|
|
7156
|
-
url: requireArg(args.url, "url"),
|
|
7157
|
-
formats: formats(args.formats) ?? ["markdown"],
|
|
7158
|
-
onlyMainContent: args["only-main-content"] !== false,
|
|
7159
|
-
timeoutMs: toNumberValue(args["timeout-ms"], 6e4),
|
|
7160
|
-
forceRefresh: forceRefresh(args)
|
|
7161
|
-
}));
|
|
7162
|
-
}
|
|
7163
|
-
}),
|
|
7164
|
-
map: defineCommand({
|
|
7165
|
-
meta: {
|
|
7166
|
-
name: "map",
|
|
7167
|
-
description: "Map URLs through Forgeway-hosted Firecrawl"
|
|
7168
|
-
},
|
|
7169
|
-
args: {
|
|
7170
|
-
url: {
|
|
7171
|
-
type: "positional",
|
|
7172
|
-
description: "Base URL to map",
|
|
7173
|
-
required: true
|
|
7174
|
-
},
|
|
7175
|
-
...hostedProviderArgs,
|
|
7176
|
-
search: {
|
|
7177
|
-
type: "string",
|
|
7178
|
-
description: "Optional relevance search term"
|
|
7179
|
-
},
|
|
7180
|
-
sitemap: {
|
|
7181
|
-
type: "string",
|
|
7182
|
-
description: "Sitemap mode: skip, include, or only",
|
|
7183
|
-
default: "include"
|
|
7184
|
-
},
|
|
7185
|
-
limit: {
|
|
7186
|
-
type: "string",
|
|
7187
|
-
description: "Maximum URLs",
|
|
7188
|
-
default: "100"
|
|
7189
|
-
},
|
|
7190
|
-
"include-subdomains": {
|
|
7191
|
-
type: "boolean",
|
|
7192
|
-
description: "Include subdomains"
|
|
7193
|
-
},
|
|
7194
|
-
"ignore-query-parameters": {
|
|
7195
|
-
type: "boolean",
|
|
7196
|
-
description: "Ignore query parameters",
|
|
7197
|
-
default: true
|
|
7198
|
-
}
|
|
7199
|
-
},
|
|
7200
|
-
async run({ args }) {
|
|
7201
|
-
await runSeoRequest(args, "/api/firecrawl/map", () => providerService.firecrawlMap({
|
|
7202
|
-
url: requireArg(args.url, "url"),
|
|
7203
|
-
search: toStringValue(args.search),
|
|
7204
|
-
sitemap: sitemapMode(args.sitemap),
|
|
7205
|
-
limit: toNumberValue(args.limit, 100),
|
|
7206
|
-
includeSubdomains: args["include-subdomains"] === true,
|
|
7207
|
-
ignoreQueryParameters: args["ignore-query-parameters"] !== false,
|
|
7208
|
-
forceRefresh: forceRefresh(args)
|
|
7209
|
-
}));
|
|
7210
|
-
}
|
|
7211
|
-
}),
|
|
7212
|
-
crawl: defineCommand({
|
|
7213
|
-
meta: {
|
|
7214
|
-
name: "crawl",
|
|
7215
|
-
description: "Start a bounded Firecrawl crawl, or check status with --id"
|
|
7216
|
-
},
|
|
7217
|
-
args: {
|
|
7218
|
-
url: {
|
|
7219
|
-
type: "positional",
|
|
7220
|
-
description: "Base URL to crawl",
|
|
7221
|
-
required: false
|
|
7222
|
-
},
|
|
7223
|
-
...hostedProviderArgs,
|
|
7224
|
-
id: {
|
|
7225
|
-
type: "string",
|
|
7226
|
-
description: "Existing Firecrawl crawl id to check"
|
|
7227
|
-
},
|
|
7228
|
-
limit: {
|
|
7229
|
-
type: "string",
|
|
7230
|
-
description: "Maximum pages",
|
|
7231
|
-
default: "25"
|
|
7232
|
-
},
|
|
7233
|
-
"max-depth": {
|
|
7234
|
-
type: "string",
|
|
7235
|
-
description: "Maximum discovery depth",
|
|
7236
|
-
default: "3"
|
|
7237
|
-
},
|
|
7238
|
-
"allow-subdomains": {
|
|
7239
|
-
type: "boolean",
|
|
7240
|
-
description: "Allow subdomains"
|
|
7241
|
-
},
|
|
7242
|
-
"allow-external-links": {
|
|
7243
|
-
type: "boolean",
|
|
7244
|
-
description: "Allow external links"
|
|
7245
|
-
},
|
|
7246
|
-
formats: {
|
|
7247
|
-
type: "string",
|
|
7248
|
-
description: "Comma-separated scrape formats",
|
|
7249
|
-
default: "markdown"
|
|
7250
|
-
}
|
|
7251
|
-
},
|
|
7252
|
-
async run({ args }) {
|
|
7253
|
-
const crawlId = toStringValue(args.id);
|
|
7254
|
-
if (crawlId) {
|
|
7255
|
-
await runSeoRequest(args, `/api/firecrawl/crawl/${crawlId}`, () => providerService.firecrawlCrawlStatus({ id: crawlId }));
|
|
7256
|
-
return;
|
|
7257
|
-
}
|
|
7258
|
-
await runSeoRequest(args, "/api/firecrawl/crawl", () => providerService.firecrawlCrawlStart({
|
|
7259
|
-
url: requireArg(args.url, "url"),
|
|
7260
|
-
limit: toNumberValue(args.limit, 25),
|
|
7261
|
-
maxDiscoveryDepth: toNumberValue(args["max-depth"], 3),
|
|
7262
|
-
allowExternalLinks: args["allow-external-links"] === true,
|
|
7263
|
-
allowSubdomains: args["allow-subdomains"] === true,
|
|
7264
|
-
scrapeFormats: formats(args.formats) ?? ["markdown"],
|
|
7265
|
-
forceRefresh: forceRefresh(args)
|
|
7266
|
-
}));
|
|
7267
|
-
}
|
|
7268
|
-
}),
|
|
7269
|
-
search: defineCommand({
|
|
7270
|
-
meta: {
|
|
7271
|
-
name: "search",
|
|
7272
|
-
description: "Search through Forgeway-hosted Firecrawl"
|
|
7273
|
-
},
|
|
7274
|
-
args: {
|
|
7275
|
-
query: {
|
|
7276
|
-
type: "positional",
|
|
7277
|
-
description: "Search query",
|
|
7278
|
-
required: true
|
|
7279
|
-
},
|
|
7280
|
-
...hostedProviderArgs,
|
|
7281
|
-
limit: {
|
|
7282
|
-
type: "string",
|
|
7283
|
-
description: "Maximum results",
|
|
7284
|
-
default: "10"
|
|
7285
|
-
},
|
|
7286
|
-
scrape: {
|
|
7287
|
-
type: "boolean",
|
|
7288
|
-
description: "Scrape result markdown"
|
|
7289
|
-
}
|
|
7290
|
-
},
|
|
7291
|
-
async run({ args }) {
|
|
7292
|
-
await runSeoRequest(args, "/api/firecrawl/search", () => providerService.firecrawlSearch({
|
|
7293
|
-
query: requireArg(args.query, "query"),
|
|
7294
|
-
limit: toNumberValue(args.limit, 10),
|
|
7295
|
-
scrape: args.scrape === true,
|
|
7296
|
-
forceRefresh: forceRefresh(args)
|
|
7297
|
-
}));
|
|
7298
|
-
}
|
|
7299
|
-
})
|
|
7300
|
-
}
|
|
7301
|
-
});
|
|
7302
|
-
const dataForSeoSerpCommand = defineCommand({
|
|
7303
|
-
meta: {
|
|
7304
|
-
name: "serp",
|
|
7305
|
-
description: "Fetch Google organic SERP data"
|
|
7306
|
-
},
|
|
7307
|
-
args: {
|
|
7308
|
-
keyword: {
|
|
7309
|
-
type: "positional",
|
|
7310
|
-
description: "Keyword",
|
|
7311
|
-
required: true
|
|
7312
|
-
},
|
|
7313
|
-
...dataForSeoCommonArgs,
|
|
7314
|
-
depth: {
|
|
7315
|
-
type: "string",
|
|
7316
|
-
description: "SERP depth",
|
|
7317
|
-
default: "10"
|
|
7318
|
-
}
|
|
7319
|
-
},
|
|
7320
|
-
async run({ args }) {
|
|
7321
|
-
await runSeoRequest(args, "/api/dataforseo/serp", () => providerService.dataForSeoSerp({
|
|
7322
|
-
keyword: requireArg(args.keyword, "keyword"),
|
|
7323
|
-
depth: toNumberValue(args.depth, 10),
|
|
7324
|
-
...dataForSeoBase(args)
|
|
7325
|
-
}));
|
|
7326
|
-
}
|
|
7327
|
-
});
|
|
7328
|
-
const dataForSeoMapsCommand = defineCommand({
|
|
7329
|
-
meta: {
|
|
7330
|
-
name: "maps",
|
|
7331
|
-
description: "Fetch Google Maps SERP data"
|
|
7332
|
-
},
|
|
7333
|
-
args: {
|
|
7334
|
-
keyword: {
|
|
7335
|
-
type: "positional",
|
|
7336
|
-
description: "Keyword",
|
|
7337
|
-
required: true
|
|
7338
|
-
},
|
|
7339
|
-
...dataForSeoCommonArgs,
|
|
7340
|
-
depth: {
|
|
7341
|
-
type: "string",
|
|
7342
|
-
description: "Maps depth",
|
|
7343
|
-
default: "10"
|
|
7344
|
-
}
|
|
7345
|
-
},
|
|
7346
|
-
async run({ args }) {
|
|
7347
|
-
await runSeoRequest(args, "/api/dataforseo/maps", () => providerService.dataForSeoMaps({
|
|
7348
|
-
keyword: requireArg(args.keyword, "keyword"),
|
|
7349
|
-
depth: toNumberValue(args.depth, 10),
|
|
7350
|
-
...dataForSeoBase(args)
|
|
7351
|
-
}));
|
|
7352
|
-
}
|
|
7353
|
-
});
|
|
7354
|
-
const dataForSeoKeywordsCommand = defineCommand({
|
|
7355
|
-
meta: {
|
|
7356
|
-
name: "keywords",
|
|
7357
|
-
description: "Fetch keyword suggestions"
|
|
7358
|
-
},
|
|
7359
|
-
args: {
|
|
7360
|
-
keyword: {
|
|
7361
|
-
type: "positional",
|
|
7362
|
-
description: "Seed keyword",
|
|
7363
|
-
required: true
|
|
7364
|
-
},
|
|
7365
|
-
...dataForSeoCommonArgs,
|
|
7366
|
-
limit: {
|
|
7367
|
-
type: "string",
|
|
7368
|
-
description: "Maximum suggestions",
|
|
7369
|
-
default: "20"
|
|
7370
|
-
}
|
|
7371
|
-
},
|
|
7372
|
-
async run({ args }) {
|
|
7373
|
-
await runSeoRequest(args, "/api/dataforseo/keywords", () => providerService.dataForSeoKeywords({
|
|
7374
|
-
keyword: requireArg(args.keyword, "keyword"),
|
|
7375
|
-
limit: toNumberValue(args.limit, 20),
|
|
7376
|
-
...dataForSeoBase(args)
|
|
7377
|
-
}));
|
|
7378
|
-
}
|
|
7379
|
-
});
|
|
7380
|
-
const dataForSeoCompetitorsCommand = defineCommand({
|
|
7381
|
-
meta: {
|
|
7382
|
-
name: "competitors",
|
|
7383
|
-
description: "Fetch competitor-domain data"
|
|
7384
|
-
},
|
|
7385
|
-
args: {
|
|
7386
|
-
domain: {
|
|
7387
|
-
type: "positional",
|
|
7388
|
-
description: "Target domain",
|
|
7389
|
-
required: true
|
|
7390
|
-
},
|
|
7391
|
-
...dataForSeoCommonArgs,
|
|
7392
|
-
limit: {
|
|
7393
|
-
type: "string",
|
|
7394
|
-
description: "Maximum competitors",
|
|
7395
|
-
default: "20"
|
|
7396
|
-
}
|
|
7397
|
-
},
|
|
7398
|
-
async run({ args }) {
|
|
7399
|
-
await runSeoRequest(args, "/api/dataforseo/competitors", () => providerService.dataForSeoCompetitors({
|
|
7400
|
-
domain: requireArg(args.domain, "domain"),
|
|
7401
|
-
limit: toNumberValue(args.limit, 20),
|
|
7402
|
-
...dataForSeoBase(args)
|
|
7403
|
-
}));
|
|
7404
|
-
}
|
|
7405
|
-
});
|
|
7406
|
-
const dataForSeoAiScrapeCommand = defineCommand({
|
|
7407
|
-
meta: {
|
|
7408
|
-
name: "ai-scrape",
|
|
7409
|
-
description: "Fetch DataForSEO AI scraper response data"
|
|
7410
|
-
},
|
|
7411
|
-
args: {
|
|
7412
|
-
keyword: {
|
|
7413
|
-
type: "positional",
|
|
7414
|
-
description: "AI search keyword",
|
|
7415
|
-
required: true
|
|
7416
|
-
},
|
|
7417
|
-
...dataForSeoCommonArgs,
|
|
7418
|
-
platform: {
|
|
7419
|
-
type: "string",
|
|
7420
|
-
description: "AI platform: chat_gpt, gemini, or perplexity",
|
|
7421
|
-
default: "chat_gpt"
|
|
7422
|
-
}
|
|
7423
|
-
},
|
|
7424
|
-
async run({ args }) {
|
|
7425
|
-
await runSeoRequest(args, "/api/dataforseo/ai-scrape", () => providerService.dataForSeoAiScrape({
|
|
7426
|
-
keyword: requireArg(args.keyword, "keyword"),
|
|
7427
|
-
platform: aiScrapePlatform(args.platform),
|
|
7428
|
-
...dataForSeoBase(args)
|
|
7429
|
-
}));
|
|
7430
|
-
}
|
|
7431
|
-
});
|
|
7432
|
-
const dataForSeoAiMentionsCommand = defineCommand({
|
|
7433
|
-
meta: {
|
|
7434
|
-
name: "ai-mentions",
|
|
7435
|
-
description: "Fetch DataForSEO LLM mention data"
|
|
7436
|
-
},
|
|
7437
|
-
args: {
|
|
7438
|
-
...dataForSeoCommonArgs,
|
|
7439
|
-
domain: {
|
|
7440
|
-
type: "string",
|
|
7441
|
-
description: "Target domain"
|
|
7442
|
-
},
|
|
7443
|
-
keyword: {
|
|
7444
|
-
type: "string",
|
|
7445
|
-
description: "Target keyword"
|
|
7446
|
-
},
|
|
7447
|
-
platform: {
|
|
7448
|
-
type: "string",
|
|
7449
|
-
description: "Mention platform: google or chat_gpt",
|
|
7450
|
-
default: "google"
|
|
7451
|
-
},
|
|
7452
|
-
limit: {
|
|
7453
|
-
type: "string",
|
|
7454
|
-
description: "Maximum mentions",
|
|
7455
|
-
default: "20"
|
|
7456
|
-
}
|
|
7457
|
-
},
|
|
7458
|
-
async run({ args }) {
|
|
7459
|
-
if (!toStringValue(args.domain) && !toStringValue(args.keyword)) {
|
|
7460
|
-
consola$1.error("domain or keyword is required.");
|
|
7461
|
-
process.exit(1);
|
|
7462
|
-
}
|
|
7463
|
-
await runSeoRequest(args, "/api/dataforseo/ai-mentions", () => providerService.dataForSeoAiMentions({
|
|
7464
|
-
domain: toStringValue(args.domain),
|
|
7465
|
-
keyword: toStringValue(args.keyword),
|
|
7466
|
-
platform: aiMentionPlatform(args.platform),
|
|
7467
|
-
limit: toNumberValue(args.limit, 20),
|
|
7468
|
-
...dataForSeoBase(args)
|
|
7469
|
-
}));
|
|
7470
|
-
}
|
|
7471
|
-
});
|
|
7081
|
+
function createSeoCommand() {
|
|
7472
7082
|
return defineCommand({
|
|
7473
7083
|
meta: {
|
|
7474
7084
|
name: "seo",
|
|
7475
|
-
description: "
|
|
7085
|
+
description: "Deterministic local SEO evidence"
|
|
7476
7086
|
},
|
|
7477
|
-
subCommands: {
|
|
7478
|
-
crawl: crawlCommand,
|
|
7479
|
-
firecrawl: firecrawlCommand,
|
|
7480
|
-
dataforseo: defineCommand({
|
|
7481
|
-
meta: {
|
|
7482
|
-
name: "dataforseo",
|
|
7483
|
-
description: "Forgeway-hosted DataForSEO workflows"
|
|
7484
|
-
},
|
|
7485
|
-
subCommands: {
|
|
7486
|
-
serp: dataForSeoSerpCommand,
|
|
7487
|
-
maps: dataForSeoMapsCommand,
|
|
7488
|
-
keywords: dataForSeoKeywordsCommand,
|
|
7489
|
-
competitors: dataForSeoCompetitorsCommand,
|
|
7490
|
-
"ai-scrape": dataForSeoAiScrapeCommand,
|
|
7491
|
-
"ai-mentions": dataForSeoAiMentionsCommand
|
|
7492
|
-
}
|
|
7493
|
-
})
|
|
7494
|
-
}
|
|
7087
|
+
subCommands: { crawl: crawlCommand }
|
|
7495
7088
|
});
|
|
7496
7089
|
}
|
|
7497
7090
|
const seoCommand = createSeoCommand();
|
|
@@ -7613,6 +7206,449 @@ const taxonomyCommand = defineCommand({
|
|
|
7613
7206
|
}
|
|
7614
7207
|
});
|
|
7615
7208
|
|
|
7209
|
+
//#endregion
|
|
7210
|
+
//#region src/cli/commands/tools.ts
|
|
7211
|
+
const ENV_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7212
|
+
const CREDENTIAL_HEADER_PATTERN = /^(authorization|proxy-authorization|x-api-key|api-key|apikey|token|access-token|private-key)$/i;
|
|
7213
|
+
const accountArgs = {
|
|
7214
|
+
email: {
|
|
7215
|
+
type: "string",
|
|
7216
|
+
alias: "e",
|
|
7217
|
+
description: "Forgeway account email"
|
|
7218
|
+
},
|
|
7219
|
+
"api-url": {
|
|
7220
|
+
type: "string",
|
|
7221
|
+
description: "Forgeway API URL",
|
|
7222
|
+
default: DEFAULT_FORGEWAY_API_BASE_URL
|
|
7223
|
+
},
|
|
7224
|
+
json: {
|
|
7225
|
+
type: "boolean",
|
|
7226
|
+
description: "Output the complete JSON response"
|
|
7227
|
+
}
|
|
7228
|
+
};
|
|
7229
|
+
const endpointArgs = {
|
|
7230
|
+
provider: {
|
|
7231
|
+
type: "string",
|
|
7232
|
+
alias: "p",
|
|
7233
|
+
description: "Provider slug",
|
|
7234
|
+
required: true
|
|
7235
|
+
},
|
|
7236
|
+
endpoint: {
|
|
7237
|
+
type: "string",
|
|
7238
|
+
alias: "e",
|
|
7239
|
+
description: "Provider endpoint path",
|
|
7240
|
+
required: true
|
|
7241
|
+
}
|
|
7242
|
+
};
|
|
7243
|
+
const credentialReferenceArgs = {
|
|
7244
|
+
"credential-token-env": {
|
|
7245
|
+
type: "string",
|
|
7246
|
+
description: "Environment variable containing a request-scoped provider token"
|
|
7247
|
+
},
|
|
7248
|
+
"credential-basic-username-env": {
|
|
7249
|
+
type: "string",
|
|
7250
|
+
description: "Environment variable containing a request-scoped basic-auth username"
|
|
7251
|
+
},
|
|
7252
|
+
"credential-basic-password-env": {
|
|
7253
|
+
type: "string",
|
|
7254
|
+
description: "Environment variable containing a request-scoped basic-auth password"
|
|
7255
|
+
}
|
|
7256
|
+
};
|
|
7257
|
+
function createToolsCommand(options = {}) {
|
|
7258
|
+
const createService = options.createService ?? createCliToolsService;
|
|
7259
|
+
return defineCommand({
|
|
7260
|
+
meta: {
|
|
7261
|
+
name: "tools",
|
|
7262
|
+
description: "Discover, inspect, and run Forgeway Integration endpoints"
|
|
7263
|
+
},
|
|
7264
|
+
subCommands: {
|
|
7265
|
+
discover: defineCommand({
|
|
7266
|
+
meta: {
|
|
7267
|
+
name: "discover",
|
|
7268
|
+
description: "Find Forgeway Integration endpoints from a natural-language need"
|
|
7269
|
+
},
|
|
7270
|
+
args: {
|
|
7271
|
+
...accountArgs,
|
|
7272
|
+
query: {
|
|
7273
|
+
type: "string",
|
|
7274
|
+
alias: "q",
|
|
7275
|
+
description: "Natural-language endpoint need",
|
|
7276
|
+
required: true
|
|
7277
|
+
},
|
|
7278
|
+
limit: {
|
|
7279
|
+
type: "string",
|
|
7280
|
+
alias: "l",
|
|
7281
|
+
description: "Maximum results (1-100)"
|
|
7282
|
+
},
|
|
7283
|
+
"min-score": {
|
|
7284
|
+
type: "string",
|
|
7285
|
+
description: "Minimum relevance score (0-1)"
|
|
7286
|
+
}
|
|
7287
|
+
},
|
|
7288
|
+
async run({ args }) {
|
|
7289
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7290
|
+
const result = await (await createService(resolvedArgs)).discover({
|
|
7291
|
+
query: requiredString(resolvedArgs.query, "query"),
|
|
7292
|
+
limit: optionalNumber(resolvedArgs.limit, "limit", {
|
|
7293
|
+
integer: true,
|
|
7294
|
+
min: 1,
|
|
7295
|
+
max: 100
|
|
7296
|
+
}) ?? 10,
|
|
7297
|
+
minScore: optionalNumber(resolvedArgs["min-score"], "min-score", {
|
|
7298
|
+
min: 0,
|
|
7299
|
+
max: 1
|
|
7300
|
+
})
|
|
7301
|
+
});
|
|
7302
|
+
emitResult(result, discoverSummary(result), resolvedArgs);
|
|
7303
|
+
});
|
|
7304
|
+
}
|
|
7305
|
+
}),
|
|
7306
|
+
inspect: defineCommand({
|
|
7307
|
+
meta: {
|
|
7308
|
+
name: "inspect",
|
|
7309
|
+
description: "Inspect an endpoint schema, output, credits, cache, and risk contract"
|
|
7310
|
+
},
|
|
7311
|
+
args: {
|
|
7312
|
+
...accountArgs,
|
|
7313
|
+
...endpointArgs
|
|
7314
|
+
},
|
|
7315
|
+
async run({ args }) {
|
|
7316
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7317
|
+
const result = await (await createService(resolvedArgs)).inspect(endpointRequest(resolvedArgs));
|
|
7318
|
+
emitResult(result, inspectSummary(result), resolvedArgs);
|
|
7319
|
+
});
|
|
7320
|
+
}
|
|
7321
|
+
}),
|
|
7322
|
+
run: defineCommand({
|
|
7323
|
+
meta: {
|
|
7324
|
+
name: "run",
|
|
7325
|
+
description: "Run one inspected Forgeway Integration endpoint"
|
|
7326
|
+
},
|
|
7327
|
+
args: {
|
|
7328
|
+
...accountArgs,
|
|
7329
|
+
...endpointArgs,
|
|
7330
|
+
...credentialReferenceArgs,
|
|
7331
|
+
input: {
|
|
7332
|
+
type: "string",
|
|
7333
|
+
alias: "i",
|
|
7334
|
+
description: "Body JSON"
|
|
7335
|
+
},
|
|
7336
|
+
"input-file": {
|
|
7337
|
+
type: "string",
|
|
7338
|
+
alias: "f",
|
|
7339
|
+
description: "Read body JSON from a file"
|
|
7340
|
+
},
|
|
7341
|
+
query: {
|
|
7342
|
+
type: "string",
|
|
7343
|
+
description: "Query parameters JSON object"
|
|
7344
|
+
},
|
|
7345
|
+
path: {
|
|
7346
|
+
type: "string",
|
|
7347
|
+
description: "Path parameters JSON object"
|
|
7348
|
+
},
|
|
7349
|
+
header: {
|
|
7350
|
+
type: "string",
|
|
7351
|
+
description: "Non-credential header parameters JSON object"
|
|
7352
|
+
},
|
|
7353
|
+
wait: {
|
|
7354
|
+
type: "boolean",
|
|
7355
|
+
alias: "w",
|
|
7356
|
+
description: "Wait for a terminal run state"
|
|
7357
|
+
},
|
|
7358
|
+
"wait-timeout": {
|
|
7359
|
+
type: "string",
|
|
7360
|
+
description: "Maximum wait in seconds",
|
|
7361
|
+
default: "300"
|
|
7362
|
+
},
|
|
7363
|
+
output: {
|
|
7364
|
+
type: "string",
|
|
7365
|
+
alias: "o",
|
|
7366
|
+
description: "Write provider output as JSON"
|
|
7367
|
+
},
|
|
7368
|
+
"force-refresh": {
|
|
7369
|
+
type: "boolean",
|
|
7370
|
+
description: "Bypass eligible Forgeway cache"
|
|
7371
|
+
},
|
|
7372
|
+
"confirm-side-effect": {
|
|
7373
|
+
type: "boolean",
|
|
7374
|
+
description: "Confirm the inspected endpoint's external side effect"
|
|
7375
|
+
},
|
|
7376
|
+
"idempotency-key": {
|
|
7377
|
+
type: "string",
|
|
7378
|
+
description: "Stable idempotency key required for side-effecting endpoints"
|
|
7379
|
+
}
|
|
7380
|
+
},
|
|
7381
|
+
async run({ args }) {
|
|
7382
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7383
|
+
if (resolvedArgs["confirm-side-effect"] && !resolvedArgs["idempotency-key"]) throw new DinewayToolsError("--confirm-side-effect requires --idempotency-key.", "IDEMPOTENCY_KEY_REQUIRED");
|
|
7384
|
+
const service = await createService(resolvedArgs);
|
|
7385
|
+
const result = await service.run({
|
|
7386
|
+
...endpointRequest(resolvedArgs),
|
|
7387
|
+
input: await parseEndpointInput(resolvedArgs),
|
|
7388
|
+
credential: resolveInlineCredential(resolvedArgs),
|
|
7389
|
+
forceRefresh: resolvedArgs["force-refresh"] === true,
|
|
7390
|
+
confirmSideEffect: resolvedArgs["confirm-side-effect"] === true
|
|
7391
|
+
}, { idempotencyKey: optionalString(resolvedArgs["idempotency-key"]) });
|
|
7392
|
+
const finalResult = resolvedArgs.wait ? await service.waitForRun(result.runId, { timeoutMs: requiredNumber(resolvedArgs["wait-timeout"], "wait-timeout", { min: 1 }) * 1e3 }) : result;
|
|
7393
|
+
if (resolvedArgs.output) await writeFile(resolvedArgs.output, JSON.stringify(finalResult.output ?? finalResult.artifact ?? finalResult, null, 2) + "\n", "utf-8");
|
|
7394
|
+
emitResult(finalResult, runSummary(finalResult), resolvedArgs);
|
|
7395
|
+
});
|
|
7396
|
+
}
|
|
7397
|
+
}),
|
|
7398
|
+
runs: defineCommand({
|
|
7399
|
+
meta: {
|
|
7400
|
+
name: "runs",
|
|
7401
|
+
description: "List, get, poll, and stop Integration runs"
|
|
7402
|
+
},
|
|
7403
|
+
subCommands: {
|
|
7404
|
+
list: defineCommand({
|
|
7405
|
+
meta: {
|
|
7406
|
+
name: "list",
|
|
7407
|
+
description: "List recent Forgeway Integration runs"
|
|
7408
|
+
},
|
|
7409
|
+
args: {
|
|
7410
|
+
...accountArgs,
|
|
7411
|
+
limit: {
|
|
7412
|
+
type: "string",
|
|
7413
|
+
alias: "l",
|
|
7414
|
+
description: "Maximum runs (1-100)"
|
|
7415
|
+
},
|
|
7416
|
+
cursor: {
|
|
7417
|
+
type: "string",
|
|
7418
|
+
description: "Pagination cursor"
|
|
7419
|
+
}
|
|
7420
|
+
},
|
|
7421
|
+
async run({ args }) {
|
|
7422
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7423
|
+
const result = await (await createService(resolvedArgs)).listRuns({
|
|
7424
|
+
limit: optionalNumber(resolvedArgs.limit, "limit", {
|
|
7425
|
+
integer: true,
|
|
7426
|
+
min: 1,
|
|
7427
|
+
max: 100
|
|
7428
|
+
}),
|
|
7429
|
+
cursor: optionalString(resolvedArgs.cursor)
|
|
7430
|
+
});
|
|
7431
|
+
emitResult(result, runsSummary(result.items, result.nextCursor), resolvedArgs);
|
|
7432
|
+
});
|
|
7433
|
+
}
|
|
7434
|
+
}),
|
|
7435
|
+
get: defineCommand({
|
|
7436
|
+
meta: {
|
|
7437
|
+
name: "get",
|
|
7438
|
+
description: "Get or poll one Forgeway Integration run"
|
|
7439
|
+
},
|
|
7440
|
+
args: {
|
|
7441
|
+
...accountArgs,
|
|
7442
|
+
"run-id": {
|
|
7443
|
+
type: "string",
|
|
7444
|
+
alias: "r",
|
|
7445
|
+
description: "Run ID",
|
|
7446
|
+
required: true
|
|
7447
|
+
},
|
|
7448
|
+
wait: {
|
|
7449
|
+
type: "boolean",
|
|
7450
|
+
alias: "w",
|
|
7451
|
+
description: "Wait for a terminal run state"
|
|
7452
|
+
},
|
|
7453
|
+
"wait-timeout": {
|
|
7454
|
+
type: "string",
|
|
7455
|
+
description: "Maximum wait in seconds",
|
|
7456
|
+
default: "300"
|
|
7457
|
+
}
|
|
7458
|
+
},
|
|
7459
|
+
async run({ args }) {
|
|
7460
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7461
|
+
const service = await createService(resolvedArgs);
|
|
7462
|
+
const runId = requiredString(resolvedArgs["run-id"], "run-id");
|
|
7463
|
+
const result = resolvedArgs.wait ? await service.waitForRun(runId, { timeoutMs: requiredNumber(resolvedArgs["wait-timeout"], "wait-timeout", { min: 1 }) * 1e3 }) : await service.getRun(runId);
|
|
7464
|
+
emitResult(result, runSummary(result), resolvedArgs);
|
|
7465
|
+
});
|
|
7466
|
+
}
|
|
7467
|
+
}),
|
|
7468
|
+
stop: defineCommand({
|
|
7469
|
+
meta: {
|
|
7470
|
+
name: "stop",
|
|
7471
|
+
description: "Request cancellation for a stoppable Integration run"
|
|
7472
|
+
},
|
|
7473
|
+
args: {
|
|
7474
|
+
...accountArgs,
|
|
7475
|
+
...credentialReferenceArgs,
|
|
7476
|
+
"run-id": {
|
|
7477
|
+
type: "string",
|
|
7478
|
+
alias: "r",
|
|
7479
|
+
description: "Run ID",
|
|
7480
|
+
required: true
|
|
7481
|
+
}
|
|
7482
|
+
},
|
|
7483
|
+
async run({ args }) {
|
|
7484
|
+
await executeToolsCommand(args, async (resolvedArgs) => {
|
|
7485
|
+
const result = await (await createService(resolvedArgs)).stopRun(requiredString(resolvedArgs["run-id"], "run-id"), { credential: resolveInlineCredential(resolvedArgs) });
|
|
7486
|
+
emitResult(result, result, resolvedArgs);
|
|
7487
|
+
});
|
|
7488
|
+
}
|
|
7489
|
+
})
|
|
7490
|
+
}
|
|
7491
|
+
})
|
|
7492
|
+
}
|
|
7493
|
+
});
|
|
7494
|
+
}
|
|
7495
|
+
const toolsCommand = createToolsCommand();
|
|
7496
|
+
async function createCliToolsService(args) {
|
|
7497
|
+
const credentials = await readStoredForgewayAccount({
|
|
7498
|
+
platformApiUrl: normalizeForgewayApiUrl(optionalString(args["api-url"]) ?? process.env["DINEWAY_API_BASE_URL"] ?? process.env["FORGEWAY_API_URL"]),
|
|
7499
|
+
email: normalizeForgewayEmail(optionalString(args.email))
|
|
7500
|
+
});
|
|
7501
|
+
if (!credentials) throw new DinewayToolsError("Dineway Tools requires a verified Forgeway account. Run `dineway account login`.", "FORGEWAY_ACCOUNT_REQUIRED");
|
|
7502
|
+
const refreshed = await refreshForgewayAccountCredentials(credentials);
|
|
7503
|
+
return new DinewayToolsService(createForgewayAccountClient(refreshed.platformApiUrl, refreshed.accessToken).integration);
|
|
7504
|
+
}
|
|
7505
|
+
async function executeToolsCommand(args, operation) {
|
|
7506
|
+
configureOutputMode(args);
|
|
7507
|
+
try {
|
|
7508
|
+
await operation(args);
|
|
7509
|
+
} catch (error) {
|
|
7510
|
+
const message = error instanceof Error ? error.message : "Dineway Tools request failed.";
|
|
7511
|
+
consola$1.error(message);
|
|
7512
|
+
process.exitCode = 2;
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
function endpointRequest(args) {
|
|
7516
|
+
const endpoint = requiredString(args.endpoint, "endpoint");
|
|
7517
|
+
if (!endpoint.startsWith("/")) throw new DinewayToolsError("Endpoint must start with '/'.", "INVALID_ENDPOINT");
|
|
7518
|
+
return {
|
|
7519
|
+
provider: requiredString(args.provider, "provider"),
|
|
7520
|
+
endpoint
|
|
7521
|
+
};
|
|
7522
|
+
}
|
|
7523
|
+
async function parseEndpointInput(args) {
|
|
7524
|
+
if (args.input && args["input-file"]) throw new DinewayToolsError("Choose either --input or --input-file, not both.", "DUPLICATE_BODY_INPUT");
|
|
7525
|
+
const body = args["input-file"] ? parseJson(await readFile(args["input-file"], "utf-8"), "input-file") : args.input ? parseJson(args.input, "input") : void 0;
|
|
7526
|
+
const queryParams = parseJsonObject(args.query, "query");
|
|
7527
|
+
const pathParams = parseJsonObject(args.path, "path");
|
|
7528
|
+
const headerParams = parseHeaderParams(args.header);
|
|
7529
|
+
return {
|
|
7530
|
+
...body === void 0 ? {} : { body },
|
|
7531
|
+
...queryParams ? { queryParams } : {},
|
|
7532
|
+
...pathParams ? { pathParams } : {},
|
|
7533
|
+
...headerParams ? { headerParams } : {}
|
|
7534
|
+
};
|
|
7535
|
+
}
|
|
7536
|
+
function resolveInlineCredential(args) {
|
|
7537
|
+
const tokenEnv = optionalString(args["credential-token-env"]);
|
|
7538
|
+
const usernameEnv = optionalString(args["credential-basic-username-env"]);
|
|
7539
|
+
const passwordEnv = optionalString(args["credential-basic-password-env"]);
|
|
7540
|
+
if (tokenEnv && (usernameEnv || passwordEnv)) throw new DinewayToolsError("Choose either token or basic credential environment references, not both.", "CREDENTIAL_MODE_CONFLICT");
|
|
7541
|
+
if (usernameEnv && !passwordEnv || !usernameEnv && passwordEnv) throw new DinewayToolsError("Basic credential username and password environment references must be provided together.", "INCOMPLETE_BASIC_CREDENTIAL");
|
|
7542
|
+
if (tokenEnv) return {
|
|
7543
|
+
type: "token",
|
|
7544
|
+
value: readCredentialEnvironmentValue(tokenEnv)
|
|
7545
|
+
};
|
|
7546
|
+
if (usernameEnv && passwordEnv) return {
|
|
7547
|
+
type: "basic",
|
|
7548
|
+
username: readCredentialEnvironmentValue(usernameEnv),
|
|
7549
|
+
password: readCredentialEnvironmentValue(passwordEnv)
|
|
7550
|
+
};
|
|
7551
|
+
}
|
|
7552
|
+
function readCredentialEnvironmentValue(name) {
|
|
7553
|
+
if (!ENV_NAME_PATTERN.test(name)) throw new DinewayToolsError(`Invalid credential environment variable name: ${name}`, "INVALID_CREDENTIAL_ENV_NAME");
|
|
7554
|
+
const value = process.env[name];
|
|
7555
|
+
if (!value) throw new DinewayToolsError(`Credential environment variable ${name} is not set.`, "CREDENTIAL_ENV_MISSING");
|
|
7556
|
+
return value;
|
|
7557
|
+
}
|
|
7558
|
+
function parseHeaderParams(raw) {
|
|
7559
|
+
const value = parseJsonObject(raw, "header");
|
|
7560
|
+
if (!value) return void 0;
|
|
7561
|
+
for (const name of Object.keys(value)) if (CREDENTIAL_HEADER_PATTERN.test(name)) throw new DinewayToolsError("Credential headers are not allowed. Use environment credential references.", "CREDENTIAL_HEADER_FORBIDDEN");
|
|
7562
|
+
return value;
|
|
7563
|
+
}
|
|
7564
|
+
function parseJsonObject(raw, label) {
|
|
7565
|
+
if (raw === void 0) return void 0;
|
|
7566
|
+
const value = parseJson(requiredString(raw, label), label);
|
|
7567
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new DinewayToolsError(`--${label} must be a JSON object.`, "INVALID_JSON_OBJECT");
|
|
7568
|
+
return value;
|
|
7569
|
+
}
|
|
7570
|
+
function parseJson(raw, label) {
|
|
7571
|
+
try {
|
|
7572
|
+
const value = JSON.parse(raw);
|
|
7573
|
+
if (!isIntegrationJsonValue(value)) throw new Error("Unsupported JSON value");
|
|
7574
|
+
return value;
|
|
7575
|
+
} catch {
|
|
7576
|
+
throw new DinewayToolsError(`--${label} contains invalid JSON.`, "INVALID_JSON");
|
|
7577
|
+
}
|
|
7578
|
+
}
|
|
7579
|
+
function isIntegrationJsonValue(value) {
|
|
7580
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
7581
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
7582
|
+
if (Array.isArray(value)) return value.every(isIntegrationJsonValue);
|
|
7583
|
+
if (typeof value !== "object") return false;
|
|
7584
|
+
return Object.values(value).every(isIntegrationJsonValue);
|
|
7585
|
+
}
|
|
7586
|
+
function requiredString(value, label) {
|
|
7587
|
+
const resolved = optionalString(value);
|
|
7588
|
+
if (!resolved) throw new DinewayToolsError(`--${label} is required.`, "MISSING_ARGUMENT");
|
|
7589
|
+
return resolved;
|
|
7590
|
+
}
|
|
7591
|
+
function optionalString(value) {
|
|
7592
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
7593
|
+
}
|
|
7594
|
+
function optionalNumber(value, label, options) {
|
|
7595
|
+
return value === void 0 ? void 0 : requiredNumber(value, label, options);
|
|
7596
|
+
}
|
|
7597
|
+
function requiredNumber(value, label, options) {
|
|
7598
|
+
const parsed = Number(value);
|
|
7599
|
+
if (!Number.isFinite(parsed) || options.integer && !Number.isInteger(parsed) || options.min !== void 0 && parsed < options.min || options.max !== void 0 && parsed > options.max) throw new DinewayToolsError(`--${label} has an invalid numeric value.`, "INVALID_NUMBER");
|
|
7600
|
+
return parsed;
|
|
7601
|
+
}
|
|
7602
|
+
function emitResult(full, human, args) {
|
|
7603
|
+
output(args.json || !process.stdout.isTTY ? full : human, args);
|
|
7604
|
+
}
|
|
7605
|
+
function discoverSummary(result) {
|
|
7606
|
+
return {
|
|
7607
|
+
query: result.query,
|
|
7608
|
+
count: result.count,
|
|
7609
|
+
items: result.results.map(({ endpoint, score }) => ({
|
|
7610
|
+
provider: endpoint.provider,
|
|
7611
|
+
endpoint: endpoint.endpoint,
|
|
7612
|
+
name: endpoint.displayName,
|
|
7613
|
+
score: Number(score.toFixed(3)),
|
|
7614
|
+
estimatedCredits: endpoint.pricing.estimatedCredits,
|
|
7615
|
+
risk: endpoint.risk.level
|
|
7616
|
+
}))
|
|
7617
|
+
};
|
|
7618
|
+
}
|
|
7619
|
+
function inspectSummary(result) {
|
|
7620
|
+
return {
|
|
7621
|
+
provider: result.provider,
|
|
7622
|
+
endpoint: result.endpoint,
|
|
7623
|
+
method: result.method,
|
|
7624
|
+
name: result.displayName,
|
|
7625
|
+
pricing: result.pricing,
|
|
7626
|
+
cache: result.cache,
|
|
7627
|
+
risk: result.risk,
|
|
7628
|
+
async: result.async,
|
|
7629
|
+
input: result.input
|
|
7630
|
+
};
|
|
7631
|
+
}
|
|
7632
|
+
function runSummary(result) {
|
|
7633
|
+
return {
|
|
7634
|
+
runId: result.runId,
|
|
7635
|
+
provider: result.provider,
|
|
7636
|
+
endpoint: result.endpoint,
|
|
7637
|
+
status: result.status,
|
|
7638
|
+
stoppable: result.stoppable,
|
|
7639
|
+
cache: result.cache,
|
|
7640
|
+
billing: result.billing,
|
|
7641
|
+
artifact: result.artifact,
|
|
7642
|
+
error: result.error
|
|
7643
|
+
};
|
|
7644
|
+
}
|
|
7645
|
+
function runsSummary(items, nextCursor) {
|
|
7646
|
+
return {
|
|
7647
|
+
items: items.map(runSummary),
|
|
7648
|
+
...nextCursor ? { nextCursor } : {}
|
|
7649
|
+
};
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7616
7652
|
//#endregion
|
|
7617
7653
|
//#region src/cli/commands/types.ts
|
|
7618
7654
|
/**
|
|
@@ -7789,6 +7825,7 @@ const builtInCommands = {
|
|
|
7789
7825
|
schema: schemaCommand,
|
|
7790
7826
|
media: mediaCommand,
|
|
7791
7827
|
search: searchCommand,
|
|
7828
|
+
tools: toolsCommand,
|
|
7792
7829
|
seo: seoCommand,
|
|
7793
7830
|
taxonomy: taxonomyCommand,
|
|
7794
7831
|
menu: menuCommand,
|