@simplysm/service-common 13.0.16 → 13.0.23
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
CHANGED
|
@@ -10,13 +10,6 @@ npm install @simplysm/service-common
|
|
|
10
10
|
pnpm add @simplysm/service-common
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
### Dependencies
|
|
14
|
-
|
|
15
|
-
| Package | Description |
|
|
16
|
-
|--------|------|
|
|
17
|
-
| `@simplysm/core-common` | Common utilities (`Uuid`, `LazyGcMap`, `jsonStringify`, `jsonParse`, etc.) |
|
|
18
|
-
| `@simplysm/orm-common` | ORM types (`Dialect`, `IsolationLevel`, `QueryDef`, `ColumnMeta`, `ResultMeta`, etc.) |
|
|
19
|
-
|
|
20
13
|
## Main Modules
|
|
21
14
|
|
|
22
15
|
### Module Structure
|
|
@@ -26,13 +19,10 @@ pnpm add @simplysm/service-common
|
|
|
26
19
|
| `protocol/protocol.types` | Protocol constants, message type definitions |
|
|
27
20
|
| `protocol/service-protocol` | Message encoding/decoding class |
|
|
28
21
|
| `service-types/orm-service.types` | ORM service interface and DB connection options |
|
|
29
|
-
| `service-types/crypto-service.types` | Crypto service interface and config |
|
|
30
22
|
| `service-types/auto-update-service.types` | Auto-update service interface |
|
|
31
23
|
| `types` | `ServiceUploadResult` |
|
|
32
24
|
| `define-event` | `defineEvent`, `ServiceEventDef` |
|
|
33
25
|
|
|
34
|
-
---
|
|
35
|
-
|
|
36
26
|
## ServiceProtocol
|
|
37
27
|
|
|
38
28
|
The core interface for encoding/decoding messages into binary format. Created via the `createServiceProtocol()` factory function. Messages exceeding 3MB are automatically split into 300KB chunks, and the receiving side automatically assembles the chunks to restore the original message.
|
|
@@ -96,8 +86,6 @@ for (const chunk of chunks) {
|
|
|
96
86
|
protocol.dispose();
|
|
97
87
|
```
|
|
98
88
|
|
|
99
|
-
---
|
|
100
|
-
|
|
101
89
|
## Protocol Constants (PROTOCOL_CONFIG)
|
|
102
90
|
|
|
103
91
|
A constant object that controls protocol behavior.
|
|
@@ -114,8 +102,6 @@ import { PROTOCOL_CONFIG } from "@simplysm/service-common";
|
|
|
114
102
|
| `GC_INTERVAL` | 10s (10,000ms) | Garbage collection cycle for incomplete messages |
|
|
115
103
|
| `EXPIRE_TIME` | 60s (60,000ms) | Expiration time for incomplete messages. Removed from memory if exceeded |
|
|
116
104
|
|
|
117
|
-
---
|
|
118
|
-
|
|
119
105
|
## Message Types
|
|
120
106
|
|
|
121
107
|
Type definitions for messages exchanged between client and server. `ServiceMessage` is a union of all message types.
|
|
@@ -157,8 +143,6 @@ Type definitions for messages exchanged between client and server. `ServiceMessa
|
|
|
157
143
|
| `ServiceEmitEventMessage` | `"evt:emit"` | Client -> Server | `{ keys, data }` | Event emission |
|
|
158
144
|
| `ServiceEventMessage` | `"evt:on"` | Server -> Client | `{ keys, data }` | Event notification |
|
|
159
145
|
|
|
160
|
-
---
|
|
161
|
-
|
|
162
146
|
## defineEvent / ServiceEventDef
|
|
163
147
|
|
|
164
148
|
A function for defining event types. Events are used to publish real-time notifications from server to client.
|
|
@@ -207,8 +191,6 @@ await client.addEventListener(
|
|
|
207
191
|
);
|
|
208
192
|
```
|
|
209
193
|
|
|
210
|
-
---
|
|
211
|
-
|
|
212
194
|
## ServiceUploadResult
|
|
213
195
|
|
|
214
196
|
An interface representing file upload results.
|
|
@@ -219,8 +201,6 @@ An interface representing file upload results.
|
|
|
219
201
|
| `filename` | `string` | Original filename |
|
|
220
202
|
| `size` | `number` | File size (bytes) |
|
|
221
203
|
|
|
222
|
-
---
|
|
223
|
-
|
|
224
204
|
## Service Interfaces
|
|
225
205
|
|
|
226
206
|
Service interface definitions that are implemented on the server side and called by the client via RPC.
|
|
@@ -248,22 +228,6 @@ Defines database connection, transaction management, and query execution capabil
|
|
|
248
228
|
| `configName?` | `string` | Config name to reference in server settings |
|
|
249
229
|
| `config?` | `Record<string, unknown>` | Directly passed connection config |
|
|
250
230
|
|
|
251
|
-
### CryptoService
|
|
252
|
-
|
|
253
|
-
Defines SHA256 hash generation and AES symmetric key encryption/decryption capabilities.
|
|
254
|
-
|
|
255
|
-
| Method | Parameters | Return Type | Description |
|
|
256
|
-
|--------|---------|-----------|------|
|
|
257
|
-
| `encrypt` | `data: string \| Bytes` | `Promise<string>` | Generate SHA256 hash |
|
|
258
|
-
| `encryptAes` | `data: Bytes` | `Promise<string>` | AES encryption |
|
|
259
|
-
| `decryptAes` | `encText: string` | `Promise<Bytes>` | AES decryption |
|
|
260
|
-
|
|
261
|
-
#### CryptoConfig
|
|
262
|
-
|
|
263
|
-
| Field | Type | Description |
|
|
264
|
-
|------|------|------|
|
|
265
|
-
| `key` | `string` | AES encryption key |
|
|
266
|
-
|
|
267
231
|
### AutoUpdateService
|
|
268
232
|
|
|
269
233
|
Defines a service for querying the latest version information of a client application.
|
|
@@ -274,14 +238,12 @@ Defines a service for querying the latest version information of a client applic
|
|
|
274
238
|
|
|
275
239
|
Pass values like `"win32"`, `"darwin"`, `"linux"` to `platform`.
|
|
276
240
|
|
|
277
|
-
---
|
|
278
|
-
|
|
279
241
|
## Caveats
|
|
280
242
|
|
|
281
243
|
- `ServiceProtocol` instances are created via `createServiceProtocol()` factory function and internally use `LazyGcMap` to manage incomplete split messages. After use, you must call `dispose()` to release the GC timer.
|
|
282
244
|
- Encoding or decoding messages exceeding `PROTOCOL_CONFIG.MAX_TOTAL_SIZE` (100MB) will throw an `ArgumentError`.
|
|
283
245
|
- Passing binary data less than 28 bytes during decoding will throw an `ArgumentError`.
|
|
284
|
-
- Service interfaces (`OrmService`, `
|
|
246
|
+
- Service interfaces (`OrmService`, `AutoUpdateService`, etc.) only provide type definitions. Actual implementations are handled by the `@simplysm/service-server` package.
|
|
285
247
|
- The `$info` and `$data` properties of `ServiceEventDef` are declared with `declare` and do not exist at runtime; they are only used for TypeScript type extraction.
|
|
286
248
|
|
|
287
249
|
## License
|
|
@@ -36,10 +36,10 @@ export interface ServiceProtocol {
|
|
|
36
36
|
* - `type: "complete"`: 모든 청크가 수신되어 메시지 조립이 완료됨
|
|
37
37
|
* - `type: "progress"`: 분할 메시지 수신 중 (일부 청크만 도착)
|
|
38
38
|
*/
|
|
39
|
-
export type ServiceMessageDecodeResult<
|
|
39
|
+
export type ServiceMessageDecodeResult<TMessage extends ServiceMessage> = {
|
|
40
40
|
type: "complete";
|
|
41
41
|
uuid: string;
|
|
42
|
-
message:
|
|
42
|
+
message: TMessage;
|
|
43
43
|
} | {
|
|
44
44
|
type: "progress";
|
|
45
45
|
uuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-service-protocol.d.ts","sourceRoot":"","sources":["../../src/protocol/create-service-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtF;;OAEG;IACH,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAE9E;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,CAAC,
|
|
1
|
+
{"version":3,"file":"create-service-protocol.d.ts","sourceRoot":"","sources":["../../src/protocol/create-service-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtF;;OAEG;IACH,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAE9E;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,CAAC,QAAQ,SAAS,cAAc,IAClE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAyKvD"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/service-common",
|
|
3
|
-
"
|
|
4
|
-
"version": "13.0.16",
|
|
3
|
+
"version": "13.0.23",
|
|
5
4
|
"description": "심플리즘 패키지 - 서비스 모듈 (common)",
|
|
6
5
|
"author": "김석래",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/kslhunter/simplysm.git",
|
|
10
10
|
"directory": "packages/service-common"
|
|
11
11
|
},
|
|
12
|
-
"license": "Apache-2.0",
|
|
13
12
|
"type": "module",
|
|
14
13
|
"main": "./dist/index.js",
|
|
15
14
|
"types": "./dist/index.d.ts",
|
|
@@ -17,8 +16,9 @@
|
|
|
17
16
|
"dist",
|
|
18
17
|
"src"
|
|
19
18
|
],
|
|
19
|
+
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@simplysm/core-common": "13.0.
|
|
22
|
-
"@simplysm/orm-common": "13.0.
|
|
21
|
+
"@simplysm/core-common": "13.0.23",
|
|
22
|
+
"@simplysm/orm-common": "13.0.23"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -38,8 +38,8 @@ export interface ServiceProtocol {
|
|
|
38
38
|
* - `type: "complete"`: 모든 청크가 수신되어 메시지 조립이 완료됨
|
|
39
39
|
* - `type: "progress"`: 분할 메시지 수신 중 (일부 청크만 도착)
|
|
40
40
|
*/
|
|
41
|
-
export type ServiceMessageDecodeResult<
|
|
42
|
-
| { type: "complete"; uuid: string; message:
|
|
41
|
+
export type ServiceMessageDecodeResult<TMessage extends ServiceMessage> =
|
|
42
|
+
| { type: "complete"; uuid: string; message: TMessage }
|
|
43
43
|
| { type: "progress"; uuid: string; totalSize: number; completedSize: number };
|
|
44
44
|
|
|
45
45
|
/**
|