@sparkvault/sdk-mobile 10.1.0 → 10.2.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.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/notify.d.ts +26 -10
- package/dist/notify.js +5 -5
- package/dist/notify.js.map +1 -1
- package/dist/notify.test-d.d.ts +11 -4
- package/dist/notify.test-d.js +4 -3
- package/dist/notify.test-d.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/notify.test-d.ts +9 -3
- package/src/notify.ts +22 -10
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type { CreateSparkOptions, CreateSparkResponse, ListSparksOptions, ListSp
|
|
|
15
15
|
export { MobileEntropyClient, } from './entropy.js';
|
|
16
16
|
export type { EntropyFormat, EntropyResponse, GenerateEntropyOptions, } from './entropy.js';
|
|
17
17
|
export { MobileNotifyClient, } from './notify.js';
|
|
18
|
-
export type { NotificationInboxState, NotificationMarkState, NotificationRow, ListNotificationsOptions, ListNotificationsResponse, UnreadCountResponse, MarkNotificationStateOptions, MarkNotificationStateResponse, NotificationBulkMarkState, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, RegisterDeviceResponse, } from './notify.js';
|
|
18
|
+
export type { NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, ListNotificationsOptions, ListNotificationsResponse, UnreadCountResponse, MarkNotificationStateOptions, MarkNotificationStateResponse, NotificationBulkMarkState, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, RegisterDeviceResponse, } from './notify.js';
|
|
19
19
|
export { MobileBillingClient, } from './billing.js';
|
|
20
20
|
export { MobileUsersClient, } from './users.js';
|
|
21
21
|
export { isSessionGone, MobileTusUploader, parseForgeUrl, } from './tus.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAsBrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAMtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAsBrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAMtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAiBrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,GACd,MAAM,UAAU,CAAC;AAOlB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/E,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
package/dist/notify.d.ts
CHANGED
|
@@ -4,11 +4,26 @@ export type NotificationInboxState = 'all' | 'unseen' | 'unread' | 'archived';
|
|
|
4
4
|
/** Terminal display states the recipient can apply to one of their rows. */
|
|
5
5
|
export type NotificationMarkState = 'seen' | 'read' | 'archived';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
7
|
+
* Who a row of the person's own feed is from: SparkVault itself, or their own
|
|
8
|
+
* organization by its name. `name` is null when the organization has no name the
|
|
9
|
+
* feed can show (none, or one that reads as SparkVault's): label such a row
|
|
10
|
+
* generically, never as SparkVault's.
|
|
11
|
+
*/
|
|
12
|
+
export type NotificationSender = {
|
|
13
|
+
type: 'sparkvault';
|
|
14
|
+
} | {
|
|
15
|
+
type: 'organization';
|
|
16
|
+
name: string | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A row of the person's own feed in the two-part notification model, and who
|
|
20
|
+
* sent it (`from`): the feed holds what SparkVault itself delivered to them and
|
|
21
|
+
* what their own organization's Notify did, so show `from` on every row, since an
|
|
22
|
+
* organization's title alone could read as SparkVault's own. The `title` (and,
|
|
23
|
+
* for a cleartext send, the short `body`) is the NON-sensitive cleartext part,
|
|
24
|
+
* shown natively. A SECURE send's content lives behind the SparkLink
|
|
25
|
+
* (`sparklink_code`) and is never carried here: open the pointer to reveal it.
|
|
26
|
+
* Timestamps are epoch SECONDS.
|
|
12
27
|
*/
|
|
13
28
|
export interface NotificationRow {
|
|
14
29
|
notification_id: string;
|
|
@@ -56,6 +71,7 @@ export interface NotificationRow {
|
|
|
56
71
|
* tap-to-reveal that opens nothing.
|
|
57
72
|
*/
|
|
58
73
|
recalled: boolean;
|
|
74
|
+
from: NotificationSender;
|
|
59
75
|
}
|
|
60
76
|
export interface ListNotificationsOptions {
|
|
61
77
|
state?: NotificationInboxState;
|
|
@@ -123,11 +139,11 @@ export interface RegisterDeviceResponse {
|
|
|
123
139
|
}
|
|
124
140
|
/**
|
|
125
141
|
* SparkVault's first-party Notify surface: the metadata-only inbox of a user
|
|
126
|
-
* signed in to SparkVault itself, holding the notifications SparkVault
|
|
127
|
-
* to them `in_app`, plus this device's
|
|
128
|
-
* ALWAYS derived from the session on the
|
|
129
|
-
* `recipient_id`, and any account/recipient a caller
|
|
130
|
-
* ignored.
|
|
142
|
+
* signed in to SparkVault itself, holding the notifications SparkVault and the
|
|
143
|
+
* organization they signed in to delivered to them `in_app`, plus this device's
|
|
144
|
+
* push registration. The recipient is ALWAYS derived from the session on the
|
|
145
|
+
* server: no method takes a `recipient_id`, and any account/recipient a caller
|
|
146
|
+
* might try to supply is ignored.
|
|
131
147
|
*/
|
|
132
148
|
export declare class MobileNotifyClient {
|
|
133
149
|
private readonly http;
|
package/dist/notify.js
CHANGED
|
@@ -8,11 +8,11 @@ import { validateResourceId } from './validation.js';
|
|
|
8
8
|
const MARK_ALL_MAX_PAGES = 100;
|
|
9
9
|
/**
|
|
10
10
|
* SparkVault's first-party Notify surface: the metadata-only inbox of a user
|
|
11
|
-
* signed in to SparkVault itself, holding the notifications SparkVault
|
|
12
|
-
* to them `in_app`, plus this device's
|
|
13
|
-
* ALWAYS derived from the session on the
|
|
14
|
-
* `recipient_id`, and any account/recipient a caller
|
|
15
|
-
* ignored.
|
|
11
|
+
* signed in to SparkVault itself, holding the notifications SparkVault and the
|
|
12
|
+
* organization they signed in to delivered to them `in_app`, plus this device's
|
|
13
|
+
* push registration. The recipient is ALWAYS derived from the session on the
|
|
14
|
+
* server: no method takes a `recipient_id`, and any account/recipient a caller
|
|
15
|
+
* might try to supply is ignored.
|
|
16
16
|
*/
|
|
17
17
|
export class MobileNotifyClient {
|
|
18
18
|
constructor(http) {
|
package/dist/notify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAqJrD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IAG7B,YAAY,IAAsB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAA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AAiB;QACtC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA,6BAA6B,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
package/dist/notify.test-d.d.ts
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
* gate for that instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on
|
|
7
7
|
* every push and again on every SDK publish) refuses to compile the moment a
|
|
8
8
|
* member below stops being typed as stated there; the statements mirror
|
|
9
|
-
* `apps/api/src/notify/inbox.js` (`projectRow`)
|
|
9
|
+
* `apps/api/src/notify/inbox.js` (`projectRow`) and the feed's `from`
|
|
10
|
+
* (`GET /v1/me/notifications`) by hand.
|
|
10
11
|
*
|
|
11
12
|
* WHICH fields the row carries is gated across packages rather than here:
|
|
12
13
|
* tests/notify-contract.test.ts holds `NotificationRow` to
|
|
13
|
-
* `NOTIFY_RESPONSE_FIELDS.
|
|
14
|
+
* `NOTIFY_RESPONSE_FIELDS.feedRow` (`@sparkvault/app-sdk/notify-contract`),
|
|
14
15
|
* the list the Core API's suite holds its projection to.
|
|
15
16
|
*
|
|
16
17
|
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
17
18
|
* which would put these assertions exactly where the compiler cannot see them.
|
|
18
19
|
*
|
|
19
20
|
* The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
|
|
20
|
-
* file asserts the same
|
|
21
|
+
* file asserts the same members, so both move together.
|
|
21
22
|
*/
|
|
22
23
|
import type { NotificationRow } from './notify.js';
|
|
23
24
|
/** Fails to compile unless `T` resolves to exactly `true`. */
|
|
@@ -32,6 +33,12 @@ export type NotifyWireContract = [
|
|
|
32
33
|
Assert<Equals<NotificationRow['recalled'], boolean>>,
|
|
33
34
|
Assert<Equals<NotificationRow['locked'], boolean>>,
|
|
34
35
|
Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
|
|
35
|
-
Assert<Equals<NotificationRow['pointer_url'], string | undefined
|
|
36
|
+
Assert<Equals<NotificationRow['pointer_url'], string | undefined>>,
|
|
37
|
+
Assert<Equals<NotificationRow['from'], {
|
|
38
|
+
type: 'sparkvault';
|
|
39
|
+
} | {
|
|
40
|
+
type: 'organization';
|
|
41
|
+
name: string | null;
|
|
42
|
+
}>>
|
|
36
43
|
];
|
|
37
44
|
export {};
|
package/dist/notify.test-d.js
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
* gate for that instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on
|
|
7
7
|
* every push and again on every SDK publish) refuses to compile the moment a
|
|
8
8
|
* member below stops being typed as stated there; the statements mirror
|
|
9
|
-
* `apps/api/src/notify/inbox.js` (`projectRow`)
|
|
9
|
+
* `apps/api/src/notify/inbox.js` (`projectRow`) and the feed's `from`
|
|
10
|
+
* (`GET /v1/me/notifications`) by hand.
|
|
10
11
|
*
|
|
11
12
|
* WHICH fields the row carries is gated across packages rather than here:
|
|
12
13
|
* tests/notify-contract.test.ts holds `NotificationRow` to
|
|
13
|
-
* `NOTIFY_RESPONSE_FIELDS.
|
|
14
|
+
* `NOTIFY_RESPONSE_FIELDS.feedRow` (`@sparkvault/app-sdk/notify-contract`),
|
|
14
15
|
* the list the Core API's suite holds its projection to.
|
|
15
16
|
*
|
|
16
17
|
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
17
18
|
* which would put these assertions exactly where the compiler cannot see them.
|
|
18
19
|
*
|
|
19
20
|
* The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
|
|
20
|
-
* file asserts the same
|
|
21
|
+
* file asserts the same members, so both move together.
|
|
21
22
|
*/
|
|
22
23
|
export {};
|
|
23
24
|
//# sourceMappingURL=notify.test-d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.test-d.js","sourceRoot":"","sources":["../src/notify.test-d.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notify.test-d.js","sourceRoot":"","sources":["../src/notify.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/notify.test-d.ts
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
* gate for that instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on
|
|
7
7
|
* every push and again on every SDK publish) refuses to compile the moment a
|
|
8
8
|
* member below stops being typed as stated there; the statements mirror
|
|
9
|
-
* `apps/api/src/notify/inbox.js` (`projectRow`)
|
|
9
|
+
* `apps/api/src/notify/inbox.js` (`projectRow`) and the feed's `from`
|
|
10
|
+
* (`GET /v1/me/notifications`) by hand.
|
|
10
11
|
*
|
|
11
12
|
* WHICH fields the row carries is gated across packages rather than here:
|
|
12
13
|
* tests/notify-contract.test.ts holds `NotificationRow` to
|
|
13
|
-
* `NOTIFY_RESPONSE_FIELDS.
|
|
14
|
+
* `NOTIFY_RESPONSE_FIELDS.feedRow` (`@sparkvault/app-sdk/notify-contract`),
|
|
14
15
|
* the list the Core API's suite holds its projection to.
|
|
15
16
|
*
|
|
16
17
|
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
17
18
|
* which would put these assertions exactly where the compiler cannot see them.
|
|
18
19
|
*
|
|
19
20
|
* The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
|
|
20
|
-
* file asserts the same
|
|
21
|
+
* file asserts the same members, so both move together.
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import type { NotificationRow } from './notify.js';
|
|
@@ -47,4 +48,9 @@ export type NotifyWireContract = [
|
|
|
47
48
|
Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
|
|
48
49
|
// The URL the pointer opens travels with it: absent exactly when the pointer is.
|
|
49
50
|
Assert<Equals<NotificationRow['pointer_url'], string | undefined>>,
|
|
51
|
+
// Every row says who sent it, always: SparkVault, or the person's organization
|
|
52
|
+
// by a name the server withholds (null) when it has none it can show. An app
|
|
53
|
+
// that cannot tell the two apart would show an organization's notice as
|
|
54
|
+
// SparkVault's own.
|
|
55
|
+
Assert<Equals<NotificationRow['from'], { type: 'sparkvault' } | { type: 'organization'; name: string | null }>>,
|
|
50
56
|
];
|
package/src/notify.ts
CHANGED
|
@@ -9,11 +9,22 @@ export type NotificationInboxState = 'all' | 'unseen' | 'unread' | 'archived';
|
|
|
9
9
|
export type NotificationMarkState = 'seen' | 'read' | 'archived';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
12
|
+
* Who a row of the person's own feed is from: SparkVault itself, or their own
|
|
13
|
+
* organization by its name. `name` is null when the organization has no name the
|
|
14
|
+
* feed can show (none, or one that reads as SparkVault's): label such a row
|
|
15
|
+
* generically, never as SparkVault's.
|
|
16
|
+
*/
|
|
17
|
+
export type NotificationSender = { type: 'sparkvault' } | { type: 'organization'; name: string | null };
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A row of the person's own feed in the two-part notification model, and who
|
|
21
|
+
* sent it (`from`): the feed holds what SparkVault itself delivered to them and
|
|
22
|
+
* what their own organization's Notify did, so show `from` on every row, since an
|
|
23
|
+
* organization's title alone could read as SparkVault's own. The `title` (and,
|
|
24
|
+
* for a cleartext send, the short `body`) is the NON-sensitive cleartext part,
|
|
25
|
+
* shown natively. A SECURE send's content lives behind the SparkLink
|
|
26
|
+
* (`sparklink_code`) and is never carried here: open the pointer to reveal it.
|
|
27
|
+
* Timestamps are epoch SECONDS.
|
|
17
28
|
*/
|
|
18
29
|
export interface NotificationRow {
|
|
19
30
|
notification_id: string;
|
|
@@ -61,6 +72,7 @@ export interface NotificationRow {
|
|
|
61
72
|
* tap-to-reveal that opens nothing.
|
|
62
73
|
*/
|
|
63
74
|
recalled: boolean;
|
|
75
|
+
from: NotificationSender;
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
export interface ListNotificationsOptions {
|
|
@@ -146,11 +158,11 @@ const MARK_ALL_MAX_PAGES = 100;
|
|
|
146
158
|
|
|
147
159
|
/**
|
|
148
160
|
* SparkVault's first-party Notify surface: the metadata-only inbox of a user
|
|
149
|
-
* signed in to SparkVault itself, holding the notifications SparkVault
|
|
150
|
-
* to them `in_app`, plus this device's
|
|
151
|
-
* ALWAYS derived from the session on the
|
|
152
|
-
* `recipient_id`, and any account/recipient a caller
|
|
153
|
-
* ignored.
|
|
161
|
+
* signed in to SparkVault itself, holding the notifications SparkVault and the
|
|
162
|
+
* organization they signed in to delivered to them `in_app`, plus this device's
|
|
163
|
+
* push registration. The recipient is ALWAYS derived from the session on the
|
|
164
|
+
* server: no method takes a `recipient_id`, and any account/recipient a caller
|
|
165
|
+
* might try to supply is ignored.
|
|
154
166
|
*/
|
|
155
167
|
export class MobileNotifyClient {
|
|
156
168
|
private readonly http: MobileHttpClient;
|