@sparkvault/sdk-js 12.0.3 → 12.0.5
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.cjs +342 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +196 -91
- package/dist/index.mjs +342 -91
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +54 -7
- package/dist/ingots/types.d.ts +59 -4
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/api.d.ts +9 -0
- package/dist/vaults/upload/renderer.d.ts +5 -0
- package/dist/vaults/upload/types.d.ts +16 -0
- package/package.json +1 -1
|
@@ -33,6 +33,15 @@ export declare function mapVaultUploadInfo(wire: VaultUploadInfoResponse): Vault
|
|
|
33
33
|
* ({@link stagingRefusal}), any other error as it is.
|
|
34
34
|
*/
|
|
35
35
|
export declare function stagingRefusalOf(error: unknown): unknown;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a transfer failed once the server held every byte of its upload,
|
|
38
|
+
* short of the upload's own end: `upload_received_publishing`, and any other
|
|
39
|
+
* failure of the receipt that confirms publication (one refused, or one that
|
|
40
|
+
* went unanswered), never a gone session, Core's refusal or a cancel. The
|
|
41
|
+
* server publishes such an upload, or ends it, on its own, so its caller
|
|
42
|
+
* neither sends it again nor gives it up (`ingots.endUpload`).
|
|
43
|
+
*/
|
|
44
|
+
export declare function isReceivedUploadFailure(error: unknown): boolean;
|
|
36
45
|
export declare class UploadApi extends SparkVaultApi {
|
|
37
46
|
private readonly config;
|
|
38
47
|
/**
|
|
@@ -12,6 +12,7 @@ interface RendererCallbacks {
|
|
|
12
12
|
onError: (error: Error) => void;
|
|
13
13
|
onCancel: () => void;
|
|
14
14
|
onProgress?: (progress: UploadProgress) => void;
|
|
15
|
+
onReady?: () => void;
|
|
15
16
|
}
|
|
16
17
|
export declare class UploadRenderer {
|
|
17
18
|
private readonly api;
|
|
@@ -73,6 +74,10 @@ export declare class UploadRenderer {
|
|
|
73
74
|
private cleanupPasteHandler;
|
|
74
75
|
private startUpload;
|
|
75
76
|
private runCeremony;
|
|
77
|
+
/**
|
|
78
|
+
* Show a failure in the error view, with the way on it offers (`action`:
|
|
79
|
+
* none for a page that could not load), and tell the host through onError.
|
|
80
|
+
*/
|
|
76
81
|
private handleApiError;
|
|
77
82
|
}
|
|
78
83
|
export {};
|
|
@@ -91,6 +91,13 @@ export interface UploadOptions {
|
|
|
91
91
|
onCancel?: () => void;
|
|
92
92
|
/** Callback for upload progress */
|
|
93
93
|
onProgress?: (progress: UploadProgress) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Called once the widget has read the vault's upload page and shows its
|
|
96
|
+
* form (or, given a `file`, starts uploading it). A failure after it is the
|
|
97
|
+
* widget's to show, with the way on its failure leaves (the same file
|
|
98
|
+
* again, or another); one before it means the upload page could not load.
|
|
99
|
+
*/
|
|
100
|
+
onReady?: () => void;
|
|
94
101
|
}
|
|
95
102
|
/** Options for attach() - binds upload to element clicks */
|
|
96
103
|
export interface UploadAttachOptions {
|
|
@@ -166,7 +173,16 @@ export type UploadViewState = {
|
|
|
166
173
|
message: string;
|
|
167
174
|
code: string;
|
|
168
175
|
statusCode?: number;
|
|
176
|
+
action?: UploadRecovery | null;
|
|
169
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* The way on an error view offers after an upload of the chosen file failed:
|
|
180
|
+
* its button's label, and whether the form keeps the chosen file for it.
|
|
181
|
+
*/
|
|
182
|
+
export interface UploadRecovery {
|
|
183
|
+
label: string;
|
|
184
|
+
keepFile: boolean;
|
|
185
|
+
}
|
|
170
186
|
/**
|
|
171
187
|
* API response for vault upload info.
|
|
172
188
|
*/
|