pgbeam 0.3.8 → 0.3.10

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.
@@ -1102,6 +1102,16 @@ type ApprovalRequest = {
1102
1102
  * @type string | undefined
1103
1103
  */
1104
1104
  statement_kind?: string;
1105
+ /**
1106
+ * @description Best-effort estimate of how many rows the statement would affect, attached by the data plane when the statement was held. Either the planner estimate from EXPLAIN or the exact count observed in a rolled-back trial execution. Null when no estimate could be made; treat it as an estimate, not a guarantee.
1107
+ * @type integer
1108
+ */
1109
+ estimated_rows?: number | null;
1110
+ /**
1111
+ * @description Relations the statement touches, from the gateway\'s parse analysis.
1112
+ * @type array | undefined
1113
+ */
1114
+ target_tables?: string[];
1105
1115
  /**
1106
1116
  * @description Current state of the approval request.
1107
1117
  * @type string
@@ -1347,6 +1357,7 @@ type AuditDecisionKey = (typeof auditDecision)[keyof typeof auditDecision];
1347
1357
  declare const auditSource: {
1348
1358
  readonly wire: "wire";
1349
1359
  readonly mcp: "mcp";
1360
+ readonly rest: "rest";
1350
1361
  readonly control: "control";
1351
1362
  };
1352
1363
  type AuditSourceKey = (typeof auditSource)[keyof typeof auditSource];
@@ -1447,7 +1458,7 @@ type AuditLogEntry = {
1447
1458
  */
1448
1459
  session_id?: string;
1449
1460
  /**
1450
- * @description Statement origin (wire, mcp, or control for control-plane lifecycle events).
1461
+ * @description Statement origin (wire, mcp, rest, or control for control-plane lifecycle events).
1451
1462
  * @type string | undefined
1452
1463
  */
1453
1464
  source?: string;
@@ -1456,6 +1467,21 @@ type AuditLogEntry = {
1456
1467
  * @type string
1457
1468
  */
1458
1469
  ts: string;
1470
+ /**
1471
+ * @description Monotonic per-project position in the tamper-evident hash chain.
1472
+ * @type integer | undefined
1473
+ */
1474
+ seq?: number;
1475
+ /**
1476
+ * @description Hex SHA-256 of the previous chained entry (a fixed genesis value for the first entry). Empty for pre-chain legacy entries.
1477
+ * @type string | undefined
1478
+ */
1479
+ prev_hash?: string;
1480
+ /**
1481
+ * @description Hex SHA-256 of this entry\'s canonical content chained onto prev_hash. Empty for pre-chain legacy entries.
1482
+ * @type string | undefined
1483
+ */
1484
+ entry_hash?: string;
1459
1485
  };
1460
1486
 
1461
1487
  /**
@@ -1509,7 +1535,7 @@ type ListAuditLogsQueryEvent = string | undefined;
1509
1535
  */
1510
1536
  type ListAuditLogsQueryDecision = AuditDecisionKey | undefined;
1511
1537
  /**
1512
- * @description Filter by statement origin (wire, mcp, or control).
1538
+ * @description Filter by statement origin (wire, mcp, rest, or control).
1513
1539
  * @type string | undefined
1514
1540
  */
1515
1541
  type ListAuditLogsQuerySource = AuditSourceKey | undefined;
@@ -1601,7 +1627,7 @@ type ExportAuditLogsQueryEvent = string | undefined;
1601
1627
  */
1602
1628
  type ExportAuditLogsQueryDecision = AuditDecisionKey | undefined;
1603
1629
  /**
1604
- * @description Filter by statement origin (wire, mcp, or control).
1630
+ * @description Filter by statement origin (wire, mcp, rest, or control).
1605
1631
  * @type string | undefined
1606
1632
  */
1607
1633
  type ExportAuditLogsQuerySource = AuditSourceKey | undefined;
@@ -1648,6 +1674,108 @@ type ExportAuditLogsRequestConfig = {
1648
1674
  url: `/v1/projects/${string}/audit-logs/export`;
1649
1675
  };
1650
1676
 
1677
+ /**
1678
+ * Generated by Kubb (https://kubb.dev/).
1679
+ * Do not edit manually.
1680
+ */
1681
+ /**
1682
+ * @description Result of recomputing the project\'s tamper-evident audit hash chain over a time range. The chain links each entry to its predecessor, so editing or deleting any row breaks it.
1683
+ * @type object
1684
+ */
1685
+ type AuditChainVerification = {
1686
+ /**
1687
+ * @description True when every chained entry in the range links correctly and no tampering or deletion was detected.
1688
+ * @type boolean
1689
+ */
1690
+ ok: boolean;
1691
+ /**
1692
+ * @description Number of chained entries checked.
1693
+ * @type integer
1694
+ */
1695
+ verified_count: number;
1696
+ /**
1697
+ * @description Pre-chain (legacy) entries in the range that predate the hash chain and were skipped rather than treated as tampering.
1698
+ * @type integer
1699
+ */
1700
+ unchained_count: number;
1701
+ /**
1702
+ * @description Sequence number of the first chained entry checked. Null when none.
1703
+ * @type integer
1704
+ */
1705
+ chain_start_seq?: number | null;
1706
+ /**
1707
+ * @description Sequence number of the last chained entry checked. Null when none.
1708
+ * @type integer
1709
+ */
1710
+ chain_end_seq?: number | null;
1711
+ /**
1712
+ * @description Sequence number where verification first failed (a tampered or deleted entry). Null when ok.
1713
+ * @type integer
1714
+ */
1715
+ first_broken_seq?: number | null;
1716
+ /**
1717
+ * @description Machine-readable failure kind: hash_mismatch (entry content edited), broken_link (prev_hash does not match the predecessor), or missing_entry (a sequence number was deleted). Null when ok.
1718
+ * @type string
1719
+ */
1720
+ failure_reason?: string | null;
1721
+ /**
1722
+ * @description When verification ran.
1723
+ * @type string
1724
+ */
1725
+ verified_at: string;
1726
+ };
1727
+
1728
+ /**
1729
+ * Generated by Kubb (https://kubb.dev/).
1730
+ * Do not edit manually.
1731
+ */
1732
+
1733
+ /**
1734
+ * @description Unique project identifier (prefixed, e.g. prj_xxx).
1735
+ * @pattern ^[a-zA-Z0-9_.-]+$
1736
+ * @type string
1737
+ */
1738
+ type VerifyAuditChainPathProjectId = string;
1739
+ /**
1740
+ * @description Return entries at or after this timestamp (inclusive lower bound).
1741
+ * @type string | undefined
1742
+ */
1743
+ type VerifyAuditChainQueryStart = string | undefined;
1744
+ /**
1745
+ * @description Return entries strictly older than this timestamp (cursor / upper bound).
1746
+ * @type string | undefined
1747
+ */
1748
+ type VerifyAuditChainQueryEnd = string | undefined;
1749
+ /**
1750
+ * @description Result of recomputing the project\'s tamper-evident audit hash chain over a time range. The chain links each entry to its predecessor, so editing or deleting any row breaks it.
1751
+ * @type object
1752
+ */
1753
+ type VerifyAuditChainStatus200 = AuditChainVerification;
1754
+ /**
1755
+ * @type object
1756
+ */
1757
+ type VerifyAuditChainRequestConfig = {
1758
+ data?: never;
1759
+ /**
1760
+ * @type object
1761
+ */
1762
+ pathParams: {
1763
+ project_id: VerifyAuditChainPathProjectId;
1764
+ };
1765
+ /**
1766
+ * @type object | undefined
1767
+ */
1768
+ queryParams?: {
1769
+ start?: VerifyAuditChainQueryStart;
1770
+ end?: VerifyAuditChainQueryEnd;
1771
+ };
1772
+ headerParams?: never;
1773
+ /**
1774
+ * @type string
1775
+ */
1776
+ url: `/v1/projects/${string}/audit-logs/verify`;
1777
+ };
1778
+
1651
1779
  /**
1652
1780
  * Generated by Kubb (https://kubb.dev/).
1653
1781
  * Do not edit manually.
@@ -5406,6 +5534,250 @@ type DryEvalPolicyRequestConfig = {
5406
5534
  url: `/v1/projects/${string}/policy-evaluations`;
5407
5535
  };
5408
5536
 
5537
+ /**
5538
+ * Generated by Kubb (https://kubb.dev/).
5539
+ * Do not edit manually.
5540
+ */
5541
+
5542
+ /**
5543
+ * @description A window of recorded agent traffic to replay plus the candidate policy to replay it against. Supply exactly one of policy_id (an existing saved policy) or policy (an unsaved draft, e.g. the in-progress editor form).
5544
+ * @type object
5545
+ */
5546
+ type PolicyReplayInput = {
5547
+ /**
5548
+ * @description ID of an existing saved policy profile to replay against.
5549
+ * @example pol_01h455vb4pex5vsknk084sn02q
5550
+ * @type string | undefined
5551
+ */
5552
+ policy_id?: string;
5553
+ /**
5554
+ * @description Mutable fields of a policy profile (used for create and update).
5555
+ * @type object | undefined
5556
+ */
5557
+ policy?: PolicyProfileInput;
5558
+ /**
5559
+ * @description Restrict the replay to traffic recorded for one agent credential.
5560
+ * @example cred_01h455vb4pex5vsknk084sn02q
5561
+ * @type string | undefined
5562
+ */
5563
+ credential_id?: string;
5564
+ /**
5565
+ * @description Start of the traffic window (inclusive). Defaults to 7 days before end_ts.
5566
+ * @type string | undefined
5567
+ */
5568
+ start_ts?: string;
5569
+ /**
5570
+ * @description End of the traffic window (exclusive). Defaults to now.
5571
+ * @type string | undefined
5572
+ */
5573
+ end_ts?: string;
5574
+ /**
5575
+ * @description Maximum number of distinct queries to replay, newest first. Traffic is deduplicated by normalized query hash before evaluation.
5576
+ * @minLength 1
5577
+ * @maxLength 500
5578
+ * @default 200
5579
+ * @type integer | undefined
5580
+ */
5581
+ limit?: number;
5582
+ };
5583
+
5584
+ /**
5585
+ * Generated by Kubb (https://kubb.dev/).
5586
+ * Do not edit manually.
5587
+ */
5588
+
5589
+ declare const policyReplayItemChangeEnum: {
5590
+ readonly newly_blocked: "newly_blocked";
5591
+ readonly newly_allowed: "newly_allowed";
5592
+ readonly still_allowed: "still_allowed";
5593
+ readonly still_blocked: "still_blocked";
5594
+ };
5595
+ type PolicyReplayItemChangeEnumKey = (typeof policyReplayItemChangeEnum)[keyof typeof policyReplayItemChangeEnum];
5596
+ /**
5597
+ * @description One distinct recorded query and the decision the candidate policy would reach for it.
5598
+ * @type object
5599
+ */
5600
+ type PolicyReplayItem = {
5601
+ /**
5602
+ * @description Normalized query hash identifying this statement shape.
5603
+ * @type string
5604
+ */
5605
+ query_hash: string;
5606
+ /**
5607
+ * @description The recorded statement (normalized, literals replaced with $N placeholders), from its most recent occurrence.
5608
+ * @type string
5609
+ */
5610
+ sql: string;
5611
+ /**
5612
+ * @description Statement kind (select, insert, update, delete, ddl, ...).
5613
+ * @type string | undefined
5614
+ */
5615
+ statement_kind?: string;
5616
+ /**
5617
+ * @description How many recorded entries share this query shape in the window.
5618
+ * @type integer
5619
+ */
5620
+ occurrences: number;
5621
+ /**
5622
+ * @description Oldest occurrence in the window.
5623
+ * @type string
5624
+ */
5625
+ first_seen: string;
5626
+ /**
5627
+ * @description Newest occurrence in the window.
5628
+ * @type string
5629
+ */
5630
+ last_seen: string;
5631
+ /**
5632
+ * @description The most recent recorded outcome for this query (query, masked, truncated, or blocked).
5633
+ * @type string
5634
+ */
5635
+ recorded_event: string;
5636
+ /**
5637
+ * @description The decision rule recorded with a blocked outcome.
5638
+ * @type string | undefined
5639
+ */
5640
+ recorded_rule?: string;
5641
+ /**
5642
+ * @description How the candidate decision compares to the recorded outcome. newly_blocked and newly_allowed are the changes worth reviewing before rollout; still_allowed and still_blocked are unchanged.
5643
+ * @type string
5644
+ */
5645
+ change: PolicyReplayItemChangeEnumKey;
5646
+ /**
5647
+ * @description The decision the proxy would reach for the supplied statement under the supplied policy. verdict is the headline outcome; the remaining fields detail why.
5648
+ * @type object
5649
+ */
5650
+ result: DryEvalResult;
5651
+ };
5652
+
5653
+ /**
5654
+ * Generated by Kubb (https://kubb.dev/).
5655
+ * Do not edit manually.
5656
+ */
5657
+ /**
5658
+ * @description Aggregate outcome of a policy replay.
5659
+ * @type object
5660
+ */
5661
+ type PolicyReplaySummary = {
5662
+ /**
5663
+ * @description Recorded audit entries covered by the replayed queries.
5664
+ * @type integer
5665
+ */
5666
+ entries_scanned: number;
5667
+ /**
5668
+ * @description Distinct normalized queries found in the window (capped at limit).
5669
+ * @type integer
5670
+ */
5671
+ distinct_queries: number;
5672
+ /**
5673
+ * @description Distinct queries actually evaluated against the candidate policy.
5674
+ * @type integer
5675
+ */
5676
+ evaluated: number;
5677
+ /**
5678
+ * @description Queries the candidate policy would allow unchanged.
5679
+ * @type integer
5680
+ */
5681
+ would_allow: number;
5682
+ /**
5683
+ * @description Queries the candidate policy would block.
5684
+ * @type integer
5685
+ */
5686
+ would_block: number;
5687
+ /**
5688
+ * @description Queries the candidate policy would mask result columns on.
5689
+ * @type integer
5690
+ */
5691
+ would_mask: number;
5692
+ /**
5693
+ * @description Queries the candidate policy would inject a row filter into.
5694
+ * @type integer
5695
+ */
5696
+ would_row_filter: number;
5697
+ /**
5698
+ * @description Queries that executed under the recorded policy but the candidate policy would block.
5699
+ * @type integer
5700
+ */
5701
+ newly_blocked: number;
5702
+ /**
5703
+ * @description Queries that were blocked when recorded but the candidate policy would permit.
5704
+ * @type integer
5705
+ */
5706
+ newly_allowed: number;
5707
+ /**
5708
+ * @description Distinct queries skipped because the stored statement was truncated at record time and can no longer be parsed faithfully.
5709
+ * @type integer
5710
+ */
5711
+ skipped_unparseable: number;
5712
+ /**
5713
+ * @description True when the window contained more distinct queries than limit; only the newest were replayed.
5714
+ * @type boolean
5715
+ */
5716
+ truncated: boolean;
5717
+ };
5718
+
5719
+ /**
5720
+ * Generated by Kubb (https://kubb.dev/).
5721
+ * Do not edit manually.
5722
+ */
5723
+
5724
+ /**
5725
+ * @description The outcome of replaying recorded agent traffic against a candidate policy: an aggregate summary plus per-query decisions, changes first.
5726
+ * @type object
5727
+ */
5728
+ type PolicyReplayResult = {
5729
+ /**
5730
+ * @description Aggregate outcome of a policy replay.
5731
+ * @type object
5732
+ */
5733
+ summary: PolicyReplaySummary;
5734
+ /**
5735
+ * @description Per-query replay decisions, ordered changes first (newly blocked, then newly allowed), then by occurrence count.
5736
+ * @type array
5737
+ */
5738
+ items: PolicyReplayItem[];
5739
+ };
5740
+
5741
+ /**
5742
+ * Generated by Kubb (https://kubb.dev/).
5743
+ * Do not edit manually.
5744
+ */
5745
+
5746
+ /**
5747
+ * @description Unique project identifier (prefixed, e.g. prj_xxx).
5748
+ * @pattern ^[a-zA-Z0-9_.-]+$
5749
+ * @type string
5750
+ */
5751
+ type ReplayPolicyPathProjectId = string;
5752
+ /**
5753
+ * @description The outcome of replaying recorded agent traffic against a candidate policy: an aggregate summary plus per-query decisions, changes first.
5754
+ * @type object
5755
+ */
5756
+ type ReplayPolicyStatus200 = PolicyReplayResult;
5757
+ /**
5758
+ * @description A window of recorded agent traffic to replay plus the candidate policy to replay it against. Supply exactly one of policy_id (an existing saved policy) or policy (an unsaved draft, e.g. the in-progress editor form).
5759
+ * @type object
5760
+ */
5761
+ type ReplayPolicyData = PolicyReplayInput;
5762
+ /**
5763
+ * @type object
5764
+ */
5765
+ type ReplayPolicyRequestConfig = {
5766
+ data?: ReplayPolicyData;
5767
+ /**
5768
+ * @type object
5769
+ */
5770
+ pathParams: {
5771
+ project_id: ReplayPolicyPathProjectId;
5772
+ };
5773
+ queryParams?: never;
5774
+ headerParams?: never;
5775
+ /**
5776
+ * @type string
5777
+ */
5778
+ url: `/v1/projects/${string}/policy-replays`;
5779
+ };
5780
+
5409
5781
  /**
5410
5782
  * Generated by Kubb (https://kubb.dev/).
5411
5783
  * Do not edit manually.
@@ -7947,6 +8319,10 @@ declare const operationsByTag: {
7947
8319
  readonly method: "GET";
7948
8320
  readonly path: "/v1/projects/{project_id}/audit-logs/export";
7949
8321
  };
8322
+ readonly verifyAuditChain: {
8323
+ readonly method: "GET";
8324
+ readonly path: "/v1/projects/{project_id}/audit-logs/verify";
8325
+ };
7950
8326
  };
7951
8327
  readonly anomalies: {
7952
8328
  readonly listAnomalyAlerts: {
@@ -8165,6 +8541,10 @@ declare const operationsByTag: {
8165
8541
  readonly method: "POST";
8166
8542
  readonly path: "/v1/projects/{project_id}/policy-evaluations";
8167
8543
  };
8544
+ readonly replayPolicy: {
8545
+ readonly method: "POST";
8546
+ readonly path: "/v1/projects/{project_id}/policy-replays";
8547
+ };
8168
8548
  };
8169
8549
  readonly support: {
8170
8550
  readonly listSupportCases: {
@@ -8292,6 +8672,11 @@ declare const operationsByPath: {
8292
8672
  readonly path: "/v1/projects/{project_id}/audit-logs/export";
8293
8673
  readonly operationId: "exportAuditLogs";
8294
8674
  };
8675
+ readonly "GET /v1/projects/{project_id}/audit-logs/verify": {
8676
+ readonly method: "GET";
8677
+ readonly path: "/v1/projects/{project_id}/audit-logs/verify";
8678
+ readonly operationId: "verifyAuditChain";
8679
+ };
8295
8680
  readonly "GET /v1/plans": {
8296
8681
  readonly method: "GET";
8297
8682
  readonly path: "/v1/plans";
@@ -8452,6 +8837,11 @@ declare const operationsByPath: {
8452
8837
  readonly path: "/v1/projects/{project_id}/policy-evaluations";
8453
8838
  readonly operationId: "dryEvalPolicy";
8454
8839
  };
8840
+ readonly "POST /v1/projects/{project_id}/policy-replays": {
8841
+ readonly method: "POST";
8842
+ readonly path: "/v1/projects/{project_id}/policy-replays";
8843
+ readonly operationId: "replayPolicy";
8844
+ };
8455
8845
  readonly "GET /v1/projects": {
8456
8846
  readonly method: "GET";
8457
8847
  readonly path: "/v1/projects";
@@ -8637,6 +9027,10 @@ type ExportAuditLogsParams = {
8637
9027
  pathParams: NonNullable<ExportAuditLogsRequestConfig["pathParams"]>;
8638
9028
  queryParams?: NonNullable<ExportAuditLogsRequestConfig["queryParams"]>;
8639
9029
  };
9030
+ type VerifyAuditChainParams = {
9031
+ pathParams: NonNullable<VerifyAuditChainRequestConfig["pathParams"]>;
9032
+ queryParams?: NonNullable<VerifyAuditChainRequestConfig["queryParams"]>;
9033
+ };
8640
9034
  type GetOrganizationPlanParams = {
8641
9035
  pathParams: NonNullable<GetOrganizationPlanRequestConfig["pathParams"]>;
8642
9036
  };
@@ -8744,6 +9138,10 @@ type DryEvalPolicyParams = {
8744
9138
  pathParams: NonNullable<DryEvalPolicyRequestConfig["pathParams"]>;
8745
9139
  body: NonNullable<DryEvalPolicyRequestConfig["data"]>;
8746
9140
  };
9141
+ type ReplayPolicyParams = {
9142
+ pathParams: NonNullable<ReplayPolicyRequestConfig["pathParams"]>;
9143
+ body: NonNullable<ReplayPolicyRequestConfig["data"]>;
9144
+ };
8747
9145
  type ListProjectsParams = {
8748
9146
  queryParams: NonNullable<ListProjectsRequestConfig["queryParams"]>;
8749
9147
  };
@@ -8850,6 +9248,7 @@ interface ApiOperations {
8850
9248
  rotateAgentCredential(params: RotateAgentCredentialParams): Promise<RotateAgentCredentialStatus200>;
8851
9249
  listAuditLogs(params: ListAuditLogsParams): Promise<ListAuditLogsStatus200>;
8852
9250
  exportAuditLogs(params: ExportAuditLogsParams): Promise<ExportAuditLogsStatus200>;
9251
+ verifyAuditChain(params: VerifyAuditChainParams): Promise<VerifyAuditChainStatus200>;
8853
9252
  };
8854
9253
  anomalies: {
8855
9254
  listAnomalyAlerts(params: ListAnomalyAlertsParams): Promise<ListAnomalyAlertsStatus200>;
@@ -8918,6 +9317,7 @@ interface ApiOperations {
8918
9317
  updatePolicyProfile(params: UpdatePolicyProfileParams): Promise<UpdatePolicyProfileStatus200>;
8919
9318
  deletePolicyProfile(params: DeletePolicyProfileParams): Promise<void>;
8920
9319
  dryEvalPolicy(params: DryEvalPolicyParams): Promise<DryEvalPolicyStatus200>;
9320
+ replayPolicy(params: ReplayPolicyParams): Promise<ReplayPolicyStatus200>;
8921
9321
  };
8922
9322
  support: {
8923
9323
  listSupportCases(params: ListSupportCasesParams): Promise<ListSupportCasesStatus200>;
@@ -8995,6 +9395,10 @@ interface RequestMap {
8995
9395
  params: ExportAuditLogsParams;
8996
9396
  response: ExportAuditLogsStatus200;
8997
9397
  };
9398
+ "GET /v1/projects/{project_id}/audit-logs/verify": {
9399
+ params: VerifyAuditChainParams;
9400
+ response: VerifyAuditChainStatus200;
9401
+ };
8998
9402
  "GET /v1/plans": {
8999
9403
  params?: undefined;
9000
9404
  response: ListPlansStatus200;
@@ -9123,6 +9527,10 @@ interface RequestMap {
9123
9527
  params: DryEvalPolicyParams;
9124
9528
  response: DryEvalPolicyStatus200;
9125
9529
  };
9530
+ "POST /v1/projects/{project_id}/policy-replays": {
9531
+ params: ReplayPolicyParams;
9532
+ response: ReplayPolicyStatus200;
9533
+ };
9126
9534
  "GET /v1/projects": {
9127
9535
  params: ListProjectsParams;
9128
9536
  response: ListProjectsStatus200;