@ai-matrx/media 0.10.6 → 0.11.0

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/files.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { AudioMediaPart, AudioOutputData, VideoMediaPart, VideoOutputData, ImageMediaPart, ImageOutputData, PartialImageData, RenderBlockPayload } from '@ai-matrx/agents/generated/stream-events';
2
2
  import * as react from 'react';
3
+ import { FileErrorCode, FileError } from '@ai-matrx/data/files';
4
+ export { ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError as FileHandlerError, FileNotFoundError, FileUploadError, ShareLinkInvalidError } from '@ai-matrx/data/files';
3
5
 
4
6
  /**
5
7
  * files/ref-types — the Matrx file reference vocabulary shared by every client:
@@ -744,44 +746,8 @@ declare function VideoPublishDate({ publishedAt, className, }: {
744
746
  * - a transient auth failure on a durable URL → refresh the file session
745
747
  * (see ../session.ts) and retry the SAME URL; never a terminal error.
746
748
  */
747
- type FileHandlerErrorCode = "access_denied" | "not_found" | "deleted" | "share_link_invalid" | "external_fetch_failed" | "cors_blocked" | "mime_unknown" | "upload_failed" | "upload_cancelled" | "quota_exceeded" | "in_flight" | "internal";
748
- declare class FileHandlerError extends Error {
749
- readonly code: FileHandlerErrorCode;
750
- readonly fileId?: string | undefined;
751
- readonly cause?: unknown;
752
- constructor(code: FileHandlerErrorCode, message: string, opts?: {
753
- fileId?: string;
754
- cause?: unknown;
755
- });
756
- }
757
- declare class FileAccessDeniedError extends FileHandlerError {
758
- constructor(message?: string, opts?: {
759
- fileId?: string;
760
- });
761
- }
762
- declare class FileNotFoundError extends FileHandlerError {
763
- constructor(message?: string, opts?: {
764
- fileId?: string;
765
- });
766
- }
767
- declare class FileDeletedError extends FileHandlerError {
768
- constructor(message?: string, opts?: {
769
- fileId?: string;
770
- });
771
- }
772
- declare class ShareLinkInvalidError extends FileHandlerError {
773
- constructor(message?: string);
774
- }
775
- declare class ExternalFetchError extends FileHandlerError {
776
- constructor(message?: string, opts?: {
777
- cause?: unknown;
778
- });
779
- }
780
- declare class FileUploadError extends FileHandlerError {
781
- constructor(message: string, opts?: {
782
- cause?: unknown;
783
- });
784
- }
749
+
750
+ type FileHandlerErrorCode = FileErrorCode;
785
751
  /**
786
752
  * The person was asked which workspace an upload belongs to and declined.
787
753
  *
@@ -790,7 +756,7 @@ declare class FileUploadError extends FileHandlerError {
790
756
  * report. Every catch site must swallow it silently — cancelling has to return
791
757
  * the person exactly where they were, which a red toast does not.
792
758
  */
