n8n-nodes-2kw 5.3.0-dev.22

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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/credentials/TwoKwApi.credentials.d.ts +9 -0
  4. package/dist/credentials/TwoKwApi.credentials.js +43 -0
  5. package/dist/credentials/TwoKwApi.credentials.js.map +1 -0
  6. package/dist/nodes/TwoKw/TwoKw.node.d.ts +9 -0
  7. package/dist/nodes/TwoKw/TwoKw.node.js +76 -0
  8. package/dist/nodes/TwoKw/TwoKw.node.js.map +1 -0
  9. package/dist/nodes/TwoKw/descriptions/document.d.ts +3 -0
  10. package/dist/nodes/TwoKw/descriptions/document.js +128 -0
  11. package/dist/nodes/TwoKw/descriptions/document.js.map +1 -0
  12. package/dist/nodes/TwoKw/descriptions/extraction.d.ts +3 -0
  13. package/dist/nodes/TwoKw/descriptions/extraction.js +173 -0
  14. package/dist/nodes/TwoKw/descriptions/extraction.js.map +1 -0
  15. package/dist/nodes/TwoKw/descriptions/index.d.ts +3 -0
  16. package/dist/nodes/TwoKw/descriptions/index.js +35 -0
  17. package/dist/nodes/TwoKw/descriptions/index.js.map +1 -0
  18. package/dist/nodes/TwoKw/descriptions/prompt.d.ts +3 -0
  19. package/dist/nodes/TwoKw/descriptions/prompt.js +113 -0
  20. package/dist/nodes/TwoKw/descriptions/prompt.js.map +1 -0
  21. package/dist/nodes/TwoKw/descriptions/schema.d.ts +3 -0
  22. package/dist/nodes/TwoKw/descriptions/schema.js +45 -0
  23. package/dist/nodes/TwoKw/descriptions/schema.js.map +1 -0
  24. package/dist/nodes/TwoKw/descriptions/transcription.d.ts +3 -0
  25. package/dist/nodes/TwoKw/descriptions/transcription.js +76 -0
  26. package/dist/nodes/TwoKw/descriptions/transcription.js.map +1 -0
  27. package/dist/nodes/TwoKw/icon.svg +4 -0
  28. package/dist/nodes/TwoKw/methods.d.ts +11 -0
  29. package/dist/nodes/TwoKw/methods.js +95 -0
  30. package/dist/nodes/TwoKw/methods.js.map +1 -0
  31. package/dist/nodes/TwoKw/operations/document.d.ts +2 -0
  32. package/dist/nodes/TwoKw/operations/document.js +64 -0
  33. package/dist/nodes/TwoKw/operations/document.js.map +1 -0
  34. package/dist/nodes/TwoKw/operations/extraction.d.ts +2 -0
  35. package/dist/nodes/TwoKw/operations/extraction.js +92 -0
  36. package/dist/nodes/TwoKw/operations/extraction.js.map +1 -0
  37. package/dist/nodes/TwoKw/operations/prompt.d.ts +2 -0
  38. package/dist/nodes/TwoKw/operations/prompt.js +48 -0
  39. package/dist/nodes/TwoKw/operations/prompt.js.map +1 -0
  40. package/dist/nodes/TwoKw/operations/schema.d.ts +2 -0
  41. package/dist/nodes/TwoKw/operations/schema.js +18 -0
  42. package/dist/nodes/TwoKw/operations/schema.js.map +1 -0
  43. package/dist/nodes/TwoKw/operations/transcription.d.ts +2 -0
  44. package/dist/nodes/TwoKw/operations/transcription.js +42 -0
  45. package/dist/nodes/TwoKw/operations/transcription.js.map +1 -0
  46. package/dist/nodes/TwoKw/polling.d.ts +8 -0
  47. package/dist/nodes/TwoKw/polling.js +17 -0
  48. package/dist/nodes/TwoKw/polling.js.map +1 -0
  49. package/dist/nodes/TwoKw/splitConvert.d.ts +10 -0
  50. package/dist/nodes/TwoKw/splitConvert.js +20 -0
  51. package/dist/nodes/TwoKw/splitConvert.js.map +1 -0
  52. package/dist/nodes/TwoKw/transport.d.ts +17 -0
  53. package/dist/nodes/TwoKw/transport.js +51 -0
  54. package/dist/nodes/TwoKw/transport.js.map +1 -0
  55. package/index.js +8 -0
  56. package/package.json +62 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executePrompt = executePrompt;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const transport_1 = require("../transport");
