@ai-matrx/data 0.18.1 → 0.18.2

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
@@ -74,11 +74,23 @@ interface FilesBlobHandle {
74
74
  /** Release the handle. Cache-backed handles no-op (the cache owns the URL). */
75
75
  release(): void;
76
76
  }
77
+ /** `platform.shown_to`: a list filter, never row security (access ladder T-13). */
78
+ type FileShownTo = "only_me" | "my_team" | "everyone" | "everyone_on_ai_matrx";
77
79
  interface MediaUploadOptions {
78
80
  onProgress?: ((loaded: number, total: number) => void) | undefined;
79
81
  fileName?: string | undefined;
80
82
  mimeType?: string | undefined;
81
- /** Matrx visibility vocabulary (`personal` | `public` | `shared` | ...). */
83
+ /**
84
+ * Publish the upload to the web (the only anonymous lane; access ladder T-13).
85
+ * Omitted = not published.
86
+ */
87
+ publishedToWeb?: boolean | undefined;
88
+ /** The "Shown to" list filter; omitted = only me (the upload default). */
89
+ shownTo?: FileShownTo | undefined;
90
+ /**
91
+ * The retiring level word (`personal` | `internal` | `link` | `public`), read only when
92
+ * neither word above is given; hosts move to the two words.
93
+ */
82
94
  visibility?: string | undefined;
83
95
  /**
84
96
  * Host-side folder identity. The wire contract addresses folders by PATH
@@ -135,7 +147,8 @@ interface FileUploadResponseWire {
135
147
  url?: string | null;
136
148
  cdn_url?: string | null;
137
149
  download_url?: string | null;
138
- visibility?: string;
150
+ published_to_web?: boolean;
151
+ shown_to?: string | null;
139
152
  }
140
153
  /**
141
154
  * `GET /files/{id}` response (`FileRecord`) — the subset this lane reads.
@@ -145,7 +158,8 @@ interface FileRecordWire {
145
158
  id: string;
146
159
  file_name?: string | null;
147
160
  mime_type?: string | null;
148
- visibility?: string | null;
161
+ published_to_web?: boolean | null;
162
+ shown_to?: string | null;
149
163
  deleted_at?: string | null;
150
164
  public_url?: string | null;
151
165
  thumbnail_url?: string | null;
@@ -171,7 +185,8 @@ interface ShareLinkRecordWire {
171
185
  /** The per-file metadata this lane renders transport decisions from. */
172
186
  interface FileMetadata {
173
187
  mimeType?: string | null;
174
- visibility?: string | null;
188
+ /** True only when the file is published to the web (its CDN URL is anonymous). */
189
+ publishedToWeb?: boolean | null;
175
190
  cdnUrl?: string | null;
176
191
  publicUrl?: string | null;
177
192
  thumbnailUrl?: string | null;
@@ -179,7 +194,7 @@ interface FileMetadata {
179
194
  fileName?: string | null;
180
195
  }
181
196
  /**
182
- * Where `resolve()` reads per-file metadata (visibility → CDN vs blob lane,
197
+ * Where `resolve()` reads per-file metadata (published to the web → CDN vs blob lane,
183
198
  * mime, thumbnail). `peek` is synchronous and render-safe; `hydrate` may hit
184
199
  * the network/store. DEFAULT: an in-client cache over `GET /files/{id}`.
185
200
  * A host with its own file store (Redux, Supabase reads) overrides this port
@@ -524,6 +539,13 @@ interface MatrxFilesClient<TSrc extends string = DurableSrc> {
524
539
  * Persistent tiers (IndexedDB, the service worker) stay host-injected.
525
540
  */
526
541
  declare function createMemoryBlobCache(budgetBytes?: number): BlobCachePort;
542
+ /**
543
+ * The upload's row-access form fields (access ladder T-13). The two words are written
544
+ * explicitly on every upload — never left to a server default: not published, shown to
545
+ * only me, unless the caller says otherwise. A caller still on the retiring level word
546
+ * is translated here, once.
547
+ */
548
+ declare function uploadAccessFields(opts: MediaUploadOptions): Record<string, string>;
527
549
  declare function createMatrxFilesClient<TSrc extends string = DurableSrc>(config: MatrxFilesClientConfig): MatrxFilesClient<TSrc>;
528
550
 
529
551
  /**
@@ -663,4 +685,4 @@ interface FilesSession {
663
685
  }
664
686
  declare function createFilesSession(options: FilesSessionOptions): FilesSession;
665
687
 
666
- export { type BlobCacheEntry, type BlobCachePort, type DurableSrc, ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError, type FileErrorCode, type FileMetadata, type FileMetadataPort, FileNotFoundError, type FileOrigins, type FileRecordWire, type FileSessionResponseWire, FileUploadError, type FileUploadResponseWire, type FileUrlRecognizer, type FileUrls, type FilesBlobHandle, type FilesDiagnosticsEvent, type FilesDiagnosticsSink, type FilesRecoveryReport, type FilesRecoveryVerdict, type FilesResolution, type FilesSession, type FilesSessionOptions, type FilesSessionSnapshot, type MatrxFilesClient, type MatrxFilesClientConfig, type MediaKind, type MediaMultiUploadResult, type MediaRef, type MediaRefLike, type MediaUnavailableReason, type MediaUploadOptions, type MediaUploadResult, type MediaUrlKind, SIGNED_URL_RE, ShareLinkInvalidError, type ShareLinkRecordWire, TUS_TRANSPORT_THRESHOLD_BYTES, type UploadTransport, classifyMediaUrl, classifyUnavailable, createFileUrlRecognizer, createFilesSession, createMatrxFilesClient, createMemoryBlobCache, fileErrorFromStatus, fileNameFromUrl, fileUrls, isDurableMediaUrl, isFileIdString, isSignedUrl, mimeFromUrl, resolveUploadTransport, shareUrl, shareableMediaUrl };
688
+ export { type BlobCacheEntry, type BlobCachePort, type DurableSrc, ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError, type FileErrorCode, type FileMetadata, type FileMetadataPort, FileNotFoundError, type FileOrigins, type FileRecordWire, type FileSessionResponseWire, type FileShownTo, FileUploadError, type FileUploadResponseWire, type FileUrlRecognizer, type FileUrls, type FilesBlobHandle, type FilesDiagnosticsEvent, type FilesDiagnosticsSink, type FilesRecoveryReport, type FilesRecoveryVerdict, type FilesResolution, type FilesSession, type FilesSessionOptions, type FilesSessionSnapshot, type MatrxFilesClient, type MatrxFilesClientConfig, type MediaKind, type MediaMultiUploadResult, type MediaRef, type MediaRefLike, type MediaUnavailableReason, type MediaUploadOptions, type MediaUploadResult, type MediaUrlKind, SIGNED_URL_RE, ShareLinkInvalidError, type ShareLinkRecordWire, TUS_TRANSPORT_THRESHOLD_BYTES, type UploadTransport, classifyMediaUrl, classifyUnavailable, createFileUrlRecognizer, createFilesSession, createMatrxFilesClient, createMemoryBlobCache, fileErrorFromStatus, fileNameFromUrl, fileUrls, isDurableMediaUrl, isFileIdString, isSignedUrl, mimeFromUrl, resolveUploadTransport, shareUrl, shareableMediaUrl, uploadAccessFields };
package/dist/files.d.ts CHANGED
@@ -74,11 +74,23 @@ interface FilesBlobHandle {
74
74
  /** Release the handle. Cache-backed handles no-op (the cache owns the URL). */
75
75
  release(): void;
76
76
  }
77
+ /** `platform.shown_to`: a list filter, never row security (access ladder T-13). */
78
+ type FileShownTo = "only_me" | "my_team" | "everyone" | "everyone_on_ai_matrx";
77
79
  interface MediaUploadOptions {
78
80
  onProgress?: ((loaded: number, total: number) => void) | undefined;
79
81
  fileName?: string | undefined;
80
82
  mimeType?: string | undefined;
81
- /** Matrx visibility vocabulary (`personal` | `public` | `shared` | ...). */
83
+ /**
84
+ * Publish the upload to the web (the only anonymous lane; access ladder T-13).
85
+ * Omitted = not published.
86
+ */
87
+ publishedToWeb?: boolean | undefined;
88
+ /** The "Shown to" list filter; omitted = only me (the upload default). */
89
+ shownTo?: FileShownTo | undefined;
90
+ /**
91
+ * The retiring level word (`personal` | `internal` | `link` | `public`), read only when
92
+ * neither word above is given; hosts move to the two words.
93
+ */
82
94
  visibility?: string | undefined;
83
95
  /**
84
96
  * Host-side folder identity. The wire contract addresses folders by PATH
@@ -135,7 +147,8 @@ interface FileUploadResponseWire {
135
147
  url?: string | null;
136
148
  cdn_url?: string | null;
137
149
  download_url?: string | null;
138
- visibility?: string;
150
+ published_to_web?: boolean;
151
+ shown_to?: string | null;
139
152
  }
140
153
  /**
141
154
  * `GET /files/{id}` response (`FileRecord`) — the subset this lane reads.
@@ -145,7 +158,8 @@ interface FileRecordWire {
145
158
  id: string;
146
159
  file_name?: string | null;
147
160
  mime_type?: string | null;
148
- visibility?: string | null;
161
+ published_to_web?: boolean | null;
162
+ shown_to?: string | null;
149
163
  deleted_at?: string | null;
150
164
  public_url?: string | null;
151
165
  thumbnail_url?: string | null;
@@ -171,7 +185,8 @@ interface ShareLinkRecordWire {
171
185
  /** The per-file metadata this lane renders transport decisions from. */
172
186
  interface FileMetadata {
173
187
  mimeType?: string | null;
174
- visibility?: string | null;
188
+ /** True only when the file is published to the web (its CDN URL is anonymous). */
189
+ publishedToWeb?: boolean | null;
175
190
  cdnUrl?: string | null;
176
191
  publicUrl?: string | null;
177
192
  thumbnailUrl?: string | null;
@@ -179,7 +194,7 @@ interface FileMetadata {
179
194
  fileName?: string | null;
180
195
  }
181
196
  /**
182
- * Where `resolve()` reads per-file metadata (visibility → CDN vs blob lane,
197
+ * Where `resolve()` reads per-file metadata (published to the web → CDN vs blob lane,
183
198
  * mime, thumbnail). `peek` is synchronous and render-safe; `hydrate` may hit
184
199
  * the network/store. DEFAULT: an in-client cache over `GET /files/{id}`.
185
200
  * A host with its own file store (Redux, Supabase reads) overrides this port
@@ -524,6 +539,13 @@ interface MatrxFilesClient<TSrc extends string = DurableSrc> {
524
539
  * Persistent tiers (IndexedDB, the service worker) stay host-injected.
525
540
  */
526
541
  declare function createMemoryBlobCache(budgetBytes?: number): BlobCachePort;
542
+ /**
543
+ * The upload's row-access form fields (access ladder T-13). The two words are written
544
+ * explicitly on every upload — never left to a server default: not published, shown to
545
+ * only me, unless the caller says otherwise. A caller still on the retiring level word
546
+ * is translated here, once.
547
+ */
548
+ declare function uploadAccessFields(opts: MediaUploadOptions): Record<string, string>;
527
549
  declare function createMatrxFilesClient<TSrc extends string = DurableSrc>(config: MatrxFilesClientConfig): MatrxFilesClient<TSrc>;
528
550
 
529
551
  /**
@@ -663,4 +685,4 @@ interface FilesSession {
663
685
  }
664
686
  declare function createFilesSession(options: FilesSessionOptions): FilesSession;
665
687
 
666
- export { type BlobCacheEntry, type BlobCachePort, type DurableSrc, ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError, type FileErrorCode, type FileMetadata, type FileMetadataPort, FileNotFoundError, type FileOrigins, type FileRecordWire, type FileSessionResponseWire, FileUploadError, type FileUploadResponseWire, type FileUrlRecognizer, type FileUrls, type FilesBlobHandle, type FilesDiagnosticsEvent, type FilesDiagnosticsSink, type FilesRecoveryReport, type FilesRecoveryVerdict, type FilesResolution, type FilesSession, type FilesSessionOptions, type FilesSessionSnapshot, type MatrxFilesClient, type MatrxFilesClientConfig, type MediaKind, type MediaMultiUploadResult, type MediaRef, type MediaRefLike, type MediaUnavailableReason, type MediaUploadOptions, type MediaUploadResult, type MediaUrlKind, SIGNED_URL_RE, ShareLinkInvalidError, type ShareLinkRecordWire, TUS_TRANSPORT_THRESHOLD_BYTES, type UploadTransport, classifyMediaUrl, classifyUnavailable, createFileUrlRecognizer, createFilesSession, createMatrxFilesClient, createMemoryBlobCache, fileErrorFromStatus, fileNameFromUrl, fileUrls, isDurableMediaUrl, isFileIdString, isSignedUrl, mimeFromUrl, resolveUploadTransport, shareUrl, shareableMediaUrl };
688
+ export { type BlobCacheEntry, type BlobCachePort, type DurableSrc, ExternalFetchError, FileAccessDeniedError, FileDeletedError, FileError, type FileErrorCode, type FileMetadata, type FileMetadataPort, FileNotFoundError, type FileOrigins, type FileRecordWire, type FileSessionResponseWire, type FileShownTo, FileUploadError, type FileUploadResponseWire, type FileUrlRecognizer, type FileUrls, type FilesBlobHandle, type FilesDiagnosticsEvent, type FilesDiagnosticsSink, type FilesRecoveryReport, type FilesRecoveryVerdict, type FilesResolution, type FilesSession, type FilesSessionOptions, type FilesSessionSnapshot, type MatrxFilesClient, type MatrxFilesClientConfig, type MediaKind, type MediaMultiUploadResult, type MediaRef, type MediaRefLike, type MediaUnavailableReason, type MediaUploadOptions, type MediaUploadResult, type MediaUrlKind, SIGNED_URL_RE, ShareLinkInvalidError, type ShareLinkRecordWire, TUS_TRANSPORT_THRESHOLD_BYTES, type UploadTransport, classifyMediaUrl, classifyUnavailable, createFileUrlRecognizer, createFilesSession, createMatrxFilesClient, createMemoryBlobCache, fileErrorFromStatus, fileNameFromUrl, fileUrls, isDurableMediaUrl, isFileIdString, isSignedUrl, mimeFromUrl, resolveUploadTransport, shareUrl, shareableMediaUrl, uploadAccessFields };
package/dist/files.js CHANGED
@@ -529,10 +529,18 @@ function createMemoryBlobCache(budgetBytes = DEFAULT_BLOB_BUDGET_BYTES) {
529
529
  }
530
530
  };
531
531
  }
532
+ function uploadAccessFields(opts) {
533
+ const legacy = opts.visibility;
534
+ const published = opts.publishedToWeb ?? (legacy === void 0 ? false : legacy === "public");
535
+ const shownTo = opts.shownTo ?? (opts.publishedToWeb !== void 0 || legacy === void 0 || legacy === "personal" ? "only_me" : null);
536
+ const fields = { published_to_web: String(published) };
537
+ if (shownTo) fields.shown_to = shownTo;
538
+ return fields;
539
+ }
532
540
  function recordToMetadata(record) {
533
541
  return {
534
542
  mimeType: record.mime_type ?? null,
535
- visibility: record.visibility ?? null,
543
+ publishedToWeb: record.published_to_web ?? null,
536
544
  cdnUrl: record.cdn_url ?? null,
537
545
  publicUrl: record.public_url ?? null,
538
546
  thumbnailUrl: record.thumbnail_url ?? null,
@@ -832,7 +840,7 @@ function createMatrxFilesClient(config) {
832
840
  const form = new FormData();
833
841
  form.append("file", asFile);
834
842
  form.append("file_path", `${folder}/${asFile.name}`);
835
- form.append("visibility", opts.visibility ?? "personal");
843
+ for (const [key, value] of Object.entries(uploadAccessFields(opts))) form.append(key, value);
836
844
  if (opts.metadata) form.append("metadata_json", JSON.stringify(opts.metadata));
837
845
  const response = await postMultipart(form, opts, newRequestId());
838
846
  if (!response.file_id) {
@@ -862,7 +870,7 @@ function createMatrxFilesClient(config) {
862
870
  return { uploaded, failed, cancelled: false };
863
871
  }
864
872
  function permanentPublicUrl(meta) {
865
- if (meta?.visibility !== "public") return null;
873
+ if (meta?.publishedToWeb !== true) return null;
866
874
  const candidate = shareableMediaUrl(meta.cdnUrl ?? meta.publicUrl ?? null);
867
875
  if (!candidate) return null;
868
876
  return recognizer.fileIdFromFileEndpointUrl(candidate) ? null : candidate;
@@ -1096,6 +1104,7 @@ export {
1096
1104
  mimeFromUrl,
1097
1105
  resolveUploadTransport,
1098
1106
  shareUrl,
1099
- shareableMediaUrl
1107
+ shareableMediaUrl,
1108
+ uploadAccessFields
1100
1109
  };
1101
1110
  //# sourceMappingURL=files.js.map