@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,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"account:manageauth": {
|
|
3
|
+
"options": {
|
|
4
|
+
"info": {
|
|
5
|
+
"description": "Prints the following information for the specified authentication ID: account ID, role ID, and url. Usage: account:manageauth --info [myAuthId]."
|
|
6
|
+
},
|
|
7
|
+
"list": {
|
|
8
|
+
"description": "Prints a list of all the configured authentication IDs. Usage: account:manageauth --list."
|
|
9
|
+
},
|
|
10
|
+
"remove": {
|
|
11
|
+
"description": "Removes an authentication ID. The tokens are not revoked in the account. Usage: account:manageauth --remove [myAuthId]."
|
|
12
|
+
},
|
|
13
|
+
"rename": {
|
|
14
|
+
"description": "Renames an authentication ID. You must specify it together with the renameto option. Usage: account:manageauth --rename [myAuthId] --renameto [newAuthId]."
|
|
15
|
+
},
|
|
16
|
+
"renameto": {
|
|
17
|
+
"description": "Specifies the new ID for an authentication ID. You must specify it together with the rename option. Usage: account:manageauth --rename [myAuthId] --renameto [newAuthId]."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"account:setup:ci": {
|
|
22
|
+
"description": "Sets up an account to use with SuiteCloud SDK and configures the default auth ID for the SuiteCloud project. No browser-based login required.\nTo change the default auth ID later, run: suitecloud account:setup:ci --select [myAuthId].",
|
|
23
|
+
"options": {
|
|
24
|
+
"domain": {
|
|
25
|
+
"name": "domain",
|
|
26
|
+
"option": "domain",
|
|
27
|
+
"description": "References the NetSuite domain of the account you want to use. You only need to specify the NetSuite domain if you are not using a production account.",
|
|
28
|
+
"mandatory": false,
|
|
29
|
+
"type": "SINGLE",
|
|
30
|
+
"usage": "",
|
|
31
|
+
"defaultOption": false,
|
|
32
|
+
"disableInIntegrationMode": false
|
|
33
|
+
},
|
|
34
|
+
"url": {
|
|
35
|
+
"disableInIntegrationMode": true
|
|
36
|
+
},
|
|
37
|
+
"account": {
|
|
38
|
+
"mandatory": false
|
|
39
|
+
},
|
|
40
|
+
"authid": {
|
|
41
|
+
"mandatory": false
|
|
42
|
+
},
|
|
43
|
+
"certificateid": {
|
|
44
|
+
"mandatory": false
|
|
45
|
+
},
|
|
46
|
+
"privatekeypath": {
|
|
47
|
+
"mandatory": false
|
|
48
|
+
},
|
|
49
|
+
"select": {
|
|
50
|
+
"name": "select",
|
|
51
|
+
"option": "select",
|
|
52
|
+
"description": "Selects an existing auth ID as the default for your SuiteCloud project. Usage account:setup:ci --select myAuthId.",
|
|
53
|
+
"mandatory": false,
|
|
54
|
+
"type": "SINGLE",
|
|
55
|
+
"usage": "",
|
|
56
|
+
"defaultOption": false,
|
|
57
|
+
"disableInIntegrationMode": false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"file:import": {
|
|
62
|
+
"options": {
|
|
63
|
+
"calledfromcomparefiles": {
|
|
64
|
+
"name": "calledfromcomparefiles",
|
|
65
|
+
"option": "calledfromcomparefiles",
|
|
66
|
+
"description": "Message displayed should be different if called from Compare Files.",
|
|
67
|
+
"mandatory": false,
|
|
68
|
+
"type": "FLAG",
|
|
69
|
+
"defaultOption": false,
|
|
70
|
+
"disableInIntegrationMode": true
|
|
71
|
+
},
|
|
72
|
+
"calledfromupdate": {
|
|
73
|
+
"name": "calledfromupdate",
|
|
74
|
+
"option": "calledfromupdate",
|
|
75
|
+
"description": "Message displayed should be different if called from Update File.",
|
|
76
|
+
"mandatory": false,
|
|
77
|
+
"type": "FLAG",
|
|
78
|
+
"defaultOption": false,
|
|
79
|
+
"disableInIntegrationMode": true
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"object:update": {
|
|
84
|
+
"options": {
|
|
85
|
+
"includeinstances": {
|
|
86
|
+
"name": "includeinstances",
|
|
87
|
+
"option": "includeinstances",
|
|
88
|
+
"description": "Includes instances. This is only available for custom records.",
|
|
89
|
+
"mandatory": false,
|
|
90
|
+
"type": "FLAG",
|
|
91
|
+
"usage": "",
|
|
92
|
+
"defaultOption": true,
|
|
93
|
+
"disableInIntegrationMode": false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"project:create": {
|
|
98
|
+
"options": {
|
|
99
|
+
"includeunittesting": {
|
|
100
|
+
"name": "includeunittesting",
|
|
101
|
+
"type": "FLAG",
|
|
102
|
+
"disableInIntegrationMode": true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"project:deploy": {
|
|
107
|
+
"options": {
|
|
108
|
+
"dryrun": {
|
|
109
|
+
"name": "dryrun",
|
|
110
|
+
"option": "dryrun",
|
|
111
|
+
"description": "Runs a preview of your deploy process. Your project is not deployed.",
|
|
112
|
+
"mandatory": false,
|
|
113
|
+
"type": "FLAG",
|
|
114
|
+
"usage": "",
|
|
115
|
+
"defaultOption": false,
|
|
116
|
+
"disableInIntegrationMode": false
|
|
117
|
+
},
|
|
118
|
+
"applyinstallprefs": {
|
|
119
|
+
"alias": "a"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"project:validate": {
|
|
124
|
+
"options": {
|
|
125
|
+
"applyinstallprefs": {
|
|
126
|
+
"alias": "a"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
module.exports = [
|
|
8
|
+
{
|
|
9
|
+
id: "N/action"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "N/auth"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "N/cache"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "N/certificateControl"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "N/commerce"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "N/compress"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "N/config"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "N/crypto"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "N/crypto/certificate"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "N/currency"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "N/currentRecord"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "N/dataset"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "N/email"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "N/encode"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "N/error"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "N/file"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "N/format"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "N/format/i18n"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "N/http"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "N/https"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "N/https/clientCertificate"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "N/keyControl"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "N/log"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "N/piremoval"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "N/plugin"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "N/portlet"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "N/query"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "N/record"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "N/recordContext"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "N/redirect"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "N/render"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "N/runtime"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "N/search"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "N/sftp"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "N/sso"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "N/suiteAppInfo"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "N/task"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "N/task/accounting/recognition"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "N/transaction"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "N/translation"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "N/ui/dialog"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "N/ui/message"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "N/ui/serverWidget"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "N/url"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "N/util"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "N/workbook"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "N/workflow"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "N/xml"
|
|
151
|
+
}
|
|
152
|
+
];
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
module.exports = [
|
|
8
|
+
{
|
|
9
|
+
id: "BundleInstallationScript",
|
|
10
|
+
name: "Bundle Installation Script",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "ClientScript",
|
|
14
|
+
name: "Client Script",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "CustomModule",
|
|
18
|
+
name: "Custom Module",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "plugintypeimpl",
|
|
22
|
+
name: "Custom Plug-in",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "customRecordAction",
|
|
26
|
+
name: "Custom Record Action Script",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "MapReduceScript",
|
|
30
|
+
name: "Map/Reduce Script",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "MassUpdateScript",
|
|
34
|
+
name: "Mass Update Script",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "Portlet",
|
|
38
|
+
name: "Portlet",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "Restlet",
|
|
42
|
+
name: "RESTlet",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "ScheduledScript",
|
|
46
|
+
name: "Scheduled Script",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "SDFInstallationScript",
|
|
50
|
+
name: "SDF Installation Script",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "Suitelet",
|
|
54
|
+
name: "Suitelet",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "UserEventScript",
|
|
58
|
+
name: "User Event Script"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "WorkflowActionScript",
|
|
62
|
+
name: "Workflow Action Script"
|
|
63
|
+
},
|
|
64
|
+
];
|
|
@@ -0,0 +1,86 @@
|
|
|
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 SdkExecutionContext = require('../SdkExecutionContext');
|
|
8
|
+
const SdkExecutor = require('../SdkExecutor');
|
|
9
|
+
const NodeTranslationService = require('../services/NodeTranslationService');
|
|
10
|
+
const executeWithSpinner = require('../ui/CliSpinner').executeWithSpinner;
|
|
11
|
+
const CommandUtils = require('../utils/CommandUtils');
|
|
12
|
+
const SdkOperationResultUtils = require('../utils/SdkOperationResultUtils');
|
|
13
|
+
const { lineBreak } = require('../loggers/LoggerOsConstants');
|
|
14
|
+
const {
|
|
15
|
+
COMMAND_IMPORTFILES: { MESSAGES },
|
|
16
|
+
COMMAND_LISTFILES: { LOADING_FOLDERS, GETTING_INERNAL_ERROR: GETTING_INTERNAL_ERROR },
|
|
17
|
+
} = require('./TranslationKeys');
|
|
18
|
+
|
|
19
|
+
const INTERMEDIATE_COMMANDS = {
|
|
20
|
+
LISTFILES: {
|
|
21
|
+
SDK_COMMAND: 'listfiles',
|
|
22
|
+
FILES_REFERENCE: 'File Cabinet files',
|
|
23
|
+
OPTIONS: {
|
|
24
|
+
AUTH_ID: 'authid',
|
|
25
|
+
FOLDER: 'folder',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
LISTFOLDERS: {
|
|
29
|
+
SDK_COMMAND: 'listfolders',
|
|
30
|
+
FOLDERS_REFERENCE: 'File Cabinet folders',
|
|
31
|
+
OPTIONS: {
|
|
32
|
+
AUTH_ID: 'authid',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = class AccountFileCabinetService {
|
|
38
|
+
constructor(sdkPath, executionEnvironmentContext, authId) {
|
|
39
|
+
this._sdkExecutor = new SdkExecutor(sdkPath, executionEnvironmentContext);
|
|
40
|
+
this._authId = authId;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getAccountFileCabinetFolders() {
|
|
44
|
+
const executionContext = SdkExecutionContext.Builder.forCommand(INTERMEDIATE_COMMANDS.LISTFOLDERS.SDK_COMMAND)
|
|
45
|
+
.integration()
|
|
46
|
+
.addParam(INTERMEDIATE_COMMANDS.LISTFOLDERS.OPTIONS.AUTH_ID, this._authId)
|
|
47
|
+
.build();
|
|
48
|
+
|
|
49
|
+
let listFoldersResult;
|
|
50
|
+
try {
|
|
51
|
+
listFoldersResult = await executeWithSpinner({
|
|
52
|
+
action: this._sdkExecutor.execute(executionContext),
|
|
53
|
+
message: NodeTranslationService.getMessage(LOADING_FOLDERS),
|
|
54
|
+
});
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw NodeTranslationService.getMessage(GETTING_INTERNAL_ERROR, INTERMEDIATE_COMMANDS.LISTFOLDERS.FOLDERS_REFERENCE, lineBreak, error);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (listFoldersResult.status === SdkOperationResultUtils.STATUS.ERROR) {
|
|
60
|
+
throw listFoldersResult.errorMessages;
|
|
61
|
+
}
|
|
62
|
+
return listFoldersResult.data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async listFiles(selectedFolder) {
|
|
66
|
+
// quote folder path to preserve spaces
|
|
67
|
+
const listFilesParams = {};
|
|
68
|
+
listFilesParams[INTERMEDIATE_COMMANDS.LISTFILES.OPTIONS.FOLDER] = CommandUtils.quoteString(selectedFolder);
|
|
69
|
+
listFilesParams[INTERMEDIATE_COMMANDS.LISTFILES.OPTIONS.AUTH_ID] = this._authId;
|
|
70
|
+
|
|
71
|
+
const executionContext = SdkExecutionContext.Builder.forCommand(INTERMEDIATE_COMMANDS.LISTFILES.SDK_COMMAND)
|
|
72
|
+
.integration()
|
|
73
|
+
.addParams(listFilesParams)
|
|
74
|
+
.build();
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
return await executeWithSpinner({
|
|
78
|
+
action: this._sdkExecutor.execute(executionContext),
|
|
79
|
+
message: NodeTranslationService.getMessage(MESSAGES.LOADING_FILES),
|
|
80
|
+
});
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw NodeTranslationService.getMessage(GETTING_INTERNAL_ERROR, INTERMEDIATE_COMMANDS.LISTFILES.FILES_REFERENCE, lineBreak, error);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 spawn = require('child_process').spawnSync;
|
|
7
|
+
const { SDK_COMPATIBLE_JAVA_VERSIONS } = require('../ApplicationConstants');
|
|
8
|
+
|
|
9
|
+
module.exports = class EnvironmentInformationService {
|
|
10
|
+
isInstalledJavaVersionValid() {
|
|
11
|
+
const installedJavaVersion = this.getInstalledJavaVersionString();
|
|
12
|
+
if (installedJavaVersion) {
|
|
13
|
+
for (const compatibleJavaVersion of SDK_COMPATIBLE_JAVA_VERSIONS) {
|
|
14
|
+
if (installedJavaVersion.startsWith(compatibleJavaVersion)) return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
// in case there is no java installed or not available from path
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getInstalledJavaVersionString() {
|
|
23
|
+
const childProcess = spawn('java', ['-version'], { shell: true });
|
|
24
|
+
const javaVersionOutput = childProcess.stderr.toString();
|
|
25
|
+
// The output should be similar to: java version "17.0.4" 2022-07-19 LTS
|
|
26
|
+
// It's expected to have the version surrounded by double quotes and only contain numbers and dots
|
|
27
|
+
const regex = /(?:\bjava version\b|\bopenjdk version\b) "([\d.]+)"/;
|
|
28
|
+
const matchResult = javaVersionOutput.match(regex);
|
|
29
|
+
return matchResult ? matchResult[1] : '';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
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 {
|
|
8
|
+
COMMAND_SETUPACCOUNT: {
|
|
9
|
+
ERRORS: {
|
|
10
|
+
BROWSER_BASED_NOT_ALLOWED,
|
|
11
|
+
MACHINE_TO_MACHINE_NOT_ALLOWED,
|
|
12
|
+
NON_CONSISTENT_AUTH_STATE,
|
|
13
|
+
},
|
|
14
|
+
MESSAGES: {
|
|
15
|
+
ROTATE_PASSWORD_WARNING
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
} = require('./TranslationKeys');
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
ENV_VARS: {
|
|
23
|
+
SUITECLOUD_CI,
|
|
24
|
+
SUITECLOUD_CI_PASSKEY,
|
|
25
|
+
SUITECLOUD_FALLBACK_PASSKEY
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
LINKS: {
|
|
29
|
+
ERRORS: {
|
|
30
|
+
AUTHENTICATION_INFO,
|
|
31
|
+
AUTHENTICATION_FALLBACK_INFO,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} = require('../ApplicationConstants');
|
|
35
|
+
|
|
36
|
+
const NodeTranslationService = require('./NodeTranslationService');
|
|
37
|
+
|
|
38
|
+
const ExecutionMode = {
|
|
39
|
+
CI: 'CI',
|
|
40
|
+
AUTH_CI_SETUP: 'AUTH_CI_SETUP',
|
|
41
|
+
DEV_MACHINE: 'DEV_MACHINE',
|
|
42
|
+
DEV_MACHINE_FALLBACK_PASSKEY: 'DEV_MACHINE_FALLBACK_PASSKEY',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const validateMachineToMachineAuthIsAllowed = () => {
|
|
46
|
+
const executionMode = getExecutionMode();
|
|
47
|
+
if (!(executionMode === ExecutionMode.CI || executionMode === ExecutionMode.AUTH_CI_SETUP)) {
|
|
48
|
+
throw NodeTranslationService.getMessage(MACHINE_TO_MACHINE_NOT_ALLOWED, AUTHENTICATION_INFO);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const validateBrowserBasedAuthIsAllowed = () => {
|
|
53
|
+
const executionMode = getExecutionMode();
|
|
54
|
+
if (!(executionMode === ExecutionMode.DEV_MACHINE || executionMode === ExecutionMode.DEV_MACHINE_FALLBACK_PASSKEY)) {
|
|
55
|
+
throw NodeTranslationService.getMessage(BROWSER_BASED_NOT_ALLOWED, AUTHENTICATION_INFO);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const getBrowserBasedWarningMessages = () => {
|
|
60
|
+
const executionMode = getExecutionMode();
|
|
61
|
+
if (executionMode === ExecutionMode.DEV_MACHINE_FALLBACK_PASSKEY) {
|
|
62
|
+
return NodeTranslationService.getMessage(ROTATE_PASSWORD_WARNING, AUTHENTICATION_FALLBACK_INFO);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const getExecutionMode = () => {
|
|
67
|
+
const envFallBackPassKey = process.env[SUITECLOUD_FALLBACK_PASSKEY];
|
|
68
|
+
const envCiPassKey = process.env[SUITECLOUD_CI_PASSKEY];
|
|
69
|
+
const envCi = process.env[SUITECLOUD_CI];
|
|
70
|
+
|
|
71
|
+
if (envCi && envCi !== '0') {
|
|
72
|
+
//CI
|
|
73
|
+
if (envCiPassKey && !envFallBackPassKey) {
|
|
74
|
+
return ExecutionMode.CI;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
//Not CI
|
|
78
|
+
if (envCiPassKey && !envFallBackPassKey) {
|
|
79
|
+
return ExecutionMode.AUTH_CI_SETUP;
|
|
80
|
+
} else if (!envCiPassKey && !envFallBackPassKey) {
|
|
81
|
+
return ExecutionMode.DEV_MACHINE;
|
|
82
|
+
} else if (!envCiPassKey && envFallBackPassKey) {
|
|
83
|
+
return ExecutionMode.DEV_MACHINE_FALLBACK_PASSKEY;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//Default is non consistent states
|
|
87
|
+
throw NodeTranslationService.getMessage(NON_CONSISTENT_AUTH_STATE, getSuiteCloudEnvVariableList(), AUTHENTICATION_INFO);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const getSuiteCloudEnvVariableList = () => {
|
|
91
|
+
const envFallBackPassKey = process.env[SUITECLOUD_FALLBACK_PASSKEY];
|
|
92
|
+
const envCiPassKey = process.env[SUITECLOUD_CI_PASSKEY];
|
|
93
|
+
const envCi = process.env[SUITECLOUD_CI];
|
|
94
|
+
|
|
95
|
+
const variables = [];
|
|
96
|
+
if (envCi && envCi !== '0') {
|
|
97
|
+
variables.push(SUITECLOUD_CI);
|
|
98
|
+
}
|
|
99
|
+
if (envCiPassKey) {
|
|
100
|
+
variables.push(SUITECLOUD_CI_PASSKEY);
|
|
101
|
+
}
|
|
102
|
+
if (envFallBackPassKey) {
|
|
103
|
+
variables.push(SUITECLOUD_FALLBACK_PASSKEY);
|
|
104
|
+
}
|
|
105
|
+
return variables.join(', ');
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
module.exports = { validateBrowserBasedAuthIsAllowed, validateMachineToMachineAuthIsAllowed, getBrowserBasedWarningMessages };
|
|
@@ -0,0 +1,65 @@
|
|
|
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 FileSystemService = require('./FileSystemService');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const SUITESCRIPTS_PATH = '/SuiteScripts';
|
|
11
|
+
const TEMPLATES_PATH = '/Templates';
|
|
12
|
+
const TEMPLATES_EMAIL_TEMPLATES_PATH = '/Templates/E-mail Templates';
|
|
13
|
+
const TEMPLATES_MARKETING_TEMPLATES_PATH = '/Templates/Marketing Templates';
|
|
14
|
+
const WEB_SITE_HOSTING_FILES_PATH = '/Web Site Hosting Files';
|
|
15
|
+
const SUITEAPPS = '/SuiteApps';
|
|
16
|
+
|
|
17
|
+
const UNRESTRICTED_PATHS = [
|
|
18
|
+
SUITESCRIPTS_PATH,
|
|
19
|
+
TEMPLATES_EMAIL_TEMPLATES_PATH,
|
|
20
|
+
TEMPLATES_MARKETING_TEMPLATES_PATH,
|
|
21
|
+
WEB_SITE_HOSTING_FILES_PATH,
|
|
22
|
+
SUITEAPPS,
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
module.exports = class FileCabinetService {
|
|
26
|
+
constructor(fileCabinetAbsolutePath) {
|
|
27
|
+
this._fileSystemService = new FileSystemService();
|
|
28
|
+
this._fileCabinetAbsolutePath = fileCabinetAbsolutePath;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getFileCabinetRelativePath(file) {
|
|
32
|
+
return file.replace(this._fileCabinetAbsolutePath, '').replace(/\\/g, '/');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getFileCabinetFolders() {
|
|
36
|
+
return this._getFileCabinetFolders(this._fileCabinetAbsolutePath);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_getFileCabinetFolders(parentFolder) {
|
|
40
|
+
const folders = [];
|
|
41
|
+
const getFoldersRecursively = source =>
|
|
42
|
+
this._fileSystemService.getFoldersFromDirectory(source).forEach(folder => {
|
|
43
|
+
folders.push(folder);
|
|
44
|
+
if (this._shouldEnterFolder(folder)) {
|
|
45
|
+
getFoldersRecursively(folder);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
getFoldersRecursively(parentFolder);
|
|
49
|
+
|
|
50
|
+
return folders;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
isUnrestrictedPath(path) {
|
|
54
|
+
return UNRESTRICTED_PATHS.some(unrestrictedPath => this.getFileCabinetRelativePath(path).startsWith(unrestrictedPath));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_shouldEnterFolder(folder) {
|
|
58
|
+
//Templates itself is restricted, but it has both restricted and unrestricted child folders, so we still need to get inside it.
|
|
59
|
+
return this._isTemplatesFolder(folder) || (this.isUnrestrictedPath(folder) && this._fileSystemService.getFilesFromDirectory(folder).length);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_isTemplatesFolder(folder) {
|
|
63
|
+
return folder === path.join(this._fileCabinetAbsolutePath, TEMPLATES_PATH);
|
|
64
|
+
}
|
|
65
|
+
};
|