@contentful/experience-design-system-cli 2.37.1-dev-build-2ed60464.0 → 2.37.1-dev-build-41421938.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.
package/dist/app.js CHANGED
@@ -15165,6 +15165,35 @@ async function emitInvokedIfReady() {
15165
15165
  }, state.sessionId, { flush: true });
15166
15166
  }
15167
15167
 
15168
+ // packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js
15169
+ function countWriteResult(items, entityType) {
15170
+ const subset = items.filter((item) => item.entityType === entityType);
15171
+ return {
15172
+ created_count: subset.filter((item) => item.action === "create" && item.status === "succeeded").length,
15173
+ updated_count: subset.filter((item) => item.action === "update" && item.status === "succeeded").length,
15174
+ failed_count: subset.filter((item) => item.status === "failed").length
15175
+ };
15176
+ }
15177
+ function recordApplyOutcome(client2, spaceId, environmentId, operation) {
15178
+ setCommandContext({
15179
+ space_key: spaceId,
15180
+ environment_key: environmentId,
15181
+ x_contentful_request_id: client2.getLastRequestId()
15182
+ });
15183
+ enrichCommandResult({
15184
+ dsi_operation_id: operation.sys.id,
15185
+ component_type_result: countWriteResult(operation.items ?? [], "ComponentType"),
15186
+ design_token_result: countWriteResult(operation.items ?? [], "DesignToken")
15187
+ });
15188
+ }
15189
+ function recordContentfulContext(client2, spaceId, environmentId) {
15190
+ setCommandContext({
15191
+ space_key: spaceId,
15192
+ environment_key: environmentId,
15193
+ x_contentful_request_id: client2.getLastRequestId()
15194
+ });
15195
+ }
15196
+
15168
15197
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
15169
15198
  var DEFAULT_TIMEOUT_MS2 = 5 * 60 * 1e3;
