@atom8n/backend-common 1.2.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/dist/build.tsbuildinfo +1 -0
- package/dist/cli-parser.d.ts +18 -0
- package/dist/cli-parser.js +55 -0
- package/dist/cli-parser.js.map +1 -0
- package/dist/environment.d.ts +3 -0
- package/dist/environment.js +8 -0
- package/dist/environment.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/license-state.d.ts +51 -0
- package/dist/license-state.js +175 -0
- package/dist/license-state.js.map +1 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +6 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.d.ts +37 -0
- package/dist/logging/logger.js +250 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/modules/errors/missing-module.error.d.ts +4 -0
- package/dist/modules/errors/missing-module.error.js +11 -0
- package/dist/modules/errors/missing-module.error.js.map +1 -0
- package/dist/modules/errors/module-confusion.error.d.ts +4 -0
- package/dist/modules/errors/module-confusion.error.js +12 -0
- package/dist/modules/errors/module-confusion.error.js.map +1 -0
- package/dist/modules/errors/unknown-module.error.d.ts +4 -0
- package/dist/modules/errors/unknown-module.error.js +11 -0
- package/dist/modules/errors/unknown-module.error.js.map +1 -0
- package/dist/modules/module-registry.d.ts +27 -0
- package/dist/modules/module-registry.js +187 -0
- package/dist/modules/module-registry.js.map +1 -0
- package/dist/modules/modules.config.d.ts +11 -0
- package/dist/modules/modules.config.js +53 -0
- package/dist/modules/modules.config.js.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/is-object-literal.d.ts +5 -0
- package/dist/utils/is-object-literal.js +10 -0
- package/dist/utils/is-object-literal.js.map +1 -0
- package/dist/utils/path-util.d.ts +2 -0
- package/dist/utils/path-util.js +55 -0
- package/dist/utils/path-util.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { Logger } from './logging';
|
|
3
|
+
type CliInput<Flags extends z.ZodRawShape> = {
|
|
4
|
+
argv: string[];
|
|
5
|
+
flagsSchema?: z.ZodObject<Flags>;
|
|
6
|
+
description?: string;
|
|
7
|
+
examples?: string[];
|
|
8
|
+
};
|
|
9
|
+
type ParsedArgs<Flags = Record<string, unknown>> = {
|
|
10
|
+
flags: Flags;
|
|
11
|
+
args: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare class CliParser {
|
|
14
|
+
private readonly logger;
|
|
15
|
+
constructor(logger: Logger);
|
|
16
|
+
parse<Flags extends z.ZodRawShape>(input: CliInput<Flags>): ParsedArgs<z.infer<z.ZodObject<Flags>>>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CliParser = void 0;
|
|
16
|
+
const di_1 = require("@n8n/di");
|
|
17
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
18
|
+
const logging_1 = require("./logging");
|
|
19
|
+
let CliParser = class CliParser {
|
|
20
|
+
constructor(logger) {
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
}
|
|
23
|
+
parse(input) {
|
|
24
|
+
const { _: rest, ...rawFlags } = (0, yargs_parser_1.default)(input.argv, { string: ['id'] });
|
|
25
|
+
let flags = {};
|
|
26
|
+
if (input.flagsSchema) {
|
|
27
|
+
for (const key in input.flagsSchema.shape) {
|
|
28
|
+
const flagSchema = input.flagsSchema.shape[key];
|
|
29
|
+
let schemaDef = flagSchema._def;
|
|
30
|
+
if (schemaDef.typeName === 'ZodOptional' && schemaDef.innerType) {
|
|
31
|
+
schemaDef = schemaDef.innerType._def;
|
|
32
|
+
}
|
|
33
|
+
const alias = schemaDef._alias;
|
|
34
|
+
if (alias?.length && !(key in rawFlags) && rawFlags[alias]) {
|
|
35
|
+
rawFlags[key] = rawFlags[alias];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
flags = input.flagsSchema.parse(rawFlags);
|
|
39
|
+
}
|
|
40
|
+
const args = rest.map(String).slice(2);
|
|
41
|
+
this.logger.debug('Received CLI command', {
|
|
42
|
+
execPath: rest[0],
|
|
43
|
+
scriptPath: rest[1],
|
|
44
|
+
args,
|
|
45
|
+
flags,
|
|
46
|
+
});
|
|
47
|
+
return { flags, args };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.CliParser = CliParser;
|
|
51
|
+
exports.CliParser = CliParser = __decorate([
|
|
52
|
+
(0, di_1.Service)(),
|
|
53
|
+
__metadata("design:paramtypes", [logging_1.Logger])
|
|
54
|
+
], CliParser);
|
|
55
|
+
//# sourceMappingURL=cli-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-parser.js","sourceRoot":"","sources":["../src/cli-parser.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C,CAAC,CAAC,CAAC;QAEvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACzC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YACjB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;YACnB,IAAI;YACJ,KAAK;SACL,CAAC,CAAC;QAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxB,CAAC;CACD,CAAA;AA3CY,8BAAS;oBAAT,SAAS;IADrB,IAAA,YAAO,GAAE;qCAE4B,gBAAM;GAD/B,SAAS,CA2CrB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inDevelopment = exports.inProduction = exports.inTest = void 0;
|
|
4
|
+
const { NODE_ENV } = process.env;
|
|
5
|
+
exports.inTest = NODE_ENV === 'test';
|
|
6
|
+
exports.inProduction = NODE_ENV === 'production';
|
|
7
|
+
exports.inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
|
8
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEpB,QAAA,MAAM,GAAG,QAAQ,KAAK,MAAM,CAAC;AAC7B,QAAA,YAAY,GAAG,QAAQ,KAAK,YAAY,CAAC;AACzC,QAAA,aAAa,GAAG,CAAC,QAAQ,IAAI,QAAQ,KAAK,aAAa,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './license-state';
|
|
2
|
+
export type * from './types';
|
|
3
|
+
export { inDevelopment, inProduction, inTest } from './environment';
|
|
4
|
+
export { isObjectLiteral } from './utils/is-object-literal';
|
|
5
|
+
export { Logger } from './logging/logger';
|
|
6
|
+
export { ModuleRegistry } from './modules/module-registry';
|
|
7
|
+
export type { ModuleName } from './modules/modules.config';
|
|
8
|
+
export { ModulesConfig } from './modules/modules.config';
|
|
9
|
+
export { isContainedWithin, safeJoinPath } from './utils/path-util';
|
|
10
|
+
export { CliParser } from './cli-parser';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CliParser = exports.safeJoinPath = exports.isContainedWithin = exports.ModulesConfig = exports.ModuleRegistry = exports.Logger = exports.isObjectLiteral = exports.inTest = exports.inProduction = exports.inDevelopment = void 0;
|
|
18
|
+
__exportStar(require("./license-state"), exports);
|
|
19
|
+
var environment_1 = require("./environment");
|
|
20
|
+
Object.defineProperty(exports, "inDevelopment", { enumerable: true, get: function () { return environment_1.inDevelopment; } });
|
|
21
|
+
Object.defineProperty(exports, "inProduction", { enumerable: true, get: function () { return environment_1.inProduction; } });
|
|
22
|
+
Object.defineProperty(exports, "inTest", { enumerable: true, get: function () { return environment_1.inTest; } });
|
|
23
|
+
var is_object_literal_1 = require("./utils/is-object-literal");
|
|
24
|
+
Object.defineProperty(exports, "isObjectLiteral", { enumerable: true, get: function () { return is_object_literal_1.isObjectLiteral; } });
|
|
25
|
+
var logger_1 = require("./logging/logger");
|
|
26
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
27
|
+
var module_registry_1 = require("./modules/module-registry");
|
|
28
|
+
Object.defineProperty(exports, "ModuleRegistry", { enumerable: true, get: function () { return module_registry_1.ModuleRegistry; } });
|
|
29
|
+
var modules_config_1 = require("./modules/modules.config");
|
|
30
|
+
Object.defineProperty(exports, "ModulesConfig", { enumerable: true, get: function () { return modules_config_1.ModulesConfig; } });
|
|
31
|
+
var path_util_1 = require("./utils/path-util");
|
|
32
|
+
Object.defineProperty(exports, "isContainedWithin", { enumerable: true, get: function () { return path_util_1.isContainedWithin; } });
|
|
33
|
+
Object.defineProperty(exports, "safeJoinPath", { enumerable: true, get: function () { return path_util_1.safeJoinPath; } });
|
|
34
|
+
var cli_parser_1 = require("./cli-parser");
|
|
35
|
+
Object.defineProperty(exports, "CliParser", { enumerable: true, get: function () { return cli_parser_1.CliParser; } });
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAGhC,6CAAoE;AAA3D,4GAAA,aAAa,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,qGAAA,MAAM,OAAA;AAC5C,+DAA4D;AAAnD,oHAAA,eAAe,OAAA;AACxB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6DAA2D;AAAlD,iHAAA,cAAc,OAAA;AAEvB,2DAAyD;AAAhD,+GAAA,aAAa,OAAA;AACtB,+CAAoE;AAA3D,8GAAA,iBAAiB,OAAA;AAAE,yGAAA,YAAY,OAAA;AACxC,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { BooleanLicenseFeature } from '@n8n/constants';
|
|
2
|
+
import type { FeatureReturnType, LicenseProvider } from './types';
|
|
3
|
+
export declare class LicenseState {
|
|
4
|
+
licenseProvider: LicenseProvider | null;
|
|
5
|
+
setLicenseProvider(provider: LicenseProvider): void;
|
|
6
|
+
private assertProvider;
|
|
7
|
+
isLicensed(feature: BooleanLicenseFeature | BooleanLicenseFeature[]): boolean;
|
|
8
|
+
getValue<T extends keyof FeatureReturnType>(feature: T): FeatureReturnType[T];
|
|
9
|
+
isCustomRolesLicensed(): boolean;
|
|
10
|
+
isDynamicCredentialsLicensed(): boolean;
|
|
11
|
+
isSharingLicensed(): boolean;
|
|
12
|
+
isLogStreamingLicensed(): boolean;
|
|
13
|
+
isLdapLicensed(): boolean;
|
|
14
|
+
isSamlLicensed(): boolean;
|
|
15
|
+
isOidcLicensed(): boolean;
|
|
16
|
+
isMFAEnforcementLicensed(): boolean;
|
|
17
|
+
isApiKeyScopesLicensed(): boolean;
|
|
18
|
+
isAiAssistantLicensed(): boolean;
|
|
19
|
+
isAskAiLicensed(): boolean;
|
|
20
|
+
isAiCreditsLicensed(): boolean;
|
|
21
|
+
isAdvancedExecutionFiltersLicensed(): boolean;
|
|
22
|
+
isAdvancedPermissionsLicensed(): boolean;
|
|
23
|
+
isDebugInEditorLicensed(): boolean;
|
|
24
|
+
isBinaryDataS3Licensed(): boolean;
|
|
25
|
+
isMultiMainLicensed(): boolean;
|
|
26
|
+
isVariablesLicensed(): boolean;
|
|
27
|
+
isSourceControlLicensed(): boolean;
|
|
28
|
+
isExternalSecretsLicensed(): boolean;
|
|
29
|
+
isAPIDisabled(): boolean;
|
|
30
|
+
isWorkerViewLicensed(): boolean;
|
|
31
|
+
isProjectRoleAdminLicensed(): boolean;
|
|
32
|
+
isProjectRoleEditorLicensed(): boolean;
|
|
33
|
+
isProjectRoleViewerLicensed(): boolean;
|
|
34
|
+
isCustomNpmRegistryLicensed(): boolean;
|
|
35
|
+
isFoldersLicensed(): boolean;
|
|
36
|
+
isInsightsSummaryLicensed(): boolean;
|
|
37
|
+
isInsightsDashboardLicensed(): boolean;
|
|
38
|
+
isInsightsHourlyDataLicensed(): boolean;
|
|
39
|
+
isWorkflowDiffsLicensed(): boolean;
|
|
40
|
+
isProvisioningLicensed(): boolean;
|
|
41
|
+
getMaxUsers(): number;
|
|
42
|
+
getMaxActiveWorkflows(): number;
|
|
43
|
+
getMaxVariables(): number;
|
|
44
|
+
getMaxAiCredits(): number;
|
|
45
|
+
getWorkflowHistoryPruneQuota(): number;
|
|
46
|
+
getInsightsMaxHistory(): number;
|
|
47
|
+
getInsightsRetentionMaxAge(): number;
|
|
48
|
+
getInsightsRetentionPruneInterval(): number;
|
|
49
|
+
getMaxTeamProjects(): number;
|
|
50
|
+
getMaxWorkflowsWithEvaluations(): number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LicenseState = void 0;
|
|
10
|
+
const constants_1 = require("@n8n/constants");
|
|
11
|
+
const di_1 = require("@n8n/di");
|
|
12
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
13
|
+
class ProviderNotSetError extends n8n_workflow_1.UnexpectedError {
|
|
14
|
+
constructor() {
|
|
15
|
+
super('Cannot query license state because license provider has not been set');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
let LicenseState = class LicenseState {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.licenseProvider = null;
|
|
21
|
+
}
|
|
22
|
+
setLicenseProvider(provider) {
|
|
23
|
+
this.licenseProvider = provider;
|
|
24
|
+
}
|
|
25
|
+
assertProvider() {
|
|
26
|
+
if (!this.licenseProvider)
|
|
27
|
+
throw new ProviderNotSetError();
|
|
28
|
+
}
|
|
29
|
+
isLicensed(feature) {
|
|
30
|
+
this.assertProvider();
|
|
31
|
+
if (typeof feature === 'string')
|
|
32
|
+
return this.licenseProvider.isLicensed(feature);
|
|
33
|
+
for (const featureName of feature) {
|
|
34
|
+
if (this.licenseProvider.isLicensed(featureName)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
getValue(feature) {
|
|
41
|
+
this.assertProvider();
|
|
42
|
+
return this.licenseProvider.getValue(feature);
|
|
43
|
+
}
|
|
44
|
+
isCustomRolesLicensed() {
|
|
45
|
+
return this.isLicensed(constants_1.LICENSE_FEATURES.CUSTOM_ROLES);
|
|
46
|
+
}
|
|
47
|
+
isDynamicCredentialsLicensed() {
|
|
48
|
+
return this.isLicensed(constants_1.LICENSE_FEATURES.DYNAMIC_CREDENTIALS);
|
|
49
|
+
}
|
|
50
|
+
isSharingLicensed() {
|
|
51
|
+
return this.isLicensed('feat:sharing');
|
|
52
|
+
}
|
|
53
|
+
isLogStreamingLicensed() {
|
|
54
|
+
return this.isLicensed('feat:logStreaming');
|
|
55
|
+
}
|
|
56
|
+
isLdapLicensed() {
|
|
57
|
+
return this.isLicensed('feat:ldap');
|
|
58
|
+
}
|
|
59
|
+
isSamlLicensed() {
|
|
60
|
+
return this.isLicensed('feat:saml');
|
|
61
|
+
}
|
|
62
|
+
isOidcLicensed() {
|
|
63
|
+
return this.isLicensed('feat:oidc');
|
|
64
|
+
}
|
|
65
|
+
isMFAEnforcementLicensed() {
|
|
66
|
+
return this.isLicensed('feat:mfaEnforcement');
|
|
67
|
+
}
|
|
68
|
+
isApiKeyScopesLicensed() {
|
|
69
|
+
return this.isLicensed('feat:apiKeyScopes');
|
|
70
|
+
}
|
|
71
|
+
isAiAssistantLicensed() {
|
|
72
|
+
return this.isLicensed('feat:aiAssistant');
|
|
73
|
+
}
|
|
74
|
+
isAskAiLicensed() {
|
|
75
|
+
return this.isLicensed('feat:askAi');
|
|
76
|
+
}
|
|
77
|
+
isAiCreditsLicensed() {
|
|
78
|
+
return this.isLicensed('feat:aiCredits');
|
|
79
|
+
}
|
|
80
|
+
isAdvancedExecutionFiltersLicensed() {
|
|
81
|
+
return this.isLicensed('feat:advancedExecutionFilters');
|
|
82
|
+
}
|
|
83
|
+
isAdvancedPermissionsLicensed() {
|
|
84
|
+
return this.isLicensed('feat:advancedPermissions');
|
|
85
|
+
}
|
|
86
|
+
isDebugInEditorLicensed() {
|
|
87
|
+
return this.isLicensed('feat:debugInEditor');
|
|
88
|
+
}
|
|
89
|
+
isBinaryDataS3Licensed() {
|
|
90
|
+
return this.isLicensed('feat:binaryDataS3');
|
|
91
|
+
}
|
|
92
|
+
isMultiMainLicensed() {
|
|
93
|
+
return this.isLicensed('feat:multipleMainInstances');
|
|
94
|
+
}
|
|
95
|
+
isVariablesLicensed() {
|
|
96
|
+
return this.isLicensed('feat:variables');
|
|
97
|
+
}
|
|
98
|
+
isSourceControlLicensed() {
|
|
99
|
+
return this.isLicensed('feat:sourceControl');
|
|
100
|
+
}
|
|
101
|
+
isExternalSecretsLicensed() {
|
|
102
|
+
return this.isLicensed('feat:externalSecrets');
|
|
103
|
+
}
|
|
104
|
+
isAPIDisabled() {
|
|
105
|
+
return this.isLicensed('feat:apiDisabled');
|
|
106
|
+
}
|
|
107
|
+
isWorkerViewLicensed() {
|
|
108
|
+
return this.isLicensed('feat:workerView');
|
|
109
|
+
}
|
|
110
|
+
isProjectRoleAdminLicensed() {
|
|
111
|
+
return this.isLicensed('feat:projectRole:admin');
|
|
112
|
+
}
|
|
113
|
+
isProjectRoleEditorLicensed() {
|
|
114
|
+
return this.isLicensed('feat:projectRole:editor');
|
|
115
|
+
}
|
|
116
|
+
isProjectRoleViewerLicensed() {
|
|
117
|
+
return this.isLicensed('feat:projectRole:viewer');
|
|
118
|
+
}
|
|
119
|
+
isCustomNpmRegistryLicensed() {
|
|
120
|
+
return this.isLicensed('feat:communityNodes:customRegistry');
|
|
121
|
+
}
|
|
122
|
+
isFoldersLicensed() {
|
|
123
|
+
return this.isLicensed('feat:folders');
|
|
124
|
+
}
|
|
125
|
+
isInsightsSummaryLicensed() {
|
|
126
|
+
return this.isLicensed('feat:insights:viewSummary');
|
|
127
|
+
}
|
|
128
|
+
isInsightsDashboardLicensed() {
|
|
129
|
+
return this.isLicensed('feat:insights:viewDashboard');
|
|
130
|
+
}
|
|
131
|
+
isInsightsHourlyDataLicensed() {
|
|
132
|
+
return this.isLicensed('feat:insights:viewHourlyData');
|
|
133
|
+
}
|
|
134
|
+
isWorkflowDiffsLicensed() {
|
|
135
|
+
return this.isLicensed('feat:workflowDiffs');
|
|
136
|
+
}
|
|
137
|
+
isProvisioningLicensed() {
|
|
138
|
+
return this.isLicensed(['feat:saml', 'feat:oidc']);
|
|
139
|
+
}
|
|
140
|
+
getMaxUsers() {
|
|
141
|
+
return this.getValue('quota:users') ?? constants_1.UNLIMITED_LICENSE_QUOTA;
|
|
142
|
+
}
|
|
143
|
+
getMaxActiveWorkflows() {
|
|
144
|
+
return this.getValue('quota:activeWorkflows') ?? constants_1.UNLIMITED_LICENSE_QUOTA;
|
|
145
|
+
}
|
|
146
|
+
getMaxVariables() {
|
|
147
|
+
return this.getValue('quota:maxVariables') ?? constants_1.UNLIMITED_LICENSE_QUOTA;
|
|
148
|
+
}
|
|
149
|
+
getMaxAiCredits() {
|
|
150
|
+
return this.getValue('quota:aiCredits') ?? 0;
|
|
151
|
+
}
|
|
152
|
+
getWorkflowHistoryPruneQuota() {
|
|
153
|
+
return this.getValue('quota:workflowHistoryPrune') ?? constants_1.UNLIMITED_LICENSE_QUOTA;
|
|
154
|
+
}
|
|
155
|
+
getInsightsMaxHistory() {
|
|
156
|
+
return this.getValue('quota:insights:maxHistoryDays') ?? 7;
|
|
157
|
+
}
|
|
158
|
+
getInsightsRetentionMaxAge() {
|
|
159
|
+
return this.getValue('quota:insights:retention:maxAgeDays') ?? 180;
|
|
160
|
+
}
|
|
161
|
+
getInsightsRetentionPruneInterval() {
|
|
162
|
+
return this.getValue('quota:insights:retention:pruneIntervalDays') ?? 24;
|
|
163
|
+
}
|
|
164
|
+
getMaxTeamProjects() {
|
|
165
|
+
return this.getValue('quota:maxTeamProjects') ?? 0;
|
|
166
|
+
}
|
|
167
|
+
getMaxWorkflowsWithEvaluations() {
|
|
168
|
+
return this.getValue('quota:evaluations:maxWorkflows') ?? 0;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
exports.LicenseState = LicenseState;
|
|
172
|
+
exports.LicenseState = LicenseState = __decorate([
|
|
173
|
+
(0, di_1.Service)()
|
|
174
|
+
], LicenseState);
|
|
175
|
+
//# sourceMappingURL=license-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-state.js","sourceRoot":"","sources":["../src/license-state.ts"],"names":[],"mappings":";;;;;;;;;AACA,8CAA2E;AAC3E,gCAAkC;AAClC,+CAA+C;AAI/C,MAAM,mBAAoB,SAAQ,8BAAe;IAChD;QACC,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC/E,CAAC;CACD;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QACN,oBAAe,GAA2B,IAAI,CAAC;IAoNhD,CAAC;IAlNA,kBAAkB,CAAC,QAAyB;QAC3C,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;IACjC,CAAC;IAEO,cAAc;QACrB,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE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IAED,qBAAqB;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,0BAA0B;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,IAAI,GAAG,CAAC;IACpE,CAAC;IAED,iCAAiC;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,4CAA4C,CAAC,IAAI,EAAE,CAAC;IAC1E,CAAC;IAED,kBAAkB;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAED,8BAA8B;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;CACD,CAAA;AArNY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,YAAO,GAAE;GACG,YAAY,CAqNxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Logger } from './logger';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
var logger_1 = require("./logger");
|
|
5
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LogScope } from '@n8n/config';
|
|
2
|
+
import { GlobalConfig, InstanceSettingsConfig } from '@n8n/config';
|
|
3
|
+
import type { Logger as LoggerType, LogMetadata } from 'n8n-workflow';
|
|
4
|
+
import winston from 'winston';
|
|
5
|
+
export declare class Logger implements LoggerType {
|
|
6
|
+
private readonly globalConfig;
|
|
7
|
+
private readonly instanceSettingsConfig;
|
|
8
|
+
private internalLogger;
|
|
9
|
+
private readonly level;
|
|
10
|
+
private readonly scopes;
|
|
11
|
+
private get isScopingEnabled();
|
|
12
|
+
private readonly noColor;
|
|
13
|
+
private readonly noColorDefaultTrue;
|
|
14
|
+
constructor(globalConfig: GlobalConfig, instanceSettingsConfig: InstanceSettingsConfig, { isRoot }?: {
|
|
15
|
+
isRoot?: boolean;
|
|
16
|
+
});
|
|
17
|
+
private setInternalLogger;
|
|
18
|
+
scoped(scopes: LogScope | LogScope[]): Logger;
|
|
19
|
+
private serializeError;
|
|
20
|
+
private log;
|
|
21
|
+
private setLevel;
|
|
22
|
+
private jsonConsoleFormat;
|
|
23
|
+
private pickConsoleTransportFormat;
|
|
24
|
+
private setConsoleTransport;
|
|
25
|
+
private scopeFilter;
|
|
26
|
+
private color;
|
|
27
|
+
private debugDevConsoleFormat;
|
|
28
|
+
private debugProdConsoleFormat;
|
|
29
|
+
private devTsFormat;
|
|
30
|
+
private toPrintable;
|
|
31
|
+
private setFileTransport;
|
|
32
|
+
error(message: string, metadata?: LogMetadata): void;
|
|
33
|
+
warn(message: string, metadata?: LogMetadata): void;
|
|
34
|
+
info(message: string, metadata?: LogMetadata): void;
|
|
35
|
+
debug(message: string, metadata?: LogMetadata): void;
|
|
36
|
+
getInternalLogger(): winston.Logger;
|
|
37
|
+
}
|