@zuzjs/flare 0.2.21 → 0.2.22

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 CHANGED
@@ -593,6 +593,10 @@ const uploaded = await storage.putObject({
593
593
  },
594
594
  });
595
595
 
596
+ console.log(uploaded.key); // users/alice.png
597
+ console.log(uploaded.access); // public (default)
598
+ console.log(uploaded.url); // https://.../storage/public/<appId>/avatars/users%2Falice.png
599
+
596
600
  // ── Base64 upload (opt-in, small files only) ─────────────────────────────────
597
601
  // Pass `base64: true` to use the legacy base64-over-JSON path.
598
602
  // If the payload exceeds `base64MaxBytes` (default 4 MiB), the SDK
@@ -602,6 +606,7 @@ const uploaded2 = await storage.putObject({
602
606
  key: 'users/thumb.png',
603
607
  body: smallFileBytes,
604
608
  contentType: 'image/png',
609
+ access: 'private', // override the default public access
605
610
  base64: true, // prefer base64 path
606
611
  base64MaxBytes: 2 * 1024 * 1024, // cap at 2 MiB; larger → raw upload
607
612
  });
@@ -612,12 +617,17 @@ const uploaded3 = await storage.putObject({
612
617
  key: 'users/icon.png',
613
618
  contentBase64: alreadyEncodedString,
614
619
  contentType: 'image/png',
620
+ // encrypt defaults to false when omitted
615
621
  });
616
622
 
617
623
  const head = await storage.headObject({ bucket: 'avatars', key: uploaded.key });
624
+ console.log(head.access, head.url);
625
+
618
626
  const file = await storage.getObject({ bucket: 'avatars', key: uploaded.key });
619
627
 
620
628
  const page1 = await storage.listObjects({ bucket: 'avatars', prefix: 'users/', limit: 100 });
629
+ console.log(page1.objects[0]?.access, page1.objects[0]?.url);
630
+
621
631
  const page2 = page1.cursor
622
632
  ? await storage.listObjects({ bucket: 'avatars', prefix: 'users/', limit: 100, cursor: page1.cursor })
623
633
  : { objects: [] };
@@ -640,6 +650,7 @@ const signedUpload = await storage.createSignedUrl({
640
650
  action: FlareStorageSignedAction.Upload,
641
651
  expiresInSeconds: 300,
642
652
  contentType: 'video/mp4',
653
+ access: 'private',
643
654
  encrypt: true,
644
655
  });
645
656
 
