@gaonjs/config 0.2.0 → 0.3.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/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ConnectionConfig } from '@gaonjs/data';
2
+ import type { AuthOptions, JwtAuthOptions } from '@gaonjs/web';
2
3
  /**
3
4
  * DB 커넥션 맵 — 키는 커넥션 이름(§4.5), 값은 어댑터 설정. `main` 은 관례
4
5
  * (스키마가 `{ db: 'legacy' }` 처럼 명시하지 않으면 main 으로 붙는다).
@@ -115,6 +116,7 @@ export interface AppSessionConfig {
115
116
  * 벗어날 때만 값을 채운다:
116
117
  * - hosts: 이 앱이 응답할 도메인 목록. 생략 시 URL 프리픽스 관례만 사용.
117
118
  * - session: 세션 옵션(secret · 쿠키 이름 등).
119
+ * - auth: 인증 이음새(loadUser · loginRedirect — 결정 59).
118
120
  * - prefix: URL 프리픽스 관례를 명시적으로 덮어쓴다(고급).
119
121
  *
120
122
  * 개발 모드에서는 `<앱이름>.localhost` 로도 접근된다(v0.11 · §3.3) —
@@ -125,6 +127,13 @@ export interface AppConfig {
125
127
  readonly hosts?: readonly string[];
126
128
  /** 세션 옵션 — 미지정 시 세션 배터리는 이 앱에서 꺼져 있다. */
127
129
  readonly session?: AppSessionConfig;
130
+ /**
131
+ * 인증 이음새(§7 · 결정 59). 세션 앱은 AuthOptions(loadUser · loginRedirect),
132
+ * API 앱은 JwtAuthOptions(strategy:'jwt'). wireGaon 이 AppSpec.auth 로 그대로
133
+ * 전달한다 — 이 배선이 없으면 요청마다 currentUser 를 채울 방법이 없어
134
+ * requireAuth/this.auth.user 가 로그인 후에도 영구 null 로 파손된다.
135
+ */
136
+ readonly auth?: AuthOptions | JwtAuthOptions;
128
137
  /** URL 프리픽스 명시 덮어쓰기. 생략 시 관례: web→'/', 그 외→'/<name>'. */
129
138
  readonly prefix?: string;
130
139
  }
package/dist/wire.js CHANGED
@@ -101,12 +101,18 @@ export async function wireGaon(config, cwd = process.cwd()) {
101
101
  // 5) 앱 스캔 · createApp.
102
102
  const apps = await resolveApps(root);
103
103
  const specs = apps.map((a) => {
104
- const spec = toAppSpec(a);
104
+ let spec = toAppSpec(a);
105
105
  // app.config.ts 가 session 을 두면 세션을 켠다(app.config 는 임의 shape 라
106
106
  // 얕게 검사). Redis 인스턴스는 wireGaon 이 소유하는 걸 재사용.
107
107
  const ac = a.appConfig;
108
+ // 결정 59: app.config.ts 의 auth(loadUser) 를 AppSpec.auth 로 전달한다.
109
+ // 이 배선이 빠지면 세션 로그인은 되는데 요청마다 currentUser 를 채울 길이
110
+ // 없어 requireAuth 가 로그인 후에도 영구 실패한다(컴파일 통과·런타임 파손).
111
+ if (ac?.auth && typeof ac.auth.loadUser === 'function') {
112
+ spec = { ...spec, auth: ac.auth };
113
+ }
108
114
  if (ac?.session?.secret && redis) {
109
- return {
115
+ spec = {
110
116
  ...spec,
111
117
  session: {
112
118
  redis,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaonjs/config",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Gaon 루트 설정 로더·자동 배선 (gaon.config.ts · §3.3 · M9-A)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,20 +23,20 @@
23
23
  "dist",
24
24
  "README.md"
25
25
  ],
26
- "scripts": {
27
- "build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json"
28
- },
29
26
  "dependencies": {
30
- "@gaonjs/async": "workspace:*",
31
- "@gaonjs/core": "workspace:*",
32
- "@gaonjs/data": "workspace:*",
33
- "@gaonjs/i18n": "workspace:*",
34
- "@gaonjs/mail": "workspace:*",
35
- "@gaonjs/storage": "workspace:*",
36
- "@gaonjs/web": "workspace:*",
37
- "ioredis": "^5.4.1"
27
+ "ioredis": "^5.4.1",
28
+ "@gaonjs/async": "0.3.1",
29
+ "@gaonjs/core": "0.1.4",
30
+ "@gaonjs/data": "0.8.4",
31
+ "@gaonjs/mail": "0.1.1",
32
+ "@gaonjs/i18n": "0.1.1",
33
+ "@gaonjs/storage": "0.1.1",
34
+ "@gaonjs/web": "0.5.3"
38
35
  },
39
36
  "devDependencies": {
40
37
  "fastify": "^5.0.0"
38
+ },
39
+ "scripts": {
40
+ "build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json"
41
41
  }
42
- }
42
+ }