n8n-nodes-jev 0.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.
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_BASE_URL = void 0;
4
+ exports.getRetryDelay = getRetryDelay;
5
+ exports.jevApiRequest = jevApiRequest;
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ exports.DEFAULT_BASE_URL = 'https://api.typesafe.ai';
8
+ const RETRYABLE_STATUS = new Set([429, 529]);
9
+ const MAX_BACKOFF_MS = 30000;
10
+ function getHeader(headers, name) {
11
+ if (!headers)
12
+ return undefined;
13
+ const match = Object.keys(headers).find((key) => key.toLowerCase() === name);
14
+ return match === undefined ? undefined : String(headers[match]);
15
+ }
16
+ function getRetryDelay(attempt, retryAfter) {
17
+ if (retryAfter) {
18
+ const seconds = Number(retryAfter);
19
+ if (Number.isFinite(seconds) && seconds >= 0)
20
+ return Math.min(seconds * 1000, MAX_BACKOFF_MS);
21
+ const date = Date.parse(retryAfter);
22
+ if (!Number.isNaN(date))
23
+ return Math.min(Math.max(date - Date.now(), 0), MAX_BACKOFF_MS);
24
+ }
25
+ const base = 1000 * 2 ** attempt;
26
+ return Math.min(base + Math.floor(Math.random() * 250), MAX_BACKOFF_MS);
27
+ }
28
+ function describeError(body) {
29
+ var _a;
30
+ if (!body || typeof body !== 'object')
31
+ return typeof body === 'string' ? body : undefined;
32
+ const { detail, message, error } = body;
33
+ if (Array.isArray(detail)) {
34
+ return detail
35
+ .map((entry) => {
36
+ const { loc, msg } = (entry !== null && entry !== void 0 ? entry : {});
37
+ return Array.isArray(loc)
38
+ ? `${loc.join('.')}: ${msg}`
39
+ : String(msg !== null && msg !== void 0 ? msg : JSON.stringify(entry));
40
+ })
41
+ .join('; ');
42
+ }
43
+ const text = (_a = detail !== null && detail !== void 0 ? detail : message) !== null && _a !== void 0 ? _a : error;
44
+ if (text === undefined)
45
+ return undefined;
46
+ return typeof text === 'string' ? text : JSON.stringify(text);
47
+ }
48
+ async function jevApiRequest(method, endpoint, body, options = {}) {
49
+ var _a, _b;
50
+ const credentials = await this.getCredentials('jevApi');
51
+ const baseURL = (credentials.baseUrl || exports.DEFAULT_BASE_URL).replace(/\/+$/, '');
52
+ const maxRetries = (_a = options.maxRetries) !== null && _a !== void 0 ? _a : 3;
53
+ for (let attempt = 0;; attempt++) {
54
+ const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'jevApi', {
55
+ method,
56
+ baseURL,
57
+ url: endpoint,
58
+ body,
59
+ json: true,
60
+ returnFullResponse: true,
61
+ ignoreHttpStatusErrors: true,
62
+ timeout: options.timeout,
63
+ }));
64
+ const { statusCode } = response;
65
+ if (statusCode >= 200 && statusCode < 300)
66
+ return response.body;
67
+ if (RETRYABLE_STATUS.has(statusCode) && attempt < maxRetries) {
68
+ await (0, n8n_workflow_1.sleep)(getRetryDelay(attempt, getHeader(response.headers, 'retry-after')));
69
+ continue;
70
+ }
71
+ const errorBody = response.body && typeof response.body === 'object'
72
+ ? response.body
73
+ : { message: String((_b = response.body) !== null && _b !== void 0 ? _b : '') };
74
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), errorBody, {
75
+ httpCode: String(statusCode),
76
+ description: describeError(response.body),
77
+ itemIndex: options.itemIndex,
78
+ });
79
+ }
80
+ }
81
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../nodes/Jev/shared/transport.ts"],"names":[],"mappings":";;;AA6BA,sCASC;AAqBD,sCA0CC;AA7FD,+CAAmD;AAEtC,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAG1D,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC7C,MAAM,cAAc,GAAG,KAAM,CAAC;AAQ9B,SAAS,SAAS,CAAC,OAAgC,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AS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "n8n-nodes-jev",
3
+ "version": "0.2.0",
4
+ "description": "n8n node for Jev by TypeSafe: classify, route, and score text with questions you define, and get a probability for every answer.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/vibe-with-me-tools/n8n-nodes-jev#readme",
7
+ "keywords": [
8
+ "n8n-community-node-package",
9
+ "n8n",
10
+ "n8n-node",
11
+ "jev",
12
+ "typesafe",
13
+ "classification",
14
+ "text-classification",
15
+ "routing",
16
+ "triage",
17
+ "moderation",
18
+ "guardrails",
19
+ "workflow-automation"
20
+ ],
21
+ "author": {
22
+ "name": "Brains of Bots",
23
+ "email": "mjsadiq@gmail.com"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/vibe-with-me-tools/n8n-nodes-jev.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/vibe-with-me-tools/n8n-nodes-jev/issues"
31
+ },
32
+ "scripts": {
33
+ "build": "n8n-node build",
34
+ "build:watch": "tsc --watch",
35
+ "dev": "n8n-node dev",
36
+ "lint": "n8n-node lint",
37
+ "lint:fix": "n8n-node lint --fix",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest",
40
+ "typecheck": "tsc --noEmit -p test/tsconfig.json",
41
+ "release": "n8n-node release",
42
+ "prepublishOnly": "n8n-node prerelease"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "!dist/docs",
47
+ "!dist/**/*.tsbuildinfo"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "provenance": true
52
+ },
53
+ "n8n": {
54
+ "n8nNodesApiVersion": 1,
55
+ "strict": true,
56
+ "credentials": [
57
+ "dist/credentials/JevApi.credentials.js"
58
+ ],
59
+ "nodes": [
60
+ "dist/nodes/Jev/Jev.node.js"
61
+ ]
62
+ },
63
+ "devDependencies": {
64
+ "@n8n/node-cli": "*",
65
+ "eslint": "9.39.4",
66
+ "prettier": "3.8.3",
67
+ "release-it": "20.2.0",
68
+ "typescript": "5.9.3",
69
+ "vitest": "5.0.1"
70
+ },
71
+ "peerDependencies": {
72
+ "n8n-workflow": "*"
73
+ }
74
+ }
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "n8n-nodes-jev",
3
+ "version": "0.2.0",
4
+ "description": "n8n node for Jev by TypeSafe: classify, route, and score text with questions you define, and get a probability for every answer.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/vibe-with-me-tools/n8n-nodes-jev#readme",
7
+ "keywords": [
8
+ "n8n-community-node-package",
9
+ "n8n",
10
+ "n8n-node",
11
+ "jev",
12
+ "typesafe",
13
+ "classification",
14
+ "text-classification",
15
+ "routing",
16
+ "triage",
17
+ "moderation",
18
+ "guardrails",
19
+ "workflow-automation"
20
+ ],
21
+ "author": {
22
+ "name": "Brains of Bots",
23
+ "email": "mjsadiq@gmail.com"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/vibe-with-me-tools/n8n-nodes-jev.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/vibe-with-me-tools/n8n-nodes-jev/issues"
31
+ },
32
+ "scripts": {
33
+ "build": "n8n-node build",
34
+ "build:watch": "tsc --watch",
35
+ "dev": "n8n-node dev",
36
+ "lint": "n8n-node lint",
37
+ "lint:fix": "n8n-node lint --fix",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest",
40
+ "typecheck": "tsc --noEmit -p test/tsconfig.json",
41
+ "release": "n8n-node release",
42
+ "prepublishOnly": "n8n-node prerelease"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "!dist/docs",
47
+ "!dist/**/*.tsbuildinfo"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "provenance": true
52
+ },
53
+ "n8n": {
54
+ "n8nNodesApiVersion": 1,
55
+ "strict": true,
56
+ "credentials": [
57
+ "dist/credentials/JevApi.credentials.js"
58
+ ],
59
+ "nodes": [
60
+ "dist/nodes/Jev/Jev.node.js"
61
+ ]
62
+ },
63
+ "devDependencies": {
64
+ "@n8n/node-cli": "*",
65
+ "eslint": "9.39.4",
66
+ "prettier": "3.8.3",
67
+ "release-it": "20.2.0",
68
+ "typescript": "5.9.3",
69
+ "vitest": "5.0.1"
70
+ },
71
+ "peerDependencies": {
72
+ "n8n-workflow": "*"
73
+ }
74
+ }