15170
15199
  var MapTokensRunFailure = class _MapTokensRunFailure extends Error {
@@ -27672,6 +27701,7 @@ function clearedValidationErrorState() {
27672
27701
  }
27673
27702
  async function runPreview(input, deps) {
27674
27703
  if (shouldBypassPreview(input.state)) return buildSkippedPreviewTransition();
27704
+ setCommandContext({ space_key: input.spaceId, environment_key: input.environmentId });
27675
27705
  try {
27676
27706
  const client2 = deps.createClient({
27677
27707
  cmaToken: input.cmaToken,
@@ -27720,6 +27750,7 @@ async function runPreview(input, deps) {
27720
27750
  db.close();
27721
27751
  }
27722
27752
  }
27753
+ recordContentfulContext(client2, input.spaceId, input.environmentId);
27723
27754
  if (isEmptyPreview(preview)) {
27724
27755
  return {
27725
27756
  step: "done",
@@ -27885,6 +27916,7 @@ async function runPush(input, deps, onPatch) {
27885
27916
  } catch (logErr) {
27886
27917
  safeLog(deps, { pollLogError: String(logErr) });
27887
27918
  }
27919
+ recordApplyOutcome(client2, input.spaceId, input.environmentId, operation);
27888
27920
  const pushResult = resultOf(operation, preview);
27889
27921
  const pushSucceeded = pushResult.componentTypes.failed === 0 && pushResult.designTokens.failed === 0 && operation.sys.status !== "failed";
27890
27922
  if (pushSucceeded && input.state.lastRunId) {
package/dist/index.js CHANGED
@@ -16270,6 +16270,33 @@ var init_tracker = __esm({
16270
16270
  });
16271
16271
 
16272
16272
  // packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js
16273
+ function countWriteResult(items, entityType) {
16274
+ const subset = items.filter((item) => item.entityType === entityType);
16275
+ return {
16276
+ created_count: subset.filter((item) => item.action === "create" && item.status === "succeeded").length,
16277
+ updated_count: subset.filter((item) => item.action === "update" && item.status === "succeeded").length,
16278
+ failed_count: subset.filter((item) => item.status === "failed").length
16279
+ };
16280
+ }
16281
+ function recordApplyOutcome(client2, spaceId, environmentId, operation) {
16282
+ setCommandContext({
16283
+ space_key: spaceId,
16284
+ environment_key: environmentId,
16285
+ x_contentful_request_id: client2.getLastRequestId()
16286
+ });
16287
+ enrichCommandResult({
16288
+ dsi_operation_id: operation.sys.id,
16289
+ component_type_result: countWriteResult(operation.items ?? [], "ComponentType"),
16290
+ design_token_result: countWriteResult(operation.items ?? [], "DesignToken")
16291
+ });
16292
+ }
16293
+ function recordContentfulContext(client2, spaceId, environmentId) {
16294
+ setCommandContext({
16295
+ space_key: spaceId,
16296
+ environment_key: environmentId,
16297
+ x_contentful_request_id: client2.getLastRequestId()
16298
+ });
16299
+ }
16273
16300
  var init_apply2 = __esm({
16274
16301
  "packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js"() {
16275
16302
  "use strict";
@@ -31807,6 +31834,7 @@ function clearedValidationErrorState() {
31807
31834
  }
31808
31835
  async function runPreview(input, deps) {
31809
31836
  if (shouldBypassPreview(input.state)) return buildSkippedPreviewTransition();
31837
+ setCommandContext({ space_key: input.spaceId, environment_key: input.environmentId });
31810
31838
  try {
31811
31839
  const client2 = deps.createClient({
31812
31840
  cmaToken: input.cmaToken,
@@ -31855,6 +31883,7 @@ async function runPreview(input, deps) {
31855
31883
  db.close();
31856
31884
  }
31857
31885
  }
31886
+ recordContentfulContext(client2, input.spaceId, input.environmentId);
31858
31887
  if (isEmptyPreview(preview)) {
31859
31888
  return {
31860
31889
  step: "done",
@@ -32025,6 +32054,7 @@ async function runPush(input, deps, onPatch) {
32025
32054
  } catch (logErr) {
32026
32055
  safeLog(deps, { pollLogError: String(logErr) });
32027
32056
  }
32057
+ recordApplyOutcome(client2, input.spaceId, input.environmentId, operation);
32028
32058
  const pushResult = resultOf(operation, preview);
32029
32059
  const pushSucceeded = pushResult.componentTypes.failed === 0 && pushResult.designTokens.failed === 0 && operation.sys.status !== "failed";
32030
32060
  if (pushSucceeded && input.state.lastRunId) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-2ed60464.0",
3
+ "version": "2.37.1-dev-build-41421938.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,6 +4,8 @@ import { type CDFDocument, type DTCGTokenEntry, type ServerPreviewResponse } fro
4
4
  import type { FlowPatch, FlowState } from './types.js';
5
5
  type PreviewClient = {
6
6
  previewImport(cdf: CDFDocument): Promise<ServerPreviewResponse>;
7
+ /** Request id of the most recent response, used by `recordContentfulContext` for analytics correlation. */
8
+ getLastRequestId(): string | undefined;
7
9
  };
8
10
  /** The outside world `runPreview` talks to, so each branch can be tested without a database or a network. */
9
11
  export interface PreviewDeps {
@@ -8,6 +8,8 @@ type PushClient = {
8
8
  pollOperation(operationId: string, options: {
9
9
  onProgress?: (operation: ApplyOperationResponse) => void;
10
10
  }): Promise<ApplyOperationResponse>;
11
+ /** Request id of the most recent response, used by `recordApplyOutcome` for analytics correlation. */
12
+ getLastRequestId(): string | undefined;
11
13
  };
12
14
  /** The outside world `runPush` talks to, so each branch can be tested without a network or a run history. */
13
15
  export interface PushDeps {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-2ed60464.0",
3
+ "version": "2.37.1-dev-build-41421938.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-2ed60464.0",
3
+ "version": "2.37.1-dev-build-41421938.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-2ed60464.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-2ed60464.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-41421938.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-41421938.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",