@digipair/skill-llm 0.4.10 → 0.4.11

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 nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23513
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23520
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23521
23521
  }
23522
23522
  tokens1 = _to_consumable_array$s(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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23539
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "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 nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23558
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23559
23559
  }
23560
- return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23560
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23561
23561
  v: nextMatch1
23562
23562
  };
23563
23563
  };
@@ -27370,7 +27370,21 @@ const applyTemplate = (value, context)=>{
27370
27370
  const executePins = async (settingsOrigin, context = {}, options = {
27371
27371
  libraries: {}
27372
27372
  })=>{
27373
- const settings = await preparePinsSettings(settingsOrigin, context, options);
27373
+ var _settings_conditions;
27374
+ const settings = await preparePinsSettings(settingsOrigin, context);
27375
+ if ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.each) {
27376
+ return Promise.all(settings.conditions.each.filter((item)=>typeof item.conditions.if === 'undefined' || item.conditions.if).map((item)=>executePins(_extends({}, settings, {
27377
+ conditions: _extends({}, settings.conditions, {
27378
+ each: undefined
27379
+ })
27380
+ }), _extends({}, context, {
27381
+ item,
27382
+ parent: {
27383
+ item: context.item,
27384
+ parent: context.parent
27385
+ }
27386
+ }), options)));
27387
+ }
27374
27388
  const version = options.libraries[settings.library] || 'latest';
27375
27389
  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)); }); })(`${_config.BASE_URL}/${settings.library}@${version}/index.esm.js`));
27376
27390
  const pins = library == null ? void 0 : library[settings.element];
