@sparkvault/sdk 1.24.1 → 1.24.3
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/config.d.ts +20 -0
- package/dist/health.d.ts +18 -0
- package/dist/http.d.ts +3 -0
- package/dist/index.d.ts +66 -11
- package/dist/sparkvault.cjs.js +300 -39
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +300 -39
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +5 -3
- package/dist/vaults/types.d.ts +28 -16
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
export interface SparkVaultConfig {
|
|
5
5
|
/** Account ID for Identity operations */
|
|
6
6
|
accountId: string;
|
|
7
|
+
/** Core API origin. Defaults to https://api.sparkvault.com. A trailing /v1 is accepted and normalized. */
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
/** Identity App API base URL. Defaults to https://api.sparkvault.com/v1/apps/identity. */
|
|
10
|
+
identityBaseUrl?: string;
|
|
11
|
+
/** Static SparkVault Core access token for authenticated API calls. */
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
/** Dynamic SparkVault Core access token provider for authenticated API calls. */
|
|
14
|
+
getAccessToken?: () => string | null | Promise<string | null>;
|
|
15
|
+
/** Optional API key for server-side SDK use. */
|
|
16
|
+
apiKey?: string;
|
|
7
17
|
/** Request timeout in milliseconds (default: 30000) */
|
|
8
18
|
timeout?: number;
|
|
9
19
|
/**
|
|
@@ -15,14 +25,24 @@ export interface SparkVaultConfig {
|
|
|
15
25
|
preloadConfig?: boolean;
|
|
16
26
|
/** Enable backdrop blur on dialogs (default: true) */
|
|
17
27
|
backdropBlur?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Host allowlist for backend-issued ingot download URLs. Defaults to the
|
|
30
|
+
* canonical SparkVault Forge / S3 / CloudFront hosts. Override only when
|
|
31
|
+
* pointing at a custom deployment.
|
|
32
|
+
*/
|
|
33
|
+
allowedDownloadHostPatterns?: RegExp[];
|
|
18
34
|
}
|
|
19
35
|
export interface ResolvedConfig {
|
|
20
36
|
accountId: string;
|
|
21
37
|
timeout: number;
|
|
22
38
|
apiBaseUrl: string;
|
|
23
39
|
identityBaseUrl: string;
|
|
40
|
+
accessToken?: string;
|
|
41
|
+
getAccessToken?: () => string | null | Promise<string | null>;
|
|
42
|
+
apiKey?: string;
|
|
24
43
|
preloadConfig: boolean;
|
|
25
44
|
backdropBlur: boolean;
|
|
45
|
+
allowedDownloadHostPatterns: RegExp[];
|
|
26
46
|
}
|
|
27
47
|
export declare function resolveConfig(config: SparkVaultConfig): ResolvedConfig;
|
|
28
48
|
export declare function validateConfig(config: SparkVaultConfig): void;
|
package/dist/health.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResolvedConfig } from './config';
|
|
2
|
+
export interface HealthCheckOptions {
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface HealthCheckResult {
|
|
6
|
+
online: boolean;
|
|
7
|
+
status: string;
|
|
8
|
+
httpStatus?: number;
|
|
9
|
+
checkedAt: number;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class HealthModule {
|
|
13
|
+
private readonly config;
|
|
14
|
+
constructor(config: ResolvedConfig);
|
|
15
|
+
check(options?: HealthCheckOptions): Promise<HealthCheckResult>;
|
|
16
|
+
isOnline(options?: HealthCheckOptions): Promise<boolean>;
|
|
17
|
+
private readStatus;
|
|
18
|
+
}
|
package/dist/http.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface ApiResponse<T = unknown> {
|
|
|
19
19
|
export declare class HttpClient {
|
|
20
20
|
private readonly config;
|
|
21
21
|
constructor(config: ResolvedConfig);
|
|
22
|
+
private getDefaultHeaders;
|
|
23
|
+
private getAccessToken;
|
|
22
24
|
request<T = unknown>(path: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
23
25
|
/**
|
|
24
26
|
* Execute the actual HTTP request (internal implementation)
|
|
@@ -31,6 +33,7 @@ export declare class HttpClient {
|
|
|
31
33
|
private isRetryableError;
|
|
32
34
|
private parseResponse;
|
|
33
35
|
private createErrorFromResponse;
|
|
36
|
+
private unwrapApiResponse;
|
|
34
37
|
get<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
|
|
35
38
|
post<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
36
39
|
put<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
interface SparkVaultConfig {
|
|
5
5
|
/** Account ID for Identity operations */
|
|
6
6
|
accountId: string;
|
|
7
|
+
/** Core API origin. Defaults to https://api.sparkvault.com. A trailing /v1 is accepted and normalized. */
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
/** Identity App API base URL. Defaults to https://api.sparkvault.com/v1/apps/identity. */
|
|
10
|
+
identityBaseUrl?: string;
|
|
11
|
+
/** Static SparkVault Core access token for authenticated API calls. */
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
/** Dynamic SparkVault Core access token provider for authenticated API calls. */
|
|
14
|
+
getAccessToken?: () => string | null | Promise<string | null>;
|
|
15
|
+
/** Optional API key for server-side SDK use. */
|
|
16
|
+
apiKey?: string;
|
|
7
17
|
/** Request timeout in milliseconds (default: 30000) */
|
|
8
18
|
timeout?: number;
|
|
9
19
|
/**
|
|
@@ -15,14 +25,42 @@ interface SparkVaultConfig {
|
|
|
15
25
|
preloadConfig?: boolean;
|
|
16
26
|
/** Enable backdrop blur on dialogs (default: true) */
|
|
17
27
|
backdropBlur?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Host allowlist for backend-issued ingot download URLs. Defaults to the
|
|
30
|
+
* canonical SparkVault Forge / S3 / CloudFront hosts. Override only when
|
|
31
|
+
* pointing at a custom deployment.
|
|
32
|
+
*/
|
|
33
|
+
allowedDownloadHostPatterns?: RegExp[];
|
|
18
34
|
}
|
|
19
35
|
interface ResolvedConfig {
|
|
20
36
|
accountId: string;
|
|
21
37
|
timeout: number;
|
|
22
38
|
apiBaseUrl: string;
|
|
23
39
|
identityBaseUrl: string;
|
|
40
|
+
accessToken?: string;
|
|
41
|
+
getAccessToken?: () => string | null | Promise<string | null>;
|
|
42
|
+
apiKey?: string;
|
|
24
43
|
preloadConfig: boolean;
|
|
25
44
|
backdropBlur: boolean;
|
|
45
|
+
allowedDownloadHostPatterns: RegExp[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface HealthCheckOptions {
|
|
49
|
+
timeout?: number;
|
|
50
|
+
}
|
|
51
|
+
interface HealthCheckResult {
|
|
52
|
+
online: boolean;
|
|
53
|
+
status: string;
|
|
54
|
+
httpStatus?: number;
|
|
55
|
+
checkedAt: number;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
declare class HealthModule {
|
|
59
|
+
private readonly config;
|
|
60
|
+
constructor(config: ResolvedConfig);
|
|
61
|
+
check(options?: HealthCheckOptions): Promise<HealthCheckResult>;
|
|
62
|
+
isOnline(options?: HealthCheckOptions): Promise<boolean>;
|
|
63
|
+
private readStatus;
|
|
26
64
|
}
|
|
27
65
|
|
|
28
66
|
/**
|
|
@@ -272,6 +310,8 @@ interface ApiResponse<T = unknown> {
|
|
|
272
310
|
declare class HttpClient {
|
|
273
311
|
private readonly config;
|
|
274
312
|
constructor(config: ResolvedConfig);
|
|
313
|
+
private getDefaultHeaders;
|
|
314
|
+
private getAccessToken;
|
|
275
315
|
request<T = unknown>(path: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
276
316
|
/**
|
|
277
317
|
* Execute the actual HTTP request (internal implementation)
|
|
@@ -284,6 +324,7 @@ declare class HttpClient {
|
|
|
284
324
|
private isRetryableError;
|
|
285
325
|
private parseResponse;
|
|
286
326
|
private createErrorFromResponse;
|
|
327
|
+
private unwrapApiResponse;
|
|
287
328
|
get<T = unknown>(path: string, options?: Omit<RequestOptions, 'method' | 'body'>): Promise<ApiResponse<T>>;
|
|
288
329
|
post<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
289
330
|
put<T = unknown>(path: string, body?: unknown, options?: Omit<RequestOptions, 'method'>): Promise<ApiResponse<T>>;
|
|
@@ -324,16 +365,14 @@ interface Vault {
|
|
|
324
365
|
interface UnsealedVault {
|
|
325
366
|
/** Vault ID */
|
|
326
367
|
id: string;
|
|
327
|
-
/** Vault
|
|
328
|
-
name: string;
|
|
329
|
-
/** Vault Access Token (short-lived session) */
|
|
368
|
+
/** Vault Access Token (short-lived session, required for all ingot operations) */
|
|
330
369
|
vatToken: string;
|
|
370
|
+
/** VAT issued-at timestamp (Unix seconds) */
|
|
371
|
+
issuedAt: number;
|
|
331
372
|
/** VAT expiry timestamp (Unix seconds) */
|
|
332
373
|
expiresAt: number;
|
|
333
|
-
/**
|
|
334
|
-
|
|
335
|
-
/** Total storage used in bytes */
|
|
336
|
-
storageBytes: number;
|
|
374
|
+
/** VAT lifetime in seconds */
|
|
375
|
+
ttlSeconds: number;
|
|
337
376
|
}
|
|
338
377
|
interface VaultSummary {
|
|
339
378
|
/** Vault ID */
|
|
@@ -360,8 +399,18 @@ interface Ingot {
|
|
|
360
399
|
size: number;
|
|
361
400
|
/** Creation timestamp (Unix seconds) */
|
|
362
401
|
createdAt: number;
|
|
363
|
-
|
|
364
|
-
|
|
402
|
+
}
|
|
403
|
+
interface CreatedIngot {
|
|
404
|
+
/** Ingot ID */
|
|
405
|
+
id: string;
|
|
406
|
+
/** Ingot name */
|
|
407
|
+
name: string;
|
|
408
|
+
/** Content type (MIME) */
|
|
409
|
+
contentType: string;
|
|
410
|
+
/** Size in bytes */
|
|
411
|
+
size: number;
|
|
412
|
+
/** Forge upload session expiry (Unix seconds) */
|
|
413
|
+
uploadExpiresAt: number;
|
|
365
414
|
}
|
|
366
415
|
interface UploadIngotOptions {
|
|
367
416
|
/** File to upload */
|
|
@@ -370,6 +419,8 @@ interface UploadIngotOptions {
|
|
|
370
419
|
name?: string;
|
|
371
420
|
/** Content type (auto-detected if not provided) */
|
|
372
421
|
contentType?: string;
|
|
422
|
+
/** Progress callback for Forge/TUS upload */
|
|
423
|
+
onProgress?: (bytesUploaded: number, bytesTotal: number) => void;
|
|
373
424
|
}
|
|
374
425
|
|
|
375
426
|
/**
|
|
@@ -503,6 +554,7 @@ interface UploadCallable {
|
|
|
503
554
|
close(): void;
|
|
504
555
|
}
|
|
505
556
|
declare class VaultsModule {
|
|
557
|
+
private readonly config;
|
|
506
558
|
private readonly http;
|
|
507
559
|
private readonly uploadModule;
|
|
508
560
|
/**
|
|
@@ -562,7 +614,7 @@ declare class VaultsModule {
|
|
|
562
614
|
* name: 'document.pdf'
|
|
563
615
|
* });
|
|
564
616
|
*/
|
|
565
|
-
uploadIngot(vault: UnsealedVault, options: UploadIngotOptions): Promise<
|
|
617
|
+
uploadIngot(vault: UnsealedVault, options: UploadIngotOptions): Promise<CreatedIngot>;
|
|
566
618
|
/**
|
|
567
619
|
* Download an ingot from an unsealed vault.
|
|
568
620
|
*
|
|
@@ -588,6 +640,7 @@ declare class VaultsModule {
|
|
|
588
640
|
deleteIngot(vault: UnsealedVault, ingotId: string): Promise<void>;
|
|
589
641
|
private validateCreateOptions;
|
|
590
642
|
private validateUploadOptions;
|
|
643
|
+
private validateDownloadUrl;
|
|
591
644
|
}
|
|
592
645
|
|
|
593
646
|
/**
|
|
@@ -667,6 +720,8 @@ declare class SparkVault {
|
|
|
667
720
|
readonly identity: IdentityModule;
|
|
668
721
|
/** Persistent encrypted storage module */
|
|
669
722
|
readonly vaults: VaultsModule;
|
|
723
|
+
/** API availability checks */
|
|
724
|
+
readonly health: HealthModule;
|
|
670
725
|
private readonly config;
|
|
671
726
|
private constructor();
|
|
672
727
|
/**
|
|
@@ -692,4 +747,4 @@ declare global {
|
|
|
692
747
|
}
|
|
693
748
|
|
|
694
749
|
export { AuthenticationError, AuthorizationError, NetworkError, PopupBlockedError, SparkVault, SparkVaultError, TimeoutError, UserCancelledError, ValidationError, SparkVault as default, logger, setDebugMode };
|
|
695
|
-
export type { AuthMethod, CreateVaultOptions, AttachOptions as IdentityAttachOptions, Ingot, SparkVaultConfig, Theme, TokenClaims, UnsealedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultSummary, VaultUploadConfig, VerifyOptions, VerifyResult };
|
|
750
|
+
export type { AuthMethod, CreateVaultOptions, CreatedIngot, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, SparkVaultConfig, Theme, TokenClaims, UnsealedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultSummary, VaultUploadConfig, VerifyOptions, VerifyResult };
|