@contentstack/studio-client 1.4.0 → 1.5.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.
- package/dist/breakpoints/BreakpointManager.js +17 -5
- package/dist/breakpoints/BreakpointManager.js.map +1 -1
- package/dist/canvas/canvas.utils.js +1 -1
- package/dist/canvas/canvas.utils.js.map +1 -1
- package/dist/composable-studio/build-scoped-data.js +101 -0
- package/dist/composable-studio/build-scoped-data.js.map +1 -0
- package/dist/composable-studio/collect-data-needs.js +226 -0
- package/dist/composable-studio/collect-data-needs.js.map +1 -0
- package/dist/composable-studio/composition-placement.types.js +7 -0
- package/dist/composable-studio/composition-placement.types.js.map +1 -0
- package/dist/composable-studio/initializer-sdk.js +1 -9
- package/dist/composable-studio/initializer-sdk.js.map +1 -1
- package/dist/composable-studio/sdk.js +1551 -195
- package/dist/composable-studio/sdk.js.map +1 -1
- package/dist/composable-studio/studio-intelligence.manager.js +124 -0
- package/dist/composable-studio/studio-intelligence.manager.js.map +1 -0
- package/dist/config/config.schema.js +10 -0
- package/dist/config/config.schema.js.map +1 -1
- package/dist/config/default-config.js +1 -0
- package/dist/config/default-config.js.map +1 -1
- package/dist/config/process-user-config.js +6 -0
- package/dist/config/process-user-config.js.map +1 -1
- package/dist/config/stack-sdk-wrapper.js +87 -2
- package/dist/config/stack-sdk-wrapper.js.map +1 -1
- package/dist/design/handle-active-style-change.js +0 -3
- package/dist/design/handle-active-style-change.js.map +1 -1
- package/dist/dnd/dnd-manager.js +25 -7
- package/dist/dnd/dnd-manager.js.map +1 -1
- package/dist/dnd/{utils.js → scroll-utils.js} +2 -27
- package/dist/dnd/scroll-utils.js.map +1 -0
- package/dist/hidden-element-notification/hidden-element-notification-event.js +7 -0
- package/dist/hidden-element-notification/hidden-element-notification-event.js.map +1 -1
- package/dist/highlight-node/highlight-node-manager.js +7 -1
- package/dist/highlight-node/highlight-node-manager.js.map +1 -1
- package/dist/highlight-node/highlight-node.js +38 -18
- package/dist/highlight-node/highlight-node.js.map +1 -1
- package/dist/index.d.ts +618 -31
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/node_modules/fflate/esm/browser.js +384 -0
- package/dist/node_modules/fflate/esm/browser.js.map +1 -0
- package/dist/packages/studio-internal/dist/utils/spec-compression.js +43 -0
- package/dist/packages/studio-internal/dist/utils/spec-compression.js.map +1 -0
- package/dist/query/expression-resolver.js +124 -0
- package/dist/query/expression-resolver.js.map +1 -0
- package/dist/query/query-executor.js +482 -0
- package/dist/query/query-executor.js.map +1 -0
- package/dist/shared/dnd-events.js +39 -0
- package/dist/shared/dnd-events.js.map +1 -0
- package/dist/url-change/url-change.js +65 -0
- package/dist/url-change/url-change.js.map +1 -0
- package/dist/url-metadata/build-template-query.js +124 -0
- package/dist/url-metadata/build-template-query.js.map +1 -0
- package/dist/url-metadata/parse-url-metadata.js +75 -0
- package/dist/url-metadata/parse-url-metadata.js.map +1 -0
- package/dist/url-metadata/rank-url-matches.js +100 -0
- package/dist/url-metadata/rank-url-matches.js.map +1 -0
- package/dist/url-metadata/select-url-winner.js +45 -0
- package/dist/url-metadata/select-url-winner.js.map +1 -0
- package/dist/url-metadata/shouldUseUrlMetadataPath.js +22 -0
- package/dist/url-metadata/shouldUseUrlMetadataPath.js.map +1 -0
- package/dist/url-metadata/types.js +50 -0
- package/dist/url-metadata/types.js.map +1 -0
- package/dist/url-metadata/url-pattern-matcher.js +311 -0
- package/dist/url-metadata/url-pattern-matcher.js.map +1 -0
- package/dist/utils/build-composition-fetch-query.js +19 -0
- package/dist/utils/build-composition-fetch-query.js.map +1 -0
- package/dist/utils/composable-studio-error.js +1 -0
- package/dist/utils/composable-studio-error.js.map +1 -1
- package/dist/utils/conditionBlock.js +17 -5
- package/dist/utils/conditionBlock.js.map +1 -1
- package/dist/utils/constants.js +22 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/convertCompositionQueryInputToCompositionQuery.js +11 -1
- package/dist/utils/convertCompositionQueryInputToCompositionQuery.js.map +1 -1
- package/dist/utils/editor-utils.js +9 -0
- package/dist/utils/editor-utils.js.map +1 -1
- package/dist/utils/error-messages.default.js +1 -1
- package/dist/utils/error-messages.default.js.map +1 -1
- package/dist/utils/http-error.constants.js +11 -2
- package/dist/utils/http-error.constants.js.map +1 -1
- package/dist/utils/is-inside-iframe.js +16 -0
- package/dist/utils/is-inside-iframe.js.map +1 -0
- package/dist/utils/query-param.js +1 -1
- package/dist/utils/query-param.js.map +1 -1
- package/dist/utils/reference_fetcher.js +125 -14
- package/dist/utils/reference_fetcher.js.map +1 -1
- package/dist/utils/sdk.js +6 -1
- package/dist/utils/sdk.js.map +1 -1
- package/dist/utils/spec-analyzer.js +112 -0
- package/dist/utils/spec-analyzer.js.map +1 -0
- package/package.json +11 -10
- package/dist/dnd/utils.js.map +0 -1
- package/dist/get-composition-from-slug/get-composition-from-slug.js +0 -59
- package/dist/get-composition-from-slug/get-composition-from-slug.js.map +0 -1
- package/dist/utils/get-url-patterns.js +0 -40
- package/dist/utils/get-url-patterns.js.map +0 -1
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import { ExpressionResolver } from './expression-resolver.js';
|
|
2
|
+
|
|
3
|
+
/** Reference paths for Delivery/CMA TS SDK — must use includeReference() before .query() */
|
|
4
|
+
function normalizeReferenceIncludeParam(include) {
|
|
5
|
+
if (Array.isArray(include)) {
|
|
6
|
+
return include.map((s) => String(s).trim()).filter(Boolean);
|
|
7
|
+
}
|
|
8
|
+
if (typeof include === "string") {
|
|
9
|
+
return include
|
|
10
|
+
.split(",")
|
|
11
|
+
.map((s) => s.trim())
|
|
12
|
+
.filter(Boolean);
|
|
13
|
+
}
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
class QueryExecutor {
|
|
17
|
+
sdk;
|
|
18
|
+
expressionResolver = new ExpressionResolver();
|
|
19
|
+
constructor(sdk) {
|
|
20
|
+
this.sdk = sdk;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Detection logic:
|
|
24
|
+
* 1. If 'contentType' (lowercase) exists in object or prototype, it's likely TS SDK or CMA SDK.
|
|
25
|
+
* 2. If 'ContentType' (uppercase) exists AND 'contentType' doesn't, it's likely legacy JS Delivery SDK.
|
|
26
|
+
*/
|
|
27
|
+
isJavaScriptSDK() {
|
|
28
|
+
if (!this.sdk)
|
|
29
|
+
return false;
|
|
30
|
+
const hasLower = "contentType" in this.sdk || typeof this.sdk.contentType === "function";
|
|
31
|
+
const hasUpper = "ContentType" in this.sdk || typeof this.sdk.ContentType === "function";
|
|
32
|
+
// If it has lowercase, we treat it as TS/CMA path
|
|
33
|
+
if (hasLower)
|
|
34
|
+
return false;
|
|
35
|
+
// Otherwise, if it has uppercase, it's JS legacy
|
|
36
|
+
return hasUpper;
|
|
37
|
+
}
|
|
38
|
+
/** TS @contentstack/delivery-sdk: Mongo filter must be sent via addParams({ query }), not .query(obj) */
|
|
39
|
+
usesTsContentTypeEntryQuery() {
|
|
40
|
+
return (!this.isJavaScriptSDK() && typeof this.sdk?.contentType === "function");
|
|
41
|
+
}
|
|
42
|
+
async execute(querySpec, page = 1, context = {}, options) {
|
|
43
|
+
const { contentType, sourceType = "content_type", query: mongoQuery = {}, params = {}, } = querySpec;
|
|
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"
|
|
52
|
+
? normalizeReferenceIncludeParam(params?.include)
|
|
53
|
+
: [];
|
|
54
|
+
const includeAppliedViaReference = referenceIncludePaths.length > 0;
|
|
55
|
+
// 1. Initialize SDK query
|
|
56
|
+
let query;
|
|
57
|
+
try {
|
|
58
|
+
if (sourceType === "taxonomy") {
|
|
59
|
+
// Taxonomy query path: stack.Taxonomies()
|
|
60
|
+
if (typeof this.sdk.Taxonomies === "function") {
|
|
61
|
+
query = this.sdk.Taxonomies();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
throw new Error("SDK does not support Taxonomies() method");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Content type query path
|
|
69
|
+
if (this.isJavaScriptSDK()) {
|
|
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();
|
|
78
|
+
if (includeAppliedViaReference &&
|
|
79
|
+
typeof query.includeReference === "function") {
|
|
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);
|
|
86
|
+
if (inc)
|
|
87
|
+
query = inc;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// TS/CMA SDK Path: stack.contentType(uid).entry().query()
|
|
92
|
+
// IMPORTANT: includeReference + variants BEFORE .query() (matches stack-sdk-wrapper)
|
|
93
|
+
if (typeof this.sdk.contentType === "function") {
|
|
94
|
+
let entry = this.sdk.contentType(contentType).entry();
|
|
95
|
+
if (options?.variantAlias && typeof entry.variants === "function") {
|
|
96
|
+
entry = entry.variants(options.variantAlias);
|
|
97
|
+
}
|
|
98
|
+
if (includeAppliedViaReference &&
|
|
99
|
+
typeof entry.includeReference === "function") {
|
|
100
|
+
entry = entry.includeReference(...referenceIncludePaths);
|
|
101
|
+
}
|
|
102
|
+
query = entry.query();
|
|
103
|
+
// For TS SDK, locale must be added via addParams (not .language())
|
|
104
|
+
if (options?.locale && typeof query.addParams === "function") {
|
|
105
|
+
const lr = query.addParams({
|
|
106
|
+
locale: options.locale,
|
|
107
|
+
include_fallback: true,
|
|
108
|
+
});
|
|
109
|
+
if (lr)
|
|
110
|
+
query = lr;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (typeof this.sdk.ContentType === "function") {
|
|
114
|
+
// Same canonical chain as the JS branch above for the hybrid SDK.
|
|
115
|
+
query = this.sdk.ContentType(contentType).Entry().Query();
|
|
116
|
+
if (includeAppliedViaReference &&
|
|
117
|
+
typeof query.includeReference === "function") {
|
|
118
|
+
const inc = query.includeReference(...referenceIncludePaths);
|
|
119
|
+
if (inc)
|
|
120
|
+
query = inc;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
throw new Error("SDK does not support contentType or ContentType methods");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (!query) {
|
|
129
|
+
throw new Error(`Failed to initialize query for ${sourceType}: ${contentType}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
console.error("[QueryExecutor] Failed to initialize query", e);
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
136
|
+
// Try to apply locale on query level (for JS SDK or if entry-level didn't work)
|
|
137
|
+
if (options?.locale && typeof query.language === "function") {
|
|
138
|
+
const result = query.language(options.locale);
|
|
139
|
+
if (result) {
|
|
140
|
+
query = result;
|
|
141
|
+
}
|
|
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
|
+
}
|
|
163
|
+
if (options?.variantAlias && typeof query.variants === "function") {
|
|
164
|
+
const result = query.variants(options.variantAlias);
|
|
165
|
+
if (result) {
|
|
166
|
+
query = result;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// 2. Resolve expressions in MongoDB query (only if mongoQuery exists and has keys)
|
|
170
|
+
const resolvedQuery = mongoQuery && Object.keys(mongoQuery).length > 0
|
|
171
|
+
? this.resolveExpressionsInQuery(mongoQuery, context)
|
|
172
|
+
: {};
|
|
173
|
+
// 3. Apply query conditions based on source type
|
|
174
|
+
if (Object.keys(resolvedQuery).length > 0) {
|
|
175
|
+
if (sourceType === "taxonomy") {
|
|
176
|
+
// Map MongoDB operators to taxonomy SDK methods
|
|
177
|
+
// Supported: .equalAndBelow(), .below(), .equalAndAbove(), .above()
|
|
178
|
+
for (const [field, condition] of Object.entries(resolvedQuery)) {
|
|
179
|
+
if (typeof condition === "object" &&
|
|
180
|
+
condition !== null &&
|
|
181
|
+
!Array.isArray(condition)) {
|
|
182
|
+
if (condition.$eq_below !== undefined) {
|
|
183
|
+
// .equalAndBelow("taxonomies.taxonomy_uid", "term_uid", levels)
|
|
184
|
+
const levels = condition.levels || 10;
|
|
185
|
+
if (typeof query.equalAndBelow === "function") {
|
|
186
|
+
query = query.equalAndBelow(field, condition.$eq_below, levels);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (condition.$below !== undefined) {
|
|
190
|
+
// .below("taxonomies.taxonomy_uid", "term_uid", levels)
|
|
191
|
+
const levels = condition.levels || 10;
|
|
192
|
+
if (typeof query.below === "function") {
|
|
193
|
+
query = query.below(field, condition.$below, levels);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (condition.$eq_above !== undefined) {
|
|
197
|
+
// .equalAndAbove("taxonomies.taxonomy_uid", "term_uid", levels)
|
|
198
|
+
const levels = condition.levels || 10;
|
|
199
|
+
if (typeof query.equalAndAbove === "function") {
|
|
200
|
+
query = query.equalAndAbove(field, condition.$eq_above, levels);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else if (condition.$above !== undefined) {
|
|
204
|
+
// .above("taxonomies.taxonomy_uid", "term_uid", levels)
|
|
205
|
+
const levels = condition.levels || 10;
|
|
206
|
+
if (typeof query.above === "function") {
|
|
207
|
+
query = query.above(field, condition.$above, levels);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (condition.$exists !== undefined) {
|
|
211
|
+
if (typeof query.exists === "function") {
|
|
212
|
+
query = query.exists(field, condition.$exists);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (condition.$in !== undefined) {
|
|
216
|
+
if (typeof query.where === "function") {
|
|
217
|
+
query = query.where(field, condition.$in);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
// Direct value match
|
|
222
|
+
if (typeof query.where === "function") {
|
|
223
|
+
query = query.where(field, condition);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
// Direct value match
|
|
229
|
+
if (typeof query.where === "function") {
|
|
230
|
+
query = query.where(field, condition);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (this.usesTsContentTypeEntryQuery() &&
|
|
236
|
+
typeof query.addParams === "function") {
|
|
237
|
+
const r = query.addParams({ query: resolvedQuery });
|
|
238
|
+
if (r)
|
|
239
|
+
query = r;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// Content type query: use .query() method or .where()
|
|
243
|
+
if (typeof query.query === "function") {
|
|
244
|
+
const result = query.query(resolvedQuery);
|
|
245
|
+
// Some SDKs don't return the query object from .query(), handle both cases
|
|
246
|
+
if (result) {
|
|
247
|
+
query = result;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (typeof query.where === "function") {
|
|
251
|
+
// Fallback: apply each condition using .where()
|
|
252
|
+
for (const [field, condition] of Object.entries(resolvedQuery)) {
|
|
253
|
+
const result = query.where(field, condition);
|
|
254
|
+
if (result) {
|
|
255
|
+
query = result;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
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.
|
|
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
|
|
312
|
+
for (const [key, value] of Object.entries(params)) {
|
|
313
|
+
if (value === undefined || value === null)
|
|
314
|
+
continue;
|
|
315
|
+
if (dedicatedKeys.has(key))
|
|
316
|
+
continue;
|
|
317
|
+
if (key === "include" && includeAppliedViaReference)
|
|
318
|
+
continue;
|
|
319
|
+
let paramValue = value;
|
|
320
|
+
if (key === "include" &&
|
|
321
|
+
!includeAppliedViaReference &&
|
|
322
|
+
Array.isArray(value)) {
|
|
323
|
+
paramValue = value.join(",");
|
|
324
|
+
}
|
|
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 });
|
|
331
|
+
if (result) {
|
|
332
|
+
query = result;
|
|
333
|
+
paramApplied = true;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else if (typeof query.addParam === "function") {
|
|
337
|
+
const result = query.addParam(key, paramValue);
|
|
338
|
+
if (result) {
|
|
339
|
+
query = result;
|
|
340
|
+
paramApplied = true;
|
|
341
|
+
}
|
|
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
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// 5. Include count in results
|
|
360
|
+
if (typeof query.includeCount === "function") {
|
|
361
|
+
const result = query.includeCount();
|
|
362
|
+
if (result) {
|
|
363
|
+
query = result;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
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();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// 7. Execute
|
|
427
|
+
if (!query || typeof query.find !== "function") {
|
|
428
|
+
console.error("[QueryExecutor] Query object is invalid or missing find method", { query, hasFind: query && typeof query.find === "function" });
|
|
429
|
+
return {
|
|
430
|
+
entries: [],
|
|
431
|
+
count: 0,
|
|
432
|
+
currentPage: page,
|
|
433
|
+
pageSize: params?.limit || 10,
|
|
434
|
+
hasNextPage: false,
|
|
435
|
+
hasPreviousPage: page > 1,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
const result = await query.find();
|
|
439
|
+
// 8. Extract limit for pagination calculation
|
|
440
|
+
const limit = params?.limit || 10;
|
|
441
|
+
const skip = params?.skip || (page - 1) * limit;
|
|
442
|
+
// 9. Handle result format
|
|
443
|
+
const entries = Array.isArray(result) ? result[0] : result.entries;
|
|
444
|
+
const count = Array.isArray(result) ? result[1] : result.count;
|
|
445
|
+
return {
|
|
446
|
+
entries: entries || [],
|
|
447
|
+
count: count || 0,
|
|
448
|
+
currentPage: page,
|
|
449
|
+
pageSize: limit,
|
|
450
|
+
hasNextPage: skip + limit < (count || 0),
|
|
451
|
+
hasPreviousPage: page > 1,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Helper to resolve expressions in nested query objects
|
|
456
|
+
*/
|
|
457
|
+
resolveExpressionsInQuery(query, context) {
|
|
458
|
+
const resolved = {};
|
|
459
|
+
for (const [key, value] of Object.entries(query)) {
|
|
460
|
+
if (typeof value === "object" &&
|
|
461
|
+
value !== null &&
|
|
462
|
+
!Array.isArray(value)) {
|
|
463
|
+
// Recursively resolve nested objects
|
|
464
|
+
resolved[key] = this.resolveExpressionsInQuery(value, context);
|
|
465
|
+
}
|
|
466
|
+
else if (Array.isArray(value)) {
|
|
467
|
+
// Resolve expressions in arrays
|
|
468
|
+
resolved[key] = value.map((v) => typeof v === "object"
|
|
469
|
+
? this.resolveExpressionsInQuery(v, context)
|
|
470
|
+
: this.expressionResolver.resolve(v, context));
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
// Resolve individual values
|
|
474
|
+
resolved[key] = this.expressionResolver.resolve(value, context);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return resolved;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export { QueryExecutor };
|
|
482
|
+
//# sourceMappingURL=query-executor.js.map
|
|
@@ -0,0 +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,CA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,CAC/B,KAA0B,EAC1B,OAAuB,EAAA;QAEvB,MAAM,QAAQ,GAAwB,EAAE;AAExC,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAChD,IACE,OAAO,KAAK,KAAK,QAAQ;AACzB,gBAAA,KAAK,KAAK,IAAI;AACd,gBAAA,CAAC,KAAK,CAAC,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,39 @@
|
|
|
1
|
+
// Shared event system for DND and highlight-node communication
|
|
2
|
+
// This breaks the circular dependency between dnd-manager and highlight-node-manager
|
|
3
|
+
class DndEventManager {
|
|
4
|
+
listeners = new Map();
|
|
5
|
+
on(event, listener) {
|
|
6
|
+
if (!this.listeners.has(event)) {
|
|
7
|
+
this.listeners.set(event, new Set());
|
|
8
|
+
}
|
|
9
|
+
this.listeners.get(event).add(listener);
|
|
10
|
+
// Return unsubscribe function
|
|
11
|
+
return () => {
|
|
12
|
+
const eventListeners = this.listeners.get(event);
|
|
13
|
+
if (eventListeners) {
|
|
14
|
+
eventListeners.delete(listener);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
emit(event, payload) {
|
|
19
|
+
const eventListeners = this.listeners.get(event);
|
|
20
|
+
if (eventListeners) {
|
|
21
|
+
eventListeners.forEach((listener) => listener(payload));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
off(event, listener) {
|
|
25
|
+
if (!listener) {
|
|
26
|
+
// Remove all listeners for this event
|
|
27
|
+
this.listeners.delete(event);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const eventListeners = this.listeners.get(event);
|
|
31
|
+
if (eventListeners) {
|
|
32
|
+
eventListeners.delete(listener);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const dndEventManager = new DndEventManager();
|
|
37
|
+
|
|
38
|
+
export { dndEventManager };
|
|
39
|
+
//# sourceMappingURL=dnd-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnd-events.js","sources":["../../src/shared/dnd-events.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AAeA,MAAM,eAAe,CAAA;AACX,IAAA,SAAS,GAA+C,IAAI,GAAG,EAAE;IAEzE,EAAE,CAAyB,KAAQ,EAAE,QAA0B,EAAA;QAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC;QACtC;AACA,QAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;;AAGxC,QAAA,OAAO,MAAK;YACV,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;YAChD,IAAI,cAAc,EAAE;AAClB,gBAAA,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC;AACF,QAAA,CAAC;IACH;IAEA,IAAI,CAAyB,KAAQ,EAAE,OAA2B,EAAA;QAChE,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;QAChD,IAAI,cAAc,EAAE;AAClB,YAAA,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzD;IACF;IAEA,GAAG,CAAyB,KAAQ,EAAE,QAA2B,EAAA;QAC/D,IAAI,CAAC,QAAQ,EAAE;;AAEb,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5B;QACF;QAEA,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;QAChD,IAAI,cAAc,EAAE;AAClB,YAAA,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC;IACF;AACD;AAEM,MAAM,eAAe,GAAG,IAAI,eAAe;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IS_BROWSER, composableStudioEventManager, POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger';
|
|
2
|
+
|
|
3
|
+
function sendUrlToParent() {
|
|
4
|
+
if (!IS_BROWSER)
|
|
5
|
+
return;
|
|
6
|
+
const url = window.location.href;
|
|
7
|
+
composableStudioEventManager?.send(POST_MESSAGE_EVENTS.URL_CHANGE, { url });
|
|
8
|
+
}
|
|
9
|
+
function setupNavigationApi() {
|
|
10
|
+
if (!IS_BROWSER)
|
|
11
|
+
return null;
|
|
12
|
+
const nav = window.navigation;
|
|
13
|
+
if (!nav)
|
|
14
|
+
return null;
|
|
15
|
+
const handler = (event) => {
|
|
16
|
+
const url = event.destination.url;
|
|
17
|
+
composableStudioEventManager?.send(POST_MESSAGE_EVENTS.URL_CHANGE, { url });
|
|
18
|
+
};
|
|
19
|
+
nav.addEventListener("navigate", handler);
|
|
20
|
+
return () => nav.removeEventListener("navigate", handler);
|
|
21
|
+
}
|
|
22
|
+
function setupPopstateAndHistoryPatch() {
|
|
23
|
+
if (!IS_BROWSER)
|
|
24
|
+
return () => { };
|
|
25
|
+
const popstateHandler = () => sendUrlToParent();
|
|
26
|
+
const origPushState = history.pushState.bind(history);
|
|
27
|
+
const origReplaceState = history.replaceState.bind(history);
|
|
28
|
+
history.pushState = function (...args) {
|
|
29
|
+
origPushState(...args);
|
|
30
|
+
sendUrlToParent();
|
|
31
|
+
};
|
|
32
|
+
history.replaceState = function (...args) {
|
|
33
|
+
origReplaceState(...args);
|
|
34
|
+
sendUrlToParent();
|
|
35
|
+
};
|
|
36
|
+
window.addEventListener("popstate", popstateHandler);
|
|
37
|
+
return () => {
|
|
38
|
+
window.removeEventListener("popstate", popstateHandler);
|
|
39
|
+
history.pushState = origPushState;
|
|
40
|
+
history.replaceState = origReplaceState;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Listens for URL changes inside the iframe (SPA navigations, pushState, replaceState, popstate)
|
|
45
|
+
* and sends URL_CHANGE postMessage to the parent so the studio can sync the navbar URL.
|
|
46
|
+
* Uses Navigation API when available, with popstate + history monkey-patch fallback.
|
|
47
|
+
*/
|
|
48
|
+
function addUrlChangeListeners() {
|
|
49
|
+
if (!IS_BROWSER)
|
|
50
|
+
return undefined;
|
|
51
|
+
sendUrlToParent();
|
|
52
|
+
const removeNavigationApi = setupNavigationApi();
|
|
53
|
+
if (removeNavigationApi) {
|
|
54
|
+
return {
|
|
55
|
+
removeEventListeners: removeNavigationApi,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const removeFallback = setupPopstateAndHistoryPatch();
|
|
59
|
+
return {
|
|
60
|
+
removeEventListeners: removeFallback,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { addUrlChangeListeners };
|
|
65
|
+
//# sourceMappingURL=url-change.js.map
|
|
@@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