@simplysm/service-common 13.0.97 → 13.0.98
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 +58 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @simplysm/service-common
|
|
2
|
+
|
|
3
|
+
Service module (common) -- shared protocol and types used by both `@simplysm/service-client` and `@simplysm/service-server`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @simplysm/service-common
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exports
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
// Protocol
|
|
16
|
+
PROTOCOL_CONFIG,
|
|
17
|
+
type ServiceMessage,
|
|
18
|
+
type ServiceServerMessage,
|
|
19
|
+
type ServiceServerRawMessage,
|
|
20
|
+
type ServiceClientMessage,
|
|
21
|
+
type ServiceProtocol,
|
|
22
|
+
type ServiceMessageDecodeResult,
|
|
23
|
+
createServiceProtocol,
|
|
24
|
+
// Service Types
|
|
25
|
+
type OrmService,
|
|
26
|
+
type DbConnOptions,
|
|
27
|
+
type AutoUpdateService,
|
|
28
|
+
type SmtpClientSendAttachment,
|
|
29
|
+
type SmtpClientSendByDefaultOption,
|
|
30
|
+
type SmtpClientSendOption,
|
|
31
|
+
type SmtpClientDefaultOptions,
|
|
32
|
+
// Events + Types
|
|
33
|
+
type ServiceEventDef,
|
|
34
|
+
defineEvent,
|
|
35
|
+
type ServiceUploadResult,
|
|
36
|
+
} from "@simplysm/service-common";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { createServiceProtocol, defineEvent } from "@simplysm/service-common";
|
|
43
|
+
|
|
44
|
+
// Create protocol encoder/decoder
|
|
45
|
+
const protocol = createServiceProtocol();
|
|
46
|
+
const { chunks, totalSize } = protocol.encode(uuid, { name: "auth", body: token });
|
|
47
|
+
const result = protocol.decode(chunks[0]);
|
|
48
|
+
protocol.dispose();
|
|
49
|
+
|
|
50
|
+
// Define a typed event
|
|
51
|
+
const OrderUpdated = defineEvent<{ orderId: number }, { status: string }>("OrderUpdated");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
- [Protocol](docs/protocol.md)
|
|
57
|
+
- [Service Types](docs/service-types.md)
|
|
58
|
+
- [Events and Types](docs/events.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/service-common",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.98",
|
|
4
4
|
"description": "Simplysm package - Service module (common)",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@simplysm/core-common": "13.0.
|
|
23
|
-
"@simplysm/orm-common": "13.0.
|
|
22
|
+
"@simplysm/core-common": "13.0.98",
|
|
23
|
+
"@simplysm/orm-common": "13.0.98"
|
|
24
24
|
}
|
|
25
25
|
}
|