@uniformdev/files 20.50.1 → 20.50.2-alpha.109

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
@@ -39,6 +39,8 @@ interface paths {
39
39
  metadata?: unknown;
40
40
  size: number;
41
41
  sourceId?: string;
42
+ /** Format: date-time */
43
+ expiresAt?: string;
42
44
  };
43
45
  };
44
46
  };
@@ -80,6 +82,11 @@ interface paths {
80
82
  mediaType: string;
81
83
  width?: number;
82
84
  height?: number;
85
+ /**
86
+ * Format: date-time
87
+ * @description Optional expiry time for temporary uploads. If set, and the file is not attached to an asset at that time, it will be automatically deleted.
88
+ */
89
+ expiresAt?: string;
83
90
  };
84
91
  };
85
92
  };
@@ -161,7 +168,64 @@ interface paths {
161
168
  };
162
169
  options?: never;
163
170
  head?: never;
164
- patch?: never;
171
+ /** @description Replaces a file while preserving the existing URL */
172
+ patch: {
173
+ parameters: {
174
+ query?: never;
175
+ header?: never;
176
+ path?: never;
177
+ cookie?: never;
178
+ };
179
+ requestBody: {
180
+ content: {
181
+ "application/json": {
182
+ /** Format: uuid */
183
+ projectId: string;
184
+ /** Format: uuid */
185
+ existingFileId: string;
186
+ /** Format: uuid */
187
+ replacementFileId: string;
188
+ };
189
+ };
190
+ };
191
+ responses: {
192
+ /** @description 200 response */
193
+ 200: {
194
+ headers: {
195
+ [name: string]: unknown;
196
+ };
197
+ content: {
198
+ "application/json": {
199
+ /** Format: uuid */
200
+ id: string;
201
+ state: number;
202
+ url?: string;
203
+ name: string;
204
+ mediaType: string;
205
+ metadata?: unknown;
206
+ size: number;
207
+ sourceId?: string;
208
+ /** Format: date-time */
209
+ expiresAt?: string;
210
+ /** Format: uuid */
211
+ deletedReplacementFileId?: string;
212
+ };
213
+ };
214
+ };
215
+ 400: components["responses"]["BadRequestError"];
216
+ 401: components["responses"]["UnauthorizedError"];
217
+ 403: components["responses"]["ForbiddenError"];
218
+ /** @description 404 response */
219
+ 404: {
220
+ headers: {
221
+ [name: string]: unknown;
222
+ };
223
+ content?: never;
224
+ };
225
+ 429: components["responses"]["RateLimitError"];
226
+ 500: components["responses"]["InternalServerError"];
227
+ };
228
+ };
165
229
  trace?: never;
166
230
  };
167
231
  }
@@ -225,6 +289,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
225
289
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
226
290
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
227
291
  type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
292
+ type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json'];
293
+ type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json'];
228
294
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
229
295
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
230
296
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -247,6 +313,21 @@ declare class FileClient extends ApiClient {
247
313
  delete(options: FileDeleteRequest): Promise<{
248
314
  id: string;
249
315
  }>;
316
+ /**
317
+ * Replaces the contents behind an existing file while preserving its URL.
318
+ */
319
+ replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{
320
+ id: string;
321
+ state: number;
322
+ url?: string;
323
+ name: string;
324
+ mediaType: string;
325
+ metadata?: unknown;
326
+ size: number;
327
+ sourceId?: string;
328
+ expiresAt?: string;
329
+ deletedReplacementFileId?: string;
330
+ }>;
250
331
  }
251
332
  declare class UncachedFileClient extends FileClient {
252
333
  constructor(options: Omit<ClientOptions & {
@@ -273,4 +354,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
273
354
  declare const FILE_TYPES_ALL: string[];
274
355
  declare const FILE_MIME_TYPES_ALL: string[];
275
356
 
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 };
357
+ 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
@@ -39,6 +39,8 @@ interface paths {
39
39
  metadata?: unknown;
40
40
  size: number;
41
41
  sourceId?: string;
42
+ /** Format: date-time */
43
+ expiresAt?: string;
42
44
  };
43
45
  };
44
46
  };
