@gravity-rail/sdk 0.21.0 → 0.32.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/README.md +57 -8
- package/dist/agui.d.cts +1 -1
- package/dist/agui.d.ts +1 -1
- package/dist/audio.d.cts +1 -1
- package/dist/audio.d.ts +1 -1
- package/dist/{client-B0eh2BEY.d.cts → chat-interaction-BKdImgZ5.d.ts} +8006 -3570
- package/dist/{client-CFz-BGmY.d.ts → chat-interaction-DLfC_h_P.d.cts} +8006 -3570
- package/dist/{chunk-3HAV5XUJ.js → chunk-HRUMZ46V.js} +1 -1
- package/dist/chunk-HRUMZ46V.js.map +1 -0
- package/dist/{chunk-24L4RD4Z.js → chunk-N446FGCT.js} +1247 -203
- package/dist/chunk-N446FGCT.js.map +1 -0
- package/dist/{chunk-7OLBLLV7.js → chunk-P2E6LU7I.js} +57 -7
- package/dist/chunk-P2E6LU7I.js.map +1 -0
- package/dist/helpers.cjs +54 -1
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +3 -2
- package/dist/helpers.d.ts +3 -2
- package/dist/helpers.js +11 -3
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2302 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +509 -6
- package/dist/index.d.ts +509 -6
- package/dist/index.js +1032 -23
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +1337 -222
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +33 -49
- package/dist/internal.d.ts +33 -49
- package/dist/internal.js +73 -33
- package/dist/internal.js.map +1 -1
- package/dist/realtime.cjs +279 -14
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +169 -17
- package/dist/realtime.d.ts +169 -17
- package/dist/realtime.js +264 -13
- package/dist/realtime.js.map +1 -1
- package/dist/{revision-state-fJ9PM15N.d.cts → revision-state-Bsq5dKwi.d.cts} +236 -5
- package/dist/{revision-state-KfOztBkY.d.ts → revision-state-CQTYcIRG.d.ts} +236 -5
- package/dist/schemas.cjs +3 -1
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +31 -13
- package/dist/schemas.d.ts +31 -13
- package/dist/schemas.js +4 -2
- package/dist/schemas.js.map +1 -1
- package/dist/{tasks-WH_VfzMv.d.cts → tasks-B-31JPuq.d.cts} +298 -114
- package/dist/{tasks-WH_VfzMv.d.ts → tasks-B-31JPuq.d.ts} +298 -114
- package/dist/types-0c6_NGU4.d.cts +90 -0
- package/dist/types-0c6_NGU4.d.ts +90 -0
- package/package.json +3 -3
- package/dist/chunk-24L4RD4Z.js.map +0 -1
- package/dist/chunk-3HAV5XUJ.js.map +0 -1
- package/dist/chunk-7OLBLLV7.js.map +0 -1
- package/dist/types-DkYyrvoC.d.cts +0 -19
- package/dist/types-DkYyrvoC.d.ts +0 -19
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Event received from a subscribed workspace realtime channel. */
|
|
2
|
+
interface ChannelEvent {
|
|
3
|
+
type: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
type ChannelListener = (event: ChannelEvent) => void;
|
|
7
|
+
type Unsubscribe = () => void;
|
|
8
|
+
/**
|
|
9
|
+
* What every realtime connection needs: where the API is, and who is asking.
|
|
10
|
+
*
|
|
11
|
+
* The account socket needs nothing more — its scope comes from the server's
|
|
12
|
+
* grant map, not from the URL — so this is the base rather than a widening of
|
|
13
|
+
* {@link RealtimeAuthSession}. A workspace session is assignable to it, which
|
|
14
|
+
* is what lets one session object drive both clients during cutover.
|
|
15
|
+
*/
|
|
16
|
+
interface RealtimeSessionBase {
|
|
17
|
+
apiUrl: string;
|
|
18
|
+
accessToken: string;
|
|
19
|
+
}
|
|
20
|
+
/** Auth context for workspace realtime WebSocket connections. */
|
|
21
|
+
interface RealtimeAuthSession extends RealtimeSessionBase {
|
|
22
|
+
workspaceUuid: string;
|
|
23
|
+
}
|
|
24
|
+
/** Auth context for the account realtime WebSocket. No workspace, by design. */
|
|
25
|
+
type AccountRealtimeSession = RealtimeSessionBase;
|
|
26
|
+
type OperatorSessionState = 'idle' | 'connecting' | 'connected' | 'error';
|
|
27
|
+
type OperatorCallPhase = 'idle' | 'connecting' | 'ready' | 'dialing' | 'live' | 'onHold' | 'ended' | 'failed';
|
|
28
|
+
/** Phases where Hold / Forward / Hang up apply to an active phone leg. */
|
|
29
|
+
declare function isActiveCallPhase(phase: OperatorCallPhase): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The two activity lanes a client can watch.
|
|
32
|
+
*
|
|
33
|
+
* `activity` is the whole workspace's feed; `activity:me` is the connected
|
|
34
|
+
* member's own private lane and open items, kept separate so a busy workspace
|
|
35
|
+
* does not wake every operator's badge on every event.
|
|
36
|
+
*
|
|
37
|
+
* Both are named constants rather than interpolated strings because the server
|
|
38
|
+
* matches them exactly — a typo would subscribe successfully to nothing.
|
|
39
|
+
*/
|
|
40
|
+
declare const ACTIVITY_CHANNEL: "activity";
|
|
41
|
+
declare const ACTIVITY_MEMBER_CHANNEL: "activity:me";
|
|
42
|
+
/**
|
|
43
|
+
* The account's own lane, on the account socket only.
|
|
44
|
+
*
|
|
45
|
+
* Carries two things the workspace lanes cannot: the account's
|
|
46
|
+
* `account_private` rows (manager / DM / agent-job chats, member-targeted
|
|
47
|
+
* routine runs, and the concierge lane, which has no workspace at all), and a
|
|
48
|
+
* change to the account's own grants.
|
|
49
|
+
*/
|
|
50
|
+
declare const ACCOUNT_ACTIVITY_CHANNEL: "account:activity";
|
|
51
|
+
type ActivityChannelName = typeof ACTIVITY_CHANNEL | typeof ACTIVITY_MEMBER_CHANNEL | typeof ACCOUNT_ACTIVITY_CHANNEL;
|
|
52
|
+
/**
|
|
53
|
+
* Operator presence, on the account socket only.
|
|
54
|
+
*
|
|
55
|
+
* The channel operator presence is **written** on. Presence state lives once,
|
|
56
|
+
* at the account (`docs/projects/active/account-socket.md` § "Presence,
|
|
57
|
+
* migrated"), and is projected into each chosen workspace's live set — so
|
|
58
|
+
* going live is one command here rather than one per workspace socket.
|
|
59
|
+
*
|
|
60
|
+
* Unlike the activity lanes this one is bidirectional and does carry a
|
|
61
|
+
* payload, because it is not an invalidation lane: `presence_confirmed`
|
|
62
|
+
* reports the scope set the server actually honoured, which is the answer to
|
|
63
|
+
* the command and is not re-fetchable from anywhere else.
|
|
64
|
+
*/
|
|
65
|
+
declare const ACCOUNT_PRESENCE_CHANNEL: "account:presence";
|
|
66
|
+
/** The workspace-scoped presence channel, on the per-workspace socket. */
|
|
67
|
+
declare const PRESENCE_CHANNEL: "presence";
|
|
68
|
+
/**
|
|
69
|
+
* What an activity channel delivers — and deliberately all it delivers.
|
|
70
|
+
*
|
|
71
|
+
* **No event payloads travel over this socket.** The signal says *look again*;
|
|
72
|
+
* the look goes through `POST /activity/query` (or `/counts` for a badge) under
|
|
73
|
+
* the client's own session, where it is authorized against a freshly compiled
|
|
74
|
+
* grant set and recorded as a bulk PHI access. A payload here would be an
|
|
75
|
+
* authorization decision frozen at publish time by a producer that knows
|
|
76
|
+
* nothing about who is listening — and a read that left no audit record.
|
|
77
|
+
*
|
|
78
|
+
* So: refetch on this, never render from it.
|
|
79
|
+
*/
|
|
80
|
+
interface ActivityInvalidationEvent extends ChannelEvent {
|
|
81
|
+
type: 'invalidate';
|
|
82
|
+
data: {
|
|
83
|
+
scope: 'workspace' | 'member' | 'account';
|
|
84
|
+
reason: 'drain';
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** Narrow a channel event to an activity invalidation. */
|
|
88
|
+
declare function isActivityInvalidation(event: ChannelEvent): event is ActivityInvalidationEvent;
|
|
89
|
+
|
|
90
|
+
export { type AccountRealtimeSession as A, type ChannelEvent as C, type OperatorSessionState as O, PRESENCE_CHANNEL as P, type RealtimeSessionBase as R, type Unsubscribe as U, type ChannelListener as a, type RealtimeAuthSession as b, type OperatorCallPhase as c, ACCOUNT_ACTIVITY_CHANNEL as d, ACCOUNT_PRESENCE_CHANNEL as e, ACTIVITY_CHANNEL as f, ACTIVITY_MEMBER_CHANNEL as g, type ActivityChannelName as h, type ActivityInvalidationEvent as i, isActiveCallPhase as j, isActivityInvalidation as k };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Event received from a subscribed workspace realtime channel. */
|
|
2
|
+
interface ChannelEvent {
|
|
3
|
+
type: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
type ChannelListener = (event: ChannelEvent) => void;
|
|
7
|
+
type Unsubscribe = () => void;
|
|
8
|
+
/**
|
|
9
|
+
* What every realtime connection needs: where the API is, and who is asking.
|
|
10
|
+
*
|
|
11
|
+
* The account socket needs nothing more — its scope comes from the server's
|
|
12
|
+
* grant map, not from the URL — so this is the base rather than a widening of
|
|
13
|
+
* {@link RealtimeAuthSession}. A workspace session is assignable to it, which
|
|
14
|
+
* is what lets one session object drive both clients during cutover.
|
|
15
|
+
*/
|
|
16
|
+
interface RealtimeSessionBase {
|
|
17
|
+
apiUrl: string;
|
|
18
|
+
accessToken: string;
|
|
19
|
+
}
|
|
20
|
+
/** Auth context for workspace realtime WebSocket connections. */
|
|
21
|
+
interface RealtimeAuthSession extends RealtimeSessionBase {
|
|
22
|
+
workspaceUuid: string;
|
|
23
|
+
}
|
|
24
|
+
/** Auth context for the account realtime WebSocket. No workspace, by design. */
|
|
25
|
+
type AccountRealtimeSession = RealtimeSessionBase;
|
|
26
|
+
type OperatorSessionState = 'idle' | 'connecting' | 'connected' | 'error';
|
|
27
|
+
type OperatorCallPhase = 'idle' | 'connecting' | 'ready' | 'dialing' | 'live' | 'onHold' | 'ended' | 'failed';
|
|
28
|
+
/** Phases where Hold / Forward / Hang up apply to an active phone leg. */
|
|
29
|
+
declare function isActiveCallPhase(phase: OperatorCallPhase): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The two activity lanes a client can watch.
|
|
32
|
+
*
|
|
33
|
+
* `activity` is the whole workspace's feed; `activity:me` is the connected
|
|
34
|
+
* member's own private lane and open items, kept separate so a busy workspace
|
|
35
|
+
* does not wake every operator's badge on every event.
|
|
36
|
+
*
|
|
37
|
+
* Both are named constants rather than interpolated strings because the server
|
|
38
|
+
* matches them exactly — a typo would subscribe successfully to nothing.
|
|
39
|
+
*/
|
|
40
|
+
declare const ACTIVITY_CHANNEL: "activity";
|
|
41
|
+
declare const ACTIVITY_MEMBER_CHANNEL: "activity:me";
|
|
42
|
+
/**
|
|
43
|
+
* The account's own lane, on the account socket only.
|
|
44
|
+
*
|
|
45
|
+
* Carries two things the workspace lanes cannot: the account's
|
|
46
|
+
* `account_private` rows (manager / DM / agent-job chats, member-targeted
|
|
47
|
+
* routine runs, and the concierge lane, which has no workspace at all), and a
|
|
48
|
+
* change to the account's own grants.
|
|
49
|
+
*/
|
|
50
|
+
declare const ACCOUNT_ACTIVITY_CHANNEL: "account:activity";
|
|
51
|
+
type ActivityChannelName = typeof ACTIVITY_CHANNEL | typeof ACTIVITY_MEMBER_CHANNEL | typeof ACCOUNT_ACTIVITY_CHANNEL;
|
|
52
|
+
/**
|
|
53
|
+
* Operator presence, on the account socket only.
|
|
54
|
+
*
|
|
55
|
+
* The channel operator presence is **written** on. Presence state lives once,
|
|
56
|
+
* at the account (`docs/projects/active/account-socket.md` § "Presence,
|
|
57
|
+
* migrated"), and is projected into each chosen workspace's live set — so
|
|
58
|
+
* going live is one command here rather than one per workspace socket.
|
|
59
|
+
*
|
|
60
|
+
* Unlike the activity lanes this one is bidirectional and does carry a
|
|
61
|
+
* payload, because it is not an invalidation lane: `presence_confirmed`
|
|
62
|
+
* reports the scope set the server actually honoured, which is the answer to
|
|
63
|
+
* the command and is not re-fetchable from anywhere else.
|
|
64
|
+
*/
|
|
65
|
+
declare const ACCOUNT_PRESENCE_CHANNEL: "account:presence";
|
|
66
|
+
/** The workspace-scoped presence channel, on the per-workspace socket. */
|
|
67
|
+
declare const PRESENCE_CHANNEL: "presence";
|
|
68
|
+
/**
|
|
69
|
+
* What an activity channel delivers — and deliberately all it delivers.
|
|
70
|
+
*
|
|
71
|
+
* **No event payloads travel over this socket.** The signal says *look again*;
|
|
72
|
+
* the look goes through `POST /activity/query` (or `/counts` for a badge) under
|
|
73
|
+
* the client's own session, where it is authorized against a freshly compiled
|
|
74
|
+
* grant set and recorded as a bulk PHI access. A payload here would be an
|
|
75
|
+
* authorization decision frozen at publish time by a producer that knows
|
|
76
|
+
* nothing about who is listening — and a read that left no audit record.
|
|
77
|
+
*
|
|
78
|
+
* So: refetch on this, never render from it.
|
|
79
|
+
*/
|
|
80
|
+
interface ActivityInvalidationEvent extends ChannelEvent {
|
|
81
|
+
type: 'invalidate';
|
|
82
|
+
data: {
|
|
83
|
+
scope: 'workspace' | 'member' | 'account';
|
|
84
|
+
reason: 'drain';
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** Narrow a channel event to an activity invalidation. */
|
|
88
|
+
declare function isActivityInvalidation(event: ChannelEvent): event is ActivityInvalidationEvent;
|
|
89
|
+
|
|
90
|
+
export { type AccountRealtimeSession as A, type ChannelEvent as C, type OperatorSessionState as O, PRESENCE_CHANNEL as P, type RealtimeSessionBase as R, type Unsubscribe as U, type ChannelListener as a, type RealtimeAuthSession as b, type OperatorCallPhase as c, ACCOUNT_ACTIVITY_CHANNEL as d, ACCOUNT_PRESENCE_CHANNEL as e, ACTIVITY_CHANNEL as f, ACTIVITY_MEMBER_CHANNEL as g, type ActivityChannelName as h, type ActivityInvalidationEvent as i, isActiveCallPhase as j, isActivityInvalidation as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-rail/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Gravity Rail TypeScript SDK — API client for workspace management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"docs:json": "typedoc --json docs/api.json"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"libphonenumber-js": "^1.13.
|
|
81
|
-
"react-hook-form": "^7.
|
|
80
|
+
"libphonenumber-js": "^1.13.12",
|
|
81
|
+
"react-hook-form": "^7.87.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": "^19",
|