@uniformdev/files 20.63.0 → 20.63.1-alpha.17

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/index.d.mts CHANGED
@@ -161,7 +161,62 @@ interface paths {
161
161
  };
162
162
  options?: never;
163
163
  head?: never;
164
- patch?: never;
164
+ /** @description Replaces a file while preserving the existing URL */
165
+ patch: {
166
+ parameters: {
167
+ query?: never;
168
+ header?: never;
169
+ path?: never;
170
+ cookie?: never;
171
+ };
172
+ requestBody: {
173
+ content: {
174
+ "application/json": {
175
+ /** Format: uuid */
176
+ projectId: string;
177
+ /** Format: uuid */
178
+ existingFileId: string;
179
+ /** Format: uuid */
180
+ replacementFileId: string;
181
+ };
182
+ };
183
+ };
184
+ responses: {
185
+ /** @description 200 response */
186
+ 200: {
187
+ headers: {
188
+ [name: string]: unknown;
189
+ };
190
+ content: {
191
+ "application/json": {
192
+ /** Format: uuid */
193
+ id: string;
194
+ state: number;
195
+ url?: string;
196
+ name: string;
197
+ mediaType: string;
198
+ metadata?: unknown;
199
+ size: number;
200
+ sourceId?: string;
201
+ /** Format: uuid */
202
+ deletedReplacementFileId?: string;
203
+ };
204
+ };
205
+ };
206
+ 400: components["responses"]["BadRequestError"];
207
+ 401: components["responses"]["UnauthorizedError"];
208
+ 403: components["responses"]["ForbiddenError"];
209
+ /** @description 404 response */
210
+ 404: {
211
+ headers: {
212
+ [name: string]: unknown;
213
+ };
214
+ content?: never;
215
+ };
216
+ 429: components["responses"]["RateLimitError"];
217
+ 500: components["responses"]["InternalServerError"];
218
+ };
219
+ };
165
220
  trace?: never;
166
221
  };
167
222
  }
@@ -225,6 +280,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
225
280
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
226
281
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
227
282
  type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
283
+ type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json'];
284
+ type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json'];
228
285
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
229
286
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
230
287
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -247,6 +304,20 @@ declare class FileClient extends ApiClient {
247
304
  delete(options: FileDeleteRequest): Promise<{
248
305
  id: string;
249
306
  }>;
307
+ /**
308
+ * Replaces the contents behind an existing file while preserving its URL.
309
+ */
310
+ replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{
311
+ id: string;
312
+ state: number;
313
+ url?: string;
314
+ name: string;
315
+ mediaType: string;
316
+ metadata?: unknown;
317
+ size: number;
318
+ sourceId?: string;
319
+ deletedReplacementFileId?: string;
320
+ }>;
250
321
  }
251
322
  declare class UncachedFileClient extends FileClient {
252
323
  constructor(options: Omit<ClientOptions & {
@@ -273,4 +344,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
273
344
  declare const FILE_TYPES_ALL: string[];
274
345
  declare const FILE_MIME_TYPES_ALL: string[];
275
346
 
276
- 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 };
347
+ 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 };
package/dist/index.d.ts CHANGED
@@ -161,7 +161,62 @@ interface paths {
161
161
  };
162
162
  options?: never;
163
163
  head?: never;
164
- patch?: never;
164
+ /** @description Replaces a file while preserving the existing URL */
165
+ patch: {
166
+ parameters: {
167
+ query?: never;
168
+ header?: never;
169
+ path?: never;
170
+ cookie?: never;
171
+ };
172
+ requestBody: {
173
+ content: {
174
+ "application/json": {
175
+ /** Format: uuid */
176
+ projectId: string;
177
+ /** Format: uuid */
178
+ existingFileId: string;
179
+ /** Format: uuid */
180
+ replacementFileId: string;
181
+ };
182
+ };
183
+ };
184
+ responses: {
185
+ /** @description 200 response */
186
+ 200: {
187
+ headers: {
188
+ [name: string]: unknown;
189
+ };
190
+ content: {
191
+ "application/json": {
192
+ /** Format: uuid */
193
+ id: string;
194
+ state: number;
195
+ url?: string;
196
+ name: string;
197
+ mediaType: string;
198
+ metadata?: unknown;
199
+ size: number;
200
+ sourceId?: string;
201
+ /** Format: uuid */
202
+ deletedReplacementFileId?: string;
203
+ };
204
+ };
205
+ };
206
+ 400: components["responses"]["BadRequestError"];
207
+ 401: components["responses"]["UnauthorizedError"];
208
+ 403: components["responses"]["ForbiddenError"];
209
+ /** @description 404 response */
210
+ 404: {
211
+ headers: {
212
+ [name: string]: unknown;
213
+ };
214
+ content?: never;
215
+ };
216
+ 429: components["responses"]["RateLimitError"];
217
+ 500: components["responses"]["InternalServerError"];
218
+ };
219
+ };
165
220
  trace?: never;
166
221
  };
