n8n-nodes-netsapiens 0.2.4 → 0.2.5

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.
@@ -1774,14 +1774,14 @@ function getOperationOptionsForResource(resource) {
1774
1774
  const actionText = (_d = o.summary) !== null && _d !== void 0 ? _d : label;
1775
1775
  const specDescription = ((_e = o.description) === null || _e === void 0 ? void 0 : _e.trim()) || undefined;
1776
1776
  const descriptionText = minVersion
1777
- ? `Requires NetSapiens API v${minVersion}+`
1777
+ ? `May require NetSapiens API v${minVersion}+`
1778
1778
  : specDescription
1779
1779
  ? specDescription.replace(/\n/g, ' ').slice(0, 200)
1780
1780
  : undefined;
1781
1781
  return {
1782
- name: minVersion ? `${label} (v${minVersion}+)` : label,
1782
+ name: label,
1783
1783
  value: o.id,
1784
- action: minVersion ? `${actionText} (v${minVersion}+)` : actionText,
1784
+ action: actionText,
1785
1785
  ...(descriptionText && { description: descriptionText }),
1786
1786
  };
1787
1787
  });
@@ -2905,14 +2905,18 @@ class NetSapiens {
2905
2905
  noDataExpression: true,
2906
2906
  },
2907
2907
  {
2908
- displayName: 'This operation requires NetSapiens API v45+. It will not work on older server versions.',
2908
+ displayName: 'This operation may require NetSapiens API v45+. It may not work on older server versions. Test to confirm.',
2909
2909
  name: 'v45Notice',
2910
2910
  type: 'notice',
2911
2911
  default: '',
2912
2912
  displayOptions: {
2913
2913
  show: {
2914
2914
  operation: openapi_1.operations
2915
- .filter((o) => { var _a, _b; return ((_b = (_a = operations_overrides_1.operationOverrides[o.id]) === null || _a === void 0 ? void 0 : _a.minApiVersion) !== null && _b !== void 0 ? _b : o.minApiVersion) !== undefined; })
2915
+ .filter((o) => {
2916
+ var _a, _b;
2917
+ const v = (_b = (_a = operations_overrides_1.operationOverrides[o.id]) === null || _a === void 0 ? void 0 : _a.minApiVersion) !== null && _b !== void 0 ? _b : o.minApiVersion;
2918
+ return v !== undefined && v > 0;
2919
+ })
2916
2920
  .map((o) => o.id),
2917
2921
  },
2918
2922
  },
@@ -4020,7 +4024,7 @@ class NetSapiens {
4020
4024
  };
4021
4025
  }
4022
4026
  async execute() {
4023
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4027
+ var _a, _b, _c, _d;
4024
4028
  const items = this.getInputData();
4025
4029
  const returnData = [];
4026
4030
  const auth = await resolveAuth(this);
@@ -4208,24 +4212,8 @@ class NetSapiens {
4208
4212
  if (!operation) {
4209
4213
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operationId}`, { itemIndex });
4210
4214
  }
4211
- const operationMinVersion = (_c = (_b = operations_overrides_1.operationOverrides[operation.id]) === null || _b === void 0 ? void 0 : _b.minApiVersion) !== null && _c !== void 0 ? _c : operation.minApiVersion;
4212
- if (operationMinVersion) {
4213
- const shouldRefresh = Boolean(this.getNodeParameter('refreshOptions', itemIndex, false));
4214
- const apiVersion = await getServerApiVersion(this, auth, baseUrl, {
4215
- refresh: shouldRefresh,
4216
- });
4217
- if (typeof apiVersion.major === 'number' &&
4218
- apiVersion.major < operationMinVersion) {
4219
- const raw = apiVersion.raw ? ` (detected: ${apiVersion.raw})` : '';
4220
- const opLabel = (_f = (_e = (_d = operations_overrides_1.operationOverrides[operation.id]) === null || _d === void 0 ? void 0 : _d.displayName) !== null && _e !== void 0 ? _e : operation.summary) !== null && _f !== void 0 ? _f : operation.id;
4221
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${opLabel} requires NetSapiens API v${operationMinVersion}+${raw}`, {
4222
- itemIndex,
4223
- description: `This endpoint is not available on your server. Upgrade to NetSapiens API version ${operationMinVersion}+ or use a different operation.`,
4224
- });
4225
- }
4226
- }
4227
4215
  const override = operations_overrides_1.operationOverrides[operation.id];
4228
- const effectiveResource = (_g = override === null || override === void 0 ? void 0 : override.resource) !== null && _g !== void 0 ? _g : operation.resource;
4216
+ const effectiveResource = (_b = override === null || override === void 0 ? void 0 : override.resource) !== null && _b !== void 0 ? _b : operation.resource;
4229
4217
  if (effectiveResource !== resource) {
4230
4218
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Selected operation does not belong to selected resource', {
4231
4219
  itemIndex,
@@ -4767,7 +4755,7 @@ class NetSapiens {
4767
4755
  continue;
4768
4756
  }
4769
4757
  const isNoRouteFound = /no\s+route\s+found\s*\[92\]/i.test(errorText) || /no\s+route\s+found/i.test(errorText);
4770
- if (isNoRouteFound) {
4758
+ if (isNoRouteFound || statusCode === 404) {
4771
4759
  const shouldRefresh = Boolean(this.getNodeParameter('refreshOptions', itemIndex, false));
4772
4760
  const apiVersion = await getServerApiVersion(this, auth, baseUrl, { refresh: shouldRefresh });
4773
4761
  const versionText = apiVersion.raw
@@ -4776,13 +4764,16 @@ class NetSapiens {
4776
4764
  const operationDetails = openapi_1.operationMap[operationId];
4777
4765
  const method = operationDetails ? operationDetails.method : operationId;
4778
4766
  const opPath = operationDetails ? operationDetails.path : '';
4779
- const minVersion = (_j = (_h = operations_overrides_1.operationOverrides[operationId]) === null || _h === void 0 ? void 0 : _h.minApiVersion) !== null && _j !== void 0 ? _j : operationDetails === null || operationDetails === void 0 ? void 0 : operationDetails.minApiVersion;
4767
+ const minVersion = (_d = (_c = operations_overrides_1.operationOverrides[operationId]) === null || _c === void 0 ? void 0 : _c.minApiVersion) !== null && _d !== void 0 ? _d : operationDetails === null || operationDetails === void 0 ? void 0 : operationDetails.minApiVersion;
4780
4768
  const minVersionNote = minVersion
4781
- ? ` This endpoint requires API version ${minVersion}+.`
4769
+ ? ` This endpoint may require API version ${minVersion}+.`
4782
4770
  : '';
4771
+ const serverResponse = isNoRouteFound
4772
+ ? `The server returned "No Route Found [92]" for ${method} ${opPath}.`
4773
+ : `The server returned a 404 for ${method} ${opPath}.`;
4783
4774
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'This NetSapiens server does not support the requested endpoint.', {
4784
4775
  itemIndex,
4785
- description: `The server returned "No Route Found [92]" for ${method} ${opPath}.${versionText}${minVersionNote}`,
4776
+ description: `${serverResponse}${versionText}${minVersionNote}`,
4786
4777
  });
4787
4778
  }
4788
4779
  if (error instanceof n8n_workflow_1.NodeOperationError) {