@lunora/client 1.0.0-alpha.28 → 1.0.0-alpha.280

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