@@ -723,6 +734,9 @@ const embedUrl = await storage.getObjectUrl({
723
734
  ```
724
735
 
725
736
  Notes:
737
+ - `putObject()` defaults to `encrypt: false` and `access: 'public'`.
738
+ - `uploaded.url` is the stable public object URL shape. Anonymous reads still depend on stored `access` and any storage rules configured on the app.
739
+ - `headObject()` and `listObjects()` also return `access` and `url` metadata.
726
740
  - `forceDownload` and `embedOnly` are mutually exclusive.
727
741
  - `allowedOrigins` defaults to `['*']` when omitted.
728
742
  - `embedOnly` is valid only for download signed URLs.
package/dist/grpc.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { F as FlareConfig, aR as StructuredQuery } from './index-DlQgWDy-.cjs';
1
+ import { F as FlareConfig, aR as StructuredQuery } from './index-18tMqAtM.cjs';
2
2
  import '@zuzjs/auth';
3
3
 
4
4
  declare function runGrpcQuery<T = Record<string, unknown>>(config: FlareConfig, collection: string, query: StructuredQuery): Promise<T[] | null>;
package/dist/grpc.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { F as FlareConfig, aR as StructuredQuery } from './index-DlQgWDy-.js';
1
+ import { F as FlareConfig, aR as StructuredQuery } from './index-18tMqAtM.js';
2
2
  import '@zuzjs/auth';
3
3
 
4
4
  declare function runGrpcQuery<T = Record<string, unknown>>(config: FlareConfig, collection: string, query: StructuredQuery): Promise<T[] | null>;
@@ -264,6 +264,8 @@ interface FlareStorageObjectResult {
264
264
  ok: boolean;
265
265
  path: string;
266
266
  key: string;
267
+ access?: "public" | "private";
268
+ url?: string;
267
269
  encrypted?: boolean;
268
270
  size?: number;
269
271
  contentBase64?: string;
@@ -282,6 +284,7 @@ interface FlareStorageSignedUrlInput {
282
284
  expiresInSeconds?: number;
283
285
  sizeBytes?: number;
284
286
  contentType?: string;
287
+ access?: "public" | "private";
285
288
  encrypt?: boolean;
286
289
  decrypt?: boolean;
287
290
  forceDownload?: boolean;
@@ -370,6 +373,8 @@ interface StorageObjectMeta {
370
373
  bucket: string;
371
374
  size: number;
372
375
  contentType: string;
376
+ access?: "public" | "private";
377
+ url?: string;
373
378
  encrypted: boolean;
374
379
  createdAt?: unknown;
375
380
  updatedAt?: unknown;
@@ -402,7 +407,9 @@ interface PutObjectInput {
402
407
  */
403
408
  base64MaxBytes?: number;
404
409
  contentType?: string;
405
- /** Encrypt at rest with AES-256-GCM. Defaults to true. */
410
+ /** Public/private object access. Defaults to public. */
411
+ access?: "public" | "private";
412
+ /** Encrypt at rest with AES-256-GCM. Defaults to false. */
406
413
  encrypt?: boolean;
407
414
  /** Upload progress callback. Only fires in browser environments. */
408
415
  onProgress?: (progress: StorageProgress) => void;
@@ -411,6 +418,8 @@ interface PutObjectResult {
411
418
  ok: boolean;
412
419
  bucket: string;
413
420
  key: string;
421
+ access: "public" | "private";
422
+ url?: string;
414
423
  size: number;
415
424
  encrypted: boolean;
416
425
  }
@@ -503,6 +512,7 @@ interface StorageSignedUrlInput {
503
512
  expiresInSeconds?: number;
504
513
  sizeBytes?: number;
505
514
  contentType?: string;
515
+ access?: "public" | "private";
506
516
  encrypt?: boolean;
507
517
  decrypt?: boolean;
508
518
  forceDownload?: boolean;
@@ -264,6 +264,8 @@ interface FlareStorageObjectResult {
264
264
  ok: boolean;
265
265
  path: string;
266
266
  key: string;
267
+ access?: "public" | "private";
268
+ url?: string;
267
269
  encrypted?: boolean;
268
270
  size?: number;
269
271
  contentBase64?: string;
@@ -282,6 +284,7 @@ interface FlareStorageSignedUrlInput {
282
284
  expiresInSeconds?: number;
283
285
  sizeBytes?: number;
284
286
  contentType?: string;
287
+ access?: "public" | "private";
285
288
  encrypt?: boolean;
286
289
  decrypt?: boolean;
287
290
  forceDownload?: boolean;
@@ -370,6 +373,8 @@ interface StorageObjectMeta {
370
373
  bucket: string;
371
374
  size: number;
372
375
  contentType: string;
376
+ access?: "public" | "private";
377
+ url?: string;
373
378
  encrypted: boolean;
374
379
  createdAt?: unknown;
375
380
  updatedAt?: unknown;
@@ -402,7 +407,9 @@ interface PutObjectInput {
402
407
  */
403
408
  base64MaxBytes?: number;
404
409
  contentType?: string;
405
- /** Encrypt at rest with AES-256-GCM. Defaults to true. */
410
+ /** Public/private object access. Defaults to public. */
411
+ access?: "public" | "private";
412
+ /** Encrypt at rest with AES-256-GCM. Defaults to false. */
406
413
  encrypt?: boolean;
407
414
  /** Upload progress callback. Only fires in browser environments. */
408
415
  onProgress?: (progress: StorageProgress) => void;
@@ -411,6 +418,8 @@ interface PutObjectResult {
411
418
  ok: boolean;
412
419
  bucket: string;
413
420
  key: string;
421
+ access: "public" | "private";
422
+ url?: string;
414
423
  size: number;
415
424
  encrypted: boolean;
416
425
  }
@@ -503,6 +512,7 @@ interface StorageSignedUrlInput {
503
512
  expiresInSeconds?: number;
504
513
  sizeBytes?: number;
505
514
  contentType?: string;
515
+ access?: "public" | "private";
506
516
  encrypt?: boolean;
507
517
  decrypt?: boolean;
508
518
  forceDownload?: boolean;
@@ -1,4 +1,4 @@
1
- import { b0 as WhereCondition, aT as SubscriptionCallback, aw as QueryConfig, J as DocUpdatedCallback, I as DocDeletedCallback, H as DocChangedCallback, ay as QueryPresetMap, az as QueryPresetParams, aA as QueryPresetRow, a as AggregateSpec, ae as HavingClause, ah as JoinClause, a_ as VectorSearchClause, aR as StructuredQuery, aX as SubscriptionHandle, u as CollectionStreamOptions, r as CollectionStream, q as CollectionExternalStore, G as DocAddedCallback, m as BulkWriteOptions, o as BulkWriteResult, aY as UpdateManyItem, F as FlareConfig, aS as SubscribeOptions, aW as SubscriptionErrorCallback, aV as SubscriptionError, v as ConnectionState, ap as PresenceCallback, aq as PresenceJoinCallback, ar as PresenceLeaveCallback, aZ as VectorFieldConfig, aB as QueryPresetSpec, a8 as FlareStorageTransferManagerConfig, aN as StorageProgress, aL as StorageBucketInput, aK as StorageBucket, k as BucketPolicyInput, a1 as FlareStorageRulesPolicy, j as BucketCorsRule, a0 as FlareStorageRulesHistoryResult, au as PutObjectInput, av as PutObjectResult, aa as GetObjectInput, ab as GetObjectResult, ac as GetObjectUrlInput, L as DownloadObjectInput, M as DownloadObjectResult, af as HeadObjectInput, aM as StorageObjectMeta, ag as HeadObjectsInput, aj as ListObjectsInput, ak as ListObjectsResult, w as CopyObjectInput, z as DeleteObjectInput, E as DeleteObjectsInput, aO as StorageSignedUrlInput, a7 as FlareStorageSignedUrlResult, P as FlareAuthConfig, f as AuthStateListener, d as AuthConfigListener, U as FlareAuthSession, V as FlareAuthUser, Q as FlareAuthHydrationInput, R as FlareAuthHydrationOptions, i as BrowserPushTokenOptions, B as BrowserPushRegistrationOptions, aD as RegisterPushTokenInput, aI as SendPushNotificationInput, at as PushSendResult, e as AuthResult } from './index-DlQgWDy-.js';
1
+ import { b0 as WhereCondition, aT as SubscriptionCallback, aw as QueryConfig, J as DocUpdatedCallback, I as DocDeletedCallback, H as DocChangedCallback, ay as QueryPresetMap, az as QueryPresetParams, aA as QueryPresetRow, a as AggregateSpec, ae as HavingClause, ah as JoinClause, a_ as VectorSearchClause, aR as StructuredQuery, aX as SubscriptionHandle, u as CollectionStreamOptions, r as CollectionStream, q as CollectionExternalStore, G as DocAddedCallback, m as BulkWriteOptions, o as BulkWriteResult, aY as UpdateManyItem, F as FlareConfig, aS as SubscribeOptions, aW as SubscriptionErrorCallback, aV as SubscriptionError, v as ConnectionState, ap as PresenceCallback, aq as PresenceJoinCallback, ar as PresenceLeaveCallback, aZ as VectorFieldConfig, aB as QueryPresetSpec, a8 as FlareStorageTransferManagerConfig, aN as StorageProgress, aL as StorageBucketInput, aK as StorageBucket, k as BucketPolicyInput, a1 as FlareStorageRulesPolicy, j as BucketCorsRule, a0 as FlareStorageRulesHistoryResult, au as PutObjectInput, av as PutObjectResult, aa as GetObjectInput, ab as GetObjectResult, ac as GetObjectUrlInput, L as DownloadObjectInput, M as DownloadObjectResult, af as HeadObjectInput, aM as StorageObjectMeta, ag as HeadObjectsInput, aj as ListObjectsInput, ak as ListObjectsResult, w as CopyObjectInput, z as DeleteObjectInput, E as DeleteObjectsInput, aO as StorageSignedUrlInput, a7 as FlareStorageSignedUrlResult, P as FlareAuthConfig, f as AuthStateListener, d as AuthConfigListener, U as FlareAuthSession, V as FlareAuthUser, Q as FlareAuthHydrationInput, R as FlareAuthHydrationOptions, i as BrowserPushTokenOptions, B as BrowserPushRegistrationOptions, aD as RegisterPushTokenInput, aI as SendPushNotificationInput, at as PushSendResult, e as AuthResult } from './index-18tMqAtM.js';
2
2
  import { AuthToken } from '@zuzjs/auth';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { b0 as WhereCondition, aT as SubscriptionCallback, aw as QueryConfig, J as DocUpdatedCallback, I as DocDeletedCallback, H as DocChangedCallback, ay as QueryPresetMap, az as QueryPresetParams, aA as QueryPresetRow, a as AggregateSpec, ae as HavingClause, ah as JoinClause, a_ as VectorSearchClause, aR as StructuredQuery, aX as SubscriptionHandle, u as CollectionStreamOptions, r as CollectionStream, q as CollectionExternalStore, G as DocAddedCallback, m as BulkWriteOptions, o as BulkWriteResult, aY as UpdateManyItem, F as FlareConfig, aS as SubscribeOptions, aW as SubscriptionErrorCallback, aV as SubscriptionError, v as ConnectionState, ap as PresenceCallback, aq as PresenceJoinCallback, ar as PresenceLeaveCallback, aZ as VectorFieldConfig, aB as QueryPresetSpec, a8 as FlareStorageTransferManagerConfig, aN as StorageProgress, aL as StorageBucketInput, aK as StorageBucket, k as BucketPolicyInput, a1 as FlareStorageRulesPolicy, j as BucketCorsRule, a0 as FlareStorageRulesHistoryResult, au as PutObjectInput, av as PutObjectResult, aa as GetObjectInput, ab as GetObjectResult, ac as GetObjectUrlInput, L as DownloadObjectInput, M as DownloadObjectResult, af as HeadObjectInput, aM as StorageObjectMeta, ag as HeadObjectsInput, aj as ListObjectsInput, ak as ListObjectsResult, w as CopyObjectInput, z as DeleteObjectInput, E as DeleteObjectsInput, aO as StorageSignedUrlInput, a7 as FlareStorageSignedUrlResult, P as FlareAuthConfig, f as AuthStateListener, d as AuthConfigListener, U as FlareAuthSession, V as FlareAuthUser, Q as FlareAuthHydrationInput, R as FlareAuthHydrationOptions, i as BrowserPushTokenOptions, B as BrowserPushRegistrationOptions, aD as RegisterPushTokenInput, aI as SendPushNotificationInput, at as PushSendResult, e as AuthResult } from './index-DlQgWDy-.cjs';
1
+ import { b0 as WhereCondition, aT as SubscriptionCallback, aw as QueryConfig, J as DocUpdatedCallback, I as DocDeletedCallback, H as DocChangedCallback, ay as QueryPresetMap, az as QueryPresetParams, aA as QueryPresetRow, a as AggregateSpec, ae as HavingClause, ah as JoinClause, a_ as VectorSearchClause, aR as StructuredQuery, aX as SubscriptionHandle, u as CollectionStreamOptions, r as CollectionStream, q as CollectionExternalStore, G as DocAddedCallback, m as BulkWriteOptions, o as BulkWriteResult, aY as UpdateManyItem, F as FlareConfig, aS as SubscribeOptions, aW as SubscriptionErrorCallback, aV as SubscriptionError, v as ConnectionState, ap as PresenceCallback, aq as PresenceJoinCallback, ar as PresenceLeaveCallback, aZ as VectorFieldConfig, aB as QueryPresetSpec, a8 as FlareStorageTransferManagerConfig, aN as StorageProgress, aL as StorageBucketInput, aK as StorageBucket, k as BucketPolicyInput, a1 as FlareStorageRulesPolicy, j as BucketCorsRule, a0 as FlareStorageRulesHistoryResult, au as PutObjectInput, av as PutObjectResult, aa as GetObjectInput, ab as GetObjectResult, ac as GetObjectUrlInput, L as DownloadObjectInput, M as DownloadObjectResult, af as HeadObjectInput, aM as StorageObjectMeta, ag as HeadObjectsInput, aj as ListObjectsInput, ak as ListObjectsResult, w as CopyObjectInput, z as DeleteObjectInput, E as DeleteObjectsInput, aO as StorageSignedUrlInput, a7 as FlareStorageSignedUrlResult, P as FlareAuthConfig, f as AuthStateListener, d as AuthConfigListener, U as FlareAuthSession, V as FlareAuthUser, Q as FlareAuthHydrationInput, R as FlareAuthHydrationOptions, i as BrowserPushTokenOptions, B as BrowserPushRegistrationOptions, aD as RegisterPushTokenInput, aI as SendPushNotificationInput, at as PushSendResult, e as AuthResult } from './index-18tMqAtM.cjs';
2
2
  import { AuthToken } from '@zuzjs/auth';
3
3
 
4
4
  /**