@hubspot/local-dev-lib 0.3.15 → 0.4.0-experimental.1
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/LICENSE +12 -0
- package/README.md +17 -0
- package/api/appsDev.d.ts +6 -0
- package/api/appsDev.js +29 -0
- package/api/customObjects.d.ts +8 -20
- package/api/customObjects.js +13 -16
- package/api/designManager.d.ts +4 -14
- package/api/designManager.js +5 -8
- package/api/devSecrets.d.ts +6 -0
- package/api/devSecrets.js +40 -0
- package/api/developerTestAccounts.d.ts +12 -5
- package/api/developerTestAccounts.js +22 -10
- package/api/fileManager.d.ts +5 -4
- package/api/fileManager.js +9 -9
- package/api/fileMapper.d.ts +8 -7
- package/api/fileMapper.js +16 -16
- package/api/fileTransport.d.ts +4 -3
- package/api/fileTransport.js +5 -5
- package/api/fireAlarm.d.ts +3 -0
- package/api/fireAlarm.js +11 -0
- package/api/functions.d.ts +7 -7
- package/api/functions.js +11 -14
- package/api/github.d.ts +8 -9
- package/api/github.js +30 -13
- package/api/hubdb.d.ts +11 -10
- package/api/hubdb.js +24 -21
- package/api/lighthouseScore.d.ts +4 -4
- package/api/lighthouseScore.js +7 -10
- package/api/localDevAuth.d.ts +9 -19
- package/api/localDevAuth.js +34 -9
- package/api/marketplaceValidation.d.ts +4 -4
- package/api/marketplaceValidation.js +4 -7
- package/api/projects.d.ts +47 -35
- package/api/projects.js +145 -57
- package/api/sandboxHubs.d.ts +6 -4
- package/api/sandboxHubs.js +9 -10
- package/api/sandboxSync.d.ts +4 -4
- package/api/sandboxSync.js +4 -13
- package/api/secrets.d.ts +6 -8
- package/api/secrets.js +9 -12
- package/api/validateHubl.d.ts +2 -1
- package/api/validateHubl.js +3 -6
- package/config/CLIConfiguration.d.ts +16 -9
- package/config/CLIConfiguration.js +148 -74
- package/config/configFile.js +8 -17
- package/config/configUtils.d.ts +2 -21
- package/config/configUtils.js +2 -2
- package/config/config_DEPRECATED.d.ts +10 -8
- package/config/config_DEPRECATED.js +62 -32
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +14 -8
- package/config/index.js +108 -59
- package/config/migrate.d.ts +22 -0
- package/config/migrate.js +178 -0
- package/constants/config.d.ts +13 -1
- package/constants/config.js +19 -2
- package/constants/extensions.d.ts +1 -0
- package/constants/extensions.js +2 -1
- package/constants/files.d.ts +2 -2
- package/constants/files.js +3 -3
- package/constants/projects.d.ts +12 -0
- package/constants/projects.js +15 -0
- package/errors/errors_DEPRECATED.d.ts +1 -5
- package/errors/errors_DEPRECATED.js +2 -2
- package/errors/index.d.ts +18 -0
- package/errors/index.js +63 -0
- package/http/addQueryParams.d.ts +2 -0
- package/http/addQueryParams.js +14 -0
- package/http/getAxiosConfig.d.ts +2 -2
- package/http/getAxiosConfig.js +31 -2
- package/http/index.d.ts +10 -10
- package/http/index.js +80 -34
- package/http/unauthed.d.ts +14 -0
- package/http/unauthed.js +38 -0
- package/lang/en.json +384 -376
- package/lib/archive.d.ts +3 -6
- package/lib/archive.js +26 -20
- package/lib/cms/functions.d.ts +6 -9
- package/lib/cms/functions.js +24 -19
- package/lib/cms/handleFieldsJS.d.ts +2 -2
- package/lib/cms/handleFieldsJS.js +13 -9
- package/lib/cms/modules.d.ts +5 -13
- package/lib/cms/modules.js +40 -23
- package/lib/cms/processFieldsJs.js +8 -7
- package/lib/cms/templates.d.ts +42 -0
- package/lib/cms/templates.js +48 -5
- package/lib/cms/uploadFolder.d.ts +3 -18
- package/lib/cms/uploadFolder.js +19 -17
- package/lib/cms/validate.js +1 -1
- package/lib/cms/watch.d.ts +2 -15
- package/lib/cms/watch.js +31 -23
- package/lib/customObjects.js +4 -15
- package/lib/fileManager.js +22 -22
- package/lib/fileMapper.d.ts +4 -13
- package/lib/fileMapper.js +47 -50
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +10 -6
- package/lib/github.d.ts +11 -11
- package/lib/github.js +44 -30
- package/lib/gitignore.d.ts +1 -6
- package/lib/gitignore.js +2 -2
- package/lib/hubdb.d.ts +3 -2
- package/lib/hubdb.js +11 -9
- package/lib/notify.js +2 -2
- package/lib/oauth.d.ts +1 -1
- package/lib/oauth.js +9 -18
- package/lib/path.d.ts +3 -0
- package/lib/path.js +46 -1
- package/lib/personalAccessKey.d.ts +5 -17
- package/lib/personalAccessKey.js +42 -32
- package/lib/portManager.d.ts +3 -5
- package/lib/portManager.js +18 -6
- package/lib/text.d.ts +1 -1
- package/lib/text.js +3 -0
- package/lib/trackUsage.js +13 -7
- package/models/FileSystemError.d.ts +6 -0
- package/models/FileSystemError.js +47 -0
- package/models/HubSpotHttpError.d.ts +26 -0
- package/models/HubSpotHttpError.js +208 -0
- package/models/OAuth2Manager.d.ts +2 -27
- package/models/OAuth2Manager.js +14 -29
- package/package.json +38 -35
- package/types/Accounts.d.ts +98 -3
- package/types/Apps.d.ts +77 -0
- package/types/Apps.js +2 -0
- package/types/Archive.d.ts +9 -0
- package/types/Archive.js +2 -0
- package/types/Build.d.ts +4 -2
- package/types/ComponentStructure.d.ts +30 -10
- package/types/Config.d.ts +21 -2
- package/types/Deploy.d.ts +3 -2
- package/types/DesignManager.d.ts +15 -0
- package/types/DesignManager.js +2 -0
- package/types/DevSecrets.d.ts +5 -0
- package/types/DevSecrets.js +2 -0
- package/types/Error.d.ts +9 -5
- package/types/FieldsJS.d.ts +1 -0
- package/types/FieldsJS.js +2 -0
- package/types/FileManager.d.ts +1 -1
- package/types/Files.d.ts +43 -4
- package/types/FireAlarm.d.ts +9 -0
- package/types/FireAlarm.js +2 -0
- package/types/Functions.d.ts +52 -0
- package/types/Github.d.ts +13 -0
- package/types/Http.d.ts +12 -11
- package/types/Hubdb.d.ts +9 -0
- package/types/MarketplaceValidation.d.ts +7 -3
- package/types/Migration.d.ts +30 -0
- package/types/Migration.js +12 -0
- package/types/Modules.d.ts +11 -0
- package/types/PortManager.d.ts +7 -0
- package/types/Project.d.ts +30 -0
- package/types/Sandbox.d.ts +25 -36
- package/types/Schemas.d.ts +56 -0
- package/types/Secrets.d.ts +3 -0
- package/types/Secrets.js +2 -0
- package/types/developerTestAccounts.d.ts +11 -0
- package/utils/PortManagerServer.d.ts +6 -7
- package/utils/PortManagerServer.js +15 -9
- package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
- package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
- package/utils/cms/fieldsJS.d.ts +1 -2
- package/utils/cms/modules.js +2 -2
- package/utils/detectPort.js +3 -3
- package/errors/apiErrors.d.ts +0 -25
- package/errors/apiErrors.js +0 -186
- package/errors/fileSystemErrors.d.ts +0 -6
- package/errors/fileSystemErrors.js +0 -35
- package/errors/standardErrors.d.ts +0 -21
- package/errors/standardErrors.js +0 -52
- package/lang/lang/en.json +0 -391
- package/lib/developerTestAccounts.d.ts +0 -4
- package/lib/developerTestAccounts.js +0 -35
- package/lib/sandboxes.d.ts +0 -14
- package/lib/sandboxes.js +0 -70
- package/models/HubSpotAuthError.d.ts +0 -12
- package/models/HubSpotAuthError.js +0 -20
package/lib/fileMapper.js
CHANGED
|
@@ -11,12 +11,11 @@ const p_queue_1 = __importDefault(require("p-queue"));
|
|
|
11
11
|
const path_2 = require("./path");
|
|
12
12
|
const logger_1 = require("./logger");
|
|
13
13
|
const fileMapper_1 = require("../api/fileMapper");
|
|
14
|
-
const standardErrors_1 = require("../errors/standardErrors");
|
|
15
14
|
const extensions_1 = require("../constants/extensions");
|
|
16
15
|
const files_1 = require("../constants/files");
|
|
17
|
-
const
|
|
18
|
-
const apiErrors_1 = require("../errors/apiErrors");
|
|
16
|
+
const errors_1 = require("../errors");
|
|
19
17
|
const lang_1 = require("../utils/lang");
|
|
18
|
+
const FileSystemError_1 = require("../models/FileSystemError");
|
|
20
19
|
const i18nKey = 'lib.fileMapper';
|
|
21
20
|
const queue = new p_queue_1.default({
|
|
22
21
|
concurrency: 10,
|
|
@@ -44,14 +43,14 @@ function isPathToHubspot(filepath) {
|
|
|
44
43
|
return /^(\/|\\)?@hubspot/i.test(filepath.trim());
|
|
45
44
|
}
|
|
46
45
|
exports.isPathToHubspot = isPathToHubspot;
|
|
47
|
-
function useApiBuffer(
|
|
48
|
-
return
|
|
46
|
+
function useApiBuffer(cmsPublishMode) {
|
|
47
|
+
return cmsPublishMode === files_1.CMS_PUBLISH_MODE.draft;
|
|
49
48
|
}
|
|
50
|
-
// Determines API param based on mode
|
|
51
|
-
function getFileMapperQueryValues(
|
|
49
|
+
// Determines API param based on publish mode and options
|
|
50
|
+
function getFileMapperQueryValues(cmsPublishMode, { staging, assetVersion } = {}) {
|
|
52
51
|
return {
|
|
53
52
|
params: {
|
|
54
|
-
buffer: useApiBuffer(
|
|
53
|
+
buffer: useApiBuffer(cmsPublishMode),
|
|
55
54
|
environmentId: staging ? 2 : 1,
|
|
56
55
|
version: assetVersion,
|
|
57
56
|
},
|
|
@@ -77,9 +76,9 @@ function validateFileMapperNode(node) {
|
|
|
77
76
|
catch (err) {
|
|
78
77
|
json = node;
|
|
79
78
|
}
|
|
80
|
-
(0,
|
|
79
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidNode`, {
|
|
81
80
|
json: JSON.stringify(json),
|
|
82
|
-
});
|
|
81
|
+
}));
|
|
83
82
|
}
|
|
84
83
|
function getTypeDataFromPath(src) {
|
|
85
84
|
const isModule = isPathToModule(src);
|
|
@@ -125,10 +124,10 @@ async function writeUtimes(accountId, filepath, node) {
|
|
|
125
124
|
await fs_extra_1.default.utimes(filepath, atime, mtime);
|
|
126
125
|
}
|
|
127
126
|
catch (err) {
|
|
128
|
-
|
|
127
|
+
throw new FileSystemError_1.FileSystemError({ cause: err }, {
|
|
129
128
|
filepath,
|
|
130
129
|
accountId,
|
|
131
|
-
|
|
130
|
+
operation: 'write',
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
}
|
|
@@ -142,7 +141,7 @@ async function skipExisting(filepath, overwrite = false) {
|
|
|
142
141
|
}
|
|
143
142
|
return false;
|
|
144
143
|
}
|
|
145
|
-
async function fetchAndWriteFileStream(accountId, srcPath, filepath,
|
|
144
|
+
async function fetchAndWriteFileStream(accountId, srcPath, filepath, cmsPublishMode, options = {}) {
|
|
146
145
|
if (typeof srcPath !== 'string' || !srcPath.trim()) {
|
|
147
146
|
return;
|
|
148
147
|
}
|
|
@@ -150,21 +149,15 @@ async function fetchAndWriteFileStream(accountId, srcPath, filepath, mode, optio
|
|
|
150
149
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.skippedExisting`, { filepath }));
|
|
151
150
|
return;
|
|
152
151
|
}
|
|
153
|
-
if (!(0, path_2.isAllowedExtension)(srcPath)) {
|
|
154
|
-
(0,
|
|
155
|
-
}
|
|
156
|
-
let node;
|
|
157
|
-
try {
|
|
158
|
-
node = await (0, fileMapper_1.fetchFileStream)(accountId, srcPath, filepath, getFileMapperQueryValues(mode, options));
|
|
159
|
-
}
|
|
160
|
-
catch (err) {
|
|
161
|
-
(0, standardErrors_1.throwError)(err);
|
|
152
|
+
if (!(0, path_2.isAllowedExtension)(srcPath, Array.from(extensions_1.JSR_ALLOWED_EXTENSIONS))) {
|
|
153
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidFileType`, { srcPath }));
|
|
162
154
|
}
|
|
155
|
+
const node = await (0, fileMapper_1.fetchFileStream)(accountId, srcPath, filepath, getFileMapperQueryValues(cmsPublishMode, options));
|
|
163
156
|
await writeUtimes(accountId, filepath, node);
|
|
164
157
|
}
|
|
165
158
|
// Writes an individual file or folder (not recursive). If file source is missing, the
|
|
166
159
|
//file is fetched.
|
|
167
|
-
async function writeFileMapperNode(accountId, filepath, node,
|
|
160
|
+
async function writeFileMapperNode(accountId, filepath, node, cmsPublishMode, options = {}) {
|
|
168
161
|
const localFilepath = (0, path_2.convertToLocalFileSystemPath)(path_1.default.resolve(filepath));
|
|
169
162
|
if (await skipExisting(localFilepath, options.overwrite)) {
|
|
170
163
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.skippedExisting`, {
|
|
@@ -174,7 +167,7 @@ async function writeFileMapperNode(accountId, filepath, node, mode, options = {}
|
|
|
174
167
|
}
|
|
175
168
|
if (!node.folder) {
|
|
176
169
|
try {
|
|
177
|
-
await fetchAndWriteFileStream(accountId, node.path, localFilepath,
|
|
170
|
+
await fetchAndWriteFileStream(accountId, node.path, localFilepath, cmsPublishMode, options);
|
|
178
171
|
return true;
|
|
179
172
|
}
|
|
180
173
|
catch (err) {
|
|
@@ -188,21 +181,20 @@ async function writeFileMapperNode(accountId, filepath, node, mode, options = {}
|
|
|
188
181
|
}));
|
|
189
182
|
}
|
|
190
183
|
catch (err) {
|
|
191
|
-
|
|
184
|
+
throw new FileSystemError_1.FileSystemError({ cause: err }, {
|
|
192
185
|
filepath: localFilepath,
|
|
193
186
|
accountId,
|
|
194
|
-
|
|
187
|
+
operation: 'write',
|
|
195
188
|
});
|
|
196
|
-
return false;
|
|
197
189
|
}
|
|
198
190
|
return true;
|
|
199
191
|
}
|
|
200
|
-
async function downloadFile(accountId, src, destPath,
|
|
192
|
+
async function downloadFile(accountId, src, destPath, cmsPublishMode, options = {}) {
|
|
201
193
|
const { isFile, isHubspot } = getTypeDataFromPath(src);
|
|
194
|
+
if (!isFile) {
|
|
195
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidRequest`, { src }));
|
|
196
|
+
}
|
|
202
197
|
try {
|
|
203
|
-
if (!isFile) {
|
|
204
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.invalidRequest`, { src });
|
|
205
|
-
}
|
|
206
198
|
const dest = path_1.default.resolve(destPath);
|
|
207
199
|
const cwd = (0, path_2.getCwd)();
|
|
208
200
|
let filepath;
|
|
@@ -222,7 +214,7 @@ async function downloadFile(accountId, src, destPath, mode, options = {}) {
|
|
|
222
214
|
: path_1.default.resolve(cwd, dest, name);
|
|
223
215
|
}
|
|
224
216
|
const localFsPath = (0, path_2.convertToLocalFileSystemPath)(filepath);
|
|
225
|
-
await fetchAndWriteFileStream(accountId, src, localFsPath,
|
|
217
|
+
await fetchAndWriteFileStream(accountId, src, localFsPath, cmsPublishMode, options);
|
|
226
218
|
await queue.onIdle();
|
|
227
219
|
logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.completedFetch`, {
|
|
228
220
|
src,
|
|
@@ -232,33 +224,33 @@ async function downloadFile(accountId, src, destPath, mode, options = {}) {
|
|
|
232
224
|
}
|
|
233
225
|
catch (err) {
|
|
234
226
|
const error = err;
|
|
235
|
-
if (isHubspot && (0,
|
|
236
|
-
(0,
|
|
227
|
+
if (isHubspot && (0, errors_1.isTimeoutError)(error)) {
|
|
228
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.assetTimeout`), { cause: error });
|
|
237
229
|
}
|
|
238
230
|
else {
|
|
239
|
-
(0,
|
|
231
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchFile`, { src, dest: destPath }), { cause: error });
|
|
240
232
|
}
|
|
241
233
|
}
|
|
242
234
|
}
|
|
243
|
-
async function fetchFolderFromApi(accountId, src,
|
|
235
|
+
async function fetchFolderFromApi(accountId, src, cmsPublishMode, options = {}) {
|
|
244
236
|
const { isRoot, isFolder, isHubspot } = getTypeDataFromPath(src);
|
|
245
237
|
if (!isFolder) {
|
|
246
|
-
(0,
|
|
238
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidFetchFolderRequest`, {
|
|
247
239
|
src,
|
|
248
|
-
});
|
|
240
|
+
}));
|
|
249
241
|
}
|
|
250
242
|
const srcPath = isRoot ? '@root' : src;
|
|
251
|
-
const queryValues = getFileMapperQueryValues(
|
|
252
|
-
const node = isHubspot
|
|
243
|
+
const queryValues = getFileMapperQueryValues(cmsPublishMode, options);
|
|
244
|
+
const { data: node } = isHubspot
|
|
253
245
|
? await (0, fileMapper_1.downloadDefault)(accountId, srcPath, queryValues)
|
|
254
246
|
: await (0, fileMapper_1.download)(accountId, srcPath, queryValues);
|
|
255
247
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.folderFetch`, { src, accountId }));
|
|
256
248
|
return node;
|
|
257
249
|
}
|
|
258
250
|
exports.fetchFolderFromApi = fetchFolderFromApi;
|
|
259
|
-
async function downloadFolder(accountId, src, destPath,
|
|
251
|
+
async function downloadFolder(accountId, src, destPath, cmsPublishMode, options = {}) {
|
|
260
252
|
try {
|
|
261
|
-
const node = await fetchFolderFromApi(accountId, src,
|
|
253
|
+
const node = await fetchFolderFromApi(accountId, src, cmsPublishMode, options);
|
|
262
254
|
if (!node) {
|
|
263
255
|
return;
|
|
264
256
|
}
|
|
@@ -269,9 +261,13 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
|
|
|
269
261
|
let success = true;
|
|
270
262
|
recurseFolder(node, (childNode, filepath) => {
|
|
271
263
|
queue.add(async () => {
|
|
272
|
-
const succeeded = await writeFileMapperNode(accountId, filepath || '', childNode,
|
|
264
|
+
const succeeded = await writeFileMapperNode(accountId, filepath || '', childNode, cmsPublishMode, options);
|
|
273
265
|
if (succeeded === false) {
|
|
274
266
|
success = false;
|
|
267
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchFile`, {
|
|
268
|
+
src: childNode.path,
|
|
269
|
+
dest: filepath || '',
|
|
270
|
+
}));
|
|
275
271
|
}
|
|
276
272
|
});
|
|
277
273
|
return success;
|
|
@@ -285,16 +281,17 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
|
|
|
285
281
|
}));
|
|
286
282
|
}
|
|
287
283
|
else {
|
|
288
|
-
|
|
284
|
+
// TODO: Fix this exception. It is triggering the catch block so this error is being rewritten
|
|
285
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.incompleteFetch`, { src }));
|
|
289
286
|
}
|
|
290
287
|
}
|
|
291
288
|
catch (err) {
|
|
292
289
|
const error = err;
|
|
293
|
-
if ((0,
|
|
294
|
-
(0,
|
|
290
|
+
if ((0, errors_1.isTimeoutError)(error)) {
|
|
291
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.assetTimeout`), { cause: error });
|
|
295
292
|
}
|
|
296
293
|
else {
|
|
297
|
-
(0,
|
|
294
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchFolder`, { src, dest: destPath }), { cause: err });
|
|
298
295
|
}
|
|
299
296
|
}
|
|
300
297
|
}
|
|
@@ -305,16 +302,16 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
|
|
|
305
302
|
* @param {FileMapperInputArguments} input
|
|
306
303
|
* @returns {Promise}
|
|
307
304
|
*/
|
|
308
|
-
async function downloadFileOrFolder(accountId, src, dest,
|
|
305
|
+
async function downloadFileOrFolder(accountId, src, dest, cmsPublishMode, options = {}) {
|
|
309
306
|
if (!src) {
|
|
310
307
|
return;
|
|
311
308
|
}
|
|
312
309
|
const { isFile } = getTypeDataFromPath(src);
|
|
313
310
|
if (isFile) {
|
|
314
|
-
await downloadFile(accountId, src, dest,
|
|
311
|
+
await downloadFile(accountId, src, dest, cmsPublishMode, options);
|
|
315
312
|
}
|
|
316
313
|
else {
|
|
317
|
-
await downloadFolder(accountId, src, dest,
|
|
314
|
+
await downloadFolder(accountId, src, dest, cmsPublishMode, options);
|
|
318
315
|
}
|
|
319
316
|
}
|
|
320
317
|
exports.downloadFileOrFolder = downloadFileOrFolder;
|
package/lib/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FileData } from '../types/Files';
|
|
2
2
|
export declare function getFileInfoAsync(dir: string, file: string): Promise<FileData>;
|
|
3
3
|
export declare function flattenAndRemoveSymlinks(filesData: Array<FileData>): Array<string>;
|
|
4
|
-
export declare function walk(dir: string): Promise<Array<string>>;
|
|
4
|
+
export declare function walk(dir: string, ignoreDirs?: string[]): Promise<Array<string>>;
|
package/lib/fs.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.walk = exports.flattenAndRemoveSymlinks = exports.getFileInfoAsync = voi
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const files_1 = require("../constants/files");
|
|
10
|
-
const
|
|
10
|
+
const FileSystemError_1 = require("../models/FileSystemError");
|
|
11
11
|
function getFileInfoAsync(dir, file) {
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
const filepath = path_1.default.join(dir, file);
|
|
@@ -42,11 +42,11 @@ function flattenAndRemoveSymlinks(filesData) {
|
|
|
42
42
|
}, []);
|
|
43
43
|
}
|
|
44
44
|
exports.flattenAndRemoveSymlinks = flattenAndRemoveSymlinks;
|
|
45
|
-
const generateRecursiveFilePromise = async (dir, file) => {
|
|
45
|
+
const generateRecursiveFilePromise = async (dir, file, ignoreDirs) => {
|
|
46
46
|
return getFileInfoAsync(dir, file).then(fileData => {
|
|
47
47
|
return new Promise(resolve => {
|
|
48
48
|
if (fileData.type === files_1.STAT_TYPES.DIRECTORY) {
|
|
49
|
-
walk(fileData.filepath).then(files => {
|
|
49
|
+
walk(fileData.filepath, ignoreDirs).then(files => {
|
|
50
50
|
resolve({ ...fileData, files });
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -56,16 +56,20 @@ const generateRecursiveFilePromise = async (dir, file) => {
|
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
-
async function walk(dir) {
|
|
59
|
+
async function walk(dir, ignoreDirs) {
|
|
60
60
|
function processFiles(files) {
|
|
61
|
-
|
|
61
|
+
// If the directory is in the ignore list, return an empty array to skip the directory contents
|
|
62
|
+
if (ignoreDirs?.some(ignored => dir.includes(ignored))) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
return Promise.all(files.map(file => generateRecursiveFilePromise(dir, file, ignoreDirs)));
|
|
62
66
|
}
|
|
63
67
|
return fs_1.default.promises
|
|
64
68
|
.readdir(dir)
|
|
65
69
|
.then(processFiles)
|
|
66
70
|
.then(flattenAndRemoveSymlinks)
|
|
67
71
|
.catch(err => {
|
|
68
|
-
|
|
72
|
+
throw new FileSystemError_1.FileSystemError({ cause: err });
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
75
|
exports.walk = walk;
|
package/lib/github.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use `fetchRepoFile` instead - this util is a thin wrapper around it
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchFileFromRepository<T = Buffer>(repoPath: RepoPath, filePath: string, ref: string): Promise<T>;
|
|
5
8
|
export declare function fetchReleaseData(repoPath: RepoPath, tag?: string): Promise<GithubReleaseData>;
|
|
6
|
-
type CloneGithubRepoOptions = {
|
|
7
|
-
isRelease?: boolean;
|
|
8
|
-
type?: string;
|
|
9
|
-
branch?: string;
|
|
10
|
-
tag?: string;
|
|
11
|
-
sourceDir?: string;
|
|
12
|
-
};
|
|
13
9
|
export declare function cloneGithubRepo(repoPath: RepoPath, dest: string, options?: CloneGithubRepoOptions): Promise<boolean>;
|
|
10
|
+
export declare function fetchGitHubRepoContentFromDownloadUrl(dest: string, downloadUrl: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Writes files from a public repository to the destination folder
|
|
13
|
+
@deprecated - This method fetches all the files individually, which can hit rate limits for unauthorized requests. Use `cloneGithubRepo` instead.
|
|
14
|
+
*/
|
|
14
15
|
export declare function downloadGithubRepoContents(repoPath: RepoPath, contentPath: string, dest: string, ref?: string, filter?: (contentPiecePath: string, downloadPath: string) => boolean): Promise<void>;
|
|
15
16
|
export declare function listGithubRepoContents(repoPath: RepoPath, contentPath: string, fileFilter?: 'file' | 'dir'): Promise<GithubRepoFile[]>;
|
|
16
|
-
export {};
|
package/lib/github.js
CHANGED
|
@@ -3,15 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.listGithubRepoContents = exports.downloadGithubRepoContents = exports.cloneGithubRepo = exports.fetchReleaseData = exports.fetchFileFromRepository = void 0;
|
|
6
|
+
exports.listGithubRepoContents = exports.downloadGithubRepoContents = exports.fetchGitHubRepoContentFromDownloadUrl = exports.cloneGithubRepo = exports.fetchReleaseData = exports.fetchFileFromRepository = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const standardErrors_1 = require("../errors/standardErrors");
|
|
10
9
|
const archive_1 = require("./archive");
|
|
11
10
|
const logger_1 = require("./logger");
|
|
12
11
|
const github_1 = require("../api/github");
|
|
13
12
|
const lang_1 = require("../utils/lang");
|
|
13
|
+
const errors_1 = require("../errors");
|
|
14
14
|
const i18nKey = 'lib.github';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `fetchRepoFile` instead - this util is a thin wrapper around it
|
|
17
|
+
*/
|
|
15
18
|
async function fetchFileFromRepository(repoPath, filePath, ref) {
|
|
16
19
|
try {
|
|
17
20
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.fetchFileFromRepository.fetching`, {
|
|
@@ -21,7 +24,9 @@ async function fetchFileFromRepository(repoPath, filePath, ref) {
|
|
|
21
24
|
return data;
|
|
22
25
|
}
|
|
23
26
|
catch (err) {
|
|
24
|
-
(0,
|
|
27
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.fetchFileFromRepository.errors.fetchFail`), {
|
|
28
|
+
cause: err,
|
|
29
|
+
});
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
exports.fetchFileFromRepository = fetchFileFromRepository;
|
|
@@ -38,8 +43,9 @@ async function fetchReleaseData(repoPath, tag) {
|
|
|
38
43
|
return data;
|
|
39
44
|
}
|
|
40
45
|
catch (err) {
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.fetchReleaseData.errors.fetchFail`, {
|
|
47
|
+
tag: tag || 'latest',
|
|
48
|
+
}), { cause: err });
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
exports.fetchReleaseData = fetchReleaseData;
|
|
@@ -66,18 +72,23 @@ async function downloadGithubRepoZip(repoPath, isRelease = false, options = {})
|
|
|
66
72
|
return data;
|
|
67
73
|
}
|
|
68
74
|
catch (err) {
|
|
69
|
-
(0,
|
|
75
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoZip.errors.fetchFail`), {
|
|
76
|
+
cause: err,
|
|
77
|
+
});
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
async function cloneGithubRepo(repoPath, dest, options = {}) {
|
|
73
|
-
const { tag, isRelease, branch, sourceDir, type } = options;
|
|
81
|
+
const { tag, isRelease, branch, sourceDir, type, hideLogs } = options;
|
|
74
82
|
const zip = await downloadGithubRepoZip(repoPath, isRelease, {
|
|
75
83
|
tag,
|
|
76
84
|
branch,
|
|
77
85
|
});
|
|
78
86
|
const repoName = repoPath.split('/')[1];
|
|
79
|
-
const success = await (0, archive_1.extractZipArchive)(zip, repoName, dest, {
|
|
80
|
-
|
|
87
|
+
const success = await (0, archive_1.extractZipArchive)(zip, repoName, dest, {
|
|
88
|
+
sourceDir,
|
|
89
|
+
hideLogs,
|
|
90
|
+
});
|
|
91
|
+
if (success && !hideLogs) {
|
|
81
92
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.cloneGithubRepo.success`, {
|
|
82
93
|
type: type || '',
|
|
83
94
|
dest,
|
|
@@ -88,12 +99,21 @@ async function cloneGithubRepo(repoPath, dest, options = {}) {
|
|
|
88
99
|
exports.cloneGithubRepo = cloneGithubRepo;
|
|
89
100
|
async function fetchGitHubRepoContentFromDownloadUrl(dest, downloadUrl) {
|
|
90
101
|
const resp = await (0, github_1.fetchRepoFileByDownloadUrl)(downloadUrl);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
const contentType = resp.headers['content-type'];
|
|
103
|
+
let fileContents;
|
|
104
|
+
if (contentType.startsWith('text')) {
|
|
105
|
+
fileContents = Buffer.from(resp.data).toString('utf8');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
fileContents = resp.data;
|
|
109
|
+
}
|
|
110
|
+
fs_extra_1.default.outputFileSync(dest, fileContents);
|
|
95
111
|
}
|
|
96
|
-
|
|
112
|
+
exports.fetchGitHubRepoContentFromDownloadUrl = fetchGitHubRepoContentFromDownloadUrl;
|
|
113
|
+
/**
|
|
114
|
+
* Writes files from a public repository to the destination folder
|
|
115
|
+
@deprecated - This method fetches all the files individually, which can hit rate limits for unauthorized requests. Use `cloneGithubRepo` instead.
|
|
116
|
+
*/
|
|
97
117
|
async function downloadGithubRepoContents(repoPath, contentPath, dest, ref, filter) {
|
|
98
118
|
fs_extra_1.default.ensureDirSync(path_1.default.dirname(dest));
|
|
99
119
|
try {
|
|
@@ -126,15 +146,12 @@ async function downloadGithubRepoContents(repoPath, contentPath, dest, ref, filt
|
|
|
126
146
|
await Promise.all(contentPromises);
|
|
127
147
|
}
|
|
128
148
|
catch (e) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, error);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
(0, standardErrors_1.throwError)(error);
|
|
149
|
+
if ((0, errors_1.isSystemError)(e) && e?.error?.message) {
|
|
150
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoContents.errors.fetchFail`, {
|
|
151
|
+
errorMessage: e.error.message,
|
|
152
|
+
}), { cause: e });
|
|
137
153
|
}
|
|
154
|
+
throw e;
|
|
138
155
|
}
|
|
139
156
|
}
|
|
140
157
|
exports.downloadGithubRepoContents = downloadGithubRepoContents;
|
|
@@ -148,15 +165,12 @@ async function listGithubRepoContents(repoPath, contentPath, fileFilter) {
|
|
|
148
165
|
return filteredFiles;
|
|
149
166
|
}
|
|
150
167
|
catch (e) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
(0, standardErrors_1.throwError)(error);
|
|
168
|
+
if ((0, errors_1.isHubSpotHttpError)(e) && e.data.message) {
|
|
169
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.downloadGithubRepoContents.errors.fetchFail`, {
|
|
170
|
+
errorMessage: e.data.message,
|
|
171
|
+
}));
|
|
159
172
|
}
|
|
173
|
+
throw e;
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
176
|
exports.listGithubRepoContents = listGithubRepoContents;
|
package/lib/gitignore.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
+
import { GitInclusionResult } from '../types/Config';
|
|
1
2
|
export declare function checkAndAddConfigToGitignore(configPath: string): void;
|
|
2
|
-
type GitInclusionResult = {
|
|
3
|
-
inGit: boolean;
|
|
4
|
-
configIgnored: boolean;
|
|
5
|
-
gitignoreFiles: Array<string>;
|
|
6
|
-
};
|
|
7
3
|
export declare function checkGitInclusion(configPath: string): GitInclusionResult;
|
|
8
|
-
export {};
|
package/lib/gitignore.js
CHANGED
|
@@ -8,7 +8,7 @@ const fs_extra_1 = require("fs-extra");
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const git_1 = require("../utils/git");
|
|
10
10
|
const config_1 = require("../constants/config");
|
|
11
|
-
const
|
|
11
|
+
const lang_1 = require("../utils/lang");
|
|
12
12
|
const i18nKey = 'lib.gitignore';
|
|
13
13
|
const GITIGNORE_FILE = '.gitignore';
|
|
14
14
|
function checkAndAddConfigToGitignore(configPath) {
|
|
@@ -26,7 +26,7 @@ function checkAndAddConfigToGitignore(configPath) {
|
|
|
26
26
|
(0, fs_extra_1.writeFileSync)(gitignoreFilePath, updatedContents);
|
|
27
27
|
}
|
|
28
28
|
catch (e) {
|
|
29
|
-
(0,
|
|
29
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.configIgnore`), { cause: e });
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.checkAndAddConfigToGitignore = checkAndAddConfigToGitignore;
|
package/lib/hubdb.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { Row, Table } from '../types/Hubdb';
|
|
2
3
|
export declare function addRowsToHubDbTable(accountId: number, tableId: string, rows?: Array<Row>): Promise<{
|
|
3
4
|
tableId: string;
|
|
4
5
|
rowCount: number;
|
|
@@ -7,7 +8,7 @@ export declare function createHubDbTable(accountId: number, src: string): Promis
|
|
|
7
8
|
tableId: string;
|
|
8
9
|
rowCount: number;
|
|
9
10
|
}>;
|
|
10
|
-
export declare function updateHubDbTable(accountId: number, tableId: string, src: string): Promise<
|
|
11
|
+
export declare function updateHubDbTable(accountId: number, tableId: string, src: string): Promise<AxiosResponse<Table, any>>;
|
|
11
12
|
export declare function downloadHubDbTable(accountId: number, tableId: string, dest: string): Promise<{
|
|
12
13
|
filePath: string;
|
|
13
14
|
}>;
|
package/lib/hubdb.js
CHANGED
|
@@ -9,11 +9,11 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
9
9
|
const prettier_1 = __importDefault(require("prettier"));
|
|
10
10
|
const hubdb_1 = require("../api/hubdb");
|
|
11
11
|
const path_2 = require("./path");
|
|
12
|
-
const
|
|
12
|
+
const lang_1 = require("../utils/lang");
|
|
13
13
|
const i18nKey = 'lib.hubdb';
|
|
14
14
|
function validateJsonPath(src) {
|
|
15
15
|
if (path_1.default.extname(src) !== '.json') {
|
|
16
|
-
(0,
|
|
16
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonPath`));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function validateJsonFile(src) {
|
|
@@ -22,10 +22,12 @@ function validateJsonFile(src) {
|
|
|
22
22
|
stats = fs_extra_1.default.statSync(src);
|
|
23
23
|
}
|
|
24
24
|
catch (err) {
|
|
25
|
-
(0,
|
|
25
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonFile`, { src }), {
|
|
26
|
+
cause: err,
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
if (!stats.isFile()) {
|
|
28
|
-
(0,
|
|
30
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.invalidJsonFile`, { src }));
|
|
29
31
|
}
|
|
30
32
|
validateJsonPath(src);
|
|
31
33
|
}
|
|
@@ -42,7 +44,7 @@ async function addRowsToHubDbTable(accountId, tableId, rows = []) {
|
|
|
42
44
|
if (rowsToUpdate.length > 0) {
|
|
43
45
|
await (0, hubdb_1.createRows)(accountId, tableId, rowsToUpdate);
|
|
44
46
|
}
|
|
45
|
-
const { rowCount } = await (0, hubdb_1.publishTable)(accountId, tableId);
|
|
47
|
+
const { data: { rowCount }, } = await (0, hubdb_1.publishTable)(accountId, tableId);
|
|
46
48
|
return {
|
|
47
49
|
tableId,
|
|
48
50
|
rowCount,
|
|
@@ -53,7 +55,7 @@ async function createHubDbTable(accountId, src) {
|
|
|
53
55
|
validateJsonFile(src);
|
|
54
56
|
const table = fs_extra_1.default.readJsonSync(src);
|
|
55
57
|
const { rows, ...schema } = table;
|
|
56
|
-
const { id } = await (0, hubdb_1.createTable)(accountId, schema);
|
|
58
|
+
const { data: { id }, } = await (0, hubdb_1.createTable)(accountId, schema);
|
|
57
59
|
return addRowsToHubDbTable(accountId, id, rows);
|
|
58
60
|
}
|
|
59
61
|
exports.createHubDbTable = createHubDbTable;
|
|
@@ -96,15 +98,15 @@ async function fetchAllRows(accountId, tableId) {
|
|
|
96
98
|
let rows = [];
|
|
97
99
|
let after = null;
|
|
98
100
|
do {
|
|
99
|
-
const
|
|
100
|
-
const { paging, results } =
|
|
101
|
+
const axiosResponse = await (0, hubdb_1.fetchRows)(accountId, tableId, after ? { after } : undefined);
|
|
102
|
+
const { paging, results } = axiosResponse.data;
|
|
101
103
|
rows = rows.concat(results);
|
|
102
104
|
after = paging && paging.next ? paging.next.after : null;
|
|
103
105
|
} while (after !== null);
|
|
104
106
|
return rows;
|
|
105
107
|
}
|
|
106
108
|
async function downloadHubDbTable(accountId, tableId, dest) {
|
|
107
|
-
const table = await (0, hubdb_1.fetchTable)(accountId, tableId);
|
|
109
|
+
const { data: table } = await (0, hubdb_1.fetchTable)(accountId, tableId);
|
|
108
110
|
dest = path_1.default.resolve((0, path_2.getCwd)(), dest || `${table.name}.hubdb.json`);
|
|
109
111
|
if (fs_extra_1.default.pathExistsSync(dest)) {
|
|
110
112
|
validateJsonFile(dest);
|
package/lib/notify.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.triggerNotify = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
|
9
9
|
const debounce_1 = __importDefault(require("debounce"));
|
|
10
|
-
const
|
|
10
|
+
const lang_1 = require("../utils/lang");
|
|
11
11
|
const i18nKey = 'utils.notify';
|
|
12
12
|
const notifyQueue = [];
|
|
13
13
|
const notifyPromises = [];
|
|
@@ -37,7 +37,7 @@ function notifyFilePath(filePathToNotify, outputToWrite) {
|
|
|
37
37
|
fs_1.default.appendFileSync(filePathToNotify, outputToWrite);
|
|
38
38
|
}
|
|
39
39
|
catch (e) {
|
|
40
|
-
(0,
|
|
40
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.filePath`, { filePath: filePathToNotify }), { cause: e });
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
package/lib/oauth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import OAuth2Manager from '../models/OAuth2Manager';
|
|
1
|
+
import { OAuth2Manager } from '../models/OAuth2Manager';
|
|
2
2
|
import { FlatAccountFields } from '../types/Accounts';
|
|
3
3
|
export declare function getOauthManager(accountId: number, accountConfig: FlatAccountFields): OAuth2Manager | undefined;
|
|
4
4
|
export declare function addOauthToAccountConfig(oauth: OAuth2Manager): void;
|
package/lib/oauth.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.addOauthToAccountConfig = exports.getOauthManager = void 0;
|
|
7
|
-
const OAuth2Manager_1 =
|
|
4
|
+
const OAuth2Manager_1 = require("../models/OAuth2Manager");
|
|
8
5
|
const auth_1 = require("../constants/auth");
|
|
9
|
-
const standardErrors_1 = require("../errors/standardErrors");
|
|
10
6
|
const logger_1 = require("./logger");
|
|
11
|
-
const getAccountIdentifier_1 = require("../
|
|
7
|
+
const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
|
|
12
8
|
const config_1 = require("../config");
|
|
13
9
|
const lang_1 = require("../utils/lang");
|
|
14
10
|
const i18nKey = 'lib.oauth';
|
|
@@ -21,23 +17,18 @@ function writeOauthTokenInfo(accountConfig) {
|
|
|
21
17
|
}
|
|
22
18
|
function getOauthManager(accountId, accountConfig) {
|
|
23
19
|
if (!oauthManagers.has(accountId)) {
|
|
24
|
-
oauthManagers.set(accountId, OAuth2Manager_1.
|
|
20
|
+
oauthManagers.set(accountId, OAuth2Manager_1.OAuth2Manager.fromConfig(accountConfig, () => writeOauthTokenInfo(accountConfig)));
|
|
25
21
|
}
|
|
26
22
|
return oauthManagers.get(accountId);
|
|
27
23
|
}
|
|
28
24
|
exports.getOauthManager = getOauthManager;
|
|
29
25
|
function addOauthToAccountConfig(oauth) {
|
|
30
26
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.addOauthToAccountConfig.init`));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.addOauthToAccountConfig.success`));
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
(0, standardErrors_1.throwError)(err);
|
|
41
|
-
}
|
|
27
|
+
(0, config_1.updateAccountConfig)({
|
|
28
|
+
...oauth.account,
|
|
29
|
+
authType: auth_1.AUTH_METHODS.oauth.value,
|
|
30
|
+
});
|
|
31
|
+
(0, config_1.writeConfig)();
|
|
32
|
+
logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.addOauthToAccountConfig.success`));
|
|
42
33
|
}
|
|
43
34
|
exports.addOauthToAccountConfig = addOauthToAccountConfig;
|