@simplysm/service-common 13.0.12 → 13.0.14

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
@@ -1,6 +1,6 @@
1
1
  # @simplysm/service-common
2
2
 
3
- A package that provides shared communication protocols, message types, and service interface definitions between the service client (`service-client`) and server (`service-server`). It includes binary protocol-based message encoding/decoding, automatic message chunking for large payloads, event system types, and service interfaces for ORM/encryption/SMTP/auto-update.
3
+ A package that provides shared communication protocols, message types, and service interface definitions between the service client (`service-client`) and server (`service-server`). It includes binary protocol-based message encoding/decoding, automatic message chunking for large payloads, event system types, and service interfaces for ORM/encryption/auto-update.
4
4
 
5
5
  ## Installation
6
6
 
@@ -27,7 +27,6 @@ pnpm add @simplysm/service-common
27
27
  | `protocol/service-protocol` | Message encoding/decoding class |
28
28
  | `service-types/orm-service.types` | ORM service interface and DB connection options |
29
29
  | `service-types/crypto-service.types` | Crypto service interface and config |
30
- | `service-types/smtp-service.types` | SMTP service interface and email options |
31
30
  | `service-types/auto-update-service.types` | Auto-update service interface |
32
31
  | `types` | `ServiceUploadResult` |
33
32
  | `define-event` | `defineEvent`, `ServiceEventDef` |
@@ -36,7 +35,7 @@ pnpm add @simplysm/service-common
36
35
 
37
36
  ## ServiceProtocol
38
37
 
39
- The core class for encoding/decoding messages into binary format. Messages exceeding 3MB are automatically split into 300KB chunks, and the receiving side automatically assembles the chunks to restore the original message.
38
+ 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.
40
39
 
41
40
  ### Binary Header Structure
42
41
 
@@ -68,10 +67,10 @@ Each chunk consists of a 28-byte header and body (Big Endian).
68
67
  ### Usage Example
69
68
 
70
69
  ```typescript
71
- import { ServiceProtocol } from "@simplysm/service-common";
70
+ import { createServiceProtocol } from "@simplysm/service-common";
72
71
  import { Uuid } from "@simplysm/core-common";
73
72
 
74
- const protocol = new ServiceProtocol();
73
+ const protocol = createServiceProtocol();
75
74
 
76
75
  // Encoding: Convert message to binary chunks
77
76
  const uuid = Uuid.new().toString();
@@ -265,61 +264,6 @@ Defines SHA256 hash generation and AES symmetric key encryption/decryption capab
265
264
  |------|------|------|
266
265
  | `key` | `string` | AES encryption key |
267
266
 
268
- ### SmtpService
269
-
270
- Defines email sending capabilities. Can send by directly passing SMTP settings or by referencing server config.
271
-
272
- | Method | Parameters | Return Type | Description |
273
- |--------|---------|-----------|------|
274
- | `send` | `options: SmtpSendOption` | `Promise<string>` | Send email with direct SMTP settings |
275
- | `sendByConfig` | `configName, options: SmtpSendByConfigOption` | `Promise<string>` | Send email by referencing server config |
276
-
277
- #### SmtpSendOption
278
-
279
- A type combining `SmtpConnectionOptions` and `SmtpEmailContentOptions`, with an additional `from` field.
280
-
281
- | Field | Type | Required | Description |
282
- |------|------|------|------|
283
- | `host` | `string` | Y | SMTP host |
284
- | `port` | `number` | N | SMTP port |
285
- | `secure` | `boolean` | N | TLS usage |
286
- | `user` | `string` | N | SMTP auth user |
287
- | `pass` | `string` | N | SMTP auth password |
288
- | `from` | `string` | Y | Sender address |
289
- | `to` | `string` | Y | Recipient address |
290
- | `cc` | `string` | N | CC |
291
- | `bcc` | `string` | N | BCC |
292
- | `subject` | `string` | Y | Subject |
293
- | `html` | `string` | Y | Body (HTML) |
294
- | `attachments` | `SmtpSendAttachment[]` | N | Attachment list |
295
-
296
- #### SmtpSendByConfigOption
297
-
298
- Same as `SmtpEmailContentOptions`. SMTP connection info is referenced from server config (`configName`).
299
-
300
- #### SmtpSendAttachment
301
-
302
- | Field | Type | Required | Description |
303
- |------|------|------|------|
304
- | `filename` | `string` | Y | Attachment filename |
305
- | `content` | `Bytes` | N | File content (binary). Specify one of `path` or `content` |
306
- | `path` | `string` | N | File path on server. Specify one of `path` or `content` |
307
- | `contentType` | `string` | N | MIME type (e.g., `"application/pdf"`) |
308
-
309
- #### SmtpConfig
310
-
311
- Server-side SMTP configuration type.
312
-
313
- | Field | Type | Required | Description |
314
- |------|------|------|------|
315
- | `host` | `string` | Y | SMTP host |
316
- | `port` | `number` | N | SMTP port |
317
- | `secure` | `boolean` | N | TLS usage |
318
- | `user` | `string` | N | SMTP auth user |
319
- | `pass` | `string` | N | SMTP auth password |
320
- | `senderName` | `string` | Y | Sender display name |
321
- | `senderEmail` | `string` | N | Sender email address |
322
-
323
267
  ### AutoUpdateService
324
268
 
325
269
  Defines a service for querying the latest version information of a client application.
@@ -334,7 +278,7 @@ Pass values like `"win32"`, `"darwin"`, `"linux"` to `platform`.
334
278
 
335
279
  ## Caveats
336
280
 
337
- - `ServiceProtocol` instances internally use `LazyGcMap` to manage incomplete split messages. After use, you must call `dispose()` to release the GC timer.
281
+ - `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.
338
282
  - Encoding or decoding messages exceeding `PROTOCOL_CONFIG.MAX_TOTAL_SIZE` (100MB) will throw an `ArgumentError`.
