@zuzjs/flare-admin 0.1.8 → 0.1.10

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/dist/index.d.cts CHANGED
@@ -144,6 +144,7 @@ interface AdminStorageUploadInput {
144
144
  path: string;
145
145
  contentBase64: string;
146
146
  contentType?: string;
147
+ access?: "public" | "private";
147
148
  encrypt?: boolean;
148
149
  }
149
150
  interface AdminStorageDownloadInput {
@@ -159,6 +160,8 @@ interface AdminStorageObjectResult {
159
160
  ok: boolean;
160
161
  path: string;
161
162
  key: string;
163
+ access?: "public" | "private";
164
+ url?: string;
162
165
  encrypted?: boolean;
163
166
  size?: number;
164
167
  contentBase64?: string;
@@ -177,6 +180,7 @@ interface AdminStorageSignedUrlInput {
177
180
  expiresInSeconds?: number;
178
181
  sizeBytes?: number;
179
182
  contentType?: string;
183
+ access?: "public" | "private";
180
184
  encrypt?: boolean;
181
185
  decrypt?: boolean;
182
186
  forceDownload?: boolean;
@@ -341,6 +345,8 @@ interface AdminStorageObjectMeta {
341
345
  bucket: string;
342
346
  size: number;
343
347
  contentType: string;
348
+ access?: "public" | "private";
349
+ url?: string;
344
350
  encrypted: boolean;
345
351
  createdAt?: unknown;
346
352
  updatedAt?: unknown;
@@ -352,7 +358,9 @@ interface AdminPutObjectInput {
352
358
  /** Pre-encoded base64 body. Mutually exclusive with `body`. Always uses base64 path. */
353
359
  contentBase64?: string;
354
360
  contentType?: string;
355
- /** Encrypt at rest with AES-256-GCM. Defaults to true. */
361
+ /** Public/private object access. Defaults to public. */
362
+ access?: "public" | "private";
363
+ /** Encrypt at rest with AES-256-GCM. Defaults to false. */
356
364
  encrypt?: boolean;
357
365
  /**
358
366
  * Max payload bytes for the base64-over-JSON upload path.
@@ -365,6 +373,8 @@ interface AdminPutObjectResult {
365
373
  ok: boolean;
366
374
  bucket: string;
367
375
  key: string;
376
+ access: "public" | "private";
377
+ url?: string;
368
378
  size: number;
369
379
  encrypted: boolean;
370
380
  }
@@ -413,6 +423,105 @@ interface AdminDeleteObjectsInput {
413
423
  bucket: string;
414
424
  keys: string[];
415
425
  }
426
+ type AdminFunctionScopeType = "collection" | "document" | "field";
427
+ type AdminFunctionTargetType = "compiled_plan" | "internal" | "webhook" | "isolated_runtime";
428
+ type AdminMutationOperation = "create" | "update" | "delete" | "other";
429
+ type AdminFunctionExecutionStatus = "pending" | "running" | "success" | "failure" | "timeout";
430
+ interface AdminFunctionScope {
431
+ type?: AdminFunctionScopeType;
432
+ collection?: string;
433
+ document_id?: string;
434
+ fields?: string[];
435
+ }
436
+ interface AdminFunctionTarget {
437
+ type?: AdminFunctionTargetType;
438
+ source?: string;
439
+ handler?: string;
440
+ url?: string;
441
+ }
442
+ interface AdminCloudFunction {
443
+ id: string;
444
+ appId: string;
445
+ name: string;
446
+ enabled: boolean;
447
+ scope: AdminFunctionScope;
448
+ target: AdminFunctionTarget;
449
+ timeoutMs?: number;
450
+ createdAt?: string;
451
+ updatedAt?: string;
452
+ }
453
+ interface AdminCreateFunctionInput {
454
+ id?: string;
455
+ name: string;
456
+ enabled?: boolean;
457
+ scope: AdminFunctionScope;
458
+ target: AdminFunctionTarget;
459
+ timeoutMs?: number;
460
+ }
461
+ interface AdminPatchFunctionInput {
462
+ name?: string;
463
+ enabled?: boolean;
464
+ scope?: AdminFunctionScope;
465
+ target?: AdminFunctionTarget;
466
+ timeoutMs?: number;
467
+ }
468
+ interface AdminInvokeFunctionInput {
469
+ documentId?: string;
470
+ operation?: AdminMutationOperation;
471
+ changedFields?: string[];
472
+ updatedFields?: Record<string, unknown>;
473
+ removedFields?: string[];
474
+ fullDocument?: Record<string, unknown>;
475
+ data?: unknown;
476
+ auth?: unknown;
477
+ context?: Record<string, unknown>;
478
+ }
479
+ interface AdminInvokeFunctionResult {
480
+ ok: boolean;
481
+ functionId: string;
482
+ status: AdminFunctionExecutionStatus;
483
+ output?: unknown;
484
+ error?: string;
485
+ durationMs?: number;
486
+ executionId?: string;
487
+ }
488
+ interface AdminFunctionExecution {
489
+ id: string;
490
+ functionId: string;
491
+ appId: string;
492
+ status: AdminFunctionExecutionStatus;
493
+ triggeredBy?: string;
494
+ durationMs?: number;
495
+ output?: unknown;
496
+ error?: string;
497
+ createdAt?: string;
498
+ updatedAt?: string;
499
+ }
500
+ interface AdminFunctionValidationResult {
501
+ valid: boolean;
502
+ diagnostics: unknown[];
503
+ mode?: "server" | "local_fallback" | "unavailable";
504
+ }
505
+ interface FlareAdminFunctions {
506
+ list(): Promise<AdminCloudFunction[]>;
507
+ get(functionId: string): Promise<AdminCloudFunction | null>;
508
+ create(input: AdminCreateFunctionInput): Promise<AdminCloudFunction>;
509
+ patch(functionId: string, input: AdminPatchFunctionInput): Promise<AdminCloudFunction>;
510
+ upsert(functionId: string, input: AdminCreateFunctionInput): Promise<AdminCloudFunction>;
511
+ delete(functionId: string): Promise<{
512
+ ok: boolean;
513
+ id: string;
514
+ }>;
515
+ invoke(functionId: string, input?: AdminInvokeFunctionInput): Promise<AdminInvokeFunctionResult>;
516
+ executions(opts?: {
517
+ limit?: number;
518
+ cursor?: string;
519
+ }): Promise<{
520
+ list: AdminFunctionExecution[];
521
+ total: number;
522
+ }>;
523
+ validate(source: string, functionId?: string): Promise<AdminFunctionValidationResult>;
524
+ }
416
525
  type QueryOperator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "array-contains" | "array-contains-any" | "elem-match" | "like" | "not-like" | "contains" | "exists" | "not-exists";
417
526
  interface WhereFilter {
418
527
  field: string;
@@ -691,32 +800,6 @@ interface AdminSubscriptionHandle {
691
800
  catch: (callback: AdminSubscriptionErrorCallback) => AdminSubscriptionHandle;
692
801
  }
693
802
 
694
- declare class AdminDocumentReference<T = Record<string, unknown>> {
695
- private readonly cfg;
696
- readonly collection: string;
697
- readonly id: string;
698
- constructor(cfg: Required<FlareAdminConfig>, collection: string, id: string);
699
- private get baseUrl();
700
- private get headers();
701
- private request;
702
- /** Fetch this document. Returns `null` if it does not exist. */
703
- get(): Promise<T | null>;
704
- /**
705
- * Replace (or create) this document entirely.
706
- * All fields not in `data` are removed.
707
- */
708
- set(data: Partial<T>): Promise<void>;
709
- /**
710
- * Merge `data` into the existing document (upsert).
711
- * Only the provided fields are changed.
712
- */
713
- update(data: Partial<T>): Promise<void>;
714
- /** Delete this document. */
715
- delete(): Promise<void>;
716
- /** Return the parent collection reference. */
717
- parent(): AdminCollectionReference<T>;
718
- }
719
-
720
803
  declare class AdminCollectionReference<T = Record<string, unknown>> {
721
804
  private readonly cfg;
722
805
  readonly name: string;
@@ -838,6 +921,32 @@ declare class AdminCollectionReference<T = Record<string, unknown>> {
838
921
  doc(id: string): AdminDocumentReference<T>;
839
922
  }
840
923
 
924
+ declare class AdminDocumentReference<T = Record<string, unknown>> {
925
+ private readonly cfg;
926
+ readonly collection: string;
927
+ readonly id: string;
928
+ constructor(cfg: Required<FlareAdminConfig>, collection: string, id: string);
929
+ private get baseUrl();
930
+ private get headers();
931
+ private request;
932
+ /** Fetch this document. Returns `null` if it does not exist. */
933
+ get(): Promise<T | null>;
934
+ /**
935
+ * Replace (or create) this document entirely.
936
+ * All fields not in `data` are removed.
937
+ */
938
+ set(data: Partial<T>): Promise<void>;
939
+ /**
940
+ * Merge `data` into the existing document (upsert).
941
+ * Only the provided fields are changed.
942
+ */
943
+ update(data: Partial<T>): Promise<void>;
944
+ /** Delete this document. */
945
+ delete(): Promise<void>;
946
+ /** Return the parent collection reference. */
947
+ parent(): AdminCollectionReference<T>;
948
+ }
949
+
841
950
  declare class FlareAdminDbService implements FlareAdminDb {
842
951
  private readonly cfg;
843
952
  constructor(cfg: Required<FlareAdminConfig>);
@@ -1201,6 +1310,38 @@ declare class FlareAdminWsConnection {
1201
1310
  private _handle;
1202
1311
  }
1203
1312
 
1313
+ declare class FlareAdminFunctionsService implements FlareAdminFunctions {
1314
+ private readonly cfg;
1315
+ private readonly targetAppId;
1316
+ constructor(cfg: Required<FlareAdminConfig>, targetAppId?: string);
1317
+ private get appId();
1318
+ private get callerAppId();
1319
+ private baseUrl;
1320
+ private get authParams();
1321
+ private get headers();
1322
+ private url;
1323
+ private request;
1324
+ private extractFunction;
1325
+ list(): Promise<AdminCloudFunction[]>;
1326
+ get(functionId: string): Promise<AdminCloudFunction | null>;
1327
+ create(input: AdminCreateFunctionInput): Promise<AdminCloudFunction>;
1328
+ patch(functionId: string, input: AdminPatchFunctionInput): Promise<AdminCloudFunction>;
1329
+ upsert(functionId: string, input: AdminCreateFunctionInput): Promise<AdminCloudFunction>;
1330
+ delete(functionId: string): Promise<{
1331
+ ok: boolean;
1332
+ id: string;
1333
+ }>;
1334
+ invoke(functionId: string, input?: AdminInvokeFunctionInput): Promise<AdminInvokeFunctionResult>;
1335
+ executions(opts?: {
1336
+ limit?: number;
1337
+ cursor?: string;
1338
+ }): Promise<{
1339
+ list: AdminFunctionExecution[];
1340
+ total: number;
1341
+ }>;
1342
+ validate(source: string, functionId?: string): Promise<AdminFunctionValidationResult>;
1343
+ }
1344
+
1204
1345
  /**
1205
1346
  * Sentinel value that asks flare-node to write the current server timestamp.
1206
1347
  *
@@ -1227,6 +1368,7 @@ declare class FlareAdminApp {
1227
1368
  private _notifications?;
1228
1369
  private _storage?;
1229
1370
  private _storageS3?;
1371
+ private _functions?;
1230
1372
  /**
1231
1373
  * Access the auth service.
1232
1374
  *
@@ -1251,6 +1393,29 @@ declare class FlareAdminApp {
1251
1393
  * await admin.db().collection("users").doc("alice").update({ plan: "pro" });
1252
1394
  */
1253
1395
  db(): FlareAdminDb;
1396
+ /**
1397
+ * Generates a standard 20-character Flare document ID.
1398
+ * UUID v4 without dashes, first 20 chars — matches the Rust server-side format.
1399
+ *
1400
+ * ```ts
1401
+ * const id = admin.generateFlareId();
1402
+ * await admin.db().collection('orders').doc(id).set({ total: 99, id });
1403
+ * ```
1404
+ */
1405
+ generateFlareId(): string;
1406
+ /**
1407
+ * Creates an AdminDocumentReference with a pre-generated Flare ID.
1408
+ * Use `.id` to get the ID before any network call.
1409
+ *
1410
+ * ```ts
1411
+ * const ref = admin.doc('orders');
1412
+ * const id = ref.id;
1413
+ * await ref.set({ total: 99, id });
1414
+ * ```
1415
+ */
1416
+ doc<T = Record<string, unknown>>(collectionName: string): AdminDocumentReference<T> & {
1417
+ id: string;
1418
+ };
1254
1419
  /**
1255
1420
  * Open (or reuse) a persistent admin WebSocket connection.
1256
1421
  * One socket is shared per app instance — call `.disconnect()` when done.
@@ -1280,6 +1445,25 @@ declare class FlareAdminApp {
1280
1445
  * admin.live().disconnect();
1281
1446
  */
1282
1447
  live(): FlareAdminConnection;
1448
+ /**
1449
+ * Access cloud functions management APIs.
1450
+ * Requires `adminKey` — operations run as admin, bypassing auth checks.
1451
+ *
1452
+ * @example
1453
+ * const fns = await admin.functions().list();
1454
+ * await admin.functions().invoke('my-fn', { data: { userId: 'abc' } });
1455
+ * await admin.functions().upsert('guard-fn', {
1456
+ * name: 'guard_fn',
1457
+ * scope: { type: 'collection', collection: 'orders' },
1458
+ * target: { type: 'compiled_plan', source: 'if exists(event.invocation.auth.uid) { ... }' },
1459
+ * });
1460
+ */
1461
+ functions(): FlareAdminFunctions;
1462
+ /**
1463
+ * Access cloud functions for a specific target app.
1464
+ * The caller identity remains this admin app's credentials; only the path target changes.
1465
+ */
1466
+ functionsFor(appId: string): FlareAdminFunctions;
1283
1467
  /**
1284
1468
  * Access push notification management APIs.
1285
1469
  */
@@ -1417,4 +1601,4 @@ declare function live(name?: string): FlareAdminConnection;
1417
1601
  declare function notifications(name?: string): FlareAdminNotifications;
1418
1602
  declare function storage(name?: string): FlareAdminStorageS3;
1419
1603
 
1420
- export { type AdminBulkWriteOperation, type AdminBulkWriteOptions, type AdminBulkWriteProgress, type AdminBulkWriteResult, AdminCollectionReference, type AdminConnectionState, type AdminConnectionStateListener, type AdminCopyObjectInput, type AdminDeleteObjectsInput, type AdminDocAddedCallback, type AdminDocChangedCallback, type AdminDocDeletedCallback, type AdminDocUpdatedCallback, AdminDocumentReference, type AdminDownloadObjectInput, type AdminDownloadObjectResult, type AdminGetObjectInput, type AdminGetObjectResult, type AdminGetObjectUrlInput, type AdminHeadObjectInput, type AdminHeadObjectsInput, type AdminListObjectsInput, type AdminListObjectsResult, AdminLiveCollectionReference, AdminLiveDocumentReference, type AdminPushSendInput, type AdminPushSendResult, type AdminPushToken, type AdminPutObjectInput, type AdminPutObjectResult, type AdminSnapshotCallback, type AdminSnapshotData, type AdminStorageAwsConfig, type AdminStorageBucket, type AdminStorageBucketInput, type AdminStorageDeleteInput, type AdminStorageDownloadInput, type AdminStorageObjectMeta, type AdminStorageObjectResult, type AdminStorageRulesHistoryResult, type AdminStorageRulesPolicy, type AdminStorageServer, type AdminStorageServerInput, type AdminStorageServerPatchInput, AdminStorageSignedAction, type AdminStorageSignedUrlInput, type AdminStorageSignedUrlResult, type AdminStorageUploadInput, type AdminSubscriptionError, type AdminSubscriptionErrorCallback, type AdminSubscriptionHandle, type AdminUpdateManyItem, type AggregateFunction, type AggregateSpec, type AnyFilter, type CreateCustomTokenOptions, type CursorValue, FlareAdminApp, type FlareAdminAuth, FlareAdminAuthService, type FlareAdminConfig, FlareAdminConnection, type FlareAdminDb, FlareAdminDbService, type FlareAdminNotifications, FlareAdminNotificationsService, type FlareAdminStorage, FlareAdminStorageS3, FlareAdminWsConnection, type GroupByClause, type HavingClause, type JoinClause, type OrFilter, type OrderByClause, type QueryOperator, ServerTimeStamp, ServerTimeStampField, type StructuredQuery, type VectorSearchClause, type WhereCondition, type WhereFilter, auth, connectApp, db, disconnectAllApps, disconnectApp, getApp, live, notifications, storage };
1604
+ export { type AdminBulkWriteOperation, type AdminBulkWriteOptions, type AdminBulkWriteProgress, type AdminBulkWriteResult, type AdminCloudFunction, AdminCollectionReference, type AdminConnectionState, type AdminConnectionStateListener, type AdminCopyObjectInput, type AdminCreateFunctionInput, type AdminDeleteObjectsInput, type AdminDocAddedCallback, type AdminDocChangedCallback, type AdminDocDeletedCallback, type AdminDocUpdatedCallback, AdminDocumentReference, type AdminDownloadObjectInput, type AdminDownloadObjectResult, type AdminFunctionExecution, type AdminFunctionExecutionStatus, type AdminFunctionScope, type AdminFunctionScopeType, type AdminFunctionTarget, type AdminFunctionTargetType, type AdminGetObjectInput, type AdminGetObjectResult, type AdminGetObjectUrlInput, type AdminHeadObjectInput, type AdminHeadObjectsInput, type AdminInvokeFunctionInput, type AdminInvokeFunctionResult, type AdminListObjectsInput, type AdminListObjectsResult, AdminLiveCollectionReference, AdminLiveDocumentReference, type AdminMutationOperation, type AdminPatchFunctionInput, type AdminPushSendInput, type AdminPushSendResult, type AdminPushToken, type AdminPutObjectInput, type AdminPutObjectResult, type AdminSnapshotCallback, type AdminSnapshotData, type AdminStorageAwsConfig, type AdminStorageBucket, type AdminStorageBucketInput, type AdminStorageDeleteInput, type AdminStorageDownloadInput, type AdminStorageObjectMeta, type AdminStorageObjectResult, type AdminStorageRulesHistoryResult, type AdminStorageRulesPolicy, type AdminStorageServer, type AdminStorageServerInput, type AdminStorageServerPatchInput, AdminStorageSignedAction, type AdminStorageSignedUrlInput, type AdminStorageSignedUrlResult, type AdminStorageUploadInput, type AdminSubscriptionError, type AdminSubscriptionErrorCallback, type AdminSubscriptionHandle, type AdminUpdateManyItem, type AggregateFunction, type AggregateSpec, type AnyFilter, type CreateCustomTokenOptions, type CursorValue, FlareAdminApp, type FlareAdminAuth, FlareAdminAuthService, type FlareAdminConfig, FlareAdminConnection, type FlareAdminDb, FlareAdminDbService, type FlareAdminFunctions, FlareAdminFunctionsService, type FlareAdminNotifications, FlareAdminNotificationsService, type FlareAdminStorage, FlareAdminStorageS3, FlareAdminWsConnection, type GroupByClause, type HavingClause, type JoinClause, type OrFilter, type OrderByClause, type QueryOperator, ServerTimeStamp, ServerTimeStampField, type StructuredQuery, type VectorSearchClause, type WhereCondition, type WhereFilter, auth, connectApp, db, disconnectAllApps, disconnectApp, getApp, live, notifications, storage };
package/dist/index.d.ts CHANGED
@@ -40,6 +40,7 @@
40
40
  * .onSnapshot((snap) => console.log(snap));
41
41
  */
42
42
  export { AdminStorageSignedAction } from "./types";
43
+ export type { AdminCloudFunction, AdminCreateFunctionInput, AdminFunctionExecution, AdminFunctionExecutionStatus, AdminFunctionScope, AdminFunctionScopeType, AdminFunctionTarget, AdminFunctionTargetType, AdminInvokeFunctionInput, AdminInvokeFunctionResult, AdminMutationOperation, AdminPatchFunctionInput, FlareAdminFunctions, } from "./types";
43
44
  export type { AdminBulkWriteOperation, AdminBulkWriteOptions, AdminBulkWriteProgress, AdminBulkWriteResult, AdminConnectionState, AdminConnectionStateListener, AdminCopyObjectInput, AdminDeleteObjectsInput, AdminDocAddedCallback, AdminDocChangedCallback, AdminDocDeletedCallback, AdminDocUpdatedCallback, AdminDownloadObjectInput, AdminDownloadObjectResult, AdminGetObjectInput, AdminGetObjectResult, AdminGetObjectUrlInput, AdminHeadObjectInput, AdminHeadObjectsInput, AdminListObjectsInput, AdminListObjectsResult, AdminPushSendInput, AdminPushSendResult, AdminPushToken, AdminPutObjectInput, AdminPutObjectResult, AdminSnapshotCallback, AdminSnapshotData, AdminStorageAwsConfig, AdminStorageBucket, AdminStorageBucketInput, AdminStorageDeleteInput, AdminStorageDownloadInput, AdminStorageObjectMeta, AdminStorageObjectResult, AdminStorageRulesHistoryResult, AdminStorageRulesPolicy, AdminStorageServer, AdminStorageServerInput, AdminStorageServerPatchInput, AdminStorageSignedUrlInput, AdminStorageSignedUrlResult, AdminStorageUploadInput, AdminSubscriptionError, AdminSubscriptionErrorCallback, AdminSubscriptionHandle, AdminUpdateManyItem, AggregateFunction, AggregateSpec, AnyFilter, CreateCustomTokenOptions, CursorValue, FlareAdminAuth, FlareAdminConfig, FlareAdminDb, FlareAdminNotifications, FlareAdminStorage, GroupByClause, HavingClause, JoinClause, OrderByClause, OrFilter, QueryOperator, StructuredQuery, VectorSearchClause, WhereCondition, WhereFilter } from "./types";
44
45
  export { AdminCollectionReference } from "./db/Collection";
45
46
  export { AdminDocumentReference } from "./db/Document";
@@ -51,9 +52,10 @@ export { FlareAdminConnection } from "./realtime/Connection";
51
52
  export { AdminLiveCollectionReference } from "./realtime/LiveCollection";
52
53
  export { AdminLiveDocumentReference } from "./realtime/LiveDocument";
53
54
  export { FlareAdminWsConnection } from "./realtime/WsConnection";
55
+ export { FlareAdminFunctionsService } from "./lib/functions";
54
56
  import { FlareAdminStorageS3 } from "./lib/storage";
55
57
  import { FlareAdminConnection } from "./realtime/Connection";
56
- import { AdminCopyObjectInput, AdminDeleteObjectsInput, AdminDownloadObjectInput, AdminDownloadObjectResult, AdminGetObjectInput, AdminGetObjectResult, AdminGetObjectUrlInput, AdminHeadObjectInput, AdminHeadObjectsInput, AdminListObjectsInput, AdminListObjectsResult, AdminPutObjectInput, AdminPutObjectResult, AdminStorageBucket, AdminStorageBucketInput, AdminStorageObjectMeta, AdminStorageSignedUrlInput, AdminStorageSignedUrlResult, FlareAdminAuth, FlareAdminConfig, FlareAdminDb, FlareAdminNotifications } from "./types";
58
+ import { AdminCopyObjectInput, AdminDeleteObjectsInput, AdminDownloadObjectInput, AdminDownloadObjectResult, AdminGetObjectInput, AdminGetObjectResult, AdminGetObjectUrlInput, AdminHeadObjectInput, AdminHeadObjectsInput, AdminListObjectsInput, AdminListObjectsResult, AdminPutObjectInput, AdminPutObjectResult, AdminStorageBucket, AdminStorageBucketInput, AdminStorageObjectMeta, AdminStorageSignedUrlInput, AdminStorageSignedUrlResult, FlareAdminAuth, FlareAdminConfig, FlareAdminDb, FlareAdminFunctions, FlareAdminNotifications } from "./types";
57
59
  /**
58
60
  * A FlareAdmin application instance.
59
61
  * Create one with `connectApp()` and keep it as a module-level singleton.
@@ -66,6 +68,7 @@ export declare class FlareAdminApp {
66
68
  private _notifications?;
67
69
  private _storage?;
68
70
  private _storageS3?;
71
+ private _functions?;
69
72
  /**
70
73
  * Access the auth service.
71
74
  *
@@ -90,6 +93,29 @@ export declare class FlareAdminApp {
90
93
  * await admin.db().collection("users").doc("alice").update({ plan: "pro" });
91
94
  */
92
95
  db(): FlareAdminDb;
96
+ /**
97
+ * Generates a standard 20-character Flare document ID.
98
+ * UUID v4 without dashes, first 20 chars — matches the Rust server-side format.
99
+ *
100
+ * ```ts
101
+ * const id = admin.generateFlareId();
102
+ * await admin.db().collection('orders').doc(id).set({ total: 99, id });
103
+ * ```
104
+ */
105
+ generateFlareId(): string;
106
+ /**
107
+ * Creates an AdminDocumentReference with a pre-generated Flare ID.
108
+ * Use `.id` to get the ID before any network call.
109
+ *
110
+ * ```ts
111
+ * const ref = admin.doc('orders');
112
+ * const id = ref.id;
113
+ * await ref.set({ total: 99, id });
114
+ * ```
115
+ */
116
+ doc<T = Record<string, unknown>>(collectionName: string): import('./db/Document').AdminDocumentReference<T> & {
117
+ id: string;
118
+ };
93
119
  /**
94
120
  * Open (or reuse) a persistent admin WebSocket connection.
95
121
  * One socket is shared per app instance — call `.disconnect()` when done.
@@ -119,6 +145,25 @@ export declare class FlareAdminApp {
119
145
  * admin.live().disconnect();
120
146
  */
121
147
  live(): FlareAdminConnection;
148
+ /**
149
+ * Access cloud functions management APIs.
150
+ * Requires `adminKey` — operations run as admin, bypassing auth checks.
151
+ *
152
+ * @example
153
+ * const fns = await admin.functions().list();
154
+ * await admin.functions().invoke('my-fn', { data: { userId: 'abc' } });
155
+ * await admin.functions().upsert('guard-fn', {
156
+ * name: 'guard_fn',
157
+ * scope: { type: 'collection', collection: 'orders' },
158
+ * target: { type: 'compiled_plan', source: 'if exists(event.invocation.auth.uid) { ... }' },
159
+ * });
160
+ */
161
+ functions(): FlareAdminFunctions;
162
+ /**
163
+ * Access cloud functions for a specific target app.
164
+ * The caller identity remains this admin app's credentials; only the path target changes.
165
+ */
166
+ functionsFor(appId: string): FlareAdminFunctions;
122
167
  /**
123
168
  * Access push notification management APIs.
124
169
  */