n8n-nodes-didar-crm 0.0.15 → 0.0.16

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.
@@ -122,8 +122,8 @@ class DidarCrm {
122
122
  displayOptions: { show: { resource: ['company'] } },
123
123
  options: [
124
124
  { name: 'Create', value: 'create', action: 'Create a company' },
125
- { name: 'Update', value: 'update', action: 'Update a company by Id' }, // NEW
126
- { name: 'Get', value: 'get', action: 'Get a company by Id' }, // NEW
125
+ { name: 'Update', value: 'update', action: 'Update a company by Id' },
126
+ { name: 'Get', value: 'get', action: 'Get a company by Id' },
127
127
  ],
128
128
  default: 'create',
129
129
  description: 'Select the action to perform on the selected resource.',
@@ -135,7 +135,7 @@ class DidarCrm {
135
135
  displayOptions: { show: { resource: ['activity'] } },
136
136
  options: [
137
137
  { name: 'Create', value: 'create', action: 'Create an activity' },
138
- { name: 'Update', value: 'update', action: 'Update an activity by Id' }, // NEW
138
+ { name: 'Update', value: 'update', action: 'Update an activity by Id' },
139
139
  ],
140
140
  default: 'create',
141
141
  description: 'Select the action to perform on the selected resource.',
@@ -172,6 +172,7 @@ class DidarCrm {
172
172
  options: [
173
173
  { name: 'Create', value: 'create', action: 'Create a product' },
174
174
  { name: 'Update', value: 'update', action: 'Update a product by ID' },
175
+ { name: 'Get by Codes', value: 'getByCodes', action: 'Get products by list of codes' },
175
176
  ],
176
177
  default: 'create',
177
178
  description: 'Select the action to perform on the selected resource.',
@@ -200,6 +201,7 @@ class DidarCrm {
200
201
  // Product properties (imported)
201
202
  ...product_1.productCreateProperties,
202
203
  ...product_1.productUpdateProperties,
204
+ ...product_1.productGetByCodesProperties,
203
205
  ],
204
206
  };
205
207
  }
@@ -245,11 +247,11 @@ class DidarCrm {
245
247
  if (operation === 'update') {
246
248
  await CompanyOps.companyUpdate.call(this, i, returnData);
247
249
  continue;
248
- } // NEW
250
+ }
249
251
  if (operation === 'get') {
250
252
  await CompanyOps.companyGet.call(this, i, returnData);
251
253
  continue;
252
- } // NEW
254
+ }
253
255
  }
