fatedb 0.0.0-stage → 0.10.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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +264 -2
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +3 -0
  5. package/dist/cli.d.ts +15 -0
  6. package/dist/cli.js +256 -0
  7. package/dist/client.d.ts +152 -0
  8. package/dist/client.js +416 -0
  9. package/dist/cloudflare.d.ts +197 -0
  10. package/dist/cloudflare.js +159 -0
  11. package/dist/datalog/ast.d.ts +35 -0
  12. package/dist/datalog/ast.js +40 -0
  13. package/dist/datalog/evaluator.d.ts +14 -0
  14. package/dist/datalog/evaluator.js +395 -0
  15. package/dist/datalog/fact-source.d.ts +30 -0
  16. package/dist/datalog/fact-source.js +1 -0
  17. package/dist/datalog/fingerprint.d.ts +12 -0
  18. package/dist/datalog/fingerprint.js +50 -0
  19. package/dist/datalog/parser.d.ts +3 -0
  20. package/dist/datalog/parser.js +302 -0
  21. package/dist/datalog/value.d.ts +34 -0
  22. package/dist/datalog/value.js +104 -0
  23. package/dist/domain/date-validation.d.ts +2 -0
  24. package/dist/domain/date-validation.js +32 -0
  25. package/dist/domain/fact-value.d.ts +91 -0
  26. package/dist/domain/fact-value.js +167 -0
  27. package/dist/domain/fact.d.ts +14 -0
  28. package/dist/domain/fact.js +47 -0
  29. package/dist/domain/failure.d.ts +44 -0
  30. package/dist/domain/failure.js +30 -0
  31. package/dist/domain/graph-id.d.ts +7 -0
  32. package/dist/domain/graph-id.js +10 -0
  33. package/dist/domain/histogram.d.ts +29 -0
  34. package/dist/domain/histogram.js +48 -0
  35. package/dist/domain/identifiers.d.ts +26 -0
  36. package/dist/domain/identifiers.js +75 -0
  37. package/dist/domain/numbers.d.ts +12 -0
  38. package/dist/domain/numbers.js +77 -0
  39. package/dist/domain/projection.d.ts +252 -0
  40. package/dist/domain/projection.js +51 -0
  41. package/dist/domain/query-metrics.d.ts +31 -0
  42. package/dist/domain/query-metrics.js +35 -0
  43. package/dist/domain/read-token.d.ts +37 -0
  44. package/dist/domain/read-token.js +93 -0
  45. package/dist/domain/result.d.ts +22 -0
  46. package/dist/domain/result.js +16 -0
  47. package/dist/domain/schema-observation.d.ts +20 -0
  48. package/dist/domain/schema-observation.js +61 -0
  49. package/dist/domain/string-order.d.ts +2 -0
  50. package/dist/domain/string-order.js +15 -0
  51. package/dist/domain/vocabulary.d.ts +101 -0
  52. package/dist/domain/vocabulary.js +276 -0
  53. package/dist/index.d.ts +15 -0
  54. package/dist/index.js +14 -0
  55. package/dist/projection-config.d.ts +3 -0
  56. package/dist/projection-config.js +212 -0
  57. package/dist/server/access.d.ts +32 -0
  58. package/dist/server/access.js +117 -0
  59. package/dist/server/admin.d.ts +233 -0
  60. package/dist/server/admin.js +483 -0
  61. package/dist/server/authorization.d.ts +35 -0
  62. package/dist/server/authorization.js +76 -0
  63. package/dist/server/console-assets.d.ts +6 -0
  64. package/dist/server/console-assets.js +2 -0
  65. package/dist/server/console.d.ts +8 -0
  66. package/dist/server/console.js +301 -0
  67. package/dist/server/index.d.ts +122 -0
  68. package/dist/server/index.js +487 -0
  69. package/dist/server/mcp.d.ts +31 -0
  70. package/dist/server/mcp.js +169 -0
  71. package/dist/server/telemetry-do.d.ts +31 -0
  72. package/dist/server/telemetry-do.js +342 -0
  73. package/dist/server/telemetry.d.ts +27 -0
  74. package/dist/server/telemetry.js +191 -0
  75. package/dist/storage/constants.d.ts +20 -0
  76. package/dist/storage/constants.js +21 -0
  77. package/dist/storage/environment.d.ts +438 -0
  78. package/dist/storage/environment.js +145 -0
  79. package/dist/storage/facts.d.ts +41 -0
  80. package/dist/storage/facts.js +73 -0
  81. package/dist/storage/http.d.ts +55 -0
  82. package/dist/storage/http.js +169 -0
  83. package/dist/storage/keys.d.ts +50 -0
  84. package/dist/storage/keys.js +84 -0
  85. package/dist/storage/layout.d.ts +67 -0
  86. package/dist/storage/layout.js +134 -0
  87. package/dist/storage/log.d.ts +41 -0
  88. package/dist/storage/log.js +137 -0
  89. package/dist/storage/manifest.d.ts +26 -0
  90. package/dist/storage/manifest.js +206 -0
  91. package/dist/storage/operations.d.ts +303 -0
  92. package/dist/storage/operations.js +719 -0
  93. package/dist/storage/partition.d.ts +125 -0
  94. package/dist/storage/partition.js +816 -0
  95. package/dist/storage/projection.d.ts +72 -0
  96. package/dist/storage/projection.js +1349 -0
  97. package/dist/storage/root.d.ts +120 -0
  98. package/dist/storage/root.js +596 -0
  99. package/dist/storage/segment.d.ts +145 -0
  100. package/dist/storage/segment.js +451 -0
  101. package/dist/storage/shard.d.ts +82 -0
  102. package/dist/storage/shard.js +710 -0
  103. package/dist/storage/source.d.ts +60 -0
  104. package/dist/storage/source.js +199 -0
  105. package/dist/telemetry/model.d.ts +123 -0
  106. package/dist/telemetry/model.js +292 -0
  107. package/dist/version.d.ts +4 -0
  108. package/dist/version.js +6 -0
  109. package/package.json +82 -4
