@lemoncloud/chatic-sockets-lib 0.3.1 → 0.3.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/client-socket-v2/gateways/join-gateway.d.ts +15 -0
- package/dist/client-socket-v2/gateways/join-gateway.js +12 -0
- package/dist/client-socket-v2/index.d.ts +4 -0
- package/dist/client-socket-v2/index.js +3 -0
- package/dist/client-socket-v2/plans/channel-sync-plan.d.ts +14 -10
- package/dist/client-socket-v2/plans/channel-sync-plan.js +6 -2
- package/dist/client-socket-v2/plans/chat-sync-plan.d.ts +63 -0
- package/dist/client-socket-v2/plans/chat-sync-plan.js +166 -0
- package/dist/client-socket-v2/plans/join-sync-plan.d.ts +37 -0
- package/dist/client-socket-v2/plans/join-sync-plan.js +71 -0
- package/dist/client-socket-v2/plans/place-sync-plan.d.ts +14 -10
- package/dist/client-socket-v2/plans/place-sync-plan.js +5 -2
- package/dist/client-socket-v2/plans/profile-sync-plan.d.ts +14 -10
- package/dist/client-socket-v2/plans/profile-sync-plan.js +5 -2
- package/dist/client-socket-v2/types.d.ts +12 -0
- package/dist/lib/channel/types.d.ts +1 -2
- package/dist/lib/chat/types.d.ts +6 -1
- package/dist/lib/chat/views.d.ts +62 -0
- package/dist/lib/chat/views.js +2 -0
- package/dist/lib/join/contracts.d.ts +32 -0
- package/dist/lib/join/contracts.js +7 -0
- package/dist/lib/join/types.d.ts +31 -0
- package/dist/lib/join/types.js +2 -0
- package/dist/lib/socket-actions.d.ts +19 -1
- package/dist/lib/socket-actions.js +13 -0
- package/dist/lib/socket-inputs.d.ts +1 -0
- package/package.json +1 -1
- package/dist/modules/chat/model.d.ts +0 -107
- package/dist/modules/chat/model.js +0 -28
- package/dist/modules/chat/types.d.ts +0 -65
- package/dist/modules/chat/types.js +0 -55
- package/dist/modules/chat/views.d.ts +0 -50
- package/dist/modules/chat/views.js +0 -23
- package/dist/modules/sockets/model.d.ts +0 -206
- package/dist/modules/sockets/model.js +0 -28
- package/dist/modules/sockets/types.d.ts +0 -100
- package/dist/modules/sockets/types.js +0 -86
- package/dist/modules/sockets/views.d.ts +0 -67
- package/dist/modules/sockets/views.js +0 -23
package/dist/lib/chat/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { InferSocketRequest, SocketRequestMessage } from '../types';
|
|
1
|
+
import type { InferSocketRequest, SocketMessage, SocketRequestMessage } from '../types';
|
|
2
|
+
import type { ChatView } from './views';
|
|
2
3
|
export interface ChatSendRequestData {
|
|
3
4
|
channelId: string;
|
|
4
5
|
content: string;
|
|
@@ -77,3 +78,7 @@ export declare type ChatDeleteRequestMessage = SocketRequestMessage<ChatDeleteTy
|
|
|
77
78
|
export declare type ChatGetType = 'chat.get';
|
|
78
79
|
export declare type ChatGetInput = InferSocketRequest<ChatGetType>;
|
|
79
80
|
export declare type ChatGetRequestMessage = SocketRequestMessage<ChatGetType>;
|
|
81
|
+
/** chat.sync — 서버→클라 push(broadcast). data 자체가 append된 메시지(fat payload). nudge 아님. */
|
|
82
|
+
export declare type ChatSyncType = 'chat.sync';
|
|
83
|
+
export declare type ChatSyncData = ChatView;
|
|
84
|
+
export declare type ChatSyncMessage = SocketMessage<ChatSyncData>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lib/chat/views.ts`
|
|
3
|
+
* - client-safe shared chat-domain views (channel/chat/join).
|
|
4
|
+
* - keep this file free from server-only deps (`modules/*`, `cores`) so the published
|
|
5
|
+
* client SDK declaration build does not pull the chat model graph into its `.d.ts`.
|
|
6
|
+
* - mirrors the model-decoupled `DeviceView` pattern in `lib/device/contracts.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import type { DeviceView } from '../device/contracts';
|
|
9
|
+
export declare type ChannelStereo = '' | 'dm' | 'self' | 'public' | 'private';
|
|
10
|
+
export declare type ChatStereo = 'text' | 'join' | 'leave' | 'system';
|
|
11
|
+
export declare type JoinStereo = '';
|
|
12
|
+
/** chat room state shared across websocket client/server contracts. */
|
|
13
|
+
export interface ChannelView {
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
stereo?: ChannelStereo;
|
|
17
|
+
desc?: string;
|
|
18
|
+
ownerId?: string;
|
|
19
|
+
/** last chat sequence in this channel */
|
|
20
|
+
chatNo?: number;
|
|
21
|
+
/** joined device ids */
|
|
22
|
+
memberIds?: string[];
|
|
23
|
+
createdAt?: number;
|
|
24
|
+
updatedAt?: number;
|
|
25
|
+
deletedAt?: number;
|
|
26
|
+
/** (linked) owner info */
|
|
27
|
+
readonly owner$?: DeviceView;
|
|
28
|
+
/** (linked) last chat info */
|
|
29
|
+
readonly lastChat$?: ChatView;
|
|
30
|
+
/** (linked) device's channel connection view */
|
|
31
|
+
readonly $join?: JoinView;
|
|
32
|
+
}
|
|
33
|
+
/** message or channel event. */
|
|
34
|
+
export interface ChatView {
|
|
35
|
+
/** id = `${channelId}:${chatNo}` */
|
|
36
|
+
id?: string;
|
|
37
|
+
stereo?: ChatStereo;
|
|
38
|
+
/** channel-local sequence */
|
|
39
|
+
chatNo?: number;
|
|
40
|
+
content?: string;
|
|
41
|
+
contentType?: string;
|
|
42
|
+
channelId?: string;
|
|
43
|
+
ownerId?: string;
|
|
44
|
+
createdAt?: number;
|
|
45
|
+
updatedAt?: number;
|
|
46
|
+
deletedAt?: number;
|
|
47
|
+
}
|
|
48
|
+
/** channel membership and read cursor. */
|
|
49
|
+
export interface JoinView {
|
|
50
|
+
/** id = `${channelId}:${ownerId}` */
|
|
51
|
+
id?: string;
|
|
52
|
+
stereo?: JoinStereo;
|
|
53
|
+
channelId?: string;
|
|
54
|
+
ownerId?: string;
|
|
55
|
+
/** last read chat sequence */
|
|
56
|
+
chatNo?: number;
|
|
57
|
+
/** current joined state for API/view consumers. */
|
|
58
|
+
readonly joined?: boolean;
|
|
59
|
+
createdAt?: number;
|
|
60
|
+
updatedAt?: number;
|
|
61
|
+
deletedAt?: number;
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lib/join/contracts.ts`
|
|
3
|
+
* - client-safe join domain contracts.
|
|
4
|
+
* - keep this file free from server-only runtime dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export declare type JoinNotify = '' | 'all' | 'mention' | 'none';
|
|
7
|
+
/**
|
|
8
|
+
* client-safe join view shared across websocket client/server contracts.
|
|
9
|
+
* - mirrors the v1 (demo) JoinModel projection; the server `modelAsView` output is assignable to it.
|
|
10
|
+
* - socials responses are a superset and are injected as a concrete view by the consumer where needed.
|
|
11
|
+
* - kept free of `modules/*` imports so the published client `.d.ts` carries no server models.
|
|
12
|
+
*/
|
|
13
|
+
export interface JoinView {
|
|
14
|
+
id?: string;
|
|
15
|
+
channelId?: string;
|
|
16
|
+
ownerId?: string;
|
|
17
|
+
stereo?: string;
|
|
18
|
+
chatNo?: number;
|
|
19
|
+
joined?: boolean;
|
|
20
|
+
updatedAt?: number;
|
|
21
|
+
}
|
|
22
|
+
/** `join.get` request input — composite join id, client-supplied. */
|
|
23
|
+
export interface JoinGetRequestBody {
|
|
24
|
+
id: string;
|
|
25
|
+
}
|
|
26
|
+
/** `join.update` request input — edit join metadata (nick/notify). */
|
|
27
|
+
export interface JoinUpdateRequestBody {
|
|
28
|
+
id: string;
|
|
29
|
+
nick?: string;
|
|
30
|
+
notify?: JoinNotify;
|
|
31
|
+
role?: 'owner' | 'admin' | 'member' | string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InferSocketError, InferSocketRequest, InferSocketResponse, SocketErrorMessage, SocketRequestMessage, SocketResponseMessage } from '../types';
|
|
2
|
+
import type { JoinView, JoinGetRequestBody, JoinUpdateRequestBody } from './contracts';
|
|
3
|
+
declare module '../types' {
|
|
4
|
+
interface SocketPacketRegistry {
|
|
5
|
+
'join.get': {
|
|
6
|
+
request: JoinGetRequestBody;
|
|
7
|
+
response: JoinView;
|
|
8
|
+
error: null;
|
|
9
|
+
};
|
|
10
|
+
'join.update': {
|
|
11
|
+
request: JoinUpdateRequestBody;
|
|
12
|
+
response: JoinView;
|
|
13
|
+
error: null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare type JoinGetType = 'join.get';
|
|
18
|
+
export declare type JoinGetResponseData = InferSocketResponse<JoinGetType>;
|
|
19
|
+
export declare type JoinGetErrorData = InferSocketError<JoinGetType>;
|
|
20
|
+
export declare type JoinGetInput = InferSocketRequest<JoinGetType>;
|
|
21
|
+
export declare type JoinGetRequestMessage = SocketRequestMessage<JoinGetType>;
|
|
22
|
+
export declare type JoinGetResponseMessage = SocketResponseMessage<JoinGetType>;
|
|
23
|
+
export declare type JoinGetErrorMessage = SocketErrorMessage<JoinGetType>;
|
|
24
|
+
export declare type JoinUpdateType = 'join.update';
|
|
25
|
+
export declare type JoinUpdateResponseData = InferSocketResponse<JoinUpdateType>;
|
|
26
|
+
export declare type JoinUpdateErrorData = InferSocketError<JoinUpdateType>;
|
|
27
|
+
export declare type JoinUpdateInput = InferSocketRequest<JoinUpdateType>;
|
|
28
|
+
export declare type JoinUpdateRequestMessage = SocketRequestMessage<JoinUpdateType>;
|
|
29
|
+
export declare type JoinUpdateResponseMessage = SocketResponseMessage<JoinUpdateType>;
|
|
30
|
+
export declare type JoinUpdateErrorMessage = SocketErrorMessage<JoinUpdateType>;
|
|
31
|
+
export type { JoinView };
|
|
@@ -36,6 +36,8 @@ export declare const SocketActionTypeLUT: {
|
|
|
36
36
|
readonly profile: "profile";
|
|
37
37
|
/** cloud - cloud profile operations */
|
|
38
38
|
readonly cloud: "cloud";
|
|
39
|
+
/** join - channel join/membership operations */
|
|
40
|
+
readonly join: "join";
|
|
39
41
|
};
|
|
40
42
|
/**
|
|
41
43
|
* SystemActionType
|
|
@@ -188,6 +190,17 @@ export declare const SocketActionTypeLUT: {
|
|
|
188
190
|
/** sync - synchronize site multi-profiles (delta since cursor) */
|
|
189
191
|
readonly sync: "sync";
|
|
190
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* JoinActionType
|
|
195
|
+
* - join 도메인 액션
|
|
196
|
+
*/
|
|
197
|
+
readonly JoinActionType: {
|
|
198
|
+
readonly '': "";
|
|
199
|
+
/** get - get join record by composite id */
|
|
200
|
+
readonly get: "get";
|
|
201
|
+
/** update - update caller's join metadata (nick/notify) */
|
|
202
|
+
readonly update: "update";
|
|
203
|
+
};
|
|
191
204
|
/**
|
|
192
205
|
* CloudActionType
|
|
193
206
|
* - cloud 도메인 액션
|
|
@@ -250,10 +263,14 @@ export declare type SocketProfileActionType = SocketActionKeyOf<typeof SocketAct
|
|
|
250
263
|
* type: `SocketCloudActionType`
|
|
251
264
|
*/
|
|
252
265
|
export declare type SocketCloudActionType = SocketActionKeyOf<typeof SocketActionTypeLUT.CloudActionType>;
|
|
266
|
+
/**
|
|
267
|
+
* type: `SocketJoinActionType`
|
|
268
|
+
*/
|
|
269
|
+
export declare type SocketJoinActionType = SocketActionKeyOf<typeof SocketActionTypeLUT.JoinActionType>;
|
|
253
270
|
/**
|
|
254
271
|
* type: `SocketActionType`
|
|
255
272
|
*/
|
|
256
|
-
export declare type SocketActionType = SocketSystemActionType | SocketSocketsActionType | SocketDeviceActionType | SocketAuthActionType | SocketChannelActionType | SocketChatActionType | SocketUserActionType | SocketPlaceActionType | SocketProfileActionType | SocketCloudActionType;
|
|
273
|
+
export declare type SocketActionType = SocketSystemActionType | SocketSocketsActionType | SocketDeviceActionType | SocketAuthActionType | SocketChannelActionType | SocketChatActionType | SocketUserActionType | SocketPlaceActionType | SocketProfileActionType | SocketCloudActionType | SocketJoinActionType;
|
|
257
274
|
/**
|
|
258
275
|
* interface: `SocketActionTypeMap`
|
|
259
276
|
* - domain to action type map
|
|
@@ -269,6 +286,7 @@ export interface SocketActionTypeMap {
|
|
|
269
286
|
place: SocketPlaceActionType;
|
|
270
287
|
profile: SocketProfileActionType;
|
|
271
288
|
cloud: SocketCloudActionType;
|
|
289
|
+
join: SocketJoinActionType;
|
|
272
290
|
}
|
|
273
291
|
/**
|
|
274
292
|
* type: `SocketSupportedDomainType`
|
|
@@ -39,6 +39,8 @@ exports.SocketActionTypeLUT = {
|
|
|
39
39
|
profile: 'profile',
|
|
40
40
|
/** cloud - cloud profile operations */
|
|
41
41
|
cloud: 'cloud',
|
|
42
|
+
/** join - channel join/membership operations */
|
|
43
|
+
join: 'join',
|
|
42
44
|
},
|
|
43
45
|
/**
|
|
44
46
|
* SystemActionType
|
|
@@ -191,6 +193,17 @@ exports.SocketActionTypeLUT = {
|
|
|
191
193
|
/** sync - synchronize site multi-profiles (delta since cursor) */
|
|
192
194
|
sync: 'sync',
|
|
193
195
|
},
|
|
196
|
+
/**
|
|
197
|
+
* JoinActionType
|
|
198
|
+
* - join 도메인 액션
|
|
199
|
+
*/
|
|
200
|
+
JoinActionType: {
|
|
201
|
+
'': '',
|
|
202
|
+
/** get - get join record by composite id */
|
|
203
|
+
get: 'get',
|
|
204
|
+
/** update - update caller's join metadata (nick/notify) */
|
|
205
|
+
update: 'update',
|
|
206
|
+
},
|
|
194
207
|
/**
|
|
195
208
|
* CloudActionType
|
|
196
209
|
* - cloud 도메인 액션
|
|
@@ -13,3 +13,4 @@ export type { PlaceCreateInput, PlaceDeleteInput, PlaceGetInput, PlaceUpdateInpu
|
|
|
13
13
|
export type { ProfileGetInput, ProfileGetMineInput, ProfileSetInput, ProfileSyncInput } from './profile/types';
|
|
14
14
|
export type { CloudCreateInput, CloudDeleteInput, CloudGetInput, CloudUpdateInput, UpdateCloudInput, } from './cloud/types';
|
|
15
15
|
export type { UserGetSiteProfileInput, UserInviteBatchInput, UserInviteInput, UserMakeSiteInput, UserMySiteInput, UserSetSiteProfileInput, UserUpdateProfileInput, UserUpdateSiteInput, } from './user/types';
|
|
16
|
+
export type { JoinGetInput, JoinUpdateInput as JoinDomainUpdateInput } from './join/types';
|
package/package.json
CHANGED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `model.ts`
|
|
3
|
-
* - model definitions for chat module.
|
|
4
|
-
*/
|
|
5
|
-
import { CoreModel } from 'lemon-model';
|
|
6
|
-
import $LUT, { ChannelStereo, ChatStereo, JoinStereo } from './types';
|
|
7
|
-
/**
|
|
8
|
-
* type: `ModelType`
|
|
9
|
-
*/
|
|
10
|
-
export declare type ModelType = keyof typeof $LUT.ModelType;
|
|
11
|
-
/**
|
|
12
|
-
* type: `Model`: common model
|
|
13
|
-
*/
|
|
14
|
-
export declare type Model = CoreModel<ModelType>;
|
|
15
|
-
/**
|
|
16
|
-
* interface: `ChannelHead`
|
|
17
|
-
*/
|
|
18
|
-
export interface ChannelHead {
|
|
19
|
-
/** id of channel */
|
|
20
|
-
id?: string;
|
|
21
|
-
/** name of channel */
|
|
22
|
-
name?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* interface: `ChannelModel`
|
|
26
|
-
* - chat room state.
|
|
27
|
-
*/
|
|
28
|
-
export interface ChannelModel extends Model, ChannelHead {
|
|
29
|
-
/** id of model */
|
|
30
|
-
id?: string;
|
|
31
|
-
/** name of channel */
|
|
32
|
-
name?: string;
|
|
33
|
-
/** channel stereo */
|
|
34
|
-
stereo?: ChannelStereo;
|
|
35
|
-
/** optional description */
|
|
36
|
-
desc?: string;
|
|
37
|
-
/** owner id (P1 uses deviceId) */
|
|
38
|
-
ownerId?: string;
|
|
39
|
-
/** last chat sequence in this channel */
|
|
40
|
-
chatNo?: number;
|
|
41
|
-
/** joined device ids */
|
|
42
|
-
memberIds?: string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* interface: `ChatModel`
|
|
46
|
-
* - message or channel event.
|
|
47
|
-
*/
|
|
48
|
-
export interface ChatModel extends Model {
|
|
49
|
-
/** id = `${channelId}:${chatNo}` */
|
|
50
|
-
id?: string;
|
|
51
|
-
/** chat event kind */
|
|
52
|
-
stereo?: ChatStereo;
|
|
53
|
-
/** channel-local sequence */
|
|
54
|
-
chatNo?: number;
|
|
55
|
-
/** message content */
|
|
56
|
-
content?: string;
|
|
57
|
-
/** message content type. v1 only uses text. */
|
|
58
|
-
contentType?: string;
|
|
59
|
-
/** parent channel id */
|
|
60
|
-
channelId?: string;
|
|
61
|
-
/** owner id. v1 uses deviceId. */
|
|
62
|
-
ownerId?: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* interface: `JoinModel`
|
|
66
|
-
* - channel membership and read cursor.
|
|
67
|
-
*/
|
|
68
|
-
export interface JoinModel extends Model {
|
|
69
|
-
/** id = `${channelId}:${ownerId}` */
|
|
70
|
-
id?: string;
|
|
71
|
-
/** join stereo. v1 only uses empty string. */
|
|
72
|
-
stereo?: JoinStereo;
|
|
73
|
-
/** joined channel id */
|
|
74
|
-
channelId?: string;
|
|
75
|
-
/** owner id. v1 uses deviceId. */
|
|
76
|
-
ownerId?: string;
|
|
77
|
-
/** last read chat sequence */
|
|
78
|
-
chatNo?: number;
|
|
79
|
-
/** current joined state. 1 = joined, 0 = left. */
|
|
80
|
-
joined?: number;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* extract field names from models
|
|
84
|
-
* - only fields start with lowercase, or all upper.
|
|
85
|
-
*/
|
|
86
|
-
export declare const filterFields: (fields: string[], base?: string[]) => string[];
|
|
87
|
-
/** field names from head */
|
|
88
|
-
export declare const $HEAD: {
|
|
89
|
-
channel: string[];
|
|
90
|
-
};
|
|
91
|
-
export declare const $FIELD: {
|
|
92
|
-
channel: string[];
|
|
93
|
-
chat: string[];
|
|
94
|
-
join: string[];
|
|
95
|
-
};
|
|
96
|
-
/** must export default as below */
|
|
97
|
-
declare const _default: {
|
|
98
|
-
$HEAD: {
|
|
99
|
-
channel: string[];
|
|
100
|
-
};
|
|
101
|
-
$FIELD: {
|
|
102
|
-
channel: string[];
|
|
103
|
-
chat: string[];
|
|
104
|
-
join: string[];
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
export default _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$FIELD = exports.$HEAD = exports.filterFields = void 0;
|
|
4
|
-
const field_registry_1 = require("../../generated/field-registry");
|
|
5
|
-
/**
|
|
6
|
-
* extract field names from models
|
|
7
|
-
* - only fields start with lowercase, or all upper.
|
|
8
|
-
*/
|
|
9
|
-
const filterFields = (fields, base = []) => fields
|
|
10
|
-
.filter(field => field !== '_id' && /^[a-z_][a-zA-Z_]+/.test(field))
|
|
11
|
-
.reduce((L, k) => {
|
|
12
|
-
if (k && !L.includes(k))
|
|
13
|
-
L.push(k);
|
|
14
|
-
return L;
|
|
15
|
-
}, [...base]);
|
|
16
|
-
exports.filterFields = filterFields;
|
|
17
|
-
/** field names from head */
|
|
18
|
-
exports.$HEAD = {
|
|
19
|
-
channel: (0, exports.filterFields)(field_registry_1.fieldKeys.channelHead()),
|
|
20
|
-
};
|
|
21
|
-
// extract field names from models
|
|
22
|
-
exports.$FIELD = {
|
|
23
|
-
channel: (0, exports.filterFields)(field_registry_1.fieldKeys.channelModel(), ['meta']),
|
|
24
|
-
chat: (0, exports.filterFields)(field_registry_1.fieldKeys.chatModel(), ['meta']),
|
|
25
|
-
join: (0, exports.filterFields)(field_registry_1.fieldKeys.joinModel(), ['meta']),
|
|
26
|
-
};
|
|
27
|
-
/** must export default as below */
|
|
28
|
-
exports.default = { $HEAD: exports.$HEAD, $FIELD: exports.$FIELD };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `types.ts`
|
|
3
|
-
* - basic types for chat module.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Lookup Table
|
|
7
|
-
*
|
|
8
|
-
* WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
|
|
9
|
-
*/
|
|
10
|
-
declare const $LUT: {
|
|
11
|
-
/**
|
|
12
|
-
* Possible type of model.
|
|
13
|
-
*/
|
|
14
|
-
ModelType: {
|
|
15
|
-
/** channel model */
|
|
16
|
-
channel: string;
|
|
17
|
-
/** chat model */
|
|
18
|
-
chat: string;
|
|
19
|
-
/** join model */
|
|
20
|
-
join: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* ChannelStereo
|
|
24
|
-
*/
|
|
25
|
-
ChannelStereo: {
|
|
26
|
-
'': string;
|
|
27
|
-
/** direct message (1:1) */
|
|
28
|
-
dm: string;
|
|
29
|
-
/** self memo channel */
|
|
30
|
-
self: string;
|
|
31
|
-
/** open channel */
|
|
32
|
-
public: string;
|
|
33
|
-
/** invite-only channel */
|
|
34
|
-
private: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* ChatStereo
|
|
38
|
-
*/
|
|
39
|
-
ChatStereo: {
|
|
40
|
-
text: string;
|
|
41
|
-
join: string;
|
|
42
|
-
leave: string;
|
|
43
|
-
system: string;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* JoinStereo
|
|
47
|
-
*/
|
|
48
|
-
JoinStereo: {
|
|
49
|
-
'': string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* type: `ChannelStereo`
|
|
54
|
-
*/
|
|
55
|
-
export declare type ChannelStereo = keyof typeof $LUT.ChannelStereo;
|
|
56
|
-
/**
|
|
57
|
-
* type: `ChatStereo`
|
|
58
|
-
*/
|
|
59
|
-
export declare type ChatStereo = keyof typeof $LUT.ChatStereo;
|
|
60
|
-
/**
|
|
61
|
-
* type: `JoinStereo`
|
|
62
|
-
*/
|
|
63
|
-
export declare type JoinStereo = keyof typeof $LUT.JoinStereo;
|
|
64
|
-
/** must export $LUT as default */
|
|
65
|
-
export default $LUT;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* `types.ts`
|
|
4
|
-
* - basic types for chat module.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
/**
|
|
8
|
-
* Lookup Table
|
|
9
|
-
*
|
|
10
|
-
* WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
|
|
11
|
-
*/
|
|
12
|
-
const $LUT = {
|
|
13
|
-
/**
|
|
14
|
-
* Possible type of model.
|
|
15
|
-
*/
|
|
16
|
-
ModelType: {
|
|
17
|
-
/** channel model */
|
|
18
|
-
channel: 'channel',
|
|
19
|
-
/** chat model */
|
|
20
|
-
chat: 'chat',
|
|
21
|
-
/** join model */
|
|
22
|
-
join: 'join',
|
|
23
|
-
},
|
|
24
|
-
/**
|
|
25
|
-
* ChannelStereo
|
|
26
|
-
*/
|
|
27
|
-
ChannelStereo: {
|
|
28
|
-
'': '',
|
|
29
|
-
/** direct message (1:1) */
|
|
30
|
-
dm: 'dm',
|
|
31
|
-
/** self memo channel */
|
|
32
|
-
self: 'self',
|
|
33
|
-
/** open channel */
|
|
34
|
-
public: 'public',
|
|
35
|
-
/** invite-only channel */
|
|
36
|
-
private: 'private',
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* ChatStereo
|
|
40
|
-
*/
|
|
41
|
-
ChatStereo: {
|
|
42
|
-
text: 'text',
|
|
43
|
-
join: 'join',
|
|
44
|
-
leave: 'leave',
|
|
45
|
-
system: 'system',
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* JoinStereo
|
|
49
|
-
*/
|
|
50
|
-
JoinStereo: {
|
|
51
|
-
'': '',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
/** must export $LUT as default */
|
|
55
|
-
exports.default = $LUT;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `views.ts`
|
|
3
|
-
* - type of views used in chat module.
|
|
4
|
-
*/
|
|
5
|
-
import { View, Body } from 'lemon-model';
|
|
6
|
-
import { ChannelModel, ChatModel, JoinModel } from './model';
|
|
7
|
-
import $LUT from './types';
|
|
8
|
-
import type { DeviceView } from '../sockets/views';
|
|
9
|
-
export * from './types';
|
|
10
|
-
export default $LUT;
|
|
11
|
-
/**
|
|
12
|
-
* type: `ChannelView`
|
|
13
|
-
*/
|
|
14
|
-
export interface ChannelView extends View, Partial<ChannelModel> {
|
|
15
|
-
/** (linked) owner info */
|
|
16
|
-
readonly owner$?: DeviceView;
|
|
17
|
-
/** (linked) last chat info */
|
|
18
|
-
readonly lastChat$?: ChatView;
|
|
19
|
-
/** (readonly) device's channel connection view */
|
|
20
|
-
readonly $join?: JoinView;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Type `ChannelBody`
|
|
24
|
-
*/
|
|
25
|
-
export interface ChannelBody extends Body, Partial<ChannelView> {
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* type: `ChatView`
|
|
29
|
-
*/
|
|
30
|
-
export interface ChatView extends View, Partial<ChatModel> {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Type `ChatBody`
|
|
34
|
-
*/
|
|
35
|
-
export interface ChatBody extends Body, Partial<ChatView> {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* type: `JoinView`
|
|
39
|
-
*/
|
|
40
|
-
export interface JoinView extends Omit<View, 'joined'>, Omit<Partial<JoinModel>, 'joined'> {
|
|
41
|
-
/**
|
|
42
|
-
* current joined state for API/view consumers.
|
|
43
|
-
*/
|
|
44
|
-
readonly joined?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Type `JoinBody`
|
|
48
|
-
*/
|
|
49
|
-
export interface JoinBody extends Body, Partial<JoinView> {
|
|
50
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const types_1 = __importDefault(require("./types"));
|
|
21
|
-
//! export all internal types
|
|
22
|
-
__exportStar(require("./types"), exports);
|
|
23
|
-
exports.default = types_1.default;
|