n8n-nodes-digit 0.1.19 → 0.1.21
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/dist/nodes/DIGIT.node.js +143 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/nodes/DIGIT.node.js
CHANGED
|
@@ -241,6 +241,149 @@ class DIGIT {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
// ==================================================
|
|
244
|
+
// REGISTRY — SAVE DATA
|
|
245
|
+
// ==================================================
|
|
246
|
+
if (resource === 'registry') {
|
|
247
|
+
const operation = this.getNodeParameter('registryOperation', 0);
|
|
248
|
+
if (operation === 'registry_save') {
|
|
249
|
+
for (let i = 0; i < items.length; i++) {
|
|
250
|
+
try {
|
|
251
|
+
const tenantId = this.getNodeParameter('tenantId', i);
|
|
252
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
253
|
+
const schemaCode = this.getNodeParameter('schemaCode', i);
|
|
254
|
+
const accessToken = this.getNodeParameter('accessToken', i);
|
|
255
|
+
const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
|
|
256
|
+
let body;
|
|
257
|
+
try {
|
|
258
|
+
body = JSON.parse(this.getNodeParameter('requestBody', i));
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
throw new Error('Invalid JSON in Request Body');
|
|
262
|
+
}
|
|
263
|
+
const url = new URL(`/registry/v1/schema/${schemaCode}/data`, baseUrl).toString();
|
|
264
|
+
const response = await this.helpers.httpRequest({
|
|
265
|
+
method: 'POST',
|
|
266
|
+
url,
|
|
267
|
+
headers: {
|
|
268
|
+
'X-Tenant-ID': tenantId,
|
|
269
|
+
'X-Client-ID': clientId,
|
|
270
|
+
Authorization: `Bearer ${cleanToken}`,
|
|
271
|
+
'Content-Type': 'application/json',
|
|
272
|
+
},
|
|
273
|
+
body,
|
|
274
|
+
json: true,
|
|
275
|
+
});
|
|
276
|
+
returnData.push({ json: response });
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (this.continueOnFail()) {
|
|
280
|
+
returnData.push({ json: { error: error.message } });
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
throw error;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return [returnData];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// ==================================================
|
|
291
|
+
// REGISTRY — SEARCH
|
|
292
|
+
// ==================================================
|
|
293
|
+
if (resource === 'registry') {
|
|
294
|
+
const operation = this.getNodeParameter('registryOperation', 0);
|
|
295
|
+
if (operation === 'registry_search') {
|
|
296
|
+
for (let i = 0; i < items.length; i++) {
|
|
297
|
+
try {
|
|
298
|
+
const tenantId = this.getNodeParameter('tenantId', i);
|
|
299
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
300
|
+
const schemaCode = this.getNodeParameter('schemaCode', i);
|
|
301
|
+
const accessToken = this.getNodeParameter('accessToken', i);
|
|
302
|
+
const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
|
|
303
|
+
let body;
|
|
304
|
+
try {
|
|
305
|
+
body = JSON.parse(this.getNodeParameter('requestBody', i));
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
throw new Error('Invalid JSON in Request Body');
|
|
309
|
+
}
|
|
310
|
+
const url = new URL(`/registry/v1/schema/${schemaCode}/data/_search`, baseUrl).toString();
|
|
311
|
+
const response = await this.helpers.httpRequest({
|
|
312
|
+
method: 'POST',
|
|
313
|
+
url,
|
|
314
|
+
headers: {
|
|
315
|
+
'X-Tenant-ID': tenantId,
|
|
316
|
+
'X-Client-ID': clientId,
|
|
317
|
+
Authorization: `Bearer ${cleanToken}`,
|
|
318
|
+
'Content-Type': 'application/json',
|
|
319
|
+
},
|
|
320
|
+
body,
|
|
321
|
+
json: true,
|
|
322
|
+
});
|
|
323
|
+
returnData.push({ json: response });
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
if (this.continueOnFail()) {
|
|
327
|
+
returnData.push({ json: { error: error.message } });
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
throw error;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return [returnData];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// ==================================================
|
|
338
|
+
// REGISTRY — UPDATE
|
|
339
|
+
// ==================================================
|
|
340
|
+
if (resource === 'registry') {
|
|
341
|
+
const operation = this.getNodeParameter('registryOperation', 0);
|
|
342
|
+
if (operation === 'registry_update') {
|
|
343
|
+
for (let i = 0; i < items.length; i++) {
|
|
344
|
+
try {
|
|
345
|
+
const tenantId = this.getNodeParameter('tenantId', i);
|
|
346
|
+
const clientId = this.getNodeParameter('clientId', i);
|
|
347
|
+
const schemaCode = this.getNodeParameter('schemaCode', i);
|
|
348
|
+
const recordId = this.getNodeParameter('recordId', i);
|
|
349
|
+
const accessToken = this.getNodeParameter('accessToken', i);
|
|
350
|
+
const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
|
|
351
|
+
let body;
|
|
352
|
+
try {
|
|
353
|
+
body = JSON.parse(this.getNodeParameter('requestBody', i));
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
throw new Error('Invalid JSON in Request Body');
|
|
357
|
+
}
|
|
358
|
+
const url = new URL(`/registry/v1/schema/${schemaCode}/data`, baseUrl);
|
|
359
|
+
url.searchParams.set('id', recordId);
|
|
360
|
+
const response = await this.helpers.httpRequest({
|
|
361
|
+
method: 'PUT',
|
|
362
|
+
url: url.toString(),
|
|
363
|
+
headers: {
|
|
364
|
+
'X-Tenant-ID': tenantId,
|
|
365
|
+
'X-Client-ID': clientId,
|
|
366
|
+
Authorization: `Bearer ${cleanToken}`,
|
|
367
|
+
'Content-Type': 'application/json',
|
|
368
|
+
},
|
|
369
|
+
body,
|
|
370
|
+
json: true,
|
|
371
|
+
});
|
|
372
|
+
returnData.push({ json: response });
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
if (this.continueOnFail()) {
|
|
376
|
+
returnData.push({ json: { error: error.message } });
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return [returnData];
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// ==================================================
|
|
244
387
|
// IDGEN — GENERATE
|
|
245
388
|
// ==================================================
|
|
246
389
|
if (resource === 'idgen') {
|
package/dist/package.json
CHANGED