@adobe/ccweb-add-on-ssl 2.5.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.mocharc.json +9 -2
  2. package/README.md +5 -4
  3. package/bin/run.js +2 -2
  4. package/dist/AnalyticsMarkers.d.ts +5 -2
  5. package/dist/AnalyticsMarkers.d.ts.map +1 -1
  6. package/dist/AnalyticsMarkers.js +3 -0
  7. package/dist/app/CommandExecutor.d.ts +1 -1
  8. package/dist/app/CommandExecutor.d.ts.map +1 -1
  9. package/dist/app/PurgeCommandExecutor.d.ts +53 -0
  10. package/dist/app/PurgeCommandExecutor.d.ts.map +1 -0
  11. package/dist/app/PurgeCommandExecutor.js +125 -0
  12. package/dist/app/SSLReader.d.ts +2 -1
  13. package/dist/app/SSLReader.d.ts.map +1 -1
  14. package/dist/app/SetupCommandExecutor.d.ts.map +1 -1
  15. package/dist/app/SetupCommandExecutor.js +10 -7
  16. package/dist/app/WxpSSLReader.d.ts +8 -1
  17. package/dist/app/WxpSSLReader.d.ts.map +1 -1
  18. package/dist/app/WxpSSLReader.js +59 -5
  19. package/dist/app/index.d.ts +2 -1
  20. package/dist/app/index.d.ts.map +1 -1
  21. package/dist/app/index.js +2 -1
  22. package/dist/commands/purge.d.ts +41 -0
  23. package/dist/commands/purge.d.ts.map +1 -0
  24. package/dist/commands/purge.js +56 -0
  25. package/dist/commands/setup.d.ts +5 -10
  26. package/dist/commands/setup.d.ts.map +1 -1
  27. package/dist/commands/setup.js +5 -32
  28. package/dist/config/inversify.config.d.ts +2 -1
  29. package/dist/config/inversify.config.d.ts.map +1 -1
  30. package/dist/config/inversify.config.js +6 -1
  31. package/dist/config/inversify.types.d.ts.map +1 -1
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1 -0
  35. package/dist/models/Types.d.ts +0 -1
  36. package/dist/models/Types.d.ts.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +14 -12
  39. package/src/AnalyticsMarkers.ts +5 -2
  40. package/src/app/CommandExecutor.ts +1 -1
  41. package/src/app/PurgeCommandExecutor.ts +144 -0
  42. package/src/app/SSLReader.ts +2 -1
  43. package/src/app/SetupCommandExecutor.ts +10 -7
  44. package/src/app/WxpSSLReader.ts +71 -5
  45. package/src/app/index.ts +2 -1
  46. package/src/commands/purge.ts +72 -0
  47. package/src/commands/setup.ts +12 -40
  48. package/src/config/inversify.config.ts +9 -2
  49. package/src/config/inversify.types.ts +5 -1
  50. package/src/index.ts +2 -0
  51. package/src/test/app/PurgeCommandExecutor.spec.ts +195 -0
  52. package/src/test/app/SetupCommandExecutor.spec.ts +141 -34
  53. package/src/test/app/WxpSSLReader.spec.ts +107 -33
  54. package/src/test/commands/command.spec.ts +108 -0
  55. package/src/test/commands/purge.spec.ts +132 -0
  56. package/src/test/commands/setup.spec.ts +28 -29
  57. package/tsconfig.json +3 -1
package/.mocharc.json CHANGED
@@ -1,5 +1,12 @@
1
1
  {
2
2
  "extension": ["ts"],
3
- "node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm", "no-warnings"],
4
- "spec": ["src/test/**/*.spec.ts"]
3
+ "node-option": [
4
+ "experimental-specifier-resolution=node",
5
+ "loader=ts-node/esm",
6
+ "enable-source-maps",
7
+ "no-warnings"
8
+ ],
9
+ "spec": ["src/test/**/*.spec.ts"],
10
+ "recursive": true,
11
+ "timeout": 60000
5
12
  }
package/README.md CHANGED
@@ -8,13 +8,14 @@
8
8
 
9
9
  This package provides commands which can be used to set up your self-signed SSL certificate. This SSL certificate is used to locally host the add-on on your browser trusted HTTPS.
10
10
 
