@gaonjs/config 0.5.4 → 0.7.0

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/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { defineConfig, defineAppConfig, type GaonConfig, type AppConfig, type Ap
2
2
  export { loadGaonConfig, findConfigPath } from './load.js';
3
3
  export { resolveApps, toAppSpec, type DiscoveredApp, } from './apps.js';
4
4
  export { wireGaon, type WiredGaon } from './wire.js';
5
+ export { connectTestDatabase, type TestDbHandle } from './testkit.js';
package/dist/index.js CHANGED
@@ -10,3 +10,5 @@ export { defineConfig, defineAppConfig, } from './types.js';
10
10
  export { loadGaonConfig, findConfigPath } from './load.js';
11
11
  export { resolveApps, toAppSpec, } from './apps.js';
12
12
  export { wireGaon } from './wire.js';
13
+ // 테스트 DB 배선 (결정 111 · gaon test 격리)
14
+ export { connectTestDatabase } from './testkit.js';
@@ -0,0 +1,9 @@
1
+ export interface TestDbHandle {
2
+ /** 등록한 모든 커넥션을 종료한다(afterAll 에서 호출). */
3
+ close(): Promise<void>;
4
+ }
5
+ /**
6
+ * 테스트용 DB 커넥션을 등록한다(결정 111). 각 커넥션을 `<db>_test` 로 파생해
7
+ * poolMax:1 로 붙인다. 반환값의 close() 를 afterAll 에서 호출해 정리한다.
8
+ */
9
+ export declare function connectTestDatabase(cwd?: string): Promise<TestDbHandle>;
@@ -0,0 +1,28 @@
1
+ // @gaonjs/config · 테스트 DB 커넥션 배선 (결정 111)
2
+ //
3
+ // gaon.config 의 각 커넥션을 `<db>_test` 로 파생해 등록한다 — `gaon test` 가 미리
4
+ // 만들어 마이그레이션한 그 DB 다. 스캐폴드 `test/setup.ts` 가 부트스트랩으로 쓰고,
5
+ // 매 테스트 뒤 `truncateAll()` 로 격리한다(§9 실 인프라 · 근거는 결정 111).
6
+ //
7
+ // wireGaon 과 달리 Redis·NATS·mail 은 배선하지 않는다 — DB 격리만 담당한다.
8
+ import { loadGaonConfig } from './load.js';
9
+ import { createDb, registerConnection, deriveTestDatabaseConfig, destroyAllConnections, } from '@gaonjs/data';
10
+ /**
11
+ * 테스트용 DB 커넥션을 등록한다(결정 111). 각 커넥션을 `<db>_test` 로 파생해
12
+ * poolMax:1 로 붙인다. 반환값의 close() 를 afterAll 에서 호출해 정리한다.
13
+ */
14
+ export async function connectTestDatabase(cwd = process.cwd()) {
15
+ const config = await loadGaonConfig(cwd);
16
+ if (config.db) {
17
+ for (const [key, cfg] of Object.entries(config.db)) {
18
+ const base = cfg;
19
+ const testCfg = deriveTestDatabaseConfig({ ...base, poolMax: 1 });
20
+ registerConnection(key, createDb(testCfg), base.adapter);
21
+ }
22
+ }
23
+ return {
24
+ close: async () => {
25
+ await destroyAllConnections();
26
+ },
27
+ };
28
+ }
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ConnectionConfig } from '@gaonjs/data';
2
+ import type { SecurityOptions } from '@gaonjs/web';
2
3
  import type { AuthOptions, JwtAuthOptions } from '@gaonjs/web';
3
4
  /**
4
5
  * DB 커넥션 맵 — 키는 커넥션 이름(§4.5), 값은 어댑터 설정. `main` 은 관례
@@ -74,6 +75,12 @@ export interface WebConfig {
74
75
  readonly cookieSecret?: string;
75
76
  /** Inertia 에셋 버전. 생략 시 이 프로세스의 시작 시각(개발 편의). */
76
77
  readonly assetsVersion?: string;
78
+ /**
79
+ * 보안 기본값 조정(CORS·rate limit·보안 헤더). 생략 시 코어 기본값(전부 켬 ·
80
+ * CLAUDE.md 규칙 8). `{ rateLimit: false }` 처럼 개별 항목을 끌 수 있다 — 끄는
81
+ * 것은 반드시 명시적으로. 예: 프록시/로드밸런서 뒤에서 rate limit 을 재조정.
82
+ */
83
+ readonly security?: SecurityOptions;
77
84
  }
78
85
  /** 루트 설정 — gaon.config.ts 의 defineConfig 인자. */
79
86
  export interface GaonConfig {
package/dist/wire.js CHANGED
@@ -138,6 +138,8 @@ export async function wireGaon(config, cwd = process.cwd()) {
138
138
  apps: specs,
139
139
  version: config.web?.assetsVersion,
140
140
  cookieSecret: config.web?.cookieSecret,
141
+ // 보안 기본값 조정(생략 시 코어 기본값 전부 켬 · CLAUDE.md 규칙 8).
142
+ security: config.web?.security,
141
143
  realtime: nats ? { nats, hubAddr: config.hub?.addr, heartbeatMs: config.hub?.heartbeatMs } : undefined,
142
144
  };
143
145
  const app = await createApp(opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaonjs/config",
3
- "version": "0.5.4",
3
+ "version": "0.7.0",
4
4
  "description": "Gaon 루트 설정 로더·자동 배선 (gaon.config.ts · §3.3 · M9-A)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,12 +26,12 @@
26
26
  "dependencies": {
27
27
  "ioredis": "^5.4.1",
28
28
  "@gaonjs/async": "0.6.1",
29
- "@gaonjs/data": "0.10.0",
29
+ "@gaonjs/mail": "0.1.3",
30
30
  "@gaonjs/core": "0.2.1",
31
- "@gaonjs/storage": "0.1.2",
31
+ "@gaonjs/data": "0.12.0",
32
32
  "@gaonjs/i18n": "0.1.2",
33
- "@gaonjs/mail": "0.1.3",
34
- "@gaonjs/web": "0.7.2"
33
+ "@gaonjs/storage": "0.1.2",
34
+ "@gaonjs/web": "0.9.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "fastify": "^5.0.0"