167
222
  }
@@ -225,6 +280,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
225
280
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
226
281
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
227
282
  type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
283
+ type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json'];
284
+ type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json'];
228
285
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
229
286
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
230
287
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -247,6 +304,20 @@ declare class FileClient extends ApiClient {
247
304
  delete(options: FileDeleteRequest): Promise<{
248
305
  id: string;
249
306
  }>;
307
+ /**
308
+ * Replaces the contents behind an existing file while preserving its URL.
309
+ */
310
+ replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{
311
+ id: string;
312
+ state: number;
313
+ url?: string;
314
+ name: string;
315
+ mediaType: string;
316
+ metadata?: unknown;
317
+ size: number;
318
+ sourceId?: string;
319
+ deletedReplacementFileId?: string;
320
+ }>;
250
321
  }
251
322
  declare class UncachedFileClient extends FileClient {
252
323
  constructor(options: Omit<ClientOptions & {
@@ -273,4 +344,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
273
344
  declare const FILE_TYPES_ALL: string[];
274
345
  declare const FILE_MIME_TYPES_ALL: string[];
275
346
 
276
- 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 };
347
+ 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 };
package/dist/index.esm.js CHANGED
@@ -29,6 +29,17 @@ var FileClient = class extends ApiClient {
29
29
  body: JSON.stringify({ ...options, projectId })
30
30
  });
31
31
  }
32
+ /**
33
+ * Replaces the contents behind an existing file while preserving its URL.
34
+ */
35
+ async replace(options) {
36
+ const { projectId } = this.options;
37
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
38
+ return this.apiClient(fetchUri, {
39
+ method: "PATCH",
40
+ body: JSON.stringify({ ...options, projectId })
41
+ });
42
+ }
32
43
  };
33
44
  var UncachedFileClient = class extends FileClient {
34
45
  constructor(options) {
package/dist/index.js CHANGED
@@ -70,6 +70,17 @@ var FileClient = class extends import_api.ApiClient {
70
70
  body: JSON.stringify({ ...options, projectId })
71
71
  });
72
72
  }
73
+ /**
74
+ * Replaces the contents behind an existing file while preserving its URL.
75
+ */
76
+ async replace(options) {
77
+ const { projectId } = this.options;
78
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
79
+ return this.apiClient(fetchUri, {
80
+ method: "PATCH",
81
+ body: JSON.stringify({ ...options, projectId })
82
+ });
83
+ }
73
84
  };
74
85
  var UncachedFileClient = class extends FileClient {
75
86
  constructor(options) {
package/dist/index.mjs CHANGED
@@ -29,6 +29,17 @@ var FileClient = class extends ApiClient {
29
29
  body: JSON.stringify({ ...options, projectId })
30
30
  });
31
31
  }
32
+ /**
33
+ * Replaces the contents behind an existing file while preserving its URL.
34
+ */
35
+ async replace(options) {
36
+ const { projectId } = this.options;
37
+ const fetchUri = this.createUrl(FILE_BASE_PATH);
38
+ return this.apiClient(fetchUri, {
39
+ method: "PATCH",
40
+ body: JSON.stringify({ ...options, projectId })
41
+ });
42
+ }
32
43
  };
33
44
  var UncachedFileClient = class extends FileClient {
34
45
  constructor(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/files",
3
- "version": "20.63.0",
3
+ "version": "20.63.1-alpha.17+cd7eca3818",
4
4
  "description": "Uniform Files helpers",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@uniformdev/context": "20.63.0"
37
+ "@uniformdev/context": "20.63.1-alpha.17+cd7eca3818"
38
38
  },
39
- "gitHead": "76729fa5c8c4dc3d71d65fdb181a659755ec34ae"
39
+ "gitHead": "cd7eca38189533a6ba5899bf872b72e1331c4aa3"
40
40
  }