@contentstack/studio-client 3.1.0 → 4.0.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.
Files changed (107) hide show
  1. package/README.md +21 -0
  2. package/dist/breakpoints/BreakpointManager.js +7 -5
  3. package/dist/breakpoints/BreakpointManager.js.map +1 -1
  4. package/dist/breakpoints/breakpoint.js +3 -2
  5. package/dist/breakpoints/breakpoint.js.map +1 -1
  6. package/dist/canvas/canvas.utils.js +13 -1
  7. package/dist/canvas/canvas.utils.js.map +1 -1
  8. package/dist/composable-studio/build-scoped-data.js +53 -31
  9. package/dist/composable-studio/build-scoped-data.js.map +1 -1
  10. package/dist/composable-studio/collect-data-needs.js +22 -4
  11. package/dist/composable-studio/collect-data-needs.js.map +1 -1
  12. package/dist/composable-studio/sdk.js +1288 -453
  13. package/dist/composable-studio/sdk.js.map +1 -1
  14. package/dist/composable-studio/section-data.js +316 -0
  15. package/dist/composable-studio/section-data.js.map +1 -0
  16. package/dist/composable-studio/studio-intelligence.manager.js +5 -2
  17. package/dist/composable-studio/studio-intelligence.manager.js.map +1 -1
  18. package/dist/config/config.schema.js +45 -8
  19. package/dist/config/config.schema.js.map +1 -1
  20. package/dist/config/default-config.js +10 -3
  21. package/dist/config/default-config.js.map +1 -1
  22. package/dist/config/process-user-config.js +37 -1
  23. package/dist/config/process-user-config.js.map +1 -1
  24. package/dist/config/stack-sdk-wrapper.js +71 -2
  25. package/dist/config/stack-sdk-wrapper.js.map +1 -1
  26. package/dist/context-menu/context-menu.js +5 -2
  27. package/dist/context-menu/context-menu.js.map +1 -1
  28. package/dist/design/handle-active-style-change.js +3 -2
  29. package/dist/design/handle-active-style-change.js.map +1 -1
  30. package/dist/dnd/dnd-event.js +2 -1
  31. package/dist/dnd/dnd-event.js.map +1 -1
  32. package/dist/dnd/dnd-manager.js +3 -1
  33. package/dist/dnd/dnd-manager.js.map +1 -1
  34. package/dist/editor.d.ts +250 -0
  35. package/dist/editor.js +11 -0
  36. package/dist/editor.js.map +1 -0
  37. package/dist/get-active-node-screenshot/get-node-screenshot-event.js +2 -1
  38. package/dist/get-active-node-screenshot/get-node-screenshot-event.js.map +1 -1
  39. package/dist/hidden-element-notification/hidden-element-notification-event.js +2 -1
  40. package/dist/hidden-element-notification/hidden-element-notification-event.js.map +1 -1
  41. package/dist/highlight-node/highlight-node-manager.js +225 -15
  42. package/dist/highlight-node/highlight-node-manager.js.map +1 -1
  43. package/dist/highlight-node/highlight-node.js +42 -6
  44. package/dist/highlight-node/highlight-node.js.map +1 -1
  45. package/dist/highlight-spacing/highlight-spacing-events.js +2 -1
  46. package/dist/highlight-spacing/highlight-spacing-events.js.map +1 -1
  47. package/dist/index.d.ts +1334 -467
  48. package/dist/index.js +14 -14
  49. package/dist/index.js.map +1 -1
  50. package/dist/url-change/url-change.js +4 -3
  51. package/dist/url-change/url-change.js.map +1 -1
  52. package/dist/url-metadata/build-template-query.js +27 -6
  53. package/dist/url-metadata/build-template-query.js.map +1 -1
  54. package/dist/utils/canvas.js +2 -1
  55. package/dist/utils/canvas.js.map +1 -1
  56. package/dist/utils/check-bindings.js +233 -0
  57. package/dist/utils/check-bindings.js.map +1 -0
  58. package/dist/utils/classify-response-error.js +288 -0
  59. package/dist/utils/classify-response-error.js.map +1 -0
  60. package/dist/utils/composable-studio-error.js +36 -20
  61. package/dist/utils/composable-studio-error.js.map +1 -1
  62. package/dist/utils/composition-not-found.js +52 -0
  63. package/dist/utils/composition-not-found.js.map +1 -0
  64. package/dist/utils/conditionBlock.js +80 -3
  65. package/dist/utils/conditionBlock.js.map +1 -1
  66. package/dist/utils/constants.js +21 -2
  67. package/dist/utils/constants.js.map +1 -1
  68. package/dist/utils/degraded-finding.js +166 -0
  69. package/dist/utils/degraded-finding.js.map +1 -0
  70. package/dist/utils/editor-mode.js +1 -1
  71. package/dist/utils/http-error.constants.js +12 -46
  72. package/dist/utils/http-error.constants.js.map +1 -1
  73. package/dist/utils/include-path-rules.js +141 -0
  74. package/dist/utils/include-path-rules.js.map +1 -0
  75. package/dist/utils/is-composition-being-edited.js +1 -1
  76. package/dist/utils/is-inside-iframe.js +1 -1
  77. package/dist/utils/is-inside-visual-builder-frame.js +1 -1
  78. package/dist/utils/parse-ui.js +60 -0
  79. package/dist/utils/parse-ui.js.map +1 -0
  80. package/dist/utils/query-param.js +1 -1
  81. package/dist/utils/query-param.js.map +1 -1
  82. package/dist/utils/query-url-budget.js +79 -0
  83. package/dist/utils/query-url-budget.js.map +1 -0
  84. package/dist/utils/reference-stub.js +75 -0
  85. package/dist/utils/reference-stub.js.map +1 -0
  86. package/dist/utils/reference_fetcher.js +59 -4
  87. package/dist/utils/reference_fetcher.js.map +1 -1
  88. package/dist/utils/require-stack.js +141 -0
  89. package/dist/utils/require-stack.js.map +1 -0
  90. package/dist/utils/served-by.js +33 -0
  91. package/dist/utils/served-by.js.map +1 -0
  92. package/dist/utils/spec-analyzer.js +2 -2
  93. package/dist/utils/spec-analyzer.js.map +1 -1
  94. package/dist/utils/studio-error-codes.js +253 -0
  95. package/dist/utils/studio-error-codes.js.map +1 -0
  96. package/dist/utils/studio-error.js +122 -0
  97. package/dist/utils/studio-error.js.map +1 -0
  98. package/dist/utils/studio-messaging.js +25 -0
  99. package/dist/utils/studio-messaging.js.map +1 -0
  100. package/dist/visual-builder/composition-save-event.js +2 -1
  101. package/dist/visual-builder/composition-save-event.js.map +1 -1
  102. package/package.json +19 -7
  103. package/LICENSE +0 -21
  104. package/dist/utils/error-messages.default.js +0 -141
  105. package/dist/utils/error-messages.default.js.map +0 -1
  106. package/dist/utils/error-messages.js +0 -47
  107. package/dist/utils/error-messages.js.map +0 -1
