@digipair/skill-keycloak 0.31.4 → 0.32.1

Sign up to get free protection for your applications and to get access to all the features.
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, nextMatch = nextMatch1, i = i1, {
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, nextMatch = nextMatch1, i = i1, "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, nextMatch = nextMatch1, i = i1, "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, nextMatch = nextMatch1, i = i1, "continue";
23571
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23572
23572
  }
23573
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23573
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23574
23574
  v: nextMatch1
23575
23575
  };
23576
23576
  };
@@ -27436,7 +27436,8 @@ const executePins = async (settingsOrigin, context = {})=>{
27436
27436
  if (typeof ((_settings_conditions1 = settings.conditions) == null ? void 0 : _settings_conditions1.if) !== 'undefined' && !settings.conditions.if) {
27437
27437
  throw 'DIGIPAIR_CONDITIONS_IF_FALSE';
27438
27438
  }
27439
- const version = context.config.VERSIONS[settings.library] || 'latest';
27439
+ const config = context.config || {};
27440
+ const version = (config.VERSIONS || {})[settings.library] || 'latest';
27440
27441
  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`));
27441
27442
  const pins = library == null ? void 0 : library[settings.element];
27442
27443
  if (!pins) {
@@ -33261,13 +33262,13 @@ let KeycloakService = class KeycloakService {
33261
33262
  return await executePinsList(execute, context);
33262
33263
  }
33263
33264
  async boost(params, _pinsSettingsList, context) {
33264
- var _context_request_headers_authorization;
33265
+ var _context_request_headers_authorization, _steps_step;
33265
33266
  if (context.request.method !== 'POST') {
33266
33267
  return {
33267
33268
  error: 'Method not allowed'
33268
33269
  };
33269
33270
  }
33270
- 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;
33271
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, ''));
33272
33273
  if (token) {
33273
33274
  context.keycloak = {
@@ -33282,7 +33283,13 @@ let KeycloakService = class KeycloakService {
33282
33283
  if (secured && !context.keycloak.decodedToken) {
33283
33284
  throw new Error('Unauthorized');
33284
33285
  }
33285
- 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
+ }));
33286
33293
  return result;
33287
33294
  }
33288
33295
  constructor(){
package/index.esm.js CHANGED
@@ -27407,7 +27407,8 @@ const executePins = async (settingsOrigin, context = {})=>{
27407
27407
  if (typeof ((_settings_conditions1 = settings.conditions) == null ? void 0 : _settings_conditions1.if) !== 'undefined' && !settings.conditions.if) {
27408
27408
  throw 'DIGIPAIR_CONDITIONS_IF_FALSE';
27409
27409
  }
27410
- const version = context.config.VERSIONS[settings.library] || 'latest';
27410
+ const config = context.config || {};
27411
+ const version = (config.VERSIONS || {})[settings.library] || 'latest';
27411
27412
  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`));
27412
27413
  const pins = library == null ? void 0 : library[settings.element];
27413
27414
  if (!pins) {
@@ -33232,13 +33233,13 @@ let KeycloakService = class KeycloakService {
33232
33233
  return await executePinsList(execute, context);
33233
33234
  }
33234
33235
  async boost(params, _pinsSettingsList, context) {
33235
- var _context_request_headers_authorization;
33236
+ var _context_request_headers_authorization, _steps_step;
33236
33237
  if (context.request.method !== 'POST') {
33237
33238
  return {
33238
33239
  error: 'Method not allowed'
33239
33240
  };
33240
33241
  }
33241
- 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;
33242
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, ''));
33243
33244
  if (token) {
33244
33245
  context.keycloak = {
@@ -33253,7 +33254,13 @@ let KeycloakService = class KeycloakService {
33253
33254
  if (secured && !context.keycloak.decodedToken) {
33254
33255
  throw new Error('Unauthorized');
33255
33256
  }
33256
- 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
+ }));
33257
33264
  return result;
33258
33265
  }
33259
33266
  constructor(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.31.4",
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
  },