@lumeweb/pinner 0.1.12 → 0.1.13
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/esm/config.d.ts
CHANGED
|
@@ -40,11 +40,23 @@ interface PinnerConfig {
|
|
|
40
40
|
storage?: Storage;
|
|
41
41
|
/**
|
|
42
42
|
* Custom base name for Helia storage.
|
|
43
|
-
* Passed as the
|
|
43
|
+
* Passed as the base option to both blockstore and datastore storage instances.
|
|
44
44
|
* Only used when neither datastore nor storage are provided.
|
|
45
45
|
* @default "pinner-helia-data"
|
|
46
46
|
*/
|
|
47
47
|
datastoreName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Upload request timeout in milliseconds.
|
|
50
|
+
* Applied to XHR uploads. TUS does not expose a timeout option.
|
|
51
|
+
* @default 120_000
|
|
52
|
+
*/
|
|
53
|
+
timeout?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Number of retry attempts for failed uploads.
|
|
56
|
+
* Applied to XHR uploads (TUS uses retryDelays instead).
|
|
57
|
+
* @default 3
|
|
58
|
+
*/
|
|
59
|
+
retries?: number;
|
|
48
60
|
}
|
|
49
61
|
//#endregion
|
|
50
62
|
export { PinnerConfig };
|
|
@@ -9,7 +9,9 @@ var XHRUploadHandler = class extends BaseUploadHandler {
|
|
|
9
9
|
endpoint: `${this.config.endpoint}/api/upload`,
|
|
10
10
|
fieldName: "file",
|
|
11
11
|
formData: true,
|
|
12
|
-
headers: { Authorization: `Bearer ${this.config.jwt}` }
|
|
12
|
+
headers: { Authorization: `Bearer ${this.config.jwt}` },
|
|
13
|
+
timeout: this.config.timeout,
|
|
14
|
+
retries: this.config.retries
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
parseResult(result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr-upload.js","names":[],"sources":["../../../src/upload/xhr-upload.ts"],"sourcesContent":["import Uppy from \"@uppy/core\";\nimport XHRUpload from \"@lumeweb/uppy-post-upload\";\nimport type { UploadResult } from \"@/types/upload\";\nimport { BaseUploadHandler } from \"./base-upload\";\nimport { UPLOAD_SOURCE_XHR } from \"./constants\";\n\nexport class XHRUploadHandler extends BaseUploadHandler {\n protected configurePlugin(uppy: Uppy): void {\n uppy.use(XHRUpload, {\n endpoint: `${this.config.endpoint}/api/upload`,\n fieldName: \"file\",\n formData: true,\n headers: {\n Authorization: `Bearer ${this.config.jwt}`,\n },\n });\n }\n\n protected parseResult(result: unknown): UploadResult {\n const uppyResponse = result as {\n uploadURL: string;\n body?: unknown;\n };\n\n const body = uppyResponse.body;\n const uploadId = uppyResponse.uploadURL?.split(\"/\").pop() || \"\";\n\n return this.mapUploadResponse(body, uploadId);\n }\n\n protected getUploadSource(): string {\n return UPLOAD_SOURCE_XHR;\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,mBAAb,cAAsC,kBAAkB;CACtD,AAAU,gBAAgB,MAAkB;AAC1C,OAAK,IAAI,WAAW;GAClB,UAAU,GAAG,KAAK,OAAO,SAAS;GAClC,WAAW;GACX,UAAU;GACV,SAAS,EACP,eAAe,UAAU,KAAK,OAAO,OACtC;
|
|
1
|
+
{"version":3,"file":"xhr-upload.js","names":[],"sources":["../../../src/upload/xhr-upload.ts"],"sourcesContent":["import Uppy from \"@uppy/core\";\nimport XHRUpload from \"@lumeweb/uppy-post-upload\";\nimport type { UploadResult } from \"@/types/upload\";\nimport { BaseUploadHandler } from \"./base-upload\";\nimport { UPLOAD_SOURCE_XHR } from \"./constants\";\n\nexport class XHRUploadHandler extends BaseUploadHandler {\n protected configurePlugin(uppy: Uppy): void {\n uppy.use(XHRUpload, {\n endpoint: `${this.config.endpoint}/api/upload`,\n fieldName: \"file\",\n formData: true,\n headers: {\n Authorization: `Bearer ${this.config.jwt}`,\n },\n timeout: this.config.timeout,\n retries: this.config.retries,\n });\n }\n\n protected parseResult(result: unknown): UploadResult {\n const uppyResponse = result as {\n uploadURL: string;\n body?: unknown;\n };\n\n const body = uppyResponse.body;\n const uploadId = uppyResponse.uploadURL?.split(\"/\").pop() || \"\";\n\n return this.mapUploadResponse(body, uploadId);\n }\n\n protected getUploadSource(): string {\n return UPLOAD_SOURCE_XHR;\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,mBAAb,cAAsC,kBAAkB;CACtD,AAAU,gBAAgB,MAAkB;AAC1C,OAAK,IAAI,WAAW;GAClB,UAAU,GAAG,KAAK,OAAO,SAAS;GAClC,WAAW;GACX,UAAU;GACV,SAAS,EACP,eAAe,UAAU,KAAK,OAAO,OACtC;GACD,SAAS,KAAK,OAAO;GACrB,SAAS,KAAK,OAAO;GACtB,CAAC;;CAGJ,AAAU,YAAY,QAA+B;EACnD,MAAM,eAAe;EAKrB,MAAM,OAAO,aAAa;EAC1B,MAAM,WAAW,aAAa,WAAW,MAAM,IAAI,CAAC,KAAK,IAAI;AAE7D,SAAO,KAAK,kBAAkB,MAAM,SAAS;;CAG/C,AAAU,kBAA0B;AAClC,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumeweb/pinner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"tus-js-client": "4.3.1",
|
|
65
65
|
"unstorage": "^1.17.5",
|
|
66
66
|
"@lumeweb/portal-sdk": "0.1.5",
|
|
67
|
-
"@lumeweb/
|
|
68
|
-
"@lumeweb/
|
|
67
|
+
"@lumeweb/query-builder": "0.1.1",
|
|
68
|
+
"@lumeweb/uppy-post-upload": "0.1.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@faker-js/faker": "^10.4.0",
|