@akanjs/dictionary 0.0.44 → 0.0.45

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.
Files changed (2) hide show
  1. package/index.js +1247 -1238
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,210 +1,220 @@
1
- (() => {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined")
12
- return require.apply(this, arguments);
13
- throw Error('Dynamic require of "' + x + '" is not supported');
14
- });
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
28
 
32
- // pkgs/@akanjs/common/src/isDayjs.ts
33
- var import_dayjs = __require("dayjs");
29
+ // pkgs/@akanjs/dictionary/index.ts
30
+ var dictionary_exports = {};
31
+ __export(dictionary_exports, {
32
+ baseTrans: () => baseTrans,
33
+ checkDictCoverage: () => checkDictCoverage,
34
+ getBaseSignalTrans: () => getBaseSignalTrans,
35
+ makeDictionary: () => makeDictionary,
36
+ makeTrans: () => makeTrans,
37
+ msg: () => msg,
38
+ rootDictionary: () => rootDictionary
39
+ });
40
+ module.exports = __toCommonJS(dictionary_exports);
34
41
 
35
- // pkgs/@akanjs/common/src/isQueryEqual.ts
36
- var import_dayjs2 = __toESM(__require("dayjs"));
42
+ // pkgs/@akanjs/common/src/isDayjs.ts
43
+ var import_dayjs = require("dayjs");
37
44
 
38
- // pkgs/@akanjs/common/src/isValidDate.ts
39
- var import_dayjs3 = __toESM(__require("dayjs"));
40
- var import_customParseFormat = __toESM(__require("dayjs/plugin/customParseFormat"));
41
- import_dayjs3.default.extend(import_customParseFormat.default);
45
+ // pkgs/@akanjs/common/src/isQueryEqual.ts
46
+ var import_dayjs2 = __toESM(require("dayjs"));
42
47
 
43
- // pkgs/@akanjs/common/src/pluralize.ts
44
- var import_pluralize = __toESM(__require("pluralize"));
48
+ // pkgs/@akanjs/common/src/isValidDate.ts
49
+ var import_dayjs3 = __toESM(require("dayjs"));
50
+ var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
51
+ import_dayjs3.default.extend(import_customParseFormat.default);
45
52
 
46
- // pkgs/@akanjs/common/src/capitalize.ts
47
- var capitalize = (str) => {
48
- return str.charAt(0).toUpperCase() + str.slice(1);
49
- };
53
+ // pkgs/@akanjs/common/src/pluralize.ts
54
+ var import_pluralize = __toESM(require("pluralize"));
50
55
 
