@sparkvault/sdk-js 12.0.5 → 13.0.1
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/README.md +98 -733
- package/dist/errors.d.ts +41 -11
- package/dist/http.d.ts +8 -6
- package/dist/index.cjs +597 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +758 -207
- package/dist/index.mjs +597 -217
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +13 -4
- package/dist/ingots/types.d.ts +5 -2
- package/dist/notify/index.d.ts +50 -7
- package/dist/notify/types.d.ts +33 -9
- package/dist/products/identity/api.d.ts +25 -15
- package/dist/products/identity/index.d.ts +1 -1
- package/dist/products/identity/renderer.d.ts +12 -3
- package/dist/products/identity/state.d.ts +16 -1
- package/dist/products/identity/types.d.ts +26 -6
- package/dist/products/identity/views/error.d.ts +7 -0
- package/dist/products/index.d.ts +2 -2
- package/dist/products/notify/index.d.ts +154 -31
- package/dist/products/notify/types.d.ts +406 -121
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +5 -2
- package/dist/vaults/types.d.ts +2 -8
- package/dist/vaults/upload/api.d.ts +7 -0
- package/dist/vaults/upload/types.d.ts +10 -7
- package/package.json +1 -1
- package/dist/products/identity/types.test-d.d.ts +0 -21
- package/dist/products/notify/types.test-d.d.ts +0 -35
package/dist/vaults/index.d.ts
CHANGED
|
@@ -115,7 +115,8 @@ export declare class VaultsModule {
|
|
|
115
115
|
/** Cancel this exact deletion schedule before its deadline; company admins only. */
|
|
116
116
|
cancelDeletion(vaultId: string, deletionScheduleId: string): Promise<VaultDetail>;
|
|
117
117
|
/**
|
|
118
|
-
* Get a vault's public-sharing configuration.
|
|
118
|
+
* Get a vault's public-sharing configuration. Every sharing write below
|
|
119
|
+
* answers the same configuration as that write left it.
|
|
119
120
|
*
|
|
120
121
|
* @example
|
|
121
122
|
* const sharing = await sv.vaults.getSharingConfig('vlt_abc');
|
|
@@ -165,7 +166,9 @@ export declare class VaultsModule {
|
|
|
165
166
|
*/
|
|
166
167
|
updateAccessLogRetention(vaultId: string, seconds: number): Promise<AccessLogRetention>;
|
|
167
168
|
/**
|
|
168
|
-
* Get a vault's upload-channel configuration.
|
|
169
|
+
* Get a vault's upload-channel configuration. Every upload write below
|
|
170
|
+
* answers the same configuration as that write left it: both channels, the
|
|
171
|
+
* shared settings, and the portal's URL while the portal is on.
|
|
169
172
|
*
|
|
170
173
|
* @example
|
|
171
174
|
* const upload = await sv.vaults.getUploadConfig('vlt_abc');
|
package/dist/vaults/types.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ export interface UpdateVaultResponse {
|
|
|
213
213
|
description?: string | null;
|
|
214
214
|
updated_at: number;
|
|
215
215
|
}
|
|
216
|
+
/** GET /v1/vaults/:id/sharing, and the configuration every sharing write answers. */
|
|
216
217
|
export interface VaultSharingConfigResponse {
|
|
217
218
|
vault_id: string;
|
|
218
219
|
public_sharing_enabled: boolean;
|
|
@@ -224,6 +225,7 @@ export interface AccessLogRetentionResponse {
|
|
|
224
225
|
vault_id: string;
|
|
225
226
|
access_log_retention_seconds: number;
|
|
226
227
|
}
|
|
228
|
+
/** GET /v1/vaults/:id/upload, and the configuration every upload write answers. */
|
|
227
229
|
export interface VaultUploadSettingsResponse {
|
|
228
230
|
vault_id: string;
|
|
229
231
|
upload_portal_enabled: boolean;
|
|
@@ -234,12 +236,4 @@ export interface VaultUploadSettingsResponse {
|
|
|
234
236
|
notification_email?: string | null;
|
|
235
237
|
portal_url?: string;
|
|
236
238
|
}
|
|
237
|
-
export interface UploadChannelToggleResponse {
|
|
238
|
-
vault_id: string;
|
|
239
|
-
upload_portal_enabled?: boolean;
|
|
240
|
-
upload_widget_enabled?: boolean;
|
|
241
|
-
enabled_at?: number;
|
|
242
|
-
disabled_at?: number;
|
|
243
|
-
portal_url?: string;
|
|
244
|
-
}
|
|
245
239
|
export {};
|
|
@@ -33,6 +33,13 @@ 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
|
+
* Refuse a transfer where the browser's XMLHttpRequest is missing (a server
|
|
38
|
+
* process: Node has fetch and no XMLHttpRequest): a chunk's upload progress
|
|
39
|
+
* needs it. A flow that stages its upload with Core first checks this before
|
|
40
|
+
* the staging request, so a run that cannot transfer stages nothing.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assertBrowserTransfer(): void;
|
|
36
43
|
/**
|
|
37
44
|
* Whether a transfer failed once the server held every byte of its upload,
|
|
38
45
|
* short of the upload's own end: `upload_received_publishing`, and any other
|
|
@@ -73,9 +73,12 @@ export interface UploadOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
file?: File;
|
|
75
75
|
/**
|
|
76
|
-
* Vault Access Token
|
|
77
|
-
*
|
|
78
|
-
* is
|
|
76
|
+
* Vault Access Token, sent only on the upload's POST, where it supplies the
|
|
77
|
+
* vault key in place of the System DVAK the widget setting provisions; a
|
|
78
|
+
* read-only VAT is refused 403. It does not lift the vault's Embedded Upload
|
|
79
|
+
* Widget setting: the widget opens by reading the vault's upload info, a
|
|
80
|
+
* request that carries no VAT and is refused (UPLOAD_SOURCE_DISABLED) while
|
|
81
|
+
* the setting is off.
|
|
79
82
|
*/
|
|
80
83
|
token?: string;
|
|
81
84
|
/**
|
|
@@ -83,11 +86,11 @@ export interface UploadOptions {
|
|
|
83
86
|
* Missing path segments are find-or-created. Omitted means the vault root.
|
|
84
87
|
*/
|
|
85
88
|
folder?: string;
|
|
86
|
-
/** Callback when upload completes successfully
|
|
89
|
+
/** Callback when upload completes successfully */
|
|
87
90
|
onSuccess?: (result: UploadResult) => void;
|
|
88
|
-
/** Callback when an error occurs
|
|
91
|
+
/** Callback when an error occurs */
|
|
89
92
|
onError?: (error: Error) => void;
|
|
90
|
-
/** Callback when user cancels
|
|
93
|
+
/** Callback when user cancels */
|
|
91
94
|
onCancel?: () => void;
|
|
92
95
|
/** Callback for upload progress */
|
|
93
96
|
onProgress?: (progress: UploadProgress) => void;
|
|
@@ -137,7 +140,7 @@ export interface UploadResult {
|
|
|
137
140
|
filename: string;
|
|
138
141
|
/** File size in bytes */
|
|
139
142
|
sizeBytes: number;
|
|
140
|
-
/** Upload
|
|
143
|
+
/** Upload time in UTC, as "YYYY-MM-DD HH:MM:SS UTC" */
|
|
141
144
|
uploadTime: string;
|
|
142
145
|
}
|
|
143
146
|
/**
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Identity wire-contract assertions — COMPILE-TIME ONLY.
|
|
3
|
-
*
|
|
4
|
-
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
|
-
* the server: the transpiler strips them and every assertion passes. This file is
|
|
6
|
-
* the gate instead — `tsc --noEmit` (`pnpm typecheck`) fails the moment a
|
|
7
|
-
* declared shape stops matching what the Identity product actually answers.
|
|
8
|
-
*
|
|
9
|
-
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
10
|
-
* which would put these assertions exactly where the compiler cannot see them.
|
|
11
|
-
* Nothing imports this module, so it never reaches the bundle.
|
|
12
|
-
*/
|
|
13
|
-
import type { SparkLinkSendResponse } from './types';
|
|
14
|
-
/** Fails to compile unless `T` resolves to exactly `true`. */
|
|
15
|
-
type Assert<T extends true> = T;
|
|
16
|
-
/** Invariant type equality: `A` and `B` must be the SAME type, not merely mutually assignable. */
|
|
17
|
-
type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
|
|
18
|
-
export type IdentityWireContract = [
|
|
19
|
-
Assert<Equals<keyof SparkLinkSendResponse, 'expiresAt' | 'kindling'>>
|
|
20
|
-
];
|
|
21
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notify wire-contract assertions — COMPILE-TIME ONLY.
|
|
3
|
-
*
|
|
4
|
-
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
|
-
* the server: the transpiler strips them and every assertion passes. This file is
|
|
6
|
-
* the gate instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on every push
|
|
7
|
-
* and again on every SDK publish) fails the moment the published shapes stop
|
|
8
|
-
* matching what `apps/api` actually emits.
|
|
9
|
-
*
|
|
10
|
-
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
11
|
-
* which would put these assertions exactly where the compiler cannot see them.
|
|
12
|
-
* Nothing imports this module, so it never reaches the bundle.
|
|
13
|
-
*
|
|
14
|
-
* The mirrored server sources are named per block. When one of them changes, this
|
|
15
|
-
* file is what refuses to compile until the published type is changed with it.
|
|
16
|
-
*/
|
|
17
|
-
import type { NotificationRow } from '../../notify/types';
|
|
18
|
-
import type { NotifyRecipientState, NotifySendStatusCounts } from './types';
|
|
19
|
-
/** Fails to compile unless `T` resolves to exactly `true`. */
|
|
20
|
-
type Assert<T extends true> = T;
|
|
21
|
-
/**
|
|
22
|
-
* Invariant type equality — `A` and `B` must be the SAME type, not merely mutually
|
|
23
|
-
* assignable. Assignability would accept a union that lost a member, which is the
|
|
24
|
-
* precise drift these assertions exist to catch.
|
|
25
|
-
*/
|
|
26
|
-
type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
|
|
27
|
-
export type NotifyWireContract = [
|
|
28
|
-
Assert<Equals<NotificationRow['recalled'], boolean>>,
|
|
29
|
-
Assert<Equals<NotificationRow['locked'], boolean>>,
|
|
30
|
-
Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
|
|
31
|
-
Assert<Equals<NotificationRow['pointer_url'], string | undefined>>,
|
|
32
|
-
Assert<Equals<NotifyRecipientState, 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled'>>,
|
|
33
|
-
Assert<Equals<Pick<NotifySendStatusCounts, NotifyRecipientState>, Record<NotifyRecipientState, number>>>
|
|
34
|
-
];
|
|
35
|
-
export {};
|