@@ -80,6 +82,11 @@ interface paths {
80
82
  mediaType: string;
81
83
  width?: number;
82
84
  height?: number;
85
+ /**
86
+ * Format: date-time
87
+ * @description Optional expiry time for temporary uploads. If set, and the file is not attached to an asset at that time, it will be automatically deleted.
88
+ */
89
+ expiresAt?: string;
83
90
  };
84
91
  };
85
92
  };
@@ -161,7 +168,64 @@ interface paths {
161
168
  };
162
169
  options?: never;
163
170
  head?: never;
164
- patch?: never;
171
+ /** @description Replaces a file while preserving the existing URL */
172
+ patch: {
173
+ parameters: {
174
+ query?: never;
175
+ header?: never;
176
+ path?: never;
177
+ cookie?: never;
178
+ };
179
+ requestBody: {
180
+ content: {
181
+ "application/json": {
182
+ /** Format: uuid */
183
+ projectId: string;
184
+ /** Format: uuid */
185
+ existingFileId: string;
186
+ /** Format: uuid */
187
+ replacementFileId: string;
188
+ };
189
+ };
190
+ };
191
+ responses: {
192
+ /** @description 200 response */
193
+ 200: {
194
+ headers: {
195
+ [name: string]: unknown;
196
+ };
197
+ content: {
198
+ "application/json": {
199
+ /** Format: uuid */
200
+ id: string;
201
+ state: number;
202
+ url?: string;
203
+ name: string;
204
+ mediaType: string;
205
+ metadata?: unknown;
206
+ size: number;
207
+ sourceId?: string;
208
+ /** Format: date-time */
209
+ expiresAt?: string;
210
+ /** Format: uuid */
211
+ deletedReplacementFileId?: string;
212
+ };
213
+ };
214
+ };
215
+ 400: components["responses"]["BadRequestError"];
216
+ 401: components["responses"]["UnauthorizedError"];
217
+ 403: components["responses"]["ForbiddenError"];
218
+ /** @description 404 response */
219
+ 404: {
220
+ headers: {
221
+ [name: string]: unknown;
222
+ };
223
+ content?: never;
224
+ };
225
+ 429: components["responses"]["RateLimitError"];
226
+ 500: components["responses"]["InternalServerError"];
227
+ };
228
+ };
165
229
  trace?: never;
166
230
  };
167
231
  }
