@cartanova/qgrid-cli 1.0.4 → 1.1.1
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/bundle/dist/application/qgrid/pool.js +15 -6
- package/bundle/dist/application/qgrid/qgrid.frame.js +17 -22
- package/bundle/dist/application/qgrid/qgrid.types.js +5 -2
- package/bundle/dist/application/request-log/request-log.model.js +2 -2
- package/bundle/dist/sonamu.config.js +5 -2
- package/bundle/src/application/qgrid/pool.ts +17 -7
- package/bundle/src/application/qgrid/qgrid.frame.ts +18 -25
- package/bundle/src/application/qgrid/qgrid.types.ts +1 -1
- package/bundle/src/application/request-log/request-log.model.ts +2 -2
- package/bundle/src/sonamu.config.ts +1 -1
- package/bundle/web-dist/{web-dist/client/assets/index-DlPchHBY.js → client/assets/index-C0m8rRjO.js} +2 -2
- package/bundle/web-dist/client/assets/{routes-CagDz23B.js → routes-B1eOXnpo.js} +1 -1
- package/bundle/web-dist/client/assets/{show-aXUGa0gm.js → show-BztN6MXO.js} +1 -1
- package/bundle/web-dist/client/assets/tokens-rR2_-Pte.js +1 -0
- package/bundle/web-dist/client/index.html +1 -1
- package/bundle/web-dist/server/assets/{tokens-JH6FsnWZ.js → tokens-ARL5AOAh.js} +4 -1
- package/bundle/web-dist/server/entry-server.generated.js +1 -1
- package/dist/cli.js +38 -24
- package/package.json +10 -10
- package/bundle/dist/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +0 -9
- package/bundle/dist/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +0 -6
- package/bundle/dist/dist/_virtual/_rolldown/runtime.js +0 -15
- package/bundle/dist/dist/application/qgrid/oauth.js +0 -140
- package/bundle/dist/dist/application/qgrid/pool.js +0 -100
- package/bundle/dist/dist/application/qgrid/qgrid.frame.js +0 -280
- package/bundle/dist/dist/application/qgrid/qgrid.types.js +0 -79
- package/bundle/dist/dist/application/qgrid/worker.js +0 -183
- package/bundle/dist/dist/application/queries.generated.js +0 -31
- package/bundle/dist/dist/application/request-log/request-log.model.js +0 -113
- package/bundle/dist/dist/application/request-log/request-log.types.js +0 -13
- package/bundle/dist/dist/application/sonamu.generated.js +0 -99
- package/bundle/dist/dist/application/sonamu.generated.sso.js +0 -34
- package/bundle/dist/dist/application/token/token.model.js +0 -157
- package/bundle/dist/dist/application/token/token.types.js +0 -22
- package/bundle/dist/dist/i18n/en.js +0 -63
- package/bundle/dist/dist/i18n/ko.js +0 -62
- package/bundle/dist/dist/i18n/sd.generated.js +0 -272
- package/bundle/dist/dist/index.js +0 -11
- package/bundle/dist/dist/migrations/20260410171405_create__request_logs.js +0 -26
- package/bundle/dist/dist/migrations/20260410171406_create__tokens.js +0 -24
- package/bundle/dist/dist/migrations/20260411120624_alter_tokens_alter2.js +0 -16
- package/bundle/dist/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +0 -155
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_expect@4.1.2/node_modules/@vitest/expect/dist/index.js +0 -1484
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.2/node_modules/@vitest/pretty-format/dist/index.js +0 -887
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/chunk-artifact.js +0 -2746
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/index.js +0 -8
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/utils.js +0 -8
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_snapshot@4.1.2/node_modules/@vitest/snapshot/dist/index.js +0 -662
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_spy@4.1.2/node_modules/@vitest/spy/dist/index.js +0 -386
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +0 -82
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/constants.js +0 -48
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/diff.js +0 -1307
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/display.js +0 -558
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/error.js +0 -33
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/helpers.js +0 -226
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/offset.js +0 -27
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/serialize.js +0 -77
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/source-map.js +0 -374
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/timers.js +0 -37
- package/bundle/dist/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.js +0 -2886
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js +0 -10
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js +0 -109
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js +0 -10
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js +0 -10
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js +0 -10
- package/bundle/dist/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +0 -1127
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +0 -21
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +0 -432
- package/bundle/dist/dist/node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js +0 -506
- package/bundle/dist/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js +0 -86
- package/bundle/dist/dist/node_modules/.pnpm/vite@8.0.3_@emnapi_core@1.9.2_@emnapi_runtime@1.9.2_@types_node@25.0.7_esbuild@0.27.4_jiti@2.6.1_sass@1.98.0_tsx@4.21.0/node_modules/vite/dist/node/module-runner.js +0 -426
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +0 -6
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js +0 -41
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/evaluatedModules.Dg1zASAC.js +0 -19
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/index.Chj8NDwU.js +0 -202
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/index.DOa3dzoN.js +0 -16
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +0 -59
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/test.p_J6dB8a.js +0 -2910
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +0 -44
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/index.js +0 -28
- package/bundle/dist/dist/sonamu.config.js +0 -196
- package/bundle/dist/dist/testing/fixture.js +0 -8
- package/bundle/dist/dist/testing/global.js +0 -9
- package/bundle/dist/dist/testing/setup-mocks.js +0 -17
- package/bundle/dist/dist/utils/subset-loaders.js +0 -12
- package/bundle/src/src/application/qgrid/oauth.ts +0 -181
- package/bundle/src/src/application/qgrid/pool.ts +0 -132
- package/bundle/src/src/application/qgrid/qgrid.frame.ts +0 -275
- package/bundle/src/src/application/qgrid/qgrid.types.ts +0 -117
- package/bundle/src/src/application/qgrid/worker.ts +0 -234
- package/bundle/src/src/application/queries.generated.ts +0 -59
- package/bundle/src/src/application/request-log/request-log.entity.json +0 -75
- package/bundle/src/src/application/request-log/request-log.model.ts +0 -155
- package/bundle/src/src/application/request-log/request-log.types.ts +0 -15
- package/bundle/src/src/application/sonamu.generated.http +0 -187
- package/bundle/src/src/application/sonamu.generated.sso.ts +0 -66
- package/bundle/src/src/application/sonamu.generated.ts +0 -135
- package/bundle/src/src/application/token/token.entity.json +0 -37
- package/bundle/src/src/application/token/token.model.ts +0 -160
- package/bundle/src/src/application/token/token.types.ts +0 -26
- package/bundle/src/src/i18n/en.ts +0 -59
- package/bundle/src/src/i18n/ko.ts +0 -59
- package/bundle/src/src/i18n/sd.generated.ts +0 -384
- package/bundle/src/src/index.ts +0 -6
- package/bundle/src/src/migrations/20260410171405_create__request_logs.ts +0 -23
- package/bundle/src/src/migrations/20260410171406_create__tokens.ts +0 -21
- package/bundle/src/src/migrations/20260411120624_alter_tokens_alter2.ts +0 -15
- package/bundle/src/src/sonamu.config.ts +0 -248
- package/bundle/src/src/testing/fixture.ts +0 -6
- package/bundle/src/src/testing/global.ts +0 -6
- package/bundle/src/src/testing/setup-mocks.ts +0 -44
- package/bundle/src/src/typings/fastify.d.ts +0 -8
- package/bundle/src/src/typings/sonamu.d.ts +0 -17
- package/bundle/src/src/utils/subset-loaders.ts +0 -11
- package/bundle/web-dist/client/assets/index-DlPchHBY.js +0 -116
- package/bundle/web-dist/client/assets/tokens-DRkXtZ3Q.js +0 -1
- package/bundle/web-dist/web-dist/client/assets/index-vZsvyuFn.css +0 -1
- package/bundle/web-dist/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +0 -1
- package/bundle/web-dist/web-dist/client/assets/routes-CagDz23B.js +0 -1
- package/bundle/web-dist/web-dist/client/assets/sd.generated-BrQoQXvv.js +0 -47
- package/bundle/web-dist/web-dist/client/assets/services.generated-BspO2L0j.js +0 -1
- package/bundle/web-dist/web-dist/client/assets/show-aXUGa0gm.js +0 -29
- package/bundle/web-dist/web-dist/client/assets/tokens-DRkXtZ3Q.js +0 -1
- package/bundle/web-dist/web-dist/client/assets/vendor-react-DH4kUfK2.js +0 -9
- package/bundle/web-dist/web-dist/client/assets/vendor-tanstack-CUxlo6YN.js +0 -1
- package/bundle/web-dist/web-dist/client/index.html +0 -18
- package/bundle/web-dist/web-dist/server/assets/react-dom-CGIzOSuj.js +0 -335
- package/bundle/web-dist/web-dist/server/assets/routes-ClzReRep.js +0 -490
- package/bundle/web-dist/web-dist/server/assets/sd.generated-BnonqqKr.js +0 -21694
- package/bundle/web-dist/web-dist/server/assets/services.generated-D5ABD5fr.js +0 -836
- package/bundle/web-dist/web-dist/server/assets/show-C9pcdSxc.js +0 -23364
- package/bundle/web-dist/web-dist/server/assets/tokens-JH6FsnWZ.js +0 -860
- package/bundle/web-dist/web-dist/server/entry-server.generated.js +0 -44646
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
import { getConsoleSink } from "@logtape/logtape";
|
|
4
|
-
import { getPrettyFormatter } from "@logtape/pretty";
|
|
5
|
-
import dotenv from "dotenv";
|
|
6
|
-
import { CachePresets, defineConfig } from "sonamu";
|
|
7
|
-
import { drivers as cacheDrivers, store } from "sonamu/cache";
|
|
8
|
-
import { drivers } from "sonamu/storage";
|
|
9
|
-
|
|
10
|
-
dotenv.config({ path: path.join(import.meta.dirname, "../.env") });
|
|
11
|
-
|
|
12
|
-
const host = process.env.HOST ?? "localhost";
|
|
13
|
-
const port = Number(process.env.PORT ?? 44900);
|
|
14
|
-
|
|
15
|
-
export default defineConfig({
|
|
16
|
-
projectName: process.env.PROJECT_NAME ?? "SonamuProject",
|
|
17
|
-
database: {
|
|
18
|
-
name: process.env.QGRID_DB_NAME ?? "qgrid",
|
|
19
|
-
defaultOptions: {
|
|
20
|
-
connection: {
|
|
21
|
-
host: process.env.QGRID_DB_HOST ?? "localhost",
|
|
22
|
-
port: Number(process.env.QGRID_DB_PORT ?? 44901),
|
|
23
|
-
user: process.env.QGRID_DB_USER ?? "postgres",
|
|
24
|
-
password: process.env.QGRID_DB_PASSWORD ?? "postgres",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
environments: {
|
|
28
|
-
production: {
|
|
29
|
-
connection: {
|
|
30
|
-
host: process.env.DEV0_DB_HOST,
|
|
31
|
-
port: Number(process.env.DEV0_DB_PORT),
|
|
32
|
-
database: process.env.DATABASE_NAME,
|
|
33
|
-
user: process.env.DEV0_DB_USER,
|
|
34
|
-
password: process.env.DEV0_DB_PASSWORD,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
fixture: {
|
|
38
|
-
connection: {
|
|
39
|
-
host: process.env.DEV0_DB_HOST,
|
|
40
|
-
port: Number(process.env.DEV0_DB_PORT),
|
|
41
|
-
database: process.env.DATABASE_NAME,
|
|
42
|
-
user: process.env.DEV0_DB_USER,
|
|
43
|
-
password: process.env.DEV0_DB_PASSWORD,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
api: {
|
|
49
|
-
dir: "api",
|
|
50
|
-
timezone: "Asia/Seoul",
|
|
51
|
-
route: {
|
|
52
|
-
prefix: "/api",
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
i18n: {
|
|
56
|
-
defaultLocale: "ko",
|
|
57
|
-
supportedLocales: ["ko", "en"],
|
|
58
|
-
},
|
|
59
|
-
sync: {
|
|
60
|
-
targets: ["web"],
|
|
61
|
-
},
|
|
62
|
-
slackConfirm:
|
|
63
|
-
process.env.SLACK_BOT_TOKEN && process.env.SLACK_CHANNEL_ID
|
|
64
|
-
? {
|
|
65
|
-
targets: ["development_master", "production_master"],
|
|
66
|
-
botToken: process.env.SLACK_BOT_TOKEN ?? "",
|
|
67
|
-
channelId: process.env.SLACK_CHANNEL_ID ?? "",
|
|
68
|
-
}
|
|
69
|
-
: undefined,
|
|
70
|
-
test: {
|
|
71
|
-
parallel: true,
|
|
72
|
-
maxWorkers: 4,
|
|
73
|
-
devRunner: { enabled: true },
|
|
74
|
-
},
|
|
75
|
-
logging: {
|
|
76
|
-
sinks: {
|
|
77
|
-
console: getConsoleSink({
|
|
78
|
-
formatter: getPrettyFormatter({
|
|
79
|
-
timestamp: "time",
|
|
80
|
-
categoryWidth: 20,
|
|
81
|
-
categoryTruncate: "middle",
|
|
82
|
-
}),
|
|
83
|
-
}),
|
|
84
|
-
},
|
|
85
|
-
loggers: [
|
|
86
|
-
{
|
|
87
|
-
category: ["sonamu"],
|
|
88
|
-
sinks: ["console"],
|
|
89
|
-
lowestLevel: process.env.NODE_ENV === "test" ? "warning" : "debug",
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
server: {
|
|
94
|
-
listen: { port, host },
|
|
95
|
-
plugins: {
|
|
96
|
-
formbody: true,
|
|
97
|
-
qs: true,
|
|
98
|
-
multipart: { limits: { fileSize: 1024 * 1024 * 30 } },
|
|
99
|
-
static: {
|
|
100
|
-
root: path.join(import.meta.dirname, "/../", "public"),
|
|
101
|
-
prefix: "/api/public",
|
|
102
|
-
},
|
|
103
|
-
custom: (server) => {
|
|
104
|
-
// OAuth 콜백 — Anthropic이 /callback으로 리다이렉트
|
|
105
|
-
server.get("/callback", async (request, reply) => {
|
|
106
|
-
const { code, state } = request.query as { code?: string; state?: string };
|
|
107
|
-
if (!code || !state) {
|
|
108
|
-
return reply.redirect("/?oauth=error&reason=missing_params");
|
|
109
|
-
}
|
|
110
|
-
// Frame의 oauthCallback으로 위임
|
|
111
|
-
try {
|
|
112
|
-
const { QgridFrame } = await import("./application/qgrid/qgrid.frame");
|
|
113
|
-
await QgridFrame.handleOAuthCallback(code, state, reply);
|
|
114
|
-
} catch (e) {
|
|
115
|
-
return reply.redirect(
|
|
116
|
-
`/?oauth=error&reason=${encodeURIComponent((e as Error).message)}`,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
apiConfig: {
|
|
123
|
-
contextProvider: (defaultContext, request) => {
|
|
124
|
-
return {
|
|
125
|
-
...defaultContext,
|
|
126
|
-
ip: request.ip,
|
|
127
|
-
body: request.body,
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
guardHandler: (_guard, _request, _api) => {
|
|
131
|
-
if (_guard === "user") {
|
|
132
|
-
console.log("user guard");
|
|
133
|
-
}
|
|
134
|
-
console.log("NOTHING YET");
|
|
135
|
-
},
|
|
136
|
-
cacheControlHandler: (req) => {
|
|
137
|
-
switch (req.type) {
|
|
138
|
-
case "assets":
|
|
139
|
-
// Hash 포함된 파일: 영구 캐시
|
|
140
|
-
if (req.path.match(/-[a-f0-9]+\./)) {
|
|
141
|
-
return CachePresets.immutable;
|
|
142
|
-
}
|
|
143
|
-
return CachePresets.longLived;
|
|
144
|
-
|
|
145
|
-
case "api":
|
|
146
|
-
// GET 요청만 캐싱 고려
|
|
147
|
-
if (req.method === "GET") {
|
|
148
|
-
// 특정 경로는 짧은 캐시
|
|
149
|
-
if (req.path.startsWith("/api/static-data")) {
|
|
150
|
-
return CachePresets.shortLived;
|
|
151
|
-
}
|
|
152
|
-
if (req.path.startsWith("/api/terms")) {
|
|
153
|
-
return CachePresets.mediumLived;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// 기본: 캐시 없음
|
|
157
|
-
return CachePresets.noCache;
|
|
158
|
-
|
|
159
|
-
case "ssr":
|
|
160
|
-
// SSR 페이지: 10초 캐시
|
|
161
|
-
return CachePresets.ssr;
|
|
162
|
-
|
|
163
|
-
case "csr":
|
|
164
|
-
// CSR fallback (index.html): 1분 캐시
|
|
165
|
-
return CachePresets.shortLived;
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
storage: {
|
|
170
|
-
drivers: {
|
|
171
|
-
fs: drivers.fs({
|
|
172
|
-
location: path.join(import.meta.dirname, "/../public/uploaded"),
|
|
173
|
-
visibility: "public",
|
|
174
|
-
urlBuilder: {
|
|
175
|
-
async generateURL(key) {
|
|
176
|
-
return `/api/public/uploaded/${key}`;
|
|
177
|
-
},
|
|
178
|
-
async generateSignedURL(key) {
|
|
179
|
-
return `/api/public/uploaded/${key}`;
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
}),
|
|
183
|
-
s3: drivers.s3({
|
|
184
|
-
credentials: {
|
|
185
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? "",
|
|
186
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? "",
|
|
187
|
-
},
|
|
188
|
-
region: process.env.S3_REGION ?? "ap-northeast-2",
|
|
189
|
-
bucket: process.env.S3_BUCKET ?? "sonamu_default_bucket",
|
|
190
|
-
visibility: "private",
|
|
191
|
-
}),
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
cache: {
|
|
195
|
-
default: "main",
|
|
196
|
-
stores: {
|
|
197
|
-
main: store().useL1Layer(cacheDrivers.memory({ maxSize: "50mb" })),
|
|
198
|
-
},
|
|
199
|
-
ttl: "5m",
|
|
200
|
-
prefix: "",
|
|
201
|
-
},
|
|
202
|
-
lifecycle: {
|
|
203
|
-
onStart: async () => {
|
|
204
|
-
// DB 마이그레이션 자동 실행 (테이블 없으면 생성)
|
|
205
|
-
try {
|
|
206
|
-
const { TokenModel } = await import("./application/token/token.model");
|
|
207
|
-
const knex = TokenModel.getDB("w");
|
|
208
|
-
const migrationsDir = path.join(import.meta.dirname, "../src/migrations");
|
|
209
|
-
const [batch, log] = await knex.migrate.latest({
|
|
210
|
-
directory: migrationsDir,
|
|
211
|
-
});
|
|
212
|
-
if (log.length > 0) {
|
|
213
|
-
console.log(`✓ Migration: ${log.length} applied (batch ${batch})`);
|
|
214
|
-
log.forEach((name: string) => console.log(` ✓ ${name}`));
|
|
215
|
-
}
|
|
216
|
-
} catch (e) {
|
|
217
|
-
console.warn(`⚠ Migration skipped: ${(e as Error).message}`);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Pool 초기화
|
|
221
|
-
const { initPool } = await import("./application/qgrid/pool");
|
|
222
|
-
try {
|
|
223
|
-
const { TokenModel } = await import("./application/token/token.model");
|
|
224
|
-
const entries = await TokenModel.findActive("A");
|
|
225
|
-
const tokens = entries.map((e) => e.token);
|
|
226
|
-
const pool = initPool(tokens);
|
|
227
|
-
console.log(
|
|
228
|
-
`🌲 Server listening on http://${host}:${port} (${pool.workers.size} tokens loaded)`,
|
|
229
|
-
);
|
|
230
|
-
} catch (e) {
|
|
231
|
-
console.warn(`⚠ Pool init failed: ${(e as Error).message}`);
|
|
232
|
-
initPool([]);
|
|
233
|
-
console.log(`🌲 Server listening on http://${host}:${port} (no tokens)`);
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
onShutdown: () => {
|
|
237
|
-
console.log("graceful shutdown");
|
|
238
|
-
},
|
|
239
|
-
onError: (error, _request, reply) => {
|
|
240
|
-
console.error(error);
|
|
241
|
-
reply.status(500).send({
|
|
242
|
-
name: error.name,
|
|
243
|
-
message: error.message,
|
|
244
|
-
});
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { PathLike } from "fs";
|
|
2
|
-
|
|
3
|
-
// import { Naite } from "sonamu";
|
|
4
|
-
import { vi } from "vitest";
|
|
5
|
-
|
|
6
|
-
// GlobalMock: fs/promises (사용 예시 - 필요시 활성화)
|
|
7
|
-
vi.mock("fs/promises", async (importOriginal) => {
|
|
8
|
-
const actual = (await importOriginal()) as typeof import("fs/promises");
|
|
9
|
-
return {
|
|
10
|
-
...actual,
|
|
11
|
-
access: vi.fn((path: PathLike, mode?: number) => {
|
|
12
|
-
// const vfs = Naite.get("mock:fs/promises:virtualFileSystem").result();
|
|
13
|
-
// if (vfs.some((v) => v === path)) {
|
|
14
|
-
// return Promise.resolve();
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
return actual.access(path, mode);
|
|
18
|
-
}),
|
|
19
|
-
// mkdir: vi.fn(
|
|
20
|
-
// async (
|
|
21
|
-
// path: PathLike,
|
|
22
|
-
// options?: MakeDirectoryOptions | Mode | null,
|
|
23
|
-
// ): Promise<string | undefined> => {
|
|
24
|
-
// // Naite.t("fs:mkdir", { path, options });
|
|
25
|
-
// if (typeof options === "object" && options?.recursive) {
|
|
26
|
-
// return typeof path === "string" ? path : path.toString();
|
|
27
|
-
// }
|
|
28
|
-
// return undefined;
|
|
29
|
-
// },
|
|
30
|
-
// ),
|
|
31
|
-
// writeFile: vi.fn((path: PathLike | FileHandle, data: string | Buffer | Uint8Array) => {
|
|
32
|
-
// const filePath = typeof path === "string" ? path : path.toString();
|
|
33
|
-
|
|
34
|
-
// // Naite.t(`fs/promises:writeFile`, { path: filePath, data });
|
|
35
|
-
// }),
|
|
36
|
-
// rm: vi.fn(async (path: PathLike, options?: RmOptions) => {
|
|
37
|
-
// const filePath = typeof path === "string" ? path : path.toString();
|
|
38
|
-
|
|
39
|
-
// // Naite.t(`fs/promises:rm`, { path: filePath, options });
|
|
40
|
-
// // 실제 삭제하지 않고 기록만 함
|
|
41
|
-
// return Promise.resolve();
|
|
42
|
-
// }),
|
|
43
|
-
};
|
|
44
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/correctness/noUnusedImports: d.ts */
|
|
2
|
-
|
|
3
|
-
import {} from "sonamu";
|
|
4
|
-
|
|
5
|
-
declare module "sonamu" {
|
|
6
|
-
export interface ContextExtend {
|
|
7
|
-
ip: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface GuardKeys {
|
|
11
|
-
query: true;
|
|
12
|
-
user: true;
|
|
13
|
-
admin: true;
|
|
14
|
-
// 새로운 커스텀 가드키를 추가하는 경우
|
|
15
|
-
// CustomGuardKey: true
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SubsetQuery } from "sonamu";
|
|
2
|
-
|
|
3
|
-
export function getSubsetLoaders(subsets: string[], subsetQueries: Record<string, SubsetQuery>) {
|
|
4
|
-
return subsets.reduce(
|
|
5
|
-
(acc, subset) => {
|
|
6
|
-
acc[subset] = subsetQueries[subset]?.loaders ?? [];
|
|
7
|
-
return acc;
|
|
8
|
-
},
|
|
9
|
-
{} as Record<string, SubsetQuery["loaders"]>,
|
|
10
|
-
);
|
|
11
|
-
}
|