@suitegeezus/suitecloud-cli 3.1.4
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/CONTRIBUTING.md +7 -0
- package/DELTA.md +235 -0
- package/README.md +107 -0
- package/docs/Command.md +299 -0
- package/messages.json +317 -0
- package/package.json +51 -0
- package/postinstall.js +8 -0
- package/resources/FUTC-LICENSE.txt +115 -0
- package/src/ApplicationConstants.js +87 -0
- package/src/CLI.js +202 -0
- package/src/CLIException.js +21 -0
- package/src/ExecutionEnvironmentContext.js +39 -0
- package/src/SdkExecutionContext.js +90 -0
- package/src/SdkExecutor.js +160 -0
- package/src/commands/Command.js +158 -0
- package/src/commands/account/manageauth/ManageAccountAction.js +126 -0
- package/src/commands/account/manageauth/ManageAccountCommand.js +20 -0
- package/src/commands/account/manageauth/ManageAccountInputHandler.js +215 -0
- package/src/commands/account/manageauth/ManageAccountOutputHandler.js +30 -0
- package/src/commands/account/setup/SetupAction.js +39 -0
- package/src/commands/account/setup/SetupCommand.js +21 -0
- package/src/commands/account/setup/SetupInputHandler.js +169 -0
- package/src/commands/account/setup/SetupOutputHandler.js +65 -0
- package/src/commands/account/setupci/AccountSetupCiAction.js +58 -0
- package/src/commands/account/setupci/AccountSetupCiCommand.js +20 -0
- package/src/commands/account/setupci/AccountSetupCiConstants.js +21 -0
- package/src/commands/account/setupci/AccountSetupCiOutputHandler.js +40 -0
- package/src/commands/account/setupci/AccountSetupCiValidation.js +100 -0
- package/src/commands/base/BaseAction.js +37 -0
- package/src/commands/base/BaseInputHandler.js +24 -0
- package/src/commands/base/BaseOutputHandler.js +30 -0
- package/src/commands/custom/hello/Action.js +58 -0
- package/src/commands/custom/hello/Command.js +20 -0
- package/src/commands/custom/hello/Handler.js +26 -0
- package/src/commands/custom/hello/README.md +78 -0
- package/src/commands/custom/hook/Action.js +28 -0
- package/src/commands/custom/hook/Command.js +22 -0
- package/src/commands/custom/hook/InputHandler.js +8 -0
- package/src/commands/custom/hook/OutputHandler.js +8 -0
- package/src/commands/custom/hook/README.md +32 -0
- package/src/commands/file/create/CreateFileAction.js +89 -0
- package/src/commands/file/create/CreateFileCommand.js +20 -0
- package/src/commands/file/create/CreateFileInputHandler.js +175 -0
- package/src/commands/file/create/CreateFileOutputHandler.js +22 -0
- package/src/commands/file/import/ImportFilesAction.js +112 -0
- package/src/commands/file/import/ImportFilesCommand.js +22 -0
- package/src/commands/file/import/ImportFilesInputHandler.js +130 -0
- package/src/commands/file/import/ImportFilesOutputHandler.js +53 -0
- package/src/commands/file/list/ListFilesAction.js +55 -0
- package/src/commands/file/list/ListFilesCommand.js +20 -0
- package/src/commands/file/list/ListFilesInputHandler.js +55 -0
- package/src/commands/file/list/ListFilesOutputHandler.js +24 -0
- package/src/commands/file/upload/UploadFilesAction.js +67 -0
- package/src/commands/file/upload/UploadFilesCommand.js +20 -0
- package/src/commands/file/upload/UploadFilesInputHandler.js +125 -0
- package/src/commands/file/upload/UploadFilesOutputHandler.js +49 -0
- package/src/commands/object/create/CreateObjectAction.js +33 -0
- package/src/commands/object/create/CreateObjectCommand.js +19 -0
- package/src/commands/object/create/CreateObjectInputHandler.js +82 -0
- package/src/commands/object/import/ImportObjectsAction.js +225 -0
- package/src/commands/object/import/ImportObjectsCommand.js +20 -0
- package/src/commands/object/import/ImportObjectsInputHandler.js +310 -0
- package/src/commands/object/import/ImportObjectsOutputHandler.js +114 -0
- package/src/commands/object/list/ListObjectsAction.js +62 -0
- package/src/commands/object/list/ListObjectsCommand.js +20 -0
- package/src/commands/object/list/ListObjectsInputHandler.js +148 -0
- package/src/commands/object/list/ListObjectsOutputHandler.js +29 -0
- package/src/commands/object/update/UpdateAction.js +138 -0
- package/src/commands/object/update/UpdateCommand.js +20 -0
- package/src/commands/object/update/UpdateInputHandler.js +170 -0
- package/src/commands/object/update/UpdateOutputHandler.js +61 -0
- package/src/commands/project/adddependencies/AddDependenciesAction.js +55 -0
- package/src/commands/project/adddependencies/AddDependenciesCommand.js +19 -0
- package/src/commands/project/adddependencies/AddDependenciesOutputHandler.js +114 -0
- package/src/commands/project/create/CreateProjectAction.js +370 -0
- package/src/commands/project/create/CreateProjectCommand.js +20 -0
- package/src/commands/project/create/CreateProjectInputHandler.js +169 -0
- package/src/commands/project/create/CreateProjectOutputHandler.js +36 -0
- package/src/commands/project/deploy/DeployAction.js +161 -0
- package/src/commands/project/deploy/DeployCommand.js +20 -0
- package/src/commands/project/deploy/DeployInputHandler.js +100 -0
- package/src/commands/project/deploy/DeployOutputHandler.js +49 -0
- package/src/commands/project/package/PackageAction.js +59 -0
- package/src/commands/project/package/PackageCommand.js +18 -0
- package/src/commands/project/package/PackageOutputHandler.js +18 -0
- package/src/commands/project/validate/ValidateAction.js +106 -0
- package/src/commands/project/validate/ValidateCommand.js +20 -0
- package/src/commands/project/validate/ValidateInputHandler.js +92 -0
- package/src/commands/project/validate/ValidateOutputHandler.js +74 -0
- package/src/core/CommandActionExecutor.js +347 -0
- package/src/core/CommandAuthentication.js +13 -0
- package/src/core/CommandOptionsValidator.js +42 -0
- package/src/core/CommandRegistrationService.js +130 -0
- package/src/core/CommandsMetadataService.js +104 -0
- package/src/core/extensibility/CLIConfigurationService.js +192 -0
- package/src/core/extensibility/CommandUserExtension.js +64 -0
- package/src/core/sdksetup/SdkDownloadService.js +109 -0
- package/src/core/sdksetup/SdkLicense.js +39 -0
- package/src/core/sdksetup/SdkProperties.js +51 -0
- package/src/loggers/ConsoleLogger.js +32 -0
- package/src/loggers/LoggerFontFormatter.mjs +17 -0
- package/src/loggers/LoggerOsConstants.js +12 -0
- package/src/loggers/NodeConsoleLogger.js +47 -0
- package/src/metadata/CommandGenerators.json +92 -0
- package/src/metadata/NodeCommandsMetadata.json +139 -0
- package/src/metadata/ObjectTypesMetadata.js +615 -0
- package/src/metadata/SdkCommandsMetadata.json +846 -0
- package/src/metadata/SdkCommandsMetadataPatch.json +130 -0
- package/src/metadata/SuiteScriptModulesMetadata.js +152 -0
- package/src/metadata/SuiteScriptTypesMetadata.js +64 -0
- package/src/services/AccountFileCabinetService.js +86 -0
- package/src/services/EnvironmentInformationService.js +31 -0
- package/src/services/ExecutionContextService.js +108 -0
- package/src/services/FileCabinetService.js +65 -0
- package/src/services/FileSystemService.js +245 -0
- package/src/services/NodeTranslationService.js +22 -0
- package/src/services/NpmInstallRunner.js +33 -0
- package/src/services/ProjectInfoService.js +209 -0
- package/src/services/SuiteCloudAuthProxyService.js +469 -0
- package/src/services/TranslationKeys.js +506 -0
- package/src/services/TranslationService.js +30 -0
- package/src/services/actionresult/ActionResult.js +129 -0
- package/src/services/actionresult/AuthenticateActionResult.js +85 -0
- package/src/services/actionresult/CreateProjectActionResult.js +100 -0
- package/src/services/actionresult/DeployActionResult.js +69 -0
- package/src/services/actionresult/HelloActionResult.js +13 -0
- package/src/services/actionresult/ManageAccountActionResult.js +70 -0
- package/src/services/settings/CLISettings.js +46 -0
- package/src/services/settings/CLISettingsService.js +132 -0
- package/src/suitecloud.js +33 -0
- package/src/templates/TemplateKeys.js +25 -0
- package/src/templates/objects/commerceextension.xml +9 -0
- package/src/templates/projectconfigs/default_gitignore.template +47 -0
- package/src/templates/projectconfigs/sdf.config.js +4 -0
- package/src/templates/projectconfigs/suitecloud.config.js +4 -0
- package/src/templates/scripts/blankscript.js +3 -0
- package/src/templates/unittest/jest.config.js.template +7 -0
- package/src/templates/unittest/jsconfig.json.template +5 -0
- package/src/templates/unittest/package.json.template +12 -0
- package/src/templates/unittest/sample-test.js.template +37 -0
- package/src/templates/unittest/suitecloud.config.js.template +15 -0
- package/src/ui/CliSpinner.js +34 -0
- package/src/utils/AccountCredentialsFormatter.js +62 -0
- package/src/utils/AccountSpecificValuesUtils.js +55 -0
- package/src/utils/ActionResultUtils.js +47 -0
- package/src/utils/ApplyInstallationPreferencesUtils.js +41 -0
- package/src/utils/AuthenticationUtils.js +262 -0
- package/src/utils/CommandUtils.js +50 -0
- package/src/utils/CryptoUtils.js +41 -0
- package/src/utils/ExceptionUtils.js +33 -0
- package/src/utils/FileUtils.js +43 -0
- package/src/utils/SdkOperationResult.js +68 -0
- package/src/utils/SdkOperationResultUtils.js +20 -0
- package/src/utils/ValidationErrorsFormatter.js +23 -0
- package/src/utils/http/HttpConstants.js +39 -0
- package/src/utils/http/ProxyAgent.js +110 -0
- package/src/validation/InteractiveAnswersValidator.js +205 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const { default: { prompt } } = require('inquirer');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
10
|
+
const CommandUtils = require('../../../utils/CommandUtils');
|
|
11
|
+
const ApplicationConstants = require('../../../ApplicationConstants');
|
|
12
|
+
const FileSystemService = require('../../../services/FileSystemService');
|
|
13
|
+
const BaseInputHandler = require('../../base/BaseInputHandler');
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
COMMAND_CREATEPROJECT: { QUESTIONS, MESSAGES },
|
|
17
|
+
YES,
|
|
18
|
+
NO,
|
|
19
|
+
} = require('../../../services/TranslationKeys');
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
validateFieldIsNotEmpty,
|
|
23
|
+
showValidationResults,
|
|
24
|
+
validateFieldHasNoSpaces,
|
|
25
|
+
validateFieldIsLowerCase,
|
|
26
|
+
validatePublisherId,
|
|
27
|
+
validateProjectVersion,
|
|
28
|
+
validateAlphanumericHyphenUnderscoreExtended,
|
|
29
|
+
validateMaximumLength,
|
|
30
|
+
} = require('../../../validation/InteractiveAnswersValidator');
|
|
31
|
+
|
|
32
|
+
const COMMAND_OPTIONS = {
|
|
33
|
+
OVERWRITE: 'overwrite',
|
|
34
|
+
PARENT_DIRECTORY: 'parentdirectory',
|
|
35
|
+
PROJECT_ID: 'projectid',
|
|
36
|
+
PROJECT_NAME: 'projectname',
|
|
37
|
+
PROJECT_VERSION: 'projectversion',
|
|
38
|
+
PUBLISHER_ID: 'publisherid',
|
|
39
|
+
TYPE: 'type',
|
|
40
|
+
INCLUDE_UNIT_TESTING: 'includeunittesting',
|
|
41
|
+
PROJECT_ABSOLUTE_PATH: 'projectabsolutepath',
|
|
42
|
+
PROJECT_FOLDER_NAME: 'projectfoldername',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const ACP_PROJECT_TYPE_DISPLAY = 'Account Customization Project';
|
|
46
|
+
const SUITEAPP_PROJECT_TYPE_DISPLAY = 'SuiteApp';
|
|
47
|
+
const DEFAULT_PROJECT_VERSION = '1.0.0';
|
|
48
|
+
|
|
49
|
+
module.exports = class CreateObjectInputHandler extends BaseInputHandler {
|
|
50
|
+
constructor(options) {
|
|
51
|
+
super(options);
|
|
52
|
+
this._fileSystemService = new FileSystemService();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async getParameters(params) {
|
|
56
|
+
const answers = await prompt([
|
|
57
|
+
{
|
|
58
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
59
|
+
name: COMMAND_OPTIONS.TYPE,
|
|
60
|
+
message: NodeTranslationService.getMessage(QUESTIONS.CHOOSE_PROJECT_TYPE),
|
|
61
|
+
default: ApplicationConstants.PROJECT_ACP,
|
|
62
|
+
choices: [
|
|
63
|
+
{
|
|
64
|
+
name: ACP_PROJECT_TYPE_DISPLAY,
|
|
65
|
+
value: ApplicationConstants.PROJECT_ACP,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: SUITEAPP_PROJECT_TYPE_DISPLAY,
|
|
69
|
+
value: ApplicationConstants.PROJECT_SUITEAPP,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: CommandUtils.INQUIRER_TYPES.INPUT,
|
|
75
|
+
name: COMMAND_OPTIONS.PROJECT_NAME,
|
|
76
|
+
message: NodeTranslationService.getMessage(QUESTIONS.ENTER_PROJECT_NAME),
|
|
77
|
+
filter: (fieldValue) => fieldValue.trim(),
|
|
78
|
+
validate: (fieldValue) => showValidationResults(fieldValue.trim(), validateFieldIsNotEmpty, validateAlphanumericHyphenUnderscoreExtended),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
when: function (response) {
|
|
82
|
+
return response[COMMAND_OPTIONS.TYPE] === ApplicationConstants.PROJECT_SUITEAPP;
|
|
83
|
+
},
|
|
84
|
+
type: CommandUtils.INQUIRER_TYPES.INPUT,
|
|
85
|
+
name: COMMAND_OPTIONS.PUBLISHER_ID,
|
|
86
|
+
message: NodeTranslationService.getMessage(QUESTIONS.ENTER_PUBLISHER_ID),
|
|
87
|
+
validate: (fieldValue) => showValidationResults(fieldValue, validatePublisherId, validateMaximumLength),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
when: function (response) {
|
|
91
|
+
return response.type === ApplicationConstants.PROJECT_SUITEAPP;
|
|
92
|
+
},
|
|
93
|
+
type: CommandUtils.INQUIRER_TYPES.INPUT,
|
|
94
|
+
name: COMMAND_OPTIONS.PROJECT_ID,
|
|
95
|
+
message: NodeTranslationService.getMessage(QUESTIONS.ENTER_PROJECT_ID),
|
|
96
|
+
validate: (fieldValue) =>
|
|
97
|
+
showValidationResults(fieldValue, validateFieldIsNotEmpty, validateFieldHasNoSpaces, (fieldValue) =>
|
|
98
|
+
validateFieldIsLowerCase(COMMAND_OPTIONS.PROJECT_ID, fieldValue)
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
when: function (response) {
|
|
103
|
+
return response.type === ApplicationConstants.PROJECT_SUITEAPP;
|
|
104
|
+
},
|
|
105
|
+
type: CommandUtils.INQUIRER_TYPES.INPUT,
|
|
106
|
+
name: COMMAND_OPTIONS.PROJECT_VERSION,
|
|
107
|
+
message: NodeTranslationService.getMessage(QUESTIONS.ENTER_PROJECT_VERSION),
|
|
108
|
+
default: DEFAULT_PROJECT_VERSION,
|
|
109
|
+
validate: (fieldValue) => showValidationResults(fieldValue, validateProjectVersion),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
113
|
+
name: COMMAND_OPTIONS.INCLUDE_UNIT_TESTING,
|
|
114
|
+
message: NodeTranslationService.getMessage(QUESTIONS.INCLUDE_UNIT_TESTING),
|
|
115
|
+
default: true,
|
|
116
|
+
choices: [
|
|
117
|
+
{ name: NodeTranslationService.getMessage(YES), value: true },
|
|
118
|
+
{ name: NodeTranslationService.getMessage(NO), value: false },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
const projectFolderName = this._getProjectFolderName(answers);
|
|
124
|
+
const projectAbsolutePath = path.join(this._executionPath, projectFolderName);
|
|
125
|
+
|
|
126
|
+
if (this._fileSystemService.folderExists(projectAbsolutePath) && !this._fileSystemService.isFolderEmpty(projectAbsolutePath)) {
|
|
127
|
+
const overwriteAnswer = await prompt([
|
|
128
|
+
{
|
|
129
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
130
|
+
name: COMMAND_OPTIONS.OVERWRITE,
|
|
131
|
+
message: NodeTranslationService.getMessage(QUESTIONS.OVERWRITE_PROJECT, projectAbsolutePath),
|
|
132
|
+
default: false,
|
|
133
|
+
choices: [
|
|
134
|
+
{ name: NodeTranslationService.getMessage(NO), value: false },
|
|
135
|
+
{ name: NodeTranslationService.getMessage(YES), value: true },
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
]);
|
|
139
|
+
answers[COMMAND_OPTIONS.OVERWRITE] = overwriteAnswer[COMMAND_OPTIONS.OVERWRITE];
|
|
140
|
+
if (!overwriteAnswer[COMMAND_OPTIONS.OVERWRITE]) {
|
|
141
|
+
throw NodeTranslationService.getMessage(MESSAGES.PROJECT_CREATION_CANCELED);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (projectFolderName) {
|
|
146
|
+
answers[COMMAND_OPTIONS.PARENT_DIRECTORY] = projectAbsolutePath;
|
|
147
|
+
answers[COMMAND_OPTIONS.PROJECT_FOLDER_NAME] = projectFolderName;
|
|
148
|
+
} else {
|
|
149
|
+
// parentdirectory is a mandatory option in javaCLI but it must be computed in the nodeCLI
|
|
150
|
+
answers[COMMAND_OPTIONS.PARENT_DIRECTORY] = 'not_specified';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return answers;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
_getProjectFolderName(params) {
|
|
157
|
+
switch (params[COMMAND_OPTIONS.TYPE]) {
|
|
158
|
+
case ApplicationConstants.PROJECT_SUITEAPP:
|
|
159
|
+
return (params[COMMAND_OPTIONS.PUBLISHER_ID] && params[COMMAND_OPTIONS.PROJECT_ID])
|
|
160
|
+
? params[COMMAND_OPTIONS.PUBLISHER_ID] + '.' + params[COMMAND_OPTIONS.PROJECT_ID]
|
|
161
|
+
: 'not_specified';
|
|
162
|
+
case ApplicationConstants.PROJECT_ACP:
|
|
163
|
+
return params[COMMAND_OPTIONS.PROJECT_NAME] ? params[COMMAND_OPTIONS.PROJECT_NAME] : 'not_specified';
|
|
164
|
+
default:
|
|
165
|
+
// if --type parameter isn't correct, it doesn't matter the project folder name. It will throw a validation error later
|
|
166
|
+
return 'not_specified';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
const BaseOutputHandler = require('../../base/BaseOutputHandler');
|
|
7
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
8
|
+
const ActionResultUtils = require('../../../utils/ActionResultUtils');
|
|
9
|
+
const {
|
|
10
|
+
COMMAND_CREATEPROJECT: { MESSAGES },
|
|
11
|
+
} = require('../../../services/TranslationKeys');
|
|
12
|
+
|
|
13
|
+
module.exports = class CreateProjectOutputHandler extends BaseOutputHandler {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super(options);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
parse(actionResult) {
|
|
19
|
+
ActionResultUtils.logResultMessage(actionResult, this._log);
|
|
20
|
+
|
|
21
|
+
const projectCreatedMessage = NodeTranslationService.getMessage(MESSAGES.PROJECT_CREATED, actionResult.projectName);
|
|
22
|
+
this._log.result(projectCreatedMessage);
|
|
23
|
+
|
|
24
|
+
if (actionResult.includeUnitTesting) {
|
|
25
|
+
const sampleUnitTestMessage = NodeTranslationService.getMessage(MESSAGES.SAMPLE_UNIT_TEST_ADDED);
|
|
26
|
+
this._log.result(sampleUnitTestMessage);
|
|
27
|
+
if (!actionResult.npmPackageInitialized) {
|
|
28
|
+
this._log.error(NodeTranslationService.getMessage(MESSAGES.INIT_NPM_DEPENDENCIES_FAILED));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const navigateToProjectMessage = NodeTranslationService.getMessage(MESSAGES.NAVIGATE_TO_FOLDER, actionResult.projectDirectory);
|
|
33
|
+
this._log.result(navigateToProjectMessage);
|
|
34
|
+
return actionResult;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const SdkOperationResultUtils = require('../../../utils/SdkOperationResultUtils');
|
|
8
|
+
const { ActionResult } = require('../../../services/actionresult/ActionResult');
|
|
9
|
+
const DeployActionResult = require('../../../services/actionresult/DeployActionResult');
|
|
10
|
+
const CommandUtils = require('../../../utils/CommandUtils');
|
|
11
|
+
const ProjectInfoService = require('../../../services/ProjectInfoService');
|
|
12
|
+
const AccountSpecificValuesUtils = require('../../../utils/AccountSpecificValuesUtils');
|
|
13
|
+
const ApplyInstallationPreferencesUtils = require('../../../utils/ApplyInstallationPreferencesUtils');
|
|
14
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
15
|
+
const { executeWithSpinner } = require('../../../ui/CliSpinner');
|
|
16
|
+
const SdkExecutionContext = require('../../../SdkExecutionContext');
|
|
17
|
+
const BaseAction = require('../../base/BaseAction');
|
|
18
|
+
const { getProjectDefaultAuthId } = require('../../../utils/AuthenticationUtils');
|
|
19
|
+
|
|
20
|
+
const { PROJECT_SUITEAPP } = require('../../../ApplicationConstants');
|
|
21
|
+
|
|
22
|
+
const { COMMAND_DEPLOY } = require('../../../services/TranslationKeys');
|
|
23
|
+
|
|
24
|
+
const COMMAND = {
|
|
25
|
+
OPTIONS: {
|
|
26
|
+
AUTH_ID: 'authid',
|
|
27
|
+
ACCOUNT_SPECIFIC_VALUES: 'accountspecificvalues',
|
|
28
|
+
LOG: 'log',
|
|
29
|
+
PROJECT: 'project',
|
|
30
|
+
},
|
|
31
|
+
FLAGS: {
|
|
32
|
+
NO_PREVIEW: 'no_preview',
|
|
33
|
+
PREVIEW: 'dryrun',
|
|
34
|
+
SKIP_WARNING: 'skip_warning',
|
|
35
|
+
VALIDATE: 'validate',
|
|
36
|
+
APPLY_INSTALLATION_PREFERENCES: 'applyinstallprefs',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const PREVIEW_COMMAND = 'preview';
|
|
41
|
+
|
|
42
|
+
module.exports = class DeployAction extends (
|
|
43
|
+
BaseAction
|
|
44
|
+
) {
|
|
45
|
+
constructor(options) {
|
|
46
|
+
super(options);
|
|
47
|
+
const projectInfoService = new ProjectInfoService(this._projectFolder);
|
|
48
|
+
this._projectType = projectInfoService.getProjectType();
|
|
49
|
+
this._projectName = projectInfoService.getProjectName();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
preExecute(params) {
|
|
53
|
+
AccountSpecificValuesUtils.validate(params, this._projectFolder);
|
|
54
|
+
ApplyInstallationPreferencesUtils.validate(params, this._projectFolder, this._commandMetadata.name, this._log);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
...params,
|
|
58
|
+
[COMMAND.OPTIONS.PROJECT]: CommandUtils.quoteString(this._projectFolder),
|
|
59
|
+
...AccountSpecificValuesUtils.transformArgument(params),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async execute(params) {
|
|
64
|
+
try {
|
|
65
|
+
let flags = [COMMAND.FLAGS.NO_PREVIEW, COMMAND.FLAGS.SKIP_WARNING];
|
|
66
|
+
|
|
67
|
+
if (params[COMMAND.FLAGS.VALIDATE]) {
|
|
68
|
+
delete params[COMMAND.FLAGS.VALIDATE];
|
|
69
|
+
flags.push(COMMAND.FLAGS.VALIDATE);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (params[COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES]) {
|
|
73
|
+
delete params[COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES];
|
|
74
|
+
flags.push(COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (params[COMMAND.FLAGS.PREVIEW]) {
|
|
78
|
+
return await this._preview(params, flags);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return await this._deploy(params, flags);
|
|
82
|
+
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return ActionResult.Builder.withErrors([error]).build();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async _preview(params, flags) {
|
|
89
|
+
try {
|
|
90
|
+
delete params[COMMAND.FLAGS.PREVIEW];
|
|
91
|
+
flags.splice(flags.indexOf(COMMAND.FLAGS.NO_PREVIEW), 1);
|
|
92
|
+
flags.splice(flags.indexOf(COMMAND.FLAGS.SKIP_WARNING), 1);
|
|
93
|
+
|
|
94
|
+
if (flags.includes(COMMAND.FLAGS.VALIDATE)) {
|
|
95
|
+
throw NodeTranslationService.getMessage(COMMAND_DEPLOY.ERRORS.VALIDATE_AND_DRYRUN_OPTIONS_PASSED);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const sdkParams = CommandUtils.extractCommandOptions(params, this._commandMetadata);
|
|
99
|
+
|
|
100
|
+
const executionContextForDryrun = SdkExecutionContext.Builder.forCommand(PREVIEW_COMMAND)
|
|
101
|
+
.integration()
|
|
102
|
+
.addParams(sdkParams)
|
|
103
|
+
.addFlags(flags)
|
|
104
|
+
.build();
|
|
105
|
+
|
|
106
|
+
const dryrunOperationResult = await executeWithSpinner({
|
|
107
|
+
action: this._sdkExecutor.execute(executionContextForDryrun),
|
|
108
|
+
message: NodeTranslationService.getMessage(
|
|
109
|
+
COMMAND_DEPLOY.MESSAGES.PREVIEWING,
|
|
110
|
+
this._projectName,
|
|
111
|
+
this._authId
|
|
112
|
+
),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return dryrunOperationResult.status === SdkOperationResultUtils.STATUS.SUCCESS
|
|
116
|
+
? ActionResult.Builder.withData(dryrunOperationResult.data).withResultMessage(dryrunOperationResult.resultMessage).build()
|
|
117
|
+
: ActionResult.Builder.withErrors(dryrunOperationResult.errorMessages).build();
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return ActionResult.Builder.withErrors([error]).build();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async _deploy(params, flags) {
|
|
124
|
+
try {
|
|
125
|
+
const sdkParams = CommandUtils.extractCommandOptions(params, this._commandMetadata);
|
|
126
|
+
|
|
127
|
+
const executionContextForDeploy = SdkExecutionContext.Builder.forCommand(this._commandMetadata.sdkCommand)
|
|
128
|
+
.integration()
|
|
129
|
+
.addParams(sdkParams)
|
|
130
|
+
.addFlags(flags)
|
|
131
|
+
.build();
|
|
132
|
+
|
|
133
|
+
const operationResult = await executeWithSpinner({
|
|
134
|
+
action: this._sdkExecutor.execute(executionContextForDeploy),
|
|
135
|
+
message: NodeTranslationService.getMessage(
|
|
136
|
+
COMMAND_DEPLOY.MESSAGES.DEPLOYING,
|
|
137
|
+
this._projectName,
|
|
138
|
+
this._authId
|
|
139
|
+
),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const isServerValidation = !!sdkParams[COMMAND.FLAGS.VALIDATE];
|
|
143
|
+
const isApplyInstallationPreferences = this._projectType === PROJECT_SUITEAPP && flags.includes(COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES);
|
|
144
|
+
|
|
145
|
+
return operationResult.status === SdkOperationResultUtils.STATUS.SUCCESS
|
|
146
|
+
? DeployActionResult.Builder.withData(operationResult.data)
|
|
147
|
+
.withResultMessage(operationResult.resultMessage)
|
|
148
|
+
.withServerValidation(isServerValidation)
|
|
149
|
+
.withAppliedInstallationPreferences(isApplyInstallationPreferences)
|
|
150
|
+
.withProjectType(this._projectType)
|
|
151
|
+
.withProjectFolder(this._projectFolder)
|
|
152
|
+
.withCommandParameters(sdkParams)
|
|
153
|
+
.withCommandFlags(flags)
|
|
154
|
+
.build()
|
|
155
|
+
: DeployActionResult.Builder.withErrors(operationResult.errorMessages).withCommandParameters(sdkParams)
|
|
156
|
+
.withCommandFlags(flags).build();
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return DeployActionResult.Builder.withErrors([error]).build();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const Command = require('../../Command');
|
|
8
|
+
const DeployAction = require('./DeployAction');
|
|
9
|
+
const DeployInputHandler = require('./DeployInputHandler');
|
|
10
|
+
const DeployOutputHandler = require('./DeployOutputHandler');
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
create(options) {
|
|
14
|
+
return Command.Builder.withOptions(options)
|
|
15
|
+
.withAction(DeployAction)
|
|
16
|
+
.withInput(DeployInputHandler)
|
|
17
|
+
.withOutput(DeployOutputHandler)
|
|
18
|
+
.build();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const { default: { prompt } } = require('inquirer');
|
|
8
|
+
const CommandUtils = require('../../../utils/CommandUtils');
|
|
9
|
+
const ProjectInfoService = require('../../../services/ProjectInfoService');
|
|
10
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
11
|
+
const BaseInputHandler = require('../../base/BaseInputHandler');
|
|
12
|
+
const { ACCOUNT_SPECIFIC_VALUES_OPTIONS } = require('../../../utils/AccountSpecificValuesUtils');
|
|
13
|
+
const { LINKS, PROJECT_ACP, PROJECT_SUITEAPP } = require('../../../ApplicationConstants');
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
COMMAND_DEPLOY: { QUESTIONS, QUESTIONS_CHOICES, MESSAGES },
|
|
17
|
+
NO,
|
|
18
|
+
YES,
|
|
19
|
+
} = require('../../../services/TranslationKeys');
|
|
20
|
+
|
|
21
|
+
const COMMAND = {
|
|
22
|
+
OPTIONS: {
|
|
23
|
+
ACCOUNT_SPECIFIC_VALUES: 'accountspecificvalues',
|
|
24
|
+
LOG: 'log',
|
|
25
|
+
PROJECT: 'project',
|
|
26
|
+
},
|
|
27
|
+
FLAGS: {
|
|
28
|
+
NO_PREVIEW: 'no_preview',
|
|
29
|
+
SKIP_WARNING: 'skip_warning',
|
|
30
|
+
VALIDATE: 'validate',
|
|
31
|
+
APPLY_INSTALLATION_PREFERENCES: 'applyinstallprefs',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = class DeployInputHandler extends BaseInputHandler {
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super(options);
|
|
38
|
+
|
|
39
|
+
this._projectInfoService = new ProjectInfoService(this._projectFolder);
|
|
40
|
+
this._projectType = this._projectInfoService.getProjectType();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getParameters(params) {
|
|
44
|
+
const isSuiteAppProject = this._projectType === PROJECT_SUITEAPP;
|
|
45
|
+
const isACProject = this._projectType === PROJECT_ACP;
|
|
46
|
+
|
|
47
|
+
const answers = await prompt([
|
|
48
|
+
{
|
|
49
|
+
when: isSuiteAppProject && this._projectInfoService.hasLockAndHideFiles(),
|
|
50
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
51
|
+
name: COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES,
|
|
52
|
+
message: NodeTranslationService.getMessage(QUESTIONS.APPLY_INSTALLATION_PREFERENCES),
|
|
53
|
+
default: false,
|
|
54
|
+
choices: [
|
|
55
|
+
{ name: NodeTranslationService.getMessage(YES), value: true },
|
|
56
|
+
{ name: NodeTranslationService.getMessage(NO), value: false },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
when: isACProject,
|
|
61
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
62
|
+
name: COMMAND.OPTIONS.ACCOUNT_SPECIFIC_VALUES,
|
|
63
|
+
message: NodeTranslationService.getMessage(QUESTIONS.ACCOUNT_SPECIFIC_VALUES),
|
|
64
|
+
default: ACCOUNT_SPECIFIC_VALUES_OPTIONS.ERROR,
|
|
65
|
+
choices: [
|
|
66
|
+
{
|
|
67
|
+
name: NodeTranslationService.getMessage(QUESTIONS_CHOICES.ACCOUNT_SPECIFIC_VALUES.DISPLAY_WARNING),
|
|
68
|
+
value: ACCOUNT_SPECIFIC_VALUES_OPTIONS.WARNING,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: NodeTranslationService.getMessage(QUESTIONS_CHOICES.ACCOUNT_SPECIFIC_VALUES.CANCEL_PROCESS),
|
|
72
|
+
value: ACCOUNT_SPECIFIC_VALUES_OPTIONS.ERROR,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: CommandUtils.INQUIRER_TYPES.LIST,
|
|
78
|
+
name: COMMAND.FLAGS.VALIDATE,
|
|
79
|
+
message: NodeTranslationService.getMessage(QUESTIONS.PERFORM_LOCAL_VALIDATION),
|
|
80
|
+
default: true,
|
|
81
|
+
choices: [
|
|
82
|
+
{ name: NodeTranslationService.getMessage(YES), value: true },
|
|
83
|
+
{ name: NodeTranslationService.getMessage(NO), value: false },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
if (isSuiteAppProject && !answers.hasOwnProperty(COMMAND.FLAGS.APPLY_INSTALLATION_PREFERENCES)) {
|
|
89
|
+
this._log.info(
|
|
90
|
+
NodeTranslationService.getMessage(
|
|
91
|
+
MESSAGES.NOT_ASKING_INSTALLATION_PREFERENCES_REASON,
|
|
92
|
+
LINKS.HOW_TO.CREATE_INSTALLATION_PREFERENCES,
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
answers[COMMAND.OPTIONS.PROJECT] = this._projectFolder;
|
|
97
|
+
|
|
98
|
+
return answers;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
7
|
+
const ActionResultUtils = require('../../../utils/ActionResultUtils');
|
|
8
|
+
const BaseOutputHandler = require('../../base/BaseOutputHandler');
|
|
9
|
+
|
|
10
|
+
const { PROJECT_SUITEAPP } = require('../../../ApplicationConstants');
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
COMMAND_DEPLOY: { MESSAGES },
|
|
14
|
+
} = require('../../../services/TranslationKeys');
|
|
15
|
+
|
|
16
|
+
module.exports = class DeployOutputHandler extends BaseOutputHandler {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super(options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
parse(actionResult) {
|
|
22
|
+
this._showApplyInstallationPreferencesOptionMessage(
|
|
23
|
+
actionResult.projectType,
|
|
24
|
+
actionResult.appliedInstallationPreferences,
|
|
25
|
+
actionResult.projectFolder
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (actionResult.withServerValidation) {
|
|
29
|
+
this._log.info(NodeTranslationService.getMessage(MESSAGES.LOCALLY_VALIDATED, actionResult.projectFolder));
|
|
30
|
+
}
|
|
31
|
+
if (actionResult.resultMessage) {
|
|
32
|
+
ActionResultUtils.logResultMessage(actionResult, this._log);
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(actionResult.data)) {
|
|
35
|
+
actionResult.data.forEach((message) => this._log.result(message));
|
|
36
|
+
}
|
|
37
|
+
return actionResult;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_showApplyInstallationPreferencesOptionMessage(projectType, isApplyInstallationPreferences, projectFolder) {
|
|
41
|
+
if (projectType === PROJECT_SUITEAPP) {
|
|
42
|
+
if (isApplyInstallationPreferences) {
|
|
43
|
+
this._log.info(NodeTranslationService.getMessage(MESSAGES.APPLYING_CONTENT_PROTECTION, projectFolder));
|
|
44
|
+
} else {
|
|
45
|
+
this._log.info(NodeTranslationService.getMessage(MESSAGES.NOT_APPLYING_CONTENT_PROTECTION, projectFolder));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const BaseAction = require('../../base/BaseAction');
|
|
9
|
+
const SdkExecutionContext = require('../../../SdkExecutionContext');
|
|
10
|
+
const ProjectInfoService = require('../../../services/ProjectInfoService');
|
|
11
|
+
const { executeWithSpinner } = require('../../../ui/CliSpinner');
|
|
12
|
+
const SdkOperationResultUtils = require('../../../utils/SdkOperationResultUtils');
|
|
13
|
+
const CommandUtils = require('../../../utils/CommandUtils');
|
|
14
|
+
const { ActionResult } = require('../../../services/actionresult/ActionResult');
|
|
15
|
+
const NodeTranslationService = require('../../../services/NodeTranslationService');
|
|
16
|
+
const AccountSpecificValuesUtils = require('../../../utils/AccountSpecificValuesUtils');
|
|
17
|
+
const { COMMAND_PACKAGE } = require('../../../services/TranslationKeys');
|
|
18
|
+
|
|
19
|
+
const COMMAND_OPTIONS = {
|
|
20
|
+
PROJECT: 'project',
|
|
21
|
+
DESTINATION: 'destination',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const DEFAULT_DESTINATION_FOLDER = 'build';
|
|
25
|
+
|
|
26
|
+
module.exports = class PackageAction extends BaseAction {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super(options);
|
|
29
|
+
this._projectInfoService = new ProjectInfoService(this._projectFolder);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
preExecute(params) {
|
|
33
|
+
this._projectInfoService.checkWorkingDirectoryContainsValidProject(this._commandMetadata.name);
|
|
34
|
+
|
|
35
|
+
AccountSpecificValuesUtils.validate(params, this._projectFolder);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
[COMMAND_OPTIONS.DESTINATION]: CommandUtils.quoteString(path.join(this._executionPath, DEFAULT_DESTINATION_FOLDER)),
|
|
39
|
+
[COMMAND_OPTIONS.PROJECT]: CommandUtils.quoteString(this._projectFolder),
|
|
40
|
+
...AccountSpecificValuesUtils.transformArgument(params),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async execute(params) {
|
|
45
|
+
const sdkParams = CommandUtils.extractCommandOptions(params, this._commandMetadata);
|
|
46
|
+
|
|
47
|
+
const executionContext = SdkExecutionContext.Builder.forCommand(this._commandMetadata.sdkCommand).integration().addParams(sdkParams).build();
|
|
48
|
+
|
|
49
|
+
await this._log.warning(NodeTranslationService.getMessage(COMMAND_PACKAGE.LOCAL_VALIDATION_NOT_EXECUTED));
|
|
50
|
+
|
|
51
|
+
const operationResult = await executeWithSpinner({
|
|
52
|
+
action: this._sdkExecutor.execute(executionContext),
|
|
53
|
+
message: NodeTranslationService.getMessage(COMMAND_PACKAGE.PACKAGING),
|
|
54
|
+
});
|
|
55
|
+
return operationResult.status === SdkOperationResultUtils.STATUS.SUCCESS
|
|
56
|
+
? ActionResult.Builder.withData(operationResult.data).withResultMessage(operationResult.resultMessage).build()
|
|
57
|
+
: ActionResult.Builder.withErrors(operationResult.errorMessages).build();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const Command = require('../../Command');
|
|
8
|
+
const PackageAction = require('./PackageAction');
|
|
9
|
+
const PackageOutputHandler = require('./PackageOutputHandler');
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
create(options) {
|
|
13
|
+
return Command.Builder.withOptions(options)
|
|
14
|
+
.withAction(PackageAction)
|
|
15
|
+
.withOutput(PackageOutputHandler)
|
|
16
|
+
.build();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
** Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
|
|
3
|
+
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
const ActionResultUtils = require('../../../utils/ActionResultUtils');
|
|
7
|
+
const BaseOutputHandler = require('../../base/BaseOutputHandler');
|
|
8
|
+
|
|
9
|
+
module.exports = class PackageOutputHandler extends BaseOutputHandler {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
super(options);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
parse(actionResult) {
|
|
15
|
+
ActionResultUtils.logResultMessage(actionResult, this._log);
|
|
16
|
+
return actionResult;
|
|
17
|
+
}
|
|
18
|
+
};
|