@autifyhq/autify-cli 0.10.1 → 0.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.
@@ -1 +1 @@
1
- {"version":"0.10.1","commands":{"connect:access-point:create":{"id":"connect:access-point:create","description":"[Experimental] Create an Autify Connect Access Point","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> --name NAME --web-workspace-id ID"],"flags":{"name":{"name":"name","type":"option","description":"Name of Autify Connect Access Point to be created","required":true,"multiple":false},"web-workspace-id":{"name":"web-workspace-id","type":"option","description":"Workspace ID of Autify for Web to which the Access Point belong","multiple":false}},"args":[]},"connect:access-point:set":{"id":"connect:access-point:set","description":"[Experimental] Set Autify Connect Access Point","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %> --name=NAME","Reading the key from file:\n<%= config.bin %> <%= command.id %> --name=NAME < key.txt"],"flags":{"name":{"name":"name","type":"option","description":"Name of the Autify Connect Access Point already created","required":true,"multiple":false}},"args":[]},"connect:client:install":{"id":"connect:client:install","description":"[Experimental] Install Autify Connect Client","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["(Recommended) Install the supported version:\n<%= config.bin %> <%= command.id %>","Install a specific version:\n<%= config.bin %> <%= command.id %> v0.6.1","Install a stable version:\n<%= config.bin %> <%= command.id %> stable"],"flags":{},"args":[{"name":"version","description":"Specify the target version of Autify Connect Client.","default":"v0.6.2"}]},"connect:client:start":{"id":"connect:client:start","description":"[Experimental] Start Autify Connect Client","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"verbose":{"name":"verbose","type":"boolean","description":"Make the operation more talkative.","allowNo":false},"file-logging":{"name":"file-logging","type":"boolean","description":"Logging Autify Connect Client log to a file instead of console.","allowNo":false},"debug-server-port":{"name":"debug-server-port","type":"option","description":"[default: 3000] The server for debugging and monitoring launches on your local machine on the given port.","multiple":false},"web-workspace-id":{"name":"web-workspace-id","type":"option","description":"Workspace ID of Autify for Web to create an ephemeral Access Point. If not specified, it will use the one configured by `autify connect access-point set`, instead.","multiple":false}},"args":[]},"mobile:api:describe-test-result":{"id":"mobile:api:describe-test-result","description":"Get a test result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the test results will be obtained.","required":true,"multiple":false},"id":{"name":"id","type":"option","description":"Test Result ID.","required":true,"multiple":false}},"args":[]},"mobile:api:list-test-results":{"id":"mobile:api:list-test-results","description":"List test results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the list of test results will be retrieved.","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"Page number to be retrieved.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"Number of test results per page.","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"ID of the test plan.","required":false,"multiple":false}},"args":[]},"mobile:api:run-test-plan":{"id":"mobile:api:run-test-plan","description":"Run a test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"The ID of the test plan to run.","required":true,"multiple":false},"run-test-plan-request":{"name":"run-test-plan-request","type":"option","description":"The build_id to execute the test plan.","required":true,"multiple":false}},"args":[]},"mobile:api:upload-build":{"id":"mobile:api:upload-build","description":"Upload the build file.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"The ID of the project to upload the build file to.","required":true,"multiple":false},"file":{"name":"file","type":"option","description":"Build file.","required":true,"multiple":false}},"args":[]},"mobile:auth:login":{"id":"mobile:auth:login","description":"Login to Autify for Mobile","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"mobile:build:upload":{"id":"mobile:build:upload","description":"Upload a build file","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>","Upload build file\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app","Upload build file (JSON output)\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app --json"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"workspace-id":{"name":"workspace-id","type":"option","char":"w","description":"Workspace ID to upload the build file","required":true,"multiple":false}},"args":[{"name":"build-path","description":"File path to the iOS app (*.app) or Android app (*.apk).","required":true}],"_enableJsonFlag":true,"_globalFlags":{"json":{"description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false,"type":"boolean"}}},"mobile:test:run":{"id":"mobile:test:run","description":"Run a test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test plan with a build ID:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run a test plan with a new build file:\n<%= config.bin %> <%= command.id %> --build-path ./my.[app|apk] https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run and wait a test plan:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB --wait --timeout 600"],"flags":{"build-id":{"name":"build-id","type":"option","description":"ID of the already uploaded build.","multiple":false,"exclusive":["build-path"]},"build-path":{"name":"build-path","type":"option","description":"File path to the iOS app (*.app) or Android app (*.apk).","multiple":false,"exclusive":["build-id"]},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"max-retry-count":{"name":"max-retry-count","type":"option","description":"Maximum retry count. The command can take up to timeout * (max-retry-count + 1).","multiple":false,"default":0}},"args":[{"name":"test-plan-url","description":"Test plan URL e.g. https://mobile-app.autify.com/projects/<ID>/test_plans/<ID>","required":true}]},"mobile:test:wait":{"id":"mobile:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://mobile-app.autify.com/projects/AAA/results/BBB"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://mobile-app.autify.com/projects/<ID>/results/<ID>","required":true}]},"web:api:create-url-replacement":{"id":"web:api:create-url-replacement","description":"Create a new url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"create-url-replacement-request":{"name":"create-url-replacement-request","type":"option","description":"The url to replace","required":true,"multiple":false}},"args":[]},"web:api:delete-url-replacement":{"id":"web:api:delete-url-replacement","description":"Delete a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false}},"args":[]},"web:api:describe-result":{"id":"web:api:describe-result","description":"Get a result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false},"result-id":{"name":"result-id","type":"option","description":"For example, 4 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false}},"args":[]},"web:api:describe-scenario":{"id":"web:api:describe-scenario","description":"Get a scenario.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false},"scenario-id":{"name":"scenario-id","type":"option","description":"For example, 2 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false}},"args":[]},"web:api:execute-scenarios":{"id":"web:api:execute-scenarios","description":"You can execute any scenarios in your workspace using any execution environments (which is called \"capabilities\" here).","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"execute-scenarios-request":{"name":"execute-scenarios-request","type":"option","description":"The scenarios and settings to execute","required":true,"multiple":false}},"args":[]},"web:api:execute-schedule":{"id":"web:api:execute-schedule","description":"Run a test plan. (Note: \"Schedule\" is called as \"TestPlan\" now.)","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"schedule-id":{"name":"schedule-id","type":"option","description":"For example, 3 for the following URL: https://app.autify.com/projects/1/test_plans/3","required":true,"multiple":false}},"args":[]},"web:api:list-capabilities":{"id":"web:api:list-capabilities","description":"List available Capabilities.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities","required":true,"multiple":false},"os":{"name":"os","type":"option","description":"os name to filter","required":false,"multiple":false},"browser":{"name":"browser","type":"option","description":"browser name to filter","required":false,"multiple":false},"device-type":{"name":"device-type","type":"option","description":"device_type name to filter","required":false,"multiple":false}},"args":[]},"web:api:list-results":{"id":"web:api:list-results","description":"List results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"The number of items returns. Default number is 30 and up to a maximum of 100","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"Test plan ID used to filter results.","required":false,"multiple":false}},"args":[]},"web:api:list-scenarios":{"id":"web:api:list-scenarios","description":"List scenarios.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false}},"args":[]},"web:api:list-url-replacements":{"id":"web:api:list-url-replacements","description":"List url replacements for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false}},"args":[]},"web:api:update-url-replacement":{"id":"web:api:update-url-replacement","description":"Update a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false},"update-url-replacement-request":{"name":"update-url-replacement-request","type":"option","description":"The url to replace. Either pattern_url or replacement_url is required.","required":true,"multiple":false}},"args":[]},"web:auth:login":{"id":"web:auth:login","description":"Login to Autify for Web","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"web:test:run":{"id":"web:test:run","description":"Run a scenario or test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test scenario (Default capability):\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000","Run a test plan:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/test_plans/0000","Run and wait a test scenario:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --timeout 600","Run a test scenario with a specific capability:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --os \"Windows Server\" --browser Edge","With URL replacements:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 -r http://example.com=http://example.net -r http://example.org=http://example.net","Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name \"Sample execution\"","Run a test scenario with Autify Connect:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --autify-connect NAME"],"flags":{"name":{"name":"name","type":"option","char":"n","description":"Name of the test execution. (Only for test scenario execution.)","multiple":false},"url-replacements":{"name":"url-replacements","type":"option","char":"r","description":"URL replacements. Example: http://example.com=http://example.net","multiple":true},"autify-connect":{"name":"autify-connect","type":"option","description":"Name of the Autify Connect Access Point (Only for test scenario execution.)","multiple":false,"exclusive":["autify-connect-client"]},"autify-connect-client":{"name":"autify-connect-client","type":"boolean","description":"[Experimental] Start Autify Connect Client (Only for test scenario execution.)","allowNo":false,"dependsOn":["wait"],"exclusive":["autify-connect"]},"autify-connect-client-verbose":{"name":"autify-connect-client-verbose","type":"boolean","description":"[Experimental] Verbose output for Autify Connect Client (Only for test scenario execution.)","allowNo":false,"dependsOn":["autify-connect-client"]},"autify-connect-client-file-logging":{"name":"autify-connect-client-file-logging","type":"boolean","description":"[Experimental] Logging Autify Connect Client log to a file instead of console.","allowNo":false,"dependsOn":["autify-connect-client"]},"autify-connect-client-debug-server-port":{"name":"autify-connect-client-debug-server-port","type":"option","description":"[Experimental] [default: 3000] Port for Autify Connect Client debug server.","multiple":false,"dependsOn":["autify-connect-client"]},"os":{"name":"os","type":"option","description":"OS to run the test","multiple":false},"os-version":{"name":"os-version","type":"option","description":"OS version to run the test","multiple":false},"browser":{"name":"browser","type":"option","description":"Browser to run the test","multiple":false},"device":{"name":"device","type":"option","description":"Device to run the test","multiple":false},"device-type":{"name":"device-type","type":"option","description":"Device type to run the test","multiple":false},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"max-retry-count":{"name":"max-retry-count","type":"option","description":"Maximum retry count. The command can take up to timeout * (max-retry-count + 1).","multiple":false,"default":0}},"args":[{"name":"scenario-or-test-plan-url","description":"Scenario URL or Test plan URL e.g. https://app.autify.com/projects/<ID>/(scenarios|test_plans)/<ID>","required":true}]},"web:test:wait":{"id":"web:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/results/0000"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://app.autify.com/projects/<ID>/results/<ID>","required":true}]}}}
1
+ {"version":"0.11.0","commands":{"connect:access-point:create":{"id":"connect:access-point:create","description":"Create an Autify Connect Access Point","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> --name NAME --web-workspace-id ID"],"flags":{"name":{"name":"name","type":"option","description":"Name of Autify Connect Access Point to be created","required":true,"multiple":false},"web-workspace-id":{"name":"web-workspace-id","type":"option","description":"Workspace ID of Autify for Web to which the Access Point will belong","multiple":false}},"args":[]},"connect:access-point:set":{"id":"connect:access-point:set","description":"Set Autify Connect Access Point","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %> --name=NAME","Reading the key from file:\n<%= config.bin %> <%= command.id %> --name=NAME < key.txt"],"flags":{"name":{"name":"name","type":"option","description":"Name of the Autify Connect Access Point already created","required":true,"multiple":false}},"args":[]},"connect:client:install":{"id":"connect:client:install","description":"Install Autify Connect Client","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["(Recommended) Install the supported version:\n<%= config.bin %> <%= command.id %>","Install a specific version:\n<%= config.bin %> <%= command.id %> v0.6.1","Install a stable version:\n<%= config.bin %> <%= command.id %> stable"],"flags":{},"args":[{"name":"version","description":"Specify the target version of Autify Connect Client.","default":"v0.6.3"}]},"connect:client:start":{"id":"connect:client:start","description":"Start Autify Connect Client","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["With pre-created Access Point:\n<%= config.bin %> <%= command.id %>","With ephemeral Access Point of Autify for Web:\n<%= config.bin %> <%= command.id %> --web-workspace-id 000"],"flags":{"verbose":{"name":"verbose","type":"boolean","description":"Make the operation more talkative.","allowNo":false},"file-logging":{"name":"file-logging","type":"boolean","description":"Logging Autify Connect Client log to a file instead of console.","allowNo":false},"debug-server-port":{"name":"debug-server-port","type":"option","description":"The server for debugging and monitoring launches on your local machine on the given port. It will use a radom port if not specified.","multiple":false},"web-workspace-id":{"name":"web-workspace-id","type":"option","description":"Workspace ID of Autify for Web to create an ephemeral Access Point. If not specified, it will use the one configured by `autify connect access-point create/set`, instead.","multiple":false}},"args":[]},"mobile:api:describe-test-result":{"id":"mobile:api:describe-test-result","description":"Get a test result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the test results will be obtained.","required":true,"multiple":false},"id":{"name":"id","type":"option","description":"Test Result ID.","required":true,"multiple":false}},"args":[]},"mobile:api:list-test-results":{"id":"mobile:api:list-test-results","description":"List test results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the list of test results will be retrieved.","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"Page number to be retrieved.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"Number of test results per page.","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"ID of the test plan.","required":false,"multiple":false}},"args":[]},"mobile:api:run-test-plan":{"id":"mobile:api:run-test-plan","description":"Run a test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"The ID of the test plan to run.","required":true,"multiple":false},"run-test-plan-request":{"name":"run-test-plan-request","type":"option","description":"The build_id to execute the test plan.","required":true,"multiple":false}},"args":[]},"mobile:api:upload-build":{"id":"mobile:api:upload-build","description":"Upload the build file.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"The ID of the project to upload the build file to.","required":true,"multiple":false},"file":{"name":"file","type":"option","description":"Build file.","required":true,"multiple":false}},"args":[]},"mobile:auth:login":{"id":"mobile:auth:login","description":"Login to Autify for Mobile","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"mobile:build:upload":{"id":"mobile:build:upload","description":"Upload a build file","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>","Upload build file\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app","Upload build file (JSON output)\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app --json"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"workspace-id":{"name":"workspace-id","type":"option","char":"w","description":"Workspace ID to upload the build file","required":true,"multiple":false}},"args":[{"name":"build-path","description":"File path to the iOS app (*.app) or Android app (*.apk).","required":true}],"_enableJsonFlag":true,"_globalFlags":{"json":{"description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false,"type":"boolean"}}},"mobile:test:run":{"id":"mobile:test:run","description":"Run a test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test plan with a build ID:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run a test plan with a new build file:\n<%= config.bin %> <%= command.id %> --build-path ./my.[app|apk] https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run and wait a test plan:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB --wait --timeout 600"],"flags":{"build-id":{"name":"build-id","type":"option","description":"ID of the already uploaded build.","multiple":false,"exclusive":["build-path"]},"build-path":{"name":"build-path","type":"option","description":"File path to the iOS app (*.app) or Android app (*.apk).","multiple":false,"exclusive":["build-id"]},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"max-retry-count":{"name":"max-retry-count","type":"option","description":"Maximum retry count. The command can take up to timeout * (max-retry-count + 1).","multiple":false,"default":0}},"args":[{"name":"test-plan-url","description":"Test plan URL e.g. https://mobile-app.autify.com/projects/<ID>/test_plans/<ID>","required":true}]},"mobile:test:wait":{"id":"mobile:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://mobile-app.autify.com/projects/AAA/results/BBB"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://mobile-app.autify.com/projects/<ID>/results/<ID>","required":true}]},"web:api:create-url-replacement":{"id":"web:api:create-url-replacement","description":"Create a new url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"create-url-replacement-request":{"name":"create-url-replacement-request","type":"option","description":"The url to replace","required":true,"multiple":false}},"args":[]},"web:api:delete-url-replacement":{"id":"web:api:delete-url-replacement","description":"Delete a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false}},"args":[]},"web:api:describe-result":{"id":"web:api:describe-result","description":"Get a result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false},"result-id":{"name":"result-id","type":"option","description":"For example, 4 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false}},"args":[]},"web:api:describe-scenario":{"id":"web:api:describe-scenario","description":"Get a scenario.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false},"scenario-id":{"name":"scenario-id","type":"option","description":"For example, 2 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false}},"args":[]},"web:api:execute-scenarios":{"id":"web:api:execute-scenarios","description":"You can execute any scenarios in your workspace using any execution environments (which is called \"capabilities\" here).","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"execute-scenarios-request":{"name":"execute-scenarios-request","type":"option","description":"The scenarios and settings to execute","required":true,"multiple":false}},"args":[]},"web:api:execute-schedule":{"id":"web:api:execute-schedule","description":"Run a test plan. (Note: \"Schedule\" is called as \"TestPlan\" now.)","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"schedule-id":{"name":"schedule-id","type":"option","description":"For example, 3 for the following URL: https://app.autify.com/projects/1/test_plans/3","required":true,"multiple":false}},"args":[]},"web:api:list-capabilities":{"id":"web:api:list-capabilities","description":"List available Capabilities.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities","required":true,"multiple":false},"os":{"name":"os","type":"option","description":"os name to filter","required":false,"multiple":false},"browser":{"name":"browser","type":"option","description":"browser name to filter","required":false,"multiple":false},"device-type":{"name":"device-type","type":"option","description":"device_type name to filter","required":false,"multiple":false}},"args":[]},"web:api:list-results":{"id":"web:api:list-results","description":"List results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"The number of items returns. Default number is 30 and up to a maximum of 100","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"Test plan ID used to filter results.","required":false,"multiple":false}},"args":[]},"web:api:list-scenarios":{"id":"web:api:list-scenarios","description":"List scenarios.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false}},"args":[]},"web:api:list-url-replacements":{"id":"web:api:list-url-replacements","description":"List url replacements for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false}},"args":[]},"web:api:update-url-replacement":{"id":"web:api:update-url-replacement","description":"Update a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false},"update-url-replacement-request":{"name":"update-url-replacement-request","type":"option","description":"The url to replace. Either pattern_url or replacement_url is required.","required":true,"multiple":false}},"args":[]},"web:auth:login":{"id":"web:auth:login","description":"Login to Autify for Web","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"web:test:run":{"id":"web:test:run","description":"Run a scenario or test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test scenario (Default capability):\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000","Run a test plan:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/test_plans/0000","Run and wait a test scenario:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --timeout 600","Run a test scenario with a specific capability:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --os \"Windows Server\" --browser Edge","With URL replacements:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 -r http://example.com=http://example.net -r http://example.org=http://example.net","Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name \"Sample execution\"","Run a test scenario with Autify Connect:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --autify-connect NAME","Run a test scenario with Autify Connect Client:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --autify-connect-client"],"flags":{"name":{"name":"name","type":"option","char":"n","description":"[Only for test scenario] Name of the test execution.","multiple":false},"url-replacements":{"name":"url-replacements","type":"option","char":"r","description":"URL replacements. Example: http://example.com=http://example.net","multiple":true},"autify-connect":{"name":"autify-connect","type":"option","description":"[Only for test scenario] Name of the Autify Connect Access Point.","multiple":false,"exclusive":["autify-connect-client"]},"autify-connect-client":{"name":"autify-connect-client","type":"boolean","description":"[Only for test scenario] Start Autify Connect Client","allowNo":false,"dependsOn":["wait"],"exclusive":["autify-connect"]},"autify-connect-client-verbose":{"name":"autify-connect-client-verbose","type":"boolean","description":"[Only for test scenario] Verbose output for Autify Connect Client.","allowNo":false,"dependsOn":["autify-connect-client"]},"autify-connect-client-file-logging":{"name":"autify-connect-client-file-logging","type":"boolean","description":"[Only for test scenario] Logging Autify Connect Client log to a file instead of console.","allowNo":false,"dependsOn":["autify-connect-client"]},"autify-connect-client-debug-server-port":{"name":"autify-connect-client-debug-server-port","type":"option","description":"[Only for test scenario] Port for Autify Connect Client debug server. A random port will be used if not specified.","multiple":false,"dependsOn":["autify-connect-client"]},"os":{"name":"os","type":"option","description":"[Only for test scenario] OS to run the test","multiple":false},"os-version":{"name":"os-version","type":"option","description":"[Only for test scenario] OS version to run the test","multiple":false},"browser":{"name":"browser","type":"option","description":"[Only for test scenario] Browser to run the test","multiple":false},"device":{"name":"device","type":"option","description":"[Only for test scenario] Device to run the test","multiple":false},"device-type":{"name":"device-type","type":"option","description":"[Only for test scenario] Device type to run the test","multiple":false},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"max-retry-count":{"name":"max-retry-count","type":"option","description":"Maximum retry count while waiting. The command can take up to `timeout * (max-retry-count + 1)`. Only effective with `--wait`.","multiple":false,"default":0}},"args":[{"name":"scenario-or-test-plan-url","description":"Scenario URL or Test plan URL e.g. https://app.autify.com/projects/<ID>/(scenarios|test_plans)/<ID>","required":true}]},"web:test:wait":{"id":"web:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/results/0000"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://app.autify.com/projects/<ID>/results/<ID>","required":true}]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autifyhq/autify-cli",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Autify Command Line Interface (CLI)",
5
5
  "author": "Autify",
6
6
  "bin": {
@@ -17,28 +17,31 @@
17
17
  "/oclif.manifest.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@autifyhq/autify-sdk": "^0.4.0",
20
+ "@autifyhq/autify-sdk": "^0.5.0",
21
21
  "@oclif/core": "^1",
22
22
  "@oclif/errors": "^1.3.5",
23
23
  "@oclif/plugin-help": "^5",
24
24
  "@oclif/plugin-not-found": "^2.3.1",
25
25
  "@oclif/plugin-update": "^3.0.0",
26
26
  "@oclif/plugin-warn-if-update-available": "^2.0.4",
27
+ "abort-controller": "^3.0.0",
27
28
  "archiver": "^5.3.1",
28
29
  "envfile": "^6.18.0",
30
+ "get-port": "^5.1.1",
29
31
  "inquirer": "^8.2.4",
30
- "is-running": "^2.1.0",
31
32
  "listr": "^0.14.3",
32
33
  "node-emoji": "^1.11.0",
33
34
  "node-fetch": "^2.6.7",
34
35
  "node-stream-zip": "^1.15.0",
35
36
  "per-env": "^1.0.2",
37
+ "tar": "^6.1.11",
36
38
  "tempy": "^3.0.0",
37
39
  "tsimportlib": "^0.0.3",
38
40
  "unzip-stream": "^0.3.1",
39
41
  "uuid": "^8.3.2",
40
42
  "which": "^2.0.2",
41
- "winston": "^3.8.2"
43
+ "winston": "^3.8.2",
44
+ "xstate": "^4.33.6"
42
45
  },
43
46
  "devDependencies": {
44
47
  "@autifyhq/autify-cli-integration-test": "*",
@@ -46,12 +49,12 @@
46
49
  "@types/archiver": "^5.3.1",
47
50
  "@types/chai": "^4",
48
51
  "@types/inquirer": "^8.2.1",
49
- "@types/is-running": "^2.1.0",
50
52
  "@types/listr": "^0.14.4",
51
53
  "@types/mocha": "^9.1.1",
52
- "@types/node": "^16.11.58",
53
- "@types/node-emoji": "^1.8.1",
54
+ "@types/node": "^16.11.59",
55
+ "@types/node-emoji": "^1.8.2",
54
56
  "@types/node-fetch": "^2.6.2",
57
+ "@types/tar": "^6.1.2",
55
58
  "@types/unzip-stream": "^0.3.1",
56
59
  "@types/uuid": "^8.3.4",
57
60
  "chai": "^4",
@@ -70,6 +73,7 @@
70
73
  "ts-morph": "^14.0.0",
71
74
  "ts-node": "^10.9.1",
72
75
  "tslib": "^2.4.0",
76
+ "typed-emitter": "^2.1.0",
73
77
  "typescript": "^4.7.4"
74
78
  },
75
79
  "oclif": {
@@ -1,28 +0,0 @@
1
- /// <reference types="node" />
2
- import { WebClient } from "@autifyhq/autify-sdk";
3
- declare type EphemeralAccessPoint = Readonly<{
4
- webClient: WebClient;
5
- workspaceId: number;
6
- }>;
7
- export declare const DEFAULT_CLIENT_DEBUG_SERVER_PORT = 3000;
8
- declare type ProcessExit = [code: number | null, signal: NodeJS.Signals | null];
9
- export declare type AutifyConnectClient = Readonly<{
10
- version: string;
11
- versionMismatchWarning?: string;
12
- logFile?: string;
13
- accessPointName: string;
14
- kill: () => Promise<void>;
15
- waitReady: () => Promise<void>;
16
- waitExit: () => Promise<[
17
- ...ProcessExit,
18
- ...[deletedAccessPointName?: string]
19
- ]>;
20
- }>;
21
- declare type SpawnClientOptions = Readonly<{
22
- verbose?: boolean;
23
- fileLogging?: boolean;
24
- debugServerPort?: number;
25
- ephemeralAccessPoint?: EphemeralAccessPoint;
26
- }>;
27
- export declare const spawnClient: (configDir: string, cacheDir: string, errorHandler: (error: Error) => void, { verbose, fileLogging, debugServerPort, ephemeralAccessPoint, }: SpawnClientOptions) => Promise<AutifyConnectClient>;
28
- export {};
@@ -1,192 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.spawnClient = exports.DEFAULT_CLIENT_DEBUG_SERVER_PORT = void 0;
4
- const tslib_1 = require("tslib");
5
- /* eslint-disable unicorn/filename-case */
6
- const errors_1 = require("@oclif/errors");
7
- const installClient_1 = require("./installClient");
8
- const node_readline_1 = require("node:readline");
9
- const node_events_1 = require("node:events");
10
- const winston_1 = require("winston");
11
- const node_path_1 = require("node:path");
12
- const config_1 = require("../../config");
13
- const uuid_1 = require("uuid");
14
- const node_process_1 = require("node:process");
15
- const node_child_process_1 = require("node:child_process");
16
- const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
17
- const promises_1 = require("node:timers/promises");
18
- const is_running_1 = tslib_1.__importDefault(require("is-running"));
19
- const EPHEMERAL_ACCESS_POINT_NAME_PREFIX = "autify-cli-";
20
- const logger = (0, winston_1.createLogger)({
21
- level: "debug",
22
- });
23
- const getOrCreateAccessPoint = async (configDir, ephemeralAccessPoint) => {
24
- if (!ephemeralAccessPoint) {
25
- const accessPointName = (0, config_1.get)(configDir, "AUTIFY_CONNECT_ACCESS_POINT_NAME");
26
- const accessPointKey = (0, config_1.get)(configDir, "AUTIFY_CONNECT_ACCESS_POINT_KEY");
27
- if (!accessPointName || !accessPointKey)
28
- throw new errors_1.CLIError("Access Point is not set. Run `autify connect access-point set` first.");
29
- return { accessPointName, accessPointKey };
30
- }
31
- const { webClient, workspaceId } = ephemeralAccessPoint;
32
- const name = `${EPHEMERAL_ACCESS_POINT_NAME_PREFIX}${(0, uuid_1.v4)()}`;
33
- const { name: accessPointName, key: accessPointKey } = (await webClient.createAccessPoint(workspaceId, { name })).data;
34
- return { accessPointName, accessPointKey };
35
- };
36
- const deleteAccessPointIfPossible = async (accessPointName, ephemeralAccessPoint) => {
37
- if (!ephemeralAccessPoint)
38
- return;
39
- if (!accessPointName.startsWith(EPHEMERAL_ACCESS_POINT_NAME_PREFIX))
40
- return;
41
- const { webClient, workspaceId } = ephemeralAccessPoint;
42
- try {
43
- await webClient.deleteAccessPoint(workspaceId, { name: accessPointName });
44
- return accessPointName;
45
- }
46
- catch {
47
- // Ignore errors since this is best effort.
48
- }
49
- };
50
- const logFormat = (prefix) => winston_1.format.combine(winston_1.format.colorize(), winston_1.format.timestamp(), winston_1.format.align(), winston_1.format.printf(({ timestamp, level, message }) => `${prefix !== null && prefix !== void 0 ? prefix : ""}${timestamp} ${level} ${message}`));
51
- const setupLogger = (logFile) => {
52
- if (logFile) {
53
- logger.add(new winston_1.transports.File({
54
- filename: logFile,
55
- format: logFormat(),
56
- }));
57
- }
58
- else {
59
- logger.add(new winston_1.transports.Console({
60
- format: logFormat("[Autify Connect Client] "),
61
- }));
62
- }
63
- };
64
- const onLogMsg = (input, handler) => {
65
- return (0, node_readline_1.createInterface)({
66
- input,
67
- crlfDelay: Number.POSITIVE_INFINITY,
68
- }).on("line", (line) => {
69
- let msg = line;
70
- try {
71
- const log = JSON.parse(line);
72
- msg = log.msg;
73
- logger.log(log.level, log.msg);
74
- }
75
- finally {
76
- handler(msg);
77
- }
78
- });
79
- };
80
- exports.DEFAULT_CLIENT_DEBUG_SERVER_PORT = 3000;
81
- const requestDebugServer = async (port, path, method = "GET") => {
82
- const response = await (0, node_fetch_1.default)(`http://localhost:${port}${path}`, { method });
83
- if (response.ok)
84
- return response.json();
85
- throw new errors_1.CLIError(`Request to debug server failed: ${method} ${path} => ${response.status} ${response.statusText}`);
86
- };
87
- const requestDebugServerStatus = async (port) => {
88
- const response = (await requestDebugServer(port, "/status"));
89
- if (!response.status || !response.message)
90
- return new errors_1.CLIError(`Invalid response from GET /status: ${JSON.stringify(response)}`);
91
- return response;
92
- };
93
- const spawnClient = async (configDir, cacheDir, errorHandler, { verbose, fileLogging, debugServerPort = exports.DEFAULT_CLIENT_DEBUG_SERVER_PORT, ephemeralAccessPoint, }) => {
94
- const state = new node_events_1.EventEmitter();
95
- state.on("error", errorHandler);
96
- const clientPath = (0, installClient_1.getInstallPath)(configDir, cacheDir);
97
- const version = await (0, installClient_1.getInstallVersion)(clientPath);
98
- let versionMismatchWarning;
99
- try {
100
- await (0, installClient_1.validateVersion)(version, installClient_1.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION);
101
- }
102
- catch (error) {
103
- if (error instanceof installClient_1.ConnectClientVersionMismatchError) {
104
- versionMismatchWarning =
105
- "Installed Autify Connect Client version doesn't match our supported version. " +
106
- "Consider to run `autify connect client install` to install the supported version. " +
107
- `(version: ${version}, supported: ${installClient_1.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION})`;
108
- }
109
- }
110
- const { accessPointName, accessPointKey } = await getOrCreateAccessPoint(configDir, ephemeralAccessPoint);
111
- const args = [
112
- "--log-format",
113
- "json",
114
- "--experimental-debug-server-port",
115
- debugServerPort.toString(),
116
- ];
117
- if (verbose)
118
- args.push("--verbose");
119
- const childProcess = (0, node_child_process_1.spawn)(clientPath, args, {
120
- env: {
121
- ...node_process_1.env,
122
- AUTIFY_CONNECT_KEY: accessPointKey,
123
- },
124
- });
125
- const logFile = fileLogging
126
- ? (0, node_path_1.join)(cacheDir, `autifyconnect-${Date.now()}-${childProcess.pid}.log`)
127
- : undefined;
128
- setupLogger(logFile);
129
- process.on("SIGINT", childProcess.kill);
130
- process.on("SIGTERM", childProcess.kill);
131
- const clientReady = (0, node_events_1.once)(state, "ready");
132
- const childProcessExit = (0, node_events_1.once)(childProcess, "exit");
133
- childProcess.stderr.pipe(process.stderr);
134
- onLogMsg(childProcess.stdout, (msg) => {
135
- if (msg.includes("Successfully connected")) {
136
- state.emit("ready");
137
- }
138
- });
139
- const statusTimer = setInterval(async () => {
140
- try {
141
- const response = await requestDebugServerStatus(debugServerPort);
142
- if (response instanceof errors_1.CLIError)
143
- state.emit("error", response);
144
- else
145
- state.emit(response.status, response.message);
146
- }
147
- catch (error) {
148
- state.emit("error", error);
149
- }
150
- }, 1000);
151
- const kill = async () => {
152
- try {
153
- await requestDebugServer(debugServerPort, "/terminate", "POST");
154
- for await (const start of (0, promises_1.setInterval)(1000, Date.now())) {
155
- if (childProcess.pid && !(0, is_running_1.default)(childProcess.pid))
156
- break;
157
- if (Date.now() - start > 5000)
158
- break;
159
- }
160
- }
161
- catch {
162
- // Ignore any exceptions to fallback to signal.
163
- }
164
- finally {
165
- // Guardrail.
166
- childProcess.kill("SIGINT");
167
- }
168
- };
169
- return {
170
- version,
171
- versionMismatchWarning,
172
- logFile,
173
- accessPointName,
174
- kill,
175
- waitReady: async () => {
176
- try {
177
- await clientReady;
178
- }
179
- catch (error) {
180
- await kill();
181
- throw error;
182
- }
183
- },
184
- waitExit: async () => {
185
- const [code, signal] = await childProcessExit;
186
- clearInterval(statusTimer);
187
- const deletedAccessPointName = await deleteAccessPointIfPossible(accessPointName, ephemeralAccessPoint);
188
- return [code, signal, deletedAccessPointName];
189
- },
190
- };
191
- };
192
- exports.spawnClient = spawnClient;