@cross-deck/node 1.5.0 → 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/CHANGELOG.md +53 -0
- package/README.md +58 -0
- package/dist/auto-events/index.d.mts +1 -1
- package/dist/auto-events/index.d.ts +1 -1
- package/dist/{crossdeck-server-oAaKBnUU.d.mts → crossdeck-server-DhnHvUhh.d.mts} +12 -183
- package/dist/{crossdeck-server-oAaKBnUU.d.ts → crossdeck-server-DhnHvUhh.d.ts} +12 -183
- package/dist/index.cjs +73 -817
- 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 -812
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/contracts.json +0 -430
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,59 @@ All notable changes to `@cross-deck/node` will be documented here. The
|
|
|
4
4
|
format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.5.1] — 2026-05-27
|
|
8
|
+
|
|
9
|
+
`crossdeck.contract_failed` is now single-fire to a dedicated
|
|
10
|
+
reliability endpoint instead of the customer's `track()` pipeline.
|
|
11
|
+
Independent-controller flow per Privacy Policy §6; schema-locked by
|
|
12
|
+
`contracts/diagnostics/contract-failed-payload-schema-lock.json`.
|
|
13
|
+
`ContractFailureInput.extra` removed (schema-lock forbids unbounded
|
|
14
|
+
fields); `ContractFailureInput.deviceClass` added.
|
|
15
|
+
|
|
16
|
+
## [1.5.0] — 2026-05-26
|
|
17
|
+
|
|
18
|
+
Minor — `CrossdeckContracts` + `reportContractFailure(...)` ship as a
|
|
19
|
+
new public surface on every SDK simultaneously. Additive only; no
|
|
20
|
+
behavioural change to existing APIs.
|
|
21
|
+
|
|
22
|
+
**Added:**
|
|
23
|
+
|
|
24
|
+
- **`CrossdeckContracts` namespace** — typed access to the bank-grade
|
|
25
|
+
contract registry. Methods: `all()`, `allIncludingHistorical()`,
|
|
26
|
+
`byId(id)`, `byPillar(pillar)`, `withStatus(status)`,
|
|
27
|
+
`findByTestName(name)`. Properties: `sdkVersion`, `bundledIn`
|
|
28
|
+
(e.g. `"@cross-deck/node@1.5.0"`).
|
|
29
|
+
- **`Contract` type + `ContractPillar` / `ContractStatus` /
|
|
30
|
+
`ContractAppliesTo` unions + `ContractTestRef` + `ContractFailureInput`
|
|
31
|
+
interfaces** exported from the top-level entry. Treated as
|
|
32
|
+
binary-stable.
|
|
33
|
+
- **`CrossdeckServer.reportContractFailure(input)` method** — fires a
|
|
34
|
+
typed `crossdeck.contract_failed` server event through the standard
|
|
35
|
+
`track()` pipeline. Wire properties: `contract_id`, `sdk_version`
|
|
36
|
+
(auto-stamped), `sdk_platform` (auto-stamped to `"node"`),
|
|
37
|
+
`failure_reason`, `run_context` (`ci` | `dogfood` | `customer-app`),
|
|
38
|
+
`run_id`, plus optional `test_file` / `test_name` from `input.testRef`.
|
|
39
|
+
|
|
40
|
+
**Fixed:**
|
|
41
|
+
|
|
42
|
+
- `shutdownSync()` now emits the `sdk.shutdown` EventEmitter signal
|
|
43
|
+
with the correct reason — previously only the async `shutdown()`
|
|
44
|
+
path emitted, leaving consumers of `Symbol.dispose` /
|
|
45
|
+
`shutdownSync()` direct-callers blind. Async path is unchanged
|
|
46
|
+
thanks to a private dedup gate so listeners still fire exactly
|
|
47
|
+
once per teardown.
|
|
48
|
+
- Test infrastructure: shutdown-flush + track-PII-scrub tests were
|
|
49
|
+
reading `body.data` from captured fetch payloads but the wire
|
|
50
|
+
shape uses `body.events` (matching backend + Web/RN SDKs). Tests
|
|
51
|
+
fixed to read the correct field; behaviour was already correct.
|
|
52
|
+
|
|
53
|
+
**Changed:**
|
|
54
|
+
|
|
55
|
+
- Contract registry source files migrated to camelCase keys
|
|
56
|
+
(`appliesTo`, `codeRef`, `testRef`, `registeredAt`,
|
|
57
|
+
`firstRegisteredIn`). The bundled `contracts.json` sidecar uses
|
|
58
|
+
the new keys; `bundledIn` is build-stamped, never in source.
|
|
59
|
+
|
|
7
60
|
## [1.4.2] — 2026-05-26
|
|
8
61
|
|
|
9
62
|
Patch — fix `tests/shutdown-flush.test.ts` compile error under
|
package/README.md
CHANGED
|
@@ -569,6 +569,64 @@ const failed = results.filter((r) => !r.ok);
|
|
|
569
569
|
|
|
570
570
|
Symmetric `bulkRevokeEntitlement(revokes[], options?)`.
|
|
571
571
|
|
|
572
|
+
## Bank-grade contracts
|
|
573
|
+
|
|
574
|
+
The SDK ships its own contracts registry — every behavioural guarantee the SDK makes (per-user cache isolation, deterministic Idempotency-Key, queue durability, etc.) lives in `contracts/**/*.json` at the monorepo root and is **bundled into every release**. The customer's lockfile pins SDK code + contracts atomically — drift between what the SDK does and what it claims is structurally impossible. See [`contracts/README.md`](https://github.com/VistaApps-za/crossdeck/blob/main/contracts/README.md) for the full architecture.
|
|
575
|
+
|
|
576
|
+
### `CrossdeckContracts` — typed access to the bundled registry
|
|
577
|
+
|
|
578
|
+
```ts
|
|
579
|
+
import { CrossdeckContracts } from "@cross-deck/node";
|
|
580
|
+
|
|
581
|
+
CrossdeckContracts.all(); // enforced contracts only
|
|
582
|
+
CrossdeckContracts.allIncludingHistorical(); // + proposed + retired
|
|
583
|
+
CrossdeckContracts.byId("idempotency-key-deterministic");
|
|
584
|
+
CrossdeckContracts.byPillar("revenue");
|
|
585
|
+
CrossdeckContracts.withStatus("proposed");
|
|
586
|
+
CrossdeckContracts.findByTestName("rail namespacing prevents cross-rail collisions");
|
|
587
|
+
CrossdeckContracts.sdkVersion; // "1.5.0"
|
|
588
|
+
CrossdeckContracts.bundledIn; // "@cross-deck/node@1.5.0"
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
The `Contract` type is exported alongside; the binary-stability promise is documented in [`contracts/README.md`](https://github.com/VistaApps-za/crossdeck/blob/main/contracts/README.md).
|
|
592
|
+
|
|
593
|
+
### `crossdeckServer.reportContractFailure(input)` — surface contract test failures
|
|
594
|
+
|
|
595
|
+
When a contract test asserts and fails — in your CI, a dogfood run, or a customer integration test — fire a typed `crossdeck.contract_failed` event over the **Crossdeck reliability channel**. This is one-way operational telemetry to the Crossdeck operations team (Privacy Policy §6, "Flow B"); it never enters your `track()` pipeline, never shows in your dashboard, never bills against your event quota. The wire shape is schema-locked at [`contracts/diagnostics/contract-failed-payload-schema-lock.json`](https://github.com/VistaApps-za/crossdeck/blob/main/contracts/diagnostics/contract-failed-payload-schema-lock.json):
|
|
596
|
+
|
|
597
|
+
```ts
|
|
598
|
+
import { CrossdeckServer } from "@cross-deck/node";
|
|
599
|
+
|
|
600
|
+
const cd = new CrossdeckServer({ secretKey: process.env.CROSSDECK_SECRET_KEY! });
|
|
601
|
+
|
|
602
|
+
cd.reportContractFailure({
|
|
603
|
+
contractId: "idempotency-key-deterministic",
|
|
604
|
+
failureReason: "expected cross-SDK oracle to match canonical vector, got drift",
|
|
605
|
+
runContext: process.env.CI ? "ci" : "dogfood",
|
|
606
|
+
runId: process.env.GITHUB_RUN_ID ?? crypto.randomUUID(),
|
|
607
|
+
testRef: {
|
|
608
|
+
file: "tests/idempotency-key.test.ts",
|
|
609
|
+
name: "apple JWS produces the canonical pinned UUID across all 5 SDKs",
|
|
610
|
+
},
|
|
611
|
+
});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
No new endpoint, no special ingest path — the event lands in the same pipeline every other server-side `track()` call does. It surfaces immediately in the dashboard's live event feed, the breakdown chart (group by `contract_id`, `sdk_platform`), and any alert rule with `event = crossdeck.contract_failed`.
|
|
615
|
+
|
|
616
|
+
Properties stamped on the wire:
|
|
617
|
+
|
|
618
|
+
| Property | Source |
|
|
619
|
+
|----------|--------|
|
|
620
|
+
| `contract_id` | caller |
|
|
621
|
+
| `sdk_version`, `sdk_platform` | auto-stamped (`@cross-deck/node` ships `sdk_platform: "node"`) |
|
|
622
|
+
| `failure_reason`, `run_context`, `run_id` | caller |
|
|
623
|
+
| `test_file`, `test_name` | set when `testRef` is provided |
|
|
624
|
+
| `device_class` | optional, set by caller (categorical bucket — e.g. `"linux-server"`, `"container"`, `"lambda"`) |
|
|
625
|
+
|
|
626
|
+
The wire shape is schema-locked at [`contracts/diagnostics/contract-failed-payload-schema-lock.json`](https://github.com/VistaApps-za/crossdeck/blob/main/contracts/diagnostics/contract-failed-payload-schema-lock.json); per-SDK assertion tests gate it on every release. Free-form `extra` keys are not accepted — adding a field requires an amendment to the schema-lock contract first.
|
|
627
|
+
|
|
628
|
+
For per-test-framework hooks see [`contracts/README.md` § Reporting contract failures](https://github.com/VistaApps-za/crossdeck/blob/main/contracts/README.md#reporting-contract-failures-back-to-crossdeck).
|
|
629
|
+
|
|
572
630
|
## Node version
|
|
573
631
|
|
|
574
632
|
Node 18+. Uses the platform `fetch` and `node:crypto` — zero runtime dependencies.
|
|
@@ -111,96 +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.0";
|
|
177
|
-
readonly bundledIn: "@cross-deck/node@1.5.0";
|
|
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 — the Crossdeck dashboard joins
|
|
189
|
-
* `crossdeck.contract_failed` events across every SDK on
|
|
190
|
-
* `contract_id`, so the property bag has to agree.
|
|
191
|
-
*/
|
|
192
|
-
interface ContractFailureInput {
|
|
193
|
-
contractId: string;
|
|
194
|
-
failureReason: string;
|
|
195
|
-
runContext: "ci" | "dogfood" | "customer-app";
|
|
196
|
-
runId: string;
|
|
197
|
-
testRef?: {
|
|
198
|
-
file: string;
|
|
199
|
-
name: string;
|
|
200
|
-
};
|
|
201
|
-
extra?: Record<string, unknown>;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
114
|
/**
|
|
205
115
|
* Breadcrumb ring buffer — context attached to every error report.
|
|
206
116
|
*
|
|
@@ -499,10 +409,6 @@ interface PurchaseResult {
|
|
|
499
409
|
crossdeckCustomerId: string;
|
|
500
410
|
env: Environment;
|
|
501
411
|
entitlements: PublicEntitlement[];
|
|
502
|
-
/** True when the response came from the backend's idempotency
|
|
503
|
-
* cache instead of fresh processing. Backend also returns
|
|
504
|
-
* `Idempotent-Replayed: true` as a response header (v1.4.0). */
|
|
505
|
-
idempotent_replay?: boolean;
|
|
506
412
|
}
|
|
507
413
|
/**
|
|
508
414
|
* Response shape from `GET /v1/sdk/heartbeat`. Used by
|
|
@@ -556,25 +462,6 @@ interface CrossdeckServerOptions {
|
|
|
556
462
|
* not the source of truth.
|
|
557
463
|
*/
|
|
558
464
|
appId?: string;
|
|
559
|
-
/**
|
|
560
|
-
* Apply Crossdeck's PII scrubber to every `track()` payload before
|
|
561
|
-
* enqueue. Default `true` (parity with Web / RN / Swift SDKs — Node
|
|
562
|
-
* pre-v1.4.0 was the odd one out and SHIPPED EMAILS UNREDACTED, a
|
|
563
|
-
* privacy contract drift versus the README claim).
|
|
564
|
-
*
|
|
565
|
-
* The scrubber rewrites email-shaped and card-number-shaped
|
|
566
|
-
* substrings to `<email>` / `<card>` sentinels recursively across
|
|
567
|
-
* nested maps + arrays. See `scrubPii` / `scrubPiiFromProperties`.
|
|
568
|
-
*
|
|
569
|
-
* **Blast radius of setting `false`:** every `track()` payload —
|
|
570
|
-
* including event names with embedded emails ("user wes@example.com
|
|
571
|
-
* upgraded"), trait values, group memberships, error context blobs
|
|
572
|
-
* — ships verbatim to Crossdeck and downstream warehouses /
|
|
573
|
-
* analytics exports. Disable only for explicit compliance use
|
|
574
|
-
* cases (regulator-required audit trails where the raw value MUST
|
|
575
|
-
* be preserved) and document the decision at the call site.
|
|
576
|
-
*/
|
|
577
|
-
scrubPii?: boolean;
|
|
578
465
|
/**
|
|
579
466
|
* Error capture configuration. Default: ON with `onUncaughtException` +
|
|
580
467
|
* `onUnhandledRejection` + `wrapFetch` all enabled.
|
|
@@ -785,14 +672,6 @@ interface RequestOptions {
|
|
|
785
672
|
* `timeoutMs`. Pass `0` to disable.
|
|
786
673
|
*/
|
|
787
674
|
timeoutMs?: number;
|
|
788
|
-
/**
|
|
789
|
-
* Override the deterministic Idempotency-Key derivation (v1.4.0).
|
|
790
|
-
* The SDK derives a stable key from the request body so retries
|
|
791
|
-
* collapse on the backend. Override only when an outer
|
|
792
|
-
* orchestrator (job runner, retry harness) needs a different
|
|
793
|
-
* idempotency window — and document why at the call site.
|
|
794
|
-
*/
|
|
795
|
-
idempotencyKey?: string;
|
|
796
675
|
}
|
|
797
676
|
interface IdentityHints {
|
|
798
677
|
customerId?: string;
|
|
@@ -1283,10 +1162,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1283
1162
|
private readonly baseUrl;
|
|
1284
1163
|
private readonly appId;
|
|
1285
1164
|
private readonly env;
|
|
1286
|
-
/** PII scrubber toggle. Default true — parity with Web/RN/Swift.
|
|
1287
|
-
* Pre-v1.4.0 the Node SDK shipped track() payloads UNREDACTED,
|
|
1288
|
-
* a privacy contract drift versus the README. */
|
|
1289
|
-
private readonly scrubPii;
|
|
1290
1165
|
private readonly secretKeyPrefix;
|
|
1291
1166
|
/**
|
|
1292
1167
|
* Process-stable pseudo-anonymous ID. Used as the default identity
|
|
@@ -1332,15 +1207,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1332
1207
|
private errorContext;
|
|
1333
1208
|
private errorTags;
|
|
1334
1209
|
private errorBeforeSend;
|
|
1335
|
-
/**
|
|
1336
|
-
* Dedup gate for `sdk.shutdown`. Both `shutdown()` (async) and
|
|
1337
|
-
* `shutdownSync()` need to emit so direct callers of EITHER see
|
|
1338
|
-
* the event (the async path's listener guarantees pre-launch
|
|
1339
|
-
* tests, the sync path covers `Symbol.dispose` + tests that call
|
|
1340
|
-
* `shutdownSync()` directly). Without this flag, `shutdown()`'s
|
|
1341
|
-
* tail call into `shutdownSync()` would emit twice.
|
|
1342
|
-
*/
|
|
1343
|
-
private didEmitShutdown;
|
|
1344
1210
|
constructor(options: CrossdeckServerOptions);
|
|
1345
1211
|
/**
|
|
1346
1212
|
* Emit the honest "no cold-start durability" warning when the runtime
|
|
@@ -1465,14 +1331,6 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1465
1331
|
* `uncaughtException` has no per-request context; without the
|
|
1466
1332
|
* auto-fill, the event would be rejected at queue enqueue.
|
|
1467
1333
|
*/
|
|
1468
|
-
/**
|
|
1469
|
-
* Emit `crossdeck.contract_failed` with the canonical property
|
|
1470
|
-
* shape. Same wire shape every Crossdeck SDK uses for contract
|
|
1471
|
-
* verification telemetry — see `contracts/README.md` for the
|
|
1472
|
-
* full pattern. No new endpoint, no special path; goes through
|
|
1473
|
-
* the standard server-side `track()` pipeline.
|
|
1474
|
-
*/
|
|
1475
|
-
reportContractFailure(input: ContractFailureInput): void;
|
|
1476
1334
|
track(event: ServerEvent): void;
|
|
1477
1335
|
/**
|
|
1478
1336
|
* Immediate POST of one or more events. For bulk imports / replay
|
|
@@ -1683,36 +1541,11 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1683
1541
|
getGroups(): Record<string, GroupMembership>;
|
|
1684
1542
|
diagnostics(): Diagnostics;
|
|
1685
1543
|
/**
|
|
1686
|
-
* Tear down handlers and clear in-memory state.
|
|
1687
|
-
*
|
|
1688
|
-
*
|
|
1689
|
-
* before dropping the queue, so callers don't silently lose
|
|
1690
|
-
* every queued event on a clean shutdown. The pre-v1.4.0
|
|
1691
|
-
* behaviour (sync `eventQueue.reset()` with no flush) was the
|
|
1692
|
-
* default for both `shutdown()` and `[Symbol.dispose]`; only
|
|
1693
|
-
* `await using` + `[Symbol.asyncDispose]` flushed correctly.
|
|
1694
|
-
*
|
|
1695
|
-
* Production servers should still prefer `await server.flush()`
|
|
1696
|
-
* (visible) followed by `server.shutdown()` so the flush
|
|
1697
|
-
* outcome is observable — `shutdown()`'s internal flush swallows
|
|
1698
|
-
* errors as a best-effort drain.
|
|
1699
|
-
*
|
|
1700
|
-
* Use [[shutdownSync]] only when the runtime cannot await
|
|
1701
|
-
* (e.g. inside `Symbol.dispose` — see below).
|
|
1702
|
-
*/
|
|
1703
|
-
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): Promise<void>;
|
|
1704
|
-
/**
|
|
1705
|
-
* Synchronous teardown — drops the in-memory queue WITHOUT
|
|
1706
|
-
* flushing, then clears all in-memory state. Used by
|
|
1707
|
-
* `[Symbol.dispose]` (which has no await) and tests that need
|
|
1708
|
-
* an unconditional sync wipe. Production code should use
|
|
1709
|
-
* [[shutdown]] (async) instead so queued events are flushed.
|
|
1710
|
-
*
|
|
1711
|
-
* A queue with items at sync-shutdown logs a warning recommending
|
|
1712
|
-
* `[Symbol.asyncDispose]` or `await server.shutdown()` — silent
|
|
1713
|
-
* 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.
|
|
1714
1547
|
*/
|
|
1715
|
-
|
|
1548
|
+
shutdown(reason?: "shutdown" | "dispose" | "asyncDispose"): void;
|
|
1716
1549
|
/**
|
|
1717
1550
|
* Convert a `CapturedError` into a `ServerEvent` and push through
|
|
1718
1551
|
* `track()`. Goes through the same queue / enrichment / breadcrumb
|
|
@@ -1781,21 +1614,17 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1781
1614
|
* // ... use server ...
|
|
1782
1615
|
* // at end of block, server[Symbol.dispose]() runs automatically
|
|
1783
1616
|
*
|
|
1784
|
-
*
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
1788
|
-
* exit", switch to `await using` + `[Symbol.asyncDispose]` (or
|
|
1789
|
-
* call `await server.shutdown()` explicitly before the variable
|
|
1790
|
-
* 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).
|
|
1791
1621
|
*/
|
|
1792
1622
|
[Symbol.dispose](): void;
|
|
1793
1623
|
/**
|
|
1794
1624
|
* Async disposal hook — runs when an `await using` declaration
|
|
1795
|
-
* exits scope. Awaits
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
* 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).
|
|
1799
1628
|
*
|
|
1800
1629
|
* await using server = new CrossdeckServer({ ... });
|
|
1801
1630
|
*/
|
|
@@ -1881,4 +1710,4 @@ declare class CrossdeckServer extends EventEmitter {
|
|
|
1881
1710
|
private normalizeIngestEvent;
|
|
1882
1711
|
}
|
|
1883
1712
|
|
|
1884
|
-
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 };
|