@simplysm/service-server 13.0.14 → 13.0.16
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 +1 -1
- package/docs/server.md +9 -9
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ pnpm add @simplysm/service-server
|
|
|
51
51
|
|
|
52
52
|
### Utilities
|
|
53
53
|
|
|
54
|
-
- [`
|
|
54
|
+
- [`getConfig`](docs/server.md#getconfig) - JSON config file loading with caching and real-time file watching (auto expiration based on LazyGcMap)
|
|
55
55
|
|
|
56
56
|
### Legacy
|
|
57
57
|
|
package/docs/server.md
CHANGED
|
@@ -179,27 +179,27 @@ export const MyService = defineService("MyService", (ctx) => ({
|
|
|
179
179
|
}
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
Config files are cached and automatically refreshed on file changes (LazyGcMap-based, auto expires after 1 hour).
|
|
183
183
|
|
|
184
|
-
##
|
|
184
|
+
## getConfig
|
|
185
185
|
|
|
186
|
-
A
|
|
186
|
+
A standalone function that loads, caches, and watches JSON config files. Used internally by `ctx.getConfig()`.
|
|
187
187
|
|
|
188
188
|
```typescript
|
|
189
|
-
import {
|
|
189
|
+
import { getConfig } from "@simplysm/service-server";
|
|
190
190
|
|
|
191
191
|
// Returns undefined if the file does not exist
|
|
192
|
-
const config = await
|
|
192
|
+
const config = await getConfig<MyConfig>("/path/to/.config.json");
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
|
|
|
196
|
-
|
|
197
|
-
| `
|
|
195
|
+
| Signature | Returns | Description |
|
|
196
|
+
|-----------|---------|------|
|
|
197
|
+
| `getConfig<T>(filePath: string)` | `Promise<T \| undefined>` | Load and cache a JSON config file. Returns `undefined` if file not found |
|
|
198
198
|
|
|
199
199
|
Behavior:
|
|
200
200
|
- Caches file in `LazyGcMap` on first load.
|
|
201
201
|
- Registers file change watch (`FsWatcher`) to auto-refresh cache on changes.
|
|
202
|
-
- Cache auto-expires after 1 hour of no access, and associated
|
|
202
|
+
- Cache auto-expires after 1 hour of no access, and associated watcher is released.
|
|
203
203
|
- GC runs every 10 minutes to check for expired entries.
|
|
204
204
|
|
|
205
205
|
## Server Route Structure
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/service-server",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "13.0.
|
|
4
|
+
"version": "13.0.16",
|
|
5
5
|
"description": "심플리즘 패키지 - 서비스 모듈 (server)",
|
|
6
6
|
"author": "김석래",
|
|
7
7
|
"repository": {
|
|
@@ -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.16",
|
|
38
|
+
"@simplysm/core-node": "13.0.16",
|
|
39
|
+
"@simplysm/orm-common": "13.0.16",
|
|
40
|
+
"@simplysm/orm-node": "13.0.16",
|
|
41
|
+
"@simplysm/service-common": "13.0.16"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/semver": "^7.7.1",
|