@simplysm/service-common 13.0.100 → 14.0.1

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 (46) hide show
  1. package/dist/define-event.d.ts +7 -7
  2. package/dist/define-event.d.ts.map +1 -1
  3. package/dist/define-event.js +21 -10
  4. package/dist/define-event.js.map +1 -6
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -2
  8. package/dist/index.js.map +1 -6
  9. package/dist/protocol/create-service-protocol.d.ts +20 -20
  10. package/dist/protocol/create-service-protocol.d.ts.map +1 -1
  11. package/dist/protocol/create-service-protocol.js +149 -112
  12. package/dist/protocol/create-service-protocol.js.map +1 -6
  13. package/dist/protocol/protocol.types.d.ts +17 -17
  14. package/dist/protocol/protocol.types.d.ts.map +1 -1
  15. package/dist/protocol/protocol.types.js +16 -15
  16. package/dist/protocol/protocol.types.js.map +1 -6
  17. package/dist/service-types/auto-update-service.types.d.ts +5 -5
  18. package/dist/service-types/auto-update-service.types.js +2 -1
  19. package/dist/service-types/auto-update-service.types.js.map +1 -6
  20. package/dist/service-types/orm-service.types.d.ts +7 -5
  21. package/dist/service-types/orm-service.types.d.ts.map +1 -1
  22. package/dist/service-types/orm-service.types.js +2 -1
  23. package/dist/service-types/orm-service.types.js.map +1 -6
  24. package/dist/types.d.ts +5 -5
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/types.js +2 -1
  27. package/dist/types.js.map +1 -6
  28. package/package.json +6 -8
  29. package/src/define-event.ts +7 -7
  30. package/src/index.ts +4 -6
  31. package/src/protocol/create-service-protocol.ts +45 -38
  32. package/src/protocol/protocol.types.ts +39 -39
  33. package/src/service-types/auto-update-service.types.ts +5 -5
  34. package/src/service-types/orm-service.types.ts +5 -5
  35. package/src/types.ts +5 -5
  36. package/README.md +0 -111
  37. package/dist/service-types/smtp-client-service.types.d.ts +0 -38
  38. package/dist/service-types/smtp-client-service.types.d.ts.map +0 -1
  39. package/dist/service-types/smtp-client-service.types.js +0 -1
  40. package/dist/service-types/smtp-client-service.types.js.map +0 -6
  41. package/docs/events.md +0 -51
  42. package/docs/protocol.md +0 -252
  43. package/docs/service-types.md +0 -162
  44. package/src/service-types/smtp-client-service.types.ts +0 -41
  45. package/tests/define-event.spec.ts +0 -11
  46. package/tests/protocol/service-protocol.spec.ts +0 -251
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Auto-update service interface
2
+ * 자동 업데이트 서비스 인터페이스
3
3
  *
4
- * Retrieves the latest version info for client applications.
4
+ * 클라이언트 애플리케이션의 최신 버전 정보를 조회한다.
5
5
  */
