@vario-software/vario-app-framework-backend 2025.46.0 → 2025.46.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/package.json +1 -1
- package/utils/migrator.js +45 -0
package/package.json
CHANGED
package/utils/migrator.js
CHANGED
|
@@ -349,6 +349,15 @@ const Migrator = class
|
|
|
349
349
|
|
|
350
350
|
addAppScriptingTrigger: async (triggerId, script) =>
|
|
351
351
|
{
|
|
352
|
+
const existingProxyId = await this.methods.getAppScriptingTriggerId(triggerId);
|
|
353
|
+
|
|
354
|
+
if (existingProxyId)
|
|
355
|
+
{
|
|
356
|
+
this.methods.updateAppScriptingTrigger(triggerId, script, existingProxyId);
|
|
357
|
+
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
352
361
|
await this.ApiAdapter.fetch(
|
|
353
362
|
'/community/latest/cmn/system/app-scripting-proxy',
|
|
354
363
|
{
|
|
@@ -361,8 +370,44 @@ const Migrator = class
|
|
|
361
370
|
}),
|
|
362
371
|
});
|
|
363
372
|
|
|
373
|
+
await this.methods.log(`App-Script-Trigger with id "${triggerId}" successfully created\n`);
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
updateAppScriptingTrigger: async (triggerId, script, id) =>
|
|
377
|
+
{
|
|
378
|
+
if (!id)
|
|
379
|
+
{
|
|
380
|
+
id = await this.getAppScriptingTriggerId(triggerId);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
await this.ApiAdapter.fetch(
|
|
384
|
+
`/community/latest/cmn/system/app-scripting-proxy/${id}`,
|
|
385
|
+
{
|
|
386
|
+
useInternalApi: true,
|
|
387
|
+
method: 'PUT',
|
|
388
|
+
body: JSON.stringify({
|
|
389
|
+
appIdentifier: this.app.client.appIdentifier,
|
|
390
|
+
triggerId,
|
|
391
|
+
script,
|
|
392
|
+
}),
|
|
393
|
+
});
|
|
394
|
+
|
|
364
395
|
await this.methods.log(`App-Script-Trigger with id "${triggerId}" successfully updated\n`);
|
|
365
396
|
},
|
|
397
|
+
|
|
398
|
+
getAppScriptingTriggerId: async triggerId =>
|
|
399
|
+
{
|
|
400
|
+
const { data: existingProxy } = await this.ApiAdapter.vql({
|
|
401
|
+
statement: `
|
|
402
|
+
SELECT id
|
|
403
|
+
FROM system.queryAppScriptingProxies
|
|
404
|
+
WHERE appIdentifier = '${this.app.client.appIdentifier}'
|
|
405
|
+
AND triggerId = '${triggerId}'
|
|
406
|
+
`,
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
return existingProxy[0]?.id;
|
|
410
|
+
},
|
|
366
411
|
};
|
|
367
412
|
};
|
|
368
413
|
|