@digipair/skill-service 0.18.9 → 0.19.0

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/index.cjs.js CHANGED
@@ -23510,14 +23510,14 @@ function indent(str, spaces) {
23510
23510
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23511
23511
  // match is required
23512
23512
  if (!match) {
23513
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23513
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23514
23514
  v: nextMatch1
23515
23515
  };
23516
23516
  }
23517
23517
  var token = match.token, offset = match.offset;
23518
23518
  i1 += offset;
23519
23519
  if (token === " ") {
23520
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23520
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23521
23521
  }
23522
23522
  tokens1 = _to_consumable_array$1(tokens1).concat([
23523
23523
  token
@@ -23536,7 +23536,7 @@ function indent(str, spaces) {
23536
23536
  if (contextKeys.some(function(el) {
23537
23537
  return el.startsWith(name);
23538
23538
  })) {
23539
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23539
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23540
23540
  }
23541
23541
  if (dateTimeIdentifiers.some(function(el) {
23542
23542
  return el === name;
@@ -23555,9 +23555,9 @@ function indent(str, spaces) {
23555
23555
  if (dateTimeIdentifiers.some(function(el) {
23556
23556
  return el.startsWith(name);
23557
23557
  })) {
23558
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23558
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23559
23559
  }
23560
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23560
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23561
23561
  v: nextMatch1
23562
23562
  };
23563
23563
  };
@@ -27374,7 +27374,7 @@ const applyTemplate = (value, context)=>{
27374
27374
  return result;
27375
27375
  };
27376
27376
  const executePins = async (settingsOrigin, context = {})=>{
27377
- var _settings_conditions;
27377
+ var _settings_conditions, _settings_conditions1;
27378
27378
  const settings = await preparePinsSettings(settingsOrigin, context);
27379
27379
  if ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.each) {
27380
27380
  const results = [];
@@ -27399,11 +27399,22 @@ const executePins = async (settingsOrigin, context = {})=>{
27399
27399
  if (typeof ((_itemSettings_conditions = itemSettings.conditions) == null ? void 0 : _itemSettings_conditions.if) !== 'undefined' && !itemSettings.conditions.if) {
27400
27400
  continue;
27401
27401
  }
27402
- const itemResult = await executePins(itemSettingsOrigin, itemContext);
27402
+ let itemResult = null;
27403
+ try {
27404
+ itemResult = await executePins(itemSettingsOrigin, itemContext);
27405
+ } catch (error) {
27406
+ if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
27407
+ continue;
27408
+ }
27409
+ throw error;
27410
+ }
27403
27411
  results.push(itemResult);
27404
27412
  }
27405
27413
  return results;
27406
27414
  }
27415
+ if (typeof ((_settings_conditions1 = settings.conditions) == null ? void 0 : _settings_conditions1.if) !== 'undefined' && !settings.conditions.if) {
27416
+ throw 'DIGIPAIR_CONDITIONS_IF_FALSE';
27417
+ }
27407
27418
  const version = context.config.VERSIONS[settings.library] || 'latest';
27408
27419
  const library = _config.LIBRARIES[settings.library] || (typeof window === 'undefined' ? require(settings.library) : await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(isRemoteVersion.test(version) ? `${version}` : `${_config.BASE_URL}/${settings.library}@${version}/index.esm.js`));
27409
27420
  const pins = library == null ? void 0 : library[settings.element];
@@ -27417,23 +27428,23 @@ const executePinsList = async (pinsSettingsList, context)=>{
27417
27428
  const steps = [];
27418
27429
  // parcourir tous les pins
27419
27430
  for(let i = 0; i < pinsSettingsList.length; i++){
27420
- var _settings_conditions;
27421
27431
  const settings = pinsSettingsList[i];
27422
- if (typeof ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.if) !== 'undefined') {
27423
- const preparedSettings = await preparePinsSettings(settings, context);
27424
- if (!preparedSettings.conditions.if) {
27432
+ try {
27433
+ previous = await executePins(settings, _extends({}, context, {
27434
+ previous,
27435
+ steps,
27436
+ parent: {
27437
+ previous: context.previous,
27438
+ steps: context.steps,
27439
+ parent: context.parent
27440
+ }
27441
+ }));
27442
+ } catch (error) {
27443
+ if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
27425
27444
  continue;
27426
27445
  }
27446
+ throw error;
27427
27447
  }
27428
- previous = await executePins(settings, _extends({}, context, {
27429
- previous,
27430
- steps,
27431
- parent: {
27432
- previous: context.previous,
27433
- steps: context.steps,
27434
- parent: context.parent
27435
- }
27436
- }));
27437
27448
  steps[i] = {
27438
27449
  name: settings.name,
27439
27450
  result: previous
@@ -27468,7 +27479,13 @@ let ServiceService = class ServiceService {
27468
27479
  const { execute } = params;
27469
27480
  return await executePinsList(execute, context);
27470
27481
  }
27482
+ async task(params, _pinsSettingsList, context) {
27483
+ const { execute } = params;
27484
+ return await executePinsList(execute, context);
27485
+ }
27471
27486
  };
27472
27487
  const service = (params, pinsSettingsList, context)=>new ServiceService().service(params, pinsSettingsList, context);
27488
+ const task = (params, pinsSettingsList, context)=>new ServiceService().task(params, pinsSettingsList, context);
27473
27489
 
27474
27490
  exports.service = service;
27491
+ exports.task = task;
package/index.esm.js CHANGED
@@ -23488,14 +23488,14 @@ function indent(str, spaces) {
23488
23488
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23489
23489
  // match is required
23490
23490
  if (!match) {
23491
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23491
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23492
23492
  v: nextMatch1
23493
23493
  };
23494
23494
  }
23495
23495
  var token = match.token, offset = match.offset;
23496
23496
  i1 += offset;
23497
23497
  if (token === " ") {
23498
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23498
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23499
23499
  }
23500
23500
  tokens1 = _to_consumable_array$1(tokens1).concat([
23501
23501
  token
@@ -23514,7 +23514,7 @@ function indent(str, spaces) {
23514
23514
  if (contextKeys.some(function(el) {
23515
23515
  return el.startsWith(name);
23516
23516
  })) {
23517
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23517
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23518
23518
  }
23519
23519
  if (dateTimeIdentifiers.some(function(el) {
23520
23520
  return el === name;
@@ -23533,9 +23533,9 @@ function indent(str, spaces) {
23533
23533
  if (dateTimeIdentifiers.some(function(el) {
23534
23534
  return el.startsWith(name);
23535
23535
  })) {
23536
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23536
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23537
23537
  }
23538
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23538
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23539
23539
  v: nextMatch1
23540
23540
  };
23541
23541
  };
@@ -27352,7 +27352,7 @@ const applyTemplate = (value, context)=>{
27352
27352
  return result;
27353
27353
  };
27354
27354
  const executePins = async (settingsOrigin, context = {})=>{
27355
- var _settings_conditions;
27355
+ var _settings_conditions, _settings_conditions1;
27356
27356
  const settings = await preparePinsSettings(settingsOrigin, context);
27357
27357
  if ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.each) {
27358
27358
  const results = [];
@@ -27377,11 +27377,22 @@ const executePins = async (settingsOrigin, context = {})=>{
27377
27377
  if (typeof ((_itemSettings_conditions = itemSettings.conditions) == null ? void 0 : _itemSettings_conditions.if) !== 'undefined' && !itemSettings.conditions.if) {
27378
27378
  continue;
27379
27379
  }
27380
- const itemResult = await executePins(itemSettingsOrigin, itemContext);
27380
+ let itemResult = null;
27381
+ try {
27382
+ itemResult = await executePins(itemSettingsOrigin, itemContext);
27383
+ } catch (error) {
27384
+ if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
27385
+ continue;
27386
+ }
27387
+ throw error;
27388
+ }
27381
27389
  results.push(itemResult);
27382
27390
  }
27383
27391
  return results;
27384
27392
  }
27393
+ if (typeof ((_settings_conditions1 = settings.conditions) == null ? void 0 : _settings_conditions1.if) !== 'undefined' && !settings.conditions.if) {
27394
+ throw 'DIGIPAIR_CONDITIONS_IF_FALSE';
27395
+ }
27385
27396
  const version = context.config.VERSIONS[settings.library] || 'latest';
27386
27397
  const library = _config.LIBRARIES[settings.library] || (typeof window === 'undefined' ? require(settings.library) : await import(isRemoteVersion.test(version) ? `${version}` : `${_config.BASE_URL}/${settings.library}@${version}/index.esm.js`));
27387
27398
  const pins = library == null ? void 0 : library[settings.element];
@@ -27395,23 +27406,23 @@ const executePinsList = async (pinsSettingsList, context)=>{
27395
27406
  const steps = [];
27396
27407
  // parcourir tous les pins
27397
27408
  for(let i = 0; i < pinsSettingsList.length; i++){
27398
- var _settings_conditions;
27399
27409
  const settings = pinsSettingsList[i];
27400
- if (typeof ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.if) !== 'undefined') {
27401
- const preparedSettings = await preparePinsSettings(settings, context);
27402
- if (!preparedSettings.conditions.if) {
27410
+ try {
27411
+ previous = await executePins(settings, _extends({}, context, {
27412
+ previous,
27413
+ steps,
27414
+ parent: {
27415
+ previous: context.previous,
27416
+ steps: context.steps,
27417
+ parent: context.parent
27418
+ }
27419
+ }));
27420
+ } catch (error) {
27421
+ if (error === 'DIGIPAIR_CONDITIONS_IF_FALSE') {
27403
27422
  continue;
27404
27423
  }
27424
+ throw error;
27405
27425
  }
27406
- previous = await executePins(settings, _extends({}, context, {
27407
- previous,
27408
- steps,
27409
- parent: {
27410
- previous: context.previous,
27411
- steps: context.steps,
27412
- parent: context.parent
27413
- }
27414
- }));
27415
27426
  steps[i] = {
27416
27427
  name: settings.name,
27417
27428
  result: previous
@@ -27446,7 +27457,12 @@ let ServiceService = class ServiceService {
27446
27457
  const { execute } = params;
27447
27458
  return await executePinsList(execute, context);
27448
27459
  }
27460
+ async task(params, _pinsSettingsList, context) {
27461
+ const { execute } = params;
27462
+ return await executePinsList(execute, context);
27463
+ }
27449
27464
  };
27450
27465
  const service = (params, pinsSettingsList, context)=>new ServiceService().service(params, pinsSettingsList, context);
27466
+ const task = (params, pinsSettingsList, context)=>new ServiceService().task(params, pinsSettingsList, context);
27451
27467
 
27452
- export { service };
27468
+ export { service, task };
@@ -1,2 +1,3 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
2
  export declare const service: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
+ export declare const task: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-service",
3
- "version": "0.18.9",
3
+ "version": "0.19.0",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.json CHANGED
@@ -31,6 +31,26 @@
31
31
  }
32
32
  }
33
33
  ]
34
+ },
35
+ "/task": {
36
+ "summary": "Tache",
37
+ "description": "Exécution d'une tache.",
38
+ "tags": ["service"],
39
+ "metadata": [],
40
+ "parameters": [
41
+ {
42
+ "name": "execute",
43
+ "summary": "Exécute",
44
+ "required": true,
45
+ "description": "Commandes à exécuter",
46
+ "schema": {
47
+ "type": "array",
48
+ "items": {
49
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
50
+ }
51
+ }
52
+ }
53
+ ]
34
54
  }
35
55
  }
36
56
  }