@contentstack/studio-client 1.6.0 → 1.7.1

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 (86) hide show
  1. package/dist/breakpoints/BreakpointManager.js +18 -5
  2. package/dist/breakpoints/BreakpointManager.js.map +1 -1
  3. package/dist/canvas/canvas.utils.js +1 -1
  4. package/dist/canvas/canvas.utils.js.map +1 -1
  5. package/dist/composable-studio/build-scoped-data.js +170 -0
  6. package/dist/composable-studio/build-scoped-data.js.map +1 -0
  7. package/dist/composable-studio/collect-data-needs.js +344 -0
  8. package/dist/composable-studio/collect-data-needs.js.map +1 -0
  9. package/dist/composable-studio/composition-metadata.js +75 -0
  10. package/dist/composable-studio/composition-metadata.js.map +1 -0
  11. package/dist/composable-studio/composition-placement.types.js +7 -0
  12. package/dist/composable-studio/composition-placement.types.js.map +1 -0
  13. package/dist/composable-studio/sdk.js +2169 -192
  14. package/dist/composable-studio/sdk.js.map +1 -1
  15. package/dist/composable-studio/studio-intelligence.manager.js +2 -12
  16. package/dist/composable-studio/studio-intelligence.manager.js.map +1 -1
  17. package/dist/config/default-config.js +1 -0
  18. package/dist/config/default-config.js.map +1 -1
  19. package/dist/config/stack-sdk-wrapper.js +86 -0
  20. package/dist/config/stack-sdk-wrapper.js.map +1 -1
  21. package/dist/context-menu/context-menu.js +1 -0
  22. package/dist/context-menu/context-menu.js.map +1 -1
  23. package/dist/dnd/dnd-manager.js +1 -0
  24. package/dist/dnd/dnd-manager.js.map +1 -1
  25. package/dist/highlight-node/highlight-node-manager.js +1 -0
  26. package/dist/highlight-node/highlight-node-manager.js.map +1 -1
  27. package/dist/highlight-node/highlight-node.js +5 -1
  28. package/dist/highlight-node/highlight-node.js.map +1 -1
  29. package/dist/index.d.ts +1033 -294
  30. package/dist/index.js +13 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/json-rte-registry/embedded-entry-conversion.js +186 -0
  33. package/dist/json-rte-registry/embedded-entry-conversion.js.map +1 -0
  34. package/dist/json-rte-registry/index.js +73 -33
  35. package/dist/json-rte-registry/index.js.map +1 -1
  36. package/dist/json-rte-registry/stack-sdk-store.js +10 -0
  37. package/dist/json-rte-registry/stack-sdk-store.js.map +1 -0
  38. package/dist/query/query-executor.js +182 -27
  39. package/dist/query/query-executor.js.map +1 -1
  40. package/dist/studio-internal/dist/utils/section-slot-walker.js +63 -0
  41. package/dist/studio-internal/dist/utils/section-slot-walker.js.map +1 -0
  42. package/dist/{packages/studio-internal → studio-internal}/dist/utils/spec-compression.js +1 -1
  43. package/dist/studio-internal/dist/utils/spec-compression.js.map +1 -0
  44. package/dist/url-metadata/build-template-query.js +124 -0
  45. package/dist/url-metadata/build-template-query.js.map +1 -0
  46. package/dist/url-metadata/parse-url-metadata.js +75 -0
  47. package/dist/url-metadata/parse-url-metadata.js.map +1 -0
  48. package/dist/url-metadata/rank-url-matches.js +100 -0
  49. package/dist/url-metadata/rank-url-matches.js.map +1 -0
  50. package/dist/url-metadata/select-url-winner.js +45 -0
  51. package/dist/url-metadata/select-url-winner.js.map +1 -0
  52. package/dist/url-metadata/shouldUseUrlMetadataPath.js +22 -0
  53. package/dist/url-metadata/shouldUseUrlMetadataPath.js.map +1 -0
  54. package/dist/url-metadata/types.js +50 -0
  55. package/dist/url-metadata/types.js.map +1 -0
  56. package/dist/url-metadata/url-pattern-matcher.js +311 -0
  57. package/dist/url-metadata/url-pattern-matcher.js.map +1 -0
  58. package/dist/utils/build-composition-fetch-query.js +19 -0
  59. package/dist/utils/build-composition-fetch-query.js.map +1 -0
  60. package/dist/utils/canvas.js +14 -0
  61. package/dist/utils/canvas.js.map +1 -1
  62. package/dist/utils/constants.js +19 -2
  63. package/dist/utils/constants.js.map +1 -1
  64. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js +11 -1
  65. package/dist/utils/convertCompositionQueryInputToCompositionQuery.js.map +1 -1
  66. package/dist/utils/editor-mode.js +142 -0
  67. package/dist/utils/editor-mode.js.map +1 -0
  68. package/dist/utils/editor-utils.js +9 -0
  69. package/dist/utils/editor-utils.js.map +1 -1
  70. package/dist/utils/is-composition-being-edited.js.map +1 -1
  71. package/dist/utils/query-param.js +1 -1
  72. package/dist/utils/query-param.js.map +1 -1
  73. package/dist/utils/reference_fetcher.js +61 -6
  74. package/dist/utils/reference_fetcher.js.map +1 -1
  75. package/dist/utils/sdk.js +16 -1
  76. package/dist/utils/sdk.js.map +1 -1
  77. package/dist/utils/spec-analyzer.js +21 -4
  78. package/dist/utils/spec-analyzer.js.map +1 -1
  79. package/package.json +8 -10
  80. package/dist/get-composition-from-slug/get-composition-from-slug.js +0 -59
  81. package/dist/get-composition-from-slug/get-composition-from-slug.js.map +0 -1
  82. package/dist/node_modules/fflate/esm/browser.js +0 -384
  83. package/dist/node_modules/fflate/esm/browser.js.map +0 -1
  84. package/dist/packages/studio-internal/dist/utils/spec-compression.js.map +0 -1
  85. package/dist/utils/get-url-patterns.js +0 -40
  86. package/dist/utils/get-url-patterns.js.map +0 -1
