@acorex/connectivity 20.6.0-next.23 → 20.6.0-next.25

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.
@@ -1215,6 +1215,7 @@ class AXCFileStorageService {
1215
1215
  const updatedFileInfo = {
1216
1216
  ...file,
1217
1217
  ...request.metadata,
1218
+ name: request.name !== undefined ? request.name : file.name,
1218
1219
  isPrimary: request.isPrimary !== undefined ? request.isPrimary : file.isPrimary,
1219
1220
  };
1220
1221
  await db.files.put(updatedFileInfo);
@@ -46498,7 +46499,7 @@ async function updateChildrenCountForParent(ctx, entityDataBeforeDelete) {
46498
46499
  * - Converts file IDs back to AXPFileListItem objects for UI display
46499
46500
  *
46500
46501
  * File Status Handling:
46501
- * - 'uploaded'/'remote': Keep existing file ID
46502
+ * - 'uploaded'/'remote'/'editing': Keep existing file ID
46502
46503
  * - 'deleted': Remove from storage, exclude from entity
46503
46504
  * - 'attached'/'uploading': Upload new file
46504
46505
  */
@@ -46531,7 +46532,7 @@ const createFileCastMiddleware = {
46531
46532
  // Must have either:
46532
46533
  // 1. A valid file status (indicating it's from file uploader)
46533
46534
  // 2. A valid source with file-specific kind
46534
- const hasValidStatus = obj.status && ['attached', 'uploading', 'uploaded', 'deleted', 'remote'].includes(obj.status);
46535
+ const hasValidStatus = obj.status && ['attached', 'uploading', 'uploaded', 'deleted', 'remote', 'editing'].includes(obj.status);
46535
46536
  const hasValidSource = obj.source &&
46536
46537
  typeof obj.source === 'object' &&
46537
46538
  obj.source.kind &&
@@ -46650,10 +46651,28 @@ const createFileCastMiddleware = {
46650
46651
  return { id: serializeReference(reference), kind: 'reference' };
46651
46652
  }
46652
46653
  // Case 3: Already uploaded file (keep existing ID)
46653
- if ((file.status === 'uploaded' || file.status === 'remote') &&
46654
+ // Also handle 'editing' status - files being edited should be treated like uploaded files
46655
+ if ((file.status === 'uploaded' || file.status === 'remote' || file.status === 'editing') &&
46654
46656
  file.source?.kind === 'fileId' &&
46655
46657
  typeof file.source.value === 'string') {
46656
46658
  const cleanFileId = ensureCleanFileId(file.source.value);
46659
+ // If status is 'editing', check if name has changed and update file storage
46660
+ if (file.status === 'editing') {
46661
+ try {
46662
+ const existingFileInfo = await fileStorageService.getInfo(cleanFileId);
46663
+ // If name has changed, update the file in storage
46664
+ if (existingFileInfo && existingFileInfo.name !== file.name) {
46665
+ await fileStorageService.update({
46666
+ fileId: cleanFileId,
46667
+ name: file.name,
46668
+ metadata: existingFileInfo.metadata || {},
46669
+ });
46670
+ }
46671
+ }
46672
+ catch (error) {
46673
+ console.error('[file-cast] Failed to update file name during editing:', error);
46674
+ }
46675
+ }
46657
46676
  // If it already has an ID and also carries meta, prefer returning as a document reference (if possible)
46658
46677
  if (hasDocumentMeta(file)) {
46659
46678
  if (documentService) {