@firecms/core 3.0.0-canary.295 → 3.0.0-canary.297

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.
@@ -21,6 +21,15 @@ export interface UploadFileResult {
21
21
  * Bucket where the file was uploaded
22
22
  */
23
23
  bucket: string;
24
+
25
+ /**
26
+ * Fully qualified storage URL for the uploaded file.
27
+ *
28
+ * For example: `gs://my-bucket/path/to/file.png`.
29
+ *
30
+ * This is optional for backwards compatibility.
31
+ */
32
+ storageUrl?: string;
24
33
  }
25
34
 
26
35
  /**
@@ -122,7 +122,6 @@ export function hasEntityInCache(path: string): boolean {
122
122
  * Retrieves an entity from the in-memory cache or `localStorage`.
123
123
  * If the entity is not in the cache but exists in `localStorage`, it loads it into the cache.
124
124
  * @param path - The unique path/key for the entity.
125
- * @param useLocalStorage
126
125
  * @returns The cached entity or `undefined` if not found.
127
126
  */
128
127
  export function getEntityFromCache(path: string): object | undefined {
@@ -134,10 +133,6 @@ export function getEntityFromCache(path: string): object | undefined {
134
133
  const entityString = localStorage.getItem(key);
135
134
  if (entityString) {
136
135
  const entity: object = JSON.parse(entityString, customReviver);
137
- console.log("Loaded entity from localStorage:", {
138
- key,
139
- entity
140
- });
141
136
  return entity;
142
137
  }
143
138
  } catch (error) {
@@ -134,11 +134,21 @@ export function useStorageUploadController<M extends object>({
134
134
 
135
135
  const onFileUploadComplete = useCallback(async (uploadedPath: string,
136
136
  entry: StorageFieldItem,
137
- metadata?: any) => {
137
+ metadata?: any,
138
+ uploadedUrl?: string) => {
138
139
 
139
140
  console.debug("onFileUploadComplete", uploadedPath, entry);
140
141
 
141
142
  let uploadPathOrDownloadUrl: string | null = uploadedPath;
143
+
144
+ if (storage.includeBucketUrl) {
145
+ if (!uploadedUrl) {
146
+ console.warn("includeBucketUrl is set but no fully-qualified storage URL was returned by the StorageSource. Falling back to the storage path.");
147
+ } else {
148
+ uploadPathOrDownloadUrl = uploadedUrl;
149
+ }
150
+ }
151
+
142
152
  if (storage.storeUrl) {
143
153
  uploadPathOrDownloadUrl = (await storageSource.getDownloadURL(uploadedPath)).url;
144
154
  }