occam-open-cli 6.1.71 → 6.1.73
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/lib/abbreviations.js +27 -0
- package/lib/action/clone.js +38 -0
- package/lib/action/createAccount.js +40 -0
- package/lib/action/help.js +15 -0
- package/lib/action/initialise.js +26 -0
- package/lib/action/open.js +39 -0
- package/lib/action/publish.js +68 -0
- package/lib/action/resetPassword.js +32 -0
- package/lib/action/setOptions.js +33 -0
- package/lib/action/setShellCommands.js +37 -0
- package/lib/action/signIn.js +37 -0
- package/lib/action/signOut.js +19 -0
- package/lib/action/version.js +19 -0
- package/lib/action/withdraw.js +38 -0
- package/lib/changeDirectory.js +33 -0
- package/lib/commands.js +66 -0
- package/lib/configuration/version_2_0.js +20 -0
- package/lib/configuration/version_5_0.js +17 -0
- package/lib/configuration/version_5_1.js +40 -0
- package/lib/configuration.js +175 -0
- package/lib/constants.js +46 -0
- package/lib/defaults.js +69 -0
- package/lib/descriptions.js +58 -0
- package/lib/main.js +132 -0
- package/lib/messages.js +134 -0
- package/lib/operation/clone.js +34 -0
- package/lib/operation/cloneRepositories.js +92 -0
- package/lib/operation/createAccount.js +34 -0
- package/lib/operation/executeShallCommands.js +47 -0
- package/lib/operation/getIdentityToken.js +24 -0
- package/lib/operation/loadProject.js +28 -0
- package/lib/operation/open.js +34 -0
- package/lib/operation/openReleasees.js +120 -0
- package/lib/operation/prompt/areYouSure.js +36 -0
- package/lib/operation/prompt/confirmPassword.js +36 -0
- package/lib/operation/prompt/emailAddress.js +45 -0
- package/lib/operation/prompt/emailAddressOrUsername.js +45 -0
- package/lib/operation/prompt/gitHubHostName.js +46 -0
- package/lib/operation/prompt/password.js +36 -0
- package/lib/operation/prompt/releaseName.js +44 -0
- package/lib/operation/prompt/repositoryName.js +44 -0
- package/lib/operation/prompt/setShellCommands.js +40 -0
- package/lib/operation/prompt/useSSH.js +37 -0
- package/lib/operation/prompt/username.js +45 -0
- package/lib/operation/publish.js +46 -0
- package/lib/operation/releaseToJSON.js +28 -0
- package/lib/operation/resetPassword.js +31 -0
- package/lib/operation/signIn.js +33 -0
- package/lib/operation/updateIdentityToken.js +20 -0
- package/lib/operation/updateMetaJSONFileVersion.js +24 -0
- package/lib/operation/updateOptions.js +26 -0
- package/lib/operation/updateShellCommands.js +18 -0
- package/lib/operation/withdraw.js +27 -0
- package/lib/options.js +54 -0
- package/lib/post.js +68 -0
- package/lib/prepare.js +48 -0
- package/lib/uris.js +42 -0
- package/lib/utilities/operation.js +46 -0
- package/lib/utilities/prompt.js +15 -0
- package/lib/utilities/release.js +18 -0
- package/lib/utilities/response.js +22 -0
- package/lib/utilities/shell.js +35 -0
- package/lib/utilities/status.js +30 -0
- package/lib/utilities/string.js +17 -0
- package/lib/utilities/validate.js +83 -0
- package/lib/versions.js +30 -0
- package/open.js +3 -3
- package/package.json +20 -5
- package/{bin → src}/abbreviations.js +4 -2
- package/{bin → src}/action/clone.js +6 -8
- package/src/action/createAccount.js +32 -0
- package/{bin → src}/action/help.js +1 -3
- package/{bin → src}/action/initialise.js +3 -5
- package/{bin → src}/action/open.js +6 -8
- package/{bin → src}/action/publish.js +11 -13
- package/{bin → src}/action/resetPassword.js +4 -6
- package/src/action/setOptions.js +26 -0
- package/src/action/setShellCommands.js +29 -0
- package/src/action/signIn.js +28 -0
- package/src/action/signOut.js +12 -0
- package/src/action/version.js +13 -0
- package/{bin → src}/action/withdraw.js +7 -9
- package/{bin → src}/changeDirectory.js +4 -6
- package/src/commands.js +15 -0
- package/src/configuration/version_2_0.js +13 -0
- package/{bin → src}/configuration/version_5_1.js +4 -9
- package/{bin → src}/configuration.js +20 -35
- package/src/constants.js +10 -0
- package/src/defaults.js +21 -0
- package/src/descriptions.js +13 -0
- package/{bin → src}/main.js +32 -34
- package/src/messages.js +32 -0
- package/{bin → src}/operation/clone.js +3 -5
- package/{bin → src}/operation/cloneRepositories.js +6 -8
- package/{bin → src}/operation/createAccount.js +3 -5
- package/{bin → src}/operation/executeShallCommands.js +5 -7
- package/{bin → src}/operation/getIdentityToken.js +2 -4
- package/{bin → src}/operation/loadProject.js +3 -5
- package/{bin → src}/operation/open.js +3 -5
- package/{bin → src}/operation/openReleasees.js +6 -8
- package/{bin → src}/operation/prompt/areYouSure.js +6 -8
- package/{bin → src}/operation/prompt/confirmPassword.js +4 -6
- package/{bin → src}/operation/prompt/emailAddress.js +5 -7
- package/{bin → src}/operation/prompt/emailAddressOrUsername.js +5 -7
- package/{bin → src}/operation/prompt/gitHubHostName.js +7 -9
- package/{bin → src}/operation/prompt/password.js +5 -7
- package/{bin → src}/operation/prompt/releaseName.js +5 -7
- package/{bin → src}/operation/prompt/repositoryName.js +5 -7
- package/{bin → src}/operation/prompt/setShellCommands.js +6 -8
- package/{bin → src}/operation/prompt/useSSH.js +6 -8
- package/{bin → src}/operation/prompt/username.js +5 -7
- package/{bin → src}/operation/publish.js +4 -6
- package/{bin → src}/operation/releaseToJSON.js +2 -4
- package/{bin → src}/operation/resetPassword.js +3 -5
- package/{bin → src}/operation/signIn.js +3 -5
- package/src/operation/updateIdentityToken.js +13 -0
- package/{bin → src}/operation/updateMetaJSONFileVersion.js +3 -5
- package/{bin → src}/operation/updateOptions.js +2 -4
- package/src/operation/updateShellCommands.js +11 -0
- package/{bin → src}/operation/withdraw.js +3 -5
- package/src/options.js +12 -0
- package/{bin → src}/post.js +7 -9
- package/{bin → src}/prepare.js +13 -15
- package/src/uris.js +9 -0
- package/{bin → src}/utilities/operation.js +2 -6
- package/src/utilities/prompt.js +3 -0
- package/{bin → src}/utilities/release.js +2 -6
- package/{bin → src}/utilities/response.js +2 -6
- package/{bin → src}/utilities/shell.js +4 -8
- package/{bin → src}/utilities/status.js +1 -1
- package/src/utilities/string.js +9 -0
- package/src/utilities/validate.js +37 -0
- package/src/versions.js +6 -0
- package/bin/action/createAccount.js +0 -34
- package/bin/action/setOptions.js +0 -28
- package/bin/action/setShellCommands.js +0 -31
- package/bin/action/signIn.js +0 -30
- package/bin/action/signOut.js +0 -14
- package/bin/action/version.js +0 -15
- package/bin/commands.js +0 -31
- package/bin/configuration/version_2_0.js +0 -17
- package/bin/constants.js +0 -27
- package/bin/defaults.js +0 -37
- package/bin/descriptions.js +0 -27
- package/bin/messages.js +0 -65
- package/bin/operation/updateIdentityToken.js +0 -15
- package/bin/operation/updateShellCommands.js +0 -13
- package/bin/options.js +0 -25
- package/bin/uris.js +0 -19
- package/bin/utilities/prompt.js +0 -7
- package/bin/utilities/string.js +0 -13
- package/bin/utilities/validate.js +0 -50
- package/bin/versions.js +0 -13
- /package/{bin → src}/configuration/version_5_0.js +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { validatePassword } from "../../utilities/validate";
|
|
6
|
+
import { PASSWORD_DESCRIPTION } from "../../descriptions";
|
|
7
|
+
import { INVALID_PASSWORD_MESSAGE } from "../../messages";
|
|
8
8
|
|
|
9
9
|
const { prompt } = shellUtilities;
|
|
10
10
|
|
|
11
|
-
function passwordPromptOperation(proceed, abort, context) {
|
|
11
|
+
export default function passwordPromptOperation(proceed, abort, context) {
|
|
12
12
|
const hidden = true,
|
|
13
13
|
description = PASSWORD_DESCRIPTION,
|
|
14
14
|
errorMessage = INVALID_PASSWORD_MESSAGE,
|
|
@@ -37,5 +37,3 @@ function passwordPromptOperation(proceed, abort, context) {
|
|
|
37
37
|
abort();
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
module.exports = passwordPromptOperation;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { validateReleaseName } from "../../utilities/validate";
|
|
6
|
+
import { RELEASE_NAME_DESCRIPTION } from "../../descriptions";
|
|
7
|
+
import { INVALID_RELEASE_NAME_MESSAGE } from "../../messages";
|
|
8
8
|
|
|
9
9
|
const { prompt } = shellUtilities;
|
|
10
10
|
|
|
11
|
-
function releaseNamePromptOperation(proceed, abort, context) {
|
|
11
|
+
export default function releaseNamePromptOperation(proceed, abort, context) {
|
|
12
12
|
const { releaseName } = context,
|
|
13
13
|
errorMessage = INVALID_RELEASE_NAME_MESSAGE;
|
|
14
14
|
|
|
@@ -49,5 +49,3 @@ function releaseNamePromptOperation(proceed, abort, context) {
|
|
|
49
49
|
abort();
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
module.exports = releaseNamePromptOperation;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { validateRepositoryName } from "../../utilities/validate";
|
|
6
|
+
import { REPOSITORY_NAME_DESCRIPTION } from "../../descriptions";
|
|
7
|
+
import { INVALID_REPOSITORY_NAME_MESSAGE } from "../../messages";
|
|
8
8
|
|
|
9
9
|
const { prompt } = shellUtilities;
|
|
10
10
|
|
|
11
|
-
function repositoryNamePromptOperation(proceed, abort, context) {
|
|
11
|
+
export default function repositoryNamePromptOperation(proceed, abort, context) {
|
|
12
12
|
const { repositoryName } = context,
|
|
13
13
|
errorMessage = INVALID_REPOSITORY_NAME_MESSAGE;
|
|
14
14
|
|
|
@@ -49,5 +49,3 @@ function repositoryNamePromptOperation(proceed, abort, context) {
|
|
|
49
49
|
abort();
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
module.exports = repositoryNamePromptOperation;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
|
+
import { validateShellCommands } from "../../utilities/validate";
|
|
7
|
+
import { DEFAULT_SHELL_COMMANDS } from "../../defaults";
|
|
8
|
+
import { SHELL_COMMANDS_DESCRIPTION } from "../../descriptions";
|
|
9
9
|
|
|
10
10
|
const { prompt } = shellUtilities;
|
|
11
11
|
|
|
12
|
-
function setShellCommandsPromptOperation(proceed, abort, context) {
|
|
12
|
+
export default function setShellCommandsPromptOperation(proceed, abort, context) {
|
|
13
13
|
const { shellCommands } = context,
|
|
14
14
|
description = SHELL_COMMANDS_DESCRIPTION,
|
|
15
15
|
initialAnswer = shellCommands, ///
|
|
@@ -42,5 +42,3 @@ function setShellCommandsPromptOperation(proceed, abort, context) {
|
|
|
42
42
|
abort();
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
module.exports = setShellCommandsPromptOperation;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { validateAffirmation } from "../../utilities/validate";
|
|
6
|
+
import { isAnswerAffirmative } from "../../utilities/prompt";
|
|
7
|
+
import { USE_SSH_DESCRIPTION } from "../../descriptions";
|
|
8
|
+
import { INVALID_AFFIRMATION_MESSAGE } from "../../messages";
|
|
9
9
|
|
|
10
10
|
const { prompt } = shellUtilities;
|
|
11
11
|
|
|
12
|
-
function useSSHPromptOperation(proceed, abort, context) {
|
|
12
|
+
export default function useSSHPromptOperation(proceed, abort, context) {
|
|
13
13
|
const description = USE_SSH_DESCRIPTION,
|
|
14
14
|
errorMessage = INVALID_AFFIRMATION_MESSAGE,
|
|
15
15
|
validationFunction = validateAffirmation, ///
|
|
@@ -38,5 +38,3 @@ function useSSHPromptOperation(proceed, abort, context) {
|
|
|
38
38
|
abort();
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
module.exports = useSSHPromptOperation;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { shellUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { validateUsername } from "../../utilities/validate";
|
|
6
|
+
import { USERNAME_DESCRIPTION } from "../../descriptions";
|
|
7
|
+
import { INVALID_USERNAME_MESSAGE } from "../../messages";
|
|
8
8
|
|
|
9
9
|
const { prompt } = shellUtilities;
|
|
10
10
|
|
|
11
|
-
function usernamePromptOperation(proceed, abort, context) {
|
|
11
|
+
export default function usernamePromptOperation(proceed, abort, context) {
|
|
12
12
|
const { username } = context,
|
|
13
13
|
errorMessage = INVALID_USERNAME_MESSAGE;
|
|
14
14
|
|
|
@@ -49,5 +49,3 @@ function usernamePromptOperation(proceed, abort, context) {
|
|
|
49
49
|
abort();
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
module.exports = usernamePromptOperation;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { Version } from "occam-entities"; 1
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import post from "../post"; 1
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { PUBLISH_API_URI } from "../uris";
|
|
8
8
|
|
|
9
|
-
function publishOperation(proceed, abort, context) {
|
|
9
|
+
export default function publishOperation(proceed, abort, context) {
|
|
10
10
|
const { tail, follow, dryRun, release, logLevel, releaseName, identityToken } = context,
|
|
11
11
|
uri = `${PUBLISH_API_URI}/${releaseName}`,
|
|
12
12
|
json = {
|
|
@@ -38,5 +38,3 @@ function publishOperation(proceed, abort, context) {
|
|
|
38
38
|
proceed();
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
module.exports = publishOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { Release } from "occam-entities";
|
|
4
4
|
|
|
5
|
-
function releaseToJSONOperation(proceed, abort, context) {
|
|
5
|
+
export default function releaseToJSONOperation(proceed, abort, context) {
|
|
6
6
|
let release;
|
|
7
7
|
|
|
8
8
|
const { project } = context;
|
|
@@ -25,5 +25,3 @@ function releaseToJSONOperation(proceed, abort, context) {
|
|
|
25
25
|
|
|
26
26
|
proceed();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
module.exports = releaseToJSONOperation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import post from "../post";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { RESET_PASSWORD_API_URI } from "../uris";
|
|
6
6
|
|
|
7
|
-
function resetPasswordOperation(proceed, abort, context) {
|
|
7
|
+
export default function resetPasswordOperation(proceed, abort, context) {
|
|
8
8
|
const { emailAddress } = context,
|
|
9
9
|
uri = RESET_PASSWORD_API_URI,
|
|
10
10
|
json = {
|
|
@@ -21,5 +21,3 @@ function resetPasswordOperation(proceed, abort, context) {
|
|
|
21
21
|
proceed();
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
module.exports = resetPasswordOperation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import post from "../post";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { SIGN_IN_API_URI } from "../uris";
|
|
6
6
|
|
|
7
|
-
function signInOperation(proceed, abort, context) {
|
|
7
|
+
export default function signInOperation(proceed, abort, context) {
|
|
8
8
|
const { emailAddressOrUsername, password } = context,
|
|
9
9
|
uri = SIGN_IN_API_URI,
|
|
10
10
|
json = {
|
|
@@ -23,5 +23,3 @@ function signInOperation(proceed, abort, context) {
|
|
|
23
23
|
proceed();
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
module.exports = signInOperation;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { updateIdentityToken } from "../configuration";
|
|
4
|
+
|
|
5
|
+
export default function updateIdentityTokenOperation(proceed, abort, context) {
|
|
6
|
+
const { identityToken } = context;
|
|
7
|
+
|
|
8
|
+
if (identityToken !== null) {
|
|
9
|
+
updateIdentityToken(identityToken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
proceed();
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { fileSystemUtilities } from "occam-file-system";
|
|
4
|
+
import { fileNames, metaJSONUtilities } from "occam-entities";
|
|
5
5
|
|
|
6
6
|
const { loadFile, saveFile } = fileSystemUtilities,
|
|
7
7
|
{ META_JSON_FILE_NAME } = fileNames,
|
|
8
8
|
{ updateMetaJSONFileVersion } = metaJSONUtilities
|
|
9
9
|
|
|
10
|
-
function updateMetaJSONFileVersionOperation(proceed, abort, context) {
|
|
10
|
+
export default function updateMetaJSONFileVersionOperation(proceed, abort, context) {
|
|
11
11
|
const { success } = context;
|
|
12
12
|
|
|
13
13
|
if (success) {
|
|
@@ -23,5 +23,3 @@ function updateMetaJSONFileVersionOperation(proceed, abort, context) {
|
|
|
23
23
|
|
|
24
24
|
proceed();
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
module.exports = updateMetaJSONFileVersionOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { updateOptions } from "../configuration";
|
|
4
4
|
|
|
5
|
-
function updateOptionsOperation(proceed, abort, context) {
|
|
5
|
+
export default function updateOptionsOperation(proceed, abort, context) {
|
|
6
6
|
const { useSSH } = context,
|
|
7
7
|
options = {};
|
|
8
8
|
|
|
@@ -21,5 +21,3 @@ function updateOptionsOperation(proceed, abort, context) {
|
|
|
21
21
|
|
|
22
22
|
proceed();
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
module.exports = updateOptionsOperation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import post from "../post";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { WITHDRAW_API_URI } from "../uris";
|
|
6
6
|
|
|
7
|
-
function withdrawOperation(proceed, abort, context) {
|
|
7
|
+
export default function withdrawOperation(proceed, abort, context) {
|
|
8
8
|
const { releaseName, identityToken } = context,
|
|
9
9
|
uri = `${WITHDRAW_API_URI}/${releaseName}`,
|
|
10
10
|
json = {
|
|
@@ -15,5 +15,3 @@ function withdrawOperation(proceed, abort, context) {
|
|
|
15
15
|
proceed();
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
module.exports = withdrawOperation;
|
package/src/options.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const YES_OPTION = "yes";
|
|
4
|
+
export const HELP_OPTION = "help";
|
|
5
|
+
export const TAIL_OPTION = "tail";
|
|
6
|
+
export const FOLLOW_OPTION = "follow";
|
|
7
|
+
export const VERSION_OPTION = "version";
|
|
8
|
+
export const QUIETLY_OPTION = "quietly";
|
|
9
|
+
export const DRY_RUN_OPTION = "dry-run";
|
|
10
|
+
export const HEADLESS_OPTION = "headless";
|
|
11
|
+
export const LOG_LEVEL_OPTION = "log-level";
|
|
12
|
+
export const DEPENDENCIES_OPTION = "dependencies";
|
package/{bin → src}/post.js
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { Readable } from "stream";
|
|
4
|
+
import { headers, contentTypes, statusCodes, requestUtilities, packageUtilities } from "necessary";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { retrieveHost } from "./configuration";
|
|
7
|
+
import { contentFromResponse } from "./utilities/response";
|
|
8
|
+
import { statusMessageFromStatusCode } from "./utilities/status";
|
|
9
|
+
import { SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE } from "./messages";
|
|
10
10
|
|
|
11
11
|
const { getVersion } = packageUtilities,
|
|
12
12
|
{ createPostRequest } = requestUtilities,
|
|
@@ -14,7 +14,7 @@ const { getVersion } = packageUtilities,
|
|
|
14
14
|
{ CONTENT_TYPE_HEADER } = headers,
|
|
15
15
|
{ APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE } = contentTypes;
|
|
16
16
|
|
|
17
|
-
function post(uri, json, callback) {
|
|
17
|
+
export default function post(uri, json, callback) {
|
|
18
18
|
const host = retrieveHost(),
|
|
19
19
|
query = {},
|
|
20
20
|
headers = {
|
|
@@ -72,5 +72,3 @@ function post(uri, json, callback) {
|
|
|
72
72
|
|
|
73
73
|
readable.pipe(postRequest);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
module.exports = post;
|
package/{bin → src}/prepare.js
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function prepare(command, argument, options, main) {
|
|
3
|
+
import changeDirectory from "./changeDirectory";
|
|
4
|
+
|
|
5
|
+
import { DEFAULT_HELP, DEFAULT_VERSION } from "./defaults";
|
|
6
|
+
import { HELP_COMMAND,
|
|
7
|
+
OPEN_COMMAND,
|
|
8
|
+
VERSION_COMMAND,
|
|
9
|
+
SIGN_IN_COMMAND,
|
|
10
|
+
SIGN_OUT_COMMAND,
|
|
11
|
+
INITIALISE_COMMAND,
|
|
12
|
+
SET_OPTIONS_COMMAND,
|
|
13
|
+
SET_SHELL_COMMANDS_COMMAND } from "./commands";
|
|
14
|
+
|
|
15
|
+
export default function prepare(command, argument, options, main) {
|
|
16
16
|
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
17
17
|
|
|
18
18
|
if (false) {
|
|
@@ -56,5 +56,3 @@ function prepare(command, argument, options, main) {
|
|
|
56
56
|
|
|
57
57
|
main(command, argument, options);
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
module.exports = prepare;
|
package/src/uris.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const OPEN_API_URI = "/api/open";
|
|
4
|
+
export const CLONE_API_URI = "/api/clone";
|
|
5
|
+
export const PUBLISH_API_URI = "/api/publish";
|
|
6
|
+
export const SIGN_IN_API_URI = "/api/sign-in";
|
|
7
|
+
export const WITHDRAW_API_URI = "/api/withdraw";
|
|
8
|
+
export const RESET_PASSWORD_API_URI = "/api/reset-password";
|
|
9
|
+
export const CREATE_ACCOUNT_API_URI = "/api/create-account";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { asynchronousUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
const { whilst } = asynchronousUtilities;
|
|
6
6
|
|
|
7
|
-
function executeOperations(operations, callback, context) {
|
|
7
|
+
export default function executeOperations(operations, callback, context) {
|
|
8
8
|
const completed = true;
|
|
9
9
|
|
|
10
10
|
Object.assign(context, {
|
|
@@ -23,10 +23,6 @@ function executeOperations(operations, callback, context) {
|
|
|
23
23
|
}, context);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
module.exports = {
|
|
27
|
-
executeOperations
|
|
28
|
-
};
|
|
29
|
-
|
|
30
26
|
function executeOperation(next, done, context, index) {
|
|
31
27
|
const { operations } = context,
|
|
32
28
|
operationsLength = operations.length,
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { fileSystemUtilities } from "occam-file-system";
|
|
4
4
|
|
|
5
5
|
const { loadRelease } = fileSystemUtilities;
|
|
6
6
|
|
|
7
|
-
function isFileRelease(fileName) {
|
|
7
|
+
export function isFileRelease(fileName) {
|
|
8
8
|
const projectsDirectoryPath = process.cwd(), ///
|
|
9
9
|
release = loadRelease(fileName, projectsDirectoryPath),
|
|
10
10
|
fileRelease = (release !== null);
|
|
11
11
|
|
|
12
12
|
return fileRelease;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
isFileRelease
|
|
17
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { END, DATA, EMPTY_STRING } from "../constants";
|
|
4
4
|
|
|
5
|
-
function contentFromResponse(response, callback) {
|
|
5
|
+
export function contentFromResponse(response, callback) {
|
|
6
6
|
let content = EMPTY_STRING;
|
|
7
7
|
|
|
8
8
|
response.on(DATA, (data) => {
|
|
@@ -13,7 +13,3 @@ function contentFromResponse(response, callback) {
|
|
|
13
13
|
callback(content);
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
contentFromResponse
|
|
19
|
-
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import childProcess from "child_process";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { encodings } from "necessary";
|
|
6
|
+
import { trimTrailingCarriageReturn } from "./string";
|
|
7
7
|
|
|
8
8
|
const { UTF_8_ENCODING } = encodings;
|
|
9
9
|
|
|
10
|
-
function execute(shellCommands) {
|
|
10
|
+
export function execute(shellCommands) {
|
|
11
11
|
let output;
|
|
12
12
|
|
|
13
13
|
try {
|
|
@@ -27,7 +27,3 @@ function execute(shellCommands) {
|
|
|
27
27
|
|
|
28
28
|
return output;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
module.exports = {
|
|
32
|
-
execute
|
|
33
|
-
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function validateAnswer(answer) { return /^(:?yes|no|y|n)$/i.test(answer); }
|
|
4
|
+
|
|
5
|
+
export function validateUsername(username) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(username); }
|
|
6
|
+
|
|
7
|
+
export function validatePassword(password) { return /^[a-zA-Z0-9!@#$%^&*_.,\-]{8,24}$/.test(password); }
|
|
8
|
+
|
|
9
|
+
export function validateAffirmation(affirmation) { return /^(:?yes|no|y|n)$/i.test(affirmation); }
|
|
10
|
+
|
|
11
|
+
export function validateReleaseName(releaseName) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(releaseName); }
|
|
12
|
+
|
|
13
|
+
export function validateEmailAddress(emailAddress) { return /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,16}$/.test(emailAddress); }
|
|
14
|
+
|
|
15
|
+
export function validateShellCommands(shellCommands) { return /^.*$/.test(shellCommands); }
|
|
16
|
+
|
|
17
|
+
export function validateRepositoryName(repositoryName) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{2,16}){0,4}$/.test(repositoryName); }
|
|
18
|
+
|
|
19
|
+
export function validateGitHubHostName(gitHubHostName) { return /^[a-zA-Z0-9.\-]*$/.test(gitHubHostName); }
|
|
20
|
+
|
|
21
|
+
export function validateEmailAddressOrUsername(emailAddressOrUsername) {
|
|
22
|
+
let valid = false;
|
|
23
|
+
|
|
24
|
+
if (!valid) {
|
|
25
|
+
const emailAddress = emailAddressOrUsername; ///
|
|
26
|
+
|
|
27
|
+
valid = validateEmailAddress(emailAddress);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!valid) {
|
|
31
|
+
const username = emailAddressOrUsername; ///
|
|
32
|
+
|
|
33
|
+
valid = validateUsername(username);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return valid;
|
|
37
|
+
}
|
package/src/versions.js
ADDED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const createAccountOperation = require("../operation/createAccount"),
|
|
4
|
-
passwordPromptOperation = require("../operation/prompt/password"),
|
|
5
|
-
usernamePromptOperation = require("../operation/prompt/username"),
|
|
6
|
-
emailAddressPromptOperation = require("../operation/prompt/emailAddress"),
|
|
7
|
-
updateIdentityTokenOperation = require("../operation/updateIdentityToken");
|
|
8
|
-
|
|
9
|
-
const { executeOperations } = require("../utilities/operation");
|
|
10
|
-
|
|
11
|
-
function createAccountAction(emailAddress) {
|
|
12
|
-
const username = null,
|
|
13
|
-
password = null,
|
|
14
|
-
operations = [
|
|
15
|
-
emailAddressPromptOperation,
|
|
16
|
-
usernamePromptOperation,
|
|
17
|
-
passwordPromptOperation,
|
|
18
|
-
createAccountOperation,
|
|
19
|
-
updateIdentityTokenOperation
|
|
20
|
-
],
|
|
21
|
-
context = {
|
|
22
|
-
emailAddress,
|
|
23
|
-
username,
|
|
24
|
-
password
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
executeOperations(operations, (completed) => {
|
|
28
|
-
const { message } = context;
|
|
29
|
-
|
|
30
|
-
console.log(message);
|
|
31
|
-
}, context);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = createAccountAction;
|