@digipair/skill-keycloak 0.127.0 → 0.127.2

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/dist/index.cjs.js CHANGED
@@ -171,11 +171,11 @@ let KeycloakService = class KeycloakService {
171
171
  const param = context.request.body.params.path.split('[')[0];
172
172
  const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, params[param]);
173
173
  const pinsSettingsList = pinsSettings.properties?.['execute'] || [];
174
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
174
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
175
175
  if (token) {
176
176
  context.keycloak = {
177
177
  isLogged: true,
178
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
178
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
179
179
  };
180
180
  } else {
181
181
  context.keycloak = {
@@ -193,7 +193,7 @@ let KeycloakService = class KeycloakService {
193
193
  return JSON.stringify(await engine.executePinsList(pinsSettingsList, this.mergeConttext(context.request.body.context, context), `${context.request.body.params.path}.execute`));
194
194
  }
195
195
  const path = context.protected.req.path.replace(/\/$/g, '');
196
- const baseUrl = (context.request.headers['x-forwarded-proto'] ?? context.protected.req.protocol) + '://' + context.request.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
196
+ const baseUrl = (context.protected.req.headers['x-forwarded-proto'] ?? context.protected.req.protocol) + '://' + context.protected.req.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
197
197
  await engine.executePinsList(factoryInitialize, context, `${context.__PATH__}.factoryInitialize`);
198
198
  const html = `
199
199
  <!DOCTYPE html>
@@ -308,11 +308,11 @@ let KeycloakService = class KeycloakService {
308
308
  }
309
309
  async service(params, _pinsSettingsList, context) {
310
310
  const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
311
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
311
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
312
312
  if (token) {
313
313
  context.keycloak = {
314
314
  isLogged: true,
315
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
315
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
316
316
  };
317
317
  } else {
318
318
  context.keycloak = {
@@ -336,11 +336,11 @@ let KeycloakService = class KeycloakService {
336
336
  };
337
337
  }
338
338
  const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
339
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
339
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
340
340
  if (token) {
341
341
  context.keycloak = {
342
342
  isLogged: true,
343
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
343
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
344
344
  };
345
345
  } else {
346
346
  context.keycloak = {
package/dist/index.esm.js CHANGED
@@ -22846,14 +22846,14 @@ function indent(str, spaces) {
22846
22846
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
22847
22847
  // match is required
22848
22848
  if (!match) {
22849
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
22849
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
22850
22850
  v: nextMatch1
22851
22851
  };
22852
22852
  }
22853
22853
  var token = match.token, offset = match.offset;
22854
22854
  i1 += offset;
22855
22855
  if (token === ' ') {
22856
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
22856
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
22857
22857
  }
22858
22858
  tokens1 = _to_consumable_array$4(tokens1).concat([
22859
22859
  token
@@ -22872,7 +22872,7 @@ function indent(str, spaces) {
22872
22872
  if (contextKeys.some(function(el) {
22873
22873
  return el.startsWith(name);
22874
22874
  })) {
22875
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
22875
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
22876
22876
  }
22877
22877
  if (dateTimeIdentifiers.some(function(el) {
22878
22878
  return el === name;
@@ -22891,9 +22891,9 @@ function indent(str, spaces) {
22891
22891
  if (dateTimeIdentifiers.some(function(el) {
22892
22892
  return el.startsWith(name);
22893
22893
  })) {
22894
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
22894
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
22895
22895
  }
22896
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
22896
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
22897
22897
  v: nextMatch1
22898
22898
  };
22899
22899
  };
@@ -41552,7 +41552,7 @@ function _class_call_check$3(instance, Constructor) {
41552
41552
  throw new TypeError("Cannot call a class as a function");
41553
41553
  }
41554
41554
  }
41555
- function _defineProperties$1(target, props) {
41555
+ function _defineProperties$1$1(target, props) {
41556
41556
  for(var i = 0; i < props.length; i++){
41557
41557
  var descriptor = props[i];
41558
41558
  descriptor.enumerable = descriptor.enumerable || false;
@@ -41561,9 +41561,9 @@ function _defineProperties$1(target, props) {
41561
41561
  Object.defineProperty(target, descriptor.key, descriptor);
41562
41562
  }
41563
41563
  }
41564
- function _create_class$1(Constructor, protoProps, staticProps) {
41565
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
41566
- if (staticProps) _defineProperties$1(Constructor, staticProps);
41564
+ function _create_class$1$1(Constructor, protoProps, staticProps) {
41565
+ if (protoProps) _defineProperties$1$1(Constructor.prototype, protoProps);
41566
+ if (staticProps) _defineProperties$1$1(Constructor, staticProps);
41567
41567
  return Constructor;
41568
41568
  }
41569
41569
  function _get_prototype_of$3(o) {
@@ -41682,7 +41682,7 @@ var Parser = /*#__PURE__*/ function() {
41682
41682
  this.skipValidations = has$1(config, "skipValidations") ? config.skipValidations // casting assumes the end user passing the correct type
41683
41683
  : DEFAULT_PARSER_CONFIG.skipValidations;
41684
41684
  }
41685
- _create_class$1(Parser, [
41685
+ _create_class$1$1(Parser, [
41686
41686
  {
41687
41687
  key: "performSelfAnalysis",
41688
41688
  value: function performSelfAnalysis() {
@@ -42894,7 +42894,7 @@ function _assert_this_initialized$1(self1) {
42894
42894
  }
42895
42895
  return self1;
42896
42896
  }
42897
- function _class_call_check$1(instance, Constructor) {
42897
+ function _class_call_check$1$1(instance, Constructor) {
42898
42898
  if (!(instance instanceof Constructor)) {
42899
42899
  throw new TypeError("Cannot call a class as a function");
42900
42900
  }
@@ -42976,7 +42976,7 @@ var CelParser = /*#__PURE__*/ function(CstParser) {
42976
42976
  _inherits$1(CelParser, CstParser);
42977
42977
  var _super = _create_super$1(CelParser);
42978
42978
  function CelParser() {
42979
- _class_call_check$1(this, CelParser);
42979
+ _class_call_check$1$1(this, CelParser);
42980
42980
  var _this;
42981
42981
  _this = _super.call(this, allTokens);
42982
42982
  _define_property$2(_assert_this_initialized$1(_this), "expr", _this.RULE('expr', function() {
@@ -45959,12 +45959,12 @@ var identifiers$1 = {
45959
45959
  rcompareIdentifiers: rcompareIdentifiers
45960
45960
  };
45961
45961
 
45962
- function _class_call_check(instance, Constructor) {
45962
+ function _class_call_check$1(instance, Constructor) {
45963
45963
  if (!(instance instanceof Constructor)) {
45964
45964
  throw new TypeError("Cannot call a class as a function");
45965
45965
  }
45966
45966
  }
45967
- function _defineProperties(target, props) {
45967
+ function _defineProperties$1(target, props) {
45968
45968
  for(var i = 0; i < props.length; i++){
45969
45969
  var descriptor = props[i];
45970
45970
  descriptor.enumerable = descriptor.enumerable || false;
@@ -45973,8 +45973,8 @@ function _defineProperties(target, props) {
45973
45973
  Object.defineProperty(target, descriptor.key, descriptor);
45974
45974
  }
45975
45975
  }
45976
- function _create_class(Constructor, protoProps, staticProps) {
45977
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
45976
+ function _create_class$1(Constructor, protoProps, staticProps) {
45977
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
45978
45978
  return Constructor;
45979
45979
  }
45980
45980
  function _instanceof$6(left, right) {
@@ -45995,7 +45995,7 @@ var parseOptions = parseOptions_1;
45995
45995
  var compareIdentifiers = identifiers$1.compareIdentifiers;
45996
45996
  var SemVer$d = /*#__PURE__*/ function() {
45997
45997
  function SemVer(version, options) {
45998
- _class_call_check(this, SemVer);
45998
+ _class_call_check$1(this, SemVer);
45999
45999
  options = parseOptions(options);
46000
46000
  if (_instanceof$6(version, SemVer)) {
46001
46001
  if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
@@ -46050,7 +46050,7 @@ var SemVer$d = /*#__PURE__*/ function() {
46050
46050
  this.build = m[5] ? m[5].split('.') : [];
46051
46051
  this.format();
46052
46052
  }
46053
- _create_class(SemVer, [
46053
+ _create_class$1(SemVer, [
46054
46054
  {
46055
46055
  key: "format",
46056
46056
  value: function format() {
@@ -46631,78 +46631,70 @@ var coerce$1 = function(version, options) {
46631
46631
  };
46632
46632
  var coerce_1 = coerce$1;
46633
46633
 
46634
- var lrucache;
46635
- var hasRequiredLrucache;
46636
-
46637
- function requireLrucache () {
46638
- if (hasRequiredLrucache) return lrucache;
46639
- hasRequiredLrucache = 1;
46640
- function _class_call_check(instance, Constructor) {
46641
- if (!(instance instanceof Constructor)) {
46642
- throw new TypeError("Cannot call a class as a function");
46643
- }
46644
- }
46645
- function _defineProperties(target, props) {
46646
- for(var i = 0; i < props.length; i++){
46647
- var descriptor = props[i];
46648
- descriptor.enumerable = descriptor.enumerable || false;
46649
- descriptor.configurable = true;
46650
- if ("value" in descriptor) descriptor.writable = true;
46651
- Object.defineProperty(target, descriptor.key, descriptor);
46652
- }
46653
- }
46654
- function _create_class(Constructor, protoProps, staticProps) {
46655
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46656
- return Constructor;
46657
- }
46658
- var LRUCache = /*#__PURE__*/ function() {
46659
- function LRUCache() {
46660
- _class_call_check(this, LRUCache);
46661
- this.max = 1000;
46662
- this.map = new Map();
46663
- }
46664
- _create_class(LRUCache, [
46665
- {
46666
- key: "get",
46667
- value: function get(key) {
46668
- var value = this.map.get(key);
46669
- if (value === undefined) {
46670
- return undefined;
46671
- } else {
46672
- // Remove the key from the map and add it to the end
46673
- this.map.delete(key);
46674
- this.map.set(key, value);
46675
- return value;
46676
- }
46677
- }
46678
- },
46679
- {
46680
- key: "delete",
46681
- value: function _delete(key) {
46682
- return this.map.delete(key);
46683
- }
46684
- },
46685
- {
46686
- key: "set",
46687
- value: function set(key, value) {
46688
- var deleted = this.delete(key);
46689
- if (!deleted && value !== undefined) {
46690
- // If cache is full, delete the least recently used item
46691
- if (this.map.size >= this.max) {
46692
- var firstKey = this.map.keys().next().value;
46693
- this.delete(firstKey);
46694
- }
46695
- this.map.set(key, value);
46696
- }
46697
- return this;
46698
- }
46699
- }
46700
- ]);
46701
- return LRUCache;
46702
- }();
46703
- lrucache = LRUCache;
46704
- return lrucache;
46634
+ function _class_call_check(instance, Constructor) {
46635
+ if (!(instance instanceof Constructor)) {
46636
+ throw new TypeError("Cannot call a class as a function");
46637
+ }
46638
+ }
46639
+ function _defineProperties(target, props) {
46640
+ for(var i = 0; i < props.length; i++){
46641
+ var descriptor = props[i];
46642
+ descriptor.enumerable = descriptor.enumerable || false;
46643
+ descriptor.configurable = true;
46644
+ if ("value" in descriptor) descriptor.writable = true;
46645
+ Object.defineProperty(target, descriptor.key, descriptor);
46646
+ }
46705
46647
  }
46648
+ function _create_class(Constructor, protoProps, staticProps) {
46649
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46650
+ return Constructor;
46651
+ }
46652
+ var LRUCache = /*#__PURE__*/ function() {
46653
+ function LRUCache() {
46654
+ _class_call_check(this, LRUCache);
46655
+ this.max = 1000;
46656
+ this.map = new Map();
46657
+ }
46658
+ _create_class(LRUCache, [
46659
+ {
46660
+ key: "get",
46661
+ value: function get(key) {
46662
+ var value = this.map.get(key);
46663
+ if (value === undefined) {
46664
+ return undefined;
46665
+ } else {
46666
+ // Remove the key from the map and add it to the end
46667
+ this.map.delete(key);
46668
+ this.map.set(key, value);
46669
+ return value;
46670
+ }
46671
+ }
46672
+ },
46673
+ {
46674
+ key: "delete",
46675
+ value: function _delete(key) {
46676
+ return this.map.delete(key);
46677
+ }
46678
+ },
46679
+ {
46680
+ key: "set",
46681
+ value: function set(key, value) {
46682
+ var deleted = this.delete(key);
46683
+ if (!deleted && value !== undefined) {
46684
+ // If cache is full, delete the least recently used item
46685
+ if (this.map.size >= this.max) {
46686
+ var firstKey = this.map.keys().next().value;
46687
+ this.delete(firstKey);
46688
+ }
46689
+ this.map.set(key, value);
46690
+ }
46691
+ return this;
46692
+ }
46693
+ }
46694
+ ]);
46695
+ return LRUCache;
46696
+ }();
46697
+ var lrucache = LRUCache;
46706
46698
 
46707
46699
  var range;
46708
46700
  var hasRequiredRange;
@@ -47006,7 +46998,7 @@ function requireRange () {
47006
46998
  return Range;
47007
46999
  }();
47008
47000
  range = Range;
47009
- var LRU = requireLrucache();
47001
+ var LRU = lrucache;
47010
47002
  var cache = new LRU();
47011
47003
  var parseOptions = parseOptions_1;
47012
47004
  var Comparator = requireComparator();
@@ -61349,11 +61341,11 @@ let KeycloakService = class KeycloakService {
61349
61341
  const param = context.request.body.params.path.split('[')[0];
61350
61342
  const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, params[param]);
61351
61343
  const pinsSettingsList = pinsSettings.properties?.['execute'] || [];
61352
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
61344
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
61353
61345
  if (token) {
61354
61346
  context.keycloak = {
61355
61347
  isLogged: true,
61356
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61348
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61357
61349
  };
61358
61350
  } else {
61359
61351
  context.keycloak = {
@@ -61371,7 +61363,7 @@ let KeycloakService = class KeycloakService {
61371
61363
  return JSON.stringify(await executePinsList(pinsSettingsList, this.mergeConttext(context.request.body.context, context), `${context.request.body.params.path}.execute`));
61372
61364
  }
61373
61365
  const path = context.protected.req.path.replace(/\/$/g, '');
61374
- const baseUrl = (context.request.headers['x-forwarded-proto'] ?? context.protected.req.protocol) + '://' + context.request.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
61366
+ const baseUrl = (context.protected.req.headers['x-forwarded-proto'] ?? context.protected.req.protocol) + '://' + context.protected.req.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
61375
61367
  await executePinsList(factoryInitialize, context, `${context.__PATH__}.factoryInitialize`);
61376
61368
  const html = `
61377
61369
  <!DOCTYPE html>
@@ -61486,11 +61478,11 @@ let KeycloakService = class KeycloakService {
61486
61478
  }
61487
61479
  async service(params, _pinsSettingsList, context) {
61488
61480
  const { execute, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
61489
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
61481
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
61490
61482
  if (token) {
61491
61483
  context.keycloak = {
61492
61484
  isLogged: true,
61493
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61485
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61494
61486
  };
61495
61487
  } else {
61496
61488
  context.keycloak = {
@@ -61514,11 +61506,11 @@ let KeycloakService = class KeycloakService {
61514
61506
  };
61515
61507
  }
61516
61508
  const { steps, secured = true, url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM } = params;
61517
- const token = /^Bearer /g.test(context.request.headers.authorization) && context.request.headers.authorization?.replace(/^Bearer /g, '');
61509
+ const token = /^Bearer /g.test(context.protected.req.headers.authorization) && context.protected.req.headers.authorization?.replace(/^Bearer /g, '');
61518
61510
  if (token) {
61519
61511
  context.keycloak = {
61520
61512
  isLogged: true,
61521
- decodedToken: await this.decodedToken(url, realm, context.request.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61513
+ decodedToken: await this.decodedToken(url, realm, context.protected.req.headers.authorization.replace(/^Bearer /, ''), context.protected?.signal)
61522
61514
  };
61523
61515
  } else {
61524
61516
  context.keycloak = {
@@ -1 +1 @@
1
- {"version":3,"file":"skill-keycloak.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-keycloak.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAA4C,MAAM,kBAAkB,CAAC;AA2hB1F,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC;AAEhE,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC;AAEnE,eAAO,MAAM,KAAK,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC"}
1
+ {"version":3,"file":"skill-keycloak.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-keycloak.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAA4C,MAAM,kBAAkB,CAAC;AA6hB1F,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC;AAEhE,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC;AAEnE,eAAO,MAAM,KAAK,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.127.0",
3
+ "version": "0.127.2",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",