@salesforce/b2c-tooling-sdk 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/content-schemas/componenttype.json +37 -0
- package/dist/esm/config/dw-json.d.ts +9 -2
- package/dist/esm/config/dw-json.js.map +1 -1
- package/dist/esm/config/index.d.ts +2 -2
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/mapping.d.ts +7 -1
- package/dist/esm/config/mapping.js +10 -0
- package/dist/esm/config/mapping.js.map +1 -1
- package/dist/esm/config/sources/package-json-source.js +1 -0
- package/dist/esm/config/sources/package-json-source.js.map +1 -1
- package/dist/esm/config/types.d.ts +23 -2
- package/dist/esm/operations/content/validate.js +46 -4
- package/dist/esm/operations/content/validate.js.map +1 -1
- package/dist/esm/operations/jobs/site-archive.d.ts +12 -0
- package/dist/esm/operations/jobs/site-archive.js +107 -3
- package/dist/esm/operations/jobs/site-archive.js.map +1 -1
- package/package.json +73 -285
- package/dist/cjs/auth/api-key.d.ts +0 -28
- package/dist/cjs/auth/api-key.js +0 -45
- package/dist/cjs/auth/api-key.js.map +0 -1
- package/dist/cjs/auth/basic.d.ts +0 -7
- package/dist/cjs/auth/basic.js +0 -20
- package/dist/cjs/auth/basic.js.map +0 -1
- package/dist/cjs/auth/index.d.ts +0 -74
- package/dist/cjs/auth/index.js +0 -76
- package/dist/cjs/auth/index.js.map +0 -1
- package/dist/cjs/auth/jwt-utils.d.ts +0 -25
- package/dist/cjs/auth/jwt-utils.js +0 -66
- package/dist/cjs/auth/jwt-utils.js.map +0 -1
- package/dist/cjs/auth/middleware.d.ts +0 -196
- package/dist/cjs/auth/middleware.js +0 -190
- package/dist/cjs/auth/middleware.js.map +0 -1
- package/dist/cjs/auth/oauth-implicit.d.ts +0 -89
- package/dist/cjs/auth/oauth-implicit.js +0 -350
- package/dist/cjs/auth/oauth-implicit.js.map +0 -1
- package/dist/cjs/auth/oauth-jwt.d.ts +0 -99
- package/dist/cjs/auth/oauth-jwt.js +0 -343
- package/dist/cjs/auth/oauth-jwt.js.map +0 -1
- package/dist/cjs/auth/oauth.d.ts +0 -88
- package/dist/cjs/auth/oauth.js +0 -252
- package/dist/cjs/auth/oauth.js.map +0 -1
- package/dist/cjs/auth/resolve.d.ts +0 -100
- package/dist/cjs/auth/resolve.js +0 -175
- package/dist/cjs/auth/resolve.js.map +0 -1
- package/dist/cjs/auth/stateful-oauth-strategy.d.ts +0 -39
- package/dist/cjs/auth/stateful-oauth-strategy.js +0 -130
- package/dist/cjs/auth/stateful-oauth-strategy.js.map +0 -1
- package/dist/cjs/auth/stateful-store.d.ts +0 -49
- package/dist/cjs/auth/stateful-store.js +0 -166
- package/dist/cjs/auth/stateful-store.js.map +0 -1
- package/dist/cjs/auth/types.d.ts +0 -124
- package/dist/cjs/auth/types.js +0 -8
- package/dist/cjs/auth/types.js.map +0 -1
- package/dist/cjs/cli/am-command.d.ts +0 -74
- package/dist/cjs/cli/am-command.js +0 -199
- package/dist/cjs/cli/am-command.js.map +0 -1
- package/dist/cjs/cli/base-command.d.ts +0 -232
- package/dist/cjs/cli/base-command.js +0 -695
- package/dist/cjs/cli/base-command.js.map +0 -1
- package/dist/cjs/cli/cartridge-command.d.ts +0 -67
- package/dist/cjs/cli/cartridge-command.js +0 -146
- package/dist/cjs/cli/cartridge-command.js.map +0 -1
- package/dist/cjs/cli/cartridge-providers.d.ts +0 -149
- package/dist/cjs/cli/cartridge-providers.js +0 -103
- package/dist/cjs/cli/cartridge-providers.js.map +0 -1
- package/dist/cjs/cli/columns.d.ts +0 -128
- package/dist/cjs/cli/columns.js +0 -128
- package/dist/cjs/cli/columns.js.map +0 -1
- package/dist/cjs/cli/config.d.ts +0 -159
- package/dist/cjs/cli/config.js +0 -185
- package/dist/cjs/cli/config.js.map +0 -1
- package/dist/cjs/cli/details.d.ts +0 -69
- package/dist/cjs/cli/details.js +0 -72
- package/dist/cjs/cli/details.js.map +0 -1
- package/dist/cjs/cli/hooks.d.ts +0 -324
- package/dist/cjs/cli/hooks.js +0 -3
- package/dist/cjs/cli/hooks.js.map +0 -1
- package/dist/cjs/cli/index.d.ts +0 -108
- package/dist/cjs/cli/index.js +0 -111
- package/dist/cjs/cli/index.js.map +0 -1
- package/dist/cjs/cli/instance-command.d.ts +0 -131
- package/dist/cjs/cli/instance-command.js +0 -214
- package/dist/cjs/cli/instance-command.js.map +0 -1
- package/dist/cjs/cli/job-command.d.ts +0 -32
- package/dist/cjs/cli/job-command.js +0 -60
- package/dist/cjs/cli/job-command.js.map +0 -1
- package/dist/cjs/cli/lifecycle.d.ts +0 -189
- package/dist/cjs/cli/lifecycle.js +0 -130
- package/dist/cjs/cli/lifecycle.js.map +0 -1
- package/dist/cjs/cli/mrt-command.d.ts +0 -57
- package/dist/cjs/cli/mrt-command.js +0 -95
- package/dist/cjs/cli/mrt-command.js.map +0 -1
- package/dist/cjs/cli/oauth-command.d.ts +0 -122
- package/dist/cjs/cli/oauth-command.js +0 -311
- package/dist/cjs/cli/oauth-command.js.map +0 -1
- package/dist/cjs/cli/ods-command.d.ts +0 -97
- package/dist/cjs/cli/ods-command.js +0 -136
- package/dist/cjs/cli/ods-command.js.map +0 -1
- package/dist/cjs/cli/table.d.ts +0 -113
- package/dist/cjs/cli/table.js +0 -175
- package/dist/cjs/cli/table.js.map +0 -1
- package/dist/cjs/cli/webdav-command.d.ts +0 -110
- package/dist/cjs/cli/webdav-command.js +0 -106
- package/dist/cjs/cli/webdav-command.js.map +0 -1
- package/dist/cjs/clients/am-api.d.ts +0 -521
- package/dist/cjs/clients/am-api.js +0 -992
- package/dist/cjs/clients/am-api.js.map +0 -1
- package/dist/cjs/clients/am-apiclients-api.generated.d.ts +0 -803
- package/dist/cjs/clients/am-apiclients-api.generated.js +0 -6
- package/dist/cjs/clients/am-apiclients-api.generated.js.map +0 -1
- package/dist/cjs/clients/am-roles-api.generated.d.ts +0 -298
- package/dist/cjs/clients/am-roles-api.generated.js +0 -6
- package/dist/cjs/clients/am-roles-api.generated.js.map +0 -1
- package/dist/cjs/clients/am-users-api.generated.d.ts +0 -954
- package/dist/cjs/clients/am-users-api.generated.js +0 -6
- package/dist/cjs/clients/am-users-api.generated.js.map +0 -1
- package/dist/cjs/clients/cdn-zones.d.ts +0 -186
- package/dist/cjs/clients/cdn-zones.generated.d.ts +0 -8330
- package/dist/cjs/clients/cdn-zones.generated.js +0 -6
- package/dist/cjs/clients/cdn-zones.generated.js.map +0 -1
- package/dist/cjs/clients/cdn-zones.js +0 -103
- package/dist/cjs/clients/cdn-zones.js.map +0 -1
- package/dist/cjs/clients/cip.d.ts +0 -162
- package/dist/cjs/clients/cip.js +0 -572
- package/dist/cjs/clients/cip.js.map +0 -1
- package/dist/cjs/clients/custom-apis.d.ts +0 -174
- package/dist/cjs/clients/custom-apis.generated.d.ts +0 -202
- package/dist/cjs/clients/custom-apis.generated.js +0 -6
- package/dist/cjs/clients/custom-apis.generated.js.map +0 -1
- package/dist/cjs/clients/custom-apis.js +0 -140
- package/dist/cjs/clients/custom-apis.js.map +0 -1
- package/dist/cjs/clients/error-utils.d.ts +0 -35
- package/dist/cjs/clients/error-utils.js +0 -69
- package/dist/cjs/clients/error-utils.js.map +0 -1
- package/dist/cjs/clients/granular-replications.d.ts +0 -70
- package/dist/cjs/clients/granular-replications.generated.d.ts +0 -416
- package/dist/cjs/clients/granular-replications.generated.js +0 -6
- package/dist/cjs/clients/granular-replications.generated.js.map +0 -1
- package/dist/cjs/clients/granular-replications.js +0 -73
- package/dist/cjs/clients/granular-replications.js.map +0 -1
- package/dist/cjs/clients/index.d.ts +0 -145
- package/dist/cjs/clients/index.js +0 -137
- package/dist/cjs/clients/index.js.map +0 -1
- package/dist/cjs/clients/middleware-registry.d.ts +0 -184
- package/dist/cjs/clients/middleware-registry.js +0 -104
- package/dist/cjs/clients/middleware-registry.js.map +0 -1
- package/dist/cjs/clients/middleware.d.ts +0 -183
- package/dist/cjs/clients/middleware.js +0 -465
- package/dist/cjs/clients/middleware.js.map +0 -1
- package/dist/cjs/clients/mrt-b2c.d.ts +0 -138
- package/dist/cjs/clients/mrt-b2c.generated.d.ts +0 -176
- package/dist/cjs/clients/mrt-b2c.generated.js +0 -6
- package/dist/cjs/clients/mrt-b2c.generated.js.map +0 -1
- package/dist/cjs/clients/mrt-b2c.js +0 -86
- package/dist/cjs/clients/mrt-b2c.js.map +0 -1
- package/dist/cjs/clients/mrt.d.ts +0 -143
- package/dist/cjs/clients/mrt.generated.d.ts +0 -3806
- package/dist/cjs/clients/mrt.generated.js +0 -6
- package/dist/cjs/clients/mrt.generated.js.map +0 -1
- package/dist/cjs/clients/mrt.js +0 -93
- package/dist/cjs/clients/mrt.js.map +0 -1
- package/dist/cjs/clients/ocapi.d.ts +0 -128
- package/dist/cjs/clients/ocapi.generated.d.ts +0 -26052
- package/dist/cjs/clients/ocapi.generated.js +0 -6
- package/dist/cjs/clients/ocapi.generated.js.map +0 -1
- package/dist/cjs/clients/ocapi.js +0 -78
- package/dist/cjs/clients/ocapi.js.map +0 -1
- package/dist/cjs/clients/ods.d.ts +0 -160
- package/dist/cjs/clients/ods.generated.d.ts +0 -2860
- package/dist/cjs/clients/ods.generated.js +0 -6
- package/dist/cjs/clients/ods.generated.js.map +0 -1
- package/dist/cjs/clients/ods.js +0 -103
- package/dist/cjs/clients/ods.js.map +0 -1
- package/dist/cjs/clients/scapi-schemas.d.ts +0 -161
- package/dist/cjs/clients/scapi-schemas.generated.d.ts +0 -328
- package/dist/cjs/clients/scapi-schemas.generated.js +0 -6
- package/dist/cjs/clients/scapi-schemas.generated.js.map +0 -1
- package/dist/cjs/clients/scapi-schemas.js +0 -98
- package/dist/cjs/clients/scapi-schemas.js.map +0 -1
- package/dist/cjs/clients/slas-admin.d.ts +0 -132
- package/dist/cjs/clients/slas-admin.generated.d.ts +0 -1434
- package/dist/cjs/clients/slas-admin.generated.js +0 -6
- package/dist/cjs/clients/slas-admin.generated.js.map +0 -1
- package/dist/cjs/clients/slas-admin.js +0 -79
- package/dist/cjs/clients/slas-admin.js.map +0 -1
- package/dist/cjs/clients/tls-dispatcher.d.ts +0 -42
- package/dist/cjs/clients/tls-dispatcher.js +0 -107
- package/dist/cjs/clients/tls-dispatcher.js.map +0 -1
- package/dist/cjs/clients/user-agent.d.ts +0 -43
- package/dist/cjs/clients/user-agent.js +0 -87
- package/dist/cjs/clients/user-agent.js.map +0 -1
- package/dist/cjs/clients/webdav.d.ts +0 -186
- package/dist/cjs/clients/webdav.js +0 -395
- package/dist/cjs/clients/webdav.js.map +0 -1
- package/dist/cjs/config/config-source-registry.d.ts +0 -115
- package/dist/cjs/config/config-source-registry.js +0 -103
- package/dist/cjs/config/config-source-registry.js.map +0 -1
- package/dist/cjs/config/dw-json.d.ts +0 -267
- package/dist/cjs/config/dw-json.js +0 -333
- package/dist/cjs/config/dw-json.js.map +0 -1
- package/dist/cjs/config/index.d.ts +0 -100
- package/dist/cjs/config/index.js +0 -110
- package/dist/cjs/config/index.js.map +0 -1
- package/dist/cjs/config/instance-manager.d.ts +0 -97
- package/dist/cjs/config/instance-manager.js +0 -166
- package/dist/cjs/config/instance-manager.js.map +0 -1
- package/dist/cjs/config/mapping.d.ts +0 -193
- package/dist/cjs/config/mapping.js +0 -530
- package/dist/cjs/config/mapping.js.map +0 -1
- package/dist/cjs/config/resolved-config.d.ts +0 -29
- package/dist/cjs/config/resolved-config.js +0 -81
- package/dist/cjs/config/resolved-config.js.map +0 -1
- package/dist/cjs/config/resolver.d.ts +0 -191
- package/dist/cjs/config/resolver.js +0 -406
- package/dist/cjs/config/resolver.js.map +0 -1
- package/dist/cjs/config/sources/dw-json-source.d.ts +0 -27
- package/dist/cjs/config/sources/dw-json-source.js +0 -106
- package/dist/cjs/config/sources/dw-json-source.js.map +0 -1
- package/dist/cjs/config/sources/env-source.d.ts +0 -32
- package/dist/cjs/config/sources/env-source.js +0 -116
- package/dist/cjs/config/sources/env-source.js.map +0 -1
- package/dist/cjs/config/sources/index.d.ts +0 -9
- package/dist/cjs/config/sources/index.js +0 -15
- package/dist/cjs/config/sources/index.js.map +0 -1
- package/dist/cjs/config/sources/mobify-source.d.ts +0 -25
- package/dist/cjs/config/sources/mobify-source.js +0 -84
- package/dist/cjs/config/sources/mobify-source.js.map +0 -1
- package/dist/cjs/config/sources/package-json-source.d.ts +0 -14
- package/dist/cjs/config/sources/package-json-source.js +0 -96
- package/dist/cjs/config/sources/package-json-source.js.map +0 -1
- package/dist/cjs/config/types.d.ts +0 -407
- package/dist/cjs/config/types.js +0 -2
- package/dist/cjs/config/types.js.map +0 -1
- package/dist/cjs/defaults.d.ts +0 -36
- package/dist/cjs/defaults.js +0 -54
- package/dist/cjs/defaults.js.map +0 -1
- package/dist/cjs/discovery/detector.d.ts +0 -75
- package/dist/cjs/discovery/detector.js +0 -108
- package/dist/cjs/discovery/detector.js.map +0 -1
- package/dist/cjs/discovery/index.d.ts +0 -63
- package/dist/cjs/discovery/index.js +0 -70
- package/dist/cjs/discovery/index.js.map +0 -1
- package/dist/cjs/discovery/patterns/cartridges.d.ts +0 -16
- package/dist/cjs/discovery/patterns/cartridges.js +0 -16
- package/dist/cjs/discovery/patterns/cartridges.js.map +0 -1
- package/dist/cjs/discovery/patterns/index.d.ts +0 -21
- package/dist/cjs/discovery/patterns/index.js +0 -16
- package/dist/cjs/discovery/patterns/index.js.map +0 -1
- package/dist/cjs/discovery/patterns/pwa-kit.d.ts +0 -15
- package/dist/cjs/discovery/patterns/pwa-kit.js +0 -26
- package/dist/cjs/discovery/patterns/pwa-kit.js.map +0 -1
- package/dist/cjs/discovery/patterns/sfra.d.ts +0 -34
- package/dist/cjs/discovery/patterns/sfra.js +0 -50
- package/dist/cjs/discovery/patterns/sfra.js.map +0 -1
- package/dist/cjs/discovery/patterns/storefront-next.d.ts +0 -10
- package/dist/cjs/discovery/patterns/storefront-next.js +0 -65
- package/dist/cjs/discovery/patterns/storefront-next.js.map +0 -1
- package/dist/cjs/discovery/types.d.ts +0 -47
- package/dist/cjs/discovery/types.js +0 -12
- package/dist/cjs/discovery/types.js.map +0 -1
- package/dist/cjs/discovery/utils.d.ts +0 -44
- package/dist/cjs/discovery/utils.js +0 -82
- package/dist/cjs/discovery/utils.js.map +0 -1
- package/dist/cjs/docs/download.d.ts +0 -45
- package/dist/cjs/docs/download.js +0 -96
- package/dist/cjs/docs/download.js.map +0 -1
- package/dist/cjs/docs/index.d.ts +0 -44
- package/dist/cjs/docs/index.js +0 -12
- package/dist/cjs/docs/index.js.map +0 -1
- package/dist/cjs/docs/schema.d.ts +0 -26
- package/dist/cjs/docs/schema.js +0 -92
- package/dist/cjs/docs/schema.js.map +0 -1
- package/dist/cjs/docs/search.d.ts +0 -67
- package/dist/cjs/docs/search.js +0 -128
- package/dist/cjs/docs/search.js.map +0 -1
- package/dist/cjs/docs/types.d.ts +0 -64
- package/dist/cjs/docs/types.js +0 -15
- package/dist/cjs/docs/types.js.map +0 -1
- package/dist/cjs/errors/http-error.d.ts +0 -34
- package/dist/cjs/errors/http-error.js +0 -45
- package/dist/cjs/errors/http-error.js.map +0 -1
- package/dist/cjs/errors/index.d.ts +0 -12
- package/dist/cjs/errors/index.js +0 -18
- package/dist/cjs/errors/index.js.map +0 -1
- package/dist/cjs/i18n/index.d.ts +0 -144
- package/dist/cjs/i18n/index.js +0 -245
- package/dist/cjs/i18n/index.js.map +0 -1
- package/dist/cjs/i18n/locales/de.d.ts +0 -13
- package/dist/cjs/i18n/locales/de.js +0 -19
- package/dist/cjs/i18n/locales/de.js.map +0 -1
- package/dist/cjs/i18n/locales/index.d.ts +0 -28
- package/dist/cjs/i18n/locales/index.js +0 -25
- package/dist/cjs/i18n/locales/index.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -33
- package/dist/cjs/index.js +0 -41
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/instance/index.d.ts +0 -136
- package/dist/cjs/instance/index.js +0 -131
- package/dist/cjs/instance/index.js.map +0 -1
- package/dist/cjs/logging/index.d.ts +0 -116
- package/dist/cjs/logging/index.js +0 -121
- package/dist/cjs/logging/index.js.map +0 -1
- package/dist/cjs/logging/logger.d.ts +0 -9
- package/dist/cjs/logging/logger.js +0 -138
- package/dist/cjs/logging/logger.js.map +0 -1
- package/dist/cjs/logging/types.d.ts +0 -45
- package/dist/cjs/logging/types.js +0 -10
- package/dist/cjs/logging/types.js.map +0 -1
- package/dist/cjs/operations/bm-roles/index.d.ts +0 -52
- package/dist/cjs/operations/bm-roles/index.js +0 -57
- package/dist/cjs/operations/bm-roles/index.js.map +0 -1
- package/dist/cjs/operations/bm-roles/roles.d.ts +0 -155
- package/dist/cjs/operations/bm-roles/roles.js +0 -194
- package/dist/cjs/operations/bm-roles/roles.js.map +0 -1
- package/dist/cjs/operations/bm-users/index.d.ts +0 -50
- package/dist/cjs/operations/bm-users/index.js +0 -55
- package/dist/cjs/operations/bm-users/index.js.map +0 -1
- package/dist/cjs/operations/bm-users/users.d.ts +0 -189
- package/dist/cjs/operations/bm-users/users.js +0 -229
- package/dist/cjs/operations/bm-users/users.js.map +0 -1
- package/dist/cjs/operations/cap/index.d.ts +0 -56
- package/dist/cjs/operations/cap/index.js +0 -57
- package/dist/cjs/operations/cap/index.js.map +0 -1
- package/dist/cjs/operations/cap/install.d.ts +0 -53
- package/dist/cjs/operations/cap/install.js +0 -181
- package/dist/cjs/operations/cap/install.js.map +0 -1
- package/dist/cjs/operations/cap/list.d.ts +0 -92
- package/dist/cjs/operations/cap/list.js +0 -230
- package/dist/cjs/operations/cap/list.js.map +0 -1
- package/dist/cjs/operations/cap/package.d.ts +0 -39
- package/dist/cjs/operations/cap/package.js +0 -77
- package/dist/cjs/operations/cap/package.js.map +0 -1
- package/dist/cjs/operations/cap/pull.d.ts +0 -21
- package/dist/cjs/operations/cap/pull.js +0 -77
- package/dist/cjs/operations/cap/pull.js.map +0 -1
- package/dist/cjs/operations/cap/uninstall.d.ts +0 -46
- package/dist/cjs/operations/cap/uninstall.js +0 -87
- package/dist/cjs/operations/cap/uninstall.js.map +0 -1
- package/dist/cjs/operations/cap/validate.d.ts +0 -47
- package/dist/cjs/operations/cap/validate.js +0 -235
- package/dist/cjs/operations/cap/validate.js.map +0 -1
- package/dist/cjs/operations/cip/index.d.ts +0 -35
- package/dist/cjs/operations/cip/index.js +0 -128
- package/dist/cjs/operations/cip/index.js.map +0 -1
- package/dist/cjs/operations/cip/reports.d.ts +0 -2
- package/dist/cjs/operations/cip/reports.js +0 -210
- package/dist/cjs/operations/cip/reports.js.map +0 -1
- package/dist/cjs/operations/cip/types.d.ts +0 -97
- package/dist/cjs/operations/cip/types.js +0 -7
- package/dist/cjs/operations/cip/types.js.map +0 -1
- package/dist/cjs/operations/code/cartridges.d.ts +0 -46
- package/dist/cjs/operations/code/cartridges.js +0 -69
- package/dist/cjs/operations/code/cartridges.js.map +0 -1
- package/dist/cjs/operations/code/deploy.d.ts +0 -121
- package/dist/cjs/operations/code/deploy.js +0 -255
- package/dist/cjs/operations/code/deploy.js.map +0 -1
- package/dist/cjs/operations/code/download.d.ts +0 -77
- package/dist/cjs/operations/code/download.js +0 -300
- package/dist/cjs/operations/code/download.js.map +0 -1
- package/dist/cjs/operations/code/index.d.ts +0 -74
- package/dist/cjs/operations/code/index.js +0 -80
- package/dist/cjs/operations/code/index.js.map +0 -1
- package/dist/cjs/operations/code/upload-files.d.ts +0 -47
- package/dist/cjs/operations/code/upload-files.js +0 -116
- package/dist/cjs/operations/code/upload-files.js.map +0 -1
- package/dist/cjs/operations/code/versions.d.ts +0 -99
- package/dist/cjs/operations/code/versions.js +0 -156
- package/dist/cjs/operations/code/versions.js.map +0 -1
- package/dist/cjs/operations/code/watch.d.ts +0 -58
- package/dist/cjs/operations/code/watch.js +0 -175
- package/dist/cjs/operations/code/watch.js.map +0 -1
- package/dist/cjs/operations/content/asset-query.d.ts +0 -22
- package/dist/cjs/operations/content/asset-query.js +0 -77
- package/dist/cjs/operations/content/asset-query.js.map +0 -1
- package/dist/cjs/operations/content/export.d.ts +0 -57
- package/dist/cjs/operations/content/export.js +0 -221
- package/dist/cjs/operations/content/export.js.map +0 -1
- package/dist/cjs/operations/content/index.d.ts +0 -56
- package/dist/cjs/operations/content/index.js +0 -60
- package/dist/cjs/operations/content/index.js.map +0 -1
- package/dist/cjs/operations/content/library.d.ts +0 -137
- package/dist/cjs/operations/content/library.js +0 -396
- package/dist/cjs/operations/content/library.js.map +0 -1
- package/dist/cjs/operations/content/types.d.ts +0 -144
- package/dist/cjs/operations/content/types.js +0 -7
- package/dist/cjs/operations/content/types.js.map +0 -1
- package/dist/cjs/operations/content/validate.d.ts +0 -64
- package/dist/cjs/operations/content/validate.js +0 -170
- package/dist/cjs/operations/content/validate.js.map +0 -1
- package/dist/cjs/operations/debug/dap-adapter.d.ts +0 -72
- package/dist/cjs/operations/debug/dap-adapter.js +0 -505
- package/dist/cjs/operations/debug/dap-adapter.js.map +0 -1
- package/dist/cjs/operations/debug/debug-session.d.ts +0 -51
- package/dist/cjs/operations/debug/debug-session.js +0 -234
- package/dist/cjs/operations/debug/debug-session.js.map +0 -1
- package/dist/cjs/operations/debug/index.d.ts +0 -20
- package/dist/cjs/operations/debug/index.js +0 -21
- package/dist/cjs/operations/debug/index.js.map +0 -1
- package/dist/cjs/operations/debug/projections.d.ts +0 -72
- package/dist/cjs/operations/debug/projections.js +0 -84
- package/dist/cjs/operations/debug/projections.js.map +0 -1
- package/dist/cjs/operations/debug/resolve-path.d.ts +0 -15
- package/dist/cjs/operations/debug/resolve-path.js +0 -52
- package/dist/cjs/operations/debug/resolve-path.js.map +0 -1
- package/dist/cjs/operations/debug/sdapi-client.d.ts +0 -44
- package/dist/cjs/operations/debug/sdapi-client.js +0 -169
- package/dist/cjs/operations/debug/sdapi-client.js.map +0 -1
- package/dist/cjs/operations/debug/source-mapping.d.ts +0 -13
- package/dist/cjs/operations/debug/source-mapping.js +0 -57
- package/dist/cjs/operations/debug/source-mapping.js.map +0 -1
- package/dist/cjs/operations/debug/types.d.ts +0 -95
- package/dist/cjs/operations/debug/types.js +0 -2
- package/dist/cjs/operations/debug/types.js.map +0 -1
- package/dist/cjs/operations/debug/variable-store.d.ts +0 -35
- package/dist/cjs/operations/debug/variable-store.js +0 -52
- package/dist/cjs/operations/debug/variable-store.js.map +0 -1
- package/dist/cjs/operations/jobs/index.d.ts +0 -66
- package/dist/cjs/operations/jobs/index.js +0 -72
- package/dist/cjs/operations/jobs/index.js.map +0 -1
- package/dist/cjs/operations/jobs/run.d.ts +0 -239
- package/dist/cjs/operations/jobs/run.js +0 -324
- package/dist/cjs/operations/jobs/run.js.map +0 -1
- package/dist/cjs/operations/jobs/site-archive.d.ts +0 -267
- package/dist/cjs/operations/jobs/site-archive.js +0 -423
- package/dist/cjs/operations/jobs/site-archive.js.map +0 -1
- package/dist/cjs/operations/logs/index.d.ts +0 -65
- package/dist/cjs/operations/logs/index.js +0 -73
- package/dist/cjs/operations/logs/index.js.map +0 -1
- package/dist/cjs/operations/logs/list.d.ts +0 -35
- package/dist/cjs/operations/logs/list.js +0 -144
- package/dist/cjs/operations/logs/list.js.map +0 -1
- package/dist/cjs/operations/logs/path-normalizer.d.ts +0 -82
- package/dist/cjs/operations/logs/path-normalizer.js +0 -190
- package/dist/cjs/operations/logs/path-normalizer.js.map +0 -1
- package/dist/cjs/operations/logs/tail.d.ts +0 -92
- package/dist/cjs/operations/logs/tail.js +0 -525
- package/dist/cjs/operations/logs/tail.js.map +0 -1
- package/dist/cjs/operations/logs/types.d.ts +0 -132
- package/dist/cjs/operations/logs/types.js +0 -7
- package/dist/cjs/operations/logs/types.js.map +0 -1
- package/dist/cjs/operations/mrt/access-control.d.ts +0 -192
- package/dist/cjs/operations/mrt/access-control.js +0 -152
- package/dist/cjs/operations/mrt/access-control.js.map +0 -1
- package/dist/cjs/operations/mrt/b2c-config.d.ts +0 -201
- package/dist/cjs/operations/mrt/b2c-config.js +0 -210
- package/dist/cjs/operations/mrt/b2c-config.js.map +0 -1
- package/dist/cjs/operations/mrt/bundle.d.ts +0 -114
- package/dist/cjs/operations/mrt/bundle.js +0 -166
- package/dist/cjs/operations/mrt/bundle.js.map +0 -1
- package/dist/cjs/operations/mrt/cache.d.ts +0 -80
- package/dist/cjs/operations/mrt/cache.js +0 -65
- package/dist/cjs/operations/mrt/cache.js.map +0 -1
- package/dist/cjs/operations/mrt/certificate.d.ts +0 -60
- package/dist/cjs/operations/mrt/certificate.js +0 -76
- package/dist/cjs/operations/mrt/certificate.js.map +0 -1
- package/dist/cjs/operations/mrt/deployment.d.ts +0 -157
- package/dist/cjs/operations/mrt/deployment.js +0 -109
- package/dist/cjs/operations/mrt/deployment.js.map +0 -1
- package/dist/cjs/operations/mrt/env-var.d.ts +0 -176
- package/dist/cjs/operations/mrt/env-var.js +0 -231
- package/dist/cjs/operations/mrt/env-var.js.map +0 -1
- package/dist/cjs/operations/mrt/env.d.ts +0 -491
- package/dist/cjs/operations/mrt/env.js +0 -425
- package/dist/cjs/operations/mrt/env.js.map +0 -1
- package/dist/cjs/operations/mrt/index.d.ts +0 -75
- package/dist/cjs/operations/mrt/index.js +0 -81
- package/dist/cjs/operations/mrt/index.js.map +0 -1
- package/dist/cjs/operations/mrt/member.d.ts +0 -281
- package/dist/cjs/operations/mrt/member.js +0 -244
- package/dist/cjs/operations/mrt/member.js.map +0 -1
- package/dist/cjs/operations/mrt/notification.d.ts +0 -252
- package/dist/cjs/operations/mrt/notification.js +0 -206
- package/dist/cjs/operations/mrt/notification.js.map +0 -1
- package/dist/cjs/operations/mrt/organization-member.d.ts +0 -68
- package/dist/cjs/operations/mrt/organization-member.js +0 -88
- package/dist/cjs/operations/mrt/organization-member.js.map +0 -1
- package/dist/cjs/operations/mrt/organization.d.ts +0 -80
- package/dist/cjs/operations/mrt/organization.js +0 -53
- package/dist/cjs/operations/mrt/organization.js.map +0 -1
- package/dist/cjs/operations/mrt/project.d.ts +0 -261
- package/dist/cjs/operations/mrt/project.js +0 -232
- package/dist/cjs/operations/mrt/project.js.map +0 -1
- package/dist/cjs/operations/mrt/push.d.ts +0 -290
- package/dist/cjs/operations/mrt/push.js +0 -288
- package/dist/cjs/operations/mrt/push.js.map +0 -1
- package/dist/cjs/operations/mrt/redirect.d.ts +0 -337
- package/dist/cjs/operations/mrt/redirect.js +0 -256
- package/dist/cjs/operations/mrt/redirect.js.map +0 -1
- package/dist/cjs/operations/mrt/tail-logs.d.ts +0 -130
- package/dist/cjs/operations/mrt/tail-logs.js +0 -224
- package/dist/cjs/operations/mrt/tail-logs.js.map +0 -1
- package/dist/cjs/operations/mrt/user.d.ts +0 -135
- package/dist/cjs/operations/mrt/user.js +0 -153
- package/dist/cjs/operations/mrt/user.js.map +0 -1
- package/dist/cjs/operations/ods/index.d.ts +0 -10
- package/dist/cjs/operations/ods/index.js +0 -14
- package/dist/cjs/operations/ods/index.js.map +0 -1
- package/dist/cjs/operations/ods/sandbox-lookup.d.ts +0 -63
- package/dist/cjs/operations/ods/sandbox-lookup.js +0 -130
- package/dist/cjs/operations/ods/sandbox-lookup.js.map +0 -1
- package/dist/cjs/operations/ods/wait-for-clone.d.ts +0 -46
- package/dist/cjs/operations/ods/wait-for-clone.js +0 -100
- package/dist/cjs/operations/ods/wait-for-clone.js.map +0 -1
- package/dist/cjs/operations/ods/wait-for-sandbox.d.ts +0 -64
- package/dist/cjs/operations/ods/wait-for-sandbox.js +0 -114
- package/dist/cjs/operations/ods/wait-for-sandbox.js.map +0 -1
- package/dist/cjs/operations/orgs/index.d.ts +0 -74
- package/dist/cjs/operations/orgs/index.js +0 -33
- package/dist/cjs/operations/orgs/index.js.map +0 -1
- package/dist/cjs/operations/roles/index.d.ts +0 -43
- package/dist/cjs/operations/roles/index.js +0 -48
- package/dist/cjs/operations/roles/index.js.map +0 -1
- package/dist/cjs/operations/sites/cartridges.d.ts +0 -114
- package/dist/cjs/operations/sites/cartridges.js +0 -378
- package/dist/cjs/operations/sites/cartridges.js.map +0 -1
- package/dist/cjs/operations/sites/index.d.ts +0 -46
- package/dist/cjs/operations/sites/index.js +0 -51
- package/dist/cjs/operations/sites/index.js.map +0 -1
- package/dist/cjs/operations/users/index.d.ts +0 -153
- package/dist/cjs/operations/users/index.js +0 -139
- package/dist/cjs/operations/users/index.js.map +0 -1
- package/dist/cjs/operations/util/zip.d.ts +0 -5
- package/dist/cjs/operations/util/zip.js +0 -25
- package/dist/cjs/operations/util/zip.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/plugins/discovery.d.ts +0 -46
- package/dist/cjs/plugins/discovery.js +0 -122
- package/dist/cjs/plugins/discovery.js.map +0 -1
- package/dist/cjs/plugins/index.d.ts +0 -26
- package/dist/cjs/plugins/index.js +0 -32
- package/dist/cjs/plugins/index.js.map +0 -1
- package/dist/cjs/plugins/loader.d.ts +0 -34
- package/dist/cjs/plugins/loader.js +0 -59
- package/dist/cjs/plugins/loader.js.map +0 -1
- package/dist/cjs/plugins/manager.d.ts +0 -70
- package/dist/cjs/plugins/manager.js +0 -173
- package/dist/cjs/plugins/manager.js.map +0 -1
- package/dist/cjs/safety/index.d.ts +0 -12
- package/dist/cjs/safety/index.js +0 -11
- package/dist/cjs/safety/index.js.map +0 -1
- package/dist/cjs/safety/safety-guard.d.ts +0 -92
- package/dist/cjs/safety/safety-guard.js +0 -270
- package/dist/cjs/safety/safety-guard.js.map +0 -1
- package/dist/cjs/safety/safety-middleware.d.ts +0 -130
- package/dist/cjs/safety/safety-middleware.js +0 -248
- package/dist/cjs/safety/safety-middleware.js.map +0 -1
- package/dist/cjs/safety/types.d.ts +0 -81
- package/dist/cjs/safety/types.js +0 -16
- package/dist/cjs/safety/types.js.map +0 -1
- package/dist/cjs/safety/with-confirmation.d.ts +0 -58
- package/dist/cjs/safety/with-confirmation.js +0 -67
- package/dist/cjs/safety/with-confirmation.js.map +0 -1
- package/dist/cjs/scaffold/engine.d.ts +0 -68
- package/dist/cjs/scaffold/engine.js +0 -149
- package/dist/cjs/scaffold/engine.js.map +0 -1
- package/dist/cjs/scaffold/executor.d.ts +0 -36
- package/dist/cjs/scaffold/executor.js +0 -293
- package/dist/cjs/scaffold/executor.js.map +0 -1
- package/dist/cjs/scaffold/index.d.ts +0 -76
- package/dist/cjs/scaffold/index.js +0 -23
- package/dist/cjs/scaffold/index.js.map +0 -1
- package/dist/cjs/scaffold/merge.d.ts +0 -63
- package/dist/cjs/scaffold/merge.js +0 -192
- package/dist/cjs/scaffold/merge.js.map +0 -1
- package/dist/cjs/scaffold/parameter-resolver.d.ts +0 -86
- package/dist/cjs/scaffold/parameter-resolver.js +0 -191
- package/dist/cjs/scaffold/parameter-resolver.js.map +0 -1
- package/dist/cjs/scaffold/registry.d.ts +0 -60
- package/dist/cjs/scaffold/registry.js +0 -225
- package/dist/cjs/scaffold/registry.js.map +0 -1
- package/dist/cjs/scaffold/sources.d.ts +0 -83
- package/dist/cjs/scaffold/sources.js +0 -236
- package/dist/cjs/scaffold/sources.js.map +0 -1
- package/dist/cjs/scaffold/types.d.ts +0 -282
- package/dist/cjs/scaffold/types.js +0 -14
- package/dist/cjs/scaffold/types.js.map +0 -1
- package/dist/cjs/scaffold/validation.d.ts +0 -81
- package/dist/cjs/scaffold/validation.js +0 -250
- package/dist/cjs/scaffold/validation.js.map +0 -1
- package/dist/cjs/scaffold/validators.d.ts +0 -33
- package/dist/cjs/scaffold/validators.js +0 -340
- package/dist/cjs/scaffold/validators.js.map +0 -1
- package/dist/cjs/schemas/collapse.d.ts +0 -150
- package/dist/cjs/schemas/collapse.js +0 -180
- package/dist/cjs/schemas/collapse.js.map +0 -1
- package/dist/cjs/schemas/index.d.ts +0 -58
- package/dist/cjs/schemas/index.js +0 -65
- package/dist/cjs/schemas/index.js.map +0 -1
- package/dist/cjs/schemas/security-schemes.d.ts +0 -26
- package/dist/cjs/schemas/security-schemes.js +0 -44
- package/dist/cjs/schemas/security-schemes.js.map +0 -1
- package/dist/cjs/skills/agents.d.ts +0 -42
- package/dist/cjs/skills/agents.js +0 -200
- package/dist/cjs/skills/agents.js.map +0 -1
- package/dist/cjs/skills/github.d.ts +0 -31
- package/dist/cjs/skills/github.js +0 -450
- package/dist/cjs/skills/github.js.map +0 -1
- package/dist/cjs/skills/index.d.ts +0 -43
- package/dist/cjs/skills/index.js +0 -16
- package/dist/cjs/skills/index.js.map +0 -1
- package/dist/cjs/skills/installer.d.ts +0 -35
- package/dist/cjs/skills/installer.js +0 -182
- package/dist/cjs/skills/installer.js.map +0 -1
- package/dist/cjs/skills/parser.d.ts +0 -39
- package/dist/cjs/skills/parser.js +0 -126
- package/dist/cjs/skills/parser.js.map +0 -1
- package/dist/cjs/skills/sources.d.ts +0 -4
- package/dist/cjs/skills/sources.js +0 -52
- package/dist/cjs/skills/sources.js.map +0 -1
- package/dist/cjs/skills/types.d.ts +0 -153
- package/dist/cjs/skills/types.js +0 -7
- package/dist/cjs/skills/types.js.map +0 -1
- package/dist/cjs/slas/index.d.ts +0 -12
- package/dist/cjs/slas/index.js +0 -8
- package/dist/cjs/slas/index.js.map +0 -1
- package/dist/cjs/slas/pkce.d.ts +0 -13
- package/dist/cjs/slas/pkce.js +0 -35
- package/dist/cjs/slas/pkce.js.map +0 -1
- package/dist/cjs/slas/token.d.ts +0 -24
- package/dist/cjs/slas/token.js +0 -261
- package/dist/cjs/slas/token.js.map +0 -1
- package/dist/cjs/slas/types.d.ts +0 -43
- package/dist/cjs/slas/types.js +0 -7
- package/dist/cjs/slas/types.js.map +0 -1
- package/dist/cjs/telemetry/index.d.ts +0 -34
- package/dist/cjs/telemetry/index.js +0 -32
- package/dist/cjs/telemetry/index.js.map +0 -1
- package/dist/cjs/telemetry/telemetry.d.ts +0 -88
- package/dist/cjs/telemetry/telemetry.js +0 -298
- package/dist/cjs/telemetry/telemetry.js.map +0 -1
- package/dist/cjs/telemetry/types.d.ts +0 -62
- package/dist/cjs/telemetry/types.js +0 -7
- package/dist/cjs/telemetry/types.js.map +0 -1
- package/dist/cjs/test-utils/config-isolation.d.ts +0 -2
- package/dist/cjs/test-utils/config-isolation.js +0 -48
- package/dist/cjs/test-utils/config-isolation.js.map +0 -1
- package/dist/cjs/test-utils/index.d.ts +0 -1
- package/dist/cjs/test-utils/index.js +0 -7
- package/dist/cjs/test-utils/index.js.map +0 -1
- package/dist/cjs/ux/confirm.d.ts +0 -14
- package/dist/cjs/ux/confirm.js +0 -36
- package/dist/cjs/ux/confirm.js.map +0 -1
- package/dist/cjs/ux/index.d.ts +0 -1
- package/dist/cjs/ux/index.js +0 -7
- package/dist/cjs/ux/index.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -14
- package/dist/cjs/version.js +0 -29
- package/dist/cjs/version.js.map +0 -1
|
@@ -1,695 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2
|
|
4
|
-
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { Command, Flags } from '@oclif/core';
|
|
7
|
-
import { loadConfig } from './config.js';
|
|
8
|
-
import { parseFriendlySandboxId } from '../operations/ods/sandbox-lookup.js';
|
|
9
|
-
import { setLanguage, t } from '../i18n/index.js';
|
|
10
|
-
import { configureLogger, getLogger } from '../logging/index.js';
|
|
11
|
-
import { createExtraParamsMiddleware, createSafetyMiddleware } from '../clients/middleware.js';
|
|
12
|
-
import { getSafetyLevel, describeSafetyLevel, resolveEffectiveSafetyConfig, loadGlobalSafetyConfig, } from '../safety/index.js';
|
|
13
|
-
import { SafetyGuard } from '../safety/safety-guard.js';
|
|
14
|
-
import { confirm as safetyConfirm } from '../ux/confirm.js';
|
|
15
|
-
import { globalConfigSourceRegistry } from '../config/config-source-registry.js';
|
|
16
|
-
import { globalMiddlewareRegistry } from '../clients/middleware-registry.js';
|
|
17
|
-
import { globalAuthMiddlewareRegistry } from '../auth/middleware.js';
|
|
18
|
-
import { initializeStatefulStore } from '../auth/stateful-store.js';
|
|
19
|
-
import { setUserAgent } from '../clients/user-agent.js';
|
|
20
|
-
import { createTelemetry, Telemetry } from '../telemetry/index.js';
|
|
21
|
-
const LOG_LEVELS = ['trace', 'debug', 'info', 'warn', 'error', 'silent'];
|
|
22
|
-
/**
|
|
23
|
-
* Base command class for B2C CLI tools.
|
|
24
|
-
*
|
|
25
|
-
* Environment variables for logging:
|
|
26
|
-
* - SFCC_JSON_LOGS: Output log messages as JSON lines (for log aggregation)
|
|
27
|
-
* - SFCC_LOG_TO_STDOUT: Send logs to stdout instead of stderr
|
|
28
|
-
* - SFCC_LOG_COLORIZE: Force colors on/off (default: auto-detect TTY)
|
|
29
|
-
* - SFCC_REDACT_SECRETS: Set to 'false' to disable secret redaction
|
|
30
|
-
* - NO_COLOR: Industry standard to disable colors
|
|
31
|
-
*
|
|
32
|
-
* Environment variables for telemetry:
|
|
33
|
-
* - SF_DISABLE_TELEMETRY: Set to 'true' to disable telemetry (sf CLI standard)
|
|
34
|
-
* - SFCC_DISABLE_TELEMETRY: Set to 'true' to disable telemetry
|
|
35
|
-
* - SFCC_APP_INSIGHTS_KEY: Override connection string from package.json
|
|
36
|
-
*/
|
|
37
|
-
export class BaseCommand extends Command {
|
|
38
|
-
static baseFlags = {
|
|
39
|
-
'log-level': Flags.option({
|
|
40
|
-
description: 'Set logging verbosity level',
|
|
41
|
-
env: 'SFCC_LOG_LEVEL',
|
|
42
|
-
options: LOG_LEVELS,
|
|
43
|
-
helpGroup: 'GLOBAL',
|
|
44
|
-
})(),
|
|
45
|
-
debug: Flags.boolean({
|
|
46
|
-
char: 'D',
|
|
47
|
-
description: 'Enable debug logging (shorthand for --log-level debug)',
|
|
48
|
-
env: 'SFCC_DEBUG',
|
|
49
|
-
default: false,
|
|
50
|
-
helpGroup: 'GLOBAL',
|
|
51
|
-
}),
|
|
52
|
-
json: Flags.boolean({
|
|
53
|
-
description: 'Output result as JSON',
|
|
54
|
-
default: false,
|
|
55
|
-
helpGroup: 'GLOBAL',
|
|
56
|
-
}),
|
|
57
|
-
jsonl: Flags.boolean({
|
|
58
|
-
aliases: ['json-logs'],
|
|
59
|
-
description: 'Output log messages as JSON lines',
|
|
60
|
-
env: 'SFCC_JSON_LOGS',
|
|
61
|
-
default: false,
|
|
62
|
-
helpGroup: 'GLOBAL',
|
|
63
|
-
}),
|
|
64
|
-
lang: Flags.string({
|
|
65
|
-
char: 'L',
|
|
66
|
-
description: 'Language for messages (e.g., en, de). Also respects LANGUAGE env var.',
|
|
67
|
-
helpGroup: 'GLOBAL',
|
|
68
|
-
}),
|
|
69
|
-
config: Flags.string({
|
|
70
|
-
description: 'Path to config file (in dw.json format; defaults to ./dw.json)',
|
|
71
|
-
env: 'SFCC_CONFIG',
|
|
72
|
-
helpGroup: 'GLOBAL',
|
|
73
|
-
}),
|
|
74
|
-
instance: Flags.string({
|
|
75
|
-
char: 'i',
|
|
76
|
-
description: 'Instance name from configuration file (i.e. dw.json, etc)',
|
|
77
|
-
env: 'SFCC_INSTANCE',
|
|
78
|
-
helpGroup: 'GLOBAL',
|
|
79
|
-
}),
|
|
80
|
-
'project-directory': Flags.string({
|
|
81
|
-
aliases: ['working-directory'],
|
|
82
|
-
description: 'Project directory',
|
|
83
|
-
env: 'SFCC_PROJECT_DIRECTORY',
|
|
84
|
-
default: async () => process.env.SFCC_WORKING_DIRECTORY || undefined,
|
|
85
|
-
helpGroup: 'GLOBAL',
|
|
86
|
-
}),
|
|
87
|
-
'extra-query': Flags.string({
|
|
88
|
-
description: 'Extra query parameters as JSON (e.g., \'{"debug":"true"}\')',
|
|
89
|
-
env: 'SFCC_EXTRA_QUERY',
|
|
90
|
-
helpGroup: 'GLOBAL',
|
|
91
|
-
hidden: true,
|
|
92
|
-
}),
|
|
93
|
-
'extra-body': Flags.string({
|
|
94
|
-
description: 'Extra body fields to merge as JSON (e.g., \'{"_internal":true}\')',
|
|
95
|
-
env: 'SFCC_EXTRA_BODY',
|
|
96
|
-
helpGroup: 'GLOBAL',
|
|
97
|
-
hidden: true,
|
|
98
|
-
}),
|
|
99
|
-
'extra-headers': Flags.string({
|
|
100
|
-
description: 'Extra HTTP headers as JSON (e.g., \'{"X-Custom-Header": "value"}\')',
|
|
101
|
-
env: 'SFCC_EXTRA_HEADERS',
|
|
102
|
-
helpGroup: 'GLOBAL',
|
|
103
|
-
hidden: true,
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
flags;
|
|
107
|
-
args;
|
|
108
|
-
resolvedConfig;
|
|
109
|
-
logger;
|
|
110
|
-
/** Safety guard for evaluating operations against safety rules and levels. */
|
|
111
|
-
safetyGuard = new SafetyGuard({ level: 'NONE' });
|
|
112
|
-
/** Telemetry instance for tracking command events */
|
|
113
|
-
telemetry;
|
|
114
|
-
/** Start time for command duration tracking */
|
|
115
|
-
commandStartTime;
|
|
116
|
-
async init() {
|
|
117
|
-
await super.init();
|
|
118
|
-
const { args, flags } = await this.parse({
|
|
119
|
-
flags: this.ctor.flags,
|
|
120
|
-
baseFlags: super.ctor.baseFlags,
|
|
121
|
-
args: this.ctor.args,
|
|
122
|
-
strict: this.ctor.strict,
|
|
123
|
-
});
|
|
124
|
-
this.flags = flags;
|
|
125
|
-
this.args = args;
|
|
126
|
-
if (this.flags.lang) {
|
|
127
|
-
setLanguage(this.flags.lang);
|
|
128
|
-
}
|
|
129
|
-
this.configureLogging();
|
|
130
|
-
// Initialize stateful auth store with oclif's data directory so session
|
|
131
|
-
// files are stored alongside other CLI data (e.g. ~/Library/Application Support/@salesforce/b2c-cli).
|
|
132
|
-
// Tests may override the path via B2C_TEST_DATA_DIR to isolate the auth-session.json
|
|
133
|
-
// file (e.g. per mocha worker) so they don't race on the developer's real session file.
|
|
134
|
-
initializeStatefulStore(process.env.B2C_TEST_DATA_DIR ?? this.config.dataDir);
|
|
135
|
-
// Set CLI User-Agent (CLI name/version only, without @salesforce/ prefix)
|
|
136
|
-
// This must happen before any API clients are created
|
|
137
|
-
setUserAgent(`${this.config.name.replace(/^@salesforce\//, '')}/${this.config.version}`);
|
|
138
|
-
// Register extra params middleware (from --extra-query, --extra-body, --extra-headers flags)
|
|
139
|
-
// This must happen before any API clients are created
|
|
140
|
-
this.registerExtraParamsMiddleware();
|
|
141
|
-
// Initialize safety guard with env-var-only config (before config resolution).
|
|
142
|
-
// The guard is updated with the full config after loadConfiguration().
|
|
143
|
-
this.safetyGuard = new SafetyGuard({ level: getSafetyLevel('NONE') });
|
|
144
|
-
// Register safety middleware FIRST (before any other middleware)
|
|
145
|
-
// The middleware reads this.safetyGuard lazily via closure, so it picks up
|
|
146
|
-
// the full config after initializeSafetyGuard() runs.
|
|
147
|
-
this.registerSafetyMiddleware();
|
|
148
|
-
// Collect middleware from plugins before any API clients are created
|
|
149
|
-
await this.collectPluginHttpMiddleware();
|
|
150
|
-
// Collect auth middleware from plugins before any authentication is performed
|
|
151
|
-
await this.collectPluginAuthMiddleware();
|
|
152
|
-
// Collect config sources from plugins before loading configuration
|
|
153
|
-
await this.collectPluginConfigSources();
|
|
154
|
-
// Auto-initialize telemetry from oclif pjson config
|
|
155
|
-
await this.initTelemetryFromConfig();
|
|
156
|
-
this.resolvedConfig = await this.loadConfiguration();
|
|
157
|
-
// Update safety guard with config-provided safety settings (merges env + config)
|
|
158
|
-
this.initializeSafetyGuard();
|
|
159
|
-
// Evaluate command-level safety rules for every command.
|
|
160
|
-
// This enforces rules like { command: "code:deploy", action: "block" } generically.
|
|
161
|
-
await this.evaluateCommandSafety();
|
|
162
|
-
this.addTelemetryContext();
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Auto-initialize telemetry from package.json oclif.telemetry config.
|
|
166
|
-
* Called during init() to enable automatic telemetry for all commands.
|
|
167
|
-
*/
|
|
168
|
-
async initTelemetryFromConfig() {
|
|
169
|
-
const pjsonTelemetry = this.config.pjson.oclif?.telemetry;
|
|
170
|
-
const connectionString = Telemetry.getConnectionString(pjsonTelemetry?.connectionString);
|
|
171
|
-
if (!connectionString)
|
|
172
|
-
return;
|
|
173
|
-
this.telemetry = createTelemetry({
|
|
174
|
-
project: this.config.name,
|
|
175
|
-
appInsightsKey: connectionString,
|
|
176
|
-
version: this.config.version,
|
|
177
|
-
dataDir: this.config.dataDir,
|
|
178
|
-
initialAttributes: { command: this.id },
|
|
179
|
-
});
|
|
180
|
-
await this.telemetry.start();
|
|
181
|
-
// Track command start
|
|
182
|
-
this.commandStartTime = Date.now();
|
|
183
|
-
this.telemetry.sendEvent('COMMAND_START', { command: this.id });
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Manual telemetry initialization for non-pjson usage (e.g., MCP server with additional attributes).
|
|
187
|
-
* Use this when you need to pass custom initial attributes or use a different connection string.
|
|
188
|
-
*
|
|
189
|
-
* @param options - Telemetry options
|
|
190
|
-
* @returns The telemetry instance, or undefined if telemetry is disabled
|
|
191
|
-
*/
|
|
192
|
-
async initTelemetry(options) {
|
|
193
|
-
// If telemetry was already initialized by initTelemetryFromConfig, stop it first
|
|
194
|
-
if (this.telemetry) {
|
|
195
|
-
await this.telemetry.stop();
|
|
196
|
-
}
|
|
197
|
-
const connectionString = Telemetry.getConnectionString(options.appInsightsKey);
|
|
198
|
-
if (!connectionString)
|
|
199
|
-
return undefined;
|
|
200
|
-
this.telemetry = createTelemetry({
|
|
201
|
-
project: this.config.name,
|
|
202
|
-
appInsightsKey: connectionString,
|
|
203
|
-
version: this.config.version,
|
|
204
|
-
dataDir: this.config.dataDir,
|
|
205
|
-
initialAttributes: { command: this.id, ...options.initialAttributes },
|
|
206
|
-
});
|
|
207
|
-
await this.telemetry.start();
|
|
208
|
-
// Track command start
|
|
209
|
-
this.commandStartTime = Date.now();
|
|
210
|
-
this.telemetry.sendEvent('COMMAND_START', { command: this.id });
|
|
211
|
-
return this.telemetry;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Determine colorize setting based on env vars and TTY.
|
|
215
|
-
* Priority: NO_COLOR > SFCC_LOG_COLORIZE > TTY detection
|
|
216
|
-
*/
|
|
217
|
-
shouldColorize() {
|
|
218
|
-
if (process.env.NO_COLOR !== undefined) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
// Default: colorize if stderr is a TTY
|
|
222
|
-
return process.stderr.isTTY ?? false;
|
|
223
|
-
}
|
|
224
|
-
configureLogging() {
|
|
225
|
-
let level = 'info';
|
|
226
|
-
if (this.flags['log-level']) {
|
|
227
|
-
level = this.flags['log-level'];
|
|
228
|
-
}
|
|
229
|
-
else if (this.flags.debug) {
|
|
230
|
-
level = 'debug';
|
|
231
|
-
}
|
|
232
|
-
// Default to stderr (fd 2), allow override to stdout (fd 1)
|
|
233
|
-
const fd = process.env.SFCC_LOG_TO_STDOUT ? 1 : 2;
|
|
234
|
-
// Redaction: default true, can be disabled
|
|
235
|
-
const redact = process.env.SFCC_REDACT_SECRETS !== 'false';
|
|
236
|
-
configureLogger({
|
|
237
|
-
level,
|
|
238
|
-
fd,
|
|
239
|
-
baseContext: { command: this.id },
|
|
240
|
-
json: this.flags.jsonl,
|
|
241
|
-
colorize: this.shouldColorize(),
|
|
242
|
-
redact,
|
|
243
|
-
});
|
|
244
|
-
this.logger = getLogger();
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Override oclif's log() to use pino.
|
|
248
|
-
*/
|
|
249
|
-
log(message, ...args) {
|
|
250
|
-
if (message !== undefined) {
|
|
251
|
-
this.logger.info(args.length > 0 ? `${message} ${args.join(' ')}` : message);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Override oclif's warn() to use pino.
|
|
256
|
-
*/
|
|
257
|
-
warn(input) {
|
|
258
|
-
const message = input instanceof Error ? input.message : input;
|
|
259
|
-
this.logger.warn(message);
|
|
260
|
-
return input;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Gets base configuration options from common flags.
|
|
264
|
-
*
|
|
265
|
-
* Subclasses should spread these options when overriding loadConfiguration()
|
|
266
|
-
* to ensure common options like projectDirectory are always included.
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* ```typescript
|
|
270
|
-
* protected override loadConfiguration(): ResolvedB2CConfig {
|
|
271
|
-
* const options: LoadConfigOptions = {
|
|
272
|
-
* ...this.getBaseConfigOptions(),
|
|
273
|
-
* // Add subclass-specific options here
|
|
274
|
-
* };
|
|
275
|
-
* return loadConfig(extractMyFlags(this.flags), options);
|
|
276
|
-
* }
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
getBaseConfigOptions() {
|
|
280
|
-
return {
|
|
281
|
-
instance: this.flags.instance,
|
|
282
|
-
configPath: this.flags.config,
|
|
283
|
-
projectDirectory: this.flags['project-directory'],
|
|
284
|
-
workingDirectory: this.flags['project-directory'],
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
async loadConfiguration() {
|
|
288
|
-
return loadConfig({}, this.getBaseConfigOptions());
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Enrich telemetry with realm/tenant context from the resolved configuration.
|
|
292
|
-
* Called after loadConfiguration() in init() so that COMMAND_SUCCESS and
|
|
293
|
-
* COMMAND_EXCEPTION events include organizational context.
|
|
294
|
-
*/
|
|
295
|
-
addTelemetryContext() {
|
|
296
|
-
if (!this.telemetry)
|
|
297
|
-
return;
|
|
298
|
-
try {
|
|
299
|
-
const attributes = {};
|
|
300
|
-
const { values, sources } = this.resolvedConfig;
|
|
301
|
-
// Extract realm from tenantId (e.g., "zzpq_019" or "f_ecom_zzpq_019")
|
|
302
|
-
if (values.tenantId) {
|
|
303
|
-
attributes.tenantId = values.tenantId;
|
|
304
|
-
const parsed = parseFriendlySandboxId(values.tenantId);
|
|
305
|
-
if (parsed) {
|
|
306
|
-
attributes.realm = parsed.realm;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
// Fallback: extract realm from hostname (e.g., "zzpq-019.dx.commercecloud.salesforce.com")
|
|
310
|
-
if (!attributes.realm && values.hostname) {
|
|
311
|
-
const parsed = parseFriendlySandboxId(values.hostname.split('.')[0]);
|
|
312
|
-
if (parsed) {
|
|
313
|
-
attributes.realm = parsed.realm;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (values.hostname) {
|
|
317
|
-
attributes.hostname = values.hostname;
|
|
318
|
-
}
|
|
319
|
-
if (values.clientId) {
|
|
320
|
-
attributes.clientId = values.clientId;
|
|
321
|
-
}
|
|
322
|
-
if (values.shortCode) {
|
|
323
|
-
attributes.shortCode = values.shortCode;
|
|
324
|
-
}
|
|
325
|
-
if (values.mrtProject) {
|
|
326
|
-
attributes.mrtProject = values.mrtProject;
|
|
327
|
-
}
|
|
328
|
-
// Record which config sources contributed
|
|
329
|
-
if (sources.length > 0) {
|
|
330
|
-
attributes.configSources = sources.map((s) => s.name).join(', ');
|
|
331
|
-
}
|
|
332
|
-
if (Object.keys(attributes).length > 0) {
|
|
333
|
-
this.telemetry.addAttributes(attributes);
|
|
334
|
-
if (process.env.SFCC_TELEMETRY_LOG === 'true') {
|
|
335
|
-
this.logger.debug({ attributes }, 'telemetry context enriched');
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
catch {
|
|
340
|
-
// Best-effort: telemetry context enrichment must never prevent command execution
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Collects config sources from plugins via the `b2c:config-sources` hook.
|
|
345
|
-
*
|
|
346
|
-
* This method is called during command initialization, after flags are parsed
|
|
347
|
-
* but before configuration is resolved. It allows CLI plugins to provide
|
|
348
|
-
* custom ConfigSource implementations.
|
|
349
|
-
*
|
|
350
|
-
* Plugin sources are registered with the global config source registry
|
|
351
|
-
* and automatically included in all subsequent `resolveConfig()` calls.
|
|
352
|
-
*
|
|
353
|
-
* Priority mapping:
|
|
354
|
-
* - 'before' → -1 (higher priority than defaults)
|
|
355
|
-
* - 'after' → 10 (lower priority than defaults)
|
|
356
|
-
* - number → used directly
|
|
357
|
-
*/
|
|
358
|
-
async collectPluginConfigSources() {
|
|
359
|
-
if (process.env.B2C_SKIP_PLUGIN_HOOKS)
|
|
360
|
-
return;
|
|
361
|
-
// Access flags that may be defined in subclasses (OAuthCommand, InstanceCommand)
|
|
362
|
-
const flags = this.flags;
|
|
363
|
-
const hookOptions = {
|
|
364
|
-
instance: this.flags.instance,
|
|
365
|
-
configPath: this.flags.config,
|
|
366
|
-
flags,
|
|
367
|
-
resolveOptions: {
|
|
368
|
-
instance: this.flags.instance,
|
|
369
|
-
configPath: this.flags.config,
|
|
370
|
-
accountManagerHost: flags['account-manager-host'],
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
const hookResult = await this.config.runHook('b2c:config-sources', hookOptions);
|
|
374
|
-
// Collect sources from all plugins and register with global registry
|
|
375
|
-
for (const success of hookResult.successes) {
|
|
376
|
-
const result = success.result;
|
|
377
|
-
if (!result?.sources?.length)
|
|
378
|
-
continue;
|
|
379
|
-
// Map priority: 'before' → -1, 'after' → 10, number → as-is, undefined → 10
|
|
380
|
-
const numericPriority = result.priority === 'before'
|
|
381
|
-
? -1
|
|
382
|
-
: result.priority === 'after'
|
|
383
|
-
? 10
|
|
384
|
-
: typeof result.priority === 'number'
|
|
385
|
-
? result.priority
|
|
386
|
-
: 10; // default 'after'
|
|
387
|
-
// Apply priority to sources that don't already have one set, then register globally
|
|
388
|
-
for (const source of result.sources) {
|
|
389
|
-
if (source.priority === undefined) {
|
|
390
|
-
source.priority = numericPriority;
|
|
391
|
-
}
|
|
392
|
-
globalConfigSourceRegistry.register(source);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
// Log warnings for hook failures (don't break the CLI)
|
|
396
|
-
for (const failure of hookResult.failures) {
|
|
397
|
-
this.logger?.warn(`Plugin ${failure.plugin.name} b2c:config-sources hook failed: ${failure.error.message}`);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Collects HTTP middleware from plugins via the `b2c:http-middleware` hook.
|
|
402
|
-
*
|
|
403
|
-
* This method is called during command initialization, after flags are parsed
|
|
404
|
-
* but before any API clients are created. It allows CLI plugins to provide
|
|
405
|
-
* custom middleware that will be applied to all HTTP clients.
|
|
406
|
-
*
|
|
407
|
-
* Plugin middleware is registered with the global middleware registry.
|
|
408
|
-
*/
|
|
409
|
-
async collectPluginHttpMiddleware() {
|
|
410
|
-
if (process.env.B2C_SKIP_PLUGIN_HOOKS)
|
|
411
|
-
return;
|
|
412
|
-
const hookOptions = {
|
|
413
|
-
flags: this.flags,
|
|
414
|
-
};
|
|
415
|
-
const hookResult = await this.config.runHook('b2c:http-middleware', hookOptions);
|
|
416
|
-
// Register middleware from all plugins that responded
|
|
417
|
-
for (const success of hookResult.successes) {
|
|
418
|
-
const result = success.result;
|
|
419
|
-
if (!result?.providers?.length)
|
|
420
|
-
continue;
|
|
421
|
-
for (const provider of result.providers) {
|
|
422
|
-
globalMiddlewareRegistry.register(provider);
|
|
423
|
-
this.logger?.debug(`Registered HTTP middleware provider: ${provider.name}`);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
// Log warnings for hook failures (don't break the CLI)
|
|
427
|
-
for (const failure of hookResult.failures) {
|
|
428
|
-
this.logger?.warn(`Plugin ${failure.plugin.name} b2c:http-middleware hook failed: ${failure.error.message}`);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Collects auth middleware from plugins via the `b2c:auth-middleware` hook.
|
|
433
|
-
*
|
|
434
|
-
* This method is called during command initialization, after flags are parsed
|
|
435
|
-
* but before any authentication is performed. It allows CLI plugins to provide
|
|
436
|
-
* custom middleware that will be applied to OAuth token requests.
|
|
437
|
-
*
|
|
438
|
-
* Plugin middleware is registered with the global auth middleware registry.
|
|
439
|
-
*/
|
|
440
|
-
async collectPluginAuthMiddleware() {
|
|
441
|
-
if (process.env.B2C_SKIP_PLUGIN_HOOKS)
|
|
442
|
-
return;
|
|
443
|
-
const hookOptions = {
|
|
444
|
-
flags: this.flags,
|
|
445
|
-
};
|
|
446
|
-
const hookResult = await this.config.runHook('b2c:auth-middleware', hookOptions);
|
|
447
|
-
// Register middleware from all plugins that responded
|
|
448
|
-
for (const success of hookResult.successes) {
|
|
449
|
-
const result = success.result;
|
|
450
|
-
if (!result?.providers?.length)
|
|
451
|
-
continue;
|
|
452
|
-
for (const provider of result.providers) {
|
|
453
|
-
globalAuthMiddlewareRegistry.register(provider);
|
|
454
|
-
this.logger?.debug(`Registered auth middleware provider: ${provider.name}`);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
// Log warnings for hook failures (don't break the CLI)
|
|
458
|
-
for (const failure of hookResult.failures) {
|
|
459
|
-
this.logger?.warn(`Plugin ${failure.plugin.name} b2c:auth-middleware hook failed: ${failure.error.message}`);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Handle errors thrown during command execution.
|
|
464
|
-
*
|
|
465
|
-
* Logs the error using the structured logger (including cause if available).
|
|
466
|
-
* In JSON mode, outputs a JSON error object to stdout instead of oclif's default format.
|
|
467
|
-
* Sends exception to telemetry if initialized.
|
|
468
|
-
*/
|
|
469
|
-
async catch(err) {
|
|
470
|
-
const exitCode = err.exitCode ?? 1;
|
|
471
|
-
const duration = this.commandStartTime ? Date.now() - this.commandStartTime : undefined;
|
|
472
|
-
// Send exception and COMMAND_ERROR event so the error appears in custom events (same view as COMMAND_START)
|
|
473
|
-
// Flush explicitly before stop to ensure events are sent before process exits
|
|
474
|
-
if (this.telemetry) {
|
|
475
|
-
this.telemetry.sendException(err, { command: this.id, exitCode, duration });
|
|
476
|
-
this.telemetry.sendEvent('COMMAND_ERROR', {
|
|
477
|
-
command: this.id,
|
|
478
|
-
exitCode,
|
|
479
|
-
duration,
|
|
480
|
-
errorMessage: err.message,
|
|
481
|
-
...(err.cause ? { errorCause: String(err.cause) } : {}),
|
|
482
|
-
});
|
|
483
|
-
await this.telemetry.flush();
|
|
484
|
-
await this.telemetry.stop();
|
|
485
|
-
}
|
|
486
|
-
// Log if logger is available (may not be if error during init)
|
|
487
|
-
if (this.logger) {
|
|
488
|
-
this.logger.error({ cause: err?.cause }, err.message);
|
|
489
|
-
}
|
|
490
|
-
// In JSON mode, output structured error to stderr and exit
|
|
491
|
-
if (this.jsonEnabled()) {
|
|
492
|
-
const errorOutput = {
|
|
493
|
-
error: {
|
|
494
|
-
message: err.message,
|
|
495
|
-
code: exitCode,
|
|
496
|
-
...(err.cause ? { cause: String(err.cause) } : {}),
|
|
497
|
-
},
|
|
498
|
-
};
|
|
499
|
-
process.stderr.write(JSON.stringify(errorOutput) + '\n');
|
|
500
|
-
process.exit(exitCode);
|
|
501
|
-
}
|
|
502
|
-
// Use oclif's error() for proper exit code and display
|
|
503
|
-
return this.error(err.message, { exit: exitCode });
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Called after run() completes (whether successfully or via catch()).
|
|
507
|
-
* Tracks COMMAND_SUCCESS and stops telemetry.
|
|
508
|
-
*/
|
|
509
|
-
async finally(err) {
|
|
510
|
-
// Only track success if no error occurred
|
|
511
|
-
if (!err && this.telemetry) {
|
|
512
|
-
const duration = this.commandStartTime ? Date.now() - this.commandStartTime : undefined;
|
|
513
|
-
this.telemetry.sendEvent('COMMAND_SUCCESS', { command: this.id, duration });
|
|
514
|
-
await this.telemetry.stop();
|
|
515
|
-
}
|
|
516
|
-
await super.finally(err);
|
|
517
|
-
}
|
|
518
|
-
baseCommandTest() {
|
|
519
|
-
this.logger.info('BaseCommand initialized');
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Check if destructive operations are allowed based on safety level.
|
|
523
|
-
* Provides early, user-friendly error messages before HTTP requests are attempted.
|
|
524
|
-
*
|
|
525
|
-
* This is a command-level check that complements the HTTP middleware safety guard.
|
|
526
|
-
* While the middleware provides unbypassable protection, this method offers better
|
|
527
|
-
* error messages and early detection.
|
|
528
|
-
*
|
|
529
|
-
* Destructive operations include:
|
|
530
|
-
* - Deleting resources (sandboxes, users, API clients, etc.)
|
|
531
|
-
* - Resetting or wiping data
|
|
532
|
-
* - Force operations that overwrite data
|
|
533
|
-
* - Revoking access or permissions
|
|
534
|
-
*
|
|
535
|
-
* NOTE: This is optional - the HTTP middleware will catch any operations that bypass
|
|
536
|
-
* this check. Use this method for better UX when you know an operation is destructive.
|
|
537
|
-
*
|
|
538
|
-
* @param operationDescription - Description of the operation (e.g., "delete sandbox", "reset user password")
|
|
539
|
-
* @throws Error if safety level blocks the operation
|
|
540
|
-
*
|
|
541
|
-
* @example
|
|
542
|
-
* ```typescript
|
|
543
|
-
* async run() {
|
|
544
|
-
* this.assertDestructiveOperationAllowed('delete sandbox');
|
|
545
|
-
* // ... proceed with deletion
|
|
546
|
-
* }
|
|
547
|
-
* ```
|
|
548
|
-
*/
|
|
549
|
-
assertDestructiveOperationAllowed(operationDescription) {
|
|
550
|
-
const evaluation = this.safetyGuard.evaluate({
|
|
551
|
-
type: 'command',
|
|
552
|
-
commandId: this.id,
|
|
553
|
-
});
|
|
554
|
-
if (evaluation.action === 'allow') {
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
const operation = operationDescription || t('base.destructiveOperation', 'this destructive operation');
|
|
558
|
-
// For both 'block' and 'confirm' at the assertion level, we block.
|
|
559
|
-
// Commands that want to support confirmation should call confirmOrBlock() separately.
|
|
560
|
-
const safetyLevel = this.safetyGuard.config.level;
|
|
561
|
-
return this.error(t('base.safetyModeBlocked', 'Cannot {{operation}}: blocked by your safety configuration (level: {{safetyLevel}}).\n\n{{description}}\n\nTo change this, update the "safety" section in your dw.json or the SFCC_SAFETY_LEVEL environment variable.\nSee: https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/safety', {
|
|
562
|
-
operation,
|
|
563
|
-
safetyLevel,
|
|
564
|
-
description: describeSafetyLevel(safetyLevel),
|
|
565
|
-
}), { exit: 1 });
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Parse extra params from --extra-query, --extra-body, and --extra-headers flags.
|
|
569
|
-
* Returns undefined if no extra params are specified.
|
|
570
|
-
*
|
|
571
|
-
* @returns ExtraParamsConfig or undefined
|
|
572
|
-
*/
|
|
573
|
-
getExtraParams() {
|
|
574
|
-
const extraQuery = this.flags['extra-query'];
|
|
575
|
-
const extraBody = this.flags['extra-body'];
|
|
576
|
-
const extraHeaders = this.flags['extra-headers'];
|
|
577
|
-
if (!extraQuery && !extraBody && !extraHeaders) {
|
|
578
|
-
return undefined;
|
|
579
|
-
}
|
|
580
|
-
const config = {};
|
|
581
|
-
if (extraQuery) {
|
|
582
|
-
try {
|
|
583
|
-
config.query = JSON.parse(extraQuery);
|
|
584
|
-
}
|
|
585
|
-
catch {
|
|
586
|
-
this.error(`Invalid JSON for --extra-query: ${extraQuery}`);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
if (extraBody) {
|
|
590
|
-
try {
|
|
591
|
-
config.body = JSON.parse(extraBody);
|
|
592
|
-
}
|
|
593
|
-
catch {
|
|
594
|
-
this.error(`Invalid JSON for --extra-body: ${extraBody}`);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
if (extraHeaders) {
|
|
598
|
-
try {
|
|
599
|
-
config.headers = JSON.parse(extraHeaders);
|
|
600
|
-
}
|
|
601
|
-
catch {
|
|
602
|
-
this.error(`Invalid JSON for --extra-headers: ${extraHeaders}`);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
return config;
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Register safety middleware that evaluates all HTTP requests against the SafetyGuard.
|
|
609
|
-
*
|
|
610
|
-
* The middleware reads `this.safetyGuard` lazily (via arrow function closure), so it
|
|
611
|
-
* picks up the full config after `initializeSafetyGuard()` runs. This allows the
|
|
612
|
-
* middleware to be registered early in init() before config resolution completes.
|
|
613
|
-
*/
|
|
614
|
-
registerSafetyMiddleware() {
|
|
615
|
-
globalMiddlewareRegistry.register({
|
|
616
|
-
name: 'cli-safety-guard',
|
|
617
|
-
getMiddleware: () => {
|
|
618
|
-
// Skip if no safety restrictions are configured
|
|
619
|
-
if (this.safetyGuard.config.level === 'NONE' && !this.safetyGuard.config.rules?.length) {
|
|
620
|
-
return undefined;
|
|
621
|
-
}
|
|
622
|
-
return createSafetyMiddleware(this.safetyGuard);
|
|
623
|
-
},
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Update the safety guard with config-provided safety settings.
|
|
628
|
-
* Called after loadConfiguration() to merge env vars, global safety config,
|
|
629
|
-
* and per-instance dw.json config.
|
|
630
|
-
*/
|
|
631
|
-
initializeSafetyGuard() {
|
|
632
|
-
const globalSafety = loadGlobalSafetyConfig(this.config.configDir);
|
|
633
|
-
const config = resolveEffectiveSafetyConfig(this.resolvedConfig.values.safety, globalSafety);
|
|
634
|
-
this.safetyGuard = new SafetyGuard(config);
|
|
635
|
-
if (config.level !== 'NONE' || config.rules?.length || config.confirm) {
|
|
636
|
-
this.logger.debug({ level: config.level, confirm: config.confirm, ruleCount: config.rules?.length ?? 0 }, 'Safety mode active');
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Evaluate command-level safety rules for the current command.
|
|
641
|
-
*
|
|
642
|
-
* This runs at the end of init() so every command is evaluated against
|
|
643
|
-
* command rules (e.g., `{ command: "code:deploy", action: "block" }`).
|
|
644
|
-
* If no command rule matches, this is a no-op — level-based blocking
|
|
645
|
-
* is handled by the HTTP middleware and assertDestructiveOperationAllowed().
|
|
646
|
-
*/
|
|
647
|
-
async evaluateCommandSafety() {
|
|
648
|
-
const evaluation = this.safetyGuard.evaluate({
|
|
649
|
-
type: 'command',
|
|
650
|
-
commandId: this.id,
|
|
651
|
-
});
|
|
652
|
-
if (evaluation.action === 'block' && evaluation.rule) {
|
|
653
|
-
this.error(evaluation.reason, { exit: 1 });
|
|
654
|
-
}
|
|
655
|
-
if (evaluation.action === 'confirm' && evaluation.rule) {
|
|
656
|
-
await this.confirmOrBlock(evaluation);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Require interactive confirmation for a safety-guarded operation.
|
|
661
|
-
*
|
|
662
|
-
* If stdin is a TTY, prompts the user. Otherwise, blocks with an error message.
|
|
663
|
-
* The error message clearly indicates the block is from the user's own safety configuration.
|
|
664
|
-
*
|
|
665
|
-
* @param evaluation - The safety evaluation that triggered confirmation
|
|
666
|
-
* @throws Error if confirmation is denied or not possible
|
|
667
|
-
*/
|
|
668
|
-
async confirmOrBlock(evaluation) {
|
|
669
|
-
if (!process.stdin.isTTY) {
|
|
670
|
-
this.error(`Your safety configuration requires confirmation for this operation, ` +
|
|
671
|
-
`but no interactive session is available.\n\n ${evaluation.reason}\n\n` +
|
|
672
|
-
`To change this, update the "safety" section in your dw.json or the SFCC_SAFETY_CONFIRM environment variable.`, { exit: 1 });
|
|
673
|
-
}
|
|
674
|
-
const confirmed = await safetyConfirm(`Your safety configuration requires confirmation for this operation:\n ${evaluation.reason}\n Proceed?`);
|
|
675
|
-
if (!confirmed) {
|
|
676
|
-
this.error('Operation cancelled.', { exit: 1 });
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Register extra params (query, body, headers) as global middleware.
|
|
681
|
-
* This applies to ALL HTTP clients created during command execution.
|
|
682
|
-
*/
|
|
683
|
-
registerExtraParamsMiddleware() {
|
|
684
|
-
const extraParams = this.getExtraParams();
|
|
685
|
-
if (!extraParams)
|
|
686
|
-
return;
|
|
687
|
-
globalMiddlewareRegistry.register({
|
|
688
|
-
name: 'cli-extra-params',
|
|
689
|
-
getMiddleware() {
|
|
690
|
-
return createExtraParamsMiddleware(extraParams);
|
|
691
|
-
},
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
//# sourceMappingURL=base-command.js.map
|