movehat 0.1.8 → 0.2.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/README.md +2 -2
- package/dist/__tests__/deployContract.test.d.ts +2 -0
- package/dist/__tests__/deployContract.test.d.ts.map +1 -0
- package/dist/__tests__/deployContract.test.js +368 -0
- package/dist/__tests__/deployContract.test.js.map +1 -0
- package/dist/__tests__/errors.test.d.ts +2 -0
- package/dist/__tests__/errors.test.d.ts.map +1 -0
- package/dist/__tests__/errors.test.js +46 -0
- package/dist/__tests__/errors.test.js.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts +24 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.d.ts.map +1 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js +82 -0
- package/dist/__tests__/fixtures/sigint-deploy-harness.js.map +1 -0
- package/dist/__tests__/fork/api.test.d.ts +2 -0
- package/dist/__tests__/fork/api.test.d.ts.map +1 -0
- package/dist/__tests__/fork/api.test.js +110 -0
- package/dist/__tests__/fork/api.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.createLive.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.createLive.test.js +53 -0
- package/dist/__tests__/harness/Harness.createLive.test.js.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts +2 -0
- package/dist/__tests__/harness/Harness.proxy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/Harness.proxy.test.js +93 -0
- package/dist/__tests__/harness/Harness.proxy.test.js.map +1 -0
- package/dist/__tests__/harness/_fixture.d.ts +54 -0
- package/dist/__tests__/harness/_fixture.d.ts.map +1 -0
- package/dist/__tests__/harness/_fixture.js +69 -0
- package/dist/__tests__/harness/_fixture.js.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.deploy.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js +288 -0
- package/dist/__tests__/harness/codeObject.deploy.test.js.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts +2 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.d.ts.map +1 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js +138 -0
- package/dist/__tests__/harness/codeObject.upgrade.test.js.map +1 -0
- package/dist/__tests__/harness/script.test.d.ts +2 -0
- package/dist/__tests__/harness/script.test.d.ts.map +1 -0
- package/dist/__tests__/harness/script.test.js +219 -0
- package/dist/__tests__/harness/script.test.js.map +1 -0
- package/dist/__tests__/harness/view.test.d.ts +2 -0
- package/dist/__tests__/harness/view.test.d.ts.map +1 -0
- package/dist/__tests__/harness/view.test.js +92 -0
- package/dist/__tests__/harness/view.test.js.map +1 -0
- package/dist/__tests__/runtime.test.d.ts +2 -0
- package/dist/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.test.js +141 -0
- package/dist/__tests__/runtime.test.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/__tests__/compile.test.d.ts +2 -0
- package/dist/commands/__tests__/compile.test.d.ts.map +1 -0
- package/dist/commands/__tests__/compile.test.js +351 -0
- package/dist/commands/__tests__/compile.test.js.map +1 -0
- package/dist/commands/__tests__/init.test.d.ts +2 -0
- package/dist/commands/__tests__/init.test.d.ts.map +1 -0
- package/dist/commands/__tests__/init.test.js +101 -0
- package/dist/commands/__tests__/init.test.js.map +1 -0
- package/dist/commands/__tests__/run.test.d.ts +2 -0
- package/dist/commands/__tests__/run.test.d.ts.map +1 -0
- package/dist/commands/__tests__/run.test.js +166 -0
- package/dist/commands/__tests__/run.test.js.map +1 -0
- package/dist/commands/__tests__/test-move.test.d.ts +2 -0
- package/dist/commands/__tests__/test-move.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test-move.test.js +59 -0
- package/dist/commands/__tests__/test-move.test.js.map +1 -0
- package/dist/commands/__tests__/test.test.d.ts +2 -0
- package/dist/commands/__tests__/test.test.d.ts.map +1 -0
- package/dist/commands/__tests__/test.test.js +168 -0
- package/dist/commands/__tests__/test.test.js.map +1 -0
- package/dist/commands/__tests__/update.test.d.ts +2 -0
- package/dist/commands/__tests__/update.test.d.ts.map +1 -0
- package/dist/commands/__tests__/update.test.js +176 -0
- package/dist/commands/__tests__/update.test.js.map +1 -0
- package/dist/commands/compile.d.ts +7 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +150 -33
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/fork/__tests__/create.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/create.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/create.test.js +108 -0
- package/dist/commands/fork/__tests__/create.test.js.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/fund.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/fund.test.js +72 -0
- package/dist/commands/fork/__tests__/fund.test.js.map +1 -0
- package/dist/commands/fork/__tests__/list.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/list.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/list.test.js +119 -0
- package/dist/commands/fork/__tests__/list.test.js.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/serve.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/serve.test.js +97 -0
- package/dist/commands/fork/__tests__/serve.test.js.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts +2 -0
- package/dist/commands/fork/__tests__/view-resource.test.d.ts.map +1 -0
- package/dist/commands/fork/__tests__/view-resource.test.js +77 -0
- package/dist/commands/fork/__tests__/view-resource.test.js.map +1 -0
- package/dist/commands/fork/create.d.ts +1 -1
- package/dist/commands/fork/create.d.ts.map +1 -1
- package/dist/commands/fork/create.js +3 -2
- package/dist/commands/fork/create.js.map +1 -1
- package/dist/commands/fork/fund.d.ts.map +1 -1
- package/dist/commands/fork/fund.js +15 -8
- package/dist/commands/fork/fund.js.map +1 -1
- package/dist/commands/fork/list.d.ts.map +1 -1
- package/dist/commands/fork/list.js +2 -1
- package/dist/commands/fork/list.js.map +1 -1
- package/dist/commands/fork/serve.d.ts +1 -0
- package/dist/commands/fork/serve.d.ts.map +1 -1
- package/dist/commands/fork/serve.js +4 -2
- package/dist/commands/fork/serve.js.map +1 -1
- package/dist/commands/fork/view-resource.d.ts.map +1 -1
- package/dist/commands/fork/view-resource.js +10 -5
- package/dist/commands/fork/view-resource.js.map +1 -1
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +50 -27
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/test-move.d.ts.map +1 -1
- package/dist/commands/test-move.js +3 -2
- package/dist/commands/test-move.js.map +1 -1
- package/dist/commands/test.js +52 -46
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +15 -13
- package/dist/commands/update.js.map +1 -1
- package/dist/core/AccountManager.d.ts +1 -1
- package/dist/core/AccountManager.d.ts.map +1 -1
- package/dist/core/AccountManager.js +20 -7
- package/dist/core/AccountManager.js.map +1 -1
- package/dist/core/Publisher.d.ts +31 -0
- package/dist/core/Publisher.d.ts.map +1 -0
- package/dist/core/Publisher.js +248 -0
- package/dist/core/Publisher.js.map +1 -0
- package/dist/core/__tests__/AccountManager.test.d.ts +2 -0
- package/dist/core/__tests__/AccountManager.test.d.ts.map +1 -0
- package/dist/core/__tests__/AccountManager.test.js +239 -0
- package/dist/core/__tests__/AccountManager.test.js.map +1 -0
- package/dist/core/__tests__/config.test.d.ts +2 -0
- package/dist/core/__tests__/config.test.d.ts.map +1 -0
- package/dist/core/__tests__/config.test.js +311 -0
- package/dist/core/__tests__/config.test.js.map +1 -0
- package/dist/core/__tests__/deployments.test.d.ts +2 -0
- package/dist/core/__tests__/deployments.test.d.ts.map +1 -0
- package/dist/core/__tests__/deployments.test.js +201 -0
- package/dist/core/__tests__/deployments.test.js.map +1 -0
- package/dist/core/__tests__/shell.test.d.ts +2 -0
- package/dist/core/__tests__/shell.test.d.ts.map +1 -0
- package/dist/core/__tests__/shell.test.js +107 -0
- package/dist/core/__tests__/shell.test.js.map +1 -0
- package/dist/core/config.d.ts +13 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +80 -11
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.d.ts +1 -1
- package/dist/core/contract.d.ts.map +1 -1
- package/dist/core/contract.js +15 -4
- package/dist/core/contract.js.map +1 -1
- package/dist/core/deployments.d.ts +2 -2
- package/dist/core/deployments.d.ts.map +1 -1
- package/dist/core/deployments.js +8 -6
- package/dist/core/deployments.js.map +1 -1
- package/dist/core/movementProfile.d.ts +34 -0
- package/dist/core/movementProfile.d.ts.map +1 -0
- package/dist/core/movementProfile.js +150 -0
- package/dist/core/movementProfile.js.map +1 -0
- package/dist/core/shell.d.ts +23 -7
- package/dist/core/shell.d.ts.map +1 -1
- package/dist/core/shell.js +32 -14
- package/dist/core/shell.js.map +1 -1
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -1
- package/dist/fork/__tests__/manager.test.d.ts +2 -0
- package/dist/fork/__tests__/manager.test.d.ts.map +1 -0
- package/dist/fork/__tests__/manager.test.js +309 -0
- package/dist/fork/__tests__/manager.test.js.map +1 -0
- package/dist/fork/__tests__/server.test.d.ts +2 -0
- package/dist/fork/__tests__/server.test.d.ts.map +1 -0
- package/dist/fork/__tests__/server.test.js +54 -0
- package/dist/fork/__tests__/server.test.js.map +1 -0
- package/dist/fork/__tests__/storage.test.d.ts +2 -0
- package/dist/fork/__tests__/storage.test.d.ts.map +1 -0
- package/dist/fork/__tests__/storage.test.js +222 -0
- package/dist/fork/__tests__/storage.test.js.map +1 -0
- package/dist/fork/__tests__/test.test.d.ts +2 -0
- package/dist/fork/__tests__/test.test.d.ts.map +1 -0
- package/dist/fork/__tests__/test.test.js +81 -0
- package/dist/fork/__tests__/test.test.js.map +1 -0
- package/dist/fork/api.d.ts +14 -3
- package/dist/fork/api.d.ts.map +1 -1
- package/dist/fork/api.js +25 -14
- package/dist/fork/api.js.map +1 -1
- package/dist/fork/manager.d.ts +23 -9
- package/dist/fork/manager.d.ts.map +1 -1
- package/dist/fork/manager.js +79 -36
- package/dist/fork/manager.js.map +1 -1
- package/dist/fork/server.d.ts +11 -3
- package/dist/fork/server.d.ts.map +1 -1
- package/dist/fork/server.js +45 -13
- package/dist/fork/server.js.map +1 -1
- package/dist/fork/storage.d.ts +4 -4
- package/dist/fork/storage.d.ts.map +1 -1
- package/dist/fork/storage.js +7 -9
- package/dist/fork/storage.js.map +1 -1
- package/dist/fork/test.d.ts +13 -4
- package/dist/fork/test.d.ts.map +1 -1
- package/dist/fork/test.js +36 -27
- package/dist/fork/test.js.map +1 -1
- package/dist/harness/Harness.d.ts +124 -0
- package/dist/harness/Harness.d.ts.map +1 -0
- package/dist/harness/Harness.js +193 -0
- package/dist/harness/Harness.js.map +1 -0
- package/dist/harness/codeObject.d.ts +31 -0
- package/dist/harness/codeObject.d.ts.map +1 -0
- package/dist/harness/codeObject.js +271 -0
- package/dist/harness/codeObject.js.map +1 -0
- package/dist/harness/errors.d.ts +14 -0
- package/dist/harness/errors.d.ts.map +1 -0
- package/dist/harness/errors.js +22 -0
- package/dist/harness/errors.js.map +1 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +3 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/proxy.d.ts +7 -0
- package/dist/harness/proxy.d.ts.map +1 -0
- package/dist/harness/proxy.js +36 -0
- package/dist/harness/proxy.js.map +1 -0
- package/dist/harness/script.d.ts +21 -0
- package/dist/harness/script.d.ts.map +1 -0
- package/dist/harness/script.js +155 -0
- package/dist/harness/script.js.map +1 -0
- package/dist/harness/view.d.ts +22 -0
- package/dist/harness/view.d.ts.map +1 -0
- package/dist/harness/view.js +28 -0
- package/dist/harness/view.js.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts +2 -0
- package/dist/helpers/__tests__/semver-utils.test.d.ts.map +1 -0
- package/dist/helpers/__tests__/semver-utils.test.js +103 -0
- package/dist/helpers/__tests__/semver-utils.test.js.map +1 -0
- package/dist/helpers/index.d.ts +3 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/move-tests.d.ts +3 -3
- package/dist/helpers/move-tests.d.ts.map +1 -1
- package/dist/helpers/move-tests.js +21 -20
- package/dist/helpers/move-tests.js.map +1 -1
- package/dist/helpers/npm-registry.d.ts.map +1 -1
- package/dist/helpers/npm-registry.js +1 -3
- package/dist/helpers/npm-registry.js.map +1 -1
- package/dist/helpers/semver-utils.d.ts.map +1 -1
- package/dist/helpers/semver-utils.js +4 -3
- package/dist/helpers/semver-utils.js.map +1 -1
- package/dist/helpers/setup.d.ts.map +1 -1
- package/dist/helpers/setup.js +10 -6
- package/dist/helpers/setup.js.map +1 -1
- package/dist/helpers/setupLocalTesting.d.ts +32 -27
- package/dist/helpers/setupLocalTesting.d.ts.map +1 -1
- package/dist/helpers/setupLocalTesting.js +179 -180
- package/dist/helpers/setupLocalTesting.js.map +1 -1
- package/dist/helpers/testFixtures.d.ts +19 -53
- package/dist/helpers/testFixtures.d.ts.map +1 -1
- package/dist/helpers/testFixtures.js +89 -107
- package/dist/helpers/testFixtures.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/node/LocalNodeManager.d.ts +9 -1
- package/dist/node/LocalNodeManager.d.ts.map +1 -1
- package/dist/node/LocalNodeManager.js +75 -58
- package/dist/node/LocalNodeManager.js.map +1 -1
- package/dist/node/__tests__/LocalNodeManager.test.d.ts +2 -0
- package/dist/node/__tests__/LocalNodeManager.test.d.ts.map +1 -0
- package/dist/node/__tests__/LocalNodeManager.test.js +349 -0
- package/dist/node/__tests__/LocalNodeManager.test.js.map +1 -0
- package/dist/runtime.d.ts +12 -15
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +32 -241
- package/dist/runtime.js.map +1 -1
- package/dist/templates/README.md +1 -1
- package/dist/templates/movehat.config.ts +10 -0
- package/dist/templates/package.json +2 -1
- package/dist/templates/scripts/deploy-counter.ts +46 -38
- package/dist/templates/tests/Counter.test.ts +51 -51
- package/dist/templates/types/movehat.d.ts +6 -9
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fork.d.ts +7 -1
- package/dist/types/fork.d.ts.map +1 -1
- package/dist/types/harness.d.ts +166 -0
- package/dist/types/harness.d.ts.map +1 -0
- package/dist/types/harness.js +2 -0
- package/dist/types/harness.js.map +1 -0
- package/dist/types/runtime.d.ts +7 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/ui/__tests__/colors.test.d.ts +2 -0
- package/dist/ui/__tests__/colors.test.d.ts.map +1 -0
- package/dist/ui/__tests__/colors.test.js +127 -0
- package/dist/ui/__tests__/colors.test.js.map +1 -0
- package/dist/ui/colors.d.ts.map +1 -1
- package/dist/ui/colors.js +6 -2
- package/dist/ui/colors.js.map +1 -1
- package/dist/ui/logger.d.ts +17 -0
- package/dist/ui/logger.d.ts.map +1 -1
- package/dist/ui/logger.js +22 -0
- package/dist/ui/logger.js.map +1 -1
- package/dist/ui/symbols.d.ts +1 -0
- package/dist/ui/symbols.d.ts.map +1 -1
- package/dist/ui/symbols.js +7 -1
- package/dist/ui/symbols.js.map +1 -1
- package/dist/utils/__tests__/address.test.d.ts +2 -0
- package/dist/utils/__tests__/address.test.d.ts.map +1 -0
- package/dist/utils/__tests__/address.test.js +70 -0
- package/dist/utils/__tests__/address.test.js.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts +2 -0
- package/dist/utils/__tests__/childProcessAdapter.test.d.ts.map +1 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js +217 -0
- package/dist/utils/__tests__/childProcessAdapter.test.js.map +1 -0
- package/dist/utils/__tests__/runCli.test.d.ts +2 -0
- package/dist/utils/__tests__/runCli.test.d.ts.map +1 -0
- package/dist/utils/__tests__/runCli.test.js +187 -0
- package/dist/utils/__tests__/runCli.test.js.map +1 -0
- package/dist/utils/address.d.ts +33 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +52 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/utils/childProcessAdapter.d.ts +93 -0
- package/dist/utils/childProcessAdapter.d.ts.map +1 -0
- package/dist/utils/childProcessAdapter.js +109 -0
- package/dist/utils/childProcessAdapter.js.map +1 -0
- package/dist/utils/parseCliOutput.d.ts +20 -0
- package/dist/utils/parseCliOutput.d.ts.map +1 -0
- package/dist/utils/parseCliOutput.js +26 -0
- package/dist/utils/parseCliOutput.js.map +1 -0
- package/dist/utils/redact.d.ts +15 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +24 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/runCli.d.ts +24 -0
- package/dist/utils/runCli.d.ts.map +1 -0
- package/dist/utils/runCli.js +37 -0
- package/dist/utils/runCli.js.map +1 -0
- package/package.json +14 -4
- package/src/__tests__/deployContract.test.ts +429 -0
- package/src/__tests__/errors.test.ts +84 -0
- package/src/__tests__/fixtures/sigint-deploy-harness.ts +95 -0
- package/src/__tests__/fork/api.test.ts +143 -0
- package/src/__tests__/harness/Harness.createLive.test.ts +57 -0
- package/src/__tests__/harness/Harness.proxy.test.ts +115 -0
- package/src/__tests__/harness/_fixture.ts +131 -0
- package/src/__tests__/harness/codeObject.deploy.test.ts +319 -0
- package/src/__tests__/harness/codeObject.upgrade.test.ts +156 -0
- package/src/__tests__/harness/script.test.ts +245 -0
- package/src/__tests__/harness/view.test.ts +104 -0
- package/src/__tests__/runtime.test.ts +182 -0
- package/src/cli.ts +2 -1
- package/src/commands/__tests__/compile.test.ts +407 -0
- package/src/commands/__tests__/init.test.ts +125 -0
- package/src/commands/__tests__/run.test.ts +192 -0
- package/src/commands/__tests__/test-move.test.ts +81 -0
- package/src/commands/__tests__/test.test.ts +204 -0
- package/src/commands/__tests__/update.test.ts +223 -0
- package/src/commands/compile.ts +168 -32
- package/src/commands/fork/__tests__/create.test.ts +132 -0
- package/src/commands/fork/__tests__/fund.test.ts +104 -0
- package/src/commands/fork/__tests__/list.test.ts +139 -0
- package/src/commands/fork/__tests__/serve.test.ts +121 -0
- package/src/commands/fork/__tests__/view-resource.test.ts +101 -0
- package/src/commands/fork/create.ts +4 -3
- package/src/commands/fork/fund.ts +16 -9
- package/src/commands/fork/list.ts +3 -2
- package/src/commands/fork/serve.ts +6 -3
- package/src/commands/fork/view-resource.ts +11 -6
- package/src/commands/run.ts +54 -28
- package/src/commands/test-move.ts +4 -3
- package/src/commands/test.ts +56 -44
- package/src/commands/update.ts +19 -16
- package/src/core/AccountManager.ts +23 -10
- package/src/core/Publisher.ts +322 -0
- package/src/core/__tests__/AccountManager.test.ts +290 -0
- package/src/core/__tests__/config.test.ts +377 -0
- package/src/core/__tests__/deployments.test.ts +247 -0
- package/src/core/__tests__/shell.test.ts +138 -0
- package/src/core/config.ts +96 -12
- package/src/core/contract.ts +13 -4
- package/src/core/deployments.ts +13 -11
- package/src/core/movementProfile.ts +179 -0
- package/src/core/shell.ts +34 -14
- package/src/errors.ts +60 -0
- package/src/fork/__tests__/manager.test.ts +385 -0
- package/src/fork/__tests__/server.test.ts +65 -0
- package/src/fork/__tests__/storage.test.ts +281 -0
- package/src/fork/__tests__/test.test.ts +97 -0
- package/src/fork/api.ts +28 -14
- package/src/fork/manager.ts +88 -43
- package/src/fork/server.ts +53 -19
- package/src/fork/storage.ts +12 -15
- package/src/fork/test.ts +58 -32
- package/src/harness/Harness.ts +228 -0
- package/src/harness/codeObject.ts +388 -0
- package/src/harness/errors.ts +22 -0
- package/src/harness/index.ts +3 -0
- package/src/harness/proxy.ts +40 -0
- package/src/harness/script.ts +196 -0
- package/src/harness/view.ts +34 -0
- package/src/helpers/__tests__/semver-utils.test.ts +121 -0
- package/src/helpers/index.ts +2 -8
- package/src/helpers/move-tests.ts +27 -23
- package/src/helpers/npm-registry.ts +4 -3
- package/src/helpers/semver-utils.ts +4 -3
- package/src/helpers/setup.ts +9 -5
- package/src/helpers/setupLocalTesting.ts +219 -200
- package/src/helpers/testFixtures.ts +106 -118
- package/src/index.ts +9 -3
- package/src/node/LocalNodeManager.ts +87 -62
- package/src/node/__tests__/LocalNodeManager.test.ts +452 -0
- package/src/runtime.ts +33 -289
- package/src/templates/README.md +1 -1
- package/src/templates/movehat.config.ts +10 -0
- package/src/templates/package.json +2 -1
- package/src/templates/scripts/deploy-counter.ts +46 -38
- package/src/templates/tests/Counter.test.ts +51 -51
- package/src/templates/types/movehat.d.ts +6 -9
- package/src/types/config.ts +8 -0
- package/src/types/fork.ts +7 -1
- package/src/types/harness.ts +182 -0
- package/src/types/runtime.ts +11 -3
- package/src/ui/__tests__/colors.test.ts +156 -0
- package/src/ui/colors.ts +5 -2
- package/src/ui/logger.ts +22 -0
- package/src/ui/symbols.ts +7 -1
- package/src/utils/__tests__/address.test.ts +93 -0
- package/src/utils/__tests__/childProcessAdapter.test.ts +266 -0
- package/src/utils/__tests__/runCli.test.ts +240 -0
- package/src/utils/address.ts +56 -0
- package/src/utils/childProcessAdapter.ts +215 -0
- package/src/utils/parseCliOutput.ts +27 -0
- package/src/utils/redact.ts +24 -0
- package/src/utils/runCli.ts +64 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "fs";
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
import { dirname } from "path";
|
|
4
|
+
import { randomUUID } from "crypto";
|
|
5
|
+
import * as yaml from "js-yaml";
|
|
6
|
+
/**
|
|
7
|
+
* Shared helpers for working with the Movement CLI's `~/.aptos/config.yaml`
|
|
8
|
+
* profile file and the SIGINT/SIGTERM cleanup pipeline.
|
|
9
|
+
*
|
|
10
|
+
* Extracted from `core/Publisher.ts` so both the existing `move publish`
|
|
11
|
+
* flow (`Publisher`) and the new `move deploy-object` / `upgrade-object`
|
|
12
|
+
* flows (`harness/codeObject.ts`) can share the bug #36 / #37 / #43
|
|
13
|
+
* hardening without duplicating it.
|
|
14
|
+
*
|
|
15
|
+
* @internal — not exported from `src/index.ts`.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* In-process serializer for `~/.aptos/config.yaml` mutations. Without it,
|
|
19
|
+
* two concurrent profile writes would race in the read-modify-write cycle
|
|
20
|
+
* and the second writer would silently drop the first's profile. See #37.
|
|
21
|
+
*/
|
|
22
|
+
let yamlLock = Promise.resolve();
|
|
23
|
+
export function withYamlLock(fn) {
|
|
24
|
+
const prev = yamlLock;
|
|
25
|
+
// .then(success, failure) — continue even if the previous holder rejected,
|
|
26
|
+
// so a failure in one deploy doesn't poison the lock for the others.
|
|
27
|
+
const next = prev.then(() => fn(), () => fn());
|
|
28
|
+
yamlLock = next.catch(() => { }); // swallow on the shared chain; caller still gets the original
|
|
29
|
+
return next;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Atomic write: write payload to a temp sibling → chmod the temp to 0o600
|
|
33
|
+
* → rename over the target. The chmod-before-rename order eliminates a
|
|
34
|
+
* window where the target file could be observable with default umask
|
|
35
|
+
* perms (typically 0o644) while carrying the private key.
|
|
36
|
+
*/
|
|
37
|
+
function atomicWriteYaml(path, content) {
|
|
38
|
+
const tmpPath = `${path}.tmp.${randomUUID().slice(0, 8)}`;
|
|
39
|
+
writeFileSync(tmpPath, content, { mode: 0o600 });
|
|
40
|
+
chmodSync(tmpPath, 0o600); // defense in depth in case umask filtered the open mode
|
|
41
|
+
renameSync(tmpPath, path);
|
|
42
|
+
}
|
|
43
|
+
/** Add the deploy's profile to ~/.aptos/config.yaml. Creates the file if absent. */
|
|
44
|
+
export async function addProfile(configPath, name, data) {
|
|
45
|
+
const configDir = dirname(configPath);
|
|
46
|
+
if (!existsSync(configDir)) {
|
|
47
|
+
mkdirSync(configDir, { recursive: true, mode: 0o700 });
|
|
48
|
+
}
|
|
49
|
+
let yamlObj = {};
|
|
50
|
+
if (existsSync(configPath)) {
|
|
51
|
+
const raw = await readFile(configPath, "utf-8");
|
|
52
|
+
yamlObj = yaml.load(raw) || {};
|
|
53
|
+
}
|
|
54
|
+
if (!yamlObj.profiles)
|
|
55
|
+
yamlObj.profiles = {};
|
|
56
|
+
yamlObj.profiles[name] = data;
|
|
57
|
+
atomicWriteYaml(configPath, yaml.dump(yamlObj));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Remove the deploy's profile from ~/.aptos/config.yaml. Idempotent —
|
|
61
|
+
* a missing file or missing profile is a no-op. If removal leaves the
|
|
62
|
+
* yaml with only an empty `profiles:` block, the whole file is unlinked
|
|
63
|
+
* to preserve the "didn't exist before" semantic for the first-ever deploy.
|
|
64
|
+
*/
|
|
65
|
+
export async function removeProfile(configPath, name) {
|
|
66
|
+
if (!existsSync(configPath))
|
|
67
|
+
return;
|
|
68
|
+
const raw = await readFile(configPath, "utf-8");
|
|
69
|
+
const yamlObj = yaml.load(raw) || {};
|
|
70
|
+
if (!yamlObj.profiles || !(name in yamlObj.profiles))
|
|
71
|
+
return;
|
|
72
|
+
delete yamlObj.profiles[name];
|
|
73
|
+
const profilesEmpty = Object.keys(yamlObj.profiles).length === 0;
|
|
74
|
+
const onlyProfilesKey = Object.keys(yamlObj).length === 1 && "profiles" in yamlObj;
|
|
75
|
+
if (profilesEmpty && onlyProfilesKey) {
|
|
76
|
+
// We created this file fresh; remove it.
|
|
77
|
+
try {
|
|
78
|
+
unlinkSync(configPath);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// best-effort
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
atomicWriteYaml(configPath, yaml.dump(yamlObj));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Synchronous twin of `removeProfile` for the SIGINT/SIGTERM handler.
|
|
89
|
+
* The event loop is dead by the time the handler runs — we cannot
|
|
90
|
+
* await. Bypasses the async mutex because signal handlers are
|
|
91
|
+
* sequential by construction; the operation is idempotent so a
|
|
92
|
+
* benign double-delete (handler then finally, or vice versa) is fine.
|
|
93
|
+
*/
|
|
94
|
+
export function removeProfileSync(configPath, name) {
|
|
95
|
+
try {
|
|
96
|
+
if (!existsSync(configPath))
|
|
97
|
+
return;
|
|
98
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
99
|
+
const yamlObj = yaml.load(raw) || {};
|
|
100
|
+
if (!yamlObj.profiles || !(name in yamlObj.profiles))
|
|
101
|
+
return;
|
|
102
|
+
delete yamlObj.profiles[name];
|
|
103
|
+
const profilesEmpty = Object.keys(yamlObj.profiles).length === 0;
|
|
104
|
+
const onlyProfilesKey = Object.keys(yamlObj).length === 1 && "profiles" in yamlObj;
|
|
105
|
+
if (profilesEmpty && onlyProfilesKey) {
|
|
106
|
+
unlinkSync(configPath);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
atomicWriteYaml(configPath, yaml.dump(yamlObj));
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Signal handlers should never throw — swallow and exit. Better to
|
|
113
|
+
// leave a stale profile (recoverable by re-running the deploy) than
|
|
114
|
+
// to crash the parent process mid-shutdown.
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Process-level signal handling. A single registered handler iterates
|
|
119
|
+
* the per-deploy cleanup callbacks. Install-once because multiple
|
|
120
|
+
* concurrent deploys share the same parent process — installing per
|
|
121
|
+
* deploy would re-add the listener and exceed Node's max-listeners
|
|
122
|
+
* warning threshold under heavy parallelism.
|
|
123
|
+
*/
|
|
124
|
+
export const cleanupCallbacks = new Set();
|
|
125
|
+
let signalHandlerInstalled = false;
|
|
126
|
+
export function ensureSignalHandler() {
|
|
127
|
+
if (signalHandlerInstalled)
|
|
128
|
+
return;
|
|
129
|
+
signalHandlerInstalled = true;
|
|
130
|
+
const handler = (sig) => {
|
|
131
|
+
// Synchronous cleanup of every active deploy's profile entry.
|
|
132
|
+
for (const cb of [...cleanupCallbacks]) {
|
|
133
|
+
try {
|
|
134
|
+
cb();
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
/* sync best-effort */
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Defer the actual exit one tick so other listeners (vitest's own
|
|
141
|
+
// SIGINT handler, app-level shutdown hooks) still get to run.
|
|
142
|
+
// Without this we'd stomp on vitest's afterEach if a dev Ctrl+C'd
|
|
143
|
+
// a test run mid-suite.
|
|
144
|
+
const code = sig === "SIGTERM" ? 143 : 130;
|
|
145
|
+
setImmediate(() => process.exit(code));
|
|
146
|
+
};
|
|
147
|
+
process.on("SIGINT", handler);
|
|
148
|
+
process.on("SIGTERM", handler);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=movementProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movementProfile.js","sourceRoot":"","sources":["../../src/core/movementProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH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AAmB,EAAE,EAAE;QACtC,8DAA8D;QAC9D,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,gBAAgB,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC;gBACH,EAAE,EAAE,CAAC;YACP,CAAC;YAAC,MAAM,CAAC;gBACP,sBAAsB;YACxB,CAAC;QACH,CAAC;QACD,kEAAkE;QAClE,8DAA8D;QAC9D,kEAAkE;QAClE,wBAAwB;QACxB,MAAM,IAAI,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3C,YAAY,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/core/shell.d.ts
CHANGED
|
@@ -7,19 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function escapeShellArg(arg: string): string;
|
|
9
9
|
/**
|
|
10
|
-
* Validates that a path is safe (no command injection characters)
|
|
11
|
-
*
|
|
10
|
+
* Validates that a path is safe (no command injection characters) and
|
|
11
|
+
* returns it unchanged. Use this for callers that pass paths to spawn-with-
|
|
12
|
+
* args (no shell), where shell quoting would be incorrect.
|
|
12
13
|
*
|
|
13
|
-
* @param path - The path to validate
|
|
14
|
+
* @param path - The path to validate
|
|
14
15
|
* @param name - Name for error messages (e.g., "package directory")
|
|
16
|
+
* @returns The original path, after validation
|
|
17
|
+
*/
|
|
18
|
+
export declare function validatePathSafety(path: string, name?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Validates a path and returns the shell-escaped form. Wraps
|
|
21
|
+
* `validatePathSafety` for callers that pass paths into shell-style
|
|
22
|
+
* commands (e.g. `exec`).
|
|
23
|
+
*
|
|
24
|
+
* @param path - The path to validate and escape
|
|
25
|
+
* @param name - Name for error messages
|
|
15
26
|
* @returns The escaped path safe for shell execution
|
|
16
27
|
*/
|
|
17
28
|
export declare function validateAndEscapePath(path: string, name?: string): string;
|
|
18
29
|
/**
|
|
19
|
-
* Validates that a profile name is safe
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
30
|
+
* Validates that a profile name is safe and returns it unchanged. Mirrors
|
|
31
|
+
* `validatePathSafety` — use this for callers that pass the profile to
|
|
32
|
+
* spawn-with-args (no shell), where shell quoting would be incorrect.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateProfileSafety(profile: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Validates a profile and returns the shell-escaped form. Wraps
|
|
37
|
+
* `validateProfileSafety` for callers that pass the profile into shell-style
|
|
38
|
+
* commands (e.g. `exec`).
|
|
23
39
|
*/
|
|
24
40
|
export declare function validateAndEscapeProfile(profile: string): string;
|
|
25
41
|
//# sourceMappingURL=shell.d.ts.map
|
package/dist/core/shell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/core/shell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/core/shell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAe,GAAG,MAAM,CAgB9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAe,GAAG,MAAM,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAc7D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/core/shell.js
CHANGED
|
@@ -14,43 +14,61 @@ export function escapeShellArg(arg) {
|
|
|
14
14
|
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Validates that a path is safe (no command injection characters)
|
|
18
|
-
*
|
|
17
|
+
* Validates that a path is safe (no command injection characters) and
|
|
18
|
+
* returns it unchanged. Use this for callers that pass paths to spawn-with-
|
|
19
|
+
* args (no shell), where shell quoting would be incorrect.
|
|
19
20
|
*
|
|
20
|
-
* @param path - The path to validate
|
|
21
|
+
* @param path - The path to validate
|
|
21
22
|
* @param name - Name for error messages (e.g., "package directory")
|
|
22
|
-
* @returns The
|
|
23
|
+
* @returns The original path, after validation
|
|
23
24
|
*/
|
|
24
|
-
export function
|
|
25
|
+
export function validatePathSafety(path, name = "path") {
|
|
25
26
|
if (!path || typeof path !== "string") {
|
|
26
27
|
throw new Error(`Invalid ${name}: must be a non-empty string`);
|
|
27
28
|
}
|
|
28
|
-
// Check for obvious command injection attempts
|
|
29
|
+
// Check for obvious command injection attempts.
|
|
29
30
|
const dangerousChars = /[;&|`$(){}[\]<>]/;
|
|
30
31
|
if (dangerousChars.test(path)) {
|
|
31
32
|
throw new Error(`Invalid ${name}: "${path}"\n` +
|
|
32
33
|
`Path contains potentially dangerous characters.\n` +
|
|
33
34
|
`Allowed characters: letters, numbers, ., -, _, /, \\, spaces`);
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
return escapeShellArg(path);
|
|
36
|
+
return path;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Validates
|
|
39
|
+
* Validates a path and returns the shell-escaped form. Wraps
|
|
40
|
+
* `validatePathSafety` for callers that pass paths into shell-style
|
|
41
|
+
* commands (e.g. `exec`).
|
|
40
42
|
*
|
|
41
|
-
* @param
|
|
42
|
-
* @
|
|
43
|
+
* @param path - The path to validate and escape
|
|
44
|
+
* @param name - Name for error messages
|
|
45
|
+
* @returns The escaped path safe for shell execution
|
|
43
46
|
*/
|
|
44
|
-
export function
|
|
47
|
+
export function validateAndEscapePath(path, name = "path") {
|
|
48
|
+
return escapeShellArg(validatePathSafety(path, name));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validates that a profile name is safe and returns it unchanged. Mirrors
|
|
52
|
+
* `validatePathSafety` — use this for callers that pass the profile to
|
|
53
|
+
* spawn-with-args (no shell), where shell quoting would be incorrect.
|
|
54
|
+
*/
|
|
55
|
+
export function validateProfileSafety(profile) {
|
|
45
56
|
if (!profile || typeof profile !== "string") {
|
|
46
57
|
throw new Error("Invalid profile name: must be a non-empty string");
|
|
47
58
|
}
|
|
48
|
-
// Profile names should only contain alphanumeric, hyphens, underscores
|
|
49
59
|
const safePattern = /^[a-zA-Z0-9_-]+$/;
|
|
50
60
|
if (!safePattern.test(profile)) {
|
|
51
61
|
throw new Error(`Invalid profile name: "${profile}"\n` +
|
|
52
62
|
`Only alphanumeric characters, hyphens (-), and underscores (_) are allowed.`);
|
|
53
63
|
}
|
|
54
|
-
return
|
|
64
|
+
return profile;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates a profile and returns the shell-escaped form. Wraps
|
|
68
|
+
* `validateProfileSafety` for callers that pass the profile into shell-style
|
|
69
|
+
* commands (e.g. `exec`).
|
|
70
|
+
*/
|
|
71
|
+
export function validateAndEscapeProfile(profile) {
|
|
72
|
+
return escapeShellArg(validateProfileSafety(profile));
|
|
55
73
|
}
|
|
56
74
|
//# sourceMappingURL=shell.js.map
|
package/dist/core/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/core/shell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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AE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,WAAW,GAAG,kBAAkB,CAAC;IACvC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,0BAA0B,OAAO,KAAK;YACtC,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,OAAO,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -9,4 +9,39 @@ export declare class ModuleAlreadyDeployedError extends Error {
|
|
|
9
9
|
readonly txHash?: string | undefined;
|
|
10
10
|
constructor(message: string, moduleName: string, network: string, address: string, timestamp: number, txHash?: string | undefined);
|
|
11
11
|
}
|
|
12
|
+
import type { DeploymentInfo } from './core/deployments.js';
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when the on-chain publish succeeded but a subsequent local
|
|
15
|
+
* step (saveDeployment, profile cleanup, etc.) failed.
|
|
16
|
+
*
|
|
17
|
+
* Distinct from `CliExecutionError`: by the time this error fires, the
|
|
18
|
+
* module IS deployed on-chain. Callers that want to recover can read
|
|
19
|
+
* `deployment` and re-attempt the local-side persistence manually
|
|
20
|
+
* (e.g. write the JSON to `deployments/{network}/{moduleName}.json`).
|
|
21
|
+
*
|
|
22
|
+
* Without this distinction, the same outer catch would surface a
|
|
23
|
+
* post-publish filesystem failure as "Failed to publish module",
|
|
24
|
+
* inviting an accidental redeploy that wastes gas.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PostPublishError extends Error {
|
|
27
|
+
readonly deployment: DeploymentInfo;
|
|
28
|
+
readonly cause: Error;
|
|
29
|
+
constructor(message: string, deployment: DeploymentInfo, cause: Error);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown by runCli when a spawned process exits with a non-zero status.
|
|
33
|
+
*
|
|
34
|
+
* `stderr`, `stdoutPreview`, and each entry in `args` are redacted of
|
|
35
|
+
* well-known secret shapes (private keys, etc.) in the constructor, so the
|
|
36
|
+
* error is safe to log regardless of how it was raised. Redaction is
|
|
37
|
+
* idempotent.
|
|
38
|
+
*/
|
|
39
|
+
export declare class CliExecutionError extends Error {
|
|
40
|
+
readonly command: string;
|
|
41
|
+
readonly exitCode: number;
|
|
42
|
+
readonly stderr: string;
|
|
43
|
+
readonly stdoutPreview: string;
|
|
44
|
+
readonly args: readonly string[];
|
|
45
|
+
constructor(message: string, command: string, args: readonly string[], exitCode: number, stderr: string, stdoutPreview: string);
|
|
46
|
+
}
|
|
12
47
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAGjC,UAAU,EAAE,MAAM;aAClB,OAAO,EAAE,MAAM;aACf,OAAO,EAAE,MAAM;aACf,SAAS,EAAE,MAAM;aACjB,MAAM,CAAC,EAAE,MAAM;gBAL/B,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,YAAA;CAUlC"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAGjC,UAAU,EAAE,MAAM;aAClB,OAAO,EAAE,MAAM;aACf,OAAO,EAAE,MAAM;aACf,SAAS,EAAE,MAAM;aACjB,MAAM,CAAC,EAAE,MAAM;gBAL/B,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,YAAA;CAUlC;AAGD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aAGvB,UAAU,EAAE,cAAc;aAC1B,KAAK,EAAE,KAAK;gBAF5B,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,KAAK;CAS/B;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;aAKxB,OAAO,EAAE,MAAM;aAEf,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,MAAM;aACd,aAAa,EAAE,MAAM;IARvC,SAAgB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;gBAGtC,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,MAAM,EAC/B,IAAI,EAAE,SAAS,MAAM,EAAE,EACP,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM;CAUxC"}
|
package/dist/errors.js
CHANGED
|
@@ -21,4 +21,58 @@ export class ModuleAlreadyDeployedError extends Error {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
import { redactSecrets } from './utils/redact.js';
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when the on-chain publish succeeded but a subsequent local
|
|
27
|
+
* step (saveDeployment, profile cleanup, etc.) failed.
|
|
28
|
+
*
|
|
29
|
+
* Distinct from `CliExecutionError`: by the time this error fires, the
|
|
30
|
+
* module IS deployed on-chain. Callers that want to recover can read
|
|
31
|
+
* `deployment` and re-attempt the local-side persistence manually
|
|
32
|
+
* (e.g. write the JSON to `deployments/{network}/{moduleName}.json`).
|
|
33
|
+
*
|
|
34
|
+
* Without this distinction, the same outer catch would surface a
|
|
35
|
+
* post-publish filesystem failure as "Failed to publish module",
|
|
36
|
+
* inviting an accidental redeploy that wastes gas.
|
|
37
|
+
*/
|
|
38
|
+
export class PostPublishError extends Error {
|
|
39
|
+
deployment;
|
|
40
|
+
cause;
|
|
41
|
+
constructor(message, deployment, cause) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.deployment = deployment;
|
|
44
|
+
this.cause = cause;
|
|
45
|
+
this.name = 'PostPublishError';
|
|
46
|
+
if (Error.captureStackTrace) {
|
|
47
|
+
Error.captureStackTrace(this, PostPublishError);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thrown by runCli when a spawned process exits with a non-zero status.
|
|
53
|
+
*
|
|
54
|
+
* `stderr`, `stdoutPreview`, and each entry in `args` are redacted of
|
|
55
|
+
* well-known secret shapes (private keys, etc.) in the constructor, so the
|
|
56
|
+
* error is safe to log regardless of how it was raised. Redaction is
|
|
57
|
+
* idempotent.
|
|
58
|
+
*/
|
|
59
|
+
export class CliExecutionError extends Error {
|
|
60
|
+
command;
|
|
61
|
+
exitCode;
|
|
62
|
+
stderr;
|
|
63
|
+
stdoutPreview;
|
|
64
|
+
args;
|
|
65
|
+
constructor(message, command, args, exitCode, stderr, stdoutPreview) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.command = command;
|
|
68
|
+
this.exitCode = exitCode;
|
|
69
|
+
this.stderr = stderr;
|
|
70
|
+
this.stdoutPreview = stdoutPreview;
|
|
71
|
+
this.name = 'CliExecutionError';
|
|
72
|
+
this.args = args.map(redactSecrets);
|
|
73
|
+
if (Error.captureStackTrace) {
|
|
74
|
+
Error.captureStackTrace(this, CliExecutionError);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
24
78
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAGjC;IACA;IACA;IACA;IACA;IANlB,YACE,OAAe,EACC,UAAkB,EAClB,OAAe,EACf,OAAe,EACf,SAAiB,EACjB,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QANC,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QAEzC,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,0BAA0B,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAGjC;IACA;IACA;IACA;IACA;IANlB,YACE,OAAe,EACC,UAAkB,EAClB,OAAe,EACf,OAAe,EACf,SAAiB,EACjB,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QANC,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QAEzC,qFAAqF;QACrF,IAAI,KAAK,CAAC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