@evlop/commons 1.0.255 → 1.0.257

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.
@@ -1 +1 @@
1
- {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/data-sources/collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAwC,MAAM,aAAa,CAAC;AAchF,QAAA,MAAM,oBAAoB,EAAE,WAiC3B,CAAA;AA6CD,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/data-sources/collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAwC,MAAM,aAAa,CAAC;AAchF,QAAA,MAAM,oBAAoB,EAAE,WAmC3B,CAAA;AA6CD,eAAe,oBAAoB,CAAC"}
@@ -16,6 +16,8 @@ function _getModel(collectionName, dispatch) {
16
16
  const getModel = lodash_1.memoize(_getModel);
17
17
  const collectionDataSource = async (options, { dispatch }) => {
18
18
  const { key, sourceId, collectionName = sourceId, params: requestOptions } = options;
19
+ if (!collectionName)
20
+ return;
19
21
  let reqOptions = {};
20
22
  if (requestOptions) {
21
23
  if (typeof requestOptions === 'string') {
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/data-sources/collection.ts"],"names":[],"mappings":";;AAAA,mCAAiE;AACjE,wCAAmC;AACnC,0CAAgF;AAChF,+BAAkC;AAClC,4CAAyD;AAGzD,SAAS,SAAS,CAAE,cAAc,EAAE,QAAQ;IACxC,IAAG,CAAC,cAAc;QAAE,OAAO,eAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,gCAAqB,CAAC,cAAc,CAAC,CAAC,CAAA;IAC7D,IAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IACvB,OAAO,eAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;AACnD,CAAC;A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,GAAG,YAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAClE,MAAM,MAAM,GAAG,YAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAClE,MAAM,IAAI,GAAG,YAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAC5D,MAAM,QAAQ,GAAG,YAAG,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAClE,OAAO,SAAM,CAAC;QACV,YAAG,CAAC,cAAc,EAAE,KAAK,EAAE,EAAE,CAAC;QAC9B,cAAc;QACd,MAAM;QACN,IAAI;QACJ,QAAQ;QACR,QAAQ;QACR,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QACpB,GAAG,YAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAC,EAAE,CAAA,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,qCAAyB,CAAC,CAAA;AAC3C,CAAC,CAAC;AAGF,kBAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"collectionRecord.d.ts","sourceRoot":"","sources":["../../../src/data-sources/collectionRecord.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAA8C,MAAM,aAAa,CAAC;AAYtF,QAAA,MAAM,0BAA0B,EAAE,WAOjC,CAAA;AAyBD,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"collectionRecord.d.ts","sourceRoot":"","sources":["../../../src/data-sources/collectionRecord.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAA8C,MAAM,aAAa,CAAC;AAYtF,QAAA,MAAM,0BAA0B,EAAE,WASjC,CAAA;AAyBD,eAAe,0BAA0B,CAAC"}
@@ -16,6 +16,8 @@ function _getModel(collectionName, dispatch) {
16
16
  const getModel = lodash_1.memoize(_getModel);
17
17
  const collectionRecordDataSource = async (options, { dispatch }) => {
18
18
  const { collectionName, id, recordId = id, populate } = options;
19
+ if (!collectionName || !recordId)
20
+ return;
19
21
  const { response } = await dispatch(reducers_1.collectionGetRecord(collectionName, recordId, populate));
20
22
  const _Model = getModel(collectionName, dispatch);
21
23
  return response ? new _Model(response) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"collectionRecord.js","sourceRoot":"","sources":["../../../src/data-sources/collectionRecord.ts"],"names":[],"mappings":";;AAAA,mCAAiC;AACjC,+BAAoC;AACpC,wCAAmC;AACnC,4CAAyD;AACzD,0CAAsF;AAGtF,SAAS,SAAS,CAAE,cAAsB,EAAE,QAAkB;IAC1D,IAAG,CAAC,cAAc;QAAE,OAAO,eAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,gCAAqB,CAAC,cAAc,CAAC,CAAC,CAAA;IAC7D,IAAG,KAAK;QAAE,OAAO,KAAK,CAAC;IACvB,OAAO,eAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,QAAQ,GAAG,gBAAO,CAAC,SAAS,CAAC,CAAC;AAEpC,MAAM,0BAA0B,GAAgB,KAAK,EAAE,OAAO,EAAE,EAAC,QAAQ,EAAC,EAAC,EAAE;IACzE,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEhE,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,QAAQ,CAAC,8BAAmB,CAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAElD,OAAO,QAAQ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B,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,UAAU,EAAC;IACxF,EAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAC;CAClG,CAAC;AACF,0BAA0B,CAAC,aAAa,GAAG;IACvC,cAAc,EAAE,EAAE;CACrB,CAAC;AACF,0BAA0B,CAAC,YAAY,GAAG,CAAC,OAAO,EAAC,EAAE;IACjD,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEhE,OAAO,SAAM,CAAC;QACV,cAAc;QACd,QAAQ;QACR,QAAQ;KACX,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,qCAAyB,CAAC,CAAA;AAC3C,CAAC,CAAC;AAGF,kBAAe,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/edl/parser.ts"],"names":[],"mappings":"AAkFA,iBAAS,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,SAuHlE;AAGD,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/edl/parser.ts"],"names":[],"mappings":"AAqHA,iBAAS,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,SAiIlE;AAGD,eAAe,QAAQ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const lodash_1 = require("lodash");
4
+ const he_1 = require("he");
4
5
  const inbuiltVariables = ['context', 'data', 'setRuntimeData', 'setState', 'setStates', 'state', 'dispatchAction', 'createAction'];
5
6
  // Regex to match expressions in EDL
6
7
  const expressionRegex = /{(\((?:(?!\)\}).)*\)|[^{}]*)}/g;
@@ -13,12 +14,33 @@ const attributeRegex = /([a-zA-Z0-9_\-\.\:]+)=("[^"]*"|'[^']*'|`[^`]*`|\{\{(?:(?
13
14
  // Regex to split the JSX string into tokens using opening or closing tag regex pattern
14
15
  const openingOrClosingTagRegex = /(<(?:\/)?(?:[a-zA-Z0-9_]+)(?:(?:\s+[a-zA-Z0-9_\-\.\:]+=(?:"[^"]*"|'[^']*'|`[^`]*`|\{\{(?:(?!\}\}).)*\}\}|\{\[(?:(?!\]\}).)*\]\}|\{\((?:(?!\)\}).)*\)\}|\{[^\}]*\}))*)\s*(?:\/)?>)/s;
15
16
  const TemplateCompiler = {
17
+ breakTemplateStringToExpressionsAndStaticString: (templateString) => {
18
+ const parts = [];
19
+ const regex = new RegExp(expressionRegex);
20
+ let match;
21
+ let lastIndex = 0;
22
+ while ((match = regex.exec(templateString)) !== null) {
23
+ const startIndex = match.index;
24
+ const endIndex = startIndex + match[0].length;
25
+ if (startIndex > lastIndex) {
26
+ parts.push({ startIndex, endIndex, type: 'string', value: templateString.slice(lastIndex, startIndex) });
27
+ }
28
+ parts.push({ startIndex, endIndex, type: 'expression', value: match[1] });
29
+ lastIndex = endIndex;
30
+ }
31
+ if (lastIndex < templateString.length) {
32
+ parts.push({ startIndex: lastIndex, endIndex: templateString.length, type: 'string', value: templateString.slice(lastIndex) });
33
+ }
34
+ return parts;
35
+ },
16
36
  compileStringTemplate: (variables) => {
17
37
  const variableNamesString = `{ ${variables.join(', ')} }`;
18
- return templateString => {
38
+ return (templateString) => {
19
39
  try {
20
40
  // replace all the {expression} with ${ expression } and wrap the whole template in a function
21
41
  const processedTemplate = templateString.replace(expressionRegex, "${ $1 }");
42
+ if (processedTemplate === templateString)
43
+ return templateString;
22
44
  return new Function(variableNamesString, `return \`${processedTemplate}\`;`);
23
45
  }
24
46
  catch (e) { }
@@ -37,6 +59,13 @@ const TemplateCompiler = {
37
59
  function generateUniqueId() {
38
60
  return lodash_1.random(1000, 9999999999).toString(36);
39
61
  }
62
+ function removeUnnecessaryWhitespace(htmlString) {
63
+ return htmlString
64
+ .replace(/>\s*\n\s*/g, '>') // Remove whitespace/newline between closing bracket and content
65
+ .replace(/\s*\n\s*</g, '<') // Remove whitespace/newline between opening bracket and content
66
+ .replace(/\s*\n\s*/g, ' ') // Remove whitespace from start and end of each line
67
+ .trim(); // Trim leading and trailing whitespaces
68
+ }
40
69
  const scriptTagRegex = /<(Script)([^>]*?)>(.*?)<\/\1>/gs;
41
70
  const variableDeclarationRegex = /(const|var|let)\s+(\$[a-zA-Z0-9_]+)/g;
42
71
  function extractScriptsAndVariables(inputString) {
@@ -66,17 +95,20 @@ function extractAsVariables(inputString) {
66
95
  // This function takes a JSX string as input and returns an array of objects representing the parsed JSX structure.
67
96
  function parseEDL(edlString, additionalVariables) {
68
97
  // separate the scripts and extract variables from the edl string
69
- const { cleanedString: _edlString, scriptsById, variables: scriptVariables } = extractScriptsAndVariables(edlString);
98
+ const { cleanedString: edlStringWithCodeRemovedFromScript, scriptsById, variables: scriptVariables } = extractScriptsAndVariables(edlString);
99
+ // remove unnecessary whitespace from the edl string, after code has been removed from the script tags
100
+ const edlStringWithCodeRemovedFromScriptAndWhitespaceRemoved = removeUnnecessaryWhitespace(edlStringWithCodeRemovedFromScript);
70
101
  // Extract :as variables and include them in the union
71
- const asVariables = extractAsVariables(edlString);
102
+ const asVariables = extractAsVariables(edlStringWithCodeRemovedFromScriptAndWhitespaceRemoved);
72
103
  const variables = lodash_1.union(inbuiltVariables, Array.from(additionalVariables), scriptVariables, asVariables);
73
104
  const compileStringTemplate = TemplateCompiler.compileStringTemplate(variables);
74
105
  const compileExpression = TemplateCompiler.compileExpression(variables);
106
+ const breakTemplateStringToExpressionsAndStaticString = TemplateCompiler.breakTemplateStringToExpressionsAndStaticString;
75
107
  // Initialize an empty array to store the final JSX objects
76
108
  const jsxObjects = [];
77
109
  // Initialize an empty stack to keep track of the nested JSX elements
78
110
  const jsxStack = [];
79
- String(_edlString).split(openingOrClosingTagRegex).forEach(token => {
111
+ String(edlStringWithCodeRemovedFromScript).split(openingOrClosingTagRegex).forEach(token => {
80
112
  // If the token is an empty string, skip it
81
113
  if (token.trim() === '') {
82
114
  return;
@@ -84,12 +116,12 @@ function parseEDL(edlString, additionalVariables) {
84
116
  // If the token is not an opening or closing JSX tag, treat it as plain text
85
117
  if (token[0] !== '<') {
86
118
  const parentNode = jsxStack[jsxStack.length - 1];
87
- const stringTemplate = compileStringTemplate(token.trim());
119
+ const parts = breakTemplateStringToExpressionsAndStaticString(he_1.decode(token)).map(({ type, value }) => type == 'expression' ? compileExpression(value) : value);
88
120
  if (parentNode) {
89
- parentNode.children.push(stringTemplate);
121
+ parentNode.children.push(...parts);
90
122
  }
91
123
  else {
92
- jsxObjects.push(stringTemplate);
124
+ jsxObjects.push(...parts);
93
125
  }
94
126
  return;
95
127
  }
@@ -137,8 +169,10 @@ function parseEDL(edlString, additionalVariables) {
137
169
  lodash_1.set(staticProps, attributeName, value);
138
170
  }
139
171
  }
140
- // Get the shared prop names between static and variable props
141
- const sharedPropNames = lodash_1.keys(variableProps).map(key => lodash_1.toPath(key)[0]).filter(key => staticProps[key]);
172
+ // Get the shared prop names between static and variable props, ensuring uniqueness
173
+ const sharedPropNames = Array.from(new Set(Object.keys(variableProps)
174
+ .map(key => lodash_1.toPath(key)[0])
175
+ .filter(key => staticProps[key])));
142
176
  // Create a new JSX element object with the tag name, properties, and an empty children array
143
177
  const newElement = { _id: generateUniqueId(), tag: tagName, staticProps, variableProps, children: [], sharedPropNames };
144
178
  // If the tag is a Script tag, replace it with a UseEffect tag, and convert code to UseEffect function
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/edl/parser.ts"],"names":[],"mappings":";;AAAA,mCAAsE;AAEtE,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,OA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,GAAG,iBAAiB,CAAC,SAAS,IAAI,wBAAwB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACpI;YAED,8EAA8E;YAC9E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvB,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBACjD,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACtC;iBAAM;gBACL,oFAAoF;gBACpF,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aAC7B;YAED,0EAA0E;YAC1E,IAAI,CAAC,aAAa,EAAE;gBAClB,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aAC3B;SACF;IAEH,CAAC,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC;AAGD,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parser.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.test.d.ts","sourceRoot":"","sources":["../../../src/edl/parser.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const parser_1 = __importDefault(require("./parser"));
7
+ const chai_1 = require("chai");
8
+ describe('parseEDL', () => {
9
+ it('should parse an EDL string with a single tag and no props', () => {
10
+ const edlString = '<div></div>';
11
+ const result = parser_1.default(edlString, new Set());
12
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
13
+ chai_1.expect(result[0].tag).to.equal('div');
14
+ chai_1.expect(result[0].staticProps).to.deep.equal({});
15
+ chai_1.expect(result[0].variableProps).to.deep.equal({});
16
+ chai_1.expect(result[0].children).to.deep.equal([]);
17
+ });
18
+ it('should parse an EDL string with a single tag and static props', () => {
19
+ const edlString = '<div class="container" id="main"></div>';
20
+ const result = parser_1.default(edlString, new Set());
21
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
22
+ chai_1.expect(result[0].tag).to.equal('div');
23
+ chai_1.expect(result[0].staticProps).to.deep.equal({ className: 'container', id: 'main' });
24
+ chai_1.expect(result[0].variableProps).to.deep.equal({});
25
+ chai_1.expect(result[0].children).to.deep.equal([]);
26
+ });
27
+ it('should parse an EDL string with inline expression interpolation', () => {
28
+ const edlString = '<Text>Hello {user.name}!</Text>';
29
+ const result = parser_1.default(edlString, new Set(['user']));
30
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
31
+ chai_1.expect(result[0].tag).to.equal('Text');
32
+ chai_1.expect(result[0].children).to.be.an('array').with.lengthOf(3);
33
+ chai_1.expect(result[0].children[0]).to.equal('Hello ');
34
+ chai_1.expect(result[0].children[1]).to.be.a('function'); // The interpolated expression
35
+ chai_1.expect(result[0].children[2]).to.equal('!');
36
+ });
37
+ it('should parse an EDL string with nested tags', () => {
38
+ const edlString = '<div><span>Hello World</span></div>';
39
+ const result = parser_1.default(edlString, new Set());
40
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
41
+ chai_1.expect(result[0].tag).to.equal('div');
42
+ chai_1.expect(result[0].children).to.be.an('array').with.lengthOf(1);
43
+ chai_1.expect(result[0].children[0].tag).to.equal('span');
44
+ chai_1.expect(result[0].children[0].children).to.deep.equal(['Hello World']);
45
+ });
46
+ it('should parse an EDL string with dynamic props', () => {
47
+ const edlString = '<input type="text" value={state.value} />';
48
+ const additionalVariables = new Set(['state']);
49
+ const result = parser_1.default(edlString, additionalVariables);
50
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
51
+ chai_1.expect(result[0].tag).to.equal('input');
52
+ chai_1.expect(result[0].staticProps).to.deep.equal({ type: 'text' });
53
+ chai_1.expect(result[0].variableProps).to.have.property('value');
54
+ chai_1.expect(result[0].variableProps.value).to.be.a('function');
55
+ });
56
+ it('should parse an EDL string with a script tag and extract variables', () => {
57
+ const edlString = `<Script>
58
+ const $var1 = 42;
59
+ let $var2 = "";
60
+ </Script>`;
61
+ const result = parser_1.default(edlString, new Set());
62
+ console.log(result);
63
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
64
+ chai_1.expect(result[0].tag).to.equal('Script');
65
+ chai_1.expect(result[0].variableProps).to.have.property(':function');
66
+ chai_1.expect(result[0].variableProps[':function']).to.be.a('function');
67
+ });
68
+ it('should handle self-closing tags', () => {
69
+ const edlString = '<img src="image.png" />';
70
+ const result = parser_1.default(edlString, new Set());
71
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
72
+ chai_1.expect(result[0].tag).to.equal('img');
73
+ chai_1.expect(result[0].staticProps).to.deep.equal({ src: 'image.png' });
74
+ });
75
+ it('should parse an EDL string with both static and dynamic props', () => {
76
+ const edlString = '<button class="btn" onClick={handleClick}>Click Me</button>';
77
+ const additionalVariables = new Set(['handleClick']);
78
+ const result = parser_1.default(edlString, additionalVariables);
79
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
80
+ chai_1.expect(result[0].tag).to.equal('button');
81
+ chai_1.expect(result[0].staticProps).to.deep.equal({ className: 'btn' });
82
+ chai_1.expect(result[0].variableProps).to.have.property('onClick');
83
+ chai_1.expect(result[0].variableProps.onClick).to.be.a('function');
84
+ chai_1.expect(result[0].children).to.deep.equal(['Click Me']);
85
+ });
86
+ it('should parse an EDL string with mixed content (text and elements)', () => {
87
+ const edlString = '<div>Text before <span>inline text</span> and after</div>';
88
+ const result = parser_1.default(edlString, new Set());
89
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
90
+ chai_1.expect(result[0].tag).to.equal('div');
91
+ chai_1.expect(result[0].children).to.be.an('array').with.lengthOf(3);
92
+ chai_1.expect(result[0].children[0]).to.equal('Text before ');
93
+ chai_1.expect(result[0].children[1].tag).to.equal('span');
94
+ chai_1.expect(result[0].children[1].children).to.deep.equal(['inline text']);
95
+ chai_1.expect(result[0].children[2]).to.equal(' and after');
96
+ });
97
+ it('should identify shared props when they modify different object properties', () => {
98
+ const edlString = '<div style.color="red" style.width={width}></div>';
99
+ const result = parser_1.default(edlString, new Set(['width']));
100
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
101
+ chai_1.expect(result[0].tag).to.equal('div');
102
+ chai_1.expect(result[0].staticProps).to.deep.equal({
103
+ style: { color: 'red' }
104
+ });
105
+ chai_1.expect(result[0].variableProps).to.have.property('style.width');
106
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal(['style']);
107
+ });
108
+ it('should handle multiple shared object properties', () => {
109
+ const edlString = '<div style.color="red" style.width={width} style.height="100px" style.margin={margin}></div>';
110
+ const result = parser_1.default(edlString, new Set(['width', 'margin']));
111
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
112
+ chai_1.expect(result[0].tag).to.equal('div');
113
+ chai_1.expect(result[0].staticProps).to.deep.equal({
114
+ style: {
115
+ color: 'red',
116
+ height: '100px'
117
+ }
118
+ });
119
+ chai_1.expect(result[0].variableProps).to.have.keys('style.width', 'style.margin');
120
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal(['style']);
121
+ });
122
+ it('should handle mixed shared object properties and regular props', () => {
123
+ const edlString = '<div class="container" style.color="red" style.width={width} onClick={handleClick}></div>';
124
+ const result = parser_1.default(edlString, new Set(['width', 'handleClick']));
125
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
126
+ chai_1.expect(result[0].tag).to.equal('div');
127
+ chai_1.expect(result[0].staticProps).to.deep.equal({
128
+ className: 'container',
129
+ style: { color: 'red' }
130
+ });
131
+ chai_1.expect(result[0].variableProps).to.have.keys('style.width', 'onClick');
132
+ console.log(result[0].sharedPropNames);
133
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal(['style']);
134
+ });
135
+ it('should not mark props as shared when only static object properties exist', () => {
136
+ const edlString = '<div style.color="red" style.width="100px"></div>';
137
+ const result = parser_1.default(edlString, new Set());
138
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
139
+ chai_1.expect(result[0].tag).to.equal('div');
140
+ chai_1.expect(result[0].staticProps).to.deep.equal({
141
+ style: {
142
+ color: 'red',
143
+ width: '100px'
144
+ }
145
+ });
146
+ chai_1.expect(result[0].variableProps).to.deep.equal({});
147
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal([]);
148
+ });
149
+ it('should not mark props as shared when only dynamic object properties exist', () => {
150
+ const edlString = '<div style.color={color} style.width={width}></div>';
151
+ const result = parser_1.default(edlString, new Set(['color', 'width']));
152
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
153
+ chai_1.expect(result[0].tag).to.equal('div');
154
+ chai_1.expect(result[0].staticProps).to.deep.equal({});
155
+ chai_1.expect(result[0].variableProps).to.have.keys('style.color', 'style.width');
156
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal([]);
157
+ });
158
+ it('should parse an EDL string with static props only', () => {
159
+ const edlString = '<div class="container" id="main"></div>';
160
+ const result = parser_1.default(edlString, new Set());
161
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
162
+ chai_1.expect(result[0].tag).to.equal('div');
163
+ chai_1.expect(result[0].staticProps).to.deep.equal({ className: 'container', id: 'main' });
164
+ chai_1.expect(result[0].variableProps).to.deep.equal({});
165
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal([]);
166
+ });
167
+ it('should parse an EDL string with dynamic props only', () => {
168
+ const edlString = '<input value={state.value} onChange={handleChange} />';
169
+ const additionalVariables = new Set(['state', 'handleChange']);
170
+ const result = parser_1.default(edlString, additionalVariables);
171
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
172
+ chai_1.expect(result[0].tag).to.equal('input');
173
+ chai_1.expect(result[0].staticProps).to.deep.equal({});
174
+ chai_1.expect(result[0].variableProps).to.have.all.keys('value', 'onChange');
175
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal([]);
176
+ });
177
+ it('should parse an EDL string with both static and dynamic props (not shared)', () => {
178
+ const edlString = '<button class="btn" onClick={handleClick}>Click Me</button>';
179
+ const additionalVariables = new Set(['handleClick']);
180
+ const result = parser_1.default(edlString, additionalVariables);
181
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
182
+ chai_1.expect(result[0].tag).to.equal('button');
183
+ chai_1.expect(result[0].staticProps).to.deep.equal({ className: 'btn' });
184
+ chai_1.expect(result[0].variableProps).to.have.property('onClick');
185
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal([]);
186
+ chai_1.expect(result[0].children).to.deep.equal(['Click Me']);
187
+ });
188
+ it('should identify single shared prop correctly', () => {
189
+ const edlString = '<div class="static-class" class={dynamicClass}></div>';
190
+ const result = parser_1.default(edlString, new Set(['dynamicClass']));
191
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
192
+ chai_1.expect(result[0].tag).to.equal('div');
193
+ chai_1.expect(result[0].staticProps).to.deep.equal({ className: 'static-class' });
194
+ chai_1.expect(result[0].variableProps).to.have.property('className');
195
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal(['className']);
196
+ });
197
+ it('should handle multiple shared props correctly', () => {
198
+ const edlString = '<div id="static-id" class="static-class" id={dynamicId} class={dynamicClass}></div>';
199
+ const result = parser_1.default(edlString, new Set(['dynamicId', 'dynamicClass']));
200
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
201
+ chai_1.expect(result[0].tag).to.equal('div');
202
+ chai_1.expect(result[0].staticProps).to.deep.equal({
203
+ id: 'static-id',
204
+ className: 'static-class'
205
+ });
206
+ chai_1.expect(result[0].variableProps).to.have.keys('id', 'className');
207
+ chai_1.expect(result[0].sharedPropNames).to.have.members(['id', 'className']);
208
+ });
209
+ it('should handle mixed shared and non-shared props', () => {
210
+ const edlString = '<div id="static-id" class="static-class" id={dynamicId} onClick={handleClick}></div>';
211
+ const result = parser_1.default(edlString, new Set(['dynamicId', 'handleClick']));
212
+ chai_1.expect(result).to.be.an('array').with.lengthOf(1);
213
+ chai_1.expect(result[0].tag).to.equal('div');
214
+ chai_1.expect(result[0].staticProps).to.deep.equal({
215
+ id: 'static-id',
216
+ className: 'static-class'
217
+ });
218
+ chai_1.expect(result[0].variableProps).to.have.keys('id', 'onClick');
219
+ chai_1.expect(result[0].sharedPropNames).to.deep.equal(['id']);
220
+ });
221
+ });
222
+ //# sourceMappingURL=parser.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.test.js","sourceRoot":"","sources":["../../../src/edl/parser.test.ts"],"names":[],"mappings":";;;;;AAAA,sDAAgC;AAChC,+BAA8B;AAG9B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACnE,MAAM,SAAS,GAAG,aAAa,CAAC;QAChC,MAAM,MAAM,GAAG,gBAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAE9C,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClD,aAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtC,aAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAChD,aAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClD,aAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAA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M,EAAE,MAAM,EAAE,GAAG,UA0B7D"}
1
+ {"version":3,"file":"pathHelper.d.ts","sourceRoot":"","sources":["../../../src/helpers/pathHelper.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UA2B7D"}
@@ -9,16 +9,16 @@ function generatePath(pathTemplate, params) {
9
9
  if (!pathTemplate || !params)
10
10
  return pathTemplate;
11
11
  const paramsCopy = { ...params };
12
- // Replace placeholders in the path
13
- let path = String(pathTemplate).replace(/:\w+/g, (match) => {
14
- const paramKey = match.substring(1); // Remove the ':' prefix
12
+ // Replace placeholders in the path, now handling optional params (with ?)
13
+ let path = String(pathTemplate).replace(/\/:\w+\??/g, (match) => {
14
+ const paramKey = match.substring(2).replace('?', ''); // Remove '/:' prefix and optional '?'
15
15
  if (paramsCopy[paramKey] !== undefined) {
16
16
  const value = paramsCopy[paramKey];
17
- delete paramsCopy[paramKey]; // Remove the param from the copy to avoid duplicating in the query string
18
- return encodeURIComponent(value);
17
+ delete paramsCopy[paramKey];
18
+ return '/' + encodeURIComponent(value);
19
19
  }
20
- return match;
21
- });
20
+ return match.endsWith('?') ? '' : match; // Remove optional params if not provided
21
+ }) || '/';
22
22
  // Use query-string to stringify the remaining params from the copy
23
23
  const query = query_string_1.default.stringify(paramsCopy);
24
24
  // Append query string if it's not empty
@@ -1 +1 @@
1
- {"version":3,"file":"pathHelper.js","sourceRoot":"","sources":["../../../src/helpers/pathHelper.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AAEvC,SAAgB,YAAY,CAAC,YAAoB,EAAE,MAAW;IAE1D,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM;QAAE,OAAO,YAAY,CAAC;IAElD,MAAM,UAAU,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAEjC,mCAAmC;IACnC,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAA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AAC,QAAQ,CAAC,CAAC;YAC5B,OAAO,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;SAC1C;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,yCAAyC;IACtF,CAAC,CAAC,IAAI,GAAG,CAAC;IAGV,mEAAmE;IACnE,MAAM,KAAK,GAAG,sBAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEhD,wCAAwC;IACxC,IAAI,KAAK,EAAE;QACP,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;KACvB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AA3BD,oCA2BC"}
@@ -2,25 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const chai_1 = require("chai");
4
4
  const pathHelper_1 = require("./pathHelper");
5
- describe('Test handlebar temaplates', function () {
5
+ describe('Test path generator', function () {
6
6
  it('should replace params and append query string', () => {
7
- const result = pathHelper_1.generatePath("/users/:id?/edit?", { id: "42", a: 1 });
7
+ const result = pathHelper_1.generatePath("/users/:id?/edit", { id: "42", a: 1 });
8
8
  chai_1.expect(result).to.equal("/users/42/edit?a=1");
9
9
  });
10
10
  it('should handle optional path segments', () => {
11
- const result = pathHelper_1.generatePath("/users/:id?/edit?", { a: 1 });
11
+ const result = pathHelper_1.generatePath("/users/:id?/edit", { a: 1 });
12
12
  chai_1.expect(result).to.equal("/users/edit?a=1");
13
13
  });
14
14
  it('should handle missing optional params', () => {
15
- const result = pathHelper_1.generatePath("/users/:id?/edit?", {});
15
+ const result = pathHelper_1.generatePath("/users/:id?/edit", {});
16
16
  chai_1.expect(result).to.equal("/users/edit");
17
17
  });
18
18
  it('should URL encode params', () => {
19
- const result = pathHelper_1.generatePath("/users/:id?", { id: "hello world" });
19
+ const result = pathHelper_1.generatePath("/users/:id", { id: "hello world" });
20
20
  chai_1.expect(result).to.equal("/users/hello%20world");
21
21
  });
22
22
  it('should URL encode query string', () => {
23
- const result = pathHelper_1.generatePath("/users/:id?", { id: "42", a: "hello world" });
23
+ const result = pathHelper_1.generatePath("/users/:id", { id: "42", a: "hello world" });
24
24
  chai_1.expect(result).to.equal("/users/42?a=hello%20world");
25
25
  });
26
26
  it('should return root path when all path segments are optional and missing', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"pathhelper.test.js","sourceRoot":"","sources":["../../../src/helpers/pathhelper.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,6CAA4C;AAE5C,QAAQ,CAAC,2BAA2B,EAAE;IAClC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,yBAAY,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrE,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,MAAM,MAAM,GAAG,yBAAY,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3D,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC7C,MAAM,MAAM,GAAG,yBAAY,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACrD,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAChC,MAAM,MAAM,GAAG,yBAAY,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,aAAa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AE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACrE,MAAM,MAAM,GAAG,yBAAY,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACnD,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/commons",
3
- "version": "1.0.255",
3
+ "version": "1.0.257",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "peerDependencies": {
@@ -16,6 +16,7 @@
16
16
  "dependencies": {
17
17
  "axios-retry": "^3.3.1",
18
18
  "events": "^3.3.0",
19
+ "he": "^1.2.0",
19
20
  "moment": "^2.29.1"
20
21
  },
21
22
  "scripts": {