@@ -225,6 +289,8 @@ type FileInsertRequest = paths['/api/v1/files']['post']['requestBody']['content'
225
289
  type FileInsertResponse = paths['/api/v1/files']['post']['responses']['202']['content']['application/json'];
226
290
  type FileDeleteRequest = paths['/api/v1/files']['delete']['requestBody']['content']['application/json'];
227
291
  type FileDeleteResponse = paths['/api/v1/files']['delete']['responses']['200']['content']['application/json'];
292
+ type FileReplaceRequest = paths['/api/v1/files']['patch']['requestBody']['content']['application/json'];
293
+ type FileReplaceResponse = paths['/api/v1/files']['patch']['responses']['200']['content']['application/json'];
228
294
  type FileGetRequest = Required<paths['/api/v1/files']['get']['parameters']>['query'];
229
295
  type FileGetByIDRequest = Pick<FileGetRequest, 'id'>;
230
296
  type FileGetByURLRequest = Pick<FileGetRequest, 'url' | 'projectId'>;
@@ -247,6 +313,21 @@ declare class FileClient extends ApiClient {
247
313
  delete(options: FileDeleteRequest): Promise<{
248
314
  id: string;
249
315
  }>;
316
+ /**
317
+ * Replaces the contents behind an existing file while preserving its URL.
318
+ */
319
+ replace(options: WithoutProjectId<FileReplaceRequest>): Promise<{
320
+ id: string;
321
+ state: number;
322
+ url?: string;
323
+ name: string;
324
+ mediaType: string;
325
+ metadata?: unknown;
326
+ size: number;
327
+ sourceId?: string;
328
+ expiresAt?: string;
329
+ deletedReplacementFileId?: string;
330
+ }>;
250
331
  }
251
332
  declare class UncachedFileClient extends FileClient {
252
333
  constructor(options: Omit<ClientOptions & {
@@ -273,4 +354,4 @@ declare const FILE_MIME_TYPES_OTHER: string[];
273
354
  declare const FILE_TYPES_ALL: string[];
274
355
  declare const FILE_MIME_TYPES_ALL: string[];
275
356
 
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 };
357
+ 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) {
@@ -80,9 +91,11 @@ var FILE_TYPES_VIDEO = [".mp4", ".webm", ".ogg"];
80
91
  var FILE_MIME_TYPES_VIDEO = ["video/mp4", "video/webm", "video/ogg"];
81
92
  var FILE_TYPES_AUDIO = [".mp3", ".wav", ".ogg", ".flac"];
82
93
  var FILE_MIME_TYPES_AUDIO = ["audio/mpeg", "audio/mp4", "audio/wav", "audio/ogg", "audio/flac"];
83
- var FILE_TYPES_OTHER = [".pdf", ".json", ".zip", ".lottie", ".srt", ".vtt"];
94
+ var FILE_TYPES_OTHER = [".pdf", ".txt", ".md", ".json", ".zip", ".lottie", ".srt", ".vtt"];
84
95
  var FILE_MIME_TYPES_OTHER = [
85
96
  "application/pdf",
97
+ "text/plain",
98
+ "text/markdown",
86
99
  "application/json",
87
100
  "application/zip",
88
101
  "application/zip+dotlottie",
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) {
@@ -121,9 +132,11 @@ var FILE_TYPES_VIDEO = [".mp4", ".webm", ".ogg"];
121
132
  var FILE_MIME_TYPES_VIDEO = ["video/mp4", "video/webm", "video/ogg"];
122
133
  var FILE_TYPES_AUDIO = [".mp3", ".wav", ".ogg", ".flac"];
123
134
  var FILE_MIME_TYPES_AUDIO = ["audio/mpeg", "audio/mp4", "audio/wav", "audio/ogg", "audio/flac"];
124
- var FILE_TYPES_OTHER = [".pdf", ".json", ".zip", ".lottie", ".srt", ".vtt"];
135
+ var FILE_TYPES_OTHER = [".pdf", ".txt", ".md", ".json", ".zip", ".lottie", ".srt", ".vtt"];
125
136
  var FILE_MIME_TYPES_OTHER = [
126
137
  "application/pdf",
138
+ "text/plain",
139
+ "text/markdown",
127
140
  "application/json",
128
141
  "application/zip",
129
142
  "application/zip+dotlottie",
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) {
@@ -80,9 +91,11 @@ var FILE_TYPES_VIDEO = [".mp4", ".webm", ".ogg"];
80
91
  var FILE_MIME_TYPES_VIDEO = ["video/mp4", "video/webm", "video/ogg"];
81
92
  var FILE_TYPES_AUDIO = [".mp3", ".wav", ".ogg", ".flac"];
82
93
  var FILE_MIME_TYPES_AUDIO = ["audio/mpeg", "audio/mp4", "audio/wav", "audio/ogg", "audio/flac"];
83
- var FILE_TYPES_OTHER = [".pdf", ".json", ".zip", ".lottie", ".srt", ".vtt"];
94
+ var FILE_TYPES_OTHER = [".pdf", ".txt", ".md", ".json", ".zip", ".lottie", ".srt", ".vtt"];
84
95
  var FILE_MIME_TYPES_OTHER = [
85
96
  "application/pdf",
97
+ "text/plain",
98
+ "text/markdown",
86
99
  "application/json",
87
100
  "application/zip",
88
101
  "application/zip+dotlottie",
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@uniformdev/files",
3
- "version": "20.50.1",
3
+ "version": "20.50.2-alpha.109+846837c66a",
4
4
  "description": "Uniform Files helpers",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.esm.js",
8
8
  "exports": {
9
+ "source": "./src/index.ts",
9
10
  "import": {
10
11
  "types": "./dist/index.d.ts",
11
12
  "node": "./dist/index.mjs",
@@ -24,7 +25,6 @@
24
25
  "dev": "run-s update-openapi dev:ts",
25
26
  "dev:ts": "tsup --watch",
26
27
  "clean": "rimraf dist",
27
- "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
28
28
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
29
29
  "update-openapi": "tsx ./scripts/update-openapi.cts"
30
30
  },
@@ -35,7 +35,7 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@uniformdev/context": "20.50.1"
38
+ "@uniformdev/context": "20.50.2-alpha.109+846837c66a"
39
39
  },
40
- "gitHead": "696a2df1399a5b68564f931286806b2597f6fa64"
40
+ "gitHead": "846837c66ad0f518683c100615b59b27f91498ba"
41
41
  }