@claspo/common 7.5.14-unsub1 → 7.5.14-unsub2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/common",
3
- "version": "7.5.14-unsub1",
3
+ "version": "7.5.14-unsub2",
4
4
  "sideEffects": false,
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -0,0 +1,2 @@
1
+ export declare const createVelocityContext: (context?: Record<string, any>) => Record<string, any>;
2
+ export declare const createJsonVelocityContext: (context?: Record<string, any>) => Record<string, any>;
@@ -0,0 +1 @@
1
+ const normalizePersonalisation=(e={})=>e.personalisation&&"object"==typeof e.personalisation?e.personalisation:e,keepValue=e=>e,escapeForJsonString=e=>"string"==typeof e?JSON.stringify(e).slice(1,-1):e,addGetMethodDeep=(e,t)=>{if(Array.isArray(e)){const o=e.map(e=>addGetMethodDeep(e,t));return Object.defineProperty(o,"get",{value:e=>o[e],enumerable:!1}),o}if(e&&"object"==typeof e){const o=Object.keys(e).reduce((o,n)=>(o[n]=addGetMethodDeep(e[n],t),o),{});return Object.defineProperty(o,"get",{value:e=>o[e],enumerable:!1}),o}return t(e)},buildContext=(e,t)=>{const o=addGetMethodDeep(normalizePersonalisation(e),t);return Object.assign(Object.assign({},o),{data:o})};export const createVelocityContext=(e={})=>buildContext(e,keepValue);export const createJsonVelocityContext=(e={})=>buildContext(e,escapeForJsonString);
@@ -0,0 +1 @@
1
+ export declare const escapeVelocityPatterns: <T>(text: T) => T;
@@ -0,0 +1 @@
1
+ export const escapeVelocityPatterns=e=>"string"!=typeof e?e:e.replace(/#@/g,"\\#@");
@@ -0,0 +1 @@
1
+ export declare const adaptVelocityFallbackSyntax: (template?: string) => string;
@@ -0,0 +1 @@
1
+ const STATIC_FALLBACK_PATTERN=/\$\{\s*([a-zA-Z_$][\w$]*(?:\.[\w$]+|\[[^\]]+\])*)\s*\|\s*'([^']*)'\s*\}/g,VARIABLE_FALLBACK_PATTERN=/\$\{\s*([a-zA-Z_$][\w$]*(?:\.[\w$]+|\[[^\]]+\])*)\s*\|\s*\$([a-zA-Z_$][\w$]*(?:\.[\w$]+|\[[^\]]+\])*)\s*\}/g;export const adaptVelocityFallbackSyntax=($="")=>$.replace(VARIABLE_FALLBACK_PATTERN,($,A,e)=>{const s=`$${A}`;return`#if(${s})${s}#{else}${`$${e}`}#{end}`}).replace(STATIC_FALLBACK_PATTERN,($,A,e)=>{const s=`$${A}`;return`#if(${s})${s}#{else}${e}#{end}`});