793
- declare class UploadCancelledError extends FileHandlerError {
759
+ declare class UploadCancelledError extends FileError {
794
760
  constructor(message?: string);
795
761
  }
796
762
  declare function isUploadCancelledError(error: unknown): boolean;
@@ -1168,4 +1134,4 @@ declare function createTrackedObjectUrl(blob: Blob): string;
1168
1134
  /** Explicitly revoke a tracked URL when a consumer knows it is finished. */
1169
1135
  declare function revokeTrackedObjectUrl(url: string | undefined | null): void;
1170
1136
 
1171
- export { type AudioBlock, CloudFolderDescriptions, CloudFolders, type DocumentBlock, type ExternalAudioBlock, type ExternalDocumentBlock, ExternalFetchError, type ExternalImageBlock, type ExternalVideoBlock, FileAccessDeniedError, FileDeletedError, FileHandlerError, type FileHandlerErrorCode, type FileIdentityHint, FileNotFoundError, FileUploadError, type ImageBlock, type MatrxAudioBlock, type MatrxDocumentBlock, type MatrxImageBlock, type MatrxVideoBlock, type MediaBlockKindArg, type MediaGenerationKind, type MediaGenerationMetadata, type MediaGenerationMetadataWire, type MediaKind, type MediaOrigin, type MediaRef, type MediaStatus, type MediaVisibility, type PermissionLevel, ShareLinkInvalidError, type UnifiedImageBlock, type UnifiedMediaBlock, UploadCancelledError, type VideoBlock, VideoPublishDate, type Visibility, type WireMediaBlock, type WireMediaBlockData, type YouTubeBlock, blockFromMediaRef, composeUploadFolderPath, createTrackedObjectUrl, deriveViewerUrl, extractFileIdFromUrl, fileIdToMediaRef, folderForAgentApp, folderForAgentBlock, folderForCaptures, folderForConversation, folderForIntakeAsset, folderForOrg, folderForPodcast, folderForProductCaptureItem, folderForTask, folderForWarRoomThread, formatVideoPublishDate, formatVideoPublishDateTitle, fromCxAudioPart, fromCxMediaPart, fromCxVideoPart, fromImageOutputData, fromMediaBlock, fromPartialImageData, fromRenderBlock, imageBlockFromMediaRef, isAudioBlock, isConventionalFolder, isDocumentBlock, isExternalImageBlock, isExternalMediaBlock, isHiddenFolder, isImageBlock, isMatrxImageBlock, isMatrxMediaBlock, isMediaBlockData, isSystemPath, isUnifiedImageBlock, isUnifiedMediaBlock, isUploadCancelledError, isVideoBlock, isYouTubeBlock, parseFilenameFromUrl, parseGenerationMetadata, resolveDefaultVisibility, revokeTrackedObjectUrl, toCxMediaPart, toVisibility, urlToMediaRef, videoBlockFromMediaRef, videoPublishDateFromMetadata };
1137
+ export { type AudioBlock, CloudFolderDescriptions, CloudFolders, type DocumentBlock, type ExternalAudioBlock, type ExternalDocumentBlock, type ExternalImageBlock, type ExternalVideoBlock, type FileHandlerErrorCode, type FileIdentityHint, type ImageBlock, type MatrxAudioBlock, type MatrxDocumentBlock, type MatrxImageBlock, type MatrxVideoBlock, type MediaBlockKindArg, type MediaGenerationKind, type MediaGenerationMetadata, type MediaGenerationMetadataWire, type MediaKind, type MediaOrigin, type MediaRef, type MediaStatus, type MediaVisibility, type PermissionLevel, type UnifiedImageBlock, type UnifiedMediaBlock, UploadCancelledError, type VideoBlock, VideoPublishDate, type Visibility, type WireMediaBlock, type WireMediaBlockData, type YouTubeBlock, blockFromMediaRef, composeUploadFolderPath, createTrackedObjectUrl, deriveViewerUrl, extractFileIdFromUrl, fileIdToMediaRef, folderForAgentApp, folderForAgentBlock, folderForCaptures, folderForConversation, folderForIntakeAsset, folderForOrg, folderForPodcast, folderForProductCaptureItem, folderForTask, folderForWarRoomThread, formatVideoPublishDate, formatVideoPublishDateTitle, fromCxAudioPart, fromCxMediaPart, fromCxVideoPart, fromImageOutputData, fromMediaBlock, fromPartialImageData, fromRenderBlock, imageBlockFromMediaRef, isAudioBlock, isConventionalFolder, isDocumentBlock, isExternalImageBlock, isExternalMediaBlock, isHiddenFolder, isImageBlock, isMatrxImageBlock, isMatrxMediaBlock, isMediaBlockData, isSystemPath, isUnifiedImageBlock, isUnifiedMediaBlock, isUploadCancelledError, isVideoBlock, isYouTubeBlock, parseFilenameFromUrl, parseGenerationMetadata, resolveDefaultVisibility, revokeTrackedObjectUrl, toCxMediaPart, toVisibility, urlToMediaRef, videoBlockFromMediaRef, videoPublishDateFromMetadata };
package/dist/files.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { AudioMediaPart, AudioOutputData, VideoMediaPart, VideoOutputData, ImageMediaPart, ImageOutputData, PartialImageData, RenderBlockPayload } from '@ai-matrx/agents/generated/stream-events';
2
2
  import * as react from 'react';
3
+ import { FileErrorCode, FileError } from '@ai-matrx/data/files';
4
+ export { ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError as FileHandlerError, FileNotFoundError, FileUploadError, ShareLinkInvalidError } from '@ai-matrx/data/files';
3
5
 
4
6
  /**
5
7
  * files/ref-types — the Matrx file reference vocabulary shared by every client:
@@ -744,44 +746,8 @@ declare function VideoPublishDate({ publishedAt, className, }: {
744
746
  * - a transient auth failure on a durable URL → refresh the file session
745
747
  * (see ../session.ts) and retry the SAME URL; never a terminal error.
746
748
  */
747
- type FileHandlerErrorCode = "access_denied" | "not_found" | "deleted" | "share_link_invalid" | "external_fetch_failed" | "cors_blocked" | "mime_unknown" | "upload_failed" | "upload_cancelled" | "quota_exceeded" | "in_flight" | "internal";
748
- declare class FileHandlerError extends Error {
749
- readonly code: FileHandlerErrorCode;
750
- readonly fileId?: string | undefined;
751
- readonly cause?: unknown;
752
- constructor(code: FileHandlerErrorCode, message: string, opts?: {
753
- fileId?: string;
754
- cause?: unknown;
755
- });
756
- }
757
- declare class FileAccessDeniedError extends FileHandlerError {
758
- constructor(message?: string, opts?: {
759
- fileId?: string;
760
- });
761
- }
762
- declare class FileNotFoundError extends FileHandlerError {
763
- constructor(message?: string, opts?: {
764
- fileId?: string;
765
- });
766
- }
767
- declare class FileDeletedError extends FileHandlerError {
768
- constructor(message?: string, opts?: {
769
- fileId?: string;
770
- });
771
- }
772
- declare class ShareLinkInvalidError extends FileHandlerError {
773
- constructor(message?: string);
774
- }
775
- declare class ExternalFetchError extends FileHandlerError {
776
- constructor(message?: string, opts?: {
777
- cause?: unknown;
778
- });
779
- }
780
- declare class FileUploadError extends FileHandlerError {
781
- constructor(message: string, opts?: {
782
- cause?: unknown;
783
- });
784
- }
749
+
750
+ type FileHandlerErrorCode = FileErrorCode;
785
751
  /**
786
752
  * The person was asked which workspace an upload belongs to and declined.
787
753
  *
@@ -790,7 +756,7 @@ declare class FileUploadError extends FileHandlerError {
790
756
  * report. Every catch site must swallow it silently — cancelling has to return
791
757
  * the person exactly where they were, which a red toast does not.
792
758
  */
793
- declare class UploadCancelledError extends FileHandlerError {
759
+ declare class UploadCancelledError extends FileError {
794
760
  constructor(message?: string);
795
761
  }
796
762
  declare function isUploadCancelledError(error: unknown): boolean;
@@ -1168,4 +1134,4 @@ declare function createTrackedObjectUrl(blob: Blob): string;
1168
1134
  /** Explicitly revoke a tracked URL when a consumer knows it is finished. */
1169
1135
  declare function revokeTrackedObjectUrl(url: string | undefined | null): void;
1170
1136
 
1171
- export { type AudioBlock, CloudFolderDescriptions, CloudFolders, type DocumentBlock, type ExternalAudioBlock, type ExternalDocumentBlock, ExternalFetchError, type ExternalImageBlock, type ExternalVideoBlock, FileAccessDeniedError, FileDeletedError, FileHandlerError, type FileHandlerErrorCode, type FileIdentityHint, FileNotFoundError, FileUploadError, type ImageBlock, type MatrxAudioBlock, type MatrxDocumentBlock, type MatrxImageBlock, type MatrxVideoBlock, type MediaBlockKindArg, type MediaGenerationKind, type MediaGenerationMetadata, type MediaGenerationMetadataWire, type MediaKind, type MediaOrigin, type MediaRef, type MediaStatus, type MediaVisibility, type PermissionLevel, ShareLinkInvalidError, type UnifiedImageBlock, type UnifiedMediaBlock, UploadCancelledError, type VideoBlock, VideoPublishDate, type Visibility, type WireMediaBlock, type WireMediaBlockData, type YouTubeBlock, blockFromMediaRef, composeUploadFolderPath, createTrackedObjectUrl, deriveViewerUrl, extractFileIdFromUrl, fileIdToMediaRef, folderForAgentApp, folderForAgentBlock, folderForCaptures, folderForConversation, folderForIntakeAsset, folderForOrg, folderForPodcast, folderForProductCaptureItem, folderForTask, folderForWarRoomThread, formatVideoPublishDate, formatVideoPublishDateTitle, fromCxAudioPart, fromCxMediaPart, fromCxVideoPart, fromImageOutputData, fromMediaBlock, fromPartialImageData, fromRenderBlock, imageBlockFromMediaRef, isAudioBlock, isConventionalFolder, isDocumentBlock, isExternalImageBlock, isExternalMediaBlock, isHiddenFolder, isImageBlock, isMatrxImageBlock, isMatrxMediaBlock, isMediaBlockData, isSystemPath, isUnifiedImageBlock, isUnifiedMediaBlock, isUploadCancelledError, isVideoBlock, isYouTubeBlock, parseFilenameFromUrl, parseGenerationMetadata, resolveDefaultVisibility, revokeTrackedObjectUrl, toCxMediaPart, toVisibility, urlToMediaRef, videoBlockFromMediaRef, videoPublishDateFromMetadata };
1137
+ export { type AudioBlock, CloudFolderDescriptions, CloudFolders, type DocumentBlock, type ExternalAudioBlock, type ExternalDocumentBlock, type ExternalImageBlock, type ExternalVideoBlock, type FileHandlerErrorCode, type FileIdentityHint, type ImageBlock, type MatrxAudioBlock, type MatrxDocumentBlock, type MatrxImageBlock, type MatrxVideoBlock, type MediaBlockKindArg, type MediaGenerationKind, type MediaGenerationMetadata, type MediaGenerationMetadataWire, type MediaKind, type MediaOrigin, type MediaRef, type MediaStatus, type MediaVisibility, type PermissionLevel, type UnifiedImageBlock, type UnifiedMediaBlock, UploadCancelledError, type VideoBlock, VideoPublishDate, type Visibility, type WireMediaBlock, type WireMediaBlockData, type YouTubeBlock, blockFromMediaRef, composeUploadFolderPath, createTrackedObjectUrl, deriveViewerUrl, extractFileIdFromUrl, fileIdToMediaRef, folderForAgentApp, folderForAgentBlock, folderForCaptures, folderForConversation, folderForIntakeAsset, folderForOrg, folderForPodcast, folderForProductCaptureItem, folderForTask, folderForWarRoomThread, formatVideoPublishDate, formatVideoPublishDateTitle, fromCxAudioPart, fromCxMediaPart, fromCxVideoPart, fromImageOutputData, fromMediaBlock, fromPartialImageData, fromRenderBlock, imageBlockFromMediaRef, isAudioBlock, isConventionalFolder, isDocumentBlock, isExternalImageBlock, isExternalMediaBlock, isHiddenFolder, isImageBlock, isMatrxImageBlock, isMatrxMediaBlock, isMediaBlockData, isSystemPath, isUnifiedImageBlock, isUnifiedMediaBlock, isUploadCancelledError, isVideoBlock, isYouTubeBlock, parseFilenameFromUrl, parseGenerationMetadata, resolveDefaultVisibility, revokeTrackedObjectUrl, toCxMediaPart, toVisibility, urlToMediaRef, videoBlockFromMediaRef, videoPublishDateFromMetadata };
package/dist/files.js CHANGED
@@ -769,58 +769,17 @@ function VideoPublishDate({
769
769
  }
770
770
 
771
771
  // src/files/handler/errors.ts
772
- var FileHandlerError = class extends Error {
773
- code;
774
- fileId;
775
- cause;
776
- constructor(code, message, opts) {
777
- super(message);
778
- this.name = "FileHandlerError";
779
- this.code = code;
780
- this.fileId = opts?.fileId;
781
- this.cause = opts?.cause;
782
- }
783
- };
784
- var FileAccessDeniedError = class extends FileHandlerError {
785
- constructor(message = "This file isn't available to you.", opts) {
786
- super("access_denied", message, opts);
787
- this.name = "FileAccessDeniedError";
788
- }
789
- };
790
- var FileNotFoundError = class extends FileHandlerError {
791
- // A 404 from the file server. It proves the server could not retrieve the
792
- // file — NOT that the file was deleted (that is `FileDeletedError`, which
793
- // has a `deleted_at` to point at) and not that it never existed.
794
- constructor(message = "We couldn't retrieve this file.", opts) {
795
- super("not_found", message, opts);
796
- this.name = "FileNotFoundError";
797
- }
798
- };
799
- var FileDeletedError = class extends FileHandlerError {
800
- constructor(message = "File is in trash", opts) {
801
- super("deleted", message, opts);
802
- this.name = "FileDeletedError";
803
- }
804
- };
805
- var ShareLinkInvalidError = class extends FileHandlerError {
806
- constructor(message = "Share link is invalid, expired, or revoked") {
807
- super("share_link_invalid", message);
808
- this.name = "ShareLinkInvalidError";
809
- }
810
- };
811
- var ExternalFetchError = class extends FileHandlerError {
812
- constructor(message = "Failed to fetch external URL", opts) {
813
- super("external_fetch_failed", message, opts);
814
- this.name = "ExternalFetchError";
815
- }
816
- };
817
- var FileUploadError = class extends FileHandlerError {
818
- constructor(message, opts) {
819
- super("upload_failed", message, opts);
820
- this.name = "FileUploadError";
821
- }
822
- };
823
- var UploadCancelledError = class extends FileHandlerError {
772
+ import { FileError } from "@ai-matrx/data/files";
773
+ import {
774
+ ExternalFetchError,
775
+ FileAccessDeniedError,
776
+ FileDeletedError,
777
+ FileError as FileError2,
778
+ FileNotFoundError,
779
+ FileUploadError,
780
+ ShareLinkInvalidError
781
+ } from "@ai-matrx/data/files";
782
+ var UploadCancelledError = class extends FileError {
824
783
  constructor(message = "Upload cancelled \u2014 no workspace was selected.") {
825
784
  super("upload_cancelled", message);
826
785
  this.name = "UploadCancelledError";
@@ -1214,7 +1173,7 @@ export {
1214
1173
  ExternalFetchError,
1215
1174
  FileAccessDeniedError,
1216
1175
  FileDeletedError,
1217
- FileHandlerError,
1176
+ FileError2 as FileHandlerError,
1218
1177
  FileNotFoundError,
1219
1178
  FileUploadError,
1220
1179
  ShareLinkInvalidError,