@uplift-io/uploadthing 1.0.0 → 1.1.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/LICENSE +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Uplift contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Uplift contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { UploadError, type StorageAdapter, type StoragePutInput, type UploadedFile } from \"@uplift-io/uplift\";\n\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { UploadError, type StorageAdapter, type StoragePutInput, type UploadedFile } from \"@uplift-io/uplift\";\n\nexport type UploadThingFileResult = {\n url?: string | null;\n ufsUrl?: string | null;\n appUrl?: string | null;\n key?: string | null;\n name?: string | null;\n type?: string | null;\n size?: number | null;\n};\n\nexport type UploadThingUploadResponse =\n | UploadThingFileResult\n | {\n data: UploadThingFileResult | null;\n error: { message?: string; code?: string; data?: unknown } | null;\n };\n\nexport type UploadThingUploader = (\n file: File | File[],\n input: StoragePutInput\n) => Promise<UploadThingUploadResponse | UploadThingUploadResponse[]>;\n\nexport type UploadThingOptions = {\n uploader: UploadThingUploader;\n};\n\nexport function uploadthing(options: UploadThingOptions): StorageAdapter {\n return {\n provider: \"uploadthing\",\n async put(input) {\n const result = await options.uploader(input.body, input);\n const uploaded = normalizeUploadThingResult(Array.isArray(result) ? result[0] : result);\n if (!uploaded) {\n throw new UploadError(\"UPLOAD_FAILED\", \"UploadThing did not return an uploaded file.\");\n }\n\n const url = uploaded.ufsUrl ?? uploaded.url ?? uploaded.appUrl;\n if (!url) {\n throw new UploadError(\"UPLOAD_FAILED\", \"UploadThing did not return a file URL.\");\n }\n\n return {\n url,\n key: uploaded.key ?? input.key,\n name: uploaded.name ?? input.file.name,\n type: uploaded.type ?? input.file.type,\n size: uploaded.size ?? input.file.size,\n extension: input.file.extension,\n provider: \"uploadthing\"\n } satisfies UploadedFile;\n }\n };\n}\n\nfunction normalizeUploadThingResult(result: UploadThingUploadResponse | undefined): UploadThingFileResult | undefined {\n if (!result) return undefined;\n if (isWrappedUploadThingResponse(result)) {\n if (result.error) {\n throw new UploadError(\"UPLOAD_FAILED\", result.error.message ?? \"UploadThing rejected the upload.\");\n }\n return result.data ?? undefined;\n }\n return result;\n}\n\nfunction isWrappedUploadThingResponse(result: UploadThingUploadResponse): result is Extract<\n UploadThingUploadResponse,\n { data: UploadThingFileResult | null }\n> {\n return \"data\" in result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0F;AA4BnF,SAAS,YAAY,SAA6C;AACvE,SAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM,IAAI,OAAO;AACf,YAAM,SAAS,MAAM,QAAQ,SAAS,MAAM,MAAM,KAAK;AACvD,YAAM,WAAW,2BAA2B,MAAM,QAAQ,MAAM,IAAI,OAAO,CAAC,IAAI,MAAM;AACtF,UAAI,CAAC,UAAU;AACb,cAAM,IAAI,0BAAY,iBAAiB,8CAA8C;AAAA,MACvF;AAEA,YAAM,MAAM,SAAS,UAAU,SAAS,OAAO,SAAS;AACxD,UAAI,CAAC,KAAK;AACR,cAAM,IAAI,0BAAY,iBAAiB,wCAAwC;AAAA,MACjF;AAEA,aAAO;AAAA,QACL;AAAA,QACA,KAAK,SAAS,OAAO,MAAM;AAAA,QAC3B,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,WAAW,MAAM,KAAK;AAAA,QACtB,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BAA2B,QAAkF;AACpH,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,6BAA6B,MAAM,GAAG;AACxC,QAAI,OAAO,OAAO;AAChB,YAAM,IAAI,0BAAY,iBAAiB,OAAO,MAAM,WAAW,kCAAkC;AAAA,IACnG;AACA,WAAO,OAAO,QAAQ;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,6BAA6B,QAGpC;AACA,SAAO,UAAU;AACnB;","names":[]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { UploadError, type StorageAdapter, type StoragePutInput, type UploadedFile } from \"@uplift-io/uplift\";\n\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { UploadError, type StorageAdapter, type StoragePutInput, type UploadedFile } from \"@uplift-io/uplift\";\n\nexport type UploadThingFileResult = {\n url?: string | null;\n ufsUrl?: string | null;\n appUrl?: string | null;\n key?: string | null;\n name?: string | null;\n type?: string | null;\n size?: number | null;\n};\n\nexport type UploadThingUploadResponse =\n | UploadThingFileResult\n | {\n data: UploadThingFileResult | null;\n error: { message?: string; code?: string; data?: unknown } | null;\n };\n\nexport type UploadThingUploader = (\n file: File | File[],\n input: StoragePutInput\n) => Promise<UploadThingUploadResponse | UploadThingUploadResponse[]>;\n\nexport type UploadThingOptions = {\n uploader: UploadThingUploader;\n};\n\nexport function uploadthing(options: UploadThingOptions): StorageAdapter {\n return {\n provider: \"uploadthing\",\n async put(input) {\n const result = await options.uploader(input.body, input);\n const uploaded = normalizeUploadThingResult(Array.isArray(result) ? result[0] : result);\n if (!uploaded) {\n throw new UploadError(\"UPLOAD_FAILED\", \"UploadThing did not return an uploaded file.\");\n }\n\n const url = uploaded.ufsUrl ?? uploaded.url ?? uploaded.appUrl;\n if (!url) {\n throw new UploadError(\"UPLOAD_FAILED\", \"UploadThing did not return a file URL.\");\n }\n\n return {\n url,\n key: uploaded.key ?? input.key,\n name: uploaded.name ?? input.file.name,\n type: uploaded.type ?? input.file.type,\n size: uploaded.size ?? input.file.size,\n extension: input.file.extension,\n provider: \"uploadthing\"\n } satisfies UploadedFile;\n }\n };\n}\n\nfunction normalizeUploadThingResult(result: UploadThingUploadResponse | undefined): UploadThingFileResult | undefined {\n if (!result) return undefined;\n if (isWrappedUploadThingResponse(result)) {\n if (result.error) {\n throw new UploadError(\"UPLOAD_FAILED\", result.error.message ?? \"UploadThing rejected the upload.\");\n }\n return result.data ?? undefined;\n }\n return result;\n}\n\nfunction isWrappedUploadThingResponse(result: UploadThingUploadResponse): result is Extract<\n UploadThingUploadResponse,\n { data: UploadThingFileResult | null }\n> {\n return \"data\" in result;\n}\n"],"mappings":";AAAA,SAAS,mBAAiF;AA4BnF,SAAS,YAAY,SAA6C;AACvE,SAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM,IAAI,OAAO;AACf,YAAM,SAAS,MAAM,QAAQ,SAAS,MAAM,MAAM,KAAK;AACvD,YAAM,WAAW,2BAA2B,MAAM,QAAQ,MAAM,IAAI,OAAO,CAAC,IAAI,MAAM;AACtF,UAAI,CAAC,UAAU;AACb,cAAM,IAAI,YAAY,iBAAiB,8CAA8C;AAAA,MACvF;AAEA,YAAM,MAAM,SAAS,UAAU,SAAS,OAAO,SAAS;AACxD,UAAI,CAAC,KAAK;AACR,cAAM,IAAI,YAAY,iBAAiB,wCAAwC;AAAA,MACjF;AAEA,aAAO;AAAA,QACL;AAAA,QACA,KAAK,SAAS,OAAO,MAAM;AAAA,QAC3B,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,MAAM,SAAS,QAAQ,MAAM,KAAK;AAAA,QAClC,WAAW,MAAM,KAAK;AAAA,QACtB,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BAA2B,QAAkF;AACpH,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,6BAA6B,MAAM,GAAG;AACxC,QAAI,OAAO,OAAO;AAChB,YAAM,IAAI,YAAY,iBAAiB,OAAO,MAAM,WAAW,kCAAkC;AAAA,IACnG;AACA,WAAO,OAAO,QAAQ;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,6BAA6B,QAGpC;AACA,SAAO,UAAU;AACnB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uplift-io/uploadthing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@uplift-io/uplift": "1.
|
|
19
|
+
"@uplift-io/uplift": "1.1.0"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"homepage": "https://itzfeminisce.github.io/uplift/",
|