@digipair/skill-keycloak 0.32.0 → 0.32.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/index.cjs.js CHANGED
@@ -23523,14 +23523,14 @@ function indent(str, spaces) {
23523
23523
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23524
23524
  // match is required
23525
23525
  if (!match) {
23526
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23526
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23527
23527
  v: nextMatch1
23528
23528
  };
23529
23529
  }
23530
23530
  var token = match.token, offset = match.offset;
23531
23531
  i1 += offset;
23532
23532
  if (token === " ") {
23533
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23533
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23534
23534
  }
23535
23535
  tokens1 = _to_consumable_array$3(tokens1).concat([
23536
23536
  token
@@ -23549,7 +23549,7 @@ function indent(str, spaces) {
23549
23549
  if (contextKeys.some(function(el) {
23550
23550
  return el.startsWith(name);
23551
23551
  })) {
23552
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23552
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23553
23553
  }
23554
23554
  if (dateTimeIdentifiers.some(function(el) {
23555
23555
  return el === name;
@@ -23568,9 +23568,9 @@ function indent(str, spaces) {
23568
23568
  if (dateTimeIdentifiers.some(function(el) {
23569
23569
  return el.startsWith(name);
23570
23570
  })) {
23571
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23571
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23572
23572
  }
23573
- return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23573
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23574
23574
  v: nextMatch1
23575
23575
  };
23576
23576
  };
@@ -33262,13 +33262,13 @@ let KeycloakService = class KeycloakService {
33262
33262
  return await executePinsList(execute, context);
33263
33263
  }
33264
33264
  async boost(params, _pinsSettingsList, context) {
33265
- var _context_request_headers_authorization;
33265
+ var _context_request_headers_authorization, _steps_step;
33266
33266
  if (context.request.method !== 'POST') {
33267
33267
  return {
33268
33268
  error: 'Method not allowed'
33269
33269
  };
33270
33270
  }
33271
- const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
33271
+ const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
33272
33272
  const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
33273
33273
  if (token) {
33274
33274
  context.keycloak = {
@@ -33283,7 +33283,13 @@ let KeycloakService = class KeycloakService {
33283
33283
  if (secured && !context.keycloak.decodedToken) {
33284
33284
  throw new Error('Unauthorized');
33285
33285
  }
33286
- const result = await executePinsList(execute, context);
33286
+ const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
33287
+ const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
33288
+ const result = await executePinsList(execute, _extends({}, context, {
33289
+ boost: {
33290
+ steps
33291
+ }
33292
+ }));
33287
33293
  return result;
33288
33294
  }
33289
33295
  constructor(){
package/index.esm.js CHANGED
@@ -23494,14 +23494,14 @@ function indent(str, spaces) {
23494
23494
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23495
23495
  // match is required
23496
23496
  if (!match) {
23497
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23497
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23498
23498
  v: nextMatch1
23499
23499
  };
23500
23500
  }
23501
23501
  var token = match.token, offset = match.offset;
23502
23502
  i1 += offset;
23503
23503
  if (token === " ") {
23504
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23504
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23505
23505
  }
23506
23506
  tokens1 = _to_consumable_array$3(tokens1).concat([
23507
23507
  token
@@ -23520,7 +23520,7 @@ function indent(str, spaces) {
23520
23520
  if (contextKeys.some(function(el) {
23521
23521
  return el.startsWith(name);
23522
23522
  })) {
23523
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23523
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23524
23524
  }
23525
23525
  if (dateTimeIdentifiers.some(function(el) {
23526
23526
  return el === name;
@@ -23539,9 +23539,9 @@ function indent(str, spaces) {
23539
23539
  if (dateTimeIdentifiers.some(function(el) {
23540
23540
  return el.startsWith(name);
23541
23541
  })) {
23542
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23542
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23543
23543
  }
23544
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23544
+ return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23545
23545
  v: nextMatch1
23546
23546
  };
23547
23547
  };
@@ -33233,13 +33233,13 @@ let KeycloakService = class KeycloakService {
33233
33233
  return await executePinsList(execute, context);
33234
33234
  }
33235
33235
  async boost(params, _pinsSettingsList, context) {
33236
- var _context_request_headers_authorization;
33236
+ var _context_request_headers_authorization, _steps_step;
33237
33237
  if (context.request.method !== 'POST') {
33238
33238
  return {
33239
33239
  error: 'Method not allowed'
33240
33240
  };
33241
33241
  }
33242
- const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
33242
+ const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
33243
33243
  const token = /^Bearer /g.test(context.request.headers.authorization) && ((_context_request_headers_authorization = context.request.headers.authorization) == null ? void 0 : _context_request_headers_authorization.replace(/^Bearer /g, ''));
33244
33244
  if (token) {
33245
33245
  context.keycloak = {
@@ -33254,7 +33254,13 @@ let KeycloakService = class KeycloakService {
33254
33254
  if (secured && !context.keycloak.decodedToken) {
33255
33255
  throw new Error('Unauthorized');
33256
33256
  }
33257
- const result = await executePinsList(execute, context);
33257
+ const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
33258
+ const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
33259
+ const result = await executePinsList(execute, _extends({}, context, {
33260
+ boost: {
33261
+ steps
33262
+ }
33263
+ }));
33258
33264
  return result;
33259
33265
  }
33260
33266
  constructor(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.en.json CHANGED
@@ -60,23 +60,17 @@
60
60
  },
61
61
  "components": {
62
62
  "schemas": {
63
- "SecuredBoost": {
63
+ "SecuredInput": {
64
64
  "type": "object",
65
65
  "tags": ["boost"],
66
- "summary": "Secure trigger",
66
+ "summary": "Secure input",
67
67
  "properties": {
68
- "name": {
69
- "type": "string"
70
- },
71
68
  "prompt": {
72
69
  "type": "boolean"
73
70
  },
74
71
  "required": {
75
72
  "type": "boolean"
76
73
  },
77
- "text": {
78
- "type": "string"
79
- },
80
74
  "selector": {
81
75
  "type": "string"
82
76
  },
@@ -91,6 +85,42 @@
91
85
  }
92
86
  },
93
87
  "required": []
88
+ },
89
+ "SecuredTrigger": {
90
+ "type": "object",
91
+ "tags": ["boost"],
92
+ "summary": "Trigger",
93
+ "properties": {
94
+ "name": {
95
+ "type": "string"
96
+ },
97
+ "selector": {
98
+ "type": "string"
99
+ },
100
+ "url": {
101
+ "type": "string"
102
+ }
103
+ },
104
+ "required": []
105
+ },
106
+ "SecuredStep": {
107
+ "type": "object",
108
+ "tags": ["boost"],
109
+ "summary": "Step",
110
+ "properties": {
111
+ "name": {
112
+ "summary": "Step name",
113
+ "type": "string"
114
+ },
115
+ "execute": {
116
+ "summary": "Actions to execute",
117
+ "type": "array",
118
+ "items": {
119
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
120
+ }
121
+ }
122
+ },
123
+ "required": ["name", "execute"]
94
124
  }
95
125
  }
96
126
  },
@@ -303,25 +333,25 @@
303
333
  "name": "boosts",
304
334
  "summary": "List of triggers",
305
335
  "required": true,
306
- "description": "List of triggers for the boost",
336
+ "description": "List of boost triggers",
307
337
  "schema": {
308
338
  "type": "array",
309
339
  "items": {
310
- "$ref": "#/components/schemas/SecuredBoost"
340
+ "$ref": "#/components/schemas/SecuredTrigger"
311
341
  }
312
342
  }
313
343
  }
314
344
  ],
315
345
  "parameters": [
316
346
  {
317
- "name": "execute",
318
- "summary": "Execution of actions",
319
- "required": false,
320
- "description": "List of actions to execute",
347
+ "name": "steps",
348
+ "summary": "Execute the following steps",
349
+ "required": true,
350
+ "description": "Execute the defined steps",
321
351
  "schema": {
322
352
  "type": "array",
323
353
  "items": {
324
- "$ref": "https://schemas.digipair.ai/pinsSettings"
354
+ "$ref": "#/components/schemas/SecuredStep"
325
355
  }
326
356
  }
327
357
  },
package/schema.fr.json CHANGED
@@ -60,23 +60,17 @@
60
60
  },
61
61
  "components": {
62
62
  "schemas": {
63
- "SecuredBoost": {
63
+ "SecuredInput": {
64
64
  "type": "object",
65
65
  "tags": ["boost"],
66
- "summary": "Déclencheur sécurisé",
66
+ "summary": "Entrées sécurisées",
67
67
  "properties": {
68
- "name": {
69
- "type": "string"
70
- },
71
68
  "prompt": {
72
69
  "type": "boolean"
73
70
  },
74
71
  "required": {
75
72
  "type": "boolean"
76
73
  },
77
- "text": {
78
- "type": "string"
79
- },
80
74
  "selector": {
81
75
  "type": "string"
82
76
  },
@@ -91,6 +85,42 @@
91
85
  }
92
86
  },
93
87
  "required": []
88
+ },
89
+ "SecuredTrigger": {
90
+ "type": "object",
91
+ "tags": ["boost"],
92
+ "summary": "Déclencheur",
93
+ "properties": {
94
+ "name": {
95
+ "type": "string"
96
+ },
97
+ "selector": {
98
+ "type": "string"
99
+ },
100
+ "url": {
101
+ "type": "string"
102
+ }
103
+ },
104
+ "required": []
105
+ },
106
+ "SecuredStep": {
107
+ "type": "object",
108
+ "tags": ["boost"],
109
+ "summary": "Etape",
110
+ "properties": {
111
+ "name": {
112
+ "summary": "Nom de l'étape",
113
+ "type": "string"
114
+ },
115
+ "execute": {
116
+ "summary": "Actions à exécuter",
117
+ "type": "array",
118
+ "items": {
119
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
120
+ }
121
+ }
122
+ },
123
+ "required": ["name", "execute"]
94
124
  }
95
125
  }
96
126
  },
@@ -307,21 +337,21 @@
307
337
  "schema": {
308
338
  "type": "array",
309
339
  "items": {
310
- "$ref": "#/components/schemas/SecuredBoost"
340
+ "$ref": "#/components/schemas/SecuredInput"
311
341
  }
312
342
  }
313
343
  }
314
344
  ],
315
345
  "parameters": [
316
346
  {
317
- "name": "execute",
318
- "summary": "Exécution des actions",
319
- "required": false,
320
- "description": "Liste des actions à exécuter",
347
+ "name": "steps",
348
+ "summary": "Execute les étapes suivantes",
349
+ "required": true,
350
+ "description": "Execute les étapes définies suivantes",
321
351
  "schema": {
322
352
  "type": "array",
323
353
  "items": {
324
- "$ref": "https://schemas.digipair.ai/pinsSettings"
354
+ "$ref": "#/components/schemas/SecuredStep"
325
355
  }
326
356
  }
327
357
  },
package/schema.json CHANGED
@@ -60,23 +60,17 @@
60
60
  },
61
61
  "components": {
62
62
  "schemas": {
63
- "SecuredBoost": {
63
+ "SecuredInput": {
64
64
  "type": "object",
65
65
  "tags": ["boost"],
66
- "summary": "Secure trigger",
66
+ "summary": "Secure input",
67
67
  "properties": {
68
- "name": {
69
- "type": "string"
70
- },
71
68
  "prompt": {
72
69
  "type": "boolean"
73
70
  },
74
71
  "required": {
75
72
  "type": "boolean"
76
73
  },
77
- "text": {
78
- "type": "string"
79
- },
80
74
  "selector": {
81
75
  "type": "string"
82
76
  },
@@ -91,6 +85,42 @@
91
85
  }
92
86
  },
93
87
  "required": []
88
+ },
89
+ "SecuredTrigger": {
90
+ "type": "object",
91
+ "tags": ["boost"],
92
+ "summary": "Trigger",
93
+ "properties": {
94
+ "name": {
95
+ "type": "string"
96
+ },
97
+ "selector": {
98
+ "type": "string"
99
+ },
100
+ "url": {
101
+ "type": "string"
102
+ }
103
+ },
104
+ "required": []
105
+ },
106
+ "SecuredStep": {
107
+ "type": "object",
108
+ "tags": ["boost"],
109
+ "summary": "Step",
110
+ "properties": {
111
+ "name": {
112
+ "summary": "Step name",
113
+ "type": "string"
114
+ },
115
+ "execute": {
116
+ "summary": "Actions to execute",
117
+ "type": "array",
118
+ "items": {
119
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
120
+ }
121
+ }
122
+ },
123
+ "required": ["name", "execute"]
94
124
  }
95
125
  }
96
126
  },
@@ -303,25 +333,25 @@
303
333
  "name": "boosts",
304
334
  "summary": "List of triggers",
305
335
  "required": true,
306
- "description": "List of triggers for the boost",
336
+ "description": "List of boost triggers",
307
337
  "schema": {
308
338
  "type": "array",
309
339
  "items": {
310
- "$ref": "#/components/schemas/SecuredBoost"
340
+ "$ref": "#/components/schemas/SecuredTrigger"
311
341
  }
312
342
  }
313
343
  }
314
344
  ],
315
345
  "parameters": [
316
346
  {
317
- "name": "execute",
318
- "summary": "Execution of actions",
319
- "required": false,
320
- "description": "List of actions to execute",
347
+ "name": "steps",
348
+ "summary": "Execute the following steps",
349
+ "required": true,
350
+ "description": "Execute the defined steps",
321
351
  "schema": {
322
352
  "type": "array",
323
353
  "items": {
324
- "$ref": "https://schemas.digipair.ai/pinsSettings"
354
+ "$ref": "#/components/schemas/SecuredStep"
325
355
  }
326
356
  }
327
357
  },