@cross-deck/node 1.5.3 → 1.6.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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AliasIdentityInput, a as AliasResult, b as AuditDecision, c as AuditEntry, B as Breadcrumb, d as BreadcrumbCategory, e as BreadcrumbLevel, C as CROSSDECK_API_VERSION, f as CapturedError, g as Contract, h as ContractAppliesTo, i as ContractFailureInput, j as ContractPillar, k as ContractStatus, l as ContractTestRef, m as CrossdeckAuthenticationError, n as CrossdeckConfigurationError, o as CrossdeckContracts, p as CrossdeckError, q as CrossdeckErrorPayload, r as CrossdeckErrorType, s as CrossdeckInternalError, t as CrossdeckNetworkError, u as CrossdeckPermissionError, v as CrossdeckRateLimitError, w as CrossdeckServer, x as CrossdeckServerOptions, y as CrossdeckValidationError, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT_MS, E as Diagnostics, F as EntitlementCacheOptions, G as EntitlementMutationResult, H as EntitlementStore, I as EntitlementsListResponse, J as EntitlementsListener, K as Environment, L as ErrorCaptureConfig, M as ErrorLevel, N as EventProperties, O as ForgetResult, P as GrantDuration, Q as GrantEntitlementInput, R as GroupMembership, S as HeartbeatResponse, T as HttpRequestInfo, U as HttpResponseInfo, V as HttpRetriesConfig, W as IdentifyOptions, X as IdentityHints, Y as IngestOptions, Z as IngestResponse, _ as PublicEntitlement, $ as PurchaseResult, a0 as RequestOptions, a1 as RevokeEntitlementInput, a2 as RuntimeHost, a3 as RuntimeInfo, a4 as ServerEvent, a5 as StackFrame, a6 as StoredEntitlements, a7 as SyncPurchaseInput, a8 as makeCrossdeckError } from './crossdeck-server-BFTTwCEP.mjs';
1
+ export { A as AliasIdentityInput, a as AliasResult, b as AuditDecision, c as AuditEntry, B as Breadcrumb, d as BreadcrumbCategory, e as BreadcrumbLevel, C as CROSSDECK_API_VERSION, f as CapturedError, g as Contract, h as ContractAppliesTo, i as ContractFailureInput, j as ContractPillar, k as ContractStatus, l as ContractTestRef, m as CrossdeckAuthenticationError, n as CrossdeckConfigurationError, o as CrossdeckContracts, p as CrossdeckError, q as CrossdeckErrorPayload, r as CrossdeckErrorType, s as CrossdeckInternalError, t as CrossdeckNetworkError, u as CrossdeckPermissionError, v as CrossdeckRateLimitError, w as CrossdeckServer, x as CrossdeckServerOptions, y as CrossdeckValidationError, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT_MS, E as Diagnostics, F as EntitlementCacheOptions, G as EntitlementMutationResult, H as EntitlementStore, I as EntitlementsListResponse, J as EntitlementsListener, K as Environment, L as ErrorCaptureConfig, M as ErrorLevel, N as EventProperties, O as ForgetResult, P as GrantDuration, Q as GrantEntitlementInput, R as GroupMembership, S as HeartbeatResponse, T as HttpRequestInfo, U as HttpResponseInfo, V as HttpRetriesConfig, W as IdentifyOptions, X as IdentityHints, Y as IngestOptions, Z as IngestResponse, _ as PublicEntitlement, $ as PurchaseResult, a0 as RequestOptions, a1 as RevokeEntitlementInput, a2 as RuntimeHost, a3 as RuntimeInfo, a4 as ServerEvent, a5 as StackFrame, a6 as StoredEntitlements, a7 as SyncPurchaseInput, a8 as makeCrossdeckError } from './crossdeck-server-C1Ue0rv4.mjs';
2
2
  import 'node:events';
3
3
 
4
4
  /**
@@ -17,7 +17,7 @@ import 'node:events';
17
17
  *
18
18
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
19
19
  */
20
- declare const SDK_VERSION = "1.5.3";
20
+ declare const SDK_VERSION = "1.6.0";
21
21
  declare const SDK_NAME = "@cross-deck/node";
