@cartanova/qgrid-cli 1.0.1 → 1.0.3
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/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
- package/bundle/dist/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
- package/bundle/dist/dist/_virtual/_rolldown/runtime.js +15 -0
- package/bundle/dist/dist/application/qgrid/oauth.js +140 -0
- package/bundle/dist/dist/application/qgrid/pool.js +100 -0
- package/bundle/dist/dist/application/qgrid/qgrid.frame.js +280 -0
- package/bundle/dist/dist/application/qgrid/qgrid.types.js +79 -0
- package/bundle/dist/dist/application/qgrid/worker.js +183 -0
- package/bundle/dist/dist/application/queries.generated.js +31 -0
- package/bundle/dist/dist/application/request-log/request-log.model.js +113 -0
- package/bundle/dist/dist/application/request-log/request-log.types.js +13 -0
- package/bundle/dist/dist/application/sonamu.generated.js +99 -0
- package/bundle/dist/dist/application/sonamu.generated.sso.js +34 -0
- package/bundle/dist/dist/application/token/token.model.js +157 -0
- package/bundle/dist/dist/application/token/token.types.js +22 -0
- package/bundle/dist/dist/i18n/en.js +63 -0
- package/bundle/dist/dist/i18n/ko.js +62 -0
- package/bundle/dist/dist/i18n/sd.generated.js +272 -0
- package/bundle/dist/dist/index.js +11 -0
- package/bundle/dist/dist/migrations/20260410171405_create__request_logs.js +26 -0
- package/bundle/dist/dist/migrations/20260410171406_create__tokens.js +24 -0
- package/bundle/dist/dist/migrations/20260411120624_alter_tokens_alter2.js +16 -0
- package/bundle/dist/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +155 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_expect@4.1.2/node_modules/@vitest/expect/dist/index.js +1484 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.2/node_modules/@vitest/pretty-format/dist/index.js +887 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/chunk-artifact.js +2746 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/index.js +8 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/utils.js +8 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_snapshot@4.1.2/node_modules/@vitest/snapshot/dist/index.js +662 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_spy@4.1.2/node_modules/@vitest/spy/dist/index.js +386 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +82 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/constants.js +48 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/diff.js +1307 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/display.js +558 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/error.js +33 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/helpers.js +226 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/offset.js +27 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/serialize.js +77 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/source-map.js +374 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/timers.js +37 -0
- package/bundle/dist/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.js +2886 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js +109 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +1127 -0
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +21 -0
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +432 -0
- package/bundle/dist/dist/node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js +506 -0
- package/bundle/dist/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js +86 -0
- 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 +426 -0
- 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 +6 -0
- 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 +41 -0
- 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 +19 -0
- 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 +202 -0
- 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 +16 -0
- 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 +59 -0
- 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 +2910 -0
- 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 +44 -0
- 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 +28 -0
- package/bundle/dist/dist/sonamu.config.js +196 -0
- package/bundle/dist/dist/testing/fixture.js +8 -0
- package/bundle/dist/dist/testing/global.js +9 -0
- package/bundle/dist/dist/testing/setup-mocks.js +17 -0
- package/bundle/dist/dist/utils/subset-loaders.js +12 -0
- package/bundle/src/application/qgrid/oauth.ts +181 -0
- package/bundle/src/application/qgrid/pool.ts +132 -0
- package/bundle/src/application/qgrid/qgrid.frame.ts +275 -0
- package/bundle/src/application/qgrid/qgrid.types.ts +117 -0
- package/bundle/src/application/qgrid/worker.ts +234 -0
- package/bundle/src/application/queries.generated.ts +59 -0
- package/bundle/src/application/request-log/request-log.model.ts +155 -0
- package/bundle/src/application/request-log/request-log.types.ts +15 -0
- package/bundle/src/application/sonamu.generated.http +187 -0
- package/bundle/src/application/sonamu.generated.sso.ts +66 -0
- package/bundle/src/application/sonamu.generated.ts +135 -0
- package/bundle/src/application/token/token.model.ts +160 -0
- package/bundle/src/application/token/token.types.ts +26 -0
- package/bundle/src/i18n/en.ts +59 -0
- package/bundle/src/i18n/ko.ts +59 -0
- package/bundle/src/i18n/sd.generated.ts +384 -0
- package/bundle/src/index.ts +6 -0
- package/bundle/src/sonamu.config.ts +248 -0
- package/bundle/src/src/application/qgrid/oauth.ts +181 -0
- package/bundle/src/src/application/qgrid/pool.ts +132 -0
- package/bundle/src/src/application/qgrid/qgrid.frame.ts +275 -0
- package/bundle/src/src/application/qgrid/qgrid.types.ts +117 -0
- package/bundle/src/src/application/qgrid/worker.ts +234 -0
- package/bundle/src/src/application/queries.generated.ts +59 -0
- package/bundle/src/src/application/request-log/request-log.entity.json +75 -0
- package/bundle/src/src/application/request-log/request-log.model.ts +155 -0
- package/bundle/src/src/application/request-log/request-log.types.ts +15 -0
- package/bundle/src/src/application/sonamu.generated.http +187 -0
- package/bundle/src/src/application/sonamu.generated.sso.ts +66 -0
- package/bundle/src/src/application/sonamu.generated.ts +135 -0
- package/bundle/src/src/application/token/token.entity.json +37 -0
- package/bundle/src/src/application/token/token.model.ts +160 -0
- package/bundle/src/src/application/token/token.types.ts +26 -0
- package/bundle/src/src/i18n/en.ts +59 -0
- package/bundle/src/src/i18n/ko.ts +59 -0
- package/bundle/src/src/i18n/sd.generated.ts +384 -0
- package/bundle/src/src/index.ts +6 -0
- package/bundle/src/src/migrations/20260410171405_create__request_logs.ts +23 -0
- package/bundle/src/src/migrations/20260410171406_create__tokens.ts +21 -0
- package/bundle/src/src/migrations/20260411120624_alter_tokens_alter2.ts +15 -0
- package/bundle/src/src/sonamu.config.ts +248 -0
- package/bundle/src/src/testing/fixture.ts +6 -0
- package/bundle/src/src/testing/global.ts +6 -0
- package/bundle/src/src/testing/setup-mocks.ts +44 -0
- package/bundle/src/src/typings/fastify.d.ts +8 -0
- package/bundle/src/src/typings/sonamu.d.ts +17 -0
- package/bundle/src/src/utils/subset-loaders.ts +11 -0
- package/bundle/src/testing/fixture.ts +6 -0
- package/bundle/src/testing/global.ts +6 -0
- package/bundle/src/testing/setup-mocks.ts +44 -0
- package/bundle/src/typings/fastify.d.ts +8 -0
- package/bundle/src/typings/sonamu.d.ts +17 -0
- package/bundle/src/utils/subset-loaders.ts +11 -0
- package/bundle/web-dist/web-dist/client/assets/index-DlPchHBY.js +116 -0
- package/bundle/web-dist/web-dist/client/assets/index-vZsvyuFn.css +1 -0
- package/bundle/web-dist/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/routes-CagDz23B.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/sd.generated-BrQoQXvv.js +47 -0
- package/bundle/web-dist/web-dist/client/assets/services.generated-BspO2L0j.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/show-aXUGa0gm.js +29 -0
- package/bundle/web-dist/web-dist/client/assets/tokens-DRkXtZ3Q.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/vendor-react-DH4kUfK2.js +9 -0
- package/bundle/web-dist/web-dist/client/assets/vendor-tanstack-CUxlo6YN.js +1 -0
- package/bundle/web-dist/web-dist/client/index.html +18 -0
- package/bundle/web-dist/web-dist/server/assets/react-dom-CGIzOSuj.js +335 -0
- package/bundle/web-dist/web-dist/server/assets/routes-ClzReRep.js +490 -0
- package/bundle/web-dist/web-dist/server/assets/sd.generated-BnonqqKr.js +21694 -0
- package/bundle/web-dist/web-dist/server/assets/services.generated-D5ABD5fr.js +836 -0
- package/bundle/web-dist/web-dist/server/assets/show-C9pcdSxc.js +23364 -0
- package/bundle/web-dist/web-dist/server/assets/tokens-JH6FsnWZ.js +860 -0
- package/bundle/web-dist/web-dist/server/entry-server.generated.js +44646 -0
- package/package.json +11 -10
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated
|
|
3
|
+
* 직접 수정하지 마세요.
|
|
4
|
+
*/
|
|
5
|
+
/* oxlint-disable */
|
|
6
|
+
|
|
7
|
+
import { zArrayable, SonamuQueryMode, ApplySonamuFilter } from "sonamu";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
// Enums: RequestLog
|
|
11
|
+
export const RequestLogOrderBy = z.enum(["id-desc"]).describe("RequestLogOrderBy");
|
|
12
|
+
export type RequestLogOrderBy = z.infer<typeof RequestLogOrderBy>;
|
|
13
|
+
export const RequestLogOrderByLabel = { "id-desc": "ID최신순" };
|
|
14
|
+
export const RequestLogSearchField = z
|
|
15
|
+
.enum(["id", "token_name", "query"])
|
|
16
|
+
.describe("RequestLogSearchField");
|
|
17
|
+
export type RequestLogSearchField = z.infer<typeof RequestLogSearchField>;
|
|
18
|
+
export const RequestLogSearchFieldLabel = { id: "ID", token_name: "토큰이름", query: "쿼리" };
|
|
19
|
+
|
|
20
|
+
// Enums: Token
|
|
21
|
+
export const TokenOrderBy = z.enum(["id-desc"]).describe("TokenOrderBy");
|
|
22
|
+
export type TokenOrderBy = z.infer<typeof TokenOrderBy>;
|
|
23
|
+
export const TokenOrderByLabel = { "id-desc": "ID최신순" };
|
|
24
|
+
export const TokenSearchField = z.enum(["id", "name"]).describe("TokenSearchField");
|
|
25
|
+
export type TokenSearchField = z.infer<typeof TokenSearchField>;
|
|
26
|
+
export const TokenSearchFieldLabel = { id: "ID", name: "이름" };
|
|
27
|
+
|
|
28
|
+
// BaseSchema: RequestLog
|
|
29
|
+
export const RequestLogBaseSchema = z.object({
|
|
30
|
+
id: z.int(),
|
|
31
|
+
created_at: z.date(),
|
|
32
|
+
token_name: z.string().max(100),
|
|
33
|
+
query: z.string(),
|
|
34
|
+
response: z.string(),
|
|
35
|
+
input_tokens: z.int(),
|
|
36
|
+
output_tokens: z.int(),
|
|
37
|
+
cache_read_tokens: z.int(),
|
|
38
|
+
cache_creation_tokens: z.int(),
|
|
39
|
+
duration_ms: z.int(),
|
|
40
|
+
});
|
|
41
|
+
export type RequestLogBaseSchema = z.infer<typeof RequestLogBaseSchema> & {
|
|
42
|
+
readonly __hasDefault__: readonly ["created_at", "id"];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// BaseSchema: Token
|
|
46
|
+
export const TokenBaseSchema = z.object({
|
|
47
|
+
id: z.int(),
|
|
48
|
+
created_at: z.date(),
|
|
49
|
+
token: z.string(),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
refresh_token: z.string().nullable(),
|
|
52
|
+
expires_at: z.bigint().nullable(),
|
|
53
|
+
account_uuid: z.string().nullable(),
|
|
54
|
+
active: z.boolean(),
|
|
55
|
+
});
|
|
56
|
+
export type TokenBaseSchema = z.infer<typeof TokenBaseSchema> & {
|
|
57
|
+
readonly __hasDefault__: readonly [
|
|
58
|
+
"created_at",
|
|
59
|
+
"refresh_token",
|
|
60
|
+
"expires_at",
|
|
61
|
+
"account_uuid",
|
|
62
|
+
"active",
|
|
63
|
+
"id",
|
|
64
|
+
];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// BaseListParams: RequestLog
|
|
68
|
+
export const RequestLogBaseListParams = z
|
|
69
|
+
.object({
|
|
70
|
+
num: z.number().int().nonnegative(),
|
|
71
|
+
page: z.number().int().min(1),
|
|
72
|
+
search: RequestLogSearchField,
|
|
73
|
+
keyword: z.string(),
|
|
74
|
+
orderBy: RequestLogOrderBy,
|
|
75
|
+
queryMode: SonamuQueryMode,
|
|
76
|
+
id: zArrayable(z.number().int().positive()),
|
|
77
|
+
sonamuFilter: z.custom<ApplySonamuFilter<RequestLogBaseSchema, never, never>>(),
|
|
78
|
+
token_name: z.string().max(100),
|
|
79
|
+
})
|
|
80
|
+
.partial();
|
|
81
|
+
export type RequestLogBaseListParams = z.infer<typeof RequestLogBaseListParams>;
|
|
82
|
+
|
|
83
|
+
// BaseListParams: Token
|
|
84
|
+
export const TokenBaseListParams = z
|
|
85
|
+
.object({
|
|
86
|
+
num: z.number().int().nonnegative(),
|
|
87
|
+
page: z.number().int().min(1),
|
|
88
|
+
search: TokenSearchField,
|
|
89
|
+
keyword: z.string(),
|
|
90
|
+
orderBy: TokenOrderBy,
|
|
91
|
+
queryMode: SonamuQueryMode,
|
|
92
|
+
id: zArrayable(z.number().int().positive()),
|
|
93
|
+
sonamuFilter: z.custom<ApplySonamuFilter<TokenBaseSchema, never, never>>(),
|
|
94
|
+
token: z.string(),
|
|
95
|
+
})
|
|
96
|
+
.partial();
|
|
97
|
+
export type TokenBaseListParams = z.infer<typeof TokenBaseListParams>;
|
|
98
|
+
|
|
99
|
+
// Subsets: RequestLog
|
|
100
|
+
export const RequestLogSubsetA = z.object({
|
|
101
|
+
id: z.int(),
|
|
102
|
+
created_at: z.date(),
|
|
103
|
+
token_name: z.string().max(100),
|
|
104
|
+
query: z.string(),
|
|
105
|
+
response: z.string(),
|
|
106
|
+
input_tokens: z.int(),
|
|
107
|
+
output_tokens: z.int(),
|
|
108
|
+
cache_read_tokens: z.int(),
|
|
109
|
+
cache_creation_tokens: z.int(),
|
|
110
|
+
duration_ms: z.int(),
|
|
111
|
+
});
|
|
112
|
+
export type RequestLogSubsetA = z.infer<typeof RequestLogSubsetA>;
|
|
113
|
+
export type RequestLogSubsetMapping = {
|
|
114
|
+
A: RequestLogSubsetA;
|
|
115
|
+
};
|
|
116
|
+
export const RequestLogSubsetKey = z.enum(["A"]);
|
|
117
|
+
export type RequestLogSubsetKey = z.infer<typeof RequestLogSubsetKey>;
|
|
118
|
+
|
|
119
|
+
// Subsets: Token
|
|
120
|
+
export const TokenSubsetA = z.object({
|
|
121
|
+
id: z.int(),
|
|
122
|
+
created_at: z.date(),
|
|
123
|
+
token: z.string(),
|
|
124
|
+
name: z.string(),
|
|
125
|
+
refresh_token: z.string().nullable(),
|
|
126
|
+
expires_at: z.bigint().nullable(),
|
|
127
|
+
account_uuid: z.string().nullable(),
|
|
128
|
+
active: z.boolean(),
|
|
129
|
+
});
|
|
130
|
+
export type TokenSubsetA = z.infer<typeof TokenSubsetA>;
|
|
131
|
+
export type TokenSubsetMapping = {
|
|
132
|
+
A: TokenSubsetA;
|
|
133
|
+
};
|
|
134
|
+
export const TokenSubsetKey = z.enum(["A"]);
|
|
135
|
+
export type TokenSubsetKey = z.infer<typeof TokenSubsetKey>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
api,
|
|
3
|
+
asArray,
|
|
4
|
+
BadRequestException,
|
|
5
|
+
BaseModelClass,
|
|
6
|
+
exhaustive,
|
|
7
|
+
type ListResult,
|
|
8
|
+
NotFoundException,
|
|
9
|
+
} from "sonamu";
|
|
10
|
+
|
|
11
|
+
import { SD } from "../../i18n/sd.generated";
|
|
12
|
+
import type { TokenSubsetKey, TokenSubsetMapping } from "../sonamu.generated";
|
|
13
|
+
import { tokenLoaderQueries, tokenSubsetQueries } from "../sonamu.generated.sso";
|
|
14
|
+
import type { TokenListParams, TokenSaveParams } from "./token.types";
|
|
15
|
+
|
|
16
|
+
class TokenModelClass extends BaseModelClass<
|
|
17
|
+
TokenSubsetKey,
|
|
18
|
+
TokenSubsetMapping,
|
|
19
|
+
typeof tokenSubsetQueries,
|
|
20
|
+
typeof tokenLoaderQueries
|
|
21
|
+
> {
|
|
22
|
+
constructor() {
|
|
23
|
+
super("Token", tokenSubsetQueries, tokenLoaderQueries);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@api({ httpMethod: "GET", clients: ["axios", "tanstack-query"], resourceName: "Token" })
|
|
27
|
+
async findById<T extends TokenSubsetKey>(subset: T, id: number): Promise<TokenSubsetMapping[T]> {
|
|
28
|
+
const { rows } = await this.findMany(subset, { id, num: 1, page: 1 });
|
|
29
|
+
if (!rows[0]) {
|
|
30
|
+
throw new NotFoundException(SD("error.entityNotFound")("Token", id));
|
|
31
|
+
}
|
|
32
|
+
return rows[0];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async findOne<T extends TokenSubsetKey>(
|
|
36
|
+
subset: T,
|
|
37
|
+
listParams: TokenListParams,
|
|
38
|
+
): Promise<TokenSubsetMapping[T] | null> {
|
|
39
|
+
const { rows } = await this.findMany(subset, { ...listParams, num: 1, page: 1 });
|
|
40
|
+
return rows[0] ?? null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@api({ httpMethod: "GET", clients: ["axios", "tanstack-query"], resourceName: "Tokens" })
|
|
44
|
+
async findMany<T extends TokenSubsetKey, LP extends TokenListParams>(
|
|
45
|
+
subset: T,
|
|
46
|
+
rawParams?: LP,
|
|
47
|
+
): Promise<ListResult<LP, TokenSubsetMapping[T]>> {
|
|
48
|
+
const params = {
|
|
49
|
+
num: 24,
|
|
50
|
+
page: 1,
|
|
51
|
+
search: "id" as const,
|
|
52
|
+
orderBy: "id-desc" as const,
|
|
53
|
+
...rawParams,
|
|
54
|
+
} satisfies TokenListParams;
|
|
55
|
+
|
|
56
|
+
const { qb, onSubset: _ } = this.getSubsetQueries(subset);
|
|
57
|
+
|
|
58
|
+
if (params.id) {
|
|
59
|
+
qb.whereIn("tokens.id", asArray(params.id));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (params.token) {
|
|
63
|
+
qb.where("tokens.token", params.token);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (params.search && params.keyword && params.keyword.length > 0) {
|
|
67
|
+
if (params.search === "id") {
|
|
68
|
+
qb.where("tokens.id", Number(params.keyword));
|
|
69
|
+
} else if (params.search === "name") {
|
|
70
|
+
qb.where("tokens.name", "like", `%${params.keyword}%`);
|
|
71
|
+
} else {
|
|
72
|
+
throw new BadRequestException(SD("error.unknownSearchField")(params.search));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (params.orderBy) {
|
|
77
|
+
if (params.orderBy === "id-desc") {
|
|
78
|
+
qb.orderBy("tokens.id", "desc");
|
|
79
|
+
} else {
|
|
80
|
+
exhaustive(params.orderBy);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const enhancers = this.createEnhancers({
|
|
85
|
+
A: (row) => ({ ...row }),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return this.executeSubsetQuery({ subset, qb, params, enhancers, debug: false });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async findByToken<T extends TokenSubsetKey>(
|
|
92
|
+
subset: T,
|
|
93
|
+
token: string,
|
|
94
|
+
): Promise<TokenSubsetMapping[T] | null> {
|
|
95
|
+
const { qb } = this.getSubsetQueries(subset);
|
|
96
|
+
qb.where("tokens.token", token);
|
|
97
|
+
const enhancers = this.createEnhancers({ A: (row) => ({ ...row }) });
|
|
98
|
+
const result = await this.executeSubsetQuery({
|
|
99
|
+
subset,
|
|
100
|
+
qb,
|
|
101
|
+
params: { num: 1, page: 1 },
|
|
102
|
+
enhancers,
|
|
103
|
+
debug: false,
|
|
104
|
+
});
|
|
105
|
+
return result.rows[0] ?? null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async findByAccountUuid<T extends TokenSubsetKey>(
|
|
109
|
+
subset: T,
|
|
110
|
+
accountUuid: string,
|
|
111
|
+
): Promise<TokenSubsetMapping[T][]> {
|
|
112
|
+
const { qb } = this.getSubsetQueries(subset);
|
|
113
|
+
qb.where("tokens.account_uuid", accountUuid);
|
|
114
|
+
const enhancers = this.createEnhancers({ A: (row) => ({ ...row }) });
|
|
115
|
+
const result = await this.executeSubsetQuery({
|
|
116
|
+
subset,
|
|
117
|
+
qb,
|
|
118
|
+
params: { num: 100, page: 1 },
|
|
119
|
+
enhancers,
|
|
120
|
+
debug: false,
|
|
121
|
+
});
|
|
122
|
+
return result.rows;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async findActive<T extends TokenSubsetKey>(subset: T): Promise<TokenSubsetMapping[T][]> {
|
|
126
|
+
const { qb } = this.getSubsetQueries(subset);
|
|
127
|
+
qb.where("tokens.active", true);
|
|
128
|
+
const enhancers = this.createEnhancers({ A: (row) => ({ ...row }) });
|
|
129
|
+
const result = await this.executeSubsetQuery({
|
|
130
|
+
subset,
|
|
131
|
+
qb,
|
|
132
|
+
params: { num: 100, page: 1 },
|
|
133
|
+
enhancers,
|
|
134
|
+
debug: false,
|
|
135
|
+
});
|
|
136
|
+
return result.rows;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
|
|
140
|
+
async save(spa: TokenSaveParams[]): Promise<number[]> {
|
|
141
|
+
const wdb = this.getPuri("w");
|
|
142
|
+
spa.forEach((sp) => {
|
|
143
|
+
wdb.ubRegister("tokens", sp);
|
|
144
|
+
});
|
|
145
|
+
return wdb.transaction(async (trx) => {
|
|
146
|
+
return trx.ubUpsert("tokens");
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@api({ httpMethod: "POST", clients: ["axios", "tanstack-mutation"] })
|
|
151
|
+
async del(ids: number[]): Promise<number> {
|
|
152
|
+
const wdb = this.getPuri("w");
|
|
153
|
+
await wdb.transaction(async (trx) => {
|
|
154
|
+
return trx.table("tokens").whereIn("tokens.id", ids).delete();
|
|
155
|
+
});
|
|
156
|
+
return ids.length;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const TokenModel = new TokenModelClass();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { TokenBaseListParams, TokenBaseSchema } from "../sonamu.generated";
|
|
4
|
+
|
|
5
|
+
// Token - ListParams
|
|
6
|
+
export const TokenListParams = TokenBaseListParams;
|
|
7
|
+
export type TokenListParams = z.infer<typeof TokenListParams>;
|
|
8
|
+
|
|
9
|
+
// Token - SaveParams
|
|
10
|
+
export const TokenSaveParams = TokenBaseSchema.partial({
|
|
11
|
+
id: true,
|
|
12
|
+
created_at: true,
|
|
13
|
+
refresh_token: true,
|
|
14
|
+
expires_at: true,
|
|
15
|
+
account_uuid: true,
|
|
16
|
+
active: true,
|
|
17
|
+
});
|
|
18
|
+
export type TokenSaveParams = z.infer<typeof TokenSaveParams>;
|
|
19
|
+
|
|
20
|
+
export const refreshTokenParams = TokenSaveParams.pick({
|
|
21
|
+
id: true,
|
|
22
|
+
token: true,
|
|
23
|
+
refresh_token: true,
|
|
24
|
+
name: true,
|
|
25
|
+
});
|
|
26
|
+
export type RefreshTokenParams = z.infer<typeof refreshTokenParams>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { plural } from "sonamu/dict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Project EN Dictionary
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
"common.all": "All",
|
|
8
|
+
"common.backToList": "Back to List",
|
|
9
|
+
"common.cancel": "Cancel",
|
|
10
|
+
"common.close": "Close",
|
|
11
|
+
"common.confirm": "Confirm",
|
|
12
|
+
"common.create": "Create",
|
|
13
|
+
"common.createdAt": "Created At",
|
|
14
|
+
"common.delete": "Delete",
|
|
15
|
+
"common.edit": "Edit",
|
|
16
|
+
"common.login": "Login",
|
|
17
|
+
"common.logout": "Logout",
|
|
18
|
+
"common.manage": "Manage",
|
|
19
|
+
"common.results": (count: number) =>
|
|
20
|
+
plural(count, { one: `${count} result`, other: `${count} results` }),
|
|
21
|
+
"common.save": "Save",
|
|
22
|
+
"common.search": "Search",
|
|
23
|
+
"common.searchPlaceholder": "Search...",
|
|
24
|
+
"common.searchType": "Search Type",
|
|
25
|
+
"common.sort": "Sort",
|
|
26
|
+
"confirm.delete": "Are you sure you want to delete?",
|
|
27
|
+
"confirm.save": "Do you want to save?",
|
|
28
|
+
"dashboard.adminMenu": "Admin Menu",
|
|
29
|
+
"dashboard.createdAt": "Joined",
|
|
30
|
+
"dashboard.email": "Email",
|
|
31
|
+
"dashboard.loginRequired": "Please login to continue.",
|
|
32
|
+
"dashboard.name": "Name",
|
|
33
|
+
"dashboard.role": "Role",
|
|
34
|
+
"dashboard.title": "Admin Dashboard",
|
|
35
|
+
"dashboard.welcome": "Welcome!",
|
|
36
|
+
"delete.confirm.description":
|
|
37
|
+
"This action cannot be undone. This will permanently delete this item.",
|
|
38
|
+
"delete.confirm.title": "Are you sure?",
|
|
39
|
+
"entity.create": (name: string) => `Create ${name}`,
|
|
40
|
+
"entity.edit": (name: string, id: number) => `Edit ${name} (#${id})`,
|
|
41
|
+
"entity.list": (name: string) => `${name} List`,
|
|
42
|
+
"entity.listManage": (name: string) => `Manage ${name} List`,
|
|
43
|
+
"error.alreadyProcessed": "Already processed",
|
|
44
|
+
"error.badRequest": "Bad request",
|
|
45
|
+
"error.duplicateRow": "Duplicate data",
|
|
46
|
+
"error.forbidden": "Forbidden",
|
|
47
|
+
"error.internalServerError": "Internal server error",
|
|
48
|
+
"error.notFound": "Not found",
|
|
49
|
+
"error.serviceUnavailable": "Service unavailable",
|
|
50
|
+
"error.unauthorized": "Unauthorized",
|
|
51
|
+
notFound: (name: string, id: number) => `${name} ID ${id} not found`,
|
|
52
|
+
"validation.email": "Invalid email format",
|
|
53
|
+
"validation.maxLength": (field: string, max: number) =>
|
|
54
|
+
`${field} must be at most ${max} characters`,
|
|
55
|
+
"validation.minLength": (field: string, min: number) =>
|
|
56
|
+
`${field} must be at least ${min} characters`,
|
|
57
|
+
"validation.required": (field: string) => `${field} is required`,
|
|
58
|
+
"validation.url": "Invalid URL format",
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { josa } from "sonamu/dict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Project KO Dictionary
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
"common.all": "전체",
|
|
8
|
+
"common.backToList": "목록으로",
|
|
9
|
+
"common.cancel": "취소",
|
|
10
|
+
"common.close": "닫기",
|
|
11
|
+
"common.confirm": "확인",
|
|
12
|
+
"common.create": "생성",
|
|
13
|
+
"common.createdAt": "등록",
|
|
14
|
+
"common.delete": "삭제",
|
|
15
|
+
"common.edit": "수정",
|
|
16
|
+
"common.login": "로그인",
|
|
17
|
+
"common.logout": "로그아웃",
|
|
18
|
+
"common.manage": "관리",
|
|
19
|
+
"common.results": (count: number) => `${count}개 결과`,
|
|
20
|
+
"common.save": "저장",
|
|
21
|
+
"common.search": "검색",
|
|
22
|
+
"common.searchPlaceholder": "검색...",
|
|
23
|
+
"common.searchType": "검색 유형",
|
|
24
|
+
"common.sort": "정렬",
|
|
25
|
+
"confirm.delete": "정말 삭제하시겠습니까?",
|
|
26
|
+
"confirm.save": "저장하시겠습니까?",
|
|
27
|
+
"dashboard.adminMenu": "관리 메뉴",
|
|
28
|
+
"dashboard.createdAt": "가입일",
|
|
29
|
+
"dashboard.email": "이메일",
|
|
30
|
+
"dashboard.loginRequired": "로그인이 필요합니다.",
|
|
31
|
+
"dashboard.name": "이름",
|
|
32
|
+
"dashboard.role": "역할",
|
|
33
|
+
"dashboard.title": "관리자 대시보드",
|
|
34
|
+
"dashboard.welcome": "환영합니다!",
|
|
35
|
+
"delete.confirm.description": "이 작업은 취소할 수 없습니다. 항목이 영구적으로 삭제됩니다.",
|
|
36
|
+
"delete.confirm.title": "정말 삭제하시겠습니까?",
|
|
37
|
+
"entity.create": (name: string) => `${name} 생성`,
|
|
38
|
+
"entity.edit": (name: string, id: number) => `${name} 수정 (#${id})`,
|
|
39
|
+
"entity.list": (name: string) => `${name} 목록`,
|
|
40
|
+
"entity.listManage": (name: string) => `${name} 목록 관리`,
|
|
41
|
+
"error.alreadyProcessed": "이미 처리되었습니다",
|
|
42
|
+
"error.badRequest": "잘못된 요청입니다",
|
|
43
|
+
"error.duplicateRow": "중복된 데이터입니다",
|
|
44
|
+
"error.entityNotFound": (name: string, id: number | string) => `존재하지 않는 ${name} ID ${id}`,
|
|
45
|
+
"error.forbidden": "권한이 없습니다",
|
|
46
|
+
"error.internalServerError": "서버 오류가 발생했습니다",
|
|
47
|
+
"error.notFound": "찾을 수 없습니다",
|
|
48
|
+
"error.serviceUnavailable": "서비스를 사용할 수 없습니다",
|
|
49
|
+
"error.unauthorized": "인증이 필요합니다",
|
|
50
|
+
"error.unknownSearchField": (field: string) => `구현되지 않은 검색 필드 ${field}`,
|
|
51
|
+
notFound: (name: string, id: number) => `존재하지 않는 ${name} ID ${id}`,
|
|
52
|
+
"validation.email": "올바른 이메일 형식이 아닙니다",
|
|
53
|
+
"validation.maxLength": (field: string, max: number) =>
|
|
54
|
+
`${field}${josa(field, "은는")} 최대 ${max}자까지 입력할 수 있습니다`,
|
|
55
|
+
"validation.minLength": (field: string, min: number) =>
|
|
56
|
+
`${field}${josa(field, "은는")} 최소 ${min}자 이상이어야 합니다`,
|
|
57
|
+
"validation.required": (field: string) => `${josa(field, "은는")} 필수입니다`,
|
|
58
|
+
"validation.url": "올바른 URL 형식이 아닙니다",
|
|
59
|
+
} as const;
|