@adobe/ccweb-add-on-analytics 2.5.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.c8rc.json +7 -2
- package/.mocharc.json +6 -1
- package/dist/app/AnalyticsConsent.d.ts +16 -2
- package/dist/app/AnalyticsConsent.d.ts.map +1 -1
- package/dist/app/AnalyticsConsent.js +89 -1
- package/dist/app/AnalyticsService.d.ts +15 -3
- package/dist/app/AnalyticsService.d.ts.map +1 -1
- package/dist/app/AnalyticsService.js +88 -1
- package/dist/app/index.d.ts +0 -2
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +0 -2
- package/dist/base/BaseCommand.d.ts +40 -0
- package/dist/base/BaseCommand.d.ts.map +1 -0
- package/dist/base/BaseCommand.js +59 -0
- package/dist/base/index.d.ts +25 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +25 -0
- package/dist/config/inversify.config.d.ts +2 -1
- package/dist/config/inversify.config.d.ts.map +1 -1
- package/dist/config/inversify.config.js +4 -3
- package/dist/config/inversify.types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/app/AnalyticsConsent.ts +84 -4
- package/src/app/AnalyticsService.ts +74 -6
- package/src/app/index.ts +0 -2
- package/src/base/BaseCommand.ts +72 -0
- package/src/base/index.ts +25 -0
- package/src/config/inversify.config.ts +6 -5
- package/src/config/inversify.types.ts +4 -1
- package/src/index.ts +1 -0
- package/src/test/app/{WxpAnalyticsConsent.spec.ts → AnalyticsConsent.spec.ts} +13 -14
- package/src/test/app/{WxpAnalyticsService.spec.ts → AnalyticsService.spec.ts} +12 -13
- package/src/test/models/CLIProgram.spec.ts +1 -1
- package/tsconfig.json +3 -1
- package/dist/app/WxpAnalyticsConsent.d.ts +0 -54
- package/dist/app/WxpAnalyticsConsent.d.ts.map +0 -1
- package/dist/app/WxpAnalyticsConsent.js +0 -113
- package/dist/app/WxpAnalyticsService.d.ts +0 -60
- package/dist/app/WxpAnalyticsService.d.ts.map +0 -1
- package/dist/app/WxpAnalyticsService.js +0 -112
- package/src/app/WxpAnalyticsConsent.ts +0 -119
- package/src/app/WxpAnalyticsService.ts +0 -120
package/.c8rc.json
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
"all": true,
|
|
3
3
|
"include": ["src/**/*.ts"],
|
|
4
4
|
"exclude": [
|
|
5
|
+
"**/*.d.ts",
|
|
5
6
|
"src/**/*.spec.ts",
|
|
6
7
|
"src/**/*Types.ts",
|
|
7
8
|
"src/**/index.ts",
|
|
9
|
+
"src/base/BaseCommand.ts",
|
|
8
10
|
"src/config/*",
|
|
9
|
-
"src/constants.ts"
|
|
10
|
-
"**/*.d.ts"
|
|
11
|
+
"src/constants.ts"
|
|
11
12
|
],
|
|
13
|
+
"lines": 100,
|
|
14
|
+
"functions": 100,
|
|
15
|
+
"branches": 100,
|
|
16
|
+
"statements": 100,
|
|
12
17
|
"reporter": ["html", "text", "text-summary"],
|
|
13
18
|
"report-dir": "coverage"
|
|
14
19
|
}
|
package/.mocharc.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extension": ["ts"],
|
|
3
|
-
"node-option": [
|
|
3
|
+
"node-option": [
|
|
4
|
+
"experimental-specifier-resolution=node",
|
|
5
|
+
"loader=ts-node/esm",
|
|
6
|
+
"enable-source-maps",
|
|
7
|
+
"no-warnings"
|
|
8
|
+
],
|
|
4
9
|
"spec": ["src/test/**/*.spec.ts"]
|
|
5
10
|
}
|
|
@@ -21,11 +21,23 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
|
+
import type { Logger } from "@adobe/ccweb-add-on-core";
|
|
25
|
+
import { UserPreferences } from "@adobe/ccweb-add-on-core";
|
|
26
|
+
import "reflect-metadata";
|
|
24
27
|
/**
|
|
25
|
-
*
|
|
28
|
+
* Implementation class to get and set user's consent
|
|
26
29
|
* on allowing the application to collect and send analytics to Adobe.
|
|
27
30
|
*/
|
|
28
|
-
export
|
|
31
|
+
export declare class AnalyticsConsent {
|
|
32
|
+
private readonly _preferences;
|
|
33
|
+
private readonly _logger;
|
|
34
|
+
/**
|
|
35
|
+
* Instantiate {@link AnalyticsConsent}.
|
|
36
|
+
* @param preferences - {@link UserPreferences} reference.
|
|
37
|
+
* @param logger - {@link Logger} reference.
|
|
38
|
+
* @returns Reference to a new {@link AnalyticsConsent} instance.
|
|
39
|
+
*/
|
|
40
|
+
constructor(preferences: UserPreferences, logger: Logger);
|
|
29
41
|
/**
|
|
30
42
|
* Get user consent to collect and send analytics to Adobe.
|
|
31
43
|
* @returns Promise of boolean value representing whether the user has provided consent.
|
|
@@ -36,5 +48,7 @@ export interface AnalyticsConsent {
|
|
|
36
48
|
* @param consent - Boolean value representing whether the user has provided consent.
|
|
37
49
|
*/
|
|
38
50
|
set(consent: boolean): Promise<void>;
|
|
51
|
+
private _promptMessage;
|
|
52
|
+
private _promptMessageOption;
|
|
39
53
|
}
|
|
40
54
|
//# sourceMappingURL=AnalyticsConsent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsConsent.d.ts","sourceRoot":"","sources":["../../src/app/AnalyticsConsent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"AnalyticsConsent.d.ts","sourceRoot":"","sources":["../../src/app/AnalyticsConsent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAwB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIjF,OAAO,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,qBACa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkB;IAC/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBAEqC,WAAW,EAAE,eAAe,EACrC,MAAM,EAAE,MAAM;IAM7C;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;IAqC7B;;;OAGG;IACG,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;CAG/B"}
|
|
@@ -21,5 +21,93 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
|
-
|
|
24
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
25
|
+
import { ITypes as ICoreTypes, UserPreferences } from "@adobe/ccweb-add-on-core";
|
|
26
|
+
import chalk from "chalk";
|
|
27
|
+
import { inject, injectable } from "inversify";
|
|
28
|
+
import prompts from "prompts";
|
|
29
|
+
import "reflect-metadata";
|
|
30
|
+
/**
|
|
31
|
+
* Implementation class to get and set user's consent
|
|
32
|
+
* on allowing the application to collect and send analytics to Adobe.
|
|
33
|
+
*/
|
|
34
|
+
let AnalyticsConsent = class AnalyticsConsent {
|
|
35
|
+
_preferences;
|
|
36
|
+
_logger;
|
|
37
|
+
/**
|
|
38
|
+
* Instantiate {@link AnalyticsConsent}.
|
|
39
|
+
* @param preferences - {@link UserPreferences} reference.
|
|
40
|
+
* @param logger - {@link Logger} reference.
|
|
41
|
+
* @returns Reference to a new {@link AnalyticsConsent} instance.
|
|
42
|
+
*/
|
|
43
|
+
constructor(preferences, logger) {
|
|
44
|
+
this._preferences = preferences;
|
|
45
|
+
this._logger = logger;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get user consent to collect and send analytics to Adobe.
|
|
49
|
+
* @returns Promise of boolean value representing whether the user has provided consent.
|
|
50
|
+
*/
|
|
51
|
+
async get() {
|
|
52
|
+
// Always get the preference from cache
|
|
53
|
+
// for checking the analytics consent
|
|
54
|
+
// to avoid a file IO operation.
|
|
55
|
+
const preferenceData = this._preferences.get(true);
|
|
56
|
+
if (preferenceData.hasTelemetryConsent !== undefined) {
|
|
57
|
+
return preferenceData.hasTelemetryConsent;
|
|
58
|
+
}
|
|
59
|
+
this._logger.warning(LOGS.toolCollectsAnalytics, { prefix: LOGS.newLine });
|
|
60
|
+
const choices = [
|
|
61
|
+
{
|
|
62
|
+
title: this._promptMessageOption(LOGS.yesSendAnalytics),
|
|
63
|
+
value: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: this._promptMessageOption(LOGS.noDontSendAnalytics),
|
|
67
|
+
value: false
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const response = await prompts.prompt({
|
|
71
|
+
type: "select",
|
|
72
|
+
name: "analyticsConsent",
|
|
73
|
+
message: this._promptMessage(LOGS.sendToAdobe),
|
|
74
|
+
choices,
|
|
75
|
+
initial: 0
|
|
76
|
+
});
|
|
77
|
+
if (!response || response.analyticsConsent === undefined) {
|
|
78
|
+
return process.exit(0);
|
|
79
|
+
}
|
|
80
|
+
await this.set(response.analyticsConsent);
|
|
81
|
+
return response.analyticsConsent;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Set user consent to collect and send analytics to Adobe.
|
|
85
|
+
* @param consent - Boolean value representing whether the user has provided consent.
|
|
86
|
+
*/
|
|
87
|
+
async set(consent) {
|
|
88
|
+
const preferenceData = this._preferences.get();
|
|
89
|
+
preferenceData.hasTelemetryConsent = consent;
|
|
90
|
+
this._preferences.set(preferenceData);
|
|
91
|
+
}
|
|
92
|
+
_promptMessage(message) {
|
|
93
|
+
return chalk.hex("#E59400")(message);
|
|
94
|
+
}
|
|
95
|
+
_promptMessageOption(message) {
|
|
96
|
+
return chalk.green.bold(message);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
AnalyticsConsent = __decorate([
|
|
100
|
+
injectable(),
|
|
101
|
+
__param(0, inject(ICoreTypes.UserPreferences)),
|
|
102
|
+
__param(1, inject(ICoreTypes.Logger)),
|
|
103
|
+
__metadata("design:paramtypes", [UserPreferences, Object])
|
|
104
|
+
], AnalyticsConsent);
|
|
105
|
+
export { AnalyticsConsent };
|
|
106
|
+
const LOGS = {
|
|
107
|
+
newLine: "\n",
|
|
108
|
+
yesSendAnalytics: "Yes, send analytics to Adobe",
|
|
109
|
+
noDontSendAnalytics: "No, don't send analytics to Adobe",
|
|
110
|
+
toolCollectsAnalytics: "This tool collects and sends analytics to help Adobe improve its products.",
|
|
111
|
+
sendToAdobe: "Do you want to allow sending analytics to Adobe"
|
|
112
|
+
};
|
|
25
113
|
//# sourceMappingURL=AnalyticsConsent.js.map
|
|
@@ -21,11 +21,22 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
|
-
import {
|
|
24
|
+
import { UserPreferences } from "@adobe/ccweb-add-on-core";
|
|
25
|
+
import "reflect-metadata";
|
|
26
|
+
import { CLIProgram } from "../models/CLIProgram.js";
|
|
25
27
|
/**
|
|
26
|
-
* Analytics service
|
|
28
|
+
* Analytics service implementation.
|
|
27
29
|
*/
|
|
28
|
-
export
|
|
30
|
+
export declare class AnalyticsService {
|
|
31
|
+
private readonly _preferences;
|
|
32
|
+
private _program;
|
|
33
|
+
private _startTime;
|
|
34
|
+
/**
|
|
35
|
+
* Instantiate {@link AnalyticsService}.
|
|
36
|
+
* @param preferences - {@link UserPreferences} reference.
|
|
37
|
+
* @returns Reference to a new {@link AnalyticsService} instance.
|
|
38
|
+
*/
|
|
39
|
+
constructor(preferences: UserPreferences);
|
|
29
40
|
/**
|
|
30
41
|
* Set the program which is being executed.
|
|
31
42
|
* @param program - {@link CLIProgram} reference.
|
|
@@ -43,5 +54,6 @@ export interface AnalyticsService {
|
|
|
43
54
|
* @returns Promise.
|
|
44
55
|
*/
|
|
45
56
|
postEvent(eventType: string, eventData: string, isSuccess: boolean): Promise<void>;
|
|
57
|
+
private _getClientId;
|
|
46
58
|
}
|
|
47
59
|
//# sourceMappingURL=AnalyticsService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsService.d.ts","sourceRoot":"","sources":["../../src/app/AnalyticsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AnalyticsService.d.ts","sourceRoot":"","sources":["../../src/app/AnalyticsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,EAAwB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIjF,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;GAEG;AACH,qBACa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkB;IAE/C,OAAO,CAAC,QAAQ,CAAa;IAE7B,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;OAIG;gBAC6C,WAAW,EAAE,eAAe;IAQ5E;;;OAGG;IACH,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAE9B;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,EAEzB;IAED;;;;;;OAMG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BxF,OAAO,CAAC,YAAY;CASvB"}
|
|
@@ -21,5 +21,92 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
|
-
|
|
24
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
25
|
+
import { ITypes as ICoreTypes, UserPreferences } from "@adobe/ccweb-add-on-core";
|
|
26
|
+
import axios from "axios";
|
|
27
|
+
import { inject, injectable } from "inversify";
|
|
28
|
+
import osName from "os-name";
|
|
29
|
+
import "reflect-metadata";
|
|
30
|
+
import { ANALYTICS_API } from "../constants.js";
|
|
31
|
+
import { CLIProgram } from "../models/CLIProgram.js";
|
|
32
|
+
/**
|
|
33
|
+
* Analytics service implementation.
|
|
34
|
+
*/
|
|
35
|
+
let AnalyticsService = class AnalyticsService {
|
|
36
|
+
_preferences;
|
|
37
|
+
_program;
|
|
38
|
+
_startTime;
|
|
39
|
+
/**
|
|
40
|
+
* Instantiate {@link AnalyticsService}.
|
|
41
|
+
* @param preferences - {@link UserPreferences} reference.
|
|
42
|
+
* @returns Reference to a new {@link AnalyticsService} instance.
|
|
43
|
+
*/
|
|
44
|
+
constructor(preferences) {
|
|
45
|
+
this._preferences = preferences;
|
|
46
|
+
this._program = new CLIProgram("", "");
|
|
47
|
+
this._startTime = Date.now();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Set the program which is being executed.
|
|
51
|
+
* @param program - {@link CLIProgram} reference.
|
|
52
|
+
*/
|
|
53
|
+
set program(program) {
|
|
54
|
+
this._program = program;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Set the start time of an operation.
|
|
58
|
+
*/
|
|
59
|
+
set startTime(time) {
|
|
60
|
+
this._startTime = time;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Post an event to Adobe analytics service.
|
|
64
|
+
* @param eventType - Event type, either a SUCCESS, or an ERROR.
|
|
65
|
+
* @param eventData - Event data.
|
|
66
|
+
* @param isSuccess - Does the event represent a successful operation.
|
|
67
|
+
* @returns Promise.
|
|
68
|
+
*/
|
|
69
|
+
async postEvent(eventType, eventData, isSuccess) {
|
|
70
|
+
try {
|
|
71
|
+
const userPreferences = this._preferences.get();
|
|
72
|
+
if (!userPreferences.hasTelemetryConsent) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const currentTime = Date.now();
|
|
76
|
+
const body = JSON.stringify({
|
|
77
|
+
id: Math.floor(currentTime * Math.random()),
|
|
78
|
+
timestamp: currentTime,
|
|
79
|
+
_adobeio: {
|
|
80
|
+
eventType,
|
|
81
|
+
eventData,
|
|
82
|
+
cliVersion: this._program.version,
|
|
83
|
+
clientId: this._getClientId(),
|
|
84
|
+
command: this._program.name,
|
|
85
|
+
commandDuration: currentTime - this._startTime,
|
|
86
|
+
commandSuccess: isSuccess,
|
|
87
|
+
nodeVersion: process.version,
|
|
88
|
+
osNameVersion: osName()
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
await axios.post(ANALYTICS_API.URL, body, { headers: ANALYTICS_API.HEADERS });
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_getClientId() {
|
|
98
|
+
const userPreferences = this._preferences.get();
|
|
99
|
+
if (userPreferences.clientId === undefined) {
|
|
100
|
+
userPreferences.clientId = Math.floor(Date.now() * Math.random());
|
|
101
|
+
this._preferences.set(userPreferences);
|
|
102
|
+
}
|
|
103
|
+
return userPreferences.clientId;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
AnalyticsService = __decorate([
|
|
107
|
+
injectable(),
|
|
108
|
+
__param(0, inject(ICoreTypes.UserPreferences)),
|
|
109
|
+
__metadata("design:paramtypes", [UserPreferences])
|
|
110
|
+
], AnalyticsService);
|
|
111
|
+
export { AnalyticsService };
|
|
25
112
|
//# sourceMappingURL=AnalyticsService.js.map
|
package/dist/app/index.d.ts
CHANGED
|
@@ -23,6 +23,4 @@
|
|
|
23
23
|
********************************************************************************/
|
|
24
24
|
export * from "./AnalyticsConsent.js";
|
|
25
25
|
export * from "./AnalyticsService.js";
|
|
26
|
-
export * from "./WxpAnalyticsConsent.js";
|
|
27
|
-
export * from "./WxpAnalyticsService.js";
|
|
28
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/app/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
package/dist/app/index.js
CHANGED
|
@@ -23,6 +23,4 @@
|
|
|
23
23
|
********************************************************************************/
|
|
24
24
|
export * from "./AnalyticsConsent.js";
|
|
25
25
|
export * from "./AnalyticsService.js";
|
|
26
|
-
export * from "./WxpAnalyticsConsent.js";
|
|
27
|
-
export * from "./WxpAnalyticsService.js";
|
|
28
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { Config } from "@oclif/core";
|
|
25
|
+
import { Command } from "@oclif/core";
|
|
26
|
+
import type { BooleanFlag, CustomOptions, OptionFlag } from "@oclif/core/lib/interfaces/parser.js";
|
|
27
|
+
import type { AnalyticsConsent } from "../app/AnalyticsConsent.js";
|
|
28
|
+
import type { AnalyticsService } from "../app/AnalyticsService.js";
|
|
29
|
+
import type { CLIProgram } from "../models/CLIProgram.js";
|
|
30
|
+
export declare abstract class BaseCommand extends Command {
|
|
31
|
+
protected readonly _analyticsConsent: AnalyticsConsent;
|
|
32
|
+
protected readonly _analyticsService: AnalyticsService;
|
|
33
|
+
constructor(argv: string[], config: Config, program: CLIProgram);
|
|
34
|
+
static baseFlags: {
|
|
35
|
+
analytics: OptionFlag<string | undefined, CustomOptions>;
|
|
36
|
+
verbose: BooleanFlag<boolean>;
|
|
37
|
+
};
|
|
38
|
+
protected _seekAnalyticsConsent(analytics: string | undefined): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=BaseCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../src/base/BaseCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,8BAAsB,WAAY,SAAQ,OAAO;IAC7C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;IACvD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;gBAE3C,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAU/D,MAAM,CAAC,SAAS,EAAE;QACd,SAAS,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,EAAE,aAAa,CAAC,CAAC;QACzD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;KACjC,CAaC;cAEc,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAOtF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { Command, Flags } from "@oclif/core";
|
|
25
|
+
import { IContainer, ITypes } from "../config/index.js";
|
|
26
|
+
export class BaseCommand extends Command {
|
|
27
|
+
_analyticsConsent;
|
|
28
|
+
_analyticsService;
|
|
29
|
+
constructor(argv, config, program) {
|
|
30
|
+
super(argv, config);
|
|
31
|
+
this._analyticsConsent = IContainer.get(ITypes.AnalyticsConsent);
|
|
32
|
+
this._analyticsService = IContainer.get(ITypes.AnalyticsService);
|
|
33
|
+
this._analyticsService.program = program;
|
|
34
|
+
this._analyticsService.startTime = Date.now();
|
|
35
|
+
}
|
|
36
|
+
static baseFlags = {
|
|
37
|
+
analytics: Flags.string({
|
|
38
|
+
char: "a",
|
|
39
|
+
description: "Turn on/off sending analytics to Adobe.",
|
|
40
|
+
options: ["on", "off"],
|
|
41
|
+
required: false
|
|
42
|
+
}),
|
|
43
|
+
verbose: Flags.boolean({
|
|
44
|
+
char: "v",
|
|
45
|
+
description: "Enable verbose logging.",
|
|
46
|
+
default: false,
|
|
47
|
+
required: false
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
async _seekAnalyticsConsent(analytics) {
|
|
51
|
+
if (analytics === undefined) {
|
|
52
|
+
await this._analyticsConsent.get();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await this._analyticsConsent.set(analytics === "on");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=BaseCommand.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export * from "./BaseCommand.js";
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export * from "./BaseCommand.js";
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
|
+
import type { Container } from "inversify";
|
|
24
25
|
import "reflect-metadata";
|
|
25
|
-
declare const container:
|
|
26
|
+
declare const container: Container;
|
|
26
27
|
export { container as IContainer };
|
|
27
28
|
//# sourceMappingURL=inversify.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inversify.config.d.ts","sourceRoot":"","sources":["../../src/config/inversify.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAGlF,OAAO,kBAAkB,CAAC;AAK1B,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"inversify.config.d.ts","sourceRoot":"","sources":["../../src/config/inversify.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAGlF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,kBAAkB,CAAC;AAK1B,QAAA,MAAM,SAAS,EAAE,SAA0B,CAAC;AAM5C,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
********************************************************************************/
|
|
24
24
|
import { IContainer as ICoreContainer } from "@adobe/ccweb-add-on-core";
|
|
25
25
|
import "reflect-metadata";
|
|
26
|
-
import {
|
|
26
|
+
import { AnalyticsConsent } from "../app/AnalyticsConsent.js";
|
|
27
|
+
import { AnalyticsService } from "../app/AnalyticsService.js";
|
|
27
28
|
import { ITypes } from "./inversify.types.js";
|
|
28
29
|
const container = ICoreContainer;
|
|
29
|
-
container.bind(ITypes.AnalyticsConsent).to(
|
|
30
|
-
container.bind(ITypes.AnalyticsService).to(
|
|
30
|
+
container.bind(ITypes.AnalyticsConsent).to(AnalyticsConsent).inSingletonScope();
|
|
31
|
+
container.bind(ITypes.AnalyticsService).to(AnalyticsService).inSingletonScope();
|
|
31
32
|
export { container as IContainer };
|
|
32
33
|
//# sourceMappingURL=inversify.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inversify.types.d.ts","sourceRoot":"","sources":["../../src/config/inversify.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"inversify.types.d.ts","sourceRoot":"","sources":["../../src/config/inversify.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,eAAO,MAAM,MAAM,EAAE;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAI5B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
24
|
export * from "./app/index.js";
|
|
25
|
+
export * from "./base/index.js";
|
|
25
26
|
export * from "./config/index.js";
|
|
26
27
|
export * from "./constants.js";
|
|
27
28
|
export * from "./models/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
********************************************************************************/
|
|
24
24
|
export * from "./app/index.js";
|
|
25
|
+
export * from "./base/index.js";
|
|
25
26
|
export * from "./config/index.js";
|
|
26
27
|
export * from "./constants.js";
|
|
27
28
|
export * from "./models/index.js";
|