n8n-nodes-crm-g2k 0.2.0 → 0.2.1

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
@@ -82,6 +82,7 @@ npm test
82
82
 
83
83
  ## Version history
84
84
 
85
+ - **0.2.1:** each action names its resource (for example, Create or update ticket, Delete ERP product).
85
86
  - **0.2.0:** resource and operation structure, as in n8n's own nodes: Delete operations, Additional Fields, company list search, Get Many with Return All and Simplify, and the CRM G2K globe icon.
86
87
  - **0.1.1:** first version published from GitHub Actions, with a provenance statement.
87
88
  - **0.1.0:** first version.
@@ -62,73 +62,41 @@ const codigoCliente = (resource, operation) => ({
62
62
  description: 'The code you sent with ERP Customer: Create or Update',
63
63
  displayOptions: en(resource, operation),
64
64
  });
65
+ const UPSERT = 'Create a new record, or update the current one if it already exists (upsert)';
66
+ /** The operations of one resource (the first is Create or Update), with the resource named in each action. */
67
+ const operacionesDe = (resource, opciones) => ({
68
+ displayName: 'Operation',
69
+ name: 'operation',
70
+ type: 'options',
71
+ noDataExpression: true,
72
+ displayOptions: { show: { resource: [resource] } },
73
+ options: opciones,
74
+ default: 'upsert',
75
+ });
76
+ const crear = (cosa) => ({ name: 'Create or Update', value: 'upsert', description: UPSERT, action: `Create or update ${cosa}` });
77
+ const borrar = (cosa) => ({
78
+ name: 'Delete',
79
+ value: 'delete',
80
+ description: `Remove the ${cosa} from the CRM`,
81
+ action: `Delete ${cosa}`,
82
+ });
65
83
  const operaciones = [
66
- {
67
- displayName: 'Operation',
68
- name: 'operation',
69
- type: 'options',
70
- noDataExpression: true,
71
- displayOptions: { show: { resource: ['company'] } },
72
- options: [
73
- {
74
- name: 'Create or Update',
75
- value: 'upsert',
76
- description: 'Create a new record, or update the current one if it already exists (upsert)',
77
- action: 'Create or update company',
78
- },
79
- {
80
- name: 'Get',
81
- value: 'get',
82
- description: 'Retrieve a company with its addresses and contacts',
83
- action: 'Get company',
84
- },
85
- {
86
- name: 'Get Many',
87
- value: 'getAll',
88
- description: 'Retrieve a list of companies, by name, tax ID or changes',
89
- action: 'Get many companies',
90
- },
91
- ],
92
- default: 'upsert',
93
- },
94
- {
95
- displayName: 'Operation',
96
- name: 'operation',
97
- type: 'options',
98
- noDataExpression: true,
99
- displayOptions: { show: { resource: ['ticket', 'erpCustomer', 'erpWorkOrder'] } },
100
- options: [
101
- {
102
- name: 'Create or Update',
103
- value: 'upsert',
104
- description: 'Create a new record, or update the current one if it already exists (upsert)',
105
- action: 'Create or update record',
106
- },
107
- ],
108
- default: 'upsert',
109
- },
110
- {
111
- displayName: 'Operation',
112
- name: 'operation',
113
- type: 'options',
114
- noDataExpression: true,
115
- displayOptions: { show: { resource: ['erpSalesDocument', 'erpReceivable', 'erpProduct'] } },
116
- options: [
117
- {
118
- name: 'Create or Update',
119
- value: 'upsert',
120
- description: 'Create a new record, or update the current one if it already exists (upsert)',
121
- action: 'Create or update record',
122
- },
123
- {
124
- name: 'Delete',
125
- value: 'delete',
126
- description: 'Remove the record from the CRM',
127
- action: 'Delete record',
128
- },
129
- ],
130
- default: 'upsert',
131
- },
84
+ operacionesDe('company', [
85
+ crear('company'),
86
+ { name: 'Get', value: 'get', description: 'Retrieve a company with its addresses and contacts', action: 'Get company' },
87
+ {
88
+ name: 'Get Many',
89
+ value: 'getAll',
90
+ description: 'Retrieve a list of companies, by name, tax ID or changes',
91
+ action: 'Get many companies',
92
+ },
93
+ ]),
94
+ operacionesDe('ticket', [crear('ticket')]),
95
+ operacionesDe('erpCustomer', [crear('ERP customer')]),
96
+ operacionesDe('erpSalesDocument', [crear('ERP sales document'), borrar('ERP sales document')]),
97
+ operacionesDe('erpReceivable', [crear('ERP receivable'), borrar('ERP receivable')]),
98
+ operacionesDe('erpProduct', [crear('ERP product'), borrar('ERP product')]),
99
+ operacionesDe('erpWorkOrder', [crear('ERP work order')]),
132
100
  {
133
101
  displayName: 'Operation',
134
102
  name: 'operation',
@@ -136,12 +104,7 @@ const operaciones = [
136
104
  noDataExpression: true,
137
105
  displayOptions: { show: { resource: ['erpFile'] } },
138
106
  options: [
139
- {
140
- name: 'Upload',
141
- value: 'upload',
142
- description: 'Upload a file for a customer or a quote',
143
- action: 'Upload file',
144
- },
107
+ { name: 'Upload', value: 'upload', description: 'Upload a file for a customer or a quote', action: 'Upload ERP file' },
145
108
  ],
146
109
  default: 'upload',
147
110
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-crm-g2k",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "n8n community node for CRM G2K: a trigger for every change in the CRM and actions on companies, tickets and ERP data",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",