diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d2ea2a..d25a7368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,630 +1,420 @@ # [1.6.0](https://github.com/salesforcecli/plugin-env/compare/1.5.19...1.6.0) (2023-01-30) - ### Features -* update sf-plugins-core and oclif/core ([#493](https://github.com/salesforcecli/plugin-env/issues/493)) ([c2bdb13](https://github.com/salesforcecli/plugin-env/commit/c2bdb13d91cb7413736e42b4aebe9f8185343f1c)) - - +- update sf-plugins-core and oclif/core ([#493](https://github.com/salesforcecli/plugin-env/issues/493)) ([c2bdb13](https://github.com/salesforcecli/plugin-env/commit/c2bdb13d91cb7413736e42b4aebe9f8185343f1c)) ## [1.5.19](https://github.com/salesforcecli/plugin-env/compare/1.5.18...1.5.19) (2023-01-29) - ### Bug Fixes -* **deps:** bump tslib from 2.4.1 to 2.5.0 ([fd85ff1](https://github.com/salesforcecli/plugin-env/commit/fd85ff1a3a25889c2a27837647ed6e85adb808a2)) - - +- **deps:** bump tslib from 2.4.1 to 2.5.0 ([fd85ff1](https://github.com/salesforcecli/plugin-env/commit/fd85ff1a3a25889c2a27837647ed6e85adb808a2)) ## [1.5.18](https://github.com/salesforcecli/plugin-env/compare/1.5.17...1.5.18) (2023-01-11) - ### Bug Fixes -* **deps:** bump json5 from 1.0.1 to 1.0.2 ([cc08776](https://github.com/salesforcecli/plugin-env/commit/cc0877604153052981dff7983c02e0d178d01ae1)) - - +- **deps:** bump json5 from 1.0.1 to 1.0.2 ([cc08776](https://github.com/salesforcecli/plugin-env/commit/cc0877604153052981dff7983c02e0d178d01ae1)) ## [1.5.17](https://github.com/salesforcecli/plugin-env/compare/1.5.16...1.5.17) (2023-01-08) - ### Bug Fixes -* **deps:** bump @salesforce/sf-plugins-core from 1.21.0 to 1.21.6 ([2a741cd](https://github.com/salesforcecli/plugin-env/commit/2a741cdd71f3b8800278711e7ee441b1aae426e4)) - - +- **deps:** bump @salesforce/sf-plugins-core from 1.21.0 to 1.21.6 ([2a741cd](https://github.com/salesforcecli/plugin-env/commit/2a741cdd71f3b8800278711e7ee441b1aae426e4)) ## [1.5.16](https://github.com/salesforcecli/plugin-env/compare/1.5.15...1.5.16) (2022-12-18) - ### Bug Fixes -* **deps:** bump @salesforce/core from 3.32.6 to 3.32.11 ([51534dd](https://github.com/salesforcecli/plugin-env/commit/51534dd1165ddffedb2dcfec4c1e7c8664cb9779)) - - +- **deps:** bump @salesforce/core from 3.32.6 to 3.32.11 ([51534dd](https://github.com/salesforcecli/plugin-env/commit/51534dd1165ddffedb2dcfec4c1e7c8664cb9779)) ## [1.5.15](https://github.com/salesforcecli/plugin-env/compare/1.5.14...1.5.15) (2022-12-11) - ### Bug Fixes -* **deps:** bump @salesforce/sf-plugins-core from 1.19.0 to 1.21.0 ([60fee11](https://github.com/salesforcecli/plugin-env/commit/60fee11761513bd942a468be783e42797c522f3d)) - - +- **deps:** bump @salesforce/sf-plugins-core from 1.19.0 to 1.21.0 ([60fee11](https://github.com/salesforcecli/plugin-env/commit/60fee11761513bd942a468be783e42797c522f3d)) ## [1.5.14](https://github.com/salesforcecli/plugin-env/compare/1.5.13...1.5.14) (2022-12-04) - ### Bug Fixes -* **deps:** bump @salesforce/core from 3.32.3 to 3.32.6 ([abb8c19](https://github.com/salesforcecli/plugin-env/commit/abb8c19253a6c98b268579e0c090e280ee3e1bf4)) - - +- **deps:** bump @salesforce/core from 3.32.3 to 3.32.6 ([abb8c19](https://github.com/salesforcecli/plugin-env/commit/abb8c19253a6c98b268579e0c090e280ee3e1bf4)) ## [1.5.13](https://github.com/salesforcecli/plugin-env/compare/1.5.12...1.5.13) (2022-11-27) - ### Bug Fixes -* **deps:** bump @salesforce/core from 3.32.1 to 3.32.3 ([3324c1b](https://github.com/salesforcecli/plugin-env/commit/3324c1be3b71f7287040f740f838ffcb75887773)) - - +- **deps:** bump @salesforce/core from 3.32.1 to 3.32.3 ([3324c1b](https://github.com/salesforcecli/plugin-env/commit/3324c1be3b71f7287040f740f838ffcb75887773)) ## [1.5.12](https://github.com/salesforcecli/plugin-env/compare/1.5.11...1.5.12) (2022-11-27) - ### Bug Fixes -* **deps:** bump @salesforce/sf-plugins-core from 1.18.1 to 1.19.0 ([1626741](https://github.com/salesforcecli/plugin-env/commit/162674177acc1611707c8d8b5651b16eaca513da)) - - +- **deps:** bump @salesforce/sf-plugins-core from 1.18.1 to 1.19.0 ([1626741](https://github.com/salesforcecli/plugin-env/commit/162674177acc1611707c8d8b5651b16eaca513da)) ## [1.5.11](https://github.com/salesforcecli/plugin-env/compare/1.5.10...1.5.11) (2022-11-22) - ### Bug Fixes -* missing/unused message cleanup ([f37d63b](https://github.com/salesforcecli/plugin-env/commit/f37d63b79c2456fd31e773f68a4c39ec2518ee0a)) - - +- missing/unused message cleanup ([f37d63b](https://github.com/salesforcecli/plugin-env/commit/f37d63b79c2456fd31e773f68a4c39ec2518ee0a)) ## [1.5.10](https://github.com/salesforcecli/plugin-env/compare/1.5.9...1.5.10) (2022-11-20) - ### Bug Fixes -* **deps:** bump @salesforce/sf-plugins-core from 1.17.2 to 1.18.1 ([deea91b](https://github.com/salesforcecli/plugin-env/commit/deea91b68b237e3788b173c4b8bebda8270f424a)) - - +- **deps:** bump @salesforce/sf-plugins-core from 1.17.2 to 1.18.1 ([deea91b](https://github.com/salesforcecli/plugin-env/commit/deea91b68b237e3788b173c4b8bebda8270f424a)) ## [1.5.9](https://github.com/salesforcecli/plugin-env/compare/1.5.8...1.5.9) (2022-11-08) - ### Bug Fixes -* **deps:** bump tslib from 2.4.0 to 2.4.1 ([1707388](https://github.com/salesforcecli/plugin-env/commit/1707388c1feacadbaac3f5189fe9e1840d026b54)) - - +- **deps:** bump tslib from 2.4.0 to 2.4.1 ([1707388](https://github.com/salesforcecli/plugin-env/commit/1707388c1feacadbaac3f5189fe9e1840d026b54)) ## [1.5.8](https://github.com/salesforcecli/plugin-env/compare/1.5.7...1.5.8) (2022-10-30) - ### Bug Fixes -* **deps:** bump @salesforce/sf-plugins-core from 1.14.1 to 1.17.2 ([c973e34](https://github.com/salesforcecli/plugin-env/commit/c973e34c0bfd4e8b58633a57b272ff4dc882abf6)) - - +- **deps:** bump @salesforce/sf-plugins-core from 1.14.1 to 1.17.2 ([c973e34](https://github.com/salesforcecli/plugin-env/commit/c973e34c0bfd4e8b58633a57b272ff4dc882abf6)) ## [1.5.7](https://github.com/salesforcecli/plugin-env/compare/1.5.6...1.5.7) (2022-10-28) - ### Bug Fixes -* **deps:** bump @salesforce/core from 3.30.10 to 3.31.16 ([cffdf01](https://github.com/salesforcecli/plugin-env/commit/cffdf014dc3a45cf60b003117d0f0dbeb46b5b97)) - - +- **deps:** bump @salesforce/core from 3.30.10 to 3.31.16 ([cffdf01](https://github.com/salesforcecli/plugin-env/commit/cffdf014dc3a45cf60b003117d0f0dbeb46b5b97)) ## [1.5.6](https://github.com/salesforcecli/plugin-env/compare/1.5.5...1.5.6) (2022-10-16) - ### Bug Fixes -* **deps:** bump @oclif/core from 1.16.4 to 1.18.0 ([f332650](https://github.com/salesforcecli/plugin-env/commit/f332650722acf11933ed106a82fee952bb6bbfce)) - - +- **deps:** bump @oclif/core from 1.16.4 to 1.18.0 ([f332650](https://github.com/salesforcecli/plugin-env/commit/f332650722acf11933ed106a82fee952bb6bbfce)) ## [1.5.5](https://github.com/salesforcecli/plugin-env/compare/1.5.4...1.5.5) (2022-09-25) - ### Bug Fixes -* **deps:** bump @salesforce/core from 3.30.2 to 3.30.8 ([f25f8d3](https://github.com/salesforcecli/plugin-env/commit/f25f8d3e314ee9897aca50d112fc905248ae5c12)) - - +- **deps:** bump @salesforce/core from 3.30.2 to 3.30.8 ([f25f8d3](https://github.com/salesforcecli/plugin-env/commit/f25f8d3e314ee9897aca50d112fc905248ae5c12)) ## [1.5.4](https://github.com/salesforcecli/plugin-env/compare/v1.5.3...1.5.4) (2022-09-25) - ### Bug Fixes -* **deps:** bump @oclif/core from 1.16.0 to 1.16.4 ([1db8be8](https://github.com/salesforcecli/plugin-env/commit/1db8be80a3400d89629749e42bd6ec7dd543359a)) - - +- **deps:** bump @oclif/core from 1.16.0 to 1.16.4 ([1db8be8](https://github.com/salesforcecli/plugin-env/commit/1db8be80a3400d89629749e42bd6ec7dd543359a)) ## [1.5.3](https://github.com/salesforcecli/plugin-env/compare/v1.5.2...v1.5.3) (2022-09-06) - - ## [1.5.2](https://github.com/salesforcecli/plugin-env/compare/v1.5.1...v1.5.2) (2022-07-29) - - ## [1.5.1](https://github.com/salesforcecli/plugin-env/compare/v1.5.0...v1.5.1) (2022-07-02) - ### Bug Fixes -* add descriptions for subtopics ([ebd4eeb](https://github.com/salesforcecli/plugin-env/commit/ebd4eeb2a3dcae79fe8eae53d1a0055929a6ece9)) - - +- add descriptions for subtopics ([ebd4eeb](https://github.com/salesforcecli/plugin-env/commit/ebd4eeb2a3dcae79fe8eae53d1a0055929a6ece9)) # [1.5.0](https://github.com/salesforcecli/plugin-env/compare/v1.4.1...v1.5.0) (2022-06-23) - ### Features -* use StateAggregator ([259cceb](https://github.com/salesforcecli/plugin-env/commit/259cceb0233a9033372560e504129e87f33982ae)) - - +- use StateAggregator ([259cceb](https://github.com/salesforcecli/plugin-env/commit/259cceb0233a9033372560e504129e87f33982ae)) ## [1.4.1](https://github.com/salesforcecli/plugin-env/compare/v1.4.0...v1.4.1) (2022-06-06) - ### Bug Fixes -* resume command does not store prod org in class property ([#293](https://github.com/salesforcecli/plugin-env/issues/293)) ([c8baf92](https://github.com/salesforcecli/plugin-env/commit/c8baf92f669509b8d13fca783442fda6a02d5489)) - - +- resume command does not store prod org in class property ([#293](https://github.com/salesforcecli/plugin-env/issues/293)) ([c8baf92](https://github.com/salesforcecli/plugin-env/commit/c8baf92f669509b8d13fca783442fda6a02d5489)) # [1.4.0](https://github.com/salesforcecli/plugin-env/compare/v1.3.2...v1.4.0) (2022-06-02) - ### Features -* no-track-source flag for scratch/sandbox ([3bc3582](https://github.com/salesforcecli/plugin-env/commit/3bc358241bd9ce4600a6daecb963f325fb0c00b8)) - - +- no-track-source flag for scratch/sandbox ([3bc3582](https://github.com/salesforcecli/plugin-env/commit/3bc358241bd9ce4600a6daecb963f325fb0c00b8)) ## [1.3.2](https://github.com/salesforcecli/plugin-env/compare/v1.3.1...v1.3.2) (2022-06-01) - ### Bug Fixes -* update description to match the one in plugin-functions ([3d5bde9](https://github.com/salesforcecli/plugin-env/commit/3d5bde9550137bb76d8f46d43bdd57e5da510cf2)) - - +- update description to match the one in plugin-functions ([3d5bde9](https://github.com/salesforcecli/plugin-env/commit/3d5bde9550137bb76d8f46d43bdd57e5da510cf2)) ## [1.3.1](https://github.com/salesforcecli/plugin-env/compare/v1.3.0...v1.3.1) (2022-05-04) - ### Bug Fixes -* bump sf-plugins-core and others ([#281](https://github.com/salesforcecli/plugin-env/issues/281)) ([9e58bbe](https://github.com/salesforcecli/plugin-env/commit/9e58bbedd013f51c1fbcbb4afea958b520f59bf3)) - - +- bump sf-plugins-core and others ([#281](https://github.com/salesforcecli/plugin-env/issues/281)) ([9e58bbe](https://github.com/salesforcecli/plugin-env/commit/9e58bbedd013f51c1fbcbb4afea958b520f59bf3)) # [1.3.0](https://github.com/salesforcecli/plugin-env/compare/v1.2.3...v1.3.0) (2022-04-27) - ### Features -* add env commands for create/resume scratch/sandbox orgs ([#272](https://github.com/salesforcecli/plugin-env/issues/272)) ([c6ab732](https://github.com/salesforcecli/plugin-env/commit/c6ab73247e18a571467cc5437b8211ce8f22b49f)), closes [#254](https://github.com/salesforcecli/plugin-env/issues/254) [#271](https://github.com/salesforcecli/plugin-env/issues/271) [#270](https://github.com/salesforcecli/plugin-env/issues/270) - - +- add env commands for create/resume scratch/sandbox orgs ([#272](https://github.com/salesforcecli/plugin-env/issues/272)) ([c6ab732](https://github.com/salesforcecli/plugin-env/commit/c6ab73247e18a571467cc5437b8211ce8f22b49f)), closes [#254](https://github.com/salesforcecli/plugin-env/issues/254) [#271](https://github.com/salesforcecli/plugin-env/issues/271) [#270](https://github.com/salesforcecli/plugin-env/issues/270) ## [1.2.3](https://github.com/salesforcecli/plugin-env/compare/v1.2.2...v1.2.3) (2022-04-13) - ### Bug Fixes -* mark commands as beta ([#269](https://github.com/salesforcecli/plugin-env/issues/269)) ([e0fd353](https://github.com/salesforcecli/plugin-env/commit/e0fd3536667cd0322d07d4592b15c451c78fdfe9)) - - +- mark commands as beta ([#269](https://github.com/salesforcecli/plugin-env/issues/269)) ([e0fd353](https://github.com/salesforcecli/plugin-env/commit/e0fd3536667cd0322d07d4592b15c451c78fdfe9)) ## [1.2.2](https://github.com/salesforcecli/plugin-env/compare/v1.2.1...v1.2.2) (2022-04-10) - - ## [1.2.1](https://github.com/salesforcecli/plugin-env/compare/v1.2.0...v1.2.1) (2022-03-31) - - # [1.2.0](https://github.com/salesforcecli/plugin-env/compare/v1.1.1...v1.2.0) (2022-03-18) - ### Bug Fixes -* add caret to @salesforce/core and fix tests ([#251](https://github.com/salesforcecli/plugin-env/issues/251)) ([07d80fc](https://github.com/salesforcecli/plugin-env/commit/07d80fcbf8ef8805336843205ae2c3df6981b7bc)) - +- add caret to @salesforce/core and fix tests ([#251](https://github.com/salesforcecli/plugin-env/issues/251)) ([07d80fc](https://github.com/salesforcecli/plugin-env/commit/07d80fcbf8ef8805336843205ae2c3df6981b7bc)) ### Features -* commands to delete scratch orgs and sandboxes ([27e460d](https://github.com/salesforcecli/plugin-env/commit/27e460d3d7710a404d11172b11dff85042774a95)) - - +- commands to delete scratch orgs and sandboxes ([27e460d](https://github.com/salesforcecli/plugin-env/commit/27e460d3d7710a404d11172b11dff85042774a95)) ## [1.1.1](https://github.com/salesforcecli/plugin-env/compare/v1.1.0...v1.1.1) (2022-02-16) - ### Bug Fixes -* bump deps ([#236](https://github.com/salesforcecli/plugin-env/issues/236)) ([cf6e1cd](https://github.com/salesforcecli/plugin-env/commit/cf6e1cdd07e4c9d487918b6e65ed7155c9561e8f)) - - +- bump deps ([#236](https://github.com/salesforcecli/plugin-env/issues/236)) ([cf6e1cd](https://github.com/salesforcecli/plugin-env/commit/cf6e1cdd07e4c9d487918b6e65ed7155c9561e8f)) # [1.1.0](https://github.com/salesforcecli/plugin-env/compare/v1.0.4...v1.1.0) (2022-01-28) - ### Features -* remove cli-ux ([a031d2f](https://github.com/salesforcecli/plugin-env/commit/a031d2faf942b54e86dd6382e57cebd026a4d0f8)) - - +- remove cli-ux ([a031d2f](https://github.com/salesforcecli/plugin-env/commit/a031d2faf942b54e86dd6382e57cebd026a4d0f8)) ## [1.0.4](https://github.com/salesforcecli/plugin-env/compare/v1.0.3...v1.0.4) (2022-01-06) - ### Bug Fixes -* add main to package.json ([#215](https://github.com/salesforcecli/plugin-env/issues/215)) ([c9bcd4a](https://github.com/salesforcecli/plugin-env/commit/c9bcd4a9fa2c6c4e463941eaa2d5f91fc6842962)) - - +- add main to package.json ([#215](https://github.com/salesforcecli/plugin-env/issues/215)) ([c9bcd4a](https://github.com/salesforcecli/plugin-env/commit/c9bcd4a9fa2c6c4e463941eaa2d5f91fc6842962)) ## [1.0.3](https://github.com/salesforcecli/plugin-env/compare/v1.0.2...v1.0.3) (2021-10-14) - ### Bug Fixes -* bump deps ([#162](https://github.com/salesforcecli/plugin-env/issues/162)) ([ad6ee1b](https://github.com/salesforcecli/plugin-env/commit/ad6ee1bb2b53378224c986dbf399e2031c3bbae4)) - - +- bump deps ([#162](https://github.com/salesforcecli/plugin-env/issues/162)) ([ad6ee1b](https://github.com/salesforcecli/plugin-env/commit/ad6ee1bb2b53378224c986dbf399e2031c3bbae4)) ## [1.0.2](https://github.com/salesforcecli/plugin-env/compare/v1.0.1...v1.0.2) (2021-10-12) - - ## [1.0.1](https://github.com/salesforcecli/plugin-env/compare/v1.0.0...v1.0.1) (2021-10-05) - ### Bug Fixes -* no found envs ([1491aa3](https://github.com/salesforcecli/plugin-env/commit/1491aa3ca4a3ee6f02115e2bdec5a7b125454be7)) - - +- no found envs ([1491aa3](https://github.com/salesforcecli/plugin-env/commit/1491aa3ca4a3ee6f02115e2bdec5a7b125454be7)) # [1.0.0](https://github.com/salesforcecli/plugin-env/compare/v0.0.35...v1.0.0) (2021-09-29) - ### Bug Fixes -* !bump to v1 ([#150](https://github.com/salesforcecli/plugin-env/issues/150)) [skip-validate-pr] ([34cf5a9](https://github.com/salesforcecli/plugin-env/commit/34cf5a9cc0c96430265b2ef41e5530a6a556cf7f)) - - +- !bump to v1 ([#150](https://github.com/salesforcecli/plugin-env/issues/150)) [skip-validate-pr] ([34cf5a9](https://github.com/salesforcecli/plugin-env/commit/34cf5a9cc0c96430265b2ef41e5530a6a556cf7f)) ## [0.0.35](https://github.com/salesforcecli/plugin-env/compare/v0.0.34...v0.0.35) (2021-09-29) - ### Bug Fixes -* warn users about frontdoor url ([#149](https://github.com/salesforcecli/plugin-env/issues/149)) ([8d177ce](https://github.com/salesforcecli/plugin-env/commit/8d177cedcb17f9259db7f1026e5e939640c4da02)) - - +- warn users about frontdoor url ([#149](https://github.com/salesforcecli/plugin-env/issues/149)) ([8d177ce](https://github.com/salesforcecli/plugin-env/commit/8d177cedcb17f9259db7f1026e5e939640c4da02)) ## [0.0.34](https://github.com/salesforcecli/plugin-env/compare/v0.0.33...v0.0.34) (2021-09-23) - ### Bug Fixes -* return environments keyed by environment type ([#148](https://github.com/salesforcecli/plugin-env/issues/148)) ([e677462](https://github.com/salesforcecli/plugin-env/commit/e67746205d1798be32e31cc3ce8c0221e86c28a7)) - - +- return environments keyed by environment type ([#148](https://github.com/salesforcecli/plugin-env/issues/148)) ([e677462](https://github.com/salesforcecli/plugin-env/commit/e67746205d1798be32e31cc3ce8c0221e86c28a7)) ## [0.0.33](https://github.com/salesforcecli/plugin-env/compare/v0.0.32...v0.0.33) (2021-09-22) - ### Bug Fixes -* minor edit of description and a err messages ([693746b](https://github.com/salesforcecli/plugin-env/commit/693746b6335e889811d5adc3c95e1798e0c9c693)) -* minor edit of error message ([88b4905](https://github.com/salesforcecli/plugin-env/commit/88b490581107022ae5d00931873620e2b263e1ee)) -* minor edits to help and error messages ([c3dd2b5](https://github.com/salesforcecli/plugin-env/commit/c3dd2b52c33ca4bd067632db82686ddc6b4addd7)) -* update "open" tests w/edited error message ([76de065](https://github.com/salesforcecli/plugin-env/commit/76de065134850af19059b8d97f5348f84c771a4a)) - - +- minor edit of description and a err messages ([693746b](https://github.com/salesforcecli/plugin-env/commit/693746b6335e889811d5adc3c95e1798e0c9c693)) +- minor edit of error message ([88b4905](https://github.com/salesforcecli/plugin-env/commit/88b490581107022ae5d00931873620e2b263e1ee)) +- minor edits to help and error messages ([c3dd2b5](https://github.com/salesforcecli/plugin-env/commit/c3dd2b52c33ca4bd067632db82686ddc6b4addd7)) +- update "open" tests w/edited error message ([76de065](https://github.com/salesforcecli/plugin-env/commit/76de065134850af19059b8d97f5348f84c771a4a)) ## [0.0.32](https://github.com/salesforcecli/plugin-env/compare/v0.0.31...v0.0.32) (2021-09-16) - ### Bug Fixes -* show error message when no envs are available ([#141](https://github.com/salesforcecli/plugin-env/issues/141)) ([a17b56b](https://github.com/salesforcecli/plugin-env/commit/a17b56b2353f87f966d1e76a5fe912d90f0c80cb)) - - +- show error message when no envs are available ([#141](https://github.com/salesforcecli/plugin-env/issues/141)) ([a17b56b](https://github.com/salesforcecli/plugin-env/commit/a17b56b2353f87f966d1e76a5fe912d90f0c80cb)) ## [0.0.31](https://github.com/salesforcecli/plugin-env/compare/v0.0.30...v0.0.31) (2021-09-16) - ### Bug Fixes -* bump to latest sf-plugins-core ([#142](https://github.com/salesforcecli/plugin-env/issues/142)) ([fd668eb](https://github.com/salesforcecli/plugin-env/commit/fd668eb5963ac2486a9623af7e495d7521181967)) - - +- bump to latest sf-plugins-core ([#142](https://github.com/salesforcecli/plugin-env/issues/142)) ([fd668eb](https://github.com/salesforcecli/plugin-env/commit/fd668eb5963ac2486a9623af7e495d7521181967)) ## [0.0.30](https://github.com/salesforcecli/plugin-env/compare/v0.0.29...v0.0.30) (2021-09-15) - ### Bug Fixes -* replace command with sf-plugins-core ([#140](https://github.com/salesforcecli/plugin-env/issues/140)) ([17ff5b2](https://github.com/salesforcecli/plugin-env/commit/17ff5b26bf7b8f4b078d315c5bfa0a9bdaa4d0a6)) - - +- replace command with sf-plugins-core ([#140](https://github.com/salesforcecli/plugin-env/issues/140)) ([17ff5b2](https://github.com/salesforcecli/plugin-env/commit/17ff5b26bf7b8f4b078d315c5bfa0a9bdaa4d0a6)) ## [0.0.29](https://github.com/salesforcecli/plugin-env/compare/v0.0.28...v0.0.29) (2021-09-14) - ### Bug Fixes -* check if data exists ([#138](https://github.com/salesforcecli/plugin-env/issues/138)) ([520988b](https://github.com/salesforcecli/plugin-env/commit/520988b7e538d6d2a3a3c971b01db0672f91498a)) - +- check if data exists ([#138](https://github.com/salesforcecli/plugin-env/issues/138)) ([520988b](https://github.com/salesforcecli/plugin-env/commit/520988b7e538d6d2a3a3c971b01db0672f91498a)) ### Features -* **cli:** add plugin-functions to devPlugins for implementation of list and display hooks [skip ci] ([#139](https://github.com/salesforcecli/plugin-env/issues/139)) ([33fac72](https://github.com/salesforcecli/plugin-env/commit/33fac725adb0f9a4943a4c5a8528ff42a82fa256)) - - +- **cli:** add plugin-functions to devPlugins for implementation of list and display hooks [skip ci] ([#139](https://github.com/salesforcecli/plugin-env/issues/139)) ([33fac72](https://github.com/salesforcecli/plugin-env/commit/33fac725adb0f9a4943a4c5a8528ff42a82fa256)) ## [0.0.28](https://github.com/salesforcecli/plugin-env/compare/v0.0.27...v0.0.28) (2021-09-13) - ### Bug Fixes -* bump deps so that are uniform across plugins ([#137](https://github.com/salesforcecli/plugin-env/issues/137)) ([453c3ed](https://github.com/salesforcecli/plugin-env/commit/453c3ed598114a2d5a92ba2ebc59f44ffe677f63)) - - +- bump deps so that are uniform across plugins ([#137](https://github.com/salesforcecli/plugin-env/issues/137)) ([453c3ed](https://github.com/salesforcecli/plugin-env/commit/453c3ed598114a2d5a92ba2ebc59f44ffe677f63)) ## [0.0.27](https://github.com/salesforcecli/plugin-env/compare/v0.0.26...v0.0.27) (2021-09-10) - ### Features -* use SfCommand ([#135](https://github.com/salesforcecli/plugin-env/issues/135)) ([4182bcc](https://github.com/salesforcecli/plugin-env/commit/4182bccfbf926f87debd9cca717a6295a8ff1acd)) - - +- use SfCommand ([#135](https://github.com/salesforcecli/plugin-env/issues/135)) ([4182bcc](https://github.com/salesforcecli/plugin-env/commit/4182bccfbf926f87debd9cca717a6295a8ff1acd)) ## [0.0.26](https://github.com/salesforcecli/plugin-env/compare/v0.0.25...v0.0.26) (2021-09-08) - ### Bug Fixes -* use change-case ([4e56488](https://github.com/salesforcecli/plugin-env/commit/4e5648862d11337d4f0a6e93ab3acb704278c53d)) -* use latest sf-plugins-core ([936749f](https://github.com/salesforcecli/plugin-env/commit/936749f515b49e66a4b4635d54b594b89d8d0eab)) - +- use change-case ([4e56488](https://github.com/salesforcecli/plugin-env/commit/4e5648862d11337d4f0a6e93ab3acb704278c53d)) +- use latest sf-plugins-core ([936749f](https://github.com/salesforcecli/plugin-env/commit/936749f515b49e66a4b4635d54b594b89d8d0eab)) ### Features -* use hooks for list and display ([2af7d2f](https://github.com/salesforcecli/plugin-env/commit/2af7d2f5ebfdc769979a659e5cd87c56b61b50d1)) - - +- use hooks for list and display ([2af7d2f](https://github.com/salesforcecli/plugin-env/commit/2af7d2f5ebfdc769979a659e5cd87c56b61b50d1)) ## [0.0.25](https://github.com/salesforcecli/plugin-env/compare/v0.0.24...v0.0.25) (2021-08-18) - ### Bug Fixes -* bump oclif/core and @salesforce/core ([#120](https://github.com/salesforcecli/plugin-env/issues/120)) ([b58ed6e](https://github.com/salesforcecli/plugin-env/commit/b58ed6eafc04db24dc97d48f18497594bd4104a3)) - - +- bump oclif/core and @salesforce/core ([#120](https://github.com/salesforcecli/plugin-env/issues/120)) ([b58ed6e](https://github.com/salesforcecli/plugin-env/commit/b58ed6eafc04db24dc97d48f18497594bd4104a3)) ## [0.0.24](https://github.com/salesforcecli/plugin-env/compare/v0.0.23...v0.0.24) (2021-08-18) - ### Bug Fixes -* minor help updates ([6697ca6](https://github.com/salesforcecli/plugin-env/commit/6697ca6c44e2a5e600d48697d080b27f15a67995)) -* minor updates to help and examples ([0c23ed8](https://github.com/salesforcecli/plugin-env/commit/0c23ed844b7166765bdee7c4044557a1c1d45d2c)) - - +- minor help updates ([6697ca6](https://github.com/salesforcecli/plugin-env/commit/6697ca6c44e2a5e600d48697d080b27f15a67995)) +- minor updates to help and examples ([0c23ed8](https://github.com/salesforcecli/plugin-env/commit/0c23ed844b7166765bdee7c4044557a1c1d45d2c)) ## [0.0.23](https://github.com/salesforcecli/plugin-env/compare/v0.0.22...v0.0.23) (2021-08-12) - ### Bug Fixes -* bump @salesforce/core to 3.4.1 ([d67e845](https://github.com/salesforcecli/plugin-env/commit/d67e84595241c4e2ee0e9567c1bbbb3cae57d4ba)) - - +- bump @salesforce/core to 3.4.1 ([d67e845](https://github.com/salesforcecli/plugin-env/commit/d67e84595241c4e2ee0e9567c1bbbb3cae57d4ba)) ## [0.0.22](https://github.com/salesforcecli/plugin-env/compare/v0.0.21...v0.0.22) (2021-08-12) - ### Bug Fixes -* rename column oauth method to auth method ([dba5399](https://github.com/salesforcecli/plugin-env/commit/dba53994300f31712bdcf4aeb62ffdedfedcd471)) - - +- rename column oauth method to auth method ([dba5399](https://github.com/salesforcecli/plugin-env/commit/dba53994300f31712bdcf4aeb62ffdedfedcd471)) ## [0.0.21](https://github.com/salesforcecli/plugin-env/compare/v0.0.20...v0.0.21) (2021-08-11) - ### Bug Fixes -* only show active orgs by default ([#116](https://github.com/salesforcecli/plugin-env/issues/116)) ([e0e0bb3](https://github.com/salesforcecli/plugin-env/commit/e0e0bb3e095ff0e73486b5f40f18871aefc9b5f9)) - - +- only show active orgs by default ([#116](https://github.com/salesforcecli/plugin-env/issues/116)) ([e0e0bb3](https://github.com/salesforcecli/plugin-env/commit/e0e0bb3e095ff0e73486b5f40f18871aefc9b5f9)) ## [0.0.20](https://github.com/salesforcecli/plugin-env/compare/v0.0.19...v0.0.20) (2021-08-04) - ### Features -* separate tables for scratch orgs ([#100](https://github.com/salesforcecli/plugin-env/issues/100)) ([c3b18d8](https://github.com/salesforcecli/plugin-env/commit/c3b18d8a6a0de9a75f0710bfe5458651d7a0c431)) - - +- separate tables for scratch orgs ([#100](https://github.com/salesforcecli/plugin-env/issues/100)) ([c3b18d8](https://github.com/salesforcecli/plugin-env/commit/c3b18d8a6a0de9a75f0710bfe5458651d7a0c431)) ## [0.0.19](https://github.com/salesforcecli/plugin-env/compare/v0.0.18...v0.0.19) (2021-08-03) - ### Bug Fixes -* update topic descriptions in package.json ([c88f030](https://github.com/salesforcecli/plugin-env/commit/c88f030f5d54c8cb9ecddfe3ea1db0f93c16d0b5)) - - +- update topic descriptions in package.json ([c88f030](https://github.com/salesforcecli/plugin-env/commit/c88f030f5d54c8cb9ecddfe3ea1db0f93c16d0b5)) ## [0.0.18](https://github.com/salesforcecli/plugin-env/compare/v0.0.16...v0.0.18) (2021-07-29) - ### Bug Fixes -* bump version to force release ([7619300](https://github.com/salesforcecli/plugin-env/commit/76193006c8c0aa88a436eb8b026eb2ddc0e8f4a4)) -* exclude field timestamp for r1 ([b2ea721](https://github.com/salesforcecli/plugin-env/commit/b2ea7218abac30cf7431aa074f8444e58698e321)) -* hide extended flag from help ([#99](https://github.com/salesforcecli/plugin-env/issues/99)) ([e106778](https://github.com/salesforcecli/plugin-env/commit/e106778114e1ba5830e435d6273426e003a15e68)) - - +- bump version to force release ([7619300](https://github.com/salesforcecli/plugin-env/commit/76193006c8c0aa88a436eb8b026eb2ddc0e8f4a4)) +- exclude field timestamp for r1 ([b2ea721](https://github.com/salesforcecli/plugin-env/commit/b2ea7218abac30cf7431aa074f8444e58698e321)) +- hide extended flag from help ([#99](https://github.com/salesforcecli/plugin-env/issues/99)) ([e106778](https://github.com/salesforcecli/plugin-env/commit/e106778114e1ba5830e435d6273426e003a15e68)) ## [0.0.16](https://github.com/salesforcecli/plugin-env/compare/v0.0.15...v0.0.16) (2021-07-28) - ### Bug Fixes -* pin to @salesforce/core@3.3.5 ([6acbc2b](https://github.com/salesforcecli/plugin-env/commit/6acbc2b1b81a6cd985009592716097dfd8b1e0b3)) - - +- pin to @salesforce/core@3.3.5 ([6acbc2b](https://github.com/salesforcecli/plugin-env/commit/6acbc2b1b81a6cd985009592716097dfd8b1e0b3)) ## [0.0.15](https://github.com/salesforcecli/plugin-env/compare/v0.0.14...v0.0.15) (2021-07-28) - ### Features -* add column for config ([#96](https://github.com/salesforcecli/plugin-env/issues/96)) ([4159426](https://github.com/salesforcecli/plugin-env/commit/41594265cf902b1137505444e22ec0c3849f6c8c)) - - +- add column for config ([#96](https://github.com/salesforcecli/plugin-env/issues/96)) ([4159426](https://github.com/salesforcecli/plugin-env/commit/41594265cf902b1137505444e22ec0c3849f6c8c)) ## [0.0.14](https://github.com/salesforcecli/plugin-env/compare/v0.0.13...v0.0.14) (2021-07-27) - - ## [0.0.13](https://github.com/salesforcecli/plugin-env/compare/v0.0.12...v0.0.13) (2021-07-22) - ### Bug Fixes -* bump deps ([526c1af](https://github.com/salesforcecli/plugin-env/commit/526c1af7468865dc772e02bc52902823bec2ca54)) - - +- bump deps ([526c1af](https://github.com/salesforcecli/plugin-env/commit/526c1af7468865dc772e02bc52902823bec2ca54)) ## [0.0.12](https://github.com/salesforcecli/plugin-env/compare/v0.0.11...v0.0.12) (2021-07-21) - ### Bug Fixes -* rename flag --environment to --target-env ([#92](https://github.com/salesforcecli/plugin-env/issues/92)) ([d0c8f47](https://github.com/salesforcecli/plugin-env/commit/d0c8f470b547f64098c0cd896d1b1a378bf97aab)) - - +- rename flag --environment to --target-env ([#92](https://github.com/salesforcecli/plugin-env/issues/92)) ([d0c8f47](https://github.com/salesforcecli/plugin-env/commit/d0c8f470b547f64098c0cd896d1b1a378bf97aab)) ## [0.0.11](https://github.com/salesforcecli/plugin-env/compare/v0.0.10...v0.0.11) (2021-07-21) - ### Bug Fixes -* better help for cli-ux table flags ([#91](https://github.com/salesforcecli/plugin-env/issues/91)) ([ab61c18](https://github.com/salesforcecli/plugin-env/commit/ab61c1881f8603f1563ac86aa65fdbbce270bb5b)) - - +- better help for cli-ux table flags ([#91](https://github.com/salesforcecli/plugin-env/issues/91)) ([ab61c18](https://github.com/salesforcecli/plugin-env/commit/ab61c1881f8603f1563ac86aa65fdbbce270bb5b)) ## [0.0.10](https://github.com/salesforcecli/plugin-env/compare/v0.0.9...v0.0.10) (2021-07-19) - ### Bug Fixes -* add help summaries to env list and env display ([#88](https://github.com/salesforcecli/plugin-env/issues/88)) ([c6875aa](https://github.com/salesforcecli/plugin-env/commit/c6875aab68f3108d574e8aff61688455070c743b)) - - +- add help summaries to env list and env display ([#88](https://github.com/salesforcecli/plugin-env/issues/88)) ([c6875aa](https://github.com/salesforcecli/plugin-env/commit/c6875aab68f3108d574e8aff61688455070c743b)) ## [0.0.9](https://github.com/salesforcecli/plugin-env/compare/v0.0.8...v0.0.9) (2021-07-12) - - ## [0.0.8](https://github.com/salesforcecli/plugin-env/compare/v0.0.7...v0.0.8) (2021-07-11) - ### Bug Fixes -* bump oclif ([8b201b7](https://github.com/salesforcecli/plugin-env/commit/8b201b78063a5d83602ee2fccbb31550268812ee)) -* bump oclif/core ([f8f60f6](https://github.com/salesforcecli/plugin-env/commit/f8f60f656c0570bb97ce1e8c459e23dac46df463)) - - +- bump oclif ([8b201b7](https://github.com/salesforcecli/plugin-env/commit/8b201b78063a5d83602ee2fccbb31550268812ee)) +- bump oclif/core ([f8f60f6](https://github.com/salesforcecli/plugin-env/commit/f8f60f656c0570bb97ce1e8c459e23dac46df463)) ## [0.0.7](https://github.com/salesforcecli/plugin-env/compare/v0.0.6...v0.0.7) (2021-06-21) - ### Bug Fixes -* update help [skip-validate-pr] ([#71](https://github.com/salesforcecli/plugin-env/issues/71)) ([d43a09a](https://github.com/salesforcecli/plugin-env/commit/d43a09a7f9f659965eada455a613eb3400e0cf28)) - - +- update help [skip-validate-pr] ([#71](https://github.com/salesforcecli/plugin-env/issues/71)) ([d43a09a](https://github.com/salesforcecli/plugin-env/commit/d43a09a7f9f659965eada455a613eb3400e0cf28)) ## [0.0.6](https://github.com/salesforcecli/plugin-env/compare/v0.0.5...v0.0.6) (2021-06-09) - - ## [0.0.5](https://github.com/salesforcecli/plugin-env/compare/v0.0.4...v0.0.5) (2021-06-09) - ### Features -* add env display command ([#52](https://github.com/salesforcecli/plugin-env/issues/52)) ([7b5388b](https://github.com/salesforcecli/plugin-env/commit/7b5388b737ed9c77b73f81c97dcab775aa583af5)) - - +- add env display command ([#52](https://github.com/salesforcecli/plugin-env/issues/52)) ([7b5388b](https://github.com/salesforcecli/plugin-env/commit/7b5388b737ed9c77b73f81c97dcab775aa583af5)) ## [0.0.4](https://github.com/salesforcecli/plugin-env/compare/v0.0.3...v0.0.4) (2021-06-07) - ### Bug Fixes -* publish schemas ([695e674](https://github.com/salesforcecli/plugin-env/commit/695e674f62fbf2da138003e3595b8fede97c20a7)) - - +- publish schemas ([695e674](https://github.com/salesforcecli/plugin-env/commit/695e674f62fbf2da138003e3595b8fede97c20a7)) ## [0.0.3](https://github.com/salesforcecli/plugin-env/compare/v0.0.2...v0.0.3) (2021-06-04) - ### Features -* env open @W-9104301@ ([#31](https://github.com/salesforcecli/plugin-env/issues/31)) ([3a79a41](https://github.com/salesforcecli/plugin-env/commit/3a79a41c64cb60bbb79e542a78b1297e23924580)) - - +- env open @W-9104301@ ([#31](https://github.com/salesforcecli/plugin-env/issues/31)) ([3a79a41](https://github.com/salesforcecli/plugin-env/commit/3a79a41c64cb60bbb79e542a78b1297e23924580)) ## [0.0.2](https://github.com/salesforcecli/plugin-env/compare/v0.0.1...v0.0.2) (2021-05-24) - ### Features -* remove env connect ([f598b53](https://github.com/salesforcecli/plugin-env/commit/f598b5373cff7a01e38b6caa91c385e9e470a94d)) - - +- remove env connect ([f598b53](https://github.com/salesforcecli/plugin-env/commit/f598b5373cff7a01e38b6caa91c385e9e470a94d)) ## [0.0.1](https://github.com/salesforcecli/plugin-env/compare/6f68a5171400224321ac4e9aa4be52ad8e87adae...v0.0.1) (2021-05-19) - ### Bug Fixes -* circleci config ([2619bc3](https://github.com/salesforcecli/plugin-env/commit/2619bc3b0a7307c077e428ebf2221be385a67b27)) -* remove reference to plugin-auth messages ([09fee28](https://github.com/salesforcecli/plugin-env/commit/09fee28c202565c92debbdd956c12225db847e26)) - +- circleci config ([2619bc3](https://github.com/salesforcecli/plugin-env/commit/2619bc3b0a7307c077e428ebf2221be385a67b27)) +- remove reference to plugin-auth messages ([09fee28](https://github.com/salesforcecli/plugin-env/commit/09fee28c202565c92debbdd956c12225db847e26)) ### Features -* add jwt auth flow for orgs ([f0e2587](https://github.com/salesforcecli/plugin-env/commit/f0e25877d54377991446a823236ddcc82ede50af)) -* add web login flow ([6f68a51](https://github.com/salesforcecli/plugin-env/commit/6f68a5171400224321ac4e9aa4be52ad8e87adae)) -* env list skeleton ([9a22dd7](https://github.com/salesforcecli/plugin-env/commit/9a22dd7a1344e6907bb572c4199161b84397e8b0)) - - - +- add jwt auth flow for orgs ([f0e2587](https://github.com/salesforcecli/plugin-env/commit/f0e25877d54377991446a823236ddcc82ede50af)) +- add web login flow ([6f68a51](https://github.com/salesforcecli/plugin-env/commit/6f68a5171400224321ac4e9aa4be52ad8e87adae)) +- env list skeleton ([9a22dd7](https://github.com/salesforcecli/plugin-env/commit/9a22dd7a1344e6907bb572c4199161b84397e8b0)) diff --git a/command-snapshot.json b/command-snapshot.json index 7c1b44c9..d82df114 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -1,57 +1,4 @@ [ - { - "command": "env:create:sandbox", - "plugin": "@salesforce/plugin-env", - "flags": [ - "alias", - "async", - "clone", - "definition-file", - "json", - "license-type", - "name", - "no-prompt", - "no-track-source", - "poll-interval", - "set-default", - "target-org", - "wait" - ], - "alias": [] - }, - { - "command": "env:create:scratch", - "plugin": "@salesforce/plugin-env", - "flags": [ - "alias", - "api-version", - "async", - "client-id", - "definition-file", - "duration-days", - "edition", - "json", - "no-ancestors", - "no-namespace", - "set-default", - "target-dev-hub", - "track-source", - "wait" - ], - "alias": [] - }, - { - "command": "env:delete:sandbox", - "plugin": "@salesforce/plugin-env", - "flags": ["json", "no-prompt", "target-org"], - "alias": [] - }, - { - "command": "env:delete:scratch", - "plugin": "@salesforce/plugin-env", - "flags": ["json", "no-prompt", "target-org"], - "alias": [] - }, { "command": "env:display", "plugin": "@salesforce/plugin-env", @@ -69,17 +16,5 @@ "plugin": "@salesforce/plugin-env", "flags": ["browser", "json", "path", "target-env", "url-only"], "alias": [] - }, - { - "command": "env:resume:sandbox", - "plugin": "@salesforce/plugin-env", - "flags": ["job-id", "json", "name", "target-org", "use-most-recent", "wait"], - "alias": [] - }, - { - "command": "env:resume:scratch", - "plugin": "@salesforce/plugin-env", - "flags": ["job-id", "json", "use-most-recent"], - "alias": [] } ] diff --git a/messages/create.sandbox.md b/messages/create.sandbox.md deleted file mode 100644 index 0724a31d..00000000 --- a/messages/create.sandbox.md +++ /dev/null @@ -1,123 +0,0 @@ -# summary - -Create a sandbox org. - -# description - -There are two ways to create a sandbox org: specify a definition file that contains the sandbox options or use the --name and --license-type flags to specify the two required options. If you want to set an option other than name or license type, such as apexClassId, you must use a definition file. - -# examples - -- Create a sandbox org using a definition file and give it the alias "MyDevSandbox". The production org that contains the sandbox license has the alias "prodOrg". - - <%= config.bin %> <%= command.id %> -f config/dev-sandbox-def.json --alias MyDevSandbox --target-org prodOrg - -- Create a sandbox org by directly specifying its name and type of license (Developer) instead of using a definition file. Set the sandbox org as your default. - - <%= config.bin %> <%= command.id %> --name mysandbox --license-type Developer --alias MyDevSandbox --target-org prodOrg --set-default - -# flags.setDefault.summary - -Set the sandbox org as your default org. - -# flags.alias.summary - -Alias for the sandbox org. - -# flags.alias.description - -When you create a sandbox, the generated usernames are based on the usernames present in the production org. To ensure uniqueness, the new usernames are appended with the name of the sandbox. For example, the username "user@example.com" in the production org results in the username "user@example.com.mysandbox" in a sandbox named "mysandbox". When you set an alias for a sandbox org, it's assigned to the resulting username of the user running this command. - -# flags.targetOrg.summary - -Username or alias of the production org that contains the sandbox license. - -# flags.targetOrg.description - -When it creates the sandbox org, Salesforce copies the metadata, and optionally data, from your production org to the new sandbox org. - -# flags.definitionFile.summary - -Path to a sandbox definition file. - -# flags.definitionFile.description - -The sandbox definition file is a blueprint for the sandbox. You can create different definition files for each sandbox type that you use in the development process. See for all the options you can specify in the defintion file. - -# flags.name.summary - -Name of the sandbox org. - -# flags.name.description - -The name must be a unique alphanumeric string (10 or fewer characters) to identify the sandbox. You can’t reuse a name while a sandbox is in the process of being deleted. - -# flags.clone.summary - -Name of the sandbox org to clone. - -# flags.clone.description - -The value of clone must be an existing sandbox in the same target-org. - -# flags.licenseType.summary - -Type of sandbox license. - -# flags.wait.summary - -Number of minutes to wait for the sandbox org to be ready. - -# flags.wait.description - -If the command continues to run after the wait period, the CLI returns control of the terminal to you and displays the "sf env resume sandbox" command you run to check the status of the create. The displayed command includes the job ID for the running sandbox creation. - -# flags.poll-interval.summary - -Number of seconds to wait between retries. - -# flags.async.summary - -Request the sandbox creation, but don't wait for it to complete. - -# flags.async.description - -The command immediately displays the job ID and returns control of the terminal to you. This way, you can continue to use the CLI. To check the status of the sandbox creation, run "sf env resume sandbox". - -# flags.noPrompt.summary - -Don't prompt for confirmation about the sandbox configuration. - -# flags.no-track-source.summary - -Do not use source tracking for this sandbox. - -# flags.no-track-source.description - -We recommend you enable source tracking in Developer and Developer Pro sandbox, which is why it's the default behavior. Source tracking allows you to track the changes you make to your metadata, both in your local project and in the sandbox, and to detect any conflicts between the two. - -To disable source tracking in the new sandbox, specify the --no-track-source flag. The main reason to disable source tracking is for performance. For example, while you probably want to deploy metadata and run Apex tests in your CI/CD jobs, you probably don't want to incur the costs of source tracking (checking for conflicts, polling the SourceMember object, various file system operations.) This is a good use case for disabling source tracking in the sandbox. - -# isConfigurationOk - -Is the configuration correct? - -# warning.NoSandboxNameDefined - -No SandboxName defined, generating new SandboxName: %s. - -# error.SandboxNameLength - -The sandbox name "%s" should be 10 or fewer characters. - -# error.UserNotSatisfiedWithSandboxConfig - -The sandbox request configuration isn't acceptable. - -# error.pollIntervalGreaterThanWait - -The poll interval (%d seconds) c - -# error.noCloneSource - -Could not find the clone sandbox name "%s" in the target org. diff --git a/messages/create_scratch.md b/messages/create_scratch.md deleted file mode 100644 index 37d6d064..00000000 --- a/messages/create_scratch.md +++ /dev/null @@ -1,109 +0,0 @@ -# summary - -Create a scratch org. - -# description - -There are two ways to create a scratch org: specify a definition file that contains the options or use the --edition flag to specify the one required option. If you want to set options other than the edition, such as org features or settings, you must use a definition file. - -You must specify a Dev Hub to create a scratch org, either with the --target-dev-hub flag or by setting your default Dev Hub with the target-dev-hub configuration variable. - -# examples - -- Create a Developer edition scratch org using your default Dev Hub and give the scratch org an alias: - - <%= config.bin %> <%= command.id %> --edition=developer --alias my-scratch-org - -- Specify the Dev Hub using its alias and a scratch org definition file. Set the scratch org as your default and specify that it expires in 3 days: - - <%= config.bin %> <%= command.id %> --target-dev-hub=MyHub --definition-file config/project-scratch-def.json --set-default --duration-days 3 - -# flags.target-hub.summary - -Username or alias of the Dev Hub org. - -# flags.target-hub.description - -Overrides the value of the target-dev-hub configuration variable, if set. - -# flags.alias.summary - -Alias for the scratch org. - -# flags.alias.description - -New scratch orgs include one administrator by default. The admin user's username is auto-generated and looks something like test-wvkpnfm5z113@example.com. When you set an alias for a new scratch org, it's assigned this username. - -# flags.set-default.summary - -Set the scratch org as your default org - -# flags.no-ancestors.summary - -Don't include second-generation managed package (2GP) ancestors in the scratch org. - -# flags.edition.summary - -Salesforce edition of the scratch org. - -# flags.async.summary - -Request the org, but don't wait for it to complete. - -# flags.async.description - -The command immediately displays the job ID and returns control of the terminal to you. This way, you can continue to use the CLI. To resume the scratch org creation, run "sf env resume scratch". - -# flags.edition.description - -The editions that begin with "partner-" are available only if the Dev Hub org is a Partner Business Org. - -# flags.definition-file.summary - -Path to a scratch org definition file. - -# flags.definition-file.description - -The scratch org definition file is a blueprint for the scratch org. It mimics the shape of an org that you use in the development life cycle, such as acceptance testing, packaging, or production. See for all the option you can specify in the definition file. - -# flags.client-id.summary - -Consumer key of the Dev Hub connected app. - -# flags.wait.summary - -Number of minutes to wait for the scratch org to be ready. - -# flags.wait.description - -If the command continues to run after the wait period, the CLI returns control of the terminal to you and displays the job ID. To resume the scratch org creation, run the env resume scratch command and pass it the job ID. - -# flags.track-source.summary - -Use source tracking for this scratch org. Set --no-track-source to disable source tracking. - -# flags.track-source.description - -We recommend you enable source tracking in scratch orgs, which is why it's the default behavior. Source tracking allows you to track the changes you make to your metadata, both in your local project and in the scratch org, and to detect any conflicts between the two. - -To disable source tracking in the new scratch org, specify the --no-track-source flag. The main reason to disable source tracking is for performance. For example, while you probably want to deploy metadata and run Apex tests in your CI/CD jobs, you probably don't want to incur the costs of source tracking (checking for conflicts, polling the SourceMember object, various file system operations.) This is a good use case for disabling source tracking in the scratch org. - -# flags.no-namespace.summary - -Create the scratch org with no namespace, even if the Dev Hub has a namespace. - -# flags.duration-days.summary - -Number of days before the org expires. - -# prompt.secret - -OAuth client secret of your personal connected app - -# success - -Your scratch org is ready. - -# action.resume - -Resume scratch org creation by running sf env resume scratch --job-id %s diff --git a/messages/delete_sandbox.md b/messages/delete_sandbox.md deleted file mode 100644 index ef24a357..00000000 --- a/messages/delete_sandbox.md +++ /dev/null @@ -1,45 +0,0 @@ -# summary - -Delete a sandbox. - -# description - -Specify a sandbox with either the username you used when you logged into it with "sf login", or the alias you gave the sandbox when you created it. Run "sf env list" to view all your environments, including sandboxes, and their aliases. - -# examples - -- Delete a sandbox with alias my-sandbox: - - <%= config.bin %> <%= command.id %> --target-org=my-sandbox - -- Specify a username instead of an alias: - - <%= config.bin %> <%= command.id %> --target-org=myusername@example.com.qa - -- Delete the sandbox without prompting to confirm : - - <%= config.bin %> <%= command.id %> --target-org=my-sandbox --no-prompt - -# flags.target-org.summary - -Sandbox alias or login user. - -# flags.no-prompt.summary - -Don't prompt the user to confirm the deletion. - -# prompt.confirm - -Are you sure you want to delete the sandbox with name: %s? - -# success - -Successfully marked sandbox %s for deletion. - -# success.Idempotent - -There is no sandbox with the username %s. - -# error.isNotSandbox - -The target org, %s, is not a sandbox. diff --git a/messages/delete_scratch.md b/messages/delete_scratch.md deleted file mode 100644 index 7620c853..00000000 --- a/messages/delete_scratch.md +++ /dev/null @@ -1,41 +0,0 @@ -# summary - -Delete a scratch org. - -# description - -Specify a scratch org with either the username you used when you logged into it with "sf login", or the alias you gave the scratch org when you created it. Run "sf env list" to view all your environments, including scratch orgs, and their aliases. - -# examples - -- Delete a scratch org with alias my-scratch-org: - - <%= config.bin %> <%= command.id %> --target-org=my-scratch-org - -- Specify a username instead of an alias: - - <%= config.bin %> <%= command.id %> --target-org=test-123456-abcdefg@example.com - -- Delete the scratch org without prompting to confirm : - - <%= config.bin %> <%= command.id %> --target-org=my-scratch-org --no-prompt - -# flags.target-org.summary - -Scratch org alias or login user. - -# flags.no-prompt.summary - -Don't prompt the user to confirm the deletion. - -# prompt.confirm - -Are you sure you want to delete the scratch org with name: %s? - -# success - -Successfully marked scratch org %s for deletion. - -# success.Idempotent - -Successfully deleted scratch org %s. diff --git a/messages/resume.sandbox.md b/messages/resume.sandbox.md deleted file mode 100644 index c4a5af25..00000000 --- a/messages/resume.sandbox.md +++ /dev/null @@ -1,71 +0,0 @@ -# summary - -Check the status of a sandbox creation, and log in to it if it's ready. - -# description - -Sandbox creation can take a long time. If the original "sf env create sandbox" command either times out, or you specified the --async flag, the command displays a job ID. Use this job ID to check whether the sandbox creation is complete, and if it is, the command then logs into it. - -You can also use the sandbox name to check the status or the --use-most-recent flag to use the job ID of the most recent sandbox creation. - -# examples - -- Check the status of a sandbox creation using its name and specify a production org with alias "prodOrg": - - <%= config.bin %> <%= command.id %> --name mysandbox --target-org prodOrg - -- Check the status using the job ID: - - <%= config.bin %> <%= command.id %> --job-id 0GRxxxxxxxx - -- Check the status of the most recent sandbox create request: - - <%= config.bin %> <%= command.id %> --use-most-recent - -# flags.id.summary - -Job ID of the incomplete sandbox creation that you want to check the status of. - -# flags.id.description - -The job ID is valid for 24 hours after you start the sandbox creation. - -# flags.targetOrg.summary - -Username or alias of the production org that contains the sandbox license. - -# flags.targetOrg.description - -When it creates the sandbox org, Salesforce copies the metadata, and optionally data, from your production org to the new sandbox org. - -# flags.name.summary - -Name of the sandbox org. - -# flags.wait.summary - -Number of minutes to wait for the sandbox org to be ready. - -# flags.wait.description - -If the command continues to run after the wait period, the CLI returns control of the terminal window to you and returns the job ID. To resume checking the sandbox creation, rerun this command. - -# flags.use-most-recent.summary - -Use the most recent sandbox create request. - -# error.NoSandboxNameOrJobId - -No sandbox name or job ID were provided. - -# error.LatestSandboxRequestNotFound - -Retry the command using either the --name or --job-id flags. - -# error.NoSandboxRequestFound - -Couldn't find a sandbox creation request using the provided sandbox name or job ID. - -# error.SandboxNameLength - -The sandbox name "%s" should be 10 or fewer characters. diff --git a/messages/resume_scratch.md b/messages/resume_scratch.md deleted file mode 100644 index 3381d00a..00000000 --- a/messages/resume_scratch.md +++ /dev/null @@ -1,41 +0,0 @@ -# summary - -Resume the creation of an incomplete scratch org. - -# description - -When the original "sf env create scratch" command either times out or is run with the --async flag, it displays a job ID. - -Run this command by either passing it a job ID or using the --use-most-recent flag to specify the most recent incomplete scratch org. - -# examples - -- Resume a scratch org create with a job ID: - - <%= config.bin %> <%= command.id %> --job-id 2SR3u0000008fBDGAY - -- Resume your most recent incomplete scratch org: - - <%= config.bin %> <%= command.id %> --use-most-recent - -# flags.job-id.summary - -Job ID of the incomplete scratch org create that you want to resume. - -# flags.job-id.description - -The job ID is the same as the record ID of the incomplete scratch org in the ScratchOrgInfo object of the Dev Hub. - -The job ID is valid for 24 hours after you start the scratch org creation. - -# flags.use-most-recent.summary - -Use the job ID of the most recent incomplete scratch org. - -# error.NoRecentJobId - -There are no recent job IDs (ScratchOrgInfo requests) in your cache. Maybe it completed or already resumed? - -# success - -Your scratch org is ready. diff --git a/messages/sandboxbase.md b/messages/sandboxbase.md deleted file mode 100644 index ef609151..00000000 --- a/messages/sandboxbase.md +++ /dev/null @@ -1,17 +0,0 @@ -# sandboxSuccess - -The sandbox org creation was successful. - -# sandboxSuccess.actions - -The username for the sandbox is %s. -You can open the org by running "sf env open -e %s" - -# checkSandboxStatus - -Run "sf env resume sandbox --job-id %s -o %s" to check for status. -If the org is ready, checking the status also authorizes the org for use with Salesforce CLI. - -# warning.ClientTimeoutWaitingForSandboxCreate - -The wait time for the sandbox creation has been exhausted. Please see the results below for more information. diff --git a/package.json b/package.json index be14c9a5..149106cb 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,13 @@ { "name": "@salesforce/plugin-env", "description": "An sf plugin for logging into and interacting with different Salesforce environments.", - "version": "1.6.0", + "version": "2.0.0", "author": "Salesforce", "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": { "@oclif/core": "^2.0.7", "@salesforce/core": "^3.32.11", - "@salesforce/kit": "^1.8.2", "@salesforce/sf-plugins-core": "^2.0.1", - "chalk": "^4", "change-case": "^4.1.2", "open": "^8.4.0", "tslib": "^2" @@ -86,18 +84,7 @@ ], "topics": { "env": { - "description": "Commands to manage your environments, such as orgs and compute environments.", - "subtopics": { - "create": { - "description": "Commands to create environments." - }, - "resume": { - "description": "Commands to resume environment creation." - }, - "delete": { - "description": "Commands to delete environments." - } - } + "description": "Commands to manage your environments, such as orgs and compute environments." } } }, @@ -128,4 +115,4 @@ "access": "public" }, "main": "lib/index.js" -} \ No newline at end of file +} diff --git a/schemas/env-create-sandbox.json b/schemas/env-create-sandbox.json deleted file mode 100644 index 1f08f7ea..00000000 --- a/schemas/env-create-sandbox.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/SandboxProcessObject", - "definitions": { - "SandboxProcessObject": { - "type": "object", - "properties": { - "Id": { - "type": "string" - }, - "Status": { - "type": "string" - }, - "SandboxName": { - "type": "string" - }, - "SandboxInfoId": { - "type": "string" - }, - "LicenseType": { - "type": "string" - }, - "CreatedDate": { - "type": "string" - }, - "SandboxOrganization": { - "type": "string" - }, - "CopyProgress": { - "type": "number" - }, - "SourceId": { - "type": "string" - }, - "Description": { - "type": "string" - }, - "ApexClassId": { - "type": "string" - }, - "EndDate": { - "type": "string" - } - }, - "required": [ - "Id", - "Status", - "SandboxName", - "SandboxInfoId", - "LicenseType", - "CreatedDate" - ], - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/schemas/env-create-scratch.json b/schemas/env-create-scratch.json deleted file mode 100644 index ab849aed..00000000 --- a/schemas/env-create-scratch.json +++ /dev/null @@ -1,358 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/ScratchCreateResponse", - "definitions": { - "ScratchCreateResponse": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "scratchOrgInfo": { - "$ref": "#/definitions/ScratchOrgInfo" - }, - "authFields": { - "$ref": "#/definitions/AuthFields" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "orgId": { - "type": "string" - } - }, - "required": [ - "scratchOrgInfo", - "warnings", - "orgId" - ], - "additionalProperties": false - }, - "ScratchOrgInfo": { - "type": "object", - "properties": { - "AdminEmail": { - "type": "string" - }, - "CreatedDate": { - "type": "string" - }, - "ConnectedAppCallbackUrl": { - "type": "string" - }, - "ConnectedAppConsumerKey": { - "type": "string" - }, - "Country": { - "type": "string" - }, - "Description": { - "type": "string" - }, - "DurationDays": { - "type": "number" - }, - "Edition": { - "type": "string" - }, - "ErrorCode": { - "type": "string" - }, - "ExpirationDate": { - "type": "string" - }, - "Features": { - "type": "string" - }, - "HasSampleData": { - "type": "boolean" - }, - "Id": { - "type": "string" - }, - "Language": { - "type": "string" - }, - "LoginUrl": { - "type": "string" - }, - "Name": { - "type": "string" - }, - "Namespace": { - "type": "string" - }, - "OrgName": { - "type": "string" - }, - "Release": { - "type": "string", - "enum": [ - "Current", - "Previous", - "Preview" - ] - }, - "ScratchOrg": { - "type": "string" - }, - "SourceOrg": { - "type": "string" - }, - "AuthCode": { - "type": "string" - }, - "Snapshot": { - "type": "string" - }, - "Status": { - "type": "string", - "enum": [ - "New", - "Creating", - "Active", - "Error", - "Deleted" - ] - }, - "SignupEmail": { - "type": "string" - }, - "SignupUsername": { - "type": "string" - }, - "SignupInstance": { - "type": "string" - }, - "Username": { - "type": "string" - }, - "settings": { - "type": "object", - "additionalProperties": {} - }, - "objectSettings": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ObjectSetting" - } - }, - "orgPreferences": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - } - }, - "disabled": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "enabled", - "disabled" - ], - "additionalProperties": false - } - }, - "required": [ - "LoginUrl", - "AuthCode", - "Status", - "SignupEmail", - "SignupUsername", - "SignupInstance", - "Username" - ], - "additionalProperties": false - }, - "ObjectSetting": { - "type": "object", - "properties": { - "sharingModel": { - "type": "string" - }, - "defaultRecordType": { - "type": "string" - } - }, - "additionalProperties": { - "$ref": "#/definitions/Optional%3CAnyJson%3E" - } - }, - "Optional": { - "anyOf": [ - { - "$ref": "#/definitions/AnyJson" - }, - { - "not": {} - } - ], - "description": "A union type for either the parameterized type `T` or `undefined` -- the opposite of {@link NonOptional } ." - }, - "AnyJson": { - "anyOf": [ - { - "$ref": "#/definitions/JsonPrimitive" - }, - { - "$ref": "#/definitions/JsonCollection" - } - ], - "description": "Any valid JSON value." - }, - "JsonPrimitive": { - "type": [ - "null", - "boolean", - "number", - "string" - ], - "description": "Any valid JSON primitive value." - }, - "JsonCollection": { - "anyOf": [ - { - "$ref": "#/definitions/JsonMap" - }, - { - "$ref": "#/definitions/JsonArray" - } - ], - "description": "Any valid JSON collection value." - }, - "JsonMap": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Optional%3CAnyJson%3E" - }, - "properties": {}, - "description": "Any JSON-compatible object." - }, - "JsonArray": { - "type": "array", - "items": { - "$ref": "#/definitions/AnyJson" - }, - "description": "Any JSON-compatible array." - }, - "AuthFields": { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "alias": { - "type": "string" - }, - "authCode": { - "type": "string" - }, - "clientId": { - "type": "string" - }, - "clientSecret": { - "type": "string" - }, - "created": { - "type": "string" - }, - "createdOrgInstance": { - "type": "string" - }, - "devHubUsername": { - "type": "string" - }, - "instanceUrl": { - "type": "string" - }, - "instanceApiVersion": { - "type": "string" - }, - "instanceApiVersionLastRetrieved": { - "type": "string" - }, - "isDevHub": { - "type": "boolean" - }, - "loginUrl": { - "type": "string" - }, - "orgId": { - "type": "string" - }, - "password": { - "type": "string" - }, - "privateKey": { - "type": "string" - }, - "refreshToken": { - "type": "string" - }, - "scratchAdminUsername": { - "type": "string" - }, - "snapshot": { - "type": "string" - }, - "userId": { - "type": "string" - }, - "username": { - "type": "string" - }, - "usernames": { - "type": "array", - "items": { - "type": "string" - } - }, - "userProfileName": { - "type": "string" - }, - "expirationDate": { - "type": "string" - }, - "tracksSource": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "instanceName": { - "type": "string" - }, - "namespacePrefix": { - "type": [ - "string", - "null" - ] - }, - "isSandbox": { - "type": "boolean" - }, - "isScratch": { - "type": "boolean" - }, - "trailExpirationDate": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false, - "description": "Fields for authorization, org, and local information." - } - } -} \ No newline at end of file diff --git a/schemas/env-delete-sandbox.json b/schemas/env-delete-sandbox.json deleted file mode 100644 index 0c4ecc6a..00000000 --- a/schemas/env-delete-sandbox.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/SandboxDeleteResponse", - "definitions": { - "SandboxDeleteResponse": { - "type": "object", - "properties": { - "orgId": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "required": [ - "orgId", - "username" - ], - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/schemas/env-delete-scratch.json b/schemas/env-delete-scratch.json deleted file mode 100644 index 1bf365ed..00000000 --- a/schemas/env-delete-scratch.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/ScratchDeleteResponse", - "definitions": { - "ScratchDeleteResponse": { - "type": "object", - "properties": { - "orgId": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "required": [ - "orgId", - "username" - ], - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/schemas/env-resume-sandbox.json b/schemas/env-resume-sandbox.json deleted file mode 100644 index 1f08f7ea..00000000 --- a/schemas/env-resume-sandbox.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/SandboxProcessObject", - "definitions": { - "SandboxProcessObject": { - "type": "object", - "properties": { - "Id": { - "type": "string" - }, - "Status": { - "type": "string" - }, - "SandboxName": { - "type": "string" - }, - "SandboxInfoId": { - "type": "string" - }, - "LicenseType": { - "type": "string" - }, - "CreatedDate": { - "type": "string" - }, - "SandboxOrganization": { - "type": "string" - }, - "CopyProgress": { - "type": "number" - }, - "SourceId": { - "type": "string" - }, - "Description": { - "type": "string" - }, - "ApexClassId": { - "type": "string" - }, - "EndDate": { - "type": "string" - } - }, - "required": [ - "Id", - "Status", - "SandboxName", - "SandboxInfoId", - "LicenseType", - "CreatedDate" - ], - "additionalProperties": false - } - } -} \ No newline at end of file diff --git a/schemas/env-resume-scratch.json b/schemas/env-resume-scratch.json deleted file mode 100644 index ab849aed..00000000 --- a/schemas/env-resume-scratch.json +++ /dev/null @@ -1,358 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$ref": "#/definitions/ScratchCreateResponse", - "definitions": { - "ScratchCreateResponse": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "scratchOrgInfo": { - "$ref": "#/definitions/ScratchOrgInfo" - }, - "authFields": { - "$ref": "#/definitions/AuthFields" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "orgId": { - "type": "string" - } - }, - "required": [ - "scratchOrgInfo", - "warnings", - "orgId" - ], - "additionalProperties": false - }, - "ScratchOrgInfo": { - "type": "object", - "properties": { - "AdminEmail": { - "type": "string" - }, - "CreatedDate": { - "type": "string" - }, - "ConnectedAppCallbackUrl": { - "type": "string" - }, - "ConnectedAppConsumerKey": { - "type": "string" - }, - "Country": { - "type": "string" - }, - "Description": { - "type": "string" - }, - "DurationDays": { - "type": "number" - }, - "Edition": { - "type": "string" - }, - "ErrorCode": { - "type": "string" - }, - "ExpirationDate": { - "type": "string" - }, - "Features": { - "type": "string" - }, - "HasSampleData": { - "type": "boolean" - }, - "Id": { - "type": "string" - }, - "Language": { - "type": "string" - }, - "LoginUrl": { - "type": "string" - }, - "Name": { - "type": "string" - }, - "Namespace": { - "type": "string" - }, - "OrgName": { - "type": "string" - }, - "Release": { - "type": "string", - "enum": [ - "Current", - "Previous", - "Preview" - ] - }, - "ScratchOrg": { - "type": "string" - }, - "SourceOrg": { - "type": "string" - }, - "AuthCode": { - "type": "string" - }, - "Snapshot": { - "type": "string" - }, - "Status": { - "type": "string", - "enum": [ - "New", - "Creating", - "Active", - "Error", - "Deleted" - ] - }, - "SignupEmail": { - "type": "string" - }, - "SignupUsername": { - "type": "string" - }, - "SignupInstance": { - "type": "string" - }, - "Username": { - "type": "string" - }, - "settings": { - "type": "object", - "additionalProperties": {} - }, - "objectSettings": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ObjectSetting" - } - }, - "orgPreferences": { - "type": "object", - "properties": { - "enabled": { - "type": "array", - "items": { - "type": "string" - } - }, - "disabled": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "enabled", - "disabled" - ], - "additionalProperties": false - } - }, - "required": [ - "LoginUrl", - "AuthCode", - "Status", - "SignupEmail", - "SignupUsername", - "SignupInstance", - "Username" - ], - "additionalProperties": false - }, - "ObjectSetting": { - "type": "object", - "properties": { - "sharingModel": { - "type": "string" - }, - "defaultRecordType": { - "type": "string" - } - }, - "additionalProperties": { - "$ref": "#/definitions/Optional%3CAnyJson%3E" - } - }, - "Optional": { - "anyOf": [ - { - "$ref": "#/definitions/AnyJson" - }, - { - "not": {} - } - ], - "description": "A union type for either the parameterized type `T` or `undefined` -- the opposite of {@link NonOptional } ." - }, - "AnyJson": { - "anyOf": [ - { - "$ref": "#/definitions/JsonPrimitive" - }, - { - "$ref": "#/definitions/JsonCollection" - } - ], - "description": "Any valid JSON value." - }, - "JsonPrimitive": { - "type": [ - "null", - "boolean", - "number", - "string" - ], - "description": "Any valid JSON primitive value." - }, - "JsonCollection": { - "anyOf": [ - { - "$ref": "#/definitions/JsonMap" - }, - { - "$ref": "#/definitions/JsonArray" - } - ], - "description": "Any valid JSON collection value." - }, - "JsonMap": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Optional%3CAnyJson%3E" - }, - "properties": {}, - "description": "Any JSON-compatible object." - }, - "JsonArray": { - "type": "array", - "items": { - "$ref": "#/definitions/AnyJson" - }, - "description": "Any JSON-compatible array." - }, - "AuthFields": { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "alias": { - "type": "string" - }, - "authCode": { - "type": "string" - }, - "clientId": { - "type": "string" - }, - "clientSecret": { - "type": "string" - }, - "created": { - "type": "string" - }, - "createdOrgInstance": { - "type": "string" - }, - "devHubUsername": { - "type": "string" - }, - "instanceUrl": { - "type": "string" - }, - "instanceApiVersion": { - "type": "string" - }, - "instanceApiVersionLastRetrieved": { - "type": "string" - }, - "isDevHub": { - "type": "boolean" - }, - "loginUrl": { - "type": "string" - }, - "orgId": { - "type": "string" - }, - "password": { - "type": "string" - }, - "privateKey": { - "type": "string" - }, - "refreshToken": { - "type": "string" - }, - "scratchAdminUsername": { - "type": "string" - }, - "snapshot": { - "type": "string" - }, - "userId": { - "type": "string" - }, - "username": { - "type": "string" - }, - "usernames": { - "type": "array", - "items": { - "type": "string" - } - }, - "userProfileName": { - "type": "string" - }, - "expirationDate": { - "type": "string" - }, - "tracksSource": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "instanceName": { - "type": "string" - }, - "namespacePrefix": { - "type": [ - "string", - "null" - ] - }, - "isSandbox": { - "type": "boolean" - }, - "isScratch": { - "type": "boolean" - }, - "trailExpirationDate": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false, - "description": "Fields for authorization, org, and local information." - } - } -} \ No newline at end of file diff --git a/src/commands/env/create/sandbox.ts b/src/commands/env/create/sandbox.ts deleted file mode 100644 index 47204e4f..00000000 --- a/src/commands/env/create/sandbox.ts +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as fs from 'fs'; -import { Flags } from '@salesforce/sf-plugins-core'; -import { - Lifecycle, - Messages, - Org, - SandboxEvents, - SandboxProcessObject, - SandboxRequest, - SfError, -} from '@salesforce/core'; -import { Ux } from '@salesforce/sf-plugins-core/lib/ux'; -import { Interfaces } from '@oclif/core'; -import { SandboxCommandBase } from '../../../shared/sandboxCommandBase'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'create.sandbox'); - -export enum SandboxLicenseType { - developer = 'Developer', - developerPro = 'Developer_Pro', - partial = 'Partial', - full = 'Full', -} - -const getLicenseTypes = (): string[] => Object.values(SandboxLicenseType); - -type SandboxConfirmData = SandboxRequest & { CloneSource?: string }; - -export default class CreateSandbox extends SandboxCommandBase { - public static summary = messages.getMessage('summary'); - public static description = messages.getMessage('description'); - public static examples = messages.getMessages('examples'); - - public static flags = { - // needs to change when new flags are available - 'definition-file': Flags.file({ - exists: true, - char: 'f', - summary: messages.getMessage('flags.definitionFile.summary'), - description: messages.getMessage('flags.definitionFile.description'), - exclusive: ['name', 'license-type'], - }), - 'set-default': Flags.boolean({ - char: 's', - summary: messages.getMessage('flags.setDefault.summary'), - }), - alias: Flags.string({ - char: 'a', - summary: messages.getMessage('flags.alias.summary'), - description: messages.getMessage('flags.alias.description'), - }), - wait: Flags.duration({ - char: 'w', - summary: messages.getMessage('flags.wait.summary'), - description: messages.getMessage('flags.wait.description'), - min: 1, - unit: 'minutes', - defaultValue: 30, - helpValue: '', - exclusive: ['async'], - }), - 'poll-interval': Flags.duration({ - char: 'i', - summary: messages.getMessage('flags.poll-interval.summary'), - min: 15, - unit: 'seconds', - defaultValue: 30, - helpValue: '', - exclusive: ['async'], - }), - async: Flags.boolean({ - summary: messages.getMessage('flags.async.summary'), - description: messages.getMessage('flags.async.description'), - exclusive: ['wait', 'poll-interval'], - }), - name: Flags.string({ - char: 'n', - summary: messages.getMessage('flags.name.summary'), - description: messages.getMessage('flags.name.description'), - exclusive: ['definition-file'], - parse: (name: string): Promise => { - if (name.length > 10) { - throw messages.createError('error.SandboxNameLength', [name]); - } - return Promise.resolve(name); - }, - }), - clone: Flags.string({ - char: 'c', - summary: messages.getMessage('flags.clone.summary'), - description: messages.getMessage('flags.clone.description'), - exclusive: ['license-type'], - }), - 'license-type': Flags.string({ - char: 'l', - summary: messages.getMessage('flags.licenseType.summary'), - exclusive: ['definition-file', 'clone'], - options: getLicenseTypes(), - default: SandboxLicenseType.developer, - }), - 'target-org': Flags.requiredOrg({ - char: 'o', - summary: messages.getMessage('flags.targetOrg.summary'), - description: messages.getMessage('flags.targetOrg.description'), - }), - 'no-prompt': Flags.boolean({ - summary: messages.getMessage('flags.noPrompt.summary'), - }), - 'no-track-source': Flags.boolean({ - summary: messages.getMessage('flags.no-track-source.summary'), - description: messages.getMessage('flags.no-track-source.description'), - allowNo: false, - }), - }; - public static readonly state = 'beta'; - protected readonly lifecycleEventNames = ['postorgcreate']; - private flags: Interfaces.InferredFlags; - - public async run(): Promise { - this.sandboxRequestConfig = await this.getSandboxRequestConfig(); - this.flags = (await this.parse(CreateSandbox)).flags; - this.debug('Create started with args %s ', this.flags); - this.validateFlags(); - return this.createSandbox(); - } - - protected getCheckSandboxStatusParams(): string[] { - return [this.latestSandboxProgressObj.Id, this.flags['target-org'].getUsername()]; - } - - private async createSandboxRequest(prodOrg: Org): Promise { - let sandboxDefFileContents = this.readJsonDefFile() || {}; - - if (sandboxDefFileContents) { - sandboxDefFileContents = lowerToUpper(sandboxDefFileContents); - } - - // build sandbox request from data provided - const sandboxReq: SandboxRequest = { - SandboxName: undefined, - ...sandboxDefFileContents, - ...Object.assign({}, this.flags.name ? { SandboxName: this.flags.name } : {}), - ...Object.assign( - {}, - sandboxDefFileContents['LicenseType'] - ? { LicenseType: sandboxDefFileContents['LicenseType'] as string } - : { LicenseType: this.flags['license-type'] } - ), - }; - - if (!sandboxReq.SandboxName) { - // sandbox names are 10 chars or less, a radix of 36 = [a-z][0-9] - // see https://help.salesforce.com/s/articleView?id=sf.data_sandbox_create.htm&type=5 for sandbox naming criteria - // technically without querying the production org, the generated name could already exist, - // but the chances of that are lower than the perf penalty of querying and verifying - sandboxReq.SandboxName = `sbx${Date.now().toString(36).slice(-7)}`; - this.info(messages.createWarning('warning.NoSandboxNameDefined', [sandboxReq.SandboxName])); - } - - const sourceId = await this.getSourceId(prodOrg); - if (sourceId) { - sandboxReq.SourceId = sourceId; - delete sandboxReq.LicenseType; - } - return sandboxReq; - } - - private async createSandbox(): Promise { - this.prodOrg = this.flags['target-org']; - const lifecycle = Lifecycle.getInstance(); - - this.registerLifecycleListeners(lifecycle, { - isAsync: this.flags.async, - setDefault: this.flags['set-default'], - alias: this.flags.alias, - prodOrg: this.prodOrg, - tracksSource: this.flags['no-track-source'] === true ? false : undefined, - }); - const sandboxReq = await this.createSandboxRequest(this.prodOrg); - await this.confirmSandboxReq({ ...sandboxReq, ...(this.flags.clone ? { CloneSource: this.flags.clone } : {}) }); - this.initSandboxProcessData(this.prodOrg, sandboxReq); - - if (!this.flags.async) { - this.spinner.start('Sandbox Create'); - } - - this.debug('Calling create with SandboxRequest: %s ', sandboxReq); - - try { - const sandboxProcessObject = await this.prodOrg.createSandbox(sandboxReq, { - wait: this.flags.wait, - interval: this.flags['poll-interval'], - async: this.flags.async, - }); - this.latestSandboxProgressObj = sandboxProcessObject; - this.saveSandboxProgressConfig(); - if (this.flags.async) { - process.exitCode = 68; - } - return sandboxProcessObject; - } catch (err) { - this.spinner.stop(); - const error = err as SfError; - if (this.pollingTimeOut) { - void lifecycle.emit(SandboxEvents.EVENT_ASYNC_RESULT, undefined); - process.exitCode = 68; - return this.latestSandboxProgressObj; - } else if (error.name === 'SandboxCreateNotCompleteError') { - void lifecycle.emit(SandboxEvents.EVENT_ASYNC_RESULT, undefined); - process.exitCode = 68; - return this.latestSandboxProgressObj; - } - throw err; - } - } - - private initSandboxProcessData(prodOrg: Org, sandboxReq: SandboxRequest): void { - this.sandboxRequestData.alias = this.flags.alias; - this.sandboxRequestData.setDefault = this.flags['set-default']; - this.sandboxRequestData.prodOrgUsername = prodOrg.getUsername(); - this.sandboxRequestData.sandboxProcessObject.SandboxName = sandboxReq.SandboxName; - this.sandboxRequestData.sandboxRequest = sandboxReq; - this.sandboxRequestData.tracksSource = this.flags['no-track-source'] === true ? false : undefined; - this.saveSandboxProgressConfig(); - } - - private readJsonDefFile(): Record { - // the -f option - if (this.flags['definition-file']) { - this.debug('Reading JSON DefFile %s ', this.flags['definition-file']); - return JSON.parse(fs.readFileSync(this.flags['definition-file'], 'utf-8')) as Record; - } - } - - private async confirmSandboxReq(sandboxReq: SandboxConfirmData): Promise { - if (this.flags['no-prompt'] || this.jsonEnabled()) return; - - const columns: Ux.Table.Columns<{ key: string; value: unknown }> = { - key: { header: 'Field' }, - value: { header: 'Value' }, - }; - - const data = Object.entries(sandboxReq).map(([key, value]) => ({ key, value })); - this.styledHeader('Config Sandbox Request'); - this.table(data, columns, {}); - - const configurationCorrect = await this.timedPrompt<{ continue: boolean }>( - [ - { - name: 'continue', - type: 'confirm', - message: messages.getMessage('isConfigurationOk'), - }, - ], - 10_000 - ); - if (!configurationCorrect.continue) { - throw messages.createError('error.UserNotSatisfiedWithSandboxConfig'); - } - } - - private validateFlags(): void { - if (this.flags['poll-interval'].seconds > this.flags.wait.seconds) { - throw messages.createError('error.pollIntervalGreaterThanWait', [ - this.flags['poll-interval'].seconds, - this.flags.wait.seconds, - ]); - } - } - - private async getSourceId(prodOrg: Org): Promise { - if (!this.flags.clone) { - return undefined; - } - try { - const sourceOrg = await prodOrg.querySandboxProcessBySandboxName(this.flags.clone); - return sourceOrg.SandboxInfoId; - } catch (err) { - throw messages.createError('error.noCloneSource', [this.flags.clone], [], err as Error); - } - } -} - -const lowerToUpper = (object: Record): Record => - Object.fromEntries(Object.entries(object).map(([k, v]) => [`${k.charAt(0).toUpperCase()}${k.slice(1)}`, v])); diff --git a/src/commands/env/create/scratch.ts b/src/commands/env/create/scratch.ts deleted file mode 100644 index d4f077a6..00000000 --- a/src/commands/env/create/scratch.ts +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as fs from 'fs'; -import { Duration } from '@salesforce/kit'; -import { - Messages, - ScratchOrgCreateOptions, - Lifecycle, - ScratchOrgLifecycleEvent, - scratchOrgLifecycleEventName, - Org, - scratchOrgCreate, - SfError, -} from '@salesforce/core'; -import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; -import { buildStatus } from '../../../shared/scratchOrgOutput'; -import { ScratchCreateResponse } from '../../../types'; -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'create_scratch'); - -export const secretTimeout = 60000; - -export default class EnvCreateScratch extends SfCommand { - public static readonly summary = messages.getMessage('summary'); - public static readonly description = messages.getMessage('description'); - public static readonly examples = messages.getMessages('examples'); - public static readonly state = 'beta'; - - public static readonly flags = { - alias: Flags.string({ - char: 'a', - summary: messages.getMessage('flags.alias.summary'), - description: messages.getMessage('flags.alias.description'), - }), - async: Flags.boolean({ - summary: messages.getMessage('flags.async.summary'), - description: messages.getMessage('flags.async.description'), - }), - 'set-default': Flags.boolean({ - char: 'd', - summary: messages.getMessage('flags.set-default.summary'), - }), - 'definition-file': Flags.file({ - exists: true, - char: 'f', - summary: messages.getMessage('flags.definition-file.summary'), - description: messages.getMessage('flags.definition-file.description'), - exactlyOne: ['definition-file', 'edition'], - }), - 'target-dev-hub': Flags.requiredHub({ - char: 'v', - summary: messages.getMessage('flags.target-hub.summary'), - description: messages.getMessage('flags.target-hub.description'), - }), - 'no-ancestors': Flags.boolean({ - char: 'c', - summary: messages.getMessage('flags.no-ancestors.summary'), - helpGroup: 'Packaging', - }), - edition: Flags.string({ - char: 'e', - summary: messages.getMessage('flags.edition.summary'), - description: messages.getMessage('flags.edition.description'), - options: [ - 'developer', - 'enterprise', - 'group', - 'professional', - 'partner-developer', - 'partner-enterprise', - 'partner-group', - 'partner-professional', - ], - exactlyOne: ['definition-file', 'edition'], - }), - 'no-namespace': Flags.boolean({ - char: 'm', - summary: messages.getMessage('flags.no-namespace.summary'), - helpGroup: 'Packaging', - }), - 'duration-days': Flags.duration({ - unit: 'days', - defaultValue: 7, - min: 1, - max: 30, - char: 'y', - helpValue: '', - summary: messages.getMessage('flags.duration-days.summary'), - }), - wait: Flags.duration({ - unit: 'minutes', - defaultValue: 5, - min: 2, - char: 'w', - helpValue: '', - summary: messages.getMessage('flags.wait.summary'), - description: messages.getMessage('flags.wait.description'), - }), - 'api-version': Flags.orgApiVersion(), - 'client-id': Flags.string({ - char: 'i', - summary: messages.getMessage('flags.client-id.summary'), - }), - 'track-source': Flags.boolean({ - default: true, - char: 't', - summary: messages.getMessage('flags.track-source.summary'), - description: messages.getMessage('flags.track-source.description'), - allowNo: true, - }), - }; - public async run(): Promise { - const lifecycle = Lifecycle.getInstance(); - const { flags } = await this.parse(EnvCreateScratch); - const baseUrl = flags['target-dev-hub'].getField(Org.Fields.INSTANCE_URL).toString(); - const orgConfig = flags['definition-file'] - ? (JSON.parse(await fs.promises.readFile(flags['definition-file'], 'utf-8')) as Record) - : { edition: flags.edition }; - - const createCommandOptions: ScratchOrgCreateOptions = { - hubOrg: flags['target-dev-hub'], - clientSecret: flags['client-id'] ? await this.clientSecretPrompt() : undefined, - connectedAppConsumerKey: flags['client-id'], - durationDays: flags['duration-days'].days, - nonamespace: flags['no-namespace'], - noancestors: flags['no-ancestors'], - wait: flags.async ? Duration.minutes(0) : flags.wait, - apiversion: flags['api-version'], - orgConfig, - alias: flags.alias, - setDefault: flags['set-default'], - tracksSource: flags['track-source'], - }; - - let lastStatus: string; - - if (!flags.async) { - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(scratchOrgLifecycleEventName, async (data): Promise => { - lastStatus = buildStatus(data, baseUrl); - this.spinner.status = lastStatus; - }); - } - this.log(); - this.spinner.start( - flags.async ? 'Requesting Scratch Org (will not wait for completion because --async)' : 'Creating Scratch Org' - ); - - try { - const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgCreate(createCommandOptions); - - this.spinner.stop(lastStatus); - this.log(); - if (flags.async) { - this.info(messages.getMessage('action.resume', [scratchOrgInfo.Id])); - } else { - this.logSuccess(messages.getMessage('success')); - } - - return { username, scratchOrgInfo, authFields, warnings, orgId: scratchOrgInfo.Id }; - } catch (error) { - if (error instanceof SfError && error.name === 'ScratchOrgInfoTimeoutError') { - this.spinner.stop(lastStatus); - const scratchOrgInfoId = (error.data as { scratchOrgInfoId: string }).scratchOrgInfoId; - const resumeMessage = messages.getMessage('action.resume', [scratchOrgInfoId]); - - this.info(resumeMessage); - this.error('The scratch org did not complete within your wait time', { code: '69', exit: 69 }); - } else { - throw error; - } - } - } - - private async clientSecretPrompt(): Promise { - const { secret } = await this.timedPrompt<{ secret: string }>( - [ - { - name: 'secret', - message: messages.getMessage('prompt.secret'), - type: 'password', - }, - ], - secretTimeout - ); - return secret; - } -} diff --git a/src/commands/env/delete/sandbox.ts b/src/commands/env/delete/sandbox.ts deleted file mode 100644 index 90fe6777..00000000 --- a/src/commands/env/delete/sandbox.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Messages } from '@salesforce/core'; -import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'delete_sandbox'); - -export interface SandboxDeleteResponse { - orgId: string; - username: string; -} -export default class EnvDeleteSandbox extends SfCommand { - public static readonly summary = messages.getMessage('summary'); - public static readonly description = messages.getMessage('description'); - public static readonly examples = messages.getMessages('examples'); - public static readonly flags = { - 'target-org': Flags.requiredOrg({ - summary: messages.getMessage('flags.target-org.summary'), - char: 'o', - }), - 'no-prompt': Flags.boolean({ - char: 'p', - summary: messages.getMessage('flags.no-prompt.summary'), - }), - }; - public static readonly state = 'beta'; - - public async run(): Promise { - const flags = (await this.parse(EnvDeleteSandbox)).flags; - const org = flags['target-org']; - - if (!(await org.isSandbox())) { - throw messages.createError('error.isNotSandbox', [org.getUsername()]); - } - - if (flags['no-prompt'] || (await this.confirm(messages.getMessage('prompt.confirm', [org.getUsername()])))) { - try { - await org.delete(); - this.logSuccess(messages.getMessage('success', [org.getUsername()])); - } catch (e) { - if (e instanceof Error && e.name === 'SandboxNotFound') { - this.logSuccess(messages.getMessage('success.Idempotent', [org.getUsername()])); - } else { - throw e; - } - } - - return { username: org.getUsername(), orgId: org.getOrgId() }; - } - } -} diff --git a/src/commands/env/delete/scratch.ts b/src/commands/env/delete/scratch.ts deleted file mode 100644 index 3429da58..00000000 --- a/src/commands/env/delete/scratch.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Messages } from '@salesforce/core'; -import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'delete_scratch'); - -export interface ScratchDeleteResponse { - orgId: string; - username: string; -} - -export default class EnvDeleteScratch extends SfCommand { - public static readonly summary = messages.getMessage('summary'); - public static readonly description = messages.getMessage('description'); - public static readonly examples = messages.getMessages('examples'); - public static readonly flags = { - 'target-org': Flags.requiredOrg({ - char: 'o', - summary: messages.getMessage('flags.target-org.summary'), - }), - 'no-prompt': Flags.boolean({ - char: 'p', - summary: messages.getMessage('flags.no-prompt.summary'), - }), - }; - public static readonly state = 'beta'; - - public async run(): Promise { - const flags = (await this.parse(EnvDeleteScratch)).flags; - const org = flags['target-org']; - - if (flags['no-prompt'] || (await this.confirm(messages.getMessage('prompt.confirm', [org.getUsername()])))) { - try { - await org.delete(); - this.logSuccess(messages.getMessage('success', [org.getUsername()])); - } catch (e) { - if (e instanceof Error && e.name === 'ScratchOrgNotFound') { - this.logSuccess(messages.getMessage('success.Idempotent', [org.getUsername()])); - } else { - throw e; - } - } - - return { username: org.getUsername(), orgId: org.getOrgId() }; - } - } -} diff --git a/src/commands/env/resume/sandbox.ts b/src/commands/env/resume/sandbox.ts deleted file mode 100644 index 36ad3ec2..00000000 --- a/src/commands/env/resume/sandbox.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Flags } from '@salesforce/sf-plugins-core'; -import { - StateAggregator, - Lifecycle, - Messages, - Org, - ResultEvent, - SandboxEvents, - SandboxProcessObject, - SandboxRequestCacheEntry, - ResumeSandboxRequest, - SandboxUserAuthResponse, - SfError, -} from '@salesforce/core'; -import { Duration } from '@salesforce/kit'; -import { Interfaces } from '@oclif/core'; -import { SandboxCommandBase } from '../../../shared/sandboxCommandBase'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'resume.sandbox'); - -export default class ResumeSandbox extends SandboxCommandBase { - public static summary = messages.getMessage('summary'); - public static description = messages.getMessage('description'); - public static examples = messages.getMessages('examples'); - - public static flags = { - wait: Flags.duration({ - char: 'w', - summary: messages.getMessage('flags.wait.summary'), - description: messages.getMessage('flags.wait.description'), - min: 0, - unit: 'minutes', - helpValue: '', - defaultValue: 0, - }), - name: Flags.string({ - char: 'n', - summary: messages.getMessage('flags.name.summary'), - parse: (name: string): Promise => { - if (name.length > 10) { - throw messages.createError('error.SandboxNameLength', [name]); - } - return Promise.resolve(name); - }, - exclusive: ['job-id'], - }), - 'job-id': Flags.salesforceId({ - startsWith: '0GR', - char: 'i', - summary: messages.getMessage('flags.id.summary'), - description: messages.getMessage('flags.id.description'), - exclusive: ['name'], - }), - 'use-most-recent': Flags.boolean({ - char: 'l', - summary: messages.getMessage('flags.use-most-recent.summary'), - }), - 'target-org': Flags.optionalOrg({ - char: 'o', - summary: messages.getMessage('flags.targetOrg.summary'), - description: messages.getMessage('flags.targetOrg.description'), - }), - }; - public static readonly state = 'beta'; - protected readonly lifecycleEventNames = ['postorgcreate']; - private flags: Interfaces.InferredFlags; - - public async run(): Promise { - this.sandboxRequestConfig = await this.getSandboxRequestConfig(); - this.flags = (await this.parse(ResumeSandbox)).flags; - this.debug('Resume started with args %s ', this.flags); - return this.resumeSandbox(); - } - - protected getCheckSandboxStatusParams(): string[] { - return [this.latestSandboxProgressObj.Id, this.flags['target-org'].getUsername()]; - } - - private createResumeSandboxRequest(): ResumeSandboxRequest { - if (this.flags['use-most-recent']) { - const [, sandboxRequestData] = this.sandboxRequestConfig.getLatestEntry(); - if (sandboxRequestData) { - return { SandboxName: sandboxRequestData.sandboxProcessObject?.SandboxName }; - } - } - // build resume sandbox request from data provided - return { - ...Object.assign({}, this.flags.name ? { SandboxName: this.flags.name } : {}), - ...Object.assign({}, this.flags['job-id'] ? { SandboxProcessObjId: this.flags['job-id'] } : {}), - }; - } - - private async resumeSandbox(): Promise { - this.sandboxRequestData = this.buildSandboxRequestCacheEntry(); - const prodOrgUsername: string = this.sandboxRequestData.prodOrgUsername; - - if (!this.sandboxRequestData.sandboxProcessObject.SandboxName) { - if (!this.flags['name'] && !this.flags['job-id']) { - throw messages.createError('error.NoSandboxNameOrJobId'); - } - } - this.prodOrg = await Org.create({ aliasOrUsername: prodOrgUsername }); - this.flags['target-org'] = this.prodOrg; - const lifecycle = Lifecycle.getInstance(); - - this.registerLifecycleListeners(lifecycle, { - isAsync: false, - alias: this.sandboxRequestData.alias, - setDefault: this.sandboxRequestData.setDefault, - prodOrg: this.prodOrg, - tracksSource: this.sandboxRequestData.tracksSource, - }); - - if ( - await this.verifyIfAuthExists( - this.prodOrg, - this.sandboxRequestData.sandboxProcessObject.SandboxName, - this.flags['job-id'], - lifecycle - ) - ) { - return this.latestSandboxProgressObj; - } - - const sandboxReq = this.createResumeSandboxRequest(); - - if (this.flags.wait?.seconds > 0) { - this.spinner.start('Resume Create'); - } - - this.debug('Calling create with ResumeSandboxRequest: %s ', sandboxReq); - - try { - return await this.prodOrg.resumeSandbox(sandboxReq, { - wait: this.flags.wait ?? Duration.seconds(0), - interval: Duration.seconds(30), - }); - } catch (err) { - this.spinner.stop(); - const error = err as SfError; - if (this.pollingTimeOut) { - void lifecycle.emit(SandboxEvents.EVENT_ASYNC_RESULT, undefined); - process.exitCode = 68; - return this.latestSandboxProgressObj; - } else if (error.name === 'SandboxCreateNotCompleteError') { - process.exitCode = 68; - return this.latestSandboxProgressObj; - } - throw err; - } - } - - private buildSandboxRequestCacheEntry(): SandboxRequestCacheEntry { - let sandboxRequestCacheEntry = { - alias: undefined, - setDefault: undefined, - prodOrgUsername: undefined, - sandboxProcessObject: {}, - sandboxRequest: {}, - tracksSource: undefined, - } as SandboxRequestCacheEntry; - - let name: string | undefined; - let entry: SandboxRequestCacheEntry | undefined; - - if (this.flags['use-most-recent']) { - [name, entry] = this.sandboxRequestConfig.getLatestEntry() || [undefined, undefined]; - if (!name) { - throw messages.createError('error.LatestSandboxRequestNotFound'); - } - sandboxRequestCacheEntry = entry; - } else if (this.flags.name) { - sandboxRequestCacheEntry = this.sandboxRequestConfig.get(this.flags.name) || sandboxRequestCacheEntry; - } else if (this.flags['job-id']) { - const sce: SandboxRequestCacheEntry = this.sandboxRequestConfig - .entries() - .find( - ([, e]) => (e as SandboxRequestCacheEntry).sandboxProcessObject.Id === this.flags['job-id'] - )[1] as SandboxRequestCacheEntry; - sandboxRequestCacheEntry = sce || sandboxRequestCacheEntry; - } - sandboxRequestCacheEntry.prodOrgUsername ??= this.flags['target-org']?.getUsername(); - sandboxRequestCacheEntry.sandboxProcessObject.SandboxName ??= this.flags.name; - return sandboxRequestCacheEntry; - } - - private async verifyIfAuthExists( - prodOrg: Org, - sandboxName: string, - jobId: string, - lifecycle: Lifecycle - ): Promise { - const sandboxProcessObject: SandboxProcessObject = await getSandboxProcessObject(prodOrg, sandboxName, jobId); - const sandboxUsername = `${prodOrg.getUsername()}.${sandboxProcessObject.SandboxName}`; - const exists = await (await StateAggregator.getInstance()).orgs.exists(sandboxUsername); - if (exists) { - this.latestSandboxProgressObj = sandboxProcessObject; - const resultEvent = { - sandboxProcessObj: this.latestSandboxProgressObj, - sandboxRes: { authUserName: sandboxUsername } as Partial, - } as ResultEvent; - await lifecycle.emit(SandboxEvents.EVENT_RESULT, resultEvent as Partial); - return true; - } - return false; - } -} - -const getSandboxProcessObject = async ( - prodOrg: Org, - sandboxName?: string, - jobId?: string -): Promise => { - const where = sandboxName ? `SandboxName='${sandboxName}'` : `Id='${jobId}'`; - const queryStr = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE ${where} AND Status != 'D'`; - try { - return await prodOrg.getConnection().singleRecordQuery(queryStr, { - tooling: true, - }); - } catch (err) { - throw messages.createError('error.NoSandboxRequestFound'); - } -}; diff --git a/src/commands/env/resume/scratch.ts b/src/commands/env/resume/scratch.ts deleted file mode 100644 index 73fcde81..00000000 --- a/src/commands/env/resume/scratch.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; -import { - Messages, - scratchOrgResume, - ScratchOrgCache, - Lifecycle, - ScratchOrgLifecycleEvent, - scratchOrgLifecycleEventName, -} from '@salesforce/core'; -import { ScratchCreateResponse } from '../../../types'; -import { buildStatus } from '../../../shared/scratchOrgOutput'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'resume_scratch'); - -export default class EnvResumeScratch extends SfCommand { - public static readonly summary = messages.getMessage('summary'); - public static readonly description = messages.getMessage('description'); - public static readonly examples = messages.getMessages('examples'); - public static readonly flags = { - 'job-id': Flags.salesforceId({ - char: 'i', - summary: messages.getMessage('flags.job-id.summary'), - description: messages.getMessage('flags.job-id.description'), - exactlyOne: ['use-most-recent', 'job-id'], - startsWith: '2SR', - }), - 'use-most-recent': Flags.boolean({ - char: 'r', - summary: messages.getMessage('flags.use-most-recent.summary'), - exactlyOne: ['use-most-recent', 'job-id'], - }), - }; - - public async run(): Promise { - const { flags } = await this.parse(EnvResumeScratch); - const cache = await ScratchOrgCache.create(); - const lifecycle = Lifecycle.getInstance(); - - const jobId = flags['use-most-recent'] ? cache.getLatestKey() : flags['job-id']; - if (!jobId && flags['use-most-recent']) throw messages.createError('error.NoRecentJobId'); - - const { hubBaseUrl } = cache.get(jobId); - let lastStatus: string; - - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(scratchOrgLifecycleEventName, async (data): Promise => { - lastStatus = buildStatus(data, hubBaseUrl); - this.spinner.status = lastStatus; - }); - - this.log(); - this.spinner.start('Creating Scratch Org'); - - const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgResume(jobId); - this.spinner.stop(lastStatus); - - this.log(); - this.logSuccess(messages.getMessage('success')); - return { username, scratchOrgInfo, authFields, warnings, orgId: scratchOrgInfo.Id }; - } -} diff --git a/src/shared/orgHooks.ts b/src/shared/orgHooks.ts deleted file mode 100644 index b80b2b1a..00000000 --- a/src/shared/orgHooks.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2021, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { Optional } from '@salesforce/ts-types'; -import { AuthFields } from '@salesforce/core'; -import { Command, Interfaces, Hook } from '@oclif/core'; - -type HookOpts = { - options: { Command: Command.Class; argv: string[]; commandId: string }; - return: Optional; -}; - -export type OrgCreateResult = Pick< - AuthFields, - | 'accessToken' - | 'clientId' - | 'created' - | 'createdOrgInstance' - | 'devHubUsername' - | 'expirationDate' - | 'instanceUrl' - | 'loginUrl' - | 'orgId' - | 'username' ->; - -type PostOrgCreateOpts = HookOpts; - -/** - * Extends OCLIF's Hooks interface to add types for hooks that run on org commands - */ -export interface OrgHooks extends Interfaces.Hooks { - postorgcreate: PostOrgCreateOpts; -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type OrgHook = (this: Hook.Context, options: T extends keyof Interfaces.Hooks ? OrgHooks[T] : T) => any; - -// eslint-disable-next-line no-redeclare -export declare namespace OrgHook { - // TODO get rid of the ts-ignore - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - export type PostOrgCreate = Hook; -} diff --git a/src/shared/sandboxCommandBase.ts b/src/shared/sandboxCommandBase.ts deleted file mode 100644 index 0997cb53..00000000 --- a/src/shared/sandboxCommandBase.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as os from 'os'; -import { SfCommand } from '@salesforce/sf-plugins-core'; -import { Config } from '@oclif/core'; -import { - AuthInfo, - Lifecycle, - Messages, - Org, - ResultEvent, - SandboxEvents, - SandboxProcessObject, - SandboxRequestCache, - SandboxRequestCacheEntry, - SandboxUserAuthResponse, - StatusEvent, -} from '@salesforce/core'; -import { SandboxProgress, SandboxStatusData } from './sandboxProgress'; -import { State } from './stagedProgress'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.loadMessages('@salesforce/plugin-env', 'sandboxbase'); -export abstract class SandboxCommandBase extends SfCommand { - protected sandboxProgress: SandboxProgress; - protected latestSandboxProgressObj: SandboxProcessObject; - protected sandboxAuth?: SandboxUserAuthResponse; - protected prodOrg: Org; - protected pollingTimeOut = false; - protected sandboxRequestConfig: SandboxRequestCache; - protected sandboxRequestData: SandboxRequestCacheEntry = { - alias: '', - setDefault: false, - prodOrgUsername: '', - sandboxProcessObject: {}, - sandboxRequest: {}, - tracksSource: false, - }; - public constructor(argv: string[], config: Config) { - super(argv, config); - this.sandboxProgress = new SandboxProgress(); - } - protected async getSandboxRequestConfig(): Promise { - if (!this.sandboxRequestConfig) { - this.sandboxRequestConfig = await SandboxRequestCache.create(); - } - return this.sandboxRequestConfig; - } - - protected async calculateTrackingSetting(tracking = true): Promise { - // sandbox types that don't support tracking - if (['Partial', 'Full'].includes(this.sandboxRequestData.sandboxRequest.LicenseType)) { - return false; - } - // returns false for a sandbox type that supports it but user has opted out - if (tracking === false) { - return false; - } - // if user hasn't opted out of tracking, and sandbox type supports it, verify that prod org supports tracking-enabled sandboxes - const sourceTrackingSettings = await this.prodOrg - .getConnection() - .metadata.read('SourceTrackingSettings', 'SourceTrackingSettings'); - if (sourceTrackingSettings.enableSourceTrackingSandboxes !== true) { - return false; - } - // default for Dev/DevPro when prod org has feature enabled for sandboxes - return true; - } - - protected registerLifecycleListeners( - lifecycle: Lifecycle, - options: { isAsync: boolean; alias: string; setDefault: boolean; prodOrg?: Org; tracksSource?: boolean } - ): void { - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on('POLLING_TIME_OUT', async () => { - this.pollingTimeOut = true; - this.updateSandboxRequestData(); - }); - - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(SandboxEvents.EVENT_RESUME, async (results: SandboxProcessObject) => { - this.latestSandboxProgressObj = results; - this.sandboxProgress.markPreviousStagesAsCompleted( - results.Status !== 'Completed' ? results.Status : 'Authenticating' - ); - this.updateSandboxRequestData(); - }); - - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(SandboxEvents.EVENT_ASYNC_RESULT, async (results?: SandboxProcessObject) => { - this.latestSandboxProgressObj = results || this.latestSandboxProgressObj; - this.updateSandboxRequestData(); - if (!options.isAsync) { - this.spinner.stop(); - } - const progress = this.sandboxProgress.getSandboxProgress({ - sandboxProcessObj: this.latestSandboxProgressObj, - sandboxRes: undefined, - }); - const currentStage = progress.status; - this.sandboxProgress.markPreviousStagesAsCompleted(currentStage); - this.updateStage(currentStage, State.inProgress); - this.updateProgress({ sandboxProcessObj: this.latestSandboxProgressObj, sandboxRes: undefined }, options.isAsync); - if (this.pollingTimeOut) { - this.warn(messages.getMessage('warning.ClientTimeoutWaitingForSandboxCreate')); - } - this.log(this.sandboxProgress.formatProgressStatus(false)); - this.info(messages.getMessage('checkSandboxStatus', this.getCheckSandboxStatusParams())); - }); - - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(SandboxEvents.EVENT_STATUS, async (results: StatusEvent) => { - this.latestSandboxProgressObj = results.sandboxProcessObj; - this.updateSandboxRequestData(); - const progress = this.sandboxProgress.getSandboxProgress(results); - const currentStage = progress.status; - this.updateStage(currentStage, State.inProgress); - this.updateProgress(results, options.isAsync); - }); - - // eslint-disable-next-line @typescript-eslint/require-await - lifecycle.on(SandboxEvents.EVENT_AUTH, async (results: SandboxUserAuthResponse) => { - this.sandboxAuth = results; - }); - - lifecycle.on(SandboxEvents.EVENT_RESULT, async (results: ResultEvent) => { - this.latestSandboxProgressObj = results.sandboxProcessObj; - this.updateSandboxRequestData(); - this.sandboxProgress.markPreviousStagesAsCompleted(); - this.updateProgress(results, options.isAsync); - if (!options.isAsync) { - this.progress.stop(); - } - if (results.sandboxRes?.authUserName) { - const authInfo = await AuthInfo.create({ username: results.sandboxRes?.authUserName }); - await authInfo.handleAliasAndDefaultSettings({ - alias: options.alias, - setDefault: options.setDefault, - setDefaultDevHub: undefined, - setTracksSource: await this.calculateTrackingSetting(options.tracksSource), - }); - } - this.removeSandboxProgressConfig(); - this.updateProgress(results, options.isAsync); - this.reportResults(results); - }); - } - - protected reportResults(results: ResultEvent): void { - this.log(); - this.styledHeader('Sandbox Org Creation Status'); - this.log(this.sandboxProgress.formatProgressStatus(false)); - this.logSuccess( - [ - messages.getMessage('sandboxSuccess'), - messages.getMessages('sandboxSuccess.actions', [ - results.sandboxRes?.authUserName, - results.sandboxRes?.authUserName, - ]), - ].join(os.EOL) - ); - } - - protected updateProgress(event: ResultEvent | StatusEvent, isAsync: boolean): void { - const sandboxProgress = this.sandboxProgress.getSandboxProgress(event); - const sandboxData = { - sandboxUsername: (event as ResultEvent).sandboxRes?.authUserName, - sandboxProgress, - sandboxProcessObj: event.sandboxProcessObj, - } as SandboxStatusData; - this.sandboxProgress.statusData = sandboxData; - if (!isAsync) { - this.spinner.status = this.sandboxProgress.formatProgressStatus(); - } - } - - protected updateStage(stage: string | undefined, state: State): void { - if (stage) { - this.sandboxProgress.transitionStages(stage, state); - } - } - - protected updateSandboxRequestData(): void { - this.sandboxRequestData.sandboxProcessObject = this.latestSandboxProgressObj; - this.saveSandboxProgressConfig(); - } - - protected saveSandboxProgressConfig(): void { - this.sandboxRequestConfig.set(this.sandboxRequestData.sandboxProcessObject.SandboxName, this.sandboxRequestData); - this.sandboxRequestConfig.writeSync(); - } - - private removeSandboxProgressConfig(): void { - this.sandboxRequestConfig.unset(this.latestSandboxProgressObj.SandboxName); - this.sandboxRequestConfig.writeSync(); - } - - protected abstract getCheckSandboxStatusParams(): string[]; -} diff --git a/src/shared/sandboxProgress.ts b/src/shared/sandboxProgress.ts deleted file mode 100644 index df6f11db..00000000 --- a/src/shared/sandboxProgress.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as os from 'os'; -import { StatusEvent, ResultEvent, SandboxProcessObject } from '@salesforce/core'; -import { Ux } from '@salesforce/sf-plugins-core/lib/ux'; -import { ux } from '@oclif/core'; -import { getClockForSeconds } from '../utils/timeUtils'; -import { StagedProgress } from './stagedProgress'; - -const columns: Ux.Table.Columns<{ key: string; value: string }> = { - key: { header: 'Field' }, - value: { header: 'Value' }, -}; - -export type SandboxProgressData = { - id: string; - status: string; - percentComplete: number; - remainingWaitTime: number; - remainingWaitTimeHuman: string; -}; - -export type SandboxStatusData = { - sandboxUsername: string; - sandboxProgress: SandboxProgressData; - sandboxProcessObj?: SandboxProcessObject | undefined; -}; - -export class SandboxProgress extends StagedProgress { - public constructor(stageNames: string[] = ['Pending', 'Processing', 'Activating', 'Authenticating']) { - super(stageNames); - } - // eslint-disable-next-line class-methods-use-this - public getLogSandboxProcessResult(result: ResultEvent): string { - const { sandboxProcessObj } = result; - const sandboxReadyForUse = `Sandbox ${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id}) is ready for use.`; - return sandboxReadyForUse; - } - - // eslint-disable-next-line class-methods-use-this - public getTableDataFromProcessObj( - authUserName: string, - sandboxProcessObj: SandboxProcessObject - ): Array<{ key: string; value: string | number }> { - return [ - { key: 'Id', value: sandboxProcessObj.Id }, - { key: 'SandboxName', value: sandboxProcessObj.SandboxName }, - { key: 'Status', value: sandboxProcessObj.Status }, - { key: 'CopyProgress', value: `${sandboxProcessObj.CopyProgress}%` }, - { key: 'Description', value: sandboxProcessObj.Description }, - { key: 'LicenseType', value: sandboxProcessObj.LicenseType }, - { key: 'SandboxInfoId', value: sandboxProcessObj.SandboxInfoId }, - { key: 'SourceId', value: sandboxProcessObj.SourceId }, - { key: 'SandboxOrg', value: sandboxProcessObj.SandboxOrganization }, - { key: 'Created Date', value: sandboxProcessObj.CreatedDate }, - { key: 'ApexClassId', value: sandboxProcessObj.ApexClassId }, - { key: 'Authorized Sandbox Username', value: authUserName }, - ].filter((v) => !!v.value); - } - - // eslint-disable-next-line class-methods-use-this - public getSandboxProgress(event: StatusEvent | ResultEvent): SandboxProgressData { - const statusUpdate = event as StatusEvent; - const waitingOnAuth = statusUpdate.waitingOnAuth ?? false; - const { sandboxProcessObj } = event; - const waitTimeInSec = statusUpdate.remainingWait ?? 0; - - const sandboxIdentifierMsg = `${sandboxProcessObj.SandboxName}(${sandboxProcessObj.Id})`; - - return { - id: sandboxIdentifierMsg, - status: waitingOnAuth || sandboxProcessObj.Status === 'Completed' ? 'Authenticating' : sandboxProcessObj.Status, - percentComplete: sandboxProcessObj.CopyProgress, - remainingWaitTime: waitTimeInSec, - remainingWaitTimeHuman: waitTimeInSec === 0 ? '' : `${getClockForSeconds(waitTimeInSec)} until timeout.`, - }; - } - - public getSandboxTableAsText(sandboxUsername: string, sandboxProgress?: SandboxProcessObject): string[] { - if (!sandboxProgress) { - return []; - } - const tableRows: string[] = []; - ux.table(this.getTableDataFromProcessObj(sandboxUsername, sandboxProgress), columns, { - printLine: (s: string): void => { - tableRows.push(s); - }, - }); - return tableRows; - } - - public formatProgressStatus(withClock = true): string { - const table = this.getSandboxTableAsText(undefined, this.statusData.sandboxProcessObj).join(os.EOL); - return [ - withClock - ? `${getClockForSeconds(this.statusData.sandboxProgress.remainingWaitTime)} until timeout. ${ - this.statusData.sandboxProgress.percentComplete - }%` - : undefined, - table, - '---------------------', - 'Sandbox Create Stages', - this.formatStages(), - ] - .filter((line) => line) - .join(os.EOL); - } - // eslint-disable-next-line class-methods-use-this - protected mapCurrentStage(currentStage: string): string { - switch (currentStage) { - case 'Pending Remote Creation': - return 'Pending'; - case 'Remote Sandbox Created': - return 'Pending'; - case 'Completed': - return 'Authenticating'; - default: - return currentStage; - } - } -} diff --git a/src/shared/scratchOrgOutput.ts b/src/shared/scratchOrgOutput.ts deleted file mode 100644 index 82cdb796..00000000 --- a/src/shared/scratchOrgOutput.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { ScratchOrgLifecycleEvent, scratchOrgLifecycleStages } from '@salesforce/core'; -import * as chalk from 'chalk'; -import { capitalCase } from 'change-case'; -import { StandardColors } from '@salesforce/sf-plugins-core'; - -const boldBlue = (input: string): string => chalk.rgb(81, 176, 235).bold(input); -const boldPurple = (input: string): string => chalk.rgb(157, 129, 221).bold(input); - -export const buildStatus = (data: ScratchOrgLifecycleEvent, baseUrl: string): string => ` -RequestId: ${formatRequest(baseUrl, data.scratchOrgInfo?.Id)} -OrgId: ${formatOrgId(data.scratchOrgInfo?.ScratchOrg)} -Username: ${formatUsername(data.scratchOrgInfo?.SignupUsername)} -${formatStage(data.stage)}`; - -export const formatStage = (currentStage: ScratchOrgLifecycleEvent['stage']): string => - scratchOrgLifecycleStages - .map((stage, stageIndex) => { - // current stage - if (currentStage === stage) return formatCurrentStage(stage); - // completed stages - if (scratchOrgLifecycleStages.indexOf(currentStage) > stageIndex) return formatCompletedStage(stage); - // future stage - return formatFutureStage(stage); - }) - .join('\n'); - -export const formatRequest = (baseUrl: string, id?: string): string => - `${id ? `${chalk.bold(id)} (${baseUrl}/${id})` : ''}`; - -export const formatUsername = (username: string): string => `${username ? `${boldBlue(username)} ` : ''}`; -export const formatOrgId = (id: string): string => `${id ? `${boldBlue(id)} ` : ''}`; - -export const formatCurrentStage = (stage: string): string => boldPurple(capitalCase(stage)); -export const formatCompletedStage = (stage: string): string => StandardColors.success.bold(`✓ ${capitalCase(stage)}`); -export const formatFutureStage = (stage: string): string => StandardColors.info(capitalCase(stage)); diff --git a/src/shared/stagedProgress.ts b/src/shared/stagedProgress.ts deleted file mode 100644 index d998d290..00000000 --- a/src/shared/stagedProgress.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as os from 'os'; -import * as chalk from 'chalk'; -import { StandardColors } from '@salesforce/sf-plugins-core'; -const compareStages = ([, aValue], [, bValue]): number => - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - aValue.index - bValue.index; -export const boldPurple = chalk.rgb(157, 129, 221).bold; - -export enum State { - 'inProgress' = 'inProgress', - 'completed' = 'completed', - 'failed' = 'failed', - 'unknown' = 'unknown', -} - -export type StageAttributes = { - state: State; - char: string; - color: chalk.Chalk; - index?: number; - visited: boolean; -}; - -export const StateConstants: { [stage: string]: StageAttributes } = { - inProgress: { color: boldPurple, char: '…', visited: false, state: State.inProgress }, - completed: { color: StandardColors.success, char: '✓', visited: false, state: State.completed }, - failed: { color: chalk.bold.red, char: '✖', visited: false, state: State.failed }, - unknown: { color: chalk.dim, char: '…', visited: false, state: State.unknown }, -}; - -export type Stage = { - [stage: string]: StageAttributes; -}; - -export abstract class StagedProgress { - private dataForTheStatus: T; - private theStages: Stage; - private currentStage: string; - private previousStage: string; - public constructor(stages: string[]) { - this.theStages = stages - .map((stage, index) => ({ - [stage]: { ...StateConstants[State.unknown], index: (index + 1) * 10 }, - })) - .reduce((m, b) => Object.assign(m, b), {}); - } - - public get statusData(): T { - return this.dataForTheStatus; - } - public set statusData(statusData: T) { - this.dataForTheStatus = statusData; - } - public formatStages(): string { - return Object.entries(this.theStages) - .sort(compareStages) - .map(([stage, stageState]) => stageState.color(`${stageState.char} - ${stage}`)) - .join(os.EOL); - } - - public transitionStages(currentStage: string, newState?: State): void { - currentStage = this.mapCurrentStage(currentStage); - if (this.previousStage && this.previousStage !== currentStage) { - this.updateStages(this.previousStage, State.completed); - } - - // mark all previous stages as visited and completed - this.markPreviousStagesAsCompleted(currentStage); - - this.previousStage = currentStage; - this.currentStage = currentStage; - this.updateStages(currentStage, newState); - } - - public markPreviousStagesAsCompleted(currentStage?: string): void { - currentStage = this.mapCurrentStage(currentStage); - Object.entries(this.theStages).forEach(([stage, stageState]) => { - if (!currentStage || stageState.index < this.theStages[currentStage].index) { - this.updateStages(stage, State.completed); - } - }); - } - - public updateCurrentStage(newState: State): void { - this.updateStages(this.currentStage, newState); - } - - public updateStages(currentStage: string, newState?: State): void { - currentStage = this.mapCurrentStage(currentStage); - if (!this.theStages[currentStage]) { - const sortedEntries = Object.entries(this.theStages).sort(compareStages); - const visitedEntries = sortedEntries.filter(([, stageState]) => stageState.visited); - const [, lastState] = visitedEntries.length - ? visitedEntries[visitedEntries.length - 1] - : ['', { state: StateConstants.unknown.state, index: 0, visited: true }]; - const newEntry = { - [currentStage]: { state: StateConstants.unknown.state, visited: true, index: lastState.index + 1 }, - }; - this.theStages = Object.assign(this.theStages, newEntry); - } - this.theStages[currentStage].visited = true; - this.theStages[currentStage].state = newState || State.inProgress; - this.theStages[currentStage].char = StateConstants[this.theStages[currentStage].state].char; - this.theStages[currentStage].color = StateConstants[newState.toString()].color; - } - - public getStages(): Stage { - return this.theStages; - } - - // eslint-disable-next-line class-methods-use-this - protected mapCurrentStage(currentStage: string): string { - return currentStage; - } - - public abstract formatProgressStatus(withClock: boolean): string; -} diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index dfc9fd3a..00000000 --- a/src/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { ScratchOrgInfo, AuthFields } from '@salesforce/core'; - -export interface ScratchCreateResponse { - username?: string; - scratchOrgInfo: ScratchOrgInfo; - authFields?: AuthFields; - warnings: string[]; - orgId: string; -} diff --git a/src/utils/timeUtils.ts b/src/utils/timeUtils.ts deleted file mode 100644 index 72bd0815..00000000 --- a/src/utils/timeUtils.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Duration } from '@salesforce/kit'; - -export type TimeComponents = { - days: Duration; - hours: Duration; - minutes: Duration; - seconds: Duration; -}; - -export const getClockForSeconds = (timeInSec: number): string => { - const tc = getTimeComponentsFromSeconds(timeInSec); - - const dDisplay: string = tc.days.days > 0 ? `${tc.days.days.toString()}:` : ''; - const hDisplay: string = tc.hours.hours.toString().padStart(2, '0'); - const mDisplay: string = tc.minutes.minutes.toString().padStart(2, '0'); - const sDisplay: string = tc.seconds.seconds.toString().padStart(2, '0'); - - return `${dDisplay}${hDisplay}:${mDisplay}:${sDisplay}`; -}; -export const getTimeComponentsFromSeconds = (timeInSec: number): TimeComponents => { - const days = Duration.days(Math.floor(timeInSec / 86_400)); - const hours = Duration.hours(Math.floor((timeInSec % 86_400) / 3_600)); - const minutes = Duration.minutes(Math.floor((timeInSec % 3_600) / 60)); - const seconds = Duration.seconds(Math.floor(timeInSec % 60)); - - return { days, hours, minutes, seconds }; -}; -export const getSecondsToHuman = (timeInSec: number): string => { - const tc = getTimeComponentsFromSeconds(timeInSec); - - const dDisplay: string = tc.days.days > 0 ? tc.days.toString() + ' ' : ''; - const hDisplay: string = tc.hours.hours > 0 ? tc.hours.toString() + ' ' : ''; - const mDisplay: string = tc.minutes.minutes > 0 ? tc.minutes.toString() + ' ' : ''; - const sDisplay: string = tc.seconds.seconds > 0 ? tc.seconds.toString() : ''; - - return (dDisplay + hDisplay + mDisplay + sDisplay).trim(); -}; diff --git a/test/commands/env/create/async-create-resume.nut.ts b/test/commands/env/create/async-create-resume.nut.ts deleted file mode 100644 index 81ab8b31..00000000 --- a/test/commands/env/create/async-create-resume.nut.ts +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as fs from 'fs'; -import * as path from 'path'; -import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit'; -import { expect } from 'chai'; -import { AuthFields, Global, ScratchOrgCache } from '@salesforce/core'; -import { JsonMap } from '@salesforce/ts-types'; -import { CachedOptions } from '@salesforce/core/lib/org/scratchOrgCache'; -import { Duration, sleep } from '@salesforce/kit'; -import { ScratchCreateResponse } from '../../../../src/types'; - -describe('env create scratch async/resume', () => { - let session: TestSession; - let cacheFilePath: string; - let soiId: string; - let username: string; - - const asyncKeys = ['username', 'orgId', 'scratchOrgInfo', 'warnings']; - const completeKeys = [...asyncKeys, 'authFields']; - - const readCacheFile = async (): Promise> => - JSON.parse(await fs.promises.readFile(cacheFilePath, 'utf8')) as unknown as Record; - - const readAuthFile = async (uname: string): Promise => { - const filePath = path.join(session.homeDir, Global.STATE_FOLDER, `${uname}.json`); - return JSON.parse(await fs.promises.readFile(filePath, 'utf8')) as AuthFields; - }; - - const readAliases = async (): Promise>> => { - const filePath = path.join(session.homeDir, Global.STATE_FOLDER, 'alias.json'); - return JSON.parse(await fs.promises.readFile(filePath, 'utf8')) as Record<'orgs', Record>; - }; - - before(async () => { - session = await TestSession.create({ - project: { name: 'testProject' }, - devhubAuthStrategy: 'AUTO', - }); - cacheFilePath = path.join(session.dir, '.sf', ScratchOrgCache.getFileName()); - }); - - after(async () => { - await session?.clean(); - }); - - describe('just edition', () => { - it('requests org', () => { - const resp = execCmd('env create scratch --edition developer --json --async', { - ensureExitCode: 0, - }).jsonOutput.result; - expect(resp).to.have.all.keys(asyncKeys); - soiId = resp.scratchOrgInfo.Id; - username = resp.username; - }); - it('is present in cache', async () => { - expect(fs.existsSync(cacheFilePath)).to.be.true; - const cache = await readCacheFile(); - expect(cache[soiId]).to.include.keys(['hubBaseUrl', 'definitionjson', 'hubUsername']); - expect(cache[soiId].definitionjson).to.deep.equal({ edition: 'developer' }); - }); - it('resumes org using id', async () => { - let done = false; - while (!done) { - const resp = execCmd(`env resume scratch --job-id ${soiId} --json`).jsonOutput; - if (resp.status === 0) { - done = true; - expect(resp.result).to.have.all.keys(completeKeys); - } else if (resp.name === 'StillInProgressError') { - // eslint-disable-next-line no-await-in-loop - await sleep(Duration.seconds(30)); - } else { - throw new Error(resp.message); - } - } - }); - it('org is authenticated', async () => { - const authFile = await readAuthFile(username); - expect(authFile).to.include.keys(['orgId', 'devHubUsername', 'accessToken']); - }); - it('is NOT present in cache', async () => { - const cache = await readCacheFile(); - expect(cache).to.not.have.property(soiId); - }); - }); - - describe('alias, set-default, username, config file, use-most-recent', () => { - const testAlias = 'testAlias'; - it('requests org', () => { - const resp = execCmd( - `env create scratch --json --async -f ${path.join( - 'config', - 'project-scratch-def.json' - )} --set-default --alias ${testAlias}`, - { - ensureExitCode: 0, - } - ).jsonOutput.result; - expect(resp).to.have.all.keys(asyncKeys); - soiId = resp.scratchOrgInfo.Id; - username = resp.username; - }); - it('is present in cache', async () => { - expect(fs.existsSync(cacheFilePath)).to.be.true; - const cache = await readCacheFile(); - - expect(cache[soiId]).to.include.keys(['hubBaseUrl', 'definitionjson', 'hubUsername']); - expect(cache[soiId]).to.have.property('setDefault', true); - expect(cache[soiId].definitionjson).to.deep.equal( - JSON.parse( - await fs.promises.readFile(path.join(session.project.dir, 'config', 'project-scratch-def.json'), 'utf8') - ) as unknown as JsonMap - ); - }); - it('resumes org using latest', async () => { - let done = false; - while (!done) { - const resp = execCmd('env resume scratch --use-most-recent --json').jsonOutput; - if (resp.status === 0) { - done = true; - expect(resp.result).to.have.all.keys(completeKeys); - } else if (resp.name === 'StillInProgressError') { - // eslint-disable-next-line no-await-in-loop - await sleep(Duration.seconds(30)); - } else { - throw new Error(resp.message); - } - } - }); - it('org is authenticated with alias and config', async () => { - const authFile = await readAuthFile(username); - const aliases = await readAliases(); - expect(authFile).to.include.keys(['orgId', 'devHubUsername', 'accessToken']); - expect(aliases.orgs[testAlias]).to.equal(username); - - const config = JSON.parse( - await fs.promises.readFile(path.join(session.project.dir, '.sf', 'config.json'), 'utf8') - ) as unknown as Record; - - expect(config['target-org']).to.equal(testAlias); - }); - it('is NOT present in cache', async () => { - const cache = await readCacheFile(); - expect(cache).to.not.have.property(soiId); - }); - }); -}); diff --git a/test/commands/env/create/createSandbox.test.ts b/test/commands/env/create/createSandbox.test.ts deleted file mode 100644 index da464e64..00000000 --- a/test/commands/env/create/createSandbox.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { Lifecycle, Org, SandboxEvents, SandboxProcessObject, SfProject, AuthFields } from '@salesforce/core'; -import { Spinner } from '@salesforce/sf-plugins-core/lib/ux'; -import { Config as IConfig } from '@oclif/core/lib/interfaces'; -import { fromStub, stubInterface, stubMethod } from '@salesforce/ts-sinon'; -import * as sinon from 'sinon'; -import { expect } from 'chai'; -import { Ux } from '@salesforce/sf-plugins-core/lib/ux'; -import { OrgAccessor } from '@salesforce/core/lib/stateAggregator'; -import CreateSandbox from '../../../../src/commands/env/create/sandbox'; -import { SandboxProgress } from '../../../../lib/shared/sandboxProgress'; - -const sandboxProcessObj: SandboxProcessObject = { - Id: '0GR4p000000U8EMXXX', - Status: 'Completed', - SandboxName: 'TestSandbox', - SandboxInfoId: '0GQ4p000000U6sKXXX', - LicenseType: 'DEVELOPER', - CreatedDate: '2021-12-07T16:20:21.000+0000', - CopyProgress: 100, - SandboxOrganization: '00D2f0000008XXX', - SourceId: '123', - Description: 'sandbox description', - ApexClassId: '123', - EndDate: '2021-12-07T16:38:47.000+0000', -}; - -const fakeOrg: AuthFields = { - orgId: '00Dsomefakeorg1', - instanceUrl: 'https://some.fake.org', - username: 'somefake.org', -}; - -describe('env:create:sandbox', () => { - beforeEach(() => { - stubMethod(sandbox, OrgAccessor.prototype, 'read').callsFake(async (): Promise => fakeOrg); - stubMethod(sandbox, OrgAccessor.prototype, 'write').callsFake(async (): Promise => fakeOrg); - }); - - const sandbox = sinon.createSandbox(); - const oclifConfigStub = fromStub(stubInterface(sandbox)); - // stubs - let resolveProjectConfigStub: sinon.SinonStub; - let createSandboxStub: sinon.SinonStub; - let uxLogStub: sinon.SinonStub; - let cmd: TestCreate; - - class TestCreate extends CreateSandbox { - public async runIt() { - await this.init(); - return this.run(); - } - public setProject(project: SfProject) { - this.project = project; - } - } - - const createCommand = async (params: string[]) => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - cmd = new TestCreate(params, oclifConfigStub); - stubMethod(sandbox, cmd, 'assignProject').callsFake(() => { - const sfProjectStub = fromStub( - stubInterface(sandbox, { - resolveProjectConfig: resolveProjectConfigStub, - }) - ); - cmd.setProject(sfProjectStub); - }); - - stubMethod(sandbox, TestCreate.prototype, 'warn'); - uxLogStub = stubMethod(sandbox, TestCreate.prototype, 'log'); - stubMethod(sandbox, Ux.prototype, 'styledHeader'); - stubMethod(sandbox, TestCreate.prototype, 'table'); - stubMethod(sandbox, SandboxProgress.prototype, 'getSandboxProgress'); - stubMethod(sandbox, SandboxProgress.prototype, 'formatProgressStatus'); - stubMethod(sandbox, Spinner.prototype, 'start'); - stubMethod(sandbox, Spinner.prototype, 'stop'); - stubMethod(sandbox, Spinner.prototype, 'status'); - return cmd; - }; - - describe('sandbox', () => { - it('will print the correct message for asyncResult lifecycle event', async () => { - const command = await createCommand(['-o', 'testProdOrg', '--name', 'mysandboxx', '--no-prompt']); - - stubMethod(sandbox, cmd, 'readJsonDefFile').returns({ - licenseType: 'licenseFromJon', - }); - stubMethod(sandbox, Org, 'create').resolves(Org.prototype); - stubMethod(sandbox, Org.prototype, 'getUsername').returns('testProdOrg'); - const createStub = stubMethod(sandbox, Org.prototype, 'createSandbox').callsFake(async () => (async () => {})().catch()); - - await command.runIt(); - - // no SandboxName defined, so we should generate one that starts with sbx - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(createStub.firstCall.args[0].SandboxName).includes('mysandboxx'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect(createStub.firstCall.args[0].SandboxName.length).equals(10); - - Lifecycle.getInstance().on(SandboxEvents.EVENT_ASYNC_RESULT, async (result) => { - expect(result).to.deep.equal(sandboxProcessObj); - expect(uxLogStub.firstCall.args[0]).to.includes('0GR4p000000U8EMXXX'); - }); - - await Lifecycle.getInstance().emit(SandboxEvents.EVENT_ASYNC_RESULT, sandboxProcessObj); - }); - }); - - afterEach(() => { - sandbox.restore(); - createSandboxStub?.restore(); - }); -}); diff --git a/test/commands/env/create/sandbox.sandboxNut.ts b/test/commands/env/create/sandbox.sandboxNut.ts deleted file mode 100644 index 82a07458..00000000 --- a/test/commands/env/create/sandbox.sandboxNut.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2022, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit'; -import { Lifecycle, Messages, SandboxEvents, SandboxProcessObject, StatusEvent } from '@salesforce/core'; -import { expect } from 'chai'; - -Messages.importMessagesDirectory(__dirname); - -describe('Sandbox Orgs', () => { - let session: TestSession; - - before(async () => { - session = await TestSession.create({ - project: { name: 'sandboxCreate' }, - devhubAuthStrategy: 'AUTO', - }); - }); - - it('will create a sandbox, verify it can be opened, and then attempt to delete it', async () => { - let result: SandboxProcessObject; - try { - Lifecycle.getInstance().on(SandboxEvents.EVENT_STATUS, async (results: StatusEvent) => { - // eslint-disable-next-line no-console - console.log('sandbox copy progress', results.sandboxProcessObj.CopyProgress); - }); - let rawResult = execCmd( - `env:create:sandbox -a mySandbox -s -l Developer -o ${process.env.TESTKIT_HUB_USERNAME} --no-prompt --json --async`, - { timeout: 3600000 } - ); - result = rawResult.jsonOutput.result as SandboxProcessObject; - // autogenerated sandbox names start with 'sbx' - expect(result).to.be.ok; - expect(result.SandboxName.startsWith('sbx'), 'env:create:sandbox').to.be.true; - rawResult = execCmd( - `env:resume:sandbox --name ${result.SandboxName} -o ${process.env.TESTKIT_HUB_USERNAME} -w 60 --json`, - { timeout: 3600000 } - ); - result = rawResult.jsonOutput.result as SandboxProcessObject; - expect(result).to.be.ok; - } catch (e) { - expect(false).to.be.true(JSON.stringify(e)); - } - - const sandboxUsername = `${process.env.TESTKIT_HUB_USERNAME}.${result.SandboxName}`; - // even if a DNS issue occurred, the sandbox should still be present and available. - const openResult = execCmd<{ url: string }>('env:open -e mySandbox --url-only --json', { - ensureExitCode: 0, - }).jsonOutput.result; - expect(openResult, 'env:open').to.be.ok; - expect(openResult.url, 'env:open').to.ok; - - const deleteResult = execCmd<{ username: string }>('env:delete:sandbox --target-org mySandbox --no-prompt --json', { - ensureExitCode: 0, - }).jsonOutput.result; - expect(deleteResult, 'env:delete:sandbox').to.be.ok; - expect(deleteResult.username, 'env:delete:sandbox').to.equal(sandboxUsername); - }); - - after(async () => { - try { - await session?.clean(); - } catch (e) { - // do nothing - } - }); -}); diff --git a/test/commands/env/create/scratch.nut.ts b/test/commands/env/create/scratch.nut.ts deleted file mode 100644 index 3d02fc84..00000000 --- a/test/commands/env/create/scratch.nut.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import * as fs from 'fs'; -import * as path from 'path'; -import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit'; -import { expect } from 'chai'; -import { AuthFields, Messages, Global, StateAggregator } from '@salesforce/core'; -import { secretTimeout } from '../../../../src/commands/env/create/scratch'; -import { ScratchCreateResponse } from '../../../../src/types'; - -Messages.importMessagesDirectory(__dirname); -const messages = Messages.load('@salesforce/plugin-env', 'create_scratch', ['prompt.secret']); -describe('env create scratch NUTs', () => { - let session: TestSession; - - const readAuthFile = async (uname: string): Promise => { - const filePath = path.join(session.homeDir, Global.STATE_FOLDER, `${uname}.json`); - return JSON.parse(await fs.promises.readFile(filePath, 'utf8')) as AuthFields; - }; - - const readAliases = async (): Promise>> => { - const filePath = path.join(session.homeDir, Global.STATE_FOLDER, 'alias.json'); - return JSON.parse(await fs.promises.readFile(filePath, 'utf8')) as Record<'orgs', Record>; - }; - - before(async () => { - session = await TestSession.create({ - project: { name: 'testProject' }, - devhubAuthStrategy: 'AUTO', - }); - }); - - after(async () => { - await session?.clean(); - }); - - describe('flag failures', () => { - it('non-existent config file', () => { - execCmd('env create scratch -f badfile.json', { ensureExitCode: 1 }); - }); - it('config file AND edition', () => { - execCmd('env create scratch -f config/project-scratch-def.json --edition developer', { ensureExitCode: 1 }); - }); - it('wait zero', () => { - execCmd('env create scratch -f config/project-scratch-def.json --wait 0', { ensureExitCode: 1 }); - }); - it('no edition or config', () => { - execCmd('env create scratch', { ensureExitCode: 1 }); - }); - it('days out of bounds', () => { - execCmd('env create scratch -f config/project-scratch-def.json -d 50', { ensureExitCode: 1 }); - }); - it('prompts for client secret if client id present and times out', () => { - const error = execCmd('env create scratch --edition developer --client-id someConnectedApp', { - ensureExitCode: 1, - }).shellOutput; - expect(error.stdout).to.include(messages.getMessage('prompt.secret')); - expect(error.stderr).to.include(`Timed out after ${secretTimeout} ms.`); - }); - }); - - describe('successes', () => { - const keys = ['username', 'orgId', 'scratchOrgInfo', 'authFields', 'warnings']; - - it('creates an org from edition flag only and sets tracking to true by default', async () => { - const resp = execCmd('env create scratch --edition developer --json --wait 60', { - ensureExitCode: 0, - }).jsonOutput.result; - expect(resp).to.have.all.keys(keys); - const stateAggregator = await StateAggregator.create(); - expect(await stateAggregator.orgs.read(resp.username)).to.have.property('tracksSource', true); - StateAggregator.clearInstance(); - }); - it('creates an org from config file flag only', () => { - const resp = execCmd( - 'env create scratch -f config/project-scratch-def.json --json --wait 60', - { - ensureExitCode: 0, - } - ).jsonOutput.result; - expect(resp).to.have.all.keys(keys); - }); - it('creates an org with tracking disabled ', async () => { - const resp = execCmd( - 'env create scratch --edition developer --no-track-source --json --wait 60', - { - ensureExitCode: 0, - } - ).jsonOutput.result; - expect(resp).to.have.all.keys(keys); - const stateAggregator = await StateAggregator.create(); - expect(await stateAggregator.orgs.read(resp.username)).to.have.property('tracksSource', false); - StateAggregator.clearInstance(); - }); - - it('stores default in local sf config', async () => { - const resp = execCmd( - 'env create scratch --edition developer --json --set-default --wait 60', - { - ensureExitCode: 0, - } - ).jsonOutput.result; - expect(resp).to.have.all.keys(keys); - - expect( - JSON.parse(await fs.promises.readFile(path.join(session.project.dir, '.sf', 'config.json'), 'utf8')) - ).to.have.property('target-org', resp.username); - }); - it('stores alias in global sf.json', async () => { - const testAlias = 'testAlias'; - const resp = execCmd( - `env create scratch --edition developer --json --alias ${testAlias} --wait 60`, - { - ensureExitCode: 0, - } - ).jsonOutput.result; - expect(resp).to.have.all.keys(keys); - - const authFile = await readAuthFile(resp.username); - expect(authFile).to.include.keys(['orgId', 'devHubUsername', 'accessToken']); - - const aliases = await readAliases(); - expect(aliases.orgs).to.have.property(testAlias, resp.username); - }); - }); -}); diff --git a/test/commands/env/create/scratchOrgOutput.test.ts b/test/commands/env/create/scratchOrgOutput.test.ts deleted file mode 100644 index 3d3864f3..00000000 --- a/test/commands/env/create/scratchOrgOutput.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { scratchOrgLifecycleStages, ScratchOrgInfo } from '@salesforce/core'; -import { expect } from 'chai'; -import { - buildStatus, - formatCompletedStage, - formatCurrentStage, - formatFutureStage, - formatOrgId, - formatRequest, - formatStage, - formatUsername, -} from '../../../../src/shared/scratchOrgOutput'; - -describe('human output', () => { - describe('stage formatter', () => { - it('highlights 1st stage with color, remaining are dimmed', () => { - const result = formatStage(scratchOrgLifecycleStages[0]); - expect(result).includes(formatCurrentStage(scratchOrgLifecycleStages[0])); - scratchOrgLifecycleStages.slice(1).forEach((stage) => { - expect(result).includes(formatFutureStage(stage)); - }); - }); - it('highlights other stage with color and previous as green', () => { - const result = formatStage(scratchOrgLifecycleStages[1]); - expect(result).includes(formatCurrentStage(scratchOrgLifecycleStages[1])); - expect(result).includes(formatCompletedStage(scratchOrgLifecycleStages[0])); - scratchOrgLifecycleStages.slice(2).forEach((stage) => { - expect(result).includes(formatFutureStage(stage)); - }); - }); - }); - describe('overall output', () => { - const baseUrl = 'https://ut.my.salesforce.com'; - const scratchOrgInfo: ScratchOrgInfo = { - Id: '2SR3u0000008VBXGA2', - ScratchOrg: '00D0x000000Lf9E', - SignupUsername: 'test-uluqhj7qu9k2@example.com', - LoginUrl: 'https://ut.my.salesforce.com', - AuthCode: 'x', - Snapshot: null, - Username: 'test-uluqhj7qu9k2@example.com', - SignupEmail: 'x', - Status: 'Active', - SignupInstance: '', - }; - - it('shows all fields when all data is present', () => { - const output = buildStatus( - { stage: scratchOrgLifecycleStages[scratchOrgLifecycleStages.length - 1], scratchOrgInfo }, - baseUrl - ); - expect(output).includes(`RequestId: ${formatRequest(baseUrl, scratchOrgInfo.Id)}`); - expect(output).includes(`OrgId: ${formatOrgId(scratchOrgInfo.ScratchOrg)}`); - expect(output).includes(`Username: ${formatUsername(scratchOrgInfo.SignupUsername)}`); - expect(output).not.includes('}'); - expect(output).not.includes('{'); - }); - - it('still shows all field names when no data is present', () => { - const output = buildStatus({ stage: scratchOrgLifecycleStages[0] }, baseUrl); - expect(output).includes('RequestId: '); - expect(output).includes('OrgId: '); - expect(output).includes('RequestId: '); - }); - }); -}); diff --git a/test/commands/env/delete/scratch.nut.ts b/test/commands/env/delete/scratch.nut.ts deleted file mode 100644 index b365ac15..00000000 --- a/test/commands/env/delete/scratch.nut.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import * as path from 'path'; -import * as fs from 'fs'; -import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit'; -import { expect } from 'chai'; -import { ScratchDeleteResponse } from '../../../../src/commands/env/delete/scratch'; - -describe('env delete scratch NUTs', () => { - const scratchOrgAlias = 'scratch-org'; - const scratchOrgAlias2 = 'scratch-org-2'; - let session: TestSession; - - before(async () => { - session = await TestSession.create({ - project: { - name: 'testProject', - }, - devhubAuthStrategy: 'AUTO', - scratchOrgs: [ - { - executable: 'sf', - alias: scratchOrgAlias, - duration: 1, - config: path.join('config', 'project-scratch-def.json'), - }, - { - executable: 'sf', - alias: scratchOrgAlias2, - duration: 1, - config: path.join('config', 'project-scratch-def.json'), - }, - { - executable: 'sf', - setDefault: true, - duration: 1, - config: path.join('config', 'project-scratch-def.json'), - }, - ], - }); - }); - - after(async () => { - // clean restores sinon, but will throw when it tries to delete the already-deleted orgs. - // so catch that and delete the dir manually - try { - await session?.clean(); - } catch { - await fs.promises.rmdir(session.dir, { recursive: true }).catch(() => {}); - } - }); - - it('should see default username in help', () => { - const output = execCmd('env delete scratch --help', { ensureExitCode: 0 }).shellOutput; - expect(output).to.include(session.orgs.get('default').username); - }); - - it('should delete the 1st scratch org by alias', () => { - const command = `env delete scratch --target-org ${scratchOrgAlias} --no-prompt --json`; - const output = execCmd(command, { ensureExitCode: 0 }).jsonOutput.result; - expect(output.username).to.equal(session.orgs.get(scratchOrgAlias).username); - }); - - it('should delete the 2nd scratch org by username', () => { - const username = session.orgs.get(scratchOrgAlias2).username; - const command = `env delete scratch --target-org ${username} --no-prompt --json`; - const output = execCmd(command, { ensureExitCode: 0 }).jsonOutput.result; - expect(output.username).to.equal(session.orgs.get(scratchOrgAlias2).username); - }); - - it('should delete the 3rd scratch org because it is the default', () => { - const command = 'env delete scratch --no-prompt --json'; - const output = execCmd(command, { ensureExitCode: 0 }).jsonOutput.result; - expect(output.username).to.equal(session.orgs.get('default').username); - }); -}); diff --git a/test/shared/sandboxProgress.test.ts b/test/shared/sandboxProgress.test.ts deleted file mode 100644 index e1d4240a..00000000 --- a/test/shared/sandboxProgress.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { Duration } from '@salesforce/cli-plugins-testkit'; -import { SandboxProcessObject, StatusEvent } from '@salesforce/core'; -import { SandboxProgress } from '../../src/shared/sandboxProgress'; - -const sandboxProcessObj: SandboxProcessObject = { - Id: '0GR4p000000U8EMXXX', - Status: 'Completed', - SandboxName: 'TestSandbox', - SandboxInfoId: '0GQ4p000000U6sKXXX', - LicenseType: 'DEVELOPER', - CreatedDate: '2021-12-07T16:20:21.000+0000', - CopyProgress: 100, - SandboxOrganization: '00D2f0000008XXX', - SourceId: '123', - Description: 'sandbox description', - ApexClassId: '123', - EndDate: '2021-12-07T16:38:47.000+0000', -}; - -describe('sandbox progress', () => { - let sandboxProgress: SandboxProgress; - beforeEach(() => { - sandboxProgress = new SandboxProgress(); - }); - describe('getSandboxProgress', () => { - it('will calculate the correct human readable message (1h 33min 00seconds seconds left)', async () => { - const data: StatusEvent = { - // 186*30 = 5580 = 1 hour, 33 min, 0 seconds. so 186 attempts left, at a 30 second polling interval - sandboxProcessObj, - interval: 30, - remainingWait: Duration.minutes(93).seconds, - waitingOnAuth: false, - }; - const res = sandboxProgress.getSandboxProgress(data); - expect(res).to.have.property('id', 'TestSandbox(0GR4p000000U8EMXXX)'); - expect(res).to.have.property('status', 'Authenticating'); - expect(res).to.have.property('percentComplete', 100); - expect(res).to.have.property('remainingWaitTimeHuman', '01:33:00 until timeout.'); - }); - - it('will calculate the correct human readable message (5 min 30seconds seconds left)', async () => { - const data: StatusEvent = { - sandboxProcessObj, - interval: 30, - remainingWait: Duration.minutes(5).seconds + Duration.seconds(30).seconds, - waitingOnAuth: false, - }; - const res = sandboxProgress.getSandboxProgress(data); - expect(res).to.have.property('id', 'TestSandbox(0GR4p000000U8EMXXX)'); - expect(res).to.have.property('status', 'Authenticating'); - expect(res).to.have.property('percentComplete', 100); - expect(res).to.have.property('remainingWaitTimeHuman', '00:05:30 until timeout.'); - }); - }); - - describe('getTableDataFromProcessObj', () => { - it('getTableDataFromProcessObj should work', () => { - const tableData = sandboxProgress.getTableDataFromProcessObj('admin@prod.org.sandbox', sandboxProcessObj); - expect(tableData.find((r) => r.key === 'Authorized Sandbox Username')).to.have.property( - 'value', - 'admin@prod.org.sandbox' - ); - expect(tableData.find((r) => r.key === 'SandboxInfoId')).to.have.property('value', '0GQ4p000000U6sKXXX'); - }); - }); - describe('getSandboxTableAsText', () => { - it('getSandboxTableAsText should work', () => { - const tableData = sandboxProgress.getSandboxTableAsText('admin@prod.org.sandbox', sandboxProcessObj); - expect(tableData.find((r) => r.includes('Authorized Sandbox Username') && r.includes('admin@prod.org.sandbox'))) - .to.be.ok; - }); - }); -}); diff --git a/test/shared/stagedProgress.test.ts b/test/shared/stagedProgress.test.ts deleted file mode 100644 index e72b9454..00000000 --- a/test/shared/stagedProgress.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import * as chalk from 'chalk'; -import { StagedProgress, State, StateConstants } from '../../src/shared/stagedProgress'; -import { SandboxStatusData } from '../../src/shared/sandboxProgress'; - -class TestStagedProgress extends StagedProgress { - // eslint-disable-next-line class-methods-use-this - public formatProgressStatus(): string { - return ''; - } -} - -describe('stagedProgress', () => { - let stagedProgress: TestStagedProgress; - describe('updateStages', () => { - beforeEach(() => { - stagedProgress = new TestStagedProgress(['Pending', 'Processing', 'Activating', 'Completed', 'Authenticating']); - }); - it('should update existing stage', () => { - stagedProgress.updateStages('Pending', State.failed); - const pendingStage = stagedProgress.getStages()['Pending']; - expect(pendingStage).to.be.ok; - expect(pendingStage.state).to.equal(State.failed); - }); - it('should insert new stage at beginning of stages', () => { - stagedProgress.updateStages('Creating', State.inProgress); - const creatingStage = stagedProgress.getStages()['Creating']; - const pendingStage = stagedProgress.getStages()['Pending']; - expect(creatingStage).to.be.ok; - expect(creatingStage.state).to.equal(State.inProgress); - expect(creatingStage.index).to.be.lessThan(pendingStage.index); - }); - it('should insert new stage at end of stages', () => { - const stages = stagedProgress.getStages(); - Object.keys(stages).forEach((stage) => { - stages[stage].visited = true; - stages[stage].state = State.completed; - }); - stagedProgress.updateStages('Past the End', State.inProgress); - const pastTheEnd = stagedProgress.getStages()['Past the End']; - const authenticatingStage = stagedProgress.getStages()['Authenticating']; - expect(pastTheEnd).to.be.ok; - expect(pastTheEnd.state).to.equal(State.inProgress); - expect(pastTheEnd.index).to.be.greaterThan(authenticatingStage.index); - }); - it('should insert new stage after Processing', () => { - const stages = stagedProgress.getStages(); - Object.keys(stages).forEach((stage) => { - if (['Pending', 'Processing'].includes(stage)) { - stages[stage].visited = true; - stages[stage].state = State.completed; - } - }); - stagedProgress.updateStages('After Processing', State.inProgress); - const afterProcessStage = stagedProgress.getStages()['After Processing']; - const processingStage = stagedProgress.getStages()['Processing']; - expect(afterProcessStage).to.be.ok; - expect(afterProcessStage.state).to.equal(State.inProgress); - expect(afterProcessStage.index).to.be.equal(processingStage.index + 1); - }); - }); - describe('getFormattedStages', () => { - beforeEach(() => { - stagedProgress = new TestStagedProgress(['Pending', 'Processing', 'Activating', 'Completed', 'Authenticating']); - }); - it('should get formatted stages - all unknown', () => { - const formattedStages = stagedProgress.formatStages(); - expect(formattedStages).to.be.ok; - expect(formattedStages).to.include(StateConstants.unknown.char); - expect(formattedStages).to.include(chalk.dim('')); - }); - it('should get formatted stages - pending in progress', () => { - stagedProgress.updateStages('Pending', State.inProgress); - const formattedStages = stagedProgress.formatStages(); - expect(formattedStages).to.be.ok; - expect(formattedStages).to.include(StateConstants.unknown.char); - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - expect(formattedStages).to.include( - StateConstants.inProgress.color(`${StateConstants.inProgress.char} - Pending`) - ); - }); - it('should get formatted stages - pending successful', () => { - stagedProgress.updateStages('Pending', State.completed); - stagedProgress.updateStages('Processing', State.inProgress); - const formattedStages = stagedProgress.formatStages(); - expect(formattedStages).to.be.ok; - expect(formattedStages).to.include(StateConstants.unknown.char); - expect(formattedStages).to.include(StateConstants.completed.color(`${StateConstants.completed.char} - Pending`)); - }); - it('should get formatted stages - processing failed', () => { - stagedProgress.updateStages('Pending', State.completed); - stagedProgress.updateStages('Processing', State.failed); - const formattedStages = stagedProgress.formatStages(); - expect(formattedStages).to.be.ok; - expect(formattedStages).to.include(StateConstants.unknown.char); - expect(formattedStages).to.include(StateConstants.failed.color(`${StateConstants.failed.char} - Processing`)); - }); - }); -}); diff --git a/test/utils/timeUtils.test.ts b/test/utils/timeUtils.test.ts deleted file mode 100644 index e6e963df..00000000 --- a/test/utils/timeUtils.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2020, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ -import { expect } from 'chai'; -import { Duration } from '@salesforce/cli-plugins-testkit'; -import { getClockForSeconds, getSecondsToHuman } from '../../src/utils/timeUtils'; - -describe('timeUtils', () => { - describe('getSecondsToHuman', () => { - it('should build time string with 10 seconds', () => { - expect(getSecondsToHuman(10)).to.includes('10 seconds'); - }); - it('should build time string 1 minute', () => { - expect(getSecondsToHuman(60)).to.includes('1 minute'); - }); - it('should build time string 1 hour', () => { - expect(getSecondsToHuman(Duration.hours(1).seconds)).to.includes('1 hour'); - }); - it('should build time string 1 day', () => { - expect(getSecondsToHuman(Duration.days(1).seconds)).to.includes('1 day'); - }); - it('should build time string 1 day 12 hours', () => { - expect(getSecondsToHuman(Duration.days(1).seconds + Duration.hours(12).seconds)).to.includes('1 day 12 hour'); - }); - }); - describe('getClockForSeconds', () => { - it('should build time string with 10 seconds', () => { - expect(getClockForSeconds(10)).to.be.equal('00:00:10'); - }); - it('should build time string 1 minute', () => { - expect(getClockForSeconds(60)).to.be.equal('00:01:00'); - }); - it('should build time string 1 hour', () => { - expect(getClockForSeconds(Duration.hours(1).seconds)).to.be.equal('01:00:00'); - }); - it('should build time string 1 day', () => { - expect(getClockForSeconds(Duration.days(1).seconds)).to.be.equal('1:00:00:00'); - }); - it('should build time string 1 day 12 hours', () => { - expect(getClockForSeconds(Duration.days(1).seconds + Duration.hours(12).seconds)).to.be.equal('1:12:00:00'); - }); - }); -});