51
- // pkgs/@akanjs/common/src/Logger.ts
52
- var import_dayjs4 = __toESM(__require("dayjs"));
53
- var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
54
- var clc = {
55
- bold: (text) => `\x1B[1m${text}\x1B[0m`,
56
- green: (text) => `\x1B[32m${text}\x1B[39m`,
57
- yellow: (text) => `\x1B[33m${text}\x1B[39m`,
58
- red: (text) => `\x1B[31m${text}\x1B[39m`,
59
- magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
60
- cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
61
- };
62
- var colorizeMap = {
63
- trace: clc.bold,
64
- verbose: clc.cyanBright,
65
- debug: clc.magentaBright,
66
- log: clc.green,
67
- info: clc.green,
68
- warn: clc.yellow,
69
- error: clc.red
70
- };
71
- var Logger = class _Logger {
72
- static #ignoreCtxSet = /* @__PURE__ */ new Set([
73
- "InstanceLoader",
74
- "RoutesResolver",
75
- "RouterExplorer",
76
- "NestFactory",
77
- "WebSocketsController",
78
- "GraphQLModule",
79
- "NestApplication"
80
- ]);
81
- static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
82
- static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
83
- static #startAt = (0, import_dayjs4.default)();
84
- static setLevel(level) {
85
- this.level = level;
86
- this.#levelIdx = logLevels.findIndex((l) => l === level);
87
- }
88
- name;
89
- constructor(name) {
90
- this.name = name;
91
- }
92
- trace(msg2, context = "") {
93
- if (_Logger.#levelIdx <= 0)
94
- _Logger.#printMessages(this.name ?? "App", msg2, context, "trace");
95
- }
96
- verbose(msg2, context = "") {
97
- if (_Logger.#levelIdx <= 1)
98
- _Logger.#printMessages(this.name ?? "App", msg2, context, "verbose");
99
- }
100
- debug(msg2, context = "") {
101
- if (_Logger.#levelIdx <= 2)
102
- _Logger.#printMessages(this.name ?? "App", msg2, context, "debug");
103
- }
104
- log(msg2, context = "") {
105
- if (_Logger.#levelIdx <= 3)
106
- _Logger.#printMessages(this.name ?? "App", msg2, context, "log");
107
- }
108
- info(msg2, context = "") {
109
- if (_Logger.#levelIdx <= 4)
110
- _Logger.#printMessages(this.name ?? "App", msg2, context, "info");
111
- }
112
- warn(msg2, context = "") {
113
- if (_Logger.#levelIdx <= 5)
114
- _Logger.#printMessages(this.name ?? "App", msg2, context, "warn");
115
- }
116
- error(msg2, context = "") {
117
- if (_Logger.#levelIdx <= 6)
118
- _Logger.#printMessages(this.name ?? "App", msg2, context, "error");
119
- }
120
- raw(msg2, method) {
121
- _Logger.rawLog(msg2, method);
122
- }
123
- rawLog(msg2, method) {
124
- _Logger.rawLog(msg2, method);
125
- }
126
- static trace(msg2, context = "") {
127
- if (_Logger.#levelIdx <= 0)
128
- _Logger.#printMessages("App", msg2, context, "trace");
129
- }
130
- static verbose(msg2, context = "") {
131
- if (_Logger.#levelIdx <= 1)
132
- _Logger.#printMessages("App", msg2, context, "verbose");
133
- }
134
- static debug(msg2, context = "") {
135
- if (_Logger.#levelIdx <= 2)
136
- _Logger.#printMessages("App", msg2, context, "debug");
137
- }
138
- static log(msg2, context = "") {
139
- if (_Logger.#levelIdx <= 3)
140
- _Logger.#printMessages("App", msg2, context, "log");
141
- }
142
- static info(msg2, context = "") {
143
- if (_Logger.#levelIdx <= 4)
144
- _Logger.#printMessages("App", msg2, context, "info");
145
- }
146
- static warn(msg2, context = "") {
147
- if (_Logger.#levelIdx <= 5)
148
- _Logger.#printMessages("App", msg2, context, "warn");
149
- }
150
- static error(msg2, context = "") {
151
- if (_Logger.#levelIdx <= 6)
152
- _Logger.#printMessages("App", msg2, context, "error");
153
- }
154
- static #colorize(msg2, logLevel) {
155
- return colorizeMap[logLevel](msg2);
156
- }
157
- static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
158
- if (this.#ignoreCtxSet.has(context))
159
- return;
160
- const now = (0, import_dayjs4.default)();
161
- const processMsg = this.#colorize(
162
- `[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
163
- logLevel
164
- );
165
- const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
166
- const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
167
- const contextMsg = context ? clc.yellow(`[${context}] `) : "";
168
- const contentMsg = this.#colorize(content, logLevel);
169
- const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
170
- if (typeof window === "undefined")
171
- process[writeStreamType].write(
172
- `${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
56
+ // pkgs/@akanjs/common/src/capitalize.ts
57
+ var capitalize = (str) => {
58
+ return str.charAt(0).toUpperCase() + str.slice(1);
59
+ };
60
+
61
+ // pkgs/@akanjs/common/src/Logger.ts
62
+ var import_dayjs4 = __toESM(require("dayjs"));
63
+ var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
64
+ var clc = {
65
+ bold: (text) => `\x1B[1m${text}\x1B[0m`,
66
+ green: (text) => `\x1B[32m${text}\x1B[39m`,
67
+ yellow: (text) => `\x1B[33m${text}\x1B[39m`,
68
+ red: (text) => `\x1B[31m${text}\x1B[39m`,
69
+ magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
70
+ cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
71
+ };
72
+ var colorizeMap = {
73
+ trace: clc.bold,
74
+ verbose: clc.cyanBright,
75
+ debug: clc.magentaBright,
76
+ log: clc.green,
77
+ info: clc.green,
78
+ warn: clc.yellow,
79
+ error: clc.red
80
+ };
81
+ var Logger = class _Logger {
82
+ static #ignoreCtxSet = /* @__PURE__ */ new Set([
83
+ "InstanceLoader",
84
+ "RoutesResolver",
85
+ "RouterExplorer",
86
+ "NestFactory",
87
+ "WebSocketsController",
88
+ "GraphQLModule",
89
+ "NestApplication"
90
+ ]);
91
+ static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
92
+ static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
93
+ static #startAt = (0, import_dayjs4.default)();
94
+ static setLevel(level) {
95
+ this.level = level;
96
+ this.#levelIdx = logLevels.findIndex((l) => l === level);
97
+ }
98
+ name;
99
+ constructor(name) {
100
+ this.name = name;
101
+ }
102
+ trace(msg2, context = "") {
103
+ if (_Logger.#levelIdx <= 0)
104
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "trace");
105
+ }
106
+ verbose(msg2, context = "") {
107
+ if (_Logger.#levelIdx <= 1)
108
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "verbose");
109
+ }
110
+ debug(msg2, context = "") {
111
+ if (_Logger.#levelIdx <= 2)
112
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "debug");
113
+ }
114
+ log(msg2, context = "") {
115
+ if (_Logger.#levelIdx <= 3)
116
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "log");
117
+ }
118
+ info(msg2, context = "") {
119
+ if (_Logger.#levelIdx <= 4)
120
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "info");
121
+ }
122
+ warn(msg2, context = "") {
123
+ if (_Logger.#levelIdx <= 5)
124
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "warn");
125
+ }
126
+ error(msg2, context = "") {
127
+ if (_Logger.#levelIdx <= 6)
128
+ _Logger.#printMessages(this.name ?? "App", msg2, context, "error");
129
+ }
130
+ raw(msg2, method) {
131
+ _Logger.rawLog(msg2, method);
132
+ }
133
+ rawLog(msg2, method) {
134
+ _Logger.rawLog(msg2, method);
135
+ }
136
+ static trace(msg2, context = "") {
137
+ if (_Logger.#levelIdx <= 0)
138
+ _Logger.#printMessages("App", msg2, context, "trace");
139
+ }
140
+ static verbose(msg2, context = "") {
141
+ if (_Logger.#levelIdx <= 1)
142
+ _Logger.#printMessages("App", msg2, context, "verbose");
143
+ }
144
+ static debug(msg2, context = "") {
145
+ if (_Logger.#levelIdx <= 2)
146
+ _Logger.#printMessages("App", msg2, context, "debug");
147
+ }
148
+ static log(msg2, context = "") {
149
+ if (_Logger.#levelIdx <= 3)
150
+ _Logger.#printMessages("App", msg2, context, "log");
151
+ }
152
+ static info(msg2, context = "") {
153
+ if (_Logger.#levelIdx <= 4)
154
+ _Logger.#printMessages("App", msg2, context, "info");
155
+ }
156
+ static warn(msg2, context = "") {
157
+ if (_Logger.#levelIdx <= 5)
158
+ _Logger.#printMessages("App", msg2, context, "warn");
159
+ }
160
+ static error(msg2, context = "") {
161
+ if (_Logger.#levelIdx <= 6)
162
+ _Logger.#printMessages("App", msg2, context, "error");
163
+ }
164
+ static #colorize(msg2, logLevel) {
165
+ return colorizeMap[logLevel](msg2);
166
+ }
167
+ static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
168
+ if (this.#ignoreCtxSet.has(context))
169
+ return;
170
+ const now = (0, import_dayjs4.default)();
171
+ const processMsg = this.#colorize(
172
+ `[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
173
+ logLevel
174
+ );
175
+ const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
176
+ const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
177
+ const contextMsg = context ? clc.yellow(`[${context}] `) : "";
178
+ const contentMsg = this.#colorize(content, logLevel);
179
+ const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
180
+ if (typeof window === "undefined")
181
+ process[writeStreamType].write(
182
+ `${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
173
183
  `
174
- );
175
- else
176
- console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
184
+ );
185
+ else
186
+ console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
177
187
  `);
178
- }
179
- static rawLog(msg2, method) {
180
- this.raw(`${msg2}
188
+ }
189
+ static rawLog(msg2, method) {
190
+ this.raw(`${msg2}
181
191
  `, method);
182
- }
183
- static raw(msg2, method) {
184
- if (typeof window === "undefined" && method !== "console" && global.process)
185
- global.process.stdout.write(msg2);
186
- else
187
- console.log(msg2);
188
- }
189
- };
192
+ }
193
+ static raw(msg2, method) {
194
+ if (typeof window === "undefined" && method !== "console" && global.process)
195
+ global.process.stdout.write(msg2);
196
+ else
197
+ console.log(msg2);
198
+ }
199
+ };
190
200
 
191
- // pkgs/@akanjs/common/src/lowerlize.ts
192
- var lowerlize = (str) => {
193
- return str.charAt(0).toLowerCase() + str.slice(1);
194
- };
201
+ // pkgs/@akanjs/common/src/lowerlize.ts
202
+ var lowerlize = (str) => {
203
+ return str.charAt(0).toLowerCase() + str.slice(1);
204
+ };
195
205
 
196
- // pkgs/@akanjs/common/src/sleep.ts
197
- var sleep = async (ms) => {
198
- return new Promise((resolve) => {
199
- setTimeout(() => {
200
- resolve(true);
201
- }, ms);
202
- });
203
- };
206
+ // pkgs/@akanjs/common/src/sleep.ts
207
+ var sleep = async (ms) => {
208
+ return new Promise((resolve) => {
209
+ setTimeout(() => {
210
+ resolve(true);
211
+ }, ms);
212
+ });
213
+ };
204
214
 
205
- // pkgs/@akanjs/base/src/base.ts
206
- var version = "0.9.0";
207
- var logo = `
215
+ // pkgs/@akanjs/base/src/base.ts
216
+ var version = "0.9.0";
217
+ var logo = `
208
218
  _ _ _
209
219
  / \\ | | ____ _ _ __ (_)___
210
220
  / _ \\ | |/ / _' | '_ \\ | / __|
@@ -216,1083 +226,1082 @@
216
226
 
217
227
  `;
218
228
 
219
- // pkgs/@akanjs/base/src/baseEnv.ts
220
- var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
221
- var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
222
- var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
223
- if (appName === "unknown")
224
- throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
225
- if (repoName === "unknown")
226
- throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
227
- if (serveDomain === "unknown")
228
- throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
229
- var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
230
- var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
231
- var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
232
- var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
233
- var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
234
- var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
235
- var baseEnv = {
236
- repoName,
237
- serveDomain,
238
- appName,
239
- environment,
240
- operationType,
241
- operationMode,
242
- networkType,
243
- tunnelUsername,
244
- tunnelPassword
245
- };
246
- var side = typeof window === "undefined" ? "server" : "client";
247
- var renderMode = process.env.RENDER_ENV ?? "ssr";
248
- var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
249
- var clientPort = parseInt(
250
- process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
251
- );
252
- var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
253
- var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
254
- var serverHost = process.env.SERVER_HOST ?? (operationMode === "local" ? typeof window === "undefined" ? "localhost" : window.location.host.split(":")[0] : renderMode === "csr" ? `${appName}-${environment}.${serveDomain}` : side === "client" ? window.location.host.split(":")[0] : operationMode === "cloud" ? `backend-svc.${appName}-${environment}.svc.cluster.local` : "localhost");
255
- var serverPort = parseInt(
256
- process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
257
- );
258
- var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
259
- var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
260
- var serverGraphqlUri = `${serverHttpUri}/graphql`;
261
- var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
262
- var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
263
- var baseClientEnv = {
264
- ...baseEnv,
265
- side,
266
- renderMode,
267
- websocket: true,
268
- clientHost,
269
- clientPort,
270
- clientHttpProtocol,
271
- clientHttpUri,
272
- serverHost,
273
- serverPort,
274
- serverHttpProtocol,
275
- serverHttpUri,
276
- serverGraphqlUri,
277
- serverWsProtocol,
278
- serverWsUri
279
- };
229
+ // pkgs/@akanjs/base/src/baseEnv.ts
230
+ var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
231
+ var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
232
+ var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
233
+ if (appName === "unknown")
234
+ throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
235
+ if (repoName === "unknown")
236
+ throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
237
+ if (serveDomain === "unknown")
238
+ throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
239
+ var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
240
+ var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
241
+ var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
242
+ var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
243
+ var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
244
+ var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
245
+ var baseEnv = {
246
+ repoName,
247
+ serveDomain,
248
+ appName,
249
+ environment,
250
+ operationType,
251
+ operationMode,
252
+ networkType,
253
+ tunnelUsername,
254
+ tunnelPassword
255
+ };
256
+ var side = typeof window === "undefined" ? "server" : "client";
257
+ var renderMode = process.env.RENDER_ENV ?? "ssr";
258
+ var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
259
+ var clientPort = parseInt(
260
+ process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
261
+ );
262
+ var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
263
+ var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
264
+ var serverHost = process.env.SERVER_HOST ?? (operationMode === "local" ? typeof window === "undefined" ? "localhost" : window.location.host.split(":")[0] : renderMode === "csr" ? `${appName}-${environment}.${serveDomain}` : side === "client" ? window.location.host.split(":")[0] : operationMode === "cloud" ? `backend-svc.${appName}-${environment}.svc.cluster.local` : "localhost");
265
+ var serverPort = parseInt(
266
+ process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
267
+ );
268
+ var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
269
+ var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
270
+ var serverGraphqlUri = `${serverHttpUri}/graphql`;
271
+ var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
272
+ var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
273
+ var baseClientEnv = {
274
+ ...baseEnv,
275
+ side,
276
+ renderMode,
277
+ websocket: true,
278
+ clientHost,
279
+ clientPort,
280
+ clientHttpProtocol,
281
+ clientHttpUri,
282
+ serverHost,
283
+ serverPort,
284
+ serverHttpProtocol,
285
+ serverHttpUri,
286
+ serverGraphqlUri,
287
+ serverWsProtocol,
288
+ serverWsUri
289
+ };
280
290
 
281
- // pkgs/@akanjs/base/src/scalar.ts
282
- var import_dayjs5 = __toESM(__require("dayjs"));
283
- var dayjs4 = import_dayjs5.default;
284
- var Int = class {
285
- __Scalar__;
286
- };
287
- var Upload = class {
288
- __Scalar__;
289
- filename;
290
- mimetype;
291
- encoding;
292
- createReadStream;
293
- };
294
- var Float = class {
295
- __Scalar__;
296
- };
297
- var ID = class {
298
- __Scalar__;
299
- };
300
- var JSON2 = class {
301
- __Scalar__;
302
- };
303
- var getNonArrayModel = (arraiedModel2) => {
304
- let arrDepth = 0;
305
- let target = arraiedModel2;
306
- while (Array.isArray(target)) {
307
- target = target[0];
308
- arrDepth++;
309
- }
310
- return [target, arrDepth];
311
- };
312
- var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON2, Map]);
313
- var scalarNameMap = /* @__PURE__ */ new Map([
314
- [ID, "ID"],
315
- [Int, "Int"],
316
- [Float, "Float"],
317
- [String, "String"],
318
- [Boolean, "Boolean"],
319
- [Date, "Date"],
320
- [Upload, "Upload"],
321
- [JSON2, "JSON"],
322
- [Map, "Map"]
323
- ]);
324
- var scalarArgMap = /* @__PURE__ */ new Map([
325
- [ID, null],
326
- [String, ""],
327
- [Boolean, false],
328
- [Date, dayjs4(/* @__PURE__ */ new Date(-1))],
329
- [Int, 0],
330
- [Float, 0],
331
- [JSON2, {}],
332
- [Map, {}]
333
- ]);
334
- var scalarDefaultMap = /* @__PURE__ */ new Map([
335
- [ID, null],
336
- [String, ""],
337
- [Boolean, false],
338
- [Date, dayjs4(/* @__PURE__ */ new Date(-1))],
339
- [Int, 0],
340
- [Float, 0],
341
- [JSON2, {}]
342
- ]);
343
- var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
344
- var isGqlMap = (modelRef) => modelRef === Map;
291
+ // pkgs/@akanjs/base/src/scalar.ts
292
+ var import_dayjs5 = __toESM(require("dayjs"));
293
+ var dayjs4 = import_dayjs5.default;
294
+ var Int = class {
295
+ __Scalar__;
296
+ };
297
+ var Upload = class {
298
+ __Scalar__;
299
+ filename;
300
+ mimetype;
301
+ encoding;
302
+ createReadStream;
303
+ };
304
+ var Float = class {
305
+ __Scalar__;
306
+ };
307
+ var ID = class {
308
+ __Scalar__;
309
+ };
310
+ var JSON2 = class {
311
+ __Scalar__;
312
+ };
313
+ var getNonArrayModel = (arraiedModel2) => {
314
+ let arrDepth = 0;
315
+ let target = arraiedModel2;
316
+ while (Array.isArray(target)) {
317
+ target = target[0];
318
+ arrDepth++;
319
+ }
320
+ return [target, arrDepth];
321
+ };
322
+ var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON2, Map]);
323
+ var scalarNameMap = /* @__PURE__ */ new Map([
324
+ [ID, "ID"],
325
+ [Int, "Int"],
326
+ [Float, "Float"],
327
+ [String, "String"],
328
+ [Boolean, "Boolean"],
329
+ [Date, "Date"],
330
+ [Upload, "Upload"],
331
+ [JSON2, "JSON"],
332
+ [Map, "Map"]
333
+ ]);
334
+ var scalarArgMap = /* @__PURE__ */ new Map([
335
+ [ID, null],
336
+ [String, ""],
337
+ [Boolean, false],
338
+ [Date, dayjs4(/* @__PURE__ */ new Date(-1))],
339
+ [Int, 0],
340
+ [Float, 0],
341
+ [JSON2, {}],
342
+ [Map, {}]
343
+ ]);
344
+ var scalarDefaultMap = /* @__PURE__ */ new Map([
345
+ [ID, null],
346
+ [String, ""],
347
+ [Boolean, false],
348
+ [Date, dayjs4(/* @__PURE__ */ new Date(-1))],
349
+ [Int, 0],
350
+ [Float, 0],
351
+ [JSON2, {}]
352
+ ]);
353
+ var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
354
+ var isGqlMap = (modelRef) => modelRef === Map;
345
355
 
346
- // pkgs/@akanjs/constant/src/scalar.ts
347
- var import_reflect_metadata = __require("reflect-metadata");
348
- var scalarExampleMap = /* @__PURE__ */ new Map([
349
- [ID, "1234567890abcdef12345678"],
350
- [Int, 0],
351
- [Float, 0],
352
- [String, "String"],
353
- [Boolean, true],
354
- [Date, (/* @__PURE__ */ new Date()).toISOString()],
355
- [Upload, "FileUpload"],
356
- [JSON2, {}],
357
- [Map, {}]
358
- ]);
359
- var getClassMeta = (modelRef) => {
360
- const [target] = getNonArrayModel(modelRef);
361
- const classMeta = Reflect.getMetadata("class", target.prototype);
362
- if (!classMeta)
363
- throw new Error(`No ClassMeta for this target ${target.name}`);
364
- return classMeta;
365
- };
366
- var getFieldMetas = (modelRef) => {
367
- const [target] = getNonArrayModel(modelRef);
368
- const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
369
- const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
370
- return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
371
- };
372
- var getFieldMetaMap = (modelRef) => {
373
- const [target] = getNonArrayModel(modelRef);
374
- const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
375
- return new Map(metadataMap);
376
- };
377
- var getFieldMetaMapOnPrototype = (prototype) => {
378
- const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
379
- return new Map(metadataMap);
380
- };
381
- var setFieldMetaMapOnPrototype = (prototype, metadataMap) => {
382
- Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
383
- };
356
+ // pkgs/@akanjs/constant/src/scalar.ts
357
+ var import_reflect_metadata = require("reflect-metadata");
358
+ var scalarExampleMap = /* @__PURE__ */ new Map([
359
+ [ID, "1234567890abcdef12345678"],
360
+ [Int, 0],
361
+ [Float, 0],
362
+ [String, "String"],
363
+ [Boolean, true],
364
+ [Date, (/* @__PURE__ */ new Date()).toISOString()],
365
+ [Upload, "FileUpload"],
366
+ [JSON2, {}],
367
+ [Map, {}]
368
+ ]);
369
+ var getClassMeta = (modelRef) => {
370
+ const [target] = getNonArrayModel(modelRef);
371
+ const classMeta = Reflect.getMetadata("class", target.prototype);
372
+ if (!classMeta)
373
+ throw new Error(`No ClassMeta for this target ${target.name}`);
374
+ return classMeta;
375
+ };
376
+ var getFieldMetas = (modelRef) => {
377
+ const [target] = getNonArrayModel(modelRef);
378
+ const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
379
+ const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
380
+ return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
381
+ };
382
+ var getFieldMetaMap = (modelRef) => {
383
+ const [target] = getNonArrayModel(modelRef);
384
+ const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
385
+ return new Map(metadataMap);
386
+ };
387
+ var getFieldMetaMapOnPrototype = (prototype) => {
388
+ const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
389
+ return new Map(metadataMap);
390
+ };
391
+ var setFieldMetaMapOnPrototype = (prototype, metadataMap) => {
392
+ Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
393
+ };
384
394
 
385
- // pkgs/@akanjs/constant/src/fieldMeta.ts
386
- var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
387
- const isArray = arrDepth > 0;
388
- const isClass = !isGqlScalar(modelRef);
389
- const isMap = isGqlMap(modelRef);
390
- const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
391
- const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
392
- if (isMap && !option.of)
393
- throw new Error("Map type must have 'of' option");
394
- return (prototype, key) => {
395
- const metadata = {
396
- nullable: option.nullable ?? false,
397
- ref: option.ref,
398
- refPath: option.refPath,
399
- refType: option.refType,
400
- default: option.default ?? (isArray ? [] : null),
401
- type: option.type,
402
- fieldType: option.fieldType ?? "property",
403
- immutable: option.immutable ?? false,
404
- min: option.min,
405
- max: option.max,
406
- enum: option.enum,
407
- select: option.select ?? true,
408
- minlength: option.minlength,
409
- maxlength: option.maxlength,
410
- query: option.query,
411
- accumulate: option.accumulate,
412
- example: option.example,
413
- validate: option.validate,
414
- key,
415
- name,
416
- isClass,
417
- isScalar: type === "scalar",
418
- modelRef,
419
- arrDepth,
420
- isArray,
421
- optArrDepth: optionArrDepth,
422
- isMap,
423
- of: option.of,
424
- text: option.text
425
- };
426
- const metadataMap = getFieldMetaMapOnPrototype(prototype);
427
- metadataMap.set(key, metadata);
428
- setFieldMetaMapOnPrototype(prototype, metadataMap);
395
+ // pkgs/@akanjs/constant/src/fieldMeta.ts
396
+ var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
397
+ const isArray = arrDepth > 0;
398
+ const isClass = !isGqlScalar(modelRef);
399
+ const isMap = isGqlMap(modelRef);
400
+ const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
401
+ const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
402
+ if (isMap && !option.of)
403
+ throw new Error("Map type must have 'of' option");
404
+ return (prototype, key) => {
405
+ const metadata = {
406
+ nullable: option.nullable ?? false,
407
+ ref: option.ref,
408
+ refPath: option.refPath,
409
+ refType: option.refType,
410
+ default: option.default ?? (isArray ? [] : null),
411
+ type: option.type,
412
+ fieldType: option.fieldType ?? "property",
413
+ immutable: option.immutable ?? false,
414
+ min: option.min,
415
+ max: option.max,
416
+ enum: option.enum,
417
+ select: option.select ?? true,
418
+ minlength: option.minlength,
419
+ maxlength: option.maxlength,
420
+ query: option.query,
421
+ accumulate: option.accumulate,
422
+ example: option.example,
423
+ validate: option.validate,
424
+ key,
425
+ name,
426
+ isClass,
427
+ isScalar: type === "scalar",
428
+ modelRef,
429
+ arrDepth,
430
+ isArray,
431
+ optArrDepth: optionArrDepth,
432
+ isMap,
433
+ of: option.of,
434
+ text: option.text
429
435
  };
430
- };
431
- var makeField = (customOption) => (returns, fieldOption) => {
432
- const [modelRef, arrDepth] = getNonArrayModel(returns());
433
- if (!fieldOption)
434
- return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
435
- const [opt, optArrDepth] = getNonArrayModel(fieldOption);
436
- return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
437
- };
438
- var Field = {
439
- Prop: makeField({ fieldType: "property" }),
440
- Hidden: makeField({ fieldType: "hidden", nullable: true }),
441
- Secret: makeField({ fieldType: "hidden", select: false, nullable: true }),
442
- Resolve: makeField({ fieldType: "resolve" })
443
- };
436
+ const metadataMap = getFieldMetaMapOnPrototype(prototype);
437
+ metadataMap.set(key, metadata);
438
+ setFieldMetaMapOnPrototype(prototype, metadataMap);
439
+ };
440
+ };
441
+ var makeField = (customOption) => (returns, fieldOption) => {
442
+ const [modelRef, arrDepth] = getNonArrayModel(returns());
443
+ if (!fieldOption)
444
+ return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
445
+ const [opt, optArrDepth] = getNonArrayModel(fieldOption);
446
+ return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
447
+ };
448
+ var Field = {
449
+ Prop: makeField({ fieldType: "property" }),
450
+ Hidden: makeField({ fieldType: "hidden", nullable: true }),
451
+ Secret: makeField({ fieldType: "hidden", select: false, nullable: true }),
452
+ Resolve: makeField({ fieldType: "resolve" })
453
+ };
444
454
 
445
- // pkgs/@akanjs/constant/src/constantDecorator.ts
446
- var import_reflect_metadata2 = __require("reflect-metadata");
455
+ // pkgs/@akanjs/constant/src/constantDecorator.ts
456
+ var import_reflect_metadata2 = require("reflect-metadata");
447
457
 
448
- // pkgs/@akanjs/constant/src/filterMeta.ts
449
- var getFilterMeta = (filterRef) => {
450
- const filterMeta = Reflect.getMetadata("filter", filterRef.prototype);
451
- if (!filterMeta)
452
- throw new Error("filterMeta is not defined");
453
- return filterMeta;
454
- };
455
- var setFilterMeta = (filterRef, filterMeta) => {
456
- const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
457
- if (existingFilterMeta)
458
- Object.assign(filterMeta.sort, existingFilterMeta.sort);
459
- Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
460
- };
461
- var getFilterKeyMetaMapOnPrototype = (prototype) => {
462
- const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
463
- return new Map(metadataMap);
464
- };
465
- var setFilterKeyMetaMapOnPrototype = (prototype, metadataMap) => {
466
- Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
467
- };
468
- var applyFilterKeyMeta = (option) => {
469
- return (prototype, key, descriptor) => {
470
- const metadata = { key, ...option, descriptor };
471
- const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
472
- metadataMap.set(key, metadata);
473
- setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
474
- };
475
- };
476
- var makeFilter = (customOption) => (fieldOption) => {
477
- return applyFilterKeyMeta({ ...customOption, ...fieldOption });
478
- };
479
- var getFilterArgMetasOnPrototype = (prototype, key) => {
480
- const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
481
- return filterArgMetas;
482
- };
483
- var setFilterArgMetasOnPrototype = (prototype, key, filterArgMetas) => {
484
- Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
485
- };
486
- var getFilterArgMetas = (filterRef, key) => {
487
- const filterArgMetas = getFilterArgMetasOnPrototype(filterRef.prototype, key);
488
- return filterArgMetas;
489
- };
490
- var applyFilterArgMeta = (name, returns, argOption) => {
491
- return (prototype, key, idx) => {
492
- const [modelRef, arrDepth] = getNonArrayModel(returns());
493
- const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
494
- const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
495
- const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
496
- filterArgMetas[idx] = filterArgMeta;
497
- setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
498
- };
499
- };
500
- var getFilterQueryMap = (filterRef) => {
501
- const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(filterRef.prototype);
502
- return filterKeyMetaMap;
503
- };
504
- var getFilterSortMap = (filterRef) => {
505
- const filterMeta = getFilterMeta(filterRef);
506
- return filterMeta.sort;
507
- };
508
- var Filter = {
509
- Mongo: makeFilter({ type: "mongo" }),
510
- // Meili: makeFilter({ fieldType: "hidden", nullable: true }),
511
- Arg: applyFilterArgMeta
512
- };
458
+ // pkgs/@akanjs/constant/src/filterMeta.ts
459
+ var getFilterMeta = (filterRef) => {
460
+ const filterMeta = Reflect.getMetadata("filter", filterRef.prototype);
461
+ if (!filterMeta)
462
+ throw new Error("filterMeta is not defined");
463
+ return filterMeta;
464
+ };
465
+ var setFilterMeta = (filterRef, filterMeta) => {
466
+ const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
467
+ if (existingFilterMeta)
468
+ Object.assign(filterMeta.sort, existingFilterMeta.sort);
469
+ Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
470
+ };
471
+ var getFilterKeyMetaMapOnPrototype = (prototype) => {
472
+ const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
473
+ return new Map(metadataMap);
474
+ };
475
+ var setFilterKeyMetaMapOnPrototype = (prototype, metadataMap) => {
476
+ Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
477
+ };
478
+ var applyFilterKeyMeta = (option) => {
479
+ return (prototype, key, descriptor) => {
480
+ const metadata = { key, ...option, descriptor };
481
+ const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
482
+ metadataMap.set(key, metadata);
483
+ setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
484
+ };
485
+ };
486
+ var makeFilter = (customOption) => (fieldOption) => {
487
+ return applyFilterKeyMeta({ ...customOption, ...fieldOption });
488
+ };
489
+ var getFilterArgMetasOnPrototype = (prototype, key) => {
490
+ const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
491
+ return filterArgMetas;
492
+ };
493
+ var setFilterArgMetasOnPrototype = (prototype, key, filterArgMetas) => {
494
+ Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
495
+ };
496
+ var getFilterArgMetas = (filterRef, key) => {
497
+ const filterArgMetas = getFilterArgMetasOnPrototype(filterRef.prototype, key);
498
+ return filterArgMetas;
499
+ };
500
+ var applyFilterArgMeta = (name, returns, argOption) => {
501
+ return (prototype, key, idx) => {
502
+ const [modelRef, arrDepth] = getNonArrayModel(returns());
503
+ const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
504
+ const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
505
+ const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
506
+ filterArgMetas[idx] = filterArgMeta;
507
+ setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
508
+ };
509
+ };
510
+ var getFilterQueryMap = (filterRef) => {
511
+ const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(filterRef.prototype);
512
+ return filterKeyMetaMap;
513
+ };
514
+ var getFilterSortMap = (filterRef) => {
515
+ const filterMeta = getFilterMeta(filterRef);
516
+ return filterMeta.sort;
517
+ };
518
+ var Filter = {
519
+ Mongo: makeFilter({ type: "mongo" }),
520
+ // Meili: makeFilter({ fieldType: "hidden", nullable: true }),
521
+ Arg: applyFilterArgMeta
522
+ };
513
523
 
514
- // pkgs/@akanjs/constant/src/baseGql.ts
515
- var import_reflect_metadata3 = __require("reflect-metadata");
516
- var defaultFieldMeta = {
517
- fieldType: "property",
518
- immutable: false,
519
- select: true,
520
- isClass: false,
521
- isScalar: true,
522
- nullable: false,
523
- isArray: false,
524
- arrDepth: 0,
525
- optArrDepth: 0,
526
- default: null,
527
- isMap: false
528
- };
529
- var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
530
- var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
531
- var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
532
- var removedAtFieldMeta = {
533
- ...defaultFieldMeta,
534
- key: "removedAt",
535
- name: "Date",
536
- modelRef: Date,
537
- nullable: true,
538
- default: null
539
- };
524
+ // pkgs/@akanjs/constant/src/baseGql.ts
525
+ var import_reflect_metadata3 = require("reflect-metadata");
526
+ var defaultFieldMeta = {
527
+ fieldType: "property",
528
+ immutable: false,
529
+ select: true,
530
+ isClass: false,
531
+ isScalar: true,
532
+ nullable: false,
533
+ isArray: false,
534
+ arrDepth: 0,
535
+ optArrDepth: 0,
536
+ default: null,
537
+ isMap: false
538
+ };
539
+ var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
540
+ var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
541
+ var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
542
+ var removedAtFieldMeta = {
543
+ ...defaultFieldMeta,
544
+ key: "removedAt",
545
+ name: "Date",
546
+ modelRef: Date,
547
+ nullable: true,
548
+ default: null
549
+ };
540
550
 
541
- // pkgs/@akanjs/constant/src/classMeta.ts
542
- var import_reflect_metadata4 = __require("reflect-metadata");
543
- var InputModelStorage = class {
544
- };
545
- var LightModelStorage = class {
546
- };
547
- var FullModelStorage = class {
548
- };
549
- var ScalarModelStorage = class {
550
- };
551
- var FilterModelStorage = class {
552
- };
553
- var hasTextField = (modelRef) => {
554
- const fieldMetas = getFieldMetas(modelRef);
555
- return fieldMetas.some(
556
- (fieldMeta) => !!fieldMeta.text || fieldMeta.isScalar && fieldMeta.isClass && fieldMeta.select && hasTextField(fieldMeta.modelRef)
557
- );
558
- };
559
- var applyClassMeta = (type, modelType, storage) => {
560
- return function(refName) {
561
- return function(target) {
562
- const modelRef = target;
563
- const classMeta = { refName, type, modelType, modelRef, hasTextField: hasTextField(modelRef) };
564
- Reflect.defineMetadata("class", classMeta, modelRef.prototype);
565
- Reflect.defineMetadata(refName, modelRef, storage.prototype);
566
- };
551
+ // pkgs/@akanjs/constant/src/classMeta.ts
552
+ var import_reflect_metadata4 = require("reflect-metadata");
553
+ var InputModelStorage = class {
554
+ };
555
+ var LightModelStorage = class {
556
+ };
557
+ var FullModelStorage = class {
558
+ };
559
+ var ScalarModelStorage = class {
560
+ };
561
+ var FilterModelStorage = class {
562
+ };
563
+ var hasTextField = (modelRef) => {
564
+ const fieldMetas = getFieldMetas(modelRef);
565
+ return fieldMetas.some(
566
+ (fieldMeta) => !!fieldMeta.text || fieldMeta.isScalar && fieldMeta.isClass && fieldMeta.select && hasTextField(fieldMeta.modelRef)
567
+ );
568
+ };
569
+ var applyClassMeta = (type, modelType, storage) => {
570
+ return function(refName) {
571
+ return function(target) {
572
+ const modelRef = target;
573
+ const classMeta = { refName, type, modelType, modelRef, hasTextField: hasTextField(modelRef) };
574
+ Reflect.defineMetadata("class", classMeta, modelRef.prototype);
575
+ Reflect.defineMetadata(refName, modelRef, storage.prototype);
567
576
  };
568
577
  };
569
- var applyFilterMeta = (storage) => {
570
- return function(refName) {
571
- return function(target) {
572
- const modelRef = target;
573
- setFilterMeta(modelRef, { refName, sort: {} });
574
- Reflect.defineMetadata(refName, modelRef, storage.prototype);
575
- };
578
+ };
579
+ var applyFilterMeta = (storage) => {
580
+ return function(refName) {
581
+ return function(target) {
582
+ const modelRef = target;
583
+ setFilterMeta(modelRef, { refName, sort: {} });
584
+ Reflect.defineMetadata(refName, modelRef, storage.prototype);
576
585
  };
577
586
  };
578
- var Model = {
579
- Light: applyClassMeta("light", "data", LightModelStorage),
580
- Object: applyClassMeta("full", "ephemeral", FullModelStorage),
581
- Full: applyClassMeta("full", "data", FullModelStorage),
582
- Input: applyClassMeta("input", "data", InputModelStorage),
583
- Scalar: applyClassMeta("scalar", "data", ScalarModelStorage),
584
- Summary: applyClassMeta("scalar", "summary", ScalarModelStorage),
585
- Insight: applyClassMeta("scalar", "insight", ScalarModelStorage),
586
- Filter: applyFilterMeta(FilterModelStorage)
587
- };
588
- var getAllFullModelRefs = () => {
589
- const modelNames = Reflect.getMetadataKeys(FullModelStorage.prototype);
590
- const modelRefs = modelNames.map(
591
- (modelName) => Reflect.getMetadata(modelName, FullModelStorage.prototype)
592
- );
593
- return modelRefs;
594
- };
595
- var getAllScalarModelRefs = () => {
596
- const modelNames = Reflect.getMetadataKeys(ScalarModelStorage.prototype);
597
- const modelRefs = modelNames.map(
598
- (modelName) => Reflect.getMetadata(modelName, ScalarModelStorage.prototype)
599
- );
600
- return modelRefs;
601
- };
602
- var getAllFilterModelRefs = () => {
603
- const modelNames = Reflect.getMetadataKeys(FilterModelStorage.prototype);
604
- const modelRefs = modelNames.map(
605
- (modelName) => Reflect.getMetadata(modelName, FilterModelStorage.prototype)
606
- );
607
- return modelRefs;
608
- };
587
+ };
588
+ var Model = {
589
+ Light: applyClassMeta("light", "data", LightModelStorage),
590
+ Object: applyClassMeta("full", "ephemeral", FullModelStorage),
591
+ Full: applyClassMeta("full", "data", FullModelStorage),
592
+ Input: applyClassMeta("input", "data", InputModelStorage),
593
+ Scalar: applyClassMeta("scalar", "data", ScalarModelStorage),
594
+ Summary: applyClassMeta("scalar", "summary", ScalarModelStorage),
595
+ Insight: applyClassMeta("scalar", "insight", ScalarModelStorage),
596
+ Filter: applyFilterMeta(FilterModelStorage)
597
+ };
598
+ var getAllFullModelRefs = () => {
599
+ const modelNames = Reflect.getMetadataKeys(FullModelStorage.prototype);
600
+ const modelRefs = modelNames.map(
601
+ (modelName) => Reflect.getMetadata(modelName, FullModelStorage.prototype)
602
+ );
603
+ return modelRefs;
604
+ };
605
+ var getAllScalarModelRefs = () => {
606
+ const modelNames = Reflect.getMetadataKeys(ScalarModelStorage.prototype);
607
+ const modelRefs = modelNames.map(
608
+ (modelName) => Reflect.getMetadata(modelName, ScalarModelStorage.prototype)
609
+ );
610
+ return modelRefs;
611
+ };
612
+ var getAllFilterModelRefs = () => {
613
+ const modelNames = Reflect.getMetadataKeys(FilterModelStorage.prototype);
614
+ const modelRefs = modelNames.map(
615
+ (modelName) => Reflect.getMetadata(modelName, FilterModelStorage.prototype)
616
+ );
617
+ return modelRefs;
618
+ };
609
619
 
610
- // pkgs/@akanjs/signal/src/client.ts
611
- var import_core = __require("@urql/core");
612
- var import_socket = __require("socket.io-client");
613
- var SocketIo = class {
614
- socket;
615
- roomSubscribeMap = /* @__PURE__ */ new Map();
616
- constructor(uri) {
617
- this.socket = (0, import_socket.io)(uri, { transports: ["websocket"] });
618
- this.socket.on("connect", () => {
619
- this.roomSubscribeMap.forEach((option) => {
620
- this.socket.emit(option.key, { ...option.message, __subscribe__: true });
621
- });
622
- });
623
- }
624
- on(event, callback) {
625
- this.socket.on(event, callback);
626
- }
627
- removeListener(event, callback) {
628
- this.socket.removeListener(event, callback);
629
- }
630
- removeAllListeners() {
631
- this.socket.removeAllListeners();
632
- }
633
- hasListeners(event) {
634
- return this.socket.hasListeners(event);
635
- }
636
- emit(key, data) {
637
- this.socket.emit(key, data);
638
- }
639
- subscribe(option) {
640
- if (!this.roomSubscribeMap.has(option.roomId)) {
641
- this.roomSubscribeMap.set(option.roomId, option);
620
+ // pkgs/@akanjs/signal/src/client.ts
621
+ var import_core = require("@urql/core");
622
+ var import_socket = require("socket.io-client");
623
+ var SocketIo = class {
624
+ socket;
625
+ roomSubscribeMap = /* @__PURE__ */ new Map();
626
+ constructor(uri) {
627
+ this.socket = (0, import_socket.io)(uri, { transports: ["websocket"] });
628
+ this.socket.on("connect", () => {
629
+ this.roomSubscribeMap.forEach((option) => {
642
630
  this.socket.emit(option.key, { ...option.message, __subscribe__: true });
643
- }
644
- this.socket.on(option.roomId, option.handleEvent);
645
- }
646
- unsubscribe(roomId, handleEvent) {
647
- this.socket.removeListener(roomId, handleEvent);
648
- const option = this.roomSubscribeMap.get(roomId);
649
- if (this.hasListeners(roomId) || !option)
650
- return;
651
- this.roomSubscribeMap.delete(roomId);
652
- this.socket.emit(option.key, { ...option.message, __subscribe__: false });
653
- }
654
- disconnect() {
655
- this.socket.disconnect();
656
- return this;
657
- }
658
- };
659
- var Client = class _Client {
660
- static globalIoMap = /* @__PURE__ */ new Map();
661
- static tokenStore = /* @__PURE__ */ new Map();
662
- async waitUntilWebSocketConnected(ws = baseClientEnv.serverWsUri) {
663
- if (baseClientEnv.side === "server")
664
- return true;
665
- while (!this.getIo(ws).socket.connected) {
666
- Logger.verbose("waiting for websocket to initialize...");
667
- await sleep(300);
668
- }
669
- }
670
- isInitialized = false;
671
- uri = baseClientEnv.serverGraphqlUri;
672
- ws = baseClientEnv.serverWsUri;
673
- udp = null;
674
- gql = (0, import_core.createClient)({ url: this.uri, fetch, exchanges: [import_core.cacheExchange, import_core.fetchExchange] });
675
- jwt = null;
676
- async getJwt() {
677
- const isNextServer = baseClientEnv.side === "server" && baseEnv.operationType === "client";
678
- if (isNextServer) {
679
- const nextHeaders = __require("next/headers");
680
- return (await nextHeaders.cookies?.())?.get("jwt")?.value ?? (await nextHeaders.headers?.())?.get("jwt") ?? this.jwt ?? null;
681
- } else
682
- return _Client.tokenStore.get(this) ?? null;
683
- }
684
- io = null;
685
- init(data = {}) {
686
- Object.assign(this, data);
687
- this.setLink(data.uri);
688
- this.setIo(data.ws);
689
- this.isInitialized = true;
690
- }
691
- setIo(ws = baseClientEnv.serverWsUri) {
692
- this.ws = ws;
693
- const existingIo = _Client.globalIoMap.get(ws);
694
- if (existingIo) {
695
- this.io = existingIo;
696
- return;
697
- }
698
- this.io = new SocketIo(ws);
699
- _Client.globalIoMap.set(ws, this.io);
700
- }
701
- getIo(ws = baseClientEnv.serverWsUri) {
702
- const existingIo = _Client.globalIoMap.get(ws);
703
- if (existingIo)
704
- return existingIo;
705
- const io2 = new SocketIo(ws);
706
- _Client.globalIoMap.set(ws, io2);
707
- return io2;
708
- }
709
- setLink(uri = baseClientEnv.serverGraphqlUri) {
710
- this.uri = uri;
711
- this.gql = (0, import_core.createClient)({
712
- url: this.uri,
713
- fetch,
714
- exchanges: [import_core.cacheExchange, import_core.fetchExchange],
715
- // requestPolicy: "network-only",
716
- fetchOptions: () => {
717
- return {
718
- headers: {
719
- "apollo-require-preflight": "true",
720
- ...this.jwt ? { authorization: `Bearer ${this.jwt}` } : {}
721
- }
722
- };
723
- }
724
631
  });
632
+ });
633
+ }
634
+ on(event, callback) {
635
+ this.socket.on(event, callback);
636
+ }
637
+ removeListener(event, callback) {
638
+ this.socket.removeListener(event, callback);
639
+ }
640
+ removeAllListeners() {
641
+ this.socket.removeAllListeners();
642
+ }
643
+ hasListeners(event) {
644
+ return this.socket.hasListeners(event);
645
+ }
646
+ emit(key, data) {
647
+ this.socket.emit(key, data);
648
+ }
649
+ subscribe(option) {
650
+ if (!this.roomSubscribeMap.has(option.roomId)) {
651
+ this.roomSubscribeMap.set(option.roomId, option);
652
+ this.socket.emit(option.key, { ...option.message, __subscribe__: true });
725
653
  }
726
- setJwt(jwt) {
727
- _Client.tokenStore.set(this, jwt);
728
- }
729
- reset() {
730
- this.io?.disconnect();
731
- this.io = null;
732
- this.jwt = null;
733
- }
734
- clone(data = {}) {
735
- const newClient = new _Client();
736
- newClient.init({ ...this, ...data });
737
- if (data.jwt)
738
- _Client.tokenStore.set(newClient, data.jwt);
739
- return newClient;
740
- }
741
- terminate() {
742
- this.reset();
743
- _Client.globalIoMap.forEach((io2) => io2.disconnect());
744
- this.isInitialized = false;
654
+ this.socket.on(option.roomId, option.handleEvent);
655
+ }
656
+ unsubscribe(roomId, handleEvent) {
657
+ this.socket.removeListener(roomId, handleEvent);
658
+ const option = this.roomSubscribeMap.get(roomId);
659
+ if (this.hasListeners(roomId) || !option)
660
+ return;
661
+ this.roomSubscribeMap.delete(roomId);
662
+ this.socket.emit(option.key, { ...option.message, __subscribe__: false });
663
+ }
664
+ disconnect() {
665
+ this.socket.disconnect();
666
+ return this;
667
+ }
668
+ };
669
+ var Client = class _Client {
670
+ static globalIoMap = /* @__PURE__ */ new Map();
671
+ static tokenStore = /* @__PURE__ */ new Map();
672
+ async waitUntilWebSocketConnected(ws = baseClientEnv.serverWsUri) {
673
+ if (baseClientEnv.side === "server")
674
+ return true;
675
+ while (!this.getIo(ws).socket.connected) {
676
+ Logger.verbose("waiting for websocket to initialize...");
677
+ await sleep(300);
745
678
  }
746
- setUdp(udp) {
747
- this.udp = udp;
679
+ }
680
+ isInitialized = false;
681
+ uri = baseClientEnv.serverGraphqlUri;
682
+ ws = baseClientEnv.serverWsUri;
683
+ udp = null;
684
+ gql = (0, import_core.createClient)({ url: this.uri, fetch, exchanges: [import_core.cacheExchange, import_core.fetchExchange] });
685
+ jwt = null;
686
+ async getJwt() {
687
+ const isNextServer = baseClientEnv.side === "server" && baseEnv.operationType === "client";
688
+ if (isNextServer) {
689
+ const nextHeaders = require("next/headers");
690
+ return (await nextHeaders.cookies?.())?.get("jwt")?.value ?? (await nextHeaders.headers?.())?.get("jwt") ?? this.jwt ?? null;
691
+ } else
692
+ return _Client.tokenStore.get(this) ?? null;
693
+ }
694
+ io = null;
695
+ init(data = {}) {
696
+ Object.assign(this, data);
697
+ this.setLink(data.uri);
698
+ this.setIo(data.ws);
699
+ this.isInitialized = true;
700
+ }
701
+ setIo(ws = baseClientEnv.serverWsUri) {
702
+ this.ws = ws;
703
+ const existingIo = _Client.globalIoMap.get(ws);
704
+ if (existingIo) {
705
+ this.io = existingIo;
706
+ return;
748
707
  }
749
- };
750
- var client = new Client();
708
+ this.io = new SocketIo(ws);
709
+ _Client.globalIoMap.set(ws, this.io);
710
+ }
711
+ getIo(ws = baseClientEnv.serverWsUri) {
712
+ const existingIo = _Client.globalIoMap.get(ws);
713
+ if (existingIo)
714
+ return existingIo;
715
+ const io2 = new SocketIo(ws);
716
+ _Client.globalIoMap.set(ws, io2);
717
+ return io2;
718
+ }
719
+ setLink(uri = baseClientEnv.serverGraphqlUri) {
720
+ this.uri = uri;
721
+ this.gql = (0, import_core.createClient)({
722
+ url: this.uri,
723
+ fetch,
724
+ exchanges: [import_core.cacheExchange, import_core.fetchExchange],
725
+ // requestPolicy: "network-only",
726
+ fetchOptions: () => {
727
+ return {
728
+ headers: {
729
+ "apollo-require-preflight": "true",
730
+ ...this.jwt ? { authorization: `Bearer ${this.jwt}` } : {}
731
+ }
732
+ };
733
+ }
734
+ });
735
+ }
736
+ setJwt(jwt) {
737
+ _Client.tokenStore.set(this, jwt);
738
+ }
739
+ reset() {
740
+ this.io?.disconnect();
741
+ this.io = null;
742
+ this.jwt = null;
743
+ }
744
+ clone(data = {}) {
745
+ const newClient = new _Client();
746
+ newClient.init({ ...this, ...data });
747
+ if (data.jwt)
748
+ _Client.tokenStore.set(newClient, data.jwt);
749
+ return newClient;
750
+ }
751
+ terminate() {
752
+ this.reset();
753
+ _Client.globalIoMap.forEach((io2) => io2.disconnect());
754
+ this.isInitialized = false;
755
+ }
756
+ setUdp(udp) {
757
+ this.udp = udp;
758
+ }
759
+ };
760
+ var client = new Client();
751
761
 
752
- // pkgs/@akanjs/signal/src/immerify.ts
753
- var import_immer = __require("immer");
762
+ // pkgs/@akanjs/signal/src/immerify.ts
763
+ var import_immer = require("immer");
754
764
 
755
- // pkgs/@akanjs/signal/src/signalDecorators.ts
756
- var import_reflect_metadata5 = __require("reflect-metadata");
757
- var SignalStorage = class {
758
- };
759
- var getAllSignalRefs = () => {
760
- const signalNames = Reflect.getOwnMetadataKeys(SignalStorage.prototype);
761
- const sigRefs = signalNames?.reduce((acc, signalName) => [...acc, ...getSignalRefsOnStorage(signalName)], []) ?? [];
762
- return sigRefs;
763
- };
764
- var getSignalRefsOnStorage = (refName) => {
765
- const sigRefs = Reflect.getMetadata(refName, SignalStorage.prototype);
766
- return sigRefs ?? [];
767
- };
768
- var createArgMetaDecorator = (type) => {
769
- return function(option = {}) {
770
- return function(prototype, key, idx) {
771
- const argMetas = getArgMetasOnPrototype(prototype, key);
772
- argMetas[idx] = { key, idx, type, option };
773
- setArgMetasOnPrototype(prototype, key, argMetas);
774
- };
775
- };
776
- };
777
- var Account = createArgMetaDecorator("Account");
778
- var defaultAccount = {
779
- __InternalArg__: "Account",
780
- appName: baseEnv.appName,
781
- environment: baseEnv.environment
782
- };
783
- var Self = createArgMetaDecorator("Self");
784
- var Me = createArgMetaDecorator("Me");
785
- var UserIp = createArgMetaDecorator("UserIp");
786
- var Access = createArgMetaDecorator("Access");
787
- var Req = createArgMetaDecorator("Req");
788
- var Res = createArgMetaDecorator("Res");
789
- var Ws = createArgMetaDecorator("Ws");
790
- var Job = createArgMetaDecorator("Job");
791
- var getQuery = (allow) => function(returns, signalOption = {}, guards = []) {
792
- return (prototype, key, descriptor) => {
793
- const metadataMap = getGqlMetaMapOnPrototype(prototype);
794
- metadataMap.set(key, {
795
- returns,
796
- signalOption,
797
- key,
798
- descriptor,
799
- guards: [allow, ...guards],
800
- type: "Query"
801
- });
802
- setGqlMetaMapOnPrototype(prototype, metadataMap);
803
- };
804
- };
805
- var getMutation = (allow) => function(returns, signalOption = {}, guards = []) {
806
- return (prototype, key, descriptor) => {
807
- const metadataMap = getGqlMetaMapOnPrototype(prototype);
808
- metadataMap.set(key, {
809
- returns,
810
- signalOption,
811
- key,
812
- descriptor,
813
- guards: [allow, ...guards],
814
- type: "Mutation"
815
- });
816
- setGqlMetaMapOnPrototype(prototype, metadataMap);
817
- };
818
- };
819
- var getMessage = (allow) => function(returns, signalOption = {}, guards = []) {
820
- return (prototype, key, descriptor) => {
821
- const metadataMap = getGqlMetaMapOnPrototype(prototype);
822
- metadataMap.set(key, {
823
- returns,
824
- signalOption,
825
- key,
826
- descriptor,
827
- guards: [allow, ...guards],
828
- type: "Message"
829
- });
830
- setGqlMetaMapOnPrototype(prototype, metadataMap);
831
- };
832
- };
833
- var getPubsub = (allow) => function(returns, signalOption = {}, guards = []) {
834
- return (prototype, key, descriptor) => {
835
- const metadataMap = getGqlMetaMapOnPrototype(prototype);
836
- metadataMap.set(key, {
837
- returns,
838
- signalOption,
839
- key,
840
- descriptor,
841
- guards: [allow, ...guards],
842
- type: "Pubsub"
843
- });
844
- setGqlMetaMapOnPrototype(prototype, metadataMap);
845
- };
846
- };
847
- var getProcess = (serverType) => function(returns, signalOption = {}) {
848
- return (prototype, key, descriptor) => {
849
- const metadataMap = getGqlMetaMapOnPrototype(prototype);
850
- metadataMap.set(key, {
851
- returns,
852
- signalOption: { ...signalOption, serverType: lowerlize(serverType) },
853
- key,
854
- descriptor,
855
- guards: ["None"],
856
- type: "Process"
857
- });
858
- setGqlMetaMapOnPrototype(prototype, metadataMap);
859
- };
860
- };
861
- var Query = {
862
- Public: getQuery("Public"),
863
- Every: getQuery("Every"),
864
- Admin: getQuery("Admin"),
865
- User: getQuery("User"),
866
- SuperAdmin: getQuery("SuperAdmin"),
867
- None: getQuery("None"),
868
- Owner: getQuery("Owner")
869
- };
870
- var Mutation = {
871
- Public: getMutation("Public"),
872
- Every: getMutation("Every"),
873
- Admin: getMutation("Admin"),
874
- User: getMutation("User"),
875
- SuperAdmin: getMutation("SuperAdmin"),
876
- None: getMutation("None"),
877
- Owner: getMutation("Owner")
878
- };
879
- var Message = {
880
- Public: getMessage("Public"),
881
- Every: getMessage("Every"),
882
- Admin: getMessage("Admin"),
883
- User: getMessage("User"),
884
- SuperAdmin: getMessage("SuperAdmin"),
885
- None: getMessage("None"),
886
- Owner: getMessage("Owner")
887
- };
888
- var Pubsub = {
889
- Public: getPubsub("Public"),
890
- Every: getPubsub("Every"),
891
- Admin: getPubsub("Admin"),
892
- User: getPubsub("User"),
893
- SuperAdmin: getPubsub("SuperAdmin"),
894
- None: getPubsub("None"),
895
- Owner: getPubsub("Owner")
896
- };
897
- var Process = {
898
- Federation: getProcess("Federation"),
899
- Batch: getProcess("Batch"),
900
- All: getProcess("All")
901
- };
902
- var getArg = (type) => function(name, returns, argsOption = {}) {
765
+ // pkgs/@akanjs/signal/src/signalDecorators.ts
766
+ var import_reflect_metadata5 = require("reflect-metadata");
767
+ var SignalStorage = class {
768
+ };
769
+ var getAllSignalRefs = () => {
770
+ const signalNames = Reflect.getOwnMetadataKeys(SignalStorage.prototype);
771
+ const sigRefs = signalNames?.reduce((acc, signalName) => [...acc, ...getSignalRefsOnStorage(signalName)], []) ?? [];
772
+ return sigRefs;
773
+ };
774
+ var getSignalRefsOnStorage = (refName) => {
775
+ const sigRefs = Reflect.getMetadata(refName, SignalStorage.prototype);
776
+ return sigRefs ?? [];
777
+ };
778
+ var createArgMetaDecorator = (type) => {
779
+ return function(option = {}) {
903
780
  return function(prototype, key, idx) {
904
781
  const argMetas = getArgMetasOnPrototype(prototype, key);
905
- argMetas[idx] = { name, returns, argsOption, key, idx, type };
782
+ argMetas[idx] = { key, idx, type, option };
906
783
  setArgMetasOnPrototype(prototype, key, argMetas);
907
784
  };
908
785
  };
909
- var Arg = {
910
- Body: getArg("Body"),
911
- Param: getArg("Param"),
912
- Query: getArg("Query"),
913
- Upload: getArg("Upload"),
914
- Msg: getArg("Msg"),
915
- Room: getArg("Room")
916
- };
917
- var getSigMeta = (sigRef) => {
918
- const sigMeta = Reflect.getMetadata("signal", sigRef.prototype);
919
- if (!sigMeta)
920
- throw new Error(`No SignalMeta found for ${sigRef.name}`);
921
- return sigMeta;
922
- };
923
- var getGqlMetaMapOnPrototype = (prototype) => {
924
- const gqlMetaMap = Reflect.getMetadata("gql", prototype);
925
- return gqlMetaMap ?? /* @__PURE__ */ new Map();
926
- };
927
- var getGqlMetas = (sigRef) => {
928
- const gqlMetaMap = Reflect.getMetadata("gql", sigRef.prototype);
929
- return gqlMetaMap ? [...gqlMetaMap.values()] : [];
930
- };
931
- var setGqlMetaMapOnPrototype = (prototype, gqlMetaMap) => {
932
- Reflect.defineMetadata("gql", gqlMetaMap, prototype);
933
- };
934
- var getArgMetas = (sigRef, key) => {
935
- const metas = Reflect.getMetadata("args", sigRef.prototype, key) ?? [];
936
- const argMetas = metas.filter((meta) => !!meta.returns);
937
- const internalArgMetas = metas.filter((meta) => !meta.returns);
938
- return [argMetas, internalArgMetas];
939
- };
940
- var getArgMetasOnPrototype = (prototype, key) => {
941
- return Reflect.getMetadata("args", prototype, key) ?? [];
942
- };
943
- var setArgMetasOnPrototype = (prototype, key, argMetas) => {
944
- Reflect.defineMetadata("args", argMetas, prototype, key);
945
- };
946
-
947
- // pkgs/@akanjs/signal/src/baseFetch.ts
948
- var nativeFetch = fetch;
949
- var baseFetch = Object.assign(nativeFetch, {
950
- client,
951
- clone: function(option = {}) {
952
- return {
953
- ...this,
954
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
955
- client: this.client.clone(option)
956
- };
957
- }
958
- });
959
-
960
- // pkgs/@akanjs/dictionary/src/trans.ts
961
- var baseTrans = {
962
- id: ["Id", "\uC544\uC774\uB514"],
963
- "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
964
- createdAt: ["CreatedAt", "\uC0DD\uC131\uC77C"],
965
- "desc-createdAt": ["Data created time", "\uB370\uC774\uD130 \uC0DD\uC131 \uC2DC\uAC01"],
966
- updatedAt: ["UpdatedAt", "\uC218\uC815\uC77C"],
967
- "desc-updatedAt": ["Data updated time", "\uB370\uC774\uD130 \uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"],
968
- removedAt: ["RemovedAt", "\uC0AD\uC81C\uC77C"],
969
- "desc-removedAt": ["Data removed time", "\uB370\uC774\uD130 \uC0AD\uC81C \uC2DC\uAC01"],
970
- status: ["Status", "\uC0C1\uD0DC"],
971
- "desc-status": ["Data status", "\uB370\uC774\uD130 \uC0C1\uD0DC"],
972
- count: ["Count", "\uAC1C\uC218"],
973
- "desc-count": ["Data count", "\uB370\uC774\uD130 \uAC1C\uC218"],
974
- latest: ["latest", "\uCD5C\uC2E0\uC21C"],
975
- "desc-latest": ["latest", "\uCD5C\uC2E0\uC21C"],
976
- oldest: ["oldest", "\uC624\uB798\uB41C\uC21C"],
977
- "desc-oldest": ["oldest", "\uC624\uB798\uB41C\uC21C"],
978
- "qry-any": ["All", "\uC804\uCCB4"],
979
- "qrydesc-any": ["All", "\uC804\uCCB4"],
980
- "qry-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
981
- "qrydesc-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
982
- "qarg-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"],
983
- "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
984
- };
985
- var getBaseSignalTrans = (modelName) => {
986
- const className = capitalize(modelName);
987
- return {
988
- // * ==================== Endpoint ==================== * //
989
- [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
990
- [`apidesc-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
991
- [`arg-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
992
- [`argdesc-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
993
- [`api-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
994
- [`apidesc-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
995
- [`arg-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
996
- [`argdesc-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
997
- [`api-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
998
- [`apidesc-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
999
- [`arg-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1000
- [`argdesc-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1001
- [`arg-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
1002
- [`argdesc-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
1003
- [`arg-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
1004
- [`argdesc-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
1005
- [`arg-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
1006
- [`argdesc-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
1007
- [`api-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
1008
- [`apidesc-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
1009
- [`arg-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1010
- [`argdesc-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1011
- [`api-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
1012
- [`apidesc-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
1013
- [`arg-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1014
- [`argdesc-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1015
- [`api-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
1016
- [`apidesc-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
1017
- [`arg-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1018
- [`argdesc-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1019
- [`api-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
1020
- [`apidesc-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
1021
- [`arg-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1022
- [`argdesc-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1023
- [`arg-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1024
- [`argdesc-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1025
- [`api-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
1026
- [`apidesc-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
1027
- [`arg-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1028
- [`argdesc-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`]
1029
- // * ==================== Endpoint ==================== * //
1030
- };
1031
- };
1032
- var checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
1033
- const enumKeyMap = /* @__PURE__ */ new Map();
1034
- modelRefs.forEach((modelRef) => {
1035
- const fieldMetaMap = getFieldMetaMap(modelRef);
1036
- [...fieldMetaMap.values()].forEach((fieldMeta) => {
1037
- if (!fieldMeta.enum)
1038
- return;
1039
- enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
1040
- fieldMeta.enum.forEach((value) => {
1041
- const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
1042
- const modelDict = rootDictionary[modelName];
1043
- const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
1044
- if (!enumDict && !rootEnumDict) {
1045
- Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
1046
- }
1047
- const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
1048
- const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
1049
- if (!enumDescDict && !rootEnumDescDict) {
1050
- Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
1051
- }
1052
- });
1053
- });
1054
- });
1055
- Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
1056
- const [, fieldKey, ...values] = key.split("-");
1057
- const value = values.join("-");
1058
- if (!enumKeyMap.get(fieldKey)?.has(value)) {
1059
- Logger.error(
1060
- `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
1061
- );
1062
- }
1063
- });
1064
- const fieldKeySet = /* @__PURE__ */ new Set([
1065
- ...modelRefs.map((modelRef) => [...getFieldMetaMap(modelRef).keys()]).flat(),
1066
- ...filterRefs.map((filterRef) => Object.keys(getFilterSortMap(filterRef))).flat()
1067
- ]);
1068
- Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
1069
- const [, fieldKey] = key.split("-");
1070
- if (!fieldKeySet.has(fieldKey))
1071
- Logger.error(
1072
- `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
1073
- );
1074
- });
1075
- };
1076
- var checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
1077
- const argKeyMap = /* @__PURE__ */ new Map();
1078
- sigRefs.forEach((sigRef) => {
1079
- const gqlMetas = getGqlMetas(sigRef);
1080
- gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
1081
- const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
1082
- argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
1083
- argMetas.forEach((argMeta) => {
1084
- const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
1085
- if (!argDict) {
1086
- Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
1087
- }
1088
- const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
1089
- if (!argDescDict) {
1090
- Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
1091
- }
1092
- });
1093
- });
1094
- });
1095
- Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
1096
- const [, gqlKey, argKey] = key.split("-");
1097
- if (!argKeyMap.get(gqlKey)?.has(argKey))
1098
- Logger.error(
1099
- `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
1100
- );
1101
- });
1102
- };
1103
- var checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
1104
- const qargKeyMap = /* @__PURE__ */ new Map();
1105
- filterRefs.forEach((filterRef) => {
1106
- const filterMetaMap = getFilterQueryMap(filterRef);
1107
- filterMetaMap.forEach((filterMeta) => {
1108
- const filterArgMetas = getFilterArgMetas(filterRef, filterMeta.key);
1109
- qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
1110
- filterArgMetas.forEach((filterArgMeta) => {
1111
- const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
1112
- if (!qargDict)
1113
- Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
1114
- const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
1115
- if (!qargDescDict)
1116
- Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
1117
- });
1118
- });
1119
- });
1120
- Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
1121
- const [, filterKey, filterArgKey] = key.split("-");
1122
- if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
1123
- Logger.error(
1124
- `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
1125
- );
1126
- });
1127
- };
1128
- var checkDictCoverage = () => {
1129
- const fullModelRefEntries = getAllFullModelRefs().filter((modelRef) => {
1130
- const classMeta = getClassMeta(modelRef);
1131
- return classMeta.type === "full" && classMeta.modelType === "data";
1132
- }).map((modelRef) => {
1133
- const classMeta = getClassMeta(modelRef);
1134
- const modelName = lowerlize(classMeta.refName);
1135
- return { modelName, modelRef };
1136
- });
1137
- const scalarModelRefs = getAllScalarModelRefs();
1138
- const insightModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "insight").map((modelRef) => {
1139
- const classMeta = getClassMeta(modelRef);
1140
- if (!classMeta.refName.endsWith("Insight"))
1141
- throw new Error(`Invalid insight model name: ${classMeta.refName}`);
1142
- const modelName = lowerlize(classMeta.refName.slice(0, -7));
1143
- return { modelName, modelRef };
786
+ };
787
+ var Account = createArgMetaDecorator("Account");
788
+ var defaultAccount = {
789
+ __InternalArg__: "Account",
790
+ appName: baseEnv.appName,
791
+ environment: baseEnv.environment
792
+ };
793
+ var Self = createArgMetaDecorator("Self");
794
+ var Me = createArgMetaDecorator("Me");
795
+ var UserIp = createArgMetaDecorator("UserIp");
796
+ var Access = createArgMetaDecorator("Access");
797
+ var Req = createArgMetaDecorator("Req");
798
+ var Res = createArgMetaDecorator("Res");
799
+ var Ws = createArgMetaDecorator("Ws");
800
+ var Job = createArgMetaDecorator("Job");
801
+ var getQuery = (allow) => function(returns, signalOption = {}, guards = []) {
802
+ return (prototype, key, descriptor) => {
803
+ const metadataMap = getGqlMetaMapOnPrototype(prototype);
804
+ metadataMap.set(key, {
805
+ returns,
806
+ signalOption,
807
+ key,
808
+ descriptor,
809
+ guards: [allow, ...guards],
810
+ type: "Query"
1144
811
  });
1145
- const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "data").map((modelRef) => {
1146
- const classMeta = getClassMeta(modelRef);
1147
- const modelName = lowerlize(classMeta.refName);
1148
- return { modelName, modelRef };
812
+ setGqlMetaMapOnPrototype(prototype, metadataMap);
813
+ };
814
+ };
815
+ var getMutation = (allow) => function(returns, signalOption = {}, guards = []) {
816
+ return (prototype, key, descriptor) => {
817
+ const metadataMap = getGqlMetaMapOnPrototype(prototype);
818
+ metadataMap.set(key, {
819
+ returns,
820
+ signalOption,
821
+ key,
822
+ descriptor,
823
+ guards: [allow, ...guards],
824
+ type: "Mutation"
1149
825
  });
1150
- const filterModelRefEntries = getAllFilterModelRefs().map((filterModelRef) => {
1151
- const filterMeta = getFilterMeta(filterModelRef);
1152
- if (!filterMeta.refName.endsWith("Filter"))
1153
- throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
1154
- const modelName = lowerlize(filterMeta.refName.slice(0, -6));
1155
- return { modelName, filterModelRef };
826
+ setGqlMetaMapOnPrototype(prototype, metadataMap);
827
+ };
828
+ };
829
+ var getMessage = (allow) => function(returns, signalOption = {}, guards = []) {
830
+ return (prototype, key, descriptor) => {
831
+ const metadataMap = getGqlMetaMapOnPrototype(prototype);
832
+ metadataMap.set(key, {
833
+ returns,
834
+ signalOption,
835
+ key,
836
+ descriptor,
837
+ guards: [allow, ...guards],
838
+ type: "Message"
1156
839
  });
1157
- const signalRefs = getAllSignalRefs();
1158
- const fullModelSignalRefEntries = signalRefs.filter((ref) => {
1159
- const sigMeta = getSigMeta(ref);
1160
- if (!sigMeta.returns)
1161
- return false;
1162
- const modelRef = sigMeta.returns();
1163
- const classMeta = getClassMeta(modelRef);
1164
- return classMeta.type === "full";
1165
- }).map((sigRef) => {
1166
- const sigMeta = getSigMeta(sigRef);
1167
- const modelName = lowerlize(sigMeta.refName);
1168
- return { modelName, sigRef };
840
+ setGqlMetaMapOnPrototype(prototype, metadataMap);
841
+ };
842
+ };
843
+ var getPubsub = (allow) => function(returns, signalOption = {}, guards = []) {
844
+ return (prototype, key, descriptor) => {
845
+ const metadataMap = getGqlMetaMapOnPrototype(prototype);
846
+ metadataMap.set(key, {
847
+ returns,
848
+ signalOption,
849
+ key,
850
+ descriptor,
851
+ guards: [allow, ...guards],
852
+ type: "Pubsub"
1169
853
  });
1170
- const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
1171
- const sigMeta = getSigMeta(ref);
1172
- if (!sigMeta.returns)
1173
- return false;
1174
- const modelRef = sigMeta.returns();
1175
- const classMeta = getClassMeta(modelRef);
1176
- return classMeta.type === "scalar";
1177
- }).map((sigRef) => {
1178
- const sigMeta = getSigMeta(sigRef);
1179
- const modelName = lowerlize(sigMeta.refName);
1180
- return { modelName, sigRef };
854
+ setGqlMetaMapOnPrototype(prototype, metadataMap);
855
+ };
856
+ };
857
+ var getProcess = (serverType) => function(returns, signalOption = {}) {
858
+ return (prototype, key, descriptor) => {
859
+ const metadataMap = getGqlMetaMapOnPrototype(prototype);
860
+ metadataMap.set(key, {
861
+ returns,
862
+ signalOption: { ...signalOption, serverType: lowerlize(serverType) },
863
+ key,
864
+ descriptor,
865
+ guards: ["None"],
866
+ type: "Process"
1181
867
  });
1182
- const pureSignalRefEntries = signalRefs.filter((ref) => !getSigMeta(ref).returns).map((sigRef) => {
1183
- const sigMeta = getSigMeta(sigRef);
1184
- const modelName = lowerlize(sigMeta.refName);
1185
- return { modelName, sigRef };
1186
- });
1187
- const modelDictExamMap = /* @__PURE__ */ new Map();
1188
- const scalarDictExamMap = /* @__PURE__ */ new Map();
1189
- const signalDictExamMap = /* @__PURE__ */ new Map();
1190
- const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
1191
- fullModelRefEntries.forEach(({ modelName, modelRef }) => {
1192
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1193
- modelDictExam.modelRefs.push(modelRef);
1194
- modelDictExamMap.set(modelName, modelDictExam);
1195
- });
1196
- insightModelRefEntries.forEach(({ modelName, modelRef }) => {
1197
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1198
- modelDictExam.insightRefs.push(modelRef);
1199
- modelDictExamMap.set(modelName, modelDictExam);
1200
- });
1201
- fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
1202
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1203
- modelDictExam.sigRefs.push(sigRef);
1204
- modelDictExamMap.set(modelName, modelDictExam);
1205
- });
1206
- filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
1207
- const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1208
- modelDictExam.filterRefs.push(filterModelRef);
1209
- modelDictExamMap.set(modelName, modelDictExam);
1210
- });
1211
- const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
1212
- pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
1213
- const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
1214
- scalarDictExam.modelRefs.push(modelRef);
1215
- scalarDictExamMap.set(modelName, scalarDictExam);
1216
- });
1217
- scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
1218
- const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
1219
- scalarDictExam.sigRefs.push(sigRef);
1220
- scalarDictExamMap.set(modelName, scalarDictExam);
1221
- });
1222
- const getDefaultSignalDict = () => ({ sigRefs: [] });
1223
- pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
1224
- const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
1225
- signalDictExam.sigRefs.push(sigRef);
1226
- signalDictExamMap.set(modelName, signalDictExam);
1227
- });
1228
- modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
1229
- const dictionary = rootDictionary[modelName];
1230
- if (!dictionary)
1231
- return;
1232
- checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
1233
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
1234
- checkFilterDictCoverages(modelName, filterRefs, dictionary);
1235
- });
1236
- scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
1237
- const dictionary = rootDictionary[modelName];
1238
- if (!dictionary)
868
+ setGqlMetaMapOnPrototype(prototype, metadataMap);
869
+ };
870
+ };
871
+ var Query = {
872
+ Public: getQuery("Public"),
873
+ Every: getQuery("Every"),
874
+ Admin: getQuery("Admin"),
875
+ User: getQuery("User"),
876
+ SuperAdmin: getQuery("SuperAdmin"),
877
+ None: getQuery("None"),
878
+ Owner: getQuery("Owner")
879
+ };
880
+ var Mutation = {
881
+ Public: getMutation("Public"),
882
+ Every: getMutation("Every"),
883
+ Admin: getMutation("Admin"),
884
+ User: getMutation("User"),
885
+ SuperAdmin: getMutation("SuperAdmin"),
886
+ None: getMutation("None"),
887
+ Owner: getMutation("Owner")
888
+ };
889
+ var Message = {
890
+ Public: getMessage("Public"),
891
+ Every: getMessage("Every"),
892
+ Admin: getMessage("Admin"),
893
+ User: getMessage("User"),
894
+ SuperAdmin: getMessage("SuperAdmin"),
895
+ None: getMessage("None"),
896
+ Owner: getMessage("Owner")
897
+ };
898
+ var Pubsub = {
899
+ Public: getPubsub("Public"),
900
+ Every: getPubsub("Every"),
901
+ Admin: getPubsub("Admin"),
902
+ User: getPubsub("User"),
903
+ SuperAdmin: getPubsub("SuperAdmin"),
904
+ None: getPubsub("None"),
905
+ Owner: getPubsub("Owner")
906
+ };
907
+ var Process = {
908
+ Federation: getProcess("Federation"),
909
+ Batch: getProcess("Batch"),
910
+ All: getProcess("All")
911
+ };
912
+ var getArg = (type) => function(name, returns, argsOption = {}) {
913
+ return function(prototype, key, idx) {
914
+ const argMetas = getArgMetasOnPrototype(prototype, key);
915
+ argMetas[idx] = { name, returns, argsOption, key, idx, type };
916
+ setArgMetasOnPrototype(prototype, key, argMetas);
917
+ };
918
+ };
919
+ var Arg = {
920
+ Body: getArg("Body"),
921
+ Param: getArg("Param"),
922
+ Query: getArg("Query"),
923
+ Upload: getArg("Upload"),
924
+ Msg: getArg("Msg"),
925
+ Room: getArg("Room")
926
+ };
927
+ var getSigMeta = (sigRef) => {
928
+ const sigMeta = Reflect.getMetadata("signal", sigRef.prototype);
929
+ if (!sigMeta)
930
+ throw new Error(`No SignalMeta found for ${sigRef.name}`);
931
+ return sigMeta;
932
+ };
933
+ var getGqlMetaMapOnPrototype = (prototype) => {
934
+ const gqlMetaMap = Reflect.getMetadata("gql", prototype);
935
+ return gqlMetaMap ?? /* @__PURE__ */ new Map();
936
+ };
937
+ var getGqlMetas = (sigRef) => {
938
+ const gqlMetaMap = Reflect.getMetadata("gql", sigRef.prototype);
939
+ return gqlMetaMap ? [...gqlMetaMap.values()] : [];
940
+ };
941
+ var setGqlMetaMapOnPrototype = (prototype, gqlMetaMap) => {
942
+ Reflect.defineMetadata("gql", gqlMetaMap, prototype);
943
+ };
944
+ var getArgMetas = (sigRef, key) => {
945
+ const metas = Reflect.getMetadata("args", sigRef.prototype, key) ?? [];
946
+ const argMetas = metas.filter((meta) => !!meta.returns);
947
+ const internalArgMetas = metas.filter((meta) => !meta.returns);
948
+ return [argMetas, internalArgMetas];
949
+ };
950
+ var getArgMetasOnPrototype = (prototype, key) => {
951
+ return Reflect.getMetadata("args", prototype, key) ?? [];
952
+ };
953
+ var setArgMetasOnPrototype = (prototype, key, argMetas) => {
954
+ Reflect.defineMetadata("args", argMetas, prototype, key);
955
+ };
956
+
957
+ // pkgs/@akanjs/signal/src/baseFetch.ts
958
+ var nativeFetch = fetch;
959
+ var baseFetch = Object.assign(nativeFetch, {
960
+ client,
961
+ clone: function(option = {}) {
962
+ return {
963
+ ...this,
964
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
965
+ client: this.client.clone(option)
966
+ };
967
+ }
968
+ });
969
+
970
+ // pkgs/@akanjs/dictionary/src/trans.ts
971
+ var baseTrans = {
972
+ id: ["Id", "\uC544\uC774\uB514"],
973
+ "desc-id": ["Unique ID value", "\uC720\uB2C8\uD06C\uD55C \uC544\uC774\uB514\uAC12"],
974
+ createdAt: ["CreatedAt", "\uC0DD\uC131\uC77C"],
975
+ "desc-createdAt": ["Data created time", "\uB370\uC774\uD130 \uC0DD\uC131 \uC2DC\uAC01"],
976
+ updatedAt: ["UpdatedAt", "\uC218\uC815\uC77C"],
977
+ "desc-updatedAt": ["Data updated time", "\uB370\uC774\uD130 \uB9C8\uC9C0\uB9C9 \uC218\uC815 \uC2DC\uAC01"],
978
+ removedAt: ["RemovedAt", "\uC0AD\uC81C\uC77C"],
979
+ "desc-removedAt": ["Data removed time", "\uB370\uC774\uD130 \uC0AD\uC81C \uC2DC\uAC01"],
980
+ status: ["Status", "\uC0C1\uD0DC"],
981
+ "desc-status": ["Data status", "\uB370\uC774\uD130 \uC0C1\uD0DC"],
982
+ count: ["Count", "\uAC1C\uC218"],
983
+ "desc-count": ["Data count", "\uB370\uC774\uD130 \uAC1C\uC218"],
984
+ latest: ["latest", "\uCD5C\uC2E0\uC21C"],
985
+ "desc-latest": ["latest", "\uCD5C\uC2E0\uC21C"],
986
+ oldest: ["oldest", "\uC624\uB798\uB41C\uC21C"],
987
+ "desc-oldest": ["oldest", "\uC624\uB798\uB41C\uC21C"],
988
+ "qry-any": ["All", "\uC804\uCCB4"],
989
+ "qrydesc-any": ["All", "\uC804\uCCB4"],
990
+ "qry-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
991
+ "qrydesc-byStatuses": ["By Statuses", "\uC0C1\uD0DC\uBCC4 \uC870\uD68C"],
992
+ "qarg-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"],
993
+ "qargdesc-byStatuses-statuses": ["Statuses", "\uC0C1\uD0DC"]
994
+ };
995
+ var getBaseSignalTrans = (modelName) => {
996
+ const className = capitalize(modelName);
997
+ return {
998
+ // * ==================== Endpoint ==================== * //
999
+ [`api-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
1000
+ [`apidesc-light${className}`]: [`Get light version of ${modelName}`, `${modelName} \uACBD\uB7C9\uD654 \uBC84\uC804 \uC870\uD68C`],
1001
+ [`arg-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1002
+ [`argdesc-light${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1003
+ [`api-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
1004
+ [`apidesc-${modelName}`]: [`Get ${modelName}`, `${modelName} \uC870\uD68C`],
1005
+ [`arg-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1006
+ [`argdesc-${modelName}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1007
+ [`api-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
1008
+ [`apidesc-${modelName}List`]: [`Get ${modelName} list`, `${modelName} \uB9AC\uC2A4\uD2B8 \uC870\uD68C`],
1009
+ [`arg-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1010
+ [`argdesc-${modelName}List-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1011
+ [`arg-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
1012
+ [`argdesc-${modelName}List-skip`]: [`Skip of ${modelName}`, `${modelName} \uC2A4\uD0B5`],
1013
+ [`arg-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
1014
+ [`argdesc-${modelName}List-limit`]: [`Limit of ${modelName}`, `${modelName} \uC81C\uD55C`],
1015
+ [`arg-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
1016
+ [`argdesc-${modelName}List-sort`]: [`Sort of ${modelName}`, `${modelName} \uC815\uB82C`],
1017
+ [`api-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
1018
+ [`apidesc-${modelName}Insight`]: [`Get ${modelName} insight`, `${modelName} \uC778\uC0AC\uC774\uD2B8 \uC870\uD68C`],
1019
+ [`arg-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1020
+ [`argdesc-${modelName}Insight-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1021
+ [`api-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
1022
+ [`apidesc-${modelName}Exists`]: [`Check ${modelName} exists`, `${modelName} \uC874\uC7AC \uC5EC\uBD80 \uD655\uC778`],
1023
+ [`arg-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1024
+ [`argdesc-${modelName}Exists-query`]: [`Query of ${modelName}`, `${modelName} \uCFFC\uB9AC`],
1025
+ [`api-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
1026
+ [`apidesc-create${className}`]: [`Create ${modelName}`, `${modelName} \uC0DD\uC131`],
1027
+ [`arg-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1028
+ [`argdesc-create${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1029
+ [`api-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
1030
+ [`apidesc-update${className}`]: [`Update ${modelName}`, `${modelName} \uC218\uC815`],
1031
+ [`arg-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1032
+ [`argdesc-update${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1033
+ [`arg-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1034
+ [`argdesc-update${className}-data`]: [`Data of ${modelName}`, `${modelName} \uB370\uC774\uD130`],
1035
+ [`api-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
1036
+ [`apidesc-remove${className}`]: [`Remove ${modelName}`, `${modelName} \uC0AD\uC81C`],
1037
+ [`arg-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`],
1038
+ [`argdesc-remove${className}-${modelName}Id`]: [`Id of ${modelName}`, `${modelName} \uC544\uC774\uB514`]
1039
+ // * ==================== Endpoint ==================== * //
1040
+ };
1041
+ };
1042
+ var checkModelDictCoverages = (modelName, dictionary, modelRefs, filterRefs) => {
1043
+ const enumKeyMap = /* @__PURE__ */ new Map();
1044
+ modelRefs.forEach((modelRef) => {
1045
+ const fieldMetaMap = getFieldMetaMap(modelRef);
1046
+ [...fieldMetaMap.values()].forEach((fieldMeta) => {
1047
+ if (!fieldMeta.enum)
1239
1048
  return;
1240
- checkModelDictCoverages(modelName, dictionary, modelRefs, []);
1241
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
1049
+ enumKeyMap.set(fieldMeta.key, new Set(fieldMeta.enum.map((value) => value.toString())));
1050
+ fieldMeta.enum.forEach((value) => {
1051
+ const enumDict = dictionary[`enum-${fieldMeta.key}-${value}`];
1052
+ const modelDict = rootDictionary[modelName];
1053
+ const rootEnumDict = modelDict?.[`enum-${fieldMeta.key}-${value}`];
1054
+ if (!enumDict && !rootEnumDict) {
1055
+ Logger.warn(`\u2620\uFE0F Missing enum translation: ${modelName}.enum-${fieldMeta.key}-${value}`);
1056
+ }
1057
+ const enumDescDict = dictionary[`enumdesc-${fieldMeta.key}-${value}`];
1058
+ const rootEnumDescDict = modelDict?.[`enumdesc-${fieldMeta.key}-${value}`];
1059
+ if (!enumDescDict && !rootEnumDescDict) {
1060
+ Logger.warn(`\u2620\uFE0F Missing enum description: ${modelName}.enumdesc-${fieldMeta.key}-${value}`);
1061
+ }
1062
+ });
1242
1063
  });
1243
- signalDictExamMap.forEach(({ sigRefs }, modelName) => {
1244
- const dictionary = rootDictionary[modelName];
1245
- if (!dictionary)
1246
- return;
1247
- checkSignalDictCoverages(modelName, sigRefs, dictionary);
1064
+ });
1065
+ Object.keys(dictionary).filter((key) => key.startsWith("enum-")).forEach((key) => {
1066
+ const [, fieldKey, ...values] = key.split("-");
1067
+ const value = values.join("-");
1068
+ if (!enumKeyMap.get(fieldKey)?.has(value)) {
1069
+ Logger.error(
1070
+ `\u{1F47B} Unused enum translation, need to delete: ${modelName}.enum-${fieldKey}-${value} & ${modelName}.enumdesc-${fieldKey}-${value}`
1071
+ );
1072
+ }
1073
+ });
1074
+ const fieldKeySet = /* @__PURE__ */ new Set([
1075
+ ...modelRefs.map((modelRef) => [...getFieldMetaMap(modelRef).keys()]).flat(),
1076
+ ...filterRefs.map((filterRef) => Object.keys(getFilterSortMap(filterRef))).flat()
1077
+ ]);
1078
+ Object.keys(dictionary).filter((key) => key.startsWith("desc-")).forEach((key) => {
1079
+ const [, fieldKey] = key.split("-");
1080
+ if (!fieldKeySet.has(fieldKey))
1081
+ Logger.error(
1082
+ `\u{1F47B} Unused description translation, need to delete: ${modelName}.${fieldKey} & ${modelName}.desc-${fieldKey}`
1083
+ );
1084
+ });
1085
+ };
1086
+ var checkSignalDictCoverages = (modelName, sigRefs, dictionary) => {
1087
+ const argKeyMap = /* @__PURE__ */ new Map();
1088
+ sigRefs.forEach((sigRef) => {
1089
+ const gqlMetas = getGqlMetas(sigRef);
1090
+ gqlMetas.filter((gqlMeta) => gqlMeta.type !== "Process").forEach((gqlMeta) => {
1091
+ const [argMetas] = getArgMetas(sigRef, gqlMeta.key);
1092
+ argKeyMap.set(gqlMeta.key, new Set(argMetas.map((argMeta) => argMeta.name)));
1093
+ argMetas.forEach((argMeta) => {
1094
+ const argDict = dictionary[`arg-${gqlMeta.key}-${argMeta.name}`];
1095
+ if (!argDict) {
1096
+ Logger.warn(`\u2620\uFE0F Missing arg translation: ${modelName}.arg-${gqlMeta.key}-${argMeta.name}`);
1097
+ }
1098
+ const argDescDict = dictionary[`argdesc-${gqlMeta.key}-${argMeta.name}`];
1099
+ if (!argDescDict) {
1100
+ Logger.warn(`\u2620\uFE0F Missing arg description: ${modelName}.argdesc-${gqlMeta.key}-${argMeta.name}`);
1101
+ }
1102
+ });
1248
1103
  });
1249
- };
1250
- var rootDictionary = {};
1251
- var makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
1252
- const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
1253
- dicts.forEach((dict) => {
1254
- Object.entries(dict).forEach(([key, value]) => {
1255
- const rootValue = rootDict[key];
1256
- if (!rootValue)
1257
- Object.assign(rootDict, { [key]: value });
1258
- else
1259
- Object.assign(rootDict[key], value);
1104
+ });
1105
+ Object.keys(dictionary).filter((key) => key.startsWith("arg-")).forEach((key) => {
1106
+ const [, gqlKey, argKey] = key.split("-");
1107
+ if (!argKeyMap.get(gqlKey)?.has(argKey))
1108
+ Logger.error(
1109
+ `\u{1F47B} Unused arg translation, need to delete: ${modelName}.arg-${gqlKey}-${argKey} & ${modelName}.argdesc-${gqlKey}-${argKey}`
1110
+ );
1111
+ });
1112
+ };
1113
+ var checkFilterDictCoverages = (modelName, filterRefs, dictionary) => {
1114
+ const qargKeyMap = /* @__PURE__ */ new Map();
1115
+ filterRefs.forEach((filterRef) => {
1116
+ const filterMetaMap = getFilterQueryMap(filterRef);
1117
+ filterMetaMap.forEach((filterMeta) => {
1118
+ const filterArgMetas = getFilterArgMetas(filterRef, filterMeta.key);
1119
+ qargKeyMap.set(filterMeta.key, new Set(filterArgMetas.map((filterArgMeta) => filterArgMeta.name)));
1120
+ filterArgMetas.forEach((filterArgMeta) => {
1121
+ const qargDict = dictionary[`qarg-${filterMeta.key}-${filterArgMeta.name}`];
1122
+ if (!qargDict)
1123
+ Logger.warn(`\u2620\uFE0F Missing qarg translation: ${modelName}.qarg-${filterMeta.key}-${filterArgMeta.name}`);
1124
+ const qargDescDict = dictionary[`qargdesc-${filterMeta.key}-${filterArgMeta.name}`];
1125
+ if (!qargDescDict)
1126
+ Logger.warn(`\u2620\uFE0F Missing qarg description: ${modelName}.qargdesc-${filterMeta.key}-${filterArgMeta.name}`);
1260
1127
  });
1261
1128
  });
1262
- return rootDict;
1263
- };
1264
- var languages = ["ko", "en", "zhChs", "zhCht"];
1265
- var msg = {
1266
- info: () => null,
1267
- success: () => null,
1268
- error: () => null,
1269
- warning: () => null,
1270
- loading: () => null
1271
- };
1272
- var makeTrans = (locale) => {
1273
- const revert = (key, data) => {
1274
- throw new Error(key);
1275
- };
1276
- class Revert extends Error {
1277
- constructor(key, data) {
1278
- super(key);
1279
- }
1129
+ });
1130
+ Object.keys(dictionary).filter((key) => key.startsWith("qarg-")).forEach((key) => {
1131
+ const [, filterKey, filterArgKey] = key.split("-");
1132
+ if (!qargKeyMap.get(filterKey)?.has(filterArgKey))
1133
+ Logger.error(
1134
+ `\u{1F47B} Unused qarg translation, need to delete: ${modelName}.qarg-${filterKey}-${filterArgKey} & ${modelName}.qargdesc-${filterKey}-${filterArgKey}`
1135
+ );
1136
+ });
1137
+ };
1138
+ var checkDictCoverage = () => {
1139
+ const fullModelRefEntries = getAllFullModelRefs().filter((modelRef) => {
1140
+ const classMeta = getClassMeta(modelRef);
1141
+ return classMeta.type === "full" && classMeta.modelType === "data";
1142
+ }).map((modelRef) => {
1143
+ const classMeta = getClassMeta(modelRef);
1144
+ const modelName = lowerlize(classMeta.refName);
1145
+ return { modelName, modelRef };
1146
+ });
1147
+ const scalarModelRefs = getAllScalarModelRefs();
1148
+ const insightModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "insight").map((modelRef) => {
1149
+ const classMeta = getClassMeta(modelRef);
1150
+ if (!classMeta.refName.endsWith("Insight"))
1151
+ throw new Error(`Invalid insight model name: ${classMeta.refName}`);
1152
+ const modelName = lowerlize(classMeta.refName.slice(0, -7));
1153
+ return { modelName, modelRef };
1154
+ });
1155
+ const pureScalarModelRefEntries = scalarModelRefs.filter((ref) => getClassMeta(ref).modelType === "data").map((modelRef) => {
1156
+ const classMeta = getClassMeta(modelRef);
1157
+ const modelName = lowerlize(classMeta.refName);
1158
+ return { modelName, modelRef };
1159
+ });
1160
+ const filterModelRefEntries = getAllFilterModelRefs().map((filterModelRef) => {
1161
+ const filterMeta = getFilterMeta(filterModelRef);
1162
+ if (!filterMeta.refName.endsWith("Filter"))
1163
+ throw new Error(`Invalid filter model name: ${filterMeta.refName}`);
1164
+ const modelName = lowerlize(filterMeta.refName.slice(0, -6));
1165
+ return { modelName, filterModelRef };
1166
+ });
1167
+ const signalRefs = getAllSignalRefs();
1168
+ const fullModelSignalRefEntries = signalRefs.filter((ref) => {
1169
+ const sigMeta = getSigMeta(ref);
1170
+ if (!sigMeta.returns)
1171
+ return false;
1172
+ const modelRef = sigMeta.returns();
1173
+ const classMeta = getClassMeta(modelRef);
1174
+ return classMeta.type === "full";
1175
+ }).map((sigRef) => {
1176
+ const sigMeta = getSigMeta(sigRef);
1177
+ const modelName = lowerlize(sigMeta.refName);
1178
+ return { modelName, sigRef };
1179
+ });
1180
+ const scalarModelSignalRefEntries = signalRefs.filter((ref) => {
1181
+ const sigMeta = getSigMeta(ref);
1182
+ if (!sigMeta.returns)
1183
+ return false;
1184
+ const modelRef = sigMeta.returns();
1185
+ const classMeta = getClassMeta(modelRef);
1186
+ return classMeta.type === "scalar";
1187
+ }).map((sigRef) => {
1188
+ const sigMeta = getSigMeta(sigRef);
1189
+ const modelName = lowerlize(sigMeta.refName);
1190
+ return { modelName, sigRef };
1191
+ });
1192
+ const pureSignalRefEntries = signalRefs.filter((ref) => !getSigMeta(ref).returns).map((sigRef) => {
1193
+ const sigMeta = getSigMeta(sigRef);
1194
+ const modelName = lowerlize(sigMeta.refName);
1195
+ return { modelName, sigRef };
1196
+ });
1197
+ const modelDictExamMap = /* @__PURE__ */ new Map();
1198
+ const scalarDictExamMap = /* @__PURE__ */ new Map();
1199
+ const signalDictExamMap = /* @__PURE__ */ new Map();
1200
+ const getDefaultModelDict = () => ({ modelRefs: [], insightRefs: [], sigRefs: [], filterRefs: [] });
1201
+ fullModelRefEntries.forEach(({ modelName, modelRef }) => {
1202
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1203
+ modelDictExam.modelRefs.push(modelRef);
1204
+ modelDictExamMap.set(modelName, modelDictExam);
1205
+ });
1206
+ insightModelRefEntries.forEach(({ modelName, modelRef }) => {
1207
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1208
+ modelDictExam.insightRefs.push(modelRef);
1209
+ modelDictExamMap.set(modelName, modelDictExam);
1210
+ });
1211
+ fullModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
1212
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1213
+ modelDictExam.sigRefs.push(sigRef);
1214
+ modelDictExamMap.set(modelName, modelDictExam);
1215
+ });
1216
+ filterModelRefEntries.forEach(({ modelName, filterModelRef }) => {
1217
+ const modelDictExam = modelDictExamMap.get(modelName) ?? getDefaultModelDict();
1218
+ modelDictExam.filterRefs.push(filterModelRef);
1219
+ modelDictExamMap.set(modelName, modelDictExam);
1220
+ });
1221
+ const getDefaultScalarDict = () => ({ modelRefs: [], sigRefs: [] });
1222
+ pureScalarModelRefEntries.forEach(({ modelName, modelRef }) => {
1223
+ const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
1224
+ scalarDictExam.modelRefs.push(modelRef);
1225
+ scalarDictExamMap.set(modelName, scalarDictExam);
1226
+ });
1227
+ scalarModelSignalRefEntries.forEach(({ modelName, sigRef }) => {
1228
+ const scalarDictExam = scalarDictExamMap.get(modelName) ?? getDefaultScalarDict();
1229
+ scalarDictExam.sigRefs.push(sigRef);
1230
+ scalarDictExamMap.set(modelName, scalarDictExam);
1231
+ });
1232
+ const getDefaultSignalDict = () => ({ sigRefs: [] });
1233
+ pureSignalRefEntries.forEach(({ modelName, sigRef }) => {
1234
+ const signalDictExam = signalDictExamMap.get(modelName) ?? getDefaultSignalDict();
1235
+ signalDictExam.sigRefs.push(sigRef);
1236
+ signalDictExamMap.set(modelName, signalDictExam);
1237
+ });
1238
+ modelDictExamMap.forEach(({ modelRefs, insightRefs, sigRefs, filterRefs }, modelName) => {
1239
+ const dictionary = rootDictionary[modelName];
1240
+ if (!dictionary)
1241
+ return;
1242
+ checkModelDictCoverages(modelName, dictionary, [...modelRefs, ...insightRefs], filterRefs);
1243
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
1244
+ checkFilterDictCoverages(modelName, filterRefs, dictionary);
1245
+ });
1246
+ scalarDictExamMap.forEach(({ modelRefs, sigRefs }, modelName) => {
1247
+ const dictionary = rootDictionary[modelName];
1248
+ if (!dictionary)
1249
+ return;
1250
+ checkModelDictCoverages(modelName, dictionary, modelRefs, []);
1251
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
1252
+ });
1253
+ signalDictExamMap.forEach(({ sigRefs }, modelName) => {
1254
+ const dictionary = rootDictionary[modelName];
1255
+ if (!dictionary)
1256
+ return;
1257
+ checkSignalDictCoverages(modelName, sigRefs, dictionary);
1258
+ });
1259
+ };
1260
+ var rootDictionary = {};
1261
+ var makeDictionary = (rootDict, dict1, dict2, dict3, dict4, dict5) => {
1262
+ const dicts = [dict1, dict2, dict3, dict4, dict5].filter((d) => !!d);
1263
+ dicts.forEach((dict) => {
1264
+ Object.entries(dict).forEach(([key, value]) => {
1265
+ const rootValue = rootDict[key];
1266
+ if (!rootValue)
1267
+ Object.assign(rootDict, { [key]: value });
1268
+ else
1269
+ Object.assign(rootDict[key], value);
1270
+ });
1271
+ });
1272
+ return rootDict;
1273
+ };
1274
+ var languages = ["ko", "en", "zhChs", "zhCht"];
1275
+ var msg = {
1276
+ info: () => null,
1277
+ success: () => null,
1278
+ error: () => null,
1279
+ warning: () => null,
1280
+ loading: () => null
1281
+ };
1282
+ var makeTrans = (locale) => {
1283
+ const revert = (key, data) => {
1284
+ throw new Error(key);
1285
+ };
1286
+ class Revert extends Error {
1287
+ constructor(key, data) {
1288
+ super(key);
1280
1289
  }
1281
- const translate = (lang, key, data) => {
1282
- const langIdx = languages.indexOf(lang);
1283
- const [modelName, msgKey] = key.split(".");
1284
- const model = locale[modelName];
1285
- const message = model[msgKey][langIdx];
1286
- if (!message)
1287
- throw new Error("Invalid message");
1288
- return message;
1289
- };
1290
- return {
1291
- revert,
1292
- Revert,
1293
- translate,
1294
- msg
1295
- };
1296
- };
1297
- })();
1290
+ }
1291
+ const translate = (lang, key, data) => {
1292
+ const langIdx = languages.indexOf(lang);
1293
+ const [modelName, msgKey] = key.split(".");
1294
+ const model = locale[modelName];
1295
+ const message = model[msgKey][langIdx];
1296
+ if (!message)
1297
+ throw new Error("Invalid message");
1298
+ return message;
1299
+ };
1300
+ return {
1301
+ revert,
1302
+ Revert,
1303
+ translate,
1304
+ msg
1305
+ };
1306
+ };
1298
1307
  //! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.