254
256
  if (resource === 'activity') {
255
257
  if (operation === 'create') {
@@ -259,7 +261,7 @@ class DidarCrm {
259
261
  if (operation === 'update') {
260
262
  await ActivityOps.activityUpdate.call(this, i, returnData);
261
263
  continue;
262
- } // NEW
264
+ }
263
265
  }
264
266
  if (resource === 'note') {
265
267
  if (operation === 'create') {
@@ -289,7 +291,11 @@ class DidarCrm {
289
291
  if (operation === 'update') {
290
292
  await ProductOps.productUpdate.call(this, i, returnData);
291
293
  continue;
292
- } // NEW
294
+ }
295
+ if (operation === 'getByCodes') {
296
+ await ProductOps.productGetByCodes.call(this, i, returnData);
297
+ continue;
298
+ }
293
299
  }
294
300
  }
295
301
  return [returnData];
@@ -5,7 +5,7 @@ var create_operation_1 = require("./create.operation");
5
5
  Object.defineProperty(exports, "activityCreate", { enumerable: true, get: function () { return create_operation_1.activityCreate; } });
6
6
  var create_properties_1 = require("./create.properties");
7
7
  Object.defineProperty(exports, "activityCreateProperties", { enumerable: true, get: function () { return create_properties_1.activityCreateProperties; } });
8
- var update_operation_1 = require("./update.operation"); // NEW
8
+ var update_operation_1 = require("./update.operation");
9
9
  Object.defineProperty(exports, "activityUpdate", { enumerable: true, get: function () { return update_operation_1.activityUpdate; } });
10
- var update_properties_1 = require("./update.properties"); // NEW
10
+ var update_properties_1 = require("./update.properties");
11
11
  Object.defineProperty(exports, "activityUpdateProperties", { enumerable: true, get: function () { return update_properties_1.activityUpdateProperties; } });
@@ -9,7 +9,7 @@ var update_operation_1 = require("./update.operation");
9
9
  Object.defineProperty(exports, "companyUpdate", { enumerable: true, get: function () { return update_operation_1.companyUpdate; } });
10
10
  var update_properties_1 = require("./update.properties");
11
11
  Object.defineProperty(exports, "companyUpdateProperties", { enumerable: true, get: function () { return update_properties_1.companyUpdateProperties; } });
12
- var get_operation_1 = require("./get.operation"); // NEW
12
+ var get_operation_1 = require("./get.operation");
13
13
  Object.defineProperty(exports, "companyGet", { enumerable: true, get: function () { return get_operation_1.companyGet; } });
14
- var get_properties_1 = require("./get.properties"); // NEW
14
+ var get_properties_1 = require("./get.properties");
15
15
  Object.defineProperty(exports, "companyGetProperties", { enumerable: true, get: function () { return get_properties_1.companyGetProperties; } });
@@ -0,0 +1,2 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function productGetByCodes(this: IExecuteFunctions, i: number, returnData: INodeExecutionData[]): Promise<INodeExecutionData[]>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productGetByCodes = productGetByCodes;
4
+ const http_1 = require("../../lib/http");
5
+ async function productGetByCodes(i, returnData) {
6
+ var _a;
7
+ // Read & normalize codes
8
+ const raw = this.getNodeParameter('Code', i, []);
9
+ const toArray = (v) => Array.isArray(v) ? v : (typeof v === 'string' && v ? [v] : []);
10
+ const codes = toArray(raw).map(s => (s !== null && s !== void 0 ? s : '').toString().trim()).filter(Boolean);
11
+ if (!codes.length)
12
+ throw new Error('At least one product code is required.');
13
+ const body = { Code: codes };
14
+ const resp = await (0, http_1.didarRequest)(this, i, {
15
+ method: 'POST',
16
+ path: '/api/product/getproductbycodes',
17
+ body,
18
+ });
19
+ // API returns { Response: { Total, Products: [...] } }
20
+ const out = ((_a = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _a !== void 0 ? _a : resp);
21
+ returnData.push({ json: out });
22
+ return returnData;
23
+ }
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const productGetByCodesProperties: INodeProperties[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productGetByCodesProperties = void 0;
4
+ const showForProductGetByCodes = { show: { resource: ['product'], operation: ['getByCodes'] } };
5
+ exports.productGetByCodesProperties = [
6
+ {
7
+ displayName: 'Codes',
8
+ name: 'Code',
9
+ type: 'string',
10
+ typeOptions: { multipleValues: true }, // n8n → string[]
11
+ default: [],
12
+ required: true,
13
+ displayOptions: showForProductGetByCodes,
14
+ description: 'List of product codes (at least one).',
15
+ },
16
+ ];
@@ -2,3 +2,5 @@ export { productCreate } from './create.operation';
2
2
  export { productCreateProperties } from './create.properties';
3
3
  export { productUpdate } from './update.operation';
4
4
  export { productUpdateProperties } from './update.properties';
5
+ export { productGetByCodes } from './getByCodes.operation';
6
+ export { productGetByCodesProperties } from './getByCodes.properties';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productUpdateProperties = exports.productUpdate = exports.productCreateProperties = exports.productCreate = void 0;
3
+ exports.productGetByCodesProperties = exports.productGetByCodes = exports.productUpdateProperties = exports.productUpdate = exports.productCreateProperties = exports.productCreate = void 0;
4
4
  // nodes/product/index.ts
5
5
  var create_operation_1 = require("./create.operation");
6
6
  Object.defineProperty(exports, "productCreate", { enumerable: true, get: function () { return create_operation_1.productCreate; } });
@@ -10,3 +10,7 @@ var update_operation_1 = require("./update.operation");
10
10
  Object.defineProperty(exports, "productUpdate", { enumerable: true, get: function () { return update_operation_1.productUpdate; } });
11
11
  var update_properties_1 = require("./update.properties");
12
12
  Object.defineProperty(exports, "productUpdateProperties", { enumerable: true, get: function () { return update_properties_1.productUpdateProperties; } });
13
+ var getByCodes_operation_1 = require("./getByCodes.operation");
14
+ Object.defineProperty(exports, "productGetByCodes", { enumerable: true, get: function () { return getByCodes_operation_1.productGetByCodes; } });
15
+ var getByCodes_properties_1 = require("./getByCodes.properties");
16
+ Object.defineProperty(exports, "productGetByCodesProperties", { enumerable: true, get: function () { return getByCodes_properties_1.productGetByCodesProperties; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-didar-crm",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Didar CRM nodes for n8n (Trigger + Deal.create)",
5
5
  "author": "You",
6
6
  "license": "MIT",