@@ -41,7 +41,14 @@ class QueryExecutor {
41
41
  }
42
42
  async execute(querySpec, page = 1, context = {}, options) {
43
43
  const { contentType, sourceType = "content_type", query: mongoQuery = {}, params = {}, } = querySpec;
44
- const referenceIncludePaths = sourceType === "content_type"
44
+ // Treat every non-taxonomy source as a content-type-shaped query for
45
+ // include-reference purposes. Studio sends sourceType="contentstack" for
46
+ // CS-bound queries (and may send other strings); only "taxonomy" needs
47
+ // a different path. Restricting this to sourceType==="content_type"
48
+ // earlier dropped includes for everything else, which fell through to
49
+ // the generic param loop and emitted `include=path` (no brackets) —
50
+ // CDA rejects with `{ include: ["should be an array of field paths"] }`.
51
+ const referenceIncludePaths = sourceType !== "taxonomy"
45
52
  ? normalizeReferenceIncludeParam(params?.include)
46
53
  : [];
47
54
  const includeAppliedViaReference = referenceIncludePaths.length > 0;
@@ -60,11 +67,22 @@ class QueryExecutor {
60
67
  else {
61
68
  // Content type query path
62
69
  if (this.isJavaScriptSDK()) {
63
- // JS SDK Path: stack.ContentType(uid).Query()
64
- query = this.sdk.ContentType(contentType).Query();
70
+ // JS SDK Path: stack.ContentType(uid).Entry().Query()
71
+ // The `.Entry()` in the middle aligns with Contentstack's
72
+ // documented chain for entry-collection queries; the legacy
73
+ // `contentstack` SDK accepts `.ContentType().Query()` directly
74
+ // too, but the `.Entry()` form is what consumers see in docs and
75
+ // is the supported shape for include-reference behaviour. The
76
+ // hoist below remains as a safety net for the URL-bracket bug.
77
+ query = this.sdk.ContentType(contentType).Entry().Query();
65
78
  if (includeAppliedViaReference &&
66
79
  typeof query.includeReference === "function") {
67
- const inc = query.includeReference(referenceIncludePaths);
80
+ // Spread the array. The contentstack JS SDK serialises a
81
+ // single-element array passed as one arg as `include=path`
82
+ // (without `[]`), which CDA rejects with
83
+ // `{ include: ["should be an array of field paths"] }`.
84
+ // Spreading forces vararg form so the SDK emits `include[]=path`.
85
+ const inc = query.includeReference(...referenceIncludePaths);
68
86
  if (inc)
69
87
  query = inc;
70
88
  }
@@ -93,10 +111,11 @@ class QueryExecutor {
93
111
  }
94
112
  }
95
113
  else if (typeof this.sdk.ContentType === "function") {
96
- query = this.sdk.ContentType(contentType).Query();
114
+ // Same canonical chain as the JS branch above for the hybrid SDK.
115
+ query = this.sdk.ContentType(contentType).Entry().Query();
97
116
  if (includeAppliedViaReference &&
98
117
  typeof query.includeReference === "function") {
99
- const inc = query.includeReference(referenceIncludePaths);
118
+ const inc = query.includeReference(...referenceIncludePaths);
100
119
  if (inc)
101
120
  query = inc;
102
121
  }
@@ -121,6 +140,26 @@ class QueryExecutor {
121
140
  query = result;
122
141
  }
123
142
  }
143
+ // Always request locale fallback. Without `include_fallback=true`, an
144
+ // entry that exists only in the master locale won't appear in a query
145
+ // scoped to a non-master locale (e.g. `ar`) — which is why bound queries
146
+ // returned `{ entries: [], count: 0 }` for compositions authored in
147
+ // a master-locale-only stack. Apply for both JS SDK (`addQuery`) and
148
+ // TS/CMA SDK (`addParams`) flavors; use whichever method the query
149
+ // exposes. Runs unconditionally so it covers the case where locale
150
+ // comes from stack config (not from `options.locale` override) — that's
151
+ // the path that produced the `locale=ar&include_count=true` URL without
152
+ // `include_fallback=true`.
153
+ if (typeof query.addQuery === "function") {
154
+ const r = query.addQuery("include_fallback", true);
155
+ if (r)
156
+ query = r;
157
+ }
158
+ else if (typeof query.addParams === "function") {
159
+ const r = query.addParams({ include_fallback: true });
160
+ if (r)
161
+ query = r;
162
+ }
124
163
  if (options?.variantAlias && typeof query.variants === "function") {
125
164
  const result = query.variants(options.variantAlias);
126
165
  if (result) {
@@ -219,37 +258,102 @@ class QueryExecutor {
219
258
  }
220
259
  }
221
260
  }
222
- // 4. Apply all params - try addParam first, then individual methods
261
+ // 4. Apply all params.
262
+ // Pagination and sort params must use dedicated SDK methods — the TS delivery SDK
263
+ // ignores these when passed via addParams(). All other params go through addParam
264
+ // (JS SDK) or addParams (TS SDK). Keys handled via dedicated methods are skipped
265
+ // in the generic loop to avoid double-application.
223
266
  if (params && Object.keys(params).length > 0) {
267
+ const dedicatedKeys = new Set();
268
+ // limit / skip — dedicated methods on both JS and TS SDKs
269
+ if (params.limit !== undefined && typeof query.limit === "function") {
270
+ const r = query.limit(Number(params.limit));
271
+ if (r)
272
+ query = r;
273
+ dedicatedKeys.add("limit");
274
+ }
275
+ if (params.skip !== undefined && typeof query.skip === "function") {
276
+ const r = query.skip(Number(params.skip));
277
+ if (r)
278
+ query = r;
279
+ dedicatedKeys.add("skip");
280
+ }
281
+ // sort descending — TS SDK uses orderByDescending(); JS SDK uses addParam/addQuery
282
+ if (params.desc !== undefined) {
283
+ if (typeof query.orderByDescending === "function") {
284
+ const r = query.orderByDescending(String(params.desc));
285
+ if (r)
286
+ query = r;
287
+ dedicatedKeys.add("desc");
288
+ }
289
+ else if (typeof query.descending === "function") {
290
+ const r = query.descending(String(params.desc));
291
+ if (r)
292
+ query = r;
293
+ dedicatedKeys.add("desc");
294
+ }
295
+ }
296
+ // sort ascending — same pattern
297
+ if (params.asc !== undefined) {
298
+ if (typeof query.orderByAscending === "function") {
299
+ const r = query.orderByAscending(String(params.asc));
300
+ if (r)
301
+ query = r;
302
+ dedicatedKeys.add("asc");
303
+ }
304
+ else if (typeof query.ascending === "function") {
305
+ const r = query.ascending(String(params.asc));
306
+ if (r)
307
+ query = r;
308
+ dedicatedKeys.add("asc");
309
+ }
310
+ }
311
+ // Generic loop for remaining params
224
312
  for (const [key, value] of Object.entries(params)) {
225
313
  if (value === undefined || value === null)
226
314
  continue;
227
- if (key === "include" && includeAppliedViaReference) {
315
+ if (dedicatedKeys.has(key))
316
+ continue;
317
+ if (key === "include" && includeAppliedViaReference)
228
318
  continue;
229
- }
230
319
  let paramValue = value;
231
320
  if (key === "include" &&
232
321
  !includeAppliedViaReference &&
233
322
  Array.isArray(value)) {
234
323
  paramValue = value.join(",");
235
324
  }
236
- // Try addParam first (supported by some SDKs)
237
- if (typeof query.addParam === "function") {
238
- const result = query.addParam(key, paramValue);
325
+ // JS SDK: addParam(key, value) — singular, but returns undefined (no-op on Query objects).
326
+ // Fall through to addQuery when addParam is present but ineffective.
327
+ let paramApplied = false;
328
+ if (typeof query.addParams === "function") {
329
+ // TS delivery SDK: addParams({ key: value }) — for arbitrary params
330
+ const result = query.addParams({ [key]: paramValue });
239
331
  if (result) {
240
332
  query = result;
333
+ paramApplied = true;
241
334
  }
242
335
  }
243
- else {
244
- // Fallback: try calling the method directly (e.g., query.limit(10))
245
- const methodName = key;
246
- if (typeof query[methodName] === "function") {
247
- const result = query[methodName](paramValue);
248
- if (result) {
249
- query = result;
250
- }
336
+ else if (typeof query.addParam === "function") {
337
+ const result = query.addParam(key, paramValue);
338
+ if (result) {
339
+ query = result;
340
+ paramApplied = true;
251
341
  }
252
342
  }
343
+ if (!paramApplied && typeof query.addQuery === "function") {
344
+ // JS SDK Query object: addParam returns undefined (no-op); addQuery
345
+ // survives toJSON() — matches the stack-sdk-wrapper.ts pattern.
346
+ const result = query.addQuery(key, paramValue);
347
+ if (result)
348
+ query = result;
349
+ paramApplied = true;
350
+ }
351
+ if (!paramApplied && typeof query[key] === "function") {
352
+ // Last resort: named method (rare)
353
+ const result = query[key](paramValue);
354
+ if (result)
355
+ query = result;
356
+ }
253
357
  }
254
358
  }
255
359
  // 5. Include count in results
@@ -259,13 +363,64 @@ class QueryExecutor {
259
363
  query = result;
260
364
  }
261
365
  }
262
- // 6. Convert to JSON (for JS SDK and taxonomy queries) - only if query still exists and has the method
263
- if (query && typeof query.toJSON === "function") {
264
- // For taxonomy queries, always call toJSON() before find()
265
- // For content type queries, only call toJSON() for JS SDK
266
- if (sourceType === "taxonomy" ||
267
- (this.isJavaScriptSDK() && sourceType === "content_type")) {
268
- query = query.toJSON();
366
+ // 6. Convert to JSON before .find() — JS SDK only.
367
+ //
368
+ // The legacy JS SDK's `find()` otherwise wraps each entry via the bundled
369
+ // `Result` class, and contentstack 3.27.0's bundle calls that class
370
+ // without `new` — throwing "Cannot call a class as a function". `toJSON()`
371
+ // sets an internal `tojson` flag which short-circuits that wrapping.
372
+ //
373
+ // Do NOT call toJSON on the TS delivery-sdk path. Earlier comment
374
+ // claimed it was a "no-op pass-through" — that's no longer true after
375
+ // delivery-sdk's qs upgrade (3.26.4+).
376
+ if (this.isJavaScriptSDK() && query && typeof query.toJSON === "function") {
377
+ const r = query.toJSON();
378
+ if (r)
379
+ query = r;
380
+ }
381
+ // Hoist `include` from the MongoDB query bag (`_query.include`) to the
382
+ // URL params bag (`_queryParams["include[]"]`). The legacy JS SDK's
383
+ // `Query().find()` URL builder serialises `_query.include = [path]` as
384
+ // `?include=path` (no brackets) — CDA rejects that with
385
+ // `{ include: ["should be an array of field paths"] }`. The single-entry
386
+ // path (`Entry.fetch()`) writes references to `_queryParams["include[]"]`
387
+ // directly and produces the correct `?include[]=path&include[]=path2`
388
+ // form. Moving the value across after `includeReference()` makes the
389
+ // collection path emit the same URL shape.
390
+ // Cross-SDK include-reference URL fixups.
391
+ //
392
+ // - JS SDK (legacy `contentstack` package): `Query().find()` URL builder
393
+ // serialises `_query.include = [path]` as `?include=path` (no brackets)
394
+ // under the bundled qs default. CDA rejects with
395
+ // `{ include: ["should be an array of field paths"] }`. Rename the
396
+ // key to `include[]` so qs emits the bracket form. (Used to bypass the
397
+ // regression introduced by qs's upgrade in contentstack 3.26.4+.)
398
+ //
399
+ // - TS SDK (`@contentstack/delivery-sdk`): `Entries#includeReference()`
400
+ // writes to `_queryParams["include[]"]` with a literal `[]` in the
401
+ // key, while `@contentstack/core`'s param-serializer uses
402
+ // `Qs.stringify(..., { arrayFormat: "brackets" })` which adds another
403
+ // `[]` for array values — producing `?include[][]=path` (rejected by
404
+ // CDA). Move the array back to the unbracketed `include` key so qs
405
+ // adds exactly one `[]`, matching the working CMA single-entry URL.
406
+ if (includeAppliedViaReference &&
407
+ referenceIncludePaths.length > 0 &&
408
+ query &&
409
+ typeof query === "object") {
410
+ const q = query;
411
+ if (this.isJavaScriptSDK()) {
412
+ if (q._query && typeof q._query === "object" && "include" in q._query) {
413
+ delete q._query.include;
414
+ }
415
+ if (q._query && typeof q._query === "object") {
416
+ q._query["include[]"] = referenceIncludePaths.slice();
417
+ }
418
+ }
419
+ else if (q._queryParams && typeof q._queryParams === "object") {
420
+ if ("include[]" in q._queryParams) {
421
+ delete q._queryParams["include[]"];
422
+ }
423
+ q._queryParams.include = referenceIncludePaths.slice();
269
424
  }
270
425
  }
271
426
  // 7. Execute
@@ -1 +1 @@
1
- {"version":3,"file":"query-executor.js","sources":["../../src/query/query-executor.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAQA;AACA,SAAS,8BAA8B,CAAC,OAAgB,EAAA;AACtD,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7D;AACA,IAAA,IAAI,OAAO,OAAO,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OAAO,CAAC,KAAK,CAAC,EACrB;;AAEA,gBAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,OAAO,CAAC;YAChE;AAAO,iBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;AAE/B,gBAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAC,KAAK;sBACT,IAAI,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO;AAC3C,sBAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAChD;YACH;iBAAO;;AAEL,gBAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;YACjE;QACF;AAEA,QAAA,OAAO,QAAQ;IACjB;AACD;;;;"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared section-UI walker for section-slot context resolution.
3
+ *
4
+ * Sections expose `section-slot` placeholders inside their authored UI. When
5
+ * those slots are filled on a page composition, the slot children render
6
+ * inside the section's body — surrounded by whatever Repeater /
7
+ * ConditionBlock chain wraps the matching `section-slot` in the section's
8
+ * authored UI.
9
+ *
10
+ * Three call sites historically each rolled their own walker:
11
+ *
12
+ * - Studio's `findSectionCompositionInstances` (auto-binder) — needs
13
+ * parentRepeaterUid + cumulative schema-path segments for the
14
+ * auto-binder's contextSchemaPath input.
15
+ * - Studio's picker `getRepeatersWrappingSectionSlot` — needs the actual
16
+ * Repeater node references for a SPECIFIC slot (to feed the picker's
17
+ * repeater adapters and to surface the section title as the picker
18
+ * header label).
19
+ * - SDK's `indexSectionInternalSlotRepeaters` — needs only the nearest
20
+ * ancestor Repeater uid per slot, for the per-instance binding seeder.
21
+ *
22
+ * All three did the same walk with different output shapes. This module
23
+ * does the walk ONCE and exposes the raw ancestor-node chain per slot;
24
+ * each consumer derives the shape it needs. Lives in `studio-internal`
25
+ * because that's the only SDK package both Studio and the SDK packages
26
+ * symlink to.
27
+ */
28
+ /**
29
+ * Walks `sectionUI` and returns, for every `section-slot` encountered, the
30
+ * chain of ancestor Repeater and ConditionBlock nodes wrapping it.
31
+ *
32
+ * The returned arrays preserve root→leaf order so callers can either
33
+ * - read the LAST entry as the nearest ancestor (e.g. parentRepeaterUid), or
34
+ * - join their bindings to derive the cumulative schema path.
35
+ *
36
+ * Returns a map keyed by section-slot uid. If a slot uid is missing from the
37
+ * map the slot isn't wrapped by any Repeater / ConditionBlock in the section
38
+ * (or doesn't exist in this section).
39
+ */
40
+ function indexSectionSlotContexts(sectionUI) {
41
+ const out = {};
42
+ const walk = (node, ancestors) => {
43
+ if (!node || typeof node !== "object")
44
+ return;
45
+ if (node.type === "section-slot" && typeof node.uid === "string") {
46
+ out[node.uid] = { ancestorNodes: ancestors };
47
+ }
48
+ const nextAncestors = node.type === "repeater" || node.type === "condition-block"
49
+ ? [...ancestors, node]
50
+ : ancestors;
51
+ const slots = node.slots || {};
52
+ for (const slotId of Object.keys(slots)) {
53
+ for (const child of slots[slotId] || []) {
54
+ walk(child, nextAncestors);
55
+ }
56
+ }
57
+ };
58
+ walk(sectionUI, []);
59
+ return out;
60
+ }
61
+
62
+ export { indexSectionSlotContexts };
63
+ //# sourceMappingURL=section-slot-walker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-slot-walker.js","sources":["../../../../../studio-internal/dist/utils/section-slot-walker.js"],"sourcesContent":["/**\n * Shared section-UI walker for section-slot context resolution.\n *\n * Sections expose `section-slot` placeholders inside their authored UI. When\n * those slots are filled on a page composition, the slot children render\n * inside the section's body — surrounded by whatever Repeater /\n * ConditionBlock chain wraps the matching `section-slot` in the section's\n * authored UI.\n *\n * Three call sites historically each rolled their own walker:\n *\n * - Studio's `findSectionCompositionInstances` (auto-binder) — needs\n * parentRepeaterUid + cumulative schema-path segments for the\n * auto-binder's contextSchemaPath input.\n * - Studio's picker `getRepeatersWrappingSectionSlot` — needs the actual\n * Repeater node references for a SPECIFIC slot (to feed the picker's\n * repeater adapters and to surface the section title as the picker\n * header label).\n * - SDK's `indexSectionInternalSlotRepeaters` — needs only the nearest\n * ancestor Repeater uid per slot, for the per-instance binding seeder.\n *\n * All three did the same walk with different output shapes. This module\n * does the walk ONCE and exposes the raw ancestor-node chain per slot;\n * each consumer derives the shape it needs. Lives in `studio-internal`\n * because that's the only SDK package both Studio and the SDK packages\n * symlink to.\n */\n/**\n * Walks `sectionUI` and returns, for every `section-slot` encountered, the\n * chain of ancestor Repeater and ConditionBlock nodes wrapping it.\n *\n * The returned arrays preserve root→leaf order so callers can either\n * - read the LAST entry as the nearest ancestor (e.g. parentRepeaterUid), or\n * - join their bindings to derive the cumulative schema path.\n *\n * Returns a map keyed by section-slot uid. If a slot uid is missing from the\n * map the slot isn't wrapped by any Repeater / ConditionBlock in the section\n * (or doesn't exist in this section).\n */\nfunction indexSectionSlotContexts(sectionUI) {\n const out = {};\n const walk = (node, ancestors) => {\n if (!node || typeof node !== \"object\")\n return;\n if (node.type === \"section-slot\" && typeof node.uid === \"string\") {\n out[node.uid] = { ancestorNodes: ancestors };\n }\n const nextAncestors = node.type === \"repeater\" || node.type === \"condition-block\"\n ? [...ancestors, node]\n : ancestors;\n const slots = node.slots || {};\n for (const slotId of Object.keys(slots)) {\n for (const child of slots[slotId] || []) {\n walk(child, nextAncestors);\n }\n }\n };\n walk(sectionUI, []);\n return out;\n}\n\nexport { indexSectionSlotContexts };\n//# sourceMappingURL=section-slot-walker.js.map\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,CAAC,SAAS,EAAE;AAC7C,IAAI,MAAM,GAAG,GAAG,EAAE;AAClB,IAAI,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,SAAS,KAAK;AACtC,QAAQ,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;AAC7C,YAAY;AACZ,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,EAAE;AAC1E,YAAY,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE;AACxD,QAAQ;AACR,QAAQ,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK;AACxE,cAAc,CAAC,GAAG,SAAS,EAAE,IAAI;AACjC,cAAc,SAAS;AACvB,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;AACtC,QAAQ,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACjD,YAAY,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;AACrD,gBAAgB,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC;AAC1C,YAAY;AACZ,QAAQ;AACR,IAAI,CAAC;AACL,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;AACvB,IAAI,OAAO,GAAG;AACd;;;;"}
@@ -1,4 +1,4 @@
1
- import { unzlibSync } from '../../../../node_modules/fflate/esm/browser.js';
1
+ import { unzlibSync } from 'fflate';
2
2
 
3
3
  /**
4
4
  * Decompress a UI spec from storage.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-compression.js","sources":["../../../../../studio-internal/dist/utils/spec-compression.js"],"sourcesContent":["import { zlibSync, unzlibSync } from 'fflate';\n\n/**\n * Compress a UI spec using zlib compression for storage.\n *\n * The compressed output is base64-encoded and prefixed with \"zlib:\" for format detection.\n * This achieves 77-90% size reduction on typical UI specs.\n * Uses fflate library which works in both Node.js and browser environments.\n *\n * @param spec - The UI spec Node to compress\n * @returns Base64-encoded compressed string prefixed with \"zlib:\"\n *\n * @example\n * const compressed = compressSpec(editor.getUI());\n * // Returns: \"zlib:eJzt3Vtv2...\"\n */\nfunction compressSpec(spec) {\n const json = JSON.stringify(spec);\n const encoder = new TextEncoder();\n const uint8Array = encoder.encode(json);\n // Level 9 = max compression\n const compressed = zlibSync(uint8Array, { level: 9 });\n // Convert to base64\n const base64 = btoa(String.fromCharCode(...compressed));\n return \"zlib:\" + base64;\n}\n/**\n * Decompress a UI spec from storage.\n *\n * Automatically detects and handles both formats:\n * - Compressed format: \"zlib:...\" (base64-encoded zlib)\n * - Legacy format: Raw JSON string\n *\n * This provides backward compatibility with existing uncompressed specs.\n *\n * @param data - Compressed or legacy JSON string from storage\n * @returns Parsed Node object\n *\n * @example\n * // Compressed format\n * const spec = decompressSpec(\"zlib:eJzt3Vtv2...\");\n *\n * // Legacy format (backward compatible)\n * const spec = decompressSpec('{\"uid\":\"abc\",\"type\":\"page\",...}');\n */\nfunction decompressSpec(data) {\n // Detect compressed format\n if (data.startsWith(\"zlib:\")) {\n const base64 = data.slice(5);\n // Decode base64 to Uint8Array\n const binaryString = atob(base64);\n const uint8Array = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n // Decompress\n const decompressed = unzlibSync(uint8Array);\n const decoder = new TextDecoder();\n const json = decoder.decode(decompressed);\n return JSON.parse(json);\n }\n // Legacy uncompressed format\n return JSON.parse(data);\n}\n/**\n * Validate compression with round-trip test.\n * Use this during development to ensure data integrity.\n *\n * @param spec - The spec to validate\n * @returns Object with validation results\n *\n * @example\n * const result = validateCompression(editor.getUI());\n * console.log(`Compression: ${result.compressionRatio}%`);\n * console.log(`Integrity: ${result.isIdentical ? 'PASS' : 'FAIL'}`);\n */\nfunction validateCompression(spec) {\n const original = JSON.stringify(spec);\n const encoder = new TextEncoder();\n const originalSize = encoder.encode(original).length;\n // Compress\n const compressed = compressSpec(spec);\n const compressedSize = encoder.encode(compressed).length;\n // Decompress\n const restored = decompressSpec(compressed);\n const restoredStr = JSON.stringify(restored);\n // Verify integrity\n const isIdentical = original === restoredStr;\n const compressionRatio = parseFloat(((1 - compressedSize / originalSize) * 100).toFixed(2));\n return {\n originalSize,\n compressedSize,\n compressionRatio,\n isIdentical,\n };\n}\n\nexport { compressSpec, decompressSpec, validateCompression };\n//# sourceMappingURL=spec-compression.js.map\n"],"names":[],"mappings":";;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,IAAI,EAAE;AAC9B;AACA,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AAClC,QAAQ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACpC;AACA,QAAQ,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;AACzC,QAAQ,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC;AAC9D,QAAQ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACtD,YAAY,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AACtD,QAAQ;AACR;AACA,QAAQ,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC;AACnD,QAAQ,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACzC,QAAQ,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;AACjD,QAAQ,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAC/B,IAAI;AACJ;AACA,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAC3B;;;;"}
@@ -0,0 +1,124 @@
1
+ import { COMPOSITION_PREVIEW_URL_SOURCES } from './types.js';
2
+
3
+ /** Non-empty predicate for scalar entry fields. */
4
+ const NON_EMPTY = {
5
+ $nin: ["", null],
6
+ };
7
+ /** Existence predicate for taxonomy variables (entry has at least one term). */
8
+ const TAXONOMY_EXISTS = { $exists: true };
9
+ /**
10
+ * Build the plain JSON query object for a composition's URL metadata.
11
+ *
12
+ * Shared between the SDK (production composition resolution) and the Studio
13
+ * UI (iframe-URL preview-entry fetch). The SDK passes the returned object (possibly
14
+ * wrapped in an `$or` by `buildTemplateQuery`) to `ctQuery({ query })`; the UI
15
+ * stringifies it and passes it to `api.cma.entry.getAll` via the `query` param.
16
+ *
17
+ * In `existence` mode for `legacy_url` and `content_type_url_pattern` the
18
+ * object is `{ url: { $nin: ["", null] } }` regardless of `extractedVariables`.
19
+ */
20
+ function buildUrlMetadataQueryObject(context, mode = "match") {
21
+ const { url_source, compositionQuery, extractedVariables } = context;
22
+ const query = {};
23
+ if (url_source === COMPOSITION_PREVIEW_URL_SOURCES.CONTENT_TYPE_URL_PATTERN ||
24
+ url_source === COMPOSITION_PREVIEW_URL_SOURCES.LEGACY_URL) {
25
+ if (mode === "existence") {
26
+ query.url = { ...NON_EMPTY };
27
+ }
28
+ else if (compositionQuery.url) {
29
+ query.url = compositionQuery.url;
30
+ }
31
+ return query;
32
+ }
33
+ // Pattern-based sources: emit one predicate per entry-field / taxonomy.
34
+ for (const [fieldName, fieldValue] of Object.entries(extractedVariables.fields)) {
35
+ if (isReferenceFieldValue(fieldValue)) {
36
+ query[fieldName] = {
37
+ $in_query: buildReferencePredicate(fieldValue, mode),
38
+ };
39
+ }
40
+ else {
41
+ query[fieldName] = mode === "existence" ? { ...NON_EMPTY } : fieldValue;
42
+ }
43
+ }
44
+ for (const taxonomyUid of Object.keys(extractedVariables.taxonomies)) {
45
+ const field = `taxonomies.${taxonomyUid}`;
46
+ query[field] =
47
+ mode === "existence"
48
+ ? { ...TAXONOMY_EXISTS }
49
+ : extractedVariables.taxonomies[taxonomyUid];
50
+ }
51
+ return query;
52
+ }
53
+ function isReferenceFieldValue(value) {
54
+ return typeof value === "object" && value !== null;
55
+ }
56
+ function buildReferencePredicate(ref, mode) {
57
+ const predicate = {};
58
+ for (const [field, value] of Object.entries(ref)) {
59
+ predicate[field] = mode === "existence" ? { ...NON_EMPTY } : value;
60
+ }
61
+ return predicate;
62
+ }
63
+ /**
64
+ * Build the full template-entry query as a single raw query object and hand it
65
+ * to `ctQuery({ query })`.
66
+ *
67
+ * Unlike the old per-field `where()` chaining, this builds one object so it can
68
+ * express a top-level `$or` and embed `taxonomies.<uid>` directly (the dedicated
69
+ * `applyTaxonomyFilters`/`Taxonomies()` path cannot compose inside an `$or`).
70
+ *
71
+ * For `{{entry.url}}` in a pattern-based source (match mode), the query becomes
72
+ * `{ $or: [ <per-field decomposition>, { url: <full request path> } ] }` so the
73
+ * `url` field matches the whole request path as well as the captured segment —
74
+ * the prefix-duplication / bare-`/{{entry.url}}` case. Other sources and modes
75
+ * pass the per-field object unchanged.
76
+ */
77
+ function buildTemplateQuery(stackSdk, context, queryOptions, mode = "match") {
78
+ const { parsedUrlQueries, connectedContentType, extractedVariables, url_source, } = context;
79
+ const queryObject = buildUrlMetadataQueryObject(context, mode);
80
+ // Full-path `$or` branch for `{{entry.url}}` (entry.url-only for now). The
81
+ // `url` field holds the full path, so we match it against the whole request
82
+ // path as well as the captured fragment. See COMS-1487 (decisions doc §4.5)
83
+ // for why `entry.url` is treated specially.
84
+ const isPatternSource = url_source !== COMPOSITION_PREVIEW_URL_SOURCES.CONTENT_TYPE_URL_PATTERN &&
85
+ url_source !== COMPOSITION_PREVIEW_URL_SOURCES.LEGACY_URL;
86
+ const hasEntryUrl = typeof extractedVariables.fields.url === "string" ||
87
+ typeof extractedVariables.fields.url === "number";
88
+ const finalQuery = mode === "match" &&
89
+ isPatternSource &&
90
+ hasEntryUrl &&
91
+ extractedVariables.requestPath
92
+ ? { $or: [queryObject, { url: extractedVariables.requestPath }] }
93
+ : queryObject;
94
+ return stackSdk
95
+ .ctQuery(connectedContentType, {
96
+ references: [
97
+ ...queryOptions.references,
98
+ ...parsedUrlQueries.include,
99
+ ].filter((v, i, arr) => arr.indexOf(v) === i),
100
+ only: queryOptions.only,
101
+ variantAlias: queryOptions.variantAlias,
102
+ locale: queryOptions.locale,
103
+ branch: queryOptions.branch,
104
+ environment: queryOptions.environment,
105
+ query: finalQuery,
106
+ })
107
+ .limit(1);
108
+ }
109
+ /**
110
+ * Resolve template entry based on url_source type and query context
111
+ */
112
+ function resolveByUrlSource(stackSdk, url_source, compositionQuery, extractedVariables, parsedUrlQueries, connectedContentType, queryOptions) {
113
+ const context = {
114
+ compositionQuery,
115
+ extractedVariables,
116
+ parsedUrlQueries,
117
+ connectedContentType,
118
+ url_source: url_source,
119
+ };
120
+ return buildTemplateQuery(stackSdk, context, queryOptions);
121
+ }
122
+
123
+ export { buildTemplateQuery, buildUrlMetadataQueryObject, resolveByUrlSource };
124
+ //# sourceMappingURL=build-template-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-template-query.js","sources":["../../src/url-metadata/build-template-query.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAoBA;AACA,MAAM,SAAS,GAA2C;AACxD,IAAA,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;CACjB;AAED;AACA,MAAM,eAAe,GAAsB,EAAE,OAAO,EAAE,IAAI,EAAE;AAE5D;;;;;;;;;;AAUG;SACa,2BAA2B,CACzC,OAGC,EACD,OAA6B,OAAO,EAAA;IAEpC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,OAAO;IACpE,MAAM,KAAK,GAAwB,EAAE;AAErC,IAAA,IACE,UAAU,KAAK,+BAA+B,CAAC,wBAAwB;AACvE,QAAA,UAAU,KAAK,+BAA+B,CA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AAY,CAAC,YAAY;QACvC,MAAM,EAAE,YAAY,CAAC,MAAM;QAC3B,MAAM,EAAE,YAAY,CAAC,MAAM;QAC3B,WAAW,EAAE,YAAY,CAAC,WAAW;AACrC,QAAA,KAAK,EAAE,UAAU;KAClB;SACA,KAAK,CAAC,CAAC,CAAC;AACb;AAEA;;AAEG;AACG,SAAU,kBAAkB,CAChC,QAAkB,EAClB,UAAkB,EAClB,gBAAkC,EAClC,kBAAgD,EAChD,gBAAuC,EACvC,oBAA4B,EAC5B,YAOC,EAAA;AAED,IAAA,MAAM,OAAO,GAAyB;QACpC,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;QAChB,oBAAoB;AACpB,QAAA,UAAU,EAAE,UAA+C;KAC5D;IAED,OAAO,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC;AAC5D;;;;"}
@@ -0,0 +1,75 @@
1
+ import { COMPOSITION_PREVIEW_URL_SOURCES, COMPOSITION_PREVIEW_URL_SOURCES_VALUES } from './types.js';
2
+
3
+ /**
4
+ * Parse and validate url_metadata field from a composition entry
5
+ * Returns parsed metadata or legacy object if metadata is missing, malformed, or legacy
6
+ */
7
+ function parseUrlMetadata(url_metadata) {
8
+ const legacyMetadata = {
9
+ url_source: COMPOSITION_PREVIEW_URL_SOURCES.LEGACY_URL,
10
+ url_queries: {
11
+ include: [],
12
+ only: {},
13
+ where: {},
14
+ },
15
+ };
16
+ if (!url_metadata || !url_metadata.url_source) {
17
+ // Default to legacy behavior when no metadata provided
18
+ return legacyMetadata;
19
+ }
20
+ // Legacy or unknown url_source — return consistent legacy object
21
+ if (url_metadata.url_source === COMPOSITION_PREVIEW_URL_SOURCES.LEGACY_URL ||
22
+ !COMPOSITION_PREVIEW_URL_SOURCES_VALUES.includes(url_metadata.url_source)) {
23
+ return legacyMetadata;
24
+ }
25
+ let parsedQueries;
26
+ try {
27
+ if (typeof url_metadata.url_queries === "string") {
28
+ parsedQueries = JSON.parse(url_metadata.url_queries);
29
+ }
30
+ else if (url_metadata.url_queries) {
31
+ parsedQueries = url_metadata.url_queries;
32
+ }
33
+ else {
34
+ // Default empty structure if no url_queries
35
+ parsedQueries = {
36
+ include: [],
37
+ only: {},
38
+ where: {},
39
+ };
40
+ }
41
+ }
42
+ catch {
43
+ // Invalid JSON in url_queries - fall back to legacy
44
+ return legacyMetadata;
45
+ }
46
+ // Validate parsed queries structure
47
+ if (typeof parsedQueries !== "object" || parsedQueries === null) {
48
+ return legacyMetadata;
49
+ }
50
+ // Ensure required fields exist with defaults
51
+ const safeQueries = {
52
+ include: Array.isArray(parsedQueries.include) ? parsedQueries.include : [],
53
+ only: typeof parsedQueries.only === "object" && parsedQueries.only !== null
54
+ ? parsedQueries.only
55
+ : {},
56
+ where: typeof parsedQueries.where === "object" && parsedQueries.where !== null
57
+ ? parsedQueries.where
58
+ : {},
59
+ };
60
+ return {
61
+ url_source: url_metadata.url_source,
62
+ url_queries: safeQueries,
63
+ };
64
+ }
65
+ /**
66
+ * Check if a composition entry has taxonomy extraction enabled
67
+ * Returns true if only.BASE includes "taxonomies"
68
+ */
69
+ function shouldExtractTaxonomies(parsedMetadata) {
70
+ const baseFields = parsedMetadata.url_queries.only?.BASE;
71
+ return Array.isArray(baseFields) && baseFields.includes("taxonomies");
72
+ }
73
+
74
+ export { parseUrlMetadata, shouldExtractTaxonomies };
75
+ //# sourceMappingURL=parse-url-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-url-metadata.js","sources":["../../src/url-metadata/parse-url-metadata.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA;;;AAGG;AACG,SAAU,gBAAgB,CAC9B,YAAwD,EAAA;AAExD,IAAA,MAAM,cAAc,GAAG;QACrB,UAAU,EAAE,+BAA+B,CAAC,UAAU;AACtD,QAAA,WAAW,EAAE;AACX,YAAA,OAAO,EAAE,EAAE;AACX,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE;AACV,SAAA;KACF;I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