6
6
  export interface AutoUpdateService {
7
7
  /**
8
- * Retrieve the latest version info for the specified platform.
9
- * @param platform Target platform (e.g., "win32", "darwin", "linux")
10
- * @returns Latest version info, or undefined if no version exists
8
+ * 지정된 플랫폼의 최신 버전 정보를 조회한다.
9
+ * @param platform 대상 플랫폼 (예: "win32", "darwin", "linux")
10
+ * @returns 최신 버전 정보, 버전이 없으면 undefined
11
11
  */
12
12
  getLastVersion(platform: string): Promise<
13
13
  | {
@@ -7,10 +7,10 @@ import type {
7
7
  } from "@simplysm/orm-common";
8
8
 
9
9
  /**
10
- * ORM service interface
10
+ * ORM 서비스 인터페이스
11
11
  *
12
- * Provides database connection, transaction management, and query execution.
13
- * Supports MySQL, MSSQL, and PostgreSQL.
12
+ * 데이터베이스 연결, 트랜잭션 관리, 쿼리 실행을 제공한다.
13
+ * MySQL, MSSQL, PostgreSQL을 지원한다.
14
14
  */
15
15
  export interface OrmService {
16
16
  getInfo(opt: DbConnOptions & { configName: string }): Promise<{
@@ -19,7 +19,7 @@ export interface OrmService {
19
19
  schema?: string;
20
20
  }>;
21
21
 
22
- connect(opt: Record<string, unknown>): Promise<number>;
22
+ connect(opt: DbConnOptions & { configName: string }): Promise<number>;
23
23
 
24
24
  close(connId: number): Promise<void>;
25
25
 
@@ -45,5 +45,5 @@ export interface OrmService {
45
45
  ): Promise<void>;
46
46
  }
47
47
 
48
- /** Database connection options */
48
+ /** 데이터베이스 연결 옵션 */
49
49
  export type DbConnOptions = { configName?: string; config?: Record<string, unknown> };
package/src/types.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * File upload result
2
+ * 파일 업로드 결과
3
3
  *
4
- * Contains information about a file uploaded to the server.
4
+ * 서버에 업로드된 파일의 정보를 포함한다.
5
5
  */
6
6
  export interface ServiceUploadResult {
7
- /** Storage path on the server */
7
+ /** 서버 저장 경로 */
8
8
  path: string;
9
- /** Original filename */
9
+ /** 원본 파일명 */
10
10
  filename: string;
11
- /** File size (bytes) */
11
+ /** 파일 크기 (바이트) */
12
12
  size: number;
13
13
  }
package/README.md DELETED
@@ -1,111 +0,0 @@
1
- # @simplysm/service-common
2
-
3
- Simplysm package - Service module (common)
4
-
5
- Shared protocol and types used by both `@simplysm/service-client` and `@simplysm/service-server`. Provides binary message encoding/decoding, service interface definitions, and event type system.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install @simplysm/service-common
11
- ```
12
-
13
- ## API Overview
14
-
15
- ### Protocol
16
- | API | Type | Description |
17
- |-----|------|-------------|
18
- | `PROTOCOL_CONFIG` | const | Protocol configuration constants (sizes, timeouts) |
19
- | `ServiceProtocol` | interface | Binary protocol encoder/decoder interface |
20
- | `createServiceProtocol` | function | Create a protocol instance |
21
- | `ServiceMessageDecodeResult` | type | Decode result (complete or progress) |
22
- | `ServiceMessage` | type | Union of all message types |
23
- | `ServiceServerMessage` | type | Server-to-client message union |
24
- | `ServiceServerRawMessage` | type | Server messages including progress |
25
- | `ServiceClientMessage` | type | Client-to-server message union |
26
- | `ServiceReloadMessage` | interface | Server reload command |
27
- | `ServiceProgressMessage` | interface | Chunked message progress notification |
28
- | `ServiceErrorMessage` | interface | Server error notification |
29
- | `ServiceAuthMessage` | interface | Client authentication message |
30
- | `ServiceRequestMessage` | interface | Client service method request |
31
- | `ServiceResponseMessage` | interface | Server method response |
32
- | `ServiceAddEventListenerMessage` | interface | Client add event listener |
33
- | `ServiceRemoveEventListenerMessage` | interface | Client remove event listener |
34
- | `ServiceGetEventListenerInfosMessage` | interface | Client request event listener infos |
35
- | `ServiceEmitEventMessage` | interface | Client emit event |
36
- | `ServiceEventMessage` | interface | Server event notification |
37
-
38
- -> See [docs/protocol.md](./docs/protocol.md) for details.
39
-
40
- ### Service Types
41
- | API | Type | Description |
42
- |-----|------|-------------|
43
- | `OrmService` | interface | ORM service interface (connect, query, transaction) |
44
- | `DbConnOptions` | type | Database connection options |
45
- | `AutoUpdateService` | interface | Auto-update service interface |
46
- | `SmtpClientSendOption` | interface | Full SMTP send options |
47
- | `SmtpClientSendByDefaultOption` | interface | SMTP send with server defaults |
48
- | `SmtpClientSendAttachment` | interface | Email attachment definition |
49
- | `SmtpClientDefaultOptions` | interface | Default SMTP client config |
50
-
51
- -> See [docs/service-types.md](./docs/service-types.md) for details.
52
-
53
- ### Types
54
- | API | Type | Description |
55
- |-----|------|-------------|
56
- | `ServiceUploadResult` | interface | File upload result (path, filename, size) |
57
-
58
- -> See [docs/events.md](./docs/events.md) for details.
59
-
60
- ### Event Definition
61
- | API | Type | Description |
62
- |-----|------|-------------|
63
- | `ServiceEventDef` | interface | Type-safe event definition |
64
- | `defineEvent` | function | Define a service event with typed info and data |
65
-
66
- -> See [docs/events.md](./docs/events.md) for details.
67
-
68
- ## Usage Examples
69
-
70
- ### Define and Use Events
71
-
72
- ```typescript
73
- import { defineEvent } from "@simplysm/service-common";
74
-
75
- // Define a typed event
76
- const OrderUpdated = defineEvent<
77
- { orderId: number }, // TInfo: filter info
78
- { status: string } // TData: event data
79
- >("OrderUpdated");
80
-
81
- // Server: emit event
82
- ctx.socket?.emitEvent(OrderUpdated, { orderId: 123 }, { status: "shipped" });
83
-
84
- // Client: subscribe to event
85
- await client.addEventListener(OrderUpdated, { orderId: 123 }, (data) => {
86
- console.log(data.status); // typed as string
87
- });
88
- ```
89
-
90
- ### Use Protocol
91
-
92
- ```typescript
93
- import { createServiceProtocol } from "@simplysm/service-common";
94
-
95
- const protocol = createServiceProtocol();
96
-
97
- // Encode
98
- const { chunks, totalSize } = protocol.encode(uuid, {
99
- name: "MyService.myMethod",
100
- body: [param1, param2],
101
- });
102
-
103
- // Decode
104
- const result = protocol.decode(receivedBytes);
105
- if (result.type === "complete") {
106
- handleMessage(result.message);
107
- }
108
-
109
- // Cleanup
110
- protocol.dispose();
111
- ```
@@ -1,38 +0,0 @@
1
- export interface SmtpClientSendAttachment {
2
- filename: string;
3
- content?: string | Uint8Array;
4
- path?: any;
5
- contentType?: string;
6
- }
7
- export interface SmtpClientSendByDefaultOption {
8
- to: string;
9
- cc?: string;
10
- bcc?: string;
11
- subject: string;
12
- html: string;
13
- attachments?: SmtpClientSendAttachment[];
14
- }
15
- export interface SmtpClientSendOption {
16
- host: string;
17
- port?: number;
18
- secure?: boolean;
19
- user?: string;
20
- pass?: string;
21
- from: string;
22
- to: string;
23
- cc?: string;
24
- bcc?: string;
25
- subject: string;
26
- html: string;
27
- attachments?: SmtpClientSendAttachment[];
28
- }
29
- export interface SmtpClientDefaultOptions {
30
- senderName: string;
31
- senderEmail?: string;
32
- user?: string;
33
- pass?: string;
34
- host: string;
35
- port?: number;
36
- secure?: boolean;
37
- }
38
- //# sourceMappingURL=smtp-client-service.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smtp-client-service.types.d.ts","sourceRoot":"","sources":["..\\..\\src\\service-types\\smtp-client-service.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=smtp-client-service.types.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "mappings": "",
5
- "names": []
6
- }
package/docs/events.md DELETED
@@ -1,51 +0,0 @@
1
- # Event Definition
2
-
3
- ## `ServiceEventDef`
4
-
5
- Event definition created by `defineEvent()`. `$info` and `$data` are type-only markers (not used at runtime).
6
-
7
- ```typescript
8
- interface ServiceEventDef<TInfo = unknown, TData = unknown> {
9
- eventName: string;
10
- readonly $info: TInfo;
11
- readonly $data: TData;
12
- }
13
- ```
14
-
15
- | Field | Type | Description |
16
- |-------|------|-------------|
17
- | `eventName` | `string` | Event name |
18
- | `$info` | `TInfo` | Type extraction only (listener filter info type) |
19
- | `$data` | `TData` | Type extraction only (event data type) |
20
-
21
- ## `defineEvent`
22
-
23
- Define a service event with type-safe info and data.
24
-
25
- ```typescript
26
- function defineEvent<TInfo = unknown, TData = unknown>(
27
- eventName: string,
28
- ): ServiceEventDef<TInfo, TData>;
29
- ```
30
-
31
- | Parameter | Type | Description |
32
- |-----------|------|-------------|
33
- | `eventName` | `string` | Event name |
34
-
35
- ## `ServiceUploadResult`
36
-
37
- File upload result. Contains information about a file uploaded to the server.
38
-
39
- ```typescript
40
- interface ServiceUploadResult {
41
- path: string;
42
- filename: string;
43
- size: number;
44
- }
45
- ```
46
-
47
- | Field | Type | Description |
48
- |-------|------|-------------|
49
- | `path` | `string` | Storage path on the server |
50
- | `filename` | `string` | Original filename |
51
- | `size` | `number` | File size (bytes) |
package/docs/protocol.md DELETED
@@ -1,252 +0,0 @@
1
- # Protocol
2
-
3
- ## `PROTOCOL_CONFIG`
4
-
5
- Service protocol configuration constants.
6
-
7
- ```typescript
8
- const PROTOCOL_CONFIG = {
9
- MAX_TOTAL_SIZE: 100 * 1024 * 1024, // Max message size (100MB)
10
- SPLIT_MESSAGE_SIZE: 3 * 1024 * 1024, // Chunking threshold (3MB)
11
- CHUNK_SIZE: 300 * 1024, // Chunk size (300KB)
12
- GC_INTERVAL: 10 * 1000, // GC interval (10s)
13
- EXPIRE_TIME: 60 * 1000, // Incomplete message expiry (60s)
14
- } as const;
15
- ```
16
-
17
- ## `ServiceProtocol`
18
-
19
- Service protocol interface for encoding/decoding binary messages.
20
-
21
- ```typescript
22
- interface ServiceProtocol {
23
- encode(uuid: string, message: ServiceMessage): { chunks: Bytes[]; totalSize: number };
24
- decode<T extends ServiceMessage>(bytes: Bytes): ServiceMessageDecodeResult<T>;
25
- dispose(): void;
26
- }
27
- ```
28
-
29
- | Method | Description |
30
- |--------|-------------|
31
- | `encode()` | Encode a message (auto-split if exceeding 3MB) |
32
- | `decode()` | Decode a message (auto-reassemble chunked packets) |
33
- | `dispose()` | Release GC timer and free memory |
34
-
35
- ## `ServiceMessageDecodeResult`
36
-
37
- Message decode result type (union).
38
-
39
- ```typescript
40
- type ServiceMessageDecodeResult<TMessage extends ServiceMessage> =
41
- | { type: "complete"; uuid: string; message: TMessage }
42
- | { type: "progress"; uuid: string; totalSize: number; completedSize: number };
43
- ```
44
-
45
- ## `createServiceProtocol`
46
-
47
- Create a service protocol encoder/decoder. Binary Protocol V2: Header 28 bytes (UUID 16 + TotalSize 8 + Index 4) + JSON body. Auto chunking at 300KB when exceeding 3MB. Max 100MB.
48
-
49
- ```typescript
50
- function createServiceProtocol(): ServiceProtocol;
51
- ```
52
-
53
- ## `ServiceMessage`
54
-
55
- Union type of all service messages.
56
-
57
- ```typescript
58
- type ServiceMessage =
59
- | ServiceReloadMessage
60
- | ServiceRequestMessage
61
- | ServiceAuthMessage
62
- | ServiceProgressMessage
63
- | ServiceResponseMessage
64
- | ServiceErrorMessage
65
- | ServiceAddEventListenerMessage
66
- | ServiceRemoveEventListenerMessage
67
- | ServiceGetEventListenerInfosMessage
68
- | ServiceEmitEventMessage
69
- | ServiceEventMessage;
70
- ```
71
-
72
- ## `ServiceServerMessage`
73
-
74
- Messages sent from server to client.
75
-
76
- ```typescript
77
- type ServiceServerMessage =
78
- | ServiceReloadMessage
79
- | ServiceResponseMessage
80
- | ServiceErrorMessage
81
- | ServiceEventMessage;
82
- ```
83
-
84
- ## `ServiceServerRawMessage`
85
-
86
- Server messages including progress notifications.
87
-
88
- ```typescript
89
- type ServiceServerRawMessage = ServiceProgressMessage | ServiceServerMessage;
90
- ```
91
-
92
- ## `ServiceClientMessage`
93
-
94
- Messages sent from client to server.
95
-
96
- ```typescript
97
- type ServiceClientMessage =
98
- | ServiceRequestMessage
99
- | ServiceAuthMessage
100
- | ServiceAddEventListenerMessage
101
- | ServiceRemoveEventListenerMessage
102
- | ServiceGetEventListenerInfosMessage
103
- | ServiceEmitEventMessage;
104
- ```
105
-
106
- ## `ServiceReloadMessage`
107
-
108
- Server reload command to client.
109
-
110
- ```typescript
111
- interface ServiceReloadMessage {
112
- name: "reload";
113
- body: {
114
- clientName: string | undefined;
115
- changedFileSet: Set<string>;
116
- };
117
- }
118
- ```
119
-
120
- ## `ServiceProgressMessage`
121
-
122
- Server progress notification for chunked messages.
123
-
124
- ```typescript
125
- interface ServiceProgressMessage {
126
- name: "progress";
127
- body: {
128
- totalSize: number;
129
- completedSize: number;
130
- };
131
- }
132
- ```
133
-
134
- ## `ServiceErrorMessage`
135
-
136
- Server error notification.
137
-
138
- ```typescript
139
- interface ServiceErrorMessage {
140
- name: "error";
141
- body: {
142
- name: string;
143
- message: string;
144
- code: string;
145
- stack?: string;
146
- detail?: unknown;
147
- cause?: unknown;
148
- };
149
- }
150
- ```
151
-
152
- ## `ServiceAuthMessage`
153
-
154
- Client authentication message.
155
-
156
- ```typescript
157
- interface ServiceAuthMessage {
158
- name: "auth";
159
- body: string;
160
- }
161
- ```
162
-
163
- ## `ServiceRequestMessage`
164
-
165
- Client service method request.
166
-
167
- ```typescript
168
- interface ServiceRequestMessage {
169
- name: `${string}.${string}`;
170
- body: unknown[];
171
- }
172
- ```
173
-
174
- ## `ServiceResponseMessage`
175
-
176
- Server service method response.
177
-
178
- ```typescript
179
- interface ServiceResponseMessage {
180
- name: "response";
181
- body?: unknown;
182
- }
183
- ```
184
-
185
- ## `ServiceAddEventListenerMessage`
186
-
187
- Client add event listener request.
188
-
189
- ```typescript
190
- interface ServiceAddEventListenerMessage {
191
- name: "evt:add";
192
- body: {
193
- key: string;
194
- name: string;
195
- info: unknown;
196
- };
197
- }
198
- ```
199
-
200
- ## `ServiceRemoveEventListenerMessage`
201
-
202
- Client remove event listener request.
203
-
204
- ```typescript
205
- interface ServiceRemoveEventListenerMessage {
206
- name: "evt:remove";
207
- body: {
208
- key: string;
209
- };
210
- }
211
- ```
212
-
213
- ## `ServiceGetEventListenerInfosMessage`
214
-
215
- Client request for event listener info list.
216
-
217
- ```typescript
218
- interface ServiceGetEventListenerInfosMessage {
219
- name: "evt:gets";
220
- body: {
221
- name: string;
222
- };
223
- }
224
- ```
225
-
226
- ## `ServiceEmitEventMessage`
227
-
228
- Client emit event request.
229
-
230
- ```typescript
231
- interface ServiceEmitEventMessage {
232
- name: "evt:emit";
233
- body: {
234
- keys: string[];
235
- data: unknown;
236
- };
237
- }
238
- ```
239
-
240
- ## `ServiceEventMessage`
241
-
242
- Server event notification.
243
-
244
- ```typescript
245
- interface ServiceEventMessage {
246
- name: "evt:on";
247
- body: {
248
- keys: string[];
249
- data: unknown;
250
- };
251
- }
252
- ```
@@ -1,162 +0,0 @@
1
- # Service Types
2
-
3
- ## `OrmService`
4
-
5
- ORM service interface. Provides database connection, transaction management, and query execution over the service protocol. Supports MySQL, MSSQL, and PostgreSQL.
6
-
7
- ```typescript
8
- interface OrmService {
9
- getInfo(opt: DbConnOptions & { configName: string }): Promise<{
10
- dialect: Dialect;
11
- database?: string;
12
- schema?: string;
13
- }>;
14
- connect(opt: Record<string, unknown>): Promise<number>;
15
- close(connId: number): Promise<void>;
16
- beginTransaction(connId: number, isolationLevel?: IsolationLevel): Promise<void>;
17
- commitTransaction(connId: number): Promise<void>;
18
- rollbackTransaction(connId: number): Promise<void>;
19
- executeParametrized(connId: number, query: string, params?: unknown[]): Promise<unknown[][]>;
20
- executeDefs(connId: number, defs: QueryDef[], options?: (ResultMeta | undefined)[]): Promise<unknown[][]>;
21
- bulkInsert(connId: number, tableName: string, columnDefs: Record<string, ColumnMeta>, records: Record<string, unknown>[]): Promise<void>;
22
- }
23
- ```
24
-
25
- | Method | Description |
26
- |--------|-------------|
27
- | `getInfo()` | Get database dialect and connection info |
28
- | `connect()` | Open a new database connection, returns connection ID |
29
- | `close()` | Close a database connection |
30
- | `beginTransaction()` | Begin transaction with optional isolation level |
31
- | `commitTransaction()` | Commit transaction |
32
- | `rollbackTransaction()` | Rollback transaction |
33
- | `executeParametrized()` | Execute a parameterized SQL query |
34
- | `executeDefs()` | Execute QueryDef array |
35
- | `bulkInsert()` | Bulk insert records |
36
-
37
- ## `DbConnOptions`
38
-
39
- Database connection options.
40
-
41
- ```typescript
42
- type DbConnOptions = { configName?: string; config?: Record<string, unknown> };
43
- ```
44
-
45
- | Field | Type | Description |
46
- |-------|------|-------------|
47
- | `configName` | `string` | Configuration name to look up from server config |
48
- | `config` | `Record<string, unknown>` | Direct connection config object |
49
-
50
- ## `AutoUpdateService`
51
-
52
- Auto-update service interface. Retrieves the latest version info for client applications.
53
-
54
- ```typescript
55
- interface AutoUpdateService {
56
- getLastVersion(platform: string): Promise<
57
- | { version: string; downloadPath: string }
58
- | undefined
59
- >;
60
- }
61
- ```
62
-
63
- | Method | Description |
64
- |--------|-------------|
65
- | `getLastVersion()` | Retrieve latest version info for a platform (e.g., "win32", "darwin", "android") |
66
-
67
- ## `SmtpClientSendOption`
68
-
69
- Full SMTP send options.
70
-
71
- ```typescript
72
- interface SmtpClientSendOption {
73
- host: string;
74
- port?: number;
75
- secure?: boolean;
76
- user?: string;
77
- pass?: string;
78
- from: string;
79
- to: string;
80
- cc?: string;
81
- bcc?: string;
82
- subject: string;
83
- html: string;
84
- attachments?: SmtpClientSendAttachment[];
85
- }
86
- ```
87
-
88
- | Field | Type | Description |
89
- |-------|------|-------------|
90
- | `host` | `string` | SMTP server hostname |
91
- | `port` | `number` | SMTP server port |
92
- | `secure` | `boolean` | Use TLS |
93
- | `user` | `string` | SMTP auth username |
94
- | `pass` | `string` | SMTP auth password |
95
- | `from` | `string` | Sender email |
96
- | `to` | `string` | Recipient email |
97
- | `cc` | `string` | CC recipients |
98
- | `bcc` | `string` | BCC recipients |
99
- | `subject` | `string` | Email subject |
100
- | `html` | `string` | Email body (HTML) |
101
- | `attachments` | `SmtpClientSendAttachment[]` | File attachments |
102
-
103
- ## `SmtpClientSendByDefaultOption`
104
-
105
- SMTP send options using default server configuration.
106
-
107
- ```typescript
108
- interface SmtpClientSendByDefaultOption {
109
- to: string;
110
- cc?: string;
111
- bcc?: string;
112
- subject: string;
113
- html: string;
114
- attachments?: SmtpClientSendAttachment[];
115
- }
116
- ```
117
-
118
- ## `SmtpClientSendAttachment`
119
-
120
- Email attachment definition.
121
-
122
- ```typescript
123
- interface SmtpClientSendAttachment {
124
- filename: string;
125
- content?: string | Uint8Array;
126
- path?: any;
127
- contentType?: string;
128
- }
129
- ```
130
-
131
- | Field | Type | Description |
132
- |-------|------|-------------|
133
- | `filename` | `string` | Attachment filename |
134
- | `content` | `string \| Uint8Array` | Inline content |
135
- | `path` | `any` | File path |
136
- | `contentType` | `string` | MIME type |
137
-
138
- ## `SmtpClientDefaultOptions`
139
-
140
- Default SMTP client configuration.
141
-
142
- ```typescript
143
- interface SmtpClientDefaultOptions {
144
- senderName: string;
145
- senderEmail?: string;
146
- user?: string;
147
- pass?: string;
148
- host: string;
149
- port?: number;
150
- secure?: boolean;
151
- }
152
- ```
153
-
154
- | Field | Type | Description |
155
- |-------|------|-------------|
156
- | `senderName` | `string` | Default sender display name |
157
- | `senderEmail` | `string` | Default sender email |
158
- | `user` | `string` | SMTP auth username |
159
- | `pass` | `string` | SMTP auth password |
160
- | `host` | `string` | SMTP server hostname |
161
- | `port` | `number` | SMTP server port |
162
- | `secure` | `boolean` | Use TLS |