@sparkvault/sdk-js 14.2.3 → 14.3.0
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 +24 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +97 -21
- package/dist/index.mjs +24 -10
- package/dist/index.mjs.map +1 -1
- package/dist/sparks/index.d.ts +20 -9
- package/dist/sparks/types.d.ts +81 -14
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21353,8 +21353,9 @@ function mapUploadSettings(wire) {
|
|
|
21353
21353
|
/**
|
|
21354
21354
|
* Sparks Module
|
|
21355
21355
|
*
|
|
21356
|
-
* Create, read, share, and delete
|
|
21357
|
-
*
|
|
21356
|
+
* Create, read, share, and delete ephemeral secrets, sealed server-side under
|
|
21357
|
+
* platform-held keys and read once. Sparks are account-scoped — no vault or
|
|
21358
|
+
* VAT is involved.
|
|
21358
21359
|
*/
|
|
21359
21360
|
class SparksModule {
|
|
21360
21361
|
constructor(http) {
|
|
@@ -21452,7 +21453,12 @@ class SparksModule {
|
|
|
21452
21453
|
await this.http.delete(apiPath `/v1/sparks/${id}`);
|
|
21453
21454
|
}
|
|
21454
21455
|
/**
|
|
21455
|
-
* Share a spark via a
|
|
21456
|
+
* Share a spark via a SparkLink (x.sv URL). A spark already shared keeps
|
|
21457
|
+
* its link: the settings are applied to it in place (`alreadyShared`), an
|
|
21458
|
+
* omitted visibility keeps the current one, and `expiresInSeconds` applies
|
|
21459
|
+
* to the first share only. `linkCode` names the link the change was asked
|
|
21460
|
+
* of: a change asked of a link replaced or turned off since is refused
|
|
21461
|
+
* (409 CONFLICT).
|
|
21456
21462
|
*
|
|
21457
21463
|
* @example
|
|
21458
21464
|
* const share = await sv.sparks.share('spk_abc', { visibility: 'public' });
|
|
@@ -21464,6 +21470,7 @@ class SparksModule {
|
|
|
21464
21470
|
visibility: options.visibility,
|
|
21465
21471
|
invites: options.invites,
|
|
21466
21472
|
expires_in_seconds: options.expiresInSeconds,
|
|
21473
|
+
link_code: options.linkCode,
|
|
21467
21474
|
});
|
|
21468
21475
|
return mapShare(response.data);
|
|
21469
21476
|
}
|
|
@@ -21472,14 +21479,15 @@ class SparksModule {
|
|
|
21472
21479
|
* nothing about the link: the way on from an invitation that could not be
|
|
21473
21480
|
* delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
|
|
21474
21481
|
* link in place, and the same share again delivers nothing), or one the
|
|
21475
|
-
* invitee never received.
|
|
21482
|
+
* invitee never received. `linkCode` names the link the resend was asked
|
|
21483
|
+
* of: a link replaced since is never delivered in its place (409 CONFLICT).
|
|
21476
21484
|
*
|
|
21477
21485
|
* @example
|
|
21478
21486
|
* const { identity } = await sv.sparks.resendInvite('spk_abc');
|
|
21479
21487
|
*/
|
|
21480
|
-
async resendInvite(sparkId) {
|
|
21488
|
+
async resendInvite(sparkId, options = {}) {
|
|
21481
21489
|
const id = requireResourceId(sparkId, 'sparkId');
|
|
21482
|
-
const response = await this.http.post(apiPath `/v1/sparks/${id}/share/resend
|
|
21490
|
+
const response = await this.http.post(apiPath `/v1/sparks/${id}/share/resend`, options.linkCode === undefined ? undefined : { link_code: options.linkCode });
|
|
21483
21491
|
const data = response.data;
|
|
21484
21492
|
return {
|
|
21485
21493
|
sparkId: data.spark_id,
|
|
@@ -21500,14 +21508,18 @@ class SparksModule {
|
|
|
21500
21508
|
return mapShare(response.data);
|
|
21501
21509
|
}
|
|
21502
21510
|
/**
|
|
21503
|
-
* Unshare a spark (delete its SparkLink).
|
|
21511
|
+
* Unshare a spark (delete its SparkLink). Idempotent: a spark with no link
|
|
21512
|
+
* answers `shared: false`, the link `linkCode` names included, so a retried
|
|
21513
|
+
* unshare is never refused. A `linkCode` naming a link another share
|
|
21514
|
+
* replaced since is refused (409 CONFLICT), so the link that took its place
|
|
21515
|
+
* is never deleted.
|
|
21504
21516
|
*
|
|
21505
21517
|
* @example
|
|
21506
21518
|
* await sv.sparks.unshare('spk_abc');
|
|
21507
21519
|
*/
|
|
21508
|
-
async unshare(sparkId) {
|
|
21520
|
+
async unshare(sparkId, options = {}) {
|
|
21509
21521
|
const id = requireResourceId(sparkId, 'sparkId');
|
|
21510
|
-
const response = await this.http.delete(apiPath `/v1/sparks/${id}/share
|
|
21522
|
+
const response = await this.http.delete(apiPath `/v1/sparks/${id}/share`, { query: { link_code: options.linkCode } });
|
|
21511
21523
|
return mapShare(response.data);
|
|
21512
21524
|
}
|
|
21513
21525
|
}
|
|
@@ -21533,9 +21545,11 @@ function mapShare(wire) {
|
|
|
21533
21545
|
linkCode: wire.link_code,
|
|
21534
21546
|
visibility: wire.visibility,
|
|
21535
21547
|
invites: wire.invites,
|
|
21548
|
+
status: wire.status,
|
|
21536
21549
|
expiresAt: wire.expires_at,
|
|
21537
21550
|
createdAt: wire.created_at,
|
|
21538
21551
|
deliveredTo: wire.delivered_to,
|
|
21552
|
+
alreadyShared: wire.already_shared,
|
|
21539
21553
|
};
|
|
21540
21554
|
}
|
|
21541
21555
|
|
|
@@ -22091,7 +22105,7 @@ class SparkVault {
|
|
|
22091
22105
|
}
|
|
22092
22106
|
/** Get the SDK version */
|
|
22093
22107
|
static get version() {
|
|
22094
|
-
return '14.
|
|
22108
|
+
return '14.3.0';
|
|
22095
22109
|
}
|
|
22096
22110
|
}
|
|
22097
22111
|
if (typeof window !== 'undefined') {
|