22
22
 
23
23
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AliasIdentityInput, a as AliasResult, b as AuditDecision, c as AuditEntry, B as Breadcrumb, d as BreadcrumbCategory, e as BreadcrumbLevel, C as CROSSDECK_API_VERSION, f as CapturedError, g as Contract, h as ContractAppliesTo, i as ContractFailureInput, j as ContractPillar, k as ContractStatus, l as ContractTestRef, m as CrossdeckAuthenticationError, n as CrossdeckConfigurationError, o as CrossdeckContracts, p as CrossdeckError, q as CrossdeckErrorPayload, r as CrossdeckErrorType, s as CrossdeckInternalError, t as CrossdeckNetworkError, u as CrossdeckPermissionError, v as CrossdeckRateLimitError, w as CrossdeckServer, x as CrossdeckServerOptions, y as CrossdeckValidationError, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT_MS, E as Diagnostics, F as EntitlementCacheOptions, G as EntitlementMutationResult, H as EntitlementStore, I as EntitlementsListResponse, J as EntitlementsListener, K as Environment, L as ErrorCaptureConfig, M as ErrorLevel, N as EventProperties, O as ForgetResult, P as GrantDuration, Q as GrantEntitlementInput, R as GroupMembership, S as HeartbeatResponse, T as HttpRequestInfo, U as HttpResponseInfo, V as HttpRetriesConfig, W as IdentifyOptions, X as IdentityHints, Y as IngestOptions, Z as IngestResponse, _ as PublicEntitlement, $ as PurchaseResult, a0 as RequestOptions, a1 as RevokeEntitlementInput, a2 as RuntimeHost, a3 as RuntimeInfo, a4 as ServerEvent, a5 as StackFrame, a6 as StoredEntitlements, a7 as SyncPurchaseInput, a8 as makeCrossdeckError } from './crossdeck-server-BFTTwCEP.js';
1
+ export { A as AliasIdentityInput, a as AliasResult, b as AuditDecision, c as AuditEntry, B as Breadcrumb, d as BreadcrumbCategory, e as BreadcrumbLevel, C as CROSSDECK_API_VERSION, f as CapturedError, g as Contract, h as ContractAppliesTo, i as ContractFailureInput, j as ContractPillar, k as ContractStatus, l as ContractTestRef, m as CrossdeckAuthenticationError, n as CrossdeckConfigurationError, o as CrossdeckContracts, p as CrossdeckError, q as CrossdeckErrorPayload, r as CrossdeckErrorType, s as CrossdeckInternalError, t as CrossdeckNetworkError, u as CrossdeckPermissionError, v as CrossdeckRateLimitError, w as CrossdeckServer, x as CrossdeckServerOptions, y as CrossdeckValidationError, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT_MS, E as Diagnostics, F as EntitlementCacheOptions, G as EntitlementMutationResult, H as EntitlementStore, I as EntitlementsListResponse, J as EntitlementsListener, K as Environment, L as ErrorCaptureConfig, M as ErrorLevel, N as EventProperties, O as ForgetResult, P as GrantDuration, Q as GrantEntitlementInput, R as GroupMembership, S as HeartbeatResponse, T as HttpRequestInfo, U as HttpResponseInfo, V as HttpRetriesConfig, W as IdentifyOptions, X as IdentityHints, Y as IngestOptions, Z as IngestResponse, _ as PublicEntitlement, $ as PurchaseResult, a0 as RequestOptions, a1 as RevokeEntitlementInput, a2 as RuntimeHost, a3 as RuntimeInfo, a4 as ServerEvent, a5 as StackFrame, a6 as StoredEntitlements, a7 as SyncPurchaseInput, a8 as makeCrossdeckError } from './crossdeck-server-C1Ue0rv4.js';
2
2
  import 'node:events';
3
3
 
4
4
  /**
@@ -17,7 +17,7 @@ import 'node:events';
17
17
  *
18
18
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
19
19
  */
