@simplysm/sd-claude 14.0.42 → 14.0.44
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/claude/references/sd-simplysm14/angular/docs/directives.md +74 -3
- package/claude/references/sd-simplysm14/angular/docs/features.md +64 -14
- package/claude/references/sd-simplysm14/angular/docs/plugins.md +2 -90
- package/claude/references/sd-simplysm14/angular/docs/providers.md +2 -2
- package/claude/references/sd-simplysm14/angular/docs/type-utilities.md +1 -2
- package/claude/references/sd-simplysm14/angular/docs/ui-data.md +103 -23
- package/claude/references/sd-simplysm14/angular/docs/ui-form.md +173 -28
- package/claude/references/sd-simplysm14/angular/docs/ui-layout.md +19 -4
- package/claude/references/sd-simplysm14/angular/docs/ui-navigation.md +20 -2
- package/claude/references/sd-simplysm14/angular/docs/ui-overlay.md +23 -14
- package/claude/references/sd-simplysm14/angular/docs/ui-visual.md +15 -7
- package/claude/references/sd-simplysm14/angular/docs/utils.md +1 -1
- package/claude/references/sd-simplysm14/angular/usage.md +59 -15
- package/claude/references/sd-simplysm14/capacitor-plugin-auto-update/usage.md +1 -1
- package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/file-operations.md +154 -0
- package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/permissions.md +84 -0
- package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/storage-paths.md +107 -0
- package/claude/references/sd-simplysm14/capacitor-plugin-file-system/docs/types.md +83 -0
- package/claude/references/sd-simplysm14/capacitor-plugin-file-system/usage.md +83 -128
- package/claude/references/sd-simplysm14/capacitor-plugin-usb-storage/usage.md +99 -1
- package/claude/references/sd-simplysm14/core-node/docs/child-process.md +182 -0
- package/claude/references/sd-simplysm14/core-node/docs/features.md +1 -1
- package/claude/references/sd-simplysm14/core-node/docs/file-system.md +509 -0
- package/claude/references/sd-simplysm14/core-node/docs/file-watching.md +139 -0
- package/claude/references/sd-simplysm14/core-node/docs/logging.md +180 -0
- package/claude/references/sd-simplysm14/core-node/docs/path.md +176 -0
- package/claude/references/sd-simplysm14/core-node/docs/worker-threads.md +334 -0
- package/claude/references/sd-simplysm14/core-node/usage.md +192 -96
- package/claude/references/sd-simplysm14/excel/docs/core-classes.md +33 -14
- package/claude/references/sd-simplysm14/excel/usage.md +47 -45
- package/claude/references/sd-simplysm14/lint/usage.md +3 -2
- package/claude/references/sd-simplysm14/orm-common/docs/queryable-executable.md +30 -35
- package/claude/references/sd-simplysm14/orm-common/usage.md +9 -8
- package/claude/references/sd-simplysm14/sd-claude/docs/assets.md +43 -34
- package/claude/references/sd-simplysm14/sd-claude/docs/cli.md +1 -1
- package/claude/references/sd-simplysm14/sd-claude/docs/hooks.md +20 -2
- package/claude/references/sd-simplysm14/sd-claude/docs/scripts.md +5 -18
- package/claude/references/sd-simplysm14/sd-claude/usage.md +6 -5
- package/claude/references/sd-simplysm14/sd-cli/usage.md +176 -1
- package/claude/references/sd-simplysm14/service-client/usage.md +126 -61
- package/claude/references/sd-simplysm14/service-common/usage.md +28 -28
- package/claude/references/sd-simplysm14/storage/usage.md +123 -30
- package/claude/{rules → references}/sd-simplysm14.md +1 -1
- package/claude/references/sd-testing.md +100 -4
- package/claude/rules/sd-claude-rules.md +21 -5
- package/claude/sd-check-write.py +1 -1
- package/claude/skills/sd-check/SKILL.md +7 -4
- package/claude/skills/sd-claude-docs/SKILL.md +7 -4
- package/claude/skills/sd-claude-docs/references/package-doc-gen.md +30 -7
- package/claude/skills/sd-commit/SKILL.md +2 -0
- package/claude/skills/sd-debug/SKILL.md +1 -1
- package/claude/skills/sd-deliverable/SKILL.md +2 -0
- package/claude/skills/sd-dev/SKILL.md +1 -1
- package/claude/skills/sd-doc-extract/SKILL.md +2 -0
- package/claude/{references/sd-debug.md → skills/sd-inner-debug/SKILL.md} +16 -20
- package/claude/{references/sd-review.md → skills/sd-inner-review/SKILL.md} +9 -4
- package/claude/skills/sd-issue/SKILL.md +2 -0
- package/claude/skills/sd-outlook/SKILL.md +2 -0
- package/claude/skills/sd-plan/SKILL.md +1 -1
- package/claude/skills/sd-prompt/SKILL.md +2 -2
- package/claude/skills/sd-refactor/SKILL.md +2 -2
- package/claude/skills/sd-review/SKILL.md +1 -1
- package/claude/skills/sd-tdd/SKILL.md +7 -7
- package/claude/skills/sd-use/SKILL.md +2 -0
- package/claude/skills/sd-wbs/SKILL.md +41 -18
- package/package.json +1 -1
- /package/claude/{references → rules}/sd-clarify.md +0 -0
|
@@ -40,6 +40,14 @@ npm install @simplysm/sd-cli
|
|
|
40
40
|
| `SdConfigParams` | interface | sd.config.ts 함수에 전달되는 매개변수 |
|
|
41
41
|
| `SdConfigFn` | type | sd.config.ts default export 함수 타입 |
|
|
42
42
|
|
|
43
|
+
### TypeScript Compiler
|
|
44
|
+
|
|
45
|
+
| API | Type | Description |
|
|
46
|
+
|-----|------|-------------|
|
|
47
|
+
| `SdTsCompiler` | class | TypeScript AOT 컴파일러 (Angular 및 일반 TS 패키지 지원) |
|
|
48
|
+
| `ISdTsCompilerOptions` | interface | SdTsCompiler 생성 옵션 |
|
|
49
|
+
| `ISdTsCompilerResult` | interface | SdTsCompiler.compileAsync() 반환 타입 |
|
|
50
|
+
|
|
43
51
|
### Angular Vite Plugin
|
|
44
52
|
|
|
45
53
|
| API | Type | Description |
|
|
@@ -47,6 +55,127 @@ npm install @simplysm/sd-cli
|
|
|
47
55
|
| `SdAngularPluginOptions` | interface | sdAngularPlugin 옵션 |
|
|
48
56
|
| `sdAngularPlugin` | function | Angular AOT 컴파일을 수행하는 Vite 플러그인 |
|
|
49
57
|
|
|
58
|
+
## TypeScript Compiler 상세
|
|
59
|
+
|
|
60
|
+
### `SdTsCompiler`
|
|
61
|
+
|
|
62
|
+
TypeScript AOT 컴파일러. Angular 패키지와 일반 TypeScript 패키지 모두 지원하며 증분 빌드, lint 통합, SCSS 컴파일을 관리한다.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
export class SdTsCompiler {
|
|
66
|
+
constructor(options: ISdTsCompilerOptions);
|
|
67
|
+
|
|
68
|
+
async compileAsync(
|
|
69
|
+
modifiedFiles?: ReadonlySet<string>,
|
|
70
|
+
emitOptions?: ISdTsCompilerEmitOptions,
|
|
71
|
+
): Promise<ISdTsCompilerResult>;
|
|
72
|
+
|
|
73
|
+
compileSideEffectScss(): void;
|
|
74
|
+
|
|
75
|
+
findAffectedByScss(scssPath: string): string[];
|
|
76
|
+
|
|
77
|
+
get sideEffectScssRegistry(): Map<string, SideEffectScssEntry>;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Method | Description |
|
|
82
|
+
|--------|-------------|
|
|
83
|
+
| `compileAsync()` | TypeScript 컴파일 실행. modifiedFiles 지정 시 증분 빌드 수행. emitOptions로 emit 방식 제어 |
|
|
84
|
+
| `compileSideEffectScss()` | sideEffectScssRegistry의 모든 항목을 SCSS로 컴파일 |
|
|
85
|
+
| `findAffectedByScss()` | SCSS 경로에 의존하는 TypeScript 파일 목록 반환 (watch 역방향 추적용) |
|
|
86
|
+
| `sideEffectScssRegistry` | getter. Angular component @Component.styles 항목 저장소 |
|
|
87
|
+
|
|
88
|
+
### `ISdTsCompilerOptions`
|
|
89
|
+
|
|
90
|
+
SdTsCompiler 생성 옵션.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
export interface ISdTsCompilerOptions {
|
|
94
|
+
pkgDir: string;
|
|
95
|
+
cwd: string;
|
|
96
|
+
output: { js: boolean; dts: boolean };
|
|
97
|
+
includeTests?: boolean;
|
|
98
|
+
env?: TypecheckEnv;
|
|
99
|
+
sourceFileCache?: AngularSourceFileCache;
|
|
100
|
+
transformStylesheet?: (data: string, containingFile: string, stylesheetFile?: string) => Promise<string | null>;
|
|
101
|
+
externalStylesheets?: Map<string, string>;
|
|
102
|
+
compilerOptionsTransformer?: (options: ts.CompilerOptions) => ts.CompilerOptions;
|
|
103
|
+
lint?: boolean;
|
|
104
|
+
globalScss?: boolean;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Field | Type | Description |
|
|
109
|
+
|-------|------|-------------|
|
|
110
|
+
| `pkgDir` | `string` | 패키지 디렉토리 (절대 경로) |
|
|
111
|
+
| `cwd` | `string` | workspace 루트 (diagnostics 필터링 등에 사용) |
|
|
112
|
+
| `output` | `{ js: boolean; dts: boolean }` | emit 제어: js (JavaScript emit), dts (타입 선언 emit) |
|
|
113
|
+
| `includeTests` | `boolean?` | tests/ 파일을 rootNames에 포함할지 여부 (기본값: false) |
|
|
114
|
+
| `env` | `TypecheckEnv?` | 타입체크 환경. 설정 시 getCompilerOptionsForEnv() 적용 |
|
|
115
|
+
| `sourceFileCache` | `AngularSourceFileCache?` | Angular 증분 빌드용 SourceFile 캐시. 미제공 시 내부 생성 |
|
|
116
|
+
| `transformStylesheet` | `(data: string, containingFile: string, stylesheetFile?: string) => Promise<string \| null>?` | 스타일시트 변환 콜백 (Angular only) |
|
|
117
|
+
| `externalStylesheets` | `Map<string, string>?` | 외부 스타일시트 맵 (클라이언트 빌드용, resourceNameToFileName에서 사용) |
|
|
118
|
+
| `compilerOptionsTransformer` | `(options: ts.CompilerOptions) => ts.CompilerOptions?` | compilerOptions 후처리 (클라이언트의 target/module 강제 등) |
|
|
119
|
+
| `lint` | `boolean?` | lint 실행 여부. true이면 compileAsync 결과에 lint 결과 포함 |
|
|
120
|
+
| `globalScss` | `boolean?` | 글로벌 SCSS 컴파일 여부. true이면 scss/styles.scss → dist/styles.css 생성 |
|
|
121
|
+
|
|
122
|
+
### `ISdTsCompilerEmitOptions`
|
|
123
|
+
|
|
124
|
+
compileAsync()의 emit 옵션. Angular 컴파일러만 지원.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
export interface ISdTsCompilerEmitOptions {
|
|
128
|
+
sourceFilter?: (fileName: string) => boolean;
|
|
129
|
+
additionalTransformers?: {
|
|
130
|
+
before?: ts.TransformerFactory<ts.SourceFile>[];
|
|
131
|
+
after?: ts.TransformerFactory<ts.SourceFile>[];
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
| Field | Type | Description |
|
|
137
|
+
|-------|------|-------------|
|
|
138
|
+
| `sourceFilter` | `(fileName: string) => boolean?` | emit 대상 소스 필터 (지정 시 해당 파일만 EmitResult에 포함). Angular only |
|
|
139
|
+
| `additionalTransformers` | `{ before?: ts.TransformerFactory<ts.SourceFile>[]; after?: ts.TransformerFactory<ts.SourceFile>[]; }?` | Angular transformers 외 추가 transformers. Angular only |
|
|
140
|
+
|
|
141
|
+
### `ISdTsCompilerResult`
|
|
142
|
+
|
|
143
|
+
compileAsync() 반환 타입.
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
export interface ISdTsCompilerResult {
|
|
147
|
+
program: ts.Program;
|
|
148
|
+
builderProgram: ts.EmitAndSemanticDiagnosticsBuilderProgram;
|
|
149
|
+
isForAngular: boolean;
|
|
150
|
+
affectedFiles: ReadonlySet<string> | undefined;
|
|
151
|
+
diagnostics: SerializedDiagnostic[];
|
|
152
|
+
errorCount: number;
|
|
153
|
+
warningCount: number;
|
|
154
|
+
errors?: string[];
|
|
155
|
+
ngtscProgram?: NgtscProgram;
|
|
156
|
+
emitResults?: EmitResult[];
|
|
157
|
+
lint?: LintWithProgramResult;
|
|
158
|
+
scssErrors: string[];
|
|
159
|
+
scssDependencies: ReadonlyMap<string, ReadonlySet<string>>;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Field | Type | Description |
|
|
164
|
+
|-------|------|-------------|
|
|
165
|
+
| `program` | `ts.Program` | TypeScript Program 참조 (lint, 외부 도구용) |
|
|
166
|
+
| `builderProgram` | `ts.EmitAndSemanticDiagnosticsBuilderProgram` | Builder Program 참조 (증분 빌드 상태) |
|
|
167
|
+
| `isForAngular` | `boolean` | Angular 패키지 여부 (tsconfig.json에 angularCompilerOptions 존재) |
|
|
168
|
+
| `affectedFiles` | `ReadonlySet<string> \| undefined` | 이 빌드에서 영향받은 파일 (posix 경로). undefined = 전역 변경 (전체 리빌드) |
|
|
169
|
+
| `diagnostics` | `SerializedDiagnostic[]` | 직렬화된 진단 정보 (Worker 경계 통과용) |
|
|
170
|
+
| `errorCount` | `number` | Error 카테고리 진단 수 |
|
|
171
|
+
| `warningCount` | `number` | Warning 카테고리 진단 수 |
|
|
172
|
+
| `errors` | `string[]?` | Error 카테고리 진단을 "파일:줄:열: TS코드: 메시지" 형식으로 포맷한 배열 |
|
|
173
|
+
| `ngtscProgram` | `NgtscProgram?` | NgtscProgram 참조 (Angular only, HMR용). Non-Angular이면 undefined |
|
|
174
|
+
| `emitResults` | `EmitResult[]?` | Angular emit 결과 (Non-Angular이면 undefined — writeFile 훅으로 디스크 직접 쓰기) |
|
|
175
|
+
| `lint` | `LintWithProgramResult?` | lint 결과 (lint 옵션 활성 시) |
|
|
176
|
+
| `scssErrors` | `string[]` | SCSS 컴파일 에러 목록 |
|
|
177
|
+
| `scssDependencies` | `ReadonlyMap<string, ReadonlySet<string>>` | SCSS 의존성 맵 (소유자 파일 → 의존 SCSS 경로 집합). watch 역방향 탐색용 |
|
|
178
|
+
|
|
50
179
|
## Config 상세
|
|
51
180
|
|
|
52
181
|
### `NpmConfig`
|
|
@@ -407,7 +536,7 @@ export interface SdClientPackageConfig {
|
|
|
407
536
|
| `capacitor` | `SdCapacitorConfig?` | Capacitor 설정 |
|
|
408
537
|
| `electron` | `SdElectronConfig?` | Electron 설정 |
|
|
409
538
|
| `configs` | `Record<string, unknown>?` | 런타임 설정 (빌드 시 dist/.config.json으로 기록) |
|
|
410
|
-
| `exclude` | `string[]?` |
|
|
539
|
+
| `exclude` | `string[]?` | Capacitor/Electron package.json에 추가할 패키지 |
|
|
411
540
|
| `browserSupport` | `SdBrowserSupportConfig?` | 브라우저 지원 설정 |
|
|
412
541
|
| `pwa` | `false \| SdPwaConfig?` | PWA 설정. false이면 비활성화. 미지정 시 기본값으로 활성화 |
|
|
413
542
|
|
|
@@ -572,6 +701,52 @@ Vite 훅: `config` (pkgDir 초기화), `watchChange` (파일 변경 추적), `bu
|
|
|
572
701
|
|
|
573
702
|
## Usage Examples
|
|
574
703
|
|
|
704
|
+
### SdTsCompiler를 사용한 TypeScript 컴파일
|
|
705
|
+
|
|
706
|
+
```typescript
|
|
707
|
+
import { SdTsCompiler } from "@simplysm/sd-cli";
|
|
708
|
+
|
|
709
|
+
const compiler = new SdTsCompiler({
|
|
710
|
+
pkgDir: "/workspace/packages/my-lib",
|
|
711
|
+
cwd: "/workspace",
|
|
712
|
+
output: { js: true, dts: true },
|
|
713
|
+
lint: true,
|
|
714
|
+
globalScss: true,
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// 초기 컴파일
|
|
718
|
+
const result = await compiler.compileAsync();
|
|
719
|
+
|
|
720
|
+
if (result.errors) {
|
|
721
|
+
console.error("Compilation errors:", result.errors);
|
|
722
|
+
process.exit(1);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
console.log(`Compiled ${result.affectedFiles?.size ?? "all"} files`);
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
### watch 모드에서 증분 컴파일
|
|
729
|
+
|
|
730
|
+
```typescript
|
|
731
|
+
import { SdTsCompiler } from "@simplysm/sd-cli";
|
|
732
|
+
|
|
733
|
+
const compiler = new SdTsCompiler({
|
|
734
|
+
pkgDir: "/workspace/packages/my-lib",
|
|
735
|
+
cwd: "/workspace",
|
|
736
|
+
output: { js: true, dts: true },
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
// 초기 컴파일
|
|
740
|
+
let result = await compiler.compileAsync();
|
|
741
|
+
|
|
742
|
+
// 파일 변경 감지 시 증분 컴파일
|
|
743
|
+
const changedFiles = new Set(["/workspace/packages/my-lib/src/foo.ts"]);
|
|
744
|
+
result = await compiler.compileAsync(changedFiles);
|
|
745
|
+
|
|
746
|
+
// SCSS 의존성이 변경된 TS 파일 찾기
|
|
747
|
+
const affectedByScss = compiler.findAffectedByScss("/workspace/packages/my-lib/scss/variables.scss");
|
|
748
|
+
```
|
|
749
|
+
|
|
575
750
|
### sd.config.ts 작성
|
|
576
751
|
|
|
577
752
|
```typescript
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @simplysm/service-client
|
|
2
2
|
|
|
3
|
-
WebSocket 기반 서비스 서버
|
|
3
|
+
WebSocket 기반 서비스 서버 클라이언트로, 서비스 호출, 실시간 이벤트 구독/발행, 파일 업로드/다운로드, ORM 원격 실행을 지원한다.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,118 +10,142 @@ npm install @simplysm/service-client
|
|
|
10
10
|
|
|
11
11
|
## API Overview
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Core Client
|
|
14
14
|
|
|
15
15
|
| API | Type | Description |
|
|
16
16
|
|-----|------|-------------|
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `isWorkerSupported` | function | Web Worker API 지원 여부 확인 |
|
|
21
|
-
| `createBrowserWorker` | function | Web Worker 생성 (미지원 환경이면 undefined 반환) |
|
|
22
|
-
| `ServiceConnectionOptions` | interface | 서비스 연결 옵션 (host, port, ssl, maxReconnectCount) |
|
|
23
|
-
| `ServiceProgress` | interface | 요청/응답/서버 progress 콜백 컨테이너 |
|
|
24
|
-
| `ServiceProgressState` | interface | progress 상태 (uuid, totalSize, completedSize) |
|
|
17
|
+
| `ServiceClient` | class | WebSocket 서비스 클라이언트 최상위 파사드 (연결, RPC, 이벤트, 파일, ORM 통합) |
|
|
18
|
+
| `createServiceClient()` | function | ServiceClient 인스턴스 생성 팩토리 함수 |
|
|
19
|
+
| `ServiceProxy<T>` | type | 서비스 메서드 반환 타입을 Promise로 래핑하는 타입 변환기 |
|
|
25
20
|
|
|
26
|
-
→ See [docs/
|
|
21
|
+
→ See [docs/main.md](./docs/main.md) for details.
|
|
27
22
|
|
|
28
|
-
### Transport
|
|
23
|
+
### Transport Layer
|
|
29
24
|
|
|
30
25
|
| API | Type | Description |
|
|
31
26
|
|-----|------|-------------|
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
27
|
+
| `SocketProvider` | interface | WebSocket 래퍼 인터페이스 (connect, close, send, on, off, heartbeat) |
|
|
28
|
+
| `createSocketProvider()` | function | SocketProvider 팩토리. 재연결 및 하트비트 관리 |
|
|
29
|
+
| `SocketProviderEvents` | interface | SocketProvider 이벤트 맵 (message, state) |
|
|
30
|
+
| `ServiceTransport` | interface | 요청-응답 매핑, progress 중계, 이벤트 디스패치 |
|
|
31
|
+
| `createServiceTransport()` | function | ServiceTransport 팩토리. SocketProvider와 ClientProtocolWrapper 조합 |
|
|
32
|
+
| `ServiceTransportEvents` | interface | ServiceTransport 이벤트 맵 (event) |
|
|
38
33
|
|
|
39
34
|
→ See [docs/transport.md](./docs/transport.md) for details.
|
|
40
35
|
|
|
41
|
-
### Protocol
|
|
36
|
+
### Protocol & Encoding
|
|
42
37
|
|
|
43
38
|
| API | Type | Description |
|
|
44
39
|
|-----|------|-------------|
|
|
45
|
-
| `ClientProtocolWrapper` | interface | 인코딩/디코딩
|
|
46
|
-
| `createClientProtocolWrapper` | function | ClientProtocolWrapper 팩토리. ServiceProtocol
|
|
40
|
+
| `ClientProtocolWrapper` | interface | 메시지 인코딩/디코딩 (30KB 이상 시 Web Worker 오프로드) |
|
|
41
|
+
| `createClientProtocolWrapper()` | function | ClientProtocolWrapper 팩토리. ServiceProtocol 래핑 |
|
|
47
42
|
|
|
48
43
|
→ See [docs/protocol.md](./docs/protocol.md) for details.
|
|
49
44
|
|
|
50
|
-
###
|
|
45
|
+
### Event Management
|
|
51
46
|
|
|
52
47
|
| API | Type | Description |
|
|
53
48
|
|-----|------|-------------|
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `FileClient` | interface | 파일 업로드(POST)/다운로드(GET) 인터페이스 |
|
|
58
|
-
| `createFileClient` | function | FileClient 팩토리. hostUrl과 clientName으로 생성 |
|
|
59
|
-
| `OrmConnectOptions` | interface | ORM 연결 옵션 (DbClass, connOpt, dbContextOpt) |
|
|
60
|
-
| `OrmClientConnector` | interface | DbContext 트랜잭션 연결 헬퍼 인터페이스 |
|
|
61
|
-
| `createOrmClientConnector` | function | OrmClientConnector 팩토리. ServiceClient를 사용 |
|
|
62
|
-
| `OrmClientDbContextExecutor` | class | DbContextExecutor 구현체 (서버로 원격 호출) |
|
|
49
|
+
| `EventClient` | interface | 서버 이벤트 구독/발행 관리 (재연결 시 자동 재구독) |
|
|
50
|
+
| `createEventClient()` | function | EventClient 팩토리. ServiceTransport 사용 |
|
|
51
|
+
| `ClientEventProxy<T>` | interface | 특정 이벤트에 대한 프록시 인터페이스 |
|
|
63
52
|
|
|
64
53
|
→ See [docs/features.md](./docs/features.md) for details.
|
|
65
54
|
|
|
66
|
-
###
|
|
55
|
+
### File Operations
|
|
67
56
|
|
|
68
57
|
| API | Type | Description |
|
|
69
58
|
|-----|------|-------------|
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `createServiceClient` | function | ServiceClient 팩토리 함수 |
|
|
59
|
+
| `FileClient` | interface | 파일 업로드(POST)/다운로드(GET) 인터페이스 |
|
|
60
|
+
| `createFileClient()` | function | FileClient 팩토리. hostUrl과 clientName으로 생성 |
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
### ORM Remote Execution
|
|
63
|
+
|
|
64
|
+
| API | Type | Description |
|
|
65
|
+
|-----|------|-------------|
|
|
66
|
+
| `OrmClientConnector` | interface | DbContext 원격 트랜잭션 연결 헬퍼 |
|
|
67
|
+
| `createOrmClientConnector()` | function | OrmClientConnector 팩토리. ServiceClient 사용 |
|
|
68
|
+
| `OrmConnectOptions<T>` | interface | ORM 연결 설정 (DbClass, connOpt, dbContextOpt) |
|
|
69
|
+
| `OrmClientDbContextExecutor` | class | DbContextExecutor 구현체 (서버로 원격 호출) |
|
|
70
|
+
|
|
71
|
+
### Types & Utilities
|
|
72
|
+
|
|
73
|
+
| API | Type | Description |
|
|
74
|
+
|-----|------|-------------|
|
|
75
|
+
| `ServiceConnectionOptions` | interface | 서버 연결 옵션 (host, port, ssl, maxReconnectCount) |
|
|
76
|
+
| `ServiceProgress` | interface | progress 콜백 인터페이스 (request, response, server) |
|
|
77
|
+
| `ServiceProgressState` | interface | progress 상태 (uuid, totalSize, completedSize) |
|
|
78
|
+
| `BlobInput` | type | Blob \| Uint8Array \| ArrayBuffer \| string (Blob 생성자 허용 타입) |
|
|
79
|
+
| `FileCollection` | interface | FileList 호환 컬렉션 인터페이스 |
|
|
80
|
+
| `WorkerLike` | interface | Web Worker 호환 인터페이스 |
|
|
81
|
+
| `isWorkerSupported()` | function | Web Worker 지원 여부 확인 |
|
|
82
|
+
| `createBrowserWorker()` | function | Web Worker 인스턴스 생성 (미지원 환경이면 undefined) |
|
|
83
|
+
|
|
84
|
+
→ See [docs/types.md](./docs/types.md) for details.
|
|
75
85
|
|
|
76
86
|
## Usage Examples
|
|
77
87
|
|
|
78
|
-
###
|
|
88
|
+
### Basic Service Connection & RPC
|
|
79
89
|
|
|
80
90
|
```typescript
|
|
81
|
-
import {
|
|
91
|
+
import { createServiceClient } from "@simplysm/service-client";
|
|
82
92
|
|
|
83
|
-
const client =
|
|
93
|
+
const client = createServiceClient("my-app", {
|
|
84
94
|
host: "localhost",
|
|
85
95
|
port: 3000,
|
|
86
96
|
ssl: false,
|
|
97
|
+
maxReconnectCount: 10, // 자동 재연결 (0으로 비활성화)
|
|
87
98
|
});
|
|
88
99
|
|
|
89
100
|
await client.connect();
|
|
90
|
-
await client.auth("
|
|
101
|
+
await client.auth("jwt-token");
|
|
91
102
|
|
|
92
103
|
// 타입 안전한 서비스 프록시
|
|
93
104
|
const userSvc = client.getService<UserService>("User");
|
|
94
|
-
const users = await userSvc.
|
|
105
|
+
const users = await userSvc.getAll();
|
|
95
106
|
|
|
96
107
|
await client.close();
|
|
97
108
|
```
|
|
98
109
|
|
|
99
|
-
###
|
|
110
|
+
### Event Subscription
|
|
100
111
|
|
|
101
112
|
```typescript
|
|
102
|
-
|
|
113
|
+
// 이벤트 리스너 등록 (selector로 필터링)
|
|
114
|
+
const listenerId = await client.addListener(
|
|
115
|
+
"user:created",
|
|
116
|
+
{ userId: 123 }, // info selector (서버와 공유되는 필터 정보)
|
|
117
|
+
async (data) => {
|
|
118
|
+
console.log("새 사용자:", data.name);
|
|
119
|
+
},
|
|
120
|
+
);
|
|
103
121
|
|
|
104
|
-
//
|
|
105
|
-
|
|
122
|
+
// 이벤트 발행 (특정 selector에 매칭하는 리스너에만 전송)
|
|
123
|
+
await client.emitEvent(
|
|
124
|
+
"user:created",
|
|
125
|
+
(info) => info.userId === 123,
|
|
126
|
+
{ name: "Alice", email: "alice@example.com" },
|
|
127
|
+
);
|
|
106
128
|
|
|
107
|
-
//
|
|
108
|
-
|
|
129
|
+
// 리스너 제거
|
|
130
|
+
await client.removeListener(listenerId);
|
|
131
|
+
```
|
|
109
132
|
|
|
110
|
-
|
|
111
|
-
const chatEvt = client.getEvent<typeof ChatEvent>("Chat");
|
|
112
|
-
const key = await chatEvt.addListener({ roomId: "room-1" }, async (data) => {
|
|
113
|
-
// data.message는 string으로 타입 추론
|
|
114
|
-
});
|
|
115
|
-
await chatEvt.removeListener(key);
|
|
133
|
+
### File Upload & Download
|
|
116
134
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
})
|
|
121
|
-
|
|
135
|
+
```typescript
|
|
136
|
+
// 파일 업로드 (인증 필수)
|
|
137
|
+
const files = [
|
|
138
|
+
new File(["content"], "file.txt", { type: "text/plain" }),
|
|
139
|
+
];
|
|
140
|
+
const results = await client.uploadFile(files);
|
|
141
|
+
console.log("업로드 결과:", results);
|
|
142
|
+
|
|
143
|
+
// 파일 다운로드
|
|
144
|
+
const buffer = await client.downloadFileBuffer("/uploaded/file.txt");
|
|
145
|
+
console.log("다운로드 바이트:", buffer.length);
|
|
122
146
|
```
|
|
123
147
|
|
|
124
|
-
### ORM
|
|
148
|
+
### ORM Remote Execution
|
|
125
149
|
|
|
126
150
|
```typescript
|
|
127
151
|
import { createOrmClientConnector } from "@simplysm/service-client";
|
|
@@ -129,9 +153,50 @@ import { createOrmClientConnector } from "@simplysm/service-client";
|
|
|
129
153
|
const connector = createOrmClientConnector(client);
|
|
130
154
|
|
|
131
155
|
const result = await connector.connect(
|
|
132
|
-
{
|
|
156
|
+
{
|
|
157
|
+
DbClass: MyDbContext,
|
|
158
|
+
connOpt: { configName: "main", username: "user", password: "pass" },
|
|
159
|
+
},
|
|
133
160
|
async (db) => {
|
|
134
|
-
return db.
|
|
161
|
+
return db.users.select().execute();
|
|
135
162
|
},
|
|
136
163
|
);
|
|
164
|
+
|
|
165
|
+
console.log("조회 결과:", result);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Progress Tracking
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
const progress = {
|
|
172
|
+
request: (state) => {
|
|
173
|
+
console.log(`요청 전송: ${state.completedSize}/${state.totalSize} bytes`);
|
|
174
|
+
},
|
|
175
|
+
response: (state) => {
|
|
176
|
+
console.log(`응답 수신: ${state.completedSize}/${state.totalSize} bytes`);
|
|
177
|
+
},
|
|
178
|
+
server: (state) => {
|
|
179
|
+
console.log(`서버 처리: ${state.completedSize}/${state.totalSize}`);
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
await client.send("Service", "method", [arg1, arg2], progress);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Connection State & Events
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// 연결 상태 모니터링
|
|
190
|
+
client.on("state", (state) => {
|
|
191
|
+
console.log("연결 상태:", state); // "connected" | "closed" | "reconnecting"
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
client.on("request-progress", (state) => {
|
|
195
|
+
console.log(`요청 진행: ${state.completedSize}/${state.totalSize}`);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// 연결 확인
|
|
199
|
+
if (client.connected) {
|
|
200
|
+
console.log("서버에 연결됨");
|
|
201
|
+
}
|
|
137
202
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @simplysm/service-common
|
|
2
2
|
|
|
3
|
-
서비스 클라이언트와 서버가 공유하는 프로토콜, 메시지 타입, 서비스 인터페이스, 앱 구조 정의 패키지.
|
|
3
|
+
서비스 클라이언트와 서버가 공유하는 바이너리 프로토콜, 메시지 타입, 서비스 인터페이스, 앱 구조 정의 패키지.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -15,23 +15,23 @@ npm install @simplysm/service-common
|
|
|
15
15
|
| API | Type | Description |
|
|
16
16
|
|-----|------|-------------|
|
|
17
17
|
| `PROTOCOL_CONFIG` | const | 프로토콜 설정 상수 (최대 크기, 청킹 임계값, 청크 크기, GC 주기, 만료 시간) |
|
|
18
|
-
| `ServiceMessage` | type |
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `ServiceProgressMessage` | interface | 청크 수신 진행 상태 알림
|
|
23
|
-
| `ServiceErrorMessage` | interface | 서버 에러 알림
|
|
18
|
+
| `ServiceMessage` | type | 양방향 메시지의 유니언 타입 |
|
|
19
|
+
| `ServiceClientMessage` | type | 클라이언트 → 서버 메시지 유니언 |
|
|
20
|
+
| `ServiceServerMessage` | type | 서버 → 클라이언트 메시지 유니언 |
|
|
21
|
+
| `ServiceServerRawMessage` | type | 진행 상태를 포함한 서버 메시지 유니언 |
|
|
22
|
+
| `ServiceProgressMessage` | interface | 청크 수신 진행 상태 알림 |
|
|
23
|
+
| `ServiceErrorMessage` | interface | 서버 에러 알림 |
|
|
24
24
|
| `ServiceAuthMessage` | interface | 클라이언트 인증 메시지 (토큰) |
|
|
25
|
-
| `ServiceRequestMessage` | interface | 서비스 메서드 요청
|
|
26
|
-
| `ServiceResponseMessage` | interface | 서비스 메서드 응답
|
|
27
|
-
| `ServiceAddEventListenerMessage` | interface | 이벤트 리스너 추가
|
|
28
|
-
| `ServiceRemoveEventListenerMessage` | interface | 이벤트 리스너 제거
|
|
29
|
-
| `ServiceGetEventListenerInfosMessage` | interface | 이벤트 리스너 정보 목록 요청
|
|
30
|
-
| `ServiceEmitEventMessage` | interface | 이벤트 발생
|
|
31
|
-
| `ServiceEventMessage` | interface | 서버 이벤트 알림
|
|
32
|
-
| `ServiceProtocol` | interface | 바이너리 프로토콜 인코더/디코더
|
|
33
|
-
| `ServiceMessageDecodeResult` | type | 디코딩 결과 (complete
|
|
34
|
-
| `createServiceProtocol` | function | ServiceProtocol 인스턴스 팩토리
|
|
25
|
+
| `ServiceRequestMessage` | interface | 서비스 메서드 요청 |
|
|
26
|
+
| `ServiceResponseMessage` | interface | 서비스 메서드 응답 |
|
|
27
|
+
| `ServiceAddEventListenerMessage` | interface | 이벤트 리스너 추가 요청 |
|
|
28
|
+
| `ServiceRemoveEventListenerMessage` | interface | 이벤트 리스너 제거 요청 |
|
|
29
|
+
| `ServiceGetEventListenerInfosMessage` | interface | 이벤트 리스너 정보 목록 요청 |
|
|
30
|
+
| `ServiceEmitEventMessage` | interface | 이벤트 발생 요청 |
|
|
31
|
+
| `ServiceEventMessage` | interface | 서버 이벤트 알림 |
|
|
32
|
+
| `ServiceProtocol` | interface | 바이너리 프로토콜 인코더/디코더 |
|
|
33
|
+
| `ServiceMessageDecodeResult` | type | 디코딩 결과 유니언 (complete \| progress) |
|
|
34
|
+
| `createServiceProtocol` | function | ServiceProtocol 인스턴스 생성 팩토리 |
|
|
35
35
|
|
|
36
36
|
→ See [docs/protocol.md](./docs/protocol.md) for details.
|
|
37
37
|
|
|
@@ -39,10 +39,10 @@ npm install @simplysm/service-common
|
|
|
39
39
|
|
|
40
40
|
| API | Type | Description |
|
|
41
41
|
|-----|------|-------------|
|
|
42
|
-
| `OrmService` | interface | DB 연결,
|
|
43
|
-
| `DbConnOptions` | type |
|
|
44
|
-
| `AutoUpdateService` | interface | 클라이언트 최신 버전
|
|
45
|
-
| `AppStructureService` | interface |
|
|
42
|
+
| `OrmService` | interface | DB 연결, 트랜잭션, 쿼리 실행 서비스 인터페이스 |
|
|
43
|
+
| `DbConnOptions` | type | DB 연결 옵션 타입 |
|
|
44
|
+
| `AutoUpdateService` | interface | 클라이언트 최신 버전 조회 서비스 인터페이스 |
|
|
45
|
+
| `AppStructureService` | interface | 앱 구조 항목 조회 서비스 인터페이스 |
|
|
46
46
|
|
|
47
47
|
→ See [docs/service-types.md](./docs/service-types.md) for details.
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ npm install @simplysm/service-common
|
|
|
50
50
|
|
|
51
51
|
| API | Type | Description |
|
|
52
52
|
|-----|------|-------------|
|
|
53
|
-
| `ServiceUploadResult` | interface | 파일 업로드 결과
|
|
53
|
+
| `ServiceUploadResult` | interface | 파일 업로드 결과 |
|
|
54
54
|
|
|
55
55
|
→ See [docs/types.md](./docs/types.md) for details.
|
|
56
56
|
|
|
@@ -58,14 +58,14 @@ npm install @simplysm/service-common
|
|
|
58
58
|
|
|
59
59
|
| API | Type | Description |
|
|
60
60
|
|-----|------|-------------|
|
|
61
|
-
| `AppStructureItem` | type | 앱 구조 항목
|
|
61
|
+
| `AppStructureItem` | type | 앱 구조 항목 (그룹 또는 리프) |
|
|
62
62
|
| `AppStructureGroupItem` | interface | 자식을 가진 그룹 메뉴 항목 |
|
|
63
63
|
| `AppStructureLeafItem` | interface | 말단 메뉴 항목 (권한, URL 포함) |
|
|
64
64
|
| `AppStructureSubPermission` | interface | 리프 항목의 하위 권한 정의 |
|
|
65
|
-
| `FlatPermission` | interface |
|
|
66
|
-
| `isUsableModules` | function | 모듈 접근 가능 여부 판단
|
|
65
|
+
| `FlatPermission` | interface | 플래트닝된 권한 결과 |
|
|
66
|
+
| `isUsableModules` | function | 개별 항목의 모듈 접근 가능 여부 판단 |
|
|
67
67
|
| `isUsableModulesChain` | function | 모듈 체인 전체의 접근 가능 여부 판단 |
|
|
68
|
-
| `getFlatPermissions` | function | 앱 구조 트리를
|
|
68
|
+
| `getFlatPermissions` | function | 앱 구조 트리를 플래트닝하여 권한 배열 반환 |
|
|
69
69
|
|
|
70
70
|
→ See [docs/app-structure.md](./docs/app-structure.md) for details.
|
|
71
71
|
|
|
@@ -73,8 +73,8 @@ npm install @simplysm/service-common
|
|
|
73
73
|
|
|
74
74
|
| API | Type | Description |
|
|
75
75
|
|-----|------|-------------|
|
|
76
|
-
| `ServiceEventDef` | interface |
|
|
77
|
-
| `defineEvent` | function | 타입
|
|
76
|
+
| `ServiceEventDef` | interface | 타입 안전 이벤트 정의 인터페이스 |
|
|
77
|
+
| `defineEvent` | function | 타입 안전 이벤트를 정의하는 팩토리 함수 |
|
|
78
78
|
|
|
79
79
|
→ See [docs/events.md](./docs/events.md) for details.
|
|
80
80
|
|