@@ -27386,7 +27400,11 @@ const executePinsList = async (pinsSettingsList, context, options = {
27386
27400
  const steps = [];
27387
27401
  // parcourir tous les pins
27388
27402
  for(let i = 0; i < pinsSettingsList.length; i++){
27403
+ var _settings_conditions;
27389
27404
  const settings = pinsSettingsList[i];
27405
+ if (typeof ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.if) !== 'undefined' && !settings.conditions.if) {
27406
+ continue;
27407
+ }
27390
27408
  previous = await executePins(settings, _extends({}, context, {
27391
27409
  previous,
27392
27410
  steps,
@@ -27403,18 +27421,16 @@ const executePinsList = async (pinsSettingsList, context, options = {
27403
27421
  }
27404
27422
  return previous;
27405
27423
  };
27406
- const preparePinsSettings = async (settings, context, options = {
27407
- libraries: {}
27408
- })=>{
27424
+ const preparePinsSettings = async (settings, context)=>{
27409
27425
  const localContext = _extends({}, context, {
27410
27426
  variables: context.variables || {},
27411
- requests: context.requests || {}
27427
+ conditions: context.conditions || {}
27412
27428
  });
27413
27429
  for (const [key, value] of Object.entries(settings.variables || {})){
27414
27430
  localContext.variables[key] = applyTemplate(value, localContext);
27415
27431
  }
27416
- for (const [key, value] of Object.entries(settings.requests || {})){
27417
- localContext.requests[key] = await executePins(value, localContext, options);
27432
+ for (const [key, value] of Object.entries(settings.conditions || {})){
27433
+ localContext.conditions[key] = await applyTemplate(value, localContext);
27418
27434
  }
27419
27435
  const properties = {};
27420
27436
  for (const [key, value] of Object.entries(settings.properties || {})){
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 i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23491
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
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 i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23498
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23499
23499
  }
23500
23500
  tokens1 = _to_consumable_array$s(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 i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23517
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "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 i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23536
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23537
23537
  }
23538
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23538
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23539
23539
  v: nextMatch1
23540
23540
  };
23541
23541
  };
@@ -27348,7 +27348,21 @@ const applyTemplate = (value, context)=>{
27348
27348
  const executePins = async (settingsOrigin, context = {}, options = {
27349
27349
  libraries: {}
27350
27350
  })=>{
27351
- const settings = await preparePinsSettings(settingsOrigin, context, options);
27351
+ var _settings_conditions;
27352
+ const settings = await preparePinsSettings(settingsOrigin, context);
27353
+ if ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.each) {
27354
+ return Promise.all(settings.conditions.each.filter((item)=>typeof item.conditions.if === 'undefined' || item.conditions.if).map((item)=>executePins(_extends({}, settings, {
27355
+ conditions: _extends({}, settings.conditions, {
27356
+ each: undefined
27357
+ })
27358
+ }), _extends({}, context, {
27359
+ item,
27360
+ parent: {
27361
+ item: context.item,
27362
+ parent: context.parent
27363
+ }
27364
+ }), options)));
27365
+ }
27352
27366
  const version = options.libraries[settings.library] || 'latest';
27353
27367
  const library = _config.LIBRARIES[settings.library] || (typeof window === 'undefined' ? require(settings.library) : await import(`${_config.BASE_URL}/${settings.library}@${version}/index.esm.js`));
27354
27368
  const pins = library == null ? void 0 : library[settings.element];
@@ -27364,7 +27378,11 @@ const executePinsList = async (pinsSettingsList, context, options = {
27364
27378
  const steps = [];
27365
27379
  // parcourir tous les pins
27366
27380
  for(let i = 0; i < pinsSettingsList.length; i++){
27381
+ var _settings_conditions;
27367
27382
  const settings = pinsSettingsList[i];
27383
+ if (typeof ((_settings_conditions = settings.conditions) == null ? void 0 : _settings_conditions.if) !== 'undefined' && !settings.conditions.if) {
27384
+ continue;
27385
+ }
27368
27386
  previous = await executePins(settings, _extends({}, context, {
27369
27387
  previous,
27370
27388
  steps,
@@ -27381,18 +27399,16 @@ const executePinsList = async (pinsSettingsList, context, options = {
27381
27399
  }
27382
27400
  return previous;
27383
27401
  };
27384
- const preparePinsSettings = async (settings, context, options = {
27385
- libraries: {}
27386
- })=>{
27402
+ const preparePinsSettings = async (settings, context)=>{
27387
27403
  const localContext = _extends({}, context, {
27388
27404
  variables: context.variables || {},
27389
- requests: context.requests || {}
27405
+ conditions: context.conditions || {}
27390
27406
  });
27391
27407
  for (const [key, value] of Object.entries(settings.variables || {})){
27392
27408
  localContext.variables[key] = applyTemplate(value, localContext);
27393
27409
  }
27394
- for (const [key, value] of Object.entries(settings.requests || {})){
27395
- localContext.requests[key] = await executePins(value, localContext, options);
27410
+ for (const [key, value] of Object.entries(settings.conditions || {})){
27411
+ localContext.conditions[key] = await applyTemplate(value, localContext);
27396
27412
  }
27397
27413
  const properties = {};
27398
27414
  for (const [key, value] of Object.entries(settings.properties || {})){
@@ -14,14 +14,10 @@ export declare const executePinsList: (pinsSettingsList: PinsSettings[], context
14
14
  [key: string]: string;
15
15
  };
16
16
  }) => Promise<any>;
17
- export declare const generateElementFromPins: (pinsSettings: PinsSettings, context: any, options?: {
17
+ export declare const generateElementFromPins: (pinsSettings: PinsSettings, parent: Element, context: any, options?: {
18
18
  libraries: {
19
19
  [key: string]: string;
20
20
  };
21
- }) => Promise<Element>;
22
- export declare const preparePinsSettings: (settings: PinsSettings, context: any, options?: {
23
- libraries: {
24
- [key: string]: string;
25
- };
26
- }) => Promise<PinsSettings>;
21
+ }) => Promise<Element | void>;
22
+ export declare const preparePinsSettings: (settings: PinsSettings, context: any) => Promise<PinsSettings>;
27
23
  export {};
@@ -9,8 +9,9 @@ export interface PinsSettings {
9
9
  variables?: {
10
10
  [key: string]: any;
11
11
  };
12
- requests?: {
13
- [key: string]: PinsSettings;
12
+ conditions?: {
13
+ if?: boolean;
14
+ each?: any[];
14
15
  };
15
16
  pins?: PinsSettings[];
16
17
  events?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-llm",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"