339
283
  - Passing binary data less than 28 bytes during decoding will throw an `ArgumentError`.
340
284
  - Service interfaces (`OrmService`, `CryptoService`, etc.) only provide type definitions. Actual implementations are handled by the `@simplysm/service-server` package.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  export * from "./protocol/protocol.types";
2
2
  export * from "./protocol/service-protocol";
3
3
  export * from "./service-types/orm-service.types";
4
- export * from "./service-types/crypto-service.types";
5
4
  export * from "./service-types/auto-update-service.types";
6
- export * from "./service-types/smtp-service.types";
7
5
  export * from "./types";
8
6
  export * from "./define-event";
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AAGnD,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAG1D,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  export * from "./protocol/protocol.types.js";
2
2
  export * from "./protocol/service-protocol.js";
3
3
  export * from "./service-types/orm-service.types.js";
4
- export * from "./service-types/crypto-service.types.js";
5
4
  export * from "./service-types/auto-update-service.types.js";
6
- export * from "./service-types/smtp-service.types.js";
7
5
  export * from "./types.js";
8
6
  export * from "./define-event.js";
9
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "mappings": "AACA,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;",
4
+ "mappings": "AACA,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysm/service-common",
3
3
  "sideEffects": false,
4
- "version": "13.0.12",
4
+ "version": "13.0.14",
5
5
  "description": "심플리즘 패키지 - 서비스 모듈 (common)",
6
6
  "author": "김석래",
7
7
  "repository": {
@@ -18,7 +18,7 @@
18
18
  "src"
19
19
  ],
20
20
  "dependencies": {
21
- "@simplysm/core-common": "13.0.12",
22
- "@simplysm/orm-common": "13.0.12"
21
+ "@simplysm/core-common": "13.0.14",
22
+ "@simplysm/orm-common": "13.0.14"
23
23
  }
24
24
  }
package/src/index.ts CHANGED
@@ -4,9 +4,7 @@ export * from "./protocol/service-protocol";
4
4
 
5
5
  // Service Types
6
6
  export * from "./service-types/orm-service.types";
7
- export * from "./service-types/crypto-service.types";
8
7
  export * from "./service-types/auto-update-service.types";
9
- export * from "./service-types/smtp-service.types";
10
8
 
11
9
  // Types
12
10
  export * from "./types";
