@davixlabs/n8n-nodes-davix-h2i 0.0.0-stage → 2.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.
Files changed (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -2
  3. package/dist/core/config.d.ts +11 -0
  4. package/dist/core/config.js +14 -0
  5. package/dist/core/define.d.ts +10 -0
  6. package/dist/core/define.js +26 -0
  7. package/dist/core/errors.d.ts +7 -0
  8. package/dist/core/errors.js +51 -0
  9. package/dist/core/factory.d.ts +20 -0
  10. package/dist/core/factory.js +149 -0
  11. package/dist/core/fields.d.ts +38 -0
  12. package/dist/core/fields.js +745 -0
  13. package/dist/core/forms/csv.d.ts +2 -0
  14. package/dist/core/forms/csv.js +47 -0
  15. package/dist/core/forms/index.d.ts +3 -0
  16. package/dist/core/forms/index.js +14 -0
  17. package/dist/core/forms/props.d.ts +7 -0
  18. package/dist/core/forms/props.js +330 -0
  19. package/dist/core/forms/read.d.ts +5 -0
  20. package/dist/core/forms/read.js +89 -0
  21. package/dist/core/forms/specs.d.ts +17 -0
  22. package/dist/core/forms/specs.js +48 -0
  23. package/dist/core/help.d.ts +2 -0
  24. package/dist/core/help.js +514 -0
  25. package/dist/core/hidden.d.ts +1 -0
  26. package/dist/core/hidden.js +29 -0
  27. package/dist/core/jobs.d.ts +4 -0
  28. package/dist/core/jobs.js +31 -0
  29. package/dist/core/loaders.d.ts +10 -0
  30. package/dist/core/loaders.js +178 -0
  31. package/dist/core/params.d.ts +4 -0
  32. package/dist/core/params.js +274 -0
  33. package/dist/core/primary.d.ts +2 -0
  34. package/dist/core/primary.js +43 -0
  35. package/dist/core/registry.d.ts +3 -0
  36. package/dist/core/registry.js +7 -0
  37. package/dist/core/results.d.ts +11 -0
  38. package/dist/core/results.js +100 -0
  39. package/dist/core/sdk.d.ts +26 -0
  40. package/dist/core/sdk.js +22 -0
  41. package/dist/core/types.d.ts +38 -0
  42. package/dist/core/types.js +2 -0
  43. package/dist/credentials/DavixH2IApi.credentials.d.ts +10 -0
  44. package/dist/credentials/DavixH2IApi.credentials.js +31 -0
  45. package/dist/credentials/davixH2I.png +0 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +2 -0
  48. package/dist/nodes/DavixH2I.node.d.ts +12 -0
  49. package/dist/nodes/DavixH2I.node.js +43 -0
  50. package/dist/nodes/davixH2I.png +0 -0
  51. package/dist/nodes/resources/ai-content/index.d.ts +1 -0
  52. package/dist/nodes/resources/ai-content/index.js +14 -0
  53. package/dist/nodes/resources/ai-documents/index.d.ts +1 -0
  54. package/dist/nodes/resources/ai-documents/index.js +22 -0
  55. package/dist/nodes/resources/ai-enhancement/index.d.ts +1 -0
  56. package/dist/nodes/resources/ai-enhancement/index.js +12 -0
  57. package/dist/nodes/resources/ai-extraction/index.d.ts +1 -0
  58. package/dist/nodes/resources/ai-extraction/index.js +14 -0
  59. package/dist/nodes/resources/ai-general/index.d.ts +1 -0
  60. package/dist/nodes/resources/ai-general/index.js +9 -0
  61. package/dist/nodes/resources/ai-generation/index.d.ts +1 -0
  62. package/dist/nodes/resources/ai-generation/index.js +16 -0
  63. package/dist/nodes/resources/ai-ocr/index.d.ts +1 -0
  64. package/dist/nodes/resources/ai-ocr/index.js +16 -0
  65. package/dist/nodes/resources/ai-vision/index.d.ts +1 -0
  66. package/dist/nodes/resources/ai-vision/index.js +16 -0
  67. package/dist/nodes/resources/certificates/index.d.ts +1 -0
  68. package/dist/nodes/resources/certificates/index.js +8 -0
  69. package/dist/nodes/resources/data/index.d.ts +1 -0
  70. package/dist/nodes/resources/data/index.js +12 -0
  71. package/dist/nodes/resources/documents/index.d.ts +1 -0
  72. package/dist/nodes/resources/documents/index.js +11 -0
  73. package/dist/nodes/resources/files/index.d.ts +1 -0
  74. package/dist/nodes/resources/files/index.js +48 -0
  75. package/dist/nodes/resources/images/index.d.ts +1 -0
  76. package/dist/nodes/resources/images/index.js +32 -0
  77. package/dist/nodes/resources/jobs/index.d.ts +1 -0
  78. package/dist/nodes/resources/jobs/index.js +53 -0
  79. package/dist/nodes/resources/pdfs/index.d.ts +1 -0
  80. package/dist/nodes/resources/pdfs/index.js +30 -0
  81. package/dist/nodes/resources/presets/index.d.ts +1 -0
  82. package/dist/nodes/resources/presets/index.js +11 -0
  83. package/dist/nodes/resources/render/index.d.ts +1 -0
  84. package/dist/nodes/resources/render/index.js +9 -0
  85. package/dist/nodes/resources/templates/index.d.ts +1 -0
  86. package/dist/nodes/resources/templates/index.js +13 -0
  87. package/dist/nodes/resources/usage/index.d.ts +1 -0
  88. package/dist/nodes/resources/usage/index.js +9 -0
  89. package/dist/vendor/davix-h2i-sdk/README.md +55 -0
  90. package/dist/vendor/davix-h2i-sdk/VERSION +1 -0
  91. package/dist/vendor/davix-h2i-sdk/index.d.ts +9183 -0
  92. package/dist/vendor/davix-h2i-sdk/index.js +20 -0
  93. package/dist/vendor/davix-h2i-sdk/package.json +39 -0
  94. package/dist/vendor/davix-h2i-sdk/src/client.js +447 -0
  95. package/dist/vendor/davix-h2i-sdk/src/errors.js +67 -0
  96. package/dist/vendor/davix-h2i-sdk/src/generated/api.js +218 -0
  97. package/dist/vendor/davix-h2i-sdk/src/generated/contract.json +1 -0
  98. package/dist/vendor/davix-h2i-sdk/src/generated/enums.js +1018 -0
  99. package/dist/vendor/davix-h2i-sdk/src/generated/error-codes.js +96 -0
  100. package/dist/vendor/davix-h2i-sdk/src/multipart.js +109 -0
  101. package/dist/vendor/davix-h2i-sdk/src/paths.js +47 -0
  102. package/dist/vendor/davix-h2i-sdk/src/schema.js +174 -0
  103. package/dist/vendor/studio-specs/field-layout.js +54 -0
  104. package/dist/vendor/studio-specs/field-specs.js +473 -0
  105. package/package.json +68 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Davood Fathi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # Davix H2I for n8n
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ One node, **Davix H2I**, with everything in it: images, AI, PDFs, documents, data, render, and your own templates, presets, files and jobs.
4
+
5
+ ## Install
6
+
7
+ In n8n: **Settings → Community nodes → Install** and enter `@davixlabs/n8n-nodes-davix-h2i`.
8
+
9
+ ## Connect
10
+
11
+ Create a **Davix H2I API** credential and paste your API key from the Dashboard. The **Test** button checks it.
12
+
13
+ ## How it works
14
+
15
+ 1. Pick a **Resource**. (For **AI** pick the kind of AI work next.) Then pick the **Operation**.
16
+ 2. The **input file** comes first: the name of the binary field that holds it (usually `data`). Instead of a file you can give a **Source URL** under Options.
17
+ 3. **Settings**: fill them in on the screen, or start from one of your **saved presets**. Anything you set on the screen replaces that value of the preset.
18
+ 4. For **Render**, choose **Write HTML Here** or **Use a Saved Template**. A template shows the variables it needs as fields to fill in.
19
+ 5. The main settings of each action are on the screen. Everything less common is under **Options → Add Option**. Hover the **?** next to any field to see what it does.
20
+ 6. Results come back as JSON, and every file the action made is attached as binary data (`data`, `data_1`, ...).
21
+
22
+ Give a call an **App Name** (Options) to see in your History which workflow made it. Left empty, the name of the workflow is used.
23
+
24
+ Long actions can run as a **background job**: turn on *Run as Background Job* and keep *Wait for Completion* on, or fetch the job later with **Job → Wait for Completion**.
25
+
26
+ See [docs/](docs/README.md) for the structure, development and testing.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The one place that decides where the nodes talk to. The address is fixed on purpose, so a workflow can never be pointed at
3
+ * another server by a credential or a parameter. It is the live Davix H2I app.
4
+ */
5
+ export declare const SERVER_URL = "https://app.h2i.davixlabs.io";
6
+ /** Shown in the customer's History when a workflow does not name its own app. */
7
+ export declare const DEFAULT_APP_NAME = "Davix H2I n8n node";
8
+ export declare const NODE_PACKAGE_VERSION = "2.1.0";
9
+ export declare const CREDENTIAL_NAME = "davixH2IApi";
10
+ /** How long a "wait for the background job" call may take at most, in seconds. */
11
+ export declare const DEFAULT_MAX_WAIT_SECONDS = 300;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_MAX_WAIT_SECONDS = exports.CREDENTIAL_NAME = exports.NODE_PACKAGE_VERSION = exports.DEFAULT_APP_NAME = exports.SERVER_URL = void 0;
4
+ /**
5
+ * The one place that decides where the nodes talk to. The address is fixed on purpose, so a workflow can never be pointed at
6
+ * another server by a credential or a parameter. It is the live Davix H2I app.
7
+ */
8
+ exports.SERVER_URL = 'https://app.h2i.davixlabs.io';
9
+ /** Shown in the customer's History when a workflow does not name its own app. */
10
+ exports.DEFAULT_APP_NAME = 'Davix H2I n8n node';
11
+ exports.NODE_PACKAGE_VERSION = '2.1.0';
12
+ exports.CREDENTIAL_NAME = 'davixH2IApi';
13
+ /** How long a "wait for the background job" call may take at most, in seconds. */
14
+ exports.DEFAULT_MAX_WAIT_SECONDS = 300;
@@ -0,0 +1,10 @@
1
+ import type { OperationDef, ResourceDef } from './types';
2
+ /**
3
+ * Describing a resource is one line per API endpoint. The name, the help text and every parameter come from the SDK contract.
4
+ *
5
+ * resource('images', 'Image', 'Optimize, convert...', 'images.', ['images.optimize', 'images.resize'])
6
+ *
7
+ * Add `{ list: true }` for a list endpoint, and an override object for anything that needs a nicer name.
8
+ */
9
+ export type Entry = string | [endpoint: string, overrides: Partial<OperationDef>];
10
+ export declare function resource(value: string, name: string, description: string, prefix: string, entries: Array<Entry | OperationDef>): ResourceDef;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resource = resource;
4
+ const fields_1 = require("./fields");
5
+ function operation(prefix, entry) {
6
+ const [endpoint, overrides] = typeof entry === 'string' ? [entry, {}] : entry;
7
+ const contract = (0, fields_1.endpointById)(endpoint);
8
+ const rest = endpoint.startsWith(prefix) ? endpoint.slice(prefix.length) : endpoint;
9
+ const value = overrides.value ?? (rest.replace(/[.{}]+/g, '-').replace(/^-+|-+$/g, '') || 'run');
10
+ const description = overrides.description ?? String(contract.name || (0, fields_1.humanize)(rest)).replace(/\s*\([^)]*(NEW|Phase|phase)[^)]*\)\s*/g, ' ').replace(/\s+/g, ' ').trim();
11
+ return {
12
+ value,
13
+ name: overrides.name ?? (0, fields_1.humanize)(rest.replace(/^.*\./, '')),
14
+ description,
15
+ endpoint,
16
+ ...overrides,
17
+ };
18
+ }
19
+ function resource(value, name, description, prefix, entries) {
20
+ return {
21
+ value,
22
+ name,
23
+ description,
24
+ operations: entries.map((e) => (typeof e === 'object' && !Array.isArray(e) ? e : operation(prefix, e))),
25
+ };
26
+ }
@@ -0,0 +1,7 @@
1
+ import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
2
+ import { NodeOperationError } from 'n8n-workflow';
3
+ /** Never let anything that looks like a key reach an error message or an output. */
4
+ export declare function redact(text: string): string;
5
+ export declare function toNodeError(ctx: IExecuteFunctions, err: unknown, itemIndex: number): NodeOperationError;
6
+ /** The item a workflow gets when "Continue on Fail" is on. */
7
+ export declare function errorItemJson(err: unknown): IDataObject;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.redact = redact;
4
+ exports.toNodeError = toNodeError;
5
+ exports.errorItemJson = errorItemJson;
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ /** Never let anything that looks like a key reach an error message or an output. */
8
+ function redact(text) {
9
+ return String(text).replace(/h2i_[A-Za-z0-9_\-]{8,}/g, 'h2i_****').replace(/Bearer\s+[A-Za-z0-9._\-]+/gi, 'Bearer ****');
10
+ }
11
+ /** An SDK error (or any other error) turned into a short message and a helpful second line. */
12
+ function describeError(err) {
13
+ const e = err;
14
+ const message = redact(e && e.message ? String(e.message) : 'Something went wrong.');
15
+ const parts = [];
16
+ if (e && e.hint)
17
+ parts.push(redact(String(e.hint)));
18
+ if (e && e.code === 'monthly_quota_exceeded')
19
+ parts.push('Your plan\'s allowance for this period is used up.');
20
+ if (e && e.renewalUrl)
21
+ parts.push(`Renew or upgrade: ${redact(String(e.renewalUrl))}`);
22
+ if (e && e.requestId)
23
+ parts.push(`Request ID: ${e.requestId}`);
24
+ return {
25
+ message,
26
+ description: parts.join(' · '),
27
+ code: e && e.code ? String(e.code) : undefined,
28
+ status: e && typeof e.status === 'number' ? e.status : undefined,
29
+ requestId: e && e.requestId ? String(e.requestId) : undefined,
30
+ };
31
+ }
32
+ function toNodeError(ctx, err, itemIndex) {
33
+ if (err instanceof n8n_workflow_1.NodeOperationError)
34
+ return err;
35
+ const info = describeError(err);
36
+ return new n8n_workflow_1.NodeOperationError(ctx.getNode(), info.message, { itemIndex, description: info.description || undefined });
37
+ }
38
+ /** The item a workflow gets when "Continue on Fail" is on. */
39
+ function errorItemJson(err) {
40
+ const info = describeError(err);
41
+ const out = { error: info.message };
42
+ if (info.code)
43
+ out.code = info.code;
44
+ if (info.status)
45
+ out.status = info.status;
46
+ if (info.requestId)
47
+ out.requestId = info.requestId;
48
+ if (info.description)
49
+ out.hint = info.description;
50
+ return out;
51
+ }
@@ -0,0 +1,20 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeTypeDescription } from 'n8n-workflow';
2
+ import type { ResourceDef } from './types';
3
+ interface NodeMeta {
4
+ displayName: string;
5
+ name: string;
6
+ description: string;
7
+ }
8
+ /** Everything a node class needs, built from its meta and its resources. */
9
+ export declare function defineNode(meta: NodeMeta, resources: ResourceDef[]): {
10
+ description: INodeTypeDescription;
11
+ methods: {
12
+ loadOptions: Record<string, (this: import("n8n-workflow").ILoadOptionsFunctions) => Promise<import("n8n-workflow").INodePropertyOptions[]>>;
13
+ resourceMapping: {
14
+ getPresetSettings(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").ResourceMapperFields>;
15
+ getTemplateVariables(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").ResourceMapperFields>;
16
+ };
17
+ };
18
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
19
+ };
20
+ export {};
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineNode = defineNode;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const config_1 = require("./config");
6
+ const errors_1 = require("./errors");
7
+ const fields_1 = require("./fields");
8
+ const loaders_1 = require("./loaders");
9
+ const registry_1 = require("./registry");
10
+ const params_1 = require("./params");
11
+ const results_1 = require("./results");
12
+ const sdk_1 = require("./sdk");
13
+ /** Where an operation's screens are shown: under its resource, or under its group (for example AI → Content Writing). */
14
+ function scopeOf(r) {
15
+ return r.parent ? { resource: [r.parent.value], [`${r.parent.value}Category`]: [r.value] } : { resource: [r.value] };
16
+ }
17
+ /** The screens of the node: Resource, then (for a group) its type, then Operation, then the fields of the operation. */
18
+ function buildDescription(meta, resources) {
19
+ const tops = [];
20
+ for (const r of resources) {
21
+ const top = r.parent ?? r;
22
+ if (!tops.some((t) => t.value === top.value))
23
+ tops.push({ value: top.value, name: top.name, description: top.description });
24
+ }
25
+ const properties = [
26
+ {
27
+ displayName: 'Resource',
28
+ name: 'resource',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ default: tops[0].value,
32
+ description: 'The kind of thing you want to work with. Pick one, then choose what to do with it.',
33
+ options: tops.map((t) => ({ name: t.name, value: t.value, description: t.description })),
34
+ },
35
+ ];
36
+ // A group (AI) asks one more question before the operation: which kind of AI work.
37
+ for (const top of tops) {
38
+ const children = resources.filter((r) => r.parent && r.parent.value === top.value);
39
+ if (!children.length)
40
+ continue;
41
+ properties.push({
42
+ displayName: 'Type',
43
+ name: `${top.value}Category`,
44
+ type: 'options',
45
+ noDataExpression: true,
46
+ default: children[0].value,
47
+ description: `What kind of ${top.name} work to do. Then choose the operation.`,
48
+ displayOptions: { show: { resource: [top.value] } },
49
+ options: children.map((c) => ({ name: c.name, value: c.value, description: c.description })),
50
+ });
51
+ }
52
+ for (const resource of resources) {
53
+ const ops = [...resource.operations].sort((a, b) => a.name.localeCompare(b.name));
54
+ const scope = scopeOf(resource);
55
+ properties.push({
56
+ displayName: 'Operation',
57
+ name: 'operation',
58
+ type: 'options',
59
+ noDataExpression: true,
60
+ default: ops[0].value,
61
+ description: `What to do. ${resource.description}`,
62
+ displayOptions: { show: scope },
63
+ options: ops.map((o) => ({ name: o.name, value: o.value, description: o.description, action: `${o.name}` })),
64
+ });
65
+ for (const op of resource.operations) {
66
+ properties.push(...(0, fields_1.buildOperationProperties)(scope, op));
67
+ }
68
+ }
69
+ return {
70
+ displayName: meta.displayName,
71
+ name: meta.name,
72
+ icon: 'file:davixH2I.png',
73
+ group: ['transform'],
74
+ version: 1,
75
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
76
+ description: meta.description,
77
+ defaults: { name: meta.displayName },
78
+ usableAsTool: true,
79
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
80
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
81
+ credentials: [{ name: config_1.CREDENTIAL_NAME, required: true }],
82
+ properties,
83
+ };
84
+ }
85
+ function findOperation(resources, resource, category, operation) {
86
+ return (0, registry_1.openResource)(resources, resource, category)?.operations.find((o) => o.value === operation);
87
+ }
88
+ /** "Return All": goes through every page of a list and returns one answer with all the entries. */
89
+ async function allPages(client, endpoint, params) {
90
+ const field = (0, fields_1.endpointById)(endpoint).request.fields.find((f) => f.name === 'limit');
91
+ const limit = field && field.maximum ? field.maximum : 100;
92
+ const collected = [];
93
+ let last;
94
+ for (let page = 1; page <= 1000; page++) {
95
+ last = await client.call(endpoint, { ...params, page, limit });
96
+ const results = last.data && Array.isArray(last.data.results) ? last.data.results : [];
97
+ collected.push(...results);
98
+ if (!last.data || !last.data.has_more || !results.length)
99
+ break;
100
+ }
101
+ return { ...last, data: { ...((last && last.data) || {}), results: collected, has_more: false } };
102
+ }
103
+ async function execute(ctx, resources) {
104
+ const input = ctx.getInputData();
105
+ const out = [];
106
+ const client = await (0, sdk_1.getClient)(ctx);
107
+ for (let i = 0; i < input.length; i++) {
108
+ try {
109
+ const resource = ctx.getNodeParameter('resource', i);
110
+ const hasGroup = resources.some((r) => r.parent && r.parent.value === resource);
111
+ const category = hasGroup ? ctx.getNodeParameter(`${resource}Category`, i) : undefined;
112
+ const operation = ctx.getNodeParameter('operation', i);
113
+ const op = findOperation(resources, resource, category, operation);
114
+ if (!op)
115
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unknown action "${resource} / ${category ?? ''} / ${operation}".`, { itemIndex: i });
116
+ if (op.run) {
117
+ out.push(...(await op.run({ ctx, itemIndex: i, client })));
118
+ continue;
119
+ }
120
+ const endpoint = op.endpoint;
121
+ const options = ctx.getNodeParameter('options', i, {}) ?? {};
122
+ const params = await (0, params_1.collectParams)(ctx, i, op);
123
+ let res;
124
+ if (op.paged && ctx.getNodeParameter('returnAll', i, false))
125
+ res = await allPages(client, endpoint, params);
126
+ else
127
+ res = await client.call(endpoint, params);
128
+ out.push(...(await (0, results_1.buildItems)(ctx, client, i, endpoint, res, options, Boolean(op.list))));
129
+ }
130
+ catch (err) {
131
+ if (ctx.continueOnFail()) {
132
+ out.push({ json: (0, errors_1.errorItemJson)(err), pairedItem: { item: i } });
133
+ continue;
134
+ }
135
+ throw (0, errors_1.toNodeError)(ctx, err, i);
136
+ }
137
+ }
138
+ return [out];
139
+ }
140
+ /** Everything a node class needs, built from its meta and its resources. */
141
+ function defineNode(meta, resources) {
142
+ return {
143
+ description: buildDescription(meta, resources),
144
+ methods: { loadOptions: (0, loaders_1.createLoaders)(resources), resourceMapping: (0, loaders_1.createMappers)() },
145
+ async execute() {
146
+ return execute(this, resources);
147
+ },
148
+ };
149
+ }
@@ -0,0 +1,38 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import type { OperationDef } from './types';
3
+ export declare function humanize(raw: string): string;
4
+ export declare function uiName(apiName: string): string;
5
+ /** The "app" parameter of a processing call is a label for the History; on a list it is a filter and stays a normal parameter. */
6
+ export declare function isAppLabel(f: any): boolean;
7
+ export declare function endpointById(id: string): any;
8
+ export declare function endpointFlags(endpointId: string): {
9
+ jobEligible: boolean;
10
+ files: boolean;
11
+ };
12
+ /** The value a main-screen optional field has when the user left it alone: it is then not sent at all. */
13
+ export declare function neutralValue(f: any): unknown;
14
+ export declare function virtualFields(endpointId: string): any[];
15
+ /**
16
+ * A parameter with a form gets a way to write it as code instead: a switch "Edit as Code" and a JSON box that replaces the fields while the
17
+ * switch is on. (n8n cannot move a value between the two on its own, so the JSON box starts empty; whichever is in use when the action runs is sent.)
18
+ */
19
+ export declare function codeSwitch(f: any, show: Record<string, unknown[]> | undefined): {
20
+ toggle: INodeProperties;
21
+ json: INodeProperties;
22
+ formDisplay: Record<string, unknown>;
23
+ };
24
+ /** Actions that can start from a saved HTML template (render): the HTML is written here OR taken from a template. */
25
+ export declare function supportsTemplate(endpointId: string): boolean;
26
+ /** Actions that merge data into a saved document template (mail merge): the template is chosen, its variables are filled in. */
27
+ export declare function supportsDocumentTemplate(endpointId: string): boolean;
28
+ export declare function supportsPreset(endpointId: string): boolean;
29
+ /** Fields that the special pickers replace. */
30
+ export declare function replacedFields(endpointId: string): Set<string>;
31
+ /**
32
+ * All screens of one operation. `scope` says where the operation lives: { resource: ['images'] }, or for the AI groups
33
+ * { resource: ['ai'], aiCategory: ['content'] }.
34
+ *
35
+ * Above the section header: Settings (and Content, for render), then the input file. Below it: either the saved preset (with its
36
+ * settings listed) or the fields to fill in by hand, then Options.
37
+ */
38
+ export declare function buildOperationProperties(scope: Record<string, string[]>, op: OperationDef): INodeProperties[];