@sparkvault/sdk-js 8.9.0 → 8.9.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.
- package/dist/index.d.ts +110 -2
- package/dist/notify/index.d.ts +41 -0
- package/dist/notify/types.d.ts +65 -0
- package/dist/products/identity/renderer.d.ts +1 -0
- package/dist/sparkvault.cjs.js +88 -1
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +88 -2
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1808,6 +1808,112 @@ declare class EntropyModule {
|
|
|
1808
1808
|
private validateByteCount;
|
|
1809
1809
|
}
|
|
1810
1810
|
|
|
1811
|
+
/**
|
|
1812
|
+
* Notify Module Types
|
|
1813
|
+
*
|
|
1814
|
+
* The signed-in user's first-party inbox. Unlike Entropy/Sparks, notification
|
|
1815
|
+
* ROWS are NOT remapped to camelCase: a row is an opaque, metadata-only pointer
|
|
1816
|
+
* whose fields mirror the wire and whose content is never carried here (it lives
|
|
1817
|
+
* behind the SparkLink `sparklink_code`). Keeping the wire shape verbatim is the
|
|
1818
|
+
* single source of truth shared with `@sparkvault/sdk-mobile` and the first-party
|
|
1819
|
+
* console, so do not "camelCase" these rows. Only the input option `createdAt`
|
|
1820
|
+
* is camelCase for call ergonomics (mapped to `created_at` on the wire).
|
|
1821
|
+
*/
|
|
1822
|
+
/** Inbox views the feed can be filtered to. `all` excludes archived rows. */
|
|
1823
|
+
type NotificationInboxState = 'all' | 'unseen' | 'unread' | 'archived';
|
|
1824
|
+
/** Terminal display states the recipient can apply to one of their rows. */
|
|
1825
|
+
type NotificationMarkState = 'seen' | 'read' | 'archived';
|
|
1826
|
+
/**
|
|
1827
|
+
* A metadata-only inbox row. Rows are LOCKED pointers: the content lives behind
|
|
1828
|
+
* the SparkLink (`sparklink_code`) and is never carried here — open the SparkLink
|
|
1829
|
+
* to unseal it. Timestamps are epoch SECONDS.
|
|
1830
|
+
*/
|
|
1831
|
+
interface NotificationRow {
|
|
1832
|
+
notification_id: string;
|
|
1833
|
+
send_id: string;
|
|
1834
|
+
created_at: number;
|
|
1835
|
+
title: string;
|
|
1836
|
+
category: string;
|
|
1837
|
+
type: string;
|
|
1838
|
+
seen_at: number | null;
|
|
1839
|
+
read_at: number | null;
|
|
1840
|
+
archived_at: number | null;
|
|
1841
|
+
sparklink_code: string;
|
|
1842
|
+
locked: true;
|
|
1843
|
+
thread_id?: string;
|
|
1844
|
+
}
|
|
1845
|
+
interface ListNotificationsOptions {
|
|
1846
|
+
state?: NotificationInboxState;
|
|
1847
|
+
/** Page size, 1-100 (server default 50). */
|
|
1848
|
+
limit?: number;
|
|
1849
|
+
/** Opaque cursor from a prior response. */
|
|
1850
|
+
cursor?: string;
|
|
1851
|
+
}
|
|
1852
|
+
interface ListNotificationsResponse {
|
|
1853
|
+
notifications: NotificationRow[];
|
|
1854
|
+
/**
|
|
1855
|
+
* Next-page cursor, or null on the last page. A page can be SHORT of `limit`
|
|
1856
|
+
* yet still carry a non-null cursor (the state/sender filter is applied after
|
|
1857
|
+
* the key query) — follow the cursor; never treat a short page as the end.
|
|
1858
|
+
*/
|
|
1859
|
+
cursor: string | null;
|
|
1860
|
+
}
|
|
1861
|
+
interface UnreadCountResponse {
|
|
1862
|
+
unread_count: number;
|
|
1863
|
+
/** True when the true count is at/beyond the badge ceiling (render "N+"). */
|
|
1864
|
+
capped: boolean;
|
|
1865
|
+
}
|
|
1866
|
+
interface MarkNotificationStateOptions {
|
|
1867
|
+
/** The row's `created_at` (epoch seconds), round-tripped from the list row. Required. */
|
|
1868
|
+
createdAt: number;
|
|
1869
|
+
state: NotificationMarkState;
|
|
1870
|
+
}
|
|
1871
|
+
interface MarkNotificationStateResponse {
|
|
1872
|
+
notification_id: string;
|
|
1873
|
+
state: NotificationMarkState;
|
|
1874
|
+
updated_at: number;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* Notify Module
|
|
1879
|
+
*
|
|
1880
|
+
* The signed-in user's first-party Notify surface: their own metadata-only
|
|
1881
|
+
* inbox. The recipient is ALWAYS derived from the session on the server — no
|
|
1882
|
+
* method takes a `recipient_id`, and any account/recipient a caller might try
|
|
1883
|
+
* to supply is ignored. This mirrors `@sparkvault/sdk-mobile`'s notify client;
|
|
1884
|
+
* device push registration is intentionally omitted (Expo-only on mobile).
|
|
1885
|
+
*/
|
|
1886
|
+
|
|
1887
|
+
declare class NotifyModule {
|
|
1888
|
+
private readonly http;
|
|
1889
|
+
constructor(http: HttpClient);
|
|
1890
|
+
/**
|
|
1891
|
+
* The caller's own inbox feed (newest first). Follow `cursor` to page — a
|
|
1892
|
+
* page can come back short of `limit` yet still carry a non-null cursor.
|
|
1893
|
+
*
|
|
1894
|
+
* @example
|
|
1895
|
+
* const { notifications, cursor } = await sv.notify.getInbox({ state: 'unread' });
|
|
1896
|
+
*/
|
|
1897
|
+
getInbox(options?: ListNotificationsOptions): Promise<ListNotificationsResponse>;
|
|
1898
|
+
/**
|
|
1899
|
+
* Bounded unseen badge count for the caller's own inbox. `capped` true means
|
|
1900
|
+
* the true count is at/beyond the ceiling — render "N+".
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* const { unread_count, capped } = await sv.notify.getUnreadCount();
|
|
1904
|
+
*/
|
|
1905
|
+
getUnreadCount(): Promise<UnreadCountResponse>;
|
|
1906
|
+
/**
|
|
1907
|
+
* Apply a terminal display state to one of the caller's own rows (idempotent).
|
|
1908
|
+
* `createdAt` MUST be the row's own `created_at` (round-tripped from the list
|
|
1909
|
+
* row) — the id alone cannot address the row.
|
|
1910
|
+
*
|
|
1911
|
+
* @example
|
|
1912
|
+
* await sv.notify.markState('ntf_abc', { createdAt: row.created_at, state: 'read' });
|
|
1913
|
+
*/
|
|
1914
|
+
markState(notificationId: string, options: MarkNotificationStateOptions): Promise<MarkNotificationStateResponse>;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1811
1917
|
/**
|
|
1812
1918
|
* SparkVault Debug Logger
|
|
1813
1919
|
*
|
|
@@ -1893,6 +1999,8 @@ declare class SparkVault {
|
|
|
1893
1999
|
readonly sparks: SparksModule;
|
|
1894
2000
|
/** Hardware-backed random generation. */
|
|
1895
2001
|
readonly entropy: EntropyModule;
|
|
2002
|
+
/** The signed-in user's first-party notification inbox. */
|
|
2003
|
+
readonly notify: NotifyModule;
|
|
1896
2004
|
/** API availability checks. */
|
|
1897
2005
|
readonly health: HealthModule;
|
|
1898
2006
|
private readonly config;
|
|
@@ -1928,5 +2036,5 @@ declare global {
|
|
|
1928
2036
|
}
|
|
1929
2037
|
}
|
|
1930
2038
|
|
|
1931
|
-
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NetworkError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, SparkVault as default, logger, setDebugMode };
|
|
1932
|
-
export type { AccessLogRetention, AccessLogsOptions, ApiResponse, AuthMethod, BandwidthPool, CreateFolderOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, Folder, FolderBreadcrumbItem, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListSparksOptions, PoolState, PoolsMeta, QuotaResource, ReplaceIngotOptions, ResponseMeta, SearchIngotsOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StoragePool, Theme, TokenClaims, UnsealedVault, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultDetail, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult };
|
|
2039
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NetworkError, NotifyModule, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, SparkVault as default, logger, setDebugMode };
|
|
2040
|
+
export type { AccessLogRetention, AccessLogsOptions, ApiResponse, AuthMethod, BandwidthPool, CreateFolderOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, Folder, FolderBreadcrumbItem, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListSparksOptions, MarkNotificationStateOptions, MarkNotificationStateResponse, NotificationInboxState, NotificationMarkState, NotificationRow, PoolState, PoolsMeta, QuotaResource, ReplaceIngotOptions, ResponseMeta, SearchIngotsOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StoragePool, Theme, TokenClaims, UnreadCountResponse, UnsealedVault, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultDetail, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notify Module
|
|
3
|
+
*
|
|
4
|
+
* The signed-in user's first-party Notify surface: their own metadata-only
|
|
5
|
+
* inbox. The recipient is ALWAYS derived from the session on the server — no
|
|
6
|
+
* method takes a `recipient_id`, and any account/recipient a caller might try
|
|
7
|
+
* to supply is ignored. This mirrors `@sparkvault/sdk-mobile`'s notify client;
|
|
8
|
+
* device push registration is intentionally omitted (Expo-only on mobile).
|
|
9
|
+
*/
|
|
10
|
+
import { HttpClient } from '../http';
|
|
11
|
+
import type { ListNotificationsOptions, ListNotificationsResponse, UnreadCountResponse, MarkNotificationStateOptions, MarkNotificationStateResponse } from './types';
|
|
12
|
+
export declare class NotifyModule {
|
|
13
|
+
private readonly http;
|
|
14
|
+
constructor(http: HttpClient);
|
|
15
|
+
/**
|
|
16
|
+
* The caller's own inbox feed (newest first). Follow `cursor` to page — a
|
|
17
|
+
* page can come back short of `limit` yet still carry a non-null cursor.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const { notifications, cursor } = await sv.notify.getInbox({ state: 'unread' });
|
|
21
|
+
*/
|
|
22
|
+
getInbox(options?: ListNotificationsOptions): Promise<ListNotificationsResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Bounded unseen badge count for the caller's own inbox. `capped` true means
|
|
25
|
+
* the true count is at/beyond the ceiling — render "N+".
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const { unread_count, capped } = await sv.notify.getUnreadCount();
|
|
29
|
+
*/
|
|
30
|
+
getUnreadCount(): Promise<UnreadCountResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Apply a terminal display state to one of the caller's own rows (idempotent).
|
|
33
|
+
* `createdAt` MUST be the row's own `created_at` (round-tripped from the list
|
|
34
|
+
* row) — the id alone cannot address the row.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* await sv.notify.markState('ntf_abc', { createdAt: row.created_at, state: 'read' });
|
|
38
|
+
*/
|
|
39
|
+
markState(notificationId: string, options: MarkNotificationStateOptions): Promise<MarkNotificationStateResponse>;
|
|
40
|
+
}
|
|
41
|
+
export type { NotificationInboxState, NotificationMarkState, NotificationRow, ListNotificationsOptions, ListNotificationsResponse, UnreadCountResponse, MarkNotificationStateOptions, MarkNotificationStateResponse, } from './types';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notify Module Types
|
|
3
|
+
*
|
|
4
|
+
* The signed-in user's first-party inbox. Unlike Entropy/Sparks, notification
|
|
5
|
+
* ROWS are NOT remapped to camelCase: a row is an opaque, metadata-only pointer
|
|
6
|
+
* whose fields mirror the wire and whose content is never carried here (it lives
|
|
7
|
+
* behind the SparkLink `sparklink_code`). Keeping the wire shape verbatim is the
|
|
8
|
+
* single source of truth shared with `@sparkvault/sdk-mobile` and the first-party
|
|
9
|
+
* console, so do not "camelCase" these rows. Only the input option `createdAt`
|
|
10
|
+
* is camelCase for call ergonomics (mapped to `created_at` on the wire).
|
|
11
|
+
*/
|
|
12
|
+
/** Inbox views the feed can be filtered to. `all` excludes archived rows. */
|
|
13
|
+
export type NotificationInboxState = 'all' | 'unseen' | 'unread' | 'archived';
|
|
14
|
+
/** Terminal display states the recipient can apply to one of their rows. */
|
|
15
|
+
export type NotificationMarkState = 'seen' | 'read' | 'archived';
|
|
16
|
+
/**
|
|
17
|
+
* A metadata-only inbox row. Rows are LOCKED pointers: the content lives behind
|
|
18
|
+
* the SparkLink (`sparklink_code`) and is never carried here — open the SparkLink
|
|
19
|
+
* to unseal it. Timestamps are epoch SECONDS.
|
|
20
|
+
*/
|
|
21
|
+
export interface NotificationRow {
|
|
22
|
+
notification_id: string;
|
|
23
|
+
send_id: string;
|
|
24
|
+
created_at: number;
|
|
25
|
+
title: string;
|
|
26
|
+
category: string;
|
|
27
|
+
type: string;
|
|
28
|
+
seen_at: number | null;
|
|
29
|
+
read_at: number | null;
|
|
30
|
+
archived_at: number | null;
|
|
31
|
+
sparklink_code: string;
|
|
32
|
+
locked: true;
|
|
33
|
+
thread_id?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ListNotificationsOptions {
|
|
36
|
+
state?: NotificationInboxState;
|
|
37
|
+
/** Page size, 1-100 (server default 50). */
|
|
38
|
+
limit?: number;
|
|
39
|
+
/** Opaque cursor from a prior response. */
|
|
40
|
+
cursor?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ListNotificationsResponse {
|
|
43
|
+
notifications: NotificationRow[];
|
|
44
|
+
/**
|
|
45
|
+
* Next-page cursor, or null on the last page. A page can be SHORT of `limit`
|
|
46
|
+
* yet still carry a non-null cursor (the state/sender filter is applied after
|
|
47
|
+
* the key query) — follow the cursor; never treat a short page as the end.
|
|
48
|
+
*/
|
|
49
|
+
cursor: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface UnreadCountResponse {
|
|
52
|
+
unread_count: number;
|
|
53
|
+
/** True when the true count is at/beyond the badge ceiling (render "N+"). */
|
|
54
|
+
capped: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface MarkNotificationStateOptions {
|
|
57
|
+
/** The row's `created_at` (epoch seconds), round-tripped from the list row. Required. */
|
|
58
|
+
createdAt: number;
|
|
59
|
+
state: NotificationMarkState;
|
|
60
|
+
}
|
|
61
|
+
export interface MarkNotificationStateResponse {
|
|
62
|
+
notification_id: string;
|
|
63
|
+
state: NotificationMarkState;
|
|
64
|
+
updated_at: number;
|
|
65
|
+
}
|
package/dist/sparkvault.cjs.js
CHANGED
|
@@ -6254,6 +6254,12 @@ const SPARKLINK_CSP_BLOCKED_ERROR = {
|
|
|
6254
6254
|
};
|
|
6255
6255
|
class IdentityRenderer {
|
|
6256
6256
|
constructor(container, api, options, callbacks) {
|
|
6257
|
+
// True only when the identifier was prefilled by the flow (invite / simple
|
|
6258
|
+
// redirect), not typed by the person. Gates the "identity is fixed" behavior
|
|
6259
|
+
// so a no-hint simple-mode session where the person types their own
|
|
6260
|
+
// identifier still gets a change-identity back link and single-method
|
|
6261
|
+
// auto-proceed.
|
|
6262
|
+
this.identityPrefilled = false;
|
|
6257
6263
|
// View management
|
|
6258
6264
|
this.currentView = null;
|
|
6259
6265
|
this.focusTimeoutId = null;
|
|
@@ -6311,6 +6317,8 @@ class IdentityRenderer {
|
|
|
6311
6317
|
else {
|
|
6312
6318
|
this.verificationState.setIdentity(validateEmail(raw) ?? raw, 'email');
|
|
6313
6319
|
}
|
|
6320
|
+
// The flow supplied the identifier — it is fixed, not user-changeable.
|
|
6321
|
+
this.identityPrefilled = true;
|
|
6314
6322
|
}
|
|
6315
6323
|
/**
|
|
6316
6324
|
* True when the identifier is fixed by the flow and the person must prove
|
|
@@ -6320,7 +6328,8 @@ class IdentityRenderer {
|
|
|
6320
6328
|
* identifier than the one they were invited as.
|
|
6321
6329
|
*/
|
|
6322
6330
|
isIdentityFixed() {
|
|
6323
|
-
return this.
|
|
6331
|
+
return this.identityPrefilled
|
|
6332
|
+
&& this.verificationState.authContext?.simpleMode !== undefined;
|
|
6324
6333
|
}
|
|
6325
6334
|
/**
|
|
6326
6335
|
* Fire the host's onSuccess callback, swallowing any exception so a
|
|
@@ -6923,6 +6932,9 @@ class IdentityRenderer {
|
|
|
6923
6932
|
}
|
|
6924
6933
|
handleIdentitySubmit(result) {
|
|
6925
6934
|
this.verificationState.setIdentity(result.value, result.type);
|
|
6935
|
+
// The person typed this identifier, so it is theirs to change — a no-hint
|
|
6936
|
+
// simple-mode session must keep the back link + single-method auto-proceed.
|
|
6937
|
+
this.identityPrefilled = false;
|
|
6926
6938
|
this.showMethodSelect();
|
|
6927
6939
|
}
|
|
6928
6940
|
getAllowedIdentityTypes() {
|
|
@@ -13512,6 +13524,79 @@ class EntropyModule {
|
|
|
13512
13524
|
}
|
|
13513
13525
|
}
|
|
13514
13526
|
|
|
13527
|
+
/**
|
|
13528
|
+
* Notify Module
|
|
13529
|
+
*
|
|
13530
|
+
* The signed-in user's first-party Notify surface: their own metadata-only
|
|
13531
|
+
* inbox. The recipient is ALWAYS derived from the session on the server — no
|
|
13532
|
+
* method takes a `recipient_id`, and any account/recipient a caller might try
|
|
13533
|
+
* to supply is ignored. This mirrors `@sparkvault/sdk-mobile`'s notify client;
|
|
13534
|
+
* device push registration is intentionally omitted (Expo-only on mobile).
|
|
13535
|
+
*/
|
|
13536
|
+
const MARK_STATES = ['seen', 'read', 'archived'];
|
|
13537
|
+
class NotifyModule {
|
|
13538
|
+
constructor(http) {
|
|
13539
|
+
this.http = http;
|
|
13540
|
+
}
|
|
13541
|
+
/**
|
|
13542
|
+
* The caller's own inbox feed (newest first). Follow `cursor` to page — a
|
|
13543
|
+
* page can come back short of `limit` yet still carry a non-null cursor.
|
|
13544
|
+
*
|
|
13545
|
+
* @example
|
|
13546
|
+
* const { notifications, cursor } = await sv.notify.getInbox({ state: 'unread' });
|
|
13547
|
+
*/
|
|
13548
|
+
async getInbox(options = {}) {
|
|
13549
|
+
const params = new URLSearchParams();
|
|
13550
|
+
if (options.state)
|
|
13551
|
+
params.set('state', options.state);
|
|
13552
|
+
if (options.limit)
|
|
13553
|
+
params.set('limit', String(options.limit));
|
|
13554
|
+
if (options.cursor)
|
|
13555
|
+
params.set('cursor', options.cursor);
|
|
13556
|
+
const query = params.toString();
|
|
13557
|
+
const response = await this.http.get(query ? `/v1/me/notifications?${query}` : '/v1/me/notifications');
|
|
13558
|
+
return response.data;
|
|
13559
|
+
}
|
|
13560
|
+
/**
|
|
13561
|
+
* Bounded unseen badge count for the caller's own inbox. `capped` true means
|
|
13562
|
+
* the true count is at/beyond the ceiling — render "N+".
|
|
13563
|
+
*
|
|
13564
|
+
* @example
|
|
13565
|
+
* const { unread_count, capped } = await sv.notify.getUnreadCount();
|
|
13566
|
+
*/
|
|
13567
|
+
async getUnreadCount() {
|
|
13568
|
+
const response = await this.http.get('/v1/me/notifications/unread-count');
|
|
13569
|
+
return response.data;
|
|
13570
|
+
}
|
|
13571
|
+
/**
|
|
13572
|
+
* Apply a terminal display state to one of the caller's own rows (idempotent).
|
|
13573
|
+
* `createdAt` MUST be the row's own `created_at` (round-tripped from the list
|
|
13574
|
+
* row) — the id alone cannot address the row.
|
|
13575
|
+
*
|
|
13576
|
+
* @example
|
|
13577
|
+
* await sv.notify.markState('ntf_abc', { createdAt: row.created_at, state: 'read' });
|
|
13578
|
+
*/
|
|
13579
|
+
async markState(notificationId, options) {
|
|
13580
|
+
if (!notificationId || typeof notificationId !== 'string') {
|
|
13581
|
+
throw new ValidationError('notificationId is required', { field: 'notificationId' });
|
|
13582
|
+
}
|
|
13583
|
+
if (!Number.isFinite(options?.createdAt)) {
|
|
13584
|
+
throw new ValidationError('createdAt (the row\'s created_at) is required', {
|
|
13585
|
+
field: 'createdAt',
|
|
13586
|
+
received: options?.createdAt,
|
|
13587
|
+
});
|
|
13588
|
+
}
|
|
13589
|
+
if (!MARK_STATES.includes(options.state)) {
|
|
13590
|
+
throw new ValidationError(`state must be one of ${MARK_STATES.join(', ')}`, {
|
|
13591
|
+
field: 'state',
|
|
13592
|
+
received: options.state,
|
|
13593
|
+
});
|
|
13594
|
+
}
|
|
13595
|
+
const response = await this.http.post(`/v1/me/notifications/${encodeURIComponent(notificationId)}/state`, { created_at: options.createdAt, state: options.state });
|
|
13596
|
+
return response.data;
|
|
13597
|
+
}
|
|
13598
|
+
}
|
|
13599
|
+
|
|
13515
13600
|
/**
|
|
13516
13601
|
* SparkVault Debug Logger
|
|
13517
13602
|
*
|
|
@@ -13700,6 +13785,7 @@ class SparkVault {
|
|
|
13700
13785
|
this.folders = new FoldersModule(http);
|
|
13701
13786
|
this.sparks = new SparksModule(http);
|
|
13702
13787
|
this.entropy = new EntropyModule(http);
|
|
13788
|
+
this.notify = new NotifyModule(http);
|
|
13703
13789
|
this.health = new HealthModule(this.config);
|
|
13704
13790
|
}
|
|
13705
13791
|
/**
|
|
@@ -13746,6 +13832,7 @@ exports.FoldersModule = FoldersModule;
|
|
|
13746
13832
|
exports.IdentityModule = IdentityModule;
|
|
13747
13833
|
exports.IngotsModule = IngotsModule;
|
|
13748
13834
|
exports.NetworkError = NetworkError;
|
|
13835
|
+
exports.NotifyModule = NotifyModule;
|
|
13749
13836
|
exports.PlanRequiredError = PlanRequiredError;
|
|
13750
13837
|
exports.PopupBlockedError = PopupBlockedError;
|
|
13751
13838
|
exports.ProductsModule = ProductsModule;
|