@akanjs/nest 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +130 -1041
- package/package.json +1 -7
package/index.js
CHANGED
|
@@ -56,8 +56,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
56
56
|
// pkgs/@akanjs/nest/index.ts
|
|
57
57
|
var nest_exports = {};
|
|
58
58
|
__export(nest_exports, {
|
|
59
|
-
Access: () =>
|
|
60
|
-
Account: () =>
|
|
59
|
+
Access: () => Access,
|
|
60
|
+
Account: () => Account2,
|
|
61
61
|
Admin: () => Admin,
|
|
62
62
|
AllExceptionsFilter: () => AllExceptionsFilter,
|
|
63
63
|
ArrayifyPipe: () => ArrayifyPipe,
|
|
@@ -76,24 +76,24 @@ __export(nest_exports, {
|
|
|
76
76
|
Interval: () => Interval,
|
|
77
77
|
JSONPipe: () => JSONPipe,
|
|
78
78
|
LoggingInterceptor: () => LoggingInterceptor,
|
|
79
|
-
Me: () =>
|
|
79
|
+
Me: () => Me,
|
|
80
80
|
MulterToUploadPipe: () => MulterToUploadPipe,
|
|
81
81
|
None: () => None,
|
|
82
82
|
Owner: () => Owner,
|
|
83
83
|
Public: () => Public,
|
|
84
84
|
RedisIoAdapter: () => RedisIoAdapter,
|
|
85
|
-
Req: () =>
|
|
86
|
-
Res: () =>
|
|
85
|
+
Req: () => Req,
|
|
86
|
+
Res: () => Res,
|
|
87
87
|
SALT_ROUNDS: () => SALT_ROUNDS,
|
|
88
88
|
SearchClient: () => SearchClient,
|
|
89
|
-
Self: () =>
|
|
89
|
+
Self: () => Self,
|
|
90
90
|
SuperAdmin: () => SuperAdmin,
|
|
91
91
|
TimeoutInterceptor: () => TimeoutInterceptor,
|
|
92
92
|
Transaction: () => Transaction,
|
|
93
93
|
Try: () => Try,
|
|
94
94
|
User: () => User,
|
|
95
|
-
UserIp: () =>
|
|
96
|
-
Ws: () =>
|
|
95
|
+
UserIp: () => UserIp,
|
|
96
|
+
Ws: () => Ws,
|
|
97
97
|
allow: () => allow,
|
|
98
98
|
exportToCsv: () => exportToCsv,
|
|
99
99
|
exportToJson: () => exportToJson,
|
|
@@ -121,940 +121,19 @@ __export(nest_exports, {
|
|
|
121
121
|
});
|
|
122
122
|
module.exports = __toCommonJS(nest_exports);
|
|
123
123
|
|
|
124
|
-
// pkgs/@akanjs/base/src/base.ts
|
|
125
|
-
var version = "0.9.0";
|
|
126
|
-
var logo = `
|
|
127
|
-
_ _ _
|
|
128
|
-
/ \\ | | ____ _ _ __ (_)___
|
|
129
|
-
/ _ \\ | |/ / _' | '_ \\ | / __|
|
|
130
|
-
/ ___ \\| < (_| | | | |_ | \\__ \\
|
|
131
|
-
/_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
|
|
132
|
-
|__/ ver ${version}
|
|
133
|
-
? See more details on docs https://www.akanjs.com/docs
|
|
134
|
-
\u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
|
|
135
|
-
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
// pkgs/@akanjs/base/src/baseEnv.ts
|
|
139
|
-
var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
|
|
140
|
-
var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
|
|
141
|
-
var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
|
|
142
|
-
if (appName === "unknown")
|
|
143
|
-
throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
|
|
144
|
-
if (repoName === "unknown")
|
|
145
|
-
throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
|
|
146
|
-
if (serveDomain === "unknown")
|
|
147
|
-
throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
|
|
148
|
-
var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
149
|
-
var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
|
|
150
|
-
var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
|
|
151
|
-
var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
|
|
152
|
-
var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
|
|
153
|
-
var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
|
|
154
|
-
var baseEnv = {
|
|
155
|
-
repoName,
|
|
156
|
-
serveDomain,
|
|
157
|
-
appName,
|
|
158
|
-
environment,
|
|
159
|
-
operationType,
|
|
160
|
-
operationMode,
|
|
161
|
-
networkType,
|
|
162
|
-
tunnelUsername,
|
|
163
|
-
tunnelPassword
|
|
164
|
-
};
|
|
165
|
-
var side = typeof window === "undefined" ? "server" : "client";
|
|
166
|
-
var renderMode = process.env.RENDER_ENV ?? "ssr";
|
|
167
|
-
var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
|
|
168
|
-
var clientPort = parseInt(
|
|
169
|
-
process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
|
|
170
|
-
);
|
|
171
|
-
var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
|
|
172
|
-
var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
|
|
173
|
-
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");
|
|
174
|
-
var serverPort = parseInt(
|
|
175
|
-
process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
|
|
176
|
-
);
|
|
177
|
-
var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
|
|
178
|
-
var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
|
|
179
|
-
var serverGraphqlUri = `${serverHttpUri}/graphql`;
|
|
180
|
-
var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
|
|
181
|
-
var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
|
|
182
|
-
var baseClientEnv = {
|
|
183
|
-
...baseEnv,
|
|
184
|
-
side,
|
|
185
|
-
renderMode,
|
|
186
|
-
websocket: true,
|
|
187
|
-
clientHost,
|
|
188
|
-
clientPort,
|
|
189
|
-
clientHttpProtocol,
|
|
190
|
-
clientHttpUri,
|
|
191
|
-
serverHost,
|
|
192
|
-
serverPort,
|
|
193
|
-
serverHttpProtocol,
|
|
194
|
-
serverHttpUri,
|
|
195
|
-
serverGraphqlUri,
|
|
196
|
-
serverWsProtocol,
|
|
197
|
-
serverWsUri
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// pkgs/@akanjs/base/src/scalar.ts
|
|
201
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
202
|
-
var dayjs = import_dayjs.default;
|
|
203
|
-
var Int = class {
|
|
204
|
-
__Scalar__;
|
|
205
|
-
};
|
|
206
|
-
var Upload = class {
|
|
207
|
-
__Scalar__;
|
|
208
|
-
filename;
|
|
209
|
-
mimetype;
|
|
210
|
-
encoding;
|
|
211
|
-
createReadStream;
|
|
212
|
-
};
|
|
213
|
-
var Float = class {
|
|
214
|
-
__Scalar__;
|
|
215
|
-
};
|
|
216
|
-
var ID = class {
|
|
217
|
-
__Scalar__;
|
|
218
|
-
};
|
|
219
|
-
var JSON2 = class {
|
|
220
|
-
__Scalar__;
|
|
221
|
-
};
|
|
222
|
-
var getNonArrayModel = (arraiedModel2) => {
|
|
223
|
-
let arrDepth = 0;
|
|
224
|
-
let target = arraiedModel2;
|
|
225
|
-
while (Array.isArray(target)) {
|
|
226
|
-
target = target[0];
|
|
227
|
-
arrDepth++;
|
|
228
|
-
}
|
|
229
|
-
return [target, arrDepth];
|
|
230
|
-
};
|
|
231
|
-
var applyFnToArrayObjects = (arraiedData, fn) => {
|
|
232
|
-
if (Array.isArray(arraiedData))
|
|
233
|
-
return arraiedData.map((data) => applyFnToArrayObjects(data, fn));
|
|
234
|
-
return fn(arraiedData);
|
|
235
|
-
};
|
|
236
|
-
var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON2, Map]);
|
|
237
|
-
var scalarNameMap = /* @__PURE__ */ new Map([
|
|
238
|
-
[ID, "ID"],
|
|
239
|
-
[Int, "Int"],
|
|
240
|
-
[Float, "Float"],
|
|
241
|
-
[String, "String"],
|
|
242
|
-
[Boolean, "Boolean"],
|
|
243
|
-
[Date, "Date"],
|
|
244
|
-
[Upload, "Upload"],
|
|
245
|
-
[JSON2, "JSON"],
|
|
246
|
-
[Map, "Map"]
|
|
247
|
-
]);
|
|
248
|
-
var scalarArgMap = /* @__PURE__ */ new Map([
|
|
249
|
-
[ID, null],
|
|
250
|
-
[String, ""],
|
|
251
|
-
[Boolean, false],
|
|
252
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
253
|
-
[Int, 0],
|
|
254
|
-
[Float, 0],
|
|
255
|
-
[JSON2, {}],
|
|
256
|
-
[Map, {}]
|
|
257
|
-
]);
|
|
258
|
-
var scalarDefaultMap = /* @__PURE__ */ new Map([
|
|
259
|
-
[ID, null],
|
|
260
|
-
[String, ""],
|
|
261
|
-
[Boolean, false],
|
|
262
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
263
|
-
[Int, 0],
|
|
264
|
-
[Float, 0],
|
|
265
|
-
[JSON2, {}]
|
|
266
|
-
]);
|
|
267
|
-
var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
|
|
268
|
-
var isGqlMap = (modelRef) => modelRef === Map;
|
|
269
|
-
|
|
270
|
-
// pkgs/@akanjs/common/src/isDayjs.ts
|
|
271
|
-
var import_dayjs2 = require("dayjs");
|
|
272
|
-
|
|
273
|
-
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
274
|
-
var import_dayjs3 = __toESM(require("dayjs"));
|
|
275
|
-
|
|
276
|
-
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
277
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
278
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
279
|
-
import_dayjs4.default.extend(import_customParseFormat.default);
|
|
280
|
-
|
|
281
|
-
// pkgs/@akanjs/common/src/pluralize.ts
|
|
282
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
283
|
-
|
|
284
|
-
// pkgs/@akanjs/common/src/capitalize.ts
|
|
285
|
-
var capitalize = (str) => {
|
|
286
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
// pkgs/@akanjs/common/src/Logger.ts
|
|
290
|
-
var import_dayjs5 = __toESM(require("dayjs"));
|
|
291
|
-
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
292
|
-
var clc = {
|
|
293
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
294
|
-
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
295
|
-
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
296
|
-
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
297
|
-
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
298
|
-
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
299
|
-
};
|
|
300
|
-
var colorizeMap = {
|
|
301
|
-
trace: clc.bold,
|
|
302
|
-
verbose: clc.cyanBright,
|
|
303
|
-
debug: clc.magentaBright,
|
|
304
|
-
log: clc.green,
|
|
305
|
-
info: clc.green,
|
|
306
|
-
warn: clc.yellow,
|
|
307
|
-
error: clc.red
|
|
308
|
-
};
|
|
309
|
-
var Logger = class _Logger {
|
|
310
|
-
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
311
|
-
"InstanceLoader",
|
|
312
|
-
"RoutesResolver",
|
|
313
|
-
"RouterExplorer",
|
|
314
|
-
"NestFactory",
|
|
315
|
-
"WebSocketsController",
|
|
316
|
-
"GraphQLModule",
|
|
317
|
-
"NestApplication"
|
|
318
|
-
]);
|
|
319
|
-
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
320
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
321
|
-
static #startAt = (0, import_dayjs5.default)();
|
|
322
|
-
static setLevel(level) {
|
|
323
|
-
this.level = level;
|
|
324
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
325
|
-
}
|
|
326
|
-
name;
|
|
327
|
-
constructor(name) {
|
|
328
|
-
this.name = name;
|
|
329
|
-
}
|
|
330
|
-
trace(msg, context = "") {
|
|
331
|
-
if (_Logger.#levelIdx <= 0)
|
|
332
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
333
|
-
}
|
|
334
|
-
verbose(msg, context = "") {
|
|
335
|
-
if (_Logger.#levelIdx <= 1)
|
|
336
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
337
|
-
}
|
|
338
|
-
debug(msg, context = "") {
|
|
339
|
-
if (_Logger.#levelIdx <= 2)
|
|
340
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
341
|
-
}
|
|
342
|
-
log(msg, context = "") {
|
|
343
|
-
if (_Logger.#levelIdx <= 3)
|
|
344
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
345
|
-
}
|
|
346
|
-
info(msg, context = "") {
|
|
347
|
-
if (_Logger.#levelIdx <= 4)
|
|
348
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
349
|
-
}
|
|
350
|
-
warn(msg, context = "") {
|
|
351
|
-
if (_Logger.#levelIdx <= 5)
|
|
352
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
353
|
-
}
|
|
354
|
-
error(msg, context = "") {
|
|
355
|
-
if (_Logger.#levelIdx <= 6)
|
|
356
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
357
|
-
}
|
|
358
|
-
raw(msg, method) {
|
|
359
|
-
_Logger.rawLog(msg, method);
|
|
360
|
-
}
|
|
361
|
-
rawLog(msg, method) {
|
|
362
|
-
_Logger.rawLog(msg, method);
|
|
363
|
-
}
|
|
364
|
-
static trace(msg, context = "") {
|
|
365
|
-
if (_Logger.#levelIdx <= 0)
|
|
366
|
-
_Logger.#printMessages("App", msg, context, "trace");
|
|
367
|
-
}
|
|
368
|
-
static verbose(msg, context = "") {
|
|
369
|
-
if (_Logger.#levelIdx <= 1)
|
|
370
|
-
_Logger.#printMessages("App", msg, context, "verbose");
|
|
371
|
-
}
|
|
372
|
-
static debug(msg, context = "") {
|
|
373
|
-
if (_Logger.#levelIdx <= 2)
|
|
374
|
-
_Logger.#printMessages("App", msg, context, "debug");
|
|
375
|
-
}
|
|
376
|
-
static log(msg, context = "") {
|
|
377
|
-
if (_Logger.#levelIdx <= 3)
|
|
378
|
-
_Logger.#printMessages("App", msg, context, "log");
|
|
379
|
-
}
|
|
380
|
-
static info(msg, context = "") {
|
|
381
|
-
if (_Logger.#levelIdx <= 4)
|
|
382
|
-
_Logger.#printMessages("App", msg, context, "info");
|
|
383
|
-
}
|
|
384
|
-
static warn(msg, context = "") {
|
|
385
|
-
if (_Logger.#levelIdx <= 5)
|
|
386
|
-
_Logger.#printMessages("App", msg, context, "warn");
|
|
387
|
-
}
|
|
388
|
-
static error(msg, context = "") {
|
|
389
|
-
if (_Logger.#levelIdx <= 6)
|
|
390
|
-
_Logger.#printMessages("App", msg, context, "error");
|
|
391
|
-
}
|
|
392
|
-
static #colorize(msg, logLevel) {
|
|
393
|
-
return colorizeMap[logLevel](msg);
|
|
394
|
-
}
|
|
395
|
-
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
396
|
-
if (this.#ignoreCtxSet.has(context))
|
|
397
|
-
return;
|
|
398
|
-
const now = (0, import_dayjs5.default)();
|
|
399
|
-
const processMsg = this.#colorize(
|
|
400
|
-
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
401
|
-
logLevel
|
|
402
|
-
);
|
|
403
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
404
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
405
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
406
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
407
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
408
|
-
if (typeof window === "undefined")
|
|
409
|
-
process[writeStreamType].write(
|
|
410
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
411
|
-
`
|
|
412
|
-
);
|
|
413
|
-
else
|
|
414
|
-
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
415
|
-
`);
|
|
416
|
-
}
|
|
417
|
-
static rawLog(msg, method) {
|
|
418
|
-
this.raw(`${msg}
|
|
419
|
-
`, method);
|
|
420
|
-
}
|
|
421
|
-
static raw(msg, method) {
|
|
422
|
-
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
423
|
-
global.process.stdout.write(msg);
|
|
424
|
-
else
|
|
425
|
-
console.log(msg);
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
// pkgs/@akanjs/common/src/lowerlize.ts
|
|
430
|
-
var lowerlize = (str) => {
|
|
431
|
-
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
// pkgs/@akanjs/common/src/sleep.ts
|
|
435
|
-
var sleep = async (ms) => {
|
|
436
|
-
return new Promise((resolve) => {
|
|
437
|
-
setTimeout(() => {
|
|
438
|
-
resolve(true);
|
|
439
|
-
}, ms);
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// pkgs/@akanjs/signal/src/client.ts
|
|
444
|
-
var import_core = require("@urql/core");
|
|
445
|
-
var import_socket = require("socket.io-client");
|
|
446
|
-
var SocketIo = class {
|
|
447
|
-
socket;
|
|
448
|
-
roomSubscribeMap = /* @__PURE__ */ new Map();
|
|
449
|
-
constructor(uri) {
|
|
450
|
-
this.socket = (0, import_socket.io)(uri, { transports: ["websocket"] });
|
|
451
|
-
this.socket.on("connect", () => {
|
|
452
|
-
this.roomSubscribeMap.forEach((option) => {
|
|
453
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: true });
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
on(event, callback) {
|
|
458
|
-
this.socket.on(event, callback);
|
|
459
|
-
}
|
|
460
|
-
removeListener(event, callback) {
|
|
461
|
-
this.socket.removeListener(event, callback);
|
|
462
|
-
}
|
|
463
|
-
removeAllListeners() {
|
|
464
|
-
this.socket.removeAllListeners();
|
|
465
|
-
}
|
|
466
|
-
hasListeners(event) {
|
|
467
|
-
return this.socket.hasListeners(event);
|
|
468
|
-
}
|
|
469
|
-
emit(key, data) {
|
|
470
|
-
this.socket.emit(key, data);
|
|
471
|
-
}
|
|
472
|
-
subscribe(option) {
|
|
473
|
-
if (!this.roomSubscribeMap.has(option.roomId)) {
|
|
474
|
-
this.roomSubscribeMap.set(option.roomId, option);
|
|
475
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: true });
|
|
476
|
-
}
|
|
477
|
-
this.socket.on(option.roomId, option.handleEvent);
|
|
478
|
-
}
|
|
479
|
-
unsubscribe(roomId, handleEvent) {
|
|
480
|
-
this.socket.removeListener(roomId, handleEvent);
|
|
481
|
-
const option = this.roomSubscribeMap.get(roomId);
|
|
482
|
-
if (this.hasListeners(roomId) || !option)
|
|
483
|
-
return;
|
|
484
|
-
this.roomSubscribeMap.delete(roomId);
|
|
485
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: false });
|
|
486
|
-
}
|
|
487
|
-
disconnect() {
|
|
488
|
-
this.socket.disconnect();
|
|
489
|
-
return this;
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
var Client = class _Client {
|
|
493
|
-
static globalIoMap = /* @__PURE__ */ new Map();
|
|
494
|
-
static tokenStore = /* @__PURE__ */ new Map();
|
|
495
|
-
async waitUntilWebSocketConnected(ws = baseClientEnv.serverWsUri) {
|
|
496
|
-
if (baseClientEnv.side === "server")
|
|
497
|
-
return true;
|
|
498
|
-
while (!this.getIo(ws).socket.connected) {
|
|
499
|
-
Logger.verbose("waiting for websocket to initialize...");
|
|
500
|
-
await sleep(300);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
isInitialized = false;
|
|
504
|
-
uri = baseClientEnv.serverGraphqlUri;
|
|
505
|
-
ws = baseClientEnv.serverWsUri;
|
|
506
|
-
udp = null;
|
|
507
|
-
gql = (0, import_core.createClient)({ url: this.uri, fetch, exchanges: [import_core.cacheExchange, import_core.fetchExchange] });
|
|
508
|
-
jwt = null;
|
|
509
|
-
async getJwt() {
|
|
510
|
-
const isNextServer = baseClientEnv.side === "server" && baseEnv.operationType === "client";
|
|
511
|
-
if (isNextServer) {
|
|
512
|
-
const nextHeaders = require("next/headers");
|
|
513
|
-
return (await nextHeaders.cookies?.())?.get("jwt")?.value ?? (await nextHeaders.headers?.())?.get("jwt") ?? this.jwt ?? null;
|
|
514
|
-
} else
|
|
515
|
-
return _Client.tokenStore.get(this) ?? null;
|
|
516
|
-
}
|
|
517
|
-
io = null;
|
|
518
|
-
init(data = {}) {
|
|
519
|
-
Object.assign(this, data);
|
|
520
|
-
this.setLink(data.uri);
|
|
521
|
-
this.setIo(data.ws);
|
|
522
|
-
this.isInitialized = true;
|
|
523
|
-
}
|
|
524
|
-
setIo(ws = baseClientEnv.serverWsUri) {
|
|
525
|
-
this.ws = ws;
|
|
526
|
-
const existingIo = _Client.globalIoMap.get(ws);
|
|
527
|
-
if (existingIo) {
|
|
528
|
-
this.io = existingIo;
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
this.io = new SocketIo(ws);
|
|
532
|
-
_Client.globalIoMap.set(ws, this.io);
|
|
533
|
-
}
|
|
534
|
-
getIo(ws = baseClientEnv.serverWsUri) {
|
|
535
|
-
const existingIo = _Client.globalIoMap.get(ws);
|
|
536
|
-
if (existingIo)
|
|
537
|
-
return existingIo;
|
|
538
|
-
const io2 = new SocketIo(ws);
|
|
539
|
-
_Client.globalIoMap.set(ws, io2);
|
|
540
|
-
return io2;
|
|
541
|
-
}
|
|
542
|
-
setLink(uri = baseClientEnv.serverGraphqlUri) {
|
|
543
|
-
this.uri = uri;
|
|
544
|
-
this.gql = (0, import_core.createClient)({
|
|
545
|
-
url: this.uri,
|
|
546
|
-
fetch,
|
|
547
|
-
exchanges: [import_core.cacheExchange, import_core.fetchExchange],
|
|
548
|
-
// requestPolicy: "network-only",
|
|
549
|
-
fetchOptions: () => {
|
|
550
|
-
return {
|
|
551
|
-
headers: {
|
|
552
|
-
"apollo-require-preflight": "true",
|
|
553
|
-
...this.jwt ? { authorization: `Bearer ${this.jwt}` } : {}
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
setJwt(jwt3) {
|
|
560
|
-
_Client.tokenStore.set(this, jwt3);
|
|
561
|
-
}
|
|
562
|
-
reset() {
|
|
563
|
-
this.io?.disconnect();
|
|
564
|
-
this.io = null;
|
|
565
|
-
this.jwt = null;
|
|
566
|
-
}
|
|
567
|
-
clone(data = {}) {
|
|
568
|
-
const newClient = new _Client();
|
|
569
|
-
newClient.init({ ...this, ...data });
|
|
570
|
-
if (data.jwt)
|
|
571
|
-
_Client.tokenStore.set(newClient, data.jwt);
|
|
572
|
-
return newClient;
|
|
573
|
-
}
|
|
574
|
-
terminate() {
|
|
575
|
-
this.reset();
|
|
576
|
-
_Client.globalIoMap.forEach((io2) => io2.disconnect());
|
|
577
|
-
this.isInitialized = false;
|
|
578
|
-
}
|
|
579
|
-
setUdp(udp) {
|
|
580
|
-
this.udp = udp;
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
var client = new Client();
|
|
584
|
-
|
|
585
|
-
// pkgs/@akanjs/constant/src/types.ts
|
|
586
|
-
var DEFAULT_PAGE_SIZE = 20;
|
|
587
|
-
|
|
588
|
-
// pkgs/@akanjs/constant/src/scalar.ts
|
|
589
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
590
|
-
var scalarExampleMap = /* @__PURE__ */ new Map([
|
|
591
|
-
[ID, "1234567890abcdef12345678"],
|
|
592
|
-
[Int, 0],
|
|
593
|
-
[Float, 0],
|
|
594
|
-
[String, "String"],
|
|
595
|
-
[Boolean, true],
|
|
596
|
-
[Date, (/* @__PURE__ */ new Date()).toISOString()],
|
|
597
|
-
[Upload, "FileUpload"],
|
|
598
|
-
[JSON2, {}],
|
|
599
|
-
[Map, {}]
|
|
600
|
-
]);
|
|
601
|
-
var getClassMeta = (modelRef) => {
|
|
602
|
-
const [target] = getNonArrayModel(modelRef);
|
|
603
|
-
const classMeta = Reflect.getMetadata("class", target.prototype);
|
|
604
|
-
if (!classMeta)
|
|
605
|
-
throw new Error(`No ClassMeta for this target ${target.name}`);
|
|
606
|
-
return classMeta;
|
|
607
|
-
};
|
|
608
|
-
var getFieldMetas = (modelRef) => {
|
|
609
|
-
const [target] = getNonArrayModel(modelRef);
|
|
610
|
-
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
611
|
-
const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
|
|
612
|
-
return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
|
|
613
|
-
};
|
|
614
|
-
var getFieldMetaMapOnPrototype = (prototype) => {
|
|
615
|
-
const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
|
|
616
|
-
return new Map(metadataMap);
|
|
617
|
-
};
|
|
618
|
-
var setFieldMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
619
|
-
Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
// pkgs/@akanjs/constant/src/fieldMeta.ts
|
|
623
|
-
var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
|
|
624
|
-
const isArray = arrDepth > 0;
|
|
625
|
-
const isClass = !isGqlScalar(modelRef);
|
|
626
|
-
const isMap = isGqlMap(modelRef);
|
|
627
|
-
const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
|
|
628
|
-
const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
|
|
629
|
-
if (isMap && !option.of)
|
|
630
|
-
throw new Error("Map type must have 'of' option");
|
|
631
|
-
return (prototype, key) => {
|
|
632
|
-
const metadata = {
|
|
633
|
-
nullable: option.nullable ?? false,
|
|
634
|
-
ref: option.ref,
|
|
635
|
-
refPath: option.refPath,
|
|
636
|
-
refType: option.refType,
|
|
637
|
-
default: option.default ?? (isArray ? [] : null),
|
|
638
|
-
type: option.type,
|
|
639
|
-
fieldType: option.fieldType ?? "property",
|
|
640
|
-
immutable: option.immutable ?? false,
|
|
641
|
-
min: option.min,
|
|
642
|
-
max: option.max,
|
|
643
|
-
enum: option.enum,
|
|
644
|
-
select: option.select ?? true,
|
|
645
|
-
minlength: option.minlength,
|
|
646
|
-
maxlength: option.maxlength,
|
|
647
|
-
query: option.query,
|
|
648
|
-
accumulate: option.accumulate,
|
|
649
|
-
example: option.example,
|
|
650
|
-
validate: option.validate,
|
|
651
|
-
key,
|
|
652
|
-
name,
|
|
653
|
-
isClass,
|
|
654
|
-
isScalar: type === "scalar",
|
|
655
|
-
modelRef,
|
|
656
|
-
arrDepth,
|
|
657
|
-
isArray,
|
|
658
|
-
optArrDepth: optionArrDepth,
|
|
659
|
-
isMap,
|
|
660
|
-
of: option.of,
|
|
661
|
-
text: option.text
|
|
662
|
-
};
|
|
663
|
-
const metadataMap = getFieldMetaMapOnPrototype(prototype);
|
|
664
|
-
metadataMap.set(key, metadata);
|
|
665
|
-
setFieldMetaMapOnPrototype(prototype, metadataMap);
|
|
666
|
-
};
|
|
667
|
-
};
|
|
668
|
-
var makeField = (customOption) => (returns, fieldOption) => {
|
|
669
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
670
|
-
if (!fieldOption)
|
|
671
|
-
return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
|
|
672
|
-
const [opt, optArrDepth] = getNonArrayModel(fieldOption);
|
|
673
|
-
return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
|
|
674
|
-
};
|
|
675
|
-
var Field = {
|
|
676
|
-
Prop: makeField({ fieldType: "property" }),
|
|
677
|
-
Hidden: makeField({ fieldType: "hidden", nullable: true }),
|
|
678
|
-
Secret: makeField({ fieldType: "hidden", select: false, nullable: true }),
|
|
679
|
-
Resolve: makeField({ fieldType: "resolve" })
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
// pkgs/@akanjs/constant/src/constantDecorator.ts
|
|
683
|
-
var import_reflect_metadata2 = require("reflect-metadata");
|
|
684
|
-
|
|
685
|
-
// pkgs/@akanjs/constant/src/filterMeta.ts
|
|
686
|
-
var setFilterMeta = (filterRef, filterMeta) => {
|
|
687
|
-
const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
|
|
688
|
-
if (existingFilterMeta)
|
|
689
|
-
Object.assign(filterMeta.sort, existingFilterMeta.sort);
|
|
690
|
-
Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
|
|
691
|
-
};
|
|
692
|
-
var getFilterKeyMetaMapOnPrototype = (prototype) => {
|
|
693
|
-
const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
|
|
694
|
-
return new Map(metadataMap);
|
|
695
|
-
};
|
|
696
|
-
var setFilterKeyMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
697
|
-
Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
|
|
698
|
-
};
|
|
699
|
-
var applyFilterKeyMeta = (option) => {
|
|
700
|
-
return (prototype, key, descriptor) => {
|
|
701
|
-
const metadata = { key, ...option, descriptor };
|
|
702
|
-
const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
|
|
703
|
-
metadataMap.set(key, metadata);
|
|
704
|
-
setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
|
|
705
|
-
};
|
|
706
|
-
};
|
|
707
|
-
var makeFilter = (customOption) => (fieldOption) => {
|
|
708
|
-
return applyFilterKeyMeta({ ...customOption, ...fieldOption });
|
|
709
|
-
};
|
|
710
|
-
var getFilterArgMetasOnPrototype = (prototype, key) => {
|
|
711
|
-
const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
|
|
712
|
-
return filterArgMetas;
|
|
713
|
-
};
|
|
714
|
-
var setFilterArgMetasOnPrototype = (prototype, key, filterArgMetas) => {
|
|
715
|
-
Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
|
|
716
|
-
};
|
|
717
|
-
var applyFilterArgMeta = (name, returns, argOption) => {
|
|
718
|
-
return (prototype, key, idx) => {
|
|
719
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
720
|
-
const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
|
|
721
|
-
const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
|
|
722
|
-
const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
|
|
723
|
-
filterArgMetas[idx] = filterArgMeta;
|
|
724
|
-
setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
|
|
725
|
-
};
|
|
726
|
-
};
|
|
727
|
-
var Filter = {
|
|
728
|
-
Mongo: makeFilter({ type: "mongo" }),
|
|
729
|
-
// Meili: makeFilter({ fieldType: "hidden", nullable: true }),
|
|
730
|
-
Arg: applyFilterArgMeta
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
// pkgs/@akanjs/constant/src/baseGql.ts
|
|
734
|
-
var import_reflect_metadata3 = require("reflect-metadata");
|
|
735
|
-
var defaultFieldMeta = {
|
|
736
|
-
fieldType: "property",
|
|
737
|
-
immutable: false,
|
|
738
|
-
select: true,
|
|
739
|
-
isClass: false,
|
|
740
|
-
isScalar: true,
|
|
741
|
-
nullable: false,
|
|
742
|
-
isArray: false,
|
|
743
|
-
arrDepth: 0,
|
|
744
|
-
optArrDepth: 0,
|
|
745
|
-
default: null,
|
|
746
|
-
isMap: false
|
|
747
|
-
};
|
|
748
|
-
var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
|
|
749
|
-
var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
|
|
750
|
-
var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
|
|
751
|
-
var removedAtFieldMeta = {
|
|
752
|
-
...defaultFieldMeta,
|
|
753
|
-
key: "removedAt",
|
|
754
|
-
name: "Date",
|
|
755
|
-
modelRef: Date,
|
|
756
|
-
nullable: true,
|
|
757
|
-
default: null
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
// pkgs/@akanjs/constant/src/classMeta.ts
|
|
761
|
-
var import_reflect_metadata4 = require("reflect-metadata");
|
|
762
|
-
var InputModelStorage = class {
|
|
763
|
-
};
|
|
764
|
-
var LightModelStorage = class {
|
|
765
|
-
};
|
|
766
|
-
var FullModelStorage = class {
|
|
767
|
-
};
|
|
768
|
-
var ScalarModelStorage = class {
|
|
769
|
-
};
|
|
770
|
-
var FilterModelStorage = class {
|
|
771
|
-
};
|
|
772
|
-
var hasTextField = (modelRef) => {
|
|
773
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
774
|
-
return fieldMetas.some(
|
|
775
|
-
(fieldMeta) => !!fieldMeta.text || fieldMeta.isScalar && fieldMeta.isClass && fieldMeta.select && hasTextField(fieldMeta.modelRef)
|
|
776
|
-
);
|
|
777
|
-
};
|
|
778
|
-
var applyClassMeta = (type, modelType, storage) => {
|
|
779
|
-
return function(refName) {
|
|
780
|
-
return function(target) {
|
|
781
|
-
const modelRef = target;
|
|
782
|
-
const classMeta = { refName, type, modelType, modelRef, hasTextField: hasTextField(modelRef) };
|
|
783
|
-
Reflect.defineMetadata("class", classMeta, modelRef.prototype);
|
|
784
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
785
|
-
};
|
|
786
|
-
};
|
|
787
|
-
};
|
|
788
|
-
var applyFilterMeta = (storage) => {
|
|
789
|
-
return function(refName) {
|
|
790
|
-
return function(target) {
|
|
791
|
-
const modelRef = target;
|
|
792
|
-
setFilterMeta(modelRef, { refName, sort: {} });
|
|
793
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
794
|
-
};
|
|
795
|
-
};
|
|
796
|
-
};
|
|
797
|
-
var Model = {
|
|
798
|
-
Light: applyClassMeta("light", "data", LightModelStorage),
|
|
799
|
-
Object: applyClassMeta("full", "ephemeral", FullModelStorage),
|
|
800
|
-
Full: applyClassMeta("full", "data", FullModelStorage),
|
|
801
|
-
Input: applyClassMeta("input", "data", InputModelStorage),
|
|
802
|
-
Scalar: applyClassMeta("scalar", "data", ScalarModelStorage),
|
|
803
|
-
Summary: applyClassMeta("scalar", "summary", ScalarModelStorage),
|
|
804
|
-
Insight: applyClassMeta("scalar", "insight", ScalarModelStorage),
|
|
805
|
-
Filter: applyFilterMeta(FilterModelStorage)
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
// pkgs/@akanjs/signal/src/immerify.ts
|
|
809
|
-
var import_immer = require("immer");
|
|
810
|
-
|
|
811
|
-
// pkgs/@akanjs/signal/src/signalDecorators.ts
|
|
812
|
-
var import_reflect_metadata5 = require("reflect-metadata");
|
|
813
|
-
var createArgMetaDecorator = (type) => {
|
|
814
|
-
return function(option = {}) {
|
|
815
|
-
return function(prototype, key, idx) {
|
|
816
|
-
const argMetas = getArgMetasOnPrototype(prototype, key);
|
|
817
|
-
argMetas[idx] = { key, idx, type, option };
|
|
818
|
-
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
819
|
-
};
|
|
820
|
-
};
|
|
821
|
-
};
|
|
822
|
-
var Account = createArgMetaDecorator("Account");
|
|
823
|
-
var defaultAccount = {
|
|
824
|
-
__InternalArg__: "Account",
|
|
825
|
-
appName: baseEnv.appName,
|
|
826
|
-
environment: baseEnv.environment
|
|
827
|
-
};
|
|
828
|
-
var Self = createArgMetaDecorator("Self");
|
|
829
|
-
var Me = createArgMetaDecorator("Me");
|
|
830
|
-
var UserIp = createArgMetaDecorator("UserIp");
|
|
831
|
-
var Access = createArgMetaDecorator("Access");
|
|
832
|
-
var Req = createArgMetaDecorator("Req");
|
|
833
|
-
var Res = createArgMetaDecorator("Res");
|
|
834
|
-
var Ws = createArgMetaDecorator("Ws");
|
|
835
|
-
var Job = createArgMetaDecorator("Job");
|
|
836
|
-
var getQuery = (allow2) => function(returns, signalOption = {}, guards = []) {
|
|
837
|
-
return (prototype, key, descriptor) => {
|
|
838
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
839
|
-
metadataMap.set(key, {
|
|
840
|
-
returns,
|
|
841
|
-
signalOption,
|
|
842
|
-
key,
|
|
843
|
-
descriptor,
|
|
844
|
-
guards: [allow2, ...guards],
|
|
845
|
-
type: "Query"
|
|
846
|
-
});
|
|
847
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
848
|
-
};
|
|
849
|
-
};
|
|
850
|
-
var getMutation = (allow2) => function(returns, signalOption = {}, guards = []) {
|
|
851
|
-
return (prototype, key, descriptor) => {
|
|
852
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
853
|
-
metadataMap.set(key, {
|
|
854
|
-
returns,
|
|
855
|
-
signalOption,
|
|
856
|
-
key,
|
|
857
|
-
descriptor,
|
|
858
|
-
guards: [allow2, ...guards],
|
|
859
|
-
type: "Mutation"
|
|
860
|
-
});
|
|
861
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
862
|
-
};
|
|
863
|
-
};
|
|
864
|
-
var getMessage = (allow2) => function(returns, signalOption = {}, guards = []) {
|
|
865
|
-
return (prototype, key, descriptor) => {
|
|
866
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
867
|
-
metadataMap.set(key, {
|
|
868
|
-
returns,
|
|
869
|
-
signalOption,
|
|
870
|
-
key,
|
|
871
|
-
descriptor,
|
|
872
|
-
guards: [allow2, ...guards],
|
|
873
|
-
type: "Message"
|
|
874
|
-
});
|
|
875
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
876
|
-
};
|
|
877
|
-
};
|
|
878
|
-
var getPubsub = (allow2) => function(returns, signalOption = {}, guards = []) {
|
|
879
|
-
return (prototype, key, descriptor) => {
|
|
880
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
881
|
-
metadataMap.set(key, {
|
|
882
|
-
returns,
|
|
883
|
-
signalOption,
|
|
884
|
-
key,
|
|
885
|
-
descriptor,
|
|
886
|
-
guards: [allow2, ...guards],
|
|
887
|
-
type: "Pubsub"
|
|
888
|
-
});
|
|
889
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
890
|
-
};
|
|
891
|
-
};
|
|
892
|
-
var getProcess = (serverType) => function(returns, signalOption = {}) {
|
|
893
|
-
return (prototype, key, descriptor) => {
|
|
894
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
895
|
-
metadataMap.set(key, {
|
|
896
|
-
returns,
|
|
897
|
-
signalOption: { ...signalOption, serverType: lowerlize(serverType) },
|
|
898
|
-
key,
|
|
899
|
-
descriptor,
|
|
900
|
-
guards: ["None"],
|
|
901
|
-
type: "Process"
|
|
902
|
-
});
|
|
903
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
904
|
-
};
|
|
905
|
-
};
|
|
906
|
-
var Query = {
|
|
907
|
-
Public: getQuery("Public"),
|
|
908
|
-
Every: getQuery("Every"),
|
|
909
|
-
Admin: getQuery("Admin"),
|
|
910
|
-
User: getQuery("User"),
|
|
911
|
-
SuperAdmin: getQuery("SuperAdmin"),
|
|
912
|
-
None: getQuery("None"),
|
|
913
|
-
Owner: getQuery("Owner")
|
|
914
|
-
};
|
|
915
|
-
var Mutation = {
|
|
916
|
-
Public: getMutation("Public"),
|
|
917
|
-
Every: getMutation("Every"),
|
|
918
|
-
Admin: getMutation("Admin"),
|
|
919
|
-
User: getMutation("User"),
|
|
920
|
-
SuperAdmin: getMutation("SuperAdmin"),
|
|
921
|
-
None: getMutation("None"),
|
|
922
|
-
Owner: getMutation("Owner")
|
|
923
|
-
};
|
|
924
|
-
var Message = {
|
|
925
|
-
Public: getMessage("Public"),
|
|
926
|
-
Every: getMessage("Every"),
|
|
927
|
-
Admin: getMessage("Admin"),
|
|
928
|
-
User: getMessage("User"),
|
|
929
|
-
SuperAdmin: getMessage("SuperAdmin"),
|
|
930
|
-
None: getMessage("None"),
|
|
931
|
-
Owner: getMessage("Owner")
|
|
932
|
-
};
|
|
933
|
-
var Pubsub = {
|
|
934
|
-
Public: getPubsub("Public"),
|
|
935
|
-
Every: getPubsub("Every"),
|
|
936
|
-
Admin: getPubsub("Admin"),
|
|
937
|
-
User: getPubsub("User"),
|
|
938
|
-
SuperAdmin: getPubsub("SuperAdmin"),
|
|
939
|
-
None: getPubsub("None"),
|
|
940
|
-
Owner: getPubsub("Owner")
|
|
941
|
-
};
|
|
942
|
-
var Process = {
|
|
943
|
-
Federation: getProcess("Federation"),
|
|
944
|
-
Batch: getProcess("Batch"),
|
|
945
|
-
All: getProcess("All")
|
|
946
|
-
};
|
|
947
|
-
var getArg = (type) => function(name, returns, argsOption = {}) {
|
|
948
|
-
return function(prototype, key, idx) {
|
|
949
|
-
const argMetas = getArgMetasOnPrototype(prototype, key);
|
|
950
|
-
argMetas[idx] = { name, returns, argsOption, key, idx, type };
|
|
951
|
-
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
952
|
-
};
|
|
953
|
-
};
|
|
954
|
-
var Arg = {
|
|
955
|
-
Body: getArg("Body"),
|
|
956
|
-
Param: getArg("Param"),
|
|
957
|
-
Query: getArg("Query"),
|
|
958
|
-
Upload: getArg("Upload"),
|
|
959
|
-
Msg: getArg("Msg"),
|
|
960
|
-
Room: getArg("Room")
|
|
961
|
-
};
|
|
962
|
-
var getGqlMeta = (sigRef, key) => {
|
|
963
|
-
const gqlMetaMap = Reflect.getMetadata("gql", sigRef.prototype);
|
|
964
|
-
if (!gqlMetaMap)
|
|
965
|
-
throw new Error(`No GqlMeta found for ${sigRef.name}`);
|
|
966
|
-
const gqlMeta = gqlMetaMap.get(key);
|
|
967
|
-
if (!gqlMeta)
|
|
968
|
-
throw new Error(`No GqlMeta found for ${key}`);
|
|
969
|
-
return gqlMeta;
|
|
970
|
-
};
|
|
971
|
-
var getGqlMetaMapOnPrototype = (prototype) => {
|
|
972
|
-
const gqlMetaMap = Reflect.getMetadata("gql", prototype);
|
|
973
|
-
return gqlMetaMap ?? /* @__PURE__ */ new Map();
|
|
974
|
-
};
|
|
975
|
-
var setGqlMetaMapOnPrototype = (prototype, gqlMetaMap) => {
|
|
976
|
-
Reflect.defineMetadata("gql", gqlMetaMap, prototype);
|
|
977
|
-
};
|
|
978
|
-
var getArgMetasOnPrototype = (prototype, key) => {
|
|
979
|
-
return Reflect.getMetadata("args", prototype, key) ?? [];
|
|
980
|
-
};
|
|
981
|
-
var setArgMetasOnPrototype = (prototype, key, argMetas) => {
|
|
982
|
-
Reflect.defineMetadata("args", argMetas, prototype, key);
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
// pkgs/@akanjs/signal/src/gql.ts
|
|
986
|
-
var scalarDeserializeMap = /* @__PURE__ */ new Map([
|
|
987
|
-
[Date, (value) => dayjs(value)],
|
|
988
|
-
[String, (value) => value],
|
|
989
|
-
[ID, (value) => value],
|
|
990
|
-
[Boolean, (value) => value],
|
|
991
|
-
[Int, (value) => value],
|
|
992
|
-
[Float, (value) => value],
|
|
993
|
-
[JSON2, (value) => value]
|
|
994
|
-
]);
|
|
995
|
-
var getDeserializeFn = (inputRef) => {
|
|
996
|
-
const deserializeFn = scalarDeserializeMap.get(inputRef);
|
|
997
|
-
if (!deserializeFn)
|
|
998
|
-
return (value) => value;
|
|
999
|
-
return deserializeFn;
|
|
1000
|
-
};
|
|
1001
|
-
var deserializeInput = (value, inputRef, arrDepth) => {
|
|
1002
|
-
if (arrDepth && Array.isArray(value))
|
|
1003
|
-
return value.map((v) => deserializeInput(v, inputRef, arrDepth - 1));
|
|
1004
|
-
else if (inputRef.prototype === Map.prototype) {
|
|
1005
|
-
const [valueRef] = getNonArrayModel(inputRef);
|
|
1006
|
-
const deserializeFn = getDeserializeFn(valueRef);
|
|
1007
|
-
return Object.fromEntries(
|
|
1008
|
-
[...value.entries()].map(([key, val]) => [key, applyFnToArrayObjects(val, deserializeFn)])
|
|
1009
|
-
);
|
|
1010
|
-
} else if (isGqlScalar(inputRef)) {
|
|
1011
|
-
const deserializeFn = getDeserializeFn(inputRef);
|
|
1012
|
-
return deserializeFn(value);
|
|
1013
|
-
}
|
|
1014
|
-
const classMeta = getClassMeta(inputRef);
|
|
1015
|
-
if (classMeta.type !== "scalar")
|
|
1016
|
-
return value;
|
|
1017
|
-
else
|
|
1018
|
-
return Object.fromEntries(
|
|
1019
|
-
getFieldMetas(inputRef).map((fieldMeta) => [
|
|
1020
|
-
fieldMeta.key,
|
|
1021
|
-
deserializeInput(value[fieldMeta.key], fieldMeta.modelRef, fieldMeta.arrDepth)
|
|
1022
|
-
])
|
|
1023
|
-
);
|
|
1024
|
-
};
|
|
1025
|
-
var deserializeArg = (argMeta, value) => {
|
|
1026
|
-
const [returnRef, arrDepth] = getNonArrayModel(argMeta.returns());
|
|
1027
|
-
if (argMeta.argsOption.nullable && (value === null || value === void 0))
|
|
1028
|
-
return null;
|
|
1029
|
-
else if (!argMeta.argsOption.nullable && (value === null || value === void 0))
|
|
1030
|
-
throw new Error(`Invalid Value (Nullable) in ${argMeta.name} for value ${value}`);
|
|
1031
|
-
return deserializeInput(value, returnRef, arrDepth);
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
|
-
// pkgs/@akanjs/signal/src/baseFetch.ts
|
|
1035
|
-
var nativeFetch = fetch;
|
|
1036
|
-
var baseFetch = Object.assign(nativeFetch, {
|
|
1037
|
-
client,
|
|
1038
|
-
clone: function(option = {}) {
|
|
1039
|
-
return {
|
|
1040
|
-
...this,
|
|
1041
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
1042
|
-
client: this.client.clone(option)
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
124
|
// pkgs/@akanjs/nest/src/authorization.ts
|
|
125
|
+
var import_base = require("@akanjs/base");
|
|
126
|
+
var import_signal = require("@akanjs/signal");
|
|
1048
127
|
var import_apollo = require("@nestjs/apollo");
|
|
1049
128
|
var jwt = __toESM(require("jsonwebtoken"));
|
|
1050
129
|
var verifyToken = (secret, authorization) => {
|
|
1051
130
|
const [type, token] = authorization?.split(" ") ?? [void 0, void 0];
|
|
1052
131
|
if (!token || type !== "Bearer")
|
|
1053
|
-
return defaultAccount;
|
|
132
|
+
return import_signal.defaultAccount;
|
|
1054
133
|
try {
|
|
1055
134
|
const account = jwt.verify(token, secret);
|
|
1056
|
-
if (account.appName !== baseEnv.appName || account.environment !== baseEnv.environment)
|
|
1057
|
-
return defaultAccount;
|
|
135
|
+
if (account.appName !== import_base.baseEnv.appName || account.environment !== import_base.baseEnv.environment)
|
|
136
|
+
return import_signal.defaultAccount;
|
|
1058
137
|
return {
|
|
1059
138
|
__InternalArg__: "Account",
|
|
1060
139
|
self: account.self && !account.self.removedAt ? account.self : void 0,
|
|
@@ -1063,7 +142,7 @@ var verifyToken = (secret, authorization) => {
|
|
|
1063
142
|
environment: account.environment
|
|
1064
143
|
};
|
|
1065
144
|
} catch (e) {
|
|
1066
|
-
return defaultAccount;
|
|
145
|
+
return import_signal.defaultAccount;
|
|
1067
146
|
}
|
|
1068
147
|
};
|
|
1069
148
|
var allow = (account, roles, userId) => {
|
|
@@ -1100,7 +179,7 @@ __export(authGuards_exports, {
|
|
|
1100
179
|
getResponse: () => getResponse,
|
|
1101
180
|
getSocket: () => getSocket
|
|
1102
181
|
});
|
|
1103
|
-
var
|
|
182
|
+
var import_common = require("@nestjs/common");
|
|
1104
183
|
var import_graphql = require("@nestjs/graphql");
|
|
1105
184
|
var getRequest = (context) => {
|
|
1106
185
|
const type = context.getType();
|
|
@@ -1139,7 +218,7 @@ var Public = class {
|
|
|
1139
218
|
}
|
|
1140
219
|
};
|
|
1141
220
|
Public = __decorateClass([
|
|
1142
|
-
(0,
|
|
221
|
+
(0, import_common.Injectable)()
|
|
1143
222
|
], Public);
|
|
1144
223
|
var None = class {
|
|
1145
224
|
canActivate() {
|
|
@@ -1147,7 +226,7 @@ var None = class {
|
|
|
1147
226
|
}
|
|
1148
227
|
};
|
|
1149
228
|
None = __decorateClass([
|
|
1150
|
-
(0,
|
|
229
|
+
(0, import_common.Injectable)()
|
|
1151
230
|
], None);
|
|
1152
231
|
var Every = class {
|
|
1153
232
|
canActivate(context) {
|
|
@@ -1156,7 +235,7 @@ var Every = class {
|
|
|
1156
235
|
}
|
|
1157
236
|
};
|
|
1158
237
|
Every = __decorateClass([
|
|
1159
|
-
(0,
|
|
238
|
+
(0, import_common.Injectable)()
|
|
1160
239
|
], Every);
|
|
1161
240
|
var Owner = class {
|
|
1162
241
|
canActivate(context) {
|
|
@@ -1165,7 +244,7 @@ var Owner = class {
|
|
|
1165
244
|
}
|
|
1166
245
|
};
|
|
1167
246
|
Owner = __decorateClass([
|
|
1168
|
-
(0,
|
|
247
|
+
(0, import_common.Injectable)()
|
|
1169
248
|
], Owner);
|
|
1170
249
|
var Admin = class {
|
|
1171
250
|
canActivate(context) {
|
|
@@ -1174,7 +253,7 @@ var Admin = class {
|
|
|
1174
253
|
}
|
|
1175
254
|
};
|
|
1176
255
|
Admin = __decorateClass([
|
|
1177
|
-
(0,
|
|
256
|
+
(0, import_common.Injectable)()
|
|
1178
257
|
], Admin);
|
|
1179
258
|
var SuperAdmin = class {
|
|
1180
259
|
canActivate(context) {
|
|
@@ -1183,7 +262,7 @@ var SuperAdmin = class {
|
|
|
1183
262
|
}
|
|
1184
263
|
};
|
|
1185
264
|
SuperAdmin = __decorateClass([
|
|
1186
|
-
(0,
|
|
265
|
+
(0, import_common.Injectable)()
|
|
1187
266
|
], SuperAdmin);
|
|
1188
267
|
var User = class {
|
|
1189
268
|
canActivate(context) {
|
|
@@ -1192,42 +271,43 @@ var User = class {
|
|
|
1192
271
|
}
|
|
1193
272
|
};
|
|
1194
273
|
User = __decorateClass([
|
|
1195
|
-
(0,
|
|
274
|
+
(0, import_common.Injectable)()
|
|
1196
275
|
], User);
|
|
1197
276
|
|
|
1198
277
|
// pkgs/@akanjs/nest/src/authentication.ts
|
|
1199
|
-
var
|
|
278
|
+
var import_base2 = require("@akanjs/base");
|
|
279
|
+
var import_common2 = require("@nestjs/common");
|
|
1200
280
|
var import_ua_parser_js = __toESM(require("ua-parser-js"));
|
|
1201
|
-
var
|
|
281
|
+
var Account2 = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1202
282
|
const { account } = getRequest(context);
|
|
1203
283
|
return account;
|
|
1204
284
|
});
|
|
1205
|
-
var
|
|
285
|
+
var Self = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1206
286
|
const { account } = getRequest(context);
|
|
1207
287
|
const self = account.self;
|
|
1208
288
|
if (!self && !option.nullable)
|
|
1209
|
-
throw new
|
|
289
|
+
throw new import_common2.UnauthorizedException("No or Invalid Account in Self (User)");
|
|
1210
290
|
return self;
|
|
1211
291
|
});
|
|
1212
|
-
var
|
|
292
|
+
var Me = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1213
293
|
const { account } = getRequest(context);
|
|
1214
294
|
const me = account.me;
|
|
1215
295
|
if (!me && !option.nullable)
|
|
1216
|
-
throw new
|
|
296
|
+
throw new import_common2.UnauthorizedException("No or Invalid Account in Me (Admin)");
|
|
1217
297
|
return me;
|
|
1218
298
|
});
|
|
1219
|
-
var
|
|
299
|
+
var UserIp = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1220
300
|
const req = getRequest(context);
|
|
1221
301
|
const ip = req.ip;
|
|
1222
302
|
if (!ip && !option.nullable)
|
|
1223
|
-
throw new
|
|
303
|
+
throw new import_common2.UnauthorizedException("Invalid IP");
|
|
1224
304
|
return { ip };
|
|
1225
305
|
});
|
|
1226
|
-
var
|
|
306
|
+
var Access = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1227
307
|
const req = getRequest(context);
|
|
1228
308
|
const res = new import_ua_parser_js.default(req.userAgent).getResult();
|
|
1229
309
|
if (!req.userAgent && !option.nullable)
|
|
1230
|
-
throw new
|
|
310
|
+
throw new import_common2.UnauthorizedException("Invalid UserAgent");
|
|
1231
311
|
return {
|
|
1232
312
|
...req.geolocation ? JSON.parse(req.geolocation) : {},
|
|
1233
313
|
osName: res.os.name,
|
|
@@ -1237,17 +317,17 @@ var Access2 = (0, import_common7.createParamDecorator)((option, context) => {
|
|
|
1237
317
|
mobileModel: res.device.model,
|
|
1238
318
|
mobileVendor: res.device.vendor,
|
|
1239
319
|
deviceType: res.device.type ?? "desktop",
|
|
1240
|
-
at: dayjs(),
|
|
320
|
+
at: (0, import_base2.dayjs)(),
|
|
1241
321
|
period: 0
|
|
1242
322
|
};
|
|
1243
323
|
});
|
|
1244
|
-
var
|
|
324
|
+
var Req = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1245
325
|
return getRequest(context);
|
|
1246
326
|
});
|
|
1247
|
-
var
|
|
327
|
+
var Res = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1248
328
|
return getResponse(context);
|
|
1249
329
|
});
|
|
1250
|
-
var
|
|
330
|
+
var Ws = (0, import_common2.createParamDecorator)((option, context) => {
|
|
1251
331
|
const socket = context.getArgByIndex(0);
|
|
1252
332
|
const { __subscribe__ } = context.getArgByIndex(1);
|
|
1253
333
|
return {
|
|
@@ -1268,7 +348,9 @@ var Ws2 = (0, import_common7.createParamDecorator)((option, context) => {
|
|
|
1268
348
|
});
|
|
1269
349
|
|
|
1270
350
|
// pkgs/@akanjs/nest/src/interceptors.ts
|
|
1271
|
-
var
|
|
351
|
+
var import_common3 = require("@akanjs/common");
|
|
352
|
+
var import_signal2 = require("@akanjs/signal");
|
|
353
|
+
var import_common4 = require("@nestjs/common");
|
|
1272
354
|
var import_graphql2 = require("@nestjs/graphql");
|
|
1273
355
|
var import_rxjs = require("rxjs");
|
|
1274
356
|
var import_operators = require("rxjs/operators");
|
|
@@ -1279,13 +361,13 @@ var CacheInterceptor = class {
|
|
|
1279
361
|
__privateAdd(this, _generateCacheKey);
|
|
1280
362
|
__privateAdd(this, _getCache);
|
|
1281
363
|
__privateAdd(this, _setCache);
|
|
1282
|
-
__privateAdd(this, _logger, new Logger("CacheInterceptor"));
|
|
364
|
+
__privateAdd(this, _logger, new import_common3.Logger("CacheInterceptor"));
|
|
1283
365
|
__privateAdd(this, _CACHE_PREFIX, "signal:");
|
|
1284
366
|
}
|
|
1285
367
|
async intercept(context, next) {
|
|
1286
368
|
const handler = context.getHandler();
|
|
1287
369
|
const signalKey = handler.name;
|
|
1288
|
-
const gqlMeta = getGqlMeta(context.getClass(), signalKey);
|
|
370
|
+
const gqlMeta = (0, import_signal2.getGqlMeta)(context.getClass(), signalKey);
|
|
1289
371
|
if (gqlMeta.type !== "Query" || !gqlMeta.signalOption.cache) {
|
|
1290
372
|
if (gqlMeta.signalOption.cache)
|
|
1291
373
|
__privateGet(this, _logger).warn(`CacheInterceptor: ${signalKey} is not Query endpoint or cache is not set`);
|
|
@@ -1353,12 +435,12 @@ setCache_fn = async function(key, data, ttlMs) {
|
|
|
1353
435
|
}
|
|
1354
436
|
};
|
|
1355
437
|
CacheInterceptor = __decorateClass([
|
|
1356
|
-
(0,
|
|
1357
|
-
__decorateParam(0, (0,
|
|
438
|
+
(0, import_common4.Injectable)(),
|
|
439
|
+
__decorateParam(0, (0, import_common4.Inject)("REDIS_CLIENT"))
|
|
1358
440
|
], CacheInterceptor);
|
|
1359
441
|
var TimeoutInterceptor = class {
|
|
1360
442
|
intercept(context, next) {
|
|
1361
|
-
const gqlMeta = getGqlMeta(context.getClass(), context.getHandler().name);
|
|
443
|
+
const gqlMeta = (0, import_signal2.getGqlMeta)(context.getClass(), context.getHandler().name);
|
|
1362
444
|
const timeoutMs = gqlMeta.signalOption.timeout ?? 3e4;
|
|
1363
445
|
if (timeoutMs === 0)
|
|
1364
446
|
return next.handle();
|
|
@@ -1366,17 +448,17 @@ var TimeoutInterceptor = class {
|
|
|
1366
448
|
(0, import_operators.timeout)(timeoutMs),
|
|
1367
449
|
(0, import_operators.catchError)((err) => {
|
|
1368
450
|
if (err instanceof import_rxjs.TimeoutError)
|
|
1369
|
-
return (0, import_rxjs.throwError)(() => new
|
|
451
|
+
return (0, import_rxjs.throwError)(() => new import_common4.RequestTimeoutException());
|
|
1370
452
|
return (0, import_rxjs.throwError)(() => err);
|
|
1371
453
|
})
|
|
1372
454
|
);
|
|
1373
455
|
}
|
|
1374
456
|
};
|
|
1375
457
|
TimeoutInterceptor = __decorateClass([
|
|
1376
|
-
(0,
|
|
458
|
+
(0, import_common4.Injectable)()
|
|
1377
459
|
], TimeoutInterceptor);
|
|
1378
460
|
var LoggingInterceptor = class {
|
|
1379
|
-
logger = new Logger("IO");
|
|
461
|
+
logger = new import_common3.Logger("IO");
|
|
1380
462
|
intercept(context, next) {
|
|
1381
463
|
const gqlReq = context.getArgByIndex(3);
|
|
1382
464
|
const req = getRequest(context);
|
|
@@ -1394,16 +476,17 @@ var LoggingInterceptor = class {
|
|
|
1394
476
|
}
|
|
1395
477
|
};
|
|
1396
478
|
LoggingInterceptor = __decorateClass([
|
|
1397
|
-
(0,
|
|
479
|
+
(0, import_common4.Injectable)()
|
|
1398
480
|
], LoggingInterceptor);
|
|
1399
481
|
|
|
1400
482
|
// pkgs/@akanjs/nest/src/redis-io.adapter.ts
|
|
483
|
+
var import_common5 = require("@akanjs/common");
|
|
1401
484
|
var import_platform_socket = require("@nestjs/platform-socket.io");
|
|
1402
485
|
var import_redis_adapter = require("@socket.io/redis-adapter");
|
|
1403
486
|
var import_redis = require("redis");
|
|
1404
487
|
var RedisIoAdapter = class extends import_platform_socket.IoAdapter {
|
|
1405
488
|
adapterConstructor;
|
|
1406
|
-
logger = new Logger("RedisIoAdapter");
|
|
489
|
+
logger = new import_common5.Logger("RedisIoAdapter");
|
|
1407
490
|
server;
|
|
1408
491
|
pubClient;
|
|
1409
492
|
subClient;
|
|
@@ -1427,7 +510,7 @@ var RedisIoAdapter = class extends import_platform_socket.IoAdapter {
|
|
|
1427
510
|
this.logger.error(`Redis pub database is errored. Error: ${err}`);
|
|
1428
511
|
const reconnect = async () => {
|
|
1429
512
|
await this.pubClient.quit();
|
|
1430
|
-
await sleep(1e3);
|
|
513
|
+
await (0, import_common5.sleep)(1e3);
|
|
1431
514
|
await this.pubClient.connect();
|
|
1432
515
|
};
|
|
1433
516
|
void reconnect();
|
|
@@ -1436,7 +519,7 @@ var RedisIoAdapter = class extends import_platform_socket.IoAdapter {
|
|
|
1436
519
|
this.logger.error(`Redis sub database is errored. Error: ${err}`);
|
|
1437
520
|
const reconnect = async () => {
|
|
1438
521
|
await this.subClient.quit();
|
|
1439
|
-
await sleep(1e3);
|
|
522
|
+
await (0, import_common5.sleep)(1e3);
|
|
1440
523
|
await this.subClient.connect();
|
|
1441
524
|
};
|
|
1442
525
|
void reconnect();
|
|
@@ -1457,7 +540,9 @@ var RedisIoAdapter = class extends import_platform_socket.IoAdapter {
|
|
|
1457
540
|
};
|
|
1458
541
|
|
|
1459
542
|
// pkgs/@akanjs/nest/src/pipes.ts
|
|
1460
|
-
var
|
|
543
|
+
var import_base3 = require("@akanjs/base");
|
|
544
|
+
var import_signal3 = require("@akanjs/signal");
|
|
545
|
+
var import_common6 = require("@nestjs/common");
|
|
1461
546
|
var import_stream = require("stream");
|
|
1462
547
|
var ArrayifyPipe = class {
|
|
1463
548
|
transform(value, metadata) {
|
|
@@ -1465,7 +550,7 @@ var ArrayifyPipe = class {
|
|
|
1465
550
|
}
|
|
1466
551
|
};
|
|
1467
552
|
ArrayifyPipe = __decorateClass([
|
|
1468
|
-
(0,
|
|
553
|
+
(0, import_common6.Injectable)()
|
|
1469
554
|
], ArrayifyPipe);
|
|
1470
555
|
var IntPipe = class {
|
|
1471
556
|
transform(value, metadata) {
|
|
@@ -1473,7 +558,7 @@ var IntPipe = class {
|
|
|
1473
558
|
}
|
|
1474
559
|
};
|
|
1475
560
|
IntPipe = __decorateClass([
|
|
1476
|
-
(0,
|
|
561
|
+
(0, import_common6.Injectable)()
|
|
1477
562
|
], IntPipe);
|
|
1478
563
|
var FloatPipe = class {
|
|
1479
564
|
transform(value, metadata) {
|
|
@@ -1481,7 +566,7 @@ var FloatPipe = class {
|
|
|
1481
566
|
}
|
|
1482
567
|
};
|
|
1483
568
|
FloatPipe = __decorateClass([
|
|
1484
|
-
(0,
|
|
569
|
+
(0, import_common6.Injectable)()
|
|
1485
570
|
], FloatPipe);
|
|
1486
571
|
var BooleanPipe = class {
|
|
1487
572
|
transform(value, metadata) {
|
|
@@ -1489,15 +574,15 @@ var BooleanPipe = class {
|
|
|
1489
574
|
}
|
|
1490
575
|
};
|
|
1491
576
|
BooleanPipe = __decorateClass([
|
|
1492
|
-
(0,
|
|
577
|
+
(0, import_common6.Injectable)()
|
|
1493
578
|
], BooleanPipe);
|
|
1494
579
|
var DayjsPipe = class {
|
|
1495
580
|
transform(value, metadata) {
|
|
1496
|
-
return Array.isArray(value) ? value.map(dayjs) : [dayjs(value)];
|
|
581
|
+
return Array.isArray(value) ? value.map(import_base3.dayjs) : [(0, import_base3.dayjs)(value)];
|
|
1497
582
|
}
|
|
1498
583
|
};
|
|
1499
584
|
DayjsPipe = __decorateClass([
|
|
1500
|
-
(0,
|
|
585
|
+
(0, import_common6.Injectable)()
|
|
1501
586
|
], DayjsPipe);
|
|
1502
587
|
var JSONPipe = class {
|
|
1503
588
|
transform(value, metadata) {
|
|
@@ -1507,7 +592,7 @@ var JSONPipe = class {
|
|
|
1507
592
|
}
|
|
1508
593
|
};
|
|
1509
594
|
JSONPipe = __decorateClass([
|
|
1510
|
-
(0,
|
|
595
|
+
(0, import_common6.Injectable)()
|
|
1511
596
|
], JSONPipe);
|
|
1512
597
|
var convertToFileStream = (value) => ({
|
|
1513
598
|
filename: value.originalname,
|
|
@@ -1521,14 +606,14 @@ var MulterToUploadPipe = class {
|
|
|
1521
606
|
}
|
|
1522
607
|
};
|
|
1523
608
|
MulterToUploadPipe = __decorateClass([
|
|
1524
|
-
(0,
|
|
609
|
+
(0, import_common6.Injectable)()
|
|
1525
610
|
], MulterToUploadPipe);
|
|
1526
611
|
var gqlScalarPipeMap = /* @__PURE__ */ new Map([
|
|
1527
|
-
[Int, IntPipe],
|
|
1528
|
-
[Float, FloatPipe],
|
|
612
|
+
[import_base3.Int, IntPipe],
|
|
613
|
+
[import_base3.Float, FloatPipe],
|
|
1529
614
|
[Boolean, BooleanPipe],
|
|
1530
615
|
[Date, DayjsPipe],
|
|
1531
|
-
[
|
|
616
|
+
[import_base3.JSON, JSONPipe]
|
|
1532
617
|
]);
|
|
1533
618
|
var getQueryPipes = (modelRef, arrDepth) => {
|
|
1534
619
|
const pipes = arrDepth ? [ArrayifyPipe] : [];
|
|
@@ -1538,16 +623,16 @@ var getQueryPipes = (modelRef, arrDepth) => {
|
|
|
1538
623
|
return pipes;
|
|
1539
624
|
};
|
|
1540
625
|
var getBodyPipes = (argMeta) => {
|
|
1541
|
-
const [returnRef] = getNonArrayModel(argMeta.returns());
|
|
1542
|
-
if (returnRef.prototype !== Date.prototype && !isGqlScalar(returnRef))
|
|
626
|
+
const [returnRef] = (0, import_base3.getNonArrayModel)(argMeta.returns());
|
|
627
|
+
if (returnRef.prototype !== Date.prototype && !(0, import_base3.isGqlScalar)(returnRef))
|
|
1543
628
|
return [];
|
|
1544
629
|
let BodyPipe = class {
|
|
1545
630
|
transform(value, metadata) {
|
|
1546
|
-
return deserializeArg(argMeta, value);
|
|
631
|
+
return (0, import_signal3.deserializeArg)(argMeta, value);
|
|
1547
632
|
}
|
|
1548
633
|
};
|
|
1549
634
|
BodyPipe = __decorateClass([
|
|
1550
|
-
(0,
|
|
635
|
+
(0, import_common6.Injectable)()
|
|
1551
636
|
], BodyPipe);
|
|
1552
637
|
return [BodyPipe];
|
|
1553
638
|
};
|
|
@@ -1648,7 +733,7 @@ var verifyPayment = async (payment) => {
|
|
|
1648
733
|
};
|
|
1649
734
|
|
|
1650
735
|
// pkgs/@akanjs/nest/src/sso.ts
|
|
1651
|
-
var
|
|
736
|
+
var import_common7 = require("@nestjs/common");
|
|
1652
737
|
var import_passport = require("@nestjs/passport");
|
|
1653
738
|
var appleSignin = __toESM(require("apple-signin"));
|
|
1654
739
|
var jwt2 = __toESM(require("jsonwebtoken"));
|
|
@@ -1679,7 +764,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1679
764
|
}
|
|
1680
765
|
};
|
|
1681
766
|
KakaoOauthStrategy = __decorateClass([
|
|
1682
|
-
(0,
|
|
767
|
+
(0, import_common7.Injectable)()
|
|
1683
768
|
], KakaoOauthStrategy);
|
|
1684
769
|
providers.push(KakaoOauthStrategy);
|
|
1685
770
|
}
|
|
@@ -1697,7 +782,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1697
782
|
}
|
|
1698
783
|
};
|
|
1699
784
|
NaverOauthStrategy = __decorateClass([
|
|
1700
|
-
(0,
|
|
785
|
+
(0, import_common7.Injectable)()
|
|
1701
786
|
], NaverOauthStrategy);
|
|
1702
787
|
providers.push(NaverOauthStrategy);
|
|
1703
788
|
}
|
|
@@ -1711,7 +796,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1711
796
|
}
|
|
1712
797
|
};
|
|
1713
798
|
GithubOauthStrategy = __decorateClass([
|
|
1714
|
-
(0,
|
|
799
|
+
(0, import_common7.Injectable)()
|
|
1715
800
|
], GithubOauthStrategy);
|
|
1716
801
|
providers.push(GithubOauthStrategy);
|
|
1717
802
|
}
|
|
@@ -1725,7 +810,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1725
810
|
}
|
|
1726
811
|
};
|
|
1727
812
|
GoogleOauthStrategy = __decorateClass([
|
|
1728
|
-
(0,
|
|
813
|
+
(0, import_common7.Injectable)()
|
|
1729
814
|
], GoogleOauthStrategy);
|
|
1730
815
|
providers.push(GoogleOauthStrategy);
|
|
1731
816
|
}
|
|
@@ -1744,7 +829,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1744
829
|
}
|
|
1745
830
|
};
|
|
1746
831
|
FacebookOauthStrategy = __decorateClass([
|
|
1747
|
-
(0,
|
|
832
|
+
(0, import_common7.Injectable)()
|
|
1748
833
|
], FacebookOauthStrategy);
|
|
1749
834
|
providers.push(FacebookOauthStrategy);
|
|
1750
835
|
}
|
|
@@ -1763,7 +848,7 @@ var getSsoProviders = (host, ssoOptions) => {
|
|
|
1763
848
|
}
|
|
1764
849
|
};
|
|
1765
850
|
AppleOauthStrategy = __decorateClass([
|
|
1766
|
-
(0,
|
|
851
|
+
(0, import_common7.Injectable)()
|
|
1767
852
|
], AppleOauthStrategy);
|
|
1768
853
|
providers.push(AppleOauthStrategy);
|
|
1769
854
|
}
|
|
@@ -1790,9 +875,10 @@ var verifyAppleUser = async (payload, origin, sso) => {
|
|
|
1790
875
|
};
|
|
1791
876
|
|
|
1792
877
|
// pkgs/@akanjs/nest/src/exceptions.ts
|
|
1793
|
-
var
|
|
878
|
+
var import_common8 = require("@akanjs/common");
|
|
879
|
+
var import_common9 = require("@nestjs/common");
|
|
1794
880
|
var AllExceptionsFilter = class {
|
|
1795
|
-
logger = new Logger("Exception Filter");
|
|
881
|
+
logger = new import_common8.Logger("Exception Filter");
|
|
1796
882
|
catch(exception, host) {
|
|
1797
883
|
if (host.getType() !== "http") {
|
|
1798
884
|
const gqlArgs = host.getArgByIndex(1);
|
|
@@ -1812,13 +898,13 @@ ${exception.stack}`
|
|
|
1812
898
|
const req = ctx.getRequest();
|
|
1813
899
|
const reqType = req.method;
|
|
1814
900
|
const reqName = req.url;
|
|
1815
|
-
const status = exception instanceof
|
|
901
|
+
const status = exception instanceof import_common9.HttpException ? exception.getStatus() : null;
|
|
1816
902
|
if (status) {
|
|
1817
903
|
res.status(status).json({
|
|
1818
904
|
statusCode: status,
|
|
1819
905
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1820
906
|
path: req.url,
|
|
1821
|
-
message: exception instanceof
|
|
907
|
+
message: exception instanceof import_common9.HttpException ? exception.getResponse() : exception.message
|
|
1822
908
|
});
|
|
1823
909
|
this.logger.error(
|
|
1824
910
|
`Http Error: ${status}
|
|
@@ -1830,10 +916,11 @@ ${exception.stack}`
|
|
|
1830
916
|
}
|
|
1831
917
|
};
|
|
1832
918
|
AllExceptionsFilter = __decorateClass([
|
|
1833
|
-
(0,
|
|
919
|
+
(0, import_common9.Catch)()
|
|
1834
920
|
], AllExceptionsFilter);
|
|
1835
921
|
|
|
1836
922
|
// pkgs/@akanjs/nest/src/generateSecrets.ts
|
|
923
|
+
var import_base4 = require("@akanjs/base");
|
|
1837
924
|
var import_crypto = require("crypto");
|
|
1838
925
|
var import_tunnel_ssh = require("tunnel-ssh");
|
|
1839
926
|
var generateHexStringFromSeed = (seed, length = 256) => {
|
|
@@ -1846,27 +933,27 @@ var generateHexStringFromSeed = (seed, length = 256) => {
|
|
|
1846
933
|
}
|
|
1847
934
|
return hexString.substring(0, length * 2);
|
|
1848
935
|
};
|
|
1849
|
-
var generateJwtSecret = (
|
|
1850
|
-
const seed = `${
|
|
936
|
+
var generateJwtSecret = (appName, environment) => {
|
|
937
|
+
const seed = `${appName}-${environment}-jwt-secret`;
|
|
1851
938
|
return generateHexStringFromSeed(seed);
|
|
1852
939
|
};
|
|
1853
|
-
var generateAeskey = (
|
|
1854
|
-
const seed = `${
|
|
940
|
+
var generateAeskey = (appName, environment) => {
|
|
941
|
+
const seed = `${appName}-${environment}-aes-key`;
|
|
1855
942
|
return (0, import_crypto.createHash)("sha256").update(seed).digest("hex");
|
|
1856
943
|
};
|
|
1857
944
|
var DEFAULT_CLOUD_PORT = 3e4;
|
|
1858
|
-
var getEnvironmentPort = (
|
|
945
|
+
var getEnvironmentPort = (environment) => environment === "main" ? 2e3 : environment === "develop" ? 1e3 : environment === "debug" ? 0 : 0;
|
|
1859
946
|
var getServicePort = (appCode, service) => (service === "redis" ? 300 : service === "mongo" ? 400 : 500) + appCode % 10 * 10 + (appCode >= 10 ? 5 : 0);
|
|
1860
947
|
var createDatabaseTunnel = async ({
|
|
1861
|
-
appName
|
|
1862
|
-
environment
|
|
948
|
+
appName,
|
|
949
|
+
environment,
|
|
1863
950
|
type,
|
|
1864
951
|
port,
|
|
1865
952
|
sshOptions = {
|
|
1866
|
-
host: `${
|
|
953
|
+
host: `${appName}-${environment}.${import_base4.baseEnv.serveDomain}`,
|
|
1867
954
|
port: 32767,
|
|
1868
|
-
username: baseEnv.tunnelUsername,
|
|
1869
|
-
password: baseEnv.tunnelPassword
|
|
955
|
+
username: import_base4.baseEnv.tunnelUsername,
|
|
956
|
+
password: import_base4.baseEnv.tunnelPassword
|
|
1870
957
|
}
|
|
1871
958
|
}) => {
|
|
1872
959
|
const tunnelOptions = { autoClose: true, reconnectOnError: false };
|
|
@@ -1874,47 +961,47 @@ var createDatabaseTunnel = async ({
|
|
|
1874
961
|
const forwardOptions = {
|
|
1875
962
|
srcAddr: "0.0.0.0",
|
|
1876
963
|
srcPort: port,
|
|
1877
|
-
dstAddr: `${type}-0.${type}-svc.${
|
|
964
|
+
dstAddr: `${type}-0.${type}-svc.${appName}-${environment}`,
|
|
1878
965
|
dstPort: type === "mongo" ? 27017 : type === "redis" ? 6379 : 7700
|
|
1879
966
|
};
|
|
1880
|
-
const [server,
|
|
967
|
+
const [server, client] = await (0, import_tunnel_ssh.createTunnel)(tunnelOptions, serverOptions, sshOptions, forwardOptions);
|
|
1881
968
|
return `localhost:${port}`;
|
|
1882
969
|
};
|
|
1883
|
-
var generateRedisUri = async ({ appName
|
|
970
|
+
var generateRedisUri = async ({ appName, appCode, environment, operationMode, sshOptions }) => {
|
|
1884
971
|
if (process.env.REDIS_URI)
|
|
1885
972
|
return process.env.REDIS_URI;
|
|
1886
|
-
const port =
|
|
1887
|
-
const url =
|
|
973
|
+
const port = operationMode === "local" ? DEFAULT_CLOUD_PORT + getEnvironmentPort(environment) + getServicePort(appCode, "redis") : 6379;
|
|
974
|
+
const url = operationMode === "cloud" ? `redis-svc.${appName}-${environment}.svc.cluster.local` : operationMode === "local" ? await createDatabaseTunnel({ appName, environment, type: "redis", port, sshOptions }) : "localhost:6379";
|
|
1888
975
|
const uri = `redis://${url}`;
|
|
1889
976
|
return uri;
|
|
1890
977
|
};
|
|
1891
978
|
var generateMongoUri = async ({
|
|
1892
|
-
appName
|
|
979
|
+
appName,
|
|
1893
980
|
appCode,
|
|
1894
|
-
environment
|
|
1895
|
-
operationMode
|
|
1896
|
-
username = `${
|
|
981
|
+
environment,
|
|
982
|
+
operationMode,
|
|
983
|
+
username = `${appName}-${environment}-mongo-user`,
|
|
1897
984
|
password,
|
|
1898
985
|
sshOptions
|
|
1899
986
|
}) => {
|
|
1900
987
|
if (process.env.MONGO_URI)
|
|
1901
988
|
return process.env.MONGO_URI;
|
|
1902
|
-
const record =
|
|
1903
|
-
const port =
|
|
1904
|
-
const url =
|
|
989
|
+
const record = operationMode === "cloud" ? "mongodb+srv" : "mongodb";
|
|
990
|
+
const port = operationMode === "local" ? DEFAULT_CLOUD_PORT + getEnvironmentPort(environment) + getServicePort(appCode, "mongo") : 27017;
|
|
991
|
+
const url = operationMode === "cloud" ? `mongo-svc.${appName}-${environment}.svc.cluster.local` : operationMode === "local" ? await createDatabaseTunnel({ appName, environment, type: "mongo", port, sshOptions }) : "localhost:27017";
|
|
1905
992
|
const usernameEncoded = password ? encodeURIComponent(username) : null;
|
|
1906
993
|
const passwordEncoded = password ? encodeURIComponent(password) : null;
|
|
1907
|
-
const dbName = `${
|
|
1908
|
-
const directConnection =
|
|
994
|
+
const dbName = `${appName}-${environment}`;
|
|
995
|
+
const directConnection = operationMode === "cloud" ? false : true;
|
|
1909
996
|
const authInfo = usernameEncoded ? `${usernameEncoded}:${passwordEncoded}@` : "";
|
|
1910
997
|
const uri = `${record}://${authInfo}${url}/${dbName}?authSource=${dbName}&readPreference=primary&ssl=false&retryWrites=true&directConnection=${directConnection}`;
|
|
1911
998
|
return uri;
|
|
1912
999
|
};
|
|
1913
|
-
var generateMeiliUri = ({ appName
|
|
1000
|
+
var generateMeiliUri = ({ appName, appCode, environment, operationMode }) => {
|
|
1914
1001
|
if (process.env.MEILI_URI)
|
|
1915
1002
|
return process.env.MEILI_URI;
|
|
1916
|
-
const protocol =
|
|
1917
|
-
const url =
|
|
1003
|
+
const protocol = operationMode === "local" ? "https" : "http";
|
|
1004
|
+
const url = operationMode === "cloud" ? `meili-0.meili-svc.${appName}-${environment}.svc.cluster.local:7700` : operationMode === "local" ? `${appName}-${environment}.${import_base4.baseEnv.serveDomain}/search` : "localhost:7700";
|
|
1918
1005
|
const uri = `${protocol}://${url}`;
|
|
1919
1006
|
return uri;
|
|
1920
1007
|
};
|
|
@@ -1927,20 +1014,21 @@ var generateHost = (env) => {
|
|
|
1927
1014
|
else if (env.operationMode === "local")
|
|
1928
1015
|
return "localhost";
|
|
1929
1016
|
else
|
|
1930
|
-
return `${env.appName}-${env.environment}.${baseEnv.serveDomain}`;
|
|
1017
|
+
return `${env.appName}-${env.environment}.${import_base4.baseEnv.serveDomain}`;
|
|
1931
1018
|
};
|
|
1932
|
-
var generateMeiliKey = ({ appName
|
|
1933
|
-
return `meilisearch-key-${
|
|
1019
|
+
var generateMeiliKey = ({ appName, environment }) => {
|
|
1020
|
+
return `meilisearch-key-${appName}-${environment}`;
|
|
1934
1021
|
};
|
|
1935
1022
|
|
|
1936
1023
|
// pkgs/@akanjs/nest/src/mongoose.ts
|
|
1024
|
+
var import_common10 = require("@akanjs/common");
|
|
1937
1025
|
var import_mongoose = __toESM(require("mongoose"));
|
|
1938
1026
|
var initMongoDB = ({
|
|
1939
1027
|
logging,
|
|
1940
1028
|
threshold = 5e3,
|
|
1941
1029
|
sendReport = false
|
|
1942
1030
|
}) => {
|
|
1943
|
-
const mongoDBLogger = new Logger("MongoDB");
|
|
1031
|
+
const mongoDBLogger = new import_common10.Logger("MongoDB");
|
|
1944
1032
|
if (logging)
|
|
1945
1033
|
import_mongoose.default.set("debug", function(collection, method, ...methodArgs) {
|
|
1946
1034
|
mongoDBLogger.verbose(
|
|
@@ -1992,7 +1080,8 @@ var initMongoDB = ({
|
|
|
1992
1080
|
};
|
|
1993
1081
|
|
|
1994
1082
|
// pkgs/@akanjs/nest/src/searchClient.ts
|
|
1995
|
-
var
|
|
1083
|
+
var import_constant = require("@akanjs/constant");
|
|
1084
|
+
var import_common11 = require("@nestjs/common");
|
|
1996
1085
|
var SearchClient = class {
|
|
1997
1086
|
meili;
|
|
1998
1087
|
async getIndexNames() {
|
|
@@ -2000,7 +1089,7 @@ var SearchClient = class {
|
|
|
2000
1089
|
return results.map((index) => index.uid);
|
|
2001
1090
|
}
|
|
2002
1091
|
async getSearchResult(indexName, option) {
|
|
2003
|
-
const { skip = 0, limit = DEFAULT_PAGE_SIZE, sort = "", searchString } = option;
|
|
1092
|
+
const { skip = 0, limit = import_constant.DEFAULT_PAGE_SIZE, sort = "", searchString } = option;
|
|
2004
1093
|
if (!searchString) {
|
|
2005
1094
|
const { results, total } = await this.meili.index(indexName).getDocuments({ offset: skip, limit });
|
|
2006
1095
|
return { docs: results, skip, limit, sort, total };
|
|
@@ -2018,31 +1107,32 @@ var SearchClient = class {
|
|
|
2018
1107
|
}
|
|
2019
1108
|
};
|
|
2020
1109
|
__decorateClass([
|
|
2021
|
-
(0,
|
|
1110
|
+
(0, import_common11.Inject)("MEILI_CLIENT")
|
|
2022
1111
|
], SearchClient.prototype, "meili", 2);
|
|
2023
1112
|
SearchClient = __decorateClass([
|
|
2024
|
-
(0,
|
|
1113
|
+
(0, import_common11.Injectable)()
|
|
2025
1114
|
], SearchClient);
|
|
2026
1115
|
|
|
2027
1116
|
// pkgs/@akanjs/nest/src/cacheClient.ts
|
|
2028
|
-
var
|
|
1117
|
+
var import_common12 = require("@nestjs/common");
|
|
2029
1118
|
var CacheClient = class {
|
|
2030
1119
|
redis;
|
|
2031
1120
|
};
|
|
2032
1121
|
__decorateClass([
|
|
2033
|
-
(0,
|
|
1122
|
+
(0, import_common12.Inject)("REDIS_CLIENT")
|
|
2034
1123
|
], CacheClient.prototype, "redis", 2);
|
|
2035
1124
|
CacheClient = __decorateClass([
|
|
2036
|
-
(0,
|
|
1125
|
+
(0, import_common12.Injectable)()
|
|
2037
1126
|
], CacheClient);
|
|
2038
1127
|
|
|
2039
1128
|
// pkgs/@akanjs/nest/src/databaseClient.ts
|
|
2040
|
-
var
|
|
1129
|
+
var import_common13 = require("@akanjs/common");
|
|
1130
|
+
var import_common14 = require("@nestjs/common");
|
|
2041
1131
|
var import_mongoose2 = require("@nestjs/mongoose");
|
|
2042
1132
|
var DatabaseClient = class {
|
|
2043
1133
|
connection;
|
|
2044
1134
|
getModel(modelName) {
|
|
2045
|
-
const model = this.connection.models[capitalize(modelName)];
|
|
1135
|
+
const model = this.connection.models[(0, import_common13.capitalize)(modelName)];
|
|
2046
1136
|
return model;
|
|
2047
1137
|
}
|
|
2048
1138
|
};
|
|
@@ -2050,11 +1140,11 @@ __decorateClass([
|
|
|
2050
1140
|
(0, import_mongoose2.InjectConnection)()
|
|
2051
1141
|
], DatabaseClient.prototype, "connection", 2);
|
|
2052
1142
|
DatabaseClient = __decorateClass([
|
|
2053
|
-
(0,
|
|
1143
|
+
(0, import_common14.Injectable)()
|
|
2054
1144
|
], DatabaseClient);
|
|
2055
1145
|
|
|
2056
1146
|
// pkgs/@akanjs/nest/src/decorators.ts
|
|
2057
|
-
var
|
|
1147
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
2058
1148
|
var import_schedule = require("@nestjs/schedule");
|
|
2059
1149
|
var Try = () => {
|
|
2060
1150
|
return function(target, key, descriptor) {
|
|
@@ -2191,4 +1281,3 @@ var Cache = (timeout2 = 1e3, getCacheKey) => {
|
|
|
2191
1281
|
};
|
|
2192
1282
|
};
|
|
2193
1283
|
};
|
|
2194
|
-
//! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
|