n8n-nodes-fetchsandbox 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -34,7 +34,7 @@ can access. From the n8n user's data directory, install the package in the
34
34
  ```sh
35
35
  mkdir -p ~/.n8n/nodes
36
36
  cd ~/.n8n/nodes
37
- npm install /absolute/path/to/n8n-nodes-fetchsandbox-0.1.1.tgz
37
+ npm install /absolute/path/to/n8n-nodes-fetchsandbox-0.1.2.tgz
38
38
  ```
39
39
 
40
40
  Restart n8n. Add a **Manual Trigger**, search for **FetchSandbox**, and select
@@ -98,15 +98,16 @@ class FetchSandbox {
98
98
  };
99
99
  async execute() {
100
100
  const operation = this.getNodeParameter('operation', 0);
101
+ const node = this.getNode();
101
102
  try {
102
103
  const items = this.getInputData();
103
104
  const signal = this.getExecutionCancelSignal();
104
105
  if (operation === 'runLeadIntake') {
105
- const result = await (0, rehearsal_1.runLeadIntakeRehearsal)((options) => this.helpers.httpRequest(options), signal);
106
+ const result = await (0, rehearsal_1.runLeadIntakeRehearsal)(node, (options) => this.helpers.httpRequest(options), signal);
106
107
  return [[{ json: result, pairedItem: items.map((_, item) => ({ item })) }]];
107
108
  }
108
109
  if (items.length !== 1)
109
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Pass one configured workflow, contract, or job to this operation');
110
+ throw new n8n_workflow_1.NodeOperationError(node, 'Pass one configured workflow, contract, or job to this operation');
110
111
  const invariant = operation === 'planWorkflowReplay'
111
112
  ? this.getNodeParameter('invariant', 0) : '';
112
113
  const reviewedVersion = operation === 'configureReplay' ? this.getNodeParameter('reviewedVersion', 0) : '';
@@ -119,11 +120,11 @@ class FetchSandbox {
119
120
  ? selection.value : selection;
120
121
  input = { ...(operation === 'connectWorkflow' ? input : {}), workflow_id: workflowId };
121
122
  }
122
- const result = await (0, replay_1.runReplayOperation)(operation, input, invariant, reviewedVersion, (options) => this.helpers.httpRequestWithAuthentication.call(this, 'fetchSandboxApi', options), signal);
123
+ const result = await (0, replay_1.runReplayOperation)(node, operation, input, invariant, reviewedVersion, (options) => this.helpers.httpRequestWithAuthentication.call(this, 'fetchSandboxApi', options), signal);
123
124
  return [[{ json: result, pairedItem: { item: 0 } }]];
124
125
  }
125
126
  catch (error) {
126
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof rehearsal_1.RehearsalError
127
+ throw new n8n_workflow_1.NodeOperationError(node, error instanceof rehearsal_1.RehearsalError || error instanceof n8n_workflow_1.NodeOperationError
127
128
  ? error.message
128
129
  : 'The FetchSandbox rehearsal could not finish');
129
130
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RehearsalError = void 0;
4
4
  exports.runLeadIntakeRehearsal = runLeadIntakeRehearsal;
5
+ const n8n_workflow_1 = require("n8n-workflow");
5
6
  const leadIntakeMachine_1 = require("./leadIntakeMachine");
6
7
  const origin = 'https://fetchsandbox.com';
7
8
  const endpoint = origin + '/api/demo/n8n/lead-intake';
@@ -50,7 +51,7 @@ function readReceipt(response) {
50
51
  checks,
51
52
  };
52
53
  }
53
- async function runLeadIntakeRehearsal(send, cancelSignal) {
54
+ async function runLeadIntakeRehearsal(node, send, cancelSignal) {
54
55
  const deadline = Date.now() + 145_000;
55
56
  async function post(url, body, capability) {
56
57
  if (cancelSignal?.aborted)
@@ -79,12 +80,10 @@ async function runLeadIntakeRehearsal(send, cancelSignal) {
79
80
  });
80
81
  }
81
82
  catch {
82
- // The node converts these safe transport errors into NodeOperationError.
83
- // eslint-disable-next-line @n8n/community-nodes/require-node-api-error
84
- if (cancelSignal?.aborted)
85
- throw new RehearsalError('The FetchSandbox rehearsal was cancelled');
86
- // eslint-disable-next-line @n8n/community-nodes/require-node-api-error
87
- throw new RehearsalError('Could not reach FetchSandbox. Check the connection and run it again');
83
+ if (cancelSignal?.aborted) {
84
+ throw new n8n_workflow_1.NodeOperationError(node, 'The FetchSandbox rehearsal was cancelled');
85
+ }
86
+ throw new n8n_workflow_1.NodeOperationError(node, 'Could not reach FetchSandbox. Check the connection and run it again');
88
87
  }
89
88
  const { statusCode, body: result } = object(raw);
90
89
  if (statusCode === 429) {
@@ -124,8 +123,7 @@ async function runLeadIntakeRehearsal(send, cancelSignal) {
124
123
  }
125
124
  catch {
126
125
  // Report only the protocol error, since the payload can contain internal state.
127
- // eslint-disable-next-line @n8n/community-nodes/require-node-api-error
128
- throw new RehearsalError(invalidResponse);
126
+ throw new n8n_workflow_1.NodeOperationError(node, invalidResponse);
129
127
  }
130
128
  payload = { turn, output };
131
129
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runReplayOperation = runReplayOperation;
4
+ const n8n_workflow_1 = require("n8n-workflow");
4
5
  const rehearsal_1 = require("./rehearsal");
5
6
  const endpoint = 'https://fetchsandbox.com/api/mcp/';
6
7
  function record(value) {
@@ -37,7 +38,7 @@ function connectionBinding(input, workflowId) {
37
38
  }
38
39
  return { ...binding, trigger_path: discovered };
39
40
  }
40
- async function runReplayOperation(operation, input, invariant, reviewedVersion, send, signal) {
41
+ async function runReplayOperation(node, operation, input, invariant, reviewedVersion, send, signal) {
41
42
  const call = async (method, path, body) => {
42
43
  if (signal?.aborted)
43
44
  throw new rehearsal_1.RehearsalError('The FetchSandbox operation was cancelled');
@@ -48,8 +49,7 @@ async function runReplayOperation(operation, input, invariant, reviewedVersion,
48
49
  return response;
49
50
  }
50
51
  catch {
51
- // eslint-disable-next-line @n8n/community-nodes/require-node-api-error
52
- throw new rehearsal_1.RehearsalError(method === 'GET'
52
+ throw new n8n_workflow_1.NodeOperationError(node, method === 'GET'
53
53
  ? 'Could not read this FetchSandbox job. Check the connection and read the same job again.'
54
54
  : 'Could not confirm the FetchSandbox operation. Check the existing session before submitting again.');
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-fetchsandbox",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Run FetchSandbox workflow rehearsals from n8n",
5
5
  "license": "MIT",
6
6
  "homepage": "https://fetchsandbox.com",