@boostercloud/framework-provider-azure 2.11.0 → 2.12.0

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.
@@ -184,6 +184,13 @@ function buildProjections(projections = '*') {
184
184
  if (typeof projections !== 'object') {
185
185
  return projections;
186
186
  }
187
+ // Helper function to convert dot notation to square-bracket notation
188
+ const toSquareBracketsNotation = (path) => {
189
+ return path
190
+ .split('.')
191
+ .map((part) => `["${part}"]`)
192
+ .join('');
193
+ };
187
194
  // Group fields by the root property
188
195
  const groupedFields = {};
189
196
  Object.values(projections).forEach((field) => {
@@ -198,12 +205,16 @@ function buildProjections(projections = '*') {
198
205
  const fields = groupedFields[root];
199
206
  if (root.endsWith('[]')) {
200
207
  const arrayRoot = root.slice(0, -2);
201
- const subFields = fields.map((f) => f.replace(`${root}.`, 'item.')).join(', ');
202
- return `ARRAY(SELECT ${subFields} FROM item IN c.${arrayRoot}) AS ${arrayRoot}`;
208
+ const subFields = fields
209
+ .map((f) => f.replace(`${root}.`, ''))
210
+ .map(toSquareBracketsNotation)
211
+ .map((f) => `item${f}`)
212
+ .join(', ');
213
+ return `ARRAY(SELECT ${subFields} FROM item IN c["${arrayRoot}"]) AS ${arrayRoot}`;
203
214
  }
204
215
  else if (fields.length === 1 && !fields[0].includes('.')) {
205
216
  // Simple field
206
- return `c.${fields[0]}`;
217
+ return `c${toSquareBracketsNotation(fields[0])}`;
207
218
  }
208
219
  else {
209
220
  // Nested object fields
@@ -220,13 +231,18 @@ function buildProjections(projections = '*') {
220
231
  });
221
232
  return Object.keys(nestedFields)
222
233
  .map((nestedRoot) => {
223
- const subFields = nestedFields[nestedRoot].map((f) => `c.${root}.${f} AS "${root}.${f}"`).join(', ');
234
+ const subFields = nestedFields[nestedRoot]
235
+ .map((f) => `c${toSquareBracketsNotation(`${root}.${f}`)} AS "${root}.${f}"`)
236
+ .join(', ');
224
237
  if (nestedRoot.endsWith('[]')) {
225
238
  const arrayNestedRoot = nestedRoot.slice(0, -2);
226
239
  const subArrayFields = nestedFields[nestedRoot]
227
- .map((f) => `item.${f.split('.').slice(1).join('.')}`)
240
+ .map((f) => {
241
+ const subFieldParts = f.split('.').slice(1).join('.');
242
+ return `item${toSquareBracketsNotation(subFieldParts)}`;
243
+ })
228
244
  .join(', ');
229
- return `ARRAY(SELECT ${subArrayFields} FROM item IN c.${root}.${arrayNestedRoot}) AS "${root}.${arrayNestedRoot}"`;
245
+ return `ARRAY(SELECT ${subArrayFields} FROM item IN c${toSquareBracketsNotation(`${root}.${arrayNestedRoot}`)}) AS "${root}.${arrayNestedRoot}"`;
230
246
  }
231
247
  return subFields;
232
248
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostercloud/framework-provider-azure",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "Handle Booster's integration with Azure",
5
5
  "keywords": [
6
6
  "framework-provider-azure"
@@ -27,14 +27,14 @@
27
27
  "@azure/functions": "^1.2.2",
28
28
  "@azure/identity": "~2.1.0",
29
29
  "@azure/event-hubs": "5.11.1",
30
- "@boostercloud/framework-common-helpers": "^2.11.0",
31
- "@boostercloud/framework-types": "^2.11.0",
30
+ "@boostercloud/framework-common-helpers": "^2.12.0",
31
+ "@boostercloud/framework-types": "^2.12.0",
32
32
  "tslib": "^2.4.0",
33
33
  "@effect-ts/core": "^0.60.4",
34
34
  "@azure/web-pubsub": "~1.1.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@boostercloud/eslint-config": "^2.11.0",
37
+ "@boostercloud/eslint-config": "^2.12.0",
38
38
  "@types/chai": "4.2.18",
39
39
  "@types/chai-as-promised": "7.1.4",
40
40
  "@types/faker": "5.1.5",