@layers/amba 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,671 @@
1
+ import type { ApiResponse, ApiListResponse } from './_internal/shared.js';
2
+ export declare class ApiClientError extends Error {
3
+ readonly statusCode: number;
4
+ readonly errorCode?: string | undefined;
5
+ constructor(message: string, statusCode: number, errorCode?: string | undefined);
6
+ }
7
+ /**
8
+ * Generic typed GET against the admin API. Wraps `request` so callers
9
+ * outside this module (e.g. the codegen-engine adapter in
10
+ * `commands/types.ts`) don't need to reach into the private helper.
11
+ *
12
+ * Path is relative to `/admin` — leading slash required (`/projects/X`).
13
+ */
14
+ export declare function adminGet<T>(path: string): Promise<{
15
+ data: T;
16
+ }>;
17
+ export interface ProjectSummary {
18
+ id: string;
19
+ name: string;
20
+ platform: string;
21
+ environment?: string;
22
+ bundle_id?: string | null;
23
+ status?: string;
24
+ created_at?: string;
25
+ }
26
+ export declare function listProjects(): Promise<ApiListResponse<ProjectSummary>>;
27
+ export declare function createProject(input: {
28
+ name: string;
29
+ bundle_id?: string;
30
+ platform?: string;
31
+ /**
32
+ * Project environment. `'development'` flags the row as the developer's
33
+ * personal dev project — used by `amba init` for the dev-project
34
+ * bootstrap. Defaults to `'production'` when omitted.
35
+ */
36
+ environment?: 'development' | 'production';
37
+ }): Promise<ApiResponse<{
38
+ id: string;
39
+ name: string;
40
+ platform: string;
41
+ environment?: string;
42
+ }>>;
43
+ export declare function getProject(projectId: string): Promise<ApiResponse<{
44
+ id: string;
45
+ name: string;
46
+ platform: string;
47
+ environment: string;
48
+ bundle_id: string | null;
49
+ created_at: string;
50
+ }>>;
51
+ export declare function deleteProject(projectId: string): Promise<ApiResponse<{
52
+ id: string;
53
+ deleted: boolean;
54
+ }>>;
55
+ export declare function reprovisionProject(projectId: string): Promise<ApiResponse<{
56
+ workflowId?: string;
57
+ status?: string;
58
+ message?: string;
59
+ }>>;
60
+ export declare function getProvisioningStatus(projectId: string): Promise<ApiResponse<{
61
+ projectId: string;
62
+ status: string;
63
+ workflowId?: string | null;
64
+ errorMessage?: string | null;
65
+ }>>;
66
+ export declare function createApiKey(projectId: string, keyType: 'client' | 'server', environment: 'development' | 'production'): Promise<ApiResponse<{
67
+ id: string;
68
+ key: string;
69
+ key_prefix: string;
70
+ key_type: string;
71
+ environment: string;
72
+ }>>;
73
+ export declare function sendTestPush(projectId: string, input: {
74
+ title: string;
75
+ body: string;
76
+ data?: Record<string, unknown>;
77
+ }): Promise<ApiResponse<{
78
+ sent: number;
79
+ message: string;
80
+ }>>;
81
+ export declare function listConfig(projectId: string): Promise<ApiListResponse<{
82
+ key: string;
83
+ value: unknown;
84
+ value_type: string;
85
+ description: string | null;
86
+ }>>;
87
+ export declare function setConfig(projectId: string, input: {
88
+ key: string;
89
+ value: unknown;
90
+ value_type?: string;
91
+ description?: string;
92
+ }): Promise<ApiResponse<{
93
+ key: string;
94
+ value: unknown;
95
+ value_type: string;
96
+ }>>;
97
+ export interface IntegrationSummary {
98
+ provider: string;
99
+ status?: string;
100
+ enabled?: boolean;
101
+ last_verified_at?: string | null;
102
+ [key: string]: unknown;
103
+ }
104
+ export declare function listIntegrations(projectId: string): Promise<ApiListResponse<IntegrationSummary>>;
105
+ export interface AdminUserSummary {
106
+ id: string;
107
+ email?: string | null;
108
+ is_anonymous?: boolean;
109
+ created_at?: string;
110
+ [key: string]: unknown;
111
+ }
112
+ export declare function listUsers(projectId: string, query?: {
113
+ limit?: number;
114
+ }): Promise<ApiListResponse<AdminUserSummary>>;
115
+ export declare function getUserEvents(projectId: string, userId: string, query?: {
116
+ limit?: number;
117
+ since?: string;
118
+ cursor?: string;
119
+ }): Promise<ApiListResponse<{
120
+ id?: string;
121
+ event_name: string;
122
+ user_id: string;
123
+ properties?: Record<string, unknown>;
124
+ created_at: string;
125
+ }>>;
126
+ export interface AdminEventRow {
127
+ id: string;
128
+ app_user_id: string;
129
+ event_name: string;
130
+ properties: Record<string, unknown>;
131
+ occurred_at: string;
132
+ }
133
+ export interface AdminEventsPage {
134
+ data: AdminEventRow[];
135
+ next_cursor: string | null;
136
+ }
137
+ /**
138
+ * Fetch a page of project-wide engagement events. Most-recent-first; when
139
+ * `next_cursor` is non-null the caller should pass it back as `cursor` to
140
+ * continue paging.
141
+ */
142
+ export declare function listProjectEvents(projectId: string, query?: {
143
+ since?: string;
144
+ until?: string;
145
+ eventName?: string;
146
+ userId?: string;
147
+ limit?: number;
148
+ cursor?: string;
149
+ }): Promise<AdminEventsPage>;
150
+ export interface EventsCountBucket {
151
+ key: string;
152
+ count: number;
153
+ }
154
+ export interface EventsCountResponse {
155
+ data: {
156
+ total: number;
157
+ buckets?: EventsCountBucket[];
158
+ };
159
+ }
160
+ /**
161
+ * Aggregate event counts in a time range. `groupBy` of `event_name` returns
162
+ * the per-event-name bucket list ordered by count desc.
163
+ */
164
+ export declare function getEventsCount(projectId: string, query: {
165
+ since: string;
166
+ until?: string;
167
+ eventName?: string;
168
+ groupBy?: 'day' | 'event_name';
169
+ }): Promise<EventsCountResponse>;
170
+ /**
171
+ * Stream `/users/export` as line-delimited text. Yields chunks as the
172
+ * server emits them. The endpoint always emits CSV (or NDJSON) so we don't
173
+ * try to parse — callers either tee to disk or split lines themselves.
174
+ */
175
+ export declare function streamUsersExport(projectId: string, query?: {
176
+ format?: 'csv' | 'ndjson';
177
+ since?: string;
178
+ }): Promise<Response>;
179
+ export declare function listSegments(projectId: string): Promise<ApiListResponse<{
180
+ id: string;
181
+ name: string;
182
+ is_active?: boolean;
183
+ }>>;
184
+ export declare function createSegment(projectId: string, input: {
185
+ name: string;
186
+ description?: string;
187
+ rules?: unknown;
188
+ is_active?: boolean;
189
+ }): Promise<ApiResponse<{
190
+ id: string;
191
+ name: string;
192
+ }>>;
193
+ export declare function listAchievements(projectId: string): Promise<ApiListResponse<{
194
+ id: string;
195
+ name: string;
196
+ }>>;
197
+ export declare function createAchievement(projectId: string, input: {
198
+ code: string;
199
+ name: string;
200
+ description?: string;
201
+ criteria?: unknown;
202
+ reward?: unknown;
203
+ }): Promise<ApiResponse<{
204
+ id: string;
205
+ name: string;
206
+ }>>;
207
+ export declare function listContentLibraries(projectId: string): Promise<ApiListResponse<{
208
+ id: string;
209
+ slug: string;
210
+ name: string;
211
+ }>>;
212
+ export declare function createContentLibrary(projectId: string, input: {
213
+ slug: string;
214
+ name: string;
215
+ description?: string;
216
+ }): Promise<ApiResponse<{
217
+ id: string;
218
+ slug: string;
219
+ }>>;
220
+ export declare function addContentItems(projectId: string, libraryId: string, input: {
221
+ items: Array<{
222
+ key: string;
223
+ content: unknown;
224
+ locale?: string;
225
+ }>;
226
+ }): Promise<ApiResponse<{
227
+ added: number;
228
+ }>>;
229
+ export declare function listXpRules(projectId: string): Promise<ApiListResponse<{
230
+ id: string;
231
+ event_name: string;
232
+ amount: number;
233
+ }>>;
234
+ export declare function createXpRule(projectId: string, input: {
235
+ event_name: string;
236
+ amount: number;
237
+ description?: string;
238
+ }): Promise<ApiResponse<{
239
+ id: string;
240
+ event_name: string;
241
+ amount: number;
242
+ }>>;
243
+ export interface FunctionDeploymentRow {
244
+ id: string;
245
+ project_id: string;
246
+ name: string;
247
+ version: number;
248
+ cf_script_name: string;
249
+ cf_dispatch_namespace: string;
250
+ bundle_sha: string;
251
+ status: 'active' | 'superseded' | 'disabled';
252
+ created_at: string;
253
+ }
254
+ export declare function recordFunctionDeployment(projectId: string, input: {
255
+ name: string;
256
+ cf_script_name: string;
257
+ cf_dispatch_namespace: string;
258
+ bundle_sha: string;
259
+ /**
260
+ * Optional declarative rate-limit. The CLI passes a validated
261
+ * `RateLimitConfig` here; the server persists it on the deployment
262
+ * row. Omitting (or sending `null`) = no rate limit.
263
+ */
264
+ rate_limit?: {
265
+ window: string;
266
+ max: number;
267
+ key: 'user_id' | 'ip';
268
+ } | null;
269
+ }): Promise<ApiResponse<FunctionDeploymentRow>>;
270
+ export interface DeployFunctionResult {
271
+ data: FunctionDeploymentRow;
272
+ /** `https://<project_slug>.fn.amba.host/<name>` — the live invocation URL. */
273
+ fn_url: string;
274
+ }
275
+ export declare function deployFunctionViaApi(projectId: string, input: {
276
+ /** Function name (matches `/^[a-z][a-z0-9_-]*$/`). */
277
+ name: string;
278
+ /** Bundled JS — single-file ESM entry. Server-enforced 10 MB cap. */
279
+ bundleCode: string;
280
+ /** Optional rate-limit. Validated server-side too. */
281
+ rate_limit?: {
282
+ window: string;
283
+ max: number;
284
+ key: 'user_id' | 'ip';
285
+ } | null;
286
+ }): Promise<DeployFunctionResult>;
287
+ export declare function listFunctionDeployments(projectId: string, options?: {
288
+ activeOnly?: boolean;
289
+ }): Promise<ApiListResponse<FunctionDeploymentRow>>;
290
+ export interface FunctionDeployContext {
291
+ /** Dispatch namespace for the script PUT (e.g. `amba_tenant_functions`). */
292
+ dispatch_namespace: string;
293
+ /** Project slug for `https://{slug}.fn.amba.host/{name}` URL rendering. */
294
+ project_slug: string;
295
+ /**
296
+ * R2 bucket name for the project — shared default OR dedicated tier
297
+ * NULL when storage isn't yet provisioned for the project; deploy
298
+ * step skips the storage binding in that case.
299
+ */
300
+ r2_bucket_name: string | null;
301
+ /**
302
+ * Cloudflare Hyperdrive config id. NULL until storage provisioning
303
+ * completes; deploy step skips the Hyperdrive binding when null and
304
+ * `ctx.collections` returns `tenant_unavailable` until the column is
305
+ * populated.
306
+ */
307
+ cf_hyperdrive_config_id: string | null;
308
+ }
309
+ export declare function getFunctionDispatchNamespace(projectId: string): Promise<ApiResponse<FunctionDeployContext>>;
310
+ export interface InternalCredentialsResponse {
311
+ internal_token: string;
312
+ header_signing_secret: string;
313
+ /** First 4 chars of the random portion — for log correlation, not auth. */
314
+ internal_token_fingerprint: string;
315
+ /** Same shape as above — for log correlation. */
316
+ header_signing_secret_fingerprint: string;
317
+ }
318
+ export declare function fetchInternalCredentials(projectId: string): Promise<ApiResponse<InternalCredentialsResponse>>;
319
+ export declare function disableFunctionDeployment(projectId: string, deploymentId: string): Promise<ApiResponse<{
320
+ id: string;
321
+ status: string;
322
+ }>>;
323
+ export declare function scheduleFunction(projectId: string, input: {
324
+ name: string;
325
+ cron: string;
326
+ timezone?: string;
327
+ }): Promise<ApiResponse<{
328
+ schedule_id: string;
329
+ }>>;
330
+ export interface FunctionLogEvent {
331
+ /** Logpush row — see `r2-log-reader.ts:LogpushTraceEvent`. Field-shape stable. */
332
+ Event?: {
333
+ Timestamp?: string;
334
+ };
335
+ ScriptName?: string;
336
+ Outcome?: string;
337
+ Logs?: Array<{
338
+ Level?: string;
339
+ Message?: unknown[];
340
+ TimestampMs?: number;
341
+ }>;
342
+ Exceptions?: Array<{
343
+ Name?: string;
344
+ Message?: string;
345
+ TimestampMs?: number;
346
+ }>;
347
+ EventTimestampMs?: number;
348
+ }
349
+ export interface FunctionLogsResponse {
350
+ events: FunctionLogEvent[];
351
+ truncated: boolean;
352
+ since: string;
353
+ until: string;
354
+ }
355
+ export declare function getFunctionLogs(projectId: string, functionName: string, options?: {
356
+ since?: string;
357
+ until?: string;
358
+ limit?: number;
359
+ }): Promise<ApiResponse<FunctionLogsResponse>>;
360
+ export interface QueueBinding {
361
+ queue_name: string;
362
+ function_name: string;
363
+ status: 'active' | 'paused';
364
+ created_at: string;
365
+ updated_at: string;
366
+ }
367
+ export declare function upsertQueueBinding(projectId: string, input: {
368
+ queue_name: string;
369
+ function_name: string;
370
+ status?: 'active' | 'paused';
371
+ }): Promise<ApiResponse<QueueBinding & {
372
+ id: string;
373
+ }>>;
374
+ export declare function listQueueBindings(projectId: string): Promise<ApiListResponse<QueueBinding>>;
375
+ export declare function deleteQueueBinding(projectId: string, queueName: string): Promise<ApiResponse<{
376
+ queue_name: string;
377
+ deleted: boolean;
378
+ }>>;
379
+ export interface SecretSyncPendingRow {
380
+ id: string;
381
+ project_id: string;
382
+ function_name: string | null;
383
+ secret_name: string;
384
+ expected_version: number;
385
+ status: 'pending' | 'syncing' | 'sync_failed_retrying' | 'synced';
386
+ last_error: string | null;
387
+ attempts: number;
388
+ created_at: string;
389
+ updated_at: string;
390
+ }
391
+ export declare function registerSecretSync(projectId: string, input: {
392
+ function_name: string;
393
+ secret_name: string;
394
+ expected_version: number;
395
+ }): Promise<ApiResponse<SecretSyncPendingRow>>;
396
+ export declare function listSecretSyncStatus(projectId: string): Promise<ApiListResponse<SecretSyncPendingRow>>;
397
+ export interface SetSecretResultRow {
398
+ /** Secret name as set by the customer. */
399
+ name: string;
400
+ /** Function name the secret binds to. */
401
+ function: string;
402
+ /** Secret store version number (1, 2, 3, ...). */
403
+ version: number;
404
+ /** Backend version resource path — exposed for ops debugging. */
405
+ version_path: string;
406
+ /** `'pending'` until the secret sync completes. */
407
+ sync_status: 'pending' | 'syncing' | 'sync_failed_retrying' | 'synced';
408
+ created_at: string;
409
+ }
410
+ export declare function setSecretViaApi(projectId: string, input: {
411
+ /** Uppercase identifier (`/^[A-Z][A-Z0-9_]{0,62}$/`). */
412
+ name: string;
413
+ /** Plaintext secret value. <=64KiB. */
414
+ value: string;
415
+ /** Function name the secret binds to. v1 has no project-wide secrets. */
416
+ function: string;
417
+ }): Promise<ApiResponse<SetSecretResultRow>>;
418
+ export interface ListSecretsRow {
419
+ /** Function name the secret binds to. */
420
+ function: string;
421
+ /** Secret name. */
422
+ name: string;
423
+ /** Latest secret-store version number. */
424
+ version: number;
425
+ sync_status: 'pending' | 'syncing' | 'sync_failed_retrying' | 'synced';
426
+ attempts: number;
427
+ last_error: string | null;
428
+ updated_at: string;
429
+ }
430
+ export declare function listSecretsViaApi(projectId: string): Promise<ApiListResponse<ListSecretsRow>>;
431
+ export declare function deleteSecretViaApi(projectId: string, name: string, options: {
432
+ function: string;
433
+ }): Promise<ApiResponse<{
434
+ name: string;
435
+ function: string;
436
+ deleted: true;
437
+ }>>;
438
+ /** Closed set of column types the server accepts. */
439
+ export type CollectionColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamptz' | 'date' | 'jsonb' | 'vector';
440
+ export interface CollectionColumn {
441
+ name: string;
442
+ type: CollectionColumnType;
443
+ nullable?: boolean;
444
+ references?: {
445
+ table: string;
446
+ column?: string;
447
+ onDelete?: 'CASCADE' | 'RESTRICT' | 'SET NULL' | 'NO ACTION';
448
+ };
449
+ /**
450
+ * Required when `type === 'vector'`. The pgvector dimension
451
+ * (`vector(N)`). Common values: 384, 768, 1536, 3072.
452
+ */
453
+ dimension?: number;
454
+ }
455
+ export interface CollectionIndex {
456
+ /** Optional explicit name; auto-derived from column list if omitted. */
457
+ name?: string;
458
+ /** Each entry is `<col>` or `<col> asc|desc`. Direction is parsed by the DDL emit. */
459
+ columns: string[];
460
+ unique?: boolean;
461
+ }
462
+ export interface CollectionDefinition {
463
+ name: string;
464
+ columns: CollectionColumn[];
465
+ indexes?: CollectionIndex[];
466
+ }
467
+ /** Create-collection response from `POST /admin/projects/:p/collections`. */
468
+ export interface CreateCollectionResult {
469
+ name: string;
470
+ version: number;
471
+ workflow_id: string;
472
+ run_id: string;
473
+ status: 'applied';
474
+ }
475
+ export declare function createCollection(projectId: string, input: CollectionDefinition): Promise<ApiResponse<CreateCollectionResult>>;
476
+ export interface CollectionListItem {
477
+ name: string;
478
+ created_at: string;
479
+ }
480
+ export declare function listCollections(projectId: string, options?: {
481
+ limit?: number;
482
+ offset?: number;
483
+ }): Promise<ApiListResponse<CollectionListItem>>;
484
+ export interface CollectionDescribeResult {
485
+ name: string;
486
+ columns: CollectionColumn[];
487
+ indexes: CollectionIndex[];
488
+ latest_migration: {
489
+ version: number;
490
+ applied_at: string;
491
+ } | null;
492
+ }
493
+ export declare function describeCollection(projectId: string, name: string): Promise<ApiResponse<CollectionDescribeResult>>;
494
+ /**
495
+ * Single-op PATCH per data's contract — one of `add_column`, `add_index`,
496
+ * or `drop_column` per call. The saga writes one registry row per intent
497
+ * so the operator audit trail stays one-to-one with developer actions.
498
+ *
499
+ * `drop_column` requires a `?confirm=<column-name>` query param to guard
500
+ * against typos — same accident-protection pattern as `dropCollection`.
501
+ */
502
+ export type AlterCollectionPatch = {
503
+ add_column: CollectionColumn;
504
+ } | {
505
+ add_index: CollectionIndex;
506
+ } | {
507
+ drop_column: string;
508
+ };
509
+ export interface AlterCollectionResult {
510
+ name: string;
511
+ version: number;
512
+ workflow_id: string;
513
+ run_id: string;
514
+ status: 'applied';
515
+ }
516
+ export declare function alterCollection(projectId: string, name: string, patch: AlterCollectionPatch, options?: {
517
+ confirm?: string;
518
+ }): Promise<ApiResponse<AlterCollectionResult>>;
519
+ /**
520
+ * Drop a collection. Requires `confirm` matching the collection name —
521
+ * data's safety guard against typos. CLI surfaces this as `--confirm <name>`.
522
+ */
523
+ export declare function dropCollection(projectId: string, name: string, confirm: string): Promise<ApiResponse<{
524
+ name: string;
525
+ deleted: boolean;
526
+ version: number;
527
+ }>>;
528
+ export type AiProviderName = 'anthropic' | 'openai';
529
+ export interface AiProviderRow {
530
+ name: AiProviderName;
531
+ /** Canonical secret name in the secret store. NULL only mid-rotation. */
532
+ api_key_secret_name: string | null;
533
+ /** Preview cue printed to the CLI on register; NOT a real partial key. */
534
+ api_key_preview?: string;
535
+ created_at?: string;
536
+ updated_at?: string;
537
+ }
538
+ export declare function registerAiProvider(projectId: string, input: {
539
+ name: AiProviderName;
540
+ api_key: string;
541
+ }): Promise<ApiResponse<AiProviderRow>>;
542
+ export declare function listAiProviders(projectId: string): Promise<ApiListResponse<AiProviderRow>>;
543
+ export declare function deleteAiProvider(projectId: string, name: AiProviderName): Promise<ApiResponse<{
544
+ name: AiProviderName;
545
+ deleted: true;
546
+ }>>;
547
+ export interface SiteRow {
548
+ id: string;
549
+ project_id: string;
550
+ name: string;
551
+ cf_pages_project_name: string;
552
+ status: 'active' | 'disabled' | 'archived';
553
+ created_at: string;
554
+ updated_at: string;
555
+ }
556
+ export interface SiteDomainRow {
557
+ id: string;
558
+ site_id: string;
559
+ hostname: string;
560
+ cf_hostname_id: string | null;
561
+ cert_status: 'pending_validation' | 'pending_issuance' | 'pending_deployment' | 'active' | 'error';
562
+ created_at: string;
563
+ updated_at: string;
564
+ }
565
+ export declare function createSite(projectId: string, input: {
566
+ name: string;
567
+ }): Promise<ApiResponse<SiteRow>>;
568
+ export declare function listSites(projectId: string): Promise<ApiListResponse<SiteRow>>;
569
+ export declare function describeSite(projectId: string, name: string): Promise<ApiResponse<SiteRow & {
570
+ domains: SiteDomainRow[];
571
+ }>>;
572
+ export interface DeploySiteResult {
573
+ /** Deployment uuid. */
574
+ deployment_id: string;
575
+ site_name: string;
576
+ branch: string;
577
+ /** Customer-facing canonical URL (`https://{slug}-{site}.app.amba.host`). */
578
+ url: string;
579
+ /** Underlying CDN preview URL — exposed for ops. */
580
+ preview_url: string;
581
+ deployed_at: string;
582
+ status: 'queued' | 'building' | 'success' | 'failure';
583
+ }
584
+ export declare function deploySiteViaApi(projectId: string, siteName: string, body: FormData): Promise<ApiResponse<DeploySiteResult>>;
585
+ export declare function updateSite(projectId: string, name: string, patch: {
586
+ status: 'active' | 'disabled';
587
+ }): Promise<ApiResponse<SiteRow>>;
588
+ export declare function archiveSite(projectId: string, name: string, confirm: string): Promise<ApiResponse<SiteRow>>;
589
+ /** Cascade summary returned by site/function delete proxies. */
590
+ export interface DeleteCascadeSummary {
591
+ domains_removed?: number;
592
+ cf_pages_project_deleted?: boolean;
593
+ cf_dispatch_script_deleted?: boolean;
594
+ function_deployments_marked_disabled?: number;
595
+ }
596
+ /**
597
+ * Add a custom domain to a site. The server-side proxy registers the
598
+ * custom hostname, persists the resulting `cf_hostname_id`, and returns
599
+ * the CNAME target the customer should point their DNS at.
600
+ */
601
+ export declare function addSiteDomainViaApi(projectId: string, siteName: string, hostname: string): Promise<ApiResponse<{
602
+ hostname: string;
603
+ cf_hostname_id: string;
604
+ cert_status: SiteDomainRow["cert_status"];
605
+ dns_target: string;
606
+ created_at: string;
607
+ }>>;
608
+ /**
609
+ * Remove a custom domain from a site. Idempotent — re-running on an
610
+ * already-removed hostname returns 200 with `deleted: true`. Backend
611
+ * 404s are treated as success at the proxy layer.
612
+ */
613
+ export declare function removeSiteDomainViaApi(projectId: string, siteName: string, hostname: string): Promise<ApiResponse<{
614
+ hostname: string;
615
+ deleted: true;
616
+ }>>;
617
+ /**
618
+ * Roll a live CF Pages deployment back to a prior `deployment_id`. CF's
619
+ * rollback creates a NEW deployment that serves the prior bundle (git-
620
+ * revert semantics, not git-reset), so the response shape mirrors
621
+ * `DeploySiteResult` and the new `deployment_id` is what's now live.
622
+ */
623
+ export declare function rollbackSiteViaApi(projectId: string, siteName: string, deploymentId: string): Promise<ApiResponse<DeploySiteResult>>;
624
+ /**
625
+ * Delete a site entirely. Cascade: removes attached custom hostnames,
626
+ * tears down the CDN project, and soft-deletes the site row. Partial
627
+ * failures surface as `503 CASCADE_PARTIAL_FAILURE` with the `cascade`
628
+ * field telling the CLI which steps completed.
629
+ */
630
+ export declare function deleteSiteViaApi(projectId: string, siteName: string, options: {
631
+ confirm: string;
632
+ }): Promise<ApiResponse<{
633
+ name: string;
634
+ deleted: true;
635
+ cascade: DeleteCascadeSummary;
636
+ }>>;
637
+ /**
638
+ * Delete a function entirely. Cascade: removes the deployed script
639
+ * (backend 404 treated as success), then marks every historical
640
+ * deployment row as `status='disabled'` to keep history intact for
641
+ * audit. Customer Workers stop responding immediately on cascade
642
+ * step 1.
643
+ */
644
+ export declare function deleteFunctionViaApi(projectId: string, functionName: string, options: {
645
+ confirm: string;
646
+ }): Promise<ApiResponse<{
647
+ name: string;
648
+ deleted: true;
649
+ cascade: DeleteCascadeSummary;
650
+ }>>;
651
+ export declare function attachSiteDomain(projectId: string, siteName: string, input: {
652
+ hostname: string;
653
+ cf_hostname_id?: string;
654
+ }): Promise<ApiResponse<SiteDomainRow>>;
655
+ export declare function listSiteDomains(projectId: string, siteName: string): Promise<ApiListResponse<SiteDomainRow>>;
656
+ export declare function updateSiteDomain(projectId: string, siteName: string, hostname: string, patch: {
657
+ cert_status: SiteDomainRow['cert_status'];
658
+ cf_hostname_id?: string;
659
+ }): Promise<ApiResponse<SiteDomainRow>>;
660
+ export declare function detachSiteDomain(projectId: string, siteName: string, hostname: string): Promise<ApiResponse<{
661
+ deleted: boolean;
662
+ }>>;
663
+ export declare function validateApiKey(apiKey: string): Promise<{
664
+ valid: false;
665
+ error: string;
666
+ } | {
667
+ project_id: string;
668
+ environment: string;
669
+ valid: true;
670
+ error?: undefined;
671
+ }>;