@contentstack/studio-client 4.0.0 → 4.2.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 (124) hide show
  1. package/dist/breakpoints/BreakpointManager.js +3 -2
  2. package/dist/breakpoints/BreakpointManager.js.map +1 -1
  3. package/dist/breakpoints/breakpoint-origin.js +30 -0
  4. package/dist/breakpoints/breakpoint-origin.js.map +1 -0
  5. package/dist/canvas/canvas.type.js +1 -1
  6. package/dist/canvas/canvas.utils.js +213 -9
  7. package/dist/canvas/canvas.utils.js.map +1 -1
  8. package/dist/composable-studio/binding-defect-report.js +106 -0
  9. package/dist/composable-studio/binding-defect-report.js.map +1 -0
  10. package/dist/composable-studio/build-scoped-data.js +21 -11
  11. package/dist/composable-studio/build-scoped-data.js.map +1 -1
  12. package/dist/composable-studio/collect-data-needs.js +1 -1
  13. package/dist/composable-studio/data/pre-process-static-values.js +89 -19
  14. package/dist/composable-studio/data/pre-process-static-values.js.map +1 -1
  15. package/dist/composable-studio/delivery-setup-check.js +92 -0
  16. package/dist/composable-studio/delivery-setup-check.js.map +1 -0
  17. package/dist/composable-studio/resolution-failure-spec.js +53 -0
  18. package/dist/composable-studio/resolution-failure-spec.js.map +1 -0
  19. package/dist/composable-studio/resolution-telemetry.js +68 -0
  20. package/dist/composable-studio/resolution-telemetry.js.map +1 -0
  21. package/dist/composable-studio/sdk.js +683 -551
  22. package/dist/composable-studio/sdk.js.map +1 -1
  23. package/dist/composable-studio/section-binding/compute-all-section-auto-bindings.js +146 -0
  24. package/dist/composable-studio/section-binding/compute-all-section-auto-bindings.js.map +1 -0
  25. package/dist/composable-studio/section-binding/constants.js +27 -0
  26. package/dist/composable-studio/section-binding/constants.js.map +1 -0
  27. package/dist/composable-studio/section-binding/index.js +20 -0
  28. package/dist/composable-studio/section-binding/index.js.map +1 -0
  29. package/dist/composable-studio/section-binding/schema-path.js +112 -0
  30. package/dist/composable-studio/section-binding/schema-path.js.map +1 -0
  31. package/dist/composable-studio/section-binding/section-composition-auto-binding.js +815 -0
  32. package/dist/composable-studio/section-binding/section-composition-auto-binding.js.map +1 -0
  33. package/dist/composable-studio/section-binding/section-compositions.js +349 -0
  34. package/dist/composable-studio/section-binding/section-compositions.js.map +1 -0
  35. package/dist/composable-studio/section-binding/section-internal-ref-introspection.js +72 -0
  36. package/dist/composable-studio/section-binding/section-internal-ref-introspection.js.map +1 -0
  37. package/dist/composable-studio/section-binding/self-describe-section-bindings.js +132 -0
  38. package/dist/composable-studio/section-binding/self-describe-section-bindings.js.map +1 -0
  39. package/dist/composable-studio/section-binding/serialization.js +33 -0
  40. package/dist/composable-studio/section-binding/serialization.js.map +1 -0
  41. package/dist/composable-studio/section-data.js +5 -1
  42. package/dist/composable-studio/section-data.js.map +1 -1
  43. package/dist/composable-studio/setup-check-signal.js +48 -0
  44. package/dist/composable-studio/setup-check-signal.js.map +1 -0
  45. package/dist/composable-studio/studio-intelligence.manager.js +6 -2
  46. package/dist/composable-studio/studio-intelligence.manager.js.map +1 -1
  47. package/dist/composable-studio/weak-maps.js +3 -1
  48. package/dist/composable-studio/weak-maps.js.map +1 -1
  49. package/dist/config/config.schema.js +97 -104
  50. package/dist/config/config.schema.js.map +1 -1
  51. package/dist/config/process-user-config.js +41 -24
  52. package/dist/config/process-user-config.js.map +1 -1
  53. package/dist/config/stack-sdk-wrapper.js +22 -4
  54. package/dist/config/stack-sdk-wrapper.js.map +1 -1
  55. package/dist/context-menu/context-menu.js +1 -0
  56. package/dist/context-menu/context-menu.js.map +1 -1
  57. package/dist/dnd/dnd-manager.js +29 -0
  58. package/dist/dnd/dnd-manager.js.map +1 -1
  59. package/dist/editor.d.ts +42 -1
  60. package/dist/highlight-node/highlight-node-manager.js +89 -14
  61. package/dist/highlight-node/highlight-node-manager.js.map +1 -1
  62. package/dist/highlight-node/highlight-node.js +16 -4
  63. package/dist/highlight-node/highlight-node.js.map +1 -1
  64. package/dist/highlight-node/history-shortcut.js +78 -0
  65. package/dist/highlight-node/history-shortcut.js.map +1 -0
  66. package/dist/index.d.ts +1099 -353
  67. package/dist/index.js +19 -7
  68. package/dist/index.js.map +1 -1
  69. package/dist/query/query-executor.js +51 -9
  70. package/dist/query/query-executor.js.map +1 -1
  71. package/dist/renderer-mode.d.ts +68 -0
  72. package/dist/renderer-mode.js +2 -0
  73. package/dist/renderer-mode.js.map +1 -0
  74. package/dist/url-metadata/entry-check-key.js +14 -0
  75. package/dist/url-metadata/entry-check-key.js.map +1 -0
  76. package/dist/url-metadata/select-url-winner.js +64 -12
  77. package/dist/url-metadata/select-url-winner.js.map +1 -1
  78. package/dist/url-metadata/types.js +10 -1
  79. package/dist/url-metadata/types.js.map +1 -1
  80. package/dist/url-metadata/url-pattern-matcher.js +11 -2
  81. package/dist/url-metadata/url-pattern-matcher.js.map +1 -1
  82. package/dist/utils/canvas.js +0 -1
  83. package/dist/utils/canvas.js.map +1 -1
  84. package/dist/utils/check-bindings.js +5 -3
  85. package/dist/utils/check-bindings.js.map +1 -1
  86. package/dist/utils/classify-response-error.js +243 -33
  87. package/dist/utils/classify-response-error.js.map +1 -1
  88. package/dist/utils/composable-studio-error.js +7 -0
  89. package/dist/utils/composable-studio-error.js.map +1 -1
  90. package/dist/utils/conditionBlock.js +19 -6
  91. package/dist/utils/conditionBlock.js.map +1 -1
  92. package/dist/utils/constants.js +11 -2
  93. package/dist/utils/constants.js.map +1 -1
  94. package/dist/utils/http-error.constants.js +24 -1
  95. package/dist/utils/http-error.constants.js.map +1 -1
  96. package/dist/utils/include-path-rules.js +3 -2
  97. package/dist/utils/include-path-rules.js.map +1 -1
  98. package/dist/utils/load-error-classifier.js +18 -0
  99. package/dist/utils/load-error-classifier.js.map +1 -0
  100. package/dist/utils/parse-ui.js +27 -5
  101. package/dist/utils/parse-ui.js.map +1 -1
  102. package/dist/utils/preview-hash-refused.js +75 -0
  103. package/dist/utils/preview-hash-refused.js.map +1 -0
  104. package/dist/utils/reference_fetcher.js +79 -12
  105. package/dist/utils/reference_fetcher.js.map +1 -1
  106. package/dist/utils/require-stack.js +83 -20
  107. package/dist/utils/require-stack.js.map +1 -1
  108. package/dist/utils/serialize-for-inline-script.js +19 -0
  109. package/dist/utils/serialize-for-inline-script.js.map +1 -0
  110. package/dist/utils/served-by.js +32 -13
  111. package/dist/utils/served-by.js.map +1 -1
  112. package/dist/utils/spec-analyzer.js +24 -1
  113. package/dist/utils/spec-analyzer.js.map +1 -1
  114. package/dist/utils/studio-error-codes.js +34 -2
  115. package/dist/utils/studio-error-codes.js.map +1 -1
  116. package/dist/utils/studio-error.js +68 -7
  117. package/dist/utils/studio-error.js.map +1 -1
  118. package/dist/visual-builder/composition-save-event.js +36 -5
  119. package/dist/visual-builder/composition-save-event.js.map +1 -1
  120. package/package.json +12 -8
  121. package/dist/studio-internal/dist/utils/section-slot-walker.js +0 -63
  122. package/dist/studio-internal/dist/utils/section-slot-walker.js.map +0 -1
  123. package/dist/studio-internal/dist/utils/spec-compression.js +0 -43
  124. package/dist/studio-internal/dist/utils/spec-compression.js.map +0 -1
