@synteq/cli 0.1.6 → 1.1.1
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/bin/run.js +61 -2
- package/dist/api/client.d.ts +363 -5
- package/dist/api/client.js +559 -44
- package/dist/api/client.js.map +1 -1
- package/dist/api/factory.d.ts +3 -0
- package/dist/api/factory.js +6 -3
- package/dist/api/factory.js.map +1 -1
- package/dist/api/types.d.ts +896 -4
- package/dist/apps-support/deploy.d.ts +197 -0
- package/dist/apps-support/deploy.js +639 -0
- package/dist/apps-support/deploy.js.map +1 -0
- package/dist/apps-support/dotenv.d.ts +67 -0
- package/dist/apps-support/dotenv.js +136 -0
- package/dist/apps-support/dotenv.js.map +1 -0
- package/dist/apps-support/env-rollout.d.ts +18 -0
- package/dist/apps-support/env-rollout.js +52 -0
- package/dist/apps-support/env-rollout.js.map +1 -0
- package/dist/apps-support/git.d.ts +14 -0
- package/dist/apps-support/git.js +25 -0
- package/dist/apps-support/git.js.map +1 -0
- package/dist/apps-support/link.d.ts +25 -0
- package/dist/apps-support/link.js +39 -0
- package/dist/apps-support/link.js.map +1 -0
- package/dist/apps-support/log-stream.d.ts +25 -0
- package/dist/apps-support/log-stream.js +85 -0
- package/dist/apps-support/log-stream.js.map +1 -0
- package/dist/apps-support/paid-app.d.ts +64 -0
- package/dist/apps-support/paid-app.js +195 -0
- package/dist/apps-support/paid-app.js.map +1 -0
- package/dist/apps-support/plans.d.ts +44 -0
- package/dist/apps-support/plans.js +43 -0
- package/dist/apps-support/plans.js.map +1 -0
- package/dist/apps-support/resolve.d.ts +10 -0
- package/dist/apps-support/resolve.js +53 -0
- package/dist/apps-support/resolve.js.map +1 -0
- package/dist/apps-support/time.d.ts +20 -0
- package/dist/apps-support/time.js +82 -0
- package/dist/apps-support/time.js.map +1 -0
- package/dist/auth/scope.d.ts +19 -0
- package/dist/auth/scope.js +69 -0
- package/dist/auth/scope.js.map +1 -0
- package/dist/auth/tokens.d.ts +3 -0
- package/dist/auth/tokens.js +6 -4
- package/dist/auth/tokens.js.map +1 -1
- package/dist/base/command.d.ts +36 -1
- package/dist/base/command.js +132 -0
- package/dist/base/command.js.map +1 -1
- package/dist/commands/account/index.d.ts +1 -0
- package/dist/commands/account/index.js +1 -0
- package/dist/commands/account/index.js.map +1 -1
- package/dist/commands/account/show.d.ts +1 -0
- package/dist/commands/account/show.js +1 -0
- package/dist/commands/account/show.js.map +1 -1
- package/dist/commands/agents.d.ts +10 -0
- package/dist/commands/agents.js +53 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/api.d.ts +1 -1
- package/dist/commands/api.js +6 -4
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/app/deployment/list.d.ts +14 -0
- package/dist/commands/app/deployment/list.js +45 -0
- package/dist/commands/app/deployment/list.js.map +1 -0
- package/dist/commands/app/deployment/rollback.d.ts +18 -0
- package/dist/commands/app/deployment/rollback.js +57 -0
- package/dist/commands/app/deployment/rollback.js.map +1 -0
- package/dist/commands/app/deployment/show.d.ts +26 -0
- package/dist/commands/app/deployment/show.js +98 -0
- package/dist/commands/app/deployment/show.js.map +1 -0
- package/dist/commands/app/domain/add.d.ts +17 -0
- package/dist/commands/app/domain/add.js +59 -0
- package/dist/commands/app/domain/add.js.map +1 -0
- package/dist/commands/app/domain/list.d.ts +14 -0
- package/dist/commands/app/domain/list.js +42 -0
- package/dist/commands/app/domain/list.js.map +1 -0
- package/dist/commands/app/domain/remove.d.ts +16 -0
- package/dist/commands/app/domain/remove.js +51 -0
- package/dist/commands/app/domain/remove.js.map +1 -0
- package/dist/commands/app/domain/verify.d.ts +15 -0
- package/dist/commands/app/domain/verify.js +39 -0
- package/dist/commands/app/domain/verify.js.map +1 -0
- package/dist/commands/app/env/add.d.ts +22 -0
- package/dist/commands/app/env/add.js +103 -0
- package/dist/commands/app/env/add.js.map +1 -0
- package/dist/commands/app/env/list.d.ts +17 -0
- package/dist/commands/app/env/list.js +40 -0
- package/dist/commands/app/env/list.js.map +1 -0
- package/dist/commands/app/env/reveal.d.ts +17 -0
- package/dist/commands/app/env/reveal.js +40 -0
- package/dist/commands/app/env/reveal.js.map +1 -0
- package/dist/commands/app/env/rm.d.ts +16 -0
- package/dist/commands/app/env/rm.js +48 -0
- package/dist/commands/app/env/rm.js.map +1 -0
- package/dist/commands/app/health.d.ts +14 -0
- package/dist/commands/app/health.js +40 -0
- package/dist/commands/app/health.js.map +1 -0
- package/dist/commands/app/index.d.ts +6 -0
- package/dist/commands/app/index.js +7 -0
- package/dist/commands/app/index.js.map +1 -0
- package/dist/commands/app/link.d.ts +22 -0
- package/dist/commands/app/link.js +31 -0
- package/dist/commands/app/link.js.map +1 -0
- package/dist/commands/app/logs.d.ts +25 -0
- package/dist/commands/app/logs.js +121 -0
- package/dist/commands/app/logs.js.map +1 -0
- package/dist/commands/app/metrics.d.ts +21 -0
- package/dist/commands/app/metrics.js +123 -0
- package/dist/commands/app/metrics.js.map +1 -0
- package/dist/commands/app/plan/change.d.ts +18 -0
- package/dist/commands/app/plan/change.js +79 -0
- package/dist/commands/app/plan/change.js.map +1 -0
- package/dist/commands/app/plan/show.d.ts +14 -0
- package/dist/commands/app/plan/show.js +40 -0
- package/dist/commands/app/plan/show.js.map +1 -0
- package/dist/commands/app/settings/set.d.ts +25 -0
- package/dist/commands/app/settings/set.js +96 -0
- package/dist/commands/app/settings/set.js.map +1 -0
- package/dist/commands/app/settings/show.d.ts +14 -0
- package/dist/commands/app/settings/show.js +48 -0
- package/dist/commands/app/settings/show.js.map +1 -0
- package/dist/commands/app/unlink.d.ts +8 -0
- package/dist/commands/app/unlink.js +25 -0
- package/dist/commands/app/unlink.js.map +1 -0
- package/dist/commands/apps/create.d.ts +26 -0
- package/dist/commands/apps/create.js +91 -0
- package/dist/commands/apps/create.js.map +1 -0
- package/dist/commands/apps/list.d.ts +16 -0
- package/dist/commands/apps/list.js +54 -0
- package/dist/commands/apps/list.js.map +1 -0
- package/dist/commands/baremetal/activity.d.ts +14 -0
- package/dist/commands/baremetal/activity.js +53 -0
- package/dist/commands/baremetal/activity.js.map +1 -0
- package/dist/commands/baremetal/bandwidth.d.ts +10 -0
- package/dist/commands/baremetal/bandwidth.js +86 -0
- package/dist/commands/baremetal/bandwidth.js.map +1 -0
- package/dist/commands/baremetal/console.d.ts +20 -0
- package/dist/commands/baremetal/console.js +72 -0
- package/dist/commands/baremetal/console.js.map +1 -0
- package/dist/commands/baremetal/details.d.ts +11 -0
- package/dist/commands/baremetal/details.js +116 -0
- package/dist/commands/baremetal/details.js.map +1 -0
- package/dist/commands/baremetal/index.d.ts +5 -0
- package/dist/commands/baremetal/index.js +6 -0
- package/dist/commands/baremetal/index.js.map +1 -0
- package/dist/commands/baremetal/install-password.d.ts +14 -0
- package/dist/commands/baremetal/install-password.js +80 -0
- package/dist/commands/baremetal/install-password.js.map +1 -0
- package/dist/commands/baremetal/list.d.ts +11 -0
- package/dist/commands/baremetal/list.js +59 -0
- package/dist/commands/baremetal/list.js.map +1 -0
- package/dist/commands/baremetal/order.d.ts +34 -0
- package/dist/commands/baremetal/order.js +394 -0
- package/dist/commands/baremetal/order.js.map +1 -0
- package/dist/commands/baremetal/power.d.ts +18 -0
- package/dist/commands/baremetal/power.js +168 -0
- package/dist/commands/baremetal/power.js.map +1 -0
- package/dist/commands/baremetal/reinstall.d.ts +21 -0
- package/dist/commands/baremetal/reinstall.js +168 -0
- package/dist/commands/baremetal/reinstall.js.map +1 -0
- package/dist/commands/catalog.d.ts +1 -0
- package/dist/commands/catalog.js +5 -0
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/config/index.d.ts +1 -0
- package/dist/commands/config/index.js +1 -0
- package/dist/commands/config/index.js.map +1 -1
- package/dist/commands/config/profile/add.d.ts +11 -0
- package/dist/commands/config/profile/add.js +51 -0
- package/dist/commands/config/profile/add.js.map +1 -0
- package/dist/commands/config/profile/list.d.ts +7 -0
- package/dist/commands/config/profile/list.js +29 -0
- package/dist/commands/config/profile/list.js.map +1 -0
- package/dist/commands/config/profile/remove.d.ts +11 -0
- package/dist/commands/config/profile/remove.js +35 -0
- package/dist/commands/config/profile/remove.js.map +1 -0
- package/dist/commands/config/profile/use.d.ts +10 -0
- package/dist/commands/config/profile/use.js +44 -0
- package/dist/commands/config/profile/use.js.map +1 -0
- package/dist/commands/config/set-api-url.d.ts +1 -0
- package/dist/commands/config/set-api-url.js +1 -0
- package/dist/commands/config/set-api-url.js.map +1 -1
- package/dist/commands/config/show.d.ts +1 -0
- package/dist/commands/config/show.js +5 -1
- package/dist/commands/config/show.js.map +1 -1
- package/dist/commands/credits/add.d.ts +1 -0
- package/dist/commands/credits/add.js +3 -2
- package/dist/commands/credits/add.js.map +1 -1
- package/dist/commands/credits/index.d.ts +1 -0
- package/dist/commands/credits/index.js +6 -1
- package/dist/commands/credits/index.js.map +1 -1
- package/dist/commands/credits/list.d.ts +1 -0
- package/dist/commands/credits/list.js +1 -0
- package/dist/commands/credits/list.js.map +1 -1
- package/dist/commands/deploy.d.ts +51 -0
- package/dist/commands/deploy.js +515 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/function/create.d.ts +29 -0
- package/dist/commands/function/create.js +113 -0
- package/dist/commands/function/create.js.map +1 -0
- package/dist/commands/function/credits/add.d.ts +29 -0
- package/dist/commands/function/credits/add.js +209 -0
- package/dist/commands/function/credits/add.js.map +1 -0
- package/dist/commands/function/credits/auto-reload.d.ts +27 -0
- package/dist/commands/function/credits/auto-reload.js +107 -0
- package/dist/commands/function/credits/auto-reload.js.map +1 -0
- package/dist/commands/function/credits/index.d.ts +22 -0
- package/dist/commands/function/credits/index.js +80 -0
- package/dist/commands/function/credits/index.js.map +1 -0
- package/dist/commands/function/cron/add.d.ts +19 -0
- package/dist/commands/function/cron/add.js +74 -0
- package/dist/commands/function/cron/add.js.map +1 -0
- package/dist/commands/function/cron/list.d.ts +12 -0
- package/dist/commands/function/cron/list.js +55 -0
- package/dist/commands/function/cron/list.js.map +1 -0
- package/dist/commands/function/cron/rm.d.ts +17 -0
- package/dist/commands/function/cron/rm.js +73 -0
- package/dist/commands/function/cron/rm.js.map +1 -0
- package/dist/commands/function/cron/run.d.ts +16 -0
- package/dist/commands/function/cron/run.js +59 -0
- package/dist/commands/function/cron/run.js.map +1 -0
- package/dist/commands/function/cron/update.d.ts +21 -0
- package/dist/commands/function/cron/update.js +87 -0
- package/dist/commands/function/cron/update.js.map +1 -0
- package/dist/commands/function/delete.d.ts +23 -0
- package/dist/commands/function/delete.js +90 -0
- package/dist/commands/function/delete.js.map +1 -0
- package/dist/commands/function/deploy.d.ts +64 -0
- package/dist/commands/function/deploy.js +608 -0
- package/dist/commands/function/deploy.js.map +1 -0
- package/dist/commands/function/env/list.d.ts +12 -0
- package/dist/commands/function/env/list.js +46 -0
- package/dist/commands/function/env/list.js.map +1 -0
- package/dist/commands/function/env/reveal.d.ts +21 -0
- package/dist/commands/function/env/reveal.js +54 -0
- package/dist/commands/function/env/reveal.js.map +1 -0
- package/dist/commands/function/env/rm.d.ts +17 -0
- package/dist/commands/function/env/rm.js +62 -0
- package/dist/commands/function/env/rm.js.map +1 -0
- package/dist/commands/function/env/set.d.ts +28 -0
- package/dist/commands/function/env/set.js +124 -0
- package/dist/commands/function/env/set.js.map +1 -0
- package/dist/commands/function/index.d.ts +14 -0
- package/dist/commands/function/index.js +11 -0
- package/dist/commands/function/index.js.map +1 -0
- package/dist/commands/function/init.d.ts +47 -0
- package/dist/commands/function/init.js +269 -0
- package/dist/commands/function/init.js.map +1 -0
- package/dist/commands/function/invoke.d.ts +29 -0
- package/dist/commands/function/invoke.js +138 -0
- package/dist/commands/function/invoke.js.map +1 -0
- package/dist/commands/function/link.d.ts +23 -0
- package/dist/commands/function/link.js +80 -0
- package/dist/commands/function/link.js.map +1 -0
- package/dist/commands/function/list.d.ts +16 -0
- package/dist/commands/function/list.js +55 -0
- package/dist/commands/function/list.js.map +1 -0
- package/dist/commands/function/logs.d.ts +29 -0
- package/dist/commands/function/logs.js +171 -0
- package/dist/commands/function/logs.js.map +1 -0
- package/dist/commands/function/pause.d.ts +19 -0
- package/dist/commands/function/pause.js +50 -0
- package/dist/commands/function/pause.js.map +1 -0
- package/dist/commands/function/releases.d.ts +15 -0
- package/dist/commands/function/releases.js +62 -0
- package/dist/commands/function/releases.js.map +1 -0
- package/dist/commands/function/resume.d.ts +16 -0
- package/dist/commands/function/resume.js +47 -0
- package/dist/commands/function/resume.js.map +1 -0
- package/dist/commands/function/rollback.d.ts +18 -0
- package/dist/commands/function/rollback.js +69 -0
- package/dist/commands/function/rollback.js.map +1 -0
- package/dist/commands/function/settings/set.d.ts +23 -0
- package/dist/commands/function/settings/set.js +119 -0
- package/dist/commands/function/settings/set.js.map +1 -0
- package/dist/commands/function/show.d.ts +15 -0
- package/dist/commands/function/show.js +80 -0
- package/dist/commands/function/show.js.map +1 -0
- package/dist/commands/function/unlink.d.ts +9 -0
- package/dist/commands/function/unlink.js +34 -0
- package/dist/commands/function/unlink.js.map +1 -0
- package/dist/commands/gpu/activity.d.ts +1 -0
- package/dist/commands/gpu/activity.js +1 -0
- package/dist/commands/gpu/activity.js.map +1 -1
- package/dist/commands/gpu/bandwidth.d.ts +1 -0
- package/dist/commands/gpu/bandwidth.js +1 -0
- package/dist/commands/gpu/bandwidth.js.map +1 -1
- package/dist/commands/gpu/boot-order.d.ts +1 -0
- package/dist/commands/gpu/boot-order.js +1 -0
- package/dist/commands/gpu/boot-order.js.map +1 -1
- package/dist/commands/gpu/console.d.ts +1 -0
- package/dist/commands/gpu/console.js +1 -0
- package/dist/commands/gpu/console.js.map +1 -1
- package/dist/commands/gpu/details.d.ts +1 -0
- package/dist/commands/gpu/details.js +1 -0
- package/dist/commands/gpu/details.js.map +1 -1
- package/dist/commands/gpu/index.d.ts +1 -0
- package/dist/commands/gpu/index.js +1 -0
- package/dist/commands/gpu/index.js.map +1 -1
- package/dist/commands/gpu/ip/add.d.ts +1 -0
- package/dist/commands/gpu/ip/add.js +1 -0
- package/dist/commands/gpu/ip/add.js.map +1 -1
- package/dist/commands/gpu/ip/list.d.ts +1 -0
- package/dist/commands/gpu/ip/list.js +1 -0
- package/dist/commands/gpu/ip/list.js.map +1 -1
- package/dist/commands/gpu/list.d.ts +1 -0
- package/dist/commands/gpu/list.js +1 -0
- package/dist/commands/gpu/list.js.map +1 -1
- package/dist/commands/gpu/order.d.ts +1 -0
- package/dist/commands/gpu/order.js +1 -0
- package/dist/commands/gpu/order.js.map +1 -1
- package/dist/commands/gpu/power.d.ts +1 -0
- package/dist/commands/gpu/power.js +1 -0
- package/dist/commands/gpu/power.js.map +1 -1
- package/dist/commands/gpu/reinstall.d.ts +1 -0
- package/dist/commands/gpu/reinstall.js +1 -0
- package/dist/commands/gpu/reinstall.js.map +1 -1
- package/dist/commands/gpu/resize.d.ts +1 -0
- package/dist/commands/gpu/resize.js +1 -0
- package/dist/commands/gpu/resize.js.map +1 -1
- package/dist/commands/gpu/stats.d.ts +1 -0
- package/dist/commands/gpu/stats.js +1 -0
- package/dist/commands/gpu/stats.js.map +1 -1
- package/dist/commands/help.d.ts +2 -0
- package/dist/commands/help.js +5 -0
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/instant-metal/activity.d.ts +1 -0
- package/dist/commands/instant-metal/activity.js +1 -0
- package/dist/commands/instant-metal/activity.js.map +1 -1
- package/dist/commands/instant-metal/bandwidth.d.ts +1 -0
- package/dist/commands/instant-metal/bandwidth.js +1 -0
- package/dist/commands/instant-metal/bandwidth.js.map +1 -1
- package/dist/commands/instant-metal/boot-order.d.ts +1 -0
- package/dist/commands/instant-metal/boot-order.js +1 -0
- package/dist/commands/instant-metal/boot-order.js.map +1 -1
- package/dist/commands/instant-metal/console.d.ts +1 -0
- package/dist/commands/instant-metal/console.js +1 -0
- package/dist/commands/instant-metal/console.js.map +1 -1
- package/dist/commands/instant-metal/details.d.ts +1 -0
- package/dist/commands/instant-metal/details.js +1 -0
- package/dist/commands/instant-metal/details.js.map +1 -1
- package/dist/commands/instant-metal/index.d.ts +1 -0
- package/dist/commands/instant-metal/index.js +1 -0
- package/dist/commands/instant-metal/index.js.map +1 -1
- package/dist/commands/instant-metal/ip/add.d.ts +1 -0
- package/dist/commands/instant-metal/ip/add.js +1 -0
- package/dist/commands/instant-metal/ip/add.js.map +1 -1
- package/dist/commands/instant-metal/ip/list.d.ts +1 -0
- package/dist/commands/instant-metal/ip/list.js +1 -0
- package/dist/commands/instant-metal/ip/list.js.map +1 -1
- package/dist/commands/instant-metal/list.d.ts +1 -0
- package/dist/commands/instant-metal/list.js +1 -0
- package/dist/commands/instant-metal/list.js.map +1 -1
- package/dist/commands/instant-metal/order.d.ts +1 -0
- package/dist/commands/instant-metal/order.js +1 -0
- package/dist/commands/instant-metal/order.js.map +1 -1
- package/dist/commands/instant-metal/power.d.ts +1 -0
- package/dist/commands/instant-metal/power.js +1 -0
- package/dist/commands/instant-metal/power.js.map +1 -1
- package/dist/commands/instant-metal/reinstall.d.ts +1 -0
- package/dist/commands/instant-metal/reinstall.js +1 -0
- package/dist/commands/instant-metal/reinstall.js.map +1 -1
- package/dist/commands/instant-metal/resize.d.ts +1 -0
- package/dist/commands/instant-metal/resize.js +1 -0
- package/dist/commands/instant-metal/resize.js.map +1 -1
- package/dist/commands/instant-metal/stats.d.ts +1 -0
- package/dist/commands/instant-metal/stats.js +1 -0
- package/dist/commands/instant-metal/stats.js.map +1 -1
- package/dist/commands/link.d.ts +77 -0
- package/dist/commands/link.js +530 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +10 -0
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +1 -0
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/order/gpu.d.ts +1 -0
- package/dist/commands/order/gpu.js +1 -0
- package/dist/commands/order/gpu.js.map +1 -1
- package/dist/commands/order/instant-metal.d.ts +1 -0
- package/dist/commands/order/instant-metal.js +1 -0
- package/dist/commands/order/instant-metal.js.map +1 -1
- package/dist/commands/order/storage.d.ts +1 -0
- package/dist/commands/order/storage.js +1 -0
- package/dist/commands/order/storage.js.map +1 -1
- package/dist/commands/order/vps.d.ts +1 -0
- package/dist/commands/order/vps.js +1 -0
- package/dist/commands/order/vps.js.map +1 -1
- package/dist/commands/order.d.ts +1 -0
- package/dist/commands/order.js +4 -1
- package/dist/commands/order.js.map +1 -1
- package/dist/commands/os-images.d.ts +1 -0
- package/dist/commands/os-images.js +3 -0
- package/dist/commands/os-images.js.map +1 -1
- package/dist/commands/payments/index.d.ts +1 -0
- package/dist/commands/payments/index.js +1 -0
- package/dist/commands/payments/index.js.map +1 -1
- package/dist/commands/payments/methods/add.d.ts +1 -0
- package/dist/commands/payments/methods/add.js +1 -0
- package/dist/commands/payments/methods/add.js.map +1 -1
- package/dist/commands/payments/methods/delete.d.ts +1 -0
- package/dist/commands/payments/methods/delete.js +3 -2
- package/dist/commands/payments/methods/delete.js.map +1 -1
- package/dist/commands/payments/methods/index.d.ts +1 -0
- package/dist/commands/payments/methods/index.js +1 -0
- package/dist/commands/payments/methods/index.js.map +1 -1
- package/dist/commands/payments/methods/list.d.ts +1 -0
- package/dist/commands/payments/methods/list.js +1 -0
- package/dist/commands/payments/methods/list.js.map +1 -1
- package/dist/commands/payments/methods/set-default.d.ts +1 -0
- package/dist/commands/payments/methods/set-default.js +1 -0
- package/dist/commands/payments/methods/set-default.js.map +1 -1
- package/dist/commands/projects/index.d.ts +1 -0
- package/dist/commands/projects/index.js +1 -0
- package/dist/commands/projects/index.js.map +1 -1
- package/dist/commands/projects/list.d.ts +1 -0
- package/dist/commands/projects/list.js +1 -0
- package/dist/commands/projects/list.js.map +1 -1
- package/dist/commands/resources.d.ts +1 -0
- package/dist/commands/resources.js +61 -7
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/settings/index.d.ts +1 -0
- package/dist/commands/settings/index.js +1 -0
- package/dist/commands/settings/index.js.map +1 -1
- package/dist/commands/settings/render-mode.d.ts +1 -0
- package/dist/commands/settings/render-mode.js +1 -0
- package/dist/commands/settings/render-mode.js.map +1 -1
- package/dist/commands/ssh-key/add.d.ts +1 -0
- package/dist/commands/ssh-key/add.js +1 -0
- package/dist/commands/ssh-key/add.js.map +1 -1
- package/dist/commands/ssh-key/delete.d.ts +1 -0
- package/dist/commands/ssh-key/delete.js +1 -0
- package/dist/commands/ssh-key/delete.js.map +1 -1
- package/dist/commands/ssh-key/list.d.ts +1 -0
- package/dist/commands/ssh-key/list.js +1 -0
- package/dist/commands/ssh-key/list.js.map +1 -1
- package/dist/commands/status.d.ts +12 -0
- package/dist/commands/status.js +71 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/storage/attach.d.ts +1 -0
- package/dist/commands/storage/attach.js +1 -0
- package/dist/commands/storage/attach.js.map +1 -1
- package/dist/commands/storage/detach.d.ts +1 -0
- package/dist/commands/storage/detach.js +2 -1
- package/dist/commands/storage/detach.js.map +1 -1
- package/dist/commands/storage/list.d.ts +1 -0
- package/dist/commands/storage/list.js +7 -2
- package/dist/commands/storage/list.js.map +1 -1
- package/dist/commands/storage/order.d.ts +3 -0
- package/dist/commands/storage/order.js +101 -18
- package/dist/commands/storage/order.js.map +1 -1
- package/dist/commands/storage/resize.d.ts +1 -0
- package/dist/commands/storage/resize.js +20 -6
- package/dist/commands/storage/resize.js.map +1 -1
- package/dist/commands/team/details.d.ts +1 -0
- package/dist/commands/team/details.js +1 -0
- package/dist/commands/team/details.js.map +1 -1
- package/dist/commands/team/invite.d.ts +1 -0
- package/dist/commands/team/invite.js +1 -0
- package/dist/commands/team/invite.js.map +1 -1
- package/dist/commands/team.d.ts +1 -0
- package/dist/commands/team.js +1 -0
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/tickets/close.d.ts +1 -0
- package/dist/commands/tickets/close.js +1 -0
- package/dist/commands/tickets/close.js.map +1 -1
- package/dist/commands/tickets/create.d.ts +3 -0
- package/dist/commands/tickets/create.js +41 -1
- package/dist/commands/tickets/create.js.map +1 -1
- package/dist/commands/tickets/departments.d.ts +1 -0
- package/dist/commands/tickets/departments.js +1 -0
- package/dist/commands/tickets/departments.js.map +1 -1
- package/dist/commands/tickets/download.d.ts +18 -0
- package/dist/commands/tickets/download.js +138 -0
- package/dist/commands/tickets/download.js.map +1 -0
- package/dist/commands/tickets/list.d.ts +1 -0
- package/dist/commands/tickets/list.js +14 -7
- package/dist/commands/tickets/list.js.map +1 -1
- package/dist/commands/tickets/open.d.ts +1 -0
- package/dist/commands/tickets/open.js +1 -0
- package/dist/commands/tickets/open.js.map +1 -1
- package/dist/commands/tickets/reopen.d.ts +11 -0
- package/dist/commands/tickets/reopen.js +34 -0
- package/dist/commands/tickets/reopen.js.map +1 -0
- package/dist/commands/tickets/reply.d.ts +3 -0
- package/dist/commands/tickets/reply.js +34 -4
- package/dist/commands/tickets/reply.js.map +1 -1
- package/dist/commands/transit.d.ts +1 -0
- package/dist/commands/transit.js +1 -0
- package/dist/commands/transit.js.map +1 -1
- package/dist/commands/tui/index.d.ts +1 -0
- package/dist/commands/tui/index.js +21 -0
- package/dist/commands/tui/index.js.map +1 -1
- package/dist/commands/vds/activity.d.ts +1 -0
- package/dist/commands/vds/activity.js +1 -0
- package/dist/commands/vds/activity.js.map +1 -1
- package/dist/commands/vds/bandwidth.d.ts +1 -0
- package/dist/commands/vds/bandwidth.js +1 -0
- package/dist/commands/vds/bandwidth.js.map +1 -1
- package/dist/commands/vds/boot-order.d.ts +1 -0
- package/dist/commands/vds/boot-order.js +1 -0
- package/dist/commands/vds/boot-order.js.map +1 -1
- package/dist/commands/vds/console.d.ts +1 -0
- package/dist/commands/vds/console.js +1 -0
- package/dist/commands/vds/console.js.map +1 -1
- package/dist/commands/vds/details.d.ts +1 -0
- package/dist/commands/vds/details.js +1 -0
- package/dist/commands/vds/details.js.map +1 -1
- package/dist/commands/vds/index.d.ts +1 -0
- package/dist/commands/vds/index.js +1 -0
- package/dist/commands/vds/index.js.map +1 -1
- package/dist/commands/vds/ip/add.d.ts +1 -0
- package/dist/commands/vds/ip/add.js +1 -0
- package/dist/commands/vds/ip/add.js.map +1 -1
- package/dist/commands/vds/ip/list.d.ts +1 -0
- package/dist/commands/vds/ip/list.js +1 -0
- package/dist/commands/vds/ip/list.js.map +1 -1
- package/dist/commands/vds/list.d.ts +1 -0
- package/dist/commands/vds/list.js +1 -0
- package/dist/commands/vds/list.js.map +1 -1
- package/dist/commands/vds/order.d.ts +1 -0
- package/dist/commands/vds/order.js +73 -7
- package/dist/commands/vds/order.js.map +1 -1
- package/dist/commands/vds/power.d.ts +1 -0
- package/dist/commands/vds/power.js +1 -0
- package/dist/commands/vds/power.js.map +1 -1
- package/dist/commands/vds/reinstall.d.ts +1 -0
- package/dist/commands/vds/reinstall.js +1 -0
- package/dist/commands/vds/reinstall.js.map +1 -1
- package/dist/commands/vds/resize.d.ts +1 -0
- package/dist/commands/vds/resize.js +1 -0
- package/dist/commands/vds/resize.js.map +1 -1
- package/dist/commands/vds/stats.d.ts +1 -0
- package/dist/commands/vds/stats.js +1 -0
- package/dist/commands/vds/stats.js.map +1 -1
- package/dist/commands/vps/activity.d.ts +1 -0
- package/dist/commands/vps/activity.js +1 -0
- package/dist/commands/vps/activity.js.map +1 -1
- package/dist/commands/vps/bandwidth.d.ts +1 -0
- package/dist/commands/vps/bandwidth.js +1 -0
- package/dist/commands/vps/bandwidth.js.map +1 -1
- package/dist/commands/vps/boot-order.d.ts +1 -0
- package/dist/commands/vps/boot-order.js +1 -0
- package/dist/commands/vps/boot-order.js.map +1 -1
- package/dist/commands/vps/console.d.ts +1 -0
- package/dist/commands/vps/console.js +15 -6
- package/dist/commands/vps/console.js.map +1 -1
- package/dist/commands/vps/details.d.ts +1 -0
- package/dist/commands/vps/details.js +8 -1
- package/dist/commands/vps/details.js.map +1 -1
- package/dist/commands/vps/ip/add.d.ts +1 -0
- package/dist/commands/vps/ip/add.js +77 -9
- package/dist/commands/vps/ip/add.js.map +1 -1
- package/dist/commands/vps/ip/list.d.ts +1 -0
- package/dist/commands/vps/ip/list.js +1 -0
- package/dist/commands/vps/ip/list.js.map +1 -1
- package/dist/commands/vps/list.d.ts +1 -0
- package/dist/commands/vps/list.js +14 -4
- package/dist/commands/vps/list.js.map +1 -1
- package/dist/commands/vps/order.d.ts +20 -0
- package/dist/commands/vps/order.js +180 -23
- package/dist/commands/vps/order.js.map +1 -1
- package/dist/commands/vps/power.d.ts +1 -0
- package/dist/commands/vps/power.js +3 -2
- package/dist/commands/vps/power.js.map +1 -1
- package/dist/commands/vps/reinstall.d.ts +1 -0
- package/dist/commands/vps/reinstall.js +3 -2
- package/dist/commands/vps/reinstall.js.map +1 -1
- package/dist/commands/vps/resize.d.ts +1 -0
- package/dist/commands/vps/resize.js +37 -13
- package/dist/commands/vps/resize.js.map +1 -1
- package/dist/commands/vps/stats.d.ts +1 -0
- package/dist/commands/vps/stats.js +1 -0
- package/dist/commands/vps/stats.js.map +1 -1
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.js +8 -2
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config/paths.d.ts +1 -1
- package/dist/config/paths.js +6 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/config/store.d.ts +58 -0
- package/dist/config/store.js +84 -2
- package/dist/config/store.js.map +1 -1
- package/dist/functions-support/credits.d.ts +64 -0
- package/dist/functions-support/credits.js +181 -0
- package/dist/functions-support/credits.js.map +1 -0
- package/dist/functions-support/cron.d.ts +17 -0
- package/dist/functions-support/cron.js +99 -0
- package/dist/functions-support/cron.js.map +1 -0
- package/dist/functions-support/env.d.ts +23 -0
- package/dist/functions-support/env.js +44 -0
- package/dist/functions-support/env.js.map +1 -0
- package/dist/functions-support/link.d.ts +25 -0
- package/dist/functions-support/link.js +51 -0
- package/dist/functions-support/link.js.map +1 -0
- package/dist/functions-support/poll.d.ts +40 -0
- package/dist/functions-support/poll.js +109 -0
- package/dist/functions-support/poll.js.map +1 -0
- package/dist/functions-support/resolve.d.ts +3 -0
- package/dist/functions-support/resolve.js +31 -0
- package/dist/functions-support/resolve.js.map +1 -0
- package/dist/functions-support/runtime.d.ts +30 -0
- package/dist/functions-support/runtime.js +52 -0
- package/dist/functions-support/runtime.js.map +1 -0
- package/dist/functions-support/source.d.ts +92 -0
- package/dist/functions-support/source.js +343 -0
- package/dist/functions-support/source.js.map +1 -0
- package/dist/help/help-filter.d.ts +10 -0
- package/dist/help/help-filter.js +9 -0
- package/dist/help/help-filter.js.map +1 -0
- package/dist/help/scope-aware-help.d.ts +30 -0
- package/dist/help/scope-aware-help.js +80 -0
- package/dist/help/scope-aware-help.js.map +1 -0
- package/dist/tui/App.js +11 -26
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/Menu.d.ts +3 -1
- package/dist/tui/components/Menu.js +7 -3
- package/dist/tui/components/Menu.js.map +1 -1
- package/dist/tui/components/NumberInput.js +1 -1
- package/dist/tui/components/Sparkline.js +1 -1
- package/dist/tui/router.d.ts +1 -1
- package/dist/tui/router.js.map +1 -1
- package/dist/tui/screens/Billing.js +66 -14
- package/dist/tui/screens/Billing.js.map +1 -1
- package/dist/tui/screens/Dashboard.js +8 -7
- package/dist/tui/screens/Dashboard.js.map +1 -1
- package/dist/tui/screens/Deploy.d.ts +2 -0
- package/dist/tui/screens/Deploy.js +912 -0
- package/dist/tui/screens/Deploy.js.map +1 -0
- package/dist/tui/screens/Order.js +385 -52
- package/dist/tui/screens/Order.js.map +1 -1
- package/dist/tui/screens/Resources.js +277 -35
- package/dist/tui/screens/Resources.js.map +1 -1
- package/dist/tui/screens/Tickets.js +47 -26
- package/dist/tui/screens/Tickets.js.map +1 -1
- package/dist/tui/screens/deployPreset.d.ts +20 -0
- package/dist/tui/screens/deployPreset.js +11 -0
- package/dist/tui/screens/deployPreset.js.map +1 -0
- package/dist/tui/screens/resources/AppDetail.d.ts +7 -0
- package/dist/tui/screens/resources/AppDetail.js +810 -0
- package/dist/tui/screens/resources/AppDetail.js.map +1 -0
- package/dist/tui/screens/resources/FunctionDetail.d.ts +7 -0
- package/dist/tui/screens/resources/FunctionDetail.js +751 -0
- package/dist/tui/screens/resources/FunctionDetail.js.map +1 -0
- package/dist/ui/attach.d.ts +15 -0
- package/dist/ui/attach.js +63 -0
- package/dist/ui/attach.js.map +1 -0
- package/dist/ui/baremetal-resolve.d.ts +10 -0
- package/dist/ui/baremetal-resolve.js +50 -0
- package/dist/ui/baremetal-resolve.js.map +1 -0
- package/dist/ui/confirm.js +1 -1
- package/dist/ui/confirm.js.map +1 -1
- package/dist/ui/cycle.d.ts +66 -0
- package/dist/ui/cycle.js +96 -0
- package/dist/ui/cycle.js.map +1 -0
- package/dist/ui/deploy-ui.d.ts +75 -0
- package/dist/ui/deploy-ui.js +243 -0
- package/dist/ui/deploy-ui.js.map +1 -0
- package/dist/ui/order-result.d.ts +4 -0
- package/dist/ui/order-result.js +32 -0
- package/dist/ui/order-result.js.map +1 -0
- package/dist/ui/payment-gate.d.ts +26 -0
- package/dist/ui/payment-gate.js +70 -0
- package/dist/ui/payment-gate.js.map +1 -0
- package/dist/ui/payment.js +10 -3
- package/dist/ui/payment.js.map +1 -1
- package/dist/ui/portal.d.ts +1 -1
- package/dist/ui/portal.js +7 -2
- package/dist/ui/portal.js.map +1 -1
- package/dist/ui/project-resolve.d.ts +25 -0
- package/dist/ui/project-resolve.js +31 -0
- package/dist/ui/project-resolve.js.map +1 -0
- package/dist/ui/render-mode.d.ts +5 -0
- package/dist/ui/render-mode.js +1 -1
- package/dist/ui/render-mode.js.map +1 -1
- package/dist/ui/resource-detail.js +0 -3
- package/dist/ui/resource-detail.js.map +1 -1
- package/dist/ui/resource-resolve.d.ts +9 -2
- package/dist/ui/resource-resolve.js +11 -4
- package/dist/ui/resource-resolve.js.map +1 -1
- package/dist/ui/spinner.d.ts +10 -1
- package/dist/ui/spinner.js +12 -3
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/table.d.ts +7 -0
- package/dist/ui/table.js +11 -0
- package/dist/ui/table.js.map +1 -1
- package/dist/ui/tax.d.ts +10 -0
- package/dist/ui/tax.js +31 -0
- package/dist/ui/tax.js.map +1 -0
- package/dist/ui/ticket-resolve.d.ts +9 -1
- package/dist/ui/ticket-resolve.js +13 -2
- package/dist/ui/ticket-resolve.js.map +1 -1
- package/dist/ui/volume-resolve.js +4 -1
- package/dist/ui/volume-resolve.js.map +1 -1
- package/dist/ui/wait.d.ts +4 -0
- package/dist/ui/wait.js +7 -2
- package/dist/ui/wait.js.map +1 -1
- package/dist/ui/wizard.d.ts +2 -1
- package/dist/ui/wizard.js +1 -1
- package/dist/ui/wizard.js.map +1 -1
- package/dist/version-check-bin.d.ts +35 -0
- package/dist/version-check-bin.js +123 -0
- package/dist/version-check-bin.js.map +1 -0
- package/dist/version-check.d.ts +44 -0
- package/dist/version-check.js +153 -0
- package/dist/version-check.js.map +1 -0
- package/package.json +59 -4
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { notLinkedFunctionError, resolveLinkedFunction } from "./link.js";
|
|
2
|
+
import { linkKind } from "../config/store.js";
|
|
3
|
+
import { describePaymentMethod, pickFromCatalog } from "../ui/wizard.js";
|
|
4
|
+
import { dim } from "../ui/glyphs.js";
|
|
5
|
+
/** The payment touchpoint run credits are bought through (backend
|
|
6
|
+
* `Touchpoint.FUNCTION_CREDITS`) — its own allowlist, distinct from the
|
|
7
|
+
* account-credit top-up's. */
|
|
8
|
+
export const FUNCTION_CREDITS_TOUCHPOINT = "function_credits";
|
|
9
|
+
const UNIT_LABELS = {
|
|
10
|
+
1: "per run",
|
|
11
|
+
1000: "per 1,000 runs",
|
|
12
|
+
1000000: "per 1,000,000 runs",
|
|
13
|
+
};
|
|
14
|
+
export function num(v) {
|
|
15
|
+
if (v === null || v === undefined || v === "")
|
|
16
|
+
return null;
|
|
17
|
+
const n = typeof v === "number" ? v : Number(v);
|
|
18
|
+
return Number.isFinite(n) ? n : null;
|
|
19
|
+
}
|
|
20
|
+
export function runs(n) {
|
|
21
|
+
return n == null ? "—" : `${n.toLocaleString("en-US")} runs`;
|
|
22
|
+
}
|
|
23
|
+
export function money(n, currency) {
|
|
24
|
+
return `$${n.toFixed(2)}${currency && currency !== "USD" ? ` ${currency}` : ""}`;
|
|
25
|
+
}
|
|
26
|
+
/** A per-run rate in the portal's display unit (`runPriceUnit`): a rate like
|
|
27
|
+
* 0.000002 reads as "$2 per 1,000,000 runs", as on the Billing tab. */
|
|
28
|
+
export function rateLine(rate, unit) {
|
|
29
|
+
const r = num(rate);
|
|
30
|
+
if (r === null)
|
|
31
|
+
return null;
|
|
32
|
+
const u = unit && UNIT_LABELS[unit] ? unit : 1;
|
|
33
|
+
const shown = r * u;
|
|
34
|
+
// Enough digits that a fraction of a cent never prints as $0.00.
|
|
35
|
+
const decimals = shown >= 1 ? 2 : Math.min(10, Math.max(2, Math.ceil(-Math.log10(shown)) + 2));
|
|
36
|
+
const text = shown.toFixed(decimals).replace(/(\.\d\d\d*?)0+$/, "$1");
|
|
37
|
+
return `$${text} ${UNIT_LABELS[u]}`;
|
|
38
|
+
}
|
|
39
|
+
export function autoReloadLine(v) {
|
|
40
|
+
if (!v.autoReloadEnabled)
|
|
41
|
+
return "off";
|
|
42
|
+
const when = v.autoReloadThresholdRuns != null
|
|
43
|
+
? `when the balance drops below ${runs(v.autoReloadThresholdRuns)}`
|
|
44
|
+
: "when the balance drops below one reload";
|
|
45
|
+
return `on — buys ${runs(v.autoReloadRuns ?? null)} ${when}`;
|
|
46
|
+
}
|
|
47
|
+
function grid(min, max, step) {
|
|
48
|
+
const parts = [];
|
|
49
|
+
if (min != null)
|
|
50
|
+
parts.push(`min ${min.toLocaleString("en-US")}`);
|
|
51
|
+
if (max != null)
|
|
52
|
+
parts.push(`max ${max.toLocaleString("en-US")}`);
|
|
53
|
+
if (step != null)
|
|
54
|
+
parts.push(`step ${step.toLocaleString("en-US")}`);
|
|
55
|
+
return parts.length ? parts.join(" · ") : null;
|
|
56
|
+
}
|
|
57
|
+
/** Panel rows for one function's run-credit view (GET /functions/{id}/billing). */
|
|
58
|
+
export function functionCreditRows(slug, b) {
|
|
59
|
+
const sells = num(b.creditRateUsd) !== null;
|
|
60
|
+
const plan = b.plan ? `${b.plan.displayName ?? b.plan.name} ${dim(`(${b.plan.billingMode})`)}` : "none";
|
|
61
|
+
const rows = [
|
|
62
|
+
["Function", slug],
|
|
63
|
+
["Plan", plan],
|
|
64
|
+
["Credit pool", b.source === "team" ? "team pool (shared by the team's functions)" : b.source === "function" ? "this function" : null],
|
|
65
|
+
];
|
|
66
|
+
if (sells || b.isCreditsOffering) {
|
|
67
|
+
const free = b.creditFreeBalance != null && b.creditFreeBalance > 0 ? dim(` (${runs(b.creditFreeBalance)} free)`) : "";
|
|
68
|
+
rows.push(["Balance", `${runs(b.creditBalance ?? 0)}${free}`]);
|
|
69
|
+
rows.push(["Monthly grant", b.creditMonthlyGrantRuns != null ? runs(b.creditMonthlyGrantRuns) : "none"]);
|
|
70
|
+
rows.push(["Credit rate", rateLine(b.creditRateUsd, b.runPriceUnit)]);
|
|
71
|
+
rows.push(["Purchase", grid(b.creditMinRuns, b.creditMaxRuns, b.creditStepRuns)]);
|
|
72
|
+
rows.push(["Auto-reload", autoReloadLine(b)]);
|
|
73
|
+
}
|
|
74
|
+
rows.push(["Runs this period", `${runs(b.runsUsed)}${b.periodStart ? dim(` since ${String(b.periodStart).slice(0, 10)}`) : ""}`]);
|
|
75
|
+
if (b.planLimitPaused)
|
|
76
|
+
rows.push(["Paused", "plan limit reached"]);
|
|
77
|
+
return rows;
|
|
78
|
+
}
|
|
79
|
+
/** Panel rows for the team pool (GET /functions-team-billing). */
|
|
80
|
+
export function teamCreditRows(b) {
|
|
81
|
+
const p = b.plan;
|
|
82
|
+
const free = b.creditFreeBalance ? dim(` (${runs(b.creditFreeBalance)} free, ${runs(b.creditPaidBalance ?? 0)} bought)`) : "";
|
|
83
|
+
return [
|
|
84
|
+
["Pool", "team (every function without its own plan)"],
|
|
85
|
+
["Plan", `${p.displayName ?? p.name} ${dim(`(${p.billingMode})`)}`],
|
|
86
|
+
["Balance", b.creditBalance != null ? `${runs(b.creditBalance)}${free}` : "—"],
|
|
87
|
+
["Monthly grant", p.creditMonthlyGrantRuns != null ? runs(p.creditMonthlyGrantRuns) : "none"],
|
|
88
|
+
["Credit rate", rateLine(p.creditRateUsd, b.runPriceUnit) ?? "not sold on this plan"],
|
|
89
|
+
["Purchase", grid(p.creditMinRuns, p.creditMaxRuns, p.creditStepRuns)],
|
|
90
|
+
["Auto-reload", autoReloadLine(b)],
|
|
91
|
+
["Runs this period", `${runs(b.runsUsed ?? 0)}${b.periodResetsAt ? dim(` · resets ${String(b.periodResetsAt).slice(0, 10)}`) : ""}`],
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
/** The line the customer confirms before being charged — `chargeLine`'s
|
|
95
|
+
* wording, for run credits. An `estimate` (no quote route for a function's
|
|
96
|
+
* own pool) says the tax is added at checkout instead of naming it. */
|
|
97
|
+
export function creditsChargeLine(q) {
|
|
98
|
+
const credit = Math.min(Math.max(0, q.creditsApplied), q.total);
|
|
99
|
+
const due = q.total - credit;
|
|
100
|
+
const what = `${q.runs.toLocaleString("en-US")} run credits ${q.target}`;
|
|
101
|
+
const card = q.method ? describePaymentMethod(q.method) : "your payment method";
|
|
102
|
+
if (q.estimate) {
|
|
103
|
+
return `Charge about ${money(due, q.currency)} (estimate, tax at checkout) to ${card}${credit > 0 ? ` after ${money(credit, q.currency)} credit` : ""} for ${what}?`;
|
|
104
|
+
}
|
|
105
|
+
const price = `${money(q.total, q.currency)}${q.taxTotal > 0 ? ` incl. ${money(q.taxTotal, q.currency)} ${q.taxLabel}` : ""} for ${what}.`;
|
|
106
|
+
if (due <= 0)
|
|
107
|
+
return `${price} Use ${money(credit, q.currency)} of your credit balance — nothing is charged to a card?`;
|
|
108
|
+
if (credit > 0)
|
|
109
|
+
return `${price} Use ${money(credit, q.currency)} credit and charge the remaining ${money(due, q.currency)} to ${card}?`;
|
|
110
|
+
return `${price} Charge ${money(due, q.currency)} to ${card}?`;
|
|
111
|
+
}
|
|
112
|
+
export class CreditsPaymentError extends Error {
|
|
113
|
+
}
|
|
114
|
+
/** A saved method the function_credits touchpoint may charge: --payment-method
|
|
115
|
+
* (full id or a unique prefix), else the default when nobody can be asked,
|
|
116
|
+
* else a picker — `orderPaidApp`'s step 3. */
|
|
117
|
+
export async function pickCreditsMethod(clients, opts) {
|
|
118
|
+
// A failed lookup (401/403/5xx) propagates as itself — it is not "no
|
|
119
|
+
// saved payment method", and saying so would send the customer to add a
|
|
120
|
+
// card they already have.
|
|
121
|
+
const rows = await clients.api.payments.methodsForTouchpoint(FUNCTION_CREDITS_TOUCHPOINT);
|
|
122
|
+
const eligible = rows.filter((m) => m.eligible);
|
|
123
|
+
if (opts.paymentMethodId) {
|
|
124
|
+
const ref = opts.paymentMethodId.trim().toLowerCase();
|
|
125
|
+
const hits = rows.filter((m) => m.id.toLowerCase() === ref);
|
|
126
|
+
const prefixed = hits.length ? hits : rows.filter((m) => m.id.toLowerCase().startsWith(ref));
|
|
127
|
+
if (prefixed.length === 0) {
|
|
128
|
+
throw new CreditsPaymentError(`Payment method ${opts.paymentMethodId} is not on this team. Run \`synteq payments methods list\`.`);
|
|
129
|
+
}
|
|
130
|
+
if (prefixed.length > 1) {
|
|
131
|
+
throw new CreditsPaymentError(`"${opts.paymentMethodId}" matches ${prefixed.length} methods — use more of the id.`);
|
|
132
|
+
}
|
|
133
|
+
const m = prefixed[0];
|
|
134
|
+
if (!m.eligible) {
|
|
135
|
+
throw new CreditsPaymentError(`Payment method ${opts.paymentMethodId} can't be charged for run credits${m.ineligible_reason ? `: ${m.ineligible_reason}` : "."}`);
|
|
136
|
+
}
|
|
137
|
+
return m;
|
|
138
|
+
}
|
|
139
|
+
if (eligible.length === 0) {
|
|
140
|
+
const why = rows.map((m) => m.ineligible_reason).filter(Boolean)[0];
|
|
141
|
+
throw new CreditsPaymentError(`No saved payment method can be charged for run credits${why ? ` (${why})` : ""}. ` +
|
|
142
|
+
"Add one with `synteq payments methods add`, then try again.");
|
|
143
|
+
}
|
|
144
|
+
const fallback = eligible.find((m) => m.is_default) ?? eligible[0];
|
|
145
|
+
if (!opts.interactive || eligible.length === 1)
|
|
146
|
+
return fallback;
|
|
147
|
+
const id = await pickFromCatalog("Charge which payment method?", rows.map((m) => ({
|
|
148
|
+
value: m.id,
|
|
149
|
+
name: describePaymentMethod(m),
|
|
150
|
+
disabled: m.eligible ? undefined : (m.ineligible_reason ?? "not allowed for run credits"),
|
|
151
|
+
})), { defaultValue: fallback.id });
|
|
152
|
+
return rows.find((m) => m.id === id);
|
|
153
|
+
}
|
|
154
|
+
/** `resolveLinkedFunction` for the credits commands: same resolution, but an
|
|
155
|
+
* unlinked directory's hint also names --pool, the other way to point these
|
|
156
|
+
* commands at something. */
|
|
157
|
+
export async function resolveCreditsFunction(clients, flags) {
|
|
158
|
+
try {
|
|
159
|
+
return await resolveLinkedFunction(clients, flags);
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
if (e instanceof Error && e.message === notLinkedFunctionError("--name <slug>")) {
|
|
163
|
+
throw new Error(notLinkedFunctionError("--name <slug>, or --pool for the team pool"));
|
|
164
|
+
}
|
|
165
|
+
throw e;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Credits are team-based: with no function named and no function linked in
|
|
170
|
+
* the working directory, the credits commands act on the team pool instead
|
|
171
|
+
* of refusing (`--pool` stays as the explicit form).
|
|
172
|
+
*/
|
|
173
|
+
export function poolByDefault(clients, flags, cwd = process.cwd()) {
|
|
174
|
+
if (flags.pool)
|
|
175
|
+
return true;
|
|
176
|
+
if (flags.name)
|
|
177
|
+
return false;
|
|
178
|
+
const link = clients.config.linkFor(cwd);
|
|
179
|
+
return !link || linkKind(link) !== "function";
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=credits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/functions-support/credits.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AAwC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC3G,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5B,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FnCronTrigger } from "../api/types.js";
|
|
2
|
+
/** A port of the backend's `_valid_cron_field`: comma-separated parts, each
|
|
3
|
+
* `*`, `N` or `A-B` (A <= B, both in range), optionally `/STEP` (STEP >= 1). */
|
|
4
|
+
export declare function validCronField(field: string, lo: number, hi: number): boolean;
|
|
5
|
+
/** A 5-field cron expression, evaluated in UTC by the dispatcher, checked
|
|
6
|
+
* with the backend's own grammar (`_valid_cron`) so a schedule the server
|
|
7
|
+
* would 422 is refused here, before any call — and first of all the mistake
|
|
8
|
+
* a shell makes for you: an unquoted `*` expanding to filenames, or a
|
|
9
|
+
* schedule split across arguments. Returns the whitespace-collapsed form. */
|
|
10
|
+
export declare function normalizeSchedule(raw: string): string;
|
|
11
|
+
/** Resolve a trigger by full id or a unique id prefix (the short id the list
|
|
12
|
+
* prints). Throws a plain Error — user error, not an API fault. */
|
|
13
|
+
export declare function resolveTrigger(triggers: FnCronTrigger[], ref: string): FnCronTrigger;
|
|
14
|
+
/** The short id the list shows. UUIDv7 puts the timestamp first, so triggers
|
|
15
|
+
* made minutes apart share their leading characters — the tail is what tells
|
|
16
|
+
* them apart. */
|
|
17
|
+
export declare function shortTriggerId(id: string): string;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** The five fields and their ranges — the backend's `_CRON_RANGES`
|
|
2
|
+
* (routers/functions.py), in the same order. Day-of-week allows 0-7. */
|
|
3
|
+
const CRON_FIELDS = [
|
|
4
|
+
{ name: "minute", lo: 0, hi: 59 },
|
|
5
|
+
{ name: "hour", lo: 0, hi: 23 },
|
|
6
|
+
{ name: "day-of-month", lo: 1, hi: 31 },
|
|
7
|
+
{ name: "month", lo: 1, hi: 12 },
|
|
8
|
+
{ name: "day-of-week", lo: 0, hi: 7 },
|
|
9
|
+
];
|
|
10
|
+
/** The backend's `_CRON_FIELD_RE`: digits, `*`, `,`, `-` and `/` only — no
|
|
11
|
+
* names (MON, JAN) and no `?`/`L`/`#`. */
|
|
12
|
+
const CRON_FIELD_RE = /^[0-9*,/-]+$/;
|
|
13
|
+
const DIGITS_RE = /^[0-9]+$/;
|
|
14
|
+
/** A port of the backend's `_valid_cron_field`: comma-separated parts, each
|
|
15
|
+
* `*`, `N` or `A-B` (A <= B, both in range), optionally `/STEP` (STEP >= 1). */
|
|
16
|
+
export function validCronField(field, lo, hi) {
|
|
17
|
+
if (!field || !CRON_FIELD_RE.test(field))
|
|
18
|
+
return false;
|
|
19
|
+
for (const part of field.split(",")) {
|
|
20
|
+
if (!part)
|
|
21
|
+
return false;
|
|
22
|
+
const slash = part.indexOf("/");
|
|
23
|
+
const expr = slash === -1 ? part : part.slice(0, slash);
|
|
24
|
+
const step = slash === -1 ? "" : part.slice(slash + 1);
|
|
25
|
+
// A "/" always needs a number after it ("*/" is refused by the server
|
|
26
|
+
// and by the orchestrator's scheduler, where it never fires).
|
|
27
|
+
if (slash !== -1) {
|
|
28
|
+
if (!DIGITS_RE.test(step) || Number(step) < 1)
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (expr === "*")
|
|
32
|
+
continue;
|
|
33
|
+
const dash = expr.indexOf("-");
|
|
34
|
+
if (dash !== -1) {
|
|
35
|
+
const a = expr.slice(0, dash);
|
|
36
|
+
const b = expr.slice(dash + 1);
|
|
37
|
+
if (!DIGITS_RE.test(a) || !DIGITS_RE.test(b))
|
|
38
|
+
return false;
|
|
39
|
+
if (!(lo <= Number(a) && Number(a) <= Number(b) && Number(b) <= hi))
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
else if (!DIGITS_RE.test(expr) || Number(expr) < lo || Number(expr) > hi) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
/** A 5-field cron expression, evaluated in UTC by the dispatcher, checked
|
|
49
|
+
* with the backend's own grammar (`_valid_cron`) so a schedule the server
|
|
50
|
+
* would 422 is refused here, before any call — and first of all the mistake
|
|
51
|
+
* a shell makes for you: an unquoted `*` expanding to filenames, or a
|
|
52
|
+
* schedule split across arguments. Returns the whitespace-collapsed form. */
|
|
53
|
+
export function normalizeSchedule(raw) {
|
|
54
|
+
const schedule = raw.trim().replace(/\s+/g, " ");
|
|
55
|
+
const fields = schedule.split(" ");
|
|
56
|
+
if (fields.length !== 5) {
|
|
57
|
+
throw new Error(`A schedule is 5 cron fields (minute hour day-of-month month day-of-week), got ${fields.length}: "${schedule}". ` +
|
|
58
|
+
`Quote it so the shell leaves the stars alone, e.g. "*/15 * * * *".`);
|
|
59
|
+
}
|
|
60
|
+
fields.forEach((f, i) => {
|
|
61
|
+
const { name, lo, hi } = CRON_FIELDS[i];
|
|
62
|
+
if (!validCronField(f, lo, hi)) {
|
|
63
|
+
throw new Error(`"${f}" isn't a valid ${name} field in "${schedule}": use ${lo}-${hi}, with digits, *, ",", "-" and "/" only (no names like MON or JAN).`);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return schedule;
|
|
67
|
+
}
|
|
68
|
+
/** Resolve a trigger by full id or a unique id prefix (the short id the list
|
|
69
|
+
* prints). Throws a plain Error — user error, not an API fault. */
|
|
70
|
+
export function resolveTrigger(triggers, ref) {
|
|
71
|
+
const needle = ref.trim().toLowerCase();
|
|
72
|
+
if (!needle)
|
|
73
|
+
throw new Error("Give a trigger id (see `synteq function cron list`).");
|
|
74
|
+
const exact = triggers.find((t) => t.id.toLowerCase() === needle);
|
|
75
|
+
if (exact)
|
|
76
|
+
return exact;
|
|
77
|
+
const matches = triggers.filter((t) => t.id.toLowerCase().startsWith(needle));
|
|
78
|
+
if (matches.length === 1)
|
|
79
|
+
return matches[0];
|
|
80
|
+
if (matches.length === 0) {
|
|
81
|
+
// UUIDv7 ids share a long time-ordered prefix, so the list prints the
|
|
82
|
+
// TAIL of the id; accept that too.
|
|
83
|
+
const tail = triggers.filter((t) => t.id.toLowerCase().endsWith(needle));
|
|
84
|
+
if (tail.length === 1)
|
|
85
|
+
return tail[0];
|
|
86
|
+
if (tail.length > 1) {
|
|
87
|
+
throw new Error(`"${ref}" matches ${tail.length} triggers — use more of the id.`);
|
|
88
|
+
}
|
|
89
|
+
throw new Error(`No cron trigger "${ref}" on this function (see \`synteq function cron list\`).`);
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`"${ref}" matches ${matches.length} triggers — use more of the id.`);
|
|
92
|
+
}
|
|
93
|
+
/** The short id the list shows. UUIDv7 puts the timestamp first, so triggers
|
|
94
|
+
* made minutes apart share their leading characters — the tail is what tells
|
|
95
|
+
* them apart. */
|
|
96
|
+
export function shortTriggerId(id) {
|
|
97
|
+
return id.slice(-8);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.js","sourceRoot":"","sources":["../../src/functions-support/cron.ts"],"names":[],"mappings":"AAEA;yEACyE;AACzE,MAAM,WAAW,GAA4D;IAC3E,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACjC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IAC/B,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACvC,EAAE,IAAI,EAAE,OAAO,EAAE,EA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K,CAAC;YAAE,OAAO,IAAI,CAAC,CAAC,CAAE,CAAC;QACvC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,aAAa,IAAI,CAAC,MAAM,iCAAiC,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,yDAAyD,CAAC,CAAC;IACpG,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,aAAa,OAAO,CAAC,MAAM,iCAAiC,CAAC,CAAC;AACvF,CAAC;AAED;;kBAEkB;AAClB,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A function env var key: what the backend accepts (`FnEnvVarSetIn.key`,
|
|
2
|
+
* 1..255 characters) minus what can't survive the CLI's KEY=VALUE form —
|
|
3
|
+
* whitespace and `=`. The ONE rule: `function env set` and
|
|
4
|
+
* `function deploy --env/--secret` (and its prompt) all check keys with it. */
|
|
5
|
+
export declare const FN_ENV_KEY_RE: RegExp;
|
|
6
|
+
/** Why `key` isn't a valid function env var name, or null when it is. */
|
|
7
|
+
export declare function envKeyProblem(key: string): string | null;
|
|
8
|
+
export type FnEnvKind = "config" | "secret";
|
|
9
|
+
/** One env var to set on a function: what `function env set` sends. */
|
|
10
|
+
export interface FnEnvAssignment {
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
kind: FnEnvKind;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse `KEY=VALUE` into an assignment. A leading `!` on the key marks a
|
|
17
|
+
* secret (`!API_KEY=sk-…`) — the first-run prompt's shorthand only. The
|
|
18
|
+
* scripted flags say the kind instead (`--env` config, `--secret` secret) and
|
|
19
|
+
* pass it as `kind`; a `!` there is refused rather than silently becoming
|
|
20
|
+
* part of the key. Throws a plain Error (a user error) on a malformed pair,
|
|
21
|
+
* with a message fit for a prompt validator or `this.error`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseEnvAssignment(raw: string, kind?: FnEnvKind): FnEnvAssignment;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** A function env var key: what the backend accepts (`FnEnvVarSetIn.key`,
|
|
2
|
+
* 1..255 characters) minus what can't survive the CLI's KEY=VALUE form —
|
|
3
|
+
* whitespace and `=`. The ONE rule: `function env set` and
|
|
4
|
+
* `function deploy --env/--secret` (and its prompt) all check keys with it. */
|
|
5
|
+
export const FN_ENV_KEY_RE = /^[^\s=]{1,255}$/;
|
|
6
|
+
/** Why `key` isn't a valid function env var name, or null when it is. */
|
|
7
|
+
export function envKeyProblem(key) {
|
|
8
|
+
if (!key)
|
|
9
|
+
return "Empty key. Provide KEY=VALUE.";
|
|
10
|
+
if (key.length > 255)
|
|
11
|
+
return `"${key.slice(0, 20)}…" is longer than 255 characters.`;
|
|
12
|
+
if (!FN_ENV_KEY_RE.test(key))
|
|
13
|
+
return `"${key}" isn't a valid name: no spaces or "=".`;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse `KEY=VALUE` into an assignment. A leading `!` on the key marks a
|
|
18
|
+
* secret (`!API_KEY=sk-…`) — the first-run prompt's shorthand only. The
|
|
19
|
+
* scripted flags say the kind instead (`--env` config, `--secret` secret) and
|
|
20
|
+
* pass it as `kind`; a `!` there is refused rather than silently becoming
|
|
21
|
+
* part of the key. Throws a plain Error (a user error) on a malformed pair,
|
|
22
|
+
* with a message fit for a prompt validator or `this.error`.
|
|
23
|
+
*/
|
|
24
|
+
export function parseEnvAssignment(raw, kind) {
|
|
25
|
+
let text = raw.trimStart();
|
|
26
|
+
let resolved = kind ?? "config";
|
|
27
|
+
if (text.startsWith("!")) {
|
|
28
|
+
if (kind !== undefined) {
|
|
29
|
+
throw new Error(`"${raw.trim()}": the ! secret prefix is only for the interactive prompt — pass --secret KEY=VALUE instead.`);
|
|
30
|
+
}
|
|
31
|
+
resolved = "secret";
|
|
32
|
+
text = text.slice(1);
|
|
33
|
+
}
|
|
34
|
+
const eq = text.indexOf("=");
|
|
35
|
+
if (eq <= 0) {
|
|
36
|
+
throw new Error(`"${raw.trim()}" isn't KEY=VALUE.`);
|
|
37
|
+
}
|
|
38
|
+
const key = text.slice(0, eq).trim();
|
|
39
|
+
const problem = envKeyProblem(key);
|
|
40
|
+
if (problem)
|
|
41
|
+
throw new Error(problem);
|
|
42
|
+
return { key, value: text.slice(eq + 1), kind: resolved };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/functions-support/env.ts"],"names":[],"mappings":"AAAA;;;gFAGgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE/C,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,CAAC,GAAG;QAAE,OAAO,+BAA+B,CAAC;IACjD,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,mCAAmC,CAAC;IACrF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,GAAG,yCAAyC,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC;AAWD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,IAAgB;IAC9D,IAAI,IAAI,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC;IAC3B,IAAI,QAAQ,GAAc,IAAI,IAAI,QAAQ,CAAC;IAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,IAAI,GAAG,CAAC,IAAI,EAAE,8FAA8F,CAC7G,CAAC;QACJ,CAAC;QACD,QAAQ,GAAG,QAAQ,CAAC;QACpB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Clients } from "../api/factory.js";
|
|
2
|
+
import { type AppLink } from "../config/store.js";
|
|
3
|
+
import type { Fn } from "../api/types.js";
|
|
4
|
+
/** Guidance when a command needs a function but the cwd isn't linked to one. */
|
|
5
|
+
export declare function notLinkedFunctionError(hint: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* The function a command should act on: `--name` when given, else the
|
|
8
|
+
* directory's link (which must be a FUNCTION link — an app link is refused
|
|
9
|
+
* with a pointer at `synteq …` app commands rather than silently 404ing).
|
|
10
|
+
*
|
|
11
|
+
* Returns the resolved row plus the (possibly rescoped) clients, mirroring
|
|
12
|
+
* BaseCommand.resolveLinkedApp's side effect without reaching into the
|
|
13
|
+
* command. Callers assign `this.clients = clients`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveLinkedFunction(clients: Clients, flags: {
|
|
16
|
+
name?: string;
|
|
17
|
+
team?: string;
|
|
18
|
+
insecure?: boolean;
|
|
19
|
+
}, cwd?: string): Promise<{
|
|
20
|
+
fn: Fn;
|
|
21
|
+
clients: Clients;
|
|
22
|
+
link?: AppLink;
|
|
23
|
+
}>;
|
|
24
|
+
/** Build the link record `synteq function init` writes for a directory. */
|
|
25
|
+
export declare function functionLink(fn: Fn, teamId: string, projectId: string): AppLink;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { clientsForLinkTeam } from "../apps-support/link.js";
|
|
2
|
+
import { linkKind } from "../config/store.js";
|
|
3
|
+
import { resolveFunction } from "./resolve.js";
|
|
4
|
+
/** Guidance when a command needs a function but the cwd isn't linked to one. */
|
|
5
|
+
export function notLinkedFunctionError(hint) {
|
|
6
|
+
return [
|
|
7
|
+
"No function given and this directory isn't linked to one.",
|
|
8
|
+
`Run \`synteq function init <name>\` here for a one-time setup, or pass ${hint}.`,
|
|
9
|
+
].join("\n");
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The function a command should act on: `--name` when given, else the
|
|
13
|
+
* directory's link (which must be a FUNCTION link — an app link is refused
|
|
14
|
+
* with a pointer at `synteq …` app commands rather than silently 404ing).
|
|
15
|
+
*
|
|
16
|
+
* Returns the resolved row plus the (possibly rescoped) clients, mirroring
|
|
17
|
+
* BaseCommand.resolveLinkedApp's side effect without reaching into the
|
|
18
|
+
* command. Callers assign `this.clients = clients`.
|
|
19
|
+
*/
|
|
20
|
+
export async function resolveLinkedFunction(clients, flags, cwd = process.cwd()) {
|
|
21
|
+
let ref = flags.name;
|
|
22
|
+
let projectId;
|
|
23
|
+
let link;
|
|
24
|
+
let scoped = clients;
|
|
25
|
+
if (!ref) {
|
|
26
|
+
link = clients.config.linkFor(cwd);
|
|
27
|
+
if (!link)
|
|
28
|
+
throw new Error(notLinkedFunctionError("--name <slug>"));
|
|
29
|
+
if (linkKind(link) !== "function") {
|
|
30
|
+
throw new Error(`This directory is linked to the app "${link.app_slug}", not a function. ` +
|
|
31
|
+
"Use `synteq deploy` / `synteq app …` here, or pass --name <slug>.");
|
|
32
|
+
}
|
|
33
|
+
ref = link.app_id;
|
|
34
|
+
projectId = link.project_id;
|
|
35
|
+
scoped = clientsForLinkTeam(clients, link, flags);
|
|
36
|
+
}
|
|
37
|
+
const fn = await resolveFunction(scoped.api, ref, projectId);
|
|
38
|
+
return { fn, clients: scoped, link };
|
|
39
|
+
}
|
|
40
|
+
/** Build the link record `synteq function init` writes for a directory. */
|
|
41
|
+
export function functionLink(fn, teamId, projectId) {
|
|
42
|
+
return {
|
|
43
|
+
kind: "function",
|
|
44
|
+
team_id: teamId,
|
|
45
|
+
project_id: projectId,
|
|
46
|
+
app_id: fn.id,
|
|
47
|
+
app_slug: fn.slug,
|
|
48
|
+
linked_at: new Date().toISOString(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/functions-support/link.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,gFAAgF;AAChF,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO;QACL,2DAA2D;QAC3D,0EAA0E,IAAI,GAAG;KAClF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAgB,EAChB,KAA2D,EAC3D,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAEnB,IAAI,GAAG,GAAG,KA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api/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Follow a function deploy to its end. Two phases, because the backend
|
|
5
|
+
* splits them: the BUILD row reaches succeeded/failed, then the status cron
|
|
6
|
+
* mints a RELEASE and flips it current once the orchestrator reports Live.
|
|
7
|
+
*
|
|
8
|
+
* CONTRACT:
|
|
9
|
+
* - `waitForBuild` polls GET /functions/{id}/builds/{buildId} every
|
|
10
|
+
* `intervalMs` (min 2000) until status ∈ {succeeded, failed} or
|
|
11
|
+
* `timeoutMs` elapses (→ throws DeployTimeoutError). `onStatus` fires
|
|
12
|
+
* once per status CHANGE (never per poll) so the command can print
|
|
13
|
+
* transitions without spam.
|
|
14
|
+
* - `waitForRelease` polls GET /functions/{id}/releases until a release
|
|
15
|
+
* whose buildId === build.id exists AND isCurrent, or one exists with a
|
|
16
|
+
* failed-looking status (→ returns it; the command decides), or timeout.
|
|
17
|
+
* - Both honour an AbortSignal for Ctrl-C.
|
|
18
|
+
*/
|
|
19
|
+
export declare const BUILD_TERMINAL: Set<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Release statuses that end the wait WITHOUT the release ever going current.
|
|
22
|
+
* `waitForRelease` RETURNS these rather than throwing — the command reports
|
|
23
|
+
* the outcome (and, for `failed`/`*_failed`, points at the build logs).
|
|
24
|
+
*/
|
|
25
|
+
export declare const RELEASE_TERMINAL_BAD: Set<string>;
|
|
26
|
+
/** Floor on the poll interval, so a caller can't hammer the API. */
|
|
27
|
+
export declare const MIN_INTERVAL_MS = 2000;
|
|
28
|
+
export declare class DeployTimeoutError extends Error {
|
|
29
|
+
constructor(phase: "build" | "release", after: number);
|
|
30
|
+
}
|
|
31
|
+
export interface PollOpts {
|
|
32
|
+
intervalMs?: number;
|
|
33
|
+
timeoutMs?: number;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
onStatus?: (status: string, build: FnBuild) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function waitForBuild(api: ApiClient, fnId: string, buildId: string, opts?: PollOpts): Promise<FnBuild>;
|
|
38
|
+
export declare function waitForRelease(api: ApiClient, fnId: string, buildId: string, opts?: Omit<PollOpts, "onStatus"> & {
|
|
39
|
+
onStatus?: (status: string, rel: FnRelease) => void;
|
|
40
|
+
}): Promise<FnRelease>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Follow a function deploy to its end. Two phases, because the backend
|
|
3
|
+
* splits them: the BUILD row reaches succeeded/failed, then the status cron
|
|
4
|
+
* mints a RELEASE and flips it current once the orchestrator reports Live.
|
|
5
|
+
*
|
|
6
|
+
* CONTRACT:
|
|
7
|
+
* - `waitForBuild` polls GET /functions/{id}/builds/{buildId} every
|
|
8
|
+
* `intervalMs` (min 2000) until status ∈ {succeeded, failed} or
|
|
9
|
+
* `timeoutMs` elapses (→ throws DeployTimeoutError). `onStatus` fires
|
|
10
|
+
* once per status CHANGE (never per poll) so the command can print
|
|
11
|
+
* transitions without spam.
|
|
12
|
+
* - `waitForRelease` polls GET /functions/{id}/releases until a release
|
|
13
|
+
* whose buildId === build.id exists AND isCurrent, or one exists with a
|
|
14
|
+
* failed-looking status (→ returns it; the command decides), or timeout.
|
|
15
|
+
* - Both honour an AbortSignal for Ctrl-C.
|
|
16
|
+
*/
|
|
17
|
+
export const BUILD_TERMINAL = new Set(["succeeded", "failed"]);
|
|
18
|
+
/**
|
|
19
|
+
* Release statuses that end the wait WITHOUT the release ever going current.
|
|
20
|
+
* `waitForRelease` RETURNS these rather than throwing — the command reports
|
|
21
|
+
* the outcome (and, for `failed`/`*_failed`, points at the build logs).
|
|
22
|
+
*/
|
|
23
|
+
export const RELEASE_TERMINAL_BAD = new Set([
|
|
24
|
+
"failed",
|
|
25
|
+
"health_failed",
|
|
26
|
+
"start_failed",
|
|
27
|
+
"superseded",
|
|
28
|
+
]);
|
|
29
|
+
/** Floor on the poll interval, so a caller can't hammer the API. */
|
|
30
|
+
export const MIN_INTERVAL_MS = 2000;
|
|
31
|
+
const DEFAULT_INTERVAL_MS = 3000;
|
|
32
|
+
const DEFAULT_TIMEOUT_MS = 600_000;
|
|
33
|
+
export class DeployTimeoutError extends Error {
|
|
34
|
+
constructor(phase, after) {
|
|
35
|
+
super(`Timed out after ${Math.round(after / 1000)}s waiting for the ${phase}.`);
|
|
36
|
+
this.name = "DeployTimeoutError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** The reason an aborted wait rejects with — the signal's, or a plain Error. */
|
|
40
|
+
function abortReason(signal) {
|
|
41
|
+
return signal.reason ?? new Error("aborted");
|
|
42
|
+
}
|
|
43
|
+
/** Sleep `ms`, rejecting early (and clearing the timer) if `signal` aborts. */
|
|
44
|
+
function sleep(ms, signal) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
if (signal?.aborted) {
|
|
47
|
+
reject(abortReason(signal));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const timer = setTimeout(() => {
|
|
51
|
+
signal?.removeEventListener("abort", onAbort);
|
|
52
|
+
resolve();
|
|
53
|
+
}, ms);
|
|
54
|
+
const onAbort = () => {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
reject(abortReason(signal));
|
|
57
|
+
};
|
|
58
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export async function waitForBuild(api, fnId, buildId, opts = {}) {
|
|
62
|
+
const interval = Math.max(MIN_INTERVAL_MS, opts.intervalMs ?? DEFAULT_INTERVAL_MS);
|
|
63
|
+
const timeout = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
64
|
+
const started = Date.now();
|
|
65
|
+
let last;
|
|
66
|
+
for (;;) {
|
|
67
|
+
if (opts.signal?.aborted)
|
|
68
|
+
throw abortReason(opts.signal);
|
|
69
|
+
const build = await api.functions.build(fnId, buildId);
|
|
70
|
+
if (build.status !== last) {
|
|
71
|
+
last = build.status;
|
|
72
|
+
opts.onStatus?.(build.status, build);
|
|
73
|
+
}
|
|
74
|
+
if (BUILD_TERMINAL.has(build.status))
|
|
75
|
+
return build;
|
|
76
|
+
const elapsed = Date.now() - started;
|
|
77
|
+
if (elapsed >= timeout)
|
|
78
|
+
throw new DeployTimeoutError("build", elapsed);
|
|
79
|
+
await sleep(interval, opts.signal);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export async function waitForRelease(api, fnId, buildId, opts = {}) {
|
|
83
|
+
const interval = Math.max(MIN_INTERVAL_MS, opts.intervalMs ?? DEFAULT_INTERVAL_MS);
|
|
84
|
+
const timeout = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
85
|
+
const started = Date.now();
|
|
86
|
+
let last;
|
|
87
|
+
for (;;) {
|
|
88
|
+
if (opts.signal?.aborted)
|
|
89
|
+
throw abortReason(opts.signal);
|
|
90
|
+
const releases = await api.functions.releases(fnId);
|
|
91
|
+
const mine = releases.filter((r) => r.buildId === buildId);
|
|
92
|
+
// Newest first, so a rebuild that minted two rows reports the latest.
|
|
93
|
+
mine.sort((a, b) => b.number - a.number);
|
|
94
|
+
const current = mine.find((r) => r.isCurrent);
|
|
95
|
+
const bad = mine.find((r) => RELEASE_TERMINAL_BAD.has(r.status));
|
|
96
|
+
const decided = current ?? bad;
|
|
97
|
+
if (mine.length > 0 && mine[0].status !== last) {
|
|
98
|
+
last = mine[0].status;
|
|
99
|
+
opts.onStatus?.(mine[0].status, mine[0]);
|
|
100
|
+
}
|
|
101
|
+
if (decided)
|
|
102
|
+
return decided;
|
|
103
|
+
const elapsed = Date.now() - started;
|
|
104
|
+
if (elapsed >= timeout)
|
|
105
|
+
throw new DeployTimeoutError("release", elapsed);
|
|
106
|
+
await sleep(interval, opts.signal);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=poll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/functions-support/poll.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;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