@lunora/client 1.0.0-alpha.256 → 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 +1 -0
- package/dist/admin/index.d.mts +609 -0
- package/dist/admin/index.d.ts +609 -0
- package/dist/admin/index.mjs +1 -0
- package/dist/auth/index.d.mts +6 -5
- package/dist/auth/index.d.ts +6 -5
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/LunoraAdminClient-uSk5btbv.mjs +1 -0
- package/dist/packem_shared/LunoraClient-DiKEFgNC.mjs +1 -0
- package/dist/packem_shared/{applyDelta-CWpwS3Bb.mjs → applyDelta-CaudNj2C.mjs} +1 -1
- package/dist/packem_shared/createServerClient-PMXYqcbv.mjs +1 -0
- package/dist/packem_shared/delta-merge-C6OqMEPH.mjs +1 -0
- package/dist/packem_shared/lunora-client-DrLGleL4.mjs +1 -0
- package/dist/packem_shared/{lunora-client.d-dAc3I0a1.d.mts → lunora-client.d-DRprzsY5.d.mts} +12 -596
- package/dist/packem_shared/{lunora-client.d-cLNaBGfy.d.ts → lunora-client.d-E-IxJLKG.d.ts} +12 -596
- package/dist/packem_shared/{preload.d-BWyb1pSK.d.ts → preload.d-BZxjEJ4W.d.ts} +1 -1
- package/dist/packem_shared/{preload.d-DJrMasnC.d.mts → preload.d-Dydg_mKw.d.mts} +1 -1
- package/dist/query/index.d.mts +2 -3
- package/dist/query/index.d.ts +2 -3
- package/dist/ssr/index.d.mts +2 -3
- package/dist/ssr/index.d.ts +2 -3
- package/dist/ssr/index.mjs +1 -1
- package/package.json +6 -2
- package/dist/packem_shared/LunoraClient-C0k-uoqW.mjs +0 -1
- package/dist/packem_shared/createServerClient-Du4HiC_d.mjs +0 -1
- package/dist/packem_shared/delta-merge-Ls3DED4g.mjs +0 -1
package/dist/packem_shared/{lunora-client.d-dAc3I0a1.d.mts → lunora-client.d-DRprzsY5.d.mts}
RENAMED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { LunoraErrorCodeInput, LunoraErrorCode, LunoraError } from '@lunora/errors';
|
|
2
2
|
import { F as FunctionReference, A as ArgsOf, R as ReturnOf } from "./function-reference.d-Br_hsKje.mjs";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The two client operations an admin call needs. The client supplies them as late-bound calls.
|
|
5
|
+
*
|
|
6
|
+
* The module signatures take their types from `LunoraAdminClient` via `Parameters` and `ReturnType`.
|
|
7
|
+
* Every class method those types read must keep an explicit return annotation: without one the
|
|
8
|
+
* derived type is circular, and it silently widens if the method is overloaded later.
|
|
9
|
+
*/
|
|
10
|
+
interface AdminHost {
|
|
11
|
+
adminFetch: (path: string, method: "DELETE" | "GET" | "POST" | "PUT", payload?: ArrayBuffer | Blob | Record<string, unknown>, contentType?: string) => Promise<unknown>;
|
|
12
|
+
assertOpen: () => void;
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* The `onlineOnly` option a call to the function reference `F` may take. A
|
|
6
16
|
* function with a `v.sensitive` argument is emitted as `… & { readonly sensitive:
|
|
@@ -1928,7 +1938,7 @@ declare class LunoraClient {
|
|
|
1928
1938
|
readonly url: string;
|
|
1929
1939
|
readonly wsUrl: string;
|
|
1930
1940
|
/** The admin modules reach the client only through this host. The arrows read `this` when called, so spies and overrides installed after construction still take effect. */
|
|
1931
|
-
|
|
1941
|
+
protected readonly adminHost: AdminHost;
|
|
1932
1942
|
/** Local reactive store for {@link ClientQueryRef} values — no server round-trip. Private; reach it via `getClientQuery` / `setClientQuery` / `subscribeClientQuery`. */
|
|
1933
1943
|
private readonly clientQueryStore;
|
|
1934
1944
|
/** The session credential, sent in the `connect` frame and never in the URL (protocol §6). */
|
|
@@ -3172,94 +3182,6 @@ declare class LunoraClient {
|
|
|
3172
3182
|
imported: number;
|
|
3173
3183
|
queued: number;
|
|
3174
3184
|
}>;
|
|
3175
|
-
/**
|
|
3176
|
-
* Read the cross-shard request distribution for a `.shardBy(...)` table —
|
|
3177
|
-
* the feed the studio's `hot_shard` advisor lint consumes. Hits the
|
|
3178
|
-
* admin-gated `POST /_lunora/admin/shard-traffic` endpoint, which fans the
|
|
3179
|
-
* cheap per-shard `getMetrics` read out across every live shard and returns
|
|
3180
|
-
* each shard's `{ shardKey, requests }` total (a failed shard surfaces with
|
|
3181
|
-
* `requests: 0`). Requires the worker to be built with a `queryCoordinator`
|
|
3182
|
-
* and `adminToken`, and this client's auth token to match; defaults any
|
|
3183
|
-
* absent field so an older worker yields an empty-but-valid shape.
|
|
3184
|
-
*/
|
|
3185
|
-
shardTraffic(table: string): Promise<ShardTrafficResult>;
|
|
3186
|
-
/**
|
|
3187
|
-
* List the functions queued via `runAfter` / `runAt`, soonest-due last
|
|
3188
|
-
* (the worker returns them in storage order). Hits the admin-gated
|
|
3189
|
-
* `/_lunora/admin/scheduled` endpoint, so the worker must be built with a
|
|
3190
|
-
* `schedulerDO` namespace and `adminToken`, and this client's auth token
|
|
3191
|
-
* must match. Powers `@lunora/studio`'s scheduled-jobs panel.
|
|
3192
|
-
*/
|
|
3193
|
-
listScheduledJobs(): Promise<ScheduleRecord[]>;
|
|
3194
|
-
/**
|
|
3195
|
-
* Read the app-level workpool backlog that powers `@lunora/studio`'s SLO
|
|
3196
|
-
* view: per-pool `{ name, queued, inFlight, maxConcurrency }` plus the
|
|
3197
|
-
* app-wide `backlog` (total queued) and `inFlight` (total held slots) sums.
|
|
3198
|
-
* Hits the admin-gated `GET /_lunora/admin/scheduled/status` endpoint, so the
|
|
3199
|
-
* same preconditions as {@link listScheduledJobs} apply (a `schedulerDO`
|
|
3200
|
-
* namespace + `adminToken` on the worker and a matching auth token here).
|
|
3201
|
-
* Defaults any absent field so an older worker still yields a valid shape.
|
|
3202
|
-
*/
|
|
3203
|
-
schedulerStatus(): Promise<SchedulerStatus>;
|
|
3204
|
-
/** Cancel a pending scheduled job by id. Returns whether a job was removed. */
|
|
3205
|
-
cancelScheduledJob(id: string): Promise<{
|
|
3206
|
-
cancelled: boolean;
|
|
3207
|
-
}>;
|
|
3208
|
-
/**
|
|
3209
|
-
* List the dead-letter jobs: schedules that exhausted their retry budget
|
|
3210
|
-
* and were parked instead of dropped. These never appear in
|
|
3211
|
-
* {@link listScheduledJobs} (their live header is gone), so this is the only
|
|
3212
|
-
* way the studio surfaces a permanently-failed job. Hits the admin-gated
|
|
3213
|
-
* `GET /_lunora/admin/scheduled/dead`; same preconditions as
|
|
3214
|
-
* {@link listScheduledJobs}. Powers `@lunora/studio`'s dead-letter panel.
|
|
3215
|
-
*/
|
|
3216
|
-
listDeadJobs(): Promise<ScheduleRecord[]>;
|
|
3217
|
-
/**
|
|
3218
|
-
* Resurrect a dead-letter job by id: it re-enters the schedule with a fresh
|
|
3219
|
-
* retry budget and fires on the next drain. Returns whether a parked record
|
|
3220
|
-
* matched. Hits the admin-gated `POST /_lunora/admin/scheduled/dead/retry`.
|
|
3221
|
-
*/
|
|
3222
|
-
retryDeadJob(id: string): Promise<{
|
|
3223
|
-
retried: boolean;
|
|
3224
|
-
}>;
|
|
3225
|
-
/**
|
|
3226
|
-
* Permanently drop a dead-letter job by id (the operator has decided not to
|
|
3227
|
-
* recover it). Returns whether a parked record was removed. Hits the
|
|
3228
|
-
* admin-gated `POST /_lunora/admin/scheduled/dead/cancel`.
|
|
3229
|
-
*/
|
|
3230
|
-
removeDeadJob(id: string): Promise<{
|
|
3231
|
-
removed: boolean;
|
|
3232
|
-
}>;
|
|
3233
|
-
/**
|
|
3234
|
-
* List a workflow's instances via the admin Workflows proxy
|
|
3235
|
-
* (`/_lunora/admin/workflows/instances`) — the Cloudflare control-plane data
|
|
3236
|
-
* the `Workflow` binding can't expose. Requires the worker to be built with a
|
|
3237
|
-
* `workflowsClient` (Cloudflare account id + API token). When one isn't
|
|
3238
|
-
* configured this does NOT reject: the proxy returns a `200 { configured:
|
|
3239
|
-
* false }` sentinel, so the result resolves with `configured === false` and an
|
|
3240
|
-
* empty `instances` list — callers should branch on that flag rather than
|
|
3241
|
-
* try/catch. (The instance-detail / status endpoints still reject with 501.)
|
|
3242
|
-
* `name` is the deployed workflow name.
|
|
3243
|
-
*/
|
|
3244
|
-
listWorkflowInstances(options: {
|
|
3245
|
-
name: string;
|
|
3246
|
-
page?: number;
|
|
3247
|
-
perPage?: number;
|
|
3248
|
-
status?: WorkflowInstanceStatus;
|
|
3249
|
-
}): Promise<WorkflowInstancePage>;
|
|
3250
|
-
/** Read one workflow instance with its step timeline (`/_lunora/admin/workflows/instance`). */
|
|
3251
|
-
getWorkflowInstance(options: {
|
|
3252
|
-
id: string;
|
|
3253
|
-
name: string;
|
|
3254
|
-
}): Promise<WorkflowInstanceDetail>;
|
|
3255
|
-
/** Pause / resume / restart / terminate a workflow instance (`/_lunora/admin/workflows/status`). Needs an Edit-scoped Cloudflare token. */
|
|
3256
|
-
setWorkflowInstanceStatus(options: {
|
|
3257
|
-
action: WorkflowInstanceAction;
|
|
3258
|
-
id: string;
|
|
3259
|
-
name: string;
|
|
3260
|
-
}): Promise<{
|
|
3261
|
-
status: WorkflowInstanceStatus;
|
|
3262
|
-
}>;
|
|
3263
3185
|
/**
|
|
3264
3186
|
* Subscribe to the live scheduled-jobs list over the SchedulerDO's admin
|
|
3265
3187
|
* WebSocket. `onJobs` fires with the full list on connect and on every
|
|
@@ -3271,512 +3193,6 @@ declare class LunoraClient {
|
|
|
3271
3193
|
* unsubscribe function that closes the socket and stops reconnecting.
|
|
3272
3194
|
*/
|
|
3273
3195
|
subscribeScheduledJobs(onJobs: (jobs: ScheduleRecord[]) => void): Unsubscribe;
|
|
3274
|
-
/**
|
|
3275
|
-
* List the registered public functions (queries / mutations / actions) with
|
|
3276
|
-
* their kinds. Hits the admin-gated `GET /_lunora/admin/functions` endpoint —
|
|
3277
|
-
* the worker must be built with a `functions` registry and `adminToken`, and
|
|
3278
|
-
* this client's auth token must match. Powers `@lunora/studio`'s function
|
|
3279
|
-
* runner auto-discovery.
|
|
3280
|
-
*/
|
|
3281
|
-
listFunctions(): Promise<FunctionDescriptor[]>;
|
|
3282
|
-
/**
|
|
3283
|
-
* List the code-defined cron triggers (the `cronJobs()` map injected on the
|
|
3284
|
-
* worker), each flattened to its firing `cron` expression. Hits the
|
|
3285
|
-
* admin-gated `GET /_lunora/admin/cron-jobs` endpoint — the worker must be
|
|
3286
|
-
* built with a `cronJobs` map and `adminToken`, and this client's auth token
|
|
3287
|
-
* must match. These are static (Cloudflare exposes no runtime cron
|
|
3288
|
-
* introspection), so the studio renders them read-only alongside the dynamic
|
|
3289
|
-
* scheduler jobs.
|
|
3290
|
-
*/
|
|
3291
|
-
getCronJobs(): Promise<CronJobInfo[]>;
|
|
3292
|
-
/**
|
|
3293
|
-
* Manually fire one code-defined cron job by name — the same dispatch the
|
|
3294
|
-
* scheduled trigger runs (dispatch the function, or start the durable
|
|
3295
|
-
* workflow), on demand. Hits the admin-gated `POST /_lunora/admin/cron-jobs/run`
|
|
3296
|
-
* endpoint; the worker must be built with a `cronJobs` map and `adminToken`,
|
|
3297
|
-
* and this client's auth token must match. Resolves when the job has run (a
|
|
3298
|
-
* function job's shard response is 2xx, or the workflow instance was created)
|
|
3299
|
-
* and rejects with the dispatch error otherwise.
|
|
3300
|
-
*/
|
|
3301
|
-
runCronJob(name: string): Promise<{
|
|
3302
|
-
name: string;
|
|
3303
|
-
ran: boolean;
|
|
3304
|
-
}>;
|
|
3305
|
-
/**
|
|
3306
|
-
* Fetch the generated OpenAPI 3.1 document. Hits the admin-gated
|
|
3307
|
-
* `GET /_lunora/admin/openapi` endpoint — the worker must be built with an
|
|
3308
|
-
* `openApiSpec` and `adminToken`, and this client's auth token must match.
|
|
3309
|
-
* Powers `@lunora/studio`'s API-reference (Scalar) view. When the worker has
|
|
3310
|
-
* no spec wired, the endpoint still resolves with an empty-but-valid OpenAPI
|
|
3311
|
-
* document (no `paths`), so callers can render a "not configured" state.
|
|
3312
|
-
*/
|
|
3313
|
-
fetchOpenApi(): Promise<Record<string, unknown>>;
|
|
3314
|
-
/**
|
|
3315
|
-
* Fetch the generated architecture manifest (module catalog + static call
|
|
3316
|
-
* graph). Hits the admin-gated `GET /_lunora/admin/architecture` endpoint.
|
|
3317
|
-
* Codegen emits the manifest once the app declares a module
|
|
3318
|
-
* (`lunora/<dir>/module.ts`); until then the endpoint answers an empty one
|
|
3319
|
-
* (no modules, nodes or edges). Powers `@lunora/studio`'s Architecture view.
|
|
3320
|
-
*/
|
|
3321
|
-
fetchArchitecture(): Promise<Record<string, unknown>>;
|
|
3322
|
-
/**
|
|
3323
|
-
* Fetch the generated OpenRPC 1.x document. Hits the admin-gated
|
|
3324
|
-
* `GET /_lunora/admin/openrpc` endpoint — the worker must be built with an
|
|
3325
|
-
* `openRpcSpec` and `adminToken`, and this client's auth token must match.
|
|
3326
|
-
* OpenRPC is the RPC-native spec (a `methods` array over the JSON-RPC-shaped
|
|
3327
|
-
* `POST /_lunora/rpc` transport); it documents the RPC functions only.
|
|
3328
|
-
* Powers `@lunora/studio`'s OpenRPC API-reference view. When the worker has
|
|
3329
|
-
* no spec wired, the endpoint still resolves with an empty-but-valid OpenRPC
|
|
3330
|
-
* document (no `methods`), so callers can render a "not configured" state.
|
|
3331
|
-
*/
|
|
3332
|
-
fetchOpenRpc(): Promise<Record<string, unknown>>;
|
|
3333
|
-
/**
|
|
3334
|
-
* List objects in the storage bucket, optionally under a `prefix` and from a
|
|
3335
|
-
* pagination `cursor`. Hits the admin-gated `GET /_lunora/admin/storage`
|
|
3336
|
-
* endpoint — the worker must be built with a `storageList` function and
|
|
3337
|
-
* `adminToken`, and this client's auth token must match. Powers
|
|
3338
|
-
* `@lunora/studio`'s file browser.
|
|
3339
|
-
*/
|
|
3340
|
-
listStorageObjects(options?: {
|
|
3341
|
-
bucket?: string;
|
|
3342
|
-
cursor?: string;
|
|
3343
|
-
limit?: number;
|
|
3344
|
-
prefix?: string;
|
|
3345
|
-
}): Promise<StorageListPage>;
|
|
3346
|
-
/**
|
|
3347
|
-
* Delete one object from the storage bucket by key. Hits the admin-gated
|
|
3348
|
-
* `DELETE /_lunora/admin/storage?key=…` endpoint — the worker must be built
|
|
3349
|
-
* with a `storageDelete` function and `adminToken`. Powers the studio file
|
|
3350
|
-
* browser's per-row delete; resolves `{ deleted, key }`.
|
|
3351
|
-
*
|
|
3352
|
-
* An absent `deleted` field reads as `false`, matching every sibling admin
|
|
3353
|
-
* verb (`runCronJob`'s `ran`, …): the studio renders this value as the row's
|
|
3354
|
-
* outcome, so defaulting a missing field to success would report a delete
|
|
3355
|
-
* that a mismatched/older worker never performed.
|
|
3356
|
-
*/
|
|
3357
|
-
deleteStorageObject(key: string, options?: {
|
|
3358
|
-
bucket?: string;
|
|
3359
|
-
}): Promise<{
|
|
3360
|
-
deleted: boolean;
|
|
3361
|
-
key: string;
|
|
3362
|
-
}>;
|
|
3363
|
-
/**
|
|
3364
|
-
* List the storage bucket names the worker exposes, for the studio file
|
|
3365
|
-
* browser's bucket picker. Hits the admin-gated
|
|
3366
|
-
* `GET /_lunora/admin/storage/buckets` endpoint — always resolves (an empty
|
|
3367
|
-
* array when the worker configures no `storageBuckets`, i.e. single-bucket).
|
|
3368
|
-
*/
|
|
3369
|
-
listStorageBuckets(): Promise<string[]>;
|
|
3370
|
-
/**
|
|
3371
|
-
* Upload one object to the storage bucket. Hits the admin-gated
|
|
3372
|
-
* `PUT /_lunora/admin/storage?key=…` endpoint with the raw body and an
|
|
3373
|
-
* optional `contentType` header — the worker must be built with a
|
|
3374
|
-
* `storageUpload` function and `adminToken`. Powers the studio file
|
|
3375
|
-
* browser's upload control; resolves `{ etag?, key }`.
|
|
3376
|
-
*/
|
|
3377
|
-
uploadStorageObject(options: {
|
|
3378
|
-
body: ArrayBuffer | Blob;
|
|
3379
|
-
bucket?: string;
|
|
3380
|
-
contentType?: string;
|
|
3381
|
-
key: string;
|
|
3382
|
-
}): Promise<{
|
|
3383
|
-
etag?: string;
|
|
3384
|
-
key: string;
|
|
3385
|
-
}>;
|
|
3386
|
-
/**
|
|
3387
|
-
* Build a (signed or public) URL for one object. Hits the admin-gated
|
|
3388
|
-
* `GET /_lunora/admin/storage/url?key=…` endpoint — the worker must be built
|
|
3389
|
-
* with a `storageSignedUrl` function and `adminToken`. Powers the studio
|
|
3390
|
-
* file browser's copy-URL action; resolves the URL string.
|
|
3391
|
-
*
|
|
3392
|
-
* `options.expiresInSeconds` requests a share-link lifetime, which is
|
|
3393
|
-
* validated/clamped server-side. The options object mirrors the worker's
|
|
3394
|
-
* `StorageSignedUrlFunction` options (a `password` / download-limit are noted
|
|
3395
|
-
* as future fields there).
|
|
3396
|
-
*/
|
|
3397
|
-
signedStorageUrl(key: string, options?: {
|
|
3398
|
-
bucket?: string;
|
|
3399
|
-
expiresInSeconds?: number;
|
|
3400
|
-
}): Promise<string>;
|
|
3401
|
-
/**
|
|
3402
|
-
* List the `.global()` (D1-backed) tables with their row counts. Hits the
|
|
3403
|
-
* admin-gated `GET /_lunora/admin/global/tables` endpoint — the worker must
|
|
3404
|
-
* be built with a `globalIntrospector` and `adminToken`. Powers the data
|
|
3405
|
-
* browser's global mode.
|
|
3406
|
-
*/
|
|
3407
|
-
listGlobalTables(): Promise<GlobalTableInfo[]>;
|
|
3408
|
-
/**
|
|
3409
|
-
* Read a page of rows from one `.global()` table. `filters` AND-narrows the
|
|
3410
|
-
* page to rows matching each `column = value` eq constraint — the drill-down a
|
|
3411
|
-
* facet-value click applies; the array is wire-encoded, JSON-encoded into the
|
|
3412
|
-
* `filters` query param, and the values are bound server-side.
|
|
3413
|
-
*
|
|
3414
|
-
* The response is `decodeWire`d. The worker encodes it (`readGlobalTablePage`
|
|
3415
|
-
* in `@lunora/d1`) because JSON cannot carry a `v.bigint()` column at all and
|
|
3416
|
-
* silently flattens a `v.bytes()` one to `{}` — so without the decode here the
|
|
3417
|
-
* grid renders the raw 3-element tagged array instead of the value. The shard
|
|
3418
|
-
* browser's twin already pairs the same way through `rpc`; this is the global
|
|
3419
|
-
* half of that symmetry.
|
|
3420
|
-
*/
|
|
3421
|
-
readGlobalTablePage(options: {
|
|
3422
|
-
filters?: GlobalFilterClause[];
|
|
3423
|
-
limit?: number;
|
|
3424
|
-
offset?: number;
|
|
3425
|
-
table: string;
|
|
3426
|
-
}): Promise<GlobalTablePage>;
|
|
3427
|
-
/**
|
|
3428
|
-
* Summarise the distinct values of one column in a `.global()` table over the
|
|
3429
|
-
* active view (the same eq `filters` the browser is previewing) — the global
|
|
3430
|
-
* twin of the shard browser's facet. Hits the admin-gated
|
|
3431
|
-
* `GET /_lunora/admin/global/facet` endpoint; `column` is validated + bound
|
|
3432
|
-
* server-side. Powers the global data browser's facet sidebar.
|
|
3433
|
-
*
|
|
3434
|
-
* Wire-encoded/decoded on both legs for the same reason
|
|
3435
|
-
* {@link LunoraClient.readGlobalTablePage} is: a facet over a BLOB column
|
|
3436
|
-
* returns bytes, which `Response.json` flattens to `{}` — and since a facet
|
|
3437
|
-
* value is exactly what a click sends back as a `filters` clause, that is a
|
|
3438
|
-
* broken drill-down rather than a display glitch.
|
|
3439
|
-
*/
|
|
3440
|
-
facetGlobalColumn(options: {
|
|
3441
|
-
column: string;
|
|
3442
|
-
filters?: GlobalFilterClause[];
|
|
3443
|
-
limit?: number;
|
|
3444
|
-
table: string;
|
|
3445
|
-
}): Promise<GlobalFacetResult>;
|
|
3446
|
-
/**
|
|
3447
|
-
* List the schema's Vectorize indexes with their declared shape (table,
|
|
3448
|
-
* field, dimensions, metric, metadata) and live stats (vector count,
|
|
3449
|
-
* processing watermark) when the binding is reachable. Hits the admin-gated
|
|
3450
|
-
* `GET /_lunora/admin/vector/indexes` endpoint — the worker must be built
|
|
3451
|
-
* with a `vectorIntrospector` and `adminToken`. Powers the studio's vector
|
|
3452
|
-
* browser. Vectorize can't enumerate indexes at runtime, so this list comes
|
|
3453
|
-
* from the generated `LUNORA_VECTOR_INDEXES` registry.
|
|
3454
|
-
*/
|
|
3455
|
-
listVectorIndexes(): Promise<VectorIndexSummary[]>;
|
|
3456
|
-
/**
|
|
3457
|
-
* Run a nearest-neighbour similarity query against one vector index: the
|
|
3458
|
-
* worker embeds `text` via the index's embedder and returns the top matches.
|
|
3459
|
-
* Hits the admin-gated `POST /_lunora/admin/vector/query` endpoint. Throws
|
|
3460
|
-
* `VECTOR_QUERY_UNSUPPORTED` when the worker's introspector has no embedder
|
|
3461
|
-
* wired (the index lists read-only).
|
|
3462
|
-
*/
|
|
3463
|
-
queryVectorIndex(options: {
|
|
3464
|
-
name: string;
|
|
3465
|
-
text: string;
|
|
3466
|
-
topK?: number;
|
|
3467
|
-
}): Promise<VectorQueryMatch[]>;
|
|
3468
|
-
/**
|
|
3469
|
-
* Read one keyset-paginated page of the durable `ctx.log` archive that
|
|
3470
|
-
* `pipelineLogSink` writes to R2. Server-side only — the worker holds the R2
|
|
3471
|
-
* SQL credentials and runs the reader; the browser only sees the decoded
|
|
3472
|
-
* `{ rows, nextCursor }`. Pass the previous page's `nextCursor` as
|
|
3473
|
-
* `query.cursor` to page. Admin-gated. When the operator hasn't wired the
|
|
3474
|
-
* archive, `adminFetch` throws a `LunoraClientError` with `.code ===
|
|
3475
|
-
* "LOG_ARCHIVE_NOT_CONFIGURED"`, so a caller can render a "not configured"
|
|
3476
|
-
* state rather than an error.
|
|
3477
|
-
*/
|
|
3478
|
-
queryLogArchive(query?: PipelineLogQuery): Promise<PipelineLogPage>;
|
|
3479
|
-
/**
|
|
3480
|
-
* List the worker's registered Workers KV namespaces (binding names). Hits
|
|
3481
|
-
* the admin-gated `GET /_lunora/admin/kv/namespaces` endpoint — the worker
|
|
3482
|
-
* must be built with a `kvIntrospector` and `adminToken`. Powers the
|
|
3483
|
-
* studio's KV browser.
|
|
3484
|
-
*/
|
|
3485
|
-
listKvNamespaces(): Promise<KvNamespaceSummary[]>;
|
|
3486
|
-
/**
|
|
3487
|
-
* List keys in a KV namespace, optionally filtered by `prefix` and
|
|
3488
|
-
* paginated via `cursor`. Hits the admin-gated
|
|
3489
|
-
* `GET /_lunora/admin/kv/keys` endpoint.
|
|
3490
|
-
*/
|
|
3491
|
-
listKvKeys(options: {
|
|
3492
|
-
cursor?: string;
|
|
3493
|
-
limit?: number;
|
|
3494
|
-
namespace: string;
|
|
3495
|
-
prefix?: string;
|
|
3496
|
-
}): Promise<KvKeyListResult>;
|
|
3497
|
-
/**
|
|
3498
|
-
* Read a KV value (as text) and its metadata. Hits the admin-gated
|
|
3499
|
-
* `GET /_lunora/admin/kv/value` endpoint. Returns `{ value: null, metadata: null }`
|
|
3500
|
-
* when the key is absent.
|
|
3501
|
-
*/
|
|
3502
|
-
getKvValue(options: {
|
|
3503
|
-
key: string;
|
|
3504
|
-
namespace: string;
|
|
3505
|
-
}): Promise<KvValueResult>;
|
|
3506
|
-
/**
|
|
3507
|
-
* Write a string value to a KV namespace. Accepts an absolute `expiration`
|
|
3508
|
-
* (Unix seconds) or a relative `expirationTtl`, plus optional `metadata` —
|
|
3509
|
-
* re-send the loaded values on edit so a save preserves rather than clears
|
|
3510
|
-
* them. Hits the admin-gated `PUT /_lunora/admin/kv/value` endpoint.
|
|
3511
|
-
*/
|
|
3512
|
-
putKvValue(options: {
|
|
3513
|
-
expiration?: number;
|
|
3514
|
-
expirationTtl?: number;
|
|
3515
|
-
key: string;
|
|
3516
|
-
metadata?: unknown;
|
|
3517
|
-
namespace: string;
|
|
3518
|
-
value: string;
|
|
3519
|
-
}): Promise<void>;
|
|
3520
|
-
/**
|
|
3521
|
-
* Delete a key from a KV namespace. No-op when the key is absent. Hits the
|
|
3522
|
-
* admin-gated `DELETE /_lunora/admin/kv/value` endpoint.
|
|
3523
|
-
*/
|
|
3524
|
-
deleteKvKey(options: {
|
|
3525
|
-
key: string;
|
|
3526
|
-
namespace: string;
|
|
3527
|
-
}): Promise<void>;
|
|
3528
|
-
/**
|
|
3529
|
-
* List authenticated users, paged and optionally searched / filtered / sorted.
|
|
3530
|
-
* Hits the admin-gated `GET /_lunora/admin/auth/users` endpoint — the worker
|
|
3531
|
-
* must be built with an `authAdmin` and `adminToken`. Powers the studio's
|
|
3532
|
-
* users dashboard.
|
|
3533
|
-
*/
|
|
3534
|
-
listAuthUsers(options?: {
|
|
3535
|
-
filterField?: string;
|
|
3536
|
-
filterValue?: string;
|
|
3537
|
-
limit?: number;
|
|
3538
|
-
offset?: number;
|
|
3539
|
-
search?: string;
|
|
3540
|
-
searchField?: string;
|
|
3541
|
-
sortBy?: string;
|
|
3542
|
-
sortDirection?: "asc" | "desc";
|
|
3543
|
-
}): Promise<AuthPage<AuthUser>>;
|
|
3544
|
-
/**
|
|
3545
|
-
* Create a user. Hits the admin-gated `POST /_lunora/admin/auth/users/create`
|
|
3546
|
-
* endpoint (requires the worker's `authAdmin` to implement `createUser`).
|
|
3547
|
-
* `data` carries any app-defined `user.additionalFields`.
|
|
3548
|
-
*/
|
|
3549
|
-
createAuthUser(input: {
|
|
3550
|
-
data?: Record<string, unknown>;
|
|
3551
|
-
email: string;
|
|
3552
|
-
name: string;
|
|
3553
|
-
password?: string;
|
|
3554
|
-
role?: string | string[];
|
|
3555
|
-
}): Promise<AuthUser>;
|
|
3556
|
-
/** Set a user's role (string, or array joined comma-wise server-side). */
|
|
3557
|
-
setAuthUserRole(input: {
|
|
3558
|
-
role: string | string[];
|
|
3559
|
-
userId: string;
|
|
3560
|
-
}): Promise<AuthUser>;
|
|
3561
|
-
/** Ban a user. `expiresInSeconds` sets a temporary ban; omit it for a permanent one. Revokes the user's live sessions. */
|
|
3562
|
-
banAuthUser(input: {
|
|
3563
|
-
expiresInSeconds?: number;
|
|
3564
|
-
reason?: string;
|
|
3565
|
-
userId: string;
|
|
3566
|
-
}): Promise<AuthUser>;
|
|
3567
|
-
/** Lift a user's ban. */
|
|
3568
|
-
unbanAuthUser(input: {
|
|
3569
|
-
userId: string;
|
|
3570
|
-
}): Promise<AuthUser>;
|
|
3571
|
-
/** Set a user's password (admin override — no current-password challenge). */
|
|
3572
|
-
setAuthUserPassword(input: {
|
|
3573
|
-
newPassword: string;
|
|
3574
|
-
userId: string;
|
|
3575
|
-
}): Promise<void>;
|
|
3576
|
-
/** Permanently delete a user and revoke their sessions. */
|
|
3577
|
-
removeAuthUser(input: {
|
|
3578
|
-
userId: string;
|
|
3579
|
-
}): Promise<void>;
|
|
3580
|
-
/**
|
|
3581
|
-
* Mint an impersonation session for a user, returning its bearer `token`.
|
|
3582
|
-
* The caller is responsible for using the token (e.g. setting the session
|
|
3583
|
-
* cookie); the server performs no cookie round-trip.
|
|
3584
|
-
*/
|
|
3585
|
-
impersonateAuthUser(input: {
|
|
3586
|
-
userId: string;
|
|
3587
|
-
}): Promise<AuthImpersonation>;
|
|
3588
|
-
/** Revoke a single session by its id (force sign-out of one device). */
|
|
3589
|
-
revokeAuthSession(input: {
|
|
3590
|
-
sessionId: string;
|
|
3591
|
-
}): Promise<void>;
|
|
3592
|
-
/** Revoke every session for a user (force sign-out everywhere). */
|
|
3593
|
-
revokeAuthUserSessions(input: {
|
|
3594
|
-
userId: string;
|
|
3595
|
-
}): Promise<void>;
|
|
3596
|
-
/**
|
|
3597
|
-
* Report which auth dashboard surfaces are available — derived server-side
|
|
3598
|
-
* from the enabled better-auth plugins. The studio renders only the panels
|
|
3599
|
-
* whose capability is `true`.
|
|
3600
|
-
*/
|
|
3601
|
-
getAuthCapabilities(): Promise<AuthCapabilities>;
|
|
3602
|
-
/** Update a user's fields (name/email/app-defined `additionalFields`). */
|
|
3603
|
-
updateAuthUser(input: {
|
|
3604
|
-
data: Record<string, unknown>;
|
|
3605
|
-
userId: string;
|
|
3606
|
-
}): Promise<AuthUser>;
|
|
3607
|
-
/** List a user's linked accounts (credential / OAuth providers). Token material is stripped server-side. */
|
|
3608
|
-
listAuthAccounts(input: {
|
|
3609
|
-
userId: string;
|
|
3610
|
-
}): Promise<Record<string, unknown>[]>;
|
|
3611
|
-
/** Unlink a linked account from a user. */
|
|
3612
|
-
unlinkAuthAccount(input: {
|
|
3613
|
-
accountId: string;
|
|
3614
|
-
userId: string;
|
|
3615
|
-
}): Promise<void>;
|
|
3616
|
-
/** List a user's registered passkeys (requires the passkey plugin). */
|
|
3617
|
-
listAuthPasskeys(input: {
|
|
3618
|
-
userId: string;
|
|
3619
|
-
}): Promise<Record<string, unknown>[]>;
|
|
3620
|
-
/** Delete a passkey by id (requires the passkey plugin). */
|
|
3621
|
-
deleteAuthPasskey(input: {
|
|
3622
|
-
passkeyId: string;
|
|
3623
|
-
}): Promise<void>;
|
|
3624
|
-
/** Disable two-factor auth for a user (requires the two-factor plugin). */
|
|
3625
|
-
disableAuthTwoFactor(input: {
|
|
3626
|
-
userId: string;
|
|
3627
|
-
}): Promise<void>;
|
|
3628
|
-
/** List organizations, paged (requires the organization plugin). */
|
|
3629
|
-
listAuthOrganizations(options?: {
|
|
3630
|
-
limit?: number;
|
|
3631
|
-
offset?: number;
|
|
3632
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3633
|
-
/** List the members of an organization (requires the organization plugin). */
|
|
3634
|
-
listAuthOrgMembers(input: {
|
|
3635
|
-
limit?: number;
|
|
3636
|
-
offset?: number;
|
|
3637
|
-
organizationId: string;
|
|
3638
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3639
|
-
/** List an organization's pending invitations (requires the organization plugin). */
|
|
3640
|
-
listAuthOrgInvitations(input: {
|
|
3641
|
-
limit?: number;
|
|
3642
|
-
offset?: number;
|
|
3643
|
-
organizationId: string;
|
|
3644
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3645
|
-
/**
|
|
3646
|
-
* List sign-up invitations, newest first (requires the `inviteOnly` plugin).
|
|
3647
|
-
* Unfiltered: a row is pending when `acceptedAt` is null and `expiresAt` is in
|
|
3648
|
-
* the future, and the caller labels it — filtering server-side after the page
|
|
3649
|
-
* would let page 1 come back empty while pending rows sat on page 2.
|
|
3650
|
-
*/
|
|
3651
|
-
listAuthSignUpInvitations(options?: {
|
|
3652
|
-
limit?: number;
|
|
3653
|
-
offset?: number;
|
|
3654
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3655
|
-
/** Invite an address to sign up, or refresh an existing invitation for it. */
|
|
3656
|
-
createAuthSignUpInvitation(input: {
|
|
3657
|
-
email: string;
|
|
3658
|
-
expiresInSeconds?: number;
|
|
3659
|
-
invitedBy?: string;
|
|
3660
|
-
}): Promise<Record<string, unknown>>;
|
|
3661
|
-
/** Withdraw a sign-up invitation. Not retroactive — an account already created keeps existing. */
|
|
3662
|
-
revokeAuthSignUpInvitation(input: {
|
|
3663
|
-
email: string;
|
|
3664
|
-
}): Promise<void>;
|
|
3665
|
-
/** Remove a member from an organization. */
|
|
3666
|
-
removeAuthOrgMember(input: {
|
|
3667
|
-
memberId: string;
|
|
3668
|
-
}): Promise<void>;
|
|
3669
|
-
/** Cancel a pending organization invitation. */
|
|
3670
|
-
cancelAuthOrgInvitation(input: {
|
|
3671
|
-
invitationId: string;
|
|
3672
|
-
}): Promise<void>;
|
|
3673
|
-
/**
|
|
3674
|
-
* Report the deployment's auth configuration — enabled plugins, sign-in
|
|
3675
|
-
* methods, user-settable create-user fields, organization sub-features
|
|
3676
|
-
* (teams / roles), and session / rate-limit policy. Drives the config panel
|
|
3677
|
-
* and the dynamic create-user form. Never carries a secret.
|
|
3678
|
-
*/
|
|
3679
|
-
getAuthConfig(): Promise<AuthConfigInfo>;
|
|
3680
|
-
/** Create an organization; optionally seed an `owner` member for `ownerId`. */
|
|
3681
|
-
createAuthOrganization(input: {
|
|
3682
|
-
logo?: string;
|
|
3683
|
-
metadata?: Record<string, unknown>;
|
|
3684
|
-
name: string;
|
|
3685
|
-
ownerId?: string;
|
|
3686
|
-
slug?: string;
|
|
3687
|
-
}): Promise<Record<string, unknown>>;
|
|
3688
|
-
/** Update an organization's name/slug/logo/metadata. */
|
|
3689
|
-
updateAuthOrganization(input: {
|
|
3690
|
-
logo?: string;
|
|
3691
|
-
metadata?: Record<string, unknown>;
|
|
3692
|
-
name?: string;
|
|
3693
|
-
organizationId: string;
|
|
3694
|
-
slug?: string;
|
|
3695
|
-
}): Promise<Record<string, unknown>>;
|
|
3696
|
-
/** Delete an organization and cascade its members, invitations, teams, and custom roles. */
|
|
3697
|
-
deleteAuthOrganization(input: {
|
|
3698
|
-
organizationId: string;
|
|
3699
|
-
}): Promise<void>;
|
|
3700
|
-
/** Directly add an existing user to an organization (no invitation/acceptance). */
|
|
3701
|
-
addAuthOrgMember(input: {
|
|
3702
|
-
organizationId: string;
|
|
3703
|
-
role?: string;
|
|
3704
|
-
userId: string;
|
|
3705
|
-
}): Promise<Record<string, unknown>>;
|
|
3706
|
-
/** Create a pending email invitation to an organization. */
|
|
3707
|
-
inviteAuthOrgMember(input: {
|
|
3708
|
-
email: string;
|
|
3709
|
-
inviterId?: string;
|
|
3710
|
-
organizationId: string;
|
|
3711
|
-
role?: string;
|
|
3712
|
-
}): Promise<Record<string, unknown>>;
|
|
3713
|
-
/** Change a member's role. */
|
|
3714
|
-
setAuthOrgMemberRole(input: {
|
|
3715
|
-
memberId: string;
|
|
3716
|
-
role: string | string[];
|
|
3717
|
-
}): Promise<Record<string, unknown>>;
|
|
3718
|
-
/** List an organization's teams (requires the organization plugin with teams enabled). */
|
|
3719
|
-
listAuthOrgTeams(input: {
|
|
3720
|
-
limit?: number;
|
|
3721
|
-
offset?: number;
|
|
3722
|
-
organizationId: string;
|
|
3723
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3724
|
-
/** Create a team under an organization. */
|
|
3725
|
-
createAuthOrgTeam(input: {
|
|
3726
|
-
name: string;
|
|
3727
|
-
organizationId: string;
|
|
3728
|
-
}): Promise<Record<string, unknown>>;
|
|
3729
|
-
/** Rename a team. */
|
|
3730
|
-
updateAuthOrgTeam(input: {
|
|
3731
|
-
name: string;
|
|
3732
|
-
teamId: string;
|
|
3733
|
-
}): Promise<Record<string, unknown>>;
|
|
3734
|
-
/** Delete a team and its memberships. */
|
|
3735
|
-
removeAuthOrgTeam(input: {
|
|
3736
|
-
teamId: string;
|
|
3737
|
-
}): Promise<void>;
|
|
3738
|
-
/** List a team's members. */
|
|
3739
|
-
listAuthOrgTeamMembers(input: {
|
|
3740
|
-
limit?: number;
|
|
3741
|
-
offset?: number;
|
|
3742
|
-
teamId: string;
|
|
3743
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3744
|
-
/** Add a user to a team. */
|
|
3745
|
-
addAuthOrgTeamMember(input: {
|
|
3746
|
-
teamId: string;
|
|
3747
|
-
userId: string;
|
|
3748
|
-
}): Promise<Record<string, unknown>>;
|
|
3749
|
-
/** Remove a member from a team. */
|
|
3750
|
-
removeAuthOrgTeamMember(input: {
|
|
3751
|
-
teamMemberId: string;
|
|
3752
|
-
}): Promise<void>;
|
|
3753
|
-
/** List an organization's custom roles (requires the organization plugin with dynamic access control). */
|
|
3754
|
-
listAuthOrgRoles(input: {
|
|
3755
|
-
limit?: number;
|
|
3756
|
-
offset?: number;
|
|
3757
|
-
organizationId: string;
|
|
3758
|
-
}): Promise<AuthPage<Record<string, unknown>>>;
|
|
3759
|
-
/** Create a custom org role with a permission grant (a `resource -> actions[]` map). */
|
|
3760
|
-
createAuthOrgRole(input: {
|
|
3761
|
-
organizationId: string;
|
|
3762
|
-
permission: Record<string, string[]>;
|
|
3763
|
-
role: string;
|
|
3764
|
-
}): Promise<Record<string, unknown>>;
|
|
3765
|
-
/** Replace a custom org role's permission grant. */
|
|
3766
|
-
updateAuthOrgRole(input: {
|
|
3767
|
-
permission: Record<string, string[]>;
|
|
3768
|
-
roleId: string;
|
|
3769
|
-
}): Promise<Record<string, unknown>>;
|
|
3770
|
-
/** Delete a custom org role. */
|
|
3771
|
-
deleteAuthOrgRole(input: {
|
|
3772
|
-
roleId: string;
|
|
3773
|
-
}): Promise<void>;
|
|
3774
|
-
/** List auth sessions, paged and optionally filtered to one user. */
|
|
3775
|
-
listAuthSessions(options?: {
|
|
3776
|
-
limit?: number;
|
|
3777
|
-
offset?: number;
|
|
3778
|
-
userId?: string;
|
|
3779
|
-
}): Promise<AuthPage<AuthSession>>;
|
|
3780
3196
|
/**
|
|
3781
3197
|
* Subscribe to a live query. The callback fires with the current value (from
|
|
3782
3198
|
* the durable read cache, when one is hydrated) and again on every server
|