@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.
Files changed (39) hide show
  1. package/dist/client-socket-v2/gateways/join-gateway.d.ts +15 -0
  2. package/dist/client-socket-v2/gateways/join-gateway.js +12 -0
  3. package/dist/client-socket-v2/index.d.ts +4 -0
  4. package/dist/client-socket-v2/index.js +3 -0
  5. package/dist/client-socket-v2/plans/channel-sync-plan.d.ts +14 -10
  6. package/dist/client-socket-v2/plans/channel-sync-plan.js +6 -2
  7. package/dist/client-socket-v2/plans/chat-sync-plan.d.ts +63 -0
  8. package/dist/client-socket-v2/plans/chat-sync-plan.js +166 -0
  9. package/dist/client-socket-v2/plans/join-sync-plan.d.ts +37 -0
  10. package/dist/client-socket-v2/plans/join-sync-plan.js +71 -0
  11. package/dist/client-socket-v2/plans/place-sync-plan.d.ts +14 -10
  12. package/dist/client-socket-v2/plans/place-sync-plan.js +5 -2
  13. package/dist/client-socket-v2/plans/profile-sync-plan.d.ts +14 -10
  14. package/dist/client-socket-v2/plans/profile-sync-plan.js +5 -2
  15. package/dist/client-socket-v2/types.d.ts +12 -0
  16. package/dist/lib/channel/types.d.ts +1 -2
  17. package/dist/lib/chat/types.d.ts +6 -1
  18. package/dist/lib/chat/views.d.ts +62 -0
  19. package/dist/lib/chat/views.js +2 -0
  20. package/dist/lib/join/contracts.d.ts +32 -0
  21. package/dist/lib/join/contracts.js +7 -0
  22. package/dist/lib/join/types.d.ts +31 -0
  23. package/dist/lib/join/types.js +2 -0
  24. package/dist/lib/socket-actions.d.ts +19 -1
  25. package/dist/lib/socket-actions.js +13 -0
  26. package/dist/lib/socket-inputs.d.ts +1 -0
  27. package/package.json +1 -1
  28. package/dist/modules/chat/model.d.ts +0 -107
  29. package/dist/modules/chat/model.js +0 -28
  30. package/dist/modules/chat/types.d.ts +0 -65
  31. package/dist/modules/chat/types.js +0 -55
  32. package/dist/modules/chat/views.d.ts +0 -50
  33. package/dist/modules/chat/views.js +0 -23
  34. package/dist/modules/sockets/model.d.ts +0 -206
  35. package/dist/modules/sockets/model.js +0 -28
  36. package/dist/modules/sockets/types.d.ts +0 -100
  37. package/dist/modules/sockets/types.js +0 -86
  38. package/dist/modules/sockets/views.d.ts +0 -67
  39. package/dist/modules/sockets/views.js +0 -23
