@sparkvault/sdk-js 15.11.4 → 15.11.6
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 +6 -1
- package/dist/index.cjs +52 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -4
- package/dist/index.mjs +52 -9
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/client.d.ts +3 -1
- package/dist/products/help-desk/types.d.ts +11 -0
- package/dist/products/identity/index.d.ts +6 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -465,7 +465,12 @@ const requests = await desk.listTickets({ status: 'open' });
|
|
|
465
465
|
```
|
|
466
466
|
|
|
467
467
|
`getMe`, `updateMe`, `getTicket`, `listEvents`, `replyToTicket`, `resolveTicket`,
|
|
468
|
-
`muteTicket` and attachment methods expose the existing customer routes.
|
|
468
|
+
`muteTicket` and attachment methods expose the existing customer routes. Name
|
|
469
|
+
each composed reply once with `newReplyId()` and pass it as `eventId` on every
|
|
470
|
+
send of that reply while its words and files stand unchanged, whatever an
|
|
471
|
+
earlier send answered (a lost response, a refusal): a reply an earlier send
|
|
472
|
+
posted is answered with that reply instead of being posted again. Name a
|
|
473
|
+
changed reply anew.
|
|
469
474
|
`sendAttachment(forgeUrl, file, { signal, onProgress, onSessionCreated })` and
|
|
470
475
|
`resumeAttachment({ sessionUrl }, file, { signal, onProgress })` use the same
|
|
471
476
|
direct Forge transfer as `ingots.sendUpload`, without Core or customer credentials.
|
package/dist/index.cjs
CHANGED
|
@@ -10865,7 +10865,12 @@ class IdentityModule {
|
|
|
10865
10865
|
*
|
|
10866
10866
|
* @example
|
|
10867
10867
|
* const result = await sv.products.identity.signIn();
|
|
10868
|
-
*
|
|
10868
|
+
* // Your backend verifies the token before it grants access; never log it.
|
|
10869
|
+
* await fetch('/api/auth/login', {
|
|
10870
|
+
* method: 'POST',
|
|
10871
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
10872
|
+
* body: JSON.stringify({ token: result.token }),
|
|
10873
|
+
* });
|
|
10869
10874
|
*/
|
|
10870
10875
|
async signIn(options = {}) {
|
|
10871
10876
|
return this.runFlow(options);
|
|
@@ -13098,9 +13103,14 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
|
|
|
13098
13103
|
* histogram's bucket edges live here for the same reason. So do the one rule a tag is stored by
|
|
13099
13104
|
* (ticketTag), which Core applies where it stores a tag and the console
|
|
13100
13105
|
* applies where one is typed, and the one rule a typed or pasted sign-in
|
|
13101
|
-
* code is read by (helpDeskPinDigits), which every sign-in form applies.
|
|
13106
|
+
* code is read by (helpDeskPinDigits), which every sign-in form applies. So
|
|
13107
|
+
* does the one way a client names a message it sends (newMessageId), which
|
|
13108
|
+
* the portal, the SDK and the console's composer each send their messages
|
|
13109
|
+
* under, and the one rule that a message sent again is the same message
|
|
13110
|
+
* (sameMessage), which keeps its name.
|
|
13102
13111
|
*
|
|
13103
|
-
* BROWSER-SAFE: data and pure functions
|
|
13112
|
+
* BROWSER-SAFE: data and pure functions, and newMessageId's count of the ids
|
|
13113
|
+
* its page named; its imports are the platform's label
|
|
13104
13114
|
* rule a tag is built on (./display-text.js), the mail products whose fixed
|
|
13105
13115
|
* From local parts no team alias may take (./mail-products.js) and the brand
|
|
13106
13116
|
* rule no team alias may read as (./organization-name.js).
|
|
@@ -13211,6 +13221,30 @@ function helpDeskCountdown(seconds) {
|
|
|
13211
13221
|
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`;
|
|
13212
13222
|
}
|
|
13213
13223
|
|
|
13224
|
+
/** How many message ids this page has named (newMessageId). */
|
|
13225
|
+
let messagesNamed = 0;
|
|
13226
|
+
|
|
13227
|
+
/**
|
|
13228
|
+
* A new id for a message its client sends: a customer's reply from the
|
|
13229
|
+
* portal or the SDK (`event_id`), a trainee's reply held for review
|
|
13230
|
+
* (`review_id`). The client names a message once and sends every retry of it
|
|
13231
|
+
* under the same id, so a send whose answer was lost and is made again is
|
|
13232
|
+
* answered with what the first send wrote instead of writing it twice.
|
|
13233
|
+
*
|
|
13234
|
+
* Counted, never drawn (docs/CONVENTIONS.md → Randomness: it only has to
|
|
13235
|
+
* differ): the page's time origin, the time it is named and the page's count
|
|
13236
|
+
* of the ids it named, so no two of one author's messages share one. The
|
|
13237
|
+
* server keeps a ticket's ids apart: one another record of the ticket holds
|
|
13238
|
+
* is refused.
|
|
13239
|
+
*
|
|
13240
|
+
* @returns {string} An id of a message event (`@sparkvault/app-sdk/ids` `ticketEvent`)
|
|
13241
|
+
*/
|
|
13242
|
+
function newMessageId() {
|
|
13243
|
+
messagesNamed += 1;
|
|
13244
|
+
const origin = Math.round((globalThis.performance?.timeOrigin ?? 0) * 1000);
|
|
13245
|
+
return `hdev_m${origin.toString(36)}-${Date.now().toString(36)}-${messagesNamed.toString(36)}`;
|
|
13246
|
+
}
|
|
13247
|
+
|
|
13214
13248
|
/**
|
|
13215
13249
|
* Why a customer's file is refused by the desk's upload allowance per
|
|
13216
13250
|
* customer (`customer_upload_limit_bytes`), as the 402 QUOTA_EXCEEDED that
|
|
@@ -16323,7 +16357,7 @@ function hostname(value) {
|
|
|
16323
16357
|
}
|
|
16324
16358
|
function resource(kind, value, field) {
|
|
16325
16359
|
if (!isResourceIdOf(kind, value))
|
|
16326
|
-
throw new ValidationError(`${field} must be a help desk ${kind} ID`, { field });
|
|
16360
|
+
throw new ValidationError(`${field} must be a help desk ${kind === 'ticketEvent' ? 'message' : kind} ID`, { field });
|
|
16327
16361
|
return value;
|
|
16328
16362
|
}
|
|
16329
16363
|
function requestNumber(value) {
|
|
@@ -16795,9 +16829,14 @@ class HelpDeskClient {
|
|
|
16795
16829
|
listEvents(number, cursor) {
|
|
16796
16830
|
return this.send('GET', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/events`, undefined, { cursor });
|
|
16797
16831
|
}
|
|
16798
|
-
/**
|
|
16832
|
+
/** A new id for one composed reply, sent as `HelpDeskReplyOptions.eventId` with every send of it while it stands unchanged. */
|
|
16833
|
+
newReplyId() { return newMessageId(); }
|
|
16834
|
+
/** A reply sent under an `eventId` an earlier send of it posted answers that reply, posting nothing again. */
|
|
16799
16835
|
replyToTicket(number, options, context) {
|
|
16800
|
-
|
|
16836
|
+
const eventId = options.eventId === undefined ? undefined : resource('ticketEvent', options.eventId, 'eventId');
|
|
16837
|
+
return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/replies`, {
|
|
16838
|
+
body: options.body, attachments: options.attachments ?? [], ...(eventId && { event_id: eventId }),
|
|
16839
|
+
}, undefined, true, context);
|
|
16801
16840
|
}
|
|
16802
16841
|
resolveTicket(number, context) { return this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/resolve`, undefined, undefined, true, context); }
|
|
16803
16842
|
muteTicket(number, muted, context) { return this.send('PUT', apiPath `/v1/hd/desks/${this.desk.desk_id}/tickets/${requestNumber(number)}/mute`, { muted }, undefined, true, context); }
|
|
@@ -24918,7 +24957,9 @@ class VaultsModule {
|
|
|
24918
24957
|
*
|
|
24919
24958
|
* @example
|
|
24920
24959
|
* const vault = await sv.vaults.create({ name: 'My Vault' });
|
|
24921
|
-
*
|
|
24960
|
+
* // Returned once and never again: hand the VMK to the person who keeps it,
|
|
24961
|
+
* // or to your own secret store. Never log it.
|
|
24962
|
+
* await yourSecretStore.put(`vmk/${vault.id}`, vault.vmk);
|
|
24922
24963
|
*/
|
|
24923
24964
|
async create(options) {
|
|
24924
24965
|
this.validateCreateOptions(options);
|
|
@@ -24942,7 +24983,9 @@ class VaultsModule {
|
|
|
24942
24983
|
* @example
|
|
24943
24984
|
* const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
|
|
24944
24985
|
* const delegated = await sv.vaults.unseal('vlt_abc', 'dvak_...');
|
|
24945
|
-
*
|
|
24986
|
+
* // The unsealed vault carries its VAT: hand it to the ingot and folder
|
|
24987
|
+
* // calls, never to a log.
|
|
24988
|
+
* const page = await sv.ingots.list(unsealed);
|
|
24946
24989
|
*/
|
|
24947
24990
|
async unseal(vaultId, key, options = {}) {
|
|
24948
24991
|
const id = requireResourceId(vaultId, 'vaultId');
|
|
@@ -26139,7 +26182,7 @@ class SparkVault {
|
|
|
26139
26182
|
}
|
|
26140
26183
|
/** Get the SDK version */
|
|
26141
26184
|
static get version() {
|
|
26142
|
-
return '15.11.
|
|
26185
|
+
return '15.11.6';
|
|
26143
26186
|
}
|
|
26144
26187
|
}
|
|
26145
26188
|
if (typeof window !== 'undefined') {
|