@cross-deck/node 1.5.1 → 1.5.2
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/auto-events/index.d.mts +1 -1
- package/dist/auto-events/index.d.ts +1 -1
- package/dist/{crossdeck-server-CY4PZk-j.d.mts → crossdeck-server-DhnHvUhh.d.mts} +12 -200
- package/dist/{crossdeck-server-CY4PZk-j.d.ts → crossdeck-server-DhnHvUhh.d.ts} +12 -200
- package/dist/index.cjs +73 -1020
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +21 -150
- package/dist/index.d.ts +21 -150
- package/dist/index.mjs +69 -1005
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/contracts.json +0 -552
|
@@ -111,110 +111,6 @@ declare class CrossdeckConfigurationError extends CrossdeckError {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function makeCrossdeckError(payload: CrossdeckErrorPayload): CrossdeckError;
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Public, typed accessor for the bank-grade behavioural contracts
|
|
116
|
-
* this SDK ships. The full architecture — schema, distribution,
|
|
117
|
-
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
118
|
-
* at the monorepo root.
|
|
119
|
-
*
|
|
120
|
-
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
121
|
-
* pillar names are part of Crossdeck's public commitment to
|
|
122
|
-
* customers. Reading them through `CrossdeckContracts` means the
|
|
123
|
-
* compiler catches drift the moment a contract is renamed or
|
|
124
|
-
* retired. Tools that consume contracts at runtime (dashboards,
|
|
125
|
-
* AI assistants, customer integration tests) get the exact same
|
|
126
|
-
* shape every SDK ships, with no parsing layer to drift.
|
|
127
|
-
*
|
|
128
|
-
* --- BINARY STABILITY ---
|
|
129
|
-
* `Contract` is treated as an evolving — but back-compat — wire
|
|
130
|
-
* shape. Fields may be added in any minor release. Existing
|
|
131
|
-
* fields will not be removed or repurposed except in a major
|
|
132
|
-
* version bump, even if all known contracts stop using them.
|
|
133
|
-
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
134
|
-
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
135
|
-
* and `bundledIn` being present on every contract in every
|
|
136
|
-
* future minor/patch release of this SDK.
|
|
137
|
-
*/
|
|
138
|
-
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
139
|
-
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
140
|
-
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
141
|
-
interface ContractTestRef {
|
|
142
|
-
readonly file: string;
|
|
143
|
-
readonly name: string;
|
|
144
|
-
}
|
|
145
|
-
interface Contract {
|
|
146
|
-
readonly id: string;
|
|
147
|
-
readonly pillar: ContractPillar;
|
|
148
|
-
readonly status: ContractStatus;
|
|
149
|
-
readonly claim: string;
|
|
150
|
-
readonly appliesTo: readonly ContractAppliesTo[];
|
|
151
|
-
readonly codeRef: readonly string[];
|
|
152
|
-
readonly testRef: readonly ContractTestRef[];
|
|
153
|
-
readonly registeredAt: string;
|
|
154
|
-
readonly firstRegisteredIn: string;
|
|
155
|
-
readonly bundledIn: string;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Typed entry point to the bank-grade contracts bundled with this
|
|
159
|
-
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
160
|
-
*
|
|
161
|
-
* @example Audit at app boot
|
|
162
|
-
* ```ts
|
|
163
|
-
* import { CrossdeckContracts } from "@cross-deck/node";
|
|
164
|
-
*
|
|
165
|
-
* for (const c of CrossdeckContracts.all()) {
|
|
166
|
-
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
declare const CrossdeckContracts: {
|
|
171
|
-
readonly all: () => readonly Contract[];
|
|
172
|
-
readonly allIncludingHistorical: () => readonly Contract[];
|
|
173
|
-
readonly byId: (id: string) => Contract | undefined;
|
|
174
|
-
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
175
|
-
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
176
|
-
readonly sdkVersion: "1.5.1";
|
|
177
|
-
readonly bundledIn: "@cross-deck/node@1.5.1";
|
|
178
|
-
/**
|
|
179
|
-
* Resolve a failing test back to the contract it exercises.
|
|
180
|
-
* Used by test-framework hooks to find the contract id of a
|
|
181
|
-
* failed contract test so `reportContractFailure(...)` can stamp
|
|
182
|
-
* the right `contract_id` on the emitted event.
|
|
183
|
-
*/
|
|
184
|
-
readonly findByTestName: (name: string) => Contract | undefined;
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Input to {@link CrossdeckServer.reportContractFailure}. Mirrors
|
|
188
|
-
* the per-SDK shape exactly.
|
|
189
|
-
*
|
|
190
|
-
* SCHEMA-LOCK: this interface's field set is exhaustively named. No
|
|
191
|
-
* free-form `extra: Record<string, unknown>` — the schema-lock
|
|
192
|
-
* contract at
|
|
193
|
-
* `contracts/diagnostics/contract-failed-payload-schema-lock.json`
|
|
194
|
-
* forbids unbounded fields. Adding a field requires a PR that
|
|
195
|
-
* amends the contract first, then the public interface.
|
|
196
|
-
*/
|
|
197
|
-
interface ContractFailureInput {
|
|
198
|
-
contractId: string;
|
|
199
|
-
/**
|
|
200
|
-
* Short categorical-ish label — the SDK convention is to keep
|
|
201
|
-
* this under 128 chars and stable across runs (so dashboards can
|
|
202
|
-
* group). Never an end-user-supplied string.
|
|
203
|
-
*/
|
|
204
|
-
failureReason: string;
|
|
205
|
-
runContext: "ci" | "dogfood" | "customer-app";
|
|
206
|
-
runId: string;
|
|
207
|
-
testRef?: {
|
|
208
|
-
file: string;
|
|
209
|
-
name: string;
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Optional coarse device class, e.g. "linux-server", "container",
|
|
213
|
-
* "lambda". A categorical bucket, not a host identifier.
|
|
214
|
-
*/
|
|
215
|
-
deviceClass?: string;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
114
|
/**
|
|
219
115
|
* Breadcrumb ring buffer — context attached to every error report.
|
|
220
116
|
*
|
|
@@ -513,10 +409,6 @@ interface PurchaseResult {
|
|
|
513
409
|
crossdeckCustomerId: string;
|
|
514
410
|
env: Environment;
|
|
515
411
|
entitlements: PublicEntitlement[];
|
|
516
|
-
/** True when the response came from the backend's idempotency
|
|
517
|
-
* cache instead of fresh processing. Backend also returns
|
|
518
|
-
* `Idempotent-Replayed: true` as a response header (v1.4.0). */
|
|
519
|
-
idempotent_replay?: boolean;
|
|
520
412
|
}
|
|
521
413
|
/**
|
|
522
414
|
* Response shape from `GET /v1/sdk/heartbeat`. Used by
|
|
@@ -570,25 +462,6 @@ interface CrossdeckServerOptions {
|
|
|
570
462
|
* not the source of truth.
|
|
571
463
|
*/
|
|
572
464
|
appId?: string;
|
|
573
|
-
/**
|
|
574
|
-
* Apply Crossdeck's PII scrubber to every `track()` payload before
|
|
575
|
-
* enqueue. Default `true` (parity with Web / RN / Swift SDKs — Node
|
|
576
|
-
* pre-v1.4.0 was the odd one out and SHIPPED EMAILS UNREDACTED, a
|
|
577
|
-
* privacy contract drift versus the README claim).
|
|
578
|
-
*
|
|
579
|
-
* The scrubber rewrites email-shaped and card-number-shaped
|
|
580
|
-
* substrings to `<email>` / `<card>` sentinels recursively across
|
|
581
|
-
* nested maps + arrays. See `scrubPii` / `scrubPiiFromProperties`.
|
|
582
|
-
*
|
|
583
|
-
* **Blast radius of setting `false`:** every `track()` payload —
|
|
584
|
-
* including event names with embedded emails ("user wes@example.com
|
|
585
|
-
* upgraded"), trait values, group memberships, error context blobs
|
|
586
|
-
* — ships verbatim to Crossdeck and downstream warehouses /
|
|
587
|
-
* analytics exports. Disable only for explicit compliance use
|
|
588
|
-
* cases (regulator-required audit trails where the raw value MUST
|
|
589
|
-
* be preserved) and document the decision at the call site.
|
|
590
|
-
*/
|
|
591
|
-
scrubPii?: boolean;
|
|
592
465
|
/**
|
|
593
466
|
* Error capture configuration. Default: ON with `onUncaughtException` +
|
|
594
467
|
* `onUnhandledRejection` + `wrapFetch` all enabled.
|
|
@@ -799,14 +672,6 @@ interface RequestOptions {
|
|
|
799
672
|
* `timeoutMs`. Pass `0` to disable.
|
|
800
673
|
*/
|
|
801
674
|
timeoutMs?: number;
|
|
802
|
-
/**
|
|
803
|
-
* Override the deterministic Idempotency-Key derivation (v1.4.0).
|
|
804
|
-
* The SDK derives a stable key from the request body so retries
|
|
805
|
-
* collapse on the backend. Override only when an outer
|
|
806
|
-
* orchestrator (job runner, retry harness) needs a different
|
|
807
|
-
* idempotency window — and document why at the call site.
|
|
808
|
-
*/
|
|
809
|
-
idempotencyKey?: string;
|
|
810
675
|
}
|
|
811
676
|
interface IdentityHints {
|
|
812
677
|
customerId?: string;
|
|
@@ -1297,10 +1162,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1297
1162
|
private readonly baseUrl;
|
|
1298
1163
|
private readonly appId;
|
|
1299
1164
|
private readonly env;
|
|
1300
|
-
/** PII scrubber toggle. Default true — parity with Web/RN/Swift.
|
|
1301
|
-
* Pre-v1.4.0 the Node SDK shipped track() payloads UNREDACTED,
|
|
1302
|
-
* a privacy contract drift versus the README. */
|
|
1303
|
-
private readonly scrubPii;
|
|
1304
1165
|
private readonly secretKeyPrefix;
|
|
1305
1166
|
/**
|
|
1306
1167
|
* Process-stable pseudo-anonymous ID. Used as the default identity
|
|
@@ -1346,15 +1207,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1346
1207
|
private errorContext;
|
|
1347
1208
|
private errorTags;
|
|
1348
1209
|
private errorBeforeSend;
|
|
1349
|
-
/**
|
|
1350
|
-
* Dedup gate for `sdk.shutdown`. Both `shutdown()` (async) and
|
|
1351
|
-
* `shutdownSync()` need to emit so direct callers of EITHER see
|
|
1352
|
-
* the event (the async path's listener guarantees pre-launch
|
|
1353
|
-
* tests, the sync path covers `Symbol.dispose` + tests that call
|
|
1354
|
-
* `shutdownSync()` directly). Without this flag, `shutdown()`'s
|
|
1355
|
-
* tail call into `shutdownSync()` would emit twice.
|
|
1356
|
-
*/
|
|
1357
|
-
private didEmitShutdown;
|
|
1358
1210
|
constructor(options: CrossdeckServerOptions);
|
|
1359
1211
|
/**
|
|
1360
1212
|
* Emit the honest "no cold-start durability" warning when the runtime
|
|
@@ -1479,17 +1331,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1479
1331
|
* `uncaughtException` has no per-request context; without the
|
|
1480
1332
|
* auto-fill, the event would be rejected at queue enqueue.
|
|
1481
1333
|
*/
|
|
1482
|
-
/**
|
|
1483
|
-
* Emit `crossdeck.contract_failed` to the Crossdeck reliability
|
|
1484
|
-
* endpoint — single-fire, one-way, never visible in the customer's
|
|
1485
|
-
* dashboard. Goes over a dedicated HTTP path with the reliability
|
|
1486
|
-
* publishable key embedded at build time; the customer's track()
|
|
1487
|
-
* pipeline never carries `crossdeck.*` events. This is the
|
|
1488
|
-
* independent-controller flow described in Privacy Policy §6
|
|
1489
|
-
* ("Flow B"). The wire shape is fixed by the schema-lock contract
|
|
1490
|
-
* at `contracts/diagnostics/contract-failed-payload-schema-lock.json`.
|
|
1491
|
-
*/
|
|
1492
|
-
reportContractFailure(input: ContractFailureInput): void;
|
|
1493
1334
|
track(event: ServerEvent): void;
|
|
1494
1335
|
/**
|
|
1495
1336
|
* Immediate POST of one or more events. For bulk imports / replay
|
|
@@ -1700,36 +1541,11 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1700
1541
|
getGroups(): Record<string, GroupMembership>;
|
|
1701
1542
|
diagnostics(): Diagnostics;
|
|
1702
1543
|
/**
|
|
1703
|
-
* Tear down handlers and clear in-memory state.
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
1706
|
-
* before dropping the queue, so callers don't silently lose
|
|
1707
|
-
* every queued event on a clean shutdown. The pre-v1.4.0
|
|
1708
|
-
* behaviour (sync `eventQueue.reset()` with no flush) was the
|
|
1709
|
-
* default for both `shutdown()` and `[Symbol.dispose]`; only
|
|
1710
|
-
* `await using` + `[Symbol.asyncDispose]` flushed correctly.
|
|
1711
|
-
*
|
|
1712
|
-
* Production servers should still prefer `await server.flush()`
|
|
1713
|
-
* (visible) followed by `server.shutdown()` so the flush
|
|
1714
|
-
* outcome is observable — `shutdown()`'s internal flush swallows
|
|
1715
|
-
* errors as a best-effort drain.
|
|
1716
|
-
*
|
|
1717
|
-
* Use [[shutdownSync]] only when the runtime cannot await
|
|
1718
|
-
* (e.g. inside `Symbol.dispose` — see below).
|
|
1719
|
-
*/
|
|
1720
|
-
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): Promise<void>;
|
|
1721
|
-
/**
|
|
1722
|
-
* Synchronous teardown — drops the in-memory queue WITHOUT
|
|
1723
|
-
* flushing, then clears all in-memory state. Used by
|
|
1724
|
-
* `[Symbol.dispose]` (which has no await) and tests that need
|
|
1725
|
-
* an unconditional sync wipe. Production code should use
|
|
1726
|
-
* [[shutdown]] (async) instead so queued events are flushed.
|
|
1727
|
-
*
|
|
1728
|
-
* A queue with items at sync-shutdown logs a warning recommending
|
|
1729
|
-
* `[Symbol.asyncDispose]` or `await server.shutdown()` — silent
|
|
1730
|
-
* loss is incompatible with the bank-grade contract.
|
|
1544
|
+
* Tear down handlers and clear in-memory state. Tests + custom
|
|
1545
|
+
* lifecycle callers only. Production code should rely on
|
|
1546
|
+
* `flush-on-exit` instead.
|
|
1731
1547
|
*/
|
|
1732
|
-
|
|
1548
|
+
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): void;
|
|
1733
1549
|
/**
|
|
1734
1550
|
* Convert a `CapturedError` into a `ServerEvent` and push through
|
|
1735
1551
|
* `track()`. Goes through the same queue / enrichment / breadcrumb
|
|
@@ -1798,21 +1614,17 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1798
1614
|
* // ... use server ...
|
|
1799
1615
|
* // at end of block, server[Symbol.dispose]() runs automatically
|
|
1800
1616
|
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
* exit", switch to `await using` + `[Symbol.asyncDispose]` (or
|
|
1806
|
-
* call `await server.shutdown()` explicitly before the variable
|
|
1807
|
-
* goes out of scope).
|
|
1617
|
+
* `Symbol.dispose` is synchronous so we can't await `flush()` here
|
|
1618
|
+
* — for that, use `await using` + `[Symbol.asyncDispose]()`. This
|
|
1619
|
+
* sync variant just calls `shutdown()` (handler cleanup +
|
|
1620
|
+
* in-memory state wipe).
|
|
1808
1621
|
*/
|
|
1809
1622
|
[Symbol.dispose](): void;
|
|
1810
1623
|
/**
|
|
1811
1624
|
* Async disposal hook — runs when an `await using` declaration
|
|
1812
|
-
* exits scope. Awaits
|
|
1813
|
-
*
|
|
1814
|
-
*
|
|
1815
|
-
* background workers, end-of-request hooks).
|
|
1625
|
+
* exits scope. Awaits `flush()` THEN runs `shutdown()`. Use this
|
|
1626
|
+
* variant when the caller needs the queue drained before exit
|
|
1627
|
+
* (the common case for serverless handlers).
|
|
1816
1628
|
*
|
|
1817
1629
|
* await using server = new CrossdeckServer({ ... });
|
|
1818
1630
|
*/
|
|
@@ -1898,4 +1710,4 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1898
1710
|
private normalizeIngestEvent;
|
|
1899
1711
|
}
|
|
1900
1712
|
|
|
1901
|
-
export { type
|
|
1713
|
+
export { type StoredEntitlements as $, type AliasIdentityInput as A, type Breadcrumb as B, CROSSDECK_API_VERSION as C, DEFAULT_BASE_URL as D, type EntitlementCacheOptions as E, type ErrorLevel as F, type EventProperties as G, type ForgetResult as H, type GrantDuration as I, type GrantEntitlementInput as J, type GroupMembership as K, type HeartbeatResponse as L, type HttpRequestInfo as M, type HttpResponseInfo as N, type HttpRetriesConfig as O, type IdentifyOptions as P, type IdentityHints as Q, type IngestOptions as R, type IngestResponse as S, type PublicEntitlement as T, type PurchaseResult as U, type RequestOptions as V, type RevokeEntitlementInput as W, type RuntimeHost as X, type RuntimeInfo as Y, type ServerEvent as Z, type StackFrame as _, type AliasResult as a, type SyncPurchaseInput as a0, makeCrossdeckError as a1, type AuditDecision as b, type AuditEntry as c, type BreadcrumbCategory as d, type BreadcrumbLevel as e, type CapturedError as f, CrossdeckAuthenticationError as g, CrossdeckConfigurationError as h, CrossdeckError as i, type CrossdeckErrorPayload as j, type CrossdeckErrorType as k, CrossdeckInternalError as l, CrossdeckNetworkError as m, CrossdeckPermissionError as n, CrossdeckRateLimitError as o, CrossdeckServer as p, type CrossdeckServerOptions as q, CrossdeckValidationError as r, DEFAULT_TIMEOUT_MS as s, type Diagnostics as t, type EntitlementMutationResult as u, type EntitlementStore as v, type EntitlementsListResponse as w, type EntitlementsListener as x, type Environment as y, type ErrorCaptureConfig as z };
|
|
@@ -111,110 +111,6 @@ declare class CrossdeckConfigurationError extends CrossdeckError {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function makeCrossdeckError(payload: CrossdeckErrorPayload): CrossdeckError;
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Public, typed accessor for the bank-grade behavioural contracts
|
|
116
|
-
* this SDK ships. The full architecture — schema, distribution,
|
|
117
|
-
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
118
|
-
* at the monorepo root.
|
|
119
|
-
*
|
|
120
|
-
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
121
|
-
* pillar names are part of Crossdeck's public commitment to
|
|
122
|
-
* customers. Reading them through `CrossdeckContracts` means the
|
|
123
|
-
* compiler catches drift the moment a contract is renamed or
|
|
124
|
-
* retired. Tools that consume contracts at runtime (dashboards,
|
|
125
|
-
* AI assistants, customer integration tests) get the exact same
|
|
126
|
-
* shape every SDK ships, with no parsing layer to drift.
|
|
127
|
-
*
|
|
128
|
-
* --- BINARY STABILITY ---
|
|
129
|
-
* `Contract` is treated as an evolving — but back-compat — wire
|
|
130
|
-
* shape. Fields may be added in any minor release. Existing
|
|
131
|
-
* fields will not be removed or repurposed except in a major
|
|
132
|
-
* version bump, even if all known contracts stop using them.
|
|
133
|
-
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
134
|
-
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
135
|
-
* and `bundledIn` being present on every contract in every
|
|
136
|
-
* future minor/patch release of this SDK.
|
|
137
|
-
*/
|
|
138
|
-
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
139
|
-
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
140
|
-
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
141
|
-
interface ContractTestRef {
|
|
142
|
-
readonly file: string;
|
|
143
|
-
readonly name: string;
|
|
144
|
-
}
|
|
145
|
-
interface Contract {
|
|
146
|
-
readonly id: string;
|
|
147
|
-
readonly pillar: ContractPillar;
|
|
148
|
-
readonly status: ContractStatus;
|
|
149
|
-
readonly claim: string;
|
|
150
|
-
readonly appliesTo: readonly ContractAppliesTo[];
|
|
151
|
-
readonly codeRef: readonly string[];
|
|
152
|
-
readonly testRef: readonly ContractTestRef[];
|
|
153
|
-
readonly registeredAt: string;
|
|
154
|
-
readonly firstRegisteredIn: string;
|
|
155
|
-
readonly bundledIn: string;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Typed entry point to the bank-grade contracts bundled with this
|
|
159
|
-
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
160
|
-
*
|
|
161
|
-
* @example Audit at app boot
|
|
162
|
-
* ```ts
|
|
163
|
-
* import { CrossdeckContracts } from "@cross-deck/node";
|
|
164
|
-
*
|
|
165
|
-
* for (const c of CrossdeckContracts.all()) {
|
|
166
|
-
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
declare const CrossdeckContracts: {
|
|
171
|
-
readonly all: () => readonly Contract[];
|
|
172
|
-
readonly allIncludingHistorical: () => readonly Contract[];
|
|
173
|
-
readonly byId: (id: string) => Contract | undefined;
|
|
174
|
-
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
175
|
-
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
176
|
-
readonly sdkVersion: "1.5.1";
|
|
177
|
-
readonly bundledIn: "@cross-deck/node@1.5.1";
|
|
178
|
-
/**
|
|
179
|
-
* Resolve a failing test back to the contract it exercises.
|
|
180
|
-
* Used by test-framework hooks to find the contract id of a
|
|
181
|
-
* failed contract test so `reportContractFailure(...)` can stamp
|
|
182
|
-
* the right `contract_id` on the emitted event.
|
|
183
|
-
*/
|
|
184
|
-
readonly findByTestName: (name: string) => Contract | undefined;
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Input to {@link CrossdeckServer.reportContractFailure}. Mirrors
|
|
188
|
-
* the per-SDK shape exactly.
|
|
189
|
-
*
|
|
190
|
-
* SCHEMA-LOCK: this interface's field set is exhaustively named. No
|
|
191
|
-
* free-form `extra: Record<string, unknown>` — the schema-lock
|
|
192
|
-
* contract at
|
|
193
|
-
* `contracts/diagnostics/contract-failed-payload-schema-lock.json`
|
|
194
|
-
* forbids unbounded fields. Adding a field requires a PR that
|
|
195
|
-
* amends the contract first, then the public interface.
|
|
196
|
-
*/
|
|
197
|
-
interface ContractFailureInput {
|
|
198
|
-
contractId: string;
|
|
199
|
-
/**
|
|
200
|
-
* Short categorical-ish label — the SDK convention is to keep
|
|
201
|
-
* this under 128 chars and stable across runs (so dashboards can
|
|
202
|
-
* group). Never an end-user-supplied string.
|
|
203
|
-
*/
|
|
204
|
-
failureReason: string;
|
|
205
|
-
runContext: "ci" | "dogfood" | "customer-app";
|
|
206
|
-
runId: string;
|
|
207
|
-
testRef?: {
|
|
208
|
-
file: string;
|
|
209
|
-
name: string;
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Optional coarse device class, e.g. "linux-server", "container",
|
|
213
|
-
* "lambda". A categorical bucket, not a host identifier.
|
|
214
|
-
*/
|
|
215
|
-
deviceClass?: string;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
114
|
/**
|
|
219
115
|
* Breadcrumb ring buffer — context attached to every error report.
|
|
220
116
|
*
|
|
@@ -513,10 +409,6 @@ interface PurchaseResult {
|
|
|
513
409
|
crossdeckCustomerId: string;
|
|
514
410
|
env: Environment;
|
|
515
411
|
entitlements: PublicEntitlement[];
|
|
516
|
-
/** True when the response came from the backend's idempotency
|
|
517
|
-
* cache instead of fresh processing. Backend also returns
|
|
518
|
-
* `Idempotent-Replayed: true` as a response header (v1.4.0). */
|
|
519
|
-
idempotent_replay?: boolean;
|
|
520
412
|
}
|
|
521
413
|
/**
|
|
522
414
|
* Response shape from `GET /v1/sdk/heartbeat`. Used by
|
|
@@ -570,25 +462,6 @@ interface CrossdeckServerOptions {
|
|
|
570
462
|
* not the source of truth.
|
|
571
463
|
*/
|
|
572
464
|
appId?: string;
|
|
573
|
-
/**
|
|
574
|
-
* Apply Crossdeck's PII scrubber to every `track()` payload before
|
|
575
|
-
* enqueue. Default `true` (parity with Web / RN / Swift SDKs — Node
|
|
576
|
-
* pre-v1.4.0 was the odd one out and SHIPPED EMAILS UNREDACTED, a
|
|
577
|
-
* privacy contract drift versus the README claim).
|
|
578
|
-
*
|
|
579
|
-
* The scrubber rewrites email-shaped and card-number-shaped
|
|
580
|
-
* substrings to `<email>` / `<card>` sentinels recursively across
|
|
581
|
-
* nested maps + arrays. See `scrubPii` / `scrubPiiFromProperties`.
|
|
582
|
-
*
|
|
583
|
-
* **Blast radius of setting `false`:** every `track()` payload —
|
|
584
|
-
* including event names with embedded emails ("user wes@example.com
|
|
585
|
-
* upgraded"), trait values, group memberships, error context blobs
|
|
586
|
-
* — ships verbatim to Crossdeck and downstream warehouses /
|
|
587
|
-
* analytics exports. Disable only for explicit compliance use
|
|
588
|
-
* cases (regulator-required audit trails where the raw value MUST
|
|
589
|
-
* be preserved) and document the decision at the call site.
|
|
590
|
-
*/
|
|
591
|
-
scrubPii?: boolean;
|
|
592
465
|
/**
|
|
593
466
|
* Error capture configuration. Default: ON with `onUncaughtException` +
|
|
594
467
|
* `onUnhandledRejection` + `wrapFetch` all enabled.
|
|
@@ -799,14 +672,6 @@ interface RequestOptions {
|
|
|
799
672
|
* `timeoutMs`. Pass `0` to disable.
|
|
800
673
|
*/
|
|
801
674
|
timeoutMs?: number;
|
|
802
|
-
/**
|
|
803
|
-
* Override the deterministic Idempotency-Key derivation (v1.4.0).
|
|
804
|
-
* The SDK derives a stable key from the request body so retries
|
|
805
|
-
* collapse on the backend. Override only when an outer
|
|
806
|
-
* orchestrator (job runner, retry harness) needs a different
|
|
807
|
-
* idempotency window — and document why at the call site.
|
|
808
|
-
*/
|
|
809
|
-
idempotencyKey?: string;
|
|
810
675
|
}
|
|
811
676
|
interface IdentityHints {
|
|
812
677
|
customerId?: string;
|
|
@@ -1297,10 +1162,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1297
1162
|
private readonly baseUrl;
|
|
1298
1163
|
private readonly appId;
|
|
1299
1164
|
private readonly env;
|
|
1300
|
-
/** PII scrubber toggle. Default true — parity with Web/RN/Swift.
|
|
1301
|
-
* Pre-v1.4.0 the Node SDK shipped track() payloads UNREDACTED,
|
|
1302
|
-
* a privacy contract drift versus the README. */
|
|
1303
|
-
private readonly scrubPii;
|
|
1304
1165
|
private readonly secretKeyPrefix;
|
|
1305
1166
|
/**
|
|
1306
1167
|
* Process-stable pseudo-anonymous ID. Used as the default identity
|
|
@@ -1346,15 +1207,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1346
1207
|
private errorContext;
|
|
1347
1208
|
private errorTags;
|
|
1348
1209
|
private errorBeforeSend;
|
|
1349
|
-
/**
|
|
1350
|
-
* Dedup gate for `sdk.shutdown`. Both `shutdown()` (async) and
|
|
1351
|
-
* `shutdownSync()` need to emit so direct callers of EITHER see
|
|
1352
|
-
* the event (the async path's listener guarantees pre-launch
|
|
1353
|
-
* tests, the sync path covers `Symbol.dispose` + tests that call
|
|
1354
|
-
* `shutdownSync()` directly). Without this flag, `shutdown()`'s
|
|
1355
|
-
* tail call into `shutdownSync()` would emit twice.
|
|
1356
|
-
*/
|
|
1357
|
-
private didEmitShutdown;
|
|
1358
1210
|
constructor(options: CrossdeckServerOptions);
|
|
1359
1211
|
/**
|
|
1360
1212
|
* Emit the honest "no cold-start durability" warning when the runtime
|
|
@@ -1479,17 +1331,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1479
1331
|
* `uncaughtException` has no per-request context; without the
|
|
1480
1332
|
* auto-fill, the event would be rejected at queue enqueue.
|
|
1481
1333
|
*/
|
|
1482
|
-
/**
|
|
1483
|
-
* Emit `crossdeck.contract_failed` to the Crossdeck reliability
|
|
1484
|
-
* endpoint — single-fire, one-way, never visible in the customer's
|
|
1485
|
-
* dashboard. Goes over a dedicated HTTP path with the reliability
|
|
1486
|
-
* publishable key embedded at build time; the customer's track()
|
|
1487
|
-
* pipeline never carries `crossdeck.*` events. This is the
|
|
1488
|
-
* independent-controller flow described in Privacy Policy §6
|
|
1489
|
-
* ("Flow B"). The wire shape is fixed by the schema-lock contract
|
|
1490
|
-
* at `contracts/diagnostics/contract-failed-payload-schema-lock.json`.
|
|
1491
|
-
*/
|
|
1492
|
-
reportContractFailure(input: ContractFailureInput): void;
|
|
1493
1334
|
track(event: ServerEvent): void;
|
|
1494
1335
|
/**
|
|
1495
1336
|
* Immediate POST of one or more events. For bulk imports / replay
|
|
@@ -1700,36 +1541,11 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1700
1541
|
getGroups(): Record<string, GroupMembership>;
|
|
1701
1542
|
diagnostics(): Diagnostics;
|
|
1702
1543
|
/**
|
|
1703
|
-
* Tear down handlers and clear in-memory state.
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
1706
|
-
* before dropping the queue, so callers don't silently lose
|
|
1707
|
-
* every queued event on a clean shutdown. The pre-v1.4.0
|
|
1708
|
-
* behaviour (sync `eventQueue.reset()` with no flush) was the
|
|
1709
|
-
* default for both `shutdown()` and `[Symbol.dispose]`; only
|
|
1710
|
-
* `await using` + `[Symbol.asyncDispose]` flushed correctly.
|
|
1711
|
-
*
|
|
1712
|
-
* Production servers should still prefer `await server.flush()`
|
|
1713
|
-
* (visible) followed by `server.shutdown()` so the flush
|
|
1714
|
-
* outcome is observable — `shutdown()`'s internal flush swallows
|
|
1715
|
-
* errors as a best-effort drain.
|
|
1716
|
-
*
|
|
1717
|
-
* Use [[shutdownSync]] only when the runtime cannot await
|
|
1718
|
-
* (e.g. inside `Symbol.dispose` — see below).
|
|
1719
|
-
*/
|
|
1720
|
-
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): Promise<void>;
|
|
1721
|
-
/**
|
|
1722
|
-
* Synchronous teardown — drops the in-memory queue WITHOUT
|
|
1723
|
-
* flushing, then clears all in-memory state. Used by
|
|
1724
|
-
* `[Symbol.dispose]` (which has no await) and tests that need
|
|
1725
|
-
* an unconditional sync wipe. Production code should use
|
|
1726
|
-
* [[shutdown]] (async) instead so queued events are flushed.
|
|
1727
|
-
*
|
|
1728
|
-
* A queue with items at sync-shutdown logs a warning recommending
|
|
1729
|
-
* `[Symbol.asyncDispose]` or `await server.shutdown()` — silent
|
|
1730
|
-
* loss is incompatible with the bank-grade contract.
|
|
1544
|
+
* Tear down handlers and clear in-memory state. Tests + custom
|
|
1545
|
+
* lifecycle callers only. Production code should rely on
|
|
1546
|
+
* `flush-on-exit` instead.
|
|
1731
1547
|
*/
|
|
1732
|
-
|
|
1548
|
+
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): void;
|
|
1733
1549
|
/**
|
|
1734
1550
|
* Convert a `CapturedError` into a `ServerEvent` and push through
|
|
1735
1551
|
* `track()`. Goes through the same queue / enrichment / breadcrumb
|
|
@@ -1798,21 +1614,17 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1798
1614
|
* // ... use server ...
|
|
1799
1615
|
* // at end of block, server[Symbol.dispose]() runs automatically
|
|
1800
1616
|
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
* exit", switch to `await using` + `[Symbol.asyncDispose]` (or
|
|
1806
|
-
* call `await server.shutdown()` explicitly before the variable
|
|
1807
|
-
* goes out of scope).
|
|
1617
|
+
* `Symbol.dispose` is synchronous so we can't await `flush()` here
|
|
1618
|
+
* — for that, use `await using` + `[Symbol.asyncDispose]()`. This
|
|
1619
|
+
* sync variant just calls `shutdown()` (handler cleanup +
|
|
1620
|
+
* in-memory state wipe).
|
|
1808
1621
|
*/
|
|
1809
1622
|
[Symbol.dispose](): void;
|
|
1810
1623
|
/**
|
|
1811
1624
|
* Async disposal hook — runs when an `await using` declaration
|
|
1812
|
-
* exits scope. Awaits
|
|
1813
|
-
*
|
|
1814
|
-
*
|
|
1815
|
-
* background workers, end-of-request hooks).
|
|
1625
|
+
* exits scope. Awaits `flush()` THEN runs `shutdown()`. Use this
|
|
1626
|
+
* variant when the caller needs the queue drained before exit
|
|
1627
|
+
* (the common case for serverless handlers).
|
|
1816
1628
|
*
|
|
1817
1629
|
* await using server = new CrossdeckServer({ ... });
|
|
1818
1630
|
*/
|
|
@@ -1898,4 +1710,4 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1898
1710
|
private normalizeIngestEvent;
|
|
1899
1711
|
}
|
|
1900
1712
|
|
|
1901
|
-
export { type
|
|
1713
|
+
export { type StoredEntitlements as $, type AliasIdentityInput as A, type Breadcrumb as B, CROSSDECK_API_VERSION as C, DEFAULT_BASE_URL as D, type EntitlementCacheOptions as E, type ErrorLevel as F, type EventProperties as G, type ForgetResult as H, type GrantDuration as I, type GrantEntitlementInput as J, type GroupMembership as K, type HeartbeatResponse as L, type HttpRequestInfo as M, type HttpResponseInfo as N, type HttpRetriesConfig as O, type IdentifyOptions as P, type IdentityHints as Q, type IngestOptions as R, type IngestResponse as S, type PublicEntitlement as T, type PurchaseResult as U, type RequestOptions as V, type RevokeEntitlementInput as W, type RuntimeHost as X, type RuntimeInfo as Y, type ServerEvent as Z, type StackFrame as _, type AliasResult as a, type SyncPurchaseInput as a0, makeCrossdeckError as a1, type AuditDecision as b, type AuditEntry as c, type BreadcrumbCategory as d, type BreadcrumbLevel as e, type CapturedError as f, CrossdeckAuthenticationError as g, CrossdeckConfigurationError as h, CrossdeckError as i, type CrossdeckErrorPayload as j, type CrossdeckErrorType as k, CrossdeckInternalError as l, CrossdeckNetworkError as m, CrossdeckPermissionError as n, CrossdeckRateLimitError as o, CrossdeckServer as p, type CrossdeckServerOptions as q, CrossdeckValidationError as r, DEFAULT_TIMEOUT_MS as s, type Diagnostics as t, type EntitlementMutationResult as u, type EntitlementStore as v, type EntitlementsListResponse as w, type EntitlementsListener as x, type Environment as y, type ErrorCaptureConfig as z };
|