@@ -1,206 +0,0 @@
1
- /**
2
- * `model.ts`
3
- * - model definitions per account data
4
- *
5
- * @author Steve <steve@lemoncloud.io>
6
- * @date 2022-08-29 initial version.
7
- * @author Aiden <aiden@lemocloud.io>
8
- * @date 2025-07-23 refactored for sockets service
9
- *
10
- * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
11
- */
12
- import { CoreModel } from 'lemon-model';
13
- import $LUT, { DevicePlatform, DeviceStatus, ViewingType } from './types';
14
- import type { ChannelHead } from '../chat/model';
15
- /**
16
- * type: `ModelType`
17
- */
18
- export declare type ModelType = keyof typeof $LUT.ModelType;
19
- /**
20
- * type: `Model`: common model
21
- */
22
- export declare type Model = CoreModel<ModelType>;
23
- /**
24
- * interface: `SocketModel`
25
- */
26
- export interface SocketModel extends Model {
27
- /** id of model */
28
- id?: string;
29
- /** name of model */
30
- name?: string;
31
- }
32
- /**
33
- * interface: `ConnectionModel`
34
- * - a model for each connection to websocket.
35
- * - 웹소켓 연결 정보를 저장하는 모델
36
- */
37
- export interface ConnectionModel extends Model {
38
- /**
39
- * as `conn-id`
40
- */
41
- id?: string;
42
- /**
43
- * stereo type as initial `role`.
44
- */
45
- stereo?: string;
46
- /**
47
- * (required) The deployment stage of the API (e.g., 'dev', 'prod').
48
- */
49
- stage?: string;
50
- /**
51
- * (required) The domain name of the WebSocket API.
52
- */
53
- domain?: string;
54
- /**
55
- * (required) The API Gateway ID for Management API endpoint.
56
- */
57
- apiId?: string;
58
- /**
59
- * (required) The unique identifier for the WebSocket connection.
60
- */
61
- connectionId?: string;
62
- /** (optional) if it has valid session infor. */
63
- hasSession?: number;
64
- /** (internal) Timestamp when the connection was established. */
65
- connectedAt?: number;
66
- /** (internal) Timestamp when the connection was terminated. */
67
- disConnectedAt?: number;
68
- /** (internal) version no */
69
- versionNo?: number;
70
- /** (internal) tracking no */
71
- no?: number;
72
- /**
73
- * (extended) The origin of the request.
74
- */
75
- origin?: string;
76
- /**
77
- * (extended) The remote IP address of the client.
78
- */
79
- remote?: string;
80
- /**
81
- * (extended) The User-Agent string of the client.
82
- */
83
- agent?: string;
84
- /**
85
- * (extended) The reason for disconnection, if applicable.
86
- */
87
- reason?: string;
88
- /**
89
- * (extended) The code of disconnection.
90
- */
91
- disconnectCode?: number;
92
- /**
93
- * (extended) TTL for auto-deletion (ts)
94
- */
95
- ttl?: number;
96
- /**
97
- * (internal) ping-pong count
98
- */
99
- readonly count?: number;
100
- /**
101
- * (linked) 현재 연결이 구독 중인 채널(토픽) ID 목록
102
- *
103
- * @deprecated no more supported (see `chatic-socials-api`)
104
- */
105
- channels?: string[];
106
- /**
107
- * @deprecated no longer in use (Channel management has been delegated to chatic-socials-api)
108
- */
109
- channel$$?: ChannelHead[];
110
- /**
111
- * (linked) device id for state sync
112
- * NOTE it must be 1:1 matching with device.
113
- * - `Device` has the major one connection.
114
- * - `Connection` is belong to single `Device`.
115
- */
116
- deviceId?: string;
117
- /** (internal) identity-id */
118
- identityId?: string;
119
- /** (internal) verified roles */
120
- roles?: string[];
121
- /** (internal) delegator-id — 소셜 로그인 시 게스트유저 uid */
122
- did?: string;
123
- /**
124
- * (internal) connected device-info
125
- */
126
- readonly $device?: DeviceModel;
127
- }
128
- /**
129
- * interface: `DeviceHead`
130
- */
131
- export interface DeviceHead {
132
- /** id of model */
133
- id?: string;
134
- /** name of model */
135
- name?: string;
136
- }
137
- /**
138
- * interface: `DeviceModel` (종단 기기)ㅊ
139
- * - 디바이스 정보 관리 모델
140
- * - 그럼, 여기에서는 ENDPOINT 간의 상태 동기화
141
- *
142
- * ex) 브라우저 창, 네이티브 앱, 노드기반 클라이언트.
143
- */
144
- export interface DeviceModel extends Model, DeviceHead {
145
- /** device-id (클라이언트에서 생성된 UUID) */
146
- id?: string;
147
- /** name of model */
148
- name?: string;
149
- /** device platform */
150
- platform?: DevicePlatform;
151
- /** status of device (for sync) */
152
- status?: DeviceStatus;
153
- /** tick count (for sync) */
154
- tick?: number;
155
- /** x position (for sync) */
156
- posX?: number;
157
- /** y position (for sync) */
158
- posY?: number;
159
- /** 현재 보고 있는 대상 종류 (예: 'channel') */
160
- viewingType?: ViewingType;
161
- /** 현재 보고 있는 대상 id */
162
- viewingId?: string;
163
- /** 현재 대상 진입 시각(ms) */
164
- viewingSince?: number;
165
- /** last activity timestamp */
166
- lastActiveAt?: number;
167
- /** connection start timestamp */
168
- connectedAt?: number;
169
- /** last disconnection timestamp */
170
- disconnectedAt?: number;
171
- /** (internal) connection-id */
172
- connId?: string;
173
- /** joined channel ids */
174
- channelIds?: string[];
175
- /**
176
- * (internal) owner user-id
177
- * - 푸시 전송 시, 타겟 유저 ID 매핑을 위해 이용됨.
178
- * */
179
- readonly userId?: string;
180
- }
181
- /**
182
- * extract field names from models
183
- * - only fields start with lowercase, or all upper.
184
- */
185
- export declare const filterFields: (fields: string[], base?: string[]) => string[];
186
- /** field names from head */
187
- export declare const $HEAD: {
188
- device: string[];
189
- };
190
- export declare const $FIELD: {
191
- socket: string[];
192
- connection: string[];
193
- device: string[];
194
- };
195
- /** must export default as below */
196
- declare const _default: {
197
- $HEAD: {
198
- device: string[];
199
- };
200
- $FIELD: {
201
- socket: string[];
202
- connection: string[];
203
- device: string[];
204
- };
205
- };
206
- 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
- device: (0, exports.filterFields)(field_registry_1.fieldKeys.deviceHead()),
20
- };
21
- // extract field names from models
22
- exports.$FIELD = {
23
- socket: (0, exports.filterFields)(field_registry_1.fieldKeys.socketModel(), ['meta']),
24
- connection: (0, exports.filterFields)(field_registry_1.fieldKeys.connectionModel(), ['meta']),
25
- device: (0, exports.filterFields)(field_registry_1.fieldKeys.deviceModel(), ['meta']),
26
- };
27
- /** must export default as below */
28
- exports.default = { $HEAD: exports.$HEAD, $FIELD: exports.$FIELD };
@@ -1,100 +0,0 @@
1
- /**
2
- * `types.ts`
3
- * - 기본 types used in `backend-proxy`
4
- *
5
- * **[중요! exports 순서]**
6
- * 1. define data type in `types.ts` w/ internal types.
7
- * 2. define Model in `model.ts`
8
- * 3. define View/Body in `view.ts`, and external types.
9
- *
10
- * @author Steve <steve@lemoncloud.io>
11
- * @date 2022-08-29 initial version.
12
- * @author Aiden <aiden@lemocloud.io>
13
- * @date 2025-07-23 refactored for sockets service
14
- *
15
- * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
16
- */
17
- /**
18
- * Lookup Table
19
- *
20
- * WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
21
- */
22
- declare const $LUT: {
23
- /**
24
- * Possible type of model.
25
- */
26
- ModelType: {
27
- /** socket model */
28
- socket: string;
29
- /** connection model */
30
- connection: string;
31
- /** device model */
32
- device: string;
33
- };
34
- /**
35
- * DeviceStatus
36
- */
37
- DeviceStatus: {
38
- '': string;
39
- /** green - online */
40
- green: string;
41
- /** red - offline */
42
- red: string;
43
- /** yellow - away/idle */
44
- yellow: string;
45
- };
46
- /**
47
- * DeviceEventType
48
- */
49
- DeviceEventType: {
50
- '': string;
51
- /** ping - heartbeat */
52
- ping: string;
53
- /** status - status change */
54
- status: string;
55
- };
56
- /**
57
- * ViewingType — 현재 보고 있는 대상 종류
58
- */
59
- ViewingType: {
60
- '': string;
61
- /** channel */
62
- channel: string;
63
- };
64
- /**
65
- * DevicePlatform
66
- */
67
- DevicePlatform: {
68
- '': string;
69
- /** iOS */
70
- ios: string;
71
- /** Android */
72
- android: string;
73
- /** Web browser */
74
- web: string;
75
- /** macOS */
76
- macos: string;
77
- /** Windows */
78
- windows: string;
79
- /** Linux */
80
- linux: string;
81
- };
82
- };
83
- /**
84
- * type: `DeviceStatus`
85
- */
86
- export declare type DeviceStatus = keyof typeof $LUT.DeviceStatus;
87
- /**
88
- * type: `DeviceEventType`
89
- */
90
- export declare type DeviceEventType = keyof typeof $LUT.DeviceEventType;
91
- /**
92
- * type: `ViewingType`
93
- */
94
- export declare type ViewingType = keyof typeof $LUT.ViewingType;
95
- /**
96
- * type: `DevicePlatform`
97
- */
98
- export declare type DevicePlatform = keyof typeof $LUT.DevicePlatform;
99
- /** must export $LUT as default */
100
- export default $LUT;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- /**
3
- * `types.ts`
4
- * - 기본 types used in `backend-proxy`
5
- *
6
- * **[중요! exports 순서]**
7
- * 1. define data type in `types.ts` w/ internal types.
8
- * 2. define Model in `model.ts`
9
- * 3. define View/Body in `view.ts`, and external types.
10
- *
11
- * @author Steve <steve@lemoncloud.io>
12
- * @date 2022-08-29 initial version.
13
- * @author Aiden <aiden@lemocloud.io>
14
- * @date 2025-07-23 refactored for sockets service
15
- *
16
- * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- /**
20
- * Lookup Table
21
- *
22
- * WARN! DO NOT EXPORT AS `$LUT`. use default export instead.
23
- */
24
- const $LUT = {
25
- /**
26
- * Possible type of model.
27
- */
28
- ModelType: {
29
- /** socket model */
30
- socket: 'socket',
31
- /** connection model */
32
- connection: 'connection',
33
- /** device model */
34
- device: 'device',
35
- },
36
- /**
37
- * DeviceStatus
38
- */
39
- DeviceStatus: {
40
- '': '',
41
- /** green - online */
42
- green: 'green',
43
- /** red - offline */
44
- red: 'red',
45
- /** yellow - away/idle */
46
- yellow: 'yellow',
47
- },
48
- /**
49
- * DeviceEventType
50
- */
51
- DeviceEventType: {
52
- '': '',
53
- /** ping - heartbeat */
54
- ping: 'ping',
55
- /** status - status change */
56
- status: 'status',
57
- },
58
- /**
59
- * ViewingType — 현재 보고 있는 대상 종류
60
- */
61
- ViewingType: {
62
- '': '',
63
- /** channel */
64
- channel: 'channel',
65
- },
66
- /**
67
- * DevicePlatform
68
- */
69
- DevicePlatform: {
70
- '': '',
71
- /** iOS */
72
- ios: 'ios',
73
- /** Android */
74
- android: 'android',
75
- /** Web browser */
76
- web: 'web',
77
- /** macOS */
78
- macos: 'macos',
79
- /** Windows */
80
- windows: 'windows',
81
- /** Linux */
82
- linux: 'linux',
83
- },
84
- };
85
- /** must export $LUT as default */
86
- exports.default = $LUT;
@@ -1,67 +0,0 @@
1
- /**
2
- * `views.ts`
3
- * - type of views used in `backend-proxy`
4
- *
5
- * @author Steve <steve@lemoncloud.io>
6
- * @date 2022-08-29 initial version.
7
- * @author Aiden <aiden@lemoncloud.io>
8
- * @date 2024-07-23 refactored for sockets service
9
- *
10
- * Copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
11
- */
12
- import { View, Body } from 'lemon-model';
13
- import { ConnectionModel, DeviceModel, SocketModel } from './model';
14
- import $LUT from './types';
15
- export * from './types';
16
- export default $LUT;
17
- /**!SECTION */
18
- /**
19
- * type: `SocketView`
20
- * - usually same as post's body.
21
- */
22
- export interface SocketView extends View, Partial<SocketModel> {
23
- }
24
- /**
25
- * Type `SocketBody`
26
- */
27
- export interface SocketBody extends Body, Partial<SocketView> {
28
- }
29
- /**
30
- * type: `ConnectionView`
31
- * - usually same as post's body.
32
- */
33
- export interface ConnectionView extends View, Omit<Partial<ConnectionModel>, '$device'> {
34
- /** (internal) connected device info */
35
- readonly $device?: DeviceView;
36
- }
37
- /**
38
- * Type `ConnectionBody`
39
- */
40
- export interface ConnectionBody extends Body, Partial<ConnectionView> {
41
- }
42
- /**
43
- * type: `DeviceView`
44
- */
45
- export interface DeviceView extends View, Partial<DeviceModel> {
46
- }
47
- /**
48
- * Type `DeviceBody`
49
- */
50
- export interface DeviceBody extends Body, Partial<DeviceView> {
51
- }
52
- /**
53
- * type: `ServerPingResultView`
54
- * - 서버에서 커넥션 ping 테스트 결과
55
- */
56
- export interface ServerPingResultView {
57
- /** 대상 connectionId */
58
- connId: string;
59
- /** ping 시도 시간 (timestamp) */
60
- pingedAt: number;
61
- /** 최종 활성 상태 */
62
- isActive: boolean;
63
- /** cleanup 수행 여부 */
64
- isCleaned?: boolean;
65
- /** 현재 connection 상태 */
66
- $conn?: ConnectionView;
67
- }
@@ -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;