@hubspot/local-dev-lib 0.1.2 → 0.1.4-experimental.0
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 -7
- package/api/customObjects.js +13 -16
- package/api/designManager.d.ts +4 -13
- package/api/designManager.js +6 -9
- package/api/developerTestAccounts.d.ts +7 -0
- package/api/developerTestAccounts.js +48 -0
- package/api/fileManager.d.ts +5 -4
- package/api/fileManager.js +11 -11
- package/api/fileMapper.d.ts +8 -7
- package/api/fileMapper.js +17 -17
- package/api/fileTransport.d.ts +4 -0
- package/api/fileTransport.js +39 -0
- package/api/functions.d.ts +7 -4
- package/api/functions.js +22 -11
- package/api/github.d.ts +7 -9
- package/api/github.js +31 -13
- package/api/hubdb.d.ts +11 -10
- package/api/hubdb.js +28 -22
- package/api/lighthouseScore.d.ts +4 -4
- package/api/lighthouseScore.js +9 -12
- package/api/localDevAuth.d.ts +8 -16
- package/api/localDevAuth.js +34 -13
- package/api/marketplaceValidation.d.ts +4 -4
- package/api/marketplaceValidation.js +8 -11
- package/api/projects.d.ts +31 -24
- package/api/projects.js +164 -44
- package/api/sandboxHubs.d.ts +6 -4
- package/api/sandboxHubs.js +10 -11
- 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 +15 -11
- package/config/CLIConfiguration.js +175 -90
- package/config/configFile.js +12 -18
- package/config/configUtils.d.ts +2 -21
- package/config/configUtils.js +5 -4
- package/config/config_DEPRECATED.d.ts +6 -8
- package/config/config_DEPRECATED.js +79 -25
- package/config/environment.js +5 -4
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +13 -8
- package/config/index.js +97 -57
- package/constants/config.d.ts +18 -1
- package/constants/config.js +20 -3
- package/constants/environments.d.ts +1 -0
- package/constants/environments.js +1 -0
- package/constants/extensions.d.ts +2 -0
- package/constants/extensions.js +3 -1
- package/constants/files.d.ts +2 -2
- package/constants/files.js +3 -3
- 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 +6 -3
- package/http/getAxiosConfig.js +51 -7
- package/http/index.d.ts +11 -12
- package/http/index.js +35 -41
- package/http/unauthed.d.ts +14 -0
- package/http/unauthed.js +38 -0
- package/lang/en.json +378 -386
- package/lib/archive.d.ts +2 -8
- package/lib/archive.js +34 -30
- package/lib/cms/functions.d.ts +7 -12
- package/lib/cms/functions.js +49 -51
- package/lib/cms/handleFieldsJS.js +16 -14
- package/lib/cms/modules.d.ts +4 -15
- package/lib/cms/modules.js +81 -78
- package/lib/cms/processFieldsJs.js +10 -33
- package/lib/cms/templates.d.ts +43 -3
- package/lib/cms/templates.js +53 -11
- package/lib/cms/uploadFolder.d.ts +3 -14
- package/lib/cms/uploadFolder.js +58 -42
- package/lib/cms/validate.js +1 -1
- package/lib/cms/watch.d.ts +2 -18
- package/lib/cms/watch.js +63 -68
- package/lib/customObjects.js +4 -15
- package/lib/fileManager.d.ts +2 -6
- package/lib/fileManager.js +54 -65
- package/lib/fileMapper.d.ts +4 -15
- package/lib/fileMapper.js +67 -88
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +10 -6
- package/lib/github.d.ts +9 -14
- package/lib/github.js +61 -32
- package/lib/gitignore.d.ts +2 -0
- package/lib/gitignore.js +21 -4
- package/lib/hubdb.d.ts +3 -2
- package/lib/hubdb.js +11 -9
- package/{utils → lib}/notify.js +2 -2
- package/lib/oauth.d.ts +2 -5
- package/lib/oauth.js +14 -25
- package/lib/path.d.ts +3 -0
- package/lib/path.js +46 -1
- package/lib/personalAccessKey.d.ts +8 -11
- package/lib/personalAccessKey.js +76 -38
- package/lib/portManager.d.ts +3 -5
- package/lib/portManager.js +18 -6
- package/lib/trackUsage.js +18 -11
- package/lib/urls.js +5 -1
- package/models/FileSystemError.d.ts +6 -0
- package/models/FileSystemError.js +47 -0
- package/models/HubSpotHttpError.d.ts +24 -0
- package/models/HubSpotHttpError.js +197 -0
- package/models/OAuth2Manager.d.ts +5 -27
- package/models/OAuth2Manager.js +41 -64
- package/package.json +34 -34
- package/types/Accounts.d.ts +103 -3
- package/types/Apps.d.ts +77 -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 +19 -2
- package/types/Deploy.d.ts +3 -2
- package/types/DesignManager.d.ts +10 -0
- package/types/DesignManager.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/Functions.d.ts +52 -0
- package/types/Github.d.ts +12 -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 +28 -0
- package/types/Migration.js +10 -0
- package/types/Modules.d.ts +11 -0
- package/types/PortManager.d.ts +7 -0
- package/types/Project.d.ts +30 -0
- package/types/ProjectLog.d.ts +9 -0
- package/types/ProjectLog.js +2 -0
- package/types/Sandbox.d.ts +37 -47
- package/types/Schemas.d.ts +12 -0
- package/types/Secrets.d.ts +3 -0
- package/types/Secrets.js +2 -0
- package/types/developerTestAccounts.d.ts +13 -0
- package/types/developerTestAccounts.js +2 -0
- package/utils/PortManagerServer.d.ts +6 -7
- package/utils/PortManagerServer.js +22 -16
- 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/utils/git.d.ts +1 -7
- package/utils/git.js +2 -18
- package/errors/apiErrors.d.ts +0 -19
- package/errors/apiErrors.js +0 -179
- package/errors/fileSystemErrors.d.ts +0 -5
- package/errors/fileSystemErrors.js +0 -31
- package/errors/standardErrors.d.ts +0 -27
- package/errors/standardErrors.js +0 -59
- package/lang/lang/en.json +0 -401
- package/lib/logging/git.d.ts +0 -2
- package/lib/logging/git.js +0 -54
- package/lib/logging/logs.d.ts +0 -22
- package/lib/logging/logs.js +0 -86
- package/lib/logging/table.d.ts +0 -3
- package/lib/logging/table.js +0 -47
- package/lib/sandboxes.d.ts +0 -14
- package/lib/sandboxes.js +0 -71
- package/models/HubSpotAuthError.d.ts +0 -12
- package/models/HubSpotAuthError.js +0 -20
- package/types/LogCallbacks.d.ts +0 -7
- package/utils/logger.d.ts +0 -5
- package/utils/logger.js +0 -23
- package/utils/objectUtils.d.ts +0 -8
- package/utils/objectUtils.js +0 -33
- /package/{utils → lib}/escapeRegExp.d.ts +0 -0
- /package/{utils → lib}/escapeRegExp.js +0 -0
- /package/lib/{logging/logger.d.ts → logger.d.ts} +0 -0
- /package/lib/{logging/logger.js → logger.js} +0 -0
- /package/{utils → lib}/notify.d.ts +0 -0
- /package/types/{LogCallbacks.js → Apps.js} +0 -0
package/lib/logging/logs.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.outputLogs = void 0;
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const logger_1 = require("./logger");
|
|
10
|
-
const lang_1 = require("../../utils/lang");
|
|
11
|
-
const i18nKey = 'lib.logging.logs';
|
|
12
|
-
const SEPARATOR = ' - ';
|
|
13
|
-
const LOG_STATUS_COLORS = {
|
|
14
|
-
SUCCESS: logger_1.Styles.success,
|
|
15
|
-
ERROR: logger_1.Styles.error,
|
|
16
|
-
UNHANDLED_ERROR: logger_1.Styles.error,
|
|
17
|
-
HANDLED_ERROR: logger_1.Styles.error,
|
|
18
|
-
};
|
|
19
|
-
function errorHandler(log, options) {
|
|
20
|
-
return `${formatLogHeader(log, options)}${formatError(log, options)}`;
|
|
21
|
-
}
|
|
22
|
-
const logHandler = {
|
|
23
|
-
ERROR: errorHandler,
|
|
24
|
-
UNHANDLED_ERROR: errorHandler,
|
|
25
|
-
HANDLED_ERROR: errorHandler,
|
|
26
|
-
SUCCESS: (log, options) => {
|
|
27
|
-
return `${formatLogHeader(log, options)}${formatSuccess(log, options)}`;
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
function formatSuccess(log, options) {
|
|
31
|
-
if (!log.log || options.compact) {
|
|
32
|
-
return '';
|
|
33
|
-
}
|
|
34
|
-
return `\n${log.log}`;
|
|
35
|
-
}
|
|
36
|
-
function formatError(log, options) {
|
|
37
|
-
if (!log.error || options.compact) {
|
|
38
|
-
return '';
|
|
39
|
-
}
|
|
40
|
-
return `${log.error.type}: ${log.error.message}\n${formatStackTrace(log)}`;
|
|
41
|
-
}
|
|
42
|
-
function formatLogHeader(log, options) {
|
|
43
|
-
const color = LOG_STATUS_COLORS[log.status];
|
|
44
|
-
const headerInsertion = options && options.insertions && options.insertions.header;
|
|
45
|
-
return `${formatTimestamp(log)}${SEPARATOR}${color(log.status)}${headerInsertion ? `${SEPARATOR}${headerInsertion}` : ''}${SEPARATOR}${formatExecutionTime(log)}`;
|
|
46
|
-
}
|
|
47
|
-
function formatStackTrace(log) {
|
|
48
|
-
const stackTrace = (log.error.stackTrace && log.error.stackTrace[0]) || [];
|
|
49
|
-
return stackTrace
|
|
50
|
-
.map(trace => {
|
|
51
|
-
return ` at ${trace}\n`;
|
|
52
|
-
})
|
|
53
|
-
.join('');
|
|
54
|
-
}
|
|
55
|
-
function formatTimestamp(log) {
|
|
56
|
-
return `${chalk_1.default.whiteBright((0, moment_1.default)(log.createdAt).toISOString())}`;
|
|
57
|
-
}
|
|
58
|
-
function formatExecutionTime(log) {
|
|
59
|
-
return `${chalk_1.default.whiteBright('Execution Time:')} ${log.executionTime}ms`;
|
|
60
|
-
}
|
|
61
|
-
function processLog(log, options) {
|
|
62
|
-
try {
|
|
63
|
-
return logHandler[log.status](log, options);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.unableToProcessLog`, {
|
|
67
|
-
log: JSON.stringify(log),
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function processLogs(logsResp, options) {
|
|
72
|
-
if (!logsResp || (logsResp.results && !logsResp.results.length)) {
|
|
73
|
-
return 'No logs found.';
|
|
74
|
-
}
|
|
75
|
-
else if (logsResp.results && logsResp.results.length) {
|
|
76
|
-
return logsResp.results
|
|
77
|
-
.map(log => {
|
|
78
|
-
return processLog(log, options);
|
|
79
|
-
})
|
|
80
|
-
.join('\n');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function outputLogs(logsResp, options) {
|
|
84
|
-
logger_1.logger.log(processLogs(logsResp, options));
|
|
85
|
-
}
|
|
86
|
-
exports.outputLogs = outputLogs;
|
package/lib/logging/table.d.ts
DELETED
package/lib/logging/table.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTableHeader = exports.getTableContents = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const table_1 = require("table");
|
|
9
|
-
const objectUtils_1 = require("../../utils/objectUtils");
|
|
10
|
-
const tableConfigDefaults = {
|
|
11
|
-
singleLine: true,
|
|
12
|
-
border: {
|
|
13
|
-
topBody: '',
|
|
14
|
-
topJoin: '',
|
|
15
|
-
topLeft: '',
|
|
16
|
-
topRight: '',
|
|
17
|
-
bottomBody: '',
|
|
18
|
-
bottomJoin: '',
|
|
19
|
-
bottomLeft: '',
|
|
20
|
-
bottomRight: '',
|
|
21
|
-
bodyLeft: '',
|
|
22
|
-
bodyRight: '',
|
|
23
|
-
bodyJoin: '',
|
|
24
|
-
joinBody: '',
|
|
25
|
-
joinLeft: '',
|
|
26
|
-
joinRight: '',
|
|
27
|
-
joinJoin: '',
|
|
28
|
-
},
|
|
29
|
-
columnDefault: {
|
|
30
|
-
paddingLeft: 0,
|
|
31
|
-
paddingRight: 1,
|
|
32
|
-
},
|
|
33
|
-
drawHorizontalLine: () => {
|
|
34
|
-
return false;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
function getTableContents(
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
tableData = [], tableConfig = {}) {
|
|
40
|
-
const mergedConfig = (0, objectUtils_1.mergeDeep)({}, tableConfigDefaults, tableConfig);
|
|
41
|
-
return (0, table_1.table)(tableData, mergedConfig);
|
|
42
|
-
}
|
|
43
|
-
exports.getTableContents = getTableContents;
|
|
44
|
-
function getTableHeader(headerItems) {
|
|
45
|
-
return headerItems.map(headerItem => chalk_1.default.bold(headerItem));
|
|
46
|
-
}
|
|
47
|
-
exports.getTableHeader = getTableHeader;
|
package/lib/sandboxes.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { InitiateSyncResponse, Sandbox, SandboxType, SyncTask, Task, Usage } from '../types/Sandbox';
|
|
2
|
-
export declare function createSandbox(accountId: number, name: string, type: string): Promise<{
|
|
3
|
-
name: string;
|
|
4
|
-
sandbox: Sandbox;
|
|
5
|
-
personalAccessKey: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function deleteSandbox(parentAccountId: number, sandboxAccountId: number): Promise<{
|
|
8
|
-
parentAccountId: number;
|
|
9
|
-
sandboxAccountId: number;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function getSandboxUsageLimits(parentAccountId: number): Promise<Usage | void>;
|
|
12
|
-
export declare function initiateSync(fromHubId: number, toHubId: number, tasks: Array<SyncTask>, sandboxHubId: number): Promise<InitiateSyncResponse>;
|
|
13
|
-
export declare function fetchTaskStatus(accountId: number, taskId: number): Promise<Task>;
|
|
14
|
-
export declare function fetchTypes(accountId: number, toHubId: number): Promise<Array<SandboxType> | void>;
|
package/lib/sandboxes.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchTypes = exports.fetchTaskStatus = exports.initiateSync = exports.getSandboxUsageLimits = exports.deleteSandbox = exports.createSandbox = void 0;
|
|
4
|
-
const sandboxHubs_1 = require("../api/sandboxHubs");
|
|
5
|
-
const sandboxSync_1 = require("../api/sandboxSync");
|
|
6
|
-
const standardErrors_1 = require("../errors/standardErrors");
|
|
7
|
-
const i18nKey = 'lib.sandboxes';
|
|
8
|
-
async function createSandbox(accountId, name, type) {
|
|
9
|
-
try {
|
|
10
|
-
const resp = await (0, sandboxHubs_1.createSandbox)(accountId, name, type);
|
|
11
|
-
return {
|
|
12
|
-
name,
|
|
13
|
-
...resp,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.createSandbox`, {}, err);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.createSandbox = createSandbox;
|
|
21
|
-
async function deleteSandbox(parentAccountId, sandboxAccountId) {
|
|
22
|
-
try {
|
|
23
|
-
await (0, sandboxHubs_1.deleteSandbox)(parentAccountId, sandboxAccountId);
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.deleteSandbox`, {}, err);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
parentAccountId,
|
|
30
|
-
sandboxAccountId,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.deleteSandbox = deleteSandbox;
|
|
34
|
-
async function getSandboxUsageLimits(parentAccountId) {
|
|
35
|
-
try {
|
|
36
|
-
const resp = await (0, sandboxHubs_1.getSandboxUsageLimits)(parentAccountId);
|
|
37
|
-
return resp && resp.usage;
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.getSandboxUsageLimits`, {}, err);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.getSandboxUsageLimits = getSandboxUsageLimits;
|
|
44
|
-
async function initiateSync(fromHubId, toHubId, tasks, sandboxHubId) {
|
|
45
|
-
try {
|
|
46
|
-
return await (0, sandboxSync_1.initiateSync)(fromHubId, toHubId, tasks, sandboxHubId);
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.initiateSync`, {}, err);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.initiateSync = initiateSync;
|
|
53
|
-
async function fetchTaskStatus(accountId, taskId) {
|
|
54
|
-
try {
|
|
55
|
-
return await (0, sandboxSync_1.fetchTaskStatus)(accountId, taskId);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.fetchTaskStatus`, {}, err);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.fetchTaskStatus = fetchTaskStatus;
|
|
62
|
-
async function fetchTypes(accountId, toHubId) {
|
|
63
|
-
try {
|
|
64
|
-
const resp = await (0, sandboxSync_1.fetchTypes)(accountId, toHubId);
|
|
65
|
-
return resp && resp.results;
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.fetchTypes`, {}, err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.fetchTypes = fetchTypes;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AxiosError } from 'axios';
|
|
2
|
-
export declare class HubSpotAuthError extends Error {
|
|
3
|
-
status?: number;
|
|
4
|
-
category?: string;
|
|
5
|
-
subCategory?: string;
|
|
6
|
-
constructor(message: string, { cause, }: {
|
|
7
|
-
cause?: Partial<AxiosError<{
|
|
8
|
-
category?: string;
|
|
9
|
-
subCategory?: string;
|
|
10
|
-
}>>;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HubSpotAuthError = void 0;
|
|
4
|
-
class HubSpotAuthError extends Error {
|
|
5
|
-
status;
|
|
6
|
-
category;
|
|
7
|
-
subCategory;
|
|
8
|
-
constructor(message, { cause = {}, }) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = 'HubSpotAuthError';
|
|
11
|
-
this.status = cause.response?.status;
|
|
12
|
-
this.category = cause?.response?.data?.category || undefined;
|
|
13
|
-
this.subCategory =
|
|
14
|
-
(cause.response &&
|
|
15
|
-
cause.response.data &&
|
|
16
|
-
cause.response.data.subCategory) ||
|
|
17
|
-
undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.HubSpotAuthError = HubSpotAuthError;
|
package/types/LogCallbacks.d.ts
DELETED
package/utils/logger.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LogCallbacks } from '../types/LogCallbacks';
|
|
2
|
-
import { InterpolationData, LangKey } from '../types/Lang';
|
|
3
|
-
export declare function log<T extends string>(key: T, callbacks?: LogCallbacks<T>, debugKey?: LangKey, interpolationData?: InterpolationData): void;
|
|
4
|
-
export declare function makeTypedLogger<T extends readonly string[]>(callbacks?: LogCallbacks<T[number]>): (key: T[number], debugKey?: LangKey, interpolationData?: InterpolationData) => void;
|
|
5
|
-
export declare function debug(identifier: LangKey, interpolationData?: InterpolationData): void;
|
package/utils/logger.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.debug = exports.makeTypedLogger = exports.log = void 0;
|
|
4
|
-
const lang_1 = require("./lang");
|
|
5
|
-
const logger_1 = require("../lib/logging/logger");
|
|
6
|
-
function log(key, callbacks, debugKey, interpolationData) {
|
|
7
|
-
if (callbacks && callbacks[key]) {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9
|
-
callbacks[key](interpolationData);
|
|
10
|
-
}
|
|
11
|
-
else if (debugKey) {
|
|
12
|
-
debug(debugKey, interpolationData);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.log = log;
|
|
16
|
-
function makeTypedLogger(callbacks) {
|
|
17
|
-
return (key, debugKey, interpolationData) => log(key, callbacks, debugKey, interpolationData);
|
|
18
|
-
}
|
|
19
|
-
exports.makeTypedLogger = makeTypedLogger;
|
|
20
|
-
function debug(identifier, interpolationData) {
|
|
21
|
-
logger_1.logger.debug((0, lang_1.i18n)(identifier, interpolationData));
|
|
22
|
-
}
|
|
23
|
-
exports.debug = debug;
|
package/utils/objectUtils.d.ts
DELETED
package/utils/objectUtils.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeDeep = exports.isObject = void 0;
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
function isObject(item) {
|
|
6
|
-
return item && typeof item === 'object' && !Array.isArray(item);
|
|
7
|
-
}
|
|
8
|
-
exports.isObject = isObject;
|
|
9
|
-
function mergeDeep(
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
target,
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
...sources
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
) {
|
|
16
|
-
if (!sources.length)
|
|
17
|
-
return target;
|
|
18
|
-
const source = sources.shift();
|
|
19
|
-
if (isObject(target) && source && isObject(source)) {
|
|
20
|
-
for (const key in source) {
|
|
21
|
-
if (isObject(source[key])) {
|
|
22
|
-
if (!target[key])
|
|
23
|
-
Object.assign(target, { [key]: {} });
|
|
24
|
-
mergeDeep(target[key], source[key]);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
Object.assign(target, { [key]: source[key] });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return mergeDeep(target, ...sources);
|
|
32
|
-
}
|
|
33
|
-
exports.mergeDeep = mergeDeep;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|