@n8n/utils 1.31.0 → 1.32.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 +2 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/jwt.cjs +3 -0
- package/dist/jwt.d.cts +2 -0
- package/dist/jwt.d.mts +2 -0
- package/dist/jwt.mjs +3 -0
- package/dist/jwt2.cjs +28 -0
- package/dist/jwt2.cjs.map +1 -0
- package/dist/jwt2.d.cts +5 -0
- package/dist/jwt2.d.mts +5 -0
- package/dist/jwt2.mjs +22 -0
- package/dist/jwt2.mjs.map +1 -0
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const require_truncate = require('./truncate.cjs');
|
|
|
11
11
|
const require_sanitize = require('./sanitize.cjs');
|
|
12
12
|
const require_path = require('./path.cjs');
|
|
13
13
|
const require_placeholder = require('./placeholder2.cjs');
|
|
14
|
+
const require_jwt = require('./jwt2.cjs');
|
|
14
15
|
|
|
15
16
|
exports.DEFAULT_KEYS = require_sublimeSearch.DEFAULT_KEYS;
|
|
16
17
|
exports.assert = require_assert.assert;
|
|
@@ -20,6 +21,7 @@ exports.extractPlaceholderLabels = require_placeholder.extractPlaceholderLabels;
|
|
|
20
21
|
exports.findPlaceholderDetails = require_placeholder.findPlaceholderDetails;
|
|
21
22
|
exports.formatPlaceholderPath = require_placeholder.formatPlaceholderPath;
|
|
22
23
|
exports.generateNanoId = require_workflowId.generateNanoId;
|
|
24
|
+
exports.getJwtExpiry = require_jwt.getJwtExpiry;
|
|
23
25
|
exports.hasPlaceholderDeep = require_placeholder.hasPlaceholderDeep;
|
|
24
26
|
exports.isPlaceholderString = require_placeholder.isPlaceholderString;
|
|
25
27
|
exports.isPlaceholderValue = require_placeholder.isPlaceholderValue;
|
package/dist/index.d.cts
CHANGED
|
@@ -11,4 +11,5 @@ import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.cjs";
|
|
|
11
11
|
import { t as sortByProperty } from "./sortByProperty.cjs";
|
|
12
12
|
import { n as truncateBeforeLast, t as truncate } from "./truncate.cjs";
|
|
13
13
|
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";
|
|
14
|
-
|
|
14
|
+
import { t as getJwtExpiry } from "./jwt2.cjs";
|
|
15
|
+
export { CallbackFn, DEFAULT_KEYS, EventBus, PlaceholderDetail, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/index.d.mts
CHANGED
|
@@ -11,4 +11,5 @@ import { n as sublimeSearch, t as DEFAULT_KEYS } from "./sublimeSearch.mjs";
|
|
|
11
11
|
import { t as sortByProperty } from "./sortByProperty.mjs";
|
|
12
12
|
import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
|
|
13
13
|
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";
|
|
14
|
-
|
|
14
|
+
import { t as getJwtExpiry } from "./jwt2.mjs";
|
|
15
|
+
export { CallbackFn, DEFAULT_KEYS, EventBus, PlaceholderDetail, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/index.mjs
CHANGED
|
@@ -11,5 +11,6 @@ import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
|
|
|
11
11
|
import { t as sanitizeFilename } from "./sanitize.mjs";
|
|
12
12
|
import { t as isWindowsFilePath } from "./path.mjs";
|
|
13
13
|
import { a as isPlaceholderString, i as hasPlaceholderDeep, n as findPlaceholderDetails, o as isPlaceholderValue, r as formatPlaceholderPath, t as extractPlaceholderLabels } from "./placeholder2.mjs";
|
|
14
|
+
import { t as getJwtExpiry } from "./jwt2.mjs";
|
|
14
15
|
|
|
15
|
-
export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
|
16
|
+
export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
|
package/dist/jwt.cjs
ADDED
package/dist/jwt.d.cts
ADDED
package/dist/jwt.d.mts
ADDED
package/dist/jwt.mjs
ADDED
package/dist/jwt2.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/jwt.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=jwt2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt2.cjs","names":[],"sources":["../src/jwt.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/jwt2.d.cts
ADDED
package/dist/jwt2.d.mts
ADDED
package/dist/jwt2.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/jwt.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=jwt2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt2.mjs","names":[],"sources":["../src/jwt.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/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.32.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"LICENSE_EE.md",
|
|
8
|
+
"LICENSE.md"
|
|
9
9
|
],
|
|
10
10
|
"main": "./dist/index.cjs",
|
|
11
11
|
"module": "./dist/index.mjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"nanoid": "3.3.8",
|
|
32
|
-
"@n8n/constants": "0.
|
|
32
|
+
"@n8n/constants": "0.25.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"vite": "^8.0.2",
|
|
40
40
|
"vitest": "^4.1.1",
|
|
41
41
|
"@n8n/eslint-config": "0.0.1",
|
|
42
|
-
"@n8n/
|
|
43
|
-
"@n8n/
|
|
42
|
+
"@n8n/typescript-config": "1.4.0",
|
|
43
|
+
"@n8n/vitest-config": "1.12.0"
|
|
44
44
|
},
|
|
45
45
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
46
46
|
"homepage": "https://n8n.io",
|