@sparkvault/sdk-js 12.0.0 → 12.0.2

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.
@@ -37,15 +37,17 @@ export interface Ingot {
37
37
  * kept as it is when the first word of the extension it shows (up to an
38
38
  * ASCII space, in any case) is one the MIME registry knows or holds a
39
39
  * character none of the registry's extensions is spelled with, which may
40
- * draw as one, and otherwise completed with the first extension the
41
- * registry lists for `contentType`, never one a saved copy must never open
42
- * as. Save a copy under it, handed to a browser as
43
- * `application/octet-stream` unless `contentType` is a raster image, audio,
44
- * video or PDF format (never SVG, a playlist or a stream redirector): a
45
- * browser renames a saved copy by the type it is handed (Chrome saves
46
- * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
47
- * completes or replaces no extension of a copy handed as
48
- * `application/octet-stream`.
40
+ * draw as one, and otherwise completed with the extension `contentType`'s
41
+ * files are named with (the first the registry lists for it, or, for the
42
+ * few types whose first is not the one desktops name their files with, the
43
+ * one they do: `.mp3` for `audio/mpeg`, `.mov` for `video/quicktime`), never
44
+ * one a saved copy must never open as. Save a copy under it, handed to a
45
+ * browser as `application/octet-stream` unless `contentType` is a raster
46
+ * image, audio, video or PDF format (never SVG, a playlist or a stream
47
+ * redirector): a browser renames a saved copy by the type it is handed
48
+ * (Chrome saves `Invoice` typed `application/x-msdownload` as
49
+ * `Invoice.exe`), and completes or replaces no extension of a copy handed
50
+ * as `application/octet-stream`.
49
51
  */
50
52
  downloadFilename: string;
51
53
  /** Content type (MIME) */
@@ -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';
@@ -13,13 +13,16 @@ export interface SparkSummary {
13
13
  contentType: string;
14
14
  /** Size in bytes */
15
15
  size: number;
16
- /** Lifecycle status (active | expired | ash) */
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
- /** Burn timestamp (Unix seconds), or null if not yet read */
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 {
@@ -51,9 +56,12 @@ export interface Spark {
51
56
  * with none, kept as it is when the first word of the extension it shows
52
57
  * (up to an ASCII space, in any case) is one the MIME registry knows or
53
58
  * holds a character none of the registry's extensions is spelled with,
54
- * which may draw as one, and otherwise completed with the first extension
55
- * the registry lists for `contentType`, never one a saved copy must never
56
- * open as. Save a copy under it, handed to a browser as
59
+ * which may draw as one, and otherwise completed with the extension
60
+ * `contentType`'s files are named with (the first the registry lists for
61
+ * it, or, for the few types whose first is not the one desktops name their
62
+ * files with, the one they do: `.mp3` for `audio/mpeg`, `.mov` for
63
+ * `video/quicktime`), never one a saved copy must never open as. Save a
64
+ * copy under it, handed to a browser as
57
65
  * `application/octet-stream` unless `contentType` is a raster image, audio,
58
66
  * video or PDF format (never SVG, a playlist or a stream redirector): a
59
67
  * browser renames a saved copy by the type it is handed (Chrome saves
@@ -81,6 +89,13 @@ export interface CreatedSpark {
81
89
  filename?: string;
82
90
  /** Optional kindling family ID (echoed when provided) */
83
91
  kindling?: string;
92
+ /**
93
+ * A link spark (contentType text/uri-list) only: its x.sv link, which opens
94
+ * once and redirects to the payload's URL. It is minted with the spark.
95
+ */
96
+ linkUrl?: string;
97
+ /** A link spark only: the code in linkUrl */
98
+ linkCode?: string;
84
99
  }
85
100
  /** Options for list. */
86
101
  export interface ListSparksOptions {
@@ -145,6 +160,23 @@ export interface SparkShare {
145
160
  expiresAt?: number;
146
161
  /** Link creation timestamp (Unix seconds) */
147
162
  createdAt?: number;
163
+ /**
164
+ * The invitees this share delivered the link to (share only): none for a
165
+ * share that invites no one new. An invitee already on the link is sent it
166
+ * again by resendInvite.
167
+ */
168
+ deliveredTo?: string[];
169
+ }
170
+ /** An invitation delivered again, as resendInvite answers it. */
171
+ export interface SparkInviteResend {
172
+ /** Spark ID */
173
+ sparkId: string;
174
+ /** The invitee the link was delivered to */
175
+ identity: string;
176
+ /** How it was delivered: by email or by SMS */
177
+ identityType: 'email' | 'phone';
178
+ /** Delivery timestamp (Unix seconds) */
179
+ sentAt: number;
148
180
  }
149
181
  export interface SparkSummaryWire {
150
182
  spark_id: string;
@@ -157,6 +189,7 @@ export interface SparkSummaryWire {
157
189
  time_remaining?: number;
158
190
  filename?: string;
159
191
  kindling?: string;
192
+ link_url?: string;
160
193
  }
161
194
  export interface ListSparksResponse {
162
195
  sparks: SparkSummaryWire[];
@@ -182,6 +215,8 @@ export interface CreateSparkResponse {
182
215
  ttl_minutes: number;
183
216
  filename?: string;
184
217
  kindling?: string;
218
+ link_url?: string;
219
+ link_code?: string;
185
220
  }
186
221
  export interface SparkShareResponse {
187
222
  shared: boolean;
@@ -191,4 +226,12 @@ export interface SparkShareResponse {
191
226
  invites?: string[];
192
227
  expires_at?: number;
193
228
  created_at?: number;
229
+ delivered_to?: string[];
230
+ }
231
+ export interface SparkInviteResendResponse {
232
+ resent: boolean;
233
+ spark_id: string;
234
+ identity: string;
235
+ identity_type: 'email' | 'phone';
236
+ sent_at: number;
194
237
  }