@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.
Files changed (44) hide show
  1. package/dist/build.tsbuildinfo +1 -0
  2. package/dist/cli-parser.d.ts +18 -0
  3. package/dist/cli-parser.js +55 -0
  4. package/dist/cli-parser.js.map +1 -0
  5. package/dist/environment.d.ts +3 -0
  6. package/dist/environment.js +8 -0
  7. package/dist/environment.js.map +1 -0
  8. package/dist/index.d.ts +10 -0
  9. package/dist/index.js +36 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/license-state.d.ts +51 -0
  12. package/dist/license-state.js +175 -0
  13. package/dist/license-state.js.map +1 -0
  14. package/dist/logging/index.d.ts +1 -0
  15. package/dist/logging/index.js +6 -0
  16. package/dist/logging/index.js.map +1 -0
  17. package/dist/logging/logger.d.ts +37 -0
  18. package/dist/logging/logger.js +250 -0
  19. package/dist/logging/logger.js.map +1 -0
  20. package/dist/modules/errors/missing-module.error.d.ts +4 -0
  21. package/dist/modules/errors/missing-module.error.js +11 -0
  22. package/dist/modules/errors/missing-module.error.js.map +1 -0
  23. package/dist/modules/errors/module-confusion.error.d.ts +4 -0
  24. package/dist/modules/errors/module-confusion.error.js +12 -0
  25. package/dist/modules/errors/module-confusion.error.js.map +1 -0
  26. package/dist/modules/errors/unknown-module.error.d.ts +4 -0
  27. package/dist/modules/errors/unknown-module.error.js +11 -0
  28. package/dist/modules/errors/unknown-module.error.js.map +1 -0
  29. package/dist/modules/module-registry.d.ts +27 -0
  30. package/dist/modules/module-registry.js +187 -0
  31. package/dist/modules/module-registry.js.map +1 -0
  32. package/dist/modules/modules.config.d.ts +11 -0
  33. package/dist/modules/modules.config.js +53 -0
  34. package/dist/modules/modules.config.js.map +1 -0
  35. package/dist/types.d.ts +12 -0
  36. package/dist/types.js +3 -0
  37. package/dist/types.js.map +1 -0
  38. package/dist/utils/is-object-literal.d.ts +5 -0
  39. package/dist/utils/is-object-literal.js +10 -0
  40. package/dist/utils/is-object-literal.js.map +1 -0
  41. package/dist/utils/path-util.d.ts +2 -0
  42. package/dist/utils/path-util.js +55 -0
  43. package/dist/utils/path-util.js.map +1 -0
  44. package/package.json +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ type ObjectLiteral = {
2
+ [key: string | symbol]: unknown;
3
+ };
4
+ export declare function isObjectLiteral(candidate: unknown): candidate is ObjectLiteral;
5
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isObjectLiteral = isObjectLiteral;
4
+ function isObjectLiteral(candidate) {
5
+ return (typeof candidate === 'object' &&
6
+ candidate !== null &&
7
+ !Array.isArray(candidate) &&
8
+ Object.getPrototypeOf(candidate)?.constructor?.name === 'Object');
9
+ }
10
+ //# sourceMappingURL=is-object-literal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-object-literal.js","sourceRoot":"","sources":["../../src/utils/is-object-literal.ts"],"names":[],"mappings":";;AASA,0CAOC;AAPD,SAAgB,eAAe,CAAC,SAAkB;IACjD,OAAO,CACN,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QACxB,MAAM,CAAC,cAAc,CAAC,SAAS,CAAY,EAAE,WAAW,EAAE,IAAI,KAAK,QAAQ,CAC5E,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isContainedWithin(parentPath: string, childPath: string): boolean;
2
+ export declare function safeJoinPath(parentPath: string, ...paths: string[]): string;
@@ -0,0 +1,55 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.isContainedWithin = isContainedWithin;
37
+ exports.safeJoinPath = safeJoinPath;
38
+ const n8n_workflow_1 = require("n8n-workflow");
39
+ const path = __importStar(require("node:path"));
40
+ function isContainedWithin(parentPath, childPath) {
41
+ parentPath = path.resolve(parentPath);
42
+ childPath = path.resolve(childPath);
43
+ if (parentPath === childPath) {
44
+ return true;
45
+ }
46
+ return childPath.startsWith(parentPath + path.sep);
47
+ }
48
+ function safeJoinPath(parentPath, ...paths) {
49
+ const candidate = path.join(parentPath, ...paths);
50
+ if (!isContainedWithin(parentPath, candidate)) {
51
+ throw new n8n_workflow_1.UnexpectedError(`Path traversal detected, refusing to join paths: ${parentPath} and ${JSON.stringify(paths)}`);
52
+ }
53
+ return candidate;
54
+ }
55
+ //# sourceMappingURL=path-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-util.js","sourceRoot":"","sources":["../../src/utils/path-util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,8CASC;AASD,oCAUC;AAnCD,+CAA+C;AAC/C,gDAAkC;AAMlC,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,SAAiB;IACtE,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEpC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,SAAS,CAAC,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AASD,SAAgB,YAAY,CAAC,UAAkB,EAAE,GAAG,KAAe;IAClE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC;IAElD,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,8BAAe,CACxB,oDAAoD,UAAU,QAAQ,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC7F,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@atom8n/backend-common",
3
+ "version": "1.2.0",
4
+ "scripts": {
5
+ "clean": "rimraf dist .turbo",
6
+ "dev": "pnpm watch",
7
+ "typecheck": "tsc --noEmit",
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "format": "biome format --write .",
10
+ "format:check": "biome ci .",
11
+ "lint": "eslint . --quiet",
12
+ "lint:fix": "eslint . --fix",
13
+ "watch": "tsc -p tsconfig.build.json --watch",
14
+ "test": "jest",
15
+ "test:unit": "jest",
16
+ "test:dev": "jest --watch"
17
+ },
18
+ "main": "dist/index.js",
19
+ "module": "src/index.ts",
20
+ "types": "dist/index.d.ts",
21
+ "files": [
22
+ "dist/**/*"
23
+ ],
24
+ "dependencies": {
25
+ "@atom8n/config": "2.1.0",
26
+ "@atom8n/constants": "0.15.0",
27
+ "@atom8n/decorators": "1.2.0",
28
+ "@atom8n/di": "0.10.0",
29
+ "callsites": "catalog:",
30
+ "@atom8n/n8n-workflow": "2.2.0",
31
+ "picocolors": "catalog:",
32
+ "reflect-metadata": "catalog:",
33
+ "winston": "3.14.2",
34
+ "yargs-parser": "21.1.1"
35
+ },
36
+ "devDependencies": {
37
+ "@atom8n/typescript-config": "1.3.0",
38
+ "@types/yargs-parser": "21.0.0",
39
+ "zod": "catalog:"
40
+ }
41
+ }