@lunora/client 1.0.0-alpha.255 → 1.0.0-alpha.257

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -97,6 +97,7 @@ client.close();
97
97
  - `@lunora/client/query` — the shared live-query state machine every UI adapter builds on, plus the TanStack Query key contract and `lunoraQueryOptions` factory (subpath of this package).
98
98
  - `@lunora/client/auth` — the identity store and auth-gate contract, plus the framework-neutral core of the admin/organization list hooks (subpath of this package).
99
99
  - `@lunora/client/ssr` — server-side preloading over this client's HTTP transport (subpath of this package).
100
+ - `@lunora/client/admin` — `LunoraAdminClient`, a `LunoraClient` with the deployment-admin surface (functions, scheduler, storage, KV, vectors, logs, better-auth admin) the Studio uses. Kept off `LunoraClient` so apps don't ship it.
100
101
 
101
102
  ## Supported Node.js Versions
102
103
 
@@ -0,0 +1,609 @@
1
+ import { a6 as ShardTrafficResult, Z as ScheduleRecord, a0 as SchedulerStatus, aj as WorkflowInstanceStatus, ai as WorkflowInstancePage, ah as WorkflowInstanceDetail, ag as WorkflowInstanceAction, p as FunctionDescriptor, a7 as StorageListPage, s as GlobalTableInfo, r as GlobalFilterClause, t as GlobalTablePage, G as GlobalFacetResult, L as LunoraClient } from "../packem_shared/lunora-client.d-DRprzsY5.mjs";
2
+ import { CronJobInfo, VectorIndexSummary, VectorQueryMatch, PipelineLogQuery, PipelineLogPage, KvNamespaceSummary, KvKeyListResult, KvValueResult, AuthUser, AuthPage, AuthImpersonation, AuthCapabilities, AuthConfigInfo, AuthSession } from '@lunora/runtime';
3
+ import '@lunora/errors';
4
+ import "../packem_shared/function-reference.d-Br_hsKje.mjs";
5
+ /**
6
+ * A {@link LunoraClient} with the deployment-admin surface: the Studio's
7
+ * functions, scheduler, workflow, storage, KV, vector, global-table and log
8
+ * readers, and the better-auth admin (users, sessions, organizations, teams,
9
+ * roles, invitations).
10
+ *
11
+ * These live on a subclass rather than on `LunoraClient` because class methods
12
+ * never tree-shake: every web app shipped all of them. An app that only reads,
13
+ * writes and subscribes constructs `LunoraClient` and pays nothing for them;
14
+ * an admin tool constructs this instead.
15
+ */
16
+ declare class LunoraAdminClient extends LunoraClient {
17
+ /**
18
+ * Read the cross-shard request distribution for a `.shardBy(...)` table —
19
+ * the feed the studio's `hot_shard` advisor lint consumes. Hits the
20
+ * admin-gated `POST /_lunora/admin/shard-traffic` endpoint, which fans the
21
+ * cheap per-shard `getMetrics` read out across every live shard and returns
22
+ * each shard's `{ shardKey, requests }` total (a failed shard surfaces with
23
+ * `requests: 0`). Requires the worker to be built with a `queryCoordinator`
24
+ * and `adminToken`, and this client's auth token to match; defaults any
25
+ * absent field so an older worker yields an empty-but-valid shape.
26
+ */
27
+ shardTraffic(table: string): Promise<ShardTrafficResult>;
28
+ /**
29
+ * List the functions queued via `runAfter` / `runAt`, soonest-due last
30
+ * (the worker returns them in storage order). Hits the admin-gated
31
+ * `/_lunora/admin/scheduled` endpoint, so the worker must be built with a
32
+ * `schedulerDO` namespace and `adminToken`, and this client's auth token
33
+ * must match. Powers `@lunora/studio`'s scheduled-jobs panel.
34
+ */
35
+ listScheduledJobs(): Promise<ScheduleRecord[]>;
36
+ /**
37
+ * Read the app-level workpool backlog that powers `@lunora/studio`'s SLO
38
+ * view: per-pool `{ name, queued, inFlight, maxConcurrency }` plus the
39
+ * app-wide `backlog` (total queued) and `inFlight` (total held slots) sums.
40
+ * Hits the admin-gated `GET /_lunora/admin/scheduled/status` endpoint, so the
41
+ * same preconditions as {@link listScheduledJobs} apply (a `schedulerDO`
42
+ * namespace + `adminToken` on the worker and a matching auth token here).
43
+ * Defaults any absent field so an older worker still yields a valid shape.
44
+ */
45
+ schedulerStatus(): Promise<SchedulerStatus>;
46
+ /** Cancel a pending scheduled job by id. Returns whether a job was removed. */
47
+ cancelScheduledJob(id: string): Promise<{
48
+ cancelled: boolean;
49
+ }>;
50
+ /**
51
+ * List the dead-letter jobs: schedules that exhausted their retry budget
52
+ * and were parked instead of dropped. These never appear in
53
+ * {@link listScheduledJobs} (their live header is gone), so this is the only
54
+ * way the studio surfaces a permanently-failed job. Hits the admin-gated
55
+ * `GET /_lunora/admin/scheduled/dead`; same preconditions as
56
+ * {@link listScheduledJobs}. Powers `@lunora/studio`'s dead-letter panel.
57
+ */
58
+ listDeadJobs(): Promise<ScheduleRecord[]>;
59
+ /**
60
+ * Resurrect a dead-letter job by id: it re-enters the schedule with a fresh
61
+ * retry budget and fires on the next drain. Returns whether a parked record
62
+ * matched. Hits the admin-gated `POST /_lunora/admin/scheduled/dead/retry`.
63
+ */
64
+ retryDeadJob(id: string): Promise<{
65
+ retried: boolean;
66
+ }>;
67
+ /**
68
+ * Permanently drop a dead-letter job by id (the operator has decided not to
69
+ * recover it). Returns whether a parked record was removed. Hits the
70
+ * admin-gated `POST /_lunora/admin/scheduled/dead/cancel`.
71
+ */
72
+ removeDeadJob(id: string): Promise<{
73
+ removed: boolean;
74
+ }>;
75
+ /**
76
+ * List a workflow's instances via the admin Workflows proxy
77
+ * (`/_lunora/admin/workflows/instances`) — the Cloudflare control-plane data
78
+ * the `Workflow` binding can't expose. Requires the worker to be built with a
79
+ * `workflowsClient` (Cloudflare account id + API token). When one isn't
80
+ * configured this does NOT reject: the proxy returns a `200 { configured:
81
+ * false }` sentinel, so the result resolves with `configured === false` and an
82
+ * empty `instances` list — callers should branch on that flag rather than
83
+ * try/catch. (The instance-detail / status endpoints still reject with 501.)
84
+ * `name` is the deployed workflow name.
85
+ */
86
+ listWorkflowInstances(options: {
87
+ name: string;
88
+ page?: number;
89
+ perPage?: number;
90
+ status?: WorkflowInstanceStatus;
91
+ }): Promise<WorkflowInstancePage>;
92
+ /** Read one workflow instance with its step timeline (`/_lunora/admin/workflows/instance`). */
93
+ getWorkflowInstance(options: {
94
+ id: string;
95
+ name: string;
96
+ }): Promise<WorkflowInstanceDetail>;
97
+ /** Pause / resume / restart / terminate a workflow instance (`/_lunora/admin/workflows/status`). Needs an Edit-scoped Cloudflare token. */
98
+ setWorkflowInstanceStatus(options: {
99
+ action: WorkflowInstanceAction;
100
+ id: string;
101
+ name: string;
102
+ }): Promise<{
103
+ status: WorkflowInstanceStatus;
104
+ }>;
105
+ /**
106
+ * List the registered public functions (queries / mutations / actions) with
107
+ * their kinds. Hits the admin-gated `GET /_lunora/admin/functions` endpoint —
108
+ * the worker must be built with a `functions` registry and `adminToken`, and
109
+ * this client's auth token must match. Powers `@lunora/studio`'s function
110
+ * runner auto-discovery.
111
+ */
112
+ listFunctions(): Promise<FunctionDescriptor[]>;
113
+ /**
114
+ * List the code-defined cron triggers (the `cronJobs()` map injected on the
115
+ * worker), each flattened to its firing `cron` expression. Hits the
116
+ * admin-gated `GET /_lunora/admin/cron-jobs` endpoint — the worker must be
117
+ * built with a `cronJobs` map and `adminToken`, and this client's auth token
118
+ * must match. These are static (Cloudflare exposes no runtime cron
119
+ * introspection), so the studio renders them read-only alongside the dynamic
120
+ * scheduler jobs.
121
+ */
122
+ getCronJobs(): Promise<CronJobInfo[]>;
123
+ /**
124
+ * Manually fire one code-defined cron job by name — the same dispatch the
125
+ * scheduled trigger runs (dispatch the function, or start the durable
126
+ * workflow), on demand. Hits the admin-gated `POST /_lunora/admin/cron-jobs/run`
127
+ * endpoint; the worker must be built with a `cronJobs` map and `adminToken`,
128
+ * and this client's auth token must match. Resolves when the job has run (a
129
+ * function job's shard response is 2xx, or the workflow instance was created)
130
+ * and rejects with the dispatch error otherwise.
131
+ */
132
+ runCronJob(name: string): Promise<{
133
+ name: string;
134
+ ran: boolean;
135
+ }>;
136
+ /**
137
+ * Fetch the generated OpenAPI 3.1 document. Hits the admin-gated
138
+ * `GET /_lunora/admin/openapi` endpoint — the worker must be built with an
139
+ * `openApiSpec` and `adminToken`, and this client's auth token must match.
140
+ * Powers `@lunora/studio`'s API-reference (Scalar) view. When the worker has
141
+ * no spec wired, the endpoint still resolves with an empty-but-valid OpenAPI
142
+ * document (no `paths`), so callers can render a "not configured" state.
143
+ */
144
+ fetchOpenApi(): Promise<Record<string, unknown>>;
145
+ /**
146
+ * Fetch the generated architecture manifest (module catalog + static call
147
+ * graph). Hits the admin-gated `GET /_lunora/admin/architecture` endpoint.
148
+ * Codegen emits the manifest once the app declares a module
149
+ * (`lunora/<dir>/module.ts`); until then the endpoint answers an empty one
150
+ * (no modules, nodes or edges). Powers `@lunora/studio`'s Architecture view.
151
+ */
152
+ fetchArchitecture(): Promise<Record<string, unknown>>;
153
+ /**
154
+ * Fetch the generated OpenRPC 1.x document. Hits the admin-gated
155
+ * `GET /_lunora/admin/openrpc` endpoint — the worker must be built with an
156
+ * `openRpcSpec` and `adminToken`, and this client's auth token must match.
157
+ * OpenRPC is the RPC-native spec (a `methods` array over the JSON-RPC-shaped
158
+ * `POST /_lunora/rpc` transport); it documents the RPC functions only.
159
+ * Powers `@lunora/studio`'s OpenRPC API-reference view. When the worker has
160
+ * no spec wired, the endpoint still resolves with an empty-but-valid OpenRPC
161
+ * document (no `methods`), so callers can render a "not configured" state.
162
+ */
163
+ fetchOpenRpc(): Promise<Record<string, unknown>>;
164
+ /**
165
+ * List objects in the storage bucket, optionally under a `prefix` and from a
166
+ * pagination `cursor`. Hits the admin-gated `GET /_lunora/admin/storage`
167
+ * endpoint — the worker must be built with a `storageList` function and
168
+ * `adminToken`, and this client's auth token must match. Powers
169
+ * `@lunora/studio`'s file browser.
170
+ */
171
+ listStorageObjects(options?: {
172
+ bucket?: string;
173
+ cursor?: string;
174
+ limit?: number;
175
+ prefix?: string;
176
+ }): Promise<StorageListPage>;
177
+ /**
178
+ * Delete one object from the storage bucket by key. Hits the admin-gated
179
+ * `DELETE /_lunora/admin/storage?key=…` endpoint — the worker must be built
180
+ * with a `storageDelete` function and `adminToken`. Powers the studio file
181
+ * browser's per-row delete; resolves `{ deleted, key }`.
182
+ *
183
+ * An absent `deleted` field reads as `false`, matching every sibling admin
184
+ * verb (`runCronJob`'s `ran`, …): the studio renders this value as the row's
185
+ * outcome, so defaulting a missing field to success would report a delete
186
+ * that a mismatched/older worker never performed.
187
+ */
188
+ deleteStorageObject(key: string, options?: {
189
+ bucket?: string;
190
+ }): Promise<{
191
+ deleted: boolean;
192
+ key: string;
193
+ }>;
194
+ /**
195
+ * List the storage bucket names the worker exposes, for the studio file
196
+ * browser's bucket picker. Hits the admin-gated
197
+ * `GET /_lunora/admin/storage/buckets` endpoint — always resolves (an empty
198
+ * array when the worker configures no `storageBuckets`, i.e. single-bucket).
199
+ */
200
+ listStorageBuckets(): Promise<string[]>;
201
+ /**
202
+ * Upload one object to the storage bucket. Hits the admin-gated
203
+ * `PUT /_lunora/admin/storage?key=…` endpoint with the raw body and an
204
+ * optional `contentType` header — the worker must be built with a
205
+ * `storageUpload` function and `adminToken`. Powers the studio file
206
+ * browser's upload control; resolves `{ etag?, key }`.
207
+ */
208
+ uploadStorageObject(options: {
209
+ body: ArrayBuffer | Blob;
210
+ bucket?: string;
211
+ contentType?: string;
212
+ key: string;
213
+ }): Promise<{
214
+ etag?: string;
215
+ key: string;
216
+ }>;
217
+ /**
218
+ * Build a (signed or public) URL for one object. Hits the admin-gated
219
+ * `GET /_lunora/admin/storage/url?key=…` endpoint — the worker must be built
220
+ * with a `storageSignedUrl` function and `adminToken`. Powers the studio
221
+ * file browser's copy-URL action; resolves the URL string.
222
+ *
223
+ * `options.expiresInSeconds` requests a share-link lifetime, which is
224
+ * validated/clamped server-side. The options object mirrors the worker's
225
+ * `StorageSignedUrlFunction` options (a `password` / download-limit are noted
226
+ * as future fields there).
227
+ */
228
+ signedStorageUrl(key: string, options?: {
229
+ bucket?: string;
230
+ expiresInSeconds?: number;
231
+ }): Promise<string>;
232
+ /**
233
+ * List the `.global()` (D1-backed) tables with their row counts. Hits the
234
+ * admin-gated `GET /_lunora/admin/global/tables` endpoint — the worker must
235
+ * be built with a `globalIntrospector` and `adminToken`. Powers the data
236
+ * browser's global mode.
237
+ */
238
+ listGlobalTables(): Promise<GlobalTableInfo[]>;
239
+ /**
240
+ * Read a page of rows from one `.global()` table. `filters` AND-narrows the
241
+ * page to rows matching each `column = value` eq constraint — the drill-down a
242
+ * facet-value click applies; the array is wire-encoded, JSON-encoded into the
243
+ * `filters` query param, and the values are bound server-side.
244
+ *
245
+ * The response is `decodeWire`d. The worker encodes it (`readGlobalTablePage`
246
+ * in `@lunora/d1`) because JSON cannot carry a `v.bigint()` column at all and
247
+ * silently flattens a `v.bytes()` one to `{}` — so without the decode here the
248
+ * grid renders the raw 3-element tagged array instead of the value. The shard
249
+ * browser's twin already pairs the same way through `rpc`; this is the global
250
+ * half of that symmetry.
251
+ */
252
+ readGlobalTablePage(options: {
253
+ filters?: GlobalFilterClause[];
254
+ limit?: number;
255
+ offset?: number;
256
+ table: string;
257
+ }): Promise<GlobalTablePage>;
258
+ /**
259
+ * Summarise the distinct values of one column in a `.global()` table over the
260
+ * active view (the same eq `filters` the browser is previewing) — the global
261
+ * twin of the shard browser's facet. Hits the admin-gated
262
+ * `GET /_lunora/admin/global/facet` endpoint; `column` is validated + bound
263
+ * server-side. Powers the global data browser's facet sidebar.
264
+ *
265
+ * Wire-encoded/decoded on both legs for the same reason
266
+ * {@link LunoraAdminClient.readGlobalTablePage} is: a facet over a BLOB column
267
+ * returns bytes, which `Response.json` flattens to `{}` — and since a facet
268
+ * value is exactly what a click sends back as a `filters` clause, that is a
269
+ * broken drill-down rather than a display glitch.
270
+ */
271
+ facetGlobalColumn(options: {
272
+ column: string;
273
+ filters?: GlobalFilterClause[];
274
+ limit?: number;
275
+ table: string;
276
+ }): Promise<GlobalFacetResult>;
277
+ /**
278
+ * List the schema's Vectorize indexes with their declared shape (table,
279
+ * field, dimensions, metric, metadata) and live stats (vector count,
280
+ * processing watermark) when the binding is reachable. Hits the admin-gated
281
+ * `GET /_lunora/admin/vector/indexes` endpoint — the worker must be built
282
+ * with a `vectorIntrospector` and `adminToken`. Powers the studio's vector
283
+ * browser. Vectorize can't enumerate indexes at runtime, so this list comes
284
+ * from the generated `LUNORA_VECTOR_INDEXES` registry.
285
+ */
286
+ listVectorIndexes(): Promise<VectorIndexSummary[]>;
287
+ /**
288
+ * Run a nearest-neighbour similarity query against one vector index: the
289
+ * worker embeds `text` via the index's embedder and returns the top matches.
290
+ * Hits the admin-gated `POST /_lunora/admin/vector/query` endpoint. Throws
291
+ * `VECTOR_QUERY_UNSUPPORTED` when the worker's introspector has no embedder
292
+ * wired (the index lists read-only).
293
+ */
294
+ queryVectorIndex(options: {
295
+ name: string;
296
+ text: string;
297
+ topK?: number;
298
+ }): Promise<VectorQueryMatch[]>;
299
+ /**
300
+ * Read one keyset-paginated page of the durable `ctx.log` archive that
301
+ * `pipelineLogSink` writes to R2. Server-side only — the worker holds the R2
302
+ * SQL credentials and runs the reader; the browser only sees the decoded
303
+ * `{ rows, nextCursor }`. Pass the previous page's `nextCursor` as
304
+ * `query.cursor` to page. Admin-gated. When the operator hasn't wired the
305
+ * archive, `adminFetch` throws a `LunoraClientError` with `.code ===
306
+ * "LOG_ARCHIVE_NOT_CONFIGURED"`, so a caller can render a "not configured"
307
+ * state rather than an error.
308
+ */
309
+ queryLogArchive(query?: PipelineLogQuery): Promise<PipelineLogPage>;
310
+ /**
311
+ * List the worker's registered Workers KV namespaces (binding names). Hits
312
+ * the admin-gated `GET /_lunora/admin/kv/namespaces` endpoint — the worker
313
+ * must be built with a `kvIntrospector` and `adminToken`. Powers the
314
+ * studio's KV browser.
315
+ */
316
+ listKvNamespaces(): Promise<KvNamespaceSummary[]>;
317
+ /**
318
+ * List keys in a KV namespace, optionally filtered by `prefix` and
319
+ * paginated via `cursor`. Hits the admin-gated
320
+ * `GET /_lunora/admin/kv/keys` endpoint.
321
+ */
322
+ listKvKeys(options: {
323
+ cursor?: string;
324
+ limit?: number;
325
+ namespace: string;
326
+ prefix?: string;
327
+ }): Promise<KvKeyListResult>;
328
+ /**
329
+ * Read a KV value (as text) and its metadata. Hits the admin-gated
330
+ * `GET /_lunora/admin/kv/value` endpoint. Returns `{ value: null, metadata: null }`
331
+ * when the key is absent.
332
+ */
333
+ getKvValue(options: {
334
+ key: string;
335
+ namespace: string;
336
+ }): Promise<KvValueResult>;
337
+ /**
338
+ * Write a string value to a KV namespace. Accepts an absolute `expiration`
339
+ * (Unix seconds) or a relative `expirationTtl`, plus optional `metadata` —
340
+ * re-send the loaded values on edit so a save preserves rather than clears
341
+ * them. Hits the admin-gated `PUT /_lunora/admin/kv/value` endpoint.
342
+ */
343
+ putKvValue(options: {
344
+ expiration?: number;
345
+ expirationTtl?: number;
346
+ key: string;
347
+ metadata?: unknown;
348
+ namespace: string;
349
+ value: string;
350
+ }): Promise<void>;
351
+ /**
352
+ * Delete a key from a KV namespace. No-op when the key is absent. Hits the
353
+ * admin-gated `DELETE /_lunora/admin/kv/value` endpoint.
354
+ */
355
+ deleteKvKey(options: {
356
+ key: string;
357
+ namespace: string;
358
+ }): Promise<void>;
359
+ /**
360
+ * List authenticated users, paged and optionally searched / filtered / sorted.
361
+ * Hits the admin-gated `GET /_lunora/admin/auth/users` endpoint — the worker
362
+ * must be built with an `authAdmin` and `adminToken`. Powers the studio's
363
+ * users dashboard.
364
+ */
365
+ listAuthUsers(options?: {
366
+ filterField?: string;
367
+ filterValue?: string;
368
+ limit?: number;
369
+ offset?: number;
370
+ search?: string;
371
+ searchField?: string;
372
+ sortBy?: string;
373
+ sortDirection?: "asc" | "desc";
374
+ }): Promise<AuthPage<AuthUser>>;
375
+ /**
376
+ * Create a user. Hits the admin-gated `POST /_lunora/admin/auth/users/create`
377
+ * endpoint (requires the worker's `authAdmin` to implement `createUser`).
378
+ * `data` carries any app-defined `user.additionalFields`.
379
+ */
380
+ createAuthUser(input: {
381
+ data?: Record<string, unknown>;
382
+ email: string;
383
+ name: string;
384
+ password?: string;
385
+ role?: string | string[];
386
+ }): Promise<AuthUser>;
387
+ /** Set a user's role (string, or array joined comma-wise server-side). */
388
+ setAuthUserRole(input: {
389
+ role: string | string[];
390
+ userId: string;
391
+ }): Promise<AuthUser>;
392
+ /** Ban a user. `expiresInSeconds` sets a temporary ban; omit it for a permanent one. Revokes the user's live sessions. */
393
+ banAuthUser(input: {
394
+ expiresInSeconds?: number;
395
+ reason?: string;
396
+ userId: string;
397
+ }): Promise<AuthUser>;
398
+ /** Lift a user's ban. */
399
+ unbanAuthUser(input: {
400
+ userId: string;
401
+ }): Promise<AuthUser>;
402
+ /** Set a user's password (admin override — no current-password challenge). */
403
+ setAuthUserPassword(input: {
404
+ newPassword: string;
405
+ userId: string;
406
+ }): Promise<void>;
407
+ /** Permanently delete a user and revoke their sessions. */
408
+ removeAuthUser(input: {
409
+ userId: string;
410
+ }): Promise<void>;
411
+ /**
412
+ * Mint an impersonation session for a user, returning its bearer `token`.
413
+ * The caller is responsible for using the token (e.g. setting the session
414
+ * cookie); the server performs no cookie round-trip.
415
+ */
416
+ impersonateAuthUser(input: {
417
+ userId: string;
418
+ }): Promise<AuthImpersonation>;
419
+ /** Revoke a single session by its id (force sign-out of one device). */
420
+ revokeAuthSession(input: {
421
+ sessionId: string;
422
+ }): Promise<void>;
423
+ /** Revoke every session for a user (force sign-out everywhere). */
424
+ revokeAuthUserSessions(input: {
425
+ userId: string;
426
+ }): Promise<void>;
427
+ /**
428
+ * Report which auth dashboard surfaces are available — derived server-side
429
+ * from the enabled better-auth plugins. The studio renders only the panels
430
+ * whose capability is `true`.
431
+ */
432
+ getAuthCapabilities(): Promise<AuthCapabilities>;
433
+ /** Update a user's fields (name/email/app-defined `additionalFields`). */
434
+ updateAuthUser(input: {
435
+ data: Record<string, unknown>;
436
+ userId: string;
437
+ }): Promise<AuthUser>;
438
+ /** List a user's linked accounts (credential / OAuth providers). Token material is stripped server-side. */
439
+ listAuthAccounts(input: {
440
+ userId: string;
441
+ }): Promise<Record<string, unknown>[]>;
442
+ /** Unlink a linked account from a user. */
443
+ unlinkAuthAccount(input: {
444
+ accountId: string;
445
+ userId: string;
446
+ }): Promise<void>;
447
+ /** List a user's registered passkeys (requires the passkey plugin). */
448
+ listAuthPasskeys(input: {
449
+ userId: string;
450
+ }): Promise<Record<string, unknown>[]>;
451
+ /** Delete a passkey by id (requires the passkey plugin). */
452
+ deleteAuthPasskey(input: {
453
+ passkeyId: string;
454
+ }): Promise<void>;
455
+ /** Disable two-factor auth for a user (requires the two-factor plugin). */
456
+ disableAuthTwoFactor(input: {
457
+ userId: string;
458
+ }): Promise<void>;
459
+ /** List organizations, paged (requires the organization plugin). */
460
+ listAuthOrganizations(options?: {
461
+ limit?: number;
462
+ offset?: number;
463
+ }): Promise<AuthPage<Record<string, unknown>>>;
464
+ /** List the members of an organization (requires the organization plugin). */
465
+ listAuthOrgMembers(input: {
466
+ limit?: number;
467
+ offset?: number;
468
+ organizationId: string;
469
+ }): Promise<AuthPage<Record<string, unknown>>>;
470
+ /** List an organization's pending invitations (requires the organization plugin). */
471
+ listAuthOrgInvitations(input: {
472
+ limit?: number;
473
+ offset?: number;
474
+ organizationId: string;
475
+ }): Promise<AuthPage<Record<string, unknown>>>;
476
+ /**
477
+ * List sign-up invitations, newest first (requires the `inviteOnly` plugin).
478
+ * Unfiltered: a row is pending when `acceptedAt` is null and `expiresAt` is in
479
+ * the future, and the caller labels it — filtering server-side after the page
480
+ * would let page 1 come back empty while pending rows sat on page 2.
481
+ */
482
+ listAuthSignUpInvitations(options?: {
483
+ limit?: number;
484
+ offset?: number;
485
+ }): Promise<AuthPage<Record<string, unknown>>>;
486
+ /** Invite an address to sign up, or refresh an existing invitation for it. */
487
+ createAuthSignUpInvitation(input: {
488
+ email: string;
489
+ expiresInSeconds?: number;
490
+ invitedBy?: string;
491
+ }): Promise<Record<string, unknown>>;
492
+ /** Withdraw a sign-up invitation. Not retroactive — an account already created keeps existing. */
493
+ revokeAuthSignUpInvitation(input: {
494
+ email: string;
495
+ }): Promise<void>;
496
+ removeAuthOrgMember(input: {
497
+ memberId: string;
498
+ }): Promise<void>;
499
+ cancelAuthOrgInvitation(input: {
500
+ invitationId: string;
501
+ }): Promise<void>;
502
+ /**
503
+ * Report the deployment's auth configuration — enabled plugins, sign-in
504
+ * methods, user-settable create-user fields, organization sub-features
505
+ * (teams / roles), and session / rate-limit policy. Drives the config panel
506
+ * and the dynamic create-user form. Never carries a secret.
507
+ */
508
+ getAuthConfig(): Promise<AuthConfigInfo>;
509
+ /** Create an organization; optionally seed an `owner` member for `ownerId`. */
510
+ createAuthOrganization(input: {
511
+ logo?: string;
512
+ metadata?: Record<string, unknown>;
513
+ name: string;
514
+ ownerId?: string;
515
+ slug?: string;
516
+ }): Promise<Record<string, unknown>>;
517
+ /** Update an organization's name/slug/logo/metadata. */
518
+ updateAuthOrganization(input: {
519
+ logo?: string;
520
+ metadata?: Record<string, unknown>;
521
+ name?: string;
522
+ organizationId: string;
523
+ slug?: string;
524
+ }): Promise<Record<string, unknown>>;
525
+ /** Delete an organization and cascade its members, invitations, teams, and custom roles. */
526
+ deleteAuthOrganization(input: {
527
+ organizationId: string;
528
+ }): Promise<void>;
529
+ /** Directly add an existing user to an organization (no invitation/acceptance). */
530
+ addAuthOrgMember(input: {
531
+ organizationId: string;
532
+ role?: string;
533
+ userId: string;
534
+ }): Promise<Record<string, unknown>>;
535
+ /** Create a pending email invitation to an organization. */
536
+ inviteAuthOrgMember(input: {
537
+ email: string;
538
+ inviterId?: string;
539
+ organizationId: string;
540
+ role?: string;
541
+ }): Promise<Record<string, unknown>>;
542
+ setAuthOrgMemberRole(input: {
543
+ memberId: string;
544
+ role: string | string[];
545
+ }): Promise<Record<string, unknown>>;
546
+ /** List an organization's teams (requires the organization plugin with teams enabled). */
547
+ listAuthOrgTeams(input: {
548
+ limit?: number;
549
+ offset?: number;
550
+ organizationId: string;
551
+ }): Promise<AuthPage<Record<string, unknown>>>;
552
+ /** Create a team under an organization. */
553
+ createAuthOrgTeam(input: {
554
+ name: string;
555
+ organizationId: string;
556
+ }): Promise<Record<string, unknown>>;
557
+ updateAuthOrgTeam(input: {
558
+ name: string;
559
+ teamId: string;
560
+ }): Promise<Record<string, unknown>>;
561
+ /** Delete a team and its memberships. */
562
+ removeAuthOrgTeam(input: {
563
+ teamId: string;
564
+ }): Promise<void>;
565
+ listAuthOrgTeamMembers(input: {
566
+ limit?: number;
567
+ offset?: number;
568
+ teamId: string;
569
+ }): Promise<AuthPage<Record<string, unknown>>>;
570
+ addAuthOrgTeamMember(input: {
571
+ teamId: string;
572
+ userId: string;
573
+ }): Promise<Record<string, unknown>>;
574
+ removeAuthOrgTeamMember(input: {
575
+ teamMemberId: string;
576
+ }): Promise<void>;
577
+ /** List an organization's custom roles (requires the organization plugin with dynamic access control). */
578
+ listAuthOrgRoles(input: {
579
+ limit?: number;
580
+ offset?: number;
581
+ organizationId: string;
582
+ }): Promise<AuthPage<Record<string, unknown>>>;
583
+ /** Create a custom org role with a permission grant (a `resource -> actions[]` map). */
584
+ createAuthOrgRole(input: {
585
+ organizationId: string;
586
+ permission: Record<string, string[]>;
587
+ role: string;
588
+ }): Promise<Record<string, unknown>>;
589
+ /** Replace a custom org role's permission grant. */
590
+ updateAuthOrgRole(input: {
591
+ permission: Record<string, string[]>;
592
+ roleId: string;
593
+ }): Promise<Record<string, unknown>>;
594
+ deleteAuthOrgRole(input: {
595
+ roleId: string;
596
+ }): Promise<void>;
597
+ /** List auth sessions, paged and optionally filtered to one user. */
598
+ listAuthSessions(options?: {
599
+ limit?: number;
600
+ offset?: number;
601
+ userId?: string;
602
+ }): Promise<AuthPage<AuthSession>>;
603
+ }
604
+ /**
605
+ * Whether `client` carries the admin surface. Structural rather than
606
+ * `instanceof`, so a client from a second copy of this package still passes.
607
+ */
608
+ declare const isLunoraAdminClient: (client: LunoraClient) => client is LunoraAdminClient;
609
+ export { LunoraAdminClient, isLunoraAdminClient };