@simplysm/service-server 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 +2 -4
- package/dist/core/define-service.d.ts +3 -3
- package/dist/core/define-service.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/utils/config-manager.d.ts +1 -1
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js.map +1 -1
- package/package.json +8 -8
- package/src/core/define-service.ts +3 -3
- package/src/index.ts +3 -3
- package/src/utils/config-manager.ts +3 -3
package/README.md
CHANGED
|
@@ -46,7 +46,6 @@ pnpm add @simplysm/service-server
|
|
|
46
46
|
### Built-in Services
|
|
47
47
|
|
|
48
48
|
- [`OrmService`](docs/built-in-services.md#ormservice) - DB connection/transaction/query execution (WebSocket only, auth required)
|
|
49
|
-
- [`CryptoService`](docs/built-in-services.md#cryptoservice) - SHA256 hash and AES-256-CBC encryption/decryption
|
|
50
49
|
- [`AutoUpdateService`](docs/built-in-services.md#autoupdateservice) - App auto-update (provides latest version query and download path)
|
|
51
50
|
|
|
52
51
|
### Utilities
|
|
@@ -238,19 +237,18 @@ See [Real-time Event Publishing](docs/transport.md#real-time-event-publishing) f
|
|
|
238
237
|
The package provides several built-in services:
|
|
239
238
|
|
|
240
239
|
- [`OrmService`](docs/built-in-services.md#ormservice) - Database operations (MySQL, MSSQL, PostgreSQL)
|
|
241
|
-
- [`CryptoService`](docs/built-in-services.md#cryptoservice) - Hashing and encryption
|
|
242
240
|
- [`AutoUpdateService`](docs/built-in-services.md#autoupdateservice) - Client app auto-updates
|
|
243
241
|
|
|
244
242
|
Register them like any other service:
|
|
245
243
|
|
|
246
244
|
```typescript
|
|
247
|
-
import { createServiceServer, OrmService
|
|
245
|
+
import { createServiceServer, OrmService } from "@simplysm/service-server";
|
|
248
246
|
|
|
249
247
|
const server = createServiceServer({
|
|
250
248
|
port: 8080,
|
|
251
249
|
rootPath: "/app/data",
|
|
252
250
|
auth: { jwtSecret: "secret" },
|
|
253
|
-
services: [OrmService
|
|
251
|
+
services: [OrmService],
|
|
254
252
|
});
|
|
255
253
|
```
|
|
256
254
|
|
|
@@ -33,8 +33,8 @@ export declare function getServiceAuthPermissions(fn: Function): string[] | unde
|
|
|
33
33
|
* - Method-level: `auth(() => result)` — this method requires login
|
|
34
34
|
* - Method-level with roles: `auth(["admin"], () => result)`
|
|
35
35
|
*/
|
|
36
|
-
export declare function auth<
|
|
37
|
-
export declare function auth<
|
|
36
|
+
export declare function auth<TFunction extends (...args: any[]) => any>(fn: TFunction): TFunction;
|
|
37
|
+
export declare function auth<TFunction extends (...args: any[]) => any>(permissions: string[], fn: TFunction): TFunction;
|
|
38
38
|
export interface ServiceDefinition<TMethods = Record<string, (...args: any[]) => any>> {
|
|
39
39
|
name: string;
|
|
40
40
|
factory: (ctx: ServiceContext) => TMethods;
|
|
@@ -63,5 +63,5 @@ export declare function defineService<TMethods extends Record<string, (...args:
|
|
|
63
63
|
* export type UserServiceType = ServiceMethods<typeof UserService>;
|
|
64
64
|
* // Client: client.getService<UserServiceType>("User");
|
|
65
65
|
*/
|
|
66
|
-
export type ServiceMethods<
|
|
66
|
+
export type ServiceMethods<TDefinition> = TDefinition extends ServiceDefinition<infer M> ? M : never;
|
|
67
67
|
//# sourceMappingURL=define-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-service.d.ts","sourceRoot":"","sources":["../../src/core/define-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAOnE,MAAM,WAAW,cAAc,CAAC,SAAS,GAAG,OAAO;IACj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CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC;AAcjH,MAAM,WAAW,iBAAiB,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,QAAQ,CAAC;IAC3C,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EACpF,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,QAAQ,GACzC,iBAAiB,CAAC,QAAQ,CAAC,CAM7B;AAID;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,WAAW,IAAI,WAAW,SAAS,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ export * from "./auth/auth-token-payload";
|
|
|
3
3
|
export * from "./auth/jwt-manager";
|
|
4
4
|
export * from "./core/define-service";
|
|
5
5
|
export * from "./core/service-executor";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export * from "./transport/socket/websocket-handler";
|
|
7
|
+
export * from "./transport/socket/service-socket";
|
|
8
8
|
export * from "./transport/http/http-request-handler";
|
|
9
9
|
export * from "./transport/http/upload-handler";
|
|
10
10
|
export * from "./transport/http/static-file-handler";
|
|
11
|
-
export
|
|
11
|
+
export * from "./protocol/protocol-wrapper";
|
|
12
12
|
export * from "./services/orm-service";
|
|
13
13
|
export * from "./services/auto-update-service";
|
|
14
14
|
export * from "./utils/config-manager";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AAGxC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,6BAA6B,CAAC;AAG5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAG/C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,iCAAiC,CAAC;AAGhD,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,20 +3,15 @@ export * from "./auth/auth-token-payload.js";
|
|
|
3
3
|
export * from "./auth/jwt-manager.js";
|
|
4
4
|
export * from "./core/define-service.js";
|
|
5
5
|
export * from "./core/service-executor.js";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export * from "./transport/socket/websocket-handler.js";
|
|
7
|
+
export * from "./transport/socket/service-socket.js";
|
|
8
8
|
export * from "./transport/http/http-request-handler.js";
|
|
9
9
|
export * from "./transport/http/upload-handler.js";
|
|
10
10
|
export * from "./transport/http/static-file-handler.js";
|
|
11
|
-
|
|
11
|
+
export * from "./protocol/protocol-wrapper.js";
|
|
12
12
|
export * from "./services/orm-service.js";
|
|
13
13
|
export * from "./services/auto-update-service.js";
|
|
14
14
|
export * from "./utils/config-manager.js";
|
|
15
15
|
export * from "./legacy/v1-auto-update-handler.js";
|
|
16
16
|
export * from "./service-server.js";
|
|
17
|
-
export {
|
|
18
|
-
createProtocolWrapper,
|
|
19
|
-
createServiceSocket,
|
|
20
|
-
createWebSocketHandler
|
|
21
|
-
};
|
|
22
17
|
//# 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;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,
|
|
4
|
+
"mappings": "AACA,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AACd,cAAc;AAGd,cAAc;AAGd,cAAc;AAGd,cAAc;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getConfig<
|
|
1
|
+
export declare function getConfig<TConfig>(filePath: string): Promise<TConfig | undefined>;
|
|
2
2
|
//# sourceMappingURL=config-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/utils/config-manager.ts"],"names":[],"mappings":"AAmBA,wBAAsB,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../../src/utils/config-manager.ts"],"names":[],"mappings":"AAmBA,wBAAsB,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAwCvF"}
|
|
@@ -1,6 +1,6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5B,QAAI;AACF,YAAM,UAAU,MAAM,UAAU,MAAM,CAAC,QAAQ,CAAC;AAChD,gBAAU,IAAI,UAAU,OAAO;AAE/B,cAAQ,SAAS,EAAE,OAAO,IAAI,GAAG,YAAY;AAC3C,YAAI,CAAE,MAAM,SAAS,QAAQ,GAAI;AAC/B,iBAAO,OAAO,QAAQ;AACtB,gBAAM,aAAa,QAAQ;AAC3B,iBAAO,MAAM,iDAAc,KAAK,SAAS,QAAQ,CAAC,EAAE;AACpD;AAAA,QACF;AAEA,YAAI;AACF,gBAAM,YAAY,MAAM,WAAW,QAAQ;AAC3C,iBAAO,IAAI,UAAU,SAAS;AAC9B,iBAAO,MAAM,8DAAiB,KAAK,SAAS,QAAQ,CAAC,EAAE;AAAA,QACzD,SAAS,KAAK;AACZ,iBAAO,KAAK,wDAAgB,QAAQ,IAAI,GAAG;AAAA,QAC7C;AAAA,MACF,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,aAAO,MAAM,8BAAU,QAAQ,IAAI,GAAG;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;AAEA,eAAe,aAAa,UAAkB;AAC5C,QAAM,UAAU,UAAU,IAAI,QAAQ;AACtC,MAAI,WAAW,MAAM;AACnB,UAAM,QAAQ,MAAM;AACpB,cAAU,OAAO,QAAQ;AAAA,EAC3B;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/service-server",
|
|
3
|
-
"
|
|
4
|
-
"version": "13.0.16",
|
|
3
|
+
"version": "13.0.23",
|
|
5
4
|
"description": "심플리즘 패키지 - 서비스 모듈 (server)",
|
|
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-server"
|
|
11
11
|
},
|
|
12
|
-
"license": "Apache-2.0",
|
|
13
12
|
"type": "module",
|
|
14
13
|
"main": "./dist/index.js",
|
|
15
14
|
"types": "./dist/index.d.ts",
|
|
@@ -18,6 +17,7 @@
|
|
|
18
17
|
"src",
|
|
19
18
|
"docs"
|
|
20
19
|
],
|
|
20
|
+
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@fastify/cors": "^11.2.0",
|
|
23
23
|
"@fastify/helmet": "^13.0.2",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"semver": "^7.7.4",
|
|
35
35
|
"utf-8-validate": "^6.0.6",
|
|
36
36
|
"ws": "^8.19.0",
|
|
37
|
-
"@simplysm/core-common": "13.0.
|
|
38
|
-
"@simplysm/core-node": "13.0.
|
|
39
|
-
"@simplysm/orm-common": "13.0.
|
|
40
|
-
"@simplysm/orm-node": "13.0.
|
|
41
|
-
"@simplysm/service-common": "13.0.
|
|
37
|
+
"@simplysm/core-common": "13.0.23",
|
|
38
|
+
"@simplysm/core-node": "13.0.23",
|
|
39
|
+
"@simplysm/orm-common": "13.0.23",
|
|
40
|
+
"@simplysm/orm-node": "13.0.23",
|
|
41
|
+
"@simplysm/service-common": "13.0.23"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/semver": "^7.7.1",
|
|
@@ -100,8 +100,8 @@ export function getServiceAuthPermissions(fn: Function): string[] | undefined {
|
|
|
100
100
|
* - Method-level: `auth(() => result)` — this method requires login
|
|
101
101
|
* - Method-level with roles: `auth(["admin"], () => result)`
|
|
102
102
|
*/
|
|
103
|
-
export function auth<
|
|
104
|
-
export function auth<
|
|
103
|
+
export function auth<TFunction extends (...args: any[]) => any>(fn: TFunction): TFunction;
|
|
104
|
+
export function auth<TFunction extends (...args: any[]) => any>(permissions: string[], fn: TFunction): TFunction;
|
|
105
105
|
export function auth(permissionsOrFn: string[] | Function, maybeFn?: Function): Function {
|
|
106
106
|
const permissions = Array.isArray(permissionsOrFn) ? permissionsOrFn : [];
|
|
107
107
|
const fn = Array.isArray(permissionsOrFn) ? maybeFn! : permissionsOrFn;
|
|
@@ -156,4 +156,4 @@ export function defineService<TMethods extends Record<string, (...args: any[]) =
|
|
|
156
156
|
* export type UserServiceType = ServiceMethods<typeof UserService>;
|
|
157
157
|
* // Client: client.getService<UserServiceType>("User");
|
|
158
158
|
*/
|
|
159
|
-
export type ServiceMethods<
|
|
159
|
+
export type ServiceMethods<TDefinition> = TDefinition extends ServiceDefinition<infer M> ? M : never;
|
package/src/index.ts
CHANGED
|
@@ -10,8 +10,8 @@ export * from "./core/define-service";
|
|
|
10
10
|
export * from "./core/service-executor";
|
|
11
11
|
|
|
12
12
|
// Transport - Socket
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export * from "./transport/socket/websocket-handler";
|
|
14
|
+
export * from "./transport/socket/service-socket";
|
|
15
15
|
|
|
16
16
|
// Transport - HTTP
|
|
17
17
|
export * from "./transport/http/http-request-handler";
|
|
@@ -19,7 +19,7 @@ export * from "./transport/http/upload-handler";
|
|
|
19
19
|
export * from "./transport/http/static-file-handler";
|
|
20
20
|
|
|
21
21
|
// Protocol
|
|
22
|
-
export
|
|
22
|
+
export * from "./protocol/protocol-wrapper";
|
|
23
23
|
|
|
24
24
|
// Services
|
|
25
25
|
export * from "./services/orm-service";
|
|
@@ -17,10 +17,10 @@ const _cache = new LazyGcMap<string, unknown>({
|
|
|
17
17
|
|
|
18
18
|
const _watchers = new Map<string, FsWatcher>();
|
|
19
19
|
|
|
20
|
-
export async function getConfig<
|
|
20
|
+
export async function getConfig<TConfig>(filePath: string): Promise<TConfig | undefined> {
|
|
21
21
|
// 1. 캐시 적중 (시간 자동 갱신)
|
|
22
22
|
if (_cache.has(filePath)) {
|
|
23
|
-
return _cache.get(filePath) as
|
|
23
|
+
return _cache.get(filePath) as TConfig;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (!(await fsExists(filePath))) return undefined;
|
|
@@ -56,7 +56,7 @@ export async function getConfig<T>(filePath: string): Promise<T | undefined> {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return config as
|
|
59
|
+
return config as TConfig;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
async function closeWatcher(filePath: string) {
|