20
- declare const SDK_VERSION = "1.5.3";
20
+ declare const SDK_VERSION = "1.6.0";
21
21
  declare const SDK_NAME = "@cross-deck/node";
22
22
 
23
23
  /**
package/dist/index.mjs CHANGED
@@ -320,7 +320,7 @@ function byteLength(s) {
320
320
  import * as https from "https";
321
321
 
322
322
  // src/_version.ts
323
- var SDK_VERSION = "1.5.3";
323
+ var SDK_VERSION = "1.6.0";
324
324
  var SDK_NAME = "@cross-deck/node";
325
325
 
326
326
  // src/_diagnostic-telemetry.ts
@@ -904,6 +904,11 @@ var EventQueue = class {
904
904
  try {
905
905
  const env = this.cfg.envelope();
906
906
  const body = {
907
+ // Event Envelope v1 §1 — schema/wire version the server uses to
908
+ // decide whether it can parse this payload. Integer 1; only bumped
909
+ // on a breaking wire change. Distinct from sdk.version (which
910
+ // answers "which build?") — two questions, two fields.
911
+ envelopeVersion: 1,
907
912
  events: batch,
908
913
  sdk: env.sdk
909
914
  };
@@ -1888,6 +1893,25 @@ function runtimeInfoToProperties(info) {
1888
1893
  if (info.appVersion) out.appVersion = info.appVersion;
1889
1894
  return out;
1890
1895
  }
1896
+ function buildEventContext(info, sdkName, sdkVersion) {
1897
+ const ctx = {
1898
+ // Common fields (spec §4, all platforms)
1899
+ os: info.platform,
1900
+ osVersion: info.platformRelease,
1901
+ appVersion: info.appVersion ?? null,
1902
+ sdkName,
1903
+ sdkVersion,
1904
+ // locale / timezone: Node has no process-level locale by default;
1905
+ // surface them from the environment if available, otherwise null.
1906
+ locale: typeof process !== "undefined" && process.env["LANG"] || null,
1907
+ timezone: typeof Intl !== "undefined" && Intl.DateTimeFormat().resolvedOptions().timeZone || null,
1908
+ // Node-specific runtime context (spec §4 Node section)
1909
+ nodeVersion: info.nodeVersion,
1910
+ host: info.host,
1911
+ region: info.region ?? null
1912
+ };
1913
+ return ctx;
1914
+ }
1891
1915
 
1892
1916
  // src/flush-on-exit.ts
1893
1917
  var SIGNALS = ["SIGTERM", "SIGINT"];
@@ -2555,6 +2579,8 @@ var CrossdeckServer = class extends EventEmitter {
2555
2579
  processAnonymousId;
2556
2580
  runtime;
2557
2581
  runtimeProperties;
2582
+ /** Envelope v1 §4 context object — built once at SDK init, reused on every event. */
2583
+ eventContext;
2558
2584
  breadcrumbs;
2559
2585
  eventQueue;
2560
2586
  errorTracker;