@@ -0,0 +1,32 @@
1
+ /** The console's settings, as `fatedb({ console })` binds them in CONSOLE, with the instance's Worker and bucket names. */
2
+ export type ConsoleConfig = Readonly<{
3
+ hostname: string;
4
+ teamDomain: string;
5
+ aud: string;
6
+ clientId: string;
7
+ name: string;
8
+ bucket: string;
9
+ }>;
10
+ /** Who signed in: a person, or an Access service token. */
11
+ export type Viewer = Readonly<{
12
+ kind: "person";
13
+ email: string;
14
+ }> | Readonly<{
15
+ kind: "service";
16
+ clientId: string;
17
+ }>;
18
+ export type Refusal = Readonly<{
19
+ status: 401 | 403;
20
+ reason: string;
21
+ }>;
22
+ export declare const TEAM_DOMAIN: RegExp;
23
+ export declare const AUD: RegExp;
24
+ export declare const HOSTNAME: RegExp;
25
+ export declare function consoleConfig(input: unknown): ConsoleConfig | null;
26
+ /** The verified viewer of `request`, or why it is refused. `fetcher` reaches the team's keys. */
27
+ export declare function authenticate(request: Request, config: ConsoleConfig, fetcher?: typeof fetch): Promise<Viewer | Refusal>;
28
+ export declare function isRefusal(value: Viewer | Refusal): value is Refusal;
29
+ /** A write a browser sent from another site: refused, whoever is signed in. CLIs and agents send neither header. */
30
+ export declare function isCrossSiteWrite(request: Request): boolean;
31
+ /** Forgets the cached keys. Tests only. */
32
+ export declare function forgetKeys(): void;
@@ -0,0 +1,117 @@
1
+ // The console's hostname sits behind a Cloudflare Access application. Access signs a JWT for every
2
+ // request it lets through; the instance checks it on every request anyway, so a removed or
3
+ // misconfigured Access application exposes nothing. Who may sign in is Access's policy: the
4
+ // instance only checks the token is from the application it was configured with, and current.
5
+ export const TEAM_DOMAIN = /^[a-z0-9-]+\.cloudflareaccess\.com$/;
6
+ export const AUD = /^[a-f0-9]{64}$/;
7
+ export const HOSTNAME = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
8
+ const CLOCK_SKEW_S = 30;
9
+ const KEYS_TTL_MS = 5 * 60_000;
10
+ /** The CONSOLE binding, or null when the instance has no console. A malformed one is also null: nothing is served. */
11
+ function isObjectRecord(value) {
12
+ return typeof value === "object" && value !== null && !Array.isArray(value);
13
+ }
14
+ export function consoleConfig(input) {
15
+ if (!isObjectRecord(input))
16
+ return null;
17
+ const { hostname, teamDomain, aud, clientId, name, bucket } = input;
18
+ if (typeof hostname !== "string" || !HOSTNAME.test(hostname) || typeof teamDomain !== "string" || !TEAM_DOMAIN.test(teamDomain)
19
+ || typeof aud !== "string" || !AUD.test(aud) || typeof clientId !== "string" || typeof name !== "string" || typeof bucket !== "string")
20
+ return null;
21
+ return { hostname, teamDomain, aud, clientId, name, bucket };
22
+ }
23
+ const keySets = new Map();
24
+ /** The team's signing keys, cached for a few minutes; fetched again for a key id not seen yet. */
25
+ async function signingKey(teamDomain, kid, fetcher) {
26
+ const cached = keySets.get(teamDomain);
27
+ if (cached && Date.now() - cached.at < KEYS_TTL_MS && cached.keys.has(kid))
28
+ return cached.keys.get(kid);
29
+ if (cached && Date.now() - cached.at < 10_000)
30
+ return cached.keys.get(kid);
31
+ const response = await fetcher(`https://${teamDomain}/cdn-cgi/access/certs`);
32
+ if (!response.ok)
33
+ return cached?.keys.get(kid);
34
+ const rawBody = await response.json();
35
+ const rawKeys = isObjectRecord(rawBody) && Array.isArray(rawBody["keys"]) ? rawBody["keys"] : [];
36
+ const keys = new Map();
37
+ for (const jwk of rawKeys) {
38
+ if (!isObjectRecord(jwk) || jwk["kty"] !== "RSA" || typeof jwk["kid"] !== "string" || typeof jwk["n"] !== "string" || typeof jwk["e"] !== "string")
39
+ continue;
40
+ keys.set(jwk["kid"], await crypto.subtle.importKey("jwk", { kty: "RSA", n: jwk["n"], e: jwk["e"], alg: "RS256", ext: true }, { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }, false, ["verify"]));
41
+ }
42
+ keySets.set(teamDomain, { keys, at: Date.now() });
43
+ return keys.get(kid);
44
+ }
45
+ function base64url(input) {
46
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(input.length / 4) * 4, "=");
47
+ const binary = atob(padded);
48
+ const bytes = new Uint8Array(binary.length);
49
+ for (let i = 0; i < binary.length; i++)
50
+ bytes[i] = binary.charCodeAt(i);
51
+ return bytes;
52
+ }
53
+ function json(part) {
54
+ try {
55
+ const value = JSON.parse(new TextDecoder().decode(base64url(part)));
56
+ return isObjectRecord(value) ? value : null;
57
+ }
58
+ catch {
59
+ return null;
60
+ }
61
+ }
62
+ /** The verified viewer of `request`, or why it is refused. `fetcher` reaches the team's keys. */
63
+ export async function authenticate(request, config, fetcher = fetch) {
64
+ const token = request.headers.get("cf-access-jwt-assertion")?.trim();
65
+ if (!token)
66
+ return { status: 401, reason: "Sign in through Cloudflare Access first" };
67
+ const parts = token.split(".");
68
+ const [head, body, signature] = parts;
69
+ if (parts.length !== 3 || head === undefined || body === undefined || signature === undefined)
70
+ return { status: 401, reason: "The Access token is malformed" };
71
+ const header = json(head), payload = json(body);
72
+ if (header === null || payload === null || header["alg"] !== "RS256" || typeof header["kid"] !== "string")
73
+ return { status: 401, reason: "The Access token is malformed" };
74
+ let valid = false;
75
+ try {
76
+ const key = await signingKey(config.teamDomain, header["kid"], fetcher);
77
+ valid = key !== undefined && await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key, base64url(signature), new TextEncoder().encode(`${head}.${body}`));
78
+ }
79
+ catch {
80
+ valid = false;
81
+ }
82
+ if (!valid)
83
+ return { status: 401, reason: "The Access token's signature does not verify" };
84
+ const now = Date.now() / 1000;
85
+ const audiences = Array.isArray(payload["aud"]) ? payload["aud"] : [payload["aud"]];
86
+ if (payload["iss"] !== `https://${config.teamDomain}` || !audiences.includes(config.aud))
87
+ return { status: 403, reason: "The Access token is for another application" };
88
+ if (typeof payload["exp"] !== "number" || payload["exp"] < now - CLOCK_SKEW_S)
89
+ return { status: 401, reason: "The Access token has expired" };
90
+ if (typeof payload["nbf"] === "number" && payload["nbf"] > now + CLOCK_SKEW_S)
91
+ return { status: 401, reason: "The Access token is not valid yet" };
92
+ const email = payload["email"];
93
+ if (typeof email === "string" && email.length > 0)
94
+ return { kind: "person", email: email.toLowerCase() };
95
+ // A service token's JWT has no email; its client id is the signed common_name.
96
+ const clientId = payload["common_name"];
97
+ if (typeof clientId === "string" && clientId.length > 0)
98
+ return { kind: "service", clientId };
99
+ return { status: 403, reason: "The Access token names no one" };
100
+ }
101
+ export function isRefusal(value) {
102
+ return "status" in value;
103
+ }
104
+ /** A write a browser sent from another site: refused, whoever is signed in. CLIs and agents send neither header. */
105
+ export function isCrossSiteWrite(request) {
106
+ if (request.method === "GET" || request.method === "HEAD")
107
+ return false;
108
+ const site = request.headers.get("sec-fetch-site");
109
+ if (site !== null && site !== "same-origin" && site !== "none")
110
+ return true;
111
+ const origin = request.headers.get("origin");
112
+ return origin !== null && origin !== new URL(request.url).origin;
113
+ }
114
+ /** Forgets the cached keys. Tests only. */
115
+ export function forgetKeys() {
116
+ keySets.clear();
117
+ }
@@ -0,0 +1,233 @@
1
+ import type { FactValue } from "../domain/fact-value.js";
2
+ import { type ProjectionBackfillSince, type ProjectionDeadLetter, type ProjectionDetail, type ProjectionState } from "../domain/projection.js";
3
+ import { type SchemaTerm } from "../domain/vocabulary.js";
4
+ import { type Latency } from "../domain/histogram.js";
5
+ import type { ObservabilityDimension, ObservabilityFilters, ObservabilityRange, QueryStatsResponse, TrafficResponse } from "../telemetry/model.js";
6
+ import { type StorageEnv } from "../storage/environment.js";
7
+ import { type CreatedGraph } from "../storage/operations.js";
8
+ import { ALL_GRAPHS, type GraphPermission } from "./authorization.js";
9
+ export type AdminEnv = StorageEnv & Readonly<{
10
+ GRAPH_GRANTS: unknown;
11
+ }>;
12
+ export type GraphSummary = Readonly<{
13
+ id: string;
14
+ partitions: number;
15
+ shards: number;
16
+ /** Facts in the index's segments, retractions and facts compaction has not merged yet included. */
17
+ facts: number;
18
+ segments: number;
19
+ watermark: number;
20
+ /**
21
+ * How far the index trails the writes: while it works, how far its watermark trailed real time
22
+ * when it last published; 0 once it has stopped, with nothing left to index. Null before it
23
+ * holds anything.
24
+ */
25
+ lagMs: number | null;
26
+ updatedAt: number;
27
+ permissions: readonly GraphPermission[];
28
+ }>;
29
+ export type GraphDetail = GraphSummary & Readonly<{
30
+ layout: Readonly<{
31
+ version: number;
32
+ eras: readonly Readonly<{
33
+ version: number;
34
+ from: number;
35
+ count: number;
36
+ since: number;
37
+ at: number;
38
+ }>[];
39
+ shards: readonly Readonly<{
40
+ depth: number;
41
+ prefix: number;
42
+ }>[];
43
+ }> | null;
44
+ growth: Readonly<{
45
+ installing: boolean;
46
+ lastGrewAt: number;
47
+ callsPerSecond: number | null;
48
+ }>;
49
+ shardStatus: readonly ShardSummary[];
50
+ partitionStatus: readonly PartitionSummary[];
51
+ }>;
52
+ /** An index shard: what its live segments hold, as the graph counts its facts, and how its flushes and merges go. */
53
+ export type ShardSummary = Readonly<{
54
+ shard: number;
55
+ depth: number;
56
+ watermark: number;
57
+ lagMs: number | null;
58
+ facts: number;
59
+ segments: number;
60
+ bytes: number;
61
+ errors: number;
62
+ /** Its recent flushes, of up to the last 120: how long each took, end to end, and how many fell behind. */
63
+ flushes: Readonly<{
64
+ count: number;
65
+ lastAt: number | null;
66
+ p50Ms: number | null;
67
+ maxMs: number | null;
68
+ behind: number;
69
+ }>;
70
+ /** Merges since the shard started. */
71
+ compactions: Readonly<{
72
+ runs: number;
73
+ lastMs: number;
74
+ maxMs: number;
75
+ }>;
76
+ }>;
77
+ /**
78
+ * A partition: its log, its writes, and its own service time. A partition keeps its counts in
79
+ * memory, so they start again when it does, at `startedAt`; it stops after 10 idle minutes.
80
+ */
81
+ export type PartitionSummary = Readonly<{
82
+ partition: number;
83
+ calls: number;
84
+ layoutVersion: number;
85
+ startedAt: number;
86
+ /** Rows (each one commit) in its own log, and the last row it has written to the graph's log in R2. */
87
+ rows: number;
88
+ archived: number;
89
+ commits: number;
90
+ txs: number;
91
+ replays: number;
92
+ conflicts: number;
93
+ colo: string | null;
94
+ lastWriteAt: number | null;
95
+ service: Latency | null;
96
+ }>;
97
+ export type EntityFacts = Readonly<{
98
+ id: string;
99
+ watermark: number;
100
+ facts: readonly Readonly<{
101
+ field: string;
102
+ value: FactValue;
103
+ }>[];
104
+ referencedBy: readonly Readonly<{
105
+ field: string;
106
+ entity: string;
107
+ }>[];
108
+ /** Some field held more than MAX_PER_FIELD facts, and only the first are here. */
109
+ truncated: boolean;
110
+ /** The names of the entities these facts link to, by the graph's name field, when it has one. */
111
+ names: Readonly<Record<string, string>>;
112
+ }>;
113
+ /** The graphs this client may read: every graph with an index, found from the bucket. */
114
+ export declare function listGraphs(env: AdminEnv, clientId: string): Promise<GraphSummary[]>;
115
+ export declare function graphDetail(env: AdminEnv, clientId: string, graphId: string): Promise<GraphDetail>;
116
+ export type QueryOptions = Readonly<{
117
+ consistency?: "own-writes" | "snapshot";
118
+ limit?: number;
119
+ }>;
120
+ /** The first `limit` rows (1,000 by default, at most 10,000), and whether there were more. */
121
+ export declare function runQuery(env: AdminEnv, clientId: string, graphId: string, datalog: string, options?: QueryOptions): Promise<{
122
+ rows: readonly Readonly<Record<string, FactValue>>[];
123
+ truncated: boolean;
124
+ watermark: number;
125
+ metrics: {
126
+ totalMs: number;
127
+ manifestMs: number;
128
+ tailMs: number;
129
+ evaluationMs: number;
130
+ waitedMs: number;
131
+ restarts: number;
132
+ segmentsTouched: number;
133
+ tuplesRead: number;
134
+ };
135
+ }>;
136
+ /** The fields a graph's active facts use, and their values' tags: what agents' `schema()` returns. */
137
+ export declare function observedSchema(env: AdminEnv, clientId: string, graphId: string): Promise<{
138
+ fields: readonly Readonly<{
139
+ field: string;
140
+ valueTags: readonly import("../client.js").ObservedValueTag[];
141
+ }>[];
142
+ watermark: number;
143
+ }>;
144
+ export type GraphSchema = Readonly<{
145
+ watermark: number;
146
+ terms: readonly SchemaTerm[];
147
+ }>;
148
+ /** The graph's classes, fields and value types: what its schema facts declare, and the fields its facts use. */
149
+ export declare function graphSchema(env: AdminEnv, clientId: string, graphId: string): Promise<GraphSchema>;
150
+ /**
151
+ * How a field's facts fit its domain or its range: their entities' classes, by the type fields; and
152
+ * their values' classes, for a range of classes, or their value types, for a range of value types.
153
+ */
154
+ export type Fit = Readonly<{
155
+ /** Facts checked: the first MAX_CHECKED of the field's. */
156
+ checked: number;
157
+ truncated: boolean;
158
+ fits: number;
159
+ /** Facts whose end names no class: an entity, or a value referencing one, when classes would decide. */
160
+ untyped: number;
161
+ /** Facts outside the domain or range, by the class their end names instead, or by their value's type. */
162
+ outside: readonly Readonly<{
163
+ class: string;
164
+ facts: number;
165
+ sample: readonly Readonly<{
166
+ entity: string;
167
+ value: FactValue;
168
+ }>[];
169
+ }>[];
170
+ }>;
171
+ export type TermUsage = Readonly<{
172
+ id: string;
173
+ watermark: number;
174
+ /** A class's instances, its subclasses' included, by the graph's type fields; a field's active facts. */
175
+ count: number;
176
+ /** A class's instances that name it rather than a class below it; a field's active facts. */
177
+ direct: number;
178
+ truncated: boolean;
179
+ sample: readonly Readonly<{
180
+ entity: string;
181
+ value: FactValue | null;
182
+ }>[];
183
+ names: Readonly<Record<string, string>>;
184
+ domainFit: Fit | null;
185
+ rangeFit: Fit | null;
186
+ /** For a functional field: the entities, among the facts checked, with more than one value. */
187
+ repeated: Readonly<{
188
+ count: number;
189
+ sample: readonly string[];
190
+ }> | null;
191
+ /** For an inverse functional field: the values, among the facts checked, that more than one entity holds. */
192
+ shared: Readonly<{
193
+ count: number;
194
+ sample: readonly FactValue[];
195
+ }> | null;
196
+ }>;
197
+ /** What a class or field holds: a class's instances, a field's facts, and how they fit its domain and range. */
198
+ export declare function describeTerm(env: AdminEnv, clientId: string, graphId: string, termId: string): Promise<TermUsage>;
199
+ /** The field entities are known by: a name, else a title. The console picks it the same way. */
200
+ export declare function nameField(fields: readonly string[]): string | undefined;
201
+ /** An entity's facts, field by field, the facts whose reference values name it, and the names of both ends. */
202
+ export declare function describeEntity(env: AdminEnv, clientId: string, graphId: string, entity: string): Promise<EntityFacts>;
203
+ /** Makes a graph before its first write, which needs the write grant for it. */
204
+ export declare function makeGraph(env: AdminEnv, clientId: string, graphId: string, partitions?: number): Promise<CreatedGraph>;
205
+ /** The deployed grants, client by client. A malformed policy, which denies everything, shows as none. */
206
+ export declare function grantsOf(env: AdminEnv): Record<string, Record<string, GraphPermission[]>>;
207
+ export { ALL_GRAPHS };
208
+ /** All projections configured for `graphId`, with their live state from ProjectionDO. */
209
+ export declare function listProjections(env: AdminEnv, clientId: string, graphId: string): Promise<ProjectionState[]>;
210
+ /** All projections across every graph this client may read (for the top-level Console Projections page). */
211
+ export declare function listAllProjections(env: AdminEnv, clientId: string): Promise<ProjectionState[]>;
212
+ export declare function projectionDetail(env: AdminEnv, clientId: string, graphId: string, name: string, limit?: number): Promise<ProjectionDetail>;
213
+ export declare function projectionDeadLetters(env: AdminEnv, clientId: string, graphId: string, name: string, limit?: number): Promise<readonly ProjectionDeadLetter[]>;
214
+ export declare function startProjection(env: AdminEnv, clientId: string, graphId: string, name: string): Promise<ProjectionState>;
215
+ export declare function stopProjection(env: AdminEnv, clientId: string, graphId: string, name: string): Promise<ProjectionState>;
216
+ export declare function backfillProjection(env: AdminEnv, clientId: string, graphId: string, name: string, since?: ProjectionBackfillSince): Promise<ProjectionState>;
217
+ export declare function replayProjection(env: AdminEnv, clientId: string, graphId: string, name: string, input: Readonly<{
218
+ mode: "dead-letters";
219
+ deliveryIds?: readonly string[];
220
+ } | {
221
+ mode: "from-start";
222
+ }>): Promise<Readonly<{
223
+ replayed?: number;
224
+ state: ProjectionState;
225
+ }>>;
226
+ export declare function discardProjectionDeadLetters(env: AdminEnv, clientId: string, graphId: string, name: string, deliveryIds?: readonly string[]): Promise<Readonly<{
227
+ discarded: number;
228
+ state: ProjectionState;
229
+ }>>;
230
+ /** Traffic rollups for the graphs this client may read, or null when telemetry is not bound. */
231
+ export declare function trafficStats(env: AdminEnv, clientId: string, range: ObservabilityRange, by: ObservabilityDimension | null, filters: ObservabilityFilters): Promise<TrafficResponse | null>;
232
+ /** Query-shape rollups for the graphs this client may read, or null when telemetry is not bound. */
233
+ export declare function queryShapeStats(env: AdminEnv, clientId: string, range: ObservabilityRange, filters: ObservabilityFilters): Promise<QueryStatsResponse | null>;