@zuzjs/flare 0.2.17 → 0.2.19
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 +235 -0
- package/dist/grpc.d.cts +1 -1
- package/dist/grpc.d.ts +1 -1
- package/dist/{index-B8jyF1xs.d.ts → index-EwoU5mWk.d.cts} +236 -2
- package/dist/{index-B2YceCms.d.cts → index-GvnP1-Os.d.ts} +236 -2
- package/dist/{index-BAvE1URE.d.cts → index-Y0Mq_6P9.d.cts} +355 -1
- package/dist/{index-BAvE1URE.d.ts → index-Y0Mq_6P9.d.ts} +355 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aX as WhereCondition, aP as SubscriptionCallback, as as QueryConfig, E as DocUpdatedCallback, z as DocDeletedCallback, y as DocChangedCallback, au as QueryPresetMap, av as QueryPresetParams, aw as QueryPresetRow, a as AggregateSpec, aa as HavingClause, ad as JoinClause, aV as VectorSearchClause, aN as StructuredQuery, aT as SubscriptionHandle, q as CollectionStreamOptions, n as CollectionStream, m as CollectionExternalStore, x as DocAddedCallback, F as FlareConfig, aO as SubscribeOptions, aS as SubscriptionErrorCallback, aR as SubscriptionError, r as ConnectionState, al as PresenceCallback, am as PresenceJoinCallback, an as PresenceLeaveCallback, aU as VectorFieldConfig, ax as QueryPresetSpec, a4 as FlareStorageTransferManagerConfig, aJ as StorageProgress, aH as StorageBucketInput, aG as StorageBucket, k as BucketPolicyInput, Z as FlareStorageRulesPolicy, j as BucketCorsRule, Y as FlareStorageRulesHistoryResult, aq as PutObjectInput, ar as PutObjectResult, a6 as GetObjectInput, a7 as GetObjectResult, a8 as GetObjectUrlInput, H as DownloadObjectInput, I as DownloadObjectResult, ab as HeadObjectInput, aI as StorageObjectMeta, ac as HeadObjectsInput, af as ListObjectsInput, ag as ListObjectsResult, s as CopyObjectInput, v as DeleteObjectInput, w as DeleteObjectsInput, aK as StorageSignedUrlInput, a3 as FlareStorageSignedUrlResult, L as FlareAuthConfig, f as AuthStateListener, d as AuthConfigListener, Q as FlareAuthSession, R as FlareAuthUser, M as FlareAuthHydrationInput, N as FlareAuthHydrationOptions, i as BrowserPushTokenOptions, B as BrowserPushRegistrationOptions, az as RegisterPushTokenInput, aE as SendPushNotificationInput, ap as PushSendResult, e as AuthResult } from './index-Y0Mq_6P9.js';
|
|
2
2
|
import { AuthToken } from '@zuzjs/auth';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -508,6 +508,168 @@ declare class FlareBase<TPresetMap extends QueryPresetMap = {}> {
|
|
|
508
508
|
protected handleIncoming(msg: any): void;
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
+
interface FlareStorageTransport {
|
|
512
|
+
readonly appId: string;
|
|
513
|
+
readonly transferManager?: FlareStorageTransferManagerConfig;
|
|
514
|
+
call(topic: string, payload?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
515
|
+
subscribe(subId: string, collection: string, docId: string | undefined, query: unknown, callback: (event: any) => void, options?: {
|
|
516
|
+
skipSnapshot?: boolean;
|
|
517
|
+
}): () => void;
|
|
518
|
+
doPost(label: string, path: string, body: unknown): Promise<Record<string, unknown>>;
|
|
519
|
+
doGet(label: string, path: string): Promise<Record<string, unknown>>;
|
|
520
|
+
doPostWithProgress(label: string, path: string, body: unknown, onProgress: (p: StorageProgress) => void): Promise<Record<string, unknown>>;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* S3-compatible storage service returned by `app.storage()`.
|
|
524
|
+
*
|
|
525
|
+
* Works with bucket **names** (not internal server IDs). Server IDs are
|
|
526
|
+
* resolved lazily and cached. `putObject()` automatically creates the bucket
|
|
527
|
+
* if it does not yet exist.
|
|
528
|
+
*/
|
|
529
|
+
declare class FlareStorage {
|
|
530
|
+
private readonly _t;
|
|
531
|
+
private readonly _transferEnabled;
|
|
532
|
+
private readonly _uploadLimiter;
|
|
533
|
+
private readonly _downloadLimiter;
|
|
534
|
+
/** bucket-name → serverId cache */
|
|
535
|
+
private readonly _bucketCache;
|
|
536
|
+
private _bucketListLoaded;
|
|
537
|
+
private _bucketListPromise;
|
|
538
|
+
constructor(transport: FlareStorageTransport);
|
|
539
|
+
private _scheduleUpload;
|
|
540
|
+
private _scheduleDownload;
|
|
541
|
+
private _ensureBuckets;
|
|
542
|
+
private _loadBuckets;
|
|
543
|
+
private _invalidateBucketCache;
|
|
544
|
+
/**
|
|
545
|
+
* Resolves a bucket name to its internal serverId.
|
|
546
|
+
* When `autoCreate` is true, creates the bucket if it does not exist.
|
|
547
|
+
*/
|
|
548
|
+
private _resolveBucketId;
|
|
549
|
+
private _appPath;
|
|
550
|
+
private _bucketStreamCollection;
|
|
551
|
+
private _objectStreamCollection;
|
|
552
|
+
private _subscribeStorage;
|
|
553
|
+
/**
|
|
554
|
+
* Creates a new bucket (storage server) for the app.
|
|
555
|
+
*
|
|
556
|
+
* Idempotent: if a bucket with this name already exists the existing one
|
|
557
|
+
* is returned unchanged (same behaviour as AWS S3 for same-owner buckets).
|
|
558
|
+
*/
|
|
559
|
+
createBucket(name: string, options?: StorageBucketInput): Promise<StorageBucket>;
|
|
560
|
+
private _listBucketsRaw;
|
|
561
|
+
/** Returns all buckets for the app. */
|
|
562
|
+
listBuckets(): Promise<StorageBucket[]>;
|
|
563
|
+
/** Deletes a bucket and all its objects. */
|
|
564
|
+
deleteBucket(name: string): Promise<{
|
|
565
|
+
ok: boolean;
|
|
566
|
+
removedObjects: number;
|
|
567
|
+
}>;
|
|
568
|
+
/** Deletes multiple buckets. */
|
|
569
|
+
deleteBuckets(names: string[]): Promise<{
|
|
570
|
+
ok: boolean;
|
|
571
|
+
deleted: string[];
|
|
572
|
+
errors: Record<string, string>;
|
|
573
|
+
}>;
|
|
574
|
+
/** Returns location info for a bucket (kind, region, endpoint). */
|
|
575
|
+
getBucketLocation(name: string): Promise<{
|
|
576
|
+
bucket: string;
|
|
577
|
+
kind: string;
|
|
578
|
+
region?: string;
|
|
579
|
+
endpoint?: string;
|
|
580
|
+
}>;
|
|
581
|
+
onBucketAdded(callback: (bucket: StorageBucket, bucketId: string) => void): () => void;
|
|
582
|
+
onBucketUpdated(callback: (bucket: StorageBucket, bucketId: string) => void): () => void;
|
|
583
|
+
onBucketDeleted(callback: (bucketId: string) => void): () => void;
|
|
584
|
+
/**
|
|
585
|
+
* Sets security rules for storage.
|
|
586
|
+
* Rules apply app-wide (all buckets share the same rules DSL).
|
|
587
|
+
*/
|
|
588
|
+
putBucketPolicy(input: BucketPolicyInput): Promise<{
|
|
589
|
+
id: string;
|
|
590
|
+
}>;
|
|
591
|
+
/** Gets the current storage rules policy. */
|
|
592
|
+
getBucketPolicy(): Promise<{
|
|
593
|
+
rulesDsl?: string;
|
|
594
|
+
rules?: unknown;
|
|
595
|
+
policy: FlareStorageRulesPolicy;
|
|
596
|
+
}>;
|
|
597
|
+
/**
|
|
598
|
+
* Sets CORS rules for a bucket.
|
|
599
|
+
* Note: CORS is configured at the flare-node server level; this method
|
|
600
|
+
* stores the rules in app settings for reference.
|
|
601
|
+
*/
|
|
602
|
+
putBucketCors(_bucket: string, _rules: BucketCorsRule[]): Promise<{
|
|
603
|
+
ok: boolean;
|
|
604
|
+
}>;
|
|
605
|
+
/** Alias for putBucketCors. */
|
|
606
|
+
setBucketCors: (_bucket: string, _rules: BucketCorsRule[]) => Promise<{
|
|
607
|
+
ok: boolean;
|
|
608
|
+
}>;
|
|
609
|
+
/** Returns the full storage rules/policy history. */
|
|
610
|
+
rulesHistory(): Promise<FlareStorageRulesHistoryResult>;
|
|
611
|
+
/**
|
|
612
|
+
* Uploads an object to a bucket.
|
|
613
|
+
*
|
|
614
|
+
* The bucket is created automatically if it does not exist.
|
|
615
|
+
* Default path is direct raw upload via signed URL (no base64 encoding).
|
|
616
|
+
* Set `base64: true` to prefer legacy base64 upload for small payloads.
|
|
617
|
+
* Provide `onProgress` for upload progress updates (browser only).
|
|
618
|
+
*/
|
|
619
|
+
putObject(input: PutObjectInput): Promise<PutObjectResult>;
|
|
620
|
+
/**
|
|
621
|
+
* Downloads an object from a bucket.
|
|
622
|
+
* Returns base64-encoded content.
|
|
623
|
+
*/
|
|
624
|
+
getObject(input: GetObjectInput): Promise<GetObjectResult>;
|
|
625
|
+
/** Returns a short-lived signed URL for direct browser/object download. */
|
|
626
|
+
getObjectUrl(input: GetObjectUrlInput): Promise<string>;
|
|
627
|
+
/**
|
|
628
|
+
* Triggers browser download using a signed URL and returns the resolved URL.
|
|
629
|
+
* In non-browser runtimes, this only returns the URL without dispatching a click.
|
|
630
|
+
*/
|
|
631
|
+
downloadObject(input: DownloadObjectInput): Promise<DownloadObjectResult>;
|
|
632
|
+
/** Returns object metadata without downloading the content. */
|
|
633
|
+
headObject(input: HeadObjectInput): Promise<StorageObjectMeta>;
|
|
634
|
+
/** Returns metadata for multiple objects in parallel. */
|
|
635
|
+
headObjects(input: HeadObjectsInput): Promise<StorageObjectMeta[]>;
|
|
636
|
+
/**
|
|
637
|
+
* Lists objects in a bucket with optional prefix filter and pagination.
|
|
638
|
+
*
|
|
639
|
+
* Pass the returned `cursor` to the next call to page through results.
|
|
640
|
+
*/
|
|
641
|
+
listObjects(input: ListObjectsInput): Promise<ListObjectsResult>;
|
|
642
|
+
/**
|
|
643
|
+
* Copies an object from one bucket/key to another.
|
|
644
|
+
* Source and destination can be different buckets in the same app.
|
|
645
|
+
*/
|
|
646
|
+
copyObject(input: CopyObjectInput): Promise<{
|
|
647
|
+
ok: boolean;
|
|
648
|
+
}>;
|
|
649
|
+
/** Copies multiple objects. Runs concurrently. */
|
|
650
|
+
copyObjects(inputs: CopyObjectInput[]): Promise<{
|
|
651
|
+
ok: boolean;
|
|
652
|
+
errors: Record<string, string>;
|
|
653
|
+
}>;
|
|
654
|
+
/** Deletes a single object. */
|
|
655
|
+
deleteObject(input: DeleteObjectInput): Promise<{
|
|
656
|
+
ok: boolean;
|
|
657
|
+
}>;
|
|
658
|
+
/**
|
|
659
|
+
* Deletes multiple objects in a single server request.
|
|
660
|
+
*/
|
|
661
|
+
deleteObjects(input: DeleteObjectsInput): Promise<{
|
|
662
|
+
ok: boolean;
|
|
663
|
+
deleted: string[];
|
|
664
|
+
errors: Record<string, string>;
|
|
665
|
+
}>;
|
|
666
|
+
onObjectAdded(bucket: string, callback: (object: StorageObjectMeta, key: string) => void): () => void;
|
|
667
|
+
onObjectUpdated(bucket: string, callback: (object: StorageObjectMeta, key: string) => void): () => void;
|
|
668
|
+
onObjectDeleted(bucket: string, callback: (key: string) => void): () => void;
|
|
669
|
+
/** Issues a short-lived signed URL for direct client-to-flare uploads or downloads. */
|
|
670
|
+
createSignedUrl(input: StorageSignedUrlInput): Promise<FlareStorageSignedUrlResult>;
|
|
671
|
+
}
|
|
672
|
+
|
|
511
673
|
declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBase<TPresetMap> {
|
|
512
674
|
static AUTH_TRACE_STORAGE_KEY: string;
|
|
513
675
|
protected pushServiceWorkerInitPromise?: Promise<ServiceWorkerRegistration | null>;
|
|
@@ -527,6 +689,8 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
527
689
|
protected csrfToken?: string;
|
|
528
690
|
protected csrfBootstrapAttempted: boolean;
|
|
529
691
|
protected csrfInitPromise?: Promise<void>;
|
|
692
|
+
/** Lazy singleton FlareStorage service. */
|
|
693
|
+
private _storageService;
|
|
530
694
|
protected isAuthTraceEnabled(): boolean;
|
|
531
695
|
protected traceAuth(event: string, details?: Record<string, unknown>): void;
|
|
532
696
|
setAuthTrace(enabled: boolean, persist?: boolean): void;
|
|
@@ -615,6 +779,76 @@ declare class FlareAuth<TPresetMap extends QueryPresetMap = {}> extends FlareBas
|
|
|
615
779
|
removed: boolean;
|
|
616
780
|
}>;
|
|
617
781
|
sendPushNotification(input: SendPushNotificationInput): Promise<PushSendResult>;
|
|
782
|
+
/**
|
|
783
|
+
* Returns the S3-compatible storage service for this app.
|
|
784
|
+
*
|
|
785
|
+
* Works with bucket **names** — no serverId needed.
|
|
786
|
+
* Buckets are created automatically on `putObject()` if they don't exist yet.
|
|
787
|
+
*
|
|
788
|
+
* @example
|
|
789
|
+
* const s = app.storage();
|
|
790
|
+
* await s.putObject({ bucket: 'avatars', key: 'alice.png', body: file });
|
|
791
|
+
* const { contentBase64 } = await s.getObject({ bucket: 'avatars', key: 'alice.png' });
|
|
792
|
+
*/
|
|
793
|
+
storage(): FlareStorage;
|
|
794
|
+
private _buildStorageTransport;
|
|
795
|
+
/** @see FlareStorage.putObject */
|
|
796
|
+
putObject(input: PutObjectInput): Promise<PutObjectResult>;
|
|
797
|
+
/** @see FlareStorage.getObject */
|
|
798
|
+
getObject(input: GetObjectInput): Promise<GetObjectResult>;
|
|
799
|
+
/** @see FlareStorage.getObjectUrl */
|
|
800
|
+
getObjectUrl(input: GetObjectUrlInput): Promise<string>;
|
|
801
|
+
/** @see FlareStorage.downloadObject */
|
|
802
|
+
downloadObject(input: DownloadObjectInput): Promise<DownloadObjectResult>;
|
|
803
|
+
/** @see FlareStorage.headObject */
|
|
804
|
+
headObject(input: HeadObjectInput): Promise<StorageObjectMeta>;
|
|
805
|
+
/** @see FlareStorage.headObjects */
|
|
806
|
+
headObjects(input: HeadObjectsInput): Promise<StorageObjectMeta[]>;
|
|
807
|
+
/** @see FlareStorage.listObjects */
|
|
808
|
+
listObjects(input: ListObjectsInput): Promise<ListObjectsResult>;
|
|
809
|
+
/** @see FlareStorage.copyObject */
|
|
810
|
+
copyObject(input: CopyObjectInput): Promise<{
|
|
811
|
+
ok: boolean;
|
|
812
|
+
}>;
|
|
813
|
+
/** @see FlareStorage.copyObjects */
|
|
814
|
+
copyObjects(inputs: CopyObjectInput[]): Promise<{
|
|
815
|
+
ok: boolean;
|
|
816
|
+
errors: Record<string, string>;
|
|
817
|
+
}>;
|
|
818
|
+
/** @see FlareStorage.deleteObject */
|
|
819
|
+
deleteObject(input: DeleteObjectInput): Promise<{
|
|
820
|
+
ok: boolean;
|
|
821
|
+
}>;
|
|
822
|
+
/** @see FlareStorage.deleteObjects */
|
|
823
|
+
deleteObjects(input: DeleteObjectsInput): Promise<{
|
|
824
|
+
ok: boolean;
|
|
825
|
+
deleted: string[];
|
|
826
|
+
errors: Record<string, string>;
|
|
827
|
+
}>;
|
|
828
|
+
/** @see FlareStorage.createBucket */
|
|
829
|
+
createBucket(name: string, options?: StorageBucketInput): Promise<StorageBucket>;
|
|
830
|
+
/** @see FlareStorage.listBuckets */
|
|
831
|
+
listBuckets(): Promise<StorageBucket[]>;
|
|
832
|
+
/** @see FlareStorage.deleteBucket */
|
|
833
|
+
deleteBucket(name: string): Promise<{
|
|
834
|
+
ok: boolean;
|
|
835
|
+
removedObjects: number;
|
|
836
|
+
}>;
|
|
837
|
+
/** @see FlareStorage.deleteBuckets */
|
|
838
|
+
deleteBuckets(names: string[]): Promise<{
|
|
839
|
+
ok: boolean;
|
|
840
|
+
deleted: string[];
|
|
841
|
+
errors: Record<string, string>;
|
|
842
|
+
}>;
|
|
843
|
+
/** @see FlareStorage.getBucketLocation */
|
|
844
|
+
getBucketLocation(name: string): Promise<{
|
|
845
|
+
bucket: string;
|
|
846
|
+
kind: string;
|
|
847
|
+
region?: string;
|
|
848
|
+
endpoint?: string;
|
|
849
|
+
}>;
|
|
850
|
+
/** @see FlareStorage.createSignedUrl */
|
|
851
|
+
createSignedUrl(input: StorageSignedUrlInput): Promise<FlareStorageSignedUrlResult>;
|
|
618
852
|
auth(token: string): Promise<AuthResult>;
|
|
619
853
|
private getAuthRequestContentType;
|
|
620
854
|
private buildAuthRequestBody;
|
|
@@ -826,4 +1060,4 @@ declare class FlareClient<TPresetMap extends QueryPresetMap = {}> extends FlareA
|
|
|
826
1060
|
autoEnablePushNotifications(): Promise<void>;
|
|
827
1061
|
}
|
|
828
1062
|
|
|
829
|
-
export { type BaseMessage as B, type CollectionPresetMethods as C, DocumentQueryBuilder as D, FlareClient as F, type SubscribeMessage as S, type CollectionQuery as a, CollectionReference as b, DocumentReference as c, FlareAction as d, FlareEvent as e,
|
|
1063
|
+
export { type BaseMessage as B, type CollectionPresetMethods as C, DocumentQueryBuilder as D, FlareClient as F, type SubscribeMessage as S, type CollectionQuery as a, CollectionReference as b, DocumentReference as c, FlareAction as d, FlareEvent as e, FlareStorage as f, parseWhereCondition as g, parseValue as p };
|
|
@@ -62,6 +62,39 @@ interface FlareConfig {
|
|
|
62
62
|
* - join aliases (`join(..., { as: "team" })` => "team")
|
|
63
63
|
*/
|
|
64
64
|
dataMapper?: DataMapperRegistry;
|
|
65
|
+
/**
|
|
66
|
+
* Optional storage auto-provisioning config for bucket/server defaults.
|
|
67
|
+
*/
|
|
68
|
+
storage?: boolean | FlareStorageAutoConfig;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Options for storage auto-provisioning via `storage` in `FlareConfig`.
|
|
72
|
+
*/
|
|
73
|
+
interface FlareStorageAutoConfig {
|
|
74
|
+
/** Human-readable label for the auto-provisioned server. Defaults to `"default"`. */
|
|
75
|
+
name?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Bucket name. Defaults to `"<appId>-storage"`.
|
|
78
|
+
* Must be unique per app per backend kind (embedded vs S3).
|
|
79
|
+
*/
|
|
80
|
+
bucket?: string;
|
|
81
|
+
/** Optional key prefix applied to all objects inside the bucket. */
|
|
82
|
+
prefix?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Built-in transfer manager settings.
|
|
85
|
+
*
|
|
86
|
+
* By default uploads/downloads are queued with concurrency 1 each so
|
|
87
|
+
* calling putObject/getObject without await remains safe.
|
|
88
|
+
*/
|
|
89
|
+
transferManager?: FlareStorageTransferManagerConfig;
|
|
90
|
+
}
|
|
91
|
+
interface FlareStorageTransferManagerConfig {
|
|
92
|
+
/** Enable built-in storage transfer queue. Defaults to true. */
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
/** Max concurrent uploads (putObject). Defaults to 1. */
|
|
95
|
+
uploadConcurrency?: number;
|
|
96
|
+
/** Max concurrent downloads (getObject). Defaults to 1. */
|
|
97
|
+
downloadConcurrency?: number;
|
|
65
98
|
}
|
|
66
99
|
type DataMapperFn<TRow = any, TMapped = any> = (row: TRow) => TMapped;
|
|
67
100
|
type DataMapperRegistry = Record<string, DataMapperFn<any, any>>;
|
|
@@ -169,6 +202,327 @@ interface PushSendResult {
|
|
|
169
202
|
invalidatedTokenCount: number;
|
|
170
203
|
dryRun: boolean;
|
|
171
204
|
}
|
|
205
|
+
interface FlareStorageServer {
|
|
206
|
+
id: string;
|
|
207
|
+
name: string;
|
|
208
|
+
kind: string;
|
|
209
|
+
endpoint: string;
|
|
210
|
+
bucket: string;
|
|
211
|
+
region: string;
|
|
212
|
+
prefix?: string;
|
|
213
|
+
dataDir?: string;
|
|
214
|
+
forcePathStyle?: boolean;
|
|
215
|
+
frozen?: boolean;
|
|
216
|
+
readOnly?: boolean;
|
|
217
|
+
createdAt?: unknown;
|
|
218
|
+
updatedAt?: unknown;
|
|
219
|
+
}
|
|
220
|
+
interface FlareStorageServerInput {
|
|
221
|
+
name: string;
|
|
222
|
+
kind?: string;
|
|
223
|
+
endpoint?: string;
|
|
224
|
+
bucket: string;
|
|
225
|
+
region?: string;
|
|
226
|
+
accessKey?: string;
|
|
227
|
+
secretKey?: string;
|
|
228
|
+
prefix?: string;
|
|
229
|
+
dataDir?: string;
|
|
230
|
+
forcePathStyle?: boolean;
|
|
231
|
+
frozen?: boolean;
|
|
232
|
+
readOnly?: boolean;
|
|
233
|
+
}
|
|
234
|
+
interface FlareStorageServerPatchInput {
|
|
235
|
+
name?: string;
|
|
236
|
+
endpoint?: string;
|
|
237
|
+
bucket?: string;
|
|
238
|
+
region?: string;
|
|
239
|
+
accessKey?: string;
|
|
240
|
+
secretKey?: string;
|
|
241
|
+
prefix?: string;
|
|
242
|
+
dataDir?: string;
|
|
243
|
+
forcePathStyle?: boolean;
|
|
244
|
+
frozen?: boolean;
|
|
245
|
+
readOnly?: boolean;
|
|
246
|
+
}
|
|
247
|
+
interface FlareStorageUploadInput {
|
|
248
|
+
serverId: string;
|
|
249
|
+
path: string;
|
|
250
|
+
contentBase64: string;
|
|
251
|
+
contentType?: string;
|
|
252
|
+
encrypt?: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface FlareStorageDownloadInput {
|
|
255
|
+
serverId: string;
|
|
256
|
+
path: string;
|
|
257
|
+
decrypt?: boolean;
|
|
258
|
+
}
|
|
259
|
+
interface FlareStorageDeleteInput {
|
|
260
|
+
serverId: string;
|
|
261
|
+
path: string;
|
|
262
|
+
}
|
|
263
|
+
interface FlareStorageObjectResult {
|
|
264
|
+
ok: boolean;
|
|
265
|
+
path: string;
|
|
266
|
+
key: string;
|
|
267
|
+
encrypted?: boolean;
|
|
268
|
+
size?: number;
|
|
269
|
+
contentBase64?: string;
|
|
270
|
+
contentType?: string;
|
|
271
|
+
}
|
|
272
|
+
declare enum FlareStorageSignedAction {
|
|
273
|
+
Upload = "upload",
|
|
274
|
+
Download = "download",
|
|
275
|
+
Delete = "delete",
|
|
276
|
+
Edit = "edit"
|
|
277
|
+
}
|
|
278
|
+
interface FlareStorageSignedUrlInput {
|
|
279
|
+
serverId: string;
|
|
280
|
+
path: string;
|
|
281
|
+
action: FlareStorageSignedAction;
|
|
282
|
+
expiresInSeconds?: number;
|
|
283
|
+
sizeBytes?: number;
|
|
284
|
+
contentType?: string;
|
|
285
|
+
encrypt?: boolean;
|
|
286
|
+
decrypt?: boolean;
|
|
287
|
+
forceDownload?: boolean;
|
|
288
|
+
allowedOrigins?: string[];
|
|
289
|
+
embedOnly?: boolean;
|
|
290
|
+
}
|
|
291
|
+
interface FlareStorageSignedUrlResult {
|
|
292
|
+
ok: boolean;
|
|
293
|
+
action: FlareStorageSignedAction;
|
|
294
|
+
method: "PUT" | "PATCH" | "GET" | "DELETE";
|
|
295
|
+
token: string;
|
|
296
|
+
urlPath: string;
|
|
297
|
+
url: string;
|
|
298
|
+
expiresInSeconds?: number;
|
|
299
|
+
expiresAt: number;
|
|
300
|
+
forceDownload?: boolean;
|
|
301
|
+
allowedOrigins?: string[];
|
|
302
|
+
embedOnly?: boolean;
|
|
303
|
+
}
|
|
304
|
+
interface FlareStorageAwsConfig {
|
|
305
|
+
kind: string;
|
|
306
|
+
endpoint: string;
|
|
307
|
+
region: string;
|
|
308
|
+
bucket: string;
|
|
309
|
+
prefix?: string;
|
|
310
|
+
dataDir?: string;
|
|
311
|
+
forcePathStyle?: boolean;
|
|
312
|
+
accessKeyId: string;
|
|
313
|
+
secretAccessKey: string;
|
|
314
|
+
}
|
|
315
|
+
interface FlareStorageRulesPolicy {
|
|
316
|
+
maxEntries?: number;
|
|
317
|
+
maxAgeDays?: number;
|
|
318
|
+
}
|
|
319
|
+
interface FlareStorageRulesHistoryResult {
|
|
320
|
+
history: unknown[];
|
|
321
|
+
policy: FlareStorageRulesPolicy;
|
|
322
|
+
restoreEvents: unknown[];
|
|
323
|
+
}
|
|
324
|
+
/** Upload progress snapshot. */
|
|
325
|
+
interface StorageProgress {
|
|
326
|
+
/** Bytes sent so far. */
|
|
327
|
+
loaded: number;
|
|
328
|
+
/** Total bytes to send. */
|
|
329
|
+
total: number;
|
|
330
|
+
/** 0–100. */
|
|
331
|
+
percent: number;
|
|
332
|
+
}
|
|
333
|
+
/** A bucket (backed by a flare storage server). */
|
|
334
|
+
interface StorageBucket {
|
|
335
|
+
/** Internal flare server ID. */
|
|
336
|
+
id: string;
|
|
337
|
+
/** Human-readable label. */
|
|
338
|
+
name: string;
|
|
339
|
+
/** Bucket name used on the backend (s3 bucket / embedded dir name). */
|
|
340
|
+
bucket: string;
|
|
341
|
+
/** Backend kind: "embedded" | "s3" | "managed". */
|
|
342
|
+
kind: string;
|
|
343
|
+
region?: string;
|
|
344
|
+
endpoint?: string;
|
|
345
|
+
prefix?: string;
|
|
346
|
+
frozen?: boolean;
|
|
347
|
+
readOnly?: boolean;
|
|
348
|
+
createdAt?: unknown;
|
|
349
|
+
updatedAt?: unknown;
|
|
350
|
+
}
|
|
351
|
+
/** Options for createBucket(). */
|
|
352
|
+
interface StorageBucketInput {
|
|
353
|
+
/**
|
|
354
|
+
* Backend kind. Defaults to "managed".
|
|
355
|
+
* "managed" lets flare-node choose embedded or s3-proxy based on server config.
|
|
356
|
+
*/
|
|
357
|
+
kind?: string;
|
|
358
|
+
prefix?: string;
|
|
359
|
+
region?: string;
|
|
360
|
+
/** Advanced: explicit s3 endpoint (only needed for kind="s3"). */
|
|
361
|
+
endpoint?: string;
|
|
362
|
+
accessKey?: string;
|
|
363
|
+
secretKey?: string;
|
|
364
|
+
dataDir?: string;
|
|
365
|
+
forcePathStyle?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/** Object metadata without content. */
|
|
368
|
+
interface StorageObjectMeta {
|
|
369
|
+
key: string;
|
|
370
|
+
bucket: string;
|
|
371
|
+
size: number;
|
|
372
|
+
contentType: string;
|
|
373
|
+
encrypted: boolean;
|
|
374
|
+
createdAt?: unknown;
|
|
375
|
+
updatedAt?: unknown;
|
|
376
|
+
}
|
|
377
|
+
/** Upload an object to a bucket. */
|
|
378
|
+
interface PutObjectInput {
|
|
379
|
+
bucket: string;
|
|
380
|
+
/** Object key (path inside the bucket). */
|
|
381
|
+
key: string;
|
|
382
|
+
/**
|
|
383
|
+
* Object body. Accepted forms:
|
|
384
|
+
* - `string` — UTF-8 text
|
|
385
|
+
* - `Uint8Array` / `ArrayBuffer` — raw bytes
|
|
386
|
+
* - `Blob` — browser File / Blob
|
|
387
|
+
* - `contentBase64` field on the object — pre-encoded base64 string
|
|
388
|
+
*/
|
|
389
|
+
body?: string | Uint8Array | ArrayBuffer | Blob;
|
|
390
|
+
/** Pre-encoded base64 body. Mutually exclusive with `body`. */
|
|
391
|
+
contentBase64?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Prefer legacy base64 upload path.
|
|
394
|
+
*
|
|
395
|
+
* Default is `false` (raw signed URL upload).
|
|
396
|
+
* If true and payload size exceeds `base64MaxBytes`, SDK auto-falls back to raw upload.
|
|
397
|
+
*/
|
|
398
|
+
base64?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Max payload bytes allowed for base64 path before auto-fallback to raw upload.
|
|
401
|
+
* Default: 4 MiB.
|
|
402
|
+
*/
|
|
403
|
+
base64MaxBytes?: number;
|
|
404
|
+
contentType?: string;
|
|
405
|
+
/** Encrypt at rest with AES-256-GCM. Defaults to true. */
|
|
406
|
+
encrypt?: boolean;
|
|
407
|
+
/** Upload progress callback. Only fires in browser environments. */
|
|
408
|
+
onProgress?: (progress: StorageProgress) => void;
|
|
409
|
+
}
|
|
410
|
+
interface PutObjectResult {
|
|
411
|
+
ok: boolean;
|
|
412
|
+
bucket: string;
|
|
413
|
+
key: string;
|
|
414
|
+
size: number;
|
|
415
|
+
encrypted: boolean;
|
|
416
|
+
}
|
|
417
|
+
interface GetObjectInput {
|
|
418
|
+
bucket: string;
|
|
419
|
+
key: string;
|
|
420
|
+
/** Decrypt on download. Defaults to true. */
|
|
421
|
+
decrypt?: boolean;
|
|
422
|
+
}
|
|
423
|
+
interface GetObjectResult {
|
|
424
|
+
ok: boolean;
|
|
425
|
+
bucket: string;
|
|
426
|
+
key: string;
|
|
427
|
+
/** Base64-encoded content. */
|
|
428
|
+
contentBase64: string;
|
|
429
|
+
contentType: string;
|
|
430
|
+
size: number;
|
|
431
|
+
encrypted: boolean;
|
|
432
|
+
}
|
|
433
|
+
interface GetObjectUrlInput {
|
|
434
|
+
bucket: string;
|
|
435
|
+
key: string;
|
|
436
|
+
/** Decrypt on download. Defaults to true. */
|
|
437
|
+
decrypt?: boolean;
|
|
438
|
+
/** Signed URL ttl in seconds. Defaults to server policy. */
|
|
439
|
+
expiresInSeconds?: number;
|
|
440
|
+
/** Force attachment response for browser-displayable media. */
|
|
441
|
+
forceDownload?: boolean;
|
|
442
|
+
/** Allowed request origins for accessing the signed file. Defaults to ["*"]. */
|
|
443
|
+
allowedOrigins?: string[];
|
|
444
|
+
/** Restrict access to embedded media contexts (<img>, <video>, <audio>). */
|
|
445
|
+
embedOnly?: boolean;
|
|
446
|
+
}
|
|
447
|
+
interface DownloadObjectInput extends GetObjectUrlInput {
|
|
448
|
+
/** Suggested filename for browser downloads. Defaults to key basename. */
|
|
449
|
+
filename?: string;
|
|
450
|
+
/** Open in a new tab instead of forcing attachment download. */
|
|
451
|
+
openInNewTab?: boolean;
|
|
452
|
+
}
|
|
453
|
+
interface DownloadObjectResult {
|
|
454
|
+
ok: boolean;
|
|
455
|
+
url: string;
|
|
456
|
+
filename: string;
|
|
457
|
+
/** True when browser click dispatch occurred. */
|
|
458
|
+
triggered: boolean;
|
|
459
|
+
}
|
|
460
|
+
interface HeadObjectInput {
|
|
461
|
+
bucket: string;
|
|
462
|
+
key: string;
|
|
463
|
+
}
|
|
464
|
+
interface HeadObjectsInput {
|
|
465
|
+
bucket: string;
|
|
466
|
+
keys: string[];
|
|
467
|
+
}
|
|
468
|
+
interface ListObjectsInput {
|
|
469
|
+
bucket: string;
|
|
470
|
+
/** Key prefix filter. */
|
|
471
|
+
prefix?: string;
|
|
472
|
+
limit?: number;
|
|
473
|
+
/** Continuation token from a previous ListObjectsResult. */
|
|
474
|
+
cursor?: string;
|
|
475
|
+
}
|
|
476
|
+
interface ListObjectsResult {
|
|
477
|
+
bucket: string;
|
|
478
|
+
objects: StorageObjectMeta[];
|
|
479
|
+
count: number;
|
|
480
|
+
hasMore: boolean;
|
|
481
|
+
/** Pass to the next listObjects() call to get the next page. */
|
|
482
|
+
cursor?: string;
|
|
483
|
+
}
|
|
484
|
+
interface CopyObjectInput {
|
|
485
|
+
sourceBucket: string;
|
|
486
|
+
sourceKey: string;
|
|
487
|
+
destBucket: string;
|
|
488
|
+
destKey: string;
|
|
489
|
+
}
|
|
490
|
+
interface DeleteObjectInput {
|
|
491
|
+
bucket: string;
|
|
492
|
+
key: string;
|
|
493
|
+
}
|
|
494
|
+
interface DeleteObjectsInput {
|
|
495
|
+
bucket: string;
|
|
496
|
+
keys: string[];
|
|
497
|
+
}
|
|
498
|
+
/** Signed URL input using bucket/key names instead of serverId. */
|
|
499
|
+
interface StorageSignedUrlInput {
|
|
500
|
+
bucket: string;
|
|
501
|
+
key: string;
|
|
502
|
+
action: FlareStorageSignedAction;
|
|
503
|
+
expiresInSeconds?: number;
|
|
504
|
+
sizeBytes?: number;
|
|
505
|
+
contentType?: string;
|
|
506
|
+
encrypt?: boolean;
|
|
507
|
+
decrypt?: boolean;
|
|
508
|
+
forceDownload?: boolean;
|
|
509
|
+
allowedOrigins?: string[];
|
|
510
|
+
embedOnly?: boolean;
|
|
511
|
+
}
|
|
512
|
+
/** Bucket-level security rules. Maps to flare storage rules DSL. */
|
|
513
|
+
interface BucketPolicyInput {
|
|
514
|
+
rulesDsl?: string;
|
|
515
|
+
rules?: Record<string, unknown>;
|
|
516
|
+
rulesHistoryPolicy?: FlareStorageRulesPolicy;
|
|
517
|
+
}
|
|
518
|
+
/** CORS rule for a bucket. */
|
|
519
|
+
interface BucketCorsRule {
|
|
520
|
+
allowedOrigins: string[];
|
|
521
|
+
allowedMethods: ("GET" | "PUT" | "POST" | "DELETE" | "HEAD")[];
|
|
522
|
+
allowedHeaders?: string[];
|
|
523
|
+
exposeHeaders?: string[];
|
|
524
|
+
maxAgeSeconds?: number;
|
|
525
|
+
}
|
|
172
526
|
interface SendEmailInput {
|
|
173
527
|
to: string | string[];
|
|
174
528
|
tag: string;
|
|
@@ -508,4 +862,4 @@ type SecurityRulesMap = Record<string, SecurityRuleEntry>;
|
|
|
508
862
|
declare const flareRulesToSecurityMap: (rules: FlareRule[]) => SecurityRulesMap;
|
|
509
863
|
declare const securityMapToFlareRules: (rules: SecurityRulesMap) => FlareRule[];
|
|
510
864
|
|
|
511
|
-
export { type
|
|
865
|
+
export { type FlareStorageServerInput as $, type AggregateFunction as A, type BrowserPushRegistrationOptions as B, type ChangeEvent as C, type DataMapperFn as D, type DocUpdatedCallback as E, type FlareConfig as F, type DocumentSnapshot as G, type DownloadObjectInput as H, type DownloadObjectResult as I, type EmailLinkVerifyResult as J, type EmailSendResult as K, type FlareAuthConfig as L, type FlareAuthHydrationInput as M, type FlareAuthHydrationOptions as N, type FlareAuthProviderId as O, type FlareAuthProviderPublicConfig as P, type FlareAuthSession as Q, type FlareAuthUser as R, type FlareRule as S, type FlareStorageAutoConfig as T, type FlareStorageAwsConfig as U, type FlareStorageDeleteInput as V, type FlareStorageDownloadInput as W, type FlareStorageObjectResult as X, type FlareStorageRulesHistoryResult as Y, type FlareStorageRulesPolicy as Z, type FlareStorageServer as _, type AggregateSpec as a, type FlareStorageServerPatchInput as a0, FlareStorageSignedAction as a1, type FlareStorageSignedUrlInput as a2, type FlareStorageSignedUrlResult as a3, type FlareStorageTransferManagerConfig as a4, type FlareStorageUploadInput as a5, type GetObjectInput as a6, type GetObjectResult as a7, type GetObjectUrlInput as a8, type GroupByClause as a9, type RulePermission as aA, type SecurityRuleEntry as aB, type SecurityRulesMap as aC, type SendEmailInput as aD, type SendPushNotificationInput as aE, type SnapshotEvent as aF, type StorageBucket as aG, type StorageBucketInput as aH, type StorageObjectMeta as aI, type StorageProgress as aJ, type StorageSignedUrlInput as aK, type StreamFlushReason as aL, type StructuredJoinClause as aM, type StructuredQuery as aN, type SubscribeOptions as aO, type SubscriptionCallback as aP, type SubscriptionData as aQ, type SubscriptionError as aR, type SubscriptionErrorCallback as aS, type SubscriptionHandle as aT, type VectorFieldConfig as aU, type VectorSearchClause as aV, type VerifyEmailLinkInput as aW, type WhereCondition as aX, flareRulesToSecurityMap as aY, securityMapToFlareRules as aZ, type HavingClause as aa, type HeadObjectInput as ab, type HeadObjectsInput as ac, type JoinClause as ad, type JoinQueryPattern as ae, type ListObjectsInput as af, type ListObjectsResult as ag, type NestedJoinClause as ah, type OfflineOperation as ai, type OrFilter as aj, type OrderByClause as ak, type PresenceCallback as al, type PresenceJoinCallback as am, type PresenceLeaveCallback as an, type PresenceMember as ao, type PushSendResult as ap, type PutObjectInput as aq, type PutObjectResult as ar, type QueryConfig as as, type QueryOperator as at, type QueryPresetMap as au, type QueryPresetParams as av, type QueryPresetRow as aw, type QueryPresetSpec as ax, type QuerySnapshot as ay, type RegisterPushTokenInput as az, type AndFilter as b, type AnyFilter as c, type AuthConfigListener as d, type AuthResult as e, type AuthStateListener as f, type AuthWithPendingVerificationResult as g, type AuthWithTokenResult as h, type BrowserPushTokenOptions as i, type BucketCorsRule as j, type BucketPolicyInput as k, type ChangeOperation as l, type CollectionExternalStore as m, type CollectionStream as n, type CollectionStreamListener as o, type CollectionStreamMeta as p, type CollectionStreamOptions as q, type ConnectionState as r, type CopyObjectInput as s, type CursorValue as t, type DataMapperRegistry as u, type DeleteObjectInput as v, type DeleteObjectsInput as w, type DocAddedCallback as x, type DocChangedCallback as y, type DocDeletedCallback as z };
|