@culpritsql/plans 0.5.10 → 0.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/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  [![TypeScript](https://img.shields.io/badge/types-ts--rs-3178c6?style=flat-square&labelColor=181715)](https://github.com/culpritsql/culprit-sql-studio)
15
15
  [![License: MIT](https://img.shields.io/badge/license-MIT-4cbb84?style=flat-square&labelColor=181715)](./LICENSE)
16
16
 
17
- **Portable WebAssembly execution plan parser, structural differ, deadlock parser, and exporter.**
17
+ **Portable WebAssembly execution plan parser, structural differ, deadlock & Extended Events (`.xel`) parser, and exporter.**
18
18
  <br />
19
19
  Compiled directly from [Culprit SQL Studio](https://github.com/culpritsql/culprit-sql-studio) and paired with [`@culpritsql/plan-viewer`](https://github.com/culpritsql/culprit-plan-viewer).
20
20
 
@@ -30,7 +30,7 @@ Compiled directly from [Culprit SQL Studio](https://github.com/culpritsql/culpri
30
30
  npm install @culpritsql/plans
31
31
  ```
32
32
 
33
- Initialize the WebAssembly module once, then call the synchronous parser, comparison, deadlock, and export operations:
33
+ Initialize the WebAssembly module once, then call the synchronous parser, comparison, deadlock, Extended Events, and export operations:
34
34
 
35
35
  ```ts
36
36
  import {
@@ -38,6 +38,8 @@ import {
38
38
  parsePlan,
39
39
  diffPlans,
40
40
  parseDeadlock,
41
+ parseXel,
42
+ parseExtendedEventsXml,
41
43
  exportPlan,
42
44
  } from "@culpritsql/plans";
43
45
 
@@ -48,21 +50,22 @@ const after = parsePlan(afterPlanText, "postgres");
48
50
  const diff = diffPlans(before, "Before", after, "After");
49
51
 
50
52
  const deadlocks = parseDeadlock(deadlockLogText);
53
+ const xelEvents = parseXel(new Uint8Array(await xelFile.arrayBuffer()));
51
54
  const exported = exportPlan(after, "checkout-query", "markdown", {
52
55
  redact: true,
53
56
  notes: [],
54
57
  });
55
58
  ```
56
59
 
57
- > Rendering in React? Pass `Plan`, `PlanDiff`, and `Deadlock` directly to [`@culpritsql/plan-viewer`](https://www.npmjs.com/package/@culpritsql/plan-viewer). Both packages share the exact same generated `ts-rs` model types.
60
+ > Rendering in React? Pass `Plan`, `PlanDiff`, `Deadlock`, and `ExtendedEventsBatch` directly to [`@culpritsql/plan-viewer`](https://www.npmjs.com/package/@culpritsql/plan-viewer). Both packages share the exact same generated `ts-rs` model types.
58
61
 
59
62
  ---
60
63
 
61
64
  ## Supported Engines
62
65
 
63
- | Engine | Execution Plans | Deadlocks |
66
+ | Engine | Execution Plans | Deadlocks & Native Events |
64
67
  | --- | --- | --- |
65
- | **SQL Server** | `.sqlplan` Showplan XML | XML deadlock graphs |
68
+ | **SQL Server** | `.sqlplan` Showplan XML | XML deadlock graphs, binary `.xel` & XML Extended Events (`xml_deadlock_report`, `error_reported`, `attention`) |
66
69
  | **PostgreSQL** | `EXPLAIN (FORMAT JSON)`, `EXPLAIN (ANALYZE, BUFFERS)` text | Server log deadlock excerpts |
67
70
  | **MySQL & MariaDB** | `EXPLAIN FORMAT=JSON`, `EXPLAIN ANALYZE` tree text | `SHOW ENGINE INNODB STATUS` |
68
71
  | **YugabyteDB** | `EXPLAIN (FORMAT JSON)` + DocDB RPC/storage metrics | PostgreSQL-compatible logs |
@@ -78,6 +81,8 @@ const exported = exportPlan(after, "checkout-query", "markdown", {
78
81
  | `parsePlan` | `parsePlan(input: string, engine?: Engine): Plan` | Auto-detects format or validates strictly against `"mssql" \| "postgres" \| "mysql" \| "yugabyte" \| "sqlite"` |
79
82
  | `diffPlans` | `diffPlans(a: Plan, nameA: string, b: Plan, nameB: string, context?: CompareContext): PlanDiff` | Computes structural operator changes, access-path flips, cardinality shifts, and speedup/cost verdicts |
80
83
  | `parseDeadlock` | `parseDeadlock(input: string): Deadlock[]` | Extracts victim selection, participant sessions, held/waited locks, and original timestamps |
84
+ | `parseXel` | `parseXel(input: Uint8Array, limits?: Partial<NativeLogLimits>): ExtendedEventsBatch` | Decodes binary SQL Server `.xel` captures (with SQL literal redaction and embedded deadlock graph extraction) |
85
+ | `parseExtendedEventsXml` | `parseExtendedEventsXml(input: string \| Uint8Array, limits?: Partial<NativeLogLimits>): ExtendedEventsBatch` | Decodes exported `<events>`, `<RingBufferTarget>`, or `<event>` XML records |
81
86
  | `exportPlan` | `exportPlan(plan: Plan, title: string, format: ExportFormat, options: ExportOptions): ExportFile` | Exports `"markdown"`, `"html"`, or `"native"` with optional SQL literal redaction |
82
87
  | `ParserError` | `class ParserError extends Error` | Structured refusal error (`error.error` carries `{ code, message, hint, detail }`) instead of Wasm traps |
83
88
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@culpritsql/plans",
3
- "version": "0.5.10",
4
- "description": "Portable WebAssembly execution plan parser, comparator, deadlock parser, and exporter for SQL Server, PostgreSQL, MySQL, MariaDB, YugabyteDB, and SQLite.",
3
+ "version": "0.6.0",
4
+ "description": "Portable WebAssembly execution plan parser, comparator, deadlock & Extended Events (.xel) parser, and exporter for SQL Server, PostgreSQL, MySQL, MariaDB, YugabyteDB, and SQLite.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -34,6 +34,8 @@
34
34
  "showplan",
35
35
  "sqlplan",
36
36
  "deadlock",
37
+ "xel",
38
+ "extended-events",
37
39
  "wasm",
38
40
  "webassembly",
39
41
  "postgres",
@@ -12,8 +12,13 @@
12
12
  ],
13
13
  "bindgen_cli_version": "0.2.129"
14
14
  },
15
- "cargo_lock_sha256": "579ac978fabed398aa39905eb02c3e0c9d09b32f8bf98ac1e64f56631e40b31e",
15
+ "cargo_lock_sha256": "f820645c6adbffcdea034e1112adfee622b2e88984faf901e6a40855540998fd",
16
16
  "models": [
17
+ {
18
+ "name": "ActivityClient",
19
+ "source_sha256": "10f39fa8fbca174637dfb60ae9a2053803ea8f67399eb783d275875a9eb3d139",
20
+ "package_sha256": "10f39fa8fbca174637dfb60ae9a2053803ea8f67399eb783d275875a9eb3d139"
21
+ },
17
22
  {
18
23
  "name": "ActualSummary",
19
24
  "source_sha256": "f2835c5d703e3187b50a066ef0391fe266ce5f79e1f3a95058f41ba687dc890d",
@@ -94,6 +99,11 @@
94
99
  "source_sha256": "7e860c0796f78806ed040aca34f4359b5815433d6643fe6aecc31a7f5f62f4a8",
95
100
  "package_sha256": "33b2f5da2597a7c8ac49e014a5c59edc04d8d4c21ff6e8aeb245110e107327c6"
96
101
  },
102
+ {
103
+ "name": "DefinitionPayload",
104
+ "source_sha256": "0bfa9c1fdcfd3fc29f7a2c54918e30273c2482f6bda3afea4c28718bda4d11fc",
105
+ "package_sha256": "315f41ffd457f6839a5223354c226c2a8fb909bfe1b6a87218d932ada91be4ac"
106
+ },
97
107
  {
98
108
  "name": "DeliveryProblem",
99
109
  "source_sha256": "8483d01853894a44cbf3c395c5d85e354983e1e360421cf5445d9657419849a9",
@@ -149,11 +159,31 @@
149
159
  "source_sha256": "c3904ddb90f321219f13b47040596e8cfd17a49da28fc00befd7a5f45cc66efc",
150
160
  "package_sha256": "fd595b33db897d2cf8d99783af82765f363faa9e8bda81fd8783fe9d9e0144cf"
151
161
  },
162
+ {
163
+ "name": "ExtendedEventsBatch",
164
+ "source_sha256": "407e340e1ae15ac9284c6e7d92c6a84530d76290e72fabd25de5662a304ce647",
165
+ "package_sha256": "c52af3bea9ebbd6fe8881f69005e9bfb2f6246bb377862f257611c9c6c47fc9c"
166
+ },
167
+ {
168
+ "name": "ExtendedEventsFormat",
169
+ "source_sha256": "4d2c0f3c8044661ffaae384ba7fae512286de9915c0b44cc2cbe0ae3d388cbfa",
170
+ "package_sha256": "4d2c0f3c8044661ffaae384ba7fae512286de9915c0b44cc2cbe0ae3d388cbfa"
171
+ },
152
172
  {
153
173
  "name": "Guess",
154
174
  "source_sha256": "583209cb03473ded995c96081209c7a82adb51108949a6b83d654def8eabeb87",
155
175
  "package_sha256": "583209cb03473ded995c96081209c7a82adb51108949a6b83d654def8eabeb87"
156
176
  },
177
+ {
178
+ "name": "ImportedEventDeadlock",
179
+ "source_sha256": "25285508b913f1b3369a7adff2115bd6d6da5348e373ed7d98d2ea97bfa9a1a7",
180
+ "package_sha256": "4b3141c6ad60451cefee1050d7790cdcc2600e1f3c89690b9153a7675aba1679"
181
+ },
182
+ {
183
+ "name": "ImportedEventLocation",
184
+ "source_sha256": "31bd187e4b7fa52fb75c7a5f2e7a27e03966c30efbf8efe5f74f38d9bf917cc9",
185
+ "package_sha256": "31bd187e4b7fa52fb75c7a5f2e7a27e03966c30efbf8efe5f74f38d9bf917cc9"
186
+ },
157
187
  {
158
188
  "name": "InsightArea",
159
189
  "source_sha256": "5a66f669936f61980221c4721020a6fc2a1c7fe0dbca4b5867a3a26b9ff56934",
@@ -214,6 +244,16 @@
214
244
  "source_sha256": "7b198ef60b7ca6a64bdd7bac89a39348f364a953c041e5381fde67f5e70de6dc",
215
245
  "package_sha256": "7b198ef60b7ca6a64bdd7bac89a39348f364a953c041e5381fde67f5e70de6dc"
216
246
  },
247
+ {
248
+ "name": "MssqlExtendedEventKind",
249
+ "source_sha256": "50f121d1a6b8352bb5864ee1d798d92b6b03797d7a8282c4f65a64c79c82ff39",
250
+ "package_sha256": "50f121d1a6b8352bb5864ee1d798d92b6b03797d7a8282c4f65a64c79c82ff39"
251
+ },
252
+ {
253
+ "name": "MssqlExtendedEventObservation",
254
+ "source_sha256": "46eca68f0f93a965176fb2024e53e06a2c0f5d8a745d108c3fd74b09804c0723",
255
+ "package_sha256": "1c146bf5fe1665c133d52922e4525ecd5a856c221ea4a6424b132a2abb9a4581"
256
+ },
217
257
  {
218
258
  "name": "MssqlIndexParentKind",
219
259
  "source_sha256": "74ff97cd4c3e002904541c2536d1e2e1a7ac13ec4afbaf9734ad850ccd70f2f0",
@@ -229,6 +269,21 @@
229
269
  "source_sha256": "899a25298c7ab4f6bb23a78bdfe63f46e5d6a494481d22e4d1207b8a654c854b",
230
270
  "package_sha256": "899a25298c7ab4f6bb23a78bdfe63f46e5d6a494481d22e4d1207b8a654c854b"
231
271
  },
272
+ {
273
+ "name": "NativeLogIssue",
274
+ "source_sha256": "a452afc6fda04a6f811a0bac19418689f2c717484de765dbd1e9381fb73346d0",
275
+ "package_sha256": "f661e310ecef619afcd988943ed7870109d389081c01adb8295b5a36cf1dcea5"
276
+ },
277
+ {
278
+ "name": "NativeLogLimits",
279
+ "source_sha256": "73bbef9d42ea49396a5ffe20169e60f50416faad002579486dbd2df9bed8255e",
280
+ "package_sha256": "73bbef9d42ea49396a5ffe20169e60f50416faad002579486dbd2df9bed8255e"
281
+ },
282
+ {
283
+ "name": "NativeLogProblem",
284
+ "source_sha256": "3c87ad3fdbcfd0cfd150daf9dad3d51d66d8da68dda3594fac5e521f74f922ce",
285
+ "package_sha256": "3c87ad3fdbcfd0cfd150daf9dad3d51d66d8da68dda3594fac5e521f74f922ce"
286
+ },
232
287
  {
233
288
  "name": "NativePlanIdentity",
234
289
  "source_sha256": "32ea705859b80958e4599abaf394754bf39a542242ccc72e40007eb423ee8616",
@@ -264,6 +319,11 @@
264
319
  "source_sha256": "419165c1e0c4d1d932a220a3b1e5c5d5a53c1e469026993e5cd05763a34fdbab",
265
320
  "package_sha256": "419165c1e0c4d1d932a220a3b1e5c5d5a53c1e469026993e5cd05763a34fdbab"
266
321
  },
322
+ {
323
+ "name": "PayloadUnavailable",
324
+ "source_sha256": "12d08c73b12e58d07784175bd981384f86158d6b2daec84fde50e8ff4d0ce596",
325
+ "package_sha256": "12d08c73b12e58d07784175bd981384f86158d6b2daec84fde50e8ff4d0ce596"
326
+ },
267
327
  {
268
328
  "name": "Plan",
269
329
  "source_sha256": "cf86312e76ada6e1950a93b90f4737be8c6a90b7b7d40f38c19a2056c4fa4e6e",
@@ -566,22 +626,22 @@
566
626
  },
567
627
  "artifacts": {
568
628
  "index.js": {
569
- "bytes": 1774,
570
- "gzip_bytes": 808,
571
- "brotli_bytes": 642,
572
- "sha256": "71e1010bc8581f986bda14ad494cbd75394f38792f3ab47cbf721bbd62e7f63d"
629
+ "bytes": 2709,
630
+ "gzip_bytes": 1144,
631
+ "brotli_bytes": 925,
632
+ "sha256": "6253f7a982a91fe67dd1186266d4c0ae153f12d17f67e90e98e37e3e25574153"
573
633
  },
574
634
  "native/culprit_wasm.js": {
575
- "bytes": 13044,
576
- "gzip_bytes": 2754,
577
- "brotli_bytes": 2426,
578
- "sha256": "3bb76e45db8e62c5c0e7bc95f0f13e488dbd9649d818ca615fd513ecefb1a738"
635
+ "bytes": 16073,
636
+ "gzip_bytes": 3047,
637
+ "brotli_bytes": 2675,
638
+ "sha256": "56ae0668a581f01eb3b8d4e2a33db4d83d27f9611268971b890e5d6a87dd4495"
579
639
  },
580
640
  "native/culprit_wasm_bg.wasm": {
581
- "bytes": 4797301,
582
- "gzip_bytes": 1438124,
583
- "brotli_bytes": 1022783,
584
- "sha256": "fbbe48ff499b6e18198e6d0d560543f00795ecb2db6a1d8a9e5a2e00e2ee7fe5"
641
+ "bytes": 4921358,
642
+ "gzip_bytes": 1484377,
643
+ "brotli_bytes": 1052524,
644
+ "sha256": "10b8e6e4cf789df5b4c5b5f7c1609c79ca8e65dc4964c527b178c482b25b946e"
585
645
  }
586
646
  },
587
647
  "native_or_database_work": false
package/pkg/index.d.ts CHANGED
@@ -1,14 +1,26 @@
1
1
  import initialize from "./native/culprit_wasm.js";
2
+ import type { ActivityClient } from "./models/ActivityClient.js";
2
3
  import type { CompareContext } from "./models/CompareContext.js";
3
4
  import type { Deadlock } from "./models/Deadlock.js";
5
+ import type { DefinitionPayload } from "./models/DefinitionPayload.js";
4
6
  import type { Engine } from "./models/Engine.js";
5
7
  import type { Error as CoreError } from "./models/Error.js";
6
8
  import type { ExportFile } from "./models/ExportFile.js";
7
9
  import type { ExportFormat } from "./models/ExportFormat.js";
8
10
  import type { ExportOptions } from "./models/ExportOptions.js";
11
+ import type { ExtendedEventsBatch } from "./models/ExtendedEventsBatch.js";
12
+ import type { ExtendedEventsFormat } from "./models/ExtendedEventsFormat.js";
13
+ import type { ImportedEventDeadlock } from "./models/ImportedEventDeadlock.js";
14
+ import type { ImportedEventLocation } from "./models/ImportedEventLocation.js";
15
+ import type { MssqlExtendedEventKind } from "./models/MssqlExtendedEventKind.js";
16
+ import type { MssqlExtendedEventObservation } from "./models/MssqlExtendedEventObservation.js";
17
+ import type { NativeLogIssue } from "./models/NativeLogIssue.js";
18
+ import type { NativeLogLimits } from "./models/NativeLogLimits.js";
19
+ import type { NativeLogProblem } from "./models/NativeLogProblem.js";
20
+ import type { PayloadUnavailable } from "./models/PayloadUnavailable.js";
9
21
  import type { Plan } from "./models/Plan.js";
10
22
  import type { PlanDiff } from "./models/PlanDiff.js";
11
- export type { CompareContext, Deadlock, Engine, CoreError, ExportFile, ExportFormat, ExportOptions, Plan, PlanDiff };
23
+ export type { ActivityClient, CompareContext, CoreError, Deadlock, DefinitionPayload, Engine, ExportFile, ExportFormat, ExportOptions, ExtendedEventsBatch, ExtendedEventsFormat, ImportedEventDeadlock, ImportedEventLocation, MssqlExtendedEventKind, MssqlExtendedEventObservation, NativeLogIssue, NativeLogLimits, NativeLogProblem, PayloadUnavailable, Plan, PlanDiff, };
12
24
  /** Initialize the local module once before calling its synchronous pure operations. */
13
25
  export declare function init(input?: Parameters<typeof initialize>[0]): Promise<void>;
14
26
  /** The exact Core error returned by the shared parser/export owner, without a second message catalogue. */
@@ -22,5 +34,9 @@ export declare function parsePlan(input: string, engine?: Engine): Plan;
22
34
  export declare function diffPlans(a: Plan, nameA: string, b: Plan, nameB: string, context?: CompareContext): PlanDiff;
23
35
  /** Parse native deadlock text into the existing Core observations; no source or clock is inferred. */
24
36
  export declare function parseDeadlock(input: string): Deadlock[];
37
+ /** Decode a binary SQL Server Extended Events (.xel) buffer within explicit or default bounds. XML text is refused on this route. */
38
+ export declare function parseXel(input: Uint8Array, limits?: Partial<NativeLogLimits>): ExtendedEventsBatch;
39
+ /** Decode exported SQL Server Extended Events XML (`<events>`, `<RingBufferTarget>`, or `<event>`) within bounds. Binary .xel is refused. */
40
+ export declare function parseExtendedEventsXml(input: string | Uint8Array, limits?: Partial<NativeLogLimits>): ExtendedEventsBatch;
25
41
  /** Keep the existing Markdown/HTML/native redaction and file-naming policy. */
26
42
  export declare function exportPlan(plan: Plan, title: string, format: ExportFormat, options: ExportOptions): ExportFile;
package/pkg/index.js CHANGED
@@ -30,6 +30,26 @@ export function diffPlans(a, nameA, b, nameB, context = { statistics: [], taken_
30
30
  export function parseDeadlock(input) {
31
31
  return result(native.parseDeadlockJson(input));
32
32
  }
33
+ const DEFAULT_EVENT_LIMITS = {
34
+ input_bytes: 8 * 1024 * 1024,
35
+ record_bytes: 256 * 1024,
36
+ field_bytes: 64 * 1024,
37
+ records: 4096,
38
+ };
39
+ function resolveEventLimits(limits) {
40
+ if (!limits)
41
+ return null;
42
+ return { ...DEFAULT_EVENT_LIMITS, ...limits };
43
+ }
44
+ /** Decode a binary SQL Server Extended Events (.xel) buffer within explicit or default bounds. XML text is refused on this route. */
45
+ export function parseXel(input, limits) {
46
+ return result(native.parseXelJson(input, JSON.stringify(resolveEventLimits(limits))));
47
+ }
48
+ /** Decode exported SQL Server Extended Events XML (`<events>`, `<RingBufferTarget>`, or `<event>`) within bounds. Binary .xel is refused. */
49
+ export function parseExtendedEventsXml(input, limits) {
50
+ const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
51
+ return result(native.parseExtendedEventsXmlJson(bytes, JSON.stringify(resolveEventLimits(limits))));
52
+ }
33
53
  /** Keep the existing Markdown/HTML/native redaction and file-naming policy. */
34
54
  export function exportPlan(plan, title, format, options) {
35
55
  const exportedAt = `${new Date().toISOString().slice(0, 16).replace("T", " ")} UTC`;
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type ActivityClient = { application: string | null, user: string | null, host: string | null, };
@@ -0,0 +1,4 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { PayloadUnavailable } from "./PayloadUnavailable.js";
3
+
4
+ export type DefinitionPayload = { "state": "available", text: string, sha256: string, redaction_version: number, } | { "state": "unavailable", reason: PayloadUnavailable, };
@@ -0,0 +1,13 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { ExtendedEventsFormat } from "./ExtendedEventsFormat.js";
3
+ import type { ImportedEventDeadlock } from "./ImportedEventDeadlock.js";
4
+ import type { ImportedEventLocation } from "./ImportedEventLocation.js";
5
+ import type { MssqlExtendedEventObservation } from "./MssqlExtendedEventObservation.js";
6
+ import type { NativeLogIssue } from "./NativeLogIssue.js";
7
+ import type { NativeLogProblem } from "./NativeLogProblem.js";
8
+
9
+ /**
10
+ * Bounded SQL Server Extended Events decoded from an explicit binary `.xel` or XML artifact.
11
+ * Captured metadata, client labels, and statements are contextual; they establish neither database ownership nor complete history.
12
+ */
13
+ export type ExtendedEventsBatch = { format: ExtendedEventsFormat, records: Array<MssqlExtendedEventObservation>, deadlocks: Array<ImportedEventDeadlock>, locations: Array<ImportedEventLocation>, issues: Array<NativeLogIssue>, stopped: NativeLogProblem | null, records_examined: number, };
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type ExtendedEventsFormat = "xel" | "xml";
@@ -0,0 +1,8 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { Deadlock } from "./Deadlock.js";
3
+
4
+ export type ImportedEventDeadlock = {
5
+ /**
6
+ * Position in this artifact only; graph IDs do not prove a distinct native occurrence across imports.
7
+ */
8
+ position: number, graph: Deadlock, };
@@ -0,0 +1,15 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type ImportedEventLocation = {
4
+ /**
5
+ * Zero-based position in `evidence.observations` within this supplied artifact.
6
+ */
7
+ position: number,
8
+ /**
9
+ * Byte offset of the enclosing binary XEL event buffer in the supplied artifact (`None` for XML exports).
10
+ */
11
+ buffer_offset: number | null,
12
+ /**
13
+ * Byte offset of the event record within the supplied artifact.
14
+ */
15
+ event_offset: number, };
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type MssqlExtendedEventKind = { "event": "attention", native_duration: string | null, } | { "event": "error-reported", number: number, severity: number, state: number, intercepted: boolean | null, user_defined: boolean | null, } | { "event": "deadlock-report", graphs: number, };
@@ -0,0 +1,22 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { ActivityClient } from "./ActivityClient.js";
3
+ import type { DefinitionPayload } from "./DefinitionPayload.js";
4
+ import type { MssqlExtendedEventKind } from "./MssqlExtendedEventKind.js";
5
+
6
+ export type MssqlExtendedEventObservation = { position: number, kind: MssqlExtendedEventKind,
7
+ /**
8
+ * The original timestamp attribute, including an offset-free value or absence.
9
+ */
10
+ timestamp: string | null, timestamp_utc: string | null,
11
+ /**
12
+ * Native actions are optional. These IDs lack member/process/session generations and cannot authorize a read.
13
+ */
14
+ event_sequence: string | null, session_id: string | null, request_id: string | null, transaction_id: string | null, database_id: string | null, database: string | null,
15
+ /**
16
+ * Native client labels are contextual, not an application/service owner mapping.
17
+ */
18
+ client: ActivityClient | null,
19
+ /**
20
+ * The event's captured sql_text action, not the statement that acquired a resource or caused this event.
21
+ */
22
+ statement: DefinitionPayload, };
@@ -0,0 +1,8 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { NativeLogProblem } from "./NativeLogProblem.js";
3
+
4
+ export type NativeLogIssue = {
5
+ /**
6
+ * Zero-based supplied record position, not an occurrence identity across acquisitions.
7
+ */
8
+ position: number, problem: NativeLogProblem, };
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type NativeLogLimits = { input_bytes: number, record_bytes: number, field_bytes: number, records: number, };
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type NativeLogProblem = { "kind": "invalid-limits" } | { "kind": "input-limit" } | { "kind": "input-changed" } | { "kind": "record-limit" } | { "kind": "record-bytes" } | { "kind": "field-bytes" } | { "kind": "invalid-utf8" } | { "kind": "invalid-encoding" } | { "kind": "malformed-record" } | { "kind": "duplicate-field" } | { "kind": "invalid-field", "field": string } | { "kind": "csv-column-count" } | { "kind": "native-shape" } | { "kind": "unsupported-version" } | { "kind": "unsupported-event" };
@@ -0,0 +1,3 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type PayloadUnavailable = "missing" | "restricted" | "encrypted" | "oversized" | "redaction-failed" | "not-collected" | "source-unavailable";
@@ -7,11 +7,23 @@ export function exportPlanJson(plan_json: string, title: string, format_json: st
7
7
 
8
8
  export function parseDeadlockJson(input: string): string;
9
9
 
10
+ /**
11
+ * Decode exported SQL Server Extended Events XML (`<events>`, `<RingBufferTarget>`, or `<event>`) within bounds.
12
+ * Binary .xel files are refused on this route.
13
+ */
14
+ export function parseExtendedEventsXmlJson(input: Uint8Array, limits_json: string): string;
15
+
10
16
  /**
11
17
  * The optional supplied engine selects the existing strict native parser; it is not source authority.
12
18
  */
13
19
  export function parsePlanJson(input: string, engine_json: string): string;
14
20
 
21
+ /**
22
+ * Decode a binary SQL Server Extended Events (.xel) buffer within explicit or default bounds.
23
+ * XML text is refused on this route so binary session-clock framing stays distinct from XML exports.
24
+ */
25
+ export function parseXelJson(input: Uint8Array, limits_json: string): string;
26
+
15
27
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
16
28
 
17
29
  export interface InitOutput {
@@ -19,7 +31,9 @@ export interface InitOutput {
19
31
  readonly diffPlansJson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
20
32
  readonly exportPlanJson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
21
33
  readonly parseDeadlockJson: (a: number, b: number, c: number) => void;
34
+ readonly parseExtendedEventsXmlJson: (a: number, b: number, c: number, d: number, e: number) => void;
22
35
  readonly parsePlanJson: (a: number, b: number, c: number, d: number, e: number) => void;
36
+ readonly parseXelJson: (a: number, b: number, c: number, d: number, e: number) => void;
23
37
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
24
38
  readonly __wbindgen_export: (a: number, b: number) => number;
25
39
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
@@ -117,6 +117,42 @@ export function parseDeadlockJson(input) {
117
117
  }
118
118
  }
119
119
 
120
+ /**
121
+ * Decode exported SQL Server Extended Events XML (`<events>`, `<RingBufferTarget>`, or `<event>`) within bounds.
122
+ * Binary .xel files are refused on this route.
123
+ * @param {Uint8Array} input
124
+ * @param {string} limits_json
125
+ * @returns {string}
126
+ */
127
+ export function parseExtendedEventsXmlJson(input, limits_json) {
128
+ let deferred4_0;
129
+ let deferred4_1;
130
+ try {
131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
132
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
133
+ const len0 = WASM_VECTOR_LEN;
134
+ const ptr1 = passStringToWasm0(limits_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
135
+ const len1 = WASM_VECTOR_LEN;
136
+ wasm.parseExtendedEventsXmlJson(retptr, ptr0, len0, ptr1, len1);
137
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
138
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
139
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
140
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
141
+ var ptr3 = r0;
142
+ var len3 = r1;
143
+ if (r3) {
144
+ ptr3 = 0; len3 = 0;
145
+ throw takeObject(r2);
146
+ }
147
+ deferred4_0 = ptr3;
148
+ deferred4_1 = len3;
149
+ return getStringFromWasm0(ptr3, len3);
150
+ } finally {
151
+ wasm.__wbindgen_add_to_stack_pointer(16);
152
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
153
+ }
154
+ }
155
+
120
156
  /**
121
157
  * The optional supplied engine selects the existing strict native parser; it is not source authority.
122
158
  * @param {string} input
@@ -151,6 +187,42 @@ export function parsePlanJson(input, engine_json) {
151
187
  wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
152
188
  }
153
189
  }
190
+
191
+ /**
192
+ * Decode a binary SQL Server Extended Events (.xel) buffer within explicit or default bounds.
193
+ * XML text is refused on this route so binary session-clock framing stays distinct from XML exports.
194
+ * @param {Uint8Array} input
195
+ * @param {string} limits_json
196
+ * @returns {string}
197
+ */
198
+ export function parseXelJson(input, limits_json) {
199
+ let deferred4_0;
200
+ let deferred4_1;
201
+ try {
202
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
203
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export);
204
+ const len0 = WASM_VECTOR_LEN;
205
+ const ptr1 = passStringToWasm0(limits_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
206
+ const len1 = WASM_VECTOR_LEN;
207
+ wasm.parseXelJson(retptr, ptr0, len0, ptr1, len1);
208
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
209
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
210
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
211
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
212
+ var ptr3 = r0;
213
+ var len3 = r1;
214
+ if (r3) {
215
+ ptr3 = 0; len3 = 0;
216
+ throw takeObject(r2);
217
+ }
218
+ deferred4_0 = ptr3;
219
+ deferred4_1 = len3;
220
+ return getStringFromWasm0(ptr3, len3);
221
+ } finally {
222
+ wasm.__wbindgen_add_to_stack_pointer(16);
223
+ wasm.__wbindgen_export3(deferred4_0, deferred4_1, 1);
224
+ }
225
+ }
154
226
  function __wbg_get_imports() {
155
227
  const import0 = {
156
228
  __proto__: null,
@@ -208,6 +280,13 @@ heap.push(undefined, null, true, false);
208
280
 
209
281
  let heap_next = heap.length;
210
282
 
283
+ function passArray8ToWasm0(arg, malloc) {
284
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
285
+ getUint8ArrayMemory0().set(arg, ptr / 1);
286
+ WASM_VECTOR_LEN = arg.length;
287
+ return ptr;
288
+ }
289
+
211
290
  function passStringToWasm0(arg, malloc, realloc) {
212
291
  if (realloc === undefined) {
213
292
  const buf = cachedTextEncoder.encode(arg);
Binary file
@@ -4,7 +4,9 @@ export const memory: WebAssembly.Memory;
4
4
  export const diffPlansJson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
5
5
  export const exportPlanJson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
6
6
  export const parseDeadlockJson: (a: number, b: number, c: number) => void;
7
+ export const parseExtendedEventsXmlJson: (a: number, b: number, c: number, d: number, e: number) => void;
7
8
  export const parsePlanJson: (a: number, b: number, c: number, d: number, e: number) => void;
9
+ export const parseXelJson: (a: number, b: number, c: number, d: number, e: number) => void;
8
10
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
9
11
  export const __wbindgen_export: (a: number, b: number) => number;
10
12
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;