occam-open-cli 4.0.68 → 5.0.3
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 +7 -17
- package/bin/action/clone.js +15 -24
- package/bin/action/createAccount.js +41 -0
- package/bin/action/deprecate.js +13 -14
- package/bin/action/help.js +4 -14
- package/bin/action/initialise.js +12 -2
- package/bin/action/install.js +6 -6
- package/bin/action/publish.js +12 -11
- package/bin/action/resetPassword.js +11 -13
- package/bin/action/setOptions.js +10 -26
- package/bin/action/signIn.js +37 -0
- package/bin/action/signOut.js +16 -0
- package/bin/actions.js +11 -26
- package/bin/commands.js +8 -18
- package/bin/configuration/version_1_5.js +1 -22
- package/bin/configuration/version_2_0.js +1 -16
- package/bin/configuration/version_5_0.js +42 -0
- package/bin/configuration.js +26 -21
- package/bin/constants.js +2 -0
- package/bin/defaults.js +3 -3
- package/bin/descriptions.js +2 -8
- package/bin/messages.js +24 -50
- package/bin/operation/checkMetaJSONFileExists.js +0 -4
- package/bin/operation/checkReadmeFileExists.js +0 -4
- package/bin/{cloneRepository.js → operation/clone.js} +12 -8
- package/bin/operation/createAccount.js +33 -0
- package/bin/operation/createRelease.js +1 -4
- package/bin/operation/deflateRelease.js +1 -1
- package/bin/operation/deprecate.js +23 -0
- package/bin/operation/getIdentityToken.js +21 -0
- package/bin/operation/prompt/areYouSure.js +5 -5
- package/bin/operation/prompt/emailAddressOrUsername.js +53 -0
- package/bin/operation/prompt/useSSH.js +4 -4
- package/bin/operation/publish.js +24 -0
- package/bin/operation/repository.js +29 -0
- package/bin/operation/resetPassword.js +19 -0
- package/bin/operation/setIdentityToken.js +13 -0
- package/bin/operation/setOptions.js +25 -0
- package/bin/operation/signIn.js +32 -0
- package/bin/post.js +16 -49
- package/bin/uris.js +5 -15
- package/bin/utilities/validate.js +21 -4
- package/bin/versions.js +4 -2
- package/package.json +3 -3
- package/bin/action/changeEmailAddress.js +0 -38
- package/bin/action/changePassword.js +0 -42
- package/bin/action/confirmEmailAddress.js +0 -36
- package/bin/action/login.js +0 -41
- package/bin/action/logout.js +0 -26
- package/bin/action/register.js +0 -40
- package/bin/action/remove.js +0 -9
- package/bin/action/resendConfirmationCode.js +0 -32
- package/bin/action.js +0 -19
- package/bin/configuration/unversioned.js +0 -24
- package/bin/operation/prompt/confirmNewPassword.js +0 -42
- package/bin/operation/prompt/confirmationCode.js +0 -41
- package/bin/operation/prompt/newEmailAddress.js +0 -41
- package/bin/operation/prompt/newPassword.js +0 -41
- package/bin/operation/retrieveAccessToken.js +0 -24
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const post = require("../post");
|
|
4
|
+
|
|
5
|
+
const { CLONE_API_URI } = require("../uris");
|
|
6
|
+
|
|
7
|
+
function repositoryOperation(proceed, abort, context) {
|
|
8
|
+
const { releaseName } = context,
|
|
9
|
+
uri = `${CLONE_API_URI}/${releaseName}`,
|
|
10
|
+
json = {};
|
|
11
|
+
|
|
12
|
+
post(uri, json, (json) => {
|
|
13
|
+
const { repository = null } = json;
|
|
14
|
+
|
|
15
|
+
if (repository === null) {
|
|
16
|
+
abort();
|
|
17
|
+
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Object.assign(context, {
|
|
22
|
+
repository
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
proceed();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = repositoryOperation;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const post = require("../post");
|
|
4
|
+
|
|
5
|
+
const { RESET_PASSWORD_API_URI } = require("../uris");
|
|
6
|
+
|
|
7
|
+
function resetPasswordOperation(proceed, abort, context) {
|
|
8
|
+
const { emailAddress } = context,
|
|
9
|
+
uri = RESET_PASSWORD_API_URI,
|
|
10
|
+
json = {
|
|
11
|
+
emailAddress
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
post(uri, json, (json) => {
|
|
15
|
+
proceed();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = resetPasswordOperation;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { setIdentityToken } = require("../configuration");
|
|
4
|
+
|
|
5
|
+
function setIdentityTokenOperation(proceed, abort, context) {
|
|
6
|
+
const { identityToken } = context;
|
|
7
|
+
|
|
8
|
+
setIdentityToken(identityToken);
|
|
9
|
+
|
|
10
|
+
proceed();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = setIdentityTokenOperation;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { setOptions } = require("../configuration");
|
|
4
|
+
|
|
5
|
+
function setOptionsOperation(proceed, abort, context) {
|
|
6
|
+
const { useSSH } = context,
|
|
7
|
+
options = {};
|
|
8
|
+
|
|
9
|
+
if (useSSH) {
|
|
10
|
+
const { gitHubHostName } = context,
|
|
11
|
+
ssh = {
|
|
12
|
+
gitHubHostName
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Object.assign(options, {
|
|
16
|
+
ssh
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setOptions(options);
|
|
21
|
+
|
|
22
|
+
proceed();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = setOptionsOperation;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const post = require("../post");
|
|
4
|
+
|
|
5
|
+
const { SIGN_IN_API_URI } = require("../uris");
|
|
6
|
+
|
|
7
|
+
function signInOperation(proceed, abort, context) {
|
|
8
|
+
const { emailAddressOrUsername, password } = context,
|
|
9
|
+
uri = SIGN_IN_API_URI,
|
|
10
|
+
json = {
|
|
11
|
+
emailAddressOrUsername,
|
|
12
|
+
password
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
post(uri, json, (json) => {
|
|
16
|
+
const { identityToken = null } = json;
|
|
17
|
+
|
|
18
|
+
if (identityToken === null) {
|
|
19
|
+
abort();
|
|
20
|
+
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Object.assign(context, {
|
|
25
|
+
identityToken
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
proceed();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = signInOperation;
|
package/bin/post.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const os = require("os");
|
|
4
|
-
|
|
5
3
|
const { Readable } = require("stream");
|
|
6
4
|
const { headers, contentTypes, requestUtilities } = require("necessary");
|
|
7
5
|
|
|
8
|
-
const {
|
|
9
|
-
{ retrieveHostURL } = require("./configuration"),
|
|
6
|
+
const { getHost } = require("./configuration"),
|
|
10
7
|
{ getPackageVersion } = require("./utilities/packageJSON"),
|
|
11
8
|
{ contentFromResponse } = require("./utilities/response"),
|
|
12
|
-
{
|
|
9
|
+
{ SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE } = require("./messages");
|
|
13
10
|
|
|
14
11
|
const { createPostRequest } = requestUtilities,
|
|
15
|
-
{
|
|
12
|
+
{ CONTENT_TYPE_HEADER } = headers,
|
|
16
13
|
{ APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE } = contentTypes;
|
|
17
14
|
|
|
18
|
-
function post(uri,
|
|
15
|
+
function post(uri, json, callback) {
|
|
19
16
|
const host = getHost(),
|
|
20
|
-
headers = getHeaders(),
|
|
21
|
-
versionString = getVersionString(),
|
|
22
|
-
json = Object.assign(data, { ///
|
|
23
|
-
versionString
|
|
24
|
-
}),
|
|
25
|
-
content = JSON.stringify(json),
|
|
26
17
|
query = {},
|
|
27
|
-
|
|
18
|
+
headers = getHeaders(),
|
|
19
|
+
content = JSON.stringify(json), ///
|
|
20
|
+
versionString = getVersionString();
|
|
21
|
+
|
|
22
|
+
Object.assign(json, {
|
|
23
|
+
versionString
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const postRequest = createPostRequest(host, uri, query, headers, (error, response) => {
|
|
28
27
|
if (error) {
|
|
29
28
|
console.log(SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE);
|
|
30
29
|
|
|
31
|
-
process.exit(
|
|
30
|
+
process.exit();
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
contentFromResponse(response, (content) => {
|
|
@@ -42,24 +41,10 @@ function post(uri, data, callback) {
|
|
|
42
41
|
if (error) {
|
|
43
42
|
console.log(SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE);
|
|
44
43
|
|
|
45
|
-
process.exit(
|
|
44
|
+
process.exit();
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
const { message } = json;
|
|
50
|
-
|
|
51
|
-
if (message) { ///
|
|
52
|
-
console.log(message);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
({ error } = json); ///
|
|
56
|
-
|
|
57
|
-
if (error) {
|
|
58
|
-
console.log(SERVER_ERROR_MESSAGE);
|
|
59
|
-
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
48
|
callback(json);
|
|
64
49
|
});
|
|
65
50
|
}),
|
|
@@ -70,32 +55,14 @@ function post(uri, data, callback) {
|
|
|
70
55
|
|
|
71
56
|
module.exports = post;
|
|
72
57
|
|
|
73
|
-
function getHost() {
|
|
74
|
-
const hostURL = retrieveHostURL(),
|
|
75
|
-
host = hostURL; ///
|
|
76
|
-
|
|
77
|
-
return host;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
58
|
function getHeaders() {
|
|
81
|
-
const headers = {}
|
|
82
|
-
userAgent = getUserAgent();
|
|
83
|
-
|
|
84
|
-
headers[USER_AGENT_HEADER] = userAgent;
|
|
59
|
+
const headers = {};
|
|
85
60
|
|
|
86
61
|
headers[CONTENT_TYPE_HEADER] = APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE;
|
|
87
62
|
|
|
88
63
|
return headers;
|
|
89
64
|
}
|
|
90
65
|
|
|
91
|
-
function getUserAgent() {
|
|
92
|
-
const osType = os.type(),
|
|
93
|
-
operatingSystem = osType, ///
|
|
94
|
-
userAgent = `${OPEN_CLI}/${operatingSystem}`;
|
|
95
|
-
|
|
96
|
-
return userAgent;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
66
|
function getVersionString() {
|
|
100
67
|
const packageVersion = getPackageVersion(),
|
|
101
68
|
versionString = packageVersion; ///
|
package/bin/uris.js
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const CLONE_API_URI = "/api/clone",
|
|
4
|
-
LOGIN_API_URI = "/api/login",
|
|
5
|
-
LOGOUT_API_URI = "/api/logout",
|
|
6
4
|
PUBLISH_API_URI = "/api/publish",
|
|
7
|
-
|
|
5
|
+
SIGN_IN_API_URI = "/api/sign-in",
|
|
8
6
|
DEPRECATE_API_URI = "/api/deprecate",
|
|
9
|
-
RESET_PASSWORD_API_URI = "/api/
|
|
10
|
-
|
|
11
|
-
CHANGE_EMAIL_ADDRESS_API_URI = "/api/changeEmailAddress",
|
|
12
|
-
CONFIRM_EMAIL_ADDRESS_API_URI = "/api/confirmEmailAddress",
|
|
13
|
-
RESEND_CONFIRMATION_CODE_API_URI = "/api/resendConfirmationCode";
|
|
7
|
+
RESET_PASSWORD_API_URI = "/api/reset-password",
|
|
8
|
+
CREATE_ACCOUNT_API_URI = "/api/create-account";
|
|
14
9
|
|
|
15
10
|
module.exports = {
|
|
16
11
|
CLONE_API_URI,
|
|
17
|
-
LOGIN_API_URI,
|
|
18
|
-
LOGOUT_API_URI,
|
|
19
12
|
PUBLISH_API_URI,
|
|
20
|
-
|
|
13
|
+
SIGN_IN_API_URI,
|
|
21
14
|
DEPRECATE_API_URI,
|
|
22
15
|
RESET_PASSWORD_API_URI,
|
|
23
|
-
|
|
24
|
-
CHANGE_EMAIL_ADDRESS_API_URI,
|
|
25
|
-
CONFIRM_EMAIL_ADDRESS_API_URI,
|
|
26
|
-
RESEND_CONFIRMATION_CODE_API_URI
|
|
16
|
+
CREATE_ACCOUNT_API_URI
|
|
27
17
|
};
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function validateAnswer(answer) { return /^(:?yes|no|y|n)$/i.test(answer); }
|
|
4
3
|
|
|
5
4
|
function validateUsername(username) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(username); }
|
|
6
5
|
|
|
7
6
|
function validatePassword(password) { return /^[a-zA-Z0-9!@#$%^&*_.,\-]{8,24}$/.test(password); }
|
|
8
7
|
|
|
8
|
+
function validateAffirmation(affirmation) { return /^(:?yes|no|y|n)$/i.test(affirmation); }
|
|
9
|
+
|
|
9
10
|
function validateReleaseName(releaseName) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(releaseName); }
|
|
10
11
|
|
|
11
12
|
function validateEmailAddress(emailAddress) { return /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,16}$/.test(emailAddress); }
|
|
12
13
|
|
|
13
14
|
function validateGitHubHostName(gitHubHostName) { return /^[a-zA-Z0-9.\-]*$/.test(gitHubHostName); }
|
|
14
15
|
|
|
15
|
-
function
|
|
16
|
+
function validateEmailAddressOrUsername(emailAddressOrUsername) {
|
|
17
|
+
let valid = false;
|
|
18
|
+
|
|
19
|
+
if (!valid) {
|
|
20
|
+
const emailAddress = emailAddressOrUsername; ///
|
|
21
|
+
|
|
22
|
+
valid = validateEmailAddress(emailAddress);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!valid) {
|
|
26
|
+
const username = emailAddressOrUsername; ///
|
|
27
|
+
|
|
28
|
+
valid = validateUsername(username);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return valid;
|
|
32
|
+
}
|
|
16
33
|
|
|
17
34
|
module.exports = {
|
|
18
|
-
validateAnswer,
|
|
19
35
|
validateUsername,
|
|
20
36
|
validatePassword,
|
|
37
|
+
validateAffirmation,
|
|
21
38
|
validateReleaseName,
|
|
22
39
|
validateEmailAddress,
|
|
23
40
|
validateGitHubHostName,
|
|
24
|
-
|
|
41
|
+
validateEmailAddressOrUsername
|
|
25
42
|
};
|
package/bin/versions.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const UNVERSIONED = "
|
|
3
|
+
const UNVERSIONED = "unversioned",
|
|
4
4
|
VERSION_1_5 = "1.5",
|
|
5
5
|
VERSION_2_0 = "2.0",
|
|
6
|
-
|
|
6
|
+
VERSION_5_0 = "5.0",
|
|
7
|
+
CURRENT_VERSION = VERSION_5_0; ///
|
|
7
8
|
|
|
8
9
|
module.exports = {
|
|
9
10
|
UNVERSIONED,
|
|
10
11
|
VERSION_1_5,
|
|
11
12
|
VERSION_2_0,
|
|
13
|
+
VERSION_5_0,
|
|
12
14
|
CURRENT_VERSION
|
|
13
15
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-open-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.3",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-open-cli",
|
|
7
7
|
"description": "Occam's command line package management tool.",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.15",
|
|
14
14
|
"mkdirp": "^0.5.1",
|
|
15
|
-
"necessary": "^11.
|
|
16
|
-
"occam-parsers": "^16.0.
|
|
15
|
+
"necessary": "^11.1.4",
|
|
16
|
+
"occam-parsers": "^16.0.55"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@swc/core": "^1.2.51",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
usernamePromptOperation = require("../operation/prompt/username"),
|
|
5
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress"),
|
|
6
|
-
retrieveAccessTokenOperation = require("../operation/retrieveAccessToken"),
|
|
7
|
-
newEmailAddressPromptOperation = require("../operation/prompt/newEmailAddress");
|
|
8
|
-
|
|
9
|
-
const { CHANGE_EMAIL_ADDRESS_API_URI } = require("../uris"),
|
|
10
|
-
{ FAILED_CHANGE_EMAIL_ADDRESS_MESSAGE, SUCCESSFUL_CHANGE_EMAIL_ADDRESS_MESSAGE } = require("../messages");
|
|
11
|
-
|
|
12
|
-
function changeEmailAddress(argument) {
|
|
13
|
-
const username = argument, ///
|
|
14
|
-
emailAddress = null,
|
|
15
|
-
uri = CHANGE_EMAIL_ADDRESS_API_URI,
|
|
16
|
-
operations = [
|
|
17
|
-
retrieveAccessTokenOperation,
|
|
18
|
-
usernamePromptOperation,
|
|
19
|
-
emailAddressPromptOperation,
|
|
20
|
-
newEmailAddressPromptOperation
|
|
21
|
-
],
|
|
22
|
-
context = {
|
|
23
|
-
username,
|
|
24
|
-
emailAddress
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
action(operations, uri, (json) => {
|
|
28
|
-
const { success } = json;
|
|
29
|
-
|
|
30
|
-
success ?
|
|
31
|
-
console.log(SUCCESSFUL_CHANGE_EMAIL_ADDRESS_MESSAGE) :
|
|
32
|
-
console.log(FAILED_CHANGE_EMAIL_ADDRESS_MESSAGE);
|
|
33
|
-
|
|
34
|
-
process.exit();
|
|
35
|
-
}, context);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = changeEmailAddress;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
usernamePromptOperation = require("../operation/prompt/username"),
|
|
5
|
-
passwordPromptOperation = require("../operation/prompt/password"),
|
|
6
|
-
newPasswordPromptOperation = require("../operation/prompt/newPassword"),
|
|
7
|
-
retrieveAccessTokenOperation = require("../operation/retrieveAccessToken"),
|
|
8
|
-
confirmNewPasswordPromptOperation = require("../operation/prompt/confirmNewPassword");
|
|
9
|
-
|
|
10
|
-
const { CHANGE_PASSWORD_API_URI } = require("../uris"),
|
|
11
|
-
{ FAILED_CHANGE_PASSWORD_MESSAGE, SUCCESSFUL_CHANGE_PASSWORD_MESSAGE } = require("../messages");
|
|
12
|
-
|
|
13
|
-
function changePassword(argument) {
|
|
14
|
-
const username = argument, ///
|
|
15
|
-
oldPassword = null,
|
|
16
|
-
newPassword = null,
|
|
17
|
-
uri = CHANGE_PASSWORD_API_URI,
|
|
18
|
-
operations = [
|
|
19
|
-
retrieveAccessTokenOperation,
|
|
20
|
-
usernamePromptOperation,
|
|
21
|
-
passwordPromptOperation,
|
|
22
|
-
newPasswordPromptOperation,
|
|
23
|
-
confirmNewPasswordPromptOperation
|
|
24
|
-
],
|
|
25
|
-
context = {
|
|
26
|
-
username,
|
|
27
|
-
oldPassword,
|
|
28
|
-
newPassword
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
action(operations, uri, (json) => {
|
|
32
|
-
const { success } = json;
|
|
33
|
-
|
|
34
|
-
success ?
|
|
35
|
-
console.log(SUCCESSFUL_CHANGE_PASSWORD_MESSAGE) :
|
|
36
|
-
console.log(FAILED_CHANGE_PASSWORD_MESSAGE);
|
|
37
|
-
|
|
38
|
-
process.exit();
|
|
39
|
-
}, context);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = changePassword;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress"),
|
|
5
|
-
retrieveAccessTokenOperation = require("../operation/retrieveAccessToken"),
|
|
6
|
-
confirmationCodePromptOperation = require("../operation/prompt/confirmationCode");
|
|
7
|
-
|
|
8
|
-
const { CONFIRM_EMAIL_ADDRESS_API_URI } = require("../uris"),
|
|
9
|
-
{ FAILED_CONFIRM_EMAIL_ADDRESS_MESSAGE, SUCCESSFUL_CONFIRM_EMAIL_ADDRESS_MESSAGE } = require("../messages");
|
|
10
|
-
|
|
11
|
-
function confirmEmailAddress(argument) {
|
|
12
|
-
const emailAddress = argument, ///
|
|
13
|
-
confirmationCode = null,
|
|
14
|
-
uri = CONFIRM_EMAIL_ADDRESS_API_URI,
|
|
15
|
-
operations = [
|
|
16
|
-
retrieveAccessTokenOperation,
|
|
17
|
-
emailAddressPromptOperation,
|
|
18
|
-
confirmationCodePromptOperation
|
|
19
|
-
],
|
|
20
|
-
context = {
|
|
21
|
-
emailAddress,
|
|
22
|
-
confirmationCode
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
action(operations, uri, (json) => {
|
|
26
|
-
const { success } = json;
|
|
27
|
-
|
|
28
|
-
success ?
|
|
29
|
-
console.log(SUCCESSFUL_CONFIRM_EMAIL_ADDRESS_MESSAGE) :
|
|
30
|
-
console.log(FAILED_CONFIRM_EMAIL_ADDRESS_MESSAGE);
|
|
31
|
-
|
|
32
|
-
process.exit();
|
|
33
|
-
}, context);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
module.exports = confirmEmailAddress;
|
package/bin/action/login.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
passwordPromptOperation = require("../operation/prompt/password"),
|
|
5
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress");
|
|
6
|
-
|
|
7
|
-
const { LOGIN_API_URI } = require("../uris"),
|
|
8
|
-
{ addAccessToken } = require("../configuration"),
|
|
9
|
-
{ FAILED_LOGIN_MESSAGE, SUCCESSFUL_LOGIN_MESSAGE } = require("../messages");
|
|
10
|
-
|
|
11
|
-
function login(argument) {
|
|
12
|
-
const emailAddress = argument, ///
|
|
13
|
-
password = null,
|
|
14
|
-
uri = LOGIN_API_URI,
|
|
15
|
-
operations = [
|
|
16
|
-
emailAddressPromptOperation,
|
|
17
|
-
passwordPromptOperation
|
|
18
|
-
],
|
|
19
|
-
context = {
|
|
20
|
-
emailAddress,
|
|
21
|
-
password
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
action(operations, uri, (json) => {
|
|
25
|
-
const { success } = json;
|
|
26
|
-
|
|
27
|
-
success ?
|
|
28
|
-
console.log(SUCCESSFUL_LOGIN_MESSAGE) :
|
|
29
|
-
console.log(FAILED_LOGIN_MESSAGE);
|
|
30
|
-
|
|
31
|
-
if (success) {
|
|
32
|
-
const { accessToken } = json;
|
|
33
|
-
|
|
34
|
-
addAccessToken(accessToken);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
process.exit();
|
|
38
|
-
}, context);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
module.exports = login;
|
package/bin/action/logout.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
retrieveAccessTokenOperation = require("../operation/retrieveAccessToken");
|
|
5
|
-
|
|
6
|
-
const { LOGOUT_API_URI } = require("../uris"),
|
|
7
|
-
{ removeAccessToken } = require("../configuration"),
|
|
8
|
-
{ LOGGED_OUT_MESSAGE } = require("../messages");
|
|
9
|
-
|
|
10
|
-
function logout() {
|
|
11
|
-
const uri = LOGOUT_API_URI,
|
|
12
|
-
operations = [
|
|
13
|
-
retrieveAccessTokenOperation
|
|
14
|
-
],
|
|
15
|
-
context = {};
|
|
16
|
-
|
|
17
|
-
action(operations, uri, (json) => {
|
|
18
|
-
removeAccessToken();
|
|
19
|
-
|
|
20
|
-
console.log(LOGGED_OUT_MESSAGE);
|
|
21
|
-
|
|
22
|
-
process.exit();
|
|
23
|
-
}, context);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = logout;
|
package/bin/action/register.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
usernamePromptOperation = require("../operation/prompt/username"),
|
|
5
|
-
passwordPromptOperation = require("../operation/prompt/password"),
|
|
6
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress"),
|
|
7
|
-
confirmPasswordPromptOperation = require("../operation/prompt/confirmPassword");
|
|
8
|
-
|
|
9
|
-
const { REGISTER_API_URI } = require("../uris"),
|
|
10
|
-
{ FAILED_REGISTER_MESSAGE, SUCCESSFUL_REGISTER_MESSAGE } = require("../messages");
|
|
11
|
-
|
|
12
|
-
function register(argument) {
|
|
13
|
-
const emailAddress = argument, ///
|
|
14
|
-
username = null,
|
|
15
|
-
password = null,
|
|
16
|
-
uri = REGISTER_API_URI,
|
|
17
|
-
operations = [
|
|
18
|
-
emailAddressPromptOperation,
|
|
19
|
-
usernamePromptOperation,
|
|
20
|
-
passwordPromptOperation,
|
|
21
|
-
confirmPasswordPromptOperation
|
|
22
|
-
],
|
|
23
|
-
context = {
|
|
24
|
-
username,
|
|
25
|
-
password,
|
|
26
|
-
emailAddress
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
action(operations, uri, (json) => {
|
|
30
|
-
const { success } = json;
|
|
31
|
-
|
|
32
|
-
success ?
|
|
33
|
-
console.log(SUCCESSFUL_REGISTER_MESSAGE) :
|
|
34
|
-
console.log(FAILED_REGISTER_MESSAGE);
|
|
35
|
-
|
|
36
|
-
process.exit();
|
|
37
|
-
}, context);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = register;
|
package/bin/action/remove.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const action = require("../action"),
|
|
4
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress"),
|
|
5
|
-
retrieveAccessTokenOperation = require("../operation/retrieveAccessToken");
|
|
6
|
-
|
|
7
|
-
const { RESEND_CONFIRMATION_CODE_API_URI } = require("../uris"),
|
|
8
|
-
{ SUCCESSFUL_RESEND_CONFIRMATION_CODE_MESSAGE, FAILED_RESEND_CONFIRMATION_CODE_MESSAGE } = require("../messages");
|
|
9
|
-
|
|
10
|
-
function resendConfirmationCode(argument) {
|
|
11
|
-
const emailAddress = argument, ///
|
|
12
|
-
uri = RESEND_CONFIRMATION_CODE_API_URI,
|
|
13
|
-
operations = [
|
|
14
|
-
retrieveAccessTokenOperation,
|
|
15
|
-
emailAddressPromptOperation
|
|
16
|
-
],
|
|
17
|
-
context = {
|
|
18
|
-
emailAddress
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
action(operations, uri, (json) => {
|
|
22
|
-
const { success } = json;
|
|
23
|
-
|
|
24
|
-
success ?
|
|
25
|
-
console.log(SUCCESSFUL_RESEND_CONFIRMATION_CODE_MESSAGE) :
|
|
26
|
-
console.log(FAILED_RESEND_CONFIRMATION_CODE_MESSAGE);
|
|
27
|
-
|
|
28
|
-
process.exit();
|
|
29
|
-
}, context);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = resendConfirmationCode;
|
package/bin/action.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const post = require("./post");
|
|
4
|
-
|
|
5
|
-
const { executeOperations } = require("./utilities/operation");
|
|
6
|
-
|
|
7
|
-
function action(operations, uri, callback, context) {
|
|
8
|
-
executeOperations(operations, (completed) => {
|
|
9
|
-
if (!completed) {
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const data = context; ///
|
|
14
|
-
|
|
15
|
-
post(uri, data, callback);
|
|
16
|
-
}, context);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = action;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { DEFAULT_USE_SSH, DEFAULT_HOST_URL, DEFAULT_HOST_NAME_SUFFIX } = require("../defaults");
|
|
4
|
-
|
|
5
|
-
function createConfiguration() {
|
|
6
|
-
const useSSH = DEFAULT_USE_SSH,
|
|
7
|
-
hostURL = DEFAULT_HOST_URL,
|
|
8
|
-
hostNameSuffix = DEFAULT_HOST_NAME_SUFFIX,
|
|
9
|
-
defaultOptions = {
|
|
10
|
-
useSSH,
|
|
11
|
-
hostURL,
|
|
12
|
-
hostNameSuffix
|
|
13
|
-
},
|
|
14
|
-
options = defaultOptions, ///
|
|
15
|
-
configuration = {
|
|
16
|
-
options
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return configuration;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
createConfiguration
|
|
24
|
-
};
|