sonamu 0.9.5 → 0.9.7
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/dist/api/config.d.ts +13 -2
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +1 -1
- package/dist/api/context.d.ts +17 -7
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/context.js +1 -1
- package/dist/api/decorators.d.ts +18 -0
- package/dist/api/decorators.d.ts.map +1 -1
- package/dist/api/decorators.js +55 -4
- package/dist/api/index.js +8 -3
- package/dist/api/sonamu.d.ts +24 -9
- package/dist/api/sonamu.d.ts.map +1 -1
- package/dist/api/sonamu.js +365 -79
- package/dist/api/websocket-helpers.d.ts +24 -0
- package/dist/api/websocket-helpers.d.ts.map +1 -0
- package/dist/api/websocket-helpers.js +77 -0
- package/dist/bin/cli.js +12 -4
- package/dist/dict/sonamu-dictionary.js +5 -5
- package/dist/entity/entity-manager.js +1 -1
- package/dist/entity/entity.js +3 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -4
- package/dist/migration/code-generation.js +7 -7
- package/dist/stream/index.d.ts +6 -0
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +13 -2
- package/dist/stream/ws-audience-resolver.d.ts +15 -0
- package/dist/stream/ws-audience-resolver.d.ts.map +1 -0
- package/dist/stream/ws-audience-resolver.js +31 -0
- package/dist/stream/ws-audience.d.ts +28 -0
- package/dist/stream/ws-audience.d.ts.map +1 -0
- package/dist/stream/ws-audience.js +46 -0
- package/dist/stream/ws-cluster-bus.d.ts +23 -0
- package/dist/stream/ws-cluster-bus.d.ts.map +1 -0
- package/dist/stream/ws-cluster-bus.js +18 -0
- package/dist/stream/ws-core.d.ts +15 -0
- package/dist/stream/ws-core.d.ts.map +1 -0
- package/dist/stream/ws-core.js +1 -0
- package/dist/stream/ws-delivery.d.ts +24 -0
- package/dist/stream/ws-delivery.d.ts.map +1 -0
- package/dist/stream/ws-delivery.js +103 -0
- package/dist/stream/ws-local-connection-store.d.ts +10 -0
- package/dist/stream/ws-local-connection-store.d.ts.map +1 -0
- package/dist/stream/ws-local-connection-store.js +44 -0
- package/dist/stream/ws-presence-store.d.ts +61 -0
- package/dist/stream/ws-presence-store.d.ts.map +1 -0
- package/dist/stream/ws-presence-store.js +236 -0
- package/dist/stream/ws-registry.d.ts +42 -0
- package/dist/stream/ws-registry.d.ts.map +1 -0
- package/dist/stream/ws-registry.js +108 -0
- package/dist/stream/ws.d.ts +52 -0
- package/dist/stream/ws.d.ts.map +1 -0
- package/dist/stream/ws.js +397 -0
- package/dist/syncer/api-parser.d.ts.map +1 -1
- package/dist/syncer/api-parser.js +72 -2
- package/dist/syncer/checksum.d.ts.map +1 -1
- package/dist/syncer/checksum.js +13 -12
- package/dist/syncer/code-generator.d.ts.map +1 -1
- package/dist/syncer/code-generator.js +7 -4
- package/dist/syncer/event-batcher.d.ts +27 -0
- package/dist/syncer/event-batcher.d.ts.map +1 -0
- package/dist/syncer/event-batcher.js +69 -0
- package/dist/syncer/file-patterns.d.ts +48 -26
- package/dist/syncer/file-patterns.d.ts.map +1 -1
- package/dist/syncer/file-patterns.js +71 -23
- package/dist/syncer/file-tracking.d.ts +13 -0
- package/dist/syncer/file-tracking.d.ts.map +1 -0
- package/dist/syncer/file-tracking.js +33 -0
- package/dist/syncer/index.js +2 -2
- package/dist/syncer/module-loader.d.ts +2 -11
- package/dist/syncer/module-loader.d.ts.map +1 -1
- package/dist/syncer/module-loader.js +3 -3
- package/dist/syncer/syncer-actions.d.ts +39 -6
- package/dist/syncer/syncer-actions.d.ts.map +1 -1
- package/dist/syncer/syncer-actions.js +125 -10
- package/dist/syncer/syncer.d.ts +33 -19
- package/dist/syncer/syncer.d.ts.map +1 -1
- package/dist/syncer/syncer.js +168 -168
- package/dist/syncer/watcher.d.ts +8 -0
- package/dist/syncer/watcher.d.ts.map +1 -0
- package/dist/syncer/watcher.js +105 -0
- package/dist/tasks/workflow-manager.d.ts.map +1 -1
- package/dist/tasks/workflow-manager.js +2 -1
- package/dist/template/implementations/services.template.d.ts.map +1 -1
- package/dist/template/implementations/services.template.js +36 -1
- package/dist/testing/bootstrap.d.ts.map +1 -1
- package/dist/testing/bootstrap.js +8 -1
- package/dist/testing/fixture-manager.js +1 -1
- package/dist/types/types.d.ts +2 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +2 -2
- package/dist/ui/api.js +1 -1
- package/dist/ui/cdd-service.js +1 -1
- package/dist/ui-web/assets/{index-DzZ7vBk4.js → index-BmThfg-s.js} +37 -37
- package/dist/ui-web/index.html +1 -1
- package/dist/utils/async-utils.d.ts +27 -3
- package/dist/utils/async-utils.d.ts.map +1 -1
- package/dist/utils/async-utils.js +56 -6
- package/dist/utils/formatter.d.ts +7 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +93 -59
- package/dist/utils/fs-utils.d.ts +2 -0
- package/dist/utils/fs-utils.d.ts.map +1 -1
- package/dist/utils/fs-utils.js +10 -2
- package/dist/utils/process-utils.d.ts +10 -4
- package/dist/utils/process-utils.d.ts.map +1 -1
- package/dist/utils/process-utils.js +20 -7
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +2 -2
- package/package.json +3 -1
- package/src/api/__tests__/sonamu.websocket.test.ts +64 -0
- package/src/api/__tests__/websocket-context.types.test.ts +58 -0
- package/src/api/config.ts +28 -2
- package/src/api/context.ts +21 -7
- package/src/api/decorators.ts +103 -3
- package/src/api/sonamu.ts +529 -127
- package/src/api/websocket-helpers.ts +122 -0
- package/src/bin/cli.ts +10 -2
- package/src/dict/sonamu-dictionary.ts +2 -2
- package/src/entity/entity.ts +1 -1
- package/src/index.ts +6 -0
- package/src/migration/code-generation.ts +5 -5
- package/src/shared/app.shared.ts.txt +254 -1
- package/src/shared/web.shared.ts.txt +282 -1
- package/src/stream/__tests__/ws-contracts.test.ts +381 -0
- package/src/stream/__tests__/ws.test.ts +449 -0
- package/src/stream/index.ts +6 -0
- package/src/stream/ws-audience-resolver.ts +35 -0
- package/src/stream/ws-audience.ts +62 -0
- package/src/stream/ws-cluster-bus.ts +32 -0
- package/src/stream/ws-core.ts +16 -0
- package/src/stream/ws-delivery.ts +138 -0
- package/src/stream/ws-local-connection-store.ts +44 -0
- package/src/stream/ws-presence-store.ts +326 -0
- package/src/stream/ws-registry.ts +138 -0
- package/src/stream/ws.ts +591 -0
- package/src/syncer/__tests__/api-parser.websocket-type-ref.test.ts +78 -0
- package/src/syncer/api-parser.ts +112 -1
- package/src/syncer/checksum.ts +23 -29
- package/src/syncer/code-generator.ts +4 -1
- package/src/syncer/event-batcher.ts +72 -0
- package/src/syncer/file-patterns.ts +98 -30
- package/src/syncer/file-tracking.ts +27 -0
- package/src/syncer/module-loader.ts +5 -12
- package/src/syncer/syncer-actions.ts +179 -17
- package/src/syncer/syncer.ts +250 -287
- package/src/syncer/watcher.ts +128 -0
- package/src/tasks/workflow-manager.ts +1 -0
- package/src/template/__tests__/services.template.websocket.test.ts +79 -0
- package/src/template/implementations/services.template.ts +69 -0
- package/src/testing/bootstrap.ts +8 -1
- package/src/types/types.ts +20 -2
- package/src/utils/async-utils.ts +71 -4
- package/src/utils/formatter.ts +111 -74
- package/src/utils/fs-utils.ts +9 -0
- package/src/utils/process-utils.ts +21 -4
- package/src/utils/utils.ts +1 -1
package/src/utils/fs-utils.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { type PathLike } from "fs";
|
|
|
3
3
|
import { access, readFile, stat, writeFile } from "fs/promises";
|
|
4
4
|
import path, { dirname } from "path";
|
|
5
5
|
|
|
6
|
+
import { formatCode } from "./formatter";
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* fs/promises에는 exists가 없어요. 대신 access가 있습니다.
|
|
8
10
|
* 근데 얘는 인터페이스가 쓰기 불편해요. 그래서 감싸주었습니다.
|
|
@@ -37,6 +39,8 @@ export async function fileExists(path: PathLike): Promise<boolean> {
|
|
|
37
39
|
* - services/user/user.types.ts → ../sonamu.shared
|
|
38
40
|
* - i18n/ko.ts → ../services/sonamu.shared
|
|
39
41
|
*
|
|
42
|
+
* ts/tsx 파일은 쓰기 전에 oxfmt/oxlint 한번 돌려줍니다!
|
|
43
|
+
*
|
|
40
44
|
* @param fromPath 원본 파일 경로
|
|
41
45
|
* @param toPath 대상 파일 경로
|
|
42
46
|
* @param syncHeader 동기화 시 파일 최상단에 삽입할 주석 블록. 기존 @generated 블록이 있으면 교체하고, 없으면 최상단에 추가합니다.
|
|
@@ -83,6 +87,11 @@ export async function copyFileWithReplaceCoreToShared(
|
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
// .ts/.tsx 산출물은 쓰기 전에 포맷도 해줘요 ㅎㅎ
|
|
91
|
+
if (toPath.endsWith(".ts") || toPath.endsWith(".tsx")) {
|
|
92
|
+
newFileContent = await formatCode(newFileContent, toPath);
|
|
93
|
+
}
|
|
94
|
+
|
|
86
95
|
await writeFile(toPath, newFileContent);
|
|
87
96
|
return true;
|
|
88
97
|
}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
+
import { execFile, type ExecFileOptions } from "child_process";
|
|
1
2
|
import { setTimeout as setTimeoutPromises } from "timers/promises";
|
|
3
|
+
import { promisify } from "util";
|
|
2
4
|
|
|
3
5
|
import chalk from "chalk";
|
|
4
6
|
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* child_process.execFile의 Promise 기반 wrapper입니다.
|
|
11
|
+
* exit code가 non-zero이면 reject해요.
|
|
12
|
+
*/
|
|
13
|
+
export async function execute(
|
|
14
|
+
bin: string,
|
|
15
|
+
args: string[],
|
|
16
|
+
options?: ExecFileOptions,
|
|
17
|
+
): Promise<string> {
|
|
18
|
+
const { stdout } = await execFileAsync(bin, args, options);
|
|
19
|
+
return typeof stdout === "string" ? stdout : stdout.toString();
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
/**
|
|
6
23
|
* 주어진 작업을 실행합니다.
|
|
7
|
-
* 주어진 프로세스 이벤트(=시그널)가 발생하였을 때에도 최대 한계(
|
|
24
|
+
* 주어진 프로세스 이벤트(=시그널)가 발생하였을 때에도 최대 한계(waitForUpTo) 동안 작업을 기다린 후 종료합니다.
|
|
8
25
|
* @param {() => Promise<void>} job - 실행할 작업
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {NodeJS.Signals} options.
|
|
11
|
-
* @param {number} options.
|
|
26
|
+
* @param {{ whenThisHappens: NodeJS.Signals; waitForUpTo: number }} options - 옵션
|
|
27
|
+
* @param {NodeJS.Signals} options.whenThisHappens - 프로세스 이벤트
|
|
28
|
+
* @param {number} options.waitForUpTo - 최대 한계 시간
|
|
12
29
|
*/
|
|
13
30
|
export async function runWithGracefulShutdown(
|
|
14
31
|
job: () => Promise<void>,
|
package/src/utils/utils.ts
CHANGED
|
@@ -118,7 +118,7 @@ export function merge<T extends Record<string, any>>(defaultObj: T, userObj: T):
|
|
|
118
118
|
|
|
119
119
|
// plain object 판별 헬퍼 함수
|
|
120
120
|
// (배열, null, Date 등을 제외한 순수 객체만 true)
|
|
121
|
-
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
121
|
+
export function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
122
122
|
return (
|
|
123
123
|
value !== null &&
|
|
124
124
|
typeof value === "object" &&
|