@uniformdev/files
Advanced tools
+80
-2
@@ -33,2 +33,3 @@ import { ApiClient, ClientOptions } from '@uniformdev/context/api'; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -71,5 +72,8 @@ state: number; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id?: string; | ||
| /** Format: uuid */ | ||
| projectId?: string; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| teamId?: string; | ||
@@ -92,2 +96,3 @@ name: string; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -128,2 +133,3 @@ uploadUrl: string; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| projectId?: string; | ||
@@ -141,2 +147,3 @@ }; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -162,3 +169,58 @@ }; | ||
| head?: never; | ||
| patch?: never; | ||
| /** @description Replaces a file while preserving the existing URL */ | ||
| patch: { | ||
| parameters: { | ||
| query?: never; | ||
| header?: never; | ||
| path?: never; | ||
| cookie?: never; | ||
| }; | ||
| requestBody: { | ||
| content: { | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| projectId: string; | ||
| /** Format: uuid */ | ||
| existingFileId: string; | ||
| /** Format: uuid */ | ||
| replacementFileId: string; | ||
| }; | ||
| }; | ||
| }; | ||
| responses: { | ||
| /** @description 200 response */ | ||
| 200: { | ||
| headers: { | ||
| [name: string]: unknown; | ||
| }; | ||
| content: { | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
| state: number; | ||
| url?: string; | ||
| name: string; | ||
| mediaType: string; | ||
| metadata?: unknown; | ||
| size: number; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| deletedReplacementFileId?: string; | ||
| }; | ||
| }; | ||
| }; | ||
| 400: components["responses"]["BadRequestError"]; | ||
| 401: components["responses"]["UnauthorizedError"]; | ||
| 403: components["responses"]["ForbiddenError"]; | ||
| /** @description 404 response */ | ||
| 404: { | ||
| headers: { | ||
| [name: string]: unknown; | ||
| }; | ||
| content?: never; | ||
| }; | ||
| 429: components["responses"]["RateLimitError"]; | ||
| 500: components["responses"]["InternalServerError"]; | ||
| }; | ||
| }; | ||
| trace?: never; | ||
@@ -227,2 +289,4 @@ }; | ||
| type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json']; | ||
| type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json']; | ||
| type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json']; | ||
| type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query']; | ||
@@ -250,2 +314,16 @@ type FileGetByIDRequest = Pick<FileGetRequest, 'id'>; | ||
| }>; | ||
| /** | ||
| * Replaces the contents behind an existing file while preserving its URL. | ||
| */ | ||
| replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{ | ||
| id: string; | ||
| state: number; | ||
| url?: string; | ||
| name: string; | ||
| mediaType: string; | ||
| metadata?: unknown; | ||
| size: number; | ||
| sourceId?: string; | ||
| deletedReplacementFileId?: string; | ||
| }>; | ||
| } | ||
@@ -277,2 +355,2 @@ declare class UncachedFileClient extends FileClient { | ||
| export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_MIME_TYPES_ALL, FILE_MIME_TYPES_AUDIO, FILE_MIME_TYPES_IMAGE, FILE_MIME_TYPES_OTHER, FILE_MIME_TYPES_VIDEO, FILE_READY_STATE, FILE_TYPES_ALL, FILE_TYPES_AUDIO, FILE_TYPES_IMAGE, FILE_TYPES_OTHER, FILE_TYPES_VIDEO, FileClient, type FileDeleteRequest, type FileDeleteResponse, type FileGetByIDRequest, type FileGetBySourceIDRequest, type FileGetByURLRequest, type FileGetRequest, type FileGetResponse, type FileInsertRequest, type FileInsertResponse, UncachedFileClient, getFileNameFromUrl }; | ||
| export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_MIME_TYPES_ALL, FILE_MIME_TYPES_AUDIO, FILE_MIME_TYPES_IMAGE, FILE_MIME_TYPES_OTHER, FILE_MIME_TYPES_VIDEO, FILE_READY_STATE, FILE_TYPES_ALL, FILE_TYPES_AUDIO, FILE_TYPES_IMAGE, FILE_TYPES_OTHER, FILE_TYPES_VIDEO, FileClient, type FileDeleteRequest, type FileDeleteResponse, type FileGetByIDRequest, type FileGetBySourceIDRequest, type FileGetByURLRequest, type FileGetRequest, type FileGetResponse, type FileInsertRequest, type FileInsertResponse, type FileReplaceRequest, type FileReplaceResponse, UncachedFileClient, getFileNameFromUrl }; |
+80
-2
@@ -33,2 +33,3 @@ import { ApiClient, ClientOptions } from '@uniformdev/context/api'; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -71,5 +72,8 @@ state: number; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id?: string; | ||
| /** Format: uuid */ | ||
| projectId?: string; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| teamId?: string; | ||
@@ -92,2 +96,3 @@ name: string; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -128,2 +133,3 @@ uploadUrl: string; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| projectId?: string; | ||
@@ -141,2 +147,3 @@ }; | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
@@ -162,3 +169,58 @@ }; | ||
| head?: never; | ||
| patch?: never; | ||
| /** @description Replaces a file while preserving the existing URL */ | ||
| patch: { | ||
| parameters: { | ||
| query?: never; | ||
| header?: never; | ||
| path?: never; | ||
| cookie?: never; | ||
| }; | ||
| requestBody: { | ||
| content: { | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| projectId: string; | ||
| /** Format: uuid */ | ||
| existingFileId: string; | ||
| /** Format: uuid */ | ||
| replacementFileId: string; | ||
| }; | ||
| }; | ||
| }; | ||
| responses: { | ||
| /** @description 200 response */ | ||
| 200: { | ||
| headers: { | ||
| [name: string]: unknown; | ||
| }; | ||
| content: { | ||
| "application/json": { | ||
| /** Format: uuid */ | ||
| id: string; | ||
| state: number; | ||
| url?: string; | ||
| name: string; | ||
| mediaType: string; | ||
| metadata?: unknown; | ||
| size: number; | ||
| sourceId?: string; | ||
| /** Format: uuid */ | ||
| deletedReplacementFileId?: string; | ||
| }; | ||
| }; | ||
| }; | ||
| 400: components["responses"]["BadRequestError"]; | ||
| 401: components["responses"]["UnauthorizedError"]; | ||
| 403: components["responses"]["ForbiddenError"]; | ||
| /** @description 404 response */ | ||
| 404: { | ||
| headers: { | ||
| [name: string]: unknown; | ||
| }; | ||
| content?: never; | ||
| }; | ||
| 429: components["responses"]["RateLimitError"]; | ||
| 500: components["responses"]["InternalServerError"]; | ||
| }; | ||
| }; | ||
| trace?: never; | ||
@@ -227,2 +289,4 @@ }; | ||
| type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json']; | ||
| type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json']; | ||
| type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json']; | ||
| type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query']; | ||
@@ -250,2 +314,16 @@ type FileGetByIDRequest = Pick<FileGetRequest, 'id'>; | ||
| }>; | ||
| /** | ||
| * Replaces the contents behind an existing file while preserving its URL. | ||
| */ | ||
| replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{ | ||
| id: string; | ||
| state: number; | ||
| url?: string; | ||
| name: string; | ||
| mediaType: string; | ||
| metadata?: unknown; | ||
| size: number; | ||
| sourceId?: string; | ||
| deletedReplacementFileId?: string; | ||
| }>; | ||
| } | ||
@@ -277,2 +355,2 @@ declare class UncachedFileClient extends FileClient { | ||
| export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_MIME_TYPES_ALL, FILE_MIME_TYPES_AUDIO, FILE_MIME_TYPES_IMAGE, FILE_MIME_TYPES_OTHER, FILE_MIME_TYPES_VIDEO, FILE_READY_STATE, FILE_TYPES_ALL, FILE_TYPES_AUDIO, FILE_TYPES_IMAGE, FILE_TYPES_OTHER, FILE_TYPES_VIDEO, FileClient, type FileDeleteRequest, type FileDeleteResponse, type FileGetByIDRequest, type FileGetBySourceIDRequest, type FileGetByURLRequest, type FileGetRequest, type FileGetResponse, type FileInsertRequest, type FileInsertResponse, UncachedFileClient, getFileNameFromUrl }; | ||
| export { FILE_IN_PROGRESS_STATE, FILE_MAX_SIZE, FILE_MIME_TYPES_ALL, FILE_MIME_TYPES_AUDIO, FILE_MIME_TYPES_IMAGE, FILE_MIME_TYPES_OTHER, FILE_MIME_TYPES_VIDEO, FILE_READY_STATE, FILE_TYPES_ALL, FILE_TYPES_AUDIO, FILE_TYPES_IMAGE, FILE_TYPES_OTHER, FILE_TYPES_VIDEO, FileClient, type FileDeleteRequest, type FileDeleteResponse, type FileGetByIDRequest, type FileGetBySourceIDRequest, type FileGetByURLRequest, type FileGetRequest, type FileGetResponse, type FileInsertRequest, type FileInsertResponse, type FileReplaceRequest, type FileReplaceResponse, UncachedFileClient, getFileNameFromUrl }; |
+11
-0
@@ -32,2 +32,13 @@ // src/FileClient.ts | ||
| } | ||
| /** | ||
| * Replaces the contents behind an existing file while preserving its URL. | ||
| */ | ||
| async replace(options) { | ||
| const { projectId } = this.options; | ||
| const fetchUri = this.createUrl(FILE_BASE_PATH); | ||
| return this.apiClient(fetchUri, { | ||
| method: "PATCH", | ||
| body: JSON.stringify({ ...options, projectId }) | ||
| }); | ||
| } | ||
| }; | ||
@@ -34,0 +45,0 @@ var UncachedFileClient = class extends FileClient { |
+11
-0
@@ -73,2 +73,13 @@ "use strict"; | ||
| } | ||
| /** | ||
| * Replaces the contents behind an existing file while preserving its URL. | ||
| */ | ||
| async replace(options) { | ||
| const { projectId } = this.options; | ||
| const fetchUri = this.createUrl(FILE_BASE_PATH); | ||
| return this.apiClient(fetchUri, { | ||
| method: "PATCH", | ||
| body: JSON.stringify({ ...options, projectId }) | ||
| }); | ||
| } | ||
| }; | ||
@@ -75,0 +86,0 @@ var UncachedFileClient = class extends FileClient { |
+11
-0
@@ -32,2 +32,13 @@ // src/FileClient.ts | ||
| } | ||
| /** | ||
| * Replaces the contents behind an existing file while preserving its URL. | ||
| */ | ||
| async replace(options) { | ||
| const { projectId } = this.options; | ||
| const fetchUri = this.createUrl(FILE_BASE_PATH); | ||
| return this.apiClient(fetchUri, { | ||
| method: "PATCH", | ||
| body: JSON.stringify({ ...options, projectId }) | ||
| }); | ||
| } | ||
| }; | ||
@@ -34,0 +45,0 @@ var UncachedFileClient = class extends FileClient { |
+3
-3
| { | ||
| "name": "@uniformdev/files", | ||
| "version": "20.65.0", | ||
| "version": "20.66.0", | ||
| "description": "Uniform Files helpers", | ||
@@ -37,5 +37,5 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
| "dependencies": { | ||
| "@uniformdev/context": "20.65.0" | ||
| "@uniformdev/context": "20.66.0" | ||
| }, | ||
| "gitHead": "3c85a58c461592970dbff8f166067d61da7955e3" | ||
| "gitHead": "13647d6ac2860218bede840b73d214888637811c" | ||
| } |
39367
22.42%761
17.26%+ Added
- Removed
Updated