@affinidi/cli 1.41.3 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +289 -142
- package/dist/commands/analytics.d.ts +4 -0
- package/dist/commands/analytics.js +19 -0
- package/dist/commands/analytics.js.map +1 -1
- package/dist/commands/config/index.d.ts +7 -0
- package/dist/commands/config/index.js +46 -0
- package/dist/commands/config/index.js.map +1 -1
- package/dist/commands/config/username.d.ts +18 -0
- package/dist/commands/config/username.js +91 -0
- package/dist/commands/config/username.js.map +1 -0
- package/dist/commands/config/view.js +1 -1
- package/dist/commands/config/view.js.map +1 -1
- package/dist/commands/login/index.js +20 -6
- package/dist/commands/login/index.js.map +1 -1
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +3 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/services/analytics/analytics.api.d.ts +1 -1
- package/dist/services/analytics/analytics.api.js.map +1 -1
- package/dist/services/config/index.d.ts +9 -0
- package/dist/services/config/index.js +55 -3
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/verification/verifier.api.d.ts +1 -1
- package/dist/services/verification/verifier.api.js +1 -1
- package/dist/user-actions/prompts.js +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import { ViewFormat } from '../constants';
|
|
3
|
+
import { CliError } from '../errors';
|
|
3
4
|
export declare const OPTIN_MESSAGE = "You have opted in to analytics";
|
|
4
5
|
export declare const OPTOUT_MESSAGE = "You have not opted in to analytics";
|
|
5
6
|
export default class Analytics extends Command {
|
|
6
7
|
static description: string;
|
|
8
|
+
static command: string;
|
|
9
|
+
static usage: string;
|
|
7
10
|
static examples: string[];
|
|
8
11
|
static args: {
|
|
9
12
|
name: string;
|
|
@@ -15,4 +18,5 @@ export default class Analytics extends Command {
|
|
|
15
18
|
output: import("@oclif/core/lib/interfaces").OptionFlag<ViewFormat>;
|
|
16
19
|
};
|
|
17
20
|
run(): Promise<void>;
|
|
21
|
+
catch(error: CliError): Promise<void>;
|
|
18
22
|
}
|
|
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const user_actions_1 = require("../user-actions");
|
|
6
6
|
const services_1 = require("../services");
|
|
7
7
|
const display_1 = require("../middleware/display");
|
|
8
|
+
const errors_1 = require("../errors");
|
|
8
9
|
exports.OPTIN_MESSAGE = 'You have opted in to analytics';
|
|
9
10
|
exports.OPTOUT_MESSAGE = 'You have not opted in to analytics';
|
|
10
11
|
class Analytics extends core_1.Command {
|
|
@@ -33,9 +34,27 @@ class Analytics extends core_1.Command {
|
|
|
33
34
|
flag: flags.output,
|
|
34
35
|
});
|
|
35
36
|
}
|
|
37
|
+
async catch(error) {
|
|
38
|
+
core_1.CliUx.ux.action.stop('failed');
|
|
39
|
+
const outputFormat = services_1.configService.getOutputFormat();
|
|
40
|
+
const optionsDisplay = {
|
|
41
|
+
itemToDisplay: (0, errors_1.getErrorOutput)(error, Analytics.command, Analytics.usage, Analytics.description, outputFormat !== 'plaintext'),
|
|
42
|
+
err: true,
|
|
43
|
+
};
|
|
44
|
+
try {
|
|
45
|
+
const { flags } = await this.parse(Analytics);
|
|
46
|
+
optionsDisplay.flag = flags.output;
|
|
47
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
48
|
+
}
|
|
49
|
+
catch (_) {
|
|
50
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
36
53
|
}
|
|
37
54
|
exports.default = Analytics;
|
|
38
55
|
Analytics.description = 'Opt-in or opt-out of analytics';
|
|
56
|
+
Analytics.command = 'affinidi analytics';
|
|
57
|
+
Analytics.usage = 'analytics [ true | false ]';
|
|
39
58
|
Analytics.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
40
59
|
Analytics.args = [
|
|
41
60
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/commands/analytics.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/commands/analytics.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AAEnD,kDAAwD;AACxD,0CAA6D;AAE7D,mDAAqE;AACrE,sCAAoD;AAEvC,QAAA,aAAa,GAAG,gCAAgC,CAAA;AAChD,QAAA,cAAc,GAAG,oCAAoC,CAAA;AAElE,MAAqB,SAAU,SAAQ,cAAO;IA0BrC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QACnD,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE;YACzB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAA;YAC7C,2BAAgB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;YAChD,IAAA,uBAAa,EAAC;gBACZ,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,qBAAa,CAAC,CAAC,CAAC,sBAAc;gBAC5D,IAAI,EAAE,KAAK,CAAC,MAAM;aACnB,CAAC,CAAA;YACF,OAAM;SACP;QAED,IAAI,2BAAgB,CAAC,eAAe,EAAE,EAAE;YACtC,IAAA,uBAAa,EAAC;gBACZ,aAAa,EAAE,2BAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,qBAAa,CAAC,CAAC,CAAC,sBAAc;gBACpF,IAAI,EAAE,KAAK,CAAC,MAAM;aACnB,CAAC,CAAA;YACF,OAAM;SACP;QAED,MAAM,YAAY,GAAG,MAAM,IAAA,qCAAsB,GAAE,CAAA;QACnD,2BAAgB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;QAChD,IAAA,uBAAa,EAAC;YACZ,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC,qBAAa,CAAC,CAAC,CAAC,sBAAc;YAC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"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Command, Interfaces } from '@oclif/core';
|
|
2
|
+
import { ViewFormat } from '../../constants';
|
|
3
|
+
import { CliError } from '../../errors';
|
|
2
4
|
export default class Config extends Command {
|
|
3
5
|
static command: string;
|
|
4
6
|
static summary: string;
|
|
5
7
|
static usage: string;
|
|
6
8
|
static description: string;
|
|
7
9
|
static examples: Interfaces.Example[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'unset-all': Interfaces.BooleanFlag<boolean>;
|
|
12
|
+
output: Interfaces.OptionFlag<ViewFormat>;
|
|
13
|
+
};
|
|
8
14
|
run(): Promise<void>;
|
|
15
|
+
catch(error: CliError): Promise<void>;
|
|
9
16
|
}
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const http_status_codes_1 = require("http-status-codes");
|
|
5
|
+
const services_1 = require("../../services");
|
|
4
6
|
const display_1 = require("../../middleware/display");
|
|
5
7
|
const texts_1 = require("../../render/texts");
|
|
8
|
+
const authentication_1 = require("../../middleware/authentication");
|
|
9
|
+
const errors_1 = require("../../errors");
|
|
6
10
|
class Config extends core_1.Command {
|
|
7
11
|
async run() {
|
|
12
|
+
const { flags } = await this.parse(Config);
|
|
13
|
+
if (!(0, authentication_1.isAuthenticated)()) {
|
|
14
|
+
throw new errors_1.CliError(errors_1.Unauthorized, http_status_codes_1.StatusCodes.UNAUTHORIZED, 'config');
|
|
15
|
+
}
|
|
16
|
+
const { 'unset-all': unsetAll, output } = flags;
|
|
17
|
+
if (unsetAll) {
|
|
18
|
+
services_1.configService.deleteUserConfig();
|
|
19
|
+
(0, display_1.displayOutput)({ itemToDisplay: 'Your configuration is unset', flag: output });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
8
22
|
(0, display_1.displayOutput)({
|
|
9
23
|
itemToDisplay: (0, texts_1.buildInvalidCommandUsage)(Config.command, Config.usage, Config.summary),
|
|
10
24
|
});
|
|
11
25
|
}
|
|
26
|
+
async catch(error) {
|
|
27
|
+
core_1.CliUx.ux.action.stop('failed');
|
|
28
|
+
const outputFormat = services_1.configService.getOutputFormat();
|
|
29
|
+
const optionsDisplay = {
|
|
30
|
+
itemToDisplay: (0, errors_1.getErrorOutput)(error, Config.command, Config.usage, Config.description, outputFormat !== 'plaintext'),
|
|
31
|
+
err: true,
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
const { flags } = await this.parse(Config);
|
|
35
|
+
optionsDisplay.flag = flags.output;
|
|
36
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
37
|
+
}
|
|
38
|
+
catch (_) {
|
|
39
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
12
42
|
}
|
|
13
43
|
exports.default = Config;
|
|
14
44
|
Config.command = 'affinidi config';
|
|
@@ -20,5 +50,21 @@ Config.examples = [
|
|
|
20
50
|
description: 'Configures output format view:',
|
|
21
51
|
command: '$ <%= config.bin %> <%= command.id %> view',
|
|
22
52
|
},
|
|
53
|
+
{
|
|
54
|
+
description: 'Persist username in config file, to login afterwards without providing your username:',
|
|
55
|
+
command: '$ <%= config.bin %> <%= command.id %> username',
|
|
56
|
+
},
|
|
23
57
|
];
|
|
58
|
+
Config.flags = {
|
|
59
|
+
'unset-all': core_1.Flags.boolean({
|
|
60
|
+
char: 'u',
|
|
61
|
+
description: 'remove username from config',
|
|
62
|
+
default: false,
|
|
63
|
+
}),
|
|
64
|
+
output: core_1.Flags.enum({
|
|
65
|
+
char: 'o',
|
|
66
|
+
description: 'set flag to override default output format view',
|
|
67
|
+
options: ['json', 'plaintext'],
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
24
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/config/index.ts"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AC7B;YACD,GAAG,EAAE,IAAI;SACV,CAAA;QACD,IAAI;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAC1C,cAAc,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAA;YAClC,IAAA,uBAAa,EAAC,cAAc,CAAC,CAAA;SAC9B;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,uBAAa,EAAC,cAAc,CAAC,CAAA;SAC9B;IACH,CAAC;;AAtEH,yBAuEC;AAtEQ,cAAO,GAAG,iBAAiB,CAAA;AAE3B,cAAO,GAAG,6DAA6D,CAAA;AAEvE,YAAK,GAAG,4BAA4B,CAAA;AAEpC,kBAAW,GAAG,gCAAwB,CAAA;AAEtC,eAAQ,GAAyB;IACtC;QACE,WAAW,EAAE,gCAAgC;QAC7C,OAAO,EAAE,4CAA4C;KACtD;IACD;QACE,WAAW,EACT,uFAAuF;QACzF,OAAO,EAAE,gDAAgD;KAC1D;CACF,CAAA;AAEM,YAAK,GAAG;IACb,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,KAAK;KACf,CAAC;IACF,MAAM,EAAE,YAAK,CAAC,IAAI,CAAa;QAC7B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;KAC/B,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { ViewFormat } from '../../constants';
|
|
3
|
+
import { CliError } from '../../errors';
|
|
4
|
+
export default class Username extends Command {
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static command: string;
|
|
8
|
+
static usage: string;
|
|
9
|
+
static flags: {
|
|
10
|
+
unset: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<ViewFormat>;
|
|
12
|
+
};
|
|
13
|
+
static args: {
|
|
14
|
+
name: string;
|
|
15
|
+
}[];
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
catch(error: CliError): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const EmailValidator = tslib_1.__importStar(require("email-validator"));
|
|
6
|
+
const http_status_codes_1 = require("http-status-codes");
|
|
7
|
+
const user_actions_1 = require("../../user-actions");
|
|
8
|
+
const errors_1 = require("../../errors");
|
|
9
|
+
const config_1 = require("../../services/config");
|
|
10
|
+
const display_1 = require("../../middleware/display");
|
|
11
|
+
const authentication_1 = require("../../middleware/authentication");
|
|
12
|
+
const user_management_1 = require("../../services/user-management");
|
|
13
|
+
const analytics_1 = require("../../services/analytics");
|
|
14
|
+
const MAX_EMAIL_ATTEMPT = 3;
|
|
15
|
+
class Username extends core_1.Command {
|
|
16
|
+
async run() {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const { args, flags } = await this.parse(Username);
|
|
19
|
+
if (!(0, authentication_1.isAuthenticated)()) {
|
|
20
|
+
throw new errors_1.CliError(errors_1.Unauthorized, http_status_codes_1.StatusCodes.UNAUTHORIZED, 'config');
|
|
21
|
+
}
|
|
22
|
+
const session = (0, user_management_1.getSession)();
|
|
23
|
+
const analyticsData = {
|
|
24
|
+
category: 'APPLICATION',
|
|
25
|
+
component: 'Cli',
|
|
26
|
+
uuid: (_a = session === null || session === void 0 ? void 0 : session.account) === null || _a === void 0 ? void 0 : _a.id,
|
|
27
|
+
metadata: {
|
|
28
|
+
commandId: 'affinidi.configUsername',
|
|
29
|
+
...(0, analytics_1.generateUserMetadata)((_b = session === null || session === void 0 ? void 0 : session.account) === null || _b === void 0 ? void 0 : _b.label),
|
|
30
|
+
},
|
|
31
|
+
name: 'CLI_CONFIG_USERNAME_SET',
|
|
32
|
+
};
|
|
33
|
+
if (flags.unset) {
|
|
34
|
+
analyticsData.name = 'CLI_CONFIG_USERNAME_UNSET';
|
|
35
|
+
config_1.configService.setUsername('');
|
|
36
|
+
(0, display_1.displayOutput)({ itemToDisplay: 'Your username is unset', flag: flags.output });
|
|
37
|
+
await analytics_1.analyticsService.eventsControllerSend(analyticsData);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let { email } = args;
|
|
41
|
+
if (!email) {
|
|
42
|
+
email = await (0, user_actions_1.enterEmailPrompt)();
|
|
43
|
+
}
|
|
44
|
+
let wrongEmailCount = 0;
|
|
45
|
+
while (!EmailValidator.validate(email)) {
|
|
46
|
+
email = await (0, user_actions_1.enterEmailPrompt)();
|
|
47
|
+
wrongEmailCount += 1;
|
|
48
|
+
if (wrongEmailCount === MAX_EMAIL_ATTEMPT) {
|
|
49
|
+
core_1.CliUx.ux.error(errors_1.WrongEmailError);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
config_1.configService.setUsername(email);
|
|
53
|
+
(0, display_1.displayOutput)({ itemToDisplay: 'Your username is set', flag: flags.output });
|
|
54
|
+
await analytics_1.analyticsService.eventsControllerSend(analyticsData);
|
|
55
|
+
}
|
|
56
|
+
async catch(error) {
|
|
57
|
+
core_1.CliUx.ux.action.stop('failed');
|
|
58
|
+
const outputFormat = config_1.configService.getOutputFormat();
|
|
59
|
+
const optionsDisplay = {
|
|
60
|
+
itemToDisplay: (0, errors_1.getErrorOutput)(error, Username.command, Username.usage, Username.description, outputFormat !== 'plaintext'),
|
|
61
|
+
err: true,
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
const { flags } = await this.parse(Username);
|
|
65
|
+
optionsDisplay.flag = flags.output;
|
|
66
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
67
|
+
}
|
|
68
|
+
catch (_) {
|
|
69
|
+
(0, display_1.displayOutput)(optionsDisplay);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.default = Username;
|
|
74
|
+
Username.description = 'This command sets the username. This username will be used when logging in the future if not one provided';
|
|
75
|
+
Username.examples = ['<%= config.bin %> <%= command.id %> example@email.com'];
|
|
76
|
+
Username.command = 'affinidi config username';
|
|
77
|
+
Username.usage = 'config username [email]';
|
|
78
|
+
Username.flags = {
|
|
79
|
+
unset: core_1.Flags.boolean({
|
|
80
|
+
char: 'u',
|
|
81
|
+
description: 'remove username from config',
|
|
82
|
+
default: false,
|
|
83
|
+
}),
|
|
84
|
+
output: core_1.Flags.enum({
|
|
85
|
+
char: 'o',
|
|
86
|
+
description: 'set flag to override default output format view',
|
|
87
|
+
options: ['json', 'plaintext'],
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
Username.args = [{ name: 'email' }];
|
|
91
|
+
//# sourceMappingURL=username.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"username.js","sourceRoot":"","sources":["../../../src/commands/config/username.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AACnD,wEAAiD;AACjD,yDAA+C;AAE/C,qDAAqD;AAErD,yCAAsF;AACtF,kDAAqD;AACrD,sDAAwE;AACxE,oEAAiE;AAEjE,oEAA2D;AAC3D,wDAAiF;AAEjF,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,MAAqB,QAAS,SAAQ,cAAO;IAyBpC,KAAK,CAAC,GAAG;;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAClD,IAAI,CAAC,IAAA,gCAAe,GAAE,EAAE;YACtB,MAAM,IAAI,iBAAQ,CAAC,qBAAY,EAAE,+BAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;SACrE;QACD,MAAM,OAAO,G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AC;CACH,CAAA;AAEM,aAAI,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA"}
|
|
@@ -14,7 +14,7 @@ class View extends core_1.Command {
|
|
|
14
14
|
const { args } = await this.parse(View);
|
|
15
15
|
const { format } = args;
|
|
16
16
|
if (!(0, authentication_1.isAuthenticated)()) {
|
|
17
|
-
throw new errors_1.CliError(errors_1.Unauthorized, http_status_codes_1.StatusCodes.UNAUTHORIZED, '
|
|
17
|
+
throw new errors_1.CliError(errors_1.Unauthorized, http_status_codes_1.StatusCodes.UNAUTHORIZED, 'config');
|
|
18
18
|
}
|
|
19
19
|
const session = (0, user_management_1.getSession)();
|
|
20
20
|
config_1.configService.setOutputFormat(format);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/commands/config/view.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,yDAA+C;AAE/C,kDAAqD;AACrD,yCAAqE;AACrE,oEAAiE;AACjE,sDAAwD;AAExD,wDAAiF;AACjF,oEAA2D;AAE3D,MAAqB,IAAK,SAAQ,cAAO;IAqBhC,KAAK,CAAC,GAAG;;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QACvB,IAAI,CAAC,IAAA,gCAAe,GAAE,EAAE;YACtB,MAAM,IAAI,iBAAQ,CAAC,qBAAY,EAAE,+BAAW,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/commands/config/view.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,yDAA+C;AAE/C,kDAAqD;AACrD,yCAAqE;AACrE,oEAAiE;AACjE,sDAAwD;AAExD,wDAAiF;AACjF,oEAA2D;AAE3D,MAAqB,IAAK,SAAQ,cAAO;IAqBhC,KAAK,CAAC,GAA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,EAAE,IAAI;SACV,CAAC,CAAA;IACJ,CAAC;;AA3DH,uBA4DC;AA3DQ,YAAO,GAAG,sBAAsB,CAAA;AAEhC,gBAAW,GAAG,oDAAoD,CAAA;AAElE,aAAQ,GAAG;IAChB,0CAA0C;IAC1C,+CAA+C;CAChD,CAAA;AAEM,UAAK,GAAG,gCAAgC,CAAA;AAExC,SAAI,GAAG;IACZ;QACE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;QAC9B,WAAW,EAAE,sBAAsB;KACpC;CACF,CAAA"}
|
|
@@ -18,26 +18,40 @@ class Login extends core_1.Command {
|
|
|
18
18
|
async run() {
|
|
19
19
|
var _a;
|
|
20
20
|
const { failures } = await this.config.runHook('check', { id: checkVersion_1.CHECK_OPERATION.CONFIG });
|
|
21
|
+
const { args, flags } = await this.parse(Login);
|
|
21
22
|
if (failures.length) {
|
|
22
23
|
const failure = failures.shift();
|
|
23
24
|
const { error } = failure;
|
|
24
|
-
|
|
25
|
+
throw new Error(error.message);
|
|
25
26
|
}
|
|
26
|
-
const { args, flags } = await this.parse(Login);
|
|
27
27
|
let { email } = args;
|
|
28
|
-
if (!email) {
|
|
28
|
+
if (!email && !config_1.configService.getUsername()) {
|
|
29
|
+
(0, display_1.displayOutput)({
|
|
30
|
+
itemToDisplay: `Now you can save your username using "affinidi configure username" command, so you don't have to enter your username each time you log-in`,
|
|
31
|
+
flag: flags.output,
|
|
32
|
+
});
|
|
29
33
|
email = await (0, user_actions_1.enterEmailPrompt)();
|
|
30
34
|
}
|
|
35
|
+
if (!email) {
|
|
36
|
+
try {
|
|
37
|
+
email = config_1.configService.getUsername();
|
|
38
|
+
}
|
|
39
|
+
catch (_) {
|
|
40
|
+
(0, display_1.displayOutput)({
|
|
41
|
+
itemToDisplay: `Config file doesn't exist, after logging in there will be one created and you can then use the configured username feature`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
let wrongEmailCount = 0;
|
|
32
46
|
while (!EmailValidator.validate(email)) {
|
|
33
47
|
email = await (0, user_actions_1.enterEmailPrompt)();
|
|
34
48
|
wrongEmailCount += 1;
|
|
35
49
|
if (wrongEmailCount === MAX_EMAIL_ATTEMPT) {
|
|
36
|
-
|
|
50
|
+
throw new Error(errors_1.WrongEmailError);
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
// http request to affinidi sign-up endpoint
|
|
40
|
-
core_1.CliUx.ux.action.start('Start
|
|
54
|
+
core_1.CliUx.ux.action.start('Start logging in to Affinidi');
|
|
41
55
|
const token = await services_1.userManagementService.login(email);
|
|
42
56
|
// mask input after enter is pressed
|
|
43
57
|
const confirmationCode = await (0, user_actions_1.enterOTPPrompt)();
|
|
@@ -48,7 +62,7 @@ class Login extends core_1.Command {
|
|
|
48
62
|
// Get userId from cookie. Slice removes `console_authtoken=` prefix.
|
|
49
63
|
const { userId } = (0, user_management_1.parseJwt)(sessionToken.slice('console_authtoken='.length));
|
|
50
64
|
(0, user_management_1.createSession)(email, userId, sessionToken);
|
|
51
|
-
if (config_1.configService.show().version === null) {
|
|
65
|
+
if (config_1.configService.show().version === null || !config_1.configService.show().configs[userId]) {
|
|
52
66
|
const wantsToOptIn = await (0, user_actions_1.analyticsConsentPrompt)();
|
|
53
67
|
(0, user_management_1.createConfig)({ userId, analyticsOptIn: wantsToOptIn });
|
|
54
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/login/index.ts"],"names":[],"mappings":";;;AAAA,sCAAmD;AACnD,wEAAiD;AAEjD,qEAAuC;AACvC,wDAAiF;AACjF,sDAA4D;AAC5D,6CAAkE;AAClE,qDAA6F;AAC7F,yCAAwE;AACxE,oEAAsF;AAEtF,sDAAwE;AAExE,kDAAqD;AACrD,iEAAgE;AAEhE,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,MAAqB,KAAM,S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;AArIH,wBAsIC;AArIQ,aAAO,GAAG,gBAAgB,CAAA;AAE1B,WAAK,GAAG,eAAe,CAAA;AAEvB,iBAAW,GAChB,qFAAqF,CAAA;AAEhF,cAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAElD,UAAI,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;AAE1B,WAAK,GAAG;IACb,MAAM,EAAE,YAAK,CAAC,IAAI,CAAa;QAC7B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;KAC/B,CAAC;CACH,CAAA"}
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export declare const notFoundSchema = "Please provide an existing schema ID.";
|
|
|
20
20
|
export declare const InvalidSchemaName = "Please, enter a schema name using only alpha numeric characters";
|
|
21
21
|
export declare const NotSupportedPlatform = "This platform is not supported.";
|
|
22
22
|
export declare const InvalidUseCase = "Invalid use-case";
|
|
23
|
-
export declare const NoUserConfigFound = "No user configurations were found";
|
|
23
|
+
export declare const NoUserConfigFound = "No user configurations were found, to create a configuration please log-in again.";
|
|
24
|
+
export declare const NoConfigFile = "The config file doesn't exist, please log-in again";
|
|
24
25
|
export declare const UnsuportedConfig = "Unsuported configuration version";
|
|
25
26
|
export declare const UnsuportedCredential = "Unsuported credential version";
|
|
26
27
|
export declare class CliError extends Error {
|
package/dist/errors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getErrorOutput = exports.errorToJSON = exports.CliError = exports.UnsuportedCredential = exports.UnsuportedConfig = exports.NoUserConfigFound = exports.InvalidUseCase = exports.NotSupportedPlatform = exports.InvalidSchemaName = exports.notFoundSchema = exports.schemaBadrequest = exports.verifierBadRequest = exports.Conflict = exports.NotFound = exports.NotFoundEmail = exports.JsonFileSyntaxError = exports.WrongSchemaFileType = exports.WrongFileType = exports.issuanceBadRequest = exports.NoSuchFileOrDir = exports.EmptyIssueDataFlag = exports.CouldNotParseSchema = exports.notFoundProject = exports.Unauthorized = exports.SignoutError = exports.InvalidOrExpiredOTPError = exports.ServiceDownError = exports.WrongEmailError = void 0;
|
|
3
|
+
exports.getErrorOutput = exports.errorToJSON = exports.CliError = exports.UnsuportedCredential = exports.UnsuportedConfig = exports.NoConfigFile = exports.NoUserConfigFound = exports.InvalidUseCase = exports.NotSupportedPlatform = exports.InvalidSchemaName = exports.notFoundSchema = exports.schemaBadrequest = exports.verifierBadRequest = exports.Conflict = exports.NotFound = exports.NotFoundEmail = exports.JsonFileSyntaxError = exports.WrongSchemaFileType = exports.WrongFileType = exports.issuanceBadRequest = exports.NoSuchFileOrDir = exports.EmptyIssueDataFlag = exports.CouldNotParseSchema = exports.notFoundProject = exports.Unauthorized = exports.SignoutError = exports.InvalidOrExpiredOTPError = exports.ServiceDownError = exports.WrongEmailError = void 0;
|
|
4
4
|
const http_status_codes_1 = require("http-status-codes");
|
|
5
5
|
const texts_1 = require("../render/texts");
|
|
6
6
|
const pleaseTryAgain = 'Please try again later.';
|
|
@@ -27,7 +27,8 @@ exports.notFoundSchema = 'Please provide an existing schema ID.';
|
|
|
27
27
|
exports.InvalidSchemaName = 'Please, enter a schema name using only alpha numeric characters';
|
|
28
28
|
exports.NotSupportedPlatform = 'This platform is not supported.';
|
|
29
29
|
exports.InvalidUseCase = 'Invalid use-case';
|
|
30
|
-
exports.NoUserConfigFound = 'No user configurations were found';
|
|
30
|
+
exports.NoUserConfigFound = 'No user configurations were found, to create a configuration please log-in again.';
|
|
31
|
+
exports.NoConfigFile = "The config file doesn't exist, please log-in again";
|
|
31
32
|
exports.UnsuportedConfig = 'Unsuported configuration version';
|
|
32
33
|
exports.UnsuportedCredential = 'Unsuported credential version';
|
|
33
34
|
class CliError extends Error {
|
package/dist/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+C;AAC/C,2CAA0D;AAE1D,MAAM,cAAc,GAAG,yBAAyB,CAAA;AAChD,MAAM,kBAAkB,GAAG,yBAAyB,cAAc,EAAE,CAAA;AAEvD,QAAA,eAAe,GAAG,+BAA+B,CAAA;AACjD,QAAA,gBAAgB,GAAG,kBAAkB,CAAA;AACrC,QAAA,wBAAwB,GAAG,4DAA4D,CAAA;AACvF,QAAA,YAAY,GAAG,gDAAgD,cAAc,EAAE,CAAA;AAC/E,QAAA,YAAY,GACvB,sHAAsH,CAAA;AAC3G,QAAA,eAAe,GAAG,8DAA8D,CAAA;AAEhF,QAAA,mBAAmB,GAAG,+DAA+D,CAAA;AACrF,QAAA,kBAAkB,GAAG,0CAA0C,CAAA;AAC/D,QAAA,eAAe,GAAG,oDAAoD,CAAA;AACtE,QAAA,kBAAkB,GAC7B,sFAAsF,CAAA;AAC3E,QAAA,aAAa,GAAG,yBAAyB,CAAA;AACzC,QAAA,mBAAmB,GAC9B,yEAAyE,CAAA;AAC9D,QAAA,mBAAmB,GAAG,iDAAiD,CAAA;AACvE,QAAA,aAAa,GACxB,4FAA4F,CAAA;AACjF,QAAA,QAAQ,GACnB,4FAA4F,CAAA;AACjF,QAAA,QAAQ,GAAG,uEAAuE,CAAA;AAClF,QAAA,kBAAkB,GAAG,wCAAwC,CAAA;AAC7D,QAAA,gBAAgB,GAAG,gEAAgE,CAAA;AACnF,QAAA,cAAc,GAAG,uCAAuC,CAAA;AACxD,QAAA,iBAAiB,GAAG,iEAAiE,CAAA;AACrF,QAAA,oBAAoB,GAAG,iCAAiC,CAAA;AACxD,QAAA,cAAc,GAAG,kBAAkB,CAAA;AACnC,QAAA,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+C;AAC/C,2CAA0D;A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A,mBAAW,EAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA;KAChD;IACD,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC,CAAA;AApBY,QAAA,cAAc,kBAoB1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface EventDTO {
|
|
2
2
|
/** @example Did Created */
|
|
3
|
-
name: 'Did Created' | 'Did Updated' | 'Did Resolved' | 'VC Verified' | 'VC Verified per party' | 'VC Saved' | 'VC Signed' | 'VC Revoked' | 'VC Issue Initiated' | 'VC Validated' | 'VC offer response verified' | 'VC share response verified' | 'Shared Message Created' | 'VP Signed' | 'VP Verified' | 'VP Signed JWT' | 'VP Verified JWT' | 'User Onboarded' | 'JWT Validated' | 'API called from affinidi common backend' | ' Create DID auth response token through cloud wallet' | 'Verify DID auth response token' | 'Make VC revocable' | 'Create credential offer response token' | 'Streaming service put record' | 'Get Credential Offer' | 'Create Did Auth Request' | 'Get credentials' | 'Search credentials' | 'Delete credentials' | 'Get Revocation List Credential' | 'Publish Revocation List Credential' | 'Build Revocation List Status' | 'Create Message Template' | 'Delete Message Template' | 'Get Signed Credentials' | 'Read User Key' | 'Store User Key' | 'Confirm User' | 'Delete User' | 'SIGN_JWT' | 'USER_SIGN_UP' | 'GET_USER_DID' | 'USER_CONFIRM_SIGN_UP' | 'USER_LOGIN' | 'USER_PASSWORDLESS_LOGIN' | 'USER_PASSWORDLESS_LOGIN_CONFIRM' | 'USER_LOGOUT' | 'USER_FORGOT_PASSWORD' | 'USER_FORGOT_PASSWORD_CONFIRM' | 'USER_CHANGE_USERNAME' | 'USER_CHANGE_USERNAME_CONFIRM' | 'USER_CHANGE_PASSWORD' | 'USER_SIGN_IN' | 'USER_SIGN_IN_CONFIRM' | 'GET_SHARED_CREDENTIAL' | 'GET_CREDENTIALS' | 'GET_CREDENTIAL' | 'SHARE_CREDENTIAL' | 'SAVE_CREDENTIALS' | 'DELETE_CREDENTIAL' | 'SIGN_CREDENTIAL' | 'SIGN_PRESENTATION' | 'CREATE_CRED_SHARE_REQUEST_TOKEN' | 'CREATE_CREDENTIAL_SHARE_RESPONSE_TOKEN' | 'BLOOM_VAULT_READ' | 'BLOOM_VAULT_WRITE' | 'BULK_VC_ISSUED' | 'CONSOLE_USER_SIGN_UP' | 'CONSOLE_USER_SIGN_IN' | 'CONSOLE_USER_SIGN_OUT' | 'CONSOLE_PROJECT_CREATED' | 'CONSOLE_PROJECT_READ' | 'CONSOLE_PROJECT_SET_ACTIVE' | 'CONSOLE_PROJECTS_READ' | 'CONSOLE_API_KEY_CREATED' | 'VC_SCHEMA_CREATED' | 'VC_SCHEMAS_SEARCHED' | 'VC_SCHEMAS_READ' | 'CREATE_SHARED_MESSAGE' | 'INDEX_MY_SHARED_MESSAGE' | 'READ_SHARED_MESSAGE' | 'PULL_MY_MESSAGES' | 'SEND_MESSAGE' | 'DELETE_MY_MESSAGE' | 'CLAIM_CREDENTIALS' | 'RULES_SET_INVOKED' | 'RULES_ACCOUNT_CREATED' | 'RULES_ACCOUNT_UPDATED' | 'RULES_ACCOUNT_DELETED' | 'RULES_SET_CREATED' | 'RULES_SET_PUBLISHED' | 'RULES_SET_UNPUBLISHED' | 'RULE_CREATED' | 'RULE_UPDATED' | 'COMMAND_EXECUTED' | 'SNIPPET_INSERTED' | 'EXTENSION_INITIALIZED' | 'APPLICATION_GENERATION_STARTED' | 'APPLICATION_GENERATION_COMPLETED' | 'CLI_VIEW_FORMAT_CONFIGURED';
|
|
3
|
+
name: 'Did Created' | 'Did Updated' | 'Did Resolved' | 'VC Verified' | 'VC Verified per party' | 'VC Saved' | 'VC Signed' | 'VC Revoked' | 'VC Issue Initiated' | 'VC Validated' | 'VC offer response verified' | 'VC share response verified' | 'Shared Message Created' | 'VP Signed' | 'VP Verified' | 'VP Signed JWT' | 'VP Verified JWT' | 'User Onboarded' | 'JWT Validated' | 'API called from affinidi common backend' | ' Create DID auth response token through cloud wallet' | 'Verify DID auth response token' | 'Make VC revocable' | 'Create credential offer response token' | 'Streaming service put record' | 'Get Credential Offer' | 'Create Did Auth Request' | 'Get credentials' | 'Search credentials' | 'Delete credentials' | 'Get Revocation List Credential' | 'Publish Revocation List Credential' | 'Build Revocation List Status' | 'Create Message Template' | 'Delete Message Template' | 'Get Signed Credentials' | 'Read User Key' | 'Store User Key' | 'Confirm User' | 'Delete User' | 'SIGN_JWT' | 'USER_SIGN_UP' | 'GET_USER_DID' | 'USER_CONFIRM_SIGN_UP' | 'USER_LOGIN' | 'USER_PASSWORDLESS_LOGIN' | 'USER_PASSWORDLESS_LOGIN_CONFIRM' | 'USER_LOGOUT' | 'USER_FORGOT_PASSWORD' | 'USER_FORGOT_PASSWORD_CONFIRM' | 'USER_CHANGE_USERNAME' | 'USER_CHANGE_USERNAME_CONFIRM' | 'USER_CHANGE_PASSWORD' | 'USER_SIGN_IN' | 'USER_SIGN_IN_CONFIRM' | 'GET_SHARED_CREDENTIAL' | 'GET_CREDENTIALS' | 'GET_CREDENTIAL' | 'SHARE_CREDENTIAL' | 'SAVE_CREDENTIALS' | 'DELETE_CREDENTIAL' | 'SIGN_CREDENTIAL' | 'SIGN_PRESENTATION' | 'CREATE_CRED_SHARE_REQUEST_TOKEN' | 'CREATE_CREDENTIAL_SHARE_RESPONSE_TOKEN' | 'BLOOM_VAULT_READ' | 'BLOOM_VAULT_WRITE' | 'BULK_VC_ISSUED' | 'CONSOLE_USER_SIGN_UP' | 'CONSOLE_USER_SIGN_IN' | 'CONSOLE_USER_SIGN_OUT' | 'CONSOLE_PROJECT_CREATED' | 'CONSOLE_PROJECT_READ' | 'CONSOLE_PROJECT_SET_ACTIVE' | 'CONSOLE_PROJECTS_READ' | 'CONSOLE_API_KEY_CREATED' | 'VC_SCHEMA_CREATED' | 'VC_SCHEMAS_SEARCHED' | 'VC_SCHEMAS_READ' | 'CREATE_SHARED_MESSAGE' | 'INDEX_MY_SHARED_MESSAGE' | 'READ_SHARED_MESSAGE' | 'PULL_MY_MESSAGES' | 'SEND_MESSAGE' | 'DELETE_MY_MESSAGE' | 'CLAIM_CREDENTIALS' | 'RULES_SET_INVOKED' | 'RULES_ACCOUNT_CREATED' | 'RULES_ACCOUNT_UPDATED' | 'RULES_ACCOUNT_DELETED' | 'RULES_SET_CREATED' | 'RULES_SET_PUBLISHED' | 'RULES_SET_UNPUBLISHED' | 'RULE_CREATED' | 'RULE_UPDATED' | 'COMMAND_EXECUTED' | 'SNIPPET_INSERTED' | 'EXTENSION_INITIALIZED' | 'APPLICATION_GENERATION_STARTED' | 'APPLICATION_GENERATION_COMPLETED' | 'CLI_VIEW_FORMAT_CONFIGURED' | 'CLI_CONFIG_USERNAME_SET' | 'CLI_CONFIG_USERNAME_UNSET';
|
|
4
4
|
/** @example APPLICATION */
|
|
5
5
|
category: 'DID' | 'VC' | 'VP' | 'APPLICATION' | 'JWT';
|
|
6
6
|
subCategory?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.api.js","sourceRoot":"","sources":["../../../src/services/analytics/analytics.api.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;GAOG;;;;
|
|
1
|
+
{"version":3,"file":"analytics.api.js","sourceRoot":"","sources":["../../../src/services/analytics/analytics.api.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;GAOG;;;;AAmKH,0DAMc;AA+Bd,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,+CAAgC,CAAA;IAChC,+DAAgD,CAAA;AAClD,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,MAAa,UAAU;IAOrB,YAAY,EACV,cAAc,EACd,MAAM,EACN,MAAM,EACN,GAAG,WAAW,KACiB,EAAE;QAV3B,iBAAY,GAA4B,IAAI,CAAA;QAiB7C,oBAAe,GAAG,CAAC,IAA6B,EAAE,EAAE;YACzD,IAAI,CAAC,YAAY,GAAG,IAAI,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|
11
12
|
currentUserID: string;
|
|
12
13
|
configs: Record<UserId, UserConfig>;
|
|
@@ -15,11 +16,14 @@ interface IConfigStorer {
|
|
|
15
16
|
save(params: ConfigStoreFormat): void;
|
|
16
17
|
clear(): void;
|
|
17
18
|
setOutputFormat(outputFormat: string): void;
|
|
19
|
+
getUsername: () => string;
|
|
18
20
|
getVersion: () => number;
|
|
19
21
|
getCurrentUser: () => string;
|
|
20
22
|
getAllUserConfigs: () => Record<UserId, UserConfig>;
|
|
21
23
|
getOutputFormat: () => string;
|
|
22
24
|
setCurrentProjectId: (id: string) => void;
|
|
25
|
+
setUsername: (username: string) => void;
|
|
26
|
+
deleteUserConfig: () => void;
|
|
23
27
|
}
|
|
24
28
|
declare class ConfigService {
|
|
25
29
|
private readonly store;
|
|
@@ -27,14 +31,19 @@ declare class ConfigService {
|
|
|
27
31
|
clear: () => void;
|
|
28
32
|
getVersion: () => number;
|
|
29
33
|
show: () => ConfigStoreFormat;
|
|
34
|
+
private readonly userConfigMustExist;
|
|
35
|
+
private readonly configFileMustExist;
|
|
30
36
|
getCurrentUser: () => string;
|
|
31
37
|
getOutputFormat: () => string;
|
|
38
|
+
getUsername: () => string;
|
|
32
39
|
create: (userId: string, activeProjectId?: string, analyticsOptIn?: boolean | undefined) => void;
|
|
33
40
|
setOutputFormat: (format: string) => void;
|
|
34
41
|
currentUserConfig: () => UserConfig;
|
|
35
42
|
hasAnalyticsOptIn: () => boolean;
|
|
36
43
|
optInOrOut: (inOrOut: boolean) => void;
|
|
37
44
|
setCurrentProjectId: (id: string) => void;
|
|
45
|
+
setUsername: (username: string) => void;
|
|
46
|
+
deleteUserConfig: () => void;
|
|
38
47
|
}
|
|
39
48
|
export declare const testStore: Map<any, any>;
|
|
40
49
|
export declare const configService: ConfigService;
|
|
@@ -24,7 +24,22 @@ class ConfigService {
|
|
|
24
24
|
const currentUserID = this.getCurrentUser();
|
|
25
25
|
const configVersion = this.store.getVersion();
|
|
26
26
|
const configs = this.store.getAllUserConfigs();
|
|
27
|
-
|
|
27
|
+
const username = this.store.getUsername();
|
|
28
|
+
return { version: configVersion, currentUserID, configs, username };
|
|
29
|
+
};
|
|
30
|
+
this.userConfigMustExist = () => {
|
|
31
|
+
this.configFileMustExist();
|
|
32
|
+
const userId = this.getCurrentUser();
|
|
33
|
+
const configs = this.store.getAllUserConfigs();
|
|
34
|
+
if (!(userId in configs)) {
|
|
35
|
+
throw new Error(errors_1.NoUserConfigFound);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.configFileMustExist = () => {
|
|
39
|
+
const versionConf = this.store.getVersion();
|
|
40
|
+
if (versionConf === null) {
|
|
41
|
+
throw new Error(errors_1.NoConfigFile);
|
|
42
|
+
}
|
|
28
43
|
};
|
|
29
44
|
this.getCurrentUser = () => {
|
|
30
45
|
return this.store.getCurrentUser();
|
|
@@ -32,10 +47,14 @@ class ConfigService {
|
|
|
32
47
|
this.getOutputFormat = () => {
|
|
33
48
|
return this.store.getOutputFormat();
|
|
34
49
|
};
|
|
50
|
+
this.getUsername = () => {
|
|
51
|
+
return this.store.getUsername();
|
|
52
|
+
};
|
|
35
53
|
this.create = (userId, activeProjectId = '', analyticsOptIn = undefined) => {
|
|
36
54
|
this.store.save({
|
|
37
55
|
currentUserID: userId,
|
|
38
56
|
version: (0, exports.getMajorVersion)(),
|
|
57
|
+
username: '',
|
|
39
58
|
configs: {
|
|
40
59
|
[userId]: {
|
|
41
60
|
activeProjectId,
|
|
@@ -46,6 +65,7 @@ class ConfigService {
|
|
|
46
65
|
});
|
|
47
66
|
};
|
|
48
67
|
this.setOutputFormat = (format) => {
|
|
68
|
+
this.userConfigMustExist();
|
|
49
69
|
this.store.setOutputFormat(format);
|
|
50
70
|
};
|
|
51
71
|
this.currentUserConfig = () => {
|
|
@@ -66,6 +86,7 @@ class ConfigService {
|
|
|
66
86
|
}
|
|
67
87
|
};
|
|
68
88
|
this.optInOrOut = (inOrOut) => {
|
|
89
|
+
this.userConfigMustExist();
|
|
69
90
|
const userConfig = this.currentUserConfig();
|
|
70
91
|
userConfig.analyticsOptIn = inOrOut;
|
|
71
92
|
const all = this.show();
|
|
@@ -77,8 +98,16 @@ class ConfigService {
|
|
|
77
98
|
this.store.save(updateConfigFile);
|
|
78
99
|
};
|
|
79
100
|
this.setCurrentProjectId = (id) => {
|
|
101
|
+
this.userConfigMustExist();
|
|
80
102
|
this.store.setCurrentProjectId(id);
|
|
81
103
|
};
|
|
104
|
+
this.setUsername = (username) => {
|
|
105
|
+
this.userConfigMustExist();
|
|
106
|
+
this.store.setUsername(username);
|
|
107
|
+
};
|
|
108
|
+
this.deleteUserConfig = () => {
|
|
109
|
+
this.store.deleteUserConfig();
|
|
110
|
+
};
|
|
82
111
|
this.store = store;
|
|
83
112
|
}
|
|
84
113
|
}
|
|
@@ -101,8 +130,7 @@ const store = {
|
|
|
101
130
|
return Number.isNaN(v) ? null : v;
|
|
102
131
|
},
|
|
103
132
|
getCurrentUser: function getCurrentUser() {
|
|
104
|
-
|
|
105
|
-
return value;
|
|
133
|
+
return configConf.get('currentUserID');
|
|
106
134
|
},
|
|
107
135
|
getAllUserConfigs: () => {
|
|
108
136
|
return configConf.get('configs');
|
|
@@ -130,6 +158,18 @@ const store = {
|
|
|
130
158
|
configs[userId] = newUserConfig;
|
|
131
159
|
configConf.set('configs', configs);
|
|
132
160
|
},
|
|
161
|
+
getUsername: function getUsername() {
|
|
162
|
+
return configConf.get('username');
|
|
163
|
+
},
|
|
164
|
+
setUsername: function setUsername(username) {
|
|
165
|
+
configConf.set('username', username);
|
|
166
|
+
},
|
|
167
|
+
deleteUserConfig: function deleteUserConfig() {
|
|
168
|
+
const userId = this.getCurrentUser();
|
|
169
|
+
const configs = configConf.get('configs');
|
|
170
|
+
delete configs[userId];
|
|
171
|
+
configConf.set('configs', configs);
|
|
172
|
+
},
|
|
133
173
|
};
|
|
134
174
|
exports.testStore = new Map();
|
|
135
175
|
const testStorer = {
|
|
@@ -173,6 +213,18 @@ const testStorer = {
|
|
|
173
213
|
configs[userId] = newUserConfig;
|
|
174
214
|
exports.testStore.set('configs', configs);
|
|
175
215
|
},
|
|
216
|
+
getUsername: function getUsername() {
|
|
217
|
+
return exports.testStore.get('username');
|
|
218
|
+
},
|
|
219
|
+
setUsername: function setUsername(username) {
|
|
220
|
+
exports.testStore.set('username', username);
|
|
221
|
+
},
|
|
222
|
+
deleteUserConfig: function deleteUserConfig() {
|
|
223
|
+
const configs = exports.testStore.get('configs');
|
|
224
|
+
const userId = this.getCurrentUser();
|
|
225
|
+
delete configs[userId];
|
|
226
|
+
exports.testStore.set('configs', configs);
|
|
227
|
+
},
|
|
176
228
|
};
|
|
177
229
|
exports.configService = new ConfigService(process.env.NODE_ENV === 'test' ? testStorer : store);
|
|
178
230
|
//# sourceMappingURL=index.js.map
|