@n8n/utils 1.37.0 → 1.38.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/assert.cjs +11 -2
- package/dist/assert.cjs.map +1 -0
- package/dist/assert.d.cts +5 -2
- package/dist/assert.d.mts +5 -2
- package/dist/assert.mjs +10 -2
- package/dist/assert.mjs.map +1 -0
- package/dist/client-assertion.cjs +49 -0
- package/dist/client-assertion.cjs.map +1 -0
- package/dist/client-assertion.d.cts +12 -0
- package/dist/client-assertion.d.mts +12 -0
- package/dist/client-assertion.mjs +48 -0
- package/dist/client-assertion.mjs.map +1 -0
- package/dist/create-event-queue.cjs +40 -2
- package/dist/create-event-queue.cjs.map +1 -0
- package/dist/create-event-queue.d.cts +7 -2
- package/dist/create-event-queue.d.mts +7 -2
- package/dist/create-event-queue.mjs +39 -2
- package/dist/create-event-queue.mjs.map +1 -0
- package/dist/ensure-error.cjs +15 -0
- package/dist/ensure-error.cjs.map +1 -0
- package/dist/ensure-error.mjs +9 -0
- package/dist/ensure-error.mjs.map +1 -0
- package/dist/errors/ensure-error.cjs +3 -0
- package/dist/errors/ensure-error.d.cts +5 -0
- package/dist/errors/ensure-error.d.mts +5 -0
- package/dist/errors/ensure-error.mjs +3 -0
- package/dist/event-bus.cjs +43 -2
- package/dist/event-bus.cjs.map +1 -0
- package/dist/event-bus.d.cts +14 -2
- package/dist/event-bus.d.mts +14 -2
- package/dist/event-bus.mjs +42 -2
- package/dist/event-bus.mjs.map +1 -0
- package/dist/files/is-windows-file-path.cjs +11 -2
- package/dist/files/is-windows-file-path.cjs.map +1 -0
- package/dist/files/is-windows-file-path.d.cts +5 -2
- package/dist/files/is-windows-file-path.d.mts +5 -2
- package/dist/files/is-windows-file-path.mjs +10 -2
- package/dist/files/is-windows-file-path.mjs.map +1 -0
- package/dist/files/sanitize-filename.cjs +61 -2
- package/dist/files/sanitize-filename.cjs.map +1 -0
- package/dist/files/sanitize-filename.d.cts +5 -2
- package/dist/files/sanitize-filename.d.mts +5 -2
- package/dist/files/sanitize-filename.mjs +60 -2
- package/dist/files/sanitize-filename.mjs.map +1 -0
- package/dist/format-pem-block.d.cts +5 -2
- package/dist/format-pem-block.d.mts +5 -2
- package/dist/generate-nano-id.cjs +28 -2
- package/dist/generate-nano-id.cjs.map +1 -0
- package/dist/generate-nano-id.d.cts +5 -2
- package/dist/generate-nano-id.d.mts +5 -2
- package/dist/generate-nano-id.mjs +28 -2
- package/dist/generate-nano-id.mjs.map +1 -0
- package/dist/get-jwt-expiry.cjs +22 -2
- package/dist/get-jwt-expiry.cjs.map +1 -0
- package/dist/get-jwt-expiry.d.cts +5 -2
- package/dist/get-jwt-expiry.d.mts +5 -2
- package/dist/get-jwt-expiry.mjs +21 -2
- package/dist/get-jwt-expiry.mjs.map +1 -0
- package/dist/is-record.cjs +8 -2
- package/dist/is-record.cjs.map +1 -0
- package/dist/is-record.d.cts +5 -2
- package/dist/is-record.d.mts +5 -2
- package/dist/is-record.mjs +7 -2
- package/dist/is-record.mjs.map +1 -0
- package/dist/number/smart-decimal.cjs +10 -2
- package/dist/number/smart-decimal.cjs.map +1 -0
- package/dist/number/smart-decimal.d.cts +5 -2
- package/dist/number/smart-decimal.d.mts +5 -2
- package/dist/number/smart-decimal.mjs +9 -2
- package/dist/number/smart-decimal.mjs.map +1 -0
- package/dist/placeholder.cjs +80 -7
- package/dist/placeholder.cjs.map +1 -0
- package/dist/placeholder.d.cts +14 -2
- package/dist/placeholder.d.mts +14 -2
- package/dist/placeholder.mjs +74 -2
- package/dist/placeholder.mjs.map +1 -0
- package/dist/promise/deferred-promise.cjs +14 -0
- package/dist/promise/deferred-promise.cjs.map +1 -0
- package/dist/promise/deferred-promise.d.cts +12 -0
- package/dist/promise/deferred-promise.d.mts +12 -0
- package/dist/promise/deferred-promise.mjs +13 -0
- package/dist/promise/deferred-promise.mjs.map +1 -0
- package/dist/result.cjs +30 -0
- package/dist/result.cjs.map +1 -0
- package/dist/result.d.cts +16 -0
- package/dist/result.d.mts +16 -0
- package/dist/result.mjs +28 -0
- package/dist/result.mjs.map +1 -0
- package/dist/retry.cjs +39 -2
- package/dist/retry.cjs.map +1 -0
- package/dist/retry.d.cts +6 -2
- package/dist/retry.d.mts +6 -2
- package/dist/retry.mjs +38 -2
- package/dist/retry.mjs.map +1 -0
- package/dist/scrub-secrets.cjs +44 -4
- package/dist/scrub-secrets.cjs.map +1 -0
- package/dist/scrub-secrets.d.cts +7 -2
- package/dist/scrub-secrets.d.mts +7 -2
- package/dist/scrub-secrets.mjs +41 -2
- package/dist/scrub-secrets.mjs.map +1 -0
- package/dist/search/re-rank-search-results.cjs +19 -2
- package/dist/search/re-rank-search-results.cjs.map +1 -0
- package/dist/search/re-rank-search-results.d.cts +13 -2
- package/dist/search/re-rank-search-results.d.mts +13 -2
- package/dist/search/re-rank-search-results.mjs +18 -2
- package/dist/search/re-rank-search-results.mjs.map +1 -0
- package/dist/search/sublime-search.cjs +182 -3
- package/dist/search/sublime-search.cjs.map +1 -0
- package/dist/search/sublime-search.d.cts +15 -2
- package/dist/search/sublime-search.d.mts +15 -2
- package/dist/search/sublime-search.mjs +180 -2
- package/dist/search/sublime-search.mjs.map +1 -0
- package/dist/sort/sort-by-property.cjs +12 -2
- package/dist/sort/sort-by-property.cjs.map +1 -0
- package/dist/sort/sort-by-property.d.cts +5 -2
- package/dist/sort/sort-by-property.d.mts +5 -2
- package/dist/sort/sort-by-property.mjs +11 -2
- package/dist/sort/sort-by-property.mjs.map +1 -0
- package/dist/string/truncate.cjs +32 -3
- package/dist/string/truncate.cjs.map +1 -0
- package/dist/string/truncate.d.cts +6 -2
- package/dist/string/truncate.d.mts +6 -2
- package/dist/string/truncate.mjs +30 -2
- package/dist/string/truncate.mjs.map +1 -0
- package/dist/types.d.cts +5 -2
- package/dist/types.d.mts +5 -2
- package/package.json +12 -13
- package/dist/assert2.cjs +0 -17
- package/dist/assert2.cjs.map +0 -1
- package/dist/assert2.d.cts +0 -5
- package/dist/assert2.d.mts +0 -5
- package/dist/assert2.mjs +0 -11
- package/dist/assert2.mjs.map +0 -1
- package/dist/create-event-queue2.cjs +0 -46
- package/dist/create-event-queue2.cjs.map +0 -1
- package/dist/create-event-queue2.d.cts +0 -7
- package/dist/create-event-queue2.d.mts +0 -7
- package/dist/create-event-queue2.mjs +0 -40
- package/dist/create-event-queue2.mjs.map +0 -1
- package/dist/event-bus2.cjs +0 -49
- package/dist/event-bus2.cjs.map +0 -1
- package/dist/event-bus2.d.cts +0 -14
- package/dist/event-bus2.d.mts +0 -14
- package/dist/event-bus2.mjs +0 -43
- package/dist/event-bus2.mjs.map +0 -1
- package/dist/format-pem-block2.d.cts +0 -5
- package/dist/format-pem-block2.d.mts +0 -5
- package/dist/generate-nano-id2.cjs +0 -34
- package/dist/generate-nano-id2.cjs.map +0 -1
- package/dist/generate-nano-id2.d.cts +0 -5
- package/dist/generate-nano-id2.d.mts +0 -5
- package/dist/generate-nano-id2.mjs +0 -29
- package/dist/generate-nano-id2.mjs.map +0 -1
- package/dist/get-jwt-expiry2.cjs +0 -28
- package/dist/get-jwt-expiry2.cjs.map +0 -1
- package/dist/get-jwt-expiry2.d.cts +0 -5
- package/dist/get-jwt-expiry2.d.mts +0 -5
- package/dist/get-jwt-expiry2.mjs +0 -22
- package/dist/get-jwt-expiry2.mjs.map +0 -1
- package/dist/index.cjs +0 -44
- package/dist/index.d.cts +0 -19
- package/dist/index.d.mts +0 -19
- package/dist/index.mjs +0 -19
- package/dist/is-record2.cjs +0 -14
- package/dist/is-record2.cjs.map +0 -1
- package/dist/is-record2.d.cts +0 -5
- package/dist/is-record2.d.mts +0 -5
- package/dist/is-record2.mjs +0 -8
- package/dist/is-record2.mjs.map +0 -1
- package/dist/is-windows-file-path.cjs +0 -17
- package/dist/is-windows-file-path.cjs.map +0 -1
- package/dist/is-windows-file-path.d.cts +0 -5
- package/dist/is-windows-file-path.d.mts +0 -5
- package/dist/is-windows-file-path.mjs +0 -11
- package/dist/is-windows-file-path.mjs.map +0 -1
- package/dist/placeholder2.cjs +0 -111
- package/dist/placeholder2.cjs.map +0 -1
- package/dist/placeholder2.d.cts +0 -14
- package/dist/placeholder2.d.mts +0 -14
- package/dist/placeholder2.mjs +0 -75
- package/dist/placeholder2.mjs.map +0 -1
- package/dist/re-rank-search-results.cjs +0 -25
- package/dist/re-rank-search-results.cjs.map +0 -1
- package/dist/re-rank-search-results.d.cts +0 -13
- package/dist/re-rank-search-results.d.mts +0 -13
- package/dist/re-rank-search-results.mjs +0 -19
- package/dist/re-rank-search-results.mjs.map +0 -1
- package/dist/retry2.cjs +0 -45
- package/dist/retry2.cjs.map +0 -1
- package/dist/retry2.d.cts +0 -6
- package/dist/retry2.d.mts +0 -6
- package/dist/retry2.mjs +0 -39
- package/dist/retry2.mjs.map +0 -1
- package/dist/sanitize-filename.cjs +0 -67
- package/dist/sanitize-filename.cjs.map +0 -1
- package/dist/sanitize-filename.d.cts +0 -5
- package/dist/sanitize-filename.d.mts +0 -5
- package/dist/sanitize-filename.mjs +0 -61
- package/dist/sanitize-filename.mjs.map +0 -1
- package/dist/scrub-secrets2.cjs +0 -59
- package/dist/scrub-secrets2.cjs.map +0 -1
- package/dist/scrub-secrets2.d.cts +0 -7
- package/dist/scrub-secrets2.d.mts +0 -7
- package/dist/scrub-secrets2.mjs +0 -41
- package/dist/scrub-secrets2.mjs.map +0 -1
- package/dist/smart-decimal.cjs +0 -16
- package/dist/smart-decimal.cjs.map +0 -1
- package/dist/smart-decimal.d.cts +0 -5
- package/dist/smart-decimal.d.mts +0 -5
- package/dist/smart-decimal.mjs +0 -10
- package/dist/smart-decimal.mjs.map +0 -1
- package/dist/sort-by-property.cjs +0 -18
- package/dist/sort-by-property.cjs.map +0 -1
- package/dist/sort-by-property.d.cts +0 -5
- package/dist/sort-by-property.d.mts +0 -5
- package/dist/sort-by-property.mjs +0 -12
- package/dist/sort-by-property.mjs.map +0 -1
- package/dist/sublime-search.cjs +0 -193
- package/dist/sublime-search.cjs.map +0 -1
- package/dist/sublime-search.d.cts +0 -15
- package/dist/sublime-search.d.mts +0 -15
- package/dist/sublime-search.mjs +0 -181
- package/dist/sublime-search.mjs.map +0 -1
- package/dist/truncate.cjs +0 -43
- package/dist/truncate.cjs.map +0 -1
- package/dist/truncate.d.cts +0 -6
- package/dist/truncate.d.mts +0 -6
- package/dist/truncate.mjs +0 -31
- package/dist/truncate.mjs.map +0 -1
- package/dist/types2.d.cts +0 -5
- package/dist/types2.d.mts +0 -5
package/package.json
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.38.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"LICENSE.md",
|
|
8
8
|
"LICENSE_EE.md"
|
|
9
9
|
],
|
|
10
|
-
"main": "./dist/index.cjs",
|
|
11
|
-
"module": "./dist/index.mjs",
|
|
12
|
-
"types": "./dist/index.d.mts",
|
|
13
10
|
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/index.d.mts",
|
|
16
|
-
"import": "./dist/index.mjs",
|
|
17
|
-
"require": "./dist/index.cjs"
|
|
18
|
-
},
|
|
19
11
|
"./dist/*": {
|
|
20
12
|
"types": "./dist/*.d.mts",
|
|
21
13
|
"import": "./dist/*.mjs",
|
|
@@ -27,9 +19,16 @@
|
|
|
27
19
|
"require": "./dist/*.cjs"
|
|
28
20
|
}
|
|
29
21
|
},
|
|
22
|
+
"typesVersions": {
|
|
23
|
+
"*": {
|
|
24
|
+
"*": [
|
|
25
|
+
"./dist/*.d.cts"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
30
29
|
"dependencies": {
|
|
31
30
|
"nanoid": "3.3.8",
|
|
32
|
-
"@n8n/constants": "0.
|
|
31
|
+
"@n8n/constants": "0.30.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -38,9 +37,9 @@
|
|
|
38
37
|
"typescript": "6.0.2",
|
|
39
38
|
"vite": "^8.0.2",
|
|
40
39
|
"vitest": "^4.1.9",
|
|
41
|
-
"@n8n/typescript-config": "1.
|
|
42
|
-
"@n8n/
|
|
43
|
-
"@n8n/
|
|
40
|
+
"@n8n/typescript-config": "1.8.0",
|
|
41
|
+
"@n8n/eslint-config": "0.0.1",
|
|
42
|
+
"@n8n/vitest-config": "1.17.0"
|
|
44
43
|
},
|
|
45
44
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
46
45
|
"homepage": "https://n8n.io",
|
package/dist/assert2.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/assert.ts
|
|
3
|
-
/**
|
|
4
|
-
* Asserts given condition
|
|
5
|
-
*/
|
|
6
|
-
function assert(condition, message) {
|
|
7
|
-
if (!condition) throw new Error(message ?? "Assertion failed");
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
Object.defineProperty(exports, 'assert', {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () {
|
|
14
|
-
return assert;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=assert2.cjs.map
|
package/dist/assert2.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert2.cjs","names":[],"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Asserts given condition\n */\nexport function assert(condition: unknown, message?: string): asserts condition {\n\tif (!condition) {\n\t\t// eslint-disable-next-line n8n-local-rules/no-plain-errors\n\t\tthrow new Error(message ?? 'Assertion failed');\n\t}\n}\n"],"mappings":";;;;;AAGA,SAAgB,OAAO,WAAoB,SAAqC;AAC/E,KAAI,CAAC,UAEJ,OAAM,IAAI,MAAM,WAAW,mBAAmB"}
|
package/dist/assert2.d.cts
DELETED
package/dist/assert2.d.mts
DELETED
package/dist/assert2.mjs
DELETED
package/dist/assert2.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert2.mjs","names":[],"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Asserts given condition\n */\nexport function assert(condition: unknown, message?: string): asserts condition {\n\tif (!condition) {\n\t\t// eslint-disable-next-line n8n-local-rules/no-plain-errors\n\t\tthrow new Error(message ?? 'Assertion failed');\n\t}\n}\n"],"mappings":";;;;AAGA,SAAgB,OAAO,WAAoB,SAAqC;AAC/E,KAAI,CAAC,UAEJ,OAAM,IAAI,MAAM,WAAW,mBAAmB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/create-event-queue.ts
|
|
3
|
-
/**
|
|
4
|
-
* Create an event queue that processes events sequentially.
|
|
5
|
-
*
|
|
6
|
-
* @param processEvent - Async function that processes a single event.
|
|
7
|
-
* @returns A function that enqueues events for processing.
|
|
8
|
-
*/
|
|
9
|
-
function createEventQueue(processEvent) {
|
|
10
|
-
const queue = [];
|
|
11
|
-
let processing = false;
|
|
12
|
-
/**
|
|
13
|
-
* Process the next event in the queue (if not already processing).
|
|
14
|
-
*/
|
|
15
|
-
async function processNext() {
|
|
16
|
-
if (processing || queue.length === 0) return;
|
|
17
|
-
processing = true;
|
|
18
|
-
const currentEvent = queue.shift();
|
|
19
|
-
if (currentEvent !== void 0) try {
|
|
20
|
-
await processEvent(currentEvent);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error("Error processing event:", error);
|
|
23
|
-
}
|
|
24
|
-
processing = false;
|
|
25
|
-
await processNext();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Enqueue an event and trigger processing.
|
|
29
|
-
*
|
|
30
|
-
* @param event - The event to enqueue.
|
|
31
|
-
*/
|
|
32
|
-
function enqueue(event) {
|
|
33
|
-
queue.push(event);
|
|
34
|
-
processNext();
|
|
35
|
-
}
|
|
36
|
-
return { enqueue };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
Object.defineProperty(exports, 'createEventQueue', {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () {
|
|
43
|
-
return createEventQueue;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=create-event-queue2.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-event-queue2.cjs","names":["queue: T[]"],"sources":["../src/create-event-queue.ts"],"sourcesContent":["/**\n * Create an event queue that processes events sequentially.\n *\n * @param processEvent - Async function that processes a single event.\n * @returns A function that enqueues events for processing.\n */\nexport function createEventQueue<T>(processEvent: (event: T) => Promise<void>) {\n\t// The internal queue holding events.\n\tconst queue: T[] = [];\n\n\t// Flag to indicate whether an event is currently being processed.\n\tlet processing = false;\n\n\t/**\n\t * Process the next event in the queue (if not already processing).\n\t */\n\tasync function processNext(): Promise<void> {\n\t\tif (processing || queue.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tprocessing = true;\n\t\tconst currentEvent = queue.shift();\n\n\t\tif (currentEvent !== undefined) {\n\t\t\ttry {\n\t\t\t\tawait processEvent(currentEvent);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error processing event:', error);\n\t\t\t}\n\t\t}\n\n\t\tprocessing = false;\n\n\t\t// Recursively process the next event.\n\t\tawait processNext();\n\t}\n\n\t/**\n\t * Enqueue an event and trigger processing.\n\t *\n\t * @param event - The event to enqueue.\n\t */\n\tfunction enqueue(event: T): void {\n\t\tqueue.push(event);\n\t\tvoid processNext();\n\t}\n\n\treturn { enqueue };\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,iBAAoB,cAA2C;CAE9E,MAAMA,QAAa,EAAE;CAGrB,IAAI,aAAa;;;;CAKjB,eAAe,cAA6B;AAC3C,MAAI,cAAc,MAAM,WAAW,EAClC;AAGD,eAAa;EACb,MAAM,eAAe,MAAM,OAAO;AAElC,MAAI,iBAAiB,OACpB,KAAI;AACH,SAAM,aAAa,aAAa;WACxB,OAAO;AACf,WAAQ,MAAM,2BAA2B,MAAM;;AAIjD,eAAa;AAGb,QAAM,aAAa;;;;;;;CAQpB,SAAS,QAAQ,OAAgB;AAChC,QAAM,KAAK,MAAM;AACjB,EAAK,aAAa;;AAGnB,QAAO,EAAE,SAAS"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//#region src/create-event-queue.ts
|
|
2
|
-
/**
|
|
3
|
-
* Create an event queue that processes events sequentially.
|
|
4
|
-
*
|
|
5
|
-
* @param processEvent - Async function that processes a single event.
|
|
6
|
-
* @returns A function that enqueues events for processing.
|
|
7
|
-
*/
|
|
8
|
-
function createEventQueue(processEvent) {
|
|
9
|
-
const queue = [];
|
|
10
|
-
let processing = false;
|
|
11
|
-
/**
|
|
12
|
-
* Process the next event in the queue (if not already processing).
|
|
13
|
-
*/
|
|
14
|
-
async function processNext() {
|
|
15
|
-
if (processing || queue.length === 0) return;
|
|
16
|
-
processing = true;
|
|
17
|
-
const currentEvent = queue.shift();
|
|
18
|
-
if (currentEvent !== void 0) try {
|
|
19
|
-
await processEvent(currentEvent);
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error("Error processing event:", error);
|
|
22
|
-
}
|
|
23
|
-
processing = false;
|
|
24
|
-
await processNext();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Enqueue an event and trigger processing.
|
|
28
|
-
*
|
|
29
|
-
* @param event - The event to enqueue.
|
|
30
|
-
*/
|
|
31
|
-
function enqueue(event) {
|
|
32
|
-
queue.push(event);
|
|
33
|
-
processNext();
|
|
34
|
-
}
|
|
35
|
-
return { enqueue };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { createEventQueue as t };
|
|
40
|
-
//# sourceMappingURL=create-event-queue2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-event-queue2.mjs","names":["queue: T[]"],"sources":["../src/create-event-queue.ts"],"sourcesContent":["/**\n * Create an event queue that processes events sequentially.\n *\n * @param processEvent - Async function that processes a single event.\n * @returns A function that enqueues events for processing.\n */\nexport function createEventQueue<T>(processEvent: (event: T) => Promise<void>) {\n\t// The internal queue holding events.\n\tconst queue: T[] = [];\n\n\t// Flag to indicate whether an event is currently being processed.\n\tlet processing = false;\n\n\t/**\n\t * Process the next event in the queue (if not already processing).\n\t */\n\tasync function processNext(): Promise<void> {\n\t\tif (processing || queue.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tprocessing = true;\n\t\tconst currentEvent = queue.shift();\n\n\t\tif (currentEvent !== undefined) {\n\t\t\ttry {\n\t\t\t\tawait processEvent(currentEvent);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Error processing event:', error);\n\t\t\t}\n\t\t}\n\n\t\tprocessing = false;\n\n\t\t// Recursively process the next event.\n\t\tawait processNext();\n\t}\n\n\t/**\n\t * Enqueue an event and trigger processing.\n\t *\n\t * @param event - The event to enqueue.\n\t */\n\tfunction enqueue(event: T): void {\n\t\tqueue.push(event);\n\t\tvoid processNext();\n\t}\n\n\treturn { enqueue };\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,iBAAoB,cAA2C;CAE9E,MAAMA,QAAa,EAAE;CAGrB,IAAI,aAAa;;;;CAKjB,eAAe,cAA6B;AAC3C,MAAI,cAAc,MAAM,WAAW,EAClC;AAGD,eAAa;EACb,MAAM,eAAe,MAAM,OAAO;AAElC,MAAI,iBAAiB,OACpB,KAAI;AACH,SAAM,aAAa,aAAa;WACxB,OAAO;AACf,WAAQ,MAAM,2BAA2B,MAAM;;AAIjD,eAAa;AAGb,QAAM,aAAa;;;;;;;CAQpB,SAAS,QAAQ,OAAgB;AAChC,QAAM,KAAK,MAAM;AACjB,EAAK,aAAa;;AAGnB,QAAO,EAAE,SAAS"}
|
package/dist/event-bus2.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/event-bus.ts
|
|
3
|
-
/**
|
|
4
|
-
* Creates an event bus with the given listener map.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* const eventBus = createEventBus<{
|
|
9
|
-
* 'user-logged-in': { username: string };
|
|
10
|
-
* 'user-logged-out': never;
|
|
11
|
-
* }>();
|
|
12
|
-
*/
|
|
13
|
-
function createEventBus() {
|
|
14
|
-
const handlers = /* @__PURE__ */ new Map();
|
|
15
|
-
return {
|
|
16
|
-
on(eventName, fn) {
|
|
17
|
-
let eventFns = handlers.get(eventName);
|
|
18
|
-
if (!eventFns) eventFns = [fn];
|
|
19
|
-
else eventFns.push(fn);
|
|
20
|
-
handlers.set(eventName, eventFns);
|
|
21
|
-
},
|
|
22
|
-
once(eventName, fn) {
|
|
23
|
-
const handler = (payload) => {
|
|
24
|
-
this.off(eventName, handler);
|
|
25
|
-
fn(payload);
|
|
26
|
-
};
|
|
27
|
-
this.on(eventName, handler);
|
|
28
|
-
},
|
|
29
|
-
off(eventName, fn) {
|
|
30
|
-
const eventFns = handlers.get(eventName);
|
|
31
|
-
if (eventFns) eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
32
|
-
},
|
|
33
|
-
emit(eventName, event) {
|
|
34
|
-
const eventFns = handlers.get(eventName);
|
|
35
|
-
if (eventFns) eventFns.slice().forEach((handler) => {
|
|
36
|
-
handler(event);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
Object.defineProperty(exports, 'createEventBus', {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return createEventBus;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=event-bus2.cjs.map
|
package/dist/event-bus2.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus2.cjs","names":["handler: typeof fn"],"sources":["../src/event-bus.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CallbackFn = (...args: any[]) => any;\n\ntype Payloads<ListenerMap> = {\n\t[E in keyof ListenerMap]: unknown;\n};\n\ntype Listener<Payload> = (payload: Payload) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface EventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>> {\n\ton<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\tonce<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\toff<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\temit<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tevent?: ListenerMap[EventName],\n\t): void;\n}\n\n/**\n * Creates an event bus with the given listener map.\n *\n * @example\n * ```ts\n * const eventBus = createEventBus<{\n * 'user-logged-in': { username: string };\n * 'user-logged-out': never;\n * }>();\n */\nexport function createEventBus<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tListenerMap extends Payloads<ListenerMap> = Record<string, any>,\n>(): EventBus<ListenerMap> {\n\tconst handlers = new Map<string, CallbackFn[]>();\n\n\treturn {\n\t\ton(eventName, fn) {\n\t\t\tlet eventFns = handlers.get(eventName);\n\t\t\tif (!eventFns) {\n\t\t\t\teventFns = [fn];\n\t\t\t} else {\n\t\t\t\teventFns.push(fn);\n\t\t\t}\n\t\t\thandlers.set(eventName, eventFns);\n\t\t},\n\n\t\tonce(eventName, fn) {\n\t\t\tconst handler: typeof fn = (payload) => {\n\t\t\t\tthis.off(eventName, handler);\n\t\t\t\tfn(payload);\n\t\t\t};\n\t\t\tthis.on(eventName, handler);\n\t\t},\n\n\t\toff(eventName, fn) {\n\t\t\tconst eventFns = handlers.get(eventName);\n\t\t\tif (eventFns) {\n\t\t\t\teventFns.splice(eventFns.indexOf(fn) >>> 0, 1);\n\t\t\t}\n\t\t},\n\n\t\temit(eventName, event) {\n\t\t\tconst eventFns = handlers.get(eventName);\n\t\t\tif (eventFns) {\n\t\t\t\teventFns.slice().forEach((handler) => {\n\t\t\t\t\thandler(event);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AA0CA,SAAgB,iBAGW;CAC1B,MAAM,2BAAW,IAAI,KAA2B;AAEhD,QAAO;EACN,GAAG,WAAW,IAAI;GACjB,IAAI,WAAW,SAAS,IAAI,UAAU;AACtC,OAAI,CAAC,SACJ,YAAW,CAAC,GAAG;OAEf,UAAS,KAAK,GAAG;AAElB,YAAS,IAAI,WAAW,SAAS;;EAGlC,KAAK,WAAW,IAAI;GACnB,MAAMA,WAAsB,YAAY;AACvC,SAAK,IAAI,WAAW,QAAQ;AAC5B,OAAG,QAAQ;;AAEZ,QAAK,GAAG,WAAW,QAAQ;;EAG5B,IAAI,WAAW,IAAI;GAClB,MAAM,WAAW,SAAS,IAAI,UAAU;AACxC,OAAI,SACH,UAAS,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,EAAE;;EAIhD,KAAK,WAAW,OAAO;GACtB,MAAM,WAAW,SAAS,IAAI,UAAU;AACxC,OAAI,SACH,UAAS,OAAO,CAAC,SAAS,YAAY;AACrC,YAAQ,MAAM;KACb;;EAGJ"}
|
package/dist/event-bus2.d.cts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/event-bus.d.ts
|
|
2
|
-
type CallbackFn = (...args: any[]) => any;
|
|
3
|
-
type Payloads<ListenerMap> = { [E in keyof ListenerMap]: unknown };
|
|
4
|
-
type Listener<Payload> = (payload: Payload) => void;
|
|
5
|
-
interface EventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>> {
|
|
6
|
-
on<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
7
|
-
once<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
8
|
-
off<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
9
|
-
emit<EventName extends keyof ListenerMap & string>(eventName: EventName, event?: ListenerMap[EventName]): void;
|
|
10
|
-
}
|
|
11
|
-
declare function createEventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>>(): EventBus<ListenerMap>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { EventBus as n, createEventBus as r, CallbackFn as t };
|
|
14
|
-
//# sourceMappingURL=event-bus2.d.cts.map
|
package/dist/event-bus2.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/event-bus.d.ts
|
|
2
|
-
type CallbackFn = (...args: any[]) => any;
|
|
3
|
-
type Payloads<ListenerMap> = { [E in keyof ListenerMap]: unknown };
|
|
4
|
-
type Listener<Payload> = (payload: Payload) => void;
|
|
5
|
-
interface EventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>> {
|
|
6
|
-
on<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
7
|
-
once<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
8
|
-
off<EventName extends keyof ListenerMap & string>(eventName: EventName, fn: Listener<ListenerMap[EventName]>): void;
|
|
9
|
-
emit<EventName extends keyof ListenerMap & string>(eventName: EventName, event?: ListenerMap[EventName]): void;
|
|
10
|
-
}
|
|
11
|
-
declare function createEventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>>(): EventBus<ListenerMap>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { EventBus as n, createEventBus as r, CallbackFn as t };
|
|
14
|
-
//# sourceMappingURL=event-bus2.d.mts.map
|
package/dist/event-bus2.mjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//#region src/event-bus.ts
|
|
2
|
-
/**
|
|
3
|
-
* Creates an event bus with the given listener map.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const eventBus = createEventBus<{
|
|
8
|
-
* 'user-logged-in': { username: string };
|
|
9
|
-
* 'user-logged-out': never;
|
|
10
|
-
* }>();
|
|
11
|
-
*/
|
|
12
|
-
function createEventBus() {
|
|
13
|
-
const handlers = /* @__PURE__ */ new Map();
|
|
14
|
-
return {
|
|
15
|
-
on(eventName, fn) {
|
|
16
|
-
let eventFns = handlers.get(eventName);
|
|
17
|
-
if (!eventFns) eventFns = [fn];
|
|
18
|
-
else eventFns.push(fn);
|
|
19
|
-
handlers.set(eventName, eventFns);
|
|
20
|
-
},
|
|
21
|
-
once(eventName, fn) {
|
|
22
|
-
const handler = (payload) => {
|
|
23
|
-
this.off(eventName, handler);
|
|
24
|
-
fn(payload);
|
|
25
|
-
};
|
|
26
|
-
this.on(eventName, handler);
|
|
27
|
-
},
|
|
28
|
-
off(eventName, fn) {
|
|
29
|
-
const eventFns = handlers.get(eventName);
|
|
30
|
-
if (eventFns) eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
31
|
-
},
|
|
32
|
-
emit(eventName, event) {
|
|
33
|
-
const eventFns = handlers.get(eventName);
|
|
34
|
-
if (eventFns) eventFns.slice().forEach((handler) => {
|
|
35
|
-
handler(event);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
|
-
export { createEventBus as t };
|
|
43
|
-
//# sourceMappingURL=event-bus2.mjs.map
|
package/dist/event-bus2.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus2.mjs","names":["handler: typeof fn"],"sources":["../src/event-bus.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CallbackFn = (...args: any[]) => any;\n\ntype Payloads<ListenerMap> = {\n\t[E in keyof ListenerMap]: unknown;\n};\n\ntype Listener<Payload> = (payload: Payload) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface EventBus<ListenerMap extends Payloads<ListenerMap> = Record<string, any>> {\n\ton<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\tonce<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\toff<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tfn: Listener<ListenerMap[EventName]>,\n\t): void;\n\n\temit<EventName extends keyof ListenerMap & string>(\n\t\teventName: EventName,\n\t\tevent?: ListenerMap[EventName],\n\t): void;\n}\n\n/**\n * Creates an event bus with the given listener map.\n *\n * @example\n * ```ts\n * const eventBus = createEventBus<{\n * 'user-logged-in': { username: string };\n * 'user-logged-out': never;\n * }>();\n */\nexport function createEventBus<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tListenerMap extends Payloads<ListenerMap> = Record<string, any>,\n>(): EventBus<ListenerMap> {\n\tconst handlers = new Map<string, CallbackFn[]>();\n\n\treturn {\n\t\ton(eventName, fn) {\n\t\t\tlet eventFns = handlers.get(eventName);\n\t\t\tif (!eventFns) {\n\t\t\t\teventFns = [fn];\n\t\t\t} else {\n\t\t\t\teventFns.push(fn);\n\t\t\t}\n\t\t\thandlers.set(eventName, eventFns);\n\t\t},\n\n\t\tonce(eventName, fn) {\n\t\t\tconst handler: typeof fn = (payload) => {\n\t\t\t\tthis.off(eventName, handler);\n\t\t\t\tfn(payload);\n\t\t\t};\n\t\t\tthis.on(eventName, handler);\n\t\t},\n\n\t\toff(eventName, fn) {\n\t\t\tconst eventFns = handlers.get(eventName);\n\t\t\tif (eventFns) {\n\t\t\t\teventFns.splice(eventFns.indexOf(fn) >>> 0, 1);\n\t\t\t}\n\t\t},\n\n\t\temit(eventName, event) {\n\t\t\tconst eventFns = handlers.get(eventName);\n\t\t\tif (eventFns) {\n\t\t\t\teventFns.slice().forEach((handler) => {\n\t\t\t\t\thandler(event);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;AA0CA,SAAgB,iBAGW;CAC1B,MAAM,2BAAW,IAAI,KAA2B;AAEhD,QAAO;EACN,GAAG,WAAW,IAAI;GACjB,IAAI,WAAW,SAAS,IAAI,UAAU;AACtC,OAAI,CAAC,SACJ,YAAW,CAAC,GAAG;OAEf,UAAS,KAAK,GAAG;AAElB,YAAS,IAAI,WAAW,SAAS;;EAGlC,KAAK,WAAW,IAAI;GACnB,MAAMA,WAAsB,YAAY;AACvC,SAAK,IAAI,WAAW,QAAQ;AAC5B,OAAG,QAAQ;;AAEZ,QAAK,GAAG,WAAW,QAAQ;;EAG5B,IAAI,WAAW,IAAI;GAClB,MAAM,WAAW,SAAS,IAAI,UAAU;AACxC,OAAI,SACH,UAAS,OAAO,SAAS,QAAQ,GAAG,KAAK,GAAG,EAAE;;EAIhD,KAAK,WAAW,OAAO;GACtB,MAAM,WAAW,SAAS,IAAI,UAAU;AACxC,OAAI,SACH,UAAS,OAAO,CAAC,SAAS,YAAY;AACrC,YAAQ,MAAM;KACb;;EAGJ"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
let __n8n_constants = require("@n8n/constants");
|
|
2
|
-
let nanoid = require("nanoid");
|
|
3
|
-
|
|
4
|
-
//#region src/generate-nano-id.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=generate-nano-id2.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-nano-id2.cjs","names":["NANOID_ALPHABET"],"sources":["../src/generate-nano-id.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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { NANOID_ALPHABET } from "@n8n/constants";
|
|
2
|
-
import { customAlphabet } from "nanoid";
|
|
3
|
-
|
|
4
|
-
//#region src/generate-nano-id.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=generate-nano-id2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-nano-id2.mjs","names":[],"sources":["../src/generate-nano-id.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/dist/get-jwt-expiry2.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/get-jwt-expiry.ts
|
|
3
|
-
/**
|
|
4
|
-
* Decode the payload of a JWT without verifying the signature.
|
|
5
|
-
* Returns the `exp` claim (seconds since epoch) or undefined.
|
|
6
|
-
*
|
|
7
|
-
* Use only for trusted tokens (e.g. ones we just received from our own proxy)
|
|
8
|
-
* where the goal is scheduling refresh, not authenticating the issuer.
|
|
9
|
-
*/
|
|
10
|
-
function getJwtExpiry(jwt) {
|
|
11
|
-
const parts = jwt.split(".");
|
|
12
|
-
if (parts.length !== 3) return void 0;
|
|
13
|
-
try {
|
|
14
|
-
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString());
|
|
15
|
-
return typeof payload.exp === "number" ? payload.exp : void 0;
|
|
16
|
-
} catch {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
Object.defineProperty(exports, 'getJwtExpiry', {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return getJwtExpiry;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=get-jwt-expiry2.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-jwt-expiry2.cjs","names":[],"sources":["../src/get-jwt-expiry.ts"],"sourcesContent":["/**\n * Decode the payload of a JWT without verifying the signature.\n * Returns the `exp` claim (seconds since epoch) or undefined.\n *\n * Use only for trusted tokens (e.g. ones we just received from our own proxy)\n * where the goal is scheduling refresh, not authenticating the issuer.\n */\nexport function getJwtExpiry(jwt: string): number | undefined {\n\tconst parts = jwt.split('.');\n\tif (parts.length !== 3) return undefined;\n\ttry {\n\t\tconst payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString()) as {\n\t\t\texp?: number;\n\t\t};\n\t\treturn typeof payload.exp === 'number' ? payload.exp : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,aAAa,KAAiC;CAC7D,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC5B,KAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,KAAI;EACH,MAAM,UAAU,KAAK,MAAM,OAAO,KAAK,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC;AAGzE,SAAO,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;SAChD;AACP"}
|
package/dist/get-jwt-expiry2.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/get-jwt-expiry.ts
|
|
2
|
-
/**
|
|
3
|
-
* Decode the payload of a JWT without verifying the signature.
|
|
4
|
-
* Returns the `exp` claim (seconds since epoch) or undefined.
|
|
5
|
-
*
|
|
6
|
-
* Use only for trusted tokens (e.g. ones we just received from our own proxy)
|
|
7
|
-
* where the goal is scheduling refresh, not authenticating the issuer.
|
|
8
|
-
*/
|
|
9
|
-
function getJwtExpiry(jwt) {
|
|
10
|
-
const parts = jwt.split(".");
|
|
11
|
-
if (parts.length !== 3) return void 0;
|
|
12
|
-
try {
|
|
13
|
-
const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString());
|
|
14
|
-
return typeof payload.exp === "number" ? payload.exp : void 0;
|
|
15
|
-
} catch {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { getJwtExpiry as t };
|
|
22
|
-
//# sourceMappingURL=get-jwt-expiry2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-jwt-expiry2.mjs","names":[],"sources":["../src/get-jwt-expiry.ts"],"sourcesContent":["/**\n * Decode the payload of a JWT without verifying the signature.\n * Returns the `exp` claim (seconds since epoch) or undefined.\n *\n * Use only for trusted tokens (e.g. ones we just received from our own proxy)\n * where the goal is scheduling refresh, not authenticating the issuer.\n */\nexport function getJwtExpiry(jwt: string): number | undefined {\n\tconst parts = jwt.split('.');\n\tif (parts.length !== 3) return undefined;\n\ttry {\n\t\tconst payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString()) as {\n\t\t\texp?: number;\n\t\t};\n\t\treturn typeof payload.exp === 'number' ? payload.exp : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,aAAa,KAAiC;CAC7D,MAAM,QAAQ,IAAI,MAAM,IAAI;AAC5B,KAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,KAAI;EACH,MAAM,UAAU,KAAK,MAAM,OAAO,KAAK,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC;AAGzE,SAAO,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;SAChD;AACP"}
|
package/dist/index.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const require_assert = require('./assert2.cjs');
|
|
2
|
-
const require_create_event_queue = require('./create-event-queue2.cjs');
|
|
3
|
-
const require_event_bus = require('./event-bus2.cjs');
|
|
4
|
-
const require_format_pem_block = require('./format-pem-block2.cjs');
|
|
5
|
-
const require_generate_nano_id = require('./generate-nano-id2.cjs');
|
|
6
|
-
const require_get_jwt_expiry = require('./get-jwt-expiry2.cjs');
|
|
7
|
-
const require_retry = require('./retry2.cjs');
|
|
8
|
-
const require_smart_decimal = require('./smart-decimal.cjs');
|
|
9
|
-
const require_re_rank_search_results = require('./re-rank-search-results.cjs');
|
|
10
|
-
const require_sublime_search = require('./sublime-search.cjs');
|
|
11
|
-
const require_sort_by_property = require('./sort-by-property.cjs');
|
|
12
|
-
const require_truncate = require('./truncate.cjs');
|
|
13
|
-
const require_sanitize_filename = require('./sanitize-filename.cjs');
|
|
14
|
-
const require_is_windows_file_path = require('./is-windows-file-path.cjs');
|
|
15
|
-
const require_placeholder = require('./placeholder2.cjs');
|
|
16
|
-
const require_scrub_secrets = require('./scrub-secrets2.cjs');
|
|
17
|
-
const require_is_record = require('./is-record2.cjs');
|
|
18
|
-
|
|
19
|
-
exports.DEFAULT_KEYS = require_sublime_search.DEFAULT_KEYS;
|
|
20
|
-
exports.SECRET_KEYS = require_scrub_secrets.SECRET_KEYS;
|
|
21
|
-
exports.SECRET_VALUE_PATTERNS = require_scrub_secrets.SECRET_VALUE_PATTERNS;
|
|
22
|
-
exports.assert = require_assert.assert;
|
|
23
|
-
exports.createEventBus = require_event_bus.createEventBus;
|
|
24
|
-
exports.createEventQueue = require_create_event_queue.createEventQueue;
|
|
25
|
-
exports.extractPlaceholderLabels = require_placeholder.extractPlaceholderLabels;
|
|
26
|
-
exports.findPlaceholderDetails = require_placeholder.findPlaceholderDetails;
|
|
27
|
-
exports.formatPemBlock = require_format_pem_block.formatPemBlock;
|
|
28
|
-
exports.formatPlaceholderPath = require_placeholder.formatPlaceholderPath;
|
|
29
|
-
exports.generateNanoId = require_generate_nano_id.generateNanoId;
|
|
30
|
-
exports.getJwtExpiry = require_get_jwt_expiry.getJwtExpiry;
|
|
31
|
-
exports.hasPlaceholderDeep = require_placeholder.hasPlaceholderDeep;
|
|
32
|
-
exports.isPlaceholderString = require_placeholder.isPlaceholderString;
|
|
33
|
-
exports.isPlaceholderValue = require_placeholder.isPlaceholderValue;
|
|
34
|
-
exports.isRecord = require_is_record.isRecord;
|
|
35
|
-
exports.isWindowsFilePath = require_is_windows_file_path.isWindowsFilePath;
|
|
36
|
-
exports.reRankSearchResults = require_re_rank_search_results.reRankSearchResults;
|
|
37
|
-
exports.retry = require_retry.retry;
|
|
38
|
-
exports.sanitizeFilename = require_sanitize_filename.sanitizeFilename;
|
|
39
|
-
exports.scrubSecretsInText = require_scrub_secrets.scrubSecretsInText;
|
|
40
|
-
exports.smartDecimal = require_smart_decimal.smartDecimal;
|
|
41
|
-
exports.sortByProperty = require_sort_by_property.sortByProperty;
|
|
42
|
-
exports.sublimeSearch = require_sublime_search.sublimeSearch;
|
|
43
|
-
exports.truncate = require_truncate.truncate;
|
|
44
|
-
exports.truncateBeforeLast = require_truncate.truncateBeforeLast;
|
package/dist/index.d.cts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { t as assert } from "./assert2.cjs";
|
|
2
|
-
import { t as createEventQueue } from "./create-event-queue2.cjs";
|
|
3
|
-
import { n as EventBus, r as createEventBus, t as CallbackFn } from "./event-bus2.cjs";
|
|
4
|
-
import { t as isWindowsFilePath } from "./is-windows-file-path.cjs";
|
|
5
|
-
import { t as sanitizeFilename } from "./sanitize-filename.cjs";
|
|
6
|
-
import { t as formatPemBlock } from "./format-pem-block2.cjs";
|
|
7
|
-
import { t as generateNanoId } from "./generate-nano-id2.cjs";
|
|
8
|
-
import { t as getJwtExpiry } from "./get-jwt-expiry2.cjs";
|
|
9
|
-
import { t as retry } from "./retry2.cjs";
|
|
10
|
-
import { t as smartDecimal } from "./smart-decimal.cjs";
|
|
11
|
-
import { t as reRankSearchResults } from "./re-rank-search-results.cjs";
|
|
12
|
-
import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublime-search.cjs";
|
|
13
|
-
import { t as sortByProperty } from "./sort-by-property.cjs";
|
|
14
|
-
import { n as truncateBeforeLast, t as truncate } from "./truncate.cjs";
|
|
15
|
-
import { a as hasPlaceholderDeep, i as formatPlaceholderPath, n as extractPlaceholderLabels, o as isPlaceholderString, r as findPlaceholderDetails, s as isPlaceholderValue, t as PlaceholderDetail } from "./placeholder2.cjs";
|
|
16
|
-
import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.cjs";
|
|
17
|
-
import { t as DistributiveOmit } from "./types2.cjs";
|
|
18
|
-
import { t as isRecord } from "./is-record2.cjs";
|
|
19
|
-
export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, SECRET_KEYS, SECRET_VALUE_PATTERNS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPemBlock, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isRecord, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/index.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { t as assert } from "./assert2.mjs";
|
|
2
|
-
import { t as createEventQueue } from "./create-event-queue2.mjs";
|
|
3
|
-
import { n as EventBus, r as createEventBus, t as CallbackFn } from "./event-bus2.mjs";
|
|
4
|
-
import { t as isWindowsFilePath } from "./is-windows-file-path.mjs";
|
|
5
|
-
import { t as sanitizeFilename } from "./sanitize-filename.mjs";
|
|
6
|
-
import { t as formatPemBlock } from "./format-pem-block2.mjs";
|
|
7
|
-
import { t as generateNanoId } from "./generate-nano-id2.mjs";
|
|
8
|
-
import { t as getJwtExpiry } from "./get-jwt-expiry2.mjs";
|
|
9
|
-
import { t as retry } from "./retry2.mjs";
|
|
10
|
-
import { t as smartDecimal } from "./smart-decimal.mjs";
|
|
11
|
-
import { t as reRankSearchResults } from "./re-rank-search-results.mjs";
|
|
12
|
-
import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublime-search.mjs";
|
|
13
|
-
import { t as sortByProperty } from "./sort-by-property.mjs";
|
|
14
|
-
import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
|
|
15
|
-
import { a as hasPlaceholderDeep, i as formatPlaceholderPath, n as extractPlaceholderLabels, o as isPlaceholderString, r as findPlaceholderDetails, s as isPlaceholderValue, t as PlaceholderDetail } from "./placeholder2.mjs";
|
|
16
|
-
import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.mjs";
|
|
17
|
-
import { t as DistributiveOmit } from "./types2.mjs";
|
|
18
|
-
import { t as isRecord } from "./is-record2.mjs";
|
|
19
|
-
export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, SECRET_KEYS, SECRET_VALUE_PATTERNS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPemBlock, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isRecord, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|