6
+ async function executePrompt(itemIndex, operation) {
7
+ if (operation === 'get') {
8
+ const promptId = (0, transport_1.extractResourceId)(this.getNodeParameter('prompt', itemIndex));
9
+ const result = await (0, transport_1.apiRequest)(this, 'GET', '/v1/prompts/{id}', {
10
+ pathParams: { id: promptId },
11
+ });
12
+ return [{ json: result, pairedItem: itemIndex }];
13
+ }
14
+ if (operation === 'compile') {
15
+ const promptId = (0, transport_1.extractResourceId)(this.getNodeParameter('prompt', itemIndex));
16
+ const rawVariables = this.getNodeParameter('variables', itemIndex);
17
+ const variables = typeof rawVariables === 'string'
18
+ ? JSON.parse(rawVariables)
19
+ : rawVariables;
20
+ const versionId = this.getNodeParameter('versionId', itemIndex) || '';
21
+ const label = (0, transport_1.extractResourceId)(this.getNodeParameter('label', itemIndex));
22
+ const body = { variables };
23
+ if (versionId)
24
+ body.versionId = versionId;
25
+ if (label)
26
+ body.label = label;
27
+ const result = await (0, transport_1.apiRequest)(this, 'POST', '/v1/prompts/{promptId}/compile', {
28
+ pathParams: { promptId },
29
+ body,
30
+ });
31
+ return [{ json: result, pairedItem: itemIndex }];
32
+ }
33
+ if (operation === 'resolve') {
34
+ const promptId = (0, transport_1.extractResourceId)(this.getNodeParameter('prompt', itemIndex));
35
+ const label = (0, transport_1.extractResourceId)(this.getNodeParameter('resolveLabel', itemIndex));
36
+ const opts = {
37
+ pathParams: { promptId },
38
+ };
39
+ if (label)
40
+ opts.query = { label };
41
+ const result = await (0, transport_1.apiRequest)(this, 'GET', '/v1/prompts/{promptId}/resolve', opts);
42
+ return [{ json: result, pairedItem: itemIndex }];
43
+ }
44
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown prompt operation: ${operation}`, {
45
+ itemIndex,
46
+ });
47
+ }
48
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/operations/prompt.ts"],"names":[],"mappings":";;AAQA,sCAiDC;AAzDD,+CAKsB;AACtB,4CAA6D;AAEtD,KAAK,UAAU,aAAa,CAEjC,SAAiB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EAAE,gCAAgC,EAAE;YAC9E,UAAU,EAAE,EAAE,QAAQ,EAAE;YACxB,IAAI;SACL,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,IAAI,EAAE,MAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAA,6BAAiB,EAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;QAC/E,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;QAClF,MAAM,IAAI,GAA2E;YACnF,UAAU,EAAE,EAAE,QAAQ,EAAE;SACzB,CAAC;QACF,IAAI,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAU,EAAC,IAAI,EAAE,KAAK,EAAE,gCAAgC,EAAE,IAAI,CAAC,CAAC;QACrF,OAAO,CAAC,EAAE,IAAI,EAAE,MAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,6BAA6B,SAAS,EAAE,EAAE;QACrF,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function executeSchema(this: IExecuteFunctions, itemIndex: number, operation: string): Promise<INodeExecutionData[]>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeSchema = executeSchema;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const transport_1 = require("../transport");
6
+ async function executeSchema(itemIndex, operation) {
7
+ if (operation === 'get') {
8
+ const schemaId = (0, transport_1.extractResourceId)(this.getNodeParameter('schema', itemIndex));
9
+ const result = await (0, transport_1.apiRequest)(this, 'GET', '/v1/schemas/{id}', {
10
+ pathParams: { id: schemaId },
11
+ });
12
+ return [{ json: result, pairedItem: itemIndex }];
13
+ }
14
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown schema operation: ${operation}`, {
15
+ itemIndex,
16
+ });
17
+ }
18
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/operations/schema.ts"],"names":[],"mappings":";;AAQA,sCAgBC;AAxBD,+CAKsB;AACtB,4CAA6D;AAEtD,KAAK,UAAU,aAAa,CAEjC,SAAiB,EACjB,SAAiB;IAEjB,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,IAAA,6BAAiB,EAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;QAC/E,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAU,EAAC,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE;YAC/D,UAAU,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE;SAC7B,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,IAAI,EAAE,MAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,6BAA6B,SAAS,EAAE,EAAE;QACrF,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function executeTranscription(this: IExecuteFunctions, itemIndex: number, operation: string): Promise<INodeExecutionData[]>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeTranscription = executeTranscription;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const transport_1 = require("../transport");
6
+ async function executeTranscription(itemIndex, operation) {
7
+ if (operation !== 'transcribe') {
8
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown transcription operation: ${operation}`, { itemIndex });
9
+ }
10
+ const propertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
11
+ const model = this.getNodeParameter('model', itemIndex);
12
+ const language = this.getNodeParameter('language', itemIndex) || '';
13
+ const prompt = this.getNodeParameter('prompt', itemIndex) || '';
14
+ const responseFormat = this.getNodeParameter('responseFormat', itemIndex) || '';
15
+ const temperature = this.getNodeParameter('temperature', itemIndex) || '';
16
+ const item = this.getInputData()[itemIndex];
17
+ const binaryEntry = item.binary?.[propertyName];
18
+ if (!binaryEntry) {
19
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Binary property "${propertyName}" not found on input item`, { itemIndex });
20
+ }
21
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, propertyName);
22
+ const formData = { model };
23
+ if (language)
24
+ formData.language = language;
25
+ if (prompt)
26
+ formData.prompt = prompt;
27
+ if (responseFormat)
28
+ formData.response_format = responseFormat;
29
+ if (temperature)
30
+ formData.temperature = temperature;
31
+ const result = await (0, transport_1.apiRequest)(this, 'POST', '/v1/audio/transcriptions', {
32
+ formData,
33
+ binary: {
34
+ fieldName: 'file',
35
+ buffer,
36
+ filename: binaryEntry.fileName ?? 'audio',
37
+ mimeType: binaryEntry.mimeType ?? 'application/octet-stream',
38
+ },
39
+ });
40
+ return [{ json: result, pairedItem: itemIndex }];
41
+ }
42
+ //# sourceMappingURL=transcription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/operations/transcription.ts"],"names":[],"mappings":";;AAQA,oDAgDC;AAxDD,+CAKsB;AACtB,4CAA0C;AAEnC,KAAK,UAAU,oBAAoB,CAExC,SAAiB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C,QAAQ,GAAG,QAAQ,CAAC;IAC3C,IAAI,MAAM;QAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;IACrC,IAAI,cAAc;QAAE,QAAQ,CAAC,eAAe,GAAG,cAAc,CAAC;IAC9D,IAAI,WAAW;QAAE,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;IAEpD,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAU,EAAC,IAAI,EAAE,MAAM,EAAE,0BAA0B,EAAE;QACxE,QAAQ;QACR,MAAM,EAAE;YACN,SAAS,EAAE,MAAM;YACjB,MAAM;YACN,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,OAAO;YACzC,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,0BAA0B;SAC7D;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,IAAI,EAAE,MAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface PollOptions {
2
+ intervalMs: number;
3
+ timeoutMs: number;
4
+ terminalStatuses: string[];
5
+ }
6
+ export declare function pollUntilTerminal<T extends {
7
+ status?: string;
8
+ }>(fetch: () => Promise<T>, opts: PollOptions): Promise<T>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pollUntilTerminal = pollUntilTerminal;
4
+ async function pollUntilTerminal(fetch, opts) {
5
+ const deadline = Date.now() + opts.timeoutMs;
6
+ while (true) {
7
+ const result = await fetch();
8
+ if (result.status && opts.terminalStatuses.includes(result.status)) {
9
+ return result;
10
+ }
11
+ if (Date.now() >= deadline) {
12
+ throw new Error(`Polling timeout after ${opts.timeoutMs}ms — last status: ${result.status ?? '<unknown>'}`);
13
+ }
14
+ await new Promise((resolve) => setTimeout(resolve, opts.intervalMs));
15
+ }
16
+ }
17
+ //# sourceMappingURL=polling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polling.js","sourceRoot":"","sources":["../../../nodes/TwoKw/polling.ts"],"names":[],"mappings":";;AAMA,8CAkBC;AAlBM,KAAK,UAAU,iBAAiB,CACtC,KAAuB,EACvB,IAAiB;IAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IAE7C,OAAO,IAAI,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACpE,OAAO,MAAM,CAAC;QACf,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACd,yBAAyB,IAAI,CAAC,SAAS,qBAAqB,MAAM,CAAC,MAAM,IAAI,WAAW,EAAE,CAC1F,CAAC;QACH,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { INodeExecutionData } from 'n8n-workflow';
2
+ interface ConvertResponseShape {
3
+ status?: string;
4
+ processingTime?: number;
5
+ timings?: unknown;
6
+ documents?: Record<string, unknown>[];
7
+ errors?: Record<string, unknown>[];
8
+ }
9
+ export declare function splitConvertResponse(response: ConvertResponseShape, itemIndex: number): INodeExecutionData[];
10
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitConvertResponse = splitConvertResponse;
4
+ function splitConvertResponse(response, itemIndex) {
5
+ const meta = {
6
+ status: response.status,
7
+ processingTime: response.processingTime,
8
+ timings: response.timings,
9
+ };
10
+ const docItems = (response.documents ?? []).map((doc) => ({
11
+ json: { ...doc, _response: meta },
12
+ pairedItem: itemIndex,
13
+ }));
14
+ const errorItems = (response.errors ?? []).map((err) => ({
15
+ json: { ...err, _response: { ...meta, error: true } },
16
+ pairedItem: itemIndex,
17
+ }));
18
+ return [...docItems, ...errorItems];
19
+ }
20
+ //# sourceMappingURL=splitConvert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitConvert.js","sourceRoot":"","sources":["../../../nodes/TwoKw/splitConvert.ts"],"names":[],"mappings":";;AAUA,oDAkBC;AAlBD,SAAgB,oBAAoB,CACnC,QAA8B,EAC9B,SAAiB;IAEjB,MAAM,IAAI,GAAG;QACZ,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,OAAO,EAAE,QAAQ,CAAC,OAAO;KACzB,CAAC;IACF,MAAM,QAAQ,GAAyB,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/E,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,IAAI,EAAiB;QAChD,UAAU,EAAE,SAAS;KACrB,CAAC,CAAC,CAAC;IACJ,MAAM,UAAU,GAAyB,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9E,IAAI,EAAE,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAiB;QACpE,UAAU,EAAE,SAAS;KACrB,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ import type { paths } from '../../generated/openapi';
3
+ export type ApiPaths = paths;
4
+ export interface ApiRequestOptions {
5
+ pathParams?: Record<string, string>;
6
+ query?: Record<string, string | string[] | number | boolean | undefined>;
7
+ body?: unknown;
8
+ formData?: Record<string, unknown>;
9
+ binary?: {
10
+ fieldName: string;
11
+ buffer: Buffer;
12
+ filename: string;
13
+ mimeType: string;
14
+ };
15
+ }
16
+ export declare function apiRequest<T = unknown>(ctx: IExecuteFunctions, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, opts?: ApiRequestOptions): Promise<T>;
17
+ export declare function extractResourceId(value: unknown): string;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiRequest = apiRequest;
4
+ exports.extractResourceId = extractResourceId;
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ async function apiRequest(ctx, method, path, opts = {}) {
7
+ const credentials = await ctx.getCredentials('2kwApi');
8
+ const baseUrl = String(credentials.baseUrl).replace(/\/+$/, '');
9
+ let resolvedPath = path;
10
+ if (opts.pathParams) {
11
+ for (const [k, v] of Object.entries(opts.pathParams)) {
12
+ resolvedPath = resolvedPath.replace(`{${k}}`, encodeURIComponent(v));
13
+ }
14
+ }
15
+ const requestOptions = {
16
+ method,
17
+ url: `${baseUrl}${resolvedPath}`,
18
+ qs: opts.query,
19
+ json: true,
20
+ };
21
+ if (opts.body !== undefined) {
22
+ requestOptions.body = opts.body;
23
+ }
24
+ if (opts.formData || opts.binary) {
25
+ requestOptions.json = false;
26
+ const form = { ...(opts.formData ?? {}) };
27
+ if (opts.binary) {
28
+ form[opts.binary.fieldName] = {
29
+ value: opts.binary.buffer,
30
+ options: { filename: opts.binary.filename, contentType: opts.binary.mimeType },
31
+ };
32
+ }
33
+ requestOptions.formData = form;
34
+ }
35
+ try {
36
+ return (await ctx.helpers.httpRequestWithAuthentication.call(ctx, '2kwApi', requestOptions));
37
+ }
38
+ catch (error) {
39
+ throw new n8n_workflow_1.NodeApiError(ctx.getNode(), error);
40
+ }
41
+ }
42
+ function extractResourceId(value) {
43
+ if (typeof value === 'string')
44
+ return value;
45
+ if (value && typeof value === 'object' && 'value' in value) {
46
+ const v = value.value;
47
+ return typeof v === 'string' ? v : '';
48
+ }
49
+ return '';
50
+ }
51
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../nodes/TwoKw/transport.ts"],"names":[],"mappings":";;AAkBA,gCAgDC;AAED,8CAOC;AA3ED,+CAKsB;AAaf,KAAK,UAAU,UAAU,CAC9B,GAAsB,EACtB,MAAmD,EACnD,IAAY,EACZ,OAA0B,EAAE;IAE5B,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEhE,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACrD,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,MAAM,cAAc,GAAwB;QAC1C,MAAM;QACN,GAAG,EAAE,GAAG,OAAO,GAAG,YAAY,EAAE;QAChC,EAAE,EAAE,IAAI,CAAC,KAAK;QACd,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACjC,cAAc,CAAC,IAAI,GAAG,KAAK,CAAC;QAC5B,MAAM,IAAI,GAA4B,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG;gBAC5B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;gBACzB,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;aAC/E,CAAC;QACJ,CAAC;QACA,cAA+D,CAAC,QAAQ,GAAG,IAAI,CAAC;IACnF,CAAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAC1D,GAAG,EACH,QAAQ,EACR,cAAc,CACf,CAAM,CAAC;IACV,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,2BAAY,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAI,KAA6B,CAAC,KAAK,CAAC;QAC/C,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // n8n never imports this file: it discovers the node and credential through the
2
+ // `n8n` block in package.json, which points straight at the compiled dist/ paths.
3
+ //
4
+ // The file exists because `main` has to resolve. Without it, `require('n8n-nodes-2kw')`
5
+ // — which npm itself does when validating a tarball, and which anything treating the
6
+ // package as an ordinary library does — fails with MODULE_NOT_FOUND. This is the same
7
+ // empty entry point the official n8n-nodes-starter ships, for the same reason.
8
+ module.exports = {};
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "n8n-nodes-2kw",
3
+ "version": "5.3.0-dev.22",
4
+ "description": "n8n community node for the 2kw.ai platform (engineering name: Backbone)",
5
+ "license": "MIT",
6
+ "author": "Manfred Kunze Development <mk@manfred-kunze.dev>",
7
+ "homepage": "https://github.com/2kw-ai/n8n-nodes-2kw#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/2kw-ai/n8n-nodes-2kw.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/2kw-ai/n8n-nodes-2kw/issues"
14
+ },
15
+ "engines": {
16
+ "node": ">=20.15"
17
+ },
18
+ "main": "index.js",
19
+ "scripts": {
20
+ "build": "npm run check-types && tsc && gulp build:icons",
21
+ "dev": "tsc --watch",
22
+ "lint": "tsc --noEmit",
23
+ "test": "npm run check-types && vitest run",
24
+ "test:watch": "vitest",
25
+ "sync-types": "tsx scripts/sync-openapi-types.ts",
26
+ "check-types": "tsx scripts/sync-openapi-types.ts --check",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "index.js"
32
+ ],
33
+ "n8n": {
34
+ "n8nNodesApiVersion": 1,
35
+ "credentials": [
36
+ "dist/credentials/TwoKwApi.credentials.js"
37
+ ],
38
+ "nodes": [
39
+ "dist/nodes/TwoKw/TwoKw.node.js"
40
+ ]
41
+ },
42
+ "keywords": [
43
+ "n8n-community-node-package",
44
+ "n8n",
45
+ "2kw",
46
+ "backbone",
47
+ "ai",
48
+ "extraction"
49
+ ],
50
+ "dependencies": {},
51
+ "peerDependencies": {
52
+ "n8n-workflow": "*"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^22.19.17",
56
+ "gulp": "^5.0.1",
57
+ "n8n-workflow": "^1.120.13",
58
+ "tsx": "^4.21.1",
59
+ "typescript": "^5.9.3",
60
+ "vitest": "^2.1.9"
61
+ }
62
+ }