@sparkvault/sdk-js 12.0.1 → 12.0.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/errors.d.ts +10 -0
- package/dist/index.cjs +42 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +34 -15
- package/dist/index.mjs +42 -7
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/types.d.ts +11 -9
- package/dist/products/identity/index.d.ts +6 -2
- package/dist/sparks/types.d.ts +6 -3
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -371,8 +371,12 @@ declare class IdentityModule {
|
|
|
371
371
|
* `IdentityModule.isFedcmAvailable()` and fall back to `signIn()` otherwise.
|
|
372
372
|
*
|
|
373
373
|
* @returns the verified result, or `null` when the browser has no FedCM
|
|
374
|
-
* support (so the caller can fall back). Throws `UserCancelledError` when
|
|
375
|
-
*
|
|
374
|
+
* support (so the caller can fall back). Throws `UserCancelledError` when
|
|
375
|
+
* the browser ends the request without a credential: the person dismissed
|
|
376
|
+
* the chooser, or the browser had no SparkVault account to offer (the
|
|
377
|
+
* browser reports both alike). Throws `IdentityProviderError`, carrying
|
|
378
|
+
* SparkVault's own error code, when SparkVault answered the sign-in with an
|
|
379
|
+
* error.
|
|
376
380
|
*
|
|
377
381
|
* @example
|
|
378
382
|
* const result = (await sv.products.identity.isFedcmAvailable())
|
|
@@ -2303,15 +2307,17 @@ interface Ingot {
|
|
|
2303
2307
|
* kept as it is when the first word of the extension it shows (up to an
|
|
2304
2308
|
* ASCII space, in any case) is one the MIME registry knows or holds a
|
|
2305
2309
|
* character none of the registry's extensions is spelled with, which may
|
|
2306
|
-
* draw as one, and otherwise completed with the
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2309
|
-
* `
|
|
2310
|
-
*
|
|
2311
|
-
* browser
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
* `application/
|
|
2310
|
+
* draw as one, and otherwise completed with the extension `contentType`'s
|
|
2311
|
+
* files are named with (the first the registry lists for it, or, for the
|
|
2312
|
+
* few types whose first is not the one desktops name their files with, the
|
|
2313
|
+
* one they do: `.mp3` for `audio/mpeg`, `.mov` for `video/quicktime`), never
|
|
2314
|
+
* one a saved copy must never open as. Save a copy under it, handed to a
|
|
2315
|
+
* browser as `application/octet-stream` unless `contentType` is a raster
|
|
2316
|
+
* image, audio, video or PDF format (never SVG, a playlist or a stream
|
|
2317
|
+
* redirector): a browser renames a saved copy by the type it is handed
|
|
2318
|
+
* (Chrome saves `Invoice` typed `application/x-msdownload` as
|
|
2319
|
+
* `Invoice.exe`), and completes or replaces no extension of a copy handed
|
|
2320
|
+
* as `application/octet-stream`.
|
|
2315
2321
|
*/
|
|
2316
2322
|
downloadFilename: string;
|
|
2317
2323
|
/** Content type (MIME) */
|
|
@@ -3141,9 +3147,12 @@ interface Spark {
|
|
|
3141
3147
|
* with none, kept as it is when the first word of the extension it shows
|
|
3142
3148
|
* (up to an ASCII space, in any case) is one the MIME registry knows or
|
|
3143
3149
|
* holds a character none of the registry's extensions is spelled with,
|
|
3144
|
-
* which may draw as one, and otherwise completed with the
|
|
3145
|
-
*
|
|
3146
|
-
*
|
|
3150
|
+
* which may draw as one, and otherwise completed with the extension
|
|
3151
|
+
* `contentType`'s files are named with (the first the registry lists for
|
|
3152
|
+
* it, or, for the few types whose first is not the one desktops name their
|
|
3153
|
+
* files with, the one they do: `.mp3` for `audio/mpeg`, `.mov` for
|
|
3154
|
+
* `video/quicktime`), never one a saved copy must never open as. Save a
|
|
3155
|
+
* copy under it, handed to a browser as
|
|
3147
3156
|
* `application/octet-stream` unless `contentType` is a raster image, audio,
|
|
3148
3157
|
* video or PDF format (never SVG, a playlist or a stream redirector): a
|
|
3149
3158
|
* browser renames a saved copy by the type it is handed (Chrome saves
|
|
@@ -3606,6 +3615,16 @@ declare class TimeoutError extends SparkVaultError {
|
|
|
3606
3615
|
declare class UserCancelledError extends SparkVaultError {
|
|
3607
3616
|
constructor(message?: string);
|
|
3608
3617
|
}
|
|
3618
|
+
/**
|
|
3619
|
+
* The identity provider answered a FedCM sign-in with an error of its own
|
|
3620
|
+
* (the browser's `IdentityCredentialError`), after the browser showed the
|
|
3621
|
+
* person its error dialog: the request reached the provider, which refused or
|
|
3622
|
+
* failed it, so it is no cancel. `code` is the provider's answer
|
|
3623
|
+
* (`server_error`, `access_denied`, ...).
|
|
3624
|
+
*/
|
|
3625
|
+
declare class IdentityProviderError extends SparkVaultError {
|
|
3626
|
+
constructor(code: string);
|
|
3627
|
+
}
|
|
3609
3628
|
declare class PopupBlockedError extends SparkVaultError {
|
|
3610
3629
|
constructor();
|
|
3611
3630
|
}
|
|
@@ -3691,5 +3710,5 @@ declare global {
|
|
|
3691
3710
|
}
|
|
3692
3711
|
}
|
|
3693
3712
|
|
|
3694
|
-
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, logger, setDebugMode };
|
|
3713
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, logger, setDebugMode };
|
|
3695
3714
|
export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifySendSummary, NotifyVerificationLevel, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, Spark, SparkInviteResend, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreadCountResponse, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|
package/dist/index.mjs
CHANGED
|
@@ -826,6 +826,20 @@ class UserCancelledError extends SparkVaultError {
|
|
|
826
826
|
Object.setPrototypeOf(this, UserCancelledError.prototype);
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
|
+
/**
|
|
830
|
+
* The identity provider answered a FedCM sign-in with an error of its own
|
|
831
|
+
* (the browser's `IdentityCredentialError`), after the browser showed the
|
|
832
|
+
* person its error dialog: the request reached the provider, which refused or
|
|
833
|
+
* failed it, so it is no cancel. `code` is the provider's answer
|
|
834
|
+
* (`server_error`, `access_denied`, ...).
|
|
835
|
+
*/
|
|
836
|
+
class IdentityProviderError extends SparkVaultError {
|
|
837
|
+
constructor(code) {
|
|
838
|
+
super('The identity provider could not complete the sign-in.', code || 'identity_provider_error');
|
|
839
|
+
this.name = 'IdentityProviderError';
|
|
840
|
+
Object.setPrototypeOf(this, IdentityProviderError.prototype);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
829
843
|
class PopupBlockedError extends SparkVaultError {
|
|
830
844
|
constructor() {
|
|
831
845
|
super('Popup was blocked. Please allow popups for this site.', 'popup_blocked');
|
|
@@ -10190,6 +10204,20 @@ function decodeTokenSegment(segment, message) {
|
|
|
10190
10204
|
throw new ValidationError(message);
|
|
10191
10205
|
}
|
|
10192
10206
|
}
|
|
10207
|
+
/**
|
|
10208
|
+
* The provider's own answer to a FedCM id assertion, as the browser rejects
|
|
10209
|
+
* with it (an `IdentityCredentialError`, a DOMException read by its name, so
|
|
10210
|
+
* neither the class's presence nor the realm it was made in matters), or null
|
|
10211
|
+
* for any other rejection.
|
|
10212
|
+
*/
|
|
10213
|
+
function identityProviderErrorOf(error) {
|
|
10214
|
+
if (typeof error !== 'object' || error === null)
|
|
10215
|
+
return null;
|
|
10216
|
+
const { name, error: code } = error;
|
|
10217
|
+
if (name !== 'IdentityCredentialError')
|
|
10218
|
+
return null;
|
|
10219
|
+
return new IdentityProviderError(typeof code === 'string' ? code : '');
|
|
10220
|
+
}
|
|
10193
10221
|
class IdentityModule {
|
|
10194
10222
|
constructor(config) {
|
|
10195
10223
|
this.renderer = null;
|
|
@@ -10252,8 +10280,12 @@ class IdentityModule {
|
|
|
10252
10280
|
* `IdentityModule.isFedcmAvailable()` and fall back to `signIn()` otherwise.
|
|
10253
10281
|
*
|
|
10254
10282
|
* @returns the verified result, or `null` when the browser has no FedCM
|
|
10255
|
-
* support (so the caller can fall back). Throws `UserCancelledError` when
|
|
10256
|
-
*
|
|
10283
|
+
* support (so the caller can fall back). Throws `UserCancelledError` when
|
|
10284
|
+
* the browser ends the request without a credential: the person dismissed
|
|
10285
|
+
* the chooser, or the browser had no SparkVault account to offer (the
|
|
10286
|
+
* browser reports both alike). Throws `IdentityProviderError`, carrying
|
|
10287
|
+
* SparkVault's own error code, when SparkVault answered the sign-in with an
|
|
10288
|
+
* error.
|
|
10257
10289
|
*
|
|
10258
10290
|
* @example
|
|
10259
10291
|
* const result = (await sv.products.identity.isFedcmAvailable())
|
|
@@ -10287,9 +10319,12 @@ class IdentityModule {
|
|
|
10287
10319
|
credential = await getCredential(request);
|
|
10288
10320
|
}
|
|
10289
10321
|
catch (error) {
|
|
10290
|
-
// The
|
|
10291
|
-
//
|
|
10292
|
-
|
|
10322
|
+
// The provider's own answer to the id assertion is no cancel. Every other
|
|
10323
|
+
// rejection ends the request without a credential: the browser answers a
|
|
10324
|
+
// dismissed chooser and a provider with no account to offer with the same
|
|
10325
|
+
// NetworkError, so that is the SDK's cancel signal.
|
|
10326
|
+
throw identityProviderErrorOf(error)
|
|
10327
|
+
?? new UserCancelledError(error instanceof Error ? error.message : undefined);
|
|
10293
10328
|
}
|
|
10294
10329
|
const token = credential?.token;
|
|
10295
10330
|
if (!token) {
|
|
@@ -17648,7 +17683,7 @@ class SparkVault {
|
|
|
17648
17683
|
}
|
|
17649
17684
|
/** Get the SDK version */
|
|
17650
17685
|
static get version() {
|
|
17651
|
-
return '12.0.
|
|
17686
|
+
return '12.0.3';
|
|
17652
17687
|
}
|
|
17653
17688
|
}
|
|
17654
17689
|
if (typeof window !== 'undefined') {
|
|
@@ -17658,5 +17693,5 @@ if (typeof window !== 'undefined') {
|
|
|
17658
17693
|
window.SparkVault = instance ?? SparkVault;
|
|
17659
17694
|
}
|
|
17660
17695
|
|
|
17661
|
-
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, logger, setDebugMode };
|
|
17696
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, logger, setDebugMode };
|
|
17662
17697
|
//# sourceMappingURL=index.mjs.map
|