@lumeweb/pinner 0.1.11 → 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 };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { BlockMetaResponse } from "./api/generated/schemas/blockMetaResponse.js";
|
|
2
|
+
import { Component } from "./api/generated/schemas/component.js";
|
|
3
|
+
import { ErrorResponse } from "./api/generated/schemas/errorResponse.js";
|
|
4
|
+
import { FileManagerItem } from "./api/generated/schemas/fileManagerItem.js";
|
|
5
|
+
import { FileManagerItemResponse } from "./api/generated/schemas/fileManagerItemResponse.js";
|
|
6
|
+
import { InfoResponse } from "./api/generated/schemas/infoResponse.js";
|
|
7
|
+
import { PinRequestMeta } from "./api/generated/schemas/pinRequestMeta.js";
|
|
8
|
+
import { PinRequest } from "./api/generated/schemas/pinRequest.js";
|
|
9
|
+
import { PinStatusResponseInfo } from "./api/generated/schemas/pinStatusResponseInfo.js";
|
|
10
|
+
import { PinStatusResponse } from "./api/generated/schemas/pinStatusResponse.js";
|
|
11
|
+
import { PinResultsResponse } from "./api/generated/schemas/pinResultsResponse.js";
|
|
12
|
+
import { PostUploadResponse } from "./api/generated/schemas/postUploadResponse.js";
|
|
13
|
+
import { UploadResultResponse } from "./api/generated/schemas/uploadResultResponse.js";
|
|
1
14
|
import { PinnerConfig } from "./config.js";
|
|
2
15
|
import { IpnsClient } from "./api/ipns.js";
|
|
3
16
|
import { WebsiteValidationReason, WebsiteValidationReasonValue, WebsitesClient, getValidationReason, isValidationReason } from "./api/websites.js";
|
|
@@ -15,4 +28,4 @@ import { asyncGeneratorToReadableStream, calculateStreamSize, readableStreamToAs
|
|
|
15
28
|
import { PinataAdapter } from "./adapters/pinata/v2/adapter-interface.js";
|
|
16
29
|
import { pinataAdapter } from "./adapters/pinata/v2/adapter.js";
|
|
17
30
|
import { PinataLegacyAdapter, pinataLegacyAdapter } from "./adapters/pinata/legacy/adapter.js";
|
|
18
|
-
export { type AbortOptions, AuthenticationError, type CarPreprocessOptions, type CarPreprocessResult, ConfigurationError, EmptyFileError, FILE_EXTENSION_CAR, IpnsClient, MIME_TYPE_CAR, MIME_TYPE_OCTET_STREAM, NetworkError, NotFoundError, PinError, type PinataAdapter, type PinataLegacyAdapter, Pinner, type PinnerConfig, PinnerError, RateLimitError, type RemoteAddOptions, type RemoteLsOptions, type RemotePin, type RemotePins, TimeoutError, type UnstorageBlockstoreOptions, UploadError, type UploadInput, UploadManager, type UploadOperation, type UploadOptions, type UploadProgress, type UploadResult, ValidationError, WebsiteValidationReason, type WebsiteValidationReasonValue, WebsitesClient, asyncGeneratorToReadableStream, calculateStreamSize, createBlockstore, createDatastore, destroyCarPreprocessor, getValidationReason, isAuthenticationError, isCarFile, isRetryable, isValidationReason, pinataAdapter, pinataLegacyAdapter, preprocessToCar, readableStreamToAsyncIterable, setDriverFactory, streamToBlob };
|
|
31
|
+
export { type AbortOptions, AuthenticationError, type BlockMetaResponse, type CarPreprocessOptions, type CarPreprocessResult, type Component, ConfigurationError, EmptyFileError, type ErrorResponse, FILE_EXTENSION_CAR, type FileManagerItem, type FileManagerItemResponse, type InfoResponse, IpnsClient, MIME_TYPE_CAR, MIME_TYPE_OCTET_STREAM, NetworkError, NotFoundError, PinError, type PinRequest, type PinRequestMeta, type PinResultsResponse, type PinStatusResponse, type PinStatusResponseInfo, type PinataAdapter, type PinataLegacyAdapter, Pinner, type PinnerConfig, PinnerError, type PostUploadResponse, RateLimitError, type RemoteAddOptions, type RemoteLsOptions, type RemotePin, type RemotePins, TimeoutError, type UnstorageBlockstoreOptions, UploadError, type UploadInput, UploadManager, type UploadOperation, type UploadOptions, type UploadProgress, type UploadResult, type UploadResultResponse, ValidationError, WebsiteValidationReason, type WebsiteValidationReasonValue, WebsitesClient, asyncGeneratorToReadableStream, calculateStreamSize, createBlockstore, createDatastore, destroyCarPreprocessor, getValidationReason, isAuthenticationError, isCarFile, isRetryable, isValidationReason, pinataAdapter, pinataLegacyAdapter, preprocessToCar, readableStreamToAsyncIterable, setDriverFactory, streamToBlob };
|
|
@@ -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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"unstorage": "^1.17.5",
|
|
66
66
|
"@lumeweb/portal-sdk": "0.1.5",
|
|
67
67
|
"@lumeweb/query-builder": "0.1.1",
|
|
68
|
-
"@lumeweb/uppy-post-upload": "0.1.
|
|
68
|
+
"@lumeweb/uppy-post-upload": "0.1.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@faker-js/faker": "^10.4.0",
|