@n8n/utils 1.21.0 → 1.23.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/files/path.cjs +3 -0
- package/dist/files/path.d.cts +2 -0
- package/dist/files/path.d.mts +2 -0
- package/dist/files/path.mjs +3 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +3 -1
- package/dist/path.cjs +17 -0
- package/dist/path.cjs.map +1 -0
- package/dist/path.d.cts +5 -0
- package/dist/path.d.mts +5 -0
- package/dist/path.mjs +11 -0
- package/dist/path.mjs.map +1 -0
- package/dist/workflowId.cjs +3 -0
- package/dist/workflowId.d.cts +2 -0
- package/dist/workflowId.d.mts +2 -0
- package/dist/workflowId.mjs +3 -0
- package/dist/workflowId2.cjs +34 -0
- package/dist/workflowId2.cjs.map +1 -0
- package/dist/workflowId2.d.cts +5 -0
- package/dist/workflowId2.d.mts +5 -0
- package/dist/workflowId2.mjs +29 -0
- package/dist/workflowId2.mjs.map +1 -0
- package/package.json +7 -3
package/dist/index.cjs
CHANGED
|
@@ -2,17 +2,21 @@ const require_assert = require('./assert2.cjs');
|
|
|
2
2
|
const require_event_bus = require('./event-bus2.cjs');
|
|
3
3
|
const require_event_queue = require('./event-queue2.cjs');
|
|
4
4
|
const require_retry = require('./retry2.cjs');
|
|
5
|
+
const require_workflowId = require('./workflowId2.cjs');
|
|
5
6
|
const require_smartDecimal = require('./smartDecimal.cjs');
|
|
6
7
|
const require_reRankSearchResults = require('./reRankSearchResults.cjs');
|
|
7
8
|
const require_sublimeSearch = require('./sublimeSearch.cjs');
|
|
8
9
|
const require_sortByProperty = require('./sortByProperty.cjs');
|
|
9
10
|
const require_truncate = require('./truncate.cjs');
|
|
10
11
|
const require_sanitize = require('./sanitize.cjs');
|
|
12
|
+
const require_path = require('./path.cjs');
|
|
11
13
|
|
|
12
14
|
exports.DEFAULT_KEYS = require_sublimeSearch.DEFAULT_KEYS;
|
|
13
15
|
exports.assert = require_assert.assert;
|
|
14
16
|
exports.createEventBus = require_event_bus.createEventBus;
|
|
15
17
|
exports.createEventQueue = require_event_queue.createEventQueue;
|
|
18
|
+
exports.generateNanoId = require_workflowId.generateNanoId;
|
|
19
|
+
exports.isWindowsFilePath = require_path.isWindowsFilePath;
|
|
16
20
|
exports.reRankSearchResults = require_reRankSearchResults.reRankSearchResults;
|
|
17
21
|
exports.retry = require_retry.retry;
|
|
18
22
|
exports.sanitizeFilename = require_sanitize.sanitizeFilename;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { t as assert } from "./assert2.cjs";
|
|
2
2
|
import { n as EventBus, r as createEventBus, t as CallbackFn } from "./event-bus2.cjs";
|
|
3
3
|
import { t as createEventQueue } from "./event-queue2.cjs";
|
|
4
|
+
import { t as isWindowsFilePath } from "./path.cjs";
|
|
4
5
|
import { t as sanitizeFilename } from "./sanitize.cjs";
|
|
5
6
|
import { t as retry } from "./retry2.cjs";
|
|
7
|
+
import { t as generateNanoId } from "./workflowId2.cjs";
|
|
6
8
|
import { t as smartDecimal } from "./smartDecimal.cjs";
|
|
7
9
|
import { t as reRankSearchResults } from "./reRankSearchResults.cjs";
|
|
8
10
|
import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.cjs";
|
|
9
11
|
import { t as sortByProperty } from "./sortByProperty.cjs";
|
|
10
12
|
import { n as truncateBeforeLast, t as truncate } from "./truncate.cjs";
|
|
11
|
-
export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
|
13
|
+
export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, generateNanoId, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { t as assert } from "./assert2.mjs";
|
|
2
2
|
import { n as EventBus, r as createEventBus, t as CallbackFn } from "./event-bus2.mjs";
|
|
3
3
|
import { t as createEventQueue } from "./event-queue2.mjs";
|
|
4
|
+
import { t as isWindowsFilePath } from "./path.mjs";
|
|
4
5
|
import { t as sanitizeFilename } from "./sanitize.mjs";
|
|
5
6
|
import { t as retry } from "./retry2.mjs";
|
|
7
|
+
import { t as generateNanoId } from "./workflowId2.mjs";
|
|
6
8
|
import { t as smartDecimal } from "./smartDecimal.mjs";
|
|
7
9
|
import { t as reRankSearchResults } from "./reRankSearchResults.mjs";
|
|
8
10
|
import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.mjs";
|
|
9
11
|
import { t as sortByProperty } from "./sortByProperty.mjs";
|
|
10
12
|
import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
|
|
11
|
-
export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
|
13
|
+
export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, generateNanoId, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,13 @@ import { t as assert } from "./assert2.mjs";
|
|
|
2
2
|
import { t as createEventBus } from "./event-bus2.mjs";
|
|
3
3
|
import { t as createEventQueue } from "./event-queue2.mjs";
|
|
4
4
|
import { t as retry } from "./retry2.mjs";
|
|
5
|
+
import { t as generateNanoId } from "./workflowId2.mjs";
|
|
5
6
|
import { t as smartDecimal } from "./smartDecimal.mjs";
|
|
6
7
|
import { t as reRankSearchResults } from "./reRankSearchResults.mjs";
|
|
7
8
|
import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.mjs";
|
|
8
9
|
import { t as sortByProperty } from "./sortByProperty.mjs";
|
|
9
10
|
import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
|
|
10
11
|
import { t as sanitizeFilename } from "./sanitize.mjs";
|
|
12
|
+
import { t as isWindowsFilePath } from "./path.mjs";
|
|
11
13
|
|
|
12
|
-
export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
|
14
|
+
export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, generateNanoId, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/path.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/files/path.ts
|
|
3
|
+
/**
|
|
4
|
+
* Fast check if file path starts with a windows drive letter, e.g. 'C:/' or 'C:\\'
|
|
5
|
+
*/
|
|
6
|
+
function isWindowsFilePath(str) {
|
|
7
|
+
return /^[a-zA-Z]:[\\/]/.test(str);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, 'isWindowsFilePath', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return isWindowsFilePath;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=path.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.cjs","names":[],"sources":["../src/files/path.ts"],"sourcesContent":["/**\n * Fast check if file path starts with a windows drive letter, e.g. 'C:/' or 'C:\\\\'\n */\nexport function isWindowsFilePath(str: string) {\n\treturn /^[a-zA-Z]:[\\\\/]/.test(str);\n}\n"],"mappings":";;;;;AAGA,SAAgB,kBAAkB,KAAa;AAC9C,QAAO,kBAAkB,KAAK,IAAI"}
|
package/dist/path.d.cts
ADDED
package/dist/path.d.mts
ADDED
package/dist/path.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/files/path.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fast check if file path starts with a windows drive letter, e.g. 'C:/' or 'C:\\'
|
|
4
|
+
*/
|
|
5
|
+
function isWindowsFilePath(str) {
|
|
6
|
+
return /^[a-zA-Z]:[\\/]/.test(str);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isWindowsFilePath as t };
|
|
11
|
+
//# sourceMappingURL=path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.mjs","names":[],"sources":["../src/files/path.ts"],"sourcesContent":["/**\n * Fast check if file path starts with a windows drive letter, e.g. 'C:/' or 'C:\\\\'\n */\nexport function isWindowsFilePath(str: string) {\n\treturn /^[a-zA-Z]:[\\\\/]/.test(str);\n}\n"],"mappings":";;;;AAGA,SAAgB,kBAAkB,KAAa;AAC9C,QAAO,kBAAkB,KAAK,IAAI"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
let __n8n_constants = require("@n8n/constants");
|
|
2
|
+
let nanoid = require("nanoid");
|
|
3
|
+
|
|
4
|
+
//#region src/workflowId.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generates a unique 16-character nanoid.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical ID generator used across the entire n8n codebase for:
|
|
9
|
+
* - Workflow IDs
|
|
10
|
+
* - Project IDs
|
|
11
|
+
* - Variable IDs
|
|
12
|
+
* - API Key IDs
|
|
13
|
+
* - And other entity IDs
|
|
14
|
+
*
|
|
15
|
+
* Both frontend and backend MUST use this function to ensure consistency.
|
|
16
|
+
*
|
|
17
|
+
* @returns A 16-character ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const id = generateNanoId();
|
|
22
|
+
* // => 'aBcDeFgHiJkLmNoP' (16 characters)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const generateNanoId = (0, nanoid.customAlphabet)(__n8n_constants.NANOID_ALPHABET, 16);
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
Object.defineProperty(exports, 'generateNanoId', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return generateNanoId;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=workflowId2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowId2.cjs","names":["NANOID_ALPHABET"],"sources":["../src/workflowId.ts"],"sourcesContent":["import { NANOID_ALPHABET } from '@n8n/constants';\nimport { customAlphabet } from 'nanoid';\n\n/**\n * Generates a unique 16-character nanoid.\n *\n * This is the canonical ID generator used across the entire n8n codebase for:\n * - Workflow IDs\n * - Project IDs\n * - Variable IDs\n * - API Key IDs\n * - And other entity IDs\n *\n * Both frontend and backend MUST use this function to ensure consistency.\n *\n * @returns A 16-character ID\n *\n * @example\n * ```ts\n * const id = generateNanoId();\n * // => 'aBcDeFgHiJkLmNoP' (16 characters)\n * ```\n */\nexport const generateNanoId = customAlphabet(NANOID_ALPHABET, 16);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,4CAAgCA,iCAAiB,GAAG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NANOID_ALPHABET } from "@n8n/constants";
|
|
2
|
+
import { customAlphabet } from "nanoid";
|
|
3
|
+
|
|
4
|
+
//#region src/workflowId.ts
|
|
5
|
+
/**
|
|
6
|
+
* Generates a unique 16-character nanoid.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical ID generator used across the entire n8n codebase for:
|
|
9
|
+
* - Workflow IDs
|
|
10
|
+
* - Project IDs
|
|
11
|
+
* - Variable IDs
|
|
12
|
+
* - API Key IDs
|
|
13
|
+
* - And other entity IDs
|
|
14
|
+
*
|
|
15
|
+
* Both frontend and backend MUST use this function to ensure consistency.
|
|
16
|
+
*
|
|
17
|
+
* @returns A 16-character ID
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const id = generateNanoId();
|
|
22
|
+
* // => 'aBcDeFgHiJkLmNoP' (16 characters)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const generateNanoId = customAlphabet(NANOID_ALPHABET, 16);
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { generateNanoId as t };
|
|
29
|
+
//# sourceMappingURL=workflowId2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowId2.mjs","names":[],"sources":["../src/workflowId.ts"],"sourcesContent":["import { NANOID_ALPHABET } from '@n8n/constants';\nimport { customAlphabet } from 'nanoid';\n\n/**\n * Generates a unique 16-character nanoid.\n *\n * This is the canonical ID generator used across the entire n8n codebase for:\n * - Workflow IDs\n * - Project IDs\n * - Variable IDs\n * - API Key IDs\n * - And other entity IDs\n *\n * Both frontend and backend MUST use this function to ensure consistency.\n *\n * @returns A 16-character ID\n *\n * @example\n * ```ts\n * const id = generateNanoId();\n * // => 'aBcDeFgHiJkLmNoP' (16 characters)\n * ```\n */\nexport const generateNanoId = customAlphabet(NANOID_ALPHABET, 16);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,iBAAiB,eAAe,iBAAiB,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.23.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"LICENSE.md",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"require": "./dist/*.cjs"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"nanoid": "3.3.8",
|
|
32
|
+
"@n8n/constants": "0.17.0"
|
|
33
|
+
},
|
|
30
34
|
"devDependencies": {
|
|
31
35
|
"@testing-library/jest-dom": "^6.6.3",
|
|
32
36
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -35,8 +39,8 @@
|
|
|
35
39
|
"vite": "npm:rolldown-vite@latest",
|
|
36
40
|
"vitest": "^3.1.3",
|
|
37
41
|
"@n8n/eslint-config": "0.0.1",
|
|
38
|
-
"@n8n/
|
|
39
|
-
"@n8n/
|
|
42
|
+
"@n8n/vitest-config": "1.6.0",
|
|
43
|
+
"@n8n/typescript-config": "1.3.0"
|
|
40
44
|
},
|
|
41
45
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
42
46
|
"homepage": "https://n8n.io",
|