@sovaria/sdk 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +179 -2
- package/dist/client.d.ts +146 -0
- package/dist/client.js +583 -0
- package/dist/collections.d.ts +189 -0
- package/dist/collections.js +467 -0
- package/dist/complete-api.d.ts +47 -0
- package/dist/complete-api.js +64 -0
- package/dist/crashes.d.ts +79 -0
- package/dist/crashes.js +176 -0
- package/dist/crypto.d.ts +37 -0
- package/dist/crypto.js +189 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.js +246 -0
- package/dist/firestore.d.ts +176 -0
- package/dist/firestore.js +337 -0
- package/dist/generated.d.ts +1227 -0
- package/dist/generated.js +1054 -0
- package/dist/index.d.ts +2046 -0
- package/dist/index.js +2287 -0
- package/dist/offline.d.ts +90 -0
- package/dist/offline.js +528 -0
- package/dist/types.d.ts +102 -0
- package/dist/types.js +1 -0
- package/package.json +74 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2046 @@
|
|
|
1
|
+
export { SovariaError, userMessageFor } from './errors.js';
|
|
2
|
+
export type { SovariaErrorCode } from './errors.js';
|
|
3
|
+
import { DocumentReference, Query, WriteBatch, type Transaction } from './collections.js';
|
|
4
|
+
export { DocumentReference, FieldValue, LiveQuery, Query, Transaction, WriteBatch, newDocumentId, splitTransforms, type DocumentChange, type DocumentSnapshot, type QuerySnapshot, type WhereOp, } from './collections.js';
|
|
5
|
+
import { type OfflineController, type OfflineOptions } from './offline.js';
|
|
6
|
+
import { CrashReporter } from './crashes.js';
|
|
7
|
+
export { CrashReporter, parseStack, type Breadcrumb, type CrashEvent, type CrashOptions } from './crashes.js';
|
|
8
|
+
export { evaluateQuery, indexedDbStorage, keyValueStorage, memoryStorage, type OfflineController, type OfflineOptions, type OfflineStorage, } from './offline.js';
|
|
9
|
+
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';
|
|
10
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
11
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
12
|
+
export type JsonArray = JsonValue[];
|
|
13
|
+
export type JsonObject = {
|
|
14
|
+
[key: string]: JsonValue;
|
|
15
|
+
};
|
|
16
|
+
export interface SovariaScope {
|
|
17
|
+
orgId: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
envId?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Where a signed-in session is kept between page loads (localStorage-compatible). */
|
|
22
|
+
export interface SessionStorageLike {
|
|
23
|
+
getItem(key: string): string | null;
|
|
24
|
+
setItem(key: string, value: string): void;
|
|
25
|
+
removeItem(key: string): void;
|
|
26
|
+
}
|
|
27
|
+
/** The signed-in app user's tokens. `null` when nobody is signed in (anon key only). */
|
|
28
|
+
export interface SovariaSession {
|
|
29
|
+
access_token: string;
|
|
30
|
+
refresh_token?: string;
|
|
31
|
+
/** Epoch milliseconds when the access token expires. */
|
|
32
|
+
expires_at: number;
|
|
33
|
+
}
|
|
34
|
+
export type AuthChangeEvent = 'INITIAL_SESSION' | 'SIGNED_IN' | 'TOKEN_REFRESHED' | 'SIGNED_OUT';
|
|
35
|
+
export type PersistSessionOption = boolean | {
|
|
36
|
+
storage?: SessionStorageLike;
|
|
37
|
+
key?: string;
|
|
38
|
+
};
|
|
39
|
+
export interface SovariaSDKOptions {
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
/**
|
|
42
|
+
* Keep the signed-in session across reloads and tell listeners about sign-in/out.
|
|
43
|
+
* `true` uses localStorage; pass `{ storage, key }` for anything else (cookies, AsyncStorage adapter…).
|
|
44
|
+
*/
|
|
45
|
+
persistSession?: PersistSessionOption;
|
|
46
|
+
accessToken?: string;
|
|
47
|
+
refreshToken?: string;
|
|
48
|
+
expiresIn?: number;
|
|
49
|
+
fetchImpl?: typeof fetch;
|
|
50
|
+
retryCount?: number;
|
|
51
|
+
retryBaseDelayMs?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Called whenever tokens are set or refreshed (login, refresh, OTP verify, etc.).
|
|
54
|
+
* The default payload omits `refresh_token`. Use `onTokenRefreshSensitive` if you
|
|
55
|
+
* explicitly need the refresh token (store it securely; never log it).
|
|
56
|
+
*/
|
|
57
|
+
onTokenRefresh?: (tokens: JsonObject) => void;
|
|
58
|
+
/** Opt-in callback that receives the full token JSON including refresh_token. */
|
|
59
|
+
onTokenRefreshSensitive?: (tokens: JsonObject) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Mobile / desktop apps: the device this app runs on. Sessions are grouped by it
|
|
62
|
+
* (`auth.listDevices`, sign a device out) and push tokens are tied to it. Keep `id` stable
|
|
63
|
+
* (generate once, store it in the Keychain / Keystore / AsyncStorage).
|
|
64
|
+
*/
|
|
65
|
+
device?: SovariaDevice;
|
|
66
|
+
/**
|
|
67
|
+
* App attestation: returns the current attestation token (from `api.attestation.exchange`)
|
|
68
|
+
* or null. Sent as `X-Sovaria-Attestation` on every request when the project enforces it.
|
|
69
|
+
*/
|
|
70
|
+
attestationToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
71
|
+
}
|
|
72
|
+
export interface SovariaDevice {
|
|
73
|
+
id: string;
|
|
74
|
+
name?: string;
|
|
75
|
+
platform?: 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'other';
|
|
76
|
+
appVersion?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface SovariaPortalConfig {
|
|
79
|
+
url?: string;
|
|
80
|
+
baseUrl?: string;
|
|
81
|
+
orgId?: string;
|
|
82
|
+
org_id?: string;
|
|
83
|
+
projectId?: string;
|
|
84
|
+
project_id?: string;
|
|
85
|
+
envId?: string;
|
|
86
|
+
env_id?: string;
|
|
87
|
+
accessToken?: string;
|
|
88
|
+
access_token?: string;
|
|
89
|
+
publishableKey?: string;
|
|
90
|
+
publishable_key?: string;
|
|
91
|
+
anonKey?: string;
|
|
92
|
+
anon_key?: string;
|
|
93
|
+
expiresIn?: number;
|
|
94
|
+
expires_in?: number;
|
|
95
|
+
/** Called with new tokens after a refresh — persist them so the user stays signed in. */
|
|
96
|
+
onTokenRefresh?: (tokens: JsonObject) => void;
|
|
97
|
+
onTokenRefreshSensitive?: (tokens: JsonObject) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Keep the app user's session across reloads (default: on in browsers when a publishable/anon key
|
|
100
|
+
* is given). `false` turns it off; `{ storage, key }` stores it somewhere else.
|
|
101
|
+
*/
|
|
102
|
+
persistSession?: PersistSessionOption;
|
|
103
|
+
}
|
|
104
|
+
export interface RequestOptions {
|
|
105
|
+
query?: Record<string, string | number | boolean | null | undefined>;
|
|
106
|
+
body?: unknown;
|
|
107
|
+
headers?: Record<string, string>;
|
|
108
|
+
requiresAuth?: boolean;
|
|
109
|
+
requiresScope?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Idempotency-Key sent on every attempt. Writes (POST/PUT/PATCH/DELETE) get a fresh key per call
|
|
112
|
+
* when this is not set; pass your own to make a call safe to repeat yourself (same key, same body).
|
|
113
|
+
*/
|
|
114
|
+
idempotencyKey?: string;
|
|
115
|
+
/** Kept for compatibility: every write now carries a stable Idempotency-Key from the first attempt. */
|
|
116
|
+
idempotent?: boolean;
|
|
117
|
+
/** 'blob' returns the raw response body (binary downloads); default parses JSON or text. */
|
|
118
|
+
responseType?: 'json' | 'blob';
|
|
119
|
+
/** Called with the response headers of a successful response (paging cursors, totals). */
|
|
120
|
+
onResponseHeaders?: (headers: Headers) => void;
|
|
121
|
+
}
|
|
122
|
+
/** `sovaria.data.dryRunMigrations`: every migration ran in order in one transaction, then rolled back. */
|
|
123
|
+
/** `sovaria.data.schemaDigest`: the schema as one short line per table. */
|
|
124
|
+
export interface SchemaDigest {
|
|
125
|
+
/** Changes whenever the schema does; pass it back as `since`. */
|
|
126
|
+
version: string;
|
|
127
|
+
tables: number;
|
|
128
|
+
/** 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)`. */
|
|
129
|
+
text?: string;
|
|
130
|
+
/** Only with `since`, when nothing changed (no `text`). */
|
|
131
|
+
unchanged?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/** One table in a schema plan. Columns are short form (`"status text!='draft' in(draft|live)"`, `"customer_id →customers cascade"`) or objects. */
|
|
134
|
+
export interface SchemaPlanTable {
|
|
135
|
+
name: string;
|
|
136
|
+
columns?: Array<string | {
|
|
137
|
+
name: string;
|
|
138
|
+
type?: string;
|
|
139
|
+
nullable?: boolean;
|
|
140
|
+
default?: string | number | boolean;
|
|
141
|
+
unique?: boolean;
|
|
142
|
+
references?: string;
|
|
143
|
+
on_delete?: 'cascade' | 'set null' | 'restrict';
|
|
144
|
+
values?: string[];
|
|
145
|
+
check?: string;
|
|
146
|
+
index?: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
/** owner_rows: user_id + each signed-in user sees only their rows; public_read (with owner_rows); timestamps; soft_delete. */
|
|
149
|
+
patterns?: Array<'owner_rows' | 'public_read' | 'timestamps' | 'soft_delete'>;
|
|
150
|
+
owner?: string;
|
|
151
|
+
primary_key?: string[];
|
|
152
|
+
unique?: string[][];
|
|
153
|
+
indexes?: string[][];
|
|
154
|
+
}
|
|
155
|
+
/** `sovaria.data.applySchemaPlan`: what the plan created and changed, and whether the result matches it. */
|
|
156
|
+
export interface SchemaPlanResult {
|
|
157
|
+
status: 'applied' | 'dry_run_ok' | 'unchanged';
|
|
158
|
+
migration_version?: string;
|
|
159
|
+
created?: string[];
|
|
160
|
+
/** Per extended table: what was added (`+column`, `idx(..)`, `rls:owner(..)`). */
|
|
161
|
+
altered?: Record<string, string[]>;
|
|
162
|
+
notes?: string[];
|
|
163
|
+
/** The touched tables as they now are (digest lines). */
|
|
164
|
+
digest?: string;
|
|
165
|
+
/** With dryRun: the SQL that would run, and its undo. */
|
|
166
|
+
up_sql?: string;
|
|
167
|
+
down_sql?: string;
|
|
168
|
+
verification?: {
|
|
169
|
+
ok: boolean;
|
|
170
|
+
checks: Array<{
|
|
171
|
+
check: string;
|
|
172
|
+
ok: boolean;
|
|
173
|
+
problems?: string[];
|
|
174
|
+
}>;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface MigrationSequenceResult {
|
|
178
|
+
status: 'dry_run_ok' | 'failed';
|
|
179
|
+
/** How many ran cleanly (before the failing one, when one fails). */
|
|
180
|
+
checked: number;
|
|
181
|
+
total: number;
|
|
182
|
+
duration_ms: number;
|
|
183
|
+
/** The first migration that fails: its position in the list, name and the database error. */
|
|
184
|
+
failed?: {
|
|
185
|
+
index: number;
|
|
186
|
+
name: string;
|
|
187
|
+
error: string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
export interface ProductUsersPage {
|
|
191
|
+
users: JsonObject[];
|
|
192
|
+
/** Pass back as `cursor` for the next page; null on the last page. */
|
|
193
|
+
nextCursor: string | null;
|
|
194
|
+
/** Users matching the filter; sent with the first page. */
|
|
195
|
+
total: number | null;
|
|
196
|
+
}
|
|
197
|
+
export declare class SovariaSDK {
|
|
198
|
+
private readonly baseUrl;
|
|
199
|
+
private readonly fetchImpl;
|
|
200
|
+
private readonly retryCount;
|
|
201
|
+
private readonly retryBaseDelayMs;
|
|
202
|
+
private accessToken;
|
|
203
|
+
/** Project anon/publishable key: the token used when no user is signed in. */
|
|
204
|
+
private publishableKey;
|
|
205
|
+
/** PKCE verifier for an in-flight provider sign-in (fallback when sessionStorage is unavailable). */
|
|
206
|
+
private ssoVerifier;
|
|
207
|
+
/** PKCE verifier for an email link that opens an app (magic link / password reset). */
|
|
208
|
+
private linkVerifier;
|
|
209
|
+
private readonly device?;
|
|
210
|
+
private readonly attestationToken?;
|
|
211
|
+
private refreshToken;
|
|
212
|
+
private expiresAtMs;
|
|
213
|
+
private refreshInFlight;
|
|
214
|
+
private scope?;
|
|
215
|
+
/** In-flight lookup of the project/org behind a project URL (see resolveScope). */
|
|
216
|
+
private scopeLookup?;
|
|
217
|
+
private readonly onTokenRefresh?;
|
|
218
|
+
private readonly onTokenRefreshSensitive?;
|
|
219
|
+
private sessionStore?;
|
|
220
|
+
private readonly authListeners;
|
|
221
|
+
/** Session-cached Argon2id salt (hex from login/register). */
|
|
222
|
+
private argon2Salt?;
|
|
223
|
+
/** Session-cached KEK derived at login — reused for E2EE document ops. */
|
|
224
|
+
private cachedKek?;
|
|
225
|
+
constructor(options: SovariaSDKOptions);
|
|
226
|
+
/** Device + attestation headers (mobile apps); empty for a plain web or server client. */
|
|
227
|
+
private clientHeaders;
|
|
228
|
+
/** Start a PKCE pair for an email link; the verifier is kept (session storage too) until the link is opened. */
|
|
229
|
+
private startLinkPkce;
|
|
230
|
+
private takeLinkVerifier;
|
|
231
|
+
private configureSessionStore;
|
|
232
|
+
/** Load a stored session (called once the publishable key is known, so sign-out falls back to it). */
|
|
233
|
+
private restoreSession;
|
|
234
|
+
private writeSession;
|
|
235
|
+
private currentSession;
|
|
236
|
+
private emitAuth;
|
|
237
|
+
static fromPortalConfig(config: SovariaPortalConfig): SovariaSDK;
|
|
238
|
+
static fromEnv(env?: Record<string, string | undefined>): SovariaSDK;
|
|
239
|
+
setAccessToken(token: string, options?: {
|
|
240
|
+
expiresIn?: number;
|
|
241
|
+
}): this;
|
|
242
|
+
setRefreshToken(token: string): this;
|
|
243
|
+
clearAccessToken(): this;
|
|
244
|
+
private clearKekCache;
|
|
245
|
+
private cacheArgon2SaltFromResponse;
|
|
246
|
+
private tryDeriveKekFromPassword;
|
|
247
|
+
private applyAuthResponse;
|
|
248
|
+
private tokenNeedsRefresh;
|
|
249
|
+
/** Refresh when the token is near expiry, or always with `force` (the server said 401). */
|
|
250
|
+
private ensureAccessTokenFresh;
|
|
251
|
+
setScope(scope: SovariaScope): this;
|
|
252
|
+
clearScope(): this;
|
|
253
|
+
/**
|
|
254
|
+
* The org/project this client talks to. Set explicitly with setScope(), or discovered once from
|
|
255
|
+
* the project URL (https://<ref>.sovarias.in) — so `createClient(projectUrl, anonKey)` is enough.
|
|
256
|
+
*/
|
|
257
|
+
resolveScope(): Promise<SovariaScope | undefined>;
|
|
258
|
+
getScopeHeaders(): Record<string, string>;
|
|
259
|
+
getRealtimeWebSocketUrl(channel: string, ticket?: string): string;
|
|
260
|
+
issueRealtimeWebSocketTicket(channel: string): Promise<string>;
|
|
261
|
+
getRealtimeWebSocketUrlWithTicket(channel: string): Promise<string>;
|
|
262
|
+
private offlineTransport?;
|
|
263
|
+
/**
|
|
264
|
+
* Offline-first documents: reads fall back to a local cache, offline writes are applied locally at
|
|
265
|
+
* once and queued, and everything syncs in order when the connection is back. Call once, before
|
|
266
|
+
* reading or writing documents.
|
|
267
|
+
*
|
|
268
|
+
* ```ts
|
|
269
|
+
* const offline = sov.enableOffline({ storage: indexedDbStorage(), onSyncError: (e, writes) => console.warn(e, writes) })
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
enableOffline(options?: OfflineOptions): OfflineController;
|
|
273
|
+
private documentsTransport;
|
|
274
|
+
private onlineDocumentsTransport;
|
|
275
|
+
/**
|
|
276
|
+
* A document collection (or `users/alice/posts` subcollection): field queries, cursors,
|
|
277
|
+
* live listeners and `add`.
|
|
278
|
+
*
|
|
279
|
+
* ```ts
|
|
280
|
+
* const snap = await sov.collection('posts').where('tags', 'array-contains', 'news').orderBy('at', 'desc').limit(20).get()
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
collection<T = JsonObject>(path: string): Query<T>;
|
|
284
|
+
/** A document reference: `get`, `set` (merge), `create`, `update` with FieldValue transforms, `delete`, `onSnapshot`. */
|
|
285
|
+
doc<T = JsonObject>(path: string): DocumentReference<T>;
|
|
286
|
+
/** Writes committed together: every one or none. */
|
|
287
|
+
batch(): WriteBatch;
|
|
288
|
+
/** Read then write atomically; retried (up to `maxAttempts`) when a document it read changes meanwhile. */
|
|
289
|
+
runTransaction<R>(fn: (tx: Transaction) => Promise<R>, maxAttempts?: number): Promise<R>;
|
|
290
|
+
/**
|
|
291
|
+
* App crash reporting: `sov.crashes.install({ release })` reports uncaught errors (browser and React
|
|
292
|
+
* Native); `sov.crashes.capture(error)` reports one you caught. Issues appear in the console under
|
|
293
|
+
* Observability › Crashes.
|
|
294
|
+
*/
|
|
295
|
+
readonly crashes: CrashReporter;
|
|
296
|
+
request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
297
|
+
private requestImpl;
|
|
298
|
+
private pathRequiresScope;
|
|
299
|
+
private assertScopePresent;
|
|
300
|
+
private productAuthRequest;
|
|
301
|
+
private productAuthPath;
|
|
302
|
+
readonly auth: {
|
|
303
|
+
/**
|
|
304
|
+
* Listen for sign-in, token refresh and sign-out. Fires once right away with the current
|
|
305
|
+
* session (`INITIAL_SESSION`). Returns a function that stops listening.
|
|
306
|
+
*/
|
|
307
|
+
onAuthStateChange: (callback: (event: AuthChangeEvent, session: SovariaSession | null) => void) => () => void;
|
|
308
|
+
/** The signed-in app user's session, or null. */
|
|
309
|
+
getSession: () => SovariaSession | null;
|
|
310
|
+
/** Sign the app user out (revokes the refresh token) and fall back to the anon key. */
|
|
311
|
+
signOut: () => Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Create an app user and sign them in. When the project requires email confirmation, the
|
|
314
|
+
* result has `email_verification_required: true` and no session until the user confirms.
|
|
315
|
+
*/
|
|
316
|
+
signUp: (email: string, password: string, name?: string) => Promise<JsonObject>;
|
|
317
|
+
/** Sign an app user in with email and password (same as projectLogin). */
|
|
318
|
+
signIn: (email: string, password: string) => Promise<JsonObject>;
|
|
319
|
+
/** Create an app user (no session). Most apps want signUp(), which also signs them in. */
|
|
320
|
+
register: (email: string, password: string, name: string) => Promise<JsonObject>;
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated Use {@link consoleLogin} for operators or {@link projectLogin}
|
|
323
|
+
* for product users. Unscoped calls post to `/api/v1/auth/console/login`.
|
|
324
|
+
*/
|
|
325
|
+
login: (email: string, password: string) => Promise<JsonObject>;
|
|
326
|
+
/** Strict console login — rejects every project-scoped credential. */
|
|
327
|
+
consoleLogin: (email: string, password: string) => Promise<JsonObject>;
|
|
328
|
+
/** Alias for consoleLogin() matching lane terminology in docs. */
|
|
329
|
+
loginConsole: (email: string, password: string) => Promise<JsonObject>;
|
|
330
|
+
/** Strict project login — requires X-Sovaria-Org-ID + X-Sovaria-Project-ID. */
|
|
331
|
+
projectLogin: (email: string, password: string) => Promise<JsonObject>;
|
|
332
|
+
/** Alias for projectLogin() matching lane terminology in docs. */
|
|
333
|
+
loginProduct: (email: string, password: string) => Promise<JsonObject>;
|
|
334
|
+
refresh: (refreshToken: string) => Promise<JsonObject>;
|
|
335
|
+
logout: (refreshToken?: string) => Promise<JsonObject>;
|
|
336
|
+
me: () => Promise<JsonObject>;
|
|
337
|
+
verifyMfa: (code: string, method?: "totp" | "phone") => Promise<JsonObject>;
|
|
338
|
+
/** Send a one-time login link by email. Returns 200 even for unknown emails. */
|
|
339
|
+
/**
|
|
340
|
+
* Email a sign-in link (plus a 6-digit code). A link that opens a mobile app (`myapp://…` or a
|
|
341
|
+
* registered app link) is bound to this app with PKCE automatically; pass `pkce: true` to force it.
|
|
342
|
+
*/
|
|
343
|
+
sendMagicLink: (email: string, opts?: {
|
|
344
|
+
orgId?: string;
|
|
345
|
+
projectId?: string;
|
|
346
|
+
redirectTo?: string;
|
|
347
|
+
pkce?: boolean;
|
|
348
|
+
}) => Promise<JsonObject>;
|
|
349
|
+
/** Email a password-reset link. Returns 200 even for unknown emails. */
|
|
350
|
+
resetPasswordForEmail: (email: string, opts?: {
|
|
351
|
+
orgId?: string;
|
|
352
|
+
projectId?: string;
|
|
353
|
+
redirectTo?: string;
|
|
354
|
+
pkce?: boolean;
|
|
355
|
+
}) => Promise<JsonObject>;
|
|
356
|
+
/** Set a new password with the token from a reset link (`type=recovery`). */
|
|
357
|
+
confirmPasswordReset: (token: string, newPassword: string, codeVerifier?: string) => Promise<JsonObject>;
|
|
358
|
+
/**
|
|
359
|
+
* Handle the link an auth email opened (`?token=…&type=…` on your Site URL).
|
|
360
|
+
* Magic links sign the user in; email confirmations are confirmed; for `recovery`
|
|
361
|
+
* the token is returned so you can show a "new password" form and call
|
|
362
|
+
* `confirmPasswordReset`. Returns null when the URL isn't an auth link.
|
|
363
|
+
*/
|
|
364
|
+
handleEmailLink: (url?: string) => Promise<{
|
|
365
|
+
type: string;
|
|
366
|
+
error: string;
|
|
367
|
+
description: string | undefined;
|
|
368
|
+
session?: undefined;
|
|
369
|
+
result?: undefined;
|
|
370
|
+
token?: undefined;
|
|
371
|
+
} | {
|
|
372
|
+
type: string;
|
|
373
|
+
session: JsonObject;
|
|
374
|
+
error?: undefined;
|
|
375
|
+
description?: undefined;
|
|
376
|
+
result?: undefined;
|
|
377
|
+
token?: undefined;
|
|
378
|
+
} | {
|
|
379
|
+
type: string;
|
|
380
|
+
result: JsonObject;
|
|
381
|
+
error?: undefined;
|
|
382
|
+
description?: undefined;
|
|
383
|
+
session?: undefined;
|
|
384
|
+
token?: undefined;
|
|
385
|
+
} | {
|
|
386
|
+
type: string;
|
|
387
|
+
token: string;
|
|
388
|
+
error?: undefined;
|
|
389
|
+
description?: undefined;
|
|
390
|
+
session?: undefined;
|
|
391
|
+
result?: undefined;
|
|
392
|
+
} | null>;
|
|
393
|
+
/**
|
|
394
|
+
* "Sign in with Google / GitHub / …" (providers connected in Authentication › Sign in / Providers).
|
|
395
|
+
* Sends the browser to the provider; it comes back to `redirectTo` (or your Site URL) with
|
|
396
|
+
* `?code=…&type=sso`, which `handleEmailLink()` / `exchangeCodeForSession()` turn into a session.
|
|
397
|
+
* A PKCE verifier is kept in sessionStorage so only this browser can redeem the code.
|
|
398
|
+
*/
|
|
399
|
+
signInWithProvider: (providerId: string, opts?: {
|
|
400
|
+
redirectTo?: string;
|
|
401
|
+
projectId?: string;
|
|
402
|
+
}) => Promise<{
|
|
403
|
+
url: string;
|
|
404
|
+
}>;
|
|
405
|
+
/** Exchange the one-time `code` from a provider sign-in redirect for a session. */
|
|
406
|
+
exchangeCodeForSession: (code: string, codeVerifier?: string) => Promise<JsonObject>;
|
|
407
|
+
/** Enabled social / enterprise providers for your sign-in screen. */
|
|
408
|
+
listProviders: (projectId?: string) => Promise<JsonValue>;
|
|
409
|
+
/** Public sign-in config for a project: enabled providers, password rules, MFA factors, passkeys. */
|
|
410
|
+
getPublicConfig: (projectId?: string) => Promise<JsonObject>;
|
|
411
|
+
/** Exchange a magic-link token for an access + refresh token pair. */
|
|
412
|
+
verifyMagicLink: (token: string, codeVerifier?: string) => Promise<JsonObject>;
|
|
413
|
+
/**
|
|
414
|
+
* Sign in with the 6-digit code from the sign-in email (the same email carries the magic link).
|
|
415
|
+
* Uses the client scope's org/project unless given.
|
|
416
|
+
*/
|
|
417
|
+
verifyEmailCode: (email: string, code: string, opts?: {
|
|
418
|
+
orgId?: string;
|
|
419
|
+
projectId?: string;
|
|
420
|
+
}) => Promise<JsonObject>;
|
|
421
|
+
/** Send an SMS OTP code for phone-based login. */
|
|
422
|
+
sendOtp: (phone: string, opts?: {
|
|
423
|
+
orgId?: string;
|
|
424
|
+
projectId?: string;
|
|
425
|
+
envId?: string;
|
|
426
|
+
}) => Promise<JsonObject>;
|
|
427
|
+
/** Verify an SMS OTP code and establish a session.
|
|
428
|
+
* Passwordless by default — pass `password` when argon2_salt is present to
|
|
429
|
+
* populate the session KEK without a follow-up password login.
|
|
430
|
+
*/
|
|
431
|
+
verifyOtp: (phone: string, code: string, opts?: {
|
|
432
|
+
orgId?: string;
|
|
433
|
+
projectId?: string;
|
|
434
|
+
envId?: string;
|
|
435
|
+
password?: string;
|
|
436
|
+
}) => Promise<JsonObject>;
|
|
437
|
+
/** Exchange an OAuth handoff token for a session (console OAuth callback).
|
|
438
|
+
* Passwordless: session KEK is not derived unless `password` is supplied.
|
|
439
|
+
*/
|
|
440
|
+
oauthHandoff: (token: string, password?: string) => Promise<JsonObject>;
|
|
441
|
+
/** Console-operator listing of product users across accessible projects. Path: GET /api/v1/auth/product-users (console lane). */
|
|
442
|
+
listConsoleProductUsers: () => Promise<JsonValue>;
|
|
443
|
+
/** Trigger a verification email for the authenticated user. */
|
|
444
|
+
sendVerificationEmail: () => Promise<JsonObject>;
|
|
445
|
+
/** Confirm an email-verification token. */
|
|
446
|
+
confirmVerificationEmail: (token: string) => Promise<JsonObject>;
|
|
447
|
+
/**
|
|
448
|
+
* Auth event hooks (per-project HTTP webhooks). The project is the client's scope
|
|
449
|
+
* (`X-Sovaria-Project-ID`); the caller must be an owner or admin of it.
|
|
450
|
+
*/
|
|
451
|
+
eventHooks: {
|
|
452
|
+
list: () => Promise<JsonValue>;
|
|
453
|
+
create: (payload: {
|
|
454
|
+
name: string;
|
|
455
|
+
url: string;
|
|
456
|
+
events: string[];
|
|
457
|
+
secret?: string;
|
|
458
|
+
enabled?: boolean;
|
|
459
|
+
projectId?: string;
|
|
460
|
+
}) => Promise<JsonObject>;
|
|
461
|
+
delete: (hookId: string) => Promise<JsonObject>;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated Legacy GET `/api/v1/auth/users`. Use `productUsers.list()` for
|
|
465
|
+
* project-scoped product users or `listConsoleProductUsers()` for the console
|
|
466
|
+
* product-user admin path. Use `consoleMembers.list()` for org console members.
|
|
467
|
+
*/
|
|
468
|
+
listUsers: () => Promise<JsonValue>;
|
|
469
|
+
/**
|
|
470
|
+
* @deprecated Legacy DELETE `/api/v1/auth/users/{id}`. Use `productUsers.delete()`
|
|
471
|
+
* or `consoleMembers.delete()`.
|
|
472
|
+
*/
|
|
473
|
+
deleteUser: (userId: string) => Promise<JsonObject>;
|
|
474
|
+
/**
|
|
475
|
+
* @deprecated Legacy POST `/api/v1/auth/users/{id}/ban`. Use `productUsers.ban()`.
|
|
476
|
+
*/
|
|
477
|
+
banUser: (userId: string) => Promise<JsonObject>;
|
|
478
|
+
/** Org console-member management. Canonical path: GET /api/v1/org/{orgId}/members. Not product users. */
|
|
479
|
+
consoleMembers: {
|
|
480
|
+
list: () => Promise<JsonValue>;
|
|
481
|
+
delete: (userId: string) => Promise<JsonObject>;
|
|
482
|
+
ban: (userId: string) => Promise<JsonObject>;
|
|
483
|
+
};
|
|
484
|
+
/** Product auth admin (project-scoped identities). Path: GET /api/v1/projects/{id}/auth/users. Requires setScope. */
|
|
485
|
+
productUsers: {
|
|
486
|
+
/** Every product user: follows all pages. Use `listPage()` for big projects. */
|
|
487
|
+
list: () => Promise<JsonObject[]>;
|
|
488
|
+
/** One page of product users, newest first. `search` matches part of an email or an exact id. */
|
|
489
|
+
listPage: (params?: {
|
|
490
|
+
limit?: number;
|
|
491
|
+
cursor?: string | null;
|
|
492
|
+
search?: string;
|
|
493
|
+
status?: "active" | "banned";
|
|
494
|
+
}) => Promise<ProductUsersPage>;
|
|
495
|
+
delete: (userId: string) => Promise<JsonObject>;
|
|
496
|
+
ban: (userId: string) => Promise<JsonObject>;
|
|
497
|
+
roles: (userId: string) => Promise<JsonObject>;
|
|
498
|
+
setRoles: (userId: string, roles: string[]) => Promise<JsonObject>;
|
|
499
|
+
create: (payload: {
|
|
500
|
+
email: string;
|
|
501
|
+
password: string;
|
|
502
|
+
name?: string;
|
|
503
|
+
roles?: string[];
|
|
504
|
+
}) => Promise<JsonObject>;
|
|
505
|
+
/**
|
|
506
|
+
* Bulk-import app users (up to 1,000 per call) with their ids and password hashes: `bcrypt`
|
|
507
|
+
* (Supabase) as is, `firebase_scrypt` (Firebase) checked with `hashConfig` and upgraded to bcrypt
|
|
508
|
+
* at first sign-in. No emails, hooks or triggers fire; existing emails are skipped. Org owners/admins.
|
|
509
|
+
*/
|
|
510
|
+
import: (users: Array<{
|
|
511
|
+
email: string;
|
|
512
|
+
id?: string;
|
|
513
|
+
email_verified?: boolean;
|
|
514
|
+
phone?: string | null;
|
|
515
|
+
display_name?: string | null;
|
|
516
|
+
password_algorithm?: "bcrypt" | "firebase_scrypt" | null;
|
|
517
|
+
password_hash?: string | null;
|
|
518
|
+
password_salt?: string | null;
|
|
519
|
+
}>, hashConfig?: {
|
|
520
|
+
signer_key: string;
|
|
521
|
+
salt_separator: string;
|
|
522
|
+
rounds: number;
|
|
523
|
+
mem_cost: number;
|
|
524
|
+
}) => Promise<JsonObject>;
|
|
525
|
+
};
|
|
526
|
+
sessions: {
|
|
527
|
+
list: () => Promise<JsonValue>;
|
|
528
|
+
revoke: (sessionId: string) => Promise<JsonObject>;
|
|
529
|
+
revokeOthers: () => Promise<JsonObject>;
|
|
530
|
+
getConfig: () => Promise<JsonObject>;
|
|
531
|
+
setConfig: (body: JsonObject) => Promise<JsonObject>;
|
|
532
|
+
};
|
|
533
|
+
providersConfig: {
|
|
534
|
+
get: () => Promise<JsonObject>;
|
|
535
|
+
set: (body: JsonObject) => Promise<JsonObject>;
|
|
536
|
+
};
|
|
537
|
+
mfa: {
|
|
538
|
+
status: () => Promise<JsonObject>;
|
|
539
|
+
enroll: () => Promise<JsonObject>;
|
|
540
|
+
disable: (totpCode: string) => Promise<JsonObject>;
|
|
541
|
+
};
|
|
542
|
+
github: {
|
|
543
|
+
connectionState: () => Promise<JsonObject>;
|
|
544
|
+
disconnect: () => Promise<JsonObject>;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
readonly graph: {
|
|
548
|
+
createNode: (nodeType: string, name: string, metadata?: JsonObject) => Promise<JsonObject>;
|
|
549
|
+
createEdge: (sourceId: string, targetId: string, relationType: string, role?: string) => Promise<JsonObject>;
|
|
550
|
+
addMember: (orgId: string, userId: string, role?: string) => Promise<JsonObject>;
|
|
551
|
+
getContext: (userId: string, resourceId: string) => Promise<JsonObject>;
|
|
552
|
+
listNodes: (nodeType?: string) => Promise<JsonValue>;
|
|
553
|
+
getNode: (nodeId: string) => Promise<JsonObject>;
|
|
554
|
+
getChildren: (parentId: string, relation?: string) => Promise<JsonValue>;
|
|
555
|
+
updateOrg: (orgId: string, body: JsonObject) => Promise<JsonObject>;
|
|
556
|
+
deleteOrg: (orgId: string) => Promise<JsonObject>;
|
|
557
|
+
setOrgPlan: (orgId: string, body: JsonObject) => Promise<JsonObject>;
|
|
558
|
+
listMembers: (orgId: string) => Promise<JsonValue>;
|
|
559
|
+
removeMember: (orgId: string, userId: string) => Promise<JsonObject>;
|
|
560
|
+
updateMember: (orgId: string, userId: string, body: JsonObject) => Promise<JsonObject>;
|
|
561
|
+
createInvite: (orgId: string, body: JsonObject) => Promise<JsonObject>;
|
|
562
|
+
acceptInvite: (body: JsonObject) => Promise<JsonObject>;
|
|
563
|
+
getRoleMatrix: () => Promise<JsonObject>;
|
|
564
|
+
setRoleMatrix: (body: JsonObject) => Promise<JsonObject>;
|
|
565
|
+
getRoleCatalog: () => Promise<JsonValue>;
|
|
566
|
+
getProjectRef: (projectId: string) => Promise<JsonObject>;
|
|
567
|
+
getProjectSettings: () => Promise<JsonObject>;
|
|
568
|
+
setProjectSettings: (body: JsonObject) => Promise<JsonObject>;
|
|
569
|
+
};
|
|
570
|
+
readonly data: {
|
|
571
|
+
docPut: (collection: string, documentId: string, data: JsonObject) => Promise<JsonObject>;
|
|
572
|
+
docGet: (collection: string, documentId: string, atTxid?: number) => Promise<JsonObject>;
|
|
573
|
+
docDelete: (collection: string, documentId: string) => Promise<JsonObject>;
|
|
574
|
+
/** Encrypt client-side and write a Zero-Knowledge document envelope to Atlas-Doc. */
|
|
575
|
+
putDocumentE2ee: (collection: string, documentId: string, plaintext: Uint8Array | string, password?: string) => Promise<JsonObject>;
|
|
576
|
+
/** Retrieve and decrypt a Zero-Knowledge document from Atlas-Doc. */
|
|
577
|
+
getDocumentE2ee: (collection: string, documentId: string, password?: string, atTxid?: number) => Promise<{
|
|
578
|
+
plaintext: Uint8Array<ArrayBufferLike>;
|
|
579
|
+
}>;
|
|
580
|
+
/**
|
|
581
|
+
* List the documents in one collection (newest writes last): `[{ id, data, txid }]`.
|
|
582
|
+
* Subcollections are not included — list `collection/<docId>/<sub>` for those.
|
|
583
|
+
*/
|
|
584
|
+
docList: (collection: string, options?: {
|
|
585
|
+
limit?: number;
|
|
586
|
+
}) => Promise<{
|
|
587
|
+
id: string;
|
|
588
|
+
data: JsonObject;
|
|
589
|
+
txid: number;
|
|
590
|
+
}[]>;
|
|
591
|
+
/** Field query (`where`, `order_by`, `limit`, cursors) — see also `sov.collection(...)`. */
|
|
592
|
+
docQuery: (collection: string, query?: JsonObject) => Promise<JsonObject>;
|
|
593
|
+
docCount: (collection: string, query?: JsonObject) => Promise<JsonObject>;
|
|
594
|
+
/** Atomic commit: `{ op, path, data, merge, transforms, precondition }` writes; `reads` make it a transaction. */
|
|
595
|
+
docCommit: (writes: JsonObject[], reads?: JsonObject[]) => Promise<JsonObject>;
|
|
596
|
+
docIndexes: (collection?: string) => Promise<JsonObject>;
|
|
597
|
+
createDocIndex: (collection: string, fields: (string | {
|
|
598
|
+
path: string;
|
|
599
|
+
order?: "asc" | "desc";
|
|
600
|
+
})[]) => Promise<JsonObject>;
|
|
601
|
+
dropDocIndex: (name: string) => Promise<JsonObject>;
|
|
602
|
+
collectionRules: (collection: string) => Promise<JsonObject>;
|
|
603
|
+
docScan: (args: {
|
|
604
|
+
prefix?: string;
|
|
605
|
+
start_key?: string;
|
|
606
|
+
end_key?: string;
|
|
607
|
+
limit?: number;
|
|
608
|
+
}) => Promise<JsonObject>;
|
|
609
|
+
/**
|
|
610
|
+
* Run one SQL statement. Pass values for `$1, $2, …` as `params` — they are bound by the
|
|
611
|
+
* database, so user input never becomes SQL: `sql('SELECT * FROM books WHERE id = $1', [id])`.
|
|
612
|
+
* A number as the second argument is still read as `txid` (older signature).
|
|
613
|
+
*/
|
|
614
|
+
sql: (sql: string, params?: JsonValue[] | number, txid?: number) => Promise<JsonObject>;
|
|
615
|
+
tableCreate: (payload: JsonObject) => Promise<JsonObject>;
|
|
616
|
+
tableDrop: (tableName: string) => Promise<JsonObject>;
|
|
617
|
+
tableAddColumn: (payload: JsonObject) => Promise<JsonObject>;
|
|
618
|
+
tableDropColumn: (tableName: string, columnName: string) => Promise<JsonObject>;
|
|
619
|
+
tableAddForeignKey: (payload: JsonObject) => Promise<JsonObject>;
|
|
620
|
+
tableDropForeignKey: (payload: JsonObject) => Promise<JsonObject>;
|
|
621
|
+
tableMigrations: (query?: {
|
|
622
|
+
table_name?: string;
|
|
623
|
+
limit?: number;
|
|
624
|
+
offset?: number;
|
|
625
|
+
}) => Promise<JsonObject>;
|
|
626
|
+
/** The schema as one short line per table: types, keys, →references, allowed values, indexes, owner-only rows. */
|
|
627
|
+
schemaDigest: (options?: {
|
|
628
|
+
tables?: string[];
|
|
629
|
+
maxChars?: number;
|
|
630
|
+
since?: string;
|
|
631
|
+
}) => Promise<SchemaDigest>;
|
|
632
|
+
/**
|
|
633
|
+
* Create or extend tables from one declarative plan: checked first (a 422 lists every problem and nothing
|
|
634
|
+
* changes), then applied as one reversible migration and verified. `dryRun` returns the SQL instead.
|
|
635
|
+
*/
|
|
636
|
+
applySchemaPlan: (plan: {
|
|
637
|
+
tables: SchemaPlanTable[];
|
|
638
|
+
dryRun?: boolean;
|
|
639
|
+
name?: string;
|
|
640
|
+
}) => Promise<SchemaPlanResult>;
|
|
641
|
+
/** Apply a migration atomically and record it in the project's history. `downSql` makes it reversible. */
|
|
642
|
+
applyMigration: (migration: {
|
|
643
|
+
name: string;
|
|
644
|
+
upSql: string;
|
|
645
|
+
downSql?: string;
|
|
646
|
+
version?: string;
|
|
647
|
+
}) => Promise<JsonObject>;
|
|
648
|
+
/** Run a migration inside a transaction and roll it back: reports whether it would apply. */
|
|
649
|
+
dryRunMigration: (migration: {
|
|
650
|
+
name: string;
|
|
651
|
+
upSql: string;
|
|
652
|
+
downSql?: string;
|
|
653
|
+
}) => Promise<JsonObject>;
|
|
654
|
+
/**
|
|
655
|
+
* Check several migrations the way they will be applied (what `sov db migrations push --dry-run` does):
|
|
656
|
+
* all run in order inside one transaction that is rolled back, so later ones see what earlier ones
|
|
657
|
+
* create. Up to 500 and 5 MB of SQL; `failed.index` is the first that fails. Nothing is kept.
|
|
658
|
+
*/
|
|
659
|
+
dryRunMigrations: (migrations: Array<{
|
|
660
|
+
name: string;
|
|
661
|
+
upSql: string;
|
|
662
|
+
}>) => Promise<MigrationSequenceResult>;
|
|
663
|
+
/** Undo the latest migration (or `version` with `force`) using its down SQL. */
|
|
664
|
+
rollbackMigration: (opts?: {
|
|
665
|
+
version?: string;
|
|
666
|
+
force?: boolean;
|
|
667
|
+
}) => Promise<JsonObject>;
|
|
668
|
+
beginTransaction: () => Promise<JsonObject>;
|
|
669
|
+
commitTransaction: (txid: number) => Promise<JsonObject>;
|
|
670
|
+
rollbackTransaction: (txid: number) => Promise<JsonObject>;
|
|
671
|
+
};
|
|
672
|
+
readonly realtime: {
|
|
673
|
+
subscribe: (channel: string, clientId: string) => Promise<JsonObject>;
|
|
674
|
+
unsubscribe: (channel: string, clientId: string) => Promise<JsonObject>;
|
|
675
|
+
presence: (channel: string) => Promise<JsonObject>;
|
|
676
|
+
channels: () => Promise<JsonObject>;
|
|
677
|
+
replay: (channel: string, after?: number, limit?: number) => Promise<JsonObject>;
|
|
678
|
+
publish: (channel: string, payload: JsonObject, clock?: JsonObject, clockDelta?: JsonObject) => Promise<JsonObject>;
|
|
679
|
+
e2eeBootstrap: (channel: string, ttlSeconds?: number, forceNew?: boolean) => Promise<JsonObject>;
|
|
680
|
+
e2eeRotate: (channel: string, ttlSeconds?: number) => Promise<JsonObject>;
|
|
681
|
+
e2eeRevoke: (channel: string, keyId?: string, reason?: string) => Promise<JsonObject>;
|
|
682
|
+
/** Pass your RSA-OAEP (SHA-256) public key — PEM or base64 SPKI — to get the key wrapped for you. */
|
|
683
|
+
e2eeActiveKey: (channel: string, clientPublicKey?: string) => Promise<JsonObject>;
|
|
684
|
+
e2eeGetKey: (channel: string, keyId: string, clientPublicKey?: string) => Promise<JsonObject>;
|
|
685
|
+
e2eeListKeys: (channel: string) => Promise<JsonObject>;
|
|
686
|
+
wsTicket: (channel: string) => Promise<string>;
|
|
687
|
+
wsUrl: (channel: string, ticket?: string) => string;
|
|
688
|
+
wsUrlWithTicket: (channel: string) => Promise<string>;
|
|
689
|
+
/**
|
|
690
|
+
* Listen on a channel over WebSocket. Reconnects with backoff (a fresh ticket each time) and
|
|
691
|
+
* hands you each message's payload. Call `close()` when done.
|
|
692
|
+
*
|
|
693
|
+
* ```ts
|
|
694
|
+
* const ch = sov.realtime.channel('book:42', { onMessage: (m) => console.log(m), onStatus: setStatus })
|
|
695
|
+
* await ch.send({ type: 'typing' })
|
|
696
|
+
* ch.close()
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
channel: (name: string, handlers?: RealtimeChannelHandlers) => RealtimeChannel;
|
|
700
|
+
};
|
|
701
|
+
readonly policy: {
|
|
702
|
+
templates: () => Promise<JsonObject>;
|
|
703
|
+
list: () => Promise<JsonValue>;
|
|
704
|
+
get: (policyId: string) => Promise<JsonObject>;
|
|
705
|
+
create: (payload: JsonObject) => Promise<JsonObject>;
|
|
706
|
+
update: (policyId: string, payload: JsonObject) => Promise<JsonObject>;
|
|
707
|
+
delete: (policyId: string) => Promise<JsonObject>;
|
|
708
|
+
evaluate: (policyId: string, context: JsonObject) => Promise<JsonObject>;
|
|
709
|
+
check: (payload: {
|
|
710
|
+
orgId: string;
|
|
711
|
+
projectId: string;
|
|
712
|
+
action: string;
|
|
713
|
+
resource: string;
|
|
714
|
+
context?: JsonObject;
|
|
715
|
+
}) => Promise<JsonObject>;
|
|
716
|
+
preflight: (action: string, resource: string, context?: JsonObject) => Promise<JsonObject>;
|
|
717
|
+
history: (policyId: string) => Promise<JsonValue>;
|
|
718
|
+
rollback: (policyId: string, version: number) => Promise<JsonObject>;
|
|
719
|
+
simulate: (splSource: string, context?: JsonObject) => Promise<JsonObject>;
|
|
720
|
+
};
|
|
721
|
+
readonly audit: {
|
|
722
|
+
append: (payload: JsonObject) => Promise<JsonObject>;
|
|
723
|
+
list: (query?: {
|
|
724
|
+
actor_id?: string;
|
|
725
|
+
event_type?: string;
|
|
726
|
+
source?: string;
|
|
727
|
+
resource_id?: string;
|
|
728
|
+
limit?: number;
|
|
729
|
+
offset?: number;
|
|
730
|
+
}) => Promise<JsonValue>;
|
|
731
|
+
verify: () => Promise<JsonObject>;
|
|
732
|
+
count: () => Promise<JsonObject>;
|
|
733
|
+
};
|
|
734
|
+
readonly simulate: {
|
|
735
|
+
/**
|
|
736
|
+
* Who can do what in the live project, as visitors, the app's users and the team; nothing is
|
|
737
|
+
* written. Narrow with `{ filter: { resource, action, role } }` (role: `__guest__`,
|
|
738
|
+
* `__app_user__`, `app:<role>` or a team role).
|
|
739
|
+
*/
|
|
740
|
+
run: (payload?: JsonObject) => Promise<JsonObject>;
|
|
741
|
+
/**
|
|
742
|
+
* Try a change before making it; nothing is written. `{ kind: 'policy', policy: { spl_source,
|
|
743
|
+
* name?, replaces? }, disable_policy_ids? }` lists who gains and loses access; `{ kind: 'sql',
|
|
744
|
+
* sql }` runs the script with every check, rolls it back and lists what it changed.
|
|
745
|
+
*/
|
|
746
|
+
change: (payload: JsonObject) => Promise<JsonObject>;
|
|
747
|
+
plan: (payload: JsonObject) => Promise<JsonObject>;
|
|
748
|
+
discover: () => Promise<JsonObject>;
|
|
749
|
+
listRuns: (query?: {
|
|
750
|
+
limit?: number;
|
|
751
|
+
offset?: number;
|
|
752
|
+
}) => Promise<JsonValue>;
|
|
753
|
+
getRun: (runId: string) => Promise<JsonObject>;
|
|
754
|
+
compareRuns: (targetRunId: string, baselineRunId: string) => Promise<JsonObject>;
|
|
755
|
+
};
|
|
756
|
+
readonly chrono: {
|
|
757
|
+
/** The project's configuration (policies, schema, functions, settings, buckets, keys) at a commit or ISO time. */
|
|
758
|
+
state: (query?: {
|
|
759
|
+
at?: string;
|
|
760
|
+
prefix?: string;
|
|
761
|
+
timeline?: string;
|
|
762
|
+
}) => Promise<JsonObject>;
|
|
763
|
+
/** What going back to `at` changes, file by file, with who would gain or lose access. Writes nothing. */
|
|
764
|
+
restorePlan: (at: string, timeline?: string) => Promise<JsonObject>;
|
|
765
|
+
/**
|
|
766
|
+
* Go back to `at`: applies the plan's automated changes with the caller's own permissions.
|
|
767
|
+
* `includeDatabase` also restores the database from the closest backup before `at` (replaces all
|
|
768
|
+
* data after a safety backup; undo within 7 days).
|
|
769
|
+
*/
|
|
770
|
+
restore: (at: string, timeline?: string, options?: {
|
|
771
|
+
includeDatabase?: boolean;
|
|
772
|
+
}) => Promise<JsonObject>;
|
|
773
|
+
commit: (payload: JsonObject) => Promise<JsonObject>;
|
|
774
|
+
timelineSpawn: (payload: JsonObject) => Promise<JsonObject>;
|
|
775
|
+
timelineList: () => Promise<JsonObject>;
|
|
776
|
+
timelineDelete: (name: string) => Promise<JsonObject>;
|
|
777
|
+
timelineJump: (name: string, targetHex: string) => Promise<JsonObject>;
|
|
778
|
+
timelineHistory: (name: string, limit?: number, offset?: number) => Promise<JsonObject>;
|
|
779
|
+
topology: (timeline?: string, limit?: number) => Promise<JsonObject>;
|
|
780
|
+
converge: (payload: JsonObject) => Promise<JsonObject>;
|
|
781
|
+
variance: (payload: JsonObject) => Promise<JsonObject>;
|
|
782
|
+
snapshotCreate: (payload: JsonObject) => Promise<JsonObject>;
|
|
783
|
+
snapshotList: () => Promise<JsonObject>;
|
|
784
|
+
snapshotRestore: (snapshotId: number) => Promise<JsonObject>;
|
|
785
|
+
};
|
|
786
|
+
readonly functions: {
|
|
787
|
+
list: (options: {
|
|
788
|
+
projectId: string;
|
|
789
|
+
limit?: number;
|
|
790
|
+
offset?: number;
|
|
791
|
+
}) => Promise<JsonObject>;
|
|
792
|
+
/** Validate a bundle and get a signed plan bound to its exact bytes. */
|
|
793
|
+
plan: (bundle: Blob, name: string, projectId?: string) => Promise<JsonObject>;
|
|
794
|
+
/** Plans, then applies exactly the planned bundle (Forge refuses anything else). */
|
|
795
|
+
deploy: (bundle: Blob, name: string, projectId?: string) => Promise<JsonObject>;
|
|
796
|
+
status: (deployId: string, projectId?: string) => Promise<JsonObject>;
|
|
797
|
+
invoke: (functionName: string, payload: JsonValue, options?: {
|
|
798
|
+
projectId?: string;
|
|
799
|
+
deployId?: string;
|
|
800
|
+
executionProfile?: "standard" | "heavy";
|
|
801
|
+
}) => Promise<JsonObject>;
|
|
802
|
+
/**
|
|
803
|
+
* Call a function the way an app does: POST {projectUrl}/functions/v1/{name} with the signed-in
|
|
804
|
+
* user's token (or no token for functions marked public). Returns the function's result.
|
|
805
|
+
*/
|
|
806
|
+
call: <T = JsonValue>(functionName: string, payload?: JsonValue) => Promise<T>;
|
|
807
|
+
simulate: (functionName: string, payload: JsonValue, options?: {
|
|
808
|
+
projectId?: string;
|
|
809
|
+
deployId?: string;
|
|
810
|
+
executionProfile?: "standard" | "heavy";
|
|
811
|
+
}) => Promise<JsonObject>;
|
|
812
|
+
invokeAsync: (functionName: string, payload: JsonValue, options?: {
|
|
813
|
+
projectId?: string;
|
|
814
|
+
deployId?: string;
|
|
815
|
+
executionProfile?: "standard" | "heavy";
|
|
816
|
+
simulation?: boolean;
|
|
817
|
+
}) => Promise<JsonObject>;
|
|
818
|
+
invocationStatus: (invocationId: string, projectId: string) => Promise<JsonObject>;
|
|
819
|
+
jobs: (functionName: string, options: {
|
|
820
|
+
projectId: string;
|
|
821
|
+
status?: string;
|
|
822
|
+
limit?: number;
|
|
823
|
+
offset?: number;
|
|
824
|
+
}) => Promise<JsonObject>;
|
|
825
|
+
versions: (functionName: string, options: {
|
|
826
|
+
projectId: string;
|
|
827
|
+
limit?: number;
|
|
828
|
+
offset?: number;
|
|
829
|
+
}) => Promise<JsonObject>;
|
|
830
|
+
history: (functionName: string, options: {
|
|
831
|
+
projectId: string;
|
|
832
|
+
mode?: "invoke" | "simulate";
|
|
833
|
+
limit?: number;
|
|
834
|
+
offset?: number;
|
|
835
|
+
}) => Promise<JsonObject>;
|
|
836
|
+
simulationDiff: (functionName: string, options: {
|
|
837
|
+
projectId: string;
|
|
838
|
+
leftInvocationId: string;
|
|
839
|
+
rightInvocationId: string;
|
|
840
|
+
}) => Promise<JsonObject>;
|
|
841
|
+
promote: (functionName: string, options: {
|
|
842
|
+
projectId: string;
|
|
843
|
+
version?: number;
|
|
844
|
+
deployId?: string;
|
|
845
|
+
reason?: string;
|
|
846
|
+
}) => Promise<JsonObject>;
|
|
847
|
+
rollback: (functionName: string, options: {
|
|
848
|
+
projectId: string;
|
|
849
|
+
version?: number;
|
|
850
|
+
reason?: string;
|
|
851
|
+
}) => Promise<JsonObject>;
|
|
852
|
+
request: (method: string, path: string, options?: RequestOptions) => Promise<JsonValue>;
|
|
853
|
+
get: (name: string) => Promise<JsonObject>;
|
|
854
|
+
getSource: (name: string) => Promise<JsonObject>;
|
|
855
|
+
update: (name: string, body: JsonObject) => Promise<JsonObject>;
|
|
856
|
+
delete: (name: string) => Promise<JsonObject>;
|
|
857
|
+
logs: (name: string, query?: {
|
|
858
|
+
limit?: number;
|
|
859
|
+
offset?: number;
|
|
860
|
+
status?: string;
|
|
861
|
+
}) => Promise<JsonValue>;
|
|
862
|
+
getPolicy: (name: string) => Promise<JsonObject>;
|
|
863
|
+
setPolicy: (name: string, body: JsonObject) => Promise<JsonObject>;
|
|
864
|
+
getBindings: (name: string) => Promise<JsonObject>;
|
|
865
|
+
setBindings: (name: string, body: JsonObject) => Promise<JsonObject>;
|
|
866
|
+
githubRepositories: (body: JsonObject) => Promise<JsonObject>;
|
|
867
|
+
githubImport: (body: JsonObject) => Promise<JsonObject>;
|
|
868
|
+
githubCommit: (body: JsonObject) => Promise<JsonObject>;
|
|
869
|
+
};
|
|
870
|
+
readonly storage: {
|
|
871
|
+
request: (method: string, path: string, options?: RequestOptions) => Promise<JsonValue>;
|
|
872
|
+
putJson: (path: string, payload: JsonObject) => Promise<JsonValue>;
|
|
873
|
+
get: (path: string, query?: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
|
|
874
|
+
delete: (path: string) => Promise<JsonValue>;
|
|
875
|
+
/** Public URL of an object in a public bucket (no token needed; safe to put in <img src>). */
|
|
876
|
+
publicUrl: (bucket: string, objectPath: string, projectId?: string) => string;
|
|
877
|
+
listBuckets: () => Promise<JsonValue>;
|
|
878
|
+
createBucket: (body: JsonObject) => Promise<JsonObject>;
|
|
879
|
+
getBucket: (name: string) => Promise<JsonObject>;
|
|
880
|
+
updateBucket: (name: string, body: JsonObject) => Promise<JsonObject>;
|
|
881
|
+
deleteBucket: (name: string) => Promise<JsonObject>;
|
|
882
|
+
listObjects: (bucket: string, query?: {
|
|
883
|
+
prefix?: string;
|
|
884
|
+
}) => Promise<JsonValue>;
|
|
885
|
+
signDownload: (bucket: string, objectPath: string, expiresIn?: number) => Promise<JsonObject>;
|
|
886
|
+
/**
|
|
887
|
+
* Signed upload URL. Pass `sizeBytes` (the file's exact size) to get a direct-to-storage URL bound
|
|
888
|
+
* to that size; without it the URL uploads through Sovaria, which checks the size limits as the
|
|
889
|
+
* bytes arrive.
|
|
890
|
+
*/
|
|
891
|
+
signUpload: (bucket: string, objectPath: string, expiresIn?: number, options?: {
|
|
892
|
+
sizeBytes?: number;
|
|
893
|
+
contentType?: string;
|
|
894
|
+
}) => Promise<JsonObject>;
|
|
895
|
+
moveObject: (body: JsonObject) => Promise<JsonObject>;
|
|
896
|
+
/**
|
|
897
|
+
* Upload a file. Bucket rules decide who may write where — e.g. with the "Own folder" rule a
|
|
898
|
+
* user writes to `${userId}/…`. Pass `upsert: true` to replace an existing object.
|
|
899
|
+
*/
|
|
900
|
+
upload: (bucket: string, objectPath: string, file: Blob, options?: {
|
|
901
|
+
upsert?: boolean;
|
|
902
|
+
contentType?: string;
|
|
903
|
+
}) => Promise<JsonObject>;
|
|
904
|
+
/** Download an object the caller may read, as a Blob. */
|
|
905
|
+
download: (bucket: string, objectPath: string) => Promise<Blob>;
|
|
906
|
+
/** Delete an object. */
|
|
907
|
+
remove: (bucket: string, objectPath: string) => Promise<JsonObject>;
|
|
908
|
+
};
|
|
909
|
+
readonly system: {
|
|
910
|
+
enginesHealth: () => Promise<JsonValue>;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* Billing + plan management (Ledger engine).
|
|
914
|
+
*
|
|
915
|
+
* The plan catalog is public; subscription and usage routes require a
|
|
916
|
+
* valid auth token. Subscription writes require the caller to be an
|
|
917
|
+
* org admin.
|
|
918
|
+
*/
|
|
919
|
+
readonly billing: {
|
|
920
|
+
listPlans: () => Promise<JsonValue>;
|
|
921
|
+
getPlan: (name: string) => Promise<JsonObject>;
|
|
922
|
+
getSubscription: (orgId: string) => Promise<JsonObject>;
|
|
923
|
+
setSubscription: (orgId: string, payload: {
|
|
924
|
+
plan: string;
|
|
925
|
+
billingCycle?: "monthly" | "annual";
|
|
926
|
+
stripeCustomerId?: string;
|
|
927
|
+
metadata?: JsonObject;
|
|
928
|
+
}) => Promise<JsonObject>;
|
|
929
|
+
cancelSubscription: (orgId: string, options?: {
|
|
930
|
+
immediate?: boolean;
|
|
931
|
+
}) => Promise<JsonObject>;
|
|
932
|
+
listSubscriptions: () => Promise<JsonValue>;
|
|
933
|
+
getUsage: (orgId: string, period?: string) => Promise<JsonObject>;
|
|
934
|
+
getUsageHistory: (orgId: string, months?: number) => Promise<JsonValue>;
|
|
935
|
+
listInvoices: (orgId: string) => Promise<JsonValue>;
|
|
936
|
+
buildInvoice: (orgId: string, period?: string) => Promise<JsonObject>;
|
|
937
|
+
getCompute: (orgId: string, period?: string) => Promise<JsonObject>;
|
|
938
|
+
checkout: (body: JsonObject) => Promise<JsonObject>;
|
|
939
|
+
getProvider: () => Promise<JsonObject>;
|
|
940
|
+
getFx: () => Promise<JsonObject>;
|
|
941
|
+
getOverage: (orgId: string) => Promise<JsonObject>;
|
|
942
|
+
getOpenInvoice: () => Promise<JsonObject>;
|
|
943
|
+
payInvoice: (orgId: string, period: string, body?: JsonObject) => Promise<JsonObject>;
|
|
944
|
+
razorpayCreateOrder: (body: JsonObject) => Promise<JsonObject>;
|
|
945
|
+
razorpayVerifyPayment: (body: JsonObject) => Promise<JsonObject>;
|
|
946
|
+
getAccount: (accountId: string) => Promise<JsonObject>;
|
|
947
|
+
cancelAccount: (accountId: string) => Promise<JsonObject>;
|
|
948
|
+
resumeAccount: (accountId: string) => Promise<JsonObject>;
|
|
949
|
+
};
|
|
950
|
+
/** The complete API, generated from spec/sovaria-api.json (same surface in every SDK language). */
|
|
951
|
+
readonly api: {
|
|
952
|
+
attestation: {
|
|
953
|
+
getConfig: (args?: {
|
|
954
|
+
projectId?: string;
|
|
955
|
+
}) => Promise<JsonValue>;
|
|
956
|
+
updateConfig: (args: {
|
|
957
|
+
projectId?: string;
|
|
958
|
+
body: JsonObject;
|
|
959
|
+
}) => Promise<JsonValue>;
|
|
960
|
+
setGoogleCredentials: (args: {
|
|
961
|
+
projectId?: string;
|
|
962
|
+
serviceAccount: JsonValue;
|
|
963
|
+
}) => Promise<JsonValue>;
|
|
964
|
+
setAppleCredentials: (args: {
|
|
965
|
+
projectId?: string;
|
|
966
|
+
p8: JsonValue;
|
|
967
|
+
keyId: JsonValue;
|
|
968
|
+
teamId: JsonValue;
|
|
969
|
+
}) => Promise<JsonValue>;
|
|
970
|
+
deleteCredentials: (args: {
|
|
971
|
+
projectId?: string;
|
|
972
|
+
which: string;
|
|
973
|
+
}) => Promise<JsonValue>;
|
|
974
|
+
createDebugToken: (args?: {
|
|
975
|
+
projectId?: string;
|
|
976
|
+
name?: JsonValue;
|
|
977
|
+
}) => Promise<JsonValue>;
|
|
978
|
+
deleteDebugToken: (args: {
|
|
979
|
+
projectId?: string;
|
|
980
|
+
tokenId: string;
|
|
981
|
+
}) => Promise<JsonValue>;
|
|
982
|
+
challenge: () => Promise<JsonValue>;
|
|
983
|
+
exchange: (args: {
|
|
984
|
+
provider: JsonValue;
|
|
985
|
+
appId?: JsonValue;
|
|
986
|
+
challenge?: JsonValue;
|
|
987
|
+
token?: JsonValue;
|
|
988
|
+
keyId?: JsonValue;
|
|
989
|
+
attestation?: JsonValue;
|
|
990
|
+
assertion?: JsonValue;
|
|
991
|
+
development?: JsonValue;
|
|
992
|
+
}) => Promise<JsonValue>;
|
|
993
|
+
};
|
|
994
|
+
auth: {
|
|
995
|
+
confirmVerificationEmail: (args: {
|
|
996
|
+
token: JsonValue;
|
|
997
|
+
}) => Promise<JsonValue>;
|
|
998
|
+
disableMfa: (args: {
|
|
999
|
+
totpCode: JsonValue;
|
|
1000
|
+
}) => Promise<JsonValue>;
|
|
1001
|
+
enrollMfa: () => Promise<JsonValue>;
|
|
1002
|
+
getMfaStatus: () => Promise<JsonValue>;
|
|
1003
|
+
getProvidersConfig: () => Promise<JsonValue>;
|
|
1004
|
+
getSessionsConfig: () => Promise<JsonValue>;
|
|
1005
|
+
listConsoleProductUsers: () => Promise<JsonValue>;
|
|
1006
|
+
listSessions: () => Promise<JsonValue>;
|
|
1007
|
+
revokeOtherSessions: () => Promise<JsonValue>;
|
|
1008
|
+
revokeSession: (args: {
|
|
1009
|
+
sessionId: string;
|
|
1010
|
+
}) => Promise<JsonValue>;
|
|
1011
|
+
sendVerificationEmail: () => Promise<JsonValue>;
|
|
1012
|
+
updateProvidersConfig: (args: {
|
|
1013
|
+
body: JsonObject;
|
|
1014
|
+
}) => Promise<JsonValue>;
|
|
1015
|
+
updateSessionsConfig: (args: {
|
|
1016
|
+
body: JsonObject;
|
|
1017
|
+
}) => Promise<JsonValue>;
|
|
1018
|
+
listDevices: () => Promise<JsonValue>;
|
|
1019
|
+
signOutDevice: (args: {
|
|
1020
|
+
deviceId: string;
|
|
1021
|
+
}) => Promise<JsonValue>;
|
|
1022
|
+
};
|
|
1023
|
+
billing: {
|
|
1024
|
+
buildInvoice: (args?: {
|
|
1025
|
+
orgId?: string;
|
|
1026
|
+
period?: JsonValue;
|
|
1027
|
+
}) => Promise<JsonValue>;
|
|
1028
|
+
cancelAccount: (args: {
|
|
1029
|
+
accountId: string;
|
|
1030
|
+
}) => Promise<JsonValue>;
|
|
1031
|
+
checkout: (args: {
|
|
1032
|
+
body: JsonObject;
|
|
1033
|
+
}) => Promise<JsonValue>;
|
|
1034
|
+
getAccount: (args: {
|
|
1035
|
+
accountId: string;
|
|
1036
|
+
}) => Promise<JsonValue>;
|
|
1037
|
+
getAccountOverage: (args: {
|
|
1038
|
+
accountId: string;
|
|
1039
|
+
}) => Promise<JsonValue>;
|
|
1040
|
+
getAccountOveragePrefs: (args: {
|
|
1041
|
+
accountId: string;
|
|
1042
|
+
}) => Promise<JsonValue>;
|
|
1043
|
+
getOrgOveragePrefs: (args?: {
|
|
1044
|
+
orgId?: string;
|
|
1045
|
+
}) => Promise<JsonValue>;
|
|
1046
|
+
getCompute: (args?: {
|
|
1047
|
+
orgId?: string;
|
|
1048
|
+
period?: JsonValue;
|
|
1049
|
+
}) => Promise<JsonValue>;
|
|
1050
|
+
getFx: () => Promise<JsonValue>;
|
|
1051
|
+
getOpenInvoice: () => Promise<JsonValue>;
|
|
1052
|
+
getOverage: (args?: {
|
|
1053
|
+
orgId?: string;
|
|
1054
|
+
}) => Promise<JsonValue>;
|
|
1055
|
+
getPlan: (args: {
|
|
1056
|
+
name: string;
|
|
1057
|
+
}) => Promise<JsonValue>;
|
|
1058
|
+
getProvider: () => Promise<JsonValue>;
|
|
1059
|
+
getSubscription: (args?: {
|
|
1060
|
+
orgId?: string;
|
|
1061
|
+
}) => Promise<JsonValue>;
|
|
1062
|
+
getUsage: (args?: {
|
|
1063
|
+
orgId?: string;
|
|
1064
|
+
period?: JsonValue;
|
|
1065
|
+
}) => Promise<JsonValue>;
|
|
1066
|
+
getUsageHistory: (args?: {
|
|
1067
|
+
orgId?: string;
|
|
1068
|
+
months?: JsonValue;
|
|
1069
|
+
}) => Promise<JsonValue>;
|
|
1070
|
+
listInvoices: (args?: {
|
|
1071
|
+
orgId?: string;
|
|
1072
|
+
}) => Promise<JsonValue>;
|
|
1073
|
+
listPlans: () => Promise<JsonValue>;
|
|
1074
|
+
listSubscriptions: () => Promise<JsonValue>;
|
|
1075
|
+
payInvoice: (args: {
|
|
1076
|
+
orgId?: string;
|
|
1077
|
+
period: string;
|
|
1078
|
+
}) => Promise<JsonValue>;
|
|
1079
|
+
razorpayCreateOrder: (args: {
|
|
1080
|
+
body: JsonObject;
|
|
1081
|
+
}) => Promise<JsonValue>;
|
|
1082
|
+
razorpayVerifyPayment: (args: {
|
|
1083
|
+
body: JsonObject;
|
|
1084
|
+
}) => Promise<JsonValue>;
|
|
1085
|
+
resumeAccount: (args: {
|
|
1086
|
+
accountId: string;
|
|
1087
|
+
}) => Promise<JsonValue>;
|
|
1088
|
+
setAccountOveragePrefs: (args: {
|
|
1089
|
+
accountId: string;
|
|
1090
|
+
services: JsonValue;
|
|
1091
|
+
}) => Promise<JsonValue>;
|
|
1092
|
+
setOrgOveragePrefs: (args: {
|
|
1093
|
+
orgId?: string;
|
|
1094
|
+
services: JsonValue;
|
|
1095
|
+
}) => Promise<JsonValue>;
|
|
1096
|
+
};
|
|
1097
|
+
builds: {
|
|
1098
|
+
check: (args: {
|
|
1099
|
+
build: JsonValue;
|
|
1100
|
+
}) => Promise<JsonValue>;
|
|
1101
|
+
list: (args?: {
|
|
1102
|
+
limit?: JsonValue;
|
|
1103
|
+
}) => Promise<JsonValue>;
|
|
1104
|
+
get: (args: {
|
|
1105
|
+
buildId: string;
|
|
1106
|
+
}) => Promise<JsonValue>;
|
|
1107
|
+
pullRequest: (args: {
|
|
1108
|
+
buildId: string;
|
|
1109
|
+
token?: JsonValue;
|
|
1110
|
+
}) => Promise<JsonValue>;
|
|
1111
|
+
delete: (args: {
|
|
1112
|
+
buildId: string;
|
|
1113
|
+
}) => Promise<JsonValue>;
|
|
1114
|
+
};
|
|
1115
|
+
byok: {
|
|
1116
|
+
get: () => Promise<JsonValue>;
|
|
1117
|
+
set: (args: {
|
|
1118
|
+
provider?: JsonValue;
|
|
1119
|
+
keyRef: JsonValue;
|
|
1120
|
+
}) => Promise<JsonValue>;
|
|
1121
|
+
rotate: () => Promise<JsonValue>;
|
|
1122
|
+
check: () => Promise<JsonValue>;
|
|
1123
|
+
reencryptStorage: () => Promise<JsonValue>;
|
|
1124
|
+
};
|
|
1125
|
+
crashes: {
|
|
1126
|
+
listIssues: (args?: {
|
|
1127
|
+
status
|
|
1128
|
+
/** Load a stored session (called once the publishable key is known, so sign-out falls back to it). */
|
|
1129
|
+
? /** Load a stored session (called once the publishable key is known, so sign-out falls back to it). */: JsonValue;
|
|
1130
|
+
limit?: JsonValue;
|
|
1131
|
+
}) => Promise<JsonValue>;
|
|
1132
|
+
getIssue: (args: {
|
|
1133
|
+
fingerprint: string;
|
|
1134
|
+
}) => Promise<JsonValue>;
|
|
1135
|
+
setIssueStatus: (args: {
|
|
1136
|
+
fingerprint: string;
|
|
1137
|
+
status: JsonValue;
|
|
1138
|
+
}) => Promise<JsonValue>;
|
|
1139
|
+
usage: () => Promise<JsonValue>;
|
|
1140
|
+
};
|
|
1141
|
+
data: {
|
|
1142
|
+
addColumn: (args: {
|
|
1143
|
+
tableName: JsonValue;
|
|
1144
|
+
columnName: JsonValue;
|
|
1145
|
+
dataType: JsonValue;
|
|
1146
|
+
isNullable?: JsonValue;
|
|
1147
|
+
isUnique?: JsonValue;
|
|
1148
|
+
defaultValue?: JsonValue;
|
|
1149
|
+
}) => Promise<JsonValue>;
|
|
1150
|
+
addForeignKey: (args: {
|
|
1151
|
+
tableName: JsonValue;
|
|
1152
|
+
columnName: JsonValue;
|
|
1153
|
+
referencedTable: JsonValue;
|
|
1154
|
+
referencedColumn: JsonValue;
|
|
1155
|
+
}) => Promise<JsonValue>;
|
|
1156
|
+
beginTransaction: () => Promise<JsonValue>;
|
|
1157
|
+
commitTransaction: (args: {
|
|
1158
|
+
txid: JsonValue;
|
|
1159
|
+
}) => Promise<JsonValue>;
|
|
1160
|
+
dropColumn: (args: {
|
|
1161
|
+
tableName: JsonValue;
|
|
1162
|
+
columnName: JsonValue;
|
|
1163
|
+
}) => Promise<JsonValue>;
|
|
1164
|
+
dropForeignKey: (args: {
|
|
1165
|
+
tableName: JsonValue;
|
|
1166
|
+
columnName: JsonValue;
|
|
1167
|
+
referencedTable: JsonValue;
|
|
1168
|
+
referencedColumn: JsonValue;
|
|
1169
|
+
}) => Promise<JsonValue>;
|
|
1170
|
+
dropTable: (args: {
|
|
1171
|
+
tableName: JsonValue;
|
|
1172
|
+
}) => Promise<JsonValue>;
|
|
1173
|
+
rollbackTransaction: (args: {
|
|
1174
|
+
txid: JsonValue;
|
|
1175
|
+
}) => Promise<JsonValue>;
|
|
1176
|
+
tableHistory: () => Promise<JsonValue>;
|
|
1177
|
+
setTableHistory: (args: {
|
|
1178
|
+
tableName: JsonValue;
|
|
1179
|
+
enabled: JsonValue;
|
|
1180
|
+
keepDays?: JsonValue;
|
|
1181
|
+
}) => Promise<JsonValue>;
|
|
1182
|
+
schemaDigest: (args?: {
|
|
1183
|
+
tables?: JsonValue;
|
|
1184
|
+
maxChars?: JsonValue;
|
|
1185
|
+
since?: JsonValue;
|
|
1186
|
+
}) => Promise<JsonValue>;
|
|
1187
|
+
applySchemaPlan: (args: {
|
|
1188
|
+
tables: JsonValue;
|
|
1189
|
+
dryRun?: JsonValue;
|
|
1190
|
+
name?: JsonValue;
|
|
1191
|
+
}) => Promise<JsonValue>;
|
|
1192
|
+
applyMigration: (args: {
|
|
1193
|
+
name: JsonValue;
|
|
1194
|
+
upSql: JsonValue;
|
|
1195
|
+
downSql?: JsonValue;
|
|
1196
|
+
version?: JsonValue;
|
|
1197
|
+
}) => Promise<JsonValue>;
|
|
1198
|
+
dryRunMigration: (args: {
|
|
1199
|
+
name: JsonValue;
|
|
1200
|
+
upSql: JsonValue;
|
|
1201
|
+
downSql?: JsonValue;
|
|
1202
|
+
}) => Promise<JsonValue>;
|
|
1203
|
+
dryRunMigrations: (args: {
|
|
1204
|
+
migrations: JsonValue;
|
|
1205
|
+
}) => Promise<JsonValue>;
|
|
1206
|
+
rollbackMigration: (args?: {
|
|
1207
|
+
version?: JsonValue;
|
|
1208
|
+
force?: JsonValue;
|
|
1209
|
+
}) => Promise<JsonValue>;
|
|
1210
|
+
};
|
|
1211
|
+
e2ee: {
|
|
1212
|
+
bootstrapKey: (args: {
|
|
1213
|
+
channel: JsonValue;
|
|
1214
|
+
ttlSeconds?: JsonValue;
|
|
1215
|
+
forceNew?: JsonValue;
|
|
1216
|
+
}) => Promise<JsonValue>;
|
|
1217
|
+
getActiveKey: (args: {
|
|
1218
|
+
channel: string;
|
|
1219
|
+
clientPublicKey?: JsonValue;
|
|
1220
|
+
}) => Promise<JsonValue>;
|
|
1221
|
+
getKey: (args: {
|
|
1222
|
+
channel: string;
|
|
1223
|
+
keyId: string;
|
|
1224
|
+
clientPublicKey?: JsonValue;
|
|
1225
|
+
}) => Promise<JsonValue>;
|
|
1226
|
+
listKeys: (args: {
|
|
1227
|
+
channel: string;
|
|
1228
|
+
}) => Promise<JsonValue>;
|
|
1229
|
+
revokeKey: (args: {
|
|
1230
|
+
channel: JsonValue;
|
|
1231
|
+
keyId?: JsonValue;
|
|
1232
|
+
reason?: JsonValue;
|
|
1233
|
+
}) => Promise<JsonValue>;
|
|
1234
|
+
rotateKey: (args: {
|
|
1235
|
+
channel: JsonValue;
|
|
1236
|
+
ttlSeconds?: JsonValue;
|
|
1237
|
+
}) => Promise<JsonValue>;
|
|
1238
|
+
};
|
|
1239
|
+
functions: {
|
|
1240
|
+
delete: (args: {
|
|
1241
|
+
functionName: string;
|
|
1242
|
+
}) => Promise<JsonValue>;
|
|
1243
|
+
get: (args: {
|
|
1244
|
+
functionName: string;
|
|
1245
|
+
projectId?: JsonValue;
|
|
1246
|
+
}) => Promise<JsonValue>;
|
|
1247
|
+
getBindings: (args: {
|
|
1248
|
+
functionName: string;
|
|
1249
|
+
}) => Promise<JsonValue>;
|
|
1250
|
+
getPolicy: (args: {
|
|
1251
|
+
functionName: string;
|
|
1252
|
+
}) => Promise<JsonValue>;
|
|
1253
|
+
getSource: (args: {
|
|
1254
|
+
functionName: string;
|
|
1255
|
+
projectId?: JsonValue;
|
|
1256
|
+
}) => Promise<JsonValue>;
|
|
1257
|
+
githubCommit: (args: {
|
|
1258
|
+
body: JsonObject;
|
|
1259
|
+
}) => Promise<JsonValue>;
|
|
1260
|
+
githubImport: (args: {
|
|
1261
|
+
body: JsonObject;
|
|
1262
|
+
}) => Promise<JsonValue>;
|
|
1263
|
+
invocationStatus: (args: {
|
|
1264
|
+
invocationId: string;
|
|
1265
|
+
projectId?: JsonValue;
|
|
1266
|
+
}) => Promise<JsonValue>;
|
|
1267
|
+
list: (args?: {
|
|
1268
|
+
projectId?: JsonValue;
|
|
1269
|
+
limit?: JsonValue;
|
|
1270
|
+
offset?: JsonValue;
|
|
1271
|
+
}) => Promise<JsonValue>;
|
|
1272
|
+
simulationDiff: (args: {
|
|
1273
|
+
functionName: string;
|
|
1274
|
+
projectId?: JsonValue;
|
|
1275
|
+
leftInvocationId?: JsonValue;
|
|
1276
|
+
rightInvocationId?: JsonValue;
|
|
1277
|
+
}) => Promise<JsonValue>;
|
|
1278
|
+
status: (args: {
|
|
1279
|
+
deployId: string;
|
|
1280
|
+
projectId?: JsonValue;
|
|
1281
|
+
}) => Promise<JsonValue>;
|
|
1282
|
+
update: (args: {
|
|
1283
|
+
functionName: string;
|
|
1284
|
+
body: JsonObject;
|
|
1285
|
+
projectId?: JsonValue;
|
|
1286
|
+
}) => Promise<JsonValue>;
|
|
1287
|
+
updateBindings: (args: {
|
|
1288
|
+
functionName: string;
|
|
1289
|
+
bindings: JsonValue;
|
|
1290
|
+
}) => Promise<JsonValue>;
|
|
1291
|
+
updatePolicy: (args: {
|
|
1292
|
+
functionName: string;
|
|
1293
|
+
policy: JsonObject;
|
|
1294
|
+
}) => Promise<JsonValue>;
|
|
1295
|
+
versions: (args: {
|
|
1296
|
+
functionName: string;
|
|
1297
|
+
projectId?: JsonValue;
|
|
1298
|
+
limit?: JsonValue;
|
|
1299
|
+
offset?: JsonValue;
|
|
1300
|
+
}) => Promise<JsonValue>;
|
|
1301
|
+
};
|
|
1302
|
+
governance: {
|
|
1303
|
+
adminDatabases: () => Promise<JsonValue>;
|
|
1304
|
+
getTenant: (args?: {
|
|
1305
|
+
orgId?: string;
|
|
1306
|
+
}) => Promise<JsonValue>;
|
|
1307
|
+
getTenantDatabaseConnection: (args?: {
|
|
1308
|
+
orgId?: string;
|
|
1309
|
+
projectId?: string;
|
|
1310
|
+
}) => Promise<JsonValue>;
|
|
1311
|
+
listHosts: (args?: {
|
|
1312
|
+
regionId?: JsonValue;
|
|
1313
|
+
}) => Promise<JsonValue>;
|
|
1314
|
+
listRegions: () => Promise<JsonValue>;
|
|
1315
|
+
listTenantDatabaseBackups: (args?: {
|
|
1316
|
+
orgId?: string;
|
|
1317
|
+
projectId?: string;
|
|
1318
|
+
limit?: JsonValue;
|
|
1319
|
+
}) => Promise<JsonValue>;
|
|
1320
|
+
listTenantDatabases: (args?: {
|
|
1321
|
+
orgId?: string;
|
|
1322
|
+
}) => Promise<JsonValue>;
|
|
1323
|
+
listTenants: () => Promise<JsonValue>;
|
|
1324
|
+
metricsOverview: () => Promise<JsonValue>;
|
|
1325
|
+
patchHost: (args: {
|
|
1326
|
+
hostId: string;
|
|
1327
|
+
body: JsonObject;
|
|
1328
|
+
}) => Promise<JsonValue>;
|
|
1329
|
+
patchRegion: (args: {
|
|
1330
|
+
regionId: string;
|
|
1331
|
+
body: JsonObject;
|
|
1332
|
+
}) => Promise<JsonValue>;
|
|
1333
|
+
pauseTenantDatabase: (args?: {
|
|
1334
|
+
orgId?: string;
|
|
1335
|
+
projectId?: string;
|
|
1336
|
+
}) => Promise<JsonValue>;
|
|
1337
|
+
resizeTenantDatabase: (args: {
|
|
1338
|
+
orgId?: string;
|
|
1339
|
+
projectId?: string;
|
|
1340
|
+
computeSize: JsonValue;
|
|
1341
|
+
}) => Promise<JsonValue>;
|
|
1342
|
+
resumeTenantDatabase: (args?: {
|
|
1343
|
+
orgId?: string;
|
|
1344
|
+
projectId?: string;
|
|
1345
|
+
}) => Promise<JsonValue>;
|
|
1346
|
+
revealTenantDatabaseConnection: (args: {
|
|
1347
|
+
orgId?: string;
|
|
1348
|
+
projectId?: string;
|
|
1349
|
+
grantId: JsonValue;
|
|
1350
|
+
}) => Promise<JsonValue>;
|
|
1351
|
+
setTenantStatus: (args: {
|
|
1352
|
+
orgId?: string;
|
|
1353
|
+
status: JsonValue;
|
|
1354
|
+
}) => Promise<JsonValue>;
|
|
1355
|
+
triggerTenantDatabaseBackup: (args?: {
|
|
1356
|
+
orgId?: string;
|
|
1357
|
+
projectId?: string;
|
|
1358
|
+
}) => Promise<JsonValue>;
|
|
1359
|
+
listDatabaseReplicas: (args?: {
|
|
1360
|
+
orgId?: string;
|
|
1361
|
+
projectId?: string;
|
|
1362
|
+
}) => Promise<JsonValue>;
|
|
1363
|
+
createDatabaseReplica: (args?: {
|
|
1364
|
+
orgId?: string;
|
|
1365
|
+
projectId?: string;
|
|
1366
|
+
}) => Promise<JsonValue>;
|
|
1367
|
+
deleteDatabaseReplica: (args: {
|
|
1368
|
+
orgId?: string;
|
|
1369
|
+
projectId?: string;
|
|
1370
|
+
replicaId: string;
|
|
1371
|
+
}) => Promise<JsonValue>;
|
|
1372
|
+
compareDatabaseMoments: (args: {
|
|
1373
|
+
orgId?: string;
|
|
1374
|
+
projectId?: string;
|
|
1375
|
+
fromMoment: JsonValue;
|
|
1376
|
+
toMoment?: JsonValue;
|
|
1377
|
+
includePlatform?: JsonValue;
|
|
1378
|
+
}) => Promise<JsonValue>;
|
|
1379
|
+
restoreDatabaseBackup: (args: {
|
|
1380
|
+
orgId? /** Strict console login — rejects every project-scoped credential. */: string;
|
|
1381
|
+
projectId?: string;
|
|
1382
|
+
backupId: string;
|
|
1383
|
+
confirm: JsonValue;
|
|
1384
|
+
}) => Promise<JsonValue>;
|
|
1385
|
+
listDatabaseRestores: (args?: {
|
|
1386
|
+
orgId?: string;
|
|
1387
|
+
projectId?: string;
|
|
1388
|
+
}) => Promise<JsonValue>;
|
|
1389
|
+
undoDatabaseRestore: (args: {
|
|
1390
|
+
orgId?: string;
|
|
1391
|
+
projectId?: string;
|
|
1392
|
+
restoreId: string;
|
|
1393
|
+
}) => Promise<JsonValue>;
|
|
1394
|
+
};
|
|
1395
|
+
history: {
|
|
1396
|
+
commit: (args: {
|
|
1397
|
+
timeline?: JsonValue;
|
|
1398
|
+
message: JsonValue;
|
|
1399
|
+
author?: JsonValue;
|
|
1400
|
+
eventType?: JsonValue;
|
|
1401
|
+
}) => Promise<JsonValue>;
|
|
1402
|
+
converge: (args: {
|
|
1403
|
+
target: JsonValue;
|
|
1404
|
+
source: JsonValue;
|
|
1405
|
+
author: JsonValue;
|
|
1406
|
+
message?: JsonValue;
|
|
1407
|
+
}) => Promise<JsonValue>;
|
|
1408
|
+
createSnapshot: (args: {
|
|
1409
|
+
message: JsonValue;
|
|
1410
|
+
}) => Promise<JsonValue>;
|
|
1411
|
+
deleteTimeline: (args: {
|
|
1412
|
+
name: string;
|
|
1413
|
+
}) => Promise<JsonValue>;
|
|
1414
|
+
jumpTimeline: (args: {
|
|
1415
|
+
name: string;
|
|
1416
|
+
targetHex: JsonValue;
|
|
1417
|
+
}) => Promise<JsonValue>;
|
|
1418
|
+
listSnapshots: () => Promise<JsonValue>;
|
|
1419
|
+
listTimelines: () => Promise<JsonValue>;
|
|
1420
|
+
restoreSnapshot: (args: {
|
|
1421
|
+
snapshotId: string;
|
|
1422
|
+
}) => Promise<JsonValue>;
|
|
1423
|
+
spawnTimeline: (args: {
|
|
1424
|
+
name: JsonValue;
|
|
1425
|
+
sourceHexId?: JsonValue;
|
|
1426
|
+
}) => Promise<JsonValue>;
|
|
1427
|
+
timelineHistory: (args: {
|
|
1428
|
+
name: string;
|
|
1429
|
+
limit?: JsonValue;
|
|
1430
|
+
offset?: JsonValue;
|
|
1431
|
+
}) => Promise<JsonValue>;
|
|
1432
|
+
topology: (args?: {
|
|
1433
|
+
timeline?: JsonValue;
|
|
1434
|
+
limit?: JsonValue;
|
|
1435
|
+
}) => Promise<JsonValue>;
|
|
1436
|
+
variance: (args: {
|
|
1437
|
+
oldChrononHex: JsonValue;
|
|
1438
|
+
newChrononHex: JsonValue;
|
|
1439
|
+
domainFilter?: JsonValue;
|
|
1440
|
+
}) => Promise<JsonValue>;
|
|
1441
|
+
};
|
|
1442
|
+
mcp: {
|
|
1443
|
+
listConnections: () => Promise<JsonValue>;
|
|
1444
|
+
disconnect: (args: {
|
|
1445
|
+
grantId: string;
|
|
1446
|
+
}) => Promise<JsonValue>;
|
|
1447
|
+
orgSettings: (args?: {
|
|
1448
|
+
orgId?: string;
|
|
1449
|
+
}) => Promise<JsonValue>;
|
|
1450
|
+
setOrgAllowed: (args: {
|
|
1451
|
+
orgId?: string;
|
|
1452
|
+
allowed: JsonValue;
|
|
1453
|
+
}) => Promise<JsonValue>;
|
|
1454
|
+
orgDisconnect: (args: {
|
|
1455
|
+
orgId?: string;
|
|
1456
|
+
grantId: string;
|
|
1457
|
+
}) => Promise<JsonValue>;
|
|
1458
|
+
};
|
|
1459
|
+
messaging: {
|
|
1460
|
+
listTemplates: (args?: {
|
|
1461
|
+
projectId?: string;
|
|
1462
|
+
}) => Promise<JsonValue>;
|
|
1463
|
+
getTemplate: (args: {
|
|
1464
|
+
projectId?: string;
|
|
1465
|
+
name: string;
|
|
1466
|
+
}) => Promise<JsonValue>;
|
|
1467
|
+
putTemplate: (args: {
|
|
1468
|
+
projectId?: string;
|
|
1469
|
+
name: string;
|
|
1470
|
+
description?: JsonValue;
|
|
1471
|
+
category?: JsonValue;
|
|
1472
|
+
push?: JsonValue;
|
|
1473
|
+
email?: JsonValue;
|
|
1474
|
+
}) => Promise<JsonValue>;
|
|
1475
|
+
deleteTemplate: (args: {
|
|
1476
|
+
projectId?: string;
|
|
1477
|
+
name: string;
|
|
1478
|
+
}) => Promise<JsonValue>;
|
|
1479
|
+
listAudiences: (args?: {
|
|
1480
|
+
projectId?: string;
|
|
1481
|
+
}) => Promise<JsonValue>;
|
|
1482
|
+
getAudience: (args: {
|
|
1483
|
+
projectId?: string;
|
|
1484
|
+
name: string;
|
|
1485
|
+
}) => Promise<JsonValue>;
|
|
1486
|
+
putAudience: (args: {
|
|
1487
|
+
projectId?: string;
|
|
1488
|
+
name: string;
|
|
1489
|
+
sql: JsonValue;
|
|
1490
|
+
description?: JsonValue;
|
|
1491
|
+
}) => Promise<JsonValue>;
|
|
1492
|
+
deleteAudience: (args: {
|
|
1493
|
+
projectId?: string;
|
|
1494
|
+
name: string;
|
|
1495
|
+
}) => Promise<JsonValue>;
|
|
1496
|
+
previewAudience: (args: {
|
|
1497
|
+
projectId?: string;
|
|
1498
|
+
name: string;
|
|
1499
|
+
}) => Promise<JsonValue>;
|
|
1500
|
+
previewSql: (args: {
|
|
1501
|
+
projectId?: string;
|
|
1502
|
+
sql: JsonValue;
|
|
1503
|
+
}) => Promise<JsonValue>;
|
|
1504
|
+
send: (args: {
|
|
1505
|
+
projectId?: string;
|
|
1506
|
+
template?: JsonValue;
|
|
1507
|
+
content?: JsonValue;
|
|
1508
|
+
to: JsonValue;
|
|
1509
|
+
channels?: JsonValue;
|
|
1510
|
+
variables?: JsonValue;
|
|
1511
|
+
category?: JsonValue;
|
|
1512
|
+
dryRun?: JsonValue;
|
|
1513
|
+
}) => Promise<JsonValue>;
|
|
1514
|
+
listSends: (args?: {
|
|
1515
|
+
projectId?: string;
|
|
1516
|
+
limit?: JsonValue;
|
|
1517
|
+
}) => Promise<JsonValue>;
|
|
1518
|
+
getSend: (args: {
|
|
1519
|
+
projectId?: string;
|
|
1520
|
+
sendId: string;
|
|
1521
|
+
}) => Promise<JsonValue>;
|
|
1522
|
+
listDeliveries: (args?: {
|
|
1523
|
+
projectId?: string;
|
|
1524
|
+
sendId?: JsonValue;
|
|
1525
|
+
userId?: JsonValue;
|
|
1526
|
+
status?: JsonValue;
|
|
1527
|
+
limit?: JsonValue;
|
|
1528
|
+
offset?: JsonValue;
|
|
1529
|
+
}) => Promise<JsonValue>;
|
|
1530
|
+
usage: (args?: {
|
|
1531
|
+
projectId?: string;
|
|
1532
|
+
}) => Promise<JsonValue>;
|
|
1533
|
+
setUserOptout: (args: {
|
|
1534
|
+
projectId?: string;
|
|
1535
|
+
userId: string;
|
|
1536
|
+
channel: JsonValue;
|
|
1537
|
+
optedOut: JsonValue;
|
|
1538
|
+
}) => Promise<JsonValue>;
|
|
1539
|
+
getPreferences: () => Promise<JsonValue>;
|
|
1540
|
+
setPreferences: (args: {
|
|
1541
|
+
marketing: JsonValue;
|
|
1542
|
+
}) => Promise<JsonValue>;
|
|
1543
|
+
};
|
|
1544
|
+
mobile: {
|
|
1545
|
+
listApps: (args?: {
|
|
1546
|
+
projectId?: string;
|
|
1547
|
+
}) => Promise<JsonValue>;
|
|
1548
|
+
createApp: (args: {
|
|
1549
|
+
projectId?: string;
|
|
1550
|
+
body: JsonObject;
|
|
1551
|
+
}) => Promise<JsonValue>;
|
|
1552
|
+
updateApp: (args: {
|
|
1553
|
+
projectId?: string;
|
|
1554
|
+
appId: string;
|
|
1555
|
+
body: JsonObject;
|
|
1556
|
+
}) => Promise<JsonValue>;
|
|
1557
|
+
deleteApp: (args: {
|
|
1558
|
+
projectId?: string;
|
|
1559
|
+
appId: string;
|
|
1560
|
+
}) => Promise<JsonValue>;
|
|
1561
|
+
listUserDevices: (args: {
|
|
1562
|
+
projectId?: string;
|
|
1563
|
+
userId: string;
|
|
1564
|
+
}) => Promise<JsonValue>;
|
|
1565
|
+
revokeUserDevice: (args: {
|
|
1566
|
+
projectId?: string;
|
|
1567
|
+
userId: string;
|
|
1568
|
+
deviceId: string;
|
|
1569
|
+
}) => Promise<JsonValue>;
|
|
1570
|
+
};
|
|
1571
|
+
org: {
|
|
1572
|
+
acceptOrgInvite: (args: {
|
|
1573
|
+
token: JsonValue;
|
|
1574
|
+
}) => Promise<JsonValue>;
|
|
1575
|
+
addMember: (args: {
|
|
1576
|
+
orgId?: string;
|
|
1577
|
+
userId: JsonValue;
|
|
1578
|
+
role: JsonValue;
|
|
1579
|
+
}) => Promise<JsonValue>;
|
|
1580
|
+
createEdge: (args: {
|
|
1581
|
+
sourceNodeId: JsonValue;
|
|
1582
|
+
targetNodeId: JsonValue;
|
|
1583
|
+
relationType: JsonValue;
|
|
1584
|
+
role?: JsonValue;
|
|
1585
|
+
}) => Promise<JsonValue>;
|
|
1586
|
+
createOrgInvite: (args: {
|
|
1587
|
+
orgId?: string;
|
|
1588
|
+
email: JsonValue;
|
|
1589
|
+
role: JsonValue;
|
|
1590
|
+
}) => Promise<JsonValue>;
|
|
1591
|
+
deleteOrg: (args?: {
|
|
1592
|
+
orgId?: string;
|
|
1593
|
+
}) => Promise<JsonValue>;
|
|
1594
|
+
ensureDefaultApiKeys: () => Promise<JsonValue>;
|
|
1595
|
+
getChildren: (args: {
|
|
1596
|
+
parentId: string;
|
|
1597
|
+
relation?: JsonValue;
|
|
1598
|
+
}) => Promise<JsonValue>;
|
|
1599
|
+
getContext: (args: {
|
|
1600
|
+
userId: string;
|
|
1601
|
+
resourceId: string;
|
|
1602
|
+
}) => Promise<JsonValue>;
|
|
1603
|
+
getNode: (args: {
|
|
1604
|
+
nodeId: string;
|
|
1605
|
+
}) => Promise<JsonValue>;
|
|
1606
|
+
getProjectRef: (args?: {
|
|
1607
|
+
projectId?: string;
|
|
1608
|
+
}) => Promise<JsonValue>;
|
|
1609
|
+
getProjectSettings: () => Promise<JsonValue>;
|
|
1610
|
+
getRoleCatalog: () => Promise<JsonValue>;
|
|
1611
|
+
getRoleMatrix: () => Promise<JsonValue>;
|
|
1612
|
+
listApiKeys: () => Promise<JsonValue>;
|
|
1613
|
+
listNodes: (args?: {
|
|
1614
|
+
nodeType?: JsonValue;
|
|
1615
|
+
}) => Promise<JsonValue>;
|
|
1616
|
+
listOrgMembers: (args?: {
|
|
1617
|
+
orgId?: string;
|
|
1618
|
+
}) => Promise<JsonValue>;
|
|
1619
|
+
removeOrgMember: (args: {
|
|
1620
|
+
orgId?: string;
|
|
1621
|
+
userId: string;
|
|
1622
|
+
}) => Promise<JsonValue>;
|
|
1623
|
+
revokeApiKey: (args: {
|
|
1624
|
+
keyId: string;
|
|
1625
|
+
}) => Promise<JsonValue>;
|
|
1626
|
+
setOrgPlan: (args: {
|
|
1627
|
+
orgId?: string;
|
|
1628
|
+
plan: JsonValue;
|
|
1629
|
+
}) => Promise<JsonValue>;
|
|
1630
|
+
updateMemberRole: (args: {
|
|
1631
|
+
orgId?: string;
|
|
1632
|
+
userId: string;
|
|
1633
|
+
role: JsonValue;
|
|
1634
|
+
}) => Promise<JsonValue>;
|
|
1635
|
+
updateOrg: (args: {
|
|
1636
|
+
orgId?: string;
|
|
1637
|
+
body: JsonObject;
|
|
1638
|
+
}) => Promise<JsonValue>;
|
|
1639
|
+
updateProjectSettings: (args: {
|
|
1640
|
+
settings: JsonValue;
|
|
1641
|
+
}) => Promise<JsonValue>;
|
|
1642
|
+
updateRoleMatrix: (args: {
|
|
1643
|
+
matrix: JsonValue;
|
|
1644
|
+
}) => Promise<JsonValue>;
|
|
1645
|
+
};
|
|
1646
|
+
platform: {
|
|
1647
|
+
createEventHook: (args: {
|
|
1648
|
+
body: JsonObject;
|
|
1649
|
+
}) => Promise<JsonValue>;
|
|
1650
|
+
deleteEventHook: (args: {
|
|
1651
|
+
hookId: string;
|
|
1652
|
+
}) => Promise<JsonValue>;
|
|
1653
|
+
disconnectGithub: (args?: {
|
|
1654
|
+
projectId?: JsonValue;
|
|
1655
|
+
}) => Promise<JsonValue>;
|
|
1656
|
+
gatewayHealth: () => Promise<JsonValue>;
|
|
1657
|
+
getEnginesHealth: () => Promise<JsonValue>;
|
|
1658
|
+
getErrorTrace: (args: {
|
|
1659
|
+
traceId: string;
|
|
1660
|
+
}) => Promise<JsonValue>;
|
|
1661
|
+
getGithubConnectionState: (args?: {
|
|
1662
|
+
projectId?: JsonValue;
|
|
1663
|
+
}) => Promise<JsonValue>;
|
|
1664
|
+
listEventHooks: () => Promise<JsonValue>;
|
|
1665
|
+
resolveErrorTrace: (args: {
|
|
1666
|
+
traceId: string;
|
|
1667
|
+
resolved: JsonValue;
|
|
1668
|
+
}) => Promise<JsonValue>;
|
|
1669
|
+
};
|
|
1670
|
+
policy: {
|
|
1671
|
+
auditCount: () => Promise<JsonValue>;
|
|
1672
|
+
auditVerify: () => Promise<JsonValue>;
|
|
1673
|
+
policyCreate: (args: {
|
|
1674
|
+
policyId: JsonValue;
|
|
1675
|
+
name: JsonValue;
|
|
1676
|
+
splSource: JsonValue;
|
|
1677
|
+
orgId: JsonValue;
|
|
1678
|
+
}) => Promise<JsonValue>;
|
|
1679
|
+
policyDelete: (args: {
|
|
1680
|
+
policyId: string;
|
|
1681
|
+
}) => Promise<JsonValue>;
|
|
1682
|
+
policyEvaluate: (args: {
|
|
1683
|
+
policyId: string;
|
|
1684
|
+
context: JsonValue;
|
|
1685
|
+
}) => Promise<JsonValue>;
|
|
1686
|
+
policyGet: (args: {
|
|
1687
|
+
policyId: string;
|
|
1688
|
+
}) => Promise<JsonValue>;
|
|
1689
|
+
policyHistory: (args: {
|
|
1690
|
+
policyId: string;
|
|
1691
|
+
}) => Promise<JsonValue>;
|
|
1692
|
+
policyList: () => Promise<JsonValue>;
|
|
1693
|
+
policyRollback: (args: {
|
|
1694
|
+
policyId: string;
|
|
1695
|
+
version: JsonValue;
|
|
1696
|
+
}) => Promise<JsonValue>;
|
|
1697
|
+
policyTemplates: () => Promise<JsonValue>;
|
|
1698
|
+
};
|
|
1699
|
+
push: {
|
|
1700
|
+
getCredentials: (args?: {
|
|
1701
|
+
projectId?: string;
|
|
1702
|
+
}) => Promise<JsonValue>;
|
|
1703
|
+
setFcmCredentials: (args: {
|
|
1704
|
+
projectId?: string;
|
|
1705
|
+
serviceAccount: JsonValue;
|
|
1706
|
+
}) => Promise<JsonValue>;
|
|
1707
|
+
setApnsCredentials: (args: {
|
|
1708
|
+
projectId?: string;
|
|
1709
|
+
p8: JsonValue;
|
|
1710
|
+
keyId: JsonValue;
|
|
1711
|
+
teamId: JsonValue;
|
|
1712
|
+
bundleId: JsonValue;
|
|
1713
|
+
environment?: JsonValue;
|
|
1714
|
+
}) => Promise<JsonValue>;
|
|
1715
|
+
deleteCredentials: (args: {
|
|
1716
|
+
projectId?: string;
|
|
1717
|
+
provider: string;
|
|
1718
|
+
}) => Promise<JsonValue>;
|
|
1719
|
+
listDevices: (args?: {
|
|
1720
|
+
projectId?: string;
|
|
1721
|
+
userId?: JsonValue;
|
|
1722
|
+
limit?: JsonValue;
|
|
1723
|
+
before?: JsonValue;
|
|
1724
|
+
}) => Promise<JsonValue>;
|
|
1725
|
+
send: (args: {
|
|
1726
|
+
projectId?: string;
|
|
1727
|
+
message: JsonObject;
|
|
1728
|
+
}) => Promise<JsonValue>;
|
|
1729
|
+
listSends: (args?: {
|
|
1730
|
+
projectId?: string;
|
|
1731
|
+
limit?: JsonValue;
|
|
1732
|
+
}) => Promise<JsonValue>;
|
|
1733
|
+
registerDevice: (args: {
|
|
1734
|
+
token: JsonValue;
|
|
1735
|
+
platform: JsonValue;
|
|
1736
|
+
provider?: JsonValue;
|
|
1737
|
+
deviceId?: JsonValue;
|
|
1738
|
+
appId?: JsonValue;
|
|
1739
|
+
topics?: JsonValue;
|
|
1740
|
+
locale?: JsonValue;
|
|
1741
|
+
}) => Promise<JsonValue>;
|
|
1742
|
+
myDevices: () => Promise<JsonValue>;
|
|
1743
|
+
updateTopics: (args: {
|
|
1744
|
+
deviceRowId: string;
|
|
1745
|
+
subscribe?: JsonValue;
|
|
1746
|
+
unsubscribe?: JsonValue;
|
|
1747
|
+
replace?: JsonValue;
|
|
1748
|
+
}) => Promise<JsonValue>;
|
|
1749
|
+
deleteDevice: (args: {
|
|
1750
|
+
deviceRowId: string;
|
|
1751
|
+
}) => Promise<JsonValue>;
|
|
1752
|
+
unregisterToken: (args: {
|
|
1753
|
+
token: JsonValue;
|
|
1754
|
+
}) => Promise<JsonValue>;
|
|
1755
|
+
};
|
|
1756
|
+
realtime: {
|
|
1757
|
+
channels: () => Promise<JsonValue>;
|
|
1758
|
+
presence: (args: {
|
|
1759
|
+
channel: string;
|
|
1760
|
+
}) => Promise<JsonValue>;
|
|
1761
|
+
replay: (args: {
|
|
1762
|
+
channel: string;
|
|
1763
|
+
after?: JsonValue;
|
|
1764
|
+
limit?: JsonValue;
|
|
1765
|
+
}) => Promise<JsonValue>;
|
|
1766
|
+
subscribe: (args: {
|
|
1767
|
+
channel: JsonValue;
|
|
1768
|
+
clientId: JsonValue;
|
|
1769
|
+
}) => Promise<JsonValue>;
|
|
1770
|
+
unsubscribe: (args: {
|
|
1771
|
+
channel: JsonValue;
|
|
1772
|
+
clientId: JsonValue;
|
|
1773
|
+
}) => Promise<JsonValue>;
|
|
1774
|
+
};
|
|
1775
|
+
simulation: {
|
|
1776
|
+
compareRuns: (args: {
|
|
1777
|
+
targetRunId: string;
|
|
1778
|
+
baselineRunId: string;
|
|
1779
|
+
}) => Promise<JsonValue>;
|
|
1780
|
+
discover: () => Promise<JsonValue>;
|
|
1781
|
+
getRun: (args: {
|
|
1782
|
+
runId: string;
|
|
1783
|
+
}) => Promise<JsonValue>;
|
|
1784
|
+
listRuns: (args?: {
|
|
1785
|
+
limit?: JsonValue;
|
|
1786
|
+
offset?: JsonValue;
|
|
1787
|
+
}) => Promise<JsonValue>;
|
|
1788
|
+
};
|
|
1789
|
+
storage: {
|
|
1790
|
+
createBucket: (args: {
|
|
1791
|
+
body: JsonObject;
|
|
1792
|
+
}) => Promise<JsonValue>;
|
|
1793
|
+
deleteBucket: (args: {
|
|
1794
|
+
name: string;
|
|
1795
|
+
}) => Promise<JsonValue>;
|
|
1796
|
+
getBucket: (args: {
|
|
1797
|
+
name: string;
|
|
1798
|
+
}) => Promise<JsonValue>;
|
|
1799
|
+
listBuckets: () => Promise<JsonValue>;
|
|
1800
|
+
moveObject: (args: {
|
|
1801
|
+
fromPath: JsonValue;
|
|
1802
|
+
toPath: JsonValue;
|
|
1803
|
+
}) => Promise<JsonValue>;
|
|
1804
|
+
updateBucket: (args: {
|
|
1805
|
+
name: string;
|
|
1806
|
+
body: JsonObject;
|
|
1807
|
+
}) => Promise<JsonValue>;
|
|
1808
|
+
};
|
|
1809
|
+
templates: {
|
|
1810
|
+
list: () => Promise<JsonValue>;
|
|
1811
|
+
get: (args: {
|
|
1812
|
+
name: string;
|
|
1813
|
+
}) => Promise<JsonValue>;
|
|
1814
|
+
apply: (args: {
|
|
1815
|
+
orgId?: string;
|
|
1816
|
+
projectId?: string;
|
|
1817
|
+
name: string;
|
|
1818
|
+
dryRun?: JsonValue;
|
|
1819
|
+
}) => Promise<JsonValue>;
|
|
1820
|
+
};
|
|
1821
|
+
traces: {
|
|
1822
|
+
list: (args?: {
|
|
1823
|
+
kind?: JsonValue;
|
|
1824
|
+
before?: JsonValue;
|
|
1825
|
+
limit?: JsonValue;
|
|
1826
|
+
}) => Promise<JsonValue>;
|
|
1827
|
+
get: (args: {
|
|
1828
|
+
traceId: string;
|
|
1829
|
+
}) => Promise<JsonValue>;
|
|
1830
|
+
};
|
|
1831
|
+
vector: {
|
|
1832
|
+
deleteCollection: (args: {
|
|
1833
|
+
collection: string;
|
|
1834
|
+
}) => Promise<JsonValue>;
|
|
1835
|
+
deleteRecord: (args: {
|
|
1836
|
+
collection: string;
|
|
1837
|
+
recordId: string;
|
|
1838
|
+
}) => Promise<JsonValue>;
|
|
1839
|
+
embed: (args: {
|
|
1840
|
+
texts: JsonValue;
|
|
1841
|
+
}) => Promise<JsonValue>;
|
|
1842
|
+
listCollections: () => Promise<JsonValue>;
|
|
1843
|
+
upsert: (args: {
|
|
1844
|
+
collection: JsonValue;
|
|
1845
|
+
docs: JsonValue;
|
|
1846
|
+
}) => Promise<JsonValue>;
|
|
1847
|
+
setCollection: (args: {
|
|
1848
|
+
collection: string;
|
|
1849
|
+
appSearch?: JsonValue;
|
|
1850
|
+
}) => Promise<JsonValue>;
|
|
1851
|
+
reembedCollection: (args: {
|
|
1852
|
+
collection: string;
|
|
1853
|
+
force?: JsonValue;
|
|
1854
|
+
}) => Promise<JsonValue>;
|
|
1855
|
+
sqlSearch: (args: {
|
|
1856
|
+
tableName: JsonValue;
|
|
1857
|
+
columnName?: JsonValue;
|
|
1858
|
+
vector?: JsonValue;
|
|
1859
|
+
text?: JsonValue;
|
|
1860
|
+
mode?: JsonValue;
|
|
1861
|
+
textColumns?: JsonValue;
|
|
1862
|
+
language?: JsonValue;
|
|
1863
|
+
k?: JsonValue;
|
|
1864
|
+
metric?: JsonValue;
|
|
1865
|
+
select?: JsonValue;
|
|
1866
|
+
filter?: JsonValue;
|
|
1867
|
+
maxDistance?: JsonValue;
|
|
1868
|
+
}) => Promise<JsonValue>;
|
|
1869
|
+
sqlAutoStatus: () => Promise<JsonValue>;
|
|
1870
|
+
sqlAutoEnable: (args: {
|
|
1871
|
+
tableName: JsonValue;
|
|
1872
|
+
columnName?: JsonValue;
|
|
1873
|
+
sourceColumns: JsonValue;
|
|
1874
|
+
rebuild?: JsonValue;
|
|
1875
|
+
}) => Promise<JsonValue>;
|
|
1876
|
+
sqlAutoDisable: (args: {
|
|
1877
|
+
tableName: string;
|
|
1878
|
+
}) => Promise<JsonValue>;
|
|
1879
|
+
sqlAutoSync: (args?: {
|
|
1880
|
+
tableName?: JsonValue;
|
|
1881
|
+
limit?: JsonValue;
|
|
1882
|
+
}) => Promise<JsonValue>;
|
|
1883
|
+
};
|
|
1884
|
+
workflows: {
|
|
1885
|
+
start: (args: {
|
|
1886
|
+
functionName: JsonValue;
|
|
1887
|
+
input?: JsonValue;
|
|
1888
|
+
key?: JsonValue;
|
|
1889
|
+
}) => Promise<JsonValue>;
|
|
1890
|
+
list: (args?: {
|
|
1891
|
+
functionName?: JsonValue;
|
|
1892
|
+
status?: JsonValue;
|
|
1893
|
+
before?: JsonValue;
|
|
1894
|
+
limit?: JsonValue;
|
|
1895
|
+
}) => Promise<JsonValue>;
|
|
1896
|
+
get: (args: {
|
|
1897
|
+
runId: string;
|
|
1898
|
+
}) => Promise<JsonValue>;
|
|
1899
|
+
signal: (args: {
|
|
1900
|
+
runId: string;
|
|
1901
|
+
name: JsonValue;
|
|
1902
|
+
data?: JsonValue;
|
|
1903
|
+
}) => Promise<JsonValue>;
|
|
1904
|
+
cancel: (args: {
|
|
1905
|
+
runId: string;
|
|
1906
|
+
}) => Promise<JsonValue>;
|
|
1907
|
+
retry: (args: {
|
|
1908
|
+
runId: string;
|
|
1909
|
+
latest?: JsonValue;
|
|
1910
|
+
}) => Promise<JsonValue>;
|
|
1911
|
+
};
|
|
1912
|
+
};
|
|
1913
|
+
readonly keys: {
|
|
1914
|
+
list: () => Promise<JsonValue>;
|
|
1915
|
+
create: (payload: JsonObject) => Promise<JsonObject>;
|
|
1916
|
+
ensureDefaults: () => Promise<JsonObject>;
|
|
1917
|
+
revoke: (keyId: string) => Promise<JsonObject>;
|
|
1918
|
+
};
|
|
1919
|
+
readonly governance: {
|
|
1920
|
+
listRegions: () => Promise<JsonValue>;
|
|
1921
|
+
listAvailableRegions: (query?: {
|
|
1922
|
+
size?: string;
|
|
1923
|
+
plan?: string;
|
|
1924
|
+
}) => Promise<JsonValue>;
|
|
1925
|
+
patchRegion: (regionId: string, body: JsonObject) => Promise<JsonObject>;
|
|
1926
|
+
listTenants: () => Promise<JsonValue>;
|
|
1927
|
+
getTenant: (orgId: string) => Promise<JsonObject>;
|
|
1928
|
+
setTenantStatus: (orgId: string, body: JsonObject) => Promise<JsonObject>;
|
|
1929
|
+
listTenantDatabases: (orgId: string) => Promise<JsonValue>;
|
|
1930
|
+
provisionDatabase: (orgId: string, body: JsonObject) => Promise<JsonObject>;
|
|
1931
|
+
getDatabaseConnection: (orgId: string, projectId: string) => Promise<JsonObject>;
|
|
1932
|
+
revealDatabaseConnection: (orgId: string, projectId: string, grantId: string) => Promise<JsonObject>;
|
|
1933
|
+
pauseDatabase: (orgId: string, projectId: string) => Promise<JsonObject>;
|
|
1934
|
+
resumeDatabase: (orgId: string, projectId: string) => Promise<JsonObject>;
|
|
1935
|
+
resizeDatabase: (orgId: string, projectId: string, body: JsonObject) => Promise<JsonObject>;
|
|
1936
|
+
deleteDatabase: (orgId: string, projectId: string, snapshot?: boolean) => Promise<JsonObject>;
|
|
1937
|
+
listDatabaseBackups: (orgId: string, projectId: string, limit?: number) => Promise<JsonValue>;
|
|
1938
|
+
triggerDatabaseBackup: (orgId: string, projectId: string) => Promise<JsonObject>;
|
|
1939
|
+
adminListDatabases: () => Promise<JsonValue>;
|
|
1940
|
+
listHosts: (regionId?: string) => Promise<JsonValue>;
|
|
1941
|
+
patchHost: (hostId: string, body: JsonObject) => Promise<JsonObject>;
|
|
1942
|
+
metricsOverview: () => Promise<JsonObject>;
|
|
1943
|
+
projectMetrics: (projectId: string, since?: string, limit?: number) => Promise<JsonObject>;
|
|
1944
|
+
};
|
|
1945
|
+
readonly admin: {
|
|
1946
|
+
listErrorTraces: (query?: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
|
|
1947
|
+
getErrorTrace: (traceId: string) => Promise<JsonObject>;
|
|
1948
|
+
resolveErrorTrace: (traceId: string, body?: JsonObject) => Promise<JsonObject>;
|
|
1949
|
+
usageOverview: (period?: string, limit?: number) => Promise<JsonObject>;
|
|
1950
|
+
listAccessTransparency: (query: Record<string, string | number | boolean | null | undefined>) => Promise<JsonValue>;
|
|
1951
|
+
gatewayHealth: () => Promise<JsonValue>;
|
|
1952
|
+
};
|
|
1953
|
+
/**
|
|
1954
|
+
* Vector / embeddings (Nexus engine).
|
|
1955
|
+
*
|
|
1956
|
+
* All routes are project-scoped via the standard `X-Sovaria-Project-ID`
|
|
1957
|
+
* header so call `setScope({ orgId, projectId })` first.
|
|
1958
|
+
*/
|
|
1959
|
+
readonly vector: {
|
|
1960
|
+
embed: (texts: string[]) => Promise<{
|
|
1961
|
+
vectors: number[][];
|
|
1962
|
+
dim: number;
|
|
1963
|
+
count: number;
|
|
1964
|
+
}>;
|
|
1965
|
+
upsert: (collection: string, docs: Array<{
|
|
1966
|
+
id?: string;
|
|
1967
|
+
text: string;
|
|
1968
|
+
metadata?: JsonObject;
|
|
1969
|
+
}>) => Promise<JsonObject>;
|
|
1970
|
+
/**
|
|
1971
|
+
* Search a collection. `mode`: `vector` (meaning), `keyword` (the words, BM25) or `hybrid` (both,
|
|
1972
|
+
* fused); the default is vector with a real embedding model and hybrid with the local hash model.
|
|
1973
|
+
* Apps (anon key, signed-in users) may only search collections opened with `setCollection(name, { appSearch: true })`.
|
|
1974
|
+
*/
|
|
1975
|
+
search: (collection: string, query: string, options?: {
|
|
1976
|
+
topK?: number;
|
|
1977
|
+
metadataFilter?: JsonObject;
|
|
1978
|
+
mode?: "vector" | "keyword" | "hybrid";
|
|
1979
|
+
}) => Promise<JsonObject>;
|
|
1980
|
+
/** Collection settings (team / service key): `appSearch` lets the project's apps search it. */
|
|
1981
|
+
setCollection: (collection: string, settings: {
|
|
1982
|
+
appSearch?: boolean;
|
|
1983
|
+
}) => Promise<JsonObject>;
|
|
1984
|
+
listCollections: () => Promise<JsonObject>;
|
|
1985
|
+
listRecords: (collection: string, options?: {
|
|
1986
|
+
limit?: number;
|
|
1987
|
+
offset?: number;
|
|
1988
|
+
}) => Promise<JsonObject>;
|
|
1989
|
+
deleteRecord: (collection: string, recordId: string) => Promise<JsonObject>;
|
|
1990
|
+
deleteCollection: (collection: string) => Promise<JsonObject>;
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
export type RealtimeStatus = 'connecting' | 'live' | 'reconnecting' | 'closed';
|
|
1994
|
+
export interface RealtimeChannelHandlers {
|
|
1995
|
+
/** Each message's payload (the `payload` field of a published event, or the raw frame). */
|
|
1996
|
+
onMessage?: (payload: JsonObject, raw: JsonObject) => void;
|
|
1997
|
+
onStatus?: (status: RealtimeStatus) => void;
|
|
1998
|
+
/** Called when a connection attempt fails; the channel keeps retrying. */
|
|
1999
|
+
onError?: (error: unknown) => void;
|
|
2000
|
+
/** Maximum delay between reconnects in ms (default 15000). */
|
|
2001
|
+
maxBackoffMs?: number;
|
|
2002
|
+
}
|
|
2003
|
+
export interface RealtimeChannel {
|
|
2004
|
+
readonly name: string;
|
|
2005
|
+
readonly status: RealtimeStatus;
|
|
2006
|
+
/** Publish to this channel through the API (works for every subscriber). */
|
|
2007
|
+
send: (payload: JsonObject) => Promise<JsonObject>;
|
|
2008
|
+
close: () => void;
|
|
2009
|
+
}
|
|
2010
|
+
export interface SovariaProjectConfigFile {
|
|
2011
|
+
project?: {
|
|
2012
|
+
name?: string;
|
|
2013
|
+
runtime?: string;
|
|
2014
|
+
ref?: string;
|
|
2015
|
+
};
|
|
2016
|
+
gateway?: {
|
|
2017
|
+
url?: string;
|
|
2018
|
+
};
|
|
2019
|
+
scope?: {
|
|
2020
|
+
org_id?: string;
|
|
2021
|
+
project_id?: string;
|
|
2022
|
+
env_id?: string;
|
|
2023
|
+
orgId?: string;
|
|
2024
|
+
projectId?: string;
|
|
2025
|
+
envId?: string;
|
|
2026
|
+
};
|
|
2027
|
+
features?: {
|
|
2028
|
+
realtime?: boolean;
|
|
2029
|
+
functions?: boolean;
|
|
2030
|
+
storage?: boolean;
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
/** Extra client settings layered over sovaria.config.json (keys, callbacks, session storage). */
|
|
2034
|
+
export type ProjectConfigOptions = Omit<SovariaPortalConfig, 'url' | 'baseUrl'>;
|
|
2035
|
+
/** Map sovaria.config.json content (written by `sov init` / `sov link`) to SDK bootstrap config. */
|
|
2036
|
+
export declare function portalConfigFromProjectFile(raw: SovariaProjectConfigFile, options?: ProjectConfigOptions): SovariaPortalConfig;
|
|
2037
|
+
/**
|
|
2038
|
+
* Create a client from sovaria.config.json. In a bundler, import the file and pass the anon key:
|
|
2039
|
+
* `createClientFromProjectConfig(config, { publishableKey: import.meta.env.VITE_SOVARIA_ANON_KEY })`.
|
|
2040
|
+
*/
|
|
2041
|
+
export declare function createClientFromProjectConfig(raw: SovariaProjectConfigFile, options?: ProjectConfigOptions): SovariaSDK;
|
|
2042
|
+
/**
|
|
2043
|
+
* Create a client. Either pass the two values from the console's **Connect** panel —
|
|
2044
|
+
* `createClient('https://<ref>.sovarias.in', '<anon-key>')` — or a config object.
|
|
2045
|
+
*/
|
|
2046
|
+
export declare function createClient(urlOrConfig: string | SovariaPortalConfig, key?: string, options?: Omit<SovariaPortalConfig, 'url' | 'baseUrl'>): SovariaSDK;
|