@uniformdev/files 20.74.7-alpha.12 → 20.74.7-alpha.14.sha-79426f9415

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
@@ -8,7 +8,7 @@ interface paths {
8
8
  path?: never;
9
9
  cookie?: never;
10
10
  };
11
- /** @description Gets a single file */
11
+ /** Gets a single file */
12
12
  get: {
13
13
  parameters: {
14
14
  query?: {
@@ -23,7 +23,7 @@ interface paths {
23
23
  };
24
24
  requestBody?: never;
25
25
  responses: {
26
- /** @description 200 response */
26
+ /** 200 response */
27
27
  200: {
28
28
  headers: {
29
29
  [name: string]: unknown;
@@ -47,7 +47,7 @@ interface paths {
47
47
  400: components["responses"]["BadRequestError"];
48
48
  401: components["responses"]["UnauthorizedError"];
49
49
  403: components["responses"]["ForbiddenError"];
50
- /** @description 404 response */
50
+ /** 404 response */
51
51
  404: {
52
52
  headers: {
53
53
  [name: string]: unknown;
@@ -59,7 +59,7 @@ interface paths {
59
59
  };
60
60
  };
61
61
  put?: never;
62
- /** @description Creates a new file */
62
+ /** Creates a new file */
63
63
  post: {
64
64
  parameters: {
65
65
  query?: never;
@@ -84,14 +84,14 @@ interface paths {
84
84
  height?: number;
85
85
  /**
86
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.
87
+ * 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
88
  */
89
89
  expiresAt?: string;
90
90
  };
91
91
  };
92
92
  };
93
93
  responses: {
94
- /** @description 202 response */
94
+ /** 202 response */
95
95
  202: {
96
96
  headers: {
97
97
  [name: string]: unknown;
@@ -109,7 +109,7 @@ interface paths {
109
109
  400: components["responses"]["BadRequestError"];
110
110
  401: components["responses"]["UnauthorizedError"];
111
111
  403: components["responses"]["ForbiddenError"];
112
- /** @description 404 response */
112
+ /** 404 response */
113
113
  404: {
114
114
  headers: {
115
115
  [name: string]: unknown;
@@ -120,7 +120,7 @@ interface paths {
120
120
  500: components["responses"]["InternalServerError"];
121
121
  };
122
122
  };
123
- /** @description Deletes a file */
123
+ /** Deletes a file */
124
124
  delete: {
125
125
  parameters: {
126
126
  query?: never;
@@ -140,7 +140,7 @@ interface paths {
140
140
  };
141
141
  };
142
142
  responses: {
143
- /** @description 200 response */
143
+ /** 200 response */
144
144
  200: {
145
145
  headers: {
146
146
  [name: string]: unknown;
@@ -155,7 +155,7 @@ interface paths {
155
155
  400: components["responses"]["BadRequestError"];
156
156
  401: components["responses"]["UnauthorizedError"];
157
157
  403: components["responses"]["ForbiddenError"];
158
- /** @description 404 response */
158
+ /** 404 response */
159
159
  404: {
160
160
  headers: {
161
161
  [name: string]: unknown;
@@ -168,7 +168,7 @@ interface paths {
168
168
  };
169
169
  options?: never;
170
170
  head?: never;
171
- /** @description Replaces a file while preserving the existing URL */
171
+ /** Replaces a file while preserving the existing URL */
172
172
  patch: {
173
173
  parameters: {
174
174
  query?: never;
@@ -189,7 +189,7 @@ interface paths {
189
189
  };
190
190
  };
191
191
  responses: {
192
- /** @description 200 response */
192
+ /** 200 response */
193
193
  200: {
194
194
  headers: {
195
195
  [name: string]: unknown;
@@ -215,13 +215,20 @@ interface paths {
215
215
  400: components["responses"]["BadRequestError"];
216
216
  401: components["responses"]["UnauthorizedError"];
217
217
  403: components["responses"]["ForbiddenError"];
218
- /** @description 404 response */
218
+ /** 404 response */
219
219
  404: {
220
220
  headers: {
221
221
  [name: string]: unknown;
222
222
  };
223
223
  content?: never;
224
224
  };
225
+ /** Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
226
+ 409: {
227
+ headers: {
228
+ [name: string]: unknown;
229
+ };
230
+ content?: never;
231
+ };
225
232
  429: components["responses"]["RateLimitError"];
226
233
  500: components["responses"]["InternalServerError"];
227
234
  };
@@ -232,12 +239,12 @@ interface paths {
232
239
  interface components {
233
240
  schemas: {
234
241
  Error: {
235
- /** @description Error message(s) that occurred while processing the request */
242
+ /** Error message(s) that occurred while processing the request */
236
243
  errorMessage?: string[] | string;
237
244
  };
238
245
  };
239
246
  responses: {
240
- /** @description Request input validation failed */
247
+ /** Request input validation failed */
241
248
  BadRequestError: {
242
249
  headers: {
243
250
  [name: string]: unknown;
@@ -246,7 +253,7 @@ interface components {
246
253
  "application/json": components["schemas"]["Error"];
247
254
  };
248
255
  };
249
- /** @description API key or token was not valid */
256
+ /** API key or token was not valid */
250
257
  UnauthorizedError: {
251
258
  headers: {
252
259
  [name: string]: unknown;
@@ -255,7 +262,7 @@ interface components {
255
262
  "application/json": components["schemas"]["Error"];
256
263
  };
257
264
  };
258
- /** @description Permission was denied */
265
+ /** Permission was denied */
259
266
  ForbiddenError: {
260
267
  headers: {
261
268
  [name: string]: unknown;
@@ -264,14 +271,14 @@ interface components {
264
271
  "application/json": components["schemas"]["Error"];
265
272
  };
266
273
  };
267
- /** @description Too many requests in allowed time period */
274
+ /** Too many requests in allowed time period */
268
275
  RateLimitError: {
269
276
  headers: {
270
277
  [name: string]: unknown;
271
278
  };
272
279
  content?: never;
273
280
  };
274
- /** @description Execution error occurred */
281
+ /** Execution error occurred */
275
282
  InternalServerError: {
276
283
  headers: {
277
284
  [name: string]: unknown;
@@ -340,6 +347,12 @@ declare class UncachedFileClient extends FileClient {
340
347
  }, 'bypassCache'>);
341
348
  }
342
349
 
350
+ /**
351
+ * Extracts and decodes the original filename from a Uniform file URL.
352
+ *
353
+ * The filename is decoded once. If it contains malformed percent encoding,
354
+ * the encoded filename is returned unchanged.
355
+ */
343
356
  declare const getFileNameFromUrl: (fileUrl: string) => string;
344
357
 
345
358
  /** Constant for an in-progress file state. Subject to change. */
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface paths {
8
8
  path?: never;
9
9
  cookie?: never;
10
10
  };
11
- /** @description Gets a single file */
11
+ /** Gets a single file */
12
12
  get: {
13
13
  parameters: {
14
14
  query?: {
@@ -23,7 +23,7 @@ interface paths {
23
23
  };
24
24
  requestBody?: never;
25
25
  responses: {
26
- /** @description 200 response */
26
+ /** 200 response */
27
27
  200: {
28
28
  headers: {
29
29
  [name: string]: unknown;
@@ -47,7 +47,7 @@ interface paths {
47
47
  400: components["responses"]["BadRequestError"];
48
48
  401: components["responses"]["UnauthorizedError"];
49
49
  403: components["responses"]["ForbiddenError"];
50
- /** @description 404 response */
50
+ /** 404 response */
51
51
  404: {
52
52
  headers: {
53
53
  [name: string]: unknown;
@@ -59,7 +59,7 @@ interface paths {
59
59
  };
60
60
  };
61
61
  put?: never;
62
- /** @description Creates a new file */
62
+ /** Creates a new file */
63
63
  post: {
64
64
  parameters: {
65
65
  query?: never;
@@ -84,14 +84,14 @@ interface paths {
84
84
  height?: number;
85
85
  /**
86
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.
87
+ * 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
88
  */
89
89
  expiresAt?: string;
90
90
  };
91
91
  };
92
92
  };
93
93
  responses: {
94
- /** @description 202 response */
94
+ /** 202 response */
95
95
  202: {
96
96
  headers: {
97
97
  [name: string]: unknown;
@@ -109,7 +109,7 @@ interface paths {
109
109
  400: components["responses"]["BadRequestError"];
110
110
  401: components["responses"]["UnauthorizedError"];
111
111
  403: components["responses"]["ForbiddenError"];
112
- /** @description 404 response */
112
+ /** 404 response */
113
113
  404: {
114
114
  headers: {
115
115
  [name: string]: unknown;
@@ -120,7 +120,7 @@ interface paths {
120
120
  500: components["responses"]["InternalServerError"];
121
121
  };
122
122
  };
123
- /** @description Deletes a file */
123
+ /** Deletes a file */
124
124
  delete: {
125
125
  parameters: {
126
126
  query?: never;
@@ -140,7 +140,7 @@ interface paths {
140
140
  };
141
141
  };
142
142
  responses: {
143
- /** @description 200 response */
143
+ /** 200 response */
144
144
  200: {
145
145
  headers: {
146
146
  [name: string]: unknown;
@@ -155,7 +155,7 @@ interface paths {
155
155
  400: components["responses"]["BadRequestError"];
156
156
  401: components["responses"]["UnauthorizedError"];
157
157
  403: components["responses"]["ForbiddenError"];
158
- /** @description 404 response */
158
+ /** 404 response */
159
159
  404: {
160
160
  headers: {
161
161
  [name: string]: unknown;
@@ -168,7 +168,7 @@ interface paths {
168
168
  };
169
169
  options?: never;
170
170
  head?: never;
171
- /** @description Replaces a file while preserving the existing URL */
171
+ /** Replaces a file while preserving the existing URL */
172
172
  patch: {
173
173
  parameters: {
174
174
  query?: never;
@@ -189,7 +189,7 @@ interface paths {
189
189
  };
190
190
  };
191
191
  responses: {
192
- /** @description 200 response */
192
+ /** 200 response */
193
193
  200: {
194
194
  headers: {
195
195
  [name: string]: unknown;
@@ -215,13 +215,20 @@ interface paths {
215
215
  400: components["responses"]["BadRequestError"];
216
216
  401: components["responses"]["UnauthorizedError"];
217
217
  403: components["responses"]["ForbiddenError"];
218
- /** @description 404 response */
218
+ /** 404 response */
219
219
  404: {
220
220
  headers: {
221
221
  [name: string]: unknown;
222
222
  };
223
223
  content?: never;
224
224
  };
225
+ /** Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
226
+ 409: {
227
+ headers: {
228
+ [name: string]: unknown;
229
+ };
230
+ content?: never;
231
+ };
225
232
  429: components["responses"]["RateLimitError"];
226
233
  500: components["responses"]["InternalServerError"];
227
234
  };
@@ -232,12 +239,12 @@ interface paths {
232
239
  interface components {
233
240
  schemas: {
234
241
  Error: {
235
- /** @description Error message(s) that occurred while processing the request */
242
+ /** Error message(s) that occurred while processing the request */
236
243
  errorMessage?: string[] | string;
237
244
  };
238
245
  };
239
246
  responses: {
240
- /** @description Request input validation failed */
247
+ /** Request input validation failed */
241
248
  BadRequestError: {
242
249
  headers: {
243
250
  [name: string]: unknown;
@@ -246,7 +253,7 @@ interface components {
246
253
  "application/json": components["schemas"]["Error"];
247
254
  };
248
255
  };
249
- /** @description API key or token was not valid */
256
+ /** API key or token was not valid */
250
257
  UnauthorizedError: {
251
258
  headers: {
252
259
  [name: string]: unknown;
@@ -255,7 +262,7 @@ interface components {
255
262
  "application/json": components["schemas"]["Error"];
256
263
  };
257
264
  };
258
- /** @description Permission was denied */
265
+ /** Permission was denied */
259
266
  ForbiddenError: {
260
267
  headers: {
261
268
  [name: string]: unknown;
@@ -264,14 +271,14 @@ interface components {
264
271
  "application/json": components["schemas"]["Error"];
265
272
  };
266
273
  };
267
- /** @description Too many requests in allowed time period */
274
+ /** Too many requests in allowed time period */
268
275
  RateLimitError: {
269
276
  headers: {
270
277
  [name: string]: unknown;
271
278
  };
272
279
  content?: never;
273
280
  };
274
- /** @description Execution error occurred */
281
+ /** Execution error occurred */
275
282
  InternalServerError: {
276
283
  headers: {
277
284
  [name: string]: unknown;
@@ -340,6 +347,12 @@ declare class UncachedFileClient extends FileClient {
340
347
  }, 'bypassCache'>);
341
348
  }
342
349
 
350
+ /**
351
+ * Extracts and decodes the original filename from a Uniform file URL.
352
+ *
353
+ * The filename is decoded once. If it contains malformed percent encoding,
354
+ * the encoded filename is returned unchanged.
355
+ */
343
356
  declare const getFileNameFromUrl: (fileUrl: string) => string;
344
357
 
345
358
  /** Constant for an in-progress file state. Subject to change. */
package/dist/index.esm.js CHANGED
@@ -55,7 +55,12 @@ var UncachedFileClient = class extends FileClient {
55
55
  var getFileNameFromUrl = (fileUrl) => {
56
56
  var _a;
57
57
  const url = new URL(fileUrl);
58
- return ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
58
+ const fileName = ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
59
+ try {
60
+ return decodeURIComponent(fileName);
61
+ } catch (e) {
62
+ return fileName;
63
+ }
59
64
  };
60
65
 
61
66
  // src/utils/constants.ts
package/dist/index.js CHANGED
@@ -96,7 +96,12 @@ var UncachedFileClient = class extends FileClient {
96
96
  var getFileNameFromUrl = (fileUrl) => {
97
97
  var _a;
98
98
  const url = new URL(fileUrl);
99
- return ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
99
+ const fileName = ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
100
+ try {
101
+ return decodeURIComponent(fileName);
102
+ } catch (e) {
103
+ return fileName;
104
+ }
100
105
  };
101
106
 
102
107
  // src/utils/constants.ts
package/dist/index.mjs CHANGED
@@ -55,7 +55,12 @@ var UncachedFileClient = class extends FileClient {
55
55
  var getFileNameFromUrl = (fileUrl) => {
56
56
  var _a;
57
57
  const url = new URL(fileUrl);
58
- return ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
58
+ const fileName = ((_a = url.pathname.split("/").pop()) == null ? void 0 : _a.substring(23)) || "";
59
+ try {
60
+ return decodeURIComponent(fileName);
61
+ } catch (e) {
62
+ return fileName;
63
+ }
59
64
  };
60
65
 
61
66
  // src/utils/constants.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/files",
3
- "version": "20.74.7-alpha.12+f93a44837e",
3
+ "version": "20.74.7-alpha.14.sha-79426f9415",
4
4
  "description": "Uniform Files helpers",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -26,6 +26,7 @@
26
26
  "dev:ts": "tsup --watch",
27
27
  "clean": "rimraf dist",
28
28
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
29
+ "test": "vitest run",
29
30
  "update-openapi": "tsx ./scripts/update-openapi.cts"
30
31
  },
31
32
  "files": [
@@ -35,7 +36,7 @@
35
36
  "access": "public"
36
37
  },
37
38
  "dependencies": {
38
- "@uniformdev/context": "20.74.7-alpha.12+f93a44837e"
39
+ "@uniformdev/context": "20.74.7-alpha.14.sha-79426f9415"
39
40
  },
40
- "gitHead": "f93a44837e168f8ece4f56657a29a6f72467c1cb"
41
+ "gitHead": "79426f9415aefb8cf26dd8fe7a265b24a490749c"
41
42
  }