11
- These commands are used by [@adobe/create-ccweb-add-on](https://www.npmjs.com/package/@adobe/create-ccweb-add-on) to set up your one-time SSL certificate during its first run on your system.
11
+ These commands are used by [@adobe/create-ccweb-add-on](https://www.npmjs.com/package/@adobe/create-ccweb-add-on) to set up a locally trusted SSL certificate in your system as a one-time step.
12
12
 
13
13
  ## Commands
14
14
 
15
- | Command | Description | Basic Usage |
16
- | ------- | ---------------------------------------------------- | ------------------------------------------- |
17
- | setup | Automatically set up self-signed SSL in your system. | ccweb-add-on-ssl setup --hostname localhost |
15
+ | Command | Description | Basic Usage |
16
+ | ------- | ------------------------------------------------------------ | ------------------------------------------- |
17
+ | setup | Setup a locally trusted SSL certificate for hosting add-ons. | ccweb-add-on-ssl setup --hostname localhost |
18
+ | purge | Remove all add-on related SSL artifacts from your system. | ccweb-add-on-ssl purge |
18
19
 
19
20
  For detailed usage guides, you may check `npx @adobe/ccweb-add-on-ssl --help`.
20
21
 
package/bin/run.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import oclif from "@oclif/core";
4
4
 
5
- oclif
6
- .run(process.argv.slice(2), import.meta.url)
5
+ await oclif
6
+ .execute({ dir: import.meta.url })
7
7
  .then(oclif.flush)
8
8
  .catch(oclif.Errors.handle);
@@ -24,12 +24,15 @@
24
24
  export declare enum AnalyticsErrorMarkers {
25
25
  ERROR_SSL_INVALID_HOSTNAME = "ERROR_SSL_INVALID_HOSTNAME",
26
26
  ERROR_SSL_SETUP = "ERROR_SSL_SETUP",
27
- ERROR_SSL_REMOVE = "ERROR_SSL_REMOVE"
27
+ ERROR_SSL_REMOVE = "ERROR_SSL_REMOVE",
28
+ ERROR_SSL_PURGE = "ERROR_SSL_PURGE"
28
29
  }
29
30
  export declare enum AnalyticsSuccessMarkers {
30
31
  SUCCESSFUL_SSL_MANUAL_SETUP = "SUCCESSFUL_SSL_MANUAL_SETUP",
31
32
  SUCCESSFUL_SSL_AUTOMATIC_SETUP = "SUCCESSFUL_SSL_AUTOMATIC_SETUP",
32
33
  SUCCESSFUL_SSL_MANUAL_REMOVE = "SUCCESSFUL_SSL_MANUAL_REMOVE",
33
- SUCCESSFUL_SSL_AUTOMATIC_REMOVE = "SUCCESSFUL_SSL_AUTOMATIC_REMOVE"
34
+ SUCCESSFUL_SSL_AUTOMATIC_REMOVE = "SUCCESSFUL_SSL_AUTOMATIC_REMOVE",
35
+ SUCCESSFUL_SSL_MANUAL_PURGE = "SUCCESSFUL_SSL_MANUAL_PURGE",
36
+ SUCCESSFUL_SSL_AUTOMATIC_PURGE = "SUCCESSFUL_SSL_AUTOMATIC_PURGE"
34
37
  }
35
38
  //# sourceMappingURL=AnalyticsMarkers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsMarkers.d.ts","sourceRoot":"","sources":["../src/AnalyticsMarkers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,oBAAY,qBAAqB;IAC7B,0BAA0B,+BAA+B;IACzD,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;CACxC;AAED,oBAAY,uBAAuB;IAC/B,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;IACjE,4BAA4B,iCAAiC;IAC7D,+BAA+B,oCAAoC;CACtE"}
1
+ {"version":3,"file":"AnalyticsMarkers.d.ts","sourceRoot":"","sources":["../src/AnalyticsMarkers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,oBAAY,qBAAqB;IAC7B,0BAA0B,+BAA+B;IACzD,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;CACtC;AAED,oBAAY,uBAAuB;IAC/B,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;IACjE,4BAA4B,iCAAiC;IAC7D,+BAA+B,oCAAoC;IACnE,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;CACpE"}
@@ -26,6 +26,7 @@ export var AnalyticsErrorMarkers;
26
26
  AnalyticsErrorMarkers["ERROR_SSL_INVALID_HOSTNAME"] = "ERROR_SSL_INVALID_HOSTNAME";
27
27
  AnalyticsErrorMarkers["ERROR_SSL_SETUP"] = "ERROR_SSL_SETUP";
28
28
  AnalyticsErrorMarkers["ERROR_SSL_REMOVE"] = "ERROR_SSL_REMOVE";
29
+ AnalyticsErrorMarkers["ERROR_SSL_PURGE"] = "ERROR_SSL_PURGE";
29
30
  })(AnalyticsErrorMarkers || (AnalyticsErrorMarkers = {}));
30
31
  export var AnalyticsSuccessMarkers;
31
32
  (function (AnalyticsSuccessMarkers) {
@@ -33,5 +34,7 @@ export var AnalyticsSuccessMarkers;
33
34
  AnalyticsSuccessMarkers["SUCCESSFUL_SSL_AUTOMATIC_SETUP"] = "SUCCESSFUL_SSL_AUTOMATIC_SETUP";
34
35
  AnalyticsSuccessMarkers["SUCCESSFUL_SSL_MANUAL_REMOVE"] = "SUCCESSFUL_SSL_MANUAL_REMOVE";
35
36
  AnalyticsSuccessMarkers["SUCCESSFUL_SSL_AUTOMATIC_REMOVE"] = "SUCCESSFUL_SSL_AUTOMATIC_REMOVE";
37
+ AnalyticsSuccessMarkers["SUCCESSFUL_SSL_MANUAL_PURGE"] = "SUCCESSFUL_SSL_MANUAL_PURGE";
38
+ AnalyticsSuccessMarkers["SUCCESSFUL_SSL_AUTOMATIC_PURGE"] = "SUCCESSFUL_SSL_AUTOMATIC_PURGE";
36
39
  })(AnalyticsSuccessMarkers || (AnalyticsSuccessMarkers = {}));
37
40
  //# sourceMappingURL=AnalyticsMarkers.js.map
@@ -31,6 +31,6 @@ export interface CommandExecutor {
31
31
  * @param options - Command arguments entered by user represented as {@link CommandOptions}.
32
32
  * @returns Promise.
33
33
  */
34
- execute(options: CommandOptions): Promise<void>;
34
+ execute(options?: CommandOptions): Promise<void>;
35
35
  }
36
36
  //# sourceMappingURL=CommandExecutor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../src/app/CommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
1
+ {"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../src/app/CommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD"}
@@ -0,0 +1,53 @@
1
+ /********************************************************************************
2
+ * MIT License
3
+
4
+ * © Copyright 2025 Adobe. All rights reserved.
5
+
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ ********************************************************************************/
24
+ import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
25
+ import type { Logger, Preferences } from "@adobe/ccweb-add-on-core";
26
+ import "reflect-metadata";
27
+ import type { CommandExecutor } from "./CommandExecutor.js";
28
+ /**
29
+ * Purge command execution implementation class.
30
+ */
31
+ export declare class PurgeCommandExecutor implements CommandExecutor {
32
+ private readonly _preferences;
33
+ private readonly _analyticsService;
34
+ private readonly _logger;
35
+ /**
36
+ * Instantiate {@link PurgeCommandExecutor}.
37
+ * @param preferences - {@link Preferences} reference.
38
+ * @param analyticsService - {@link AnalyticsService} reference.
39
+ * @param logger - {@link Logger} reference.
40
+ * @returns Reference to a new {@link PurgeCommandExecutor} instance.
41
+ */
42
+ constructor(preferences: Preferences, analyticsService: AnalyticsService, logger: Logger);
43
+ /**
44
+ * Purge all SSL artifacts and invalidate the certificate authority from the trusted source.
45
+ * @returns Promise.
46
+ */
47
+ execute(): Promise<void>;
48
+ private _purgeCustomSSL;
49
+ private _purgeWxpSSL;
50
+ private _promptMessage;
51
+ private _promptMessageOption;
52
+ }
53
+ //# sourceMappingURL=PurgeCommandExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PurgeCommandExecutor.d.ts","sourceRoot":"","sources":["../../src/app/PurgeCommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOpE,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,qBACa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;;OAMG;gBAEiC,WAAW,EAAE,WAAW,EACd,gBAAgB,EAAE,gBAAgB,EACjD,MAAM,EAAE,MAAM;IAO7C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqC9B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;CAG/B"}
@@ -0,0 +1,125 @@
1
+ /********************************************************************************
2
+ * MIT License
3
+
4
+ * © Copyright 2025 Adobe. All rights reserved.
5
+
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ ********************************************************************************/
24
+ import { __decorate, __metadata, __param } from "tslib";
25
+ import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
26
+ import { ITypes as ICoreTypes } from "@adobe/ccweb-add-on-core";
27
+ import devcert from "@adobe/ccweb-add-on-devcert";
28
+ import chalk from "chalk";
29
+ import fs from "fs-extra";
30
+ import { inject, injectable } from "inversify";
31
+ import prompts from "prompts";
32
+ import "reflect-metadata";
33
+ import { AnalyticsErrorMarkers, AnalyticsSuccessMarkers } from "../AnalyticsMarkers.js";
34
+ import { SSLRemoveOption } from "../models/Types.js";
35
+ /**
36
+ * Purge command execution implementation class.
37
+ */
38
+ let PurgeCommandExecutor = class PurgeCommandExecutor {
39
+ _preferences;
40
+ _analyticsService;
41
+ _logger;
42
+ /**
43
+ * Instantiate {@link PurgeCommandExecutor}.
44
+ * @param preferences - {@link Preferences} reference.
45
+ * @param analyticsService - {@link AnalyticsService} reference.
46
+ * @param logger - {@link Logger} reference.
47
+ * @returns Reference to a new {@link PurgeCommandExecutor} instance.
48
+ */
49
+ constructor(preferences, analyticsService, logger) {
50
+ this._preferences = preferences;
51
+ this._analyticsService = analyticsService;
52
+ this._logger = logger;
53
+ }
54
+ /**
55
+ * Purge all SSL artifacts and invalidate the certificate authority from the trusted source.
56
+ * @returns Promise.
57
+ */
58
+ async execute() {
59
+ const response = await prompts.prompt({
60
+ type: "select",
61
+ name: "purgeConfirmation",
62
+ message: this._promptMessage(LOGS.purgeConfirmation),
63
+ choices: [
64
+ { title: this._promptMessageOption(LOGS.keepSSL), value: SSLRemoveOption.Keep },
65
+ { title: this._promptMessageOption(LOGS.removeSSL), value: SSLRemoveOption.Remove }
66
+ ],
67
+ initial: 0
68
+ });
69
+ if (!response || !response.purgeConfirmation) {
70
+ this._analyticsService.postEvent(AnalyticsErrorMarkers.ERROR_SSL_PURGE, LOGS.sslPurgeOptionNotSpecified, false);
71
+ return;
72
+ }
73
+ if (response.purgeConfirmation === SSLRemoveOption.Keep) {
74
+ return;
75
+ }
76
+ this._logger.information(LOGS.removingAndInvalidatingSSL, { prefix: LOGS.newLine });
77
+ this._logger.message(LOGS.requireSystemPassword);
78
+ this._logger.message(LOGS.requireSystemPasswordReason);
79
+ this._logger.message(LOGS.retryRunningIfTakingLonger);
80
+ this._purgeCustomSSL();
81
+ this._purgeWxpSSL();
82
+ this._logger.success(LOGS.removedAllSSL, { prefix: LOGS.newLine, postfix: LOGS.newLine });
83
+ }
84
+ _purgeCustomSSL() {
85
+ const userPreference = this._preferences.get();
86
+ if (userPreference.ssl !== undefined) {
87
+ userPreference.ssl = undefined;
88
+ this._preferences.set(userPreference);
89
+ this._analyticsService.postEvent(AnalyticsSuccessMarkers.SUCCESSFUL_SSL_MANUAL_PURGE, "", true);
90
+ }
91
+ }
92
+ _purgeWxpSSL() {
93
+ if (fs.existsSync(devcert.location())) {
94
+ devcert.removeAll();
95
+ this._analyticsService.postEvent(AnalyticsSuccessMarkers.SUCCESSFUL_SSL_AUTOMATIC_PURGE, "", true);
96
+ }
97
+ }
98
+ _promptMessage(message) {
99
+ return chalk.hex("#E59400")(message);
100
+ }
101
+ _promptMessageOption(message) {
102
+ return chalk.green.bold(message);
103
+ }
104
+ };
105
+ PurgeCommandExecutor = __decorate([
106
+ injectable(),
107
+ __param(0, inject(ICoreTypes.Preferences)),
108
+ __param(1, inject(IAnalyticsTypes.AnalyticsService)),
109
+ __param(2, inject(ICoreTypes.Logger)),
110
+ __metadata("design:paramtypes", [Object, Object, Object])
111
+ ], PurgeCommandExecutor);
112
+ export { PurgeCommandExecutor };
113
+ const LOGS = {
114
+ newLine: "\n",
115
+ sslPurgeOptionNotSpecified: "SSL purge option is not specified.",
116
+ purgeConfirmation: "Are you sure you want to remove all SSL artifacts from your system",
117
+ keepSSL: "No, keep existing SSL artifacts",
118
+ removeSSL: "Yes, remove all SSL artifacts",
119
+ removingAndInvalidatingSSL: "Removing and invalidating all SSL artifacts from your system ...",
120
+ requireSystemPassword: "This may require you to enter your system's password,",
121
+ requireSystemPasswordReason: "so that the SSL certificate can be removed from your system's trusted certificate path.",
122
+ retryRunningIfTakingLonger: "[If this takes longer than expected, please break and retry]",
123
+ removedAllSSL: "Removed all SSL artifacts."
124
+ };
125
+ //# sourceMappingURL=PurgeCommandExecutor.js.map
@@ -41,8 +41,9 @@ export interface SSLReader {
41
41
  /**
42
42
  * Read the SSL artifacts.
43
43
  * @param hostname - Hostname in the SSL certificate.
44
+ * @param port - Port where the add-on is being hosted.
44
45
  * @returns Promise of {@link SSLData}.
45
46
  */
46
- read(hostname: string): Promise<SSLData>;
47
+ read(hostname: string, port: number): Promise<SSLData>;
47
48
  }
48
49
  //# sourceMappingURL=SSLReader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SSLReader.d.ts","sourceRoot":"","sources":["../../src/app/SSLReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C"}
1
+ {"version":3,"file":"SSLReader.d.ts","sourceRoot":"","sources":["../../src/app/SSLReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEpC;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"SetupCommandExecutor.d.ts","sourceRoot":"","sources":["../../src/app/SetupCommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQpE,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD;;GAEG;AACH,qBACa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;;;OAOG;gBAEiC,WAAW,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACJ,gBAAgB,EAAE,gBAAgB,EACjD,MAAM,EAAE,MAAM;IAQ7C;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YA2C5C,kBAAkB;YA4BlB,iBAAiB;YAejB,sBAAsB;YAgBtB,kBAAkB;YA0DlB,kBAAkB;IAkChC,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;CAG/B"}
1
+ {"version":3,"file":"SetupCommandExecutor.d.ts","sourceRoot":"","sources":["../../src/app/SetupCommandExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQpE,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD;;GAEG;AACH,qBACa,oBAAqB,YAAW,eAAe;IACxD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;;;OAOG;gBAEiC,WAAW,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACJ,gBAAgB,EAAE,gBAAgB,EACjD,MAAM,EAAE,MAAM;IAQ7C;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YA2C5C,kBAAkB;YA0BlB,iBAAiB;YAejB,sBAAsB;YAgBtB,kBAAkB;YA+DlB,kBAAkB;IAkChC,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;CAG/B"}
@@ -24,8 +24,8 @@
24
24
  import { __decorate, __metadata, __param } from "tslib";
25
25
  import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
26
26
  import { ITypes as ICoreTypes, isFile } from "@adobe/ccweb-add-on-core";
27
- import chalk from "chalk";
28
27
  import devcert from "@adobe/ccweb-add-on-devcert";
28
+ import chalk from "chalk";
29
29
  import { inject, injectable } from "inversify";
30
30
  import path from "path";
31
31
  import process from "process";
@@ -112,8 +112,6 @@ let SetupCommandExecutor = class SetupCommandExecutor {
112
112
  this._logger.warning(format(LOGS.sslAlreadyConfigured, { hostname: options.hostname }), {
113
113
  prefix: LOGS.newLine
114
114
  });
115
- // Consider updating the signature of `_removeExistingSSL` to accept only `options`
116
- // when we introduce the @oclf command to `remove` an existing SSL.
117
115
  return await this._removeExistingSSL(options, isCustomSSL, isWxpSSL);
118
116
  }
119
117
  async _setupSSLManually(hostname) {
@@ -168,10 +166,15 @@ let SetupCommandExecutor = class SetupCommandExecutor {
168
166
  this._analyticsService.postEvent(AnalyticsSuccessMarkers.SUCCESSFUL_SSL_MANUAL_REMOVE, options.hostname, true);
169
167
  }
170
168
  if (isWxpSSL) {
171
- await devcert.removeDomain(options.hostname);
169
+ if (devcert.caExpiryInDays() <= 0) {
170
+ devcert.removeAll();
171
+ }
172
+ else {
173
+ await devcert.removeDomain(options.hostname);
174
+ }
172
175
  this._analyticsService.postEvent(AnalyticsSuccessMarkers.SUCCESSFUL_SSL_AUTOMATIC_REMOVE, options.hostname, true);
173
176
  }
174
- this._logger.success(LOGS.removed, { postfix: LOGS.newLine });
177
+ this._logger.success(LOGS.removedExistingSSL, { prefix: LOGS.newLine, postfix: LOGS.newLine });
175
178
  return true;
176
179
  }
177
180
  async _promptUserForPath(asset) {
@@ -227,7 +230,7 @@ const LOGS = {
227
230
  automatically: "Automatically, set it up for me",
228
231
  manually: "Manually, I already have an SSL certificate and key",
229
232
  settingUpSSL: "Setting up self-signed SSL certificate ...",
230
- requireSystemPassword: "This is only a one time step and may require you to enter your system's password",
233
+ requireSystemPassword: "This is only a one time step and may require you to enter your system's password,",
231
234
  requireSystemPasswordReason: "so that the SSL certificate can be added to your system's trusted certificate path.",
232
235
  retryRunningIfTakingLonger: "[If this takes longer than expected, please break and retry]",
233
236
  sslSetupComplete: "SSL setup complete!",
@@ -238,6 +241,6 @@ const LOGS = {
238
241
  invalidPathSpecified: "Invalid {asset} path specified.",
239
242
  sslSetupOptionNotSpecified: "SSL setup option is not specified.",
240
243
  sslRemoveOptionNotSpecified: "SSL remove option is not specified.",
241
- removed: "Removed."
244
+ removedExistingSSL: "Removed existing SSL certificate."
242
245
  };
243
246
  //# sourceMappingURL=SetupCommandExecutor.js.map
@@ -52,9 +52,16 @@ export declare class WxpSSLReader {
52
52
  /**
53
53
  * Read the SSL artifacts.
54
54
  * @param hostname - Hostname in the SSL certificate.
55
+ * @param port - Port where the add-on is being hosted.
55
56
  * @returns Promise of {@link SSLData}.
56
57
  */
57
- read(hostname: string): Promise<SSLData>;
58
+ read(hostname: string, port: number): Promise<SSLData>;
58
59
  private _getUserDefinedSSL;
60
+ private _handleExpiredSSLCertificate;
61
+ private _handleNearingExpirySSLCertificate;
62
+ private _handleNoSSLCertificateFound;
63
+ private _handleInvalidUserSSLCertificate;
64
+ private _handleUnknownExpirySSLCertificate;
65
+ private _recreateSSLCertificate;
59
66
  }
60
67
  //# sourceMappingURL=WxpSSLReader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WxpSSLReader.d.ts","sourceRoot":"","sources":["../../src/app/WxpSSLReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAe,MAAM,0BAA0B,CAAC;AAKjF,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,qBACa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBACyC,WAAW,EAAE,WAAW,EAA6B,MAAM,EAAE,MAAM;IAK/G;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAItC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAInC;;;;OAIG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA+B9C,OAAO,CAAC,kBAAkB;CAQ7B"}
1
+ {"version":3,"file":"WxpSSLReader.d.ts","sourceRoot":"","sources":["../../src/app/WxpSSLReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAe,MAAM,0BAA0B,CAAC;AAKjF,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,qBACa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBACyC,WAAW,EAAE,WAAW,EAA6B,MAAM,EAAE,MAAM;IAK/G;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAItC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAInC;;;;;OAKG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA8C5D,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,kCAAkC;IAK1C,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,gCAAgC;IAKxC,OAAO,CAAC,kCAAkC;IAO1C,OAAO,CAAC,uBAAuB;CAOlC"}
@@ -27,6 +27,7 @@ import devcert from "@adobe/ccweb-add-on-devcert";
27
27
  import fs from "fs-extra";
28
28
  import { inject, injectable } from "inversify";
29
29
  import "reflect-metadata";
30
+ import format from "string-template";
30
31
  /**
31
32
  * Implementation class for reading the SSL artifacts.
32
33
  */
@@ -62,21 +63,23 @@ let WxpSSLReader = class WxpSSLReader {
62
63
  /**
63
64
  * Read the SSL artifacts.
64
65
  * @param hostname - Hostname in the SSL certificate.
66
+ * @param port - Port where the add-on is being hosted.
65
67
  * @returns Promise of {@link SSLData}.
66
68
  */
67
- async read(hostname) {
69
+ async read(hostname, port) {
68
70
  const sslSettings = this._getUserDefinedSSL(hostname);
69
71
  // When SSL is set up manuually by the `user`.
70
72
  if (sslSettings !== undefined) {
71
73
  const { certificatePath, keyPath } = sslSettings;
72
74
  if (!certificatePath || !isFile(certificatePath)) {
73
- this._logger.error(LOGS.invalidCertificatePath);
75
+ this._handleInvalidUserSSLCertificate(LOGS.invalidCertificatePath);
74
76
  return process.exit(1);
75
77
  }
76
78
  if (!keyPath || !isFile(keyPath)) {
77
- this._logger.error(LOGS.invalidKeyPath);
79
+ this._handleInvalidUserSSLCertificate(LOGS.invalidKeyPath);
78
80
  return process.exit(1);
79
81
  }
82
+ this._handleUnknownExpirySSLCertificate(hostname, port);
80
83
  return {
81
84
  cert: fs.readFileSync(certificatePath),
82
85
  key: fs.readFileSync(keyPath)
@@ -84,9 +87,19 @@ let WxpSSLReader = class WxpSSLReader {
84
87
  }
85
88
  // When SSL is set up automatically by `devcert`.
86
89
  if (this.isWxpSSL(hostname)) {
90
+ const caExpiry = devcert.caExpiryInDays();
91
+ const certificateExpiry = devcert.certificateExpiryInDays(hostname);
92
+ const expiry = Math.min(certificateExpiry, caExpiry);
93
+ if (expiry <= 0) {
94
+ this._handleExpiredSSLCertificate();
95
+ return process.exit(1);
96
+ }
97
+ if (expiry <= 7) {
98
+ this._handleNearingExpirySSLCertificate(expiry);
99
+ }
87
100
  return await devcert.certificateFor(hostname);
88
101
  }
89
- this._logger.error(LOGS.noSSLDataFound, { postfix: LOGS.newLine });
102
+ this._handleNoSSLCertificateFound();
90
103
  return process.exit(1);
91
104
  }
92
105
  _getUserDefinedSSL(hostname) {
@@ -96,6 +109,36 @@ let WxpSSLReader = class WxpSSLReader {
96
109
  }
97
110
  return ssl.get(hostname);
98
111
  }
112
+ _handleExpiredSSLCertificate() {
113
+ this._logger.error(LOGS.noValidSSLCertificateFound);
114
+ this._logger.error(LOGS.expiredSSLCertificate);
115
+ this._recreateSSLCertificate();
116
+ }
117
+ _handleNearingExpirySSLCertificate(expiry) {
118
+ this._logger.warning(format(LOGS.nearingExpirySSLCertificate, { expiry }));
119
+ this._recreateSSLCertificate();
120
+ }
121
+ _handleNoSSLCertificateFound() {
122
+ this._logger.error(LOGS.noValidSSLCertificateFound);
123
+ this._logger.error(LOGS.invalidatedSSLCertificate);
124
+ this._recreateSSLCertificate();
125
+ }
126
+ _handleInvalidUserSSLCertificate(errorMessage) {
127
+ this._logger.error(errorMessage);
128
+ this._recreateSSLCertificate();
129
+ }
130
+ _handleUnknownExpirySSLCertificate(hostname, port) {
131
+ this._logger.warning(LOGS.undeterminedExpirySSLCertificate);
132
+ this._logger.warning(LOGS.unableToSideloadAddOn);
133
+ this._logger.warning(format(LOGS.checkCertificateValidity, { hostname, port }));
134
+ this._recreateSSLCertificate();
135
+ }
136
+ _recreateSSLCertificate() {
137
+ this._logger.warning(LOGS.recreateSSLCertificate, { prefix: LOGS.newLine });
138
+ this._logger.information(LOGS.setupSSLCommand, { prefix: LOGS.tab });
139
+ this._logger.warning(LOGS.example, { prefix: LOGS.newLine });
140
+ this._logger.information(LOGS.setupSSLCommandExample, { prefix: LOGS.tab, postfix: LOGS.newLine });
141
+ }
99
142
  };
100
143
  WxpSSLReader = __decorate([
101
144
  injectable(),
@@ -106,8 +149,19 @@ WxpSSLReader = __decorate([
106
149
  export { WxpSSLReader };
107
150
  const LOGS = {
108
151
  newLine: "\n",
152
+ tab: " ",
109
153
  invalidCertificatePath: "Invalid SSL certificate file path.",
110
154
  invalidKeyPath: "Invalid SSL key file path.",
111
- noSSLDataFound: "No SSL related certificate or key files were found. Please retry after setting them up."
155
+ noValidSSLCertificateFound: "Could not locate a valid SSL certificate to host the add-on.",
156
+ expiredSSLCertificate: "The SSL certificate has expired.",
157
+ nearingExpirySSLCertificate: "Your SSL certificate will expire in {expiry} days.",
158
+ invalidatedSSLCertificate: "If you had previously set it up, it may have been invalidated due to a version upgrade.",
159
+ undeterminedExpirySSLCertificate: "Could not determine the expiry of your SSL certificate.",
160
+ unableToSideloadAddOn: "If you are unable to sideload your add-on, please check the validity of:",
161
+ checkCertificateValidity: "https://{hostname}:{port} certificate in your browser.",
162
+ recreateSSLCertificate: "To re-create the SSL certificate, you may run:",
163
+ setupSSLCommand: "npx @adobe/ccweb-add-on-ssl setup --hostname [hostname]",
164
+ example: "Example:",
165
+ setupSSLCommandExample: "npx @adobe/ccweb-add-on-ssl setup --hostname localhost"
112
166
  };
113
167
  //# sourceMappingURL=WxpSSLReader.js.map
@@ -22,7 +22,8 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
  export * from "./CommandExecutor.js";
25
- export * from "./SSLReader.js";
25
+ export * from "./PurgeCommandExecutor.js";
26
26
  export * from "./SetupCommandExecutor.js";
27
+ export * from "./SSLReader.js";
27
28
  export * from "./WxpSSLReader.js";
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
package/dist/app/index.js CHANGED
@@ -22,7 +22,8 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
  export * from "./CommandExecutor.js";
25
- export * from "./SSLReader.js";
25
+ export * from "./PurgeCommandExecutor.js";
26
26
  export * from "./SetupCommandExecutor.js";
27
+ export * from "./SSLReader.js";
27
28
  export * from "./WxpSSLReader.js";
28
29
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,41 @@
1
+ /********************************************************************************
2
+ * MIT License
3
+
4
+ * © Copyright 2025 Adobe. All rights reserved.
5
+
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ ********************************************************************************/
24
+ import { BaseCommand } from "@adobe/ccweb-add-on-analytics";
25
+ import type { Config } from "@oclif/core";
26
+ import "reflect-metadata";
27
+ /**
28
+ * SSL Purge command.
29
+ */
30
+ export declare class Purge extends BaseCommand {
31
+ private readonly _commandExecutor;
32
+ static description: string;
33
+ static args: {};
34
+ static flags: {};
35
+ constructor(argv: string[], config: Config);
36
+ run(): Promise<void>;
37
+ catch(error: {
38
+ message: string;
39
+ }): Promise<void>;
40
+ }
41
+ //# sourceMappingURL=purge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purge.d.ts","sourceRoot":"","sources":["../../src/commands/purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,EAAE,WAAW,EAAc,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,kBAAkB,CAAC;AAM1B;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;IAEnD,MAAM,CAAC,WAAW,SAA8E;IAEhG,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,KAAK,KAAM;gBAEN,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM;IAMpC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAepB,KAAK,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzD"}
@@ -0,0 +1,56 @@
1
+ /********************************************************************************
2
+ * MIT License
3
+
4
+ * © Copyright 2025 Adobe. All rights reserved.
5
+
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ ********************************************************************************/
24
+ import { BaseCommand, CLIProgram } from "@adobe/ccweb-add-on-analytics";
25
+ import { UncaughtExceptionHandler } from "@adobe/ccweb-add-on-core";
26
+ import process from "process";
27
+ import "reflect-metadata";
28
+ import { AnalyticsErrorMarkers } from "../AnalyticsMarkers.js";
29
+ import { IContainer, ITypes } from "../config/index.js";
30
+ import { PROGRAM_NAME } from "../constants.js";
31
+ /**
32
+ * SSL Purge command.
33
+ */
34
+ export class Purge extends BaseCommand {
35
+ _commandExecutor;
36
+ static description = "Remove and invalidate all add-on related SSL artifacts from your system.";
37
+ static args = {};
38
+ static flags = {};
39
+ constructor(argv, config) {
40
+ super(argv, config, new CLIProgram(PROGRAM_NAME, config.name + "@" + config.version));
41
+ this._commandExecutor = IContainer.getNamed(ITypes.CommandExecutor, "purge");
42
+ }
43
+ async run() {
44
+ UncaughtExceptionHandler.registerExceptionHandler(PROGRAM_NAME);
45
+ const rootDirectory = process.cwd();
46
+ process.chdir(rootDirectory);
47
+ const { flags: { analytics } } = await this.parse(Purge);
48
+ await this._seekAnalyticsConsent(analytics);
49
+ await this._commandExecutor.execute();
50
+ }
51
+ async catch(error) {
52
+ this._analyticsService.postEvent(AnalyticsErrorMarkers.ERROR_SSL_PURGE, error.message, false);
53
+ throw error;
54
+ }
55
+ }
56
+ //# sourceMappingURL=purge.js.map