@vendure/cloud 0.4.0 → 0.5.0-dev.20261016123507.ge07a06e
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 +43 -10
- package/dist/cli/arguments.d.ts.map +1 -1
- package/dist/cli/arguments.js +9 -31
- package/dist/cli/arguments.js.map +1 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js +13 -30
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/access/access.d.ts +5 -0
- package/dist/cli/commands/access/access.d.ts.map +1 -0
- package/dist/cli/commands/access/access.js +73 -0
- package/dist/cli/commands/access/access.js.map +1 -0
- package/dist/cli/commands/access/index.d.ts +2 -0
- package/dist/cli/commands/access/index.d.ts.map +1 -0
- package/dist/cli/commands/access/index.js +46 -0
- package/dist/cli/commands/access/index.js.map +1 -0
- package/dist/cli/commands/deployment/arguments.d.ts.map +1 -1
- package/dist/cli/commands/deployment/arguments.js +1 -8
- package/dist/cli/commands/deployment/arguments.js.map +1 -1
- package/dist/cli/commands/deployment/build-logs.d.ts.map +1 -1
- package/dist/cli/commands/deployment/build-logs.js +12 -16
- package/dist/cli/commands/deployment/build-logs.js.map +1 -1
- package/dist/cli/commands/deployment/deploy.d.ts.map +1 -1
- package/dist/cli/commands/deployment/deploy.js +88 -45
- package/dist/cli/commands/deployment/deploy.js.map +1 -1
- package/dist/cli/commands/deployment/index.d.ts.map +1 -1
- package/dist/cli/commands/deployment/index.js +18 -30
- package/dist/cli/commands/deployment/index.js.map +1 -1
- package/dist/cli/commands/deployment/list.d.ts.map +1 -1
- package/dist/cli/commands/deployment/list.js +5 -5
- package/dist/cli/commands/deployment/list.js.map +1 -1
- package/dist/cli/commands/deployment/log-export.d.ts.map +1 -1
- package/dist/cli/commands/deployment/log-export.js +14 -27
- package/dist/cli/commands/deployment/log-export.js.map +1 -1
- package/dist/cli/commands/deployment/log-query-output.d.ts.map +1 -1
- package/dist/cli/commands/deployment/log-query-output.js +18 -32
- package/dist/cli/commands/deployment/log-query-output.js.map +1 -1
- package/dist/cli/commands/deployment/logs.d.ts.map +1 -1
- package/dist/cli/commands/deployment/logs.js +52 -72
- package/dist/cli/commands/deployment/logs.js.map +1 -1
- package/dist/cli/commands/deployment/options.d.ts.map +1 -1
- package/dist/cli/commands/deployment/options.js +11 -20
- package/dist/cli/commands/deployment/options.js.map +1 -1
- package/dist/cli/commands/deployment/plan-format.d.ts.map +1 -1
- package/dist/cli/commands/deployment/plan-format.js +2 -2
- package/dist/cli/commands/deployment/plan-format.js.map +1 -1
- package/dist/cli/commands/deployment/plan.d.ts.map +1 -1
- package/dist/cli/commands/deployment/plan.js +7 -8
- package/dist/cli/commands/deployment/plan.js.map +1 -1
- package/dist/cli/commands/deployment/recovery.d.ts.map +1 -1
- package/dist/cli/commands/deployment/recovery.js +25 -35
- package/dist/cli/commands/deployment/recovery.js.map +1 -1
- package/dist/cli/commands/deployment/rollback.d.ts.map +1 -1
- package/dist/cli/commands/deployment/rollback.js +58 -12
- package/dist/cli/commands/deployment/rollback.js.map +1 -1
- package/dist/cli/commands/deployment/shared.d.ts.map +1 -1
- package/dist/cli/commands/deployment/shared.js +4 -7
- package/dist/cli/commands/deployment/shared.js.map +1 -1
- package/dist/cli/commands/deployment/show.d.ts.map +1 -1
- package/dist/cli/commands/deployment/show.js +8 -9
- package/dist/cli/commands/deployment/show.js.map +1 -1
- package/dist/cli/commands/deployment/source.d.ts.map +1 -1
- package/dist/cli/commands/deployment/source.js +2 -2
- package/dist/cli/commands/deployment/source.js.map +1 -1
- package/dist/cli/commands/deployment/status.d.ts.map +1 -1
- package/dist/cli/commands/deployment/status.js +10 -11
- package/dist/cli/commands/deployment/status.js.map +1 -1
- package/dist/cli/commands/deployment/teardown.js +22 -31
- package/dist/cli/commands/deployment/teardown.js.map +1 -1
- package/dist/cli/commands/identity-context/context.d.ts.map +1 -1
- package/dist/cli/commands/identity-context/context.js +3 -4
- package/dist/cli/commands/identity-context/context.js.map +1 -1
- package/dist/cli/commands/identity-context/index.d.ts.map +1 -1
- package/dist/cli/commands/identity-context/index.js +16 -50
- package/dist/cli/commands/identity-context/index.js.map +1 -1
- package/dist/cli/commands/identity-context/keys.d.ts.map +1 -1
- package/dist/cli/commands/identity-context/keys.js +13 -15
- package/dist/cli/commands/identity-context/keys.js.map +1 -1
- package/dist/cli/commands/identity-context/use.js +1 -1
- package/dist/cli/commands/identity-context/use.js.map +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +13 -20
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/project-config/config/build-fields.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/build-fields.js +2 -3
- package/dist/cli/commands/project-config/config/build-fields.js.map +1 -1
- package/dist/cli/commands/project-config/config/build.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/build.js +8 -9
- package/dist/cli/commands/project-config/config/build.js.map +1 -1
- package/dist/cli/commands/project-config/config/desired-state.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/desired-state.js +10 -12
- package/dist/cli/commands/project-config/config/desired-state.js.map +1 -1
- package/dist/cli/commands/project-config/config/email/domain.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/email/domain.js +12 -9
- package/dist/cli/commands/project-config/config/email/domain.js.map +1 -1
- package/dist/cli/commands/project-config/config/email/events.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/email/events.js +9 -9
- package/dist/cli/commands/project-config/config/email/events.js.map +1 -1
- package/dist/cli/commands/project-config/config/email/index.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/email/index.js +5 -6
- package/dist/cli/commands/project-config/config/email/index.js.map +1 -1
- package/dist/cli/commands/project-config/config/email/test-sending.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/email/test-sending.js +6 -5
- package/dist/cli/commands/project-config/config/email/test-sending.js.map +1 -1
- package/dist/cli/commands/project-config/config/index.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/index.js +8 -10
- package/dist/cli/commands/project-config/config/index.js.map +1 -1
- package/dist/cli/commands/project-config/config/runtime.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/runtime.js +10 -21
- package/dist/cli/commands/project-config/config/runtime.js.map +1 -1
- package/dist/cli/commands/project-config/config/set.js +3 -3
- package/dist/cli/commands/project-config/config/set.js.map +1 -1
- package/dist/cli/commands/project-config/config/show.d.ts.map +1 -1
- package/dist/cli/commands/project-config/config/show.js +7 -7
- package/dist/cli/commands/project-config/config/show.js.map +1 -1
- package/dist/cli/commands/project-config/env/add.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/add.js +4 -3
- package/dist/cli/commands/project-config/env/add.js.map +1 -1
- package/dist/cli/commands/project-config/env/get.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/get.js +7 -2
- package/dist/cli/commands/project-config/env/get.js.map +1 -1
- package/dist/cli/commands/project-config/env/import.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/import.js +15 -8
- package/dist/cli/commands/project-config/env/import.js.map +1 -1
- package/dist/cli/commands/project-config/env/index.js +7 -8
- package/dist/cli/commands/project-config/env/index.js.map +1 -1
- package/dist/cli/commands/project-config/env/list.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/list.js +29 -8
- package/dist/cli/commands/project-config/env/list.js.map +1 -1
- package/dist/cli/commands/project-config/env/metadata-options.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/metadata-options.js +0 -1
- package/dist/cli/commands/project-config/env/metadata-options.js.map +1 -1
- package/dist/cli/commands/project-config/env/pull.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/pull.js +22 -8
- package/dist/cli/commands/project-config/env/pull.js.map +1 -1
- package/dist/cli/commands/project-config/env/read-value.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/read-value.js +8 -4
- package/dist/cli/commands/project-config/env/read-value.js.map +1 -1
- package/dist/cli/commands/project-config/env/rm.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/rm.js +4 -3
- package/dist/cli/commands/project-config/env/rm.js.map +1 -1
- package/dist/cli/commands/project-config/env/run.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/run.js +9 -8
- package/dist/cli/commands/project-config/env/run.js.map +1 -1
- package/dist/cli/commands/project-config/env/update.d.ts.map +1 -1
- package/dist/cli/commands/project-config/env/update.js +4 -3
- package/dist/cli/commands/project-config/env/update.js.map +1 -1
- package/dist/cli/commands/project-config/environment/create.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/create.js +5 -6
- package/dist/cli/commands/project-config/environment/create.js.map +1 -1
- package/dist/cli/commands/project-config/environment/delete.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/delete.js +6 -6
- package/dist/cli/commands/project-config/environment/delete.js.map +1 -1
- package/dist/cli/commands/project-config/environment/find.js +3 -3
- package/dist/cli/commands/project-config/environment/find.js.map +1 -1
- package/dist/cli/commands/project-config/environment/index.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/index.js +8 -10
- package/dist/cli/commands/project-config/environment/index.js.map +1 -1
- package/dist/cli/commands/project-config/environment/initial-superadmin.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/initial-superadmin.js +4 -5
- package/dist/cli/commands/project-config/environment/initial-superadmin.js.map +1 -1
- package/dist/cli/commands/project-config/environment/list.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/list.js +5 -5
- package/dist/cli/commands/project-config/environment/list.js.map +1 -1
- package/dist/cli/commands/project-config/environment/regions.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/regions.js +3 -3
- package/dist/cli/commands/project-config/environment/regions.js.map +1 -1
- package/dist/cli/commands/project-config/environment/show.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/show.js +3 -4
- package/dist/cli/commands/project-config/environment/show.js.map +1 -1
- package/dist/cli/commands/project-config/environment/update.d.ts.map +1 -1
- package/dist/cli/commands/project-config/environment/update.js +3 -4
- package/dist/cli/commands/project-config/environment/update.js.map +1 -1
- package/dist/cli/commands/project-config/index.js +5 -5
- package/dist/cli/commands/project-config/index.js.map +1 -1
- package/dist/cli/commands/project-config/init/build-detection.d.ts.map +1 -1
- package/dist/cli/commands/project-config/init/build-detection.js +4 -4
- package/dist/cli/commands/project-config/init/build-detection.js.map +1 -1
- package/dist/cli/commands/project-config/init/index.d.ts.map +1 -1
- package/dist/cli/commands/project-config/init/index.js +4 -5
- package/dist/cli/commands/project-config/init/index.js.map +1 -1
- package/dist/cli/commands/project-config/init/init.d.ts.map +1 -1
- package/dist/cli/commands/project-config/init/init.js +18 -22
- package/dist/cli/commands/project-config/init/init.js.map +1 -1
- package/dist/cli/commands/project-config/options.d.ts.map +1 -1
- package/dist/cli/commands/project-config/options.js +9 -14
- package/dist/cli/commands/project-config/options.js.map +1 -1
- package/dist/cli/commands/project-config/project/create.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/create.js +3 -3
- package/dist/cli/commands/project-config/project/create.js.map +1 -1
- package/dist/cli/commands/project-config/project/delete.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/delete.js +4 -5
- package/dist/cli/commands/project-config/project/delete.js.map +1 -1
- package/dist/cli/commands/project-config/project/index.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/index.js +4 -5
- package/dist/cli/commands/project-config/project/index.js.map +1 -1
- package/dist/cli/commands/project-config/project/link.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/link.js +4 -4
- package/dist/cli/commands/project-config/project/link.js.map +1 -1
- package/dist/cli/commands/project-config/project/list.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/list.js +5 -5
- package/dist/cli/commands/project-config/project/list.js.map +1 -1
- package/dist/cli/commands/project-config/project/show.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/show.js +11 -14
- package/dist/cli/commands/project-config/project/show.js.map +1 -1
- package/dist/cli/commands/project-config/project/subscription-state.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/subscription-state.js +17 -20
- package/dist/cli/commands/project-config/project/subscription-state.js.map +1 -1
- package/dist/cli/commands/project-config/project/unlink.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/unlink.js +2 -3
- package/dist/cli/commands/project-config/project/unlink.js.map +1 -1
- package/dist/cli/commands/project-config/project/update.d.ts.map +1 -1
- package/dist/cli/commands/project-config/project/update.js +3 -4
- package/dist/cli/commands/project-config/project/update.js.map +1 -1
- package/dist/cli/commands/project-config/source/connect.d.ts.map +1 -1
- package/dist/cli/commands/project-config/source/connect.js +24 -26
- package/dist/cli/commands/project-config/source/connect.js.map +1 -1
- package/dist/cli/commands/project-config/source/disconnect.d.ts.map +1 -1
- package/dist/cli/commands/project-config/source/disconnect.js +4 -4
- package/dist/cli/commands/project-config/source/disconnect.js.map +1 -1
- package/dist/cli/commands/project-config/source/index.js +7 -7
- package/dist/cli/commands/project-config/source/index.js.map +1 -1
- package/dist/cli/commands/project-config/source/map.d.ts.map +1 -1
- package/dist/cli/commands/project-config/source/map.js +12 -16
- package/dist/cli/commands/project-config/source/map.js.map +1 -1
- package/dist/cli/commands/project-config/source/repos.d.ts.map +1 -1
- package/dist/cli/commands/project-config/source/repos.js +5 -5
- package/dist/cli/commands/project-config/source/repos.js.map +1 -1
- package/dist/cli/commands/project-config/source/status.d.ts.map +1 -1
- package/dist/cli/commands/project-config/source/status.js +16 -25
- package/dist/cli/commands/project-config/source/status.js.map +1 -1
- package/dist/cli/commands/runtime-data/backup.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/backup.js +34 -36
- package/dist/cli/commands/runtime-data/backup.js.map +1 -1
- package/dist/cli/commands/runtime-data/index.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/index.js +38 -39
- package/dist/cli/commands/runtime-data/index.js.map +1 -1
- package/dist/cli/commands/runtime-data/resource.d.ts +1 -0
- package/dist/cli/commands/runtime-data/resource.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/resource.js +92 -33
- package/dist/cli/commands/runtime-data/resource.js.map +1 -1
- package/dist/cli/commands/runtime-data/restore.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/restore.js +32 -45
- package/dist/cli/commands/runtime-data/restore.js.map +1 -1
- package/dist/cli/commands/runtime-data/seeds.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/seeds.js +24 -26
- package/dist/cli/commands/runtime-data/seeds.js.map +1 -1
- package/dist/cli/commands/runtime-data/tunnel.d.ts.map +1 -1
- package/dist/cli/commands/runtime-data/tunnel.js +33 -43
- package/dist/cli/commands/runtime-data/tunnel.js.map +1 -1
- package/dist/cli/host-arguments.d.ts.map +1 -1
- package/dist/cli/host-arguments.js +10 -18
- package/dist/cli/host-arguments.js.map +1 -1
- package/dist/cli/host-nodes.js +1 -1
- package/dist/cli/host-nodes.js.map +1 -1
- package/dist/cli/index.d.ts +10 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +22 -33
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lib/api-client.d.ts +10 -5
- package/dist/cli/lib/api-client.d.ts.map +1 -1
- package/dist/cli/lib/api-client.js +23 -42
- package/dist/cli/lib/api-client.js.map +1 -1
- package/dist/cli/lib/auth.d.ts +4 -145
- package/dist/cli/lib/auth.d.ts.map +1 -1
- package/dist/cli/lib/auth.js +8 -515
- package/dist/cli/lib/auth.js.map +1 -1
- package/dist/cli/lib/cli-login.d.ts +12 -0
- package/dist/cli/lib/cli-login.d.ts.map +1 -0
- package/dist/cli/lib/cli-login.js +155 -0
- package/dist/cli/lib/cli-login.js.map +1 -0
- package/dist/cli/lib/cloud-api-url.d.ts +2 -0
- package/dist/cli/lib/cloud-api-url.d.ts.map +1 -0
- package/dist/cli/lib/cloud-api-url.js +3 -0
- package/dist/cli/lib/cloud-api-url.js.map +1 -0
- package/dist/cli/lib/commit.d.ts.map +1 -1
- package/dist/cli/lib/commit.js +2 -3
- package/dist/cli/lib/commit.js.map +1 -1
- package/dist/cli/lib/config-revisions.d.ts +9 -0
- package/dist/cli/lib/config-revisions.d.ts.map +1 -0
- package/dist/cli/lib/config-revisions.js +52 -0
- package/dist/cli/lib/config-revisions.js.map +1 -0
- package/dist/cli/lib/config.d.ts +0 -4
- package/dist/cli/lib/config.d.ts.map +1 -1
- package/dist/cli/lib/config.js +3 -5
- package/dist/cli/lib/config.js.map +1 -1
- package/dist/cli/lib/console-pairing.d.ts +1 -14
- package/dist/cli/lib/console-pairing.d.ts.map +1 -1
- package/dist/cli/lib/console-pairing.js +48 -60
- package/dist/cli/lib/console-pairing.js.map +1 -1
- package/dist/cli/lib/contract/backup-schedule-reasons.d.ts.map +1 -1
- package/dist/cli/lib/contract/backup-schedule-reasons.js +3 -7
- package/dist/cli/lib/contract/backup-schedule-reasons.js.map +1 -1
- package/dist/cli/lib/contract/build-settings.d.ts +1 -1
- package/dist/cli/lib/contract/build-settings.d.ts.map +1 -1
- package/dist/cli/lib/contract/build-settings.js +12 -18
- package/dist/cli/lib/contract/build-settings.js.map +1 -1
- package/dist/cli/lib/contract/database.d.ts.map +1 -1
- package/dist/cli/lib/contract/database.js +7 -13
- package/dist/cli/lib/contract/database.js.map +1 -1
- package/dist/cli/lib/contract/deployment-resource-labels.d.ts.map +1 -1
- package/dist/cli/lib/contract/deployment-resource-labels.js +2 -6
- package/dist/cli/lib/contract/deployment-resource-labels.js.map +1 -1
- package/dist/cli/lib/contract/deployments.d.ts +1 -0
- package/dist/cli/lib/contract/deployments.d.ts.map +1 -1
- package/dist/cli/lib/contract/deployments.js +32 -40
- package/dist/cli/lib/contract/deployments.js.map +1 -1
- package/dist/cli/lib/contract/desired-state.d.ts +3 -1
- package/dist/cli/lib/contract/desired-state.d.ts.map +1 -1
- package/dist/cli/lib/contract/desired-state.js +33 -50
- package/dist/cli/lib/contract/desired-state.js.map +1 -1
- package/dist/cli/lib/contract/env-vars.d.ts +37 -0
- package/dist/cli/lib/contract/env-vars.d.ts.map +1 -0
- package/dist/cli/lib/contract/env-vars.js +6 -0
- package/dist/cli/lib/contract/env-vars.js.map +1 -0
- package/dist/cli/lib/contract/foreign-credentials.d.ts +14 -27
- package/dist/cli/lib/contract/foreign-credentials.d.ts.map +1 -1
- package/dist/cli/lib/contract/foreign-credentials.js +19 -32
- package/dist/cli/lib/contract/foreign-credentials.js.map +1 -1
- package/dist/cli/lib/contract/logs.d.ts.map +1 -1
- package/dist/cli/lib/contract/logs.js +26 -34
- package/dist/cli/lib/contract/logs.js.map +1 -1
- package/dist/cli/lib/contract/managed-email.d.ts.map +1 -1
- package/dist/cli/lib/contract/managed-email.js +2 -3
- package/dist/cli/lib/contract/managed-email.js.map +1 -1
- package/dist/cli/lib/contract/permission-denied.d.ts +16 -0
- package/dist/cli/lib/contract/permission-denied.d.ts.map +1 -0
- package/dist/cli/lib/contract/permission-denied.js +20 -0
- package/dist/cli/lib/contract/permission-denied.js.map +1 -0
- package/dist/cli/lib/contract/project-grants.d.ts +16 -0
- package/dist/cli/lib/contract/project-grants.d.ts.map +1 -0
- package/dist/cli/lib/contract/project-grants.js +58 -0
- package/dist/cli/lib/contract/project-grants.js.map +1 -0
- package/dist/cli/lib/contract/projects.d.ts.map +1 -1
- package/dist/cli/lib/contract/projects.js +2 -3
- package/dist/cli/lib/contract/projects.js.map +1 -1
- package/dist/cli/lib/contract/public-error-details.d.ts.map +1 -1
- package/dist/cli/lib/contract/public-error-details.js +28 -43
- package/dist/cli/lib/contract/public-error-details.js.map +1 -1
- package/dist/cli/lib/contract/regions.js +2 -2
- package/dist/cli/lib/contract/regions.js.map +1 -1
- package/dist/cli/lib/contract/runtime-operations.d.ts +16 -0
- package/dist/cli/lib/contract/runtime-operations.d.ts.map +1 -1
- package/dist/cli/lib/contract/runtime-operations.js +16 -21
- package/dist/cli/lib/contract/runtime-operations.js.map +1 -1
- package/dist/cli/lib/contract/seeds.d.ts.map +1 -1
- package/dist/cli/lib/contract/seeds.js +12 -21
- package/dist/cli/lib/contract/seeds.js.map +1 -1
- package/dist/cli/lib/contract/source-disconnect-reasons.d.ts.map +1 -1
- package/dist/cli/lib/contract/source-disconnect-reasons.js +9 -17
- package/dist/cli/lib/contract/source-disconnect-reasons.js.map +1 -1
- package/dist/cli/lib/contract/source-repository.d.ts.map +1 -1
- package/dist/cli/lib/contract/source-repository.js +5 -9
- package/dist/cli/lib/contract/source-repository.js.map +1 -1
- package/dist/cli/lib/contract/wire-types.d.ts.map +1 -1
- package/dist/cli/lib/contract/wire-types.js +3 -8
- package/dist/cli/lib/contract/wire-types.js.map +1 -1
- package/dist/cli/lib/contract/wire-values.d.ts.map +1 -1
- package/dist/cli/lib/contract/wire-values.js +2 -3
- package/dist/cli/lib/contract/wire-values.js.map +1 -1
- package/dist/cli/lib/dotenv.d.ts +6 -0
- package/dist/cli/lib/dotenv.d.ts.map +1 -1
- package/dist/cli/lib/dotenv.js +62 -20
- package/dist/cli/lib/dotenv.js.map +1 -1
- package/dist/cli/lib/env-file.d.ts.map +1 -1
- package/dist/cli/lib/env-file.js +5 -11
- package/dist/cli/lib/env-file.js.map +1 -1
- package/dist/cli/lib/env-preflight.d.ts +6 -1
- package/dist/cli/lib/env-preflight.d.ts.map +1 -1
- package/dist/cli/lib/env-preflight.js +91 -63
- package/dist/cli/lib/env-preflight.js.map +1 -1
- package/dist/cli/lib/errors.d.ts +17 -49
- package/dist/cli/lib/errors.d.ts.map +1 -1
- package/dist/cli/lib/errors.js +47 -106
- package/dist/cli/lib/errors.js.map +1 -1
- package/dist/cli/lib/format.d.ts.map +1 -1
- package/dist/cli/lib/format.js +3 -5
- package/dist/cli/lib/format.js.map +1 -1
- package/dist/cli/lib/invocation.d.ts +4 -5
- package/dist/cli/lib/invocation.d.ts.map +1 -1
- package/dist/cli/lib/invocation.js +5 -33
- package/dist/cli/lib/invocation.js.map +1 -1
- package/dist/cli/lib/log-stream.d.ts.map +1 -1
- package/dist/cli/lib/log-stream.js +15 -23
- package/dist/cli/lib/log-stream.js.map +1 -1
- package/dist/cli/lib/logger.d.ts.map +1 -1
- package/dist/cli/lib/logger.js +7 -12
- package/dist/cli/lib/logger.js.map +1 -1
- package/dist/cli/lib/organization.d.ts.map +1 -1
- package/dist/cli/lib/organization.js +5 -13
- package/dist/cli/lib/organization.js.map +1 -1
- package/dist/cli/lib/project-link.d.ts.map +1 -1
- package/dist/cli/lib/project-link.js +2 -4
- package/dist/cli/lib/project-link.js.map +1 -1
- package/dist/cli/lib/resolve.d.ts +1 -6
- package/dist/cli/lib/resolve.d.ts.map +1 -1
- package/dist/cli/lib/resolve.js +26 -48
- package/dist/cli/lib/resolve.js.map +1 -1
- package/dist/cli/lib/source-repository-link.d.ts.map +1 -1
- package/dist/cli/lib/source-repository-link.js +6 -9
- package/dist/cli/lib/source-repository-link.js.map +1 -1
- package/dist/cli/lib/terminal-output.d.ts +4 -0
- package/dist/cli/lib/terminal-output.d.ts.map +1 -1
- package/dist/cli/lib/terminal-output.js +35 -18
- package/dist/cli/lib/terminal-output.js.map +1 -1
- package/dist/cli/lib/types.d.ts +3 -7
- package/dist/cli/lib/types.d.ts.map +1 -1
- package/dist/cli/lib/types.js.map +1 -1
- package/dist/cli/lib/utf8.d.ts +2 -0
- package/dist/cli/lib/utf8.d.ts.map +1 -0
- package/dist/cli/lib/utf8.js +12 -0
- package/dist/cli/lib/utf8.js.map +1 -0
- package/dist/cli/root-options.d.ts.map +1 -1
- package/dist/cli/root-options.js +11 -14
- package/dist/cli/root-options.js.map +1 -1
- package/dist/cli-plugin.d.ts.map +1 -1
- package/dist/cli-plugin.js +2 -6
- package/dist/cli-plugin.js.map +1 -1
- package/dist/cloud-config-module.js +2 -2
- package/dist/cloud-config-module.js.map +1 -1
- package/dist/dev/cli-host.d.ts.map +1 -1
- package/dist/dev/cli-host.js +16 -19
- package/dist/dev/cli-host.js.map +1 -1
- package/dist/dev/dashboard-vite-config.d.ts.map +1 -1
- package/dist/dev/dashboard-vite-config.js +17 -20
- package/dist/dev/dashboard-vite-config.js.map +1 -1
- package/dist/dev/dev-command.d.ts.map +1 -1
- package/dist/dev/dev-command.js +72 -55
- package/dist/dev/dev-command.js.map +1 -1
- package/dist/dev/dev-config.d.ts +3 -0
- package/dist/dev/dev-config.d.ts.map +1 -1
- package/dist/dev/dev-config.js +43 -13
- package/dist/dev/dev-config.js.map +1 -1
- package/dist/dev/dev-migrate.js +7 -11
- package/dist/dev/dev-migrate.js.map +1 -1
- package/dist/dev/dev-process.d.ts.map +1 -1
- package/dist/dev/dev-process.js +6 -10
- package/dist/dev/dev-process.js.map +1 -1
- package/dist/dev/dev-server.js +7 -9
- package/dist/dev/dev-server.js.map +1 -1
- package/dist/dev/dev-worker.js +5 -3
- package/dist/dev/dev-worker.js.map +1 -1
- package/dist/dev/local-services.d.ts.map +1 -1
- package/dist/dev/local-services.js +163 -106
- package/dist/dev/local-services.js.map +1 -1
- package/dist/dev/project-layout.d.ts.map +1 -1
- package/dist/dev/project-layout.js +12 -17
- package/dist/dev/project-layout.js.map +1 -1
- package/dist/dev/project-plugin-scope.d.ts +2 -0
- package/dist/dev/project-plugin-scope.d.ts.map +1 -0
- package/dist/dev/project-plugin-scope.js +38 -0
- package/dist/dev/project-plugin-scope.js.map +1 -0
- package/dist/entrypoint.js +2 -0
- package/dist/entrypoint.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/local-asset-server.d.ts.map +1 -1
- package/dist/local-asset-server.js +7 -13
- package/dist/local-asset-server.js.map +1 -1
- package/dist/local-cache-plugin.d.ts.map +1 -1
- package/dist/local-cache-plugin.js +20 -28
- package/dist/local-cache-plugin.js.map +1 -1
- package/dist/local-cache.d.ts.map +1 -1
- package/dist/local-cache.js +40 -55
- package/dist/local-cache.js.map +1 -1
- package/dist/local-core.d.ts.map +1 -1
- package/dist/local-core.js +3 -5
- package/dist/local-core.js.map +1 -1
- package/dist/local-dashboard-plugin.d.ts.map +1 -1
- package/dist/local-dashboard-plugin.js +6 -11
- package/dist/local-dashboard-plugin.js.map +1 -1
- package/dist/local-database.d.ts.map +1 -1
- package/dist/local-database.js +20 -23
- package/dist/local-database.js.map +1 -1
- package/dist/local-durable-execution-plugin.d.ts +12 -0
- package/dist/local-durable-execution-plugin.d.ts.map +1 -1
- package/dist/local-durable-execution-plugin.js +296 -24
- package/dist/local-durable-execution-plugin.js.map +1 -1
- package/dist/local-runtime-guard.d.ts +2 -0
- package/dist/local-runtime-guard.d.ts.map +1 -1
- package/dist/local-runtime-guard.js +40 -3
- package/dist/local-runtime-guard.js.map +1 -1
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +51 -48
- package/dist/local-runtime.js.map +1 -1
- package/package.json +16 -9
- package/dist/cli/commands/identity-context/login.d.ts +0 -2
- package/dist/cli/commands/identity-context/login.d.ts.map +0 -1
- package/dist/cli/commands/identity-context/login.js +0 -158
- package/dist/cli/commands/identity-context/login.js.map +0 -1
- package/dist/cli/commands/identity-context/logout.d.ts +0 -2
- package/dist/cli/commands/identity-context/logout.d.ts.map +0 -1
- package/dist/cli/commands/identity-context/logout.js +0 -11
- package/dist/cli/commands/identity-context/logout.js.map +0 -1
- package/dist/cli/commands/identity-context/org-switch.d.ts +0 -3
- package/dist/cli/commands/identity-context/org-switch.d.ts.map +0 -1
- package/dist/cli/commands/identity-context/org-switch.js +0 -83
- package/dist/cli/commands/identity-context/org-switch.js.map +0 -1
- package/dist/cli/commands/identity-context/whoami.d.ts +0 -3
- package/dist/cli/commands/identity-context/whoami.d.ts.map +0 -1
- package/dist/cli/commands/identity-context/whoami.js +0 -101
- package/dist/cli/commands/identity-context/whoami.js.map +0 -1
- package/dist/cli/lib/console-credential.d.ts +0 -55
- package/dist/cli/lib/console-credential.d.ts.map +0 -1
- package/dist/cli/lib/console-credential.js +0 -164
- package/dist/cli/lib/console-credential.js.map +0 -1
- package/dist/cli/lib/console-origins.d.ts +0 -30
- package/dist/cli/lib/console-origins.d.ts.map +0 -1
- package/dist/cli/lib/console-origins.js +0 -87
- package/dist/cli/lib/console-origins.js.map +0 -1
- package/dist/cli/lib/console-session-lock.d.ts +0 -39
- package/dist/cli/lib/console-session-lock.d.ts.map +0 -1
- package/dist/cli/lib/console-session-lock.js +0 -235
- package/dist/cli/lib/console-session-lock.js.map +0 -1
- package/dist/cli/lib/console-session.d.ts +0 -47
- package/dist/cli/lib/console-session.d.ts.map +0 -1
- package/dist/cli/lib/console-session.js +0 -235
- package/dist/cli/lib/console-session.js.map +0 -1
- package/dist/cli/lib/file-lock.d.ts +0 -23
- package/dist/cli/lib/file-lock.d.ts.map +0 -1
- package/dist/cli/lib/file-lock.js +0 -121
- package/dist/cli/lib/file-lock.js.map +0 -1
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { consoleOrigins } from "./console-origins.js";
|
|
5
|
-
import { pairedConsoleOrigins } from "./console-pairing.js";
|
|
6
|
-
import { logger } from "./logger.js";
|
|
7
|
-
/**
|
|
8
|
-
* Treat a session as expired slightly early, so a token that passes this check and then expires
|
|
9
|
-
* while the request is in flight does not surface as a failure somewhere further down.
|
|
10
|
-
*/
|
|
11
|
-
const EXPIRY_SKEW_MS = 60_000;
|
|
12
|
-
/** `~/.vendure`. Not `~/.vendure-cloud`: this credential belongs to Console, not to Cloud. */
|
|
13
|
-
export function consoleConfigDir(home = homedir()) {
|
|
14
|
-
return join(home, ".vendure");
|
|
15
|
-
}
|
|
16
|
-
export function consoleCredentialPath(home = homedir()) {
|
|
17
|
-
return join(consoleConfigDir(home), "console-credentials.json");
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The stored credential, or `undefined`.
|
|
21
|
-
*
|
|
22
|
-
* Every failure reads as "no credential": a missing file, an unreadable one, malformed JSON, a
|
|
23
|
-
* schema version this build does not know, a session issued by a different Console, an untrusted
|
|
24
|
-
* origin named by the caller, and a machine whose control plane names no trusted Console. The
|
|
25
|
-
* answer to all of them is the same, which is that this machine has no shared session to reuse, and
|
|
26
|
-
* the caller falls back to the Cloud login it had before. Nothing here throws, including for a
|
|
27
|
-
* caller that names an origin this build does not trust.
|
|
28
|
-
*
|
|
29
|
-
* Expiry is deliberately not checked here. An expired credential may still carry a usable refresh
|
|
30
|
-
* token, so that decision belongs to the caller.
|
|
31
|
-
*
|
|
32
|
-
* A caller that names neither origin gets the Console its control plane pairs with, so the reader
|
|
33
|
-
* exported at the CLI boundary resolves the same Console as the session path (CLO-641).
|
|
34
|
-
*/
|
|
35
|
-
export function readConsoleCredential(location = {}) {
|
|
36
|
-
const expected = expectedOrigins(location);
|
|
37
|
-
if (!expected) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
const { appOrigin, apiOrigin } = expected;
|
|
41
|
-
let raw;
|
|
42
|
-
try {
|
|
43
|
-
raw = readFileSync(consoleCredentialPath(location.home), "utf-8");
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
let value;
|
|
49
|
-
try {
|
|
50
|
-
value = JSON.parse(raw);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
if (!isStoredConsoleCredential(value)) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
// Both halves have to match. A token minted against a local development Console must never be
|
|
59
|
-
// replayed against production, and the app origin alone does not say which API issued it.
|
|
60
|
-
if (!originsMatch(value.origin, appOrigin) || !originsMatch(value.apiOrigin, apiOrigin)) {
|
|
61
|
-
// Named because it is the one case with a usable session on disk behind it.
|
|
62
|
-
logger.debug({ storedApiOrigin: value.apiOrigin, expectedApiOrigin: apiOrigin }, "Ignoring a Console session another Console issued");
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
return { ...value, origin: appOrigin, apiOrigin };
|
|
66
|
-
}
|
|
67
|
-
function expectedOrigins(location) {
|
|
68
|
-
if (location.appOrigin === undefined && location.apiOrigin === undefined) {
|
|
69
|
-
return pairedConsoleOrigins();
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
return consoleOrigins(location);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
// Same answer as an untrusted `VENDURE_CLOUD_CONSOLE_API_URL`: no Console can be named, so
|
|
76
|
-
// there is no session to read. A raw throw from here would pass the `ConsoleSession*Error`
|
|
77
|
-
// taxonomy that every caller on the refresh path handles.
|
|
78
|
-
logger.debug({ error }, "Untrusted Console origins named by the caller; ignoring the session");
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Compared as origins rather than as strings, so a stored trailing slash or an explicit default
|
|
83
|
-
// port is the same credential. An unparseable stored value is not this file's to repair.
|
|
84
|
-
function originsMatch(stored, expected) {
|
|
85
|
-
try {
|
|
86
|
-
return new URL(stored).origin === expected;
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function isStoredConsoleCredential(value) {
|
|
93
|
-
if (!value || typeof value !== "object") {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
const candidate = value;
|
|
97
|
-
return (candidate.schemaVersion === 2 &&
|
|
98
|
-
typeof candidate.origin === "string" &&
|
|
99
|
-
!!candidate.origin &&
|
|
100
|
-
typeof candidate.apiOrigin === "string" &&
|
|
101
|
-
!!candidate.apiOrigin &&
|
|
102
|
-
typeof candidate.accessToken === "string" &&
|
|
103
|
-
!!candidate.accessToken &&
|
|
104
|
-
typeof candidate.expiresAt === "string" &&
|
|
105
|
-
!!candidate.expiresAt &&
|
|
106
|
-
(candidate.refreshToken === undefined ||
|
|
107
|
-
(typeof candidate.refreshToken === "string" && !!candidate.refreshToken)));
|
|
108
|
-
}
|
|
109
|
-
/** Whether the access token is past its expiry, counting the skew. */
|
|
110
|
-
export function isConsoleCredentialExpired(credential, now) {
|
|
111
|
-
const expiresAt = Date.parse(credential.expiresAt);
|
|
112
|
-
if (Number.isNaN(expiresAt)) {
|
|
113
|
-
// An expiry this build cannot read is not a session it can vouch for.
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
return expiresAt - EXPIRY_SKEW_MS <= now.getTime();
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Replace the stored credential.
|
|
120
|
-
*
|
|
121
|
-
* Only the refresh path calls this, and only while holding the session lock. Written through a
|
|
122
|
-
* temporary file and a rename, so a reader never sees half a token: a plain write truncates in
|
|
123
|
-
* place, and a crash inside it leaves unparseable JSON where a rotated refresh token used to be.
|
|
124
|
-
*/
|
|
125
|
-
export function writeConsoleCredential(credential, location = {}) {
|
|
126
|
-
const directory = consoleConfigDir(location.home);
|
|
127
|
-
const destination = consoleCredentialPath(location.home);
|
|
128
|
-
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
129
|
-
const temporary = `${destination}.${process.pid}.tmp`;
|
|
130
|
-
try {
|
|
131
|
-
writeFileSync(temporary, `${JSON.stringify(credential, null, 2)}\n`, { mode: 0o600 });
|
|
132
|
-
renameSync(temporary, destination);
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
try {
|
|
136
|
-
unlinkSync(temporary);
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
// The write may have failed before the temporary file existed at all.
|
|
140
|
-
}
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Remove the stored credential.
|
|
146
|
-
*
|
|
147
|
-
* The one caller is a refresh that Console refused, under the lock, against a refresh token that
|
|
148
|
-
* is still the stored one. Nothing else may reach it: a credential removed on a guess sends a
|
|
149
|
-
* person to the browser to log in over a session that was fine.
|
|
150
|
-
*/
|
|
151
|
-
export function discardConsoleCredential(location = {}) {
|
|
152
|
-
const path = consoleCredentialPath(location.home);
|
|
153
|
-
if (!existsSync(path)) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
unlinkSync(path);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
// Another participant removed it first, or it is not ours to remove. Either way the session is
|
|
161
|
-
// gone as far as this process is concerned.
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=console-credential.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-credential.js","sourceRoot":"","sources":["../../../src/cli/lib/console-credential.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAuB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA4BrC;;;GAGG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,8FAA8F;AAC9F,MAAM,UAAU,gBAAgB,CAAC,OAAe,OAAO,EAAE;IACvD,OAAO,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe,OAAO,EAAE;IAC5D,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC,CAAC;AAClE,CAAC;AAQD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAsC,EAAE;IAExC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,SAAS,EAA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,CAAC;QACP,+FAA+F;QAC/F,4CAA4C;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** The Console web app. Cloud never opens it; the origin identifies which Console issued a token. */
|
|
2
|
-
export declare const DEFAULT_CONSOLE_APP_ORIGIN = "https://console.vendure.io";
|
|
3
|
-
/** The Console API. Cloud calls its token endpoint to refresh a shared session. */
|
|
4
|
-
export declare const DEFAULT_CONSOLE_API_ORIGIN = "https://api.vendure.io";
|
|
5
|
-
export declare const STAGING_CONSOLE_API_ORIGIN = "https://staging.api.vendure.io";
|
|
6
|
-
export interface ConsoleOrigins {
|
|
7
|
-
appOrigin: string;
|
|
8
|
-
apiOrigin: string;
|
|
9
|
-
}
|
|
10
|
-
/** The two pairs by name, so a caller or a fixture never restates one of the four literals. */
|
|
11
|
-
export declare const DEFAULT_CONSOLE_ORIGINS: ConsoleOrigins;
|
|
12
|
-
export declare const STAGING_CONSOLE_ORIGINS: ConsoleOrigins;
|
|
13
|
-
/** Exported so a caller deciding what a loopback URL pairs with uses this same list. */
|
|
14
|
-
export declare function isLoopback(hostname: string): boolean;
|
|
15
|
-
/** The Console web app origin. Loopback is allowed for local development and tests. */
|
|
16
|
-
export declare function consoleAppOrigin(value?: string): string;
|
|
17
|
-
/** The Console API origin a token request may call. */
|
|
18
|
-
export declare function consoleApiOrigin(value?: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Select a matching app and API pair.
|
|
21
|
-
*
|
|
22
|
-
* Naming one staging origin selects the other, so a developer cannot half-configure themselves
|
|
23
|
-
* onto production. An explicit mixed pair is refused rather than silently corrected, because
|
|
24
|
-
* neither half is more likely to be the mistake.
|
|
25
|
-
*/
|
|
26
|
-
export declare function consoleOrigins(options: {
|
|
27
|
-
appOrigin?: string;
|
|
28
|
-
apiOrigin?: string;
|
|
29
|
-
}): ConsoleOrigins;
|
|
30
|
-
//# sourceMappingURL=console-origins.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-origins.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/console-origins.ts"],"names":[],"mappings":"AAeA,qGAAqG;AACrG,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAGnE,eAAO,MAAM,0BAA0B,mCAAmC,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+FAA+F;AAC/F,eAAO,MAAM,uBAAuB,EAAE,cAGrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAGrC,CAAC;AAKF,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AA0BD,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,MAAmC,GAAG,MAAM,CAEnF;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,MAAmC,GAAG,MAAM,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAmBjB"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// The Console origins this machine may talk to, and the pairing rule between them.
|
|
2
|
-
//
|
|
3
|
-
// A vendored fork of `test/fixtures/console-auth/upstream/origins.ts` from
|
|
4
|
-
// `vendurehq/vendure-platform@0d09dfd2`, adapted for this repository's quoting and formatting and
|
|
5
|
-
// carrying no Cloud-specific logic. Local to this copy, and to be kept when syncing upstream: the
|
|
6
|
-
// `export` on `STAGING_CONSOLE_API_ORIGIN`, `isLoopback` and the two origin-pair constants, which
|
|
7
|
-
// exist so `console-pairing.ts` and its fixtures name a Console without restating its literals. Both tools have to agree on these origins exactly: the pair is
|
|
8
|
-
// recorded in the credential file, and a disagreement reads as "no credential" on one side and a
|
|
9
|
-
// usable session on the other. `test/cli-console-origins.test.ts` pins the cases upstream's README
|
|
10
|
-
// names.
|
|
11
|
-
//
|
|
12
|
-
// The checks past the host list matter as much as the list. A URL carrying a path, a query, a
|
|
13
|
-
// fragment, or credentials is a URL built to be appended to, and each of those points a request
|
|
14
|
-
// somewhere else while the hostname still reads correctly.
|
|
15
|
-
/** The Console web app. Cloud never opens it; the origin identifies which Console issued a token. */
|
|
16
|
-
export const DEFAULT_CONSOLE_APP_ORIGIN = "https://console.vendure.io";
|
|
17
|
-
/** The Console API. Cloud calls its token endpoint to refresh a shared session. */
|
|
18
|
-
export const DEFAULT_CONSOLE_API_ORIGIN = "https://api.vendure.io";
|
|
19
|
-
const STAGING_CONSOLE_APP_ORIGIN = "https://staging.console.vendure.io";
|
|
20
|
-
export const STAGING_CONSOLE_API_ORIGIN = "https://staging.api.vendure.io";
|
|
21
|
-
/** The two pairs by name, so a caller or a fixture never restates one of the four literals. */
|
|
22
|
-
export const DEFAULT_CONSOLE_ORIGINS = {
|
|
23
|
-
appOrigin: DEFAULT_CONSOLE_APP_ORIGIN,
|
|
24
|
-
apiOrigin: DEFAULT_CONSOLE_API_ORIGIN,
|
|
25
|
-
};
|
|
26
|
-
export const STAGING_CONSOLE_ORIGINS = {
|
|
27
|
-
appOrigin: STAGING_CONSOLE_APP_ORIGIN,
|
|
28
|
-
apiOrigin: STAGING_CONSOLE_API_ORIGIN,
|
|
29
|
-
};
|
|
30
|
-
const TRUSTED_APP_HOSTS = ["console.vendure.io", "staging.console.vendure.io"];
|
|
31
|
-
const TRUSTED_API_HOSTS = ["api.vendure.io", "staging.api.vendure.io"];
|
|
32
|
-
/** Exported so a caller deciding what a loopback URL pairs with uses this same list. */
|
|
33
|
-
export function isLoopback(hostname) {
|
|
34
|
-
return ["localhost", "127.0.0.1", "::1"].includes(hostname) || hostname.endsWith(".localhost");
|
|
35
|
-
}
|
|
36
|
-
function trustedOrigin(value, trustedHosts, subject) {
|
|
37
|
-
let url;
|
|
38
|
-
try {
|
|
39
|
-
url = new URL(value);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
throw new Error(`The ${subject} URL is invalid.`);
|
|
43
|
-
}
|
|
44
|
-
const trustedRemote = trustedHosts.includes(url.hostname);
|
|
45
|
-
const loopback = isLoopback(url.hostname);
|
|
46
|
-
if ((!trustedRemote && !loopback) ||
|
|
47
|
-
(trustedRemote && url.protocol !== "https:") ||
|
|
48
|
-
(loopback && !["http:", "https:"].includes(url.protocol)) ||
|
|
49
|
-
url.username ||
|
|
50
|
-
url.password ||
|
|
51
|
-
url.pathname !== "/" ||
|
|
52
|
-
url.search ||
|
|
53
|
-
url.hash) {
|
|
54
|
-
throw new Error(`The ${subject} URL is not trusted.`);
|
|
55
|
-
}
|
|
56
|
-
return url.origin;
|
|
57
|
-
}
|
|
58
|
-
/** The Console web app origin. Loopback is allowed for local development and tests. */
|
|
59
|
-
export function consoleAppOrigin(value = DEFAULT_CONSOLE_APP_ORIGIN) {
|
|
60
|
-
return trustedOrigin(value, TRUSTED_APP_HOSTS, "Vendure Console");
|
|
61
|
-
}
|
|
62
|
-
/** The Console API origin a token request may call. */
|
|
63
|
-
export function consoleApiOrigin(value = DEFAULT_CONSOLE_API_ORIGIN) {
|
|
64
|
-
return trustedOrigin(value, TRUSTED_API_HOSTS, "Vendure Console API");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Select a matching app and API pair.
|
|
68
|
-
*
|
|
69
|
-
* Naming one staging origin selects the other, so a developer cannot half-configure themselves
|
|
70
|
-
* onto production. An explicit mixed pair is refused rather than silently corrected, because
|
|
71
|
-
* neither half is more likely to be the mistake.
|
|
72
|
-
*/
|
|
73
|
-
export function consoleOrigins(options) {
|
|
74
|
-
const explicitApp = options.appOrigin === undefined ? undefined : consoleAppOrigin(options.appOrigin);
|
|
75
|
-
const apiOrigin = consoleApiOrigin(options.apiOrigin ??
|
|
76
|
-
(explicitApp === STAGING_CONSOLE_APP_ORIGIN ? STAGING_CONSOLE_API_ORIGIN : undefined));
|
|
77
|
-
const appOrigin = explicitApp ??
|
|
78
|
-
(apiOrigin === STAGING_CONSOLE_API_ORIGIN
|
|
79
|
-
? STAGING_CONSOLE_APP_ORIGIN
|
|
80
|
-
: DEFAULT_CONSOLE_APP_ORIGIN);
|
|
81
|
-
if ((appOrigin === DEFAULT_CONSOLE_APP_ORIGIN && apiOrigin === STAGING_CONSOLE_API_ORIGIN) ||
|
|
82
|
-
(appOrigin === STAGING_CONSOLE_APP_ORIGIN && apiOrigin === DEFAULT_CONSOLE_API_ORIGIN)) {
|
|
83
|
-
throw new Error("The Vendure Console app and API origins must belong to the same environment.");
|
|
84
|
-
}
|
|
85
|
-
return { appOrigin, apiOrigin };
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=console-origins.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-origins.js","sourceRoot":"","sources":["../../../src/cli/lib/console-origins.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,2EAA2E;AAC3E,kGAAkG;AAClG,kGAAkG;AAClG,kGAAkG;AAClG,+JAA+J;AAC/J,iGAAiG;AACjG,mGAAmG;AACnG,SAAS;AACT,EAAE;AACF,8FAA8F;AAC9F,gGAAgG;AAChG,2DAA2D;AAE3D,qGAAqG;AACrG,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AAEvE,mFAAmF;AACnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAEnE,MAAM,0BAA0B,GAAG,oCAAoC,CAAC;AACxE,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AAO3E,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,SAAS,EAAE,0BAA0B;IACrC,SAAS,EAAE,0BAA0B;CACtC,CAAC;AAEF,MAAM,CAA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|
-
* A holder touches its own lock while it works, so this measures a holder that has stopped rather
|
|
5
|
-
* than one that is slow.
|
|
6
|
-
*/
|
|
7
|
-
export declare const CONSOLE_SESSION_LOCK_STALE_MS = 30000;
|
|
8
|
-
/**
|
|
9
|
-
* How long to wait for a lock somebody else holds.
|
|
10
|
-
*
|
|
11
|
-
* Never shorter than the stale budget. A waiter that gave up sooner could give up while the holder
|
|
12
|
-
* is dead but not yet stale, and then "I gave up waiting" would stop meaning "the holder is gone".
|
|
13
|
-
*/
|
|
14
|
-
export declare const CONSOLE_SESSION_LOCK_WAIT_MS = 30000;
|
|
15
|
-
/** The lock file, beside the credential it guards. */
|
|
16
|
-
export declare function consoleSessionLockPath(home?: string): string;
|
|
17
|
-
export interface ConsoleSessionLockOptions {
|
|
18
|
-
/** Overrides `os.homedir()`. Tests point this at a temporary directory. */
|
|
19
|
-
home?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The budgets belong to the protocol rather than to a caller. They are open here so a test can
|
|
22
|
-
* drive the stale and give-up paths without waiting half a minute for each one. A `waitMs` below
|
|
23
|
-
* `staleMs` is raised, because the protocol does not allow the shorter of the two.
|
|
24
|
-
*/
|
|
25
|
-
staleMs?: number;
|
|
26
|
-
waitMs?: number;
|
|
27
|
-
pollMs?: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Run `work` while holding the Console session lock.
|
|
31
|
-
*
|
|
32
|
-
* Every step that spends a refresh token or rewrites the credential file goes through here,
|
|
33
|
-
* including the ones in the other tool. Guarding only some of the call sites leaves the double
|
|
34
|
-
* spend reachable through the rest.
|
|
35
|
-
*
|
|
36
|
-
* The lock is not reentrant.
|
|
37
|
-
*/
|
|
38
|
-
export declare function withConsoleSessionLock<T>(options: ConsoleSessionLockOptions, work: () => Promise<T>): Promise<T>;
|
|
39
|
-
//# sourceMappingURL=console-session-lock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-session-lock.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/console-session-lock.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAInD,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAYD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,OAAO,EAAE,yBAAyB,EAClC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CASZ"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { link, mkdir, open, readFile, rename, stat, unlink, utimes } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { setTimeout as sleep } from "node:timers/promises";
|
|
5
|
-
import { consoleConfigDir } from "./console-credential.js";
|
|
6
|
-
import { ConsoleSessionLockUnavailableError } from "./errors.js";
|
|
7
|
-
import { logger } from "./logger.js";
|
|
8
|
-
// The cross-process lock guarding `~/.vendure/console-credentials.json`.
|
|
9
|
-
//
|
|
10
|
-
// Console rotates the refresh token on use and refuses the spent one, so two processes that refresh
|
|
11
|
-
// together leave one of them with nothing, and a stale pair written back over a live one ends a
|
|
12
|
-
// session that was working. Two processes are ordinary here: `vendure dev` runs for hours while
|
|
13
|
-
// Cloud commands run in another terminal.
|
|
14
|
-
//
|
|
15
|
-
// **This is a vendored fork, not a second implementation.** It is
|
|
16
|
-
// `test/fixtures/console-auth/upstream/session-lock.ts` from
|
|
17
|
-
// `vendurehq/vendure-platform@0d09dfd2`, adapted only in what this repository requires: double
|
|
18
|
-
// quotes, this project's formatting, `ConsoleSessionLockUnavailableError` in place of a bare
|
|
19
|
-
// `Error`, and a debug line on the release path. The algorithm, the constants and the reasoning are
|
|
20
|
-
// upstream's. Forking rather than importing is what upstream's README asks for, because the two
|
|
21
|
-
// tools ship on separate release trains, and there is no published build to depend on: nothing has
|
|
22
|
-
// been released to that repository's `major` dist-tag.
|
|
23
|
-
//
|
|
24
|
-
// The fork is what makes the drift dangerous, so two things guard it. `cli-console-session-lock.integration.test.ts`
|
|
25
|
-
// pins the values both processes must agree on against the vendored copy, and runs that copy in a
|
|
26
|
-
// second process against this one over a single credential file. That proves the fork still
|
|
27
|
-
// cooperates with its original. It does not prove two independent implementations agree, and
|
|
28
|
-
// nothing here should be read as claiming it does.
|
|
29
|
-
//
|
|
30
|
-
// This is not `file-lock.ts`. That lock guards `~/.vendure-cloud/refresh.lock`, is best-effort by
|
|
31
|
-
// design, and runs the guarded work anyway when it cannot be taken. Neither property is allowed
|
|
32
|
-
// here: a participant that runs unlocked is a participant that is not in the protocol.
|
|
33
|
-
/**
|
|
34
|
-
* How long a lock file may sit untouched before another participant may take it over.
|
|
35
|
-
*
|
|
36
|
-
* A holder touches its own lock while it works, so this measures a holder that has stopped rather
|
|
37
|
-
* than one that is slow.
|
|
38
|
-
*/
|
|
39
|
-
export const CONSOLE_SESSION_LOCK_STALE_MS = 30_000;
|
|
40
|
-
/**
|
|
41
|
-
* How long to wait for a lock somebody else holds.
|
|
42
|
-
*
|
|
43
|
-
* Never shorter than the stale budget. A waiter that gave up sooner could give up while the holder
|
|
44
|
-
* is dead but not yet stale, and then "I gave up waiting" would stop meaning "the holder is gone".
|
|
45
|
-
*/
|
|
46
|
-
export const CONSOLE_SESSION_LOCK_WAIT_MS = 30_000;
|
|
47
|
-
const CONSOLE_SESSION_LOCK_POLL_MS = 50;
|
|
48
|
-
/** The lock file, beside the credential it guards. */
|
|
49
|
-
export function consoleSessionLockPath(home) {
|
|
50
|
-
return join(consoleConfigDir(home), "console-credentials.lock");
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Run `work` while holding the Console session lock.
|
|
54
|
-
*
|
|
55
|
-
* Every step that spends a refresh token or rewrites the credential file goes through here,
|
|
56
|
-
* including the ones in the other tool. Guarding only some of the call sites leaves the double
|
|
57
|
-
* spend reachable through the rest.
|
|
58
|
-
*
|
|
59
|
-
* The lock is not reentrant.
|
|
60
|
-
*/
|
|
61
|
-
export async function withConsoleSessionLock(options, work) {
|
|
62
|
-
const lock = await acquire(options);
|
|
63
|
-
const beat = heartbeat(lock, options.staleMs ?? CONSOLE_SESSION_LOCK_STALE_MS);
|
|
64
|
-
try {
|
|
65
|
-
return await work();
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
clearInterval(beat);
|
|
69
|
-
await release(lock);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Say the holder is still here, by touching the lock while the work runs.
|
|
74
|
-
*
|
|
75
|
-
* Without it the stale budget measures how long the work takes rather than whether the holder is
|
|
76
|
-
* alive, so a hold that runs long on a loaded machine is broken while it is still working and two
|
|
77
|
-
* processes refresh at once. A third of the budget leaves two missed beats before anyone may act
|
|
78
|
-
* on the silence.
|
|
79
|
-
*/
|
|
80
|
-
function heartbeat(lock, staleMs) {
|
|
81
|
-
const beat = setInterval(() => {
|
|
82
|
-
void (async () => {
|
|
83
|
-
// Only ours. A lock broken and taken over while this holder was working belongs to
|
|
84
|
-
// somebody else, and beating on their behalf would keep their lock alive after they let
|
|
85
|
-
// it go.
|
|
86
|
-
const current = await readLockFile(lock.path);
|
|
87
|
-
if (current?.token !== lock.token)
|
|
88
|
-
return;
|
|
89
|
-
const when = new Date();
|
|
90
|
-
await utimes(lock.path, when, when);
|
|
91
|
-
})().catch(() => undefined);
|
|
92
|
-
}, Math.max(1, Math.round(staleMs / 3)));
|
|
93
|
-
// A lock is never a reason to keep the process running.
|
|
94
|
-
beat.unref();
|
|
95
|
-
return beat;
|
|
96
|
-
}
|
|
97
|
-
async function acquire(options) {
|
|
98
|
-
const path = consoleSessionLockPath(options.home);
|
|
99
|
-
const staleMs = options.staleMs ?? CONSOLE_SESSION_LOCK_STALE_MS;
|
|
100
|
-
const waitMs = Math.max(options.waitMs ?? CONSOLE_SESSION_LOCK_WAIT_MS, staleMs);
|
|
101
|
-
const pollMs = options.pollMs ?? CONSOLE_SESSION_LOCK_POLL_MS;
|
|
102
|
-
const token = randomUUID();
|
|
103
|
-
const deadline = Date.now() + waitMs;
|
|
104
|
-
await mkdir(consoleConfigDir(options.home), { recursive: true, mode: 0o700 });
|
|
105
|
-
const takeOver = async () => {
|
|
106
|
-
if (!(await breakIfStale(path, staleMs)))
|
|
107
|
-
return undefined;
|
|
108
|
-
return (await create(path, token)) ? { path, token } : undefined;
|
|
109
|
-
};
|
|
110
|
-
for (;;) {
|
|
111
|
-
if (await create(path, token))
|
|
112
|
-
return { path, token };
|
|
113
|
-
const taken = await takeOver();
|
|
114
|
-
if (taken)
|
|
115
|
-
return taken;
|
|
116
|
-
// Checked on every pass, including one that broke a lock. A state where `create` reports
|
|
117
|
-
// `EEXIST` while the lock itself cannot be read, such as a dangling symlink on the path, is
|
|
118
|
-
// otherwise a loop with no exit.
|
|
119
|
-
if (Date.now() >= deadline) {
|
|
120
|
-
// The lock can cross the stale boundary while the checks above are reading it, so it gets
|
|
121
|
-
// one last look. Without it a waiter that spent its whole budget can still walk away from a
|
|
122
|
-
// dead holder.
|
|
123
|
-
const last = await takeOver();
|
|
124
|
-
if (last)
|
|
125
|
-
return last;
|
|
126
|
-
throw new ConsoleSessionLockUnavailableError();
|
|
127
|
-
}
|
|
128
|
-
await sleep(pollMs);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create the lock file, or report that somebody else holds it.
|
|
133
|
-
*
|
|
134
|
-
* `wx` is the whole mechanism: the create either wins or fails with `EEXIST`, with no window in
|
|
135
|
-
* between. The body records who took it, which is what makes releasing and breaking safe, and
|
|
136
|
-
* gives a person looking at a stuck lock a pid to check.
|
|
137
|
-
*/
|
|
138
|
-
async function create(path, token) {
|
|
139
|
-
let handle;
|
|
140
|
-
try {
|
|
141
|
-
handle = await open(path, "wx", 0o600);
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
const { code } = error;
|
|
145
|
-
if (code === "EEXIST")
|
|
146
|
-
return false;
|
|
147
|
-
throw new ConsoleSessionLockUnavailableError({ cause: error });
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
const body = { token, pid: process.pid, acquiredAt: new Date().toISOString() };
|
|
151
|
-
await handle.writeFile(`${JSON.stringify(body)}\n`, "utf8");
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
await unlink(path).catch(() => undefined);
|
|
156
|
-
throw new ConsoleSessionLockUnavailableError({ cause: error });
|
|
157
|
-
}
|
|
158
|
-
finally {
|
|
159
|
-
await handle.close().catch(() => undefined);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Take a lock whose holder has stopped touching it out of the way. Reports whether the path is
|
|
164
|
-
* worth another create attempt.
|
|
165
|
-
*/
|
|
166
|
-
async function breakIfStale(path, staleMs) {
|
|
167
|
-
const before = await readLockFile(path);
|
|
168
|
-
if (!before)
|
|
169
|
-
return true;
|
|
170
|
-
// `Date.now()` counts whole milliseconds while `mtimeMs` carries a fraction, so an untouched
|
|
171
|
-
// lock written in the same millisecond a waiter started reads as younger than that waiter's own
|
|
172
|
-
// clock says it is. Floor it: both sides then measure in the same units, and a waiter that has
|
|
173
|
-
// spent its whole budget can always break what it spent the budget on.
|
|
174
|
-
if (Date.now() - Math.floor(before.mtimeMs) < staleMs)
|
|
175
|
-
return false;
|
|
176
|
-
// Move the lock aside rather than unlink it. `rename` is one operation, so one waiter moves this
|
|
177
|
-
// file and the rest get `ENOENT` and go back to creating. Unlinking by path would let a second
|
|
178
|
-
// waiter, still holding its reading of a file the first waiter has already removed, delete the
|
|
179
|
-
// fresh lock the first waiter created in its place and leave two holders.
|
|
180
|
-
const aside = `${path}.${randomUUID()}`;
|
|
181
|
-
try {
|
|
182
|
-
await rename(path, aside);
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
const moved = await readLockFile(aside);
|
|
188
|
-
if (moved && moved.token !== before.token) {
|
|
189
|
-
// Somebody took the lock between the read above and the rename, so what moved is their live
|
|
190
|
-
// lock and not the dead one. Put it back. `link` fails rather than overwrite, and a failure
|
|
191
|
-
// means a third lock is already there, at which point the holder whose lock was moved has lost
|
|
192
|
-
// it whatever happens next.
|
|
193
|
-
await link(aside, path).catch(() => undefined);
|
|
194
|
-
}
|
|
195
|
-
await unlink(aside).catch(() => undefined);
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Give up the lock.
|
|
200
|
-
*
|
|
201
|
-
* A lock carrying somebody else's token is not ours to remove: ours was already broken as stale
|
|
202
|
-
* and the file belongs to whoever took it. Releasing it would let a third process in while the
|
|
203
|
-
* second one writes.
|
|
204
|
-
*/
|
|
205
|
-
async function release(lock) {
|
|
206
|
-
const current = await readLockFile(lock.path);
|
|
207
|
-
if (current?.token !== lock.token) {
|
|
208
|
-
logger.debug("Console session lock was taken over while held; leaving it alone");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
await unlink(lock.path).catch(() => undefined);
|
|
212
|
-
}
|
|
213
|
-
async function readLockFile(path) {
|
|
214
|
-
try {
|
|
215
|
-
const info = await stat(path);
|
|
216
|
-
let token;
|
|
217
|
-
try {
|
|
218
|
-
const value = JSON.parse(await readFile(path, "utf8"));
|
|
219
|
-
if (value && typeof value === "object" && "token" in value) {
|
|
220
|
-
const { token: candidate } = value;
|
|
221
|
-
if (typeof candidate === "string")
|
|
222
|
-
token = candidate;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
catch {
|
|
226
|
-
// A lock written by something older, or caught mid-write. It still holds the lock; it just
|
|
227
|
-
// cannot prove ownership, so it can only ever be removed by the stale path.
|
|
228
|
-
}
|
|
229
|
-
return { token, mtimeMs: info.mtimeMs };
|
|
230
|
-
}
|
|
231
|
-
catch {
|
|
232
|
-
return undefined;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
//# sourceMappingURL=console-session-lock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-session-lock.js","sourceRoot":"","sources":["../../../src/cli/lib/console-session-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,yEAAyE;AACzE,EAAE;AACF,oGAAoG;AACpG,gGAAgG;AAChG,gGAAgG;AAChG,0CAA0C;AAC1C,EAAE;AACF,kEAAkE;AAClE,6DAA6D;AAC7D,+FAA+F;AAC/F,6FAA6F;AAC7F,oGAAoG;AACpG,gGAAgG;AAChG,mGAAmG;AACnG,uDAAuD;AACvD,EAAE;AACF,qHAAqH;AACrH,kGAAkG;AAClG,4FAA4F;AAC5F,6FAA6F;AAC7F,mDAAmD;AACnD,EAAE;AACF,kGAAkG;AAClG,gGA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 @@
|
|
|
1
|
-
import { type ConsoleCredentialLocation } from "./console-credential.js";
|
|
2
|
-
export interface ConsoleSessionOptions extends ConsoleCredentialLocation {
|
|
3
|
-
fetch?: typeof globalThis.fetch;
|
|
4
|
-
now?: () => Date;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Whether this machine may reuse the shared Vendure Console CLI Session for Cloud commands.
|
|
8
|
-
*
|
|
9
|
-
* Off unless the variable is set, and the control plane refuses a Console session unless it has
|
|
10
|
-
* been configured to reach Console, so both ends of CLO-641 default to the behaviour that shipped
|
|
11
|
-
* before it. The switch is one a person sets rather than something inferred from the presence of a
|
|
12
|
-
* file another tool wrote: finding a credential is not the same as being told to use it, and a
|
|
13
|
-
* machine that turned this on by itself would change which account a command runs under.
|
|
14
|
-
*
|
|
15
|
-
* It lives here rather than in `config.ts` because a machine with the feature off must not even
|
|
16
|
-
* read the Console credential, and keeping the switch beside the reader is what makes that
|
|
17
|
-
* obvious at the one call site that checks it.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isSharedConsoleSessionEnabled(): boolean;
|
|
20
|
-
export interface ResolvedConsoleSession {
|
|
21
|
-
accessToken: string;
|
|
22
|
-
/** Whether the access token is past its expiry, counting the skew. */
|
|
23
|
-
expired: boolean;
|
|
24
|
-
/** Whether an expired session can be renewed without a browser. */
|
|
25
|
-
refreshable: boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The stored Console session, or `undefined` when this machine has none to reuse.
|
|
29
|
-
*
|
|
30
|
-
* Synchronous, because it sits on the credential-resolution path that every command runs through
|
|
31
|
-
* before it does any work. An expired session is still returned: it may carry a refresh token, and
|
|
32
|
-
* the renewal happens on the first 401 through the same retry the stored Cloud login uses.
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveConsoleSession(options?: ConsoleCredentialLocation & {
|
|
35
|
-
now?: () => Date;
|
|
36
|
-
}): ResolvedConsoleSession | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Renew the shared session and return the fresh access token.
|
|
39
|
-
*
|
|
40
|
-
* Deduplicated twice, for the same reason the stored Cloud login is. This promise collapses the
|
|
41
|
-
* concurrent calls of one process, and the session lock underneath it serializes the token request
|
|
42
|
-
* against every other process on the machine, Cloud and Platform alike. Neither is enough alone:
|
|
43
|
-
* this one knows nothing about the other tool, and the lock cannot see a second client inside this
|
|
44
|
-
* process that is already waiting on it.
|
|
45
|
-
*/
|
|
46
|
-
export declare function refreshConsoleSession(failedAccessToken: string | undefined, options?: ConsoleSessionOptions): Promise<string>;
|
|
47
|
-
//# sourceMappingURL=console-session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-session.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/console-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,yBAAyB,EAK/B,MAAM,yBAAyB,CAAC;AAgCjC,MAAM,WAAW,qBAAsB,SAAQ,yBAAyB;IACtE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAGvD;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,yBAAyB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CAAO,GAC7D,sBAAsB,GAAG,SAAS,CAUpC;AAID;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|