@@ -1,22 +0,0 @@
1
- import type { Bytes } from "@simplysm/core-common";
2
- /**
3
- * 암호화 서비스 인터페이스
4
- *
5
- * SHA256 해시 및 AES 대칭키 암호화/복호화 기능을 제공한다.
6
- */
7
- export interface CryptoService {
8
- /** SHA256 해시 생성 */
9
- encrypt(data: string | Bytes): Promise<string>;
10
- /** AES 암호화 */
11
- encryptAes(data: Bytes): Promise<string>;
12
- /** AES 복호화 */
13
- decryptAes(encText: string): Promise<Bytes>;
14
- }
15
- /**
16
- * 암호화 서비스 설정
17
- */
18
- export interface CryptoConfig {
19
- /** AES 암호화 키 */
20
- key: string;
21
- }
22
- //# sourceMappingURL=crypto-service.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto-service.types.d.ts","sourceRoot":"","sources":["../../src/service-types/crypto-service.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,cAAc;IACd,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,cAAc;IACd,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=crypto-service.types.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "mappings": "",
5
- "names": []
6
- }
@@ -1,55 +0,0 @@
1
- import type { Bytes } from "@simplysm/core-common";
2
- /**
3
- * SMTP 서비스 인터페이스
4
- *
5
- * 이메일 전송 기능을 제공한다.
6
- * 직접 SMTP 설정을 전달하거나 서버 설정을 참조하여 전송할 수 있다.
7
- */
8
- export interface SmtpService {
9
- /** 직접 SMTP 설정으로 이메일 전송 */
10
- send(options: SmtpSendOption): Promise<string>;
11
- /** 서버 설정 참조로 이메일 전송 */
12
- sendByConfig(configName: string, options: SmtpSendByConfigOption): Promise<string>;
13
- }
14
- /**
15
- * 이메일 첨부 파일 정보
16
- *
17
- * content 또는 path 중 하나를 지정해야 한다.
18
- */
19
- export interface SmtpSendAttachment {
20
- /** 첨부 파일명 */
21
- filename: string;
22
- /** 파일 내용 (바이너리) */
23
- content?: Bytes;
24
- /** 서버 내 파일 경로 */
25
- path?: string;
26
- /** MIME 타입 (예: "application/pdf") */
27
- contentType?: string;
28
- }
29
- /** SMTP 연결 옵션 (공통) */
30
- export interface SmtpConnectionOptions {
31
- host: string;
32
- port?: number;
33
- secure?: boolean;
34
- user?: string;
35
- pass?: string;
36
- }
37
- /** 이메일 내용 옵션 (공통) */
38
- export interface SmtpEmailContentOptions {
39
- to: string;
40
- cc?: string;
41
- bcc?: string;
42
- subject: string;
43
- html: string;
44
- attachments?: SmtpSendAttachment[];
45
- }
46
- export interface SmtpSendByConfigOption extends SmtpEmailContentOptions {
47
- }
48
- export interface SmtpSendOption extends SmtpConnectionOptions, SmtpEmailContentOptions {
49
- from: string;
50
- }
51
- export interface SmtpConfig extends SmtpConnectionOptions {
52
- senderName: string;
53
- senderEmail?: string;
54
- }
55
- //# sourceMappingURL=smtp-service.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smtp-service.types.d.ts","sourceRoot":"","sources":["../../src/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AE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=smtp-service.types.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "mappings": "",
5
- "names": []
6
- }
@@ -1,23 +0,0 @@
1
- import type { Bytes } from "@simplysm/core-common";
2
-
3
- /**
4
- * 암호화 서비스 인터페이스
5
- *
6
- * SHA256 해시 및 AES 대칭키 암호화/복호화 기능을 제공한다.
7
- */
8
- export interface CryptoService {
9
- /** SHA256 해시 생성 */
10
- encrypt(data: string | Bytes): Promise<string>;
11
- /** AES 암호화 */
12
- encryptAes(data: Bytes): Promise<string>;
13
- /** AES 복호화 */
14
- decryptAes(encText: string): Promise<Bytes>;
15
- }
16
-
17
- /**
18
- * 암호화 서비스 설정
19
- */
20
- export interface CryptoConfig {
21
- /** AES 암호화 키 */
22
- key: string;
23
- }
@@ -1,60 +0,0 @@
1
- import type { Bytes } from "@simplysm/core-common";
2
-
3
- /**
4
- * SMTP 서비스 인터페이스
5
- *
6
- * 이메일 전송 기능을 제공한다.
7
- * 직접 SMTP 설정을 전달하거나 서버 설정을 참조하여 전송할 수 있다.
8
- */
9
- export interface SmtpService {
10
- /** 직접 SMTP 설정으로 이메일 전송 */
11
- send(options: SmtpSendOption): Promise<string>;
12
- /** 서버 설정 참조로 이메일 전송 */
13
- sendByConfig(configName: string, options: SmtpSendByConfigOption): Promise<string>;
14
- }
15
-
16
- /**
17
- * 이메일 첨부 파일 정보
18
- *
19
- * content 또는 path 중 하나를 지정해야 한다.
20
- */
21
- export interface SmtpSendAttachment {
22
- /** 첨부 파일명 */
23
- filename: string;
24
- /** 파일 내용 (바이너리) */
25
- content?: Bytes;
26
- /** 서버 내 파일 경로 */
27
- path?: string;
28
- /** MIME 타입 (예: "application/pdf") */
29
- contentType?: string;
30
- }
31
-
32
- /** SMTP 연결 옵션 (공통) */
33
- export interface SmtpConnectionOptions {
34
- host: string;
35
- port?: number;
36
- secure?: boolean;
37
- user?: string;
38
- pass?: string;
39
- }
40
-
41
- /** 이메일 내용 옵션 (공통) */
42
- export interface SmtpEmailContentOptions {
43
- to: string;
44
- cc?: string;
45
- bcc?: string;
46
- subject: string;
47
- html: string;
48
- attachments?: SmtpSendAttachment[];
49
- }
50
-
51
- export interface SmtpSendByConfigOption extends SmtpEmailContentOptions {}
52
-
53
- export interface SmtpSendOption extends SmtpConnectionOptions, SmtpEmailContentOptions {
54
- from: string;
55
- }
56
-
57
- export interface SmtpConfig extends SmtpConnectionOptions {
58
- senderName: string;
59
- senderEmail?: string;
60
- }