@@ -0,0 +1,288 @@
1
+ import { DEFAULT_COMPOSITION_TYPE_UID } from '../config/config.constant.js';
2
+ import { getStatusCode, HttpStatus, ContentstackErrorCode, isNetworkError } from './http-error.constants.js';
3
+ import { buildStudioErrorContext, createStudioError } from './studio-error.js';
4
+ import { StudioErrorCode } from './studio-error-codes.js';
5
+
6
+ /**
7
+ * Turns a delivery-API failure into a diagnosis, for the cases that have one.
8
+ *
9
+ * Returns `undefined` when nothing here recognises the response, and the
10
+ * caller's existing handling takes over. That is what makes this safe to grow
11
+ * one code at a time: a case is either diagnosed or left exactly as it was.
12
+ *
13
+ * What arrives here is the delivery SDK's `APIError`, which keeps `status`,
14
+ * `error_code` and `error_message` and discards the response's `errors` object.
15
+ * Conditions are written against the three fields that survive.
16
+ */
17
+ /**
18
+ * Whether the uid was chosen decides which cause leads. A developer who set
19
+ * nothing cannot have made a typo, and one who set a value is not going to find
20
+ * the default in their code.
21
+ *
22
+ * Both lists rank rather than assert, so both are written as possibilities with
23
+ * a check attached. We have proved the content type is not on the stack — that
24
+ * is the headline. Why it is not on the stack is a guess between two, and copy
25
+ * that states a guess as fact sends someone to correct a value that was right.
26
+ */
27
+ function contentTypeCauses(config) {
28
+ const notInstalled = {
29
+ cause: "This stack may not have Studio's content types installed.",
30
+ fix: "Check the API key points at the stack you meant. If it does, install Studio's content types there.",
31
+ };
32
+ if (config.contentTypeUidWasSupplied) {
33
+ return [
34
+ {
35
+ cause: `The uid "${config.contentTypeUid}" may be misspelled.`,
36
+ fix: "Compare it with the content type in Contentstack.",
37
+ },
38
+ notInstalled,
39
+ ];
40
+ }
41
+ return [
42
+ {
43
+ cause: `contentTypeUid was not set, so the default "${DEFAULT_COMPOSITION_TYPE_UID}" was used. This stack may use a different uid.`,
44
+ fix: "Find the compositions content type in Contentstack and set contentTypeUid to its uid.",
45
+ },
46
+ notInstalled,
47
+ ];
48
+ }
49
+ /**
50
+ * 141 carries four meanings and `error_message` is the only separator. Matched
51
+ * on the leading phrase so the trailing "Please try again." can change freely.
52
+ * Verified against a live stack, not taken from a document.
53
+ */
54
+ const ENVIRONMENT_NOT_FOUND_MESSAGE = /^\s*environment was not found/i;
55
+ const LANGUAGE_NOT_FOUND_MESSAGE = /^\s*language was not found/i;
56
+ /**
57
+ * Byte-identical responses, so this ranks and never asserts — one says change a
58
+ * value, the other change the host, and picking wrong edits what was right.
59
+ */
60
+ function stackNotFoundCauses(host) {
61
+ return [
62
+ {
63
+ cause: "The API key may be wrong.",
64
+ fix: "Compare it with the stack's API credentials in Contentstack.",
65
+ },
66
+ {
67
+ cause: `The API key may be right and ${host ?? "the host"} may be the wrong region for it. A key only answers on the region its stack lives in.`,
68
+ fix: "Check which region the stack is in, and set the host to match. The fix is the host, not the key.",
69
+ },
70
+ ];
71
+ }
72
+ /**
73
+ * A token that does not cover the environment answers here, not as a token
74
+ * error — so without scope we call an environment missing while it sits on the
75
+ * stack in front of the reader.
76
+ */
77
+ /**
78
+ * The environment is named from our own request, since the API names nothing.
79
+ * It can be absent on the legacy JS stack, where empty quotes would read as a
80
+ * bug in us, so the copy drops to a wording that claims no name.
81
+ */
82
+ function environmentNotFound(context, status, errorCode) {
83
+ const environment = context.environment;
84
+ const named = environment
85
+ ? `"${environment}"`
86
+ : "the environment it was sent";
87
+ return createStudioError({
88
+ code: StudioErrorCode.ENVIRONMENT_NOT_FOUND,
89
+ headline: environment
90
+ ? `Contentstack did not find the environment "${environment}".`
91
+ : "Contentstack did not find the environment this request was sent to.",
92
+ causes: [
93
+ {
94
+ cause: `The environment ${named} may not exist on this stack, or may have been renamed.`,
95
+ fix: "Compare the name with the environments in Contentstack.",
96
+ },
97
+ {
98
+ cause: "The environment may exist but sit outside the delivery token's scope. A delivery token is scoped to specific environments.",
99
+ fix: `Check that the delivery token in use covers ${named}.`,
100
+ },
101
+ ],
102
+ context,
103
+ findings: { environment, status, errorCode },
104
+ });
105
+ }
106
+ /** Casing leads: it is the one difference a reader cannot see by looking. */
107
+ function localeCauses(locale) {
108
+ return [
109
+ {
110
+ cause: `The code may not match the one on the stack — "${locale}" and "${locale.toLowerCase()}" are different values.`,
111
+ fix: "Compare it with the languages in Contentstack, exactly as they are written there.",
112
+ },
113
+ {
114
+ cause: "The language may never have been added to this stack.",
115
+ fix: "Add it in Contentstack, or ask for one the stack has.",
116
+ },
117
+ ];
118
+ }
119
+ /** The address asked for a language the stack does not have: a missing page. */
120
+ function urlLocaleNotFound(locale, requestedUrl, context, status, errorCode) {
121
+ return createStudioError({
122
+ code: StudioErrorCode.URL_LOCALE_NOT_FOUND,
123
+ headline: `${requestedUrl ? `"${requestedUrl}"` : "This address"} asks for the language "${locale}", which is not set up on this stack.`,
124
+ causes: [
125
+ {
126
+ cause: `The address may be wrong — "${locale}" is not one of this stack's languages.`,
127
+ fix: "Check the language segment against the languages in Contentstack.",
128
+ },
129
+ {
130
+ cause: "The language may have been removed from the stack after this address was published.",
131
+ fix: "Add it back, or redirect the address to a language the stack has.",
132
+ },
133
+ ],
134
+ context,
135
+ // What a host reads to decide what to render in the page's place.
136
+ findings: {
137
+ requestedUrl,
138
+ locale,
139
+ localeSource: "url-pattern",
140
+ status,
141
+ errorCode,
142
+ },
143
+ });
144
+ }
145
+ /** The SDK was configured with a language the stack does not have. */
146
+ function localeNotConfigured(locale, context, status, errorCode) {
147
+ return createStudioError({
148
+ code: StudioErrorCode.LOCALE_NOT_CONFIGURED,
149
+ headline: `Contentstack did not find the language "${locale}" on this stack. The locale came from the SDK configuration.`,
150
+ causes: localeCauses(locale),
151
+ context,
152
+ findings: { locale, localeSource: "configuration", status, errorCode },
153
+ });
154
+ }
155
+ function classifyResponseError(err, config, request = {}) {
156
+ const status = getStatusCode(err);
157
+ const errorCode = err?.error_code;
158
+ const errorMessage = err?.error_message ?? "";
159
+ const context = buildStudioErrorContext(config, request.servedBy);
160
+ // The response is identical whether the key is wrong or the host is for
161
+ // another region, so the two are ranked rather than picked between.
162
+ if (status === HttpStatus.PRECONDITION_FAILED &&
163
+ errorCode === ContentstackErrorCode.STACK_NOT_FOUND) {
164
+ return createStudioError({
165
+ code: StudioErrorCode.STACK_NOT_FOUND_ON_HOST,
166
+ headline: `Contentstack did not find a stack for this API key on ${context.host ?? "this host"}.`,
167
+ causes: stackNotFoundCauses(context.host),
168
+ context,
169
+ findings: { status, errorCode },
170
+ });
171
+ }
172
+ if (status === HttpStatus.UNPROCESSABLE_ENTITY &&
173
+ errorCode === ContentstackErrorCode.ENTRY_NOT_FOUND) {
174
+ if (ENVIRONMENT_NOT_FOUND_MESSAGE.test(errorMessage)) {
175
+ return environmentNotFound(context, status, errorCode);
176
+ }
177
+ if (LANGUAGE_NOT_FOUND_MESSAGE.test(errorMessage)) {
178
+ const locale = request.locale ?? context.locale ?? "";
179
+ // Split on provenance: a configured locale is a setup fault, one from the
180
+ // address is visitor input. Getting it wrong 5xxs anyone who mistypes.
181
+ return request.localeSource === "url-pattern"
182
+ ? urlLocaleNotFound(locale, request.url, context, status, errorCode)
183
+ : localeNotConfigured(locale, context, status, errorCode);
184
+ }
185
+ // Any other 141 is left alone deliberately. A missing entry is the only
186
+ // meaning that occurs in ordinary traffic, so an unrecognised wording is
187
+ // most likely one — and 5xx-ing instead breaks every genuine missing page
188
+ // the day Contentstack rewords a string.
189
+ }
190
+ if (status === HttpStatus.UNPROCESSABLE_ENTITY &&
191
+ errorCode === ContentstackErrorCode.CONTENT_TYPE_NOT_FOUND) {
192
+ return createStudioError({
193
+ code: StudioErrorCode.CONTENT_TYPE_NOT_FOUND,
194
+ headline: `The content type "${config.contentTypeUid}" does not exist in this stack.`,
195
+ causes: contentTypeCauses(config),
196
+ context,
197
+ findings: {
198
+ contentTypeUid: config.contentTypeUid,
199
+ contentTypeUidWasSupplied: config.contentTypeUidWasSupplied,
200
+ },
201
+ });
202
+ }
203
+ return undefined;
204
+ }
205
+ /**
206
+ * The diagnosis for a response nothing above recognised.
207
+ *
208
+ * **Deliberately not folded into `classifyResponseError`.** That function
209
+ * returns `undefined` on purpose for an unrecognised 141, so the caller's own
210
+ * not-found reading gets a chance — a missing entry is the only meaning of a
211
+ * 141 that occurs in ordinary traffic. Making the classifier total instead
212
+ * turns every genuine missing page into a server error the day Contentstack
213
+ * rewords a string, which is the failure this whole contract exists to remove.
214
+ *
215
+ * So the terminal case lives here, and a call site reaches it only after it has
216
+ * settled whether absence is a possible answer for the request it made.
217
+ */
218
+ function diagnoseUnreadableResponse(err, config, request = {},
219
+ /**
220
+ * What "there is no such page" means for the request that failed.
221
+ *
222
+ * The caller supplies it because only the caller knows what it asked for: an
223
+ * address that matches nothing and a uid that matches nothing are different
224
+ * findings taking opposite advice. Omit it where absence is not a possible
225
+ * answer, and an entry-not-found is then reported as the server error it
226
+ * literally is.
227
+ */
228
+ notFound) {
229
+ const status = getStatusCode(err);
230
+ const errorCode = err?.error_code;
231
+ const context = buildStudioErrorContext(config, request.servedBy);
232
+ // An unplaceable 141 reads as a missing entry, which is the only one of its
233
+ // four meanings that occurs in ordinary traffic. Reporting it as a server
234
+ // error instead would 5xx every genuine missing page the day Contentstack
235
+ // rewords a string — so the caller's own not-found wins where it has one.
236
+ const readsAsMissing = status === HttpStatus.NOT_FOUND ||
237
+ (status === HttpStatus.UNPROCESSABLE_ENTITY &&
238
+ errorCode === ContentstackErrorCode.ENTRY_NOT_FOUND);
239
+ if (readsAsMissing && notFound)
240
+ return notFound();
241
+ if (status === undefined && isNetworkError(err)) {
242
+ return createStudioError({
243
+ code: StudioErrorCode.TRANSPORT_FAILED,
244
+ headline: `The request to ${context.host ?? "Contentstack"} did not complete.`,
245
+ causes: transportCauses(context.host),
246
+ context,
247
+ findings: {
248
+ host: context.host,
249
+ detail: err?.message,
250
+ },
251
+ });
252
+ }
253
+ return createStudioError({
254
+ code: StudioErrorCode.UPSTREAM_ERROR,
255
+ headline: status === undefined
256
+ ? "Contentstack's reply to this request could not be read."
257
+ : `Contentstack answered this request with ${status}.`,
258
+ causes: [
259
+ {
260
+ cause: "Contentstack could not answer this request.",
261
+ fix: "Retry. If it persists, report it with the status and code below.",
262
+ },
263
+ ],
264
+ context,
265
+ findings: { status, errorCode, host: context.host },
266
+ });
267
+ }
268
+ /**
269
+ * Nothing answered, so there is nothing about the project to blame. Ordered by
270
+ * what the reader can act on: their own network and their own host first.
271
+ */
272
+ function transportCauses(host) {
273
+ return [
274
+ {
275
+ cause: "The network between this site and Contentstack dropped the request.",
276
+ fix: "Retry. If it keeps happening, check outbound network access and any proxy in front of this site.",
277
+ },
278
+ {
279
+ cause: host
280
+ ? `Nothing is listening at ${host}, or it is blocked from where this site runs.`
281
+ : "The configured Contentstack address cannot be reached from where this site runs.",
282
+ fix: "Check the address, and that it is reachable from this environment.",
283
+ },
284
+ ];
285
+ }
286
+
287
+ export { classifyResponseError, diagnoseUnreadableResponse };
288
+ //# sourceMappingURL=classify-response-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify-response-error.js","sources":["../../src/utils/classify-response-error.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;AAUG;AAoBH;;;;;;;;;AASG;AACH,SAAS,iBAAiB,CAAC,MAAc,EAAA;AACvC,IAAA,MAAM,YAAY,GAAG;AACnB,QAAA,KAAK,EAAE,2DAA2D;AAClE,QAAA,GAAG,EAAE,oGAAoG;KAC1G;AAED,IAAA,IAAI,MAAM,CAAC,yBAAyB,EAAE;QACpC,OAAO;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,CAAA,SAAA,EAAY,MAAM,CAAC,cAAc,CAAA,oBAAA,CAAsB;AAC9D,gBAAA,GAAG,EAAE,mDAAmD;AACzD,aAAA;YACD,YAAY;SACb;IACH;IAEA,OAAO;AACL,QAAA;YACE,KAAK,EAAE,CAAA,4CAAA,EAA+C,4BAA4B,CAAA,+CAAA,CAAiD;AACnI,YAAA,GAAG,EAAE,uFAAuF;AAC7F,SAAA;QACD,YAAY;KACb;AACH;AAkBA;;;;AAIG;AACH,MAAM,6BAA6B,GAAG,gCAAgC;AACtE,MAAM,0BAA0B,GAAG,6BAA6B;AAEhE;;;AAGG;AACH,SAAS,mBAAmB,CAAC,IAAwB,EAAA;IACnD,OAAO;AACL,QAAA;AACE,YAAA,KAAK,EAAE,2BAA2B;AAClC,YAAA,GAAG,EAAE,8DAA8D;AACpE,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE,CAAA,6BAA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;AACP,YAAA,QAAQ,EAAE;gBACR,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAG,GAAmC,EAAE,OAAO;AACtD,aAAA;AACF,SAAA,CAAC;IACJ;AAEA,IAAA,OAAO,iBAAiB,CAAC;QACvB,IAAI,EAAE,eAAe,CAAC,cAAc;QACpC,QAAQ,EACN,MAAM,KAAK;AACT,cAAE;cACA,CAAA,wCAAA,EAA2C,MAAM,CAAA,CAAA,CAAG;AAC1D,QAAA,MAAM,EAAE;AACN,YAAA;AACE,gBAAA,KAAK,EAAE,6CAA6C;AACpD,gBAAA,GAAG,EAAE,kEAAkE;AACxE,aAAA;AACF,SAAA;QACD,OAAO;QACP,QAAQ,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;AACpD,KAAA,CAAC;AACJ;AAEA;;;AAGG;AACH,SAAS,eAAe,CAAC,IAAwB,EAAA;IAC/C,OAAO;AACL,QAAA;AACE,YAAA,KAAK,EACH,qEAAqE;AACvE,YAAA,GAAG,EAAE,kGAAkG;AACxG,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE;kBACH,CAAA,wBAAA,EAA2B,IAAI,CAAA,6CAAA;AACjC,kBAAE,kFAAkF;AACtF,YAAA,GAAG,EAAE,oEAAoE;AAC1E,SAAA;KACF;AACH;;;;"}
@@ -1,30 +1,46 @@
1
- const ComposableStudioErrors = {
2
- COMPOSITION_NOT_FOUND: "COMPOSITION_NOT_FOUND",
3
- COMPOSITION_NOT_FOUND_BY_URL: "COMPOSITION_NOT_FOUND_BY_URL",
4
- PREVIEW_ENTRY_NOT_FOUND: "PREVIEW_ENTRY_NOT_FOUND",
5
- FETCHING_CONNECTED_DATA_FAILED: "FETCHING_CONNECTED_DATA_FAILED",
6
- RESOLVING_DATA_SOURCES_FAILED: "RESOLVING_DATA_SOURCES_FAILED",
7
- STACK_SDK_NOT_AVAILABLE: "STACK_SDK_NOT_AVAILABLE",
8
- INVALID_FETCH_SPEC_OPTIONS: "INVALID_FETCH_SPEC_OPTIONS",
9
- MISSING_COMPOSITION_IDENTIFIER: "MISSING_COMPOSITION_IDENTIFIER",
10
- UI_PARSING_ERROR: "UI_PARSING_ERROR",
11
- SPEC_DATA_INVALID: "SPEC_DATA_INVALID",
12
- NETWORK_ERROR: "NETWORK_ERROR",
13
- AUTHENTICATION_ERROR: "AUTHENTICATION_ERROR",
14
- SERVER_ERROR: "SERVER_ERROR",
15
- COMPONENT_NOT_FOUND: "COMPONENT_NOT_FOUND",
16
- };
1
+ import { ERROR_CLASS } from './studio-error-codes.js';
2
+
17
3
  class ComposableStudioError extends Error {
18
- id;
19
4
  details;
20
- constructor(id, message, details) {
5
+ /**
6
+ * The case this error is, and the identifier everything new reads: the log
7
+ * line, the docs, a support conversation, and the diagnostic Studio receives.
8
+ *
9
+ * Optional while throw sites move over one at a time. Absent means the site
10
+ * that raised it has not been diagnosed yet, not that the case is unknown.
11
+ * `id` is what those sites still carry, and it goes once they have all moved.
12
+ */
13
+ code;
14
+ /**
15
+ * What to do, ordered, most likely first. One entry means we proved the
16
+ * cause; more than one means we are ranking and the reader should work down
17
+ * the list. Set together with `code`, and never empty when set.
18
+ */
19
+ causes;
20
+ /** Where the request went and what it was made with. Never a token. */
21
+ context;
22
+ /**
23
+ * What this particular failure established, typed by `code`. Separate from
24
+ * `details`, which is the legacy metadata bag: these are the facts a surface
25
+ * reads, and the shape is closed so no throw site can add a token to it.
26
+ */
27
+ findings;
28
+ /**
29
+ * Which of the five classes this code belongs to, looked up rather than
30
+ * stored, so it can never disagree with `code`. A surface that does not
31
+ * recognise the code can still act on the class — it is the coarse answer
32
+ * that stays true for every code added after that surface shipped.
33
+ */
34
+ get errorClass() {
35
+ return this.code ? ERROR_CLASS[this.code] : undefined;
36
+ }
37
+ constructor(message, details) {
21
38
  super(message);
22
- this.id = id;
23
39
  this.details = details;
24
40
  }
25
41
  }
26
42
  // This fails for agadoo
27
43
  // ComposableStudioError.prototype.name = "ComposableStudioError";
28
44
 
29
- export { ComposableStudioError, ComposableStudioErrors };
45
+ export { ComposableStudioError };
30
46
  //# sourceMappingURL=composable-studio-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"composable-studio-error.js","sources":["../../src/utils/composable-studio-error.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,MAAM,sBAAsB,GAAG;AACpC,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,4BAA4B,EAAE,8BAA8B;AAC5D,IAAA,uBAAuB,EAAE,yBAAyB;AAClD,IAAA,8BAA8B,EAAE,gCAAgC;AAChE,IAAA,6BAA6B,EAAE,+BAA+B;AAC9D,IAAA,uBAAuB,EAAE,yBAAyB;AAClD,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,8BAA8B,EAAE,gCAAgC;AAChE,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,mBAAmB,EAAE,qBAAqB;;AA+BtC,MAAO,qBAAsB,SAAQ,KAAK,CAAA;AAC9C,IAAA,EAAE;AACF,IAAA,OAAO;AAEP,IAAA,WAAA,CACE,EAAuC,EACvC,OAAe,EACf,OAAsC,EAAA;QAEtC,KAAK,CAAC,OAAO,CAAC;AACd,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;AACZ,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACD;AACD;AACA;;;;"}
1
+ {"version":3,"file":"composable-studio-error.js","sources":["../../src/utils/composable-studio-error.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAoCM,MAAO,qBAAsB,SAAQ,KAAK,CAAA;AAC9C,IAAA,OAAO;AAEP;;;;;;;AAOG;AACH,IAAA,IAAI;AAEJ;;;;AAIG;AACH,IAAA,MAAM;;AAGN,IAAA,OAAO;AACP;;;;AAIG;AACH,IAAA,QAAQ;AAER;;;;;AAKG;AACH,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS;IACvD;IAEA,WAAA,CAAY,OAAe,EAAE,OAAsC,EAAA;QACjE,KAAK,CAAC,OAAO,CAAC;AACd,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AACD;AACD;AACA;;;;"}
@@ -0,0 +1,52 @@
1
+ import { ComposableStudioError } from './composable-studio-error.js';
2
+ import { ERROR_CLASS, StudioErrorClass } from './studio-error-codes.js';
3
+
4
+ /**
5
+ * How a host tells "there is no such page" from "we could not answer".
6
+ *
7
+ * A host rendering a composition answers one question per request: render this,
8
+ * return 404, or return 5xx. Only one kind of failure is a 404, and getting it
9
+ * wrong is expensive in one direction — a 404 is acted on permanently by crawlers
10
+ * and caches, while a 5xx is retried.
11
+ */
12
+ /** Every code that means we looked, finished looking, and nothing matched. */
13
+ const NOT_FOUND_CODES = new Set(Object.keys(ERROR_CLASS).filter((code) => ERROR_CLASS[code] === StudioErrorClass.NOT_FOUND));
14
+ /**
15
+ * Whether this failure means the page is not there.
16
+ *
17
+ * **This is the check to write, rather than `instanceof`.** Two copies of the
18
+ * package in one dependency tree is an ordinary outcome of a transitive install,
19
+ * and each copy has its own class object — so a prototype check returns false for
20
+ * an error raised by the other copy. It fails silently and in the worst direction:
21
+ * a genuinely missing page is reported as a server error, and the host serves a
22
+ * 500 where it meant to serve a 404.
23
+ *
24
+ * A code is a string. It survives the package boundary, a structured-clone, a
25
+ * serialisation to a log and back, and a second copy of the SDK.
26
+ */
27
+ function isCompositionNotFound(error) {
28
+ if (typeof error !== "object" || error === null)
29
+ return false;
30
+ const code = error.code;
31
+ return typeof code === "string" && NOT_FOUND_CODES.has(code);
32
+ }
33
+ /**
34
+ * The not-found subclass, for a host that would rather catch by type.
35
+ *
36
+ * It ships because catching by type is a reasonable thing to want, and because an
37
+ * error's class is what a debugger and a stack trace show. It is not the
38
+ * documented check: see {@link isCompositionNotFound} for why.
39
+ *
40
+ * Nothing constructs this directly. The diagnosis factory picks it whenever the
41
+ * code it is given belongs to the not-found class, which is what keeps the class
42
+ * and the predicate from ever disagreeing about the same error.
43
+ */
44
+ class CompositionNotFoundError extends ComposableStudioError {
45
+ }
46
+ /** Whether a code belongs to the not-found class, for the factory's own use. */
47
+ function codeIsNotFound(code) {
48
+ return NOT_FOUND_CODES.has(code);
49
+ }
50
+
51
+ export { CompositionNotFoundError, codeIsNotFound, isCompositionNotFound };
52
+ //# sourceMappingURL=composition-not-found.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition-not-found.js","sources":["../../src/utils/composition-not-found.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;AAOG;AASH;AACA,MAAM,eAAe,GAAwB,IAAI,GAAG,CAClD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAC7B,CAAC,IAAI,KACH,WAAW,CAAC,IAA2B,CAAC,KAAK,gBAAgB,CAAC,SAAS,CAC1E,CACF;AAED;;;;;;;;;;;;AAYG;AACG,SAAU,qBAAqB,CAAC,KAAc,EAAA;AAClD,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,KAAK;AAC7D,IAAA,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI;IAC/C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;AAC9D;AAEA;;;;;;;;;;AAUG;AACG,MAAO,wBAAyB,SAAQ,qBAAqB,CAAA;AAAG;AAEtE;AACM,SAAU,cAAc,CAAC,IAAyB,EAAA;AACtD,IAAA,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;AAClC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { has, get, isEqual, isPlainObject } from 'lodash-es';
2
2
  import { isNotEqual, doesArrayInclude, isLessThanOrEqual, isLessThan, isGreaterThanOrEqual, isGreaterThan } from './condition-block.utils.js';
3
- import { getBindingString } from '@contentstack/studio-registry';
3
+ import { getBindingString, getRepeaterContextPath } from '@contentstack/studio-registry';
4
4
 
5
5
  const EXISTENCE_OPERATOR_VALUES = new Set(["exists", "notExists"]);
6
6
  const EMPTINESS_OPERATOR_VALUES = new Set(["isEmpty", "isNotEmpty"]);
@@ -107,6 +107,15 @@ const evaluateCondition = (condition, data) => {
107
107
  return handleArrayCondition(condition, conditionValue);
108
108
  }
109
109
  case "modular_block":
110
+ // A Length check and a Block Name check save the same shape — `eq` is
111
+ // shared and the sub-type was not always recorded. Only a condition that
112
+ // SAYS it is a length check gets length semantics; inferring it from the
113
+ // value here would re-interpret every saved `Length == N` on the next SDK
114
+ // upgrade, changing published pages with no edit or publish event
115
+ // (ADR 0014). Absent `subType`, behave exactly as before.
116
+ if (condition.subType === "length") {
117
+ return handleArrayCondition(condition, conditionValue);
118
+ }
110
119
  switch (condition.operator) {
111
120
  case "is":
112
121
  case "eq":
@@ -150,6 +159,11 @@ const evaluateCondition = (condition, data) => {
150
159
  return handleNumberComparison(condition.operator, imageSize, condition.value);
151
160
  }
152
161
  case "reference": {
162
+ // Same ambiguity as `modular_block`: `eq` is shared between a Content Type
163
+ // check and a Length check. See the note above.
164
+ if (condition.subType === "length") {
165
+ return handleArrayCondition(condition, conditionValue);
166
+ }
153
167
  switch (condition.operator) {
154
168
  case "contentTypeIs":
155
169
  case "eq":
@@ -162,9 +176,72 @@ const evaluateCondition = (condition, data) => {
162
176
  return false;
163
177
  }
164
178
  };
179
+ /**
180
+ * Immutably set `value` at a dotted `path`, cloning only the objects along the
181
+ * path and sharing every untouched subtree by reference. A missing intermediate
182
+ * becomes `{}`.
183
+ *
184
+ * Object keys only — a spread would turn an array into an object. The one
185
+ * caller passes `getRepeaterContextPath` output, which has no indices.
186
+ */
187
+ const setInShallow = (root, path, value) => {
188
+ const keys = path.split(".");
189
+ const leaf = keys.pop();
190
+ const out = { ...root };
191
+ let cursor = out;
192
+ for (const key of keys)
193
+ cursor = cursor[key] = { ...cursor[key] };
194
+ cursor[leaf] = value;
195
+ return out;
196
+ };
197
+ /**
198
+ * Answers both questions a ConditionBlock has to ask: does this condition pass,
199
+ * and what data should its children see.
200
+ *
201
+ * When the condition binds through a repeater, the bound value is projected
202
+ * onto the repeater's context path so descendants resolve against the matched
203
+ * branch. Everything off that path is shared by reference — the projection must
204
+ * not deep-copy the spec, which is large.
205
+ *
206
+ * Lives here, with `evaluateCondition`, because all three renderers (runtime,
207
+ * editor and RSC) need the identical answer and previously derived it
208
+ * separately. `shouldRender` is evaluated against the UNPROJECTED data, which
209
+ * is what all three did.
210
+ */
211
+ const resolveConditionScope = (condition, data) => {
212
+ const shouldRender = evaluateCondition(condition, data);
213
+ // A false condition renders nothing, so no descendant ever reads the scoped
214
+ // data — projecting it would rebuild the repeater spine for a subtree the
215
+ // caller is about to throw away.
216
+ if (!shouldRender)
217
+ return { shouldRender, scopedData: data };
218
+ const binding = condition?.dataBinding;
219
+ const dataPath = binding && getBindingString(binding);
220
+ const repeaterPath = binding &&
221
+ getRepeaterContextPath(binding.value);
222
+ if (!dataPath || !repeaterPath || dataPath === repeaterPath) {
223
+ // No sub-path to project: writing the value back where it already sits
224
+ // would only cost a clone and a fresh identity.
225
+ return { shouldRender, scopedData: data };
226
+ }
227
+ const bound = get(data, dataPath);
228
+ if (!bound)
229
+ return { shouldRender, scopedData: data };
230
+ return { shouldRender, scopedData: setInShallow(data, repeaterPath, bound) };
231
+ };
165
232
  function handleArrayCondition(condition, conditionValue) {
166
233
  const arrayValue = Array.isArray(conditionValue) ? conditionValue : [];
167
- return handleNumberComparison(condition.operator, arrayValue.length, condition.value);
234
+ // `convertValueByDataType` coerces only for `boolean` and `number` FIELD data
235
+ // types, so a length check on a `blocks` or `reference` field persisted "3"
236
+ // rather than 3 — and `isEqual(3, "3")` is false, which broke `eq` even when
237
+ // it reached here. The ordering operators only worked by JS coercion.
238
+ const target = Number(condition.value);
239
+ // A length can only be compared against a number. Anything else (a hand
240
+ // authored `subType: "length"` with a block uid, say) would otherwise compare
241
+ // against NaN and silently return false for every operator, including `neq`.
242
+ if (Number.isNaN(target))
243
+ return false;
244
+ return handleNumberComparison(condition.operator, arrayValue.length, target);
168
245
  }
169
246
  function handleNumberComparison(operator, value1, value2) {
170
247
  switch (operator) {
@@ -185,5 +262,5 @@ function handleNumberComparison(operator, value1, value2) {
185
262
  }
186
263
  }
187
264
 
188
- export { evaluateCondition };
265
+ export { evaluateCondition, resolveConditionScope };
189
266
  //# sourceMappingURL=conditionBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditionBlock.js","sources":["../../src/utils/conditionBlock.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAiBA,MAAM,yBAAyB,GAC7B,IAAI,GAAG,CAAoB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAErD,MAAM,yBAAyB,GAC7B,IAAI,GAAG,CAAoB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAEvD;;;;;AAKG;AACH,MAAM,wBAAwB,GAAwB,IAAI,GAAG,CAAS;AACpE,IAAA,GAAG,yBAAyB;AAC5B,IAAA,GAAG,yBAAyB;AAC7B,CAAA,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC1B,SAAoB,KAEpB,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC;AAElD;;;;;;;AAOG;AACH,MAAM,YAAY,GAAG,CAAC,KAAc,KAAa;IAC/C,IAAI,KAAK,IAAI,IAAI;AAAE,QAAA,OAAO,IAAI;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,KAAK,EAAE;AAClD,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACnD,IA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AAM,CAAC;AAC9E;AAEA,SAAS,sBAAsB,CAC7B,QAAgB,EAChB,MAAc,EACd,MAAc,EAAA;IAEd,QAAQ,QAAQ;AACd,QAAA,KAAK,IAAI;AACP,YAAA,OAAO,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;AAChC,QAAA,KAAK,KAAK;AACR,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;AACnC,QAAA,KAAK,IAAI;AACP,YAAA,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;AACtC,QAAA,KAAK,KAAK;AACR,YAAA,OAAO,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;AAC7C,QAAA,KAAK,IAAI;AACP,YAAA,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;AACnC,QAAA,KAAK,KAAK;AACR,YAAA,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1C,QAAA;AACE,YAAA,OAAO,KAAK;;AAElB;;;;"}
@@ -22,8 +22,27 @@ const isBrowser = () => {
22
22
  */
23
23
  const INCLUDE_DEPTH_COUNT = 3;
24
24
  // SDK Version constants for Studio Intelligence
25
- const SDK_VERSION = "3.1.0";
26
- const SCHEMA_VERSION = "1.0.0";
25
+ const SDK_VERSION = "4.0.0-alpha-d9df7dd.0";
26
+ /**
27
+ * Version of the composition spec this SDK writes and reads.
28
+ *
29
+ * Studio persists whatever the canvas SDK reports here onto the composition as
30
+ * `schema_version`, so it doubles as a marker of what a saved composition can be
31
+ * trusted to contain.
32
+ *
33
+ * 1.1.0 (COMPLETE_INCLUDES_FROM_SCHEMA_VERSION) — every fetch root's
34
+ * `data_sources[*].resolvedReferences` is recomputed on save and holds exactly
35
+ * the references it needs, including what this SDK used to work out at render
36
+ * (`derivePlacementIncludePaths`), so the SDK derives nothing (ADR 0018). Below
37
+ * that the sets were accumulated by union, and before 2026-07-17 they held only
38
+ * what the author had ticked — which is why the derivation still runs for them.
39
+ *
40
+ * RELEASE ORDER: released only after Studio saves complete sets for every fetch
41
+ * root (studio-ui#1303, which calls `derivePlacementIncludePaths` at save). An SDK
42
+ * reporting 1.1.0 to a Studio that does not yet do that would mark compositions
43
+ * as trustworthy when they are not.
44
+ */
45
+ const SCHEMA_VERSION = "1.1.0";
27
46
  const COMPOSABLE_DATA_ATTRIBUTES = {
28
47
  BUILDER: "data-composable-studio-builder",
29
48
  PLACEHOLDER: "data-composable-studio-placeholder",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../src/utils/constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEO,MAAM,SAAS,GAAG,MAAK;IAC5B,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW;AACvE;AAEA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,mBAAmB,GAAG;AAEnC;MACa,WAAW,GAAG;AACpB,MAAM,cAAc,GAAG;AAEvB,MAAM,0BAA0B,GAAG;AACxC,IAAA,OAAO,EAAE,gCAAgC;AACzC,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,EAAE,EAAE,2BAA2B;AAC/B,IAAA,QAAQ,EAAE,iCAAiC;AAC3C,IAAA,IAAI,EAAE,WAAW;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../src/utils/constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEO,MAAM,SAAS,GAAG,MAAK;IAC5B,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW;AACvE;AAEA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,mBAAmB,GAAG;AAEnC;MACa,WAAW,GAAG;AAC3B;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,cAAc,GAAG;AAEvB,MAAM,0BAA0B,GAAG;AACxC,IAAA,OAAO,EAAE,gCAAgC;AACzC,IAAA,WAAW,EAAE,oCAAoC;AACjD,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,IAAI,EAAE,6BAA6B;AACnC,IAAA,EAAE,EAAE,2BAA2B;AAC/B,IAAA,QAAQ,EAAE,iCAAiC;AAC3C,IAAA,IAAI,EAAE,WAAW;;;;;"}