@n8n/utils 1.22.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/index.cjs CHANGED
@@ -2,6 +2,7 @@ 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');
@@ -14,6 +15,7 @@ exports.DEFAULT_KEYS = require_sublimeSearch.DEFAULT_KEYS;
14
15
  exports.assert = require_assert.assert;
15
16
  exports.createEventBus = require_event_bus.createEventBus;
16
17
  exports.createEventQueue = require_event_queue.createEventQueue;
18
+ exports.generateNanoId = require_workflowId.generateNanoId;
17
19
  exports.isWindowsFilePath = require_path.isWindowsFilePath;
18
20
  exports.reRankSearchResults = require_reRankSearchResults.reRankSearchResults;
19
21
  exports.retry = require_retry.retry;
package/dist/index.d.cts CHANGED
@@ -4,9 +4,10 @@ import { t as createEventQueue } from "./event-queue2.cjs";
4
4
  import { t as isWindowsFilePath } from "./path.cjs";
5
5
  import { t as sanitizeFilename } from "./sanitize.cjs";
6
6
  import { t as retry } from "./retry2.cjs";
7
+ import { t as generateNanoId } from "./workflowId2.cjs";
7
8
  import { t as smartDecimal } from "./smartDecimal.cjs";
8
9
  import { t as reRankSearchResults } from "./reRankSearchResults.cjs";
9
10
  import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.cjs";
10
11
  import { t as sortByProperty } from "./sortByProperty.cjs";
11
12
  import { n as truncateBeforeLast, t as truncate } from "./truncate.cjs";
12
- export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, isWindowsFilePath, 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
@@ -4,9 +4,10 @@ import { t as createEventQueue } from "./event-queue2.mjs";
4
4
  import { t as isWindowsFilePath } from "./path.mjs";
5
5
  import { t as sanitizeFilename } from "./sanitize.mjs";
6
6
  import { t as retry } from "./retry2.mjs";
7
+ import { t as generateNanoId } from "./workflowId2.mjs";
7
8
  import { t as smartDecimal } from "./smartDecimal.mjs";
8
9
  import { t as reRankSearchResults } from "./reRankSearchResults.mjs";
9
10
  import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.mjs";
10
11
  import { t as sortByProperty } from "./sortByProperty.mjs";
11
12
  import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
12
- export { CallbackFn, DEFAULT_KEYS, EventBus, assert, createEventBus, createEventQueue, isWindowsFilePath, 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,6 +2,7 @@ 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";
@@ -10,4 +11,4 @@ import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
10
11
  import { t as sanitizeFilename } from "./sanitize.mjs";
11
12
  import { t as isWindowsFilePath } from "./path.mjs";
12
13
 
13
- export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, isWindowsFilePath, 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 };
@@ -0,0 +1,3 @@
1
+ const require_workflowId = require('./workflowId2.cjs');
2
+
3
+ exports.generateNanoId = require_workflowId.generateNanoId;
@@ -0,0 +1,2 @@
1
+ import { t as generateNanoId } from "./workflowId2.cjs";
2
+ export { generateNanoId };
@@ -0,0 +1,2 @@
1
+ import { t as generateNanoId } from "./workflowId2.mjs";
2
+ export { generateNanoId };
@@ -0,0 +1,3 @@
1
+ import { t as generateNanoId } from "./workflowId2.mjs";
2
+
3
+ export { generateNanoId };
@@ -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,5 @@
1
+ //#region src/workflowId.d.ts
2
+ declare const generateNanoId: (size?: number) => string;
3
+ //#endregion
4
+ export { generateNanoId as t };
5
+ //# sourceMappingURL=workflowId2.d.cts.map
@@ -0,0 +1,5 @@
1
+ //#region src/workflowId.d.ts
2
+ declare const generateNanoId: (size?: number) => string;
3
+ //#endregion
4
+ export { generateNanoId as t };
5
+ //# sourceMappingURL=workflowId2.d.mts.map
@@ -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.22.0",
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",
@@ -34,9 +38,9 @@
34
38
  "typescript": "5.9.2",
35
39
  "vite": "npm:rolldown-vite@latest",
36
40
  "vitest": "^3.1.3",
37
- "@n8n/vitest-config": "1.5.0",
38
- "@n8n/typescript-config": "1.3.0",
39
- "@n8n/eslint-config": "0.0.1"
41
+ "@n8n/eslint-config": "0.0.1",
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",