@@ -2572,6 +2598,23 @@ var CrossdeckServer = class extends EventEmitter {
2572
2598
  */
2573
2599
  entitlementStore;
2574
2600
  debug;
2601
+ /**
2602
+ * Event Envelope v1 §3 — per-session monotonic sequence counter.
2603
+ *
2604
+ * Node has no mobile "session" lifecycle (no app launch / background /
2605
+ * foreground). We model a session as the SDK instance lifetime: the
2606
+ * counter starts at 0 on construction and increments once per
2607
+ * `track()` call. `session.started` is the boot-telemetry event
2608
+ * (the first `track()` called from `emitBootTelemetryEvent()`), so
2609
+ * the seq will be 0 for that event, matching the spec's "reset to 0
2610
+ * at session.started" clause — by construction, it's the zeroth event
2611
+ * of this instance's lifecycle.
2612
+ *
2613
+ * The counter persists for the entire process lifetime of the SDK
2614
+ * instance (spec §3 clause 1: background/foreground does not reset).
2615
+ * A new `CrossdeckServer` construction is the only reset (new session).
2616
+ */
2617
+ sessionSeq = 0;
2575
2618
  /**
2576
2619
  * Alias map — `developerUserId` / `anonymousId` → canonical
2577
2620
  * `crossdeckCustomerId`. Populated by `getEntitlements()` so a
@@ -2631,6 +2674,7 @@ var CrossdeckServer = class extends EventEmitter {
2631
2674
  appVersion: options.appVersion
2632
2675
  });
2633
2676
  this.runtimeProperties = runtimeInfoToProperties(this.runtime);
2677
+ this.eventContext = buildEventContext(this.runtime, SDK_NAME, this.sdkVersion);
2634
2678
  this.breadcrumbs = new BreadcrumbBuffer(options.breadcrumbsMaxSize ?? 50);
2635
2679
  this.superProps = new SuperPropertyStore();
2636
2680
  this.entitlementCache = new EntitlementCache({
@@ -3082,7 +3126,6 @@ var CrossdeckServer = class extends EventEmitter {
3082
3126
  }
3083
3127
  }
3084
3128
  const properties = {
3085
- ...this.runtimeProperties,
3086
3129
  ...this.superProps.getSuperProperties(),
3087
3130
  ...sanitized
3088
3131
  };
@@ -3091,10 +3134,14 @@ var CrossdeckServer = class extends EventEmitter {
3091
3134
  properties.$groups = groupIds;
3092
3135
  }
3093
3136
  const identity = this.resolveIdentity(event);
3137
+ const seq = this.sessionSeq++;
3138
+ const timestamp = event.timestamp ?? Date.now();
3094
3139
  const queued = {
3095
3140
  eventId: event.eventId ?? mintId("evt", 8),
3096
3141
  name: event.name,
3097
- timestamp: event.timestamp ?? Date.now(),
3142
+ timestamp,
3143
+ seq,
3144
+ context: this.eventContext,
3098
3145
  properties,
3099
3146
  ...identity
3100
3147
  };
@@ -3133,6 +3180,8 @@ var CrossdeckServer = class extends EventEmitter {
3133
3180
  }
3134
3181
  const normalized = events.map((event) => this.normalizeIngestEvent(event));
3135
3182
  const body = {
3183
+ // Event Envelope v1 §1 — wire version (parity with the queue path).
3184
+ envelopeVersion: 1,
3136
3185
  events: normalized,
3137
3186
  sdk: { name: SDK_NAME, version: this.sdkVersion },
3138
3187
  // Match the queue's batch envelope (see event-queue.ts) — backend
@@ -4391,8 +4440,8 @@ function normaliseSecrets(input) {
4391
4440
  }
4392
4441
 
4393
4442
  // src/_contracts-bundled.ts
4394
- var BUNDLED_IN = "@cross-deck/node@1.5.3";
4395
- var SDK_VERSION2 = "1.5.3";
4443
+ var BUNDLED_IN = "@cross-deck/node@1.6.0";
4444
+ var SDK_VERSION2 = "1.6.0";
4396
4445
  var BUNDLED_CONTRACTS = Object.freeze([
4397
4446
  {
4398
4447
  "id": "contract-failed-payload-schema-lock",
@@ -4514,7 +4563,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4514
4563
  "legal/security/index.html#diagnostic",
4515
4564
  "legal/sdk-data/index.html#b-diagnostic"
4516
4565
  ],
4517
- "bundledIn": "@cross-deck/node@1.5.3"
4566
+ "bundledIn": "@cross-deck/node@1.6.0"
4518
4567
  },
4519
4568
  {
4520
4569
  "id": "documentation-honesty",
@@ -4546,7 +4595,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4546
4595
  ],
4547
4596
  "registeredAt": "2026-05-26",
4548
4597
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 7.1",
4549
- "bundledIn": "@cross-deck/node@1.5.3"
4598
+ "bundledIn": "@cross-deck/node@1.6.0"
4550
4599
  },
4551
4600
  {
4552
4601
  "id": "error-envelope-shape",
@@ -4585,7 +4634,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4585
4634
  ],
4586
4635
  "registeredAt": "2026-05-26",
4587
4636
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 8 (codifies existing contract)",
4588
- "bundledIn": "@cross-deck/node@1.5.3"
4637
+ "bundledIn": "@cross-deck/node@1.6.0"
4589
4638
  },
4590
4639
  {
4591
4640
  "id": "flush-interval-parity",
@@ -4630,7 +4679,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4630
4679
  ],
4631
4680
  "registeredAt": "2026-05-26",
4632
4681
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 3.3",
4633
- "bundledIn": "@cross-deck/node@1.5.3"
4682
+ "bundledIn": "@cross-deck/node@1.6.0"
4634
4683
  },
4635
4684
  {
4636
4685
  "id": "idempotency-key-deterministic",
@@ -4735,7 +4784,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4735
4784
  ],
4736
4785
  "registeredAt": "2026-05-26",
4737
4786
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 2.2.a + 2.2.b + 2.2.c",
4738
- "bundledIn": "@cross-deck/node@1.5.3"
4787
+ "bundledIn": "@cross-deck/node@1.6.0"
4739
4788
  },
4740
4789
  {
4741
4790
  "id": "node-pii-scrubber",
@@ -4774,7 +4823,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4774
4823
  ],
4775
4824
  "registeredAt": "2026-05-26",
4776
4825
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 3.1",
4777
- "bundledIn": "@cross-deck/node@1.5.3"
4826
+ "bundledIn": "@cross-deck/node@1.6.0"
4778
4827
  },
4779
4828
  {
4780
4829
  "id": "node-shutdown-awaits-flush",
@@ -4807,7 +4856,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4807
4856
  ],
4808
4857
  "registeredAt": "2026-05-26",
4809
4858
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 5.4",
4810
- "bundledIn": "@cross-deck/node@1.5.3"
4859
+ "bundledIn": "@cross-deck/node@1.6.0"
4811
4860
  },
4812
4861
  {
4813
4862
  "id": "sdk-error-codes-catalogue",
@@ -4821,9 +4870,14 @@ var BUNDLED_CONTRACTS = Object.freeze([
4821
4870
  "codeRef": [
4822
4871
  "sdks/web/src/error-codes.ts",
4823
4872
  "sdks/node/src/error-codes.ts",
4873
+ "sdks/web/src/_contract-verifiers.ts",
4824
4874
  "backend/src/api/v1-errors.ts"
4825
4875
  ],
4826
4876
  "testRef": [
4877
+ {
4878
+ "file": "sdks/web/tests/contract-verifiers.test.ts",
4879
+ "name": "sdk-error-codes-catalogue covers every backend wire code with remediation"
4880
+ },
4827
4881
  {
4828
4882
  "file": "sdks/web/tests/error-codes-backfill.test.ts",
4829
4883
  "name": "includes backend code"
@@ -4847,7 +4901,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4847
4901
  ],
4848
4902
  "registeredAt": "2026-05-26",
4849
4903
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 6.2",
4850
- "bundledIn": "@cross-deck/node@1.5.3"
4904
+ "bundledIn": "@cross-deck/node@1.6.0"
4851
4905
  },
4852
4906
  {
4853
4907
  "id": "sync-purchases-funnel-parity",
@@ -4880,7 +4934,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4880
4934
  ],
4881
4935
  "registeredAt": "2026-05-26",
4882
4936
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 3.5",
4883
- "bundledIn": "@cross-deck/node@1.5.3"
4937
+ "bundledIn": "@cross-deck/node@1.6.0"
4884
4938
  },
4885
4939
  {
4886
4940
  "id": "verifier-timestamp-mandatory",
@@ -4934,7 +4988,7 @@ var BUNDLED_CONTRACTS = Object.freeze([
4934
4988
  ],
4935
4989
  "registeredAt": "2026-05-26",
4936
4990
  "firstRegisteredIn": "bank-grade reconciliation v1.4.0 \u2014 phase 7.2",
4937
- "bundledIn": "@cross-deck/node@1.5.3"
4991
+ "bundledIn": "@cross-deck/node@1.6.0"
4938
4992
  }
4939
4993
  ]);
4940
4994