@sparkvault/sdk-js 12.0.0 → 12.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/dist/index.cjs +29 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +46 -4
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/dist/sparks/index.d.ts +16 -3
- package/dist/sparks/types.d.ts +42 -2
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/sparks/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* secrets. Sparks are account-scoped — no vault or VAT is involved.
|
|
6
6
|
*/
|
|
7
7
|
import { HttpClient } from '../http';
|
|
8
|
-
import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare } from './types';
|
|
8
|
+
import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkInviteResend } from './types';
|
|
9
9
|
export declare class SparksModule {
|
|
10
10
|
private readonly http;
|
|
11
11
|
constructor(http: HttpClient);
|
|
@@ -26,10 +26,12 @@ export declare class SparksModule {
|
|
|
26
26
|
*/
|
|
27
27
|
get(sparkId: string): Promise<Spark>;
|
|
28
28
|
/**
|
|
29
|
-
* Create a spark.
|
|
29
|
+
* Create a spark. A link spark (contentType text/uri-list, the payload its
|
|
30
|
+
* destination URL) is created with its x.sv link, `linkUrl`.
|
|
30
31
|
*
|
|
31
32
|
* @example
|
|
32
33
|
* const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
|
|
34
|
+
* const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
|
|
33
35
|
*/
|
|
34
36
|
create(options: CreateSparkOptions): Promise<CreatedSpark>;
|
|
35
37
|
/**
|
|
@@ -47,6 +49,17 @@ export declare class SparksModule {
|
|
|
47
49
|
* console.log(share.shareUrl);
|
|
48
50
|
*/
|
|
49
51
|
share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
|
|
52
|
+
/**
|
|
53
|
+
* Deliver an invite-only spark's link to its invitee again, changing
|
|
54
|
+
* nothing about the link: the way on from an invitation that could not be
|
|
55
|
+
* delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
|
|
56
|
+
* link in place, and the same share again delivers nothing), or one the
|
|
57
|
+
* invitee never received.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* const { identity } = await sv.sparks.resendInvite('spk_abc');
|
|
61
|
+
*/
|
|
62
|
+
resendInvite(sparkId: string): Promise<SparkInviteResend>;
|
|
50
63
|
/**
|
|
51
64
|
* Get a spark's sharing status.
|
|
52
65
|
*
|
|
@@ -62,4 +75,4 @@ export declare class SparksModule {
|
|
|
62
75
|
*/
|
|
63
76
|
unshare(sparkId: string): Promise<SparkShare>;
|
|
64
77
|
}
|
|
65
|
-
export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkVisibility, } from './types';
|
|
78
|
+
export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkInviteResend, SparkVisibility, } from './types';
|
package/dist/sparks/types.d.ts
CHANGED
|
@@ -13,13 +13,16 @@ export interface SparkSummary {
|
|
|
13
13
|
contentType: string;
|
|
14
14
|
/** Size in bytes */
|
|
15
15
|
size: number;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Lifecycle status: active, expired, ash (a recipient read it, and it
|
|
18
|
+
* burned) or deleted (its owner deleted it, which burns its content too)
|
|
19
|
+
*/
|
|
17
20
|
status: string;
|
|
18
21
|
/** Creation timestamp (Unix seconds) */
|
|
19
22
|
createdAt: number;
|
|
20
23
|
/** Expiry timestamp (Unix seconds) */
|
|
21
24
|
expiresAt: number;
|
|
22
|
-
/**
|
|
25
|
+
/** The read's burn timestamp (Unix seconds), or null if not read (a deleted spark's included) */
|
|
23
26
|
burnedAt: number | null;
|
|
24
27
|
/** Seconds remaining until expiry */
|
|
25
28
|
timeRemaining: number;
|
|
@@ -27,6 +30,8 @@ export interface SparkSummary {
|
|
|
27
30
|
filename?: string;
|
|
28
31
|
/** Optional kindling family ID */
|
|
29
32
|
kindling?: string;
|
|
33
|
+
/** A link spark (contentType text/uri-list) only: its x.sv link */
|
|
34
|
+
linkUrl?: string;
|
|
30
35
|
}
|
|
31
36
|
/** The decrypted spark, returned by get (reading burns it). */
|
|
32
37
|
export interface Spark {
|
|
@@ -81,6 +86,13 @@ export interface CreatedSpark {
|
|
|
81
86
|
filename?: string;
|
|
82
87
|
/** Optional kindling family ID (echoed when provided) */
|
|
83
88
|
kindling?: string;
|
|
89
|
+
/**
|
|
90
|
+
* A link spark (contentType text/uri-list) only: its x.sv link, which opens
|
|
91
|
+
* once and redirects to the payload's URL. It is minted with the spark.
|
|
92
|
+
*/
|
|
93
|
+
linkUrl?: string;
|
|
94
|
+
/** A link spark only: the code in linkUrl */
|
|
95
|
+
linkCode?: string;
|
|
84
96
|
}
|
|
85
97
|
/** Options for list. */
|
|
86
98
|
export interface ListSparksOptions {
|
|
@@ -145,6 +157,23 @@ export interface SparkShare {
|
|
|
145
157
|
expiresAt?: number;
|
|
146
158
|
/** Link creation timestamp (Unix seconds) */
|
|
147
159
|
createdAt?: number;
|
|
160
|
+
/**
|
|
161
|
+
* The invitees this share delivered the link to (share only): none for a
|
|
162
|
+
* share that invites no one new. An invitee already on the link is sent it
|
|
163
|
+
* again by resendInvite.
|
|
164
|
+
*/
|
|
165
|
+
deliveredTo?: string[];
|
|
166
|
+
}
|
|
167
|
+
/** An invitation delivered again, as resendInvite answers it. */
|
|
168
|
+
export interface SparkInviteResend {
|
|
169
|
+
/** Spark ID */
|
|
170
|
+
sparkId: string;
|
|
171
|
+
/** The invitee the link was delivered to */
|
|
172
|
+
identity: string;
|
|
173
|
+
/** How it was delivered: by email or by SMS */
|
|
174
|
+
identityType: 'email' | 'phone';
|
|
175
|
+
/** Delivery timestamp (Unix seconds) */
|
|
176
|
+
sentAt: number;
|
|
148
177
|
}
|
|
149
178
|
export interface SparkSummaryWire {
|
|
150
179
|
spark_id: string;
|
|
@@ -157,6 +186,7 @@ export interface SparkSummaryWire {
|
|
|
157
186
|
time_remaining?: number;
|
|
158
187
|
filename?: string;
|
|
159
188
|
kindling?: string;
|
|
189
|
+
link_url?: string;
|
|
160
190
|
}
|
|
161
191
|
export interface ListSparksResponse {
|
|
162
192
|
sparks: SparkSummaryWire[];
|
|
@@ -182,6 +212,8 @@ export interface CreateSparkResponse {
|
|
|
182
212
|
ttl_minutes: number;
|
|
183
213
|
filename?: string;
|
|
184
214
|
kindling?: string;
|
|
215
|
+
link_url?: string;
|
|
216
|
+
link_code?: string;
|
|
185
217
|
}
|
|
186
218
|
export interface SparkShareResponse {
|
|
187
219
|
shared: boolean;
|
|
@@ -191,4 +223,12 @@ export interface SparkShareResponse {
|
|
|
191
223
|
invites?: string[];
|
|
192
224
|
expires_at?: number;
|
|
193
225
|
created_at?: number;
|
|
226
|
+
delivered_to?: string[];
|
|
227
|
+
}
|
|
228
|
+
export interface SparkInviteResendResponse {
|
|
229
|
+
resent: boolean;
|
|
230
|
+
spark_id: string;
|
|
231
|
+
identity: string;
|
|
232
|
+
identity_type: 'email' | 'phone';
|
|
233
|
+
sent_at: number;
|
|
194
234
|
}
|