@@ -1,3 +1,67 @@
1
+ /**
2
+ * `JSON.parse` that reports unreadable input as `undefined` instead of
3
+ * throwing. `JSON.parse` can never itself yield `undefined`, so it is an
4
+ * unambiguous "could not read this" signal.
5
+ *
6
+ * The try covers only the parse. Widening it would also swallow throws from
7
+ * the shape check and item mapping below, turning an unrelated bug into a
8
+ * silently dropped binding with a misleading warning.
9
+ */
10
+ function tryParseJson(value) {
11
+ try {
12
+ return JSON.parse(value);
13
+ }
14
+ catch {
15
+ return undefined;
16
+ }
17
+ }
18
+ /**
19
+ * Whether a parsed value matches the bucket it was stored under. A value that
20
+ * was stringified twice parses back to a string rather than a list or an
21
+ * object, which is the shape this rejects.
22
+ *
23
+ * `null` is accepted for `object` because the bucket is chosen from the
24
+ * prop's declared type, not from the value, so an object-typed prop with no
25
+ * value legitimately stores `null`. It is rejected for `array` because
26
+ * mapping over it used to throw.
27
+ */
28
+ function matchesDataType(dataType, value) {
29
+ if (dataType === "array")
30
+ return Array.isArray(value);
31
+ return value === null || (typeof value === "object" && !Array.isArray(value));
32
+ }
33
+ const warnedStaticValues = new Set();
34
+ /**
35
+ * Reads a structured (array/object) static value, which the compositions CT
36
+ * stores as a JSON string. An API client can also write the value itself
37
+ * rather than its JSON text, so a non-string value skips the parse and is
38
+ * shape-checked as it is.
39
+ *
40
+ * Returns `undefined` rather than throwing when the stored value is
41
+ * unreadable or has the wrong shape. This runs while a composition's data is
42
+ * being built, so a throw fails the whole page instead of the single binding
43
+ * holding the bad value; the key is left out and that binding falls back to
44
+ * its component default.
45
+ *
46
+ * An unset prop and a corrupt one are deliberately different. Unset is an
47
+ * authored state with a defined answer, an empty list or object, so it is
48
+ * silent. Unreadable is corruption with no correct answer, so it warns - once
49
+ * per key, because callers re-read the whole bucket on every author edit.
50
+ */
51
+ function readStructuredValue(dataType, key, value) {
52
+ if (value === undefined || value === null || value === "") {
53
+ return dataType === "array" ? [] : {};
54
+ }
55
+ const parsed = typeof value === "string" ? tryParseJson(value) : value;
56
+ if (matchesDataType(dataType, parsed))
57
+ return parsed;
58
+ const warnedKey = `${dataType}:${key}`;
59
+ if (!warnedStaticValues.has(warnedKey)) {
60
+ warnedStaticValues.add(warnedKey);
61
+ console.warn(`[Composable Studio SDK] Ignoring ${dataType} static value "${key}": the stored value could not be read as ${dataType === "array" ? "a list" : "an object"}. The binding falls back to its component default.`);
62
+ }
63
+ return undefined;
64
+ }
1
65
  /**
2
66
  * Processes the raw static values and stored them against their static value UID.
3
67
  *
@@ -31,34 +95,40 @@ function preProcessStaticValues(rawStaticValues) {
31
95
  // it as a JSON string. Parse before processing — otherwise Object.entries
32
96
  // iterates string characters and every static value is silently dropped.
33
97
  if (typeof rawStaticValues === "string") {
34
- try {
35
- rawStaticValues = JSON.parse(rawStaticValues);
36
- }
37
- catch {
38
- return {};
39
- }
40
- if (!rawStaticValues || typeof rawStaticValues !== "object")
98
+ const parsed = tryParseJson(rawStaticValues);
99
+ if (!parsed || typeof parsed !== "object")
41
100
  return {};
101
+ rawStaticValues = parsed;
42
102
  }
43
103
  const processedStaticValues = {};
104
+ if (typeof rawStaticValues !== "object" || Array.isArray(rawStaticValues)) {
105
+ return processedStaticValues;
106
+ }
44
107
  Object.entries(rawStaticValues).forEach(([dataType, staticContent]) => {
45
108
  if (!Array.isArray(staticContent))
46
109
  return;
47
110
  for (const staticItem of staticContent) {
48
- if (dataType === "object") {
49
- processedStaticValues[staticItem.key] = JSON.parse(staticItem.value || "{}");
111
+ // An item without a string key cannot be bound to: skip it.
112
+ if (!staticItem ||
113
+ typeof staticItem !== "object" ||
114
+ typeof staticItem.key !== "string") {
50
115
  continue;
51
116
  }
52
- if (dataType === "array") {
53
- const parsedArray = JSON.parse(staticItem.value || "[]");
54
- processedStaticValues[staticItem.key] = parsedArray
55
- .map((item) => {
56
- const parsedValue = parseStringValue(item);
57
- if (parsedValue.isValid) {
58
- return parsedValue.value;
59
- }
60
- })
61
- .filter(Boolean);
117
+ if (dataType === "object" || dataType === "array") {
118
+ const parsed = readStructuredValue(dataType, staticItem.key, staticItem.value);
119
+ if (parsed === undefined)
120
+ continue;
121
+ processedStaticValues[staticItem.key] =
122
+ dataType === "array"
123
+ ? parsed
124
+ .map((item) => {
125
+ const parsedItem = parseStringValue(item);
126
+ if (parsedItem.isValid) {
127
+ return parsedItem.value;
128
+ }
129
+ })
130
+ .filter(Boolean)
131
+ : parsed;
62
132
  continue;
63
133
  }
64
134
  if (dataType === "any" || dataType === "json_rte") {
@@ -1 +1 @@
1
- {"version":3,"file":"pre-process-static-values.js","sources":["../../../src/composable-studio/data/pre-process-static-values.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAU,sBAAsB,CACpC,eAAwC,EAAA;AAExC,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,EAAE;;;;AAI/B,IAAA,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;AACv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E;YAC3B,OAAO;gBACL,KAAK,EAAE,CAAC,QAAQ;AAChB,gBAAA,OAAO,EAAE,IAAI;aACd;QACH;;AAGA,QAAA,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;;AAEhD,YAAA,IAAI,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,EAAE;gBACzD,OAAO;AACL,oBAAA,KAAK,EAAE,WAAW;AAClB,oBAAA,OAAO,EAAE,IAAI;iBACd;YACH;;AAGA,YAAA,IACE,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC;AACpC,gBAAA,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC;AAC9B,gBAAA,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,EAC7B;gBACA,OAAO;AACL,oBAAA,KAAK,EAAE,WAAW;AAClB,oBAAA,OAAO,EAAE,IAAI;iBACd;YACH;QACF;;AAGA,QAAA,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACjD,OAAO;AACL,gBAAA,KAAK,EAAE,OAAO;AACd,gBAAA,OAAO,EAAE,IAAI;aACd;QACH;;QAGA,OAAO;AACL,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,KAAK,EAAE,CAAA,eAAA,EACL,SAAS,YAAY,KAAK,GAAG,SAAS,CAAC,OAAO,GAAG,eACnD,CAAA,CAAE;SACH;IACH;AACF;;;;"}
1
+ {"version":3,"file":"pre-process-static-values.js","sources":["../../../src/composable-studio/data/pre-process-static-values.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;;;;AAQG;AACH,SAAS,YAAY,CAAC,KAAa,EAAA;AACjC,IAAA,IAAI;AACF,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IA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AAK,GAAG,SAAS,CAAC,OAAO,GAAG,eACnD,CAAA,CAAE;SACH;IACH;AACF;;;;"}
@@ -0,0 +1,92 @@
1
+ import { ComposableStudioError } from '../utils/composable-studio-error.js';
2
+ import { loadErrorClassifier } from '../utils/load-error-classifier.js';
3
+ import { requireStack, requireCompositionContentType } from '../utils/require-stack.js';
4
+
5
+ /** Long enough for a slow region, short enough that a dead host is named promptly. */
6
+ const DEFAULT_TIMEOUT_MS = 10_000;
7
+ /** The request goes to the delivery host, never through live preview. */
8
+ const ROUTE = { servedBy: "cdn" };
9
+ /**
10
+ * Whether the site's delivery setup works, asked with one request.
11
+ *
12
+ * Inside Studio's canvas, live preview sends every page request to the preview
13
+ * host with the preview token, so the delivery host, delivery token and
14
+ * environment the published site depends on are never used there. A wrong one
15
+ * breaks the published site while the canvas looks fine. This is the one request
16
+ * that uses them.
17
+ *
18
+ * It is a plain `fetch`, not the delivery SDK: the delivery SDK retries a 401
19
+ * like a rate limit and reports it with no status, and its stack carries the
20
+ * live preview hash for every request it makes.
21
+ *
22
+ * Resolves `undefined` when Contentstack accepted the setup, an empty list
23
+ * included. Never rejects.
24
+ */
25
+ async function checkDeliverySetup(config, options = {}) {
26
+ let url;
27
+ let headers;
28
+ try {
29
+ const stack = requireStack(config);
30
+ const contentTypeUid = requireCompositionContentType(config);
31
+ url = new URL(`https://${stack.host}/v3/content_types/${encodeURIComponent(contentTypeUid)}/entries`);
32
+ url.searchParams.set("environment", stack.environment ?? "");
33
+ const locale = stack.locale ?? config.locale;
34
+ if (locale)
35
+ url.searchParams.set("locale", locale);
36
+ url.searchParams.set("limit", "1");
37
+ url.searchParams.append("only[BASE][]", "uid");
38
+ headers = {
39
+ api_key: stack.apiKey,
40
+ access_token: stack.deliveryToken ?? "",
41
+ ...(stack.branch ? { branch: stack.branch } : {}),
42
+ };
43
+ }
44
+ catch (error) {
45
+ // A value that is missing or cannot work is known without asking.
46
+ return await asStudioError(error, config);
47
+ }
48
+ let response;
49
+ try {
50
+ response = await fetch(url, {
51
+ headers,
52
+ signal: timeoutSignal(options.timeoutMs ?? DEFAULT_TIMEOUT_MS),
53
+ });
54
+ }
55
+ catch {
56
+ // No reply, or none in time: nothing answered.
57
+ const { diagnoseUnreadableResponse } = await loadErrorClassifier();
58
+ return diagnoseUnreadableResponse({ status: 0, error_code: "ERR_NETWORK" }, config, ROUTE);
59
+ }
60
+ if (response.ok)
61
+ return undefined;
62
+ const body = (await response.json().catch(() => ({})));
63
+ const reply = {
64
+ status: response.status,
65
+ error_code: body.error_code,
66
+ error_message: body.error_message,
67
+ };
68
+ const { classifyResponseError, diagnoseUnreadableResponse } = await loadErrorClassifier();
69
+ return (classifyResponseError(reply, config, ROUTE) ??
70
+ diagnoseUnreadableResponse(reply, config, ROUTE));
71
+ }
72
+ /**
73
+ * An abort signal that fires after `ms`. `AbortSignal.timeout` is missing from some
74
+ * browsers still in use (Safari before 16), and calling it there would throw — which
75
+ * would read as a host that never answered.
76
+ */
77
+ function timeoutSignal(ms) {
78
+ if (typeof AbortSignal.timeout === "function")
79
+ return AbortSignal.timeout(ms);
80
+ const controller = new AbortController();
81
+ setTimeout(() => controller.abort(), ms);
82
+ return controller.signal;
83
+ }
84
+ async function asStudioError(error, config) {
85
+ if (error instanceof ComposableStudioError)
86
+ return error;
87
+ const { diagnoseUnreadableResponse } = await loadErrorClassifier();
88
+ return diagnoseUnreadableResponse(error, config, ROUTE);
89
+ }
90
+
91
+ export { ROUTE, checkDeliverySetup };
92
+ //# sourceMappingURL=delivery-setup-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-setup-check.js","sources":["../../src/composable-studio/delivery-setup-check.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AASA;AACA,MAAM,kBAAkB,GAAG,MAAM;AAEjC;MACa,KAAK,GAAiB,EAAE,QAAQ,EAAE,KAAK;AAEpD;;;;;;;;;;;;;;;AAeG;AACI,eAAe,kBAAkB,CACtC,MAAc,EACd,UAAkC,EAAE,EAAA;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,MAAM,EAAE,KAAK,CAAC;AACzD;;;;"}
@@ -0,0 +1,53 @@
1
+ import { INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
2
+
3
+ /**
4
+ * Never a real composition's uid, so the push to Studio — which only happens
5
+ * for the composition being edited — can never hand Studio a failure.
6
+ */
7
+ const RESOLUTION_FAILURE_COMPOSABLE_UID = "__studio_resolution_failure__";
8
+ /**
9
+ * The spec a fetch that failed inside Studio's canvas resolves with: a complete
10
+ * composition whose only node renders the failure. Complete, so every helper
11
+ * that reads a spec keeps working on it.
12
+ */
13
+ function buildResolutionFailureSpec(telemetry) {
14
+ const telemetryProp = {
15
+ type: "object",
16
+ value: telemetry,
17
+ };
18
+ const data = { dataSources: {}, static_value: {} };
19
+ const compositionEntry = {
20
+ uid: RESOLUTION_FAILURE_COMPOSABLE_UID,
21
+ composable_uid: RESOLUTION_FAILURE_COMPOSABLE_UID,
22
+ title: "",
23
+ url: "url" in telemetry.query ? telemetry.query.url : undefined,
24
+ locale: "",
25
+ tags: [],
26
+ created_by: "",
27
+ updated_by: "",
28
+ created_at: "",
29
+ updated_at: "",
30
+ ui: "",
31
+ data_sources: "",
32
+ };
33
+ return {
34
+ data,
35
+ compositionEntry,
36
+ ui: {
37
+ uid: RESOLUTION_FAILURE_COMPOSABLE_UID,
38
+ type: INTERNAL_COMPONENTS_NAMES.RESOLUTION_FAILURE,
39
+ attrs: {},
40
+ metadata: {},
41
+ props: { telemetry: telemetryProp },
42
+ slots: {},
43
+ styles: {},
44
+ },
45
+ };
46
+ }
47
+ /** Whether a spec renders a failed fetch rather than a composition. */
48
+ function isResolutionFailureSpec(spec) {
49
+ return spec?.ui?.type === INTERNAL_COMPONENTS_NAMES.RESOLUTION_FAILURE;
50
+ }
51
+
52
+ export { buildResolutionFailureSpec, isResolutionFailureSpec };
53
+ //# sourceMappingURL=resolution-failure-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-failure-spec.js","sources":["../../src/composable-studio/resol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B;AACxE;;;;"}
@@ -0,0 +1,68 @@
1
+ import { pick } from 'lodash-es';
2
+ import { ComposableStudioError } from '../utils/composable-studio-error.js';
3
+ import { serializeStudioError } from '../utils/studio-error.js';
4
+
5
+ /** Which identifier the SDK resolves by, mirroring `fetchComposition`'s branch order. */
6
+ function getPrioritizedBy(query) {
7
+ if ("composableUid" in query && query.composableUid)
8
+ return "composableUid";
9
+ if ("templateContentTypeUid" in query && query.templateContentTypeUid)
10
+ return "templateContentTypeUid";
11
+ return "url";
12
+ }
13
+ /**
14
+ * The resolution telemetry for one fetch: what was asked for, the candidates,
15
+ * the winner, or why it failed. One builder for every surface, so Studio reads
16
+ * the same shape wherever the fetch ran. Plain data, because a server render
17
+ * carries it to the browser inside the page.
18
+ */
19
+ function buildResolutionTelemetry({ query, options, isCanvasComponent = false, spec, error, }) {
20
+ const prioritizedBy = getPrioritizedBy(query);
21
+ const entry = spec?.compositionEntry;
22
+ const studioError = error instanceof ComposableStudioError ? error : undefined;
23
+ let shortlisted;
24
+ if (spec?.urlResolution?.shortlisted?.length) {
25
+ // URL metadata path: every candidate considered, with specificity. The content
26
+ // type lets Studio tell templates sharing a URL on one content type (expected
27
+ // until publish settles it) from a clash across content types.
28
+ shortlisted = spec.urlResolution.shortlisted.map((match) => pick(match, [
29
+ "composable_uid",
30
+ "url",
31
+ "specificity",
32
+ "connected_content_type",
33
+ "connectedEntryResult",
34
+ ]));
35
+ }
36
+ else if (entry && prioritizedBy !== "url") {
37
+ // uid/ct queries resolve to exactly one composition — itself.
38
+ shortlisted = [pick(entry, ["composable_uid", "uid", "title", "url"])];
39
+ }
40
+ const telemetry = {
41
+ kind: "composition-resolution",
42
+ isCanvasComponent,
43
+ query,
44
+ options: options && pick(options, ["locale", "variantAlias", "templateEntryUid"]),
45
+ prioritizedBy,
46
+ shortlisted,
47
+ urlWinner: spec?.urlResolution?.winner,
48
+ resolved: entry &&
49
+ pick(entry, [
50
+ "composable_uid",
51
+ "uid",
52
+ "title",
53
+ "url",
54
+ "connected_content_type",
55
+ ]),
56
+ // On success it comes off the spec; on failure the error carries its own
57
+ // copy of the same block.
58
+ context: spec?.requestContext ?? studioError?.context,
59
+ error: error ? serializeStudioError(error) : undefined,
60
+ timestamp: Date.now(),
61
+ };
62
+ // A JSON copy, not a structured clone: it drops `undefined` fields and
63
+ // anything that is not plain data, which is what a framework will send.
64
+ return JSON.parse(JSON.stringify(telemetry));
65
+ }
66
+
67
+ export { buildResolutionTelemetry };
68
+ //# sourceMappingURL=resolution-telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-telemetry.js","sources":["../../src/composable-studio/resolution-telemetry.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAsBA;AACA,SAAS,gBAAgB,CACvB,KAAuB,EAAA;AAEvB,IAAA,IAAI,eAAe,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa;AAAE,QAAA,OAAO,eAAe;AAC3E,IAAA,IAAI,wBAAwB,IAAI,KAAK,IAAI,KAAK,CAAC,sBAAsB;AACnE,QAAA,OAAO,wBAAwB;AACjC,IAAA,OAAO,KAAK;AACd;AAEA;;;;;AAKG;AACG,SAAU,wBAAwB,CAAC,EACvC,KAAK,EACL,OAAO,EACP,iBAAiB,GAAG,KAAK,EACzB,IAAI,EACJ,KAAK,GACoB,EAAA;AACzB,IAAA,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC;AAC7C,IAAA,MAAM,KAAK,GAAG,IAAI,EAAE,gBAAgB;AACpC,IAAA,MAAM,WAAW,GACf,KAAK,YAAY,qBAAqB,GAAG,KAAK,GAAG,SAAS;AAE5D,IAAA,IAAI,WAAoE;IACxE,IAAI,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE;;;;AAI5C,QAAA,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,KACrD,IAAI,CAAC,KAAK,EAAE;YACV,gBAAgB;YAChB,KAAK;Y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