@uniformdev/files 20.65.0 → 20.66.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/index.d.mts CHANGED
@@ -30,6 +30,7 @@ interface paths {
30
30
  };
31
31
  content: {
32
32
  "application/json": {
33
+ /** Format: uuid */
33
34
  id: string;
34
35
  state: number;
35
36
  url?: string;
@@ -67,9 +68,12 @@ interface paths {
67
68
  requestBody: {
68
69
  content: {
69
70
  "application/json": {
71
+ /** Format: uuid */
70
72
  id?: string;
73
+ /** Format: uuid */
71
74
  projectId?: string;
72
75
  sourceId?: string;
76
+ /** Format: uuid */
73
77
  teamId?: string;
74
78
  name: string;
75
79
  size: number;
@@ -87,6 +91,7 @@ interface paths {
87
91
  };
88
92
  content: {
89
93
  "application/json": {
94
+ /** Format: uuid */
90
95
  id: string;
91
96
  uploadUrl: string;
92
97
  /** @enum {string} */
@@ -122,6 +127,7 @@ interface paths {
122
127
  url?: string;
123
128
  fileId?: string;
124
129
  sourceId?: string;
130
+ /** Format: uuid */
125
131
  projectId?: string;
126
132
  };
127
133
  };
@@ -134,6 +140,7 @@ interface paths {
134
140
  };
135
141
  content: {
136
142
  "application/json": {
143
+ /** Format: uuid */
137
144
  id: string;
138
145
  };
139
146
  };
@@ -154,7 +161,62 @@ interface paths {
154
161
  };
155
162
  options?: never;
156
163
  head?: never;
157
- 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
+ };
158
220
  trace?: never;
159
221
  };
160
222
  }
@@ -218,6 +280,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
218
280
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
219
281
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
220
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'];
221
285
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
222
286
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
223
287
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -240,6 +304,20 @@ declare class FileClient extends ApiClient {
240
304
  delete(options: FileDeleteRequest): Promise<{
241
305
  id: string;
242
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
+ }>;
243
321
  }
244
322
  declare class UncachedFileClient extends FileClient {
245
323
  constructor(options: Omit<ClientOptions & {
@@ -266,4 +344,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
266
344
  declare const FILE_TYPES_ALL: string[];
267
345
  declare const FILE_MIME_TYPES_ALL: string[];
268
346
 
269
- 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
@@ -30,6 +30,7 @@ interface paths {
30
30
  };
31
31
  content: {
32
32
  "application/json": {
33
+ /** Format: uuid */
33
34
  id: string;
34
35
  state: number;
35
36
  url?: string;
@@ -67,9 +68,12 @@ interface paths {
67
68
  requestBody: {
68
69
  content: {
69
70
  "application/json": {
71
+ /** Format: uuid */
70
72
  id?: string;
73
+ /** Format: uuid */
71
74
  projectId?: string;
72
75
  sourceId?: string;
76
+ /** Format: uuid */
73
77
  teamId?: string;
74
78
  name: string;
75
79
  size: number;
@@ -87,6 +91,7 @@ interface paths {
87
91
  };
88
92
  content: {
89
93
  "application/json": {
94
+ /** Format: uuid */
90
95
  id: string;
91
96
  uploadUrl: string;
92
97
  /** @enum {string} */
@@ -122,6 +127,7 @@ interface paths {
122
127
  url?: string;
123
128
  fileId?: string;
124
129
  sourceId?: string;
130
+ /** Format: uuid */
125
131
  projectId?: string;
126
132
  };
127
133
  };
@@ -134,6 +140,7 @@ interface paths {
134
140
  };
135
141
  content: {
136
142
  "application/json": {
143
+ /** Format: uuid */
137
144
  id: string;
138
145
  };
139
146
  };
@@ -154,7 +161,62 @@ interface paths {
154
161
  };
155
162
  options?: never;
156
163
  head?: never;
157
- 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
+ };
158
220
  trace?: never;
159
221
  };
160
222
  }
@@ -218,6 +280,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
218
280
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
219
281
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
220
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'];
221
285
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
222
286
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
223
287
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -240,6 +304,20 @@ declare class FileClient extends ApiClient {
240
304
  delete(options: FileDeleteRequest): Promise<{
241
305
  id: string;
242
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
+ }>;
243
321
  }
244
322
  declare class UncachedFileClient extends FileClient {
245
323
  constructor(options: Omit<ClientOptions & {
@@ -266,4 +344,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
266
344
  declare const FILE_TYPES_ALL: string[];
267
345
  declare const FILE_MIME_TYPES_ALL: string[];
268
346
 
269
- 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.65.0",
3
+ "version": "20.66.0",
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.65.0"
37
+ "@uniformdev/context": "20.66.0"
38
38
  },
39
- "gitHead": "3c85a58c461592970dbff8f166067d61da7955e3"
39
+ "gitHead": "13647d6ac2860218bede840b73d214888637811c"
40
40
  }