@sovaria/sdk 0.0.0-stage → 0.5.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.
@@ -0,0 +1,3562 @@
1
+ export { SovariaError, userMessageFor } from './errors.js';
2
+ export type { SovariaErrorCode } from './errors.js';
3
+ export { base64urlToBuffer, bufferToBase64url, credentialToJSON, creationOptionsFromJSON, passkeysSupported, requestOptionsFromJSON } from './passkeys.js';
4
+ import { DocumentReference, Query, WriteBatch, type Transaction } from './collections.js';
5
+ export { DocumentReference, FieldValue, LiveQuery, Query, Transaction, VectorQuery, WriteBatch, newDocumentId, splitTransforms, and, average, count, filter, or, sum, type AggregateField, type QueryFilter, type DocumentChange, type DocumentSnapshot, type QuerySnapshot, type WhereOp, type DistanceMeasure, type FindNearestOptions, } from './collections.js';
6
+ import { type OfflineController, type OfflineOptions } from './offline.js';
7
+ import { CrashReporter } from './crashes.js';
8
+ export { CrashReporter, distinctId, parseStack, type Breadcrumb, type CrashEvent, type CrashOptions, type SessionPing } from './crashes.js';
9
+ import { PerfMonitor } from './perf.js';
10
+ export { PerfMonitor, type PerfEvent, type PerfKind, type PerfOptions } from './perf.js';
11
+ import { WebPushClient } from './webpush.js';
12
+ import { InAppMessages } from './inapp.js';
13
+ export { InAppMessages, type InAppMessage } from './inapp.js';
14
+ export { WebPushClient, serviceWorkerSource, urlBase64ToUint8Array, type WebPushRegisterOptions } from './webpush.js';
15
+ import { Analytics } from './analytics.js';
16
+ import { RemoteConfig } from './remote-config.js';
17
+ export { Analytics, type AnalyticsEvent, type AnalyticsOptions, type AnalyticsProps } from './analytics.js';
18
+ export { RemoteConfig, type ConfigValue, type RemoteConfigSettings } from './remote-config.js';
19
+ export { evaluateQuery, indexedDbStorage, keyValueStorage, memoryStorage, type OfflineController, type OfflineOptions, type OfflineStorage, } from './offline.js';
20
+ export { ARGON2_HASH_LEN, ARGON2_MEMORY_COST, ARGON2_PARALLELISM, ARGON2_SALT_LEN, ARGON2_TIME_COST, computePayloadHash, decryptDocument, decryptDocumentWithKek, deriveKek, DEK_SIZE_BYTES, encryptDocument, encryptDocumentWithKek, generateSalt, hexToBytes, bytesToHex, NONCE_SIZE_BYTES, zeroBytes, type EncryptedEnvelope, } from './crypto.js';
21
+ export type JsonPrimitive = string | number | boolean | null;
22
+ export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
23
+ export type JsonArray = JsonValue[];
24
+ export type JsonObject = {
25
+ [key: string]: JsonValue;
26
+ };
27
+ export interface SovariaScope {
28
+ orgId: string;
29
+ projectId: string;
30
+ envId?: string;
31
+ }
32
+ /** Where a signed-in session is kept between page loads (localStorage-compatible). */
33
+ export interface SessionStorageLike {
34
+ getItem(key: string): string | null;
35
+ setItem(key: string, value: string): void;
36
+ removeItem(key: string): void;
37
+ }
38
+ /** The signed-in app user's tokens. `null` when nobody is signed in (anon key only). */
39
+ export interface SovariaSession {
40
+ access_token: string;
41
+ refresh_token?: string;
42
+ /** Epoch milliseconds when the access token expires. */
43
+ expires_at: number;
44
+ }
45
+ export type AuthChangeEvent = 'INITIAL_SESSION' | 'SIGNED_IN' | 'TOKEN_REFRESHED' | 'SIGNED_OUT';
46
+ export type PersistSessionOption = boolean | {
47
+ storage?: SessionStorageLike;
48
+ key?: string;
49
+ };
50
+ export interface SovariaSDKOptions {
51
+ baseUrl: string;
52
+ /**
53
+ * Keep the signed-in session across reloads and tell listeners about sign-in/out.
54
+ * `true` uses localStorage; pass `{ storage, key }` for anything else (cookies, AsyncStorage adapter…).
55
+ */
56
+ persistSession?: PersistSessionOption;
57
+ accessToken?: string;
58
+ refreshToken?: string;
59
+ expiresIn?: number;
60
+ fetchImpl?: typeof fetch;
61
+ retryCount?: number;
62
+ retryBaseDelayMs?: number;
63
+ /**
64
+ * Called whenever tokens are set or refreshed (login, refresh, OTP verify, etc.).
65
+ * The default payload omits `refresh_token`. Use `onTokenRefreshSensitive` if you
66
+ * explicitly need the refresh token (store it securely; never log it).
67
+ */
68
+ onTokenRefresh?: (tokens: JsonObject) => void;
69
+ /** Opt-in callback that receives the full token JSON including refresh_token. */
70
+ onTokenRefreshSensitive?: (tokens: JsonObject) => void;
71
+ /**
72
+ * Mobile / desktop apps: the device this app runs on. Sessions are grouped by it
73
+ * (`auth.listDevices`, sign a device out) and push tokens are tied to it. Keep `id` stable
74
+ * (generate once, store it in the Keychain / Keystore / AsyncStorage).
75
+ */
76
+ device?: SovariaDevice;
77
+ /**
78
+ * App attestation: returns the current attestation token (from `api.attestation.exchange`)
79
+ * or null. Sent as `X-Sovaria-Attestation` on every request when the project enforces it.
80
+ */
81
+ attestationToken?: () => string | null | undefined | Promise<string | null | undefined>;
82
+ }
83
+ export interface SovariaDevice {
84
+ id: string;
85
+ name?: string;
86
+ platform?: 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'other';
87
+ appVersion?: string;
88
+ }
89
+ export interface SovariaPortalConfig {
90
+ url?: string;
91
+ baseUrl?: string;
92
+ orgId?: string;
93
+ org_id?: string;
94
+ projectId?: string;
95
+ project_id?: string;
96
+ envId?: string;
97
+ env_id?: string;
98
+ accessToken?: string;
99
+ access_token?: string;
100
+ publishableKey?: string;
101
+ publishable_key?: string;
102
+ anonKey?: string;
103
+ anon_key?: string;
104
+ expiresIn?: number;
105
+ expires_in?: number;
106
+ /** Called with new tokens after a refresh — persist them so the user stays signed in. */
107
+ onTokenRefresh?: (tokens: JsonObject) => void;
108
+ onTokenRefreshSensitive?: (tokens: JsonObject) => void;
109
+ /**
110
+ * Keep the app user's session across reloads (default: on in browsers when a publishable/anon key
111
+ * is given). `false` turns it off; `{ storage, key }` stores it somewhere else.
112
+ */
113
+ persistSession?: PersistSessionOption;
114
+ }
115
+ export interface RequestOptions {
116
+ query?: Record<string, string | number | boolean | null | undefined>;
117
+ body?: unknown;
118
+ headers?: Record<string, string>;
119
+ requiresAuth?: boolean;
120
+ requiresScope?: boolean;
121
+ /**
122
+ * Idempotency-Key sent on every attempt. Writes (POST/PUT/PATCH/DELETE) get a fresh key per call
123
+ * when this is not set; pass your own to make a call safe to repeat yourself (same key, same body).
124
+ */
125
+ idempotencyKey?: string;
126
+ /** Kept for compatibility: every write now carries a stable Idempotency-Key from the first attempt. */
127
+ idempotent?: boolean;
128
+ /** 'blob' returns the raw response body (binary downloads); default parses JSON or text. */
129
+ responseType?: 'json' | 'blob';
130
+ /** Called with the response headers of a successful response (paging cursors, totals). */
131
+ onResponseHeaders?: (headers: Headers) => void;
132
+ }
133
+ /** `sovaria.data.rpc` options. */
134
+ export interface RpcOptions {
135
+ /**
136
+ * Call with GET and the arguments in the query string, for functions that only read. The default
137
+ * is POST with the arguments as a JSON body.
138
+ */
139
+ get?: boolean;
140
+ /**
141
+ * PostgREST parameters for functions that return rows: `select`, `order`, `limit`, `offset` and
142
+ * filters such as `{ status: 'eq.open' }`.
143
+ */
144
+ query?: Record<string, string | number | boolean>;
145
+ }
146
+ /** `sovaria.data.dryRunMigrations`: every migration ran in order in one transaction, then rolled back. */
147
+ /** `sovaria.data.schemaDigest`: the schema as one short line per table. */
148
+ export interface SchemaDigest {
149
+ /** Changes whenever the schema does; pass it back as `since`. */
150
+ version: string;
151
+ tables: number;
152
+ /** Legend first, then one line per table: `orders(id uuid pk=gen_random_uuid(), status text!='pending' in(pending|paid), customer_id uuid →customers cascade) rls:owner(user_id)`. */
153
+ text?: string;
154
+ /** Only with `since`, when nothing changed (no `text`). */
155
+ unchanged?: boolean;
156
+ }
157
+ /** One table in a schema plan. Columns are short form (`"status text!='draft' in(draft|live)"`, `"customer_id →customers cascade"`) or objects. */
158
+ export interface SchemaPlanTable {
159
+ name: string;
160
+ columns?: Array<string | {
161
+ name: string;
162
+ type?: string;
163
+ nullable?: boolean;
164
+ default?: string | number | boolean;
165
+ unique?: boolean;
166
+ references?: string;
167
+ on_delete?: 'cascade' | 'set null' | 'restrict';
168
+ values?: string[];
169
+ check?: string;
170
+ index?: boolean;
171
+ }>;
172
+ /** owner_rows: user_id + each signed-in user sees only their rows; public_read (with owner_rows); timestamps; soft_delete. */
173
+ patterns?: Array<'owner_rows' | 'public_read' | 'timestamps' | 'soft_delete'>;
174
+ owner?: string;
175
+ primary_key?: string[];
176
+ unique?: string[][];
177
+ indexes?: string[][];
178
+ }
179
+ /** `sovaria.data.applySchemaPlan`: what the plan created and changed, and whether the result matches it. */
180
+ export interface SchemaPlanResult {
181
+ status: 'applied' | 'dry_run_ok' | 'unchanged';
182
+ migration_version?: string;
183
+ created?: string[];
184
+ /** Per extended table: what was added (`+column`, `idx(..)`, `rls:owner(..)`). */
185
+ altered?: Record<string, string[]>;
186
+ notes?: string[];
187
+ /** The touched tables as they now are (digest lines). */
188
+ digest?: string;
189
+ /** With dryRun: the SQL that would run, and its undo. */
190
+ up_sql?: string;
191
+ down_sql?: string;
192
+ verification?: {
193
+ ok: boolean;
194
+ checks: Array<{
195
+ check: string;
196
+ ok: boolean;
197
+ problems?: string[];
198
+ }>;
199
+ };
200
+ }
201
+ export interface MigrationSequenceResult {
202
+ status: 'dry_run_ok' | 'failed';
203
+ /** How many ran cleanly (before the failing one, when one fails). */
204
+ checked: number;
205
+ total: number;
206
+ duration_ms: number;
207
+ /** The first migration that fails: its position in the list, name and the database error. */
208
+ failed?: {
209
+ index: number;
210
+ name: string;
211
+ error: string;
212
+ };
213
+ }
214
+ export interface ProductUsersPage {
215
+ users: JsonObject[];
216
+ /** Pass back as `cursor` for the next page; null on the last page. */
217
+ nextCursor: string | null;
218
+ /** Users matching the filter; sent with the first page. */
219
+ total: number | null;
220
+ }
221
+ export declare class SovariaSDK {
222
+ private readonly baseUrl;
223
+ private readonly fetchImpl;
224
+ private readonly retryCount;
225
+ private readonly retryBaseDelayMs;
226
+ private accessToken;
227
+ /** Project anon/publishable key: the token used when no user is signed in. */
228
+ private publishableKey;
229
+ /** PKCE verifier for an in-flight provider sign-in (fallback when sessionStorage is unavailable). */
230
+ private ssoVerifier;
231
+ /** PKCE verifier for an email link that opens an app (magic link / password reset). */
232
+ private linkVerifier;
233
+ private readonly device?;
234
+ private readonly attestationToken?;
235
+ private refreshToken;
236
+ private expiresAtMs;
237
+ private refreshInFlight;
238
+ private scope?;
239
+ /** In-flight lookup of the project/org behind a project URL (see resolveScope). */
240
+ private scopeLookup?;
241
+ private readonly onTokenRefresh?;
242
+ private readonly onTokenRefreshSensitive?;
243
+ private sessionStore?;
244
+ private readonly authListeners;
245
+ /** Session-cached Argon2id salt (hex from login/register). */
246
+ private argon2Salt?;
247
+ /** Session-cached KEK derived at login — reused for E2EE document ops. */
248
+ private cachedKek?;
249
+ constructor(options: SovariaSDKOptions);
250
+ /** Device + attestation headers (mobile apps); empty for a plain web or server client. */
251
+ private clientHeaders;
252
+ /** Start a PKCE pair for an email link; the verifier is kept (session storage too) until the link is opened. */
253
+ private startLinkPkce;
254
+ private takeLinkVerifier;
255
+ private configureSessionStore;
256
+ /** Load a stored session (called once the publishable key is known, so sign-out falls back to it). */
257
+ private restoreSession;
258
+ private writeSession;
259
+ private currentSession;
260
+ private emitAuth;
261
+ static fromPortalConfig(config: SovariaPortalConfig): SovariaSDK;
262
+ static fromEnv(env?: Record<string, string | undefined>): SovariaSDK;
263
+ setAccessToken(token: string, options?: {
264
+ expiresIn?: number;
265
+ }): this;
266
+ setRefreshToken(token: string): this;
267
+ clearAccessToken(): this;
268
+ private clearKekCache;
269
+ private cacheArgon2SaltFromResponse;
270
+ private tryDeriveKekFromPassword;
271
+ private applyAuthResponse;
272
+ private tokenNeedsRefresh;
273
+ /** Refresh when the token is near expiry, or always with `force` (the server said 401). */
274
+ private ensureAccessTokenFresh;
275
+ setScope(scope: SovariaScope): this;
276
+ clearScope(): this;
277
+ /**
278
+ * The org/project this client talks to. Set explicitly with setScope(), or discovered once from
279
+ * the project URL (https://<ref>.sovarias.in) — so `createClient(projectUrl, anonKey)` is enough.
280
+ */
281
+ resolveScope(): Promise<SovariaScope | undefined>;
282
+ getScopeHeaders(): Record<string, string>;
283
+ getRealtimeWebSocketUrl(channel: string, ticket?: string): string;
284
+ issueRealtimeWebSocketTicket(channel: string): Promise<string>;
285
+ getRealtimeWebSocketUrlWithTicket(channel: string): Promise<string>;
286
+ private offlineTransport?;
287
+ /**
288
+ * Offline-first documents: reads fall back to a local cache, offline writes are applied locally at
289
+ * once and queued, and everything syncs in order when the connection is back. Call once, before
290
+ * reading or writing documents.
291
+ *
292
+ * ```ts
293
+ * const offline = sov.enableOffline({ storage: indexedDbStorage(), onSyncError: (e, writes) => console.warn(e, writes) })
294
+ * ```
295
+ */
296
+ enableOffline(options?: OfflineOptions): OfflineController;
297
+ private documentsTransport;
298
+ private onlineDocumentsTransport;
299
+ /**
300
+ * A document collection (or `users/alice/posts` subcollection): field queries, cursors,
301
+ * live listeners and `add`.
302
+ *
303
+ * ```ts
304
+ * const snap = await sov.collection('posts').where('tags', 'array-contains', 'news').orderBy('at', 'desc').limit(20).get()
305
+ * ```
306
+ */
307
+ collection<T = JsonObject>(path: string): Query<T>;
308
+ /**
309
+ * Every collection with this id at any depth (`comments`, `posts/p1/comments`, …), like Firestore's
310
+ * `collectionGroup`. Guard rules and row policies apply per matched collection; `onSnapshot` is a live listener on the whole group.
311
+ *
312
+ * ```ts
313
+ * const top = await sov.collectionGroup('comments').where('flagged', '==', true).orderBy('at', 'desc').get()
314
+ * ```
315
+ */
316
+ collectionGroup<T = JsonObject>(collectionId: string): Query<T>;
317
+ /** A document reference: `get`, `set` (merge), `create`, `update` with FieldValue transforms, `delete`, `onSnapshot`. */
318
+ doc<T = JsonObject>(path: string): DocumentReference<T>;
319
+ /** Writes committed together: every one or none. */
320
+ batch(): WriteBatch;
321
+ /** Read then write atomically; retried (up to `maxAttempts`) when a document it read changes meanwhile. */
322
+ runTransaction<R>(fn: (tx: Transaction) => Promise<R>, maxAttempts?: number): Promise<R>;
323
+ /**
324
+ * App crash reporting: `sov.crashes.install({ release })` reports uncaught errors (browser and React
325
+ * Native); `sov.crashes.capture(error)` reports one you caught. Issues appear in the console under
326
+ * Observability › Crashes.
327
+ */
328
+ readonly crashes: CrashReporter;
329
+ /**
330
+ * Client performance monitoring: `sov.perf.install({ release })` measures web vitals (LCP, INP, CLS, FCP, TTFB)
331
+ * and every Sovaria request (joined to the server trace by its `traceparent`); `sov.perf.trace(name, fn)` times
332
+ * your own steps. Results are in the console under Observability › Performance.
333
+ */
334
+ readonly perf: PerfMonitor;
335
+ /** Web push for browsers with the project's own VAPID keys: `await sov.push.register()` after sign-in. */
336
+ readonly push: WebPushClient;
337
+ /** In-app messages (fetch what to show, report impressions / clicks / dismissals) and push open tracking. */
338
+ readonly inApp: InAppMessages;
339
+ /**
340
+ * Product analytics: `sov.analytics.track(name, props)`, `screen(name)`, `identify(userProps)`,
341
+ * `setEnabled(false)` for an opt-out. Batched, offline-safe; reports in the console under Analytics.
342
+ */
343
+ readonly analytics: Analytics;
344
+ /**
345
+ * Remote config and feature flags: `setDefaults`, `fetchAndActivate()`, `getBool/getString/getNumber/getJson`,
346
+ * `onUpdate(cb)` (live after a publish). Values are evaluated on the server for this user.
347
+ */
348
+ readonly config: RemoteConfig;
349
+ request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
350
+ private requestImpl;
351
+ private pathRequiresScope;
352
+ private assertScopePresent;
353
+ private productAuthRequest;
354
+ private productAuthPath;
355
+ readonly auth: {
356
+ /**
357
+ * Listen for sign-in, token refresh and sign-out. Fires once right away with the current
358
+ * session (`INITIAL_SESSION`). Returns a function that stops listening.
359
+ */
360
+ onAuthStateChange: (callback: (event: AuthChangeEvent, session: SovariaSession | null) => void) => () => void;
361
+ /** The signed-in app user's session, or null. */
362
+ getSession: () => SovariaSession | null;
363
+ /** Sign the app user out (revokes the refresh token) and fall back to the anon key. */
364
+ signOut: () => Promise<void>;
365
+ /**
366
+ * Create an app user and sign them in. When the project requires email confirmation, the
367
+ * result has `email_verification_required: true` and no session until the user confirms.
368
+ */
369
+ signUp: (email: string, password: string, name?: string) => Promise<JsonObject>;
370
+ /** Sign an app user in with email and password (same as projectLogin). */
371
+ signIn: (email: string, password: string) => Promise<JsonObject>;
372
+ /** Create an app user (no session). Most apps want signUp(), which also signs them in. */
373
+ register: (email: string, password: string, name: string) => Promise<JsonObject>;
374
+ /**
375
+ * @deprecated Use {@link consoleLogin} for operators or {@link projectLogin}
376
+ * for product users. Unscoped calls post to `/api/v1/auth/console/login`.
377
+ */
378
+ login: (email: string, password: string) => Promise<JsonObject>;
379
+ /** Strict console login — rejects every project-scoped credential. */
380
+ consoleLogin: (email: string, password: string) => Promise<JsonObject>;
381
+ /** Alias for consoleLogin() matching lane terminology in docs. */
382
+ loginConsole: (email: string, password: string) => Promise<JsonObject>;
383
+ /** Strict project login — requires X-Sovaria-Org-ID + X-Sovaria-Project-ID. */
384
+ projectLogin: (email: string, password: string) => Promise<JsonObject>;
385
+ /** Alias for projectLogin() matching lane terminology in docs. */
386
+ loginProduct: (email: string, password: string) => Promise<JsonObject>;
387
+ refresh: (refreshToken: string) => Promise<JsonObject>;
388
+ logout: (refreshToken?: string) => Promise<JsonObject>;
389
+ me: () => Promise<JsonObject>;
390
+ verifyMfa: (code: string, method?: "totp" | "phone") => Promise<JsonObject>;
391
+ /** Send a one-time login link by email. Returns 200 even for unknown emails. */
392
+ /**
393
+ * Email a sign-in link (plus a 6-digit code). A link that opens a mobile app (`myapp://…` or a
394
+ * registered app link) is bound to this app with PKCE automatically; pass `pkce: true` to force it.
395
+ */
396
+ sendMagicLink: (email: string, opts?: {
397
+ orgId?: string;
398
+ projectId?: string;
399
+ redirectTo?: string;
400
+ pkce?: boolean;
401
+ }) => Promise<JsonObject>;
402
+ /** Email a password-reset link. Returns 200 even for unknown emails. */
403
+ resetPasswordForEmail: (email: string, opts?: {
404
+ orgId?: string;
405
+ projectId?: string;
406
+ redirectTo?: string;
407
+ pkce?: boolean;
408
+ }) => Promise<JsonObject>;
409
+ /** Set a new password with the token from a reset link (`type=recovery`). */
410
+ confirmPasswordReset: (token: string, newPassword: string, codeVerifier?: string) => Promise<JsonObject>;
411
+ /**
412
+ * Handle the link an auth email opened (`?token=…&type=…` on your Site URL).
413
+ * Magic links sign the user in; email confirmations are confirmed; for `recovery`
414
+ * the token is returned so you can show a "new password" form and call
415
+ * `confirmPasswordReset`. Returns null when the URL isn't an auth link.
416
+ */
417
+ handleEmailLink: (url?: string) => Promise<{
418
+ type: string;
419
+ error: string;
420
+ description: string | undefined;
421
+ session?: undefined;
422
+ result?: undefined;
423
+ token?: undefined;
424
+ } | {
425
+ type: string;
426
+ session: JsonObject;
427
+ error?: undefined;
428
+ description?: undefined;
429
+ result?: undefined;
430
+ token?: undefined;
431
+ } | {
432
+ type: string;
433
+ result: JsonObject;
434
+ error?: undefined;
435
+ description?: undefined;
436
+ session?: undefined;
437
+ token?: undefined;
438
+ } | {
439
+ type: string;
440
+ token: string;
441
+ error?: undefined;
442
+ description?: undefined;
443
+ session?: undefined;
444
+ result?: undefined;
445
+ } | null>;
446
+ /**
447
+ * "Sign in with Google / GitHub / …" (providers connected in Authentication › Sign in / Providers).
448
+ * Sends the browser to the provider; it comes back to `redirectTo` (or your Site URL) with
449
+ * `?code=…&type=sso`, which `handleEmailLink()` / `exchangeCodeForSession()` turn into a session.
450
+ * A PKCE verifier is kept in sessionStorage so only this browser can redeem the code.
451
+ */
452
+ signInWithProvider: (providerId: string, opts?: {
453
+ redirectTo?: string;
454
+ projectId?: string;
455
+ }) => Promise<{
456
+ url: string;
457
+ }>;
458
+ /**
459
+ * Enterprise SAML single sign-on for your app's users (connections in Authentication › SAML SSO, Team plan).
460
+ * Pass the user's work `email` (or its `domain`) to find their company's identity provider, or a
461
+ * `connectionId`. The browser goes to the IdP and comes back like `signInWithProvider()`:
462
+ * `?code=…&type=sso`, which `exchangeCodeForSession()` turns into a session.
463
+ */
464
+ signInWithSSO: (opts: {
465
+ email?: string;
466
+ domain?: string;
467
+ connectionId?: string;
468
+ redirectTo?: string;
469
+ projectId?: string;
470
+ }) => Promise<{
471
+ url: string;
472
+ connectionId: string;
473
+ }>;
474
+ /** Exchange the one-time `code` from a provider sign-in redirect for a session. */
475
+ exchangeCodeForSession: (code: string, codeVerifier?: string) => Promise<JsonObject>;
476
+ /**
477
+ * Link another sign-in method (Google/GitHub/SAML…) to the SIGNED-IN user (Supabase `linkIdentity`).
478
+ * Sends the browser to the provider; it returns to `redirectTo` (or your Site URL) with `?code=…&type=link`,
479
+ * which `handleEmailLink()` / `exchangeCodeForSession()` complete. The completion is bound to THIS browser by
480
+ * a PKCE verifier kept in sessionStorage, so a forwarded link can't attach someone else's identity to your
481
+ * account. An anonymous user who links a verified provider becomes permanent.
482
+ */
483
+ linkIdentity: (providerId: string, opts?: {
484
+ redirectTo?: string;
485
+ }) => Promise<{
486
+ url: string;
487
+ }>;
488
+ /** The sign-in methods linked to the signed-in user (email, google, saml:…, passkey). */
489
+ getUserIdentities: () => Promise<JsonObject>;
490
+ /** Remove a linked sign-in method (never the last one). Pass a recent-auth `nonce` if the project requires it. */
491
+ unlinkIdentity: (identityId: string, opts?: {
492
+ nonce?: string;
493
+ }) => Promise<JsonObject>;
494
+ /** Enabled social / enterprise providers for your sign-in screen. */
495
+ listProviders: (projectId?: string) => Promise<JsonValue>;
496
+ /** Public sign-in config for a project: enabled providers, password rules, MFA factors, passkeys. */
497
+ getPublicConfig: (projectId?: string) => Promise<JsonObject>;
498
+ /** Exchange a magic-link token for an access + refresh token pair. */
499
+ verifyMagicLink: (token: string, codeVerifier?: string) => Promise<JsonObject>;
500
+ /**
501
+ * Sign in with the 6-digit code from the sign-in email (the same email carries the magic link).
502
+ * Uses the client scope's org/project unless given.
503
+ */
504
+ verifyEmailCode: (email: string, code: string, opts?: {
505
+ orgId?: string;
506
+ projectId?: string;
507
+ }) => Promise<JsonObject>;
508
+ /** Send an SMS OTP code for phone-based login. */
509
+ sendOtp: (phone: string, opts?: {
510
+ orgId?: string;
511
+ projectId?: string;
512
+ envId?: string;
513
+ }) => Promise<JsonObject>;
514
+ /** Verify an SMS OTP code and establish a session.
515
+ * Passwordless by default — pass `password` when argon2_salt is present to
516
+ * populate the session KEK without a follow-up password login.
517
+ */
518
+ verifyOtp: (phone: string, code: string, opts?: {
519
+ orgId?: string;
520
+ projectId?: string;
521
+ envId?: string;
522
+ password?: string;
523
+ }) => Promise<JsonObject>;
524
+ /** Exchange an OAuth handoff token for a session (console OAuth callback).
525
+ * Passwordless: session KEK is not derived unless `password` is supplied.
526
+ */
527
+ oauthHandoff: (token: string, password?: string) => Promise<JsonObject>;
528
+ /** Console-operator listing of product users across accessible projects. Path: GET /api/v1/auth/product-users (console lane). */
529
+ listConsoleProductUsers: () => Promise<JsonValue>;
530
+ /** Trigger a verification email for the authenticated user. */
531
+ sendVerificationEmail: () => Promise<JsonObject>;
532
+ /** Confirm an email-verification token. */
533
+ confirmVerificationEmail: (token: string) => Promise<JsonObject>;
534
+ /**
535
+ * Auth event hooks (per-project HTTP webhooks). The project is the client's scope
536
+ * (`X-Sovaria-Project-ID`); the caller must be an owner or admin of it.
537
+ */
538
+ eventHooks: {
539
+ list: () => Promise<JsonValue>;
540
+ create: (payload: {
541
+ name: string;
542
+ url: string;
543
+ events: string[];
544
+ secret?: string;
545
+ enabled?: boolean;
546
+ projectId?: string;
547
+ }) => Promise<JsonObject>;
548
+ delete: (hookId: string) => Promise<JsonObject>;
549
+ };
550
+ /**
551
+ * Blocking hooks (before-create, before-sign-in): a webhook or one of the project's functions that can
552
+ * refuse a sign-up / sign-in or add custom claims. Project owners and admins; plan key `auth.blocking_hooks`.
553
+ * `set` returns the signing secret once (`secret`) when it is created or `rotateSecret` is true.
554
+ */
555
+ blockingHooks: {
556
+ get: () => Promise<JsonObject>;
557
+ set: (event: "before_create" | "before_sign_in", hook: {
558
+ target?: "webhook" | "function";
559
+ url?: string;
560
+ function?: string;
561
+ timeoutMs?: number;
562
+ fail?: "closed" | "open";
563
+ enabled?: boolean;
564
+ rotateSecret?: boolean;
565
+ }) => Promise<JsonObject>;
566
+ delete: (event: "before_create" | "before_sign_in") => Promise<JsonObject>;
567
+ /** Send a sample event and get the hook's decision (`allowed`, `claims`, `message`, `failed`, `error`, `latency_ms`). */
568
+ test: (event: "before_create" | "before_sign_in", sample?: {
569
+ email?: string;
570
+ provider?: string;
571
+ }) => Promise<JsonObject>;
572
+ };
573
+ /**
574
+ * SCIM 2.0 provisioning of the project's app users and groups (Okta, Entra ID …). `createToken` turns it on or
575
+ * rotates the token (the old one stops at once) and returns it once with the `base_url` for the identity
576
+ * provider. Plan key `auth.scim`.
577
+ */
578
+ scim: {
579
+ status: () => Promise<JsonObject>;
580
+ createToken: () => Promise<JsonObject>;
581
+ revokeToken: () => Promise<JsonObject>;
582
+ };
583
+ /**
584
+ * @deprecated Legacy GET `/api/v1/auth/users`. Use `productUsers.list()` for
585
+ * project-scoped product users or `listConsoleProductUsers()` for the console
586
+ * product-user admin path. Use `consoleMembers.list()` for org console members.
587
+ */
588
+ listUsers: () => Promise<JsonValue>;
589
+ /**
590
+ * @deprecated Legacy DELETE `/api/v1/auth/users/{id}`. Use `productUsers.delete()`
591
+ * or `consoleMembers.delete()`.
592
+ */
593
+ deleteUser: (userId: string) => Promise<JsonObject>;
594
+ /**
595
+ * @deprecated Legacy POST `/api/v1/auth/users/{id}/ban`. Use `productUsers.ban()`.
596
+ */
597
+ banUser: (userId: string) => Promise<JsonObject>;
598
+ /** Org console-member management. Canonical path: GET /api/v1/org/{orgId}/members. Not product users. */
599
+ consoleMembers: {
600
+ list: () => Promise<JsonValue>;
601
+ delete: (userId: string) => Promise<JsonObject>;
602
+ ban: (userId: string) => Promise<JsonObject>;
603
+ };
604
+ /** Product auth admin (project-scoped identities). Path: GET /api/v1/projects/{id}/auth/users. Requires setScope. */
605
+ productUsers: {
606
+ /** Every product user: follows all pages. Use `listPage()` for big projects. */
607
+ list: () => Promise<JsonObject[]>;
608
+ /** One page of product users, newest first. `search` matches part of an email or an exact id. */
609
+ listPage: (params?: {
610
+ limit?: number;
611
+ cursor?: string | null;
612
+ search?: string;
613
+ status?: "active" | "banned";
614
+ }) => Promise<ProductUsersPage>;
615
+ delete: (userId: string) => Promise<JsonObject>;
616
+ ban: (userId: string) => Promise<JsonObject>;
617
+ roles: (userId: string) => Promise<JsonObject>;
618
+ setRoles: (userId: string, roles: string[]) => Promise<JsonObject>;
619
+ create: (payload: {
620
+ email: string;
621
+ password: string;
622
+ name?: string;
623
+ roles?: string[];
624
+ }) => Promise<JsonObject>;
625
+ /**
626
+ * Bulk-import app users (up to 1,000 per call) with their ids and password hashes: `bcrypt`
627
+ * (Supabase) as is, `firebase_scrypt` (Firebase) checked with `hashConfig` and upgraded to bcrypt
628
+ * at first sign-in. No emails, hooks or triggers fire; existing emails are skipped. Org owners/admins.
629
+ */
630
+ import: (users: Array<{
631
+ email: string;
632
+ id?: string;
633
+ email_verified?: boolean;
634
+ phone?: string | null;
635
+ display_name?: string | null;
636
+ password_algorithm?: "bcrypt" | "firebase_scrypt" | null;
637
+ password_hash?: string | null;
638
+ password_salt?: string | null;
639
+ }>, hashConfig?: {
640
+ signer_key: string;
641
+ salt_separator: string;
642
+ rounds: number;
643
+ mem_cost: number;
644
+ }) => Promise<JsonObject>;
645
+ };
646
+ sessions: {
647
+ list: () => Promise<JsonValue>;
648
+ revoke: (sessionId: string) => Promise<JsonObject>;
649
+ revokeOthers: () => Promise<JsonObject>;
650
+ getConfig: () => Promise<JsonObject>;
651
+ setConfig: (body: JsonObject) => Promise<JsonObject>;
652
+ };
653
+ providersConfig: {
654
+ get: () => Promise<JsonObject>;
655
+ set: (body: JsonObject) => Promise<JsonObject>;
656
+ };
657
+ /**
658
+ * Passkeys (WebAuthn): add one for the signed-in user, sign in with one, list and remove them.
659
+ * The project must have passkeys set up (Users › Passkeys). `register()` and `signIn()` run the
660
+ * browser ceremony; on other platforms use the `start…` / `finish…` calls with your own WebAuthn API.
661
+ *
662
+ * ```ts
663
+ * await sov.auth.passkeys.register('MacBook') // signed in: Touch ID creates a passkey
664
+ * const session = await sov.auth.passkeys.signIn() // later: sign in with it, no email needed
665
+ * ```
666
+ */
667
+ passkeys: {
668
+ /** True when this browser can create and use passkeys. */
669
+ isSupported: () => boolean;
670
+ /** Registration options for the signed-in user (their existing passkeys are excluded). */
671
+ startRegistration: (name?: string) => Promise<JsonObject>;
672
+ /** Save the credential the authenticator created (`credential` is WebAuthn JSON). */
673
+ finishRegistration: (credential: JsonObject, name?: string) => Promise<JsonObject>;
674
+ /** Create a passkey for the signed-in user with the browser's WebAuthn API and save it. */
675
+ register: (name?: string) => Promise<JsonObject>;
676
+ /** Sign-in options: `{ challenge_id, options }`. Pass `userId` to offer only that user's passkeys. */
677
+ startSignIn: (opts?: {
678
+ userId?: string;
679
+ }) => Promise<JsonObject>;
680
+ /** Verify the signed challenge and sign the user in (the session is kept and refreshed like any sign-in). */
681
+ finishSignIn: (challengeId: string, credential: JsonObject) => Promise<JsonObject>;
682
+ /** Sign in with a passkey using the browser's WebAuthn API. Resolves to the session tokens (`aal` says if it was two-factor). */
683
+ signIn: (opts?: {
684
+ userId?: string;
685
+ }) => Promise<JsonObject>;
686
+ /** The signed-in user's passkeys: id, name, created_at, last_used_at. */
687
+ list: () => Promise<JsonValue>;
688
+ /** Remove one of the signed-in user's passkeys. */
689
+ remove: (passkeyId: string) => Promise<JsonValue>;
690
+ };
691
+ mfa: {
692
+ status: () => Promise<JsonObject>;
693
+ enroll: () => Promise<JsonObject>;
694
+ disable: (totpCode: string) => Promise<JsonObject>;
695
+ };
696
+ github: {
697
+ connectionState: () => Promise<JsonObject>;
698
+ disconnect: () => Promise<JsonObject>;
699
+ };
700
+ };
701
+ readonly graph: {
702
+ /**
703
+ * Create an org, project or environment node. For a PROJECT, `options.databasePassword` sets the
704
+ * project's database password (12–72 characters, letters, numbers and symbols; no spaces, quotes,
705
+ * backslashes or backticks). Without it the database gets a random password you can change later.
706
+ */
707
+ createNode: (nodeType: string, name: string, metadata?: JsonObject, options?: {
708
+ databasePassword?: string;
709
+ }) => Promise<JsonObject>;
710
+ createEdge: (sourceId: string, targetId: string, relationType: string, role?: string) => Promise<JsonObject>;
711
+ addMember: (orgId: string, userId: string, role?: string) => Promise<JsonObject>;
712
+ getContext: (userId: string, resourceId: string) => Promise<JsonObject>;
713
+ listNodes: (nodeType?: string) => Promise<JsonValue>;
714
+ getNode: (nodeId: string) => Promise<JsonObject>;
715
+ getChildren: (parentId: string, relation?: string) => Promise<JsonValue>;
716
+ updateOrg: (orgId: string, body: JsonObject) => Promise<JsonObject>;
717
+ deleteOrg: (orgId: string) => Promise<JsonObject>;
718
+ setOrgPlan: (orgId: string, body: JsonObject) => Promise<JsonObject>;
719
+ listMembers: (orgId: string) => Promise<JsonValue>;
720
+ removeMember: (orgId: string, userId: string) => Promise<JsonObject>;
721
+ updateMember: (orgId: string, userId: string, body: JsonObject) => Promise<JsonObject>;
722
+ createInvite: (orgId: string, body: JsonObject) => Promise<JsonObject>;
723
+ acceptInvite: (body: JsonObject) => Promise<JsonObject>;
724
+ getRoleMatrix: () => Promise<JsonObject>;
725
+ setRoleMatrix: (body: JsonObject) => Promise<JsonObject>;
726
+ getRoleCatalog: () => Promise<JsonValue>;
727
+ getProjectRef: (projectId: string) => Promise<JsonObject>;
728
+ getProjectSettings: () => Promise<JsonObject>;
729
+ setProjectSettings: (body: JsonObject) => Promise<JsonObject>;
730
+ };
731
+ readonly data: {
732
+ docPut: (collection: string, documentId: string, data: JsonObject) => Promise<JsonObject>;
733
+ docGet: (collection: string, documentId: string, atTxid?: number) => Promise<JsonObject>;
734
+ docDelete: (collection: string, documentId: string) => Promise<JsonObject>;
735
+ /** Encrypt client-side and write a Zero-Knowledge document envelope to Atlas-Doc. */
736
+ putDocumentE2ee: (collection: string, documentId: string, plaintext: Uint8Array | string, password?: string) => Promise<JsonObject>;
737
+ /** Retrieve and decrypt a Zero-Knowledge document from Atlas-Doc. */
738
+ getDocumentE2ee: (collection: string, documentId: string, password?: string, atTxid?: number) => Promise<{
739
+ plaintext: Uint8Array<ArrayBufferLike>;
740
+ }>;
741
+ /**
742
+ * List the documents in one collection (newest writes last): `[{ id, data, txid }]`.
743
+ * Subcollections are not included — list `collection/<docId>/<sub>` for those.
744
+ */
745
+ docList: (collection: string, options?: {
746
+ limit?: number;
747
+ }) => Promise<{
748
+ id: string;
749
+ data: JsonObject;
750
+ txid: number;
751
+ }[]>;
752
+ /** Field query (`where`, `order_by`, `limit`, cursors) — see also `sov.collection(...)`. */
753
+ docQuery: (collection: string, query?: JsonObject) => Promise<JsonObject>;
754
+ docCount: (collection: string, query?: JsonObject) => Promise<JsonObject>;
755
+ /** Atomic commit: `{ op, path, data, merge, transforms, precondition }` writes; `reads` make it a transaction. */
756
+ docCommit: (writes: JsonObject[], reads?: JsonObject[]) => Promise<JsonObject>;
757
+ docIndexes: (collection?: string) => Promise<JsonObject>;
758
+ createDocIndex: (collection: string, fields: (string | {
759
+ path: string;
760
+ order?: "asc" | "desc";
761
+ })[]) => Promise<JsonObject>;
762
+ dropDocIndex: (name: string) => Promise<JsonObject>;
763
+ collectionRules: (collection: string) => Promise<JsonObject>;
764
+ docScan: (args: {
765
+ prefix?: string;
766
+ start_key?: string;
767
+ end_key?: string;
768
+ limit?: number;
769
+ }) => Promise<JsonObject>;
770
+ /**
771
+ * Run one SQL statement. Pass values for `$1, $2, …` as `params` — they are bound by the
772
+ * database, so user input never becomes SQL: `sql('SELECT * FROM books WHERE id = $1', [id])`.
773
+ * A number as the second argument is still read as `txid` (older signature).
774
+ *
775
+ * `{ readOnly: true }` runs it in a read-only transaction (the server refuses writes, including
776
+ * through functions). The answer has `truncated: true` when it was cut at your plan's `sql.max_rows`.
777
+ */
778
+ sql: (sql: string, params?: JsonValue[] | number, txid?: number, opts?: {
779
+ readOnly?: boolean;
780
+ }) => Promise<JsonObject>;
781
+ /**
782
+ * Call one of your Postgres functions: `POST /rest/v1/rpc/{name}` with the arguments by name.
783
+ * A function that returns one value resolves to that value; one that returns rows resolves to
784
+ * an array of objects. App users need an access policy that allows `fn:<name>`. When the function
785
+ * raises an error, the SovariaError's `detail` holds the database's `code` and `message` (and
786
+ * `technicalMessage` repeats it for logs); `message` stays one you can show users.
787
+ *
788
+ * const n = await sovaria.data.rpc<number>('post_count', { u: userId })
789
+ * const top = await sovaria.data.rpc('top_posts', { days: 7 }, { get: true, query: { limit: 10 } })
790
+ */
791
+ rpc: <T = JsonValue>(name: string, args?: JsonObject, options?: RpcOptions) => Promise<T>;
792
+ tableCreate: (payload: JsonObject) => Promise<JsonObject>;
793
+ tableDrop: (tableName: string) => Promise<JsonObject>;
794
+ tableAddColumn: (payload: JsonObject) => Promise<JsonObject>;
795
+ tableDropColumn: (tableName: string, columnName: string) => Promise<JsonObject>;
796
+ tableAddForeignKey: (payload: JsonObject) => Promise<JsonObject>;
797
+ tableDropForeignKey: (payload: JsonObject) => Promise<JsonObject>;
798
+ tableMigrations: (query?: {
799
+ table_name?: string;
800
+ limit?: number;
801
+ offset?: number;
802
+ }) => Promise<JsonObject>;
803
+ /** The schema as one short line per table: types, keys, →references, allowed values, indexes, owner-only rows. */
804
+ schemaDigest: (options?: {
805
+ tables?: string[];
806
+ maxChars?: number;
807
+ since?: string;
808
+ }) => Promise<SchemaDigest>;
809
+ /**
810
+ * Create or extend tables from one declarative plan: checked first (a 422 lists every problem and nothing
811
+ * changes), then applied as one reversible migration and verified. `dryRun` returns the SQL instead.
812
+ */
813
+ applySchemaPlan: (plan: {
814
+ tables: SchemaPlanTable[];
815
+ dryRun?: boolean;
816
+ name?: string;
817
+ }) => Promise<SchemaPlanResult>;
818
+ /** Apply a migration atomically and record it in the project's history. `downSql` makes it reversible. */
819
+ applyMigration: (migration: {
820
+ name: string;
821
+ upSql: string;
822
+ downSql?: string;
823
+ version?: string;
824
+ }) => Promise<JsonObject>;
825
+ /** Run a migration inside a transaction and roll it back: reports whether it would apply. */
826
+ dryRunMigration: (migration: {
827
+ name: string;
828
+ upSql: string;
829
+ downSql?: string;
830
+ }) => Promise<JsonObject>;
831
+ /**
832
+ * Check several migrations the way they will be applied (what `sov db migrations push --dry-run` does):
833
+ * all run in order inside one transaction that is rolled back, so later ones see what earlier ones
834
+ * create. Up to 500 and 5 MB of SQL; `failed.index` is the first that fails. Nothing is kept.
835
+ */
836
+ dryRunMigrations: (migrations: Array<{
837
+ name: string;
838
+ upSql: string;
839
+ }>) => Promise<MigrationSequenceResult>;
840
+ /** Undo the latest migration (or `version` with `force`) using its down SQL. */
841
+ rollbackMigration: (opts?: {
842
+ version?: string;
843
+ force?: boolean;
844
+ }) => Promise<JsonObject>;
845
+ beginTransaction: () => Promise<JsonObject>;
846
+ commitTransaction: (txid: number) => Promise<JsonObject>;
847
+ rollbackTransaction: (txid: number) => Promise<JsonObject>;
848
+ };
849
+ readonly realtime: {
850
+ subscribe: (channel: string, clientId: string) => Promise<JsonObject>;
851
+ unsubscribe: (channel: string, clientId: string) => Promise<JsonObject>;
852
+ presence: (channel: string) => Promise<JsonObject>;
853
+ channels: () => Promise<JsonObject>;
854
+ replay: (channel: string, after?: number, limit?: number) => Promise<JsonObject>;
855
+ publish: (channel: string, payload: JsonObject, clock?: JsonObject, clockDelta?: JsonObject) => Promise<JsonObject>;
856
+ e2eeBootstrap: (channel: string, ttlSeconds?: number, forceNew?: boolean) => Promise<JsonObject>;
857
+ e2eeRotate: (channel: string, ttlSeconds?: number) => Promise<JsonObject>;
858
+ e2eeRevoke: (channel: string, keyId?: string, reason?: string) => Promise<JsonObject>;
859
+ /** Pass your RSA-OAEP (SHA-256) public key — PEM or base64 SPKI — to get the key wrapped for you. */
860
+ e2eeActiveKey: (channel: string, clientPublicKey?: string) => Promise<JsonObject>;
861
+ e2eeGetKey: (channel: string, keyId: string, clientPublicKey?: string) => Promise<JsonObject>;
862
+ e2eeListKeys: (channel: string) => Promise<JsonObject>;
863
+ wsTicket: (channel: string) => Promise<string>;
864
+ wsUrl: (channel: string, ticket?: string) => string;
865
+ wsUrlWithTicket: (channel: string) => Promise<string>;
866
+ /**
867
+ * Listen on a channel over WebSocket. Reconnects with backoff (a fresh ticket each time) and
868
+ * hands you each message's payload. Call `close()` when done.
869
+ *
870
+ * ```ts
871
+ * const ch = sov.realtime.channel('book:42', { onMessage: (m) => console.log(m), onStatus: setStatus })
872
+ * await ch.send({ type: 'typing' })
873
+ * ch.close()
874
+ * ```
875
+ */
876
+ channel: (name: string, handlers?: RealtimeChannelHandlers) => RealtimeChannel;
877
+ };
878
+ readonly policy: {
879
+ templates: () => Promise<JsonObject>;
880
+ list: () => Promise<JsonValue>;
881
+ get: (policyId: string) => Promise<JsonObject>;
882
+ create: (payload: JsonObject) => Promise<JsonObject>;
883
+ update: (policyId: string, payload: JsonObject) => Promise<JsonObject>;
884
+ delete: (policyId: string) => Promise<JsonObject>;
885
+ evaluate: (policyId: string, context: JsonObject) => Promise<JsonObject>;
886
+ check: (payload: {
887
+ orgId: string;
888
+ projectId: string;
889
+ action: string;
890
+ resource: string;
891
+ context?: JsonObject;
892
+ }) => Promise<JsonObject>;
893
+ preflight: (action: string, resource: string, context?: JsonObject) => Promise<JsonObject>;
894
+ history: (policyId: string) => Promise<JsonValue>;
895
+ rollback: (policyId: string, version: number) => Promise<JsonObject>;
896
+ simulate: (splSource: string, context?: JsonObject) => Promise<JsonObject>;
897
+ };
898
+ readonly audit: {
899
+ append: (payload: JsonObject) => Promise<JsonObject>;
900
+ list: (query?: {
901
+ actor_id?: string;
902
+ event_type?: string;
903
+ source?: string;
904
+ resource_id?: string;
905
+ limit?: number;
906
+ offset?: number;
907
+ }) => Promise<JsonValue>;
908
+ verify: () => Promise<JsonObject>;
909
+ count: () => Promise<JsonObject>;
910
+ };
911
+ readonly simulate: {
912
+ /**
913
+ * Who can do what in the live project, as visitors, the app's users and the team; nothing is
914
+ * written. Pass `{ manifest_id }` from `discover()` to skip discovery (manifest content is never
915
+ * accepted). Narrow with `{ filter: { resource, action, role } }` (role: `__guest__`,
916
+ * `__app_user__`, `app:<role>` or a team role): up to 25 request types is a single-request check
917
+ * that doesn't use the allowance; a wider filter is charged as a full run. One full run at a time
918
+ * per organization (409 `SIMULATION_RUN_IN_PROGRESS`).
919
+ */
920
+ run: (payload?: JsonObject) => Promise<JsonObject>;
921
+ /**
922
+ * Try a change before making it; nothing is written. `{ kind: 'policy', policy: { spl_source,
923
+ * name?, replaces? }, disable_policy_ids? }` lists who gains and loses access; `{ kind: 'sql',
924
+ * sql }` runs the script with every check, rolls it back and lists what it changed.
925
+ */
926
+ change: (payload: JsonObject) => Promise<JsonObject>;
927
+ plan: (payload: JsonObject) => Promise<JsonObject>;
928
+ discover: () => Promise<JsonObject>;
929
+ listRuns: (query?: {
930
+ limit?: number;
931
+ offset?: number;
932
+ }) => Promise<JsonValue>;
933
+ /** Real runs used and allowed today (UTC) and this month: `{ day: {used, limit, resets_at}, month: {…} }`. */
934
+ quota: () => Promise<JsonObject>;
935
+ /** Outcomes the team marked as intended (shown green on every run, left out of findings). */
936
+ listIntended: () => Promise<JsonObject>;
937
+ /** Mark an outcome as intended, e.g. `{ role: '__guest__', action: 'sql:select', resource: 'public.products',
938
+ * outcome: 'ALLOW', note: 'The catalogue is public' }`. Needs policies.write. */
939
+ markIntended: (mark: {
940
+ role: string;
941
+ action: string;
942
+ resource: string;
943
+ outcome: "ALLOW" | "DENY";
944
+ note?: string;
945
+ }) => Promise<JsonObject>;
946
+ /** Remove a mark; matching cases show as measured again. */
947
+ unmarkIntended: (markId: string) => Promise<JsonObject>;
948
+ /** Callers, gateway checks, sign-in, resources and connectors (platform defences as "Platform protection"). */
949
+ topology: () => Promise<JsonObject>;
950
+ /** Everything the project has, read from every engine (every schema it created, collections, buckets, secret names,
951
+ * functions with schedules, queues, workflows and triggers, sign-in, webhooks, channels, edge limits, backups,
952
+ * environments, domains, policies, plan headroom). */
953
+ inventory: (params?: {
954
+ include?: string;
955
+ fresh?: boolean;
956
+ }) => Promise<JsonObject>;
957
+ /** What is wrong or at risk, worst first, each with a fix. `severity` keeps that level and worse. */
958
+ checks: (params?: {
959
+ severity?: "critical" | "warning" | "info";
960
+ area?: string;
961
+ fresh?: boolean;
962
+ }) => Promise<JsonObject>;
963
+ /** The architecture map: nodes by layer with their status, and the edges between them. */
964
+ graph: (params?: {
965
+ fresh?: boolean;
966
+ }) => Promise<JsonObject>;
967
+ /** Every limit the project lives under, with its value and how it is counted. */
968
+ limits: () => Promise<JsonObject>;
969
+ /** One integration flow under a programmed outcome. `modelled` is free and sends nothing; `sealed` runs the
970
+ * real code path to the send point and returns the recording (one single-request check). */
971
+ integrationRun: (body: {
972
+ connector_id: string;
973
+ flow_id: string;
974
+ outcome?: string;
975
+ mode?: "modelled" | "sealed";
976
+ }) => Promise<JsonObject>;
977
+ /** The 14 security drills judged from the project's configuration, with an optional what-if draft (never saved). */
978
+ drillsRun: (body?: {
979
+ drill_ids?: string[];
980
+ overrides?: JsonObject;
981
+ }) => Promise<JsonObject>;
982
+ /** What a run's sealed send points would have sent. */
983
+ runArtifacts: (runId: string) => Promise<JsonObject>;
984
+ getRun: (runId: string) => Promise<JsonObject>;
985
+ compareRuns: (targetRunId: string, baselineRunId: string) => Promise<JsonObject>;
986
+ };
987
+ readonly chrono: {
988
+ /** The project's configuration (policies, schema, functions, settings, buckets, keys) at a commit or ISO time. */
989
+ state: (query?: {
990
+ at?: string;
991
+ prefix?: string;
992
+ timeline?: string;
993
+ }) => Promise<JsonObject>;
994
+ /**
995
+ * What going back to `at` on a branch changes, file by file, with who would gain or lose access. Writes nothing.
996
+ * The branch decides the environment acted on (main = production); `envId` is the one you have checked out
997
+ * ('' = production) and a mismatch is refused (ENV_MISMATCH).
998
+ */
999
+ restorePlan: (at: string, timeline?: string, options?: {
1000
+ envId?: string;
1001
+ }) => Promise<JsonObject>;
1002
+ /**
1003
+ * Go back to `at` on a branch: applies the plan's automated changes with the caller's own permissions, in that
1004
+ * branch's own environment. `includeSchema` also rolls back the migrations applied since then; `includeDatabase`
1005
+ * also restores the database as of then (production: the closest backup; an environment: point-in-time).
1006
+ * The answer has `new_head`, or `recording: true` while the new commits are still arriving.
1007
+ */
1008
+ restore: (at: string, timeline?: string, options?: {
1009
+ includeDatabase?: boolean;
1010
+ includeSchema?: boolean;
1011
+ envId?: string;
1012
+ }) => Promise<JsonObject>;
1013
+ commit: (payload: JsonObject) => Promise<JsonObject>;
1014
+ timelineSpawn: (payload: JsonObject) => Promise<JsonObject>;
1015
+ timelineList: () => Promise<JsonObject>;
1016
+ timelineDelete: (name: string) => Promise<JsonObject>;
1017
+ timelineJump: (name: string, targetHex: string) => Promise<JsonObject>;
1018
+ timelineHistory: (name: string, limit?: number, offset?: number) => Promise<JsonObject>;
1019
+ topology: (timeline?: string, limit?: number) => Promise<JsonObject>;
1020
+ converge: (payload: JsonObject) => Promise<JsonObject>;
1021
+ variance: (payload: JsonObject) => Promise<JsonObject>;
1022
+ snapshotCreate: (payload: JsonObject) => Promise<JsonObject>;
1023
+ snapshotList: () => Promise<JsonObject>;
1024
+ snapshotRestore: (snapshotId: number) => Promise<JsonObject>;
1025
+ };
1026
+ readonly functions: {
1027
+ list: (options: {
1028
+ projectId: string;
1029
+ limit?: number;
1030
+ offset?: number;
1031
+ }) => Promise<JsonObject>;
1032
+ /** Validate a bundle and get a signed plan bound to its exact bytes. */
1033
+ plan: (bundle: Blob, name: string, projectId?: string) => Promise<JsonObject>;
1034
+ /** Plans, then applies exactly the planned bundle (Forge refuses anything else). */
1035
+ deploy: (bundle: Blob, name: string, projectId?: string) => Promise<JsonObject>;
1036
+ status: (deployId: string, projectId?: string) => Promise<JsonObject>;
1037
+ invoke: (functionName: string, payload: JsonValue, options?: {
1038
+ projectId?: string;
1039
+ deployId?: string;
1040
+ executionProfile?: "standard" | "heavy";
1041
+ }) => Promise<JsonObject>;
1042
+ /**
1043
+ * Call a function the way an app does: POST {projectUrl}/functions/v1/{name} with the signed-in
1044
+ * user's token (or no token for functions marked public). Returns the function's result.
1045
+ */
1046
+ call: <T = JsonValue>(functionName: string, payload?: JsonValue) => Promise<T>;
1047
+ /**
1048
+ * Call an HTTP function like `fetch`: any method, a sub-path, headers, a raw body (string, bytes, FormData…),
1049
+ * and the function's own Response back (status, headers, binary body). Sends the signed-in user's token
1050
+ * when there is one (none for public functions).
1051
+ *
1052
+ * const res = await sovaria.functions.fetch('api', 'users/42', { method: 'PUT', body: JSON.stringify(user) })
1053
+ * if (res.status === 201) console.log(await res.json())
1054
+ */
1055
+ fetch: (functionName: string, path?: string, init?: {
1056
+ method?: string;
1057
+ headers?: Record<string, string>;
1058
+ body?: BodyInit | null;
1059
+ query?: Record<string, string>;
1060
+ }) => Promise<Response>;
1061
+ /** Make a function an HTTP function (Request in, Response out) or a JSON one again. */
1062
+ setHttp: (functionName: string, http: boolean) => Promise<JsonObject>;
1063
+ simulate: (functionName: string, payload: JsonValue, options?: {
1064
+ projectId?: string;
1065
+ deployId?: string;
1066
+ executionProfile?: "standard" | "heavy";
1067
+ }) => Promise<JsonObject>;
1068
+ invokeAsync: (functionName: string, payload: JsonValue, options?: {
1069
+ projectId?: string;
1070
+ deployId?: string;
1071
+ executionProfile?: "standard" | "heavy";
1072
+ simulation?: boolean;
1073
+ }) => Promise<JsonObject>;
1074
+ invocationStatus: (invocationId: string, projectId: string) => Promise<JsonObject>;
1075
+ jobs: (functionName: string, options: {
1076
+ projectId: string;
1077
+ status?: string;
1078
+ limit?: number;
1079
+ offset?: number;
1080
+ }) => Promise<JsonObject>;
1081
+ versions: (functionName: string, options: {
1082
+ projectId: string;
1083
+ limit?: number;
1084
+ offset?: number;
1085
+ }) => Promise<JsonObject>;
1086
+ history: (functionName: string, options: {
1087
+ projectId: string;
1088
+ mode?: "invoke" | "simulate";
1089
+ limit?: number;
1090
+ offset?: number;
1091
+ }) => Promise<JsonObject>;
1092
+ simulationDiff: (functionName: string, options: {
1093
+ projectId: string;
1094
+ leftInvocationId: string;
1095
+ rightInvocationId: string;
1096
+ }) => Promise<JsonObject>;
1097
+ promote: (functionName: string, options: {
1098
+ projectId: string;
1099
+ version?: number;
1100
+ deployId?: string;
1101
+ reason?: string;
1102
+ }) => Promise<JsonObject>;
1103
+ rollback: (functionName: string, options: {
1104
+ projectId: string;
1105
+ version?: number;
1106
+ reason?: string;
1107
+ }) => Promise<JsonObject>;
1108
+ request: (method: string, path: string, options?: RequestOptions) => Promise<JsonValue>;
1109
+ get: (name: string) => Promise<JsonObject>;
1110
+ getSource: (name: string) => Promise<JsonObject>;
1111
+ update: (name: string, body: JsonObject) => Promise<JsonObject>;
1112
+ delete: (name: string) => Promise<JsonObject>;
1113
+ logs: (name: string, query?: {
1114
+ limit?: number;
1115
+ offset?: number;
1116
+ status?: string;
1117
+ }) => Promise<JsonValue>;
1118
+ getPolicy: (name: string) => Promise<JsonObject>;
1119
+ setPolicy: (name: string, body: JsonObject) => Promise<JsonObject>;
1120
+ getBindings: (name: string) => Promise<JsonObject>;
1121
+ setBindings: (name: string, body: JsonObject) => Promise<JsonObject>;
1122
+ githubRepositories: (body: JsonObject) => Promise<JsonObject>;
1123
+ githubImport: (body: JsonObject) => Promise<JsonObject>;
1124
+ githubCommit: (body: JsonObject) => Promise<JsonObject>;
1125
+ };
1126
+ /**
1127
+ * Web hosting (Sites): static builds served on `<site>.sovaria.app` and your own domains. Deploys are
1128
+ * immutable and content-addressed (only new files are uploaded); a release switches the whole site at once.
1129
+ *
1130
+ * await sovaria.hosting.createSite('my-app')
1131
+ * const { release } = await sovaria.hosting.deployFiles('my-app', { '/index.html': '<h1>Hi</h1>' }, { config: { spa: true } })
1132
+ * console.log(release.url) // https://my-app.sovaria.app
1133
+ */
1134
+ readonly hosting: {
1135
+ config: () => Promise<JsonObject>;
1136
+ sites: () => Promise<JsonObject>;
1137
+ createSite: (name: string) => Promise<JsonObject>;
1138
+ site: (site: string) => Promise<JsonObject>;
1139
+ deleteSite: (site: string) => Promise<JsonObject>;
1140
+ deploys: (site: string) => Promise<JsonObject>;
1141
+ releases: (site: string, channel?: string) => Promise<JsonObject>;
1142
+ rollback: (site: string, options?: {
1143
+ channel?: string;
1144
+ deployId?: string;
1145
+ }) => Promise<JsonObject>;
1146
+ channels: (site: string) => Promise<JsonObject>;
1147
+ releaseToChannel: (site: string, channel: string, deployId: string, expiresDays?: number) => Promise<JsonObject>;
1148
+ deleteChannel: (site: string, channel: string) => Promise<JsonObject>;
1149
+ /**
1150
+ * Deploy files (path → contents) and release them: hashes each file, uploads only the ones the project
1151
+ * doesn't have, then switches the channel (`live` by default) to the new deploy in one step.
1152
+ */
1153
+ deployFiles: (site: string, files: Record<string, string | Uint8Array | ArrayBuffer | Blob>, options?: {
1154
+ config?: JsonObject;
1155
+ channel?: string;
1156
+ expiresDays?: number;
1157
+ message?: string;
1158
+ release?: boolean;
1159
+ }) => Promise<JsonObject>;
1160
+ };
1161
+ readonly storage: {
1162
+ request: (method: string, path: string, options?: RequestOptions) => Promise<JsonValue>;
1163
+ putJson: (path: string, payload: JsonObject) => Promise<JsonValue>;
1164
+ get: (path: string, query?: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
1165
+ delete: (path: string) => Promise<JsonValue>;
1166
+ /** Public URL of an object in a public bucket (no token needed; safe to put in <img src>). */
1167
+ publicUrl: (bucket: string, objectPath: string, projectId?: string) => string;
1168
+ listBuckets: () => Promise<JsonValue>;
1169
+ createBucket: (body: JsonObject) => Promise<JsonObject>;
1170
+ getBucket: (name: string) => Promise<JsonObject>;
1171
+ updateBucket: (name: string, body: JsonObject) => Promise<JsonObject>;
1172
+ deleteBucket: (name: string) => Promise<JsonObject>;
1173
+ listObjects: (bucket: string, query?: {
1174
+ prefix?: string;
1175
+ }) => Promise<JsonValue>;
1176
+ signDownload: (bucket: string, objectPath: string, expiresIn?: number) => Promise<JsonObject>;
1177
+ /**
1178
+ * Signed upload URL. Pass `sizeBytes` (the file's exact size) to get a direct-to-storage URL bound
1179
+ * to that size; without it the URL uploads through Sovaria, which checks the size limits as the
1180
+ * bytes arrive.
1181
+ */
1182
+ signUpload: (bucket: string, objectPath: string, expiresIn?: number, options?: {
1183
+ sizeBytes?: number;
1184
+ contentType?: string;
1185
+ }) => Promise<JsonObject>;
1186
+ moveObject: (body: JsonObject) => Promise<JsonObject>;
1187
+ /**
1188
+ * Upload a file. Bucket rules decide who may write where — e.g. with the "Own folder" rule a
1189
+ * user writes to `${userId}/…`. Pass `upsert: true` to replace an existing object.
1190
+ */
1191
+ upload: (bucket: string, objectPath: string, file: Blob, options?: {
1192
+ upsert?: boolean;
1193
+ contentType?: string;
1194
+ }) => Promise<JsonObject>;
1195
+ /** Download an object the caller may read, as a Blob. */
1196
+ download: (bucket: string, objectPath: string) => Promise<Blob>;
1197
+ /** Delete an object. */
1198
+ remove: (bucket: string, objectPath: string) => Promise<JsonObject>;
1199
+ };
1200
+ /**
1201
+ * Compliance center (organization owners and admins): the evidence pack for your own audits. It is evidence of
1202
+ * how Sovaria is configured for your organization, not a certification.
1203
+ */
1204
+ readonly compliance: {
1205
+ /** Audit-log check, encryption and own-key status, data regions, per-project backups/PITR/Security Advisor, access. */
1206
+ overview: (orgId?: string, options?: {
1207
+ projectId?: string;
1208
+ }) => Promise<JsonObject>;
1209
+ /** The evidence pack as a ZIP Blob (MANIFEST.json holds every file's SHA-256). Counted per day; audited. */
1210
+ downloadEvidence: (orgId?: string, options?: {
1211
+ projectId?: string;
1212
+ }) => Promise<Blob>;
1213
+ };
1214
+ private complianceOrg;
1215
+ readonly system: {
1216
+ enginesHealth: () => Promise<JsonValue>;
1217
+ };
1218
+ /**
1219
+ * Billing + plan management (Ledger engine).
1220
+ *
1221
+ * The plan catalog is public; subscription and usage routes require a
1222
+ * valid auth token. Subscription writes require the caller to be an
1223
+ * org admin.
1224
+ */
1225
+ readonly billing: {
1226
+ listPlans: () => Promise<JsonValue>;
1227
+ getPlan: (name: string) => Promise<JsonObject>;
1228
+ getSubscription: (orgId: string) => Promise<JsonObject>;
1229
+ setSubscription: (orgId: string, payload: {
1230
+ plan: string;
1231
+ billingCycle?: "monthly" | "annual";
1232
+ stripeCustomerId?: string;
1233
+ metadata?: JsonObject;
1234
+ }) => Promise<JsonObject>;
1235
+ cancelSubscription: (orgId: string, options?: {
1236
+ immediate?: boolean;
1237
+ }) => Promise<JsonObject>;
1238
+ listSubscriptions: () => Promise<JsonValue>;
1239
+ getUsage: (orgId: string, period?: string) => Promise<JsonObject>;
1240
+ getUsageHistory: (orgId: string, months?: number) => Promise<JsonValue>;
1241
+ listInvoices: (orgId: string) => Promise<JsonValue>;
1242
+ buildInvoice: (orgId: string, period?: string) => Promise<JsonObject>;
1243
+ getCompute: (orgId: string, period?: string) => Promise<JsonObject>;
1244
+ checkout: (body: JsonObject) => Promise<JsonObject>;
1245
+ getProvider: () => Promise<JsonObject>;
1246
+ getFx: () => Promise<JsonObject>;
1247
+ getOverage: (orgId: string) => Promise<JsonObject>;
1248
+ getOpenInvoice: () => Promise<JsonObject>;
1249
+ payInvoice: (orgId: string, period: string, body?: JsonObject) => Promise<JsonObject>;
1250
+ razorpayCreateOrder: (body: JsonObject) => Promise<JsonObject>;
1251
+ razorpayVerifyPayment: (body: JsonObject) => Promise<JsonObject>;
1252
+ getAccount: (accountId: string) => Promise<JsonObject>;
1253
+ cancelAccount: (accountId: string) => Promise<JsonObject>;
1254
+ resumeAccount: (accountId: string) => Promise<JsonObject>;
1255
+ /** Add-ons on the billing account (price, paid units, what renews, paid-through) and the autopay mandate. */
1256
+ listAddons: (accountId: string) => Promise<JsonObject>;
1257
+ /**
1258
+ * Start paying for `quantity` more units of an add-on (`extra_project`, `custom_domains`,
1259
+ * `extra_environment`), prorated to the period end. Returns a Razorpay order to open in Checkout;
1260
+ * the units count once the payment is verified (`razorpayVerifyPayment`). Uses the scoped org.
1261
+ */
1262
+ addonCheckout: (accountId: string, addonId: string, quantity?: number, projectId?: string) => Promise<JsonObject>;
1263
+ /** How many units renew at the period end (0 cancels). Units already paid for keep working until then. */
1264
+ setAddonRenewal: (accountId: string, addonId: string, renewQuantity: number) => Promise<JsonObject>;
1265
+ /** ₹1 (refunded) authorisation that saves a card or UPI mandate; open it in Checkout with `recurring: '1'`. */
1266
+ autopaySetup: (accountId: string, body?: {
1267
+ customer_email?: string;
1268
+ name?: string;
1269
+ }) => Promise<JsonObject>;
1270
+ /** Remove the saved mandate; renewals become invoices to pay by hand. */
1271
+ removeAutopayMandate: (accountId: string) => Promise<JsonObject>;
1272
+ };
1273
+ /** The complete API, generated from spec/sovaria-api.json (same surface in every SDK language). */
1274
+ readonly api: {
1275
+ ai: {
1276
+ gatewayOverview: () => Promise<JsonValue>;
1277
+ saveGatewayRoute: (args: {
1278
+ name: string;
1279
+ body: JsonObject;
1280
+ }) => Promise<JsonValue>;
1281
+ deleteGatewayRoute: (args: {
1282
+ name: string;
1283
+ }) => Promise<JsonValue>;
1284
+ gatewayComplete: (args: {
1285
+ route: string;
1286
+ messages: JsonValue;
1287
+ system?: JsonValue;
1288
+ maxTokens?: JsonValue;
1289
+ cache?: JsonValue;
1290
+ }) => Promise<JsonValue>;
1291
+ gatewayUsage: (args?: {
1292
+ days?: JsonValue;
1293
+ }) => Promise<JsonValue>;
1294
+ clearGatewayCache: () => Promise<JsonValue>;
1295
+ listAgentVersions: (args: {
1296
+ agentId: string;
1297
+ }) => Promise<JsonValue>;
1298
+ publishAgentVersion: (args: {
1299
+ agentId: string;
1300
+ note?: JsonValue;
1301
+ }) => Promise<JsonValue>;
1302
+ getAgentVersion: (args: {
1303
+ agentId: string;
1304
+ version: string;
1305
+ }) => Promise<JsonValue>;
1306
+ compareAgentVersions: (args: {
1307
+ agentId: string;
1308
+ a: JsonValue;
1309
+ b?: JsonValue;
1310
+ }) => Promise<JsonValue>;
1311
+ rollbackAgentVersion: (args: {
1312
+ agentId: string;
1313
+ version: string;
1314
+ note?: JsonValue;
1315
+ }) => Promise<JsonValue>;
1316
+ };
1317
+ analytics: {
1318
+ overview: (args?: {
1319
+ days?: JsonValue;
1320
+ }) => Promise<JsonValue>;
1321
+ listEvents: (args?: {
1322
+ days?: JsonValue;
1323
+ }) => Promise<JsonValue>;
1324
+ eventTrend: (args: {
1325
+ name: string;
1326
+ days?: JsonValue;
1327
+ }) => Promise<JsonValue>;
1328
+ funnel: (args: {
1329
+ steps: JsonValue;
1330
+ windowHours?: JsonValue;
1331
+ days?: JsonValue;
1332
+ }) => Promise<JsonValue>;
1333
+ retention: (args?: {
1334
+ startEvent?: JsonValue;
1335
+ returnEvent?: JsonValue;
1336
+ period?: JsonValue;
1337
+ periods?: JsonValue;
1338
+ }) => Promise<JsonValue>;
1339
+ listUsers: (args?: {
1340
+ q?: JsonValue;
1341
+ limit?: JsonValue;
1342
+ }) => Promise<JsonValue>;
1343
+ getUser: (args: {
1344
+ userKey: string;
1345
+ limit?: JsonValue;
1346
+ }) => Promise<JsonValue>;
1347
+ eraseUser: (args: {
1348
+ userKey: string;
1349
+ }) => Promise<JsonValue>;
1350
+ live: (args?: {
1351
+ since?: JsonValue;
1352
+ limit?: JsonValue;
1353
+ }) => Promise<JsonValue>;
1354
+ usage: () => Promise<JsonValue>;
1355
+ getSettings: () => Promise<JsonValue>;
1356
+ putSettings: (args: {
1357
+ requireConsent: JsonValue;
1358
+ }) => Promise<JsonValue>;
1359
+ };
1360
+ attestation: {
1361
+ getConfig: (args?: {
1362
+ projectId?: string;
1363
+ }) => Promise<JsonValue>;
1364
+ updateConfig: (args: {
1365
+ projectId?: string;
1366
+ body: JsonObject;
1367
+ }) => Promise<JsonValue>;
1368
+ setGoogleCredentials: (args: {
1369
+ projectId?: string;
1370
+ serviceAccount: JsonValue;
1371
+ }) => Promise<JsonValue>;
1372
+ setAppleCredentials: (args: {
1373
+ projectId?: string;
1374
+ p8: JsonValue;
1375
+ keyId: JsonValue;
1376
+ teamId: JsonValue;
1377
+ }) => Promise<JsonValue>;
1378
+ deleteCredentials: (args: {
1379
+ projectId?: string;
1380
+ which: string;
1381
+ }) => Promise<JsonValue>;
1382
+ createDebugToken: (args?: {
1383
+ projectId?: string;
1384
+ name?: JsonValue;
1385
+ }) => Promise<JsonValue>;
1386
+ deleteDebugToken: (args: {
1387
+ projectId?: string;
1388
+ tokenId: string;
1389
+ }) => Promise<JsonValue>;
1390
+ challenge: () => Promise<JsonValue>;
1391
+ exchange: (args: {
1392
+ provider: JsonValue;
1393
+ appId?: JsonValue;
1394
+ challenge?: JsonValue;
1395
+ token?: JsonValue;
1396
+ keyId?: JsonValue;
1397
+ attestation?: JsonValue;
1398
+ assertion?: JsonValue;
1399
+ development?: JsonValue;
1400
+ }) => Promise<JsonValue>;
1401
+ };
1402
+ auth: {
1403
+ confirmVerificationEmail: (args: {
1404
+ token: JsonValue;
1405
+ }) => Promise<JsonValue>;
1406
+ disableMfa: (args: {
1407
+ totpCode: JsonValue;
1408
+ }) => Promise<JsonValue>;
1409
+ enrollMfa: () => Promise<JsonValue>;
1410
+ getMfaStatus: () => Promise<JsonValue>;
1411
+ getProvidersConfig: () => Promise<JsonValue>;
1412
+ getSessionsConfig: () => Promise<JsonValue>;
1413
+ listConsoleProductUsers: () => Promise<JsonValue>;
1414
+ listSessions: () => Promise<JsonValue>;
1415
+ revokeOtherSessions: () => Promise<JsonValue>;
1416
+ revokeSession: (args: {
1417
+ sessionId: string;
1418
+ }) => Promise<JsonValue>;
1419
+ sendVerificationEmail: () => Promise<JsonValue>;
1420
+ updateProvidersConfig: (args: {
1421
+ body: JsonObject;
1422
+ }) => Promise<JsonValue>;
1423
+ updateSessionsConfig: (args: {
1424
+ body: JsonObject;
1425
+ }) => Promise<JsonValue>;
1426
+ listDevices: () => Promise<JsonValue>;
1427
+ signOutDevice: (args: {
1428
+ deviceId: string;
1429
+ }) => Promise<JsonValue>;
1430
+ passkeyRegisterStart: (args?: {
1431
+ name?: JsonValue;
1432
+ }) => Promise<JsonValue>;
1433
+ passkeyRegisterFinish: (args: {
1434
+ credential: JsonValue;
1435
+ name?: JsonValue;
1436
+ }) => Promise<JsonValue>;
1437
+ passkeyAuthenticateStart: (args?: {
1438
+ userId?: JsonValue;
1439
+ }) => Promise<JsonValue>;
1440
+ passkeyAuthenticateFinish: (args: {
1441
+ challengeId: JsonValue;
1442
+ credential: JsonValue;
1443
+ }) => Promise<JsonValue>;
1444
+ listPasskeys: () => Promise<JsonValue>;
1445
+ deletePasskey: (args: {
1446
+ passkeyId: string;
1447
+ }) => Promise<JsonValue>;
1448
+ };
1449
+ billing: {
1450
+ buildInvoice: (args?: {
1451
+ orgId?: string;
1452
+ period?: JsonValue;
1453
+ }) => Promise<JsonValue>;
1454
+ cancelAccount: (args: {
1455
+ accountId: string;
1456
+ }) => Promise<JsonValue>;
1457
+ checkout: (args: {
1458
+ body: JsonObject;
1459
+ }) => Promise<JsonValue>;
1460
+ getAccount: (args: {
1461
+ accountId: string;
1462
+ }) => Promise<JsonValue>;
1463
+ getAccountOverage: (args: {
1464
+ accountId: string;
1465
+ }) => Promise<JsonValue>;
1466
+ getAccountOveragePrefs: (args: {
1467
+ accountId: string;
1468
+ }) => Promise<JsonValue>;
1469
+ getOrgOveragePrefs: (args?: {
1470
+ orgId?: string;
1471
+ }) => Promise<JsonValue>;
1472
+ getCompute: (args?: {
1473
+ orgId?: string;
1474
+ period?: JsonValue;
1475
+ }) => Promise<JsonValue>;
1476
+ getFx: () => Promise<JsonValue>;
1477
+ getOpenInvoice: () => Promise<JsonValue>;
1478
+ getOverage: (args?: {
1479
+ orgId?: string;
1480
+ }) => Promise<JsonValue>;
1481
+ getPlan: (args: {
1482
+ name: string;
1483
+ }) => Promise<JsonValue>;
1484
+ getProvider: () => Promise<JsonValue>;
1485
+ getSubscription: (args?: {
1486
+ orgId?: string;
1487
+ }) => Promise<JsonValue>;
1488
+ getUsage: (args?: {
1489
+ orgId?: string;
1490
+ period?: JsonValue;
1491
+ }) => Promise<JsonValue>;
1492
+ getUsageHistory: (args?: {
1493
+ orgId?: string;
1494
+ months?: JsonValue;
1495
+ }) => Promise<JsonValue>;
1496
+ listInvoices: (args?: {
1497
+ orgId?: string;
1498
+ }) => Promise<JsonValue>;
1499
+ listPlans: () => Promise<JsonValue>;
1500
+ listSubscriptions: () => Promise<JsonValue>;
1501
+ payInvoice: (args: {
1502
+ orgId?: string;
1503
+ period: string;
1504
+ }) => Promise<JsonValue>;
1505
+ razorpayCreateOrder: (args: {
1506
+ body: JsonObject;
1507
+ }) => Promise<JsonValue>;
1508
+ razorpayVerifyPayment: (args: {
1509
+ body: JsonObject;
1510
+ }) => Promise<JsonValue>;
1511
+ resumeAccount: (args: {
1512
+ accountId: string;
1513
+ }) => Promise<JsonValue>;
1514
+ setAccountOveragePrefs: (args: {
1515
+ accountId: string;
1516
+ services: JsonValue;
1517
+ }) => Promise<JsonValue>;
1518
+ setOrgOveragePrefs: (args: {
1519
+ orgId?: string;
1520
+ services: JsonValue;
1521
+ }) => Promise<JsonValue>;
1522
+ listAccountAddons: (args: {
1523
+ accountId: string;
1524
+ }) => Promise<JsonValue>;
1525
+ addonCheckout: (args: {
1526
+ accountId: string;
1527
+ addonId: string;
1528
+ quantity: JsonValue;
1529
+ projectId?: JsonValue;
1530
+ }) => Promise<JsonValue>;
1531
+ setAddonRenewal: (args: {
1532
+ accountId: string;
1533
+ addonId: string;
1534
+ renewQuantity: JsonValue;
1535
+ }) => Promise<JsonValue>;
1536
+ setAccountAddon: (args: {
1537
+ accountId: string;
1538
+ addonId: string;
1539
+ enabled: JsonValue;
1540
+ quantity?: JsonValue;
1541
+ }) => Promise<JsonValue>;
1542
+ setAccountAutopay: (args: {
1543
+ accountId: string;
1544
+ enabled: JsonValue;
1545
+ }) => Promise<JsonValue>;
1546
+ autopaySetup: (args: {
1547
+ accountId: string;
1548
+ customerEmail?: JsonValue;
1549
+ name? /** Refresh when the token is near expiry, or always with `force` (the server said 401). */: JsonValue;
1550
+ }) => Promise<JsonValue>;
1551
+ removeAutopayMandate: (args: {
1552
+ accountId: string;
1553
+ }) => Promise<JsonValue>;
1554
+ billingListAddonPrices: () => Promise<JsonValue>;
1555
+ };
1556
+ builds: {
1557
+ check: (args: {
1558
+ build: JsonValue;
1559
+ }) => Promise<JsonValue>;
1560
+ list: (args?: {
1561
+ limit?: JsonValue;
1562
+ }) => Promise<JsonValue>;
1563
+ get: (args: {
1564
+ buildId: string;
1565
+ }) => Promise<JsonValue>;
1566
+ pullRequest: (args: {
1567
+ buildId: string;
1568
+ token?: JsonValue;
1569
+ }) => Promise<JsonValue>;
1570
+ delete: (args: {
1571
+ buildId: string;
1572
+ }) => Promise<JsonValue>;
1573
+ };
1574
+ byok: {
1575
+ get: () => Promise<JsonValue>;
1576
+ set: (args: {
1577
+ provider?: JsonValue;
1578
+ keyRef: JsonValue;
1579
+ }) => Promise<JsonValue>;
1580
+ rotate: () => Promise<JsonValue>;
1581
+ check: () => Promise<JsonValue>;
1582
+ reencryptStorage: () => Promise<JsonValue>;
1583
+ };
1584
+ compliance: {
1585
+ overview: (args?: {
1586
+ orgId?: string;
1587
+ projectId?: JsonValue;
1588
+ }) => Promise<JsonValue>;
1589
+ };
1590
+ crashes: {
1591
+ listIssues: (args?: {
1592
+ status?: JsonValue;
1593
+ limit?: JsonValue;
1594
+ release?: JsonValue;
1595
+ environment?: JsonValue;
1596
+ platform?: JsonValue;
1597
+ q?: JsonValue;
1598
+ sort?: JsonValue;
1599
+ handled?: JsonValue;
1600
+ }) => Promise<JsonValue>;
1601
+ getIssue: (args: {
1602
+ fingerprint: string;
1603
+ }) => Promise<JsonValue>;
1604
+ setIssueStatus: (args: {
1605
+ fingerprint: string;
1606
+ status: JsonValue;
1607
+ }) => Promise<JsonValue>;
1608
+ usage: () => Promise<JsonValue>;
1609
+ trends: (args?: {
1610
+ days?: JsonValue;
1611
+ release? /** Read then write atomically; retried (up to `maxAttempts`) when a document it read changes meanwhile. */: JsonValue;
1612
+ environment?: JsonValue;
1613
+ platform?: JsonValue;
1614
+ }) => Promise<JsonValue>;
1615
+ releases: (args?: {
1616
+ days?: JsonValue;
1617
+ environment?: JsonValue;
1618
+ platform?: JsonValue;
1619
+ limit?: JsonValue;
1620
+ }) => Promise<JsonValue>;
1621
+ listDebugFiles: (args?: {
1622
+ kind?: JsonValue;
1623
+ release?: JsonValue;
1624
+ }) => Promise<JsonValue>;
1625
+ deleteDebugFile: (args: {
1626
+ fileId: string;
1627
+ }) => Promise<JsonValue>;
1628
+ };
1629
+ data: {
1630
+ addColumn: (args: {
1631
+ tableName: JsonValue;
1632
+ columnName: JsonValue;
1633
+ dataType: JsonValue;
1634
+ isNullable?: JsonValue;
1635
+ isUnique?: JsonValue;
1636
+ defaultValue?: JsonValue;
1637
+ }) => Promise<JsonValue>;
1638
+ addForeignKey: (args: {
1639
+ tableName: JsonValue;
1640
+ columnName: JsonValue;
1641
+ referencedTable: JsonValue;
1642
+ referencedColumn: JsonValue;
1643
+ }) => Promise<JsonValue>;
1644
+ beginTransaction: () => Promise<JsonValue>;
1645
+ commitTransaction: (args: {
1646
+ txid: JsonValue;
1647
+ }) => Promise<JsonValue>;
1648
+ dropColumn: (args: {
1649
+ tableName: JsonValue;
1650
+ columnName: JsonValue;
1651
+ }) => Promise<JsonValue>;
1652
+ dropForeignKey: (args: {
1653
+ tableName: JsonValue;
1654
+ columnName: JsonValue;
1655
+ referencedTable: JsonValue;
1656
+ referencedColumn: JsonValue;
1657
+ }) => Promise<JsonValue>;
1658
+ dropTable: (args: {
1659
+ tableName: JsonValue;
1660
+ }) => Promise<JsonValue>;
1661
+ rollbackTransaction: (args: {
1662
+ txid: JsonValue;
1663
+ }) => Promise<JsonValue>;
1664
+ tableHistory: () => Promise<JsonValue>;
1665
+ setTableHistory: (args: {
1666
+ tableName: JsonValue;
1667
+ enabled: JsonValue;
1668
+ keepDays?: JsonValue;
1669
+ }) => Promise<JsonValue>;
1670
+ schemaDigest: (args?: {
1671
+ tables?: JsonValue;
1672
+ maxChars?: JsonValue;
1673
+ since?: JsonValue;
1674
+ }) => Promise<JsonValue>;
1675
+ applySchemaPlan: (args: {
1676
+ tables: JsonValue;
1677
+ dryRun?: JsonValue;
1678
+ name?: JsonValue;
1679
+ }) => Promise<JsonValue>;
1680
+ applyMigration: (args: {
1681
+ name: JsonValue;
1682
+ upSql: JsonValue;
1683
+ downSql?: JsonValue;
1684
+ version?: JsonValue;
1685
+ }) => Promise<JsonValue>;
1686
+ dryRunMigration: (args: {
1687
+ name: JsonValue;
1688
+ upSql: JsonValue;
1689
+ downSql?: JsonValue;
1690
+ }) => Promise<JsonValue>;
1691
+ dryRunMigrations: (args: {
1692
+ migrations: JsonValue;
1693
+ }) => Promise<JsonValue>;
1694
+ rollbackMigration: (args?: {
1695
+ version?: JsonValue;
1696
+ force?: JsonValue;
1697
+ }) => Promise<JsonValue>;
1698
+ resetMigrations: (args?: {
1699
+ dryRun?: JsonValue;
1700
+ }) => Promise<JsonValue>;
1701
+ docPipeline: (args: {
1702
+ collection: string;
1703
+ stages: JsonValue;
1704
+ collectionGroup?: JsonValue;
1705
+ }) => Promise<JsonValue>;
1706
+ schemaDiff: (args: {
1707
+ fromEnv: JsonValue;
1708
+ toEnv?: JsonValue;
1709
+ }) => Promise<JsonValue>;
1710
+ promoteEnvironment: (args: {
1711
+ fromEnvId: JsonValue;
1712
+ toEnvId?: JsonValue;
1713
+ fromName?: JsonValue;
1714
+ toName?: JsonValue;
1715
+ dryRun?: JsonValue;
1716
+ acceptViolations?: JsonValue;
1717
+ }) => Promise<JsonValue>;
1718
+ };
1719
+ deadLetters: {
1720
+ list: (args?: {
1721
+ functionName?: JsonValue;
1722
+ triggerId?: JsonValue;
1723
+ limit?: JsonValue;
1724
+ offset?: JsonValue;
1725
+ }) => Promise<JsonValue>;
1726
+ replay: (args: {
1727
+ invocationId: string;
1728
+ }) => Promise<JsonValue>;
1729
+ replayMany: (args: {
1730
+ ids: JsonValue;
1731
+ }) => Promise<JsonValue>;
1732
+ discard: (args: {
1733
+ invocationId: string;
1734
+ }) => Promise<JsonValue>;
1735
+ };
1736
+ distribution: {
1737
+ overview: (args?: {
1738
+ projectId?: string;
1739
+ }) => Promise<JsonValue>;
1740
+ createRelease: (args: {
1741
+ projectId?: string;
1742
+ filename: JsonValue;
1743
+ sizeBytes: JsonValue;
1744
+ notes?: JsonValue;
1745
+ groups?: JsonValue;
1746
+ env?: JsonValue;
1747
+ gitRef?: JsonValue;
1748
+ appId?: JsonValue;
1749
+ notify?: JsonValue;
1750
+ }) => Promise<JsonValue>;
1751
+ finalizeRelease: (args: {
1752
+ projectId?: string;
1753
+ releaseId: string;
1754
+ }) => Promise<JsonValue>;
1755
+ updateRelease: (args: {
1756
+ projectId?: string;
1757
+ releaseId: string;
1758
+ notes?: JsonValue;
1759
+ groups?: JsonValue;
1760
+ }) => Promise<JsonValue>;
1761
+ deleteRelease: (args: {
1762
+ projectId?: string;
1763
+ releaseId: string;
1764
+ }) => Promise<JsonValue>;
1765
+ addTesters: (args: {
1766
+ projectId?: string;
1767
+ emails: JsonValue;
1768
+ groups?: JsonValue;
1769
+ sendInvite?: JsonValue;
1770
+ }) => Promise<JsonValue>;
1771
+ removeTester: (args: {
1772
+ projectId?: string;
1773
+ testerId: string;
1774
+ }) => Promise<JsonValue>;
1775
+ resendInvite: (args: {
1776
+ projectId?: string;
1777
+ testerId: string;
1778
+ }) => Promise<JsonValue>;
1779
+ deleteGroup: (args: {
1780
+ projectId?: string;
1781
+ name: string;
1782
+ }) => Promise<JsonValue>;
1783
+ };
1784
+ e2ee: {
1785
+ bootstrapKey: (args: {
1786
+ channel: JsonValue;
1787
+ ttlSeconds?: JsonValue;
1788
+ forceNew?: JsonValue;
1789
+ }) => Promise<JsonValue>;
1790
+ getActiveKey: (args: {
1791
+ channel: string;
1792
+ clientPublicKey?: JsonValue;
1793
+ }) => Promise<JsonValue>;
1794
+ getKey: (args: {
1795
+ channel: string;
1796
+ keyId: string;
1797
+ clientPublicKey?: JsonValue;
1798
+ }) => Promise<JsonValue>;
1799
+ listKeys: (args: {
1800
+ channel: string;
1801
+ }) => Promise<JsonValue>;
1802
+ revokeKey: (args: {
1803
+ channel: JsonValue;
1804
+ keyId?: JsonValue;
1805
+ reason?: JsonValue;
1806
+ }) => Promise<JsonValue>;
1807
+ rotateKey: (args: {
1808
+ channel: JsonValue;
1809
+ ttlSeconds?: JsonValue;
1810
+ }) => Promise<JsonValue>;
1811
+ };
1812
+ embeddings: {
1813
+ getSettings: () => Promise<JsonValue>;
1814
+ setSettings: (args: {
1815
+ body: JsonObject;
1816
+ }) => Promise<JsonValue>;
1817
+ clearSettings: () => Promise<JsonValue>;
1818
+ usage: (args?: {
1819
+ months?: JsonValue;
1820
+ }) => Promise<JsonValue>;
1821
+ };
1822
+ experiments: {
1823
+ listExperiments: (args?: {
1824
+ projectId?: string;
1825
+ env?: JsonValue;
1826
+ }) => Promise<JsonValue>;
1827
+ createExperiment: (args: {
1828
+ projectId?: string;
1829
+ name: JsonValue;
1830
+ param: JsonValue;
1831
+ variants: JsonValue;
1832
+ control?: JsonValue;
1833
+ condition?: JsonValue;
1834
+ exposurePct?: JsonValue;
1835
+ goal: JsonValue;
1836
+ minSample?: JsonValue;
1837
+ description?: JsonValue;
1838
+ env?: JsonValue;
1839
+ }) => Promise<JsonValue>;
1840
+ getExperiment: (args: {
1841
+ projectId?: string;
1842
+ ref: string;
1843
+ env?: JsonValue;
1844
+ }) => Promise<JsonValue>;
1845
+ updateExperiment: (args: {
1846
+ projectId?: string;
1847
+ ref: string;
1848
+ variants?: JsonValue;
1849
+ control?: JsonValue;
1850
+ exposurePct?: JsonValue;
1851
+ goal?: JsonValue;
1852
+ minSample?: JsonValue;
1853
+ description?: JsonValue;
1854
+ env?: JsonValue;
1855
+ }) => Promise<JsonValue>;
1856
+ deleteExperiment: (args: {
1857
+ projectId?: string;
1858
+ ref: string;
1859
+ env?: JsonValue;
1860
+ }) => Promise<JsonValue>;
1861
+ startExperiment: (args: {
1862
+ projectId?: string;
1863
+ ref: string;
1864
+ env?: JsonValue;
1865
+ }) => Promise<JsonValue>;
1866
+ stopExperiment: (args: {
1867
+ projectId?: string;
1868
+ ref: string;
1869
+ winner?: JsonValue;
1870
+ env?: JsonValue;
1871
+ }) => Promise<JsonValue>;
1872
+ results: (args: {
1873
+ projectId?: string;
1874
+ ref: string;
1875
+ env?: JsonValue;
1876
+ }) => Promise<JsonValue>;
1877
+ rollout: (args: {
1878
+ projectId?: string;
1879
+ ref: string;
1880
+ variant?: JsonValue;
1881
+ env?: JsonValue;
1882
+ }) => Promise<JsonValue>;
1883
+ };
1884
+ functions: {
1885
+ delete: (args: {
1886
+ functionName: string;
1887
+ }) => Promise<JsonValue>;
1888
+ get: (args: {
1889
+ functionName: string;
1890
+ projectId?: JsonValue;
1891
+ }) => Promise<JsonValue>;
1892
+ getBindings: (args: {
1893
+ functionName: string;
1894
+ }) => Promise<JsonValue>;
1895
+ getPolicy: (args: {
1896
+ functionName: string;
1897
+ }) => Promise<JsonValue>;
1898
+ getSource: (args: {
1899
+ functionName: string;
1900
+ projectId?: JsonValue;
1901
+ }) => Promise<JsonValue>;
1902
+ githubCommit: (args: {
1903
+ body: JsonObject;
1904
+ }) => Promise<JsonValue>;
1905
+ githubImport: (args: {
1906
+ body: JsonObject;
1907
+ }) => Promise<JsonValue>;
1908
+ invocationStatus: (args: {
1909
+ invocationId: string;
1910
+ projectId?: JsonValue;
1911
+ }) => Promise<JsonValue>;
1912
+ list: (args?: {
1913
+ projectId?: JsonValue;
1914
+ limit?: JsonValue;
1915
+ offset?: JsonValue;
1916
+ }) => Promise<JsonValue>;
1917
+ simulationDiff: (args: {
1918
+ functionName: string;
1919
+ projectId?: JsonValue;
1920
+ leftInvocationId?: JsonValue;
1921
+ rightInvocationId?: JsonValue;
1922
+ }) => Promise<JsonValue>;
1923
+ status: (args: {
1924
+ deployId: string;
1925
+ projectId?: JsonValue;
1926
+ }) => Promise<JsonValue>;
1927
+ update: (args: {
1928
+ functionName: string;
1929
+ body: JsonObject;
1930
+ projectId?: JsonValue;
1931
+ }) => Promise<JsonValue>;
1932
+ updateBindings: (args: {
1933
+ functionName: string;
1934
+ bindings: JsonValue;
1935
+ }) => Promise<JsonValue>;
1936
+ updatePolicy: (args: {
1937
+ functionName: string;
1938
+ policy: JsonObject;
1939
+ }) => Promise<JsonValue>;
1940
+ versions: (args: {
1941
+ functionName: string;
1942
+ projectId?: JsonValue;
1943
+ limit?: JsonValue;
1944
+ offset?: JsonValue;
1945
+ }) => Promise<JsonValue>;
1946
+ listGithubPreviews: () => Promise<JsonValue>;
1947
+ getFunctionLimits: (args: {
1948
+ functionName: string;
1949
+ }) => Promise<JsonValue>;
1950
+ setFunctionLimits: (args: {
1951
+ functionName: string;
1952
+ timeoutSec?: JsonValue;
1953
+ memoryMb?: JsonValue;
1954
+ minInstances?: JsonValue;
1955
+ }) => Promise<JsonValue>;
1956
+ };
1957
+ governance: {
1958
+ adminDatabases: () => Promise<JsonValue>;
1959
+ getTenant: (args?: {
1960
+ orgId?: string;
1961
+ }) => Promise<JsonValue>;
1962
+ getTenantDatabaseConnection: (args?: {
1963
+ orgId?: string;
1964
+ projectId?: string;
1965
+ }) => Promise<JsonValue>;
1966
+ listHosts: (args?: {
1967
+ regionId?: JsonValue;
1968
+ }) => Promise<JsonValue>;
1969
+ listRegions: () => Promise<JsonValue>;
1970
+ listTenantDatabaseBackups: (args?: {
1971
+ orgId?: string;
1972
+ projectId?: string;
1973
+ limit?: JsonValue;
1974
+ }) => Promise<JsonValue>;
1975
+ listTenantDatabases: (args?: {
1976
+ orgId?: string;
1977
+ }) => Promise<JsonValue>;
1978
+ listTenants: () => Promise<JsonValue>;
1979
+ metricsOverview: () => Promise<JsonValue>;
1980
+ patchHost: (args: {
1981
+ hostId: string;
1982
+ body: JsonObject;
1983
+ }) => Promise<JsonValue>;
1984
+ patchRegion: (args: {
1985
+ regionId: string;
1986
+ body: JsonObject;
1987
+ }) => Promise<JsonValue>;
1988
+ pauseTenantDatabase: (args?: {
1989
+ orgId?: string;
1990
+ projectId?: string;
1991
+ }) => Promise<JsonValue>;
1992
+ resizeTenantDatabase: (args: {
1993
+ orgId?: string;
1994
+ projectId?: string;
1995
+ computeSize: JsonValue;
1996
+ }) => Promise<JsonValue>;
1997
+ resumeTenantDatabase: (args?: {
1998
+ orgId?: string;
1999
+ projectId?: string;
2000
+ }) => Promise<JsonValue>;
2001
+ revealTenantDatabaseConnection: (args: {
2002
+ orgId?: string;
2003
+ projectId?: string;
2004
+ grantId: JsonValue;
2005
+ }) => Promise<JsonValue>;
2006
+ setTenantStatus: (args: {
2007
+ orgId?: string;
2008
+ status: JsonValue;
2009
+ }) => Promise<JsonValue>;
2010
+ triggerTenantDatabaseBackup: (args?: {
2011
+ orgId?: string;
2012
+ projectId?: string;
2013
+ }) => Promise<JsonValue>;
2014
+ listDatabaseReplicas: (args?: {
2015
+ orgId?: string;
2016
+ projectId?: string;
2017
+ }) => Promise<JsonValue>;
2018
+ createDatabaseReplica: (args?: {
2019
+ orgId?: string;
2020
+ projectId?: string;
2021
+ }) => Promise<JsonValue>;
2022
+ deleteDatabaseReplica: (args: {
2023
+ orgId?: string;
2024
+ projectId?: string;
2025
+ replicaId: string;
2026
+ }) => Promise<JsonValue>;
2027
+ compareDatabaseMoments: (args: {
2028
+ orgId?: string;
2029
+ projectId?: string;
2030
+ fromMoment: JsonValue;
2031
+ toMoment?: JsonValue;
2032
+ includePlatform?: JsonValue;
2033
+ }) => Promise<JsonValue>;
2034
+ restoreDatabaseBackup: (args: {
2035
+ orgId?: string;
2036
+ projectId?: string;
2037
+ backupId: string;
2038
+ confirm: JsonValue;
2039
+ }) => Promise<JsonValue>;
2040
+ listDatabaseRestores: (args?: {
2041
+ orgId?: string;
2042
+ projectId?: string;
2043
+ }) => Promise<JsonValue>;
2044
+ undoDatabaseRestore: (args: {
2045
+ orgId?: string;
2046
+ projectId?: string;
2047
+ restoreId: string;
2048
+ }) => Promise<JsonValue>;
2049
+ getPitrStatus: (args?: {
2050
+ orgId?: string;
2051
+ projectId?: string;
2052
+ }) => Promise<JsonValue>;
2053
+ enablePitr: (args?: {
2054
+ orgId?: string;
2055
+ projectId?: string;
2056
+ restart?: JsonValue;
2057
+ }) => Promise<JsonValue>;
2058
+ disablePitr: (args?: {
2059
+ orgId?: string;
2060
+ projectId?: string;
2061
+ }) => Promise<JsonValue>;
2062
+ restoreDatabaseToTime: (args: {
2063
+ orgId?: string;
2064
+ projectId?: string;
2065
+ targetTime: JsonValue;
2066
+ confirm?: JsonValue;
2067
+ verifyOnly?: JsonValue;
2068
+ }) => Promise<JsonValue>;
2069
+ getRestoreJob: (args: {
2070
+ orgId?: string;
2071
+ projectId?: string;
2072
+ jobId: string;
2073
+ }) => Promise<JsonValue>;
2074
+ listEnvironments: (args?: {
2075
+ orgId?: string;
2076
+ projectId?: string;
2077
+ }) => Promise<JsonValue>;
2078
+ createEnvironment: (args: {
2079
+ orgId?: string;
2080
+ projectId?: string;
2081
+ envId: JsonValue;
2082
+ name: JsonValue;
2083
+ kind?: JsonValue;
2084
+ label?: JsonValue;
2085
+ fromEnvId?: JsonValue;
2086
+ database?: JsonValue;
2087
+ sampleRows?: JsonValue;
2088
+ includeTables?: JsonValue;
2089
+ excludeTables?: JsonValue;
2090
+ mask?: JsonValue;
2091
+ maskAdd?: JsonValue;
2092
+ maskSkip?: JsonValue;
2093
+ protected?: JsonValue;
2094
+ expiresInDays?: JsonValue;
2095
+ }) => Promise<JsonValue>;
2096
+ getEnvironmentCopy: (args: {
2097
+ orgId?: string;
2098
+ projectId?: string;
2099
+ envId: string;
2100
+ }) => Promise<JsonValue>;
2101
+ deleteEnvironment: (args: {
2102
+ orgId?: string;
2103
+ projectId?: string;
2104
+ envId: string;
2105
+ }) => Promise<JsonValue>;
2106
+ queryInsights: (args?: {
2107
+ orgId?: string;
2108
+ projectId?: string;
2109
+ sort?: JsonValue;
2110
+ limit?: JsonValue;
2111
+ }) => Promise<JsonValue>;
2112
+ resetQueryInsights: (args?: {
2113
+ orgId?: string;
2114
+ projectId?: string;
2115
+ }) => Promise<JsonValue>;
2116
+ indexAdvisor: (args?: {
2117
+ orgId?: string;
2118
+ projectId?: string;
2119
+ queryid?: JsonValue;
2120
+ }) => Promise<JsonValue>;
2121
+ indexAdvisorForQuery: (args: {
2122
+ orgId?: string;
2123
+ projectId?: string;
2124
+ query: JsonValue;
2125
+ }) => Promise<JsonValue>;
2126
+ applyIndex: (args: {
2127
+ orgId?: string;
2128
+ projectId?: string;
2129
+ schema?: JsonValue;
2130
+ table: JsonValue;
2131
+ columns: JsonValue;
2132
+ }) => Promise<JsonValue>;
2133
+ indexStatus: (args: {
2134
+ orgId?: string;
2135
+ projectId?: string;
2136
+ indexName: string;
2137
+ }) => Promise<JsonValue>;
2138
+ updateEnvironment: (args: {
2139
+ orgId?: string;
2140
+ projectId?: string;
2141
+ envId: string;
2142
+ kind?: JsonValue;
2143
+ label?: JsonValue;
2144
+ protected?: JsonValue;
2145
+ expiresInDays?: JsonValue;
2146
+ }) => Promise<JsonValue>;
2147
+ resetEnvironment: (args: {
2148
+ orgId?: string;
2149
+ projectId?: string;
2150
+ envId: string;
2151
+ confirm: JsonValue;
2152
+ }) => Promise<JsonValue>;
2153
+ restoreEnvironment: (args: {
2154
+ orgId?: string;
2155
+ projectId?: string;
2156
+ envId: string;
2157
+ at: JsonValue;
2158
+ confirm: JsonValue;
2159
+ }) => Promise<JsonValue>;
2160
+ getEnvironmentRestore: (args: {
2161
+ orgId?: string;
2162
+ projectId?: string;
2163
+ envId: string;
2164
+ restoreId: string;
2165
+ }) => Promise<JsonValue>;
2166
+ getBackupHealth: (args?: {
2167
+ orgId?: string;
2168
+ projectId?: string;
2169
+ }) => Promise<JsonValue>;
2170
+ listProjectExports: (args?: {
2171
+ orgId?: string;
2172
+ projectId?: string;
2173
+ limit?: JsonValue;
2174
+ }) => Promise<JsonValue>;
2175
+ triggerProjectExport: (args?: {
2176
+ orgId?: string;
2177
+ projectId?: string;
2178
+ }) => Promise<JsonValue>;
2179
+ getCompare: (args: {
2180
+ orgId?: string;
2181
+ projectId?: string;
2182
+ compareId: string;
2183
+ }) => Promise<JsonValue>;
2184
+ restoreDatabaseInto: (args?: {
2185
+ orgId?: string;
2186
+ projectId?: string;
2187
+ envId?: JsonValue;
2188
+ targetProjectId?: JsonValue;
2189
+ backupId?: JsonValue;
2190
+ targetTime?: JsonValue;
2191
+ confirm?: JsonValue;
2192
+ reason?: JsonValue;
2193
+ }) => Promise<JsonValue>;
2194
+ restoreDatabaseTables: (args: {
2195
+ orgId?: string;
2196
+ projectId?: string;
2197
+ tables: JsonValue;
2198
+ backupId?: JsonValue;
2199
+ targetTime?: JsonValue;
2200
+ reason?: JsonValue;
2201
+ }) => Promise<JsonValue>;
2202
+ };
2203
+ history: {
2204
+ commit: (args: {
2205
+ timeline?: JsonValue;
2206
+ message: JsonValue;
2207
+ author?: JsonValue;
2208
+ eventType?: JsonValue;
2209
+ }) => Promise<JsonValue>;
2210
+ converge: (args: {
2211
+ target: JsonValue;
2212
+ source: JsonValue;
2213
+ author: JsonValue;
2214
+ message?: JsonValue;
2215
+ }) => Promise<JsonValue>;
2216
+ createSnapshot: (args?: {
2217
+ message?: JsonValue;
2218
+ timeline?: JsonValue;
2219
+ envId?: JsonValue;
2220
+ includeDatabase?: JsonValue;
2221
+ }) => Promise<JsonValue>;
2222
+ deleteTimeline: (args: {
2223
+ name: string;
2224
+ }) => Promise<JsonValue>;
2225
+ jumpTimeline: (args: {
2226
+ name: string;
2227
+ targetHex: JsonValue;
2228
+ }) => Promise<JsonValue>;
2229
+ listSnapshots: (args?: {
2230
+ timeline?: JsonValue;
2231
+ }) => Promise<JsonValue>;
2232
+ listTimelines: () => Promise<JsonValue>;
2233
+ restoreSnapshot: (args: {
2234
+ snapshotId: string;
2235
+ confirm?: JsonValue;
2236
+ includeDatabase?: JsonValue;
2237
+ includeSchema?: JsonValue;
2238
+ envId?: JsonValue;
2239
+ }) => Promise<JsonValue>;
2240
+ restoreSnapshotPlan: (args: {
2241
+ snapshotId: string;
2242
+ envId?: JsonValue;
2243
+ }) => Promise<JsonValue>;
2244
+ deleteSnapshot: (args: {
2245
+ snapshotId: string;
2246
+ }) => Promise<JsonValue>;
2247
+ spawnTimeline: (args: {
2248
+ name: JsonValue;
2249
+ sourceHexId?: JsonValue;
2250
+ }) => Promise<JsonValue>;
2251
+ timelineHistory: (args: {
2252
+ name: string;
2253
+ limit?: JsonValue;
2254
+ offset?: JsonValue;
2255
+ }) => Promise<JsonValue>;
2256
+ topology: (args?: {
2257
+ timeline?: JsonValue;
2258
+ limit?: JsonValue;
2259
+ }) => Promise<JsonValue>;
2260
+ variance: (args: {
2261
+ oldChrononHex: JsonValue;
2262
+ newChrononHex: JsonValue;
2263
+ domainFilter?: JsonValue;
2264
+ }) => Promise<JsonValue>;
2265
+ restorePlan: (args: {
2266
+ at: JsonValue;
2267
+ timeline?: JsonValue;
2268
+ envId?: JsonValue;
2269
+ only?: JsonValue;
2270
+ includeDatabase?: JsonValue;
2271
+ includeSchema?: JsonValue;
2272
+ }) => Promise<JsonValue>;
2273
+ restore: (args: {
2274
+ at: JsonValue;
2275
+ timeline?: JsonValue;
2276
+ envId?: JsonValue;
2277
+ only?: JsonValue;
2278
+ includeDatabase?: JsonValue;
2279
+ includeSchema?: JsonValue;
2280
+ confirm: JsonValue;
2281
+ }) => Promise<JsonValue>;
2282
+ commitChanges: (args: {
2283
+ hexId: string;
2284
+ compareTo?: JsonValue;
2285
+ }) => Promise<JsonValue>;
2286
+ undoPlan: (args: {
2287
+ hexId: string;
2288
+ timeline?: JsonValue;
2289
+ envId?: JsonValue;
2290
+ }) => Promise<JsonValue>;
2291
+ undo: (args: {
2292
+ hexId: string;
2293
+ confirm: JsonValue;
2294
+ timeline?: JsonValue;
2295
+ envId?: JsonValue;
2296
+ includeSchema?: JsonValue;
2297
+ }) => Promise<JsonValue>;
2298
+ listEnvironmentBranches: () => Promise<JsonValue>;
2299
+ bindEnvironment: (args: {
2300
+ envId: string;
2301
+ name: JsonValue;
2302
+ }) => Promise<JsonValue>;
2303
+ };
2304
+ knowledge: {
2305
+ list: () => Promise<JsonValue>;
2306
+ create: (args: {
2307
+ body: JsonObject;
2308
+ }) => Promise<JsonValue>;
2309
+ update: (args: {
2310
+ name: string;
2311
+ body: JsonObject;
2312
+ }) => Promise<JsonValue>;
2313
+ delete: (args: {
2314
+ name: string;
2315
+ }) => Promise<JsonValue>;
2316
+ listDocuments: (args: {
2317
+ name: string;
2318
+ limit?: JsonValue;
2319
+ offset?: JsonValue;
2320
+ }) => Promise<JsonValue>;
2321
+ addDocument: (args: {
2322
+ name: string;
2323
+ body: JsonObject;
2324
+ }) => Promise<JsonValue>;
2325
+ deleteDocument: (args: {
2326
+ name: string;
2327
+ documentId: string;
2328
+ }) => Promise<JsonValue>;
2329
+ search: (args: {
2330
+ name: string;
2331
+ body: JsonObject;
2332
+ }) => Promise<JsonValue>;
2333
+ listSources: (args: {
2334
+ name: string;
2335
+ }) => Promise<JsonValue>;
2336
+ };
2337
+ mcp: {
2338
+ listConnections: () => Promise<JsonValue>;
2339
+ disconnect: (args: {
2340
+ grantId: string;
2341
+ }) => Promise<JsonValue>;
2342
+ orgSettings: (args?: {
2343
+ orgId?: string;
2344
+ }) => Promise<JsonValue>;
2345
+ setOrgAllowed: (args: {
2346
+ orgId?: string;
2347
+ allowed: JsonValue;
2348
+ }) => Promise<JsonValue>;
2349
+ orgDisconnect: (args: {
2350
+ orgId?: string;
2351
+ grantId: string;
2352
+ }) => Promise<JsonValue>;
2353
+ };
2354
+ messaging: {
2355
+ listTemplates: (args?: {
2356
+ projectId?: string;
2357
+ }) => Promise<JsonValue>;
2358
+ getTemplate: (args: {
2359
+ projectId?: string;
2360
+ name: string;
2361
+ }) => Promise<JsonValue>;
2362
+ putTemplate: (args: {
2363
+ projectId?: string;
2364
+ name: string;
2365
+ description?: JsonValue;
2366
+ category?: JsonValue;
2367
+ push?: JsonValue;
2368
+ email?: JsonValue;
2369
+ }) => Promise<JsonValue>;
2370
+ deleteTemplate: (args: {
2371
+ projectId?: string;
2372
+ name: string;
2373
+ }) => Promise<JsonValue>;
2374
+ listAudiences: (args?: {
2375
+ projectId?: string;
2376
+ }) => Promise<JsonValue>;
2377
+ getAudience: (args: {
2378
+ projectId?: string;
2379
+ name: string;
2380
+ }) => Promise<JsonValue>;
2381
+ putAudience: (args: {
2382
+ projectId?: string;
2383
+ name: string;
2384
+ sql: JsonValue;
2385
+ description?: JsonValue;
2386
+ }) => Promise<JsonValue>;
2387
+ deleteAudience: (args: {
2388
+ projectId?: string;
2389
+ name: string;
2390
+ }) => Promise<JsonValue>;
2391
+ previewAudience: (args: {
2392
+ projectId?: string;
2393
+ name: string;
2394
+ }) => Promise<JsonValue>;
2395
+ previewSql: (args: {
2396
+ projectId?: string;
2397
+ sql: JsonValue;
2398
+ }) => Promise<JsonValue>;
2399
+ send: (args: {
2400
+ projectId?: string;
2401
+ template?: JsonValue;
2402
+ content?: JsonValue;
2403
+ to: JsonValue;
2404
+ channels?: JsonValue;
2405
+ variables?: JsonValue;
2406
+ category?: JsonValue;
2407
+ dryRun?: JsonValue;
2408
+ sendAt?: JsonValue;
2409
+ timezone?: JsonValue;
2410
+ timezoneFallback?: JsonValue;
2411
+ track?: JsonValue;
2412
+ }) => Promise<JsonValue>;
2413
+ listSends: (args?: {
2414
+ projectId?: string;
2415
+ limit?: JsonValue;
2416
+ }) => Promise<JsonValue>;
2417
+ getSend: (args: {
2418
+ projectId?: string;
2419
+ sendId: string;
2420
+ }) => Promise<JsonValue>;
2421
+ listDeliveries: (args?: {
2422
+ projectId?: string;
2423
+ sendId?: JsonValue;
2424
+ userId?: JsonValue;
2425
+ status?: JsonValue;
2426
+ limit?: JsonValue;
2427
+ offset?: JsonValue;
2428
+ }) => Promise<JsonValue>;
2429
+ usage: (args?: {
2430
+ projectId?: string;
2431
+ }) => Promise<JsonValue>;
2432
+ setUserOptout: (args: {
2433
+ projectId?: string;
2434
+ userId: string;
2435
+ channel: JsonValue;
2436
+ optedOut: JsonValue;
2437
+ }) => Promise<JsonValue>;
2438
+ getPreferences: () => Promise<JsonValue>;
2439
+ setPreferences: (args: {
2440
+ marketing: JsonValue;
2441
+ }) => Promise<JsonValue>;
2442
+ cancelSend: (args: {
2443
+ projectId?: string;
2444
+ sendId: string;
2445
+ }) => Promise<JsonValue>;
2446
+ listInApp: (args?: {
2447
+ projectId?: string;
2448
+ }) => Promise<JsonValue>;
2449
+ putInApp: (args: {
2450
+ projectId?: string;
2451
+ name: string;
2452
+ content: JsonValue;
2453
+ trigger?: JsonValue;
2454
+ audience?: JsonValue;
2455
+ status?: JsonValue;
2456
+ startsAt?: JsonValue;
2457
+ endsAt?: JsonValue;
2458
+ maxImpressions?: JsonValue;
2459
+ priority?: JsonValue;
2460
+ }) => Promise<JsonValue>;
2461
+ deleteInApp: (args: {
2462
+ projectId?: string;
2463
+ name: string;
2464
+ }) => Promise<JsonValue>;
2465
+ trackEvent: (args: {
2466
+ sendId: JsonValue;
2467
+ channel?: JsonValue;
2468
+ kind?: JsonValue;
2469
+ }) => Promise<JsonValue>;
2470
+ myInApp: (args?: {
2471
+ trigger?: JsonValue;
2472
+ limit?: JsonValue;
2473
+ }) => Promise<JsonValue>;
2474
+ inAppEvent: (args: {
2475
+ messageId: string;
2476
+ kind: JsonValue;
2477
+ }) => Promise<JsonValue>;
2478
+ };
2479
+ mobile: {
2480
+ listApps: (args?: {
2481
+ projectId?: string;
2482
+ }) => Promise<JsonValue>;
2483
+ createApp: (args: {
2484
+ projectId?: string;
2485
+ body: JsonObject;
2486
+ }) => Promise<JsonValue>;
2487
+ updateApp: (args: {
2488
+ projectId?: string;
2489
+ appId: string;
2490
+ body: JsonObject;
2491
+ }) => Promise<JsonValue>;
2492
+ deleteApp: (args: {
2493
+ projectId?: string;
2494
+ appId: string;
2495
+ }) => Promise<JsonValue>;
2496
+ listUserDevices: (args: {
2497
+ projectId?: string;
2498
+ userId: string;
2499
+ }) => Promise<JsonValue>;
2500
+ revokeUserDevice: (args: {
2501
+ projectId?: string;
2502
+ userId: string;
2503
+ deviceId: string;
2504
+ }) => Promise<JsonValue>;
2505
+ };
2506
+ observability: {
2507
+ metrics: (args?: {
2508
+ hours?: JsonValue;
2509
+ service?: JsonValue;
2510
+ points?: JsonValue;
2511
+ byService?: JsonValue;
2512
+ }) => Promise<JsonValue>;
2513
+ logs: (args?: {
2514
+ limit?: JsonValue;
2515
+ service?: JsonValue;
2516
+ status?: JsonValue;
2517
+ q?: JsonValue;
2518
+ after?: JsonValue;
2519
+ before?: JsonValue;
2520
+ source?: JsonValue;
2521
+ env?: JsonValue;
2522
+ }) => Promise<JsonValue>;
2523
+ routes: (args?: {
2524
+ hours?: JsonValue;
2525
+ env?: JsonValue;
2526
+ route?: JsonValue;
2527
+ limit?: JsonValue;
2528
+ }) => Promise<JsonValue>;
2529
+ alertsList: () => Promise<JsonValue>;
2530
+ alertsCreate: (args: {
2531
+ metric: JsonValue;
2532
+ threshold: JsonValue;
2533
+ windowMinutes?: JsonValue;
2534
+ name?: JsonValue;
2535
+ target?: JsonValue;
2536
+ env?: JsonValue;
2537
+ minRequests?: JsonValue;
2538
+ email?: JsonValue;
2539
+ webhookUrl?: JsonValue;
2540
+ }) => Promise<JsonValue>;
2541
+ alertsUpdate: (args: {
2542
+ ruleId: string;
2543
+ body: JsonObject;
2544
+ }) => Promise<JsonValue>;
2545
+ alertsDelete: (args: {
2546
+ ruleId: string;
2547
+ }) => Promise<JsonValue>;
2548
+ alertsTest: (args: {
2549
+ ruleId: string;
2550
+ }) => Promise<JsonValue>;
2551
+ alertsEvents: (args?: {
2552
+ limit?: JsonValue;
2553
+ }) => Promise<JsonValue>;
2554
+ };
2555
+ org: {
2556
+ acceptOrgInvite: (args: {
2557
+ token: JsonValue;
2558
+ }) => Promise<JsonValue>;
2559
+ addMember: (args: {
2560
+ orgId?: string;
2561
+ userId: JsonValue;
2562
+ role: JsonValue;
2563
+ }) => Promise<JsonValue>;
2564
+ createEdge: (args: {
2565
+ sourceNodeId: JsonValue;
2566
+ targetNodeId: JsonValue;
2567
+ relationType: JsonValue;
2568
+ role?: JsonValue;
2569
+ }) => Promise<JsonValue>;
2570
+ createOrgInvite: (args: {
2571
+ orgId?: string;
2572
+ email: JsonValue;
2573
+ role: JsonValue;
2574
+ }) => Promise<JsonValue>;
2575
+ deleteOrg: (args?: {
2576
+ orgId?: string;
2577
+ }) => Promise<JsonValue>;
2578
+ ensureDefaultApiKeys: () => Promise<JsonValue>;
2579
+ getChildren: (args: {
2580
+ parentId: string;
2581
+ relation?: JsonValue;
2582
+ }) => Promise<JsonValue>;
2583
+ getContext: (args: {
2584
+ userId: string;
2585
+ resourceId: string;
2586
+ }) => Promise<JsonValue>;
2587
+ getNode: (args: {
2588
+ nodeId: string;
2589
+ }) => Promise<JsonValue>;
2590
+ getProjectRef: (args?: {
2591
+ projectId?: string;
2592
+ }) => Promise<JsonValue>;
2593
+ getProjectSettings: () => Promise<JsonValue>;
2594
+ getRoleCatalog: () => Promise<JsonValue>;
2595
+ getRoleMatrix: () => Promise<JsonValue>;
2596
+ getRoleMatrixStatus: () => Promise<JsonValue>;
2597
+ listApiKeys: () => Promise<JsonValue>;
2598
+ listNodes: (args?: {
2599
+ nodeType?: JsonValue;
2600
+ }) => Promise<JsonValue>;
2601
+ listOrgMembers: (args?: {
2602
+ orgId?: string;
2603
+ }) => Promise<JsonValue>;
2604
+ removeOrgMember: (args: {
2605
+ orgId?: string;
2606
+ userId: string;
2607
+ }) => Promise<JsonValue>;
2608
+ revokeApiKey: (args: {
2609
+ keyId: string;
2610
+ }) => Promise<JsonValue>;
2611
+ setOrgPlan: (args: {
2612
+ orgId?: string;
2613
+ plan: JsonValue;
2614
+ }) => Promise<JsonValue>;
2615
+ updateMemberRole: (args: {
2616
+ orgId?: string;
2617
+ userId: string;
2618
+ role: JsonValue;
2619
+ }) => Promise<JsonValue>;
2620
+ updateOrg: (args: {
2621
+ orgId?: string;
2622
+ body: JsonObject;
2623
+ }) => Promise<JsonValue>;
2624
+ updateProjectSettings: (args: {
2625
+ settings: JsonValue;
2626
+ }) => Promise<JsonValue>;
2627
+ updateRoleMatrix: (args: {
2628
+ matrix: JsonValue;
2629
+ }) => Promise<JsonValue>;
2630
+ transferOrgOwnership: (args: {
2631
+ orgId?: string;
2632
+ newOwnerId: JsonValue;
2633
+ reason?: JsonValue;
2634
+ }) => Promise<JsonValue>;
2635
+ };
2636
+ perf: {
2637
+ summary: (args?: {
2638
+ days?: JsonValue;
2639
+ kind?: JsonValue;
2640
+ release?: JsonValue;
2641
+ platform?: JsonValue;
2642
+ by?: JsonValue;
2643
+ limit?: JsonValue;
2644
+ }) => Promise<JsonValue>;
2645
+ series: (args: {
2646
+ kind: JsonValue;
2647
+ name: JsonValue;
2648
+ days?: JsonValue;
2649
+ route?: JsonValue;
2650
+ release? /**
2651
+ * Billing + plan management (Ledger engine).
2652
+ *
2653
+ * The plan catalog is public; subscription and usage routes require a
2654
+ * valid auth token. Subscription writes require the caller to be an
2655
+ * org admin.
2656
+ */: JsonValue;
2657
+ platform?: JsonValue;
2658
+ q?: JsonValue;
2659
+ }) => Promise<JsonValue>;
2660
+ samples: (args?: {
2661
+ kind?: JsonValue;
2662
+ name?: JsonValue;
2663
+ route?: JsonValue;
2664
+ traceId?: JsonValue;
2665
+ slowest?: JsonValue;
2666
+ days?: JsonValue;
2667
+ limit?: JsonValue;
2668
+ }) => Promise<JsonValue>;
2669
+ network: (args?: {
2670
+ days?: JsonValue;
2671
+ env?: JsonValue;
2672
+ limit?: JsonValue;
2673
+ }) => Promise<JsonValue>;
2674
+ trace: (args: {
2675
+ traceId: string;
2676
+ }) => Promise<JsonValue>;
2677
+ usage: () => Promise<JsonValue>;
2678
+ };
2679
+ platform: {
2680
+ createEventHook: (args: {
2681
+ body: JsonObject;
2682
+ }) => Promise<JsonValue>;
2683
+ deleteEventHook: (args: {
2684
+ hookId: string;
2685
+ }) => Promise<JsonValue>;
2686
+ disconnectGithub: (args?: {
2687
+ projectId?: JsonValue;
2688
+ }) => Promise<JsonValue>;
2689
+ gatewayHealth: () => Promise<JsonValue>;
2690
+ getEnginesHealth: () => Promise<JsonValue>;
2691
+ getErrorTrace: (args: {
2692
+ traceId: string;
2693
+ }) => Promise<JsonValue>;
2694
+ getGithubConnectionState: (args?: {
2695
+ projectId?: JsonValue;
2696
+ }) => Promise<JsonValue>;
2697
+ listEventHooks: () => Promise<JsonValue>;
2698
+ resolveErrorTrace: (args: {
2699
+ traceId: string;
2700
+ resolved: JsonValue;
2701
+ }) => Promise<JsonValue>;
2702
+ };
2703
+ policy: {
2704
+ auditCount: () => Promise<JsonValue>;
2705
+ auditVerify: () => Promise<JsonValue>;
2706
+ policyCreate: (args: {
2707
+ policyId: JsonValue;
2708
+ name: JsonValue;
2709
+ splSource: JsonValue;
2710
+ orgId: JsonValue;
2711
+ }) => Promise<JsonValue>;
2712
+ policyDelete: (args: {
2713
+ policyId: string;
2714
+ }) => Promise<JsonValue>;
2715
+ policyEvaluate: (args: {
2716
+ policyId: string;
2717
+ context: JsonValue;
2718
+ }) => Promise<JsonValue>;
2719
+ policyGet: (args: {
2720
+ policyId: string;
2721
+ }) => Promise<JsonValue>;
2722
+ policyHistory: (args: {
2723
+ policyId: string;
2724
+ }) => Promise<JsonValue>;
2725
+ policyList: () => Promise<JsonValue>;
2726
+ policyRollback: (args: {
2727
+ policyId: string;
2728
+ version: JsonValue;
2729
+ }) => Promise<JsonValue>;
2730
+ policyTemplates: () => Promise<JsonValue>;
2731
+ };
2732
+ push: {
2733
+ getCredentials: (args?: {
2734
+ projectId?: string;
2735
+ }) => Promise<JsonValue>;
2736
+ setFcmCredentials: (args: {
2737
+ projectId?: string;
2738
+ serviceAccount: JsonValue;
2739
+ }) => Promise<JsonValue>;
2740
+ setApnsCredentials: (args: {
2741
+ projectId?: string;
2742
+ p8: JsonValue;
2743
+ keyId: JsonValue;
2744
+ teamId: JsonValue;
2745
+ bundleId: JsonValue;
2746
+ environment?: JsonValue;
2747
+ }) => Promise<JsonValue>;
2748
+ deleteCredentials: (args: {
2749
+ projectId?: string;
2750
+ provider: string;
2751
+ }) => Promise<JsonValue>;
2752
+ listDevices: (args?: {
2753
+ projectId?: string;
2754
+ userId?: JsonValue;
2755
+ limit?: JsonValue;
2756
+ before?: JsonValue;
2757
+ }) => Promise<JsonValue>;
2758
+ send: (args: {
2759
+ projectId?: string;
2760
+ message: JsonObject;
2761
+ }) => Promise<JsonValue>;
2762
+ listSends: (args?: {
2763
+ projectId?: string;
2764
+ limit?: JsonValue;
2765
+ }) => Promise<JsonValue>;
2766
+ registerDevice: (args: {
2767
+ token: JsonValue;
2768
+ platform: JsonValue;
2769
+ provider?: JsonValue;
2770
+ deviceId?: JsonValue;
2771
+ appId?: JsonValue;
2772
+ topics?: JsonValue;
2773
+ locale?: JsonValue;
2774
+ }) => Promise<JsonValue>;
2775
+ myDevices: () => Promise<JsonValue>;
2776
+ updateTopics: (args: {
2777
+ deviceRowId: string;
2778
+ subscribe?: JsonValue;
2779
+ unsubscribe?: JsonValue;
2780
+ replace?: JsonValue;
2781
+ }) => Promise<JsonValue>;
2782
+ deleteDevice: (args: {
2783
+ deviceRowId: string;
2784
+ }) => Promise<JsonValue>;
2785
+ unregisterToken: (args: {
2786
+ token: JsonValue;
2787
+ }) => Promise<JsonValue>;
2788
+ setWebpushCredentials: (args?: {
2789
+ projectId?: string;
2790
+ subject?: JsonValue;
2791
+ rotate?: JsonValue;
2792
+ }) => Promise<JsonValue>;
2793
+ webpushKey: () => Promise<JsonValue>;
2794
+ cancelSend: (args: {
2795
+ projectId?: string;
2796
+ sendId: string;
2797
+ }) => Promise<JsonValue>;
2798
+ };
2799
+ queues: {
2800
+ list: () => Promise<JsonValue>;
2801
+ create: (args: {
2802
+ name: JsonValue;
2803
+ description?: JsonValue;
2804
+ visibilityTimeoutSec?: JsonValue;
2805
+ maxReads?: JsonValue;
2806
+ deadLetterQueue?: JsonValue;
2807
+ retentionDays?: JsonValue;
2808
+ appSend?: JsonValue;
2809
+ consumer?: JsonValue;
2810
+ }) => Promise<JsonValue>;
2811
+ get: (args: {
2812
+ queueName: string;
2813
+ }) => Promise<JsonValue>;
2814
+ update: (args: {
2815
+ queueName: string;
2816
+ settings: JsonObject;
2817
+ }) => Promise<JsonValue>;
2818
+ delete: (args: {
2819
+ queueName: string;
2820
+ }) => Promise<JsonValue>;
2821
+ send: (args: {
2822
+ queueName: string;
2823
+ message: JsonValue;
2824
+ delay?: JsonValue;
2825
+ headers?: JsonValue;
2826
+ }) => Promise<JsonValue>;
2827
+ sendBatch: (args: {
2828
+ queueName: string;
2829
+ messages: JsonValue;
2830
+ delay?: JsonValue;
2831
+ headers?: JsonValue;
2832
+ }) => Promise<JsonValue>;
2833
+ read: (args: {
2834
+ queueName: string;
2835
+ qty?: JsonValue;
2836
+ vt?: JsonValue;
2837
+ }) => Promise<JsonValue>;
2838
+ pop: (args: {
2839
+ queueName: string;
2840
+ qty?: JsonValue;
2841
+ }) => Promise<JsonValue>;
2842
+ archive: (args: {
2843
+ queueName: string;
2844
+ msgIds: JsonValue;
2845
+ }) => Promise<JsonValue>;
2846
+ deleteMessages: (args: {
2847
+ queueName: string;
2848
+ msgIds: JsonValue;
2849
+ }) => Promise<JsonValue>;
2850
+ setVt: (args: {
2851
+ queueName: string;
2852
+ msgId: JsonValue;
2853
+ vt: JsonValue;
2854
+ }) => Promise<JsonValue>;
2855
+ purge: (args: {
2856
+ queueName: string;
2857
+ includeArchived?: JsonValue;
2858
+ }) => Promise<JsonValue>;
2859
+ metrics: (args: {
2860
+ queueName: string;
2861
+ }) => Promise<JsonValue>;
2862
+ messages: (args: {
2863
+ queueName: string;
2864
+ state?: JsonValue;
2865
+ limit?: JsonValue;
2866
+ before?: JsonValue;
2867
+ }) => Promise<JsonValue>;
2868
+ };
2869
+ realtime: {
2870
+ channels: () => Promise<JsonValue>;
2871
+ presence: (args: {
2872
+ channel: string;
2873
+ }) => Promise<JsonValue>;
2874
+ replay: (args: {
2875
+ channel: string;
2876
+ after?: JsonValue;
2877
+ limit?: JsonValue;
2878
+ }) => Promise<JsonValue>;
2879
+ subscribe: (args: {
2880
+ channel: JsonValue;
2881
+ clientId: JsonValue;
2882
+ }) => Promise<JsonValue>;
2883
+ unsubscribe: (args: {
2884
+ channel: JsonValue;
2885
+ clientId: JsonValue;
2886
+ }) => Promise<JsonValue>;
2887
+ };
2888
+ remoteConfig: {
2889
+ getDraft: (args?: {
2890
+ projectId?: string;
2891
+ env?: JsonValue;
2892
+ }) => Promise<JsonValue>;
2893
+ putParam: (args: {
2894
+ projectId?: string;
2895
+ key: string;
2896
+ type?: JsonValue;
2897
+ defaultValue?: JsonValue;
2898
+ description?: JsonValue;
2899
+ conditional?: JsonValue;
2900
+ env?: JsonValue;
2901
+ }) => Promise<JsonValue>;
2902
+ deleteParam: (args: {
2903
+ projectId?: string;
2904
+ key: string;
2905
+ env?: JsonValue;
2906
+ }) => Promise<JsonValue>;
2907
+ putCondition: (args: {
2908
+ projectId?: string;
2909
+ name: string;
2910
+ rules: JsonValue;
2911
+ priority?: JsonValue;
2912
+ description?: JsonValue;
2913
+ env?: JsonValue;
2914
+ }) => Promise<JsonValue>;
2915
+ deleteCondition: (args: {
2916
+ projectId?: string;
2917
+ name: string;
2918
+ env?: JsonValue;
2919
+ }) => Promise<JsonValue>;
2920
+ getTemplate: (args?: {
2921
+ projectId?: string;
2922
+ env?: JsonValue;
2923
+ source?: JsonValue;
2924
+ }) => Promise<JsonValue>;
2925
+ putTemplate: (args?: {
2926
+ projectId?: string;
2927
+ conditions?: JsonValue;
2928
+ parameters?: JsonValue;
2929
+ env?: JsonValue;
2930
+ prune?: JsonValue;
2931
+ }) => Promise<JsonValue>;
2932
+ diff: (args?: {
2933
+ projectId?: string;
2934
+ template?: JsonValue;
2935
+ env?: JsonValue;
2936
+ }) => Promise<JsonValue>;
2937
+ preview: (args?: {
2938
+ projectId?: string;
2939
+ template?: JsonValue;
2940
+ env?: JsonValue;
2941
+ sample?: JsonValue;
2942
+ }) => Promise<JsonValue>;
2943
+ publish: (args?: {
2944
+ projectId?: string;
2945
+ message?: JsonValue;
2946
+ baseVersion?: JsonValue;
2947
+ scheduledAt?: JsonValue;
2948
+ env?: JsonValue;
2949
+ }) => Promise<JsonValue>;
2950
+ listVersions: (args?: {
2951
+ projectId?: string;
2952
+ env?: JsonValue;
2953
+ limit?: JsonValue;
2954
+ }) => Promise<JsonValue>;
2955
+ getVersion: (args: {
2956
+ projectId?: string;
2957
+ version: string;
2958
+ env?: JsonValue;
2959
+ }) => Promise<JsonValue>;
2960
+ rollback: (args: {
2961
+ projectId?: string;
2962
+ version: string;
2963
+ message?: JsonValue;
2964
+ env?: JsonValue;
2965
+ }) => Promise<JsonValue>;
2966
+ cancelSchedule: (args: {
2967
+ projectId?: string;
2968
+ scheduleId: string;
2969
+ env?: JsonValue;
2970
+ }) => Promise<JsonValue>;
2971
+ evaluate: (args?: {
2972
+ projectId?: string;
2973
+ context?: JsonValue;
2974
+ source?: JsonValue;
2975
+ env?: JsonValue;
2976
+ }) => Promise<JsonValue>;
2977
+ };
2978
+ schedules: {
2979
+ list: (args?: {
2980
+ functionName?: JsonValue;
2981
+ }) => Promise<JsonValue>;
2982
+ create: (args: {
2983
+ cronExpression: JsonValue;
2984
+ functionName?: JsonValue;
2985
+ payload?: JsonValue;
2986
+ enabled?: JsonValue;
2987
+ name?: JsonValue;
2988
+ description?: JsonValue;
2989
+ timezone?: JsonValue;
2990
+ overlap?: JsonValue;
2991
+ maxAttempts?: JsonValue;
2992
+ timeoutSec?: JsonValue;
2993
+ targetType?: JsonValue;
2994
+ target?: JsonValue;
2995
+ }) => Promise<JsonValue>;
2996
+ get: (args: {
2997
+ scheduleId: string;
2998
+ }) => Promise<JsonValue>;
2999
+ update: (args: {
3000
+ scheduleId: string;
3001
+ changes: JsonObject;
3002
+ }) => Promise<JsonValue>;
3003
+ delete: (args: {
3004
+ scheduleId: string;
3005
+ }) => Promise<JsonValue>;
3006
+ runs: (args: {
3007
+ scheduleId: string;
3008
+ limit?: JsonValue;
3009
+ before?: JsonValue;
3010
+ }) => Promise<JsonValue>;
3011
+ run: (args: {
3012
+ scheduleId: string;
3013
+ }) => Promise<JsonValue>;
3014
+ preview: (args: {
3015
+ cronExpression: JsonValue;
3016
+ timezone?: JsonValue;
3017
+ count?: JsonValue;
3018
+ }) => Promise<JsonValue>;
3019
+ };
3020
+ simulation: {
3021
+ compareRuns: (args: {
3022
+ targetRunId: string;
3023
+ baselineRunId: string;
3024
+ }) => Promise<JsonValue>;
3025
+ discover: () => Promise<JsonValue>;
3026
+ getRun: (args: {
3027
+ runId: string;
3028
+ }) => Promise<JsonValue>;
3029
+ listRuns: (args?: {
3030
+ limit?: JsonValue;
3031
+ offset?: JsonValue;
3032
+ }) => Promise<JsonValue>;
3033
+ quota: () => Promise<JsonValue>;
3034
+ listIntended: () => Promise<JsonValue>;
3035
+ markIntended: (args: {
3036
+ role: JsonValue;
3037
+ action: JsonValue;
3038
+ resource: JsonValue;
3039
+ outcome: JsonValue;
3040
+ note?: JsonValue;
3041
+ }) => Promise<JsonValue>;
3042
+ unmarkIntended: (args: {
3043
+ markId: string;
3044
+ }) => Promise<JsonValue>;
3045
+ topology: () => Promise<JsonValue>;
3046
+ inventory: (args?: {
3047
+ include?: JsonValue;
3048
+ fresh?: JsonValue;
3049
+ }) => Promise<JsonValue>;
3050
+ checks: (args?: {
3051
+ severity?: JsonValue;
3052
+ area?: JsonValue;
3053
+ fresh?: JsonValue;
3054
+ }) => Promise<JsonValue>;
3055
+ graph: (args?: {
3056
+ fresh?: JsonValue;
3057
+ }) => Promise<JsonValue>;
3058
+ limits: () => Promise<JsonValue>;
3059
+ integrationRun: (args: {
3060
+ connectorId: JsonValue;
3061
+ flowId: JsonValue;
3062
+ outcome?: JsonValue;
3063
+ mode?: JsonValue;
3064
+ }) => Promise<JsonValue>;
3065
+ drillsRun: (args?: {
3066
+ drillIds?: JsonValue;
3067
+ overrides?: JsonValue;
3068
+ }) => Promise<JsonValue>;
3069
+ runArtifacts: (args: {
3070
+ runId: string;
3071
+ }) => Promise<JsonValue>;
3072
+ snapshot: (args?: {
3073
+ includeRows?: JsonValue;
3074
+ }) => Promise<JsonValue>;
3075
+ };
3076
+ storage: {
3077
+ createBucket: (args: {
3078
+ body: JsonObject;
3079
+ }) => Promise<JsonValue>;
3080
+ deleteBucket: (args: {
3081
+ name: string;
3082
+ }) => Promise<JsonValue>;
3083
+ getBucket: (args: {
3084
+ name: string;
3085
+ }) => Promise<JsonValue>;
3086
+ listBuckets: () => Promise<JsonValue>;
3087
+ moveObject: (args: {
3088
+ fromPath: JsonValue;
3089
+ toPath: JsonValue;
3090
+ }) => Promise<JsonValue>;
3091
+ updateBucket: (args: {
3092
+ name: string;
3093
+ body: JsonObject;
3094
+ }) => Promise<JsonValue>;
3095
+ };
3096
+ templates: {
3097
+ list: () => Promise<JsonValue>;
3098
+ get: (args: {
3099
+ name: string;
3100
+ }) => Promise<JsonValue>;
3101
+ apply: (args: {
3102
+ orgId?: string;
3103
+ projectId?: string;
3104
+ name: string;
3105
+ dryRun?: JsonValue;
3106
+ }) => Promise<JsonValue>;
3107
+ };
3108
+ traces: {
3109
+ list: (args?: {
3110
+ kind?: JsonValue;
3111
+ before?: JsonValue;
3112
+ limit?: JsonValue;
3113
+ }) => Promise<JsonValue>;
3114
+ get: (args: {
3115
+ traceId: string;
3116
+ }) => Promise<JsonValue>;
3117
+ };
3118
+ triggers: {
3119
+ list: (args?: {
3120
+ functionName?: JsonValue;
3121
+ }) => Promise<JsonValue>;
3122
+ create: (args: {
3123
+ functionName: JsonValue;
3124
+ source: JsonValue;
3125
+ eventTypes?: JsonValue;
3126
+ resource?: JsonValue;
3127
+ subjectPrefix?: JsonValue;
3128
+ name?: JsonValue;
3129
+ enabled?: JsonValue;
3130
+ maxAttempts?: JsonValue;
3131
+ }) => Promise<JsonValue>;
3132
+ get: (args: {
3133
+ triggerId: string;
3134
+ }) => Promise<JsonValue>;
3135
+ update: (args: {
3136
+ triggerId: string;
3137
+ changes: JsonObject;
3138
+ }) => Promise<JsonValue>;
3139
+ delete: (args: {
3140
+ triggerId: string;
3141
+ }) => Promise<JsonValue>;
3142
+ test: (args: {
3143
+ triggerId: string;
3144
+ }) => Promise<JsonValue>;
3145
+ };
3146
+ vector: {
3147
+ deleteCollection: (args: {
3148
+ collection: string;
3149
+ }) => Promise<JsonValue>;
3150
+ deleteRecord: (args: {
3151
+ collection: string;
3152
+ recordId: string;
3153
+ }) => Promise<JsonValue>;
3154
+ embed: (args: {
3155
+ texts: JsonValue;
3156
+ }) => Promise<JsonValue>;
3157
+ listCollections: () => Promise<JsonValue>;
3158
+ upsert: (args: {
3159
+ collection: JsonValue;
3160
+ docs: JsonValue;
3161
+ }) => Promise<JsonValue>;
3162
+ setCollection: (args: {
3163
+ collection: string;
3164
+ appSearch?: JsonValue;
3165
+ }) => Promise<JsonValue>;
3166
+ reembedCollection: (args: {
3167
+ collection: string;
3168
+ force?: JsonValue;
3169
+ }) => Promise<JsonValue>;
3170
+ sqlSearch: (args: {
3171
+ tableName: JsonValue;
3172
+ columnName?: JsonValue;
3173
+ vector?: JsonValue;
3174
+ text?: JsonValue;
3175
+ mode?: JsonValue;
3176
+ textColumns?: JsonValue;
3177
+ language?: JsonValue;
3178
+ k?: JsonValue;
3179
+ metric?: JsonValue;
3180
+ select?: JsonValue;
3181
+ filter?: JsonValue;
3182
+ maxDistance?: JsonValue;
3183
+ metadataFilter?: JsonValue;
3184
+ metadataColumn?: JsonValue;
3185
+ filterIn?: JsonValue;
3186
+ efSearch?: JsonValue;
3187
+ probes?: JsonValue;
3188
+ rerank?: JsonValue;
3189
+ rerankCandidates?: JsonValue;
3190
+ }) => Promise<JsonValue>;
3191
+ sqlAutoStatus: () => Promise<JsonValue>;
3192
+ sqlAutoEnable: (args: {
3193
+ tableName: JsonValue;
3194
+ columnName?: JsonValue;
3195
+ sourceColumns: JsonValue;
3196
+ rebuild?: JsonValue;
3197
+ language?: JsonValue;
3198
+ }) => Promise<JsonValue>;
3199
+ sqlAutoDisable: (args: {
3200
+ tableName: string;
3201
+ }) => Promise<JsonValue>;
3202
+ sqlAutoSync: (args?: {
3203
+ tableName?: JsonValue;
3204
+ limit?: JsonValue;
3205
+ }) => Promise<JsonValue>;
3206
+ sqlStatus: () => Promise<JsonValue>;
3207
+ sqlEnable: (args?: {
3208
+ enabled?: JsonValue;
3209
+ }) => Promise<JsonValue>;
3210
+ sqlCreateTable: (args: {
3211
+ tableName: JsonValue;
3212
+ dimensions: JsonValue;
3213
+ ownerRows?: JsonValue;
3214
+ }) => Promise<JsonValue>;
3215
+ sqlAddColumn: (args: {
3216
+ tableName: JsonValue;
3217
+ columnName?: JsonValue;
3218
+ dimensions: JsonValue;
3219
+ }) => Promise<JsonValue>;
3220
+ sqlCreateIndex: (args: {
3221
+ tableName: JsonValue;
3222
+ columnName?: JsonValue;
3223
+ metric?: JsonValue;
3224
+ method?: JsonValue;
3225
+ m?: JsonValue;
3226
+ efConstruction?: JsonValue;
3227
+ lists?: JsonValue;
3228
+ concurrently?: JsonValue;
3229
+ }) => Promise<JsonValue>;
3230
+ sqlInsertRows: (args: {
3231
+ tableName: JsonValue;
3232
+ columnName?: JsonValue;
3233
+ rows: JsonValue;
3234
+ embed?: JsonValue;
3235
+ }) => Promise<JsonValue>;
3236
+ };
3237
+ workflows: {
3238
+ start: (args: {
3239
+ functionName: JsonValue;
3240
+ input?: JsonValue;
3241
+ key?: JsonValue;
3242
+ maxAttempts?: JsonValue;
3243
+ }) => Promise<JsonValue>;
3244
+ list: (args?: {
3245
+ functionName?: JsonValue;
3246
+ status?: JsonValue;
3247
+ before?: JsonValue;
3248
+ limit?: JsonValue;
3249
+ }) => Promise<JsonValue>;
3250
+ get: (args: {
3251
+ runId: string;
3252
+ }) => Promise<JsonValue>;
3253
+ signal: (args: {
3254
+ runId: string;
3255
+ name: JsonValue;
3256
+ data?: JsonValue;
3257
+ }) => Promise<JsonValue>;
3258
+ cancel: (args: {
3259
+ runId: string;
3260
+ }) => Promise<JsonValue>;
3261
+ retry: (args: {
3262
+ runId: string;
3263
+ latest?: JsonValue;
3264
+ }) => Promise<JsonValue>;
3265
+ };
3266
+ };
3267
+ readonly keys: {
3268
+ list: () => Promise<JsonValue>;
3269
+ create: (payload: JsonObject) => Promise<JsonObject>;
3270
+ ensureDefaults: () => Promise<JsonObject>;
3271
+ revoke: (keyId: string) => Promise<JsonObject>;
3272
+ };
3273
+ readonly governance: {
3274
+ listRegions: () => Promise<JsonValue>;
3275
+ listAvailableRegions: (query?: {
3276
+ size?: string;
3277
+ plan?: string;
3278
+ }) => Promise<JsonValue>;
3279
+ patchRegion: (regionId: string, body: JsonObject) => Promise<JsonObject>;
3280
+ listTenants: () => Promise<JsonValue>;
3281
+ getTenant: (orgId: string) => Promise<JsonObject>;
3282
+ setTenantStatus: (orgId: string, body: JsonObject) => Promise<JsonObject>;
3283
+ listTenantDatabases: (orgId: string) => Promise<JsonValue>;
3284
+ provisionDatabase: (orgId: string, body: JsonObject) => Promise<JsonObject>;
3285
+ getDatabaseConnection: (orgId: string, projectId: string) => Promise<JsonObject>;
3286
+ revealDatabaseConnection: (orgId: string, projectId: string, grantId: string) => Promise<JsonObject>;
3287
+ pauseDatabase: (orgId: string, projectId: string) => Promise<JsonObject>;
3288
+ resumeDatabase: (orgId: string, projectId: string) => Promise<JsonObject>;
3289
+ resizeDatabase: (orgId: string, projectId: string, body: JsonObject) => Promise<JsonObject>;
3290
+ deleteDatabase: (orgId: string, projectId: string, snapshot?: boolean) => Promise<JsonObject>;
3291
+ listDatabaseBackups: (orgId: string, projectId: string, limit?: number) => Promise<JsonValue>;
3292
+ triggerDatabaseBackup: (orgId: string, projectId: string) => Promise<JsonObject>;
3293
+ downloadDatabaseBackup: (orgId: string, projectId: string, backupId: number | string) => Promise<Blob>;
3294
+ downloadProjectExport: (orgId: string, projectId: string, exportId: string) => Promise<Blob>;
3295
+ adminListDatabases: () => Promise<JsonValue>;
3296
+ listHosts: (regionId?: string) => Promise<JsonValue>;
3297
+ patchHost: (hostId: string, body: JsonObject) => Promise<JsonObject>;
3298
+ metricsOverview: () => Promise<JsonObject>;
3299
+ projectMetrics: (projectId: string, since?: string, limit?: number) => Promise<JsonObject>;
3300
+ };
3301
+ readonly admin: {
3302
+ listErrorTraces: (query?: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
3303
+ getErrorTrace: (traceId: string) => Promise<JsonObject>;
3304
+ resolveErrorTrace: (traceId: string, body?: JsonObject) => Promise<JsonObject>;
3305
+ usageOverview: (period?: string, limit?: number) => Promise<JsonObject>;
3306
+ listAccessTransparency: (query: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
3307
+ gatewayHealth: () => Promise<JsonValue>;
3308
+ };
3309
+ /**
3310
+ * Vector / embeddings (Nexus engine). `embed` works anywhere (in functions too, with the service key).
3311
+ *
3312
+ * **Collections are the legacy vector store** (capped at `ai.collection_max_records` per collection). For
3313
+ * large or row-secured data use SQL vectors (`sov.api.vector.sqlSearch`, `sqlCreateIndex`, automatic
3314
+ * embeddings) or knowledge bases (`sov.knowledge`).
3315
+ *
3316
+ * All routes are project-scoped via the standard `X-Sovaria-Project-ID`
3317
+ * header so call `setScope({ orgId, projectId })` first.
3318
+ */
3319
+ readonly vector: {
3320
+ embed: (texts: string[]) => Promise<{
3321
+ vectors: number[][];
3322
+ dim: number;
3323
+ count: number;
3324
+ }>;
3325
+ upsert: (collection: string, docs: Array<{
3326
+ id?: string;
3327
+ text: string;
3328
+ metadata?: JsonObject;
3329
+ }>) => Promise<JsonObject>;
3330
+ /**
3331
+ * Search a collection. `mode`: `vector` (meaning), `keyword` (the words, BM25) or `hybrid` (both,
3332
+ * fused); the default is vector with a real embedding model and hybrid with the local hash model.
3333
+ * Apps (anon key, signed-in users) may only search collections opened with `setCollection(name, { appSearch: true })`.
3334
+ */
3335
+ search: (collection: string, query: string, options?: {
3336
+ topK?: number;
3337
+ metadataFilter?: JsonObject;
3338
+ mode?: "vector" | "keyword" | "hybrid";
3339
+ }) => Promise<JsonObject>;
3340
+ /** Collection settings (team / service key): `appSearch` lets the project's apps search it. */
3341
+ setCollection: (collection: string, settings: {
3342
+ appSearch?: boolean;
3343
+ }) => Promise<JsonObject>;
3344
+ listCollections: () => Promise<JsonObject>;
3345
+ listRecords: (collection: string, options?: {
3346
+ limit?: number;
3347
+ offset?: number;
3348
+ }) => Promise<JsonObject>;
3349
+ deleteRecord: (collection: string, recordId: string) => Promise<JsonObject>;
3350
+ deleteCollection: (collection: string) => Promise<JsonObject>;
3351
+ };
3352
+ /**
3353
+ * Knowledge bases (RAG) on the project's own Postgres: add documents (text, files, web pages), then search
3354
+ * them with citations. Searches only return passages the signed-in user may read.
3355
+ *
3356
+ * ```ts
3357
+ * await sov.knowledge.addFile('support_docs', file) // a File / Blob in the browser
3358
+ * const { results, citations } = await sov.knowledge.search('support_docs', 'refund window')
3359
+ * ```
3360
+ */
3361
+ readonly knowledge: {
3362
+ list: () => Promise<JsonObject>;
3363
+ create: (name: string, options?: KnowledgeBaseOptions) => Promise<JsonObject>;
3364
+ addText: (name: string, text: string, options?: KnowledgeDocumentOptions & {
3365
+ format?: "text" | "markdown" | "html";
3366
+ }) => Promise<KnowledgeAddResult>;
3367
+ /** A web page. `refreshHours` (team, paid plans) fetches it again on a schedule; only changed parts are re-embedded. */
3368
+ addUrl: (name: string, url: string, options?: KnowledgeDocumentOptions & {
3369
+ refreshHours?: number;
3370
+ }) => Promise<KnowledgeAddResult>;
3371
+ /** URL documents fetched again on a schedule (team). */
3372
+ sources: (name: string) => Promise<JsonObject>;
3373
+ /** A PDF, DOCX, HTML, Markdown, TXT, CSV or JSON file (up to 7 MB): a `File`/`Blob`, or bytes with `filename`. */
3374
+ addFile: (name: string, file: Blob | Uint8Array | ArrayBuffer, options?: KnowledgeDocumentOptions & {
3375
+ filename?: string;
3376
+ }) => Promise<KnowledgeAddResult>;
3377
+ documents: (name: string, options?: {
3378
+ limit?: number;
3379
+ offset?: number;
3380
+ }) => Promise<JsonObject>;
3381
+ deleteDocument: (name: string, documentId: string) => Promise<JsonObject>;
3382
+ /**
3383
+ * Passages for a question. `documentIds` (up to 50) scopes the search; `rerank` reorders the passages with
3384
+ * the managed reranker (counts on `ai.rerank_month`; `reranked: false` when none is configured).
3385
+ */
3386
+ search: (name: string, query: string, options?: {
3387
+ k?: number;
3388
+ mode?: "vector" | "keyword" | "hybrid";
3389
+ metadataFilter?: JsonObject;
3390
+ documentIds?: string[];
3391
+ rerank?: boolean;
3392
+ }) => Promise<KnowledgeSearchResult>;
3393
+ };
3394
+ /**
3395
+ * Your project's agents, from your app. The agent acts with the signed-in user's own permissions (and an
3396
+ * agent with knowledge bases only retrieves passages that user may read).
3397
+ *
3398
+ * ```ts
3399
+ * const reply = await sov.agents.run(agentId, { message: 'Where is my order?', onEvent: (e) => render(e) })
3400
+ * await sov.agents.run(agentId, { message: 'And the invoice?', threadId: reply.threadId })
3401
+ * ```
3402
+ */
3403
+ readonly agents: {
3404
+ /** Send a message (a new thread, or `threadId` to continue one) and wait for the answer; `onEvent` streams it. */
3405
+ run: (agentId: string, input: AgentRunInput) => Promise<AgentRunResult>;
3406
+ /** The same as `run`, as an async iterator of events (`conversation`, `text_delta`, `text`, `tool_call`, …, `done`). */
3407
+ stream: (agentId: string, input: AgentRunInput) => AsyncIterable<AgentEvent>;
3408
+ /** The signed-in user's threads with this agent, newest first. */
3409
+ threads: (agentId: string) => Promise<JsonObject[]>;
3410
+ /** One thread with its events (messages, tool calls, answers). */
3411
+ thread: (threadId: string) => Promise<JsonObject>;
3412
+ /** Stop the agent's current run in this thread. */
3413
+ cancel: (threadId: string) => Promise<JsonObject>;
3414
+ };
3415
+ /** POST a JSON body and read the server-sent events it streams back (one JSON object per `data:` line). */
3416
+ private streamEvents;
3417
+ }
3418
+ export interface KnowledgeBaseOptions {
3419
+ description?: string;
3420
+ /** `team` (default): only the project team searches it; `app_users`: signed-in users read shared documents and their own. */
3421
+ access?: 'team' | 'app_users';
3422
+ /** With `access: 'app_users'`: users may add their own private documents. */
3423
+ userUploads?: boolean;
3424
+ chunkTokens?: number;
3425
+ }
3426
+ export interface KnowledgeDocumentOptions {
3427
+ /** Re-using an id replaces that document; unchanged parts keep their embeddings. */
3428
+ documentId?: string;
3429
+ title?: string;
3430
+ metadata?: JsonObject;
3431
+ }
3432
+ export interface KnowledgeAddResult {
3433
+ document_id: string;
3434
+ title: string;
3435
+ chunks: number;
3436
+ new_chunks: number;
3437
+ reused_chunks: number;
3438
+ removed_chunks: number;
3439
+ tokens: number;
3440
+ new_tokens: number;
3441
+ /** Chunks still waiting for their embedding (searchable by keyword meanwhile). */
3442
+ pending: number;
3443
+ model?: string;
3444
+ /** `managed` (Sovaria's model) or `own_key` (the project's provider key). */
3445
+ billing?: string;
3446
+ estimated_cost_usd: number | null;
3447
+ private: boolean;
3448
+ [key: string]: unknown;
3449
+ }
3450
+ export interface KnowledgeSearchResult {
3451
+ results: Array<{
3452
+ document_id: string;
3453
+ title: string;
3454
+ heading: string;
3455
+ content: string;
3456
+ source_uri: string | null;
3457
+ citation: number;
3458
+ score?: number;
3459
+ distance?: number;
3460
+ metadata: JsonObject;
3461
+ [key: string]: unknown;
3462
+ }>;
3463
+ citations: Array<{
3464
+ n: number;
3465
+ document_id: string;
3466
+ title: string;
3467
+ source_uri: string | null;
3468
+ sections: string[];
3469
+ }>;
3470
+ [key: string]: unknown;
3471
+ }
3472
+ export interface AgentRunInput {
3473
+ message: string;
3474
+ /** Continue this thread (from an earlier `run`); leave out to start a new one. */
3475
+ threadId?: string;
3476
+ onEvent?: (event: AgentEvent) => void;
3477
+ signal?: AbortSignal;
3478
+ }
3479
+ export interface AgentEvent {
3480
+ type: string;
3481
+ [key: string]: unknown;
3482
+ }
3483
+ export interface AgentRunResult {
3484
+ threadId: string;
3485
+ /** The agent's answer (all of its text in this turn). */
3486
+ text: string;
3487
+ /** `idle` when it finished; `awaiting_approval` when a tool needs the user's OK; `error`, `budget`, … */
3488
+ status: string;
3489
+ usage?: JsonObject;
3490
+ events: AgentEvent[];
3491
+ }
3492
+ /** Server-sent events → JSON objects. Streams when the runtime gives a readable body, else reads it whole. */
3493
+ export declare function parseEventStream(response: Response): AsyncGenerator<AgentEvent>;
3494
+ export type RealtimeStatus = 'connecting' | 'live' | 'reconnecting' | 'closed';
3495
+ export interface RealtimeChannelHandlers {
3496
+ /** Each message's payload (the `payload` field of a published event, or the raw frame). */
3497
+ onMessage?: (payload: JsonObject, raw: JsonObject) => void;
3498
+ onStatus?: (status: RealtimeStatus) => void;
3499
+ /** Called when a connection attempt fails; the channel keeps retrying. */
3500
+ onError?: (error: unknown) => void;
3501
+ /** Maximum delay between reconnects in ms (default 15000). */
3502
+ maxBackoffMs?: number;
3503
+ /**
3504
+ * After a reconnect, fetch the messages published while the socket was down (from the channel's
3505
+ * replay history) and deliver them, in order and once each, before new ones. Default true.
3506
+ */
3507
+ catchUp?: boolean;
3508
+ /**
3509
+ * Messages were missed and can't be recovered: older than the channel's retained history
3510
+ * (`fromSeq`..`toSeq`, by `stream_seq`), or the history couldn't be read (`toSeq` undefined).
3511
+ * Reload your state from the source of truth when this fires.
3512
+ */
3513
+ onGap?: (gap: {
3514
+ fromSeq: number;
3515
+ toSeq?: number;
3516
+ reason: string;
3517
+ }) => void;
3518
+ }
3519
+ export interface RealtimeChannel {
3520
+ readonly name: string;
3521
+ readonly status: RealtimeStatus;
3522
+ /** Publish to this channel through the API (works for every subscriber). */
3523
+ send: (payload: JsonObject) => Promise<JsonObject>;
3524
+ close: () => void;
3525
+ }
3526
+ export interface SovariaProjectConfigFile {
3527
+ project?: {
3528
+ name?: string;
3529
+ runtime?: string;
3530
+ ref?: string;
3531
+ };
3532
+ gateway?: {
3533
+ url?: string;
3534
+ };
3535
+ scope?: {
3536
+ org_id?: string;
3537
+ project_id?: string;
3538
+ env_id?: string;
3539
+ orgId?: string;
3540
+ projectId?: string;
3541
+ envId?: string;
3542
+ };
3543
+ features?: {
3544
+ realtime?: boolean;
3545
+ functions?: boolean;
3546
+ storage?: boolean;
3547
+ };
3548
+ }
3549
+ /** Extra client settings layered over sovaria.config.json (keys, callbacks, session storage). */
3550
+ export type ProjectConfigOptions = Omit<SovariaPortalConfig, 'url' | 'baseUrl'>;
3551
+ /** Map sovaria.config.json content (written by `sov init` / `sov link`) to SDK bootstrap config. */
3552
+ export declare function portalConfigFromProjectFile(raw: SovariaProjectConfigFile, options?: ProjectConfigOptions): SovariaPortalConfig;
3553
+ /**
3554
+ * Create a client from sovaria.config.json. In a bundler, import the file and pass the anon key:
3555
+ * `createClientFromProjectConfig(config, { publishableKey: import.meta.env.VITE_SOVARIA_ANON_KEY })`.
3556
+ */
3557
+ export declare function createClientFromProjectConfig(raw: SovariaProjectConfigFile, options?: ProjectConfigOptions): SovariaSDK;
3558
+ /**
3559
+ * Create a client. Either pass the two values from the console's **Connect** panel —
3560
+ * `createClient('https://<ref>.sovarias.in', '<anon-key>')` — or a config object.
3561
+ */
3562
+ export declare function createClient(urlOrConfig: string | SovariaPortalConfig, key?: string, options?: Omit<SovariaPortalConfig, 'url' | 'baseUrl'>): SovariaSDK;