@digipair/skill-keycloak 0.8.4 → 0.8.6

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.
Files changed (3) hide show
  1. package/index.cjs.js +18 -14
  2. package/index.esm.js +18 -14
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -23522,14 +23522,14 @@ function indent(str, spaces) {
23522
23522
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23523
23523
  // match is required
23524
23524
  if (!match) {
23525
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23525
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23526
23526
  v: nextMatch1
23527
23527
  };
23528
23528
  }
23529
23529
  var token = match.token, offset = match.offset;
23530
23530
  i1 += offset;
23531
23531
  if (token === " ") {
23532
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23532
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23533
23533
  }
23534
23534
  tokens1 = _to_consumable_array$3(tokens1).concat([
23535
23535
  token
@@ -23548,7 +23548,7 @@ function indent(str, spaces) {
23548
23548
  if (contextKeys.some(function(el) {
23549
23549
  return el.startsWith(name);
23550
23550
  })) {
23551
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23551
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23552
23552
  }
23553
23553
  if (dateTimeIdentifiers.some(function(el) {
23554
23554
  return el === name;
@@ -23567,9 +23567,9 @@ function indent(str, spaces) {
23567
23567
  if (dateTimeIdentifiers.some(function(el) {
23568
23568
  return el.startsWith(name);
23569
23569
  })) {
23570
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23570
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23571
23571
  }
23572
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23572
+ return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23573
23573
  v: nextMatch1
23574
23574
  };
23575
23575
  };
@@ -33856,7 +33856,7 @@ let KeycloakService = class KeycloakService {
33856
33856
  });
33857
33857
  return result;
33858
33858
  }
33859
- findFactoryPinsSettings(path, body) {
33859
+ findFactoryPinsSettings(path, item) {
33860
33860
  const pinsSettings = path.split('.').reduce((acc, key)=>{
33861
33861
  if (key.indexOf('[') !== -1) {
33862
33862
  const index = parseInt(key.match(/\d+/)[0]);
@@ -33864,7 +33864,7 @@ let KeycloakService = class KeycloakService {
33864
33864
  }
33865
33865
  return acc[key];
33866
33866
  }, {
33867
- body
33867
+ [path.split('[')[0]]: item
33868
33868
  });
33869
33869
  return pinsSettings;
33870
33870
  }
@@ -33879,6 +33879,10 @@ let KeycloakService = class KeycloakService {
33879
33879
  });
33880
33880
  return decodedtoken;
33881
33881
  }
33882
+ prepareBrowserPinsSettings(name, pinsSettings) {
33883
+ const preparedPinsSettings = pinsSettings.map((item, index)=>this.filteredWebPinsSettings(item, `${name}[${index}]`));
33884
+ return preparedPinsSettings;
33885
+ }
33882
33886
  async page(params, _pinsSettingsList, context) {
33883
33887
  var _context_request_body;
33884
33888
  const { body, title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, libraries = {}, factoryInitialize = [], browserInitialize = [], browserLoad = [], logged = [], unlogged = [] } = params;
@@ -33886,7 +33890,8 @@ let KeycloakService = class KeycloakService {
33886
33890
  const preparedData = {};
33887
33891
  if (context.request.method === 'POST' && ((_context_request_body = context.request.body) == null ? void 0 : _context_request_body.type) === 'DIGIPAIR_EXECUTE_FACTORY') {
33888
33892
  var _pinsSettings_properties, _context_request_headers_authorization, _pinsSettings_properties1, _pinsSettings_properties2;
33889
- const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, body);
33893
+ const param = context.request.body.params.path.split('[')[0];
33894
+ const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, params[param]);
33890
33895
  const pinsSettingsList = ((_pinsSettings_properties = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties['execute']) || [];
33891
33896
  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, ''));
33892
33897
  if (token) {
@@ -33905,7 +33910,6 @@ let KeycloakService = class KeycloakService {
33905
33910
  return await executePinsList(pinsSettingsList, _extends({}, context.request.body.context, context));
33906
33911
  }
33907
33912
  await executePinsList(factoryInitialize, context);
33908
- const preparedBody = body.map((item, index)=>this.filteredWebPinsSettings(item, `body[${index}]`));
33909
33913
  const html = `
33910
33914
  <!DOCTYPE html>
33911
33915
  <html style="${styleHtml}">
@@ -33957,25 +33961,25 @@ let KeycloakService = class KeycloakService {
33957
33961
  };
33958
33962
 
33959
33963
  if (keycloakService.isLogged) {
33960
- await executePinsList(${JSON.stringify(logged)}, context);
33964
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('logged', logged))}, context);
33961
33965
  } else {
33962
- await executePinsList(${JSON.stringify(unlogged)}, context);
33966
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('unlogged', unlogged))}, context);
33963
33967
  }
33964
33968
 
33965
33969
  // Pins initialization
33966
- await executePinsList(${JSON.stringify(browserInitialize)}, context);
33970
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserInitialize', browserInitialize))}, context);
33967
33971
 
33968
33972
  const options = {
33969
33973
  libraries: {},
33970
33974
  };
33971
- const pinsList = ${JSON.stringify(preparedBody)};
33975
+ const pinsList = ${JSON.stringify(this.prepareBrowserPinsSettings('body', body))};
33972
33976
  for (let i = 0; i < pinsList.length; i++) {
33973
33977
  const item = pinsList[i];
33974
33978
  await generateElementFromPins(item, document.body, { ...context, data: ${JSON.stringify(preparedData)} }, options);
33975
33979
  }
33976
33980
 
33977
33981
  setTimeout(async () => {
33978
- await executePinsList(${JSON.stringify(browserLoad)}, context);
33982
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
33979
33983
  }, 1);
33980
33984
  </script>
33981
33985
  </body>
package/index.esm.js CHANGED
@@ -23493,14 +23493,14 @@ function indent(str, spaces) {
23493
23493
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23494
23494
  // match is required
23495
23495
  if (!match) {
23496
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23496
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23497
23497
  v: nextMatch1
23498
23498
  };
23499
23499
  }
23500
23500
  var token = match.token, offset = match.offset;
23501
23501
  i1 += offset;
23502
23502
  if (token === " ") {
23503
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23503
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23504
23504
  }
23505
23505
  tokens1 = _to_consumable_array$3(tokens1).concat([
23506
23506
  token
@@ -23519,7 +23519,7 @@ function indent(str, spaces) {
23519
23519
  if (contextKeys.some(function(el) {
23520
23520
  return el.startsWith(name);
23521
23521
  })) {
23522
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23522
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23523
23523
  }
23524
23524
  if (dateTimeIdentifiers.some(function(el) {
23525
23525
  return el === name;
@@ -23538,9 +23538,9 @@ function indent(str, spaces) {
23538
23538
  if (dateTimeIdentifiers.some(function(el) {
23539
23539
  return el.startsWith(name);
23540
23540
  })) {
23541
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
23541
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23542
23542
  }
23543
- return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
23543
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23544
23544
  v: nextMatch1
23545
23545
  };
23546
23546
  };
@@ -33827,7 +33827,7 @@ let KeycloakService = class KeycloakService {
33827
33827
  });
33828
33828
  return result;
33829
33829
  }
33830
- findFactoryPinsSettings(path, body) {
33830
+ findFactoryPinsSettings(path, item) {
33831
33831
  const pinsSettings = path.split('.').reduce((acc, key)=>{
33832
33832
  if (key.indexOf('[') !== -1) {
33833
33833
  const index = parseInt(key.match(/\d+/)[0]);
@@ -33835,7 +33835,7 @@ let KeycloakService = class KeycloakService {
33835
33835
  }
33836
33836
  return acc[key];
33837
33837
  }, {
33838
- body
33838
+ [path.split('[')[0]]: item
33839
33839
  });
33840
33840
  return pinsSettings;
33841
33841
  }
@@ -33850,6 +33850,10 @@ let KeycloakService = class KeycloakService {
33850
33850
  });
33851
33851
  return decodedtoken;
33852
33852
  }
33853
+ prepareBrowserPinsSettings(name, pinsSettings) {
33854
+ const preparedPinsSettings = pinsSettings.map((item, index)=>this.filteredWebPinsSettings(item, `${name}[${index}]`));
33855
+ return preparedPinsSettings;
33856
+ }
33853
33857
  async page(params, _pinsSettingsList, context) {
33854
33858
  var _context_request_body;
33855
33859
  const { body, title = 'Digipair', favicon = 'https://www.digipair.ai/assets/images/favicon.ico', styleHtml = '', styleBody = '', baseUrl = 'https://cdn.jsdelivr.net/npm', url = context.privates.KEYCLOAK_URL, realm = context.privates.KEYCLOAK_REALM, clientId = context.privates.KEYCLOAK_CLIENTID, libraries = {}, factoryInitialize = [], browserInitialize = [], browserLoad = [], logged = [], unlogged = [] } = params;
@@ -33857,7 +33861,8 @@ let KeycloakService = class KeycloakService {
33857
33861
  const preparedData = {};
33858
33862
  if (context.request.method === 'POST' && ((_context_request_body = context.request.body) == null ? void 0 : _context_request_body.type) === 'DIGIPAIR_EXECUTE_FACTORY') {
33859
33863
  var _pinsSettings_properties, _context_request_headers_authorization, _pinsSettings_properties1, _pinsSettings_properties2;
33860
- const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, body);
33864
+ const param = context.request.body.params.path.split('[')[0];
33865
+ const pinsSettings = this.findFactoryPinsSettings(context.request.body.params.path, params[param]);
33861
33866
  const pinsSettingsList = ((_pinsSettings_properties = pinsSettings.properties) == null ? void 0 : _pinsSettings_properties['execute']) || [];
33862
33867
  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, ''));
33863
33868
  if (token) {
@@ -33876,7 +33881,6 @@ let KeycloakService = class KeycloakService {
33876
33881
  return await executePinsList(pinsSettingsList, _extends({}, context.request.body.context, context));
33877
33882
  }
33878
33883
  await executePinsList(factoryInitialize, context);
33879
- const preparedBody = body.map((item, index)=>this.filteredWebPinsSettings(item, `body[${index}]`));
33880
33884
  const html = `
33881
33885
  <!DOCTYPE html>
33882
33886
  <html style="${styleHtml}">
@@ -33928,25 +33932,25 @@ let KeycloakService = class KeycloakService {
33928
33932
  };
33929
33933
 
33930
33934
  if (keycloakService.isLogged) {
33931
- await executePinsList(${JSON.stringify(logged)}, context);
33935
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('logged', logged))}, context);
33932
33936
  } else {
33933
- await executePinsList(${JSON.stringify(unlogged)}, context);
33937
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('unlogged', unlogged))}, context);
33934
33938
  }
33935
33939
 
33936
33940
  // Pins initialization
33937
- await executePinsList(${JSON.stringify(browserInitialize)}, context);
33941
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserInitialize', browserInitialize))}, context);
33938
33942
 
33939
33943
  const options = {
33940
33944
  libraries: {},
33941
33945
  };
33942
- const pinsList = ${JSON.stringify(preparedBody)};
33946
+ const pinsList = ${JSON.stringify(this.prepareBrowserPinsSettings('body', body))};
33943
33947
  for (let i = 0; i < pinsList.length; i++) {
33944
33948
  const item = pinsList[i];
33945
33949
  await generateElementFromPins(item, document.body, { ...context, data: ${JSON.stringify(preparedData)} }, options);
33946
33950
  }
33947
33951
 
33948
33952
  setTimeout(async () => {
33949
- await executePinsList(${JSON.stringify(browserLoad)}, context);
33953
+ await executePinsList(${JSON.stringify(this.prepareBrowserPinsSettings('browserLoad', browserLoad))}, context);
33950
33954
  }, 1);
33951
33955
  </script>
33952
33956
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-keycloak",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"