@uniformdev/files 20.75.1-alpha.16 → 20.75.1-alpha.7

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,14 +215,14 @@ 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
- /** @description Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
225
+ /** Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
226
226
  409: {
227
227
  headers: {
228
228
  [name: string]: unknown;
@@ -239,12 +239,12 @@ interface paths {
239
239
  interface components {
240
240
  schemas: {
241
241
  Error: {
242
- /** @description Error message(s) that occurred while processing the request */
242
+ /** Error message(s) that occurred while processing the request */
243
243
  errorMessage?: string[] | string;
244
244
  };
245
245
  };
246
246
  responses: {
247
- /** @description Request input validation failed */
247
+ /** Request input validation failed */
248
248
  BadRequestError: {
249
249
  headers: {
250
250
  [name: string]: unknown;
@@ -253,7 +253,7 @@ interface components {
253
253
  "application/json": components["schemas"]["Error"];
254
254
  };
255
255
  };
256
- /** @description API key or token was not valid */
256
+ /** API key or token was not valid */
257
257
  UnauthorizedError: {
258
258
  headers: {
259
259
  [name: string]: unknown;
@@ -262,7 +262,7 @@ interface components {
262
262
  "application/json": components["schemas"]["Error"];
263
263
  };
264
264
  };
265
- /** @description Permission was denied */
265
+ /** Permission was denied */
266
266
  ForbiddenError: {
267
267
  headers: {
268
268
  [name: string]: unknown;
@@ -271,14 +271,14 @@ interface components {
271
271
  "application/json": components["schemas"]["Error"];
272
272
  };
273
273
  };
274
- /** @description Too many requests in allowed time period */
274
+ /** Too many requests in allowed time period */
275
275
  RateLimitError: {
276
276
  headers: {
277
277
  [name: string]: unknown;
278
278
  };
279
279
  content?: never;
280
280
  };
281
- /** @description Execution error occurred */
281
+ /** Execution error occurred */
282
282
  InternalServerError: {
283
283
  headers: {
284
284
  [name: string]: unknown;
@@ -347,6 +347,12 @@ declare class UncachedFileClient extends FileClient {
347
347
  }, 'bypassCache'>);
348
348
  }
349
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
+ */
350
356
  declare const getFileNameFromUrl: (fileUrl: string) => string;
351
357
 
352
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,14 +215,14 @@ 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
- /** @description Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
225
+ /** Conflict: the replacement file is already attached to another asset. Use an unattached file (for example a temporary upload) as the replacement. */
226
226
  409: {
227
227
  headers: {
228
228
  [name: string]: unknown;
@@ -239,12 +239,12 @@ interface paths {
239
239
  interface components {
240
240
  schemas: {
241
241
  Error: {
242
- /** @description Error message(s) that occurred while processing the request */
242
+ /** Error message(s) that occurred while processing the request */
243
243
  errorMessage?: string[] | string;
244
244
  };
245
245
  };
246
246
  responses: {
247
- /** @description Request input validation failed */
247
+ /** Request input validation failed */
248
248
  BadRequestError: {
249
249
  headers: {
250
250
  [name: string]: unknown;
@@ -253,7 +253,7 @@ interface components {
253
253
  "application/json": components["schemas"]["Error"];
254
254
  };
255
255
  };
256
- /** @description API key or token was not valid */
256
+ /** API key or token was not valid */
257
257
  UnauthorizedError: {
258
258
  headers: {
259
259
  [name: string]: unknown;
@@ -262,7 +262,7 @@ interface components {
262
262
  "application/json": components["schemas"]["Error"];
263
263
  };
264
264
  };
265
- /** @description Permission was denied */
265
+ /** Permission was denied */
266
266
  ForbiddenError: {
267
267
  headers: {
268
268
  [name: string]: unknown;
@@ -271,14 +271,14 @@ interface components {
271
271
  "application/json": components["schemas"]["Error"];
272
272
  };
273
273
  };
274
- /** @description Too many requests in allowed time period */
274
+ /** Too many requests in allowed time period */
275
275
  RateLimitError: {
276
276
  headers: {
277
277
  [name: string]: unknown;
278
278
  };
279
279
  content?: never;
280
280
  };
281
- /** @description Execution error occurred */
281
+ /** Execution error occurred */
282
282
  InternalServerError: {
283
283
  headers: {
284
284
  [name: string]: unknown;
@@ -347,6 +347,12 @@ declare class UncachedFileClient extends FileClient {
347
347
  }, 'bypassCache'>);
348
348
  }
349
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
+ */
350
356
  declare const getFileNameFromUrl: (fileUrl: string) => string;
351
357
 
352
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.75.1-alpha.16+4e56d1cd21",
3
+ "version": "20.75.1-alpha.7+ad3780cc13",
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.75.1-alpha.16+4e56d1cd21"
39
+ "@uniformdev/context": "20.75.1-alpha.7+ad3780cc13"
39
40
  },
40
- "gitHead": "4e56d1cd21f2d4a02b13d733e51fb71441cac298"
41
+ "gitHead": "ad3780cc13fc3e5f328db96ccd428109e09248ae"
41
42
  }