@akanjs/service 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 +32 -592
- package/package.json +1 -3
package/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
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
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
29
19
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
@@ -57,559 +47,10 @@ __export(service_exports, {
|
|
|
57
47
|
module.exports = __toCommonJS(service_exports);
|
|
58
48
|
|
|
59
49
|
// pkgs/@akanjs/service/src/serviceDecorators.ts
|
|
60
|
-
var import_reflect_metadata5 = require("reflect-metadata");
|
|
61
|
-
|
|
62
|
-
// pkgs/@akanjs/common/src/isDayjs.ts
|
|
63
|
-
var import_dayjs = require("dayjs");
|
|
64
|
-
|
|
65
|
-
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
66
|
-
var import_dayjs2 = __toESM(require("dayjs"));
|
|
67
|
-
|
|
68
|
-
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
69
|
-
var import_dayjs3 = __toESM(require("dayjs"));
|
|
70
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
71
|
-
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
72
|
-
|
|
73
|
-
// pkgs/@akanjs/common/src/pluralize.ts
|
|
74
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
75
|
-
|
|
76
|
-
// pkgs/@akanjs/common/src/applyMixins.ts
|
|
77
|
-
var getAllPropertyDescriptors = (objRef) => {
|
|
78
|
-
const descriptors = {};
|
|
79
|
-
let current = objRef.prototype;
|
|
80
|
-
while (current) {
|
|
81
|
-
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
82
|
-
descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
|
|
83
|
-
});
|
|
84
|
-
current = Object.getPrototypeOf(current);
|
|
85
|
-
}
|
|
86
|
-
return descriptors;
|
|
87
|
-
};
|
|
88
|
-
var applyMixins = (derivedCtor, constructors, avoidKeys) => {
|
|
89
|
-
constructors.forEach((baseCtor) => {
|
|
90
|
-
Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
|
|
91
|
-
if (name === "constructor" || avoidKeys?.has(name))
|
|
92
|
-
return;
|
|
93
|
-
Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// pkgs/@akanjs/common/src/capitalize.ts
|
|
99
|
-
var capitalize = (str) => {
|
|
100
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// pkgs/@akanjs/common/src/Logger.ts
|
|
104
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
105
|
-
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
106
|
-
var clc = {
|
|
107
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
108
|
-
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
109
|
-
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
110
|
-
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
111
|
-
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
112
|
-
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
113
|
-
};
|
|
114
|
-
var colorizeMap = {
|
|
115
|
-
trace: clc.bold,
|
|
116
|
-
verbose: clc.cyanBright,
|
|
117
|
-
debug: clc.magentaBright,
|
|
118
|
-
log: clc.green,
|
|
119
|
-
info: clc.green,
|
|
120
|
-
warn: clc.yellow,
|
|
121
|
-
error: clc.red
|
|
122
|
-
};
|
|
123
|
-
var Logger = class _Logger {
|
|
124
|
-
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
125
|
-
"InstanceLoader",
|
|
126
|
-
"RoutesResolver",
|
|
127
|
-
"RouterExplorer",
|
|
128
|
-
"NestFactory",
|
|
129
|
-
"WebSocketsController",
|
|
130
|
-
"GraphQLModule",
|
|
131
|
-
"NestApplication"
|
|
132
|
-
]);
|
|
133
|
-
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
134
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
135
|
-
static #startAt = (0, import_dayjs4.default)();
|
|
136
|
-
static setLevel(level) {
|
|
137
|
-
this.level = level;
|
|
138
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
139
|
-
}
|
|
140
|
-
name;
|
|
141
|
-
constructor(name) {
|
|
142
|
-
this.name = name;
|
|
143
|
-
}
|
|
144
|
-
trace(msg, context = "") {
|
|
145
|
-
if (_Logger.#levelIdx <= 0)
|
|
146
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
147
|
-
}
|
|
148
|
-
verbose(msg, context = "") {
|
|
149
|
-
if (_Logger.#levelIdx <= 1)
|
|
150
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
151
|
-
}
|
|
152
|
-
debug(msg, context = "") {
|
|
153
|
-
if (_Logger.#levelIdx <= 2)
|
|
154
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
155
|
-
}
|
|
156
|
-
log(msg, context = "") {
|
|
157
|
-
if (_Logger.#levelIdx <= 3)
|
|
158
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
159
|
-
}
|
|
160
|
-
info(msg, context = "") {
|
|
161
|
-
if (_Logger.#levelIdx <= 4)
|
|
162
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
163
|
-
}
|
|
164
|
-
warn(msg, context = "") {
|
|
165
|
-
if (_Logger.#levelIdx <= 5)
|
|
166
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
167
|
-
}
|
|
168
|
-
error(msg, context = "") {
|
|
169
|
-
if (_Logger.#levelIdx <= 6)
|
|
170
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
171
|
-
}
|
|
172
|
-
raw(msg, method) {
|
|
173
|
-
_Logger.rawLog(msg, method);
|
|
174
|
-
}
|
|
175
|
-
rawLog(msg, method) {
|
|
176
|
-
_Logger.rawLog(msg, method);
|
|
177
|
-
}
|
|
178
|
-
static trace(msg, context = "") {
|
|
179
|
-
if (_Logger.#levelIdx <= 0)
|
|
180
|
-
_Logger.#printMessages("App", msg, context, "trace");
|
|
181
|
-
}
|
|
182
|
-
static verbose(msg, context = "") {
|
|
183
|
-
if (_Logger.#levelIdx <= 1)
|
|
184
|
-
_Logger.#printMessages("App", msg, context, "verbose");
|
|
185
|
-
}
|
|
186
|
-
static debug(msg, context = "") {
|
|
187
|
-
if (_Logger.#levelIdx <= 2)
|
|
188
|
-
_Logger.#printMessages("App", msg, context, "debug");
|
|
189
|
-
}
|
|
190
|
-
static log(msg, context = "") {
|
|
191
|
-
if (_Logger.#levelIdx <= 3)
|
|
192
|
-
_Logger.#printMessages("App", msg, context, "log");
|
|
193
|
-
}
|
|
194
|
-
static info(msg, context = "") {
|
|
195
|
-
if (_Logger.#levelIdx <= 4)
|
|
196
|
-
_Logger.#printMessages("App", msg, context, "info");
|
|
197
|
-
}
|
|
198
|
-
static warn(msg, context = "") {
|
|
199
|
-
if (_Logger.#levelIdx <= 5)
|
|
200
|
-
_Logger.#printMessages("App", msg, context, "warn");
|
|
201
|
-
}
|
|
202
|
-
static error(msg, context = "") {
|
|
203
|
-
if (_Logger.#levelIdx <= 6)
|
|
204
|
-
_Logger.#printMessages("App", msg, context, "error");
|
|
205
|
-
}
|
|
206
|
-
static #colorize(msg, logLevel) {
|
|
207
|
-
return colorizeMap[logLevel](msg);
|
|
208
|
-
}
|
|
209
|
-
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
210
|
-
if (this.#ignoreCtxSet.has(context))
|
|
211
|
-
return;
|
|
212
|
-
const now = (0, import_dayjs4.default)();
|
|
213
|
-
const processMsg = this.#colorize(
|
|
214
|
-
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
215
|
-
logLevel
|
|
216
|
-
);
|
|
217
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
218
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
219
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
220
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
221
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
222
|
-
if (typeof window === "undefined")
|
|
223
|
-
process[writeStreamType].write(
|
|
224
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
225
|
-
`
|
|
226
|
-
);
|
|
227
|
-
else
|
|
228
|
-
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
229
|
-
`);
|
|
230
|
-
}
|
|
231
|
-
static rawLog(msg, method) {
|
|
232
|
-
this.raw(`${msg}
|
|
233
|
-
`, method);
|
|
234
|
-
}
|
|
235
|
-
static raw(msg, method) {
|
|
236
|
-
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
237
|
-
global.process.stdout.write(msg);
|
|
238
|
-
else
|
|
239
|
-
console.log(msg);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
// pkgs/@akanjs/base/src/base.ts
|
|
244
|
-
var version = "0.9.0";
|
|
245
|
-
var logo = `
|
|
246
|
-
_ _ _
|
|
247
|
-
/ \\ | | ____ _ _ __ (_)___
|
|
248
|
-
/ _ \\ | |/ / _' | '_ \\ | / __|
|
|
249
|
-
/ ___ \\| < (_| | | | |_ | \\__ \\
|
|
250
|
-
/_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
|
|
251
|
-
|__/ ver ${version}
|
|
252
|
-
? See more details on docs https://www.akanjs.com/docs
|
|
253
|
-
\u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
|
|
254
|
-
|
|
255
|
-
`;
|
|
256
|
-
|
|
257
|
-
// pkgs/@akanjs/base/src/baseEnv.ts
|
|
258
|
-
var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
|
|
259
|
-
var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
|
|
260
|
-
var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
|
|
261
|
-
if (appName === "unknown")
|
|
262
|
-
throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
|
|
263
|
-
if (repoName === "unknown")
|
|
264
|
-
throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
|
|
265
|
-
if (serveDomain === "unknown")
|
|
266
|
-
throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
|
|
267
|
-
var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
268
|
-
var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
|
|
269
|
-
var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
|
|
270
|
-
var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
|
|
271
|
-
var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
|
|
272
|
-
var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
|
|
273
|
-
var baseEnv = {
|
|
274
|
-
repoName,
|
|
275
|
-
serveDomain,
|
|
276
|
-
appName,
|
|
277
|
-
environment,
|
|
278
|
-
operationType,
|
|
279
|
-
operationMode,
|
|
280
|
-
networkType,
|
|
281
|
-
tunnelUsername,
|
|
282
|
-
tunnelPassword
|
|
283
|
-
};
|
|
284
|
-
var side = typeof window === "undefined" ? "server" : "client";
|
|
285
|
-
var renderMode = process.env.RENDER_ENV ?? "ssr";
|
|
286
|
-
var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
|
|
287
|
-
var clientPort = parseInt(
|
|
288
|
-
process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
|
|
289
|
-
);
|
|
290
|
-
var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
|
|
291
|
-
var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
|
|
292
|
-
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");
|
|
293
|
-
var serverPort = parseInt(
|
|
294
|
-
process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
|
|
295
|
-
);
|
|
296
|
-
var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
|
|
297
|
-
var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
|
|
298
|
-
var serverGraphqlUri = `${serverHttpUri}/graphql`;
|
|
299
|
-
var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
|
|
300
|
-
var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
|
|
301
|
-
var baseClientEnv = {
|
|
302
|
-
...baseEnv,
|
|
303
|
-
side,
|
|
304
|
-
renderMode,
|
|
305
|
-
websocket: true,
|
|
306
|
-
clientHost,
|
|
307
|
-
clientPort,
|
|
308
|
-
clientHttpProtocol,
|
|
309
|
-
clientHttpUri,
|
|
310
|
-
serverHost,
|
|
311
|
-
serverPort,
|
|
312
|
-
serverHttpProtocol,
|
|
313
|
-
serverHttpUri,
|
|
314
|
-
serverGraphqlUri,
|
|
315
|
-
serverWsProtocol,
|
|
316
|
-
serverWsUri
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
// pkgs/@akanjs/base/src/scalar.ts
|
|
320
|
-
var import_dayjs5 = __toESM(require("dayjs"));
|
|
321
|
-
var dayjs4 = import_dayjs5.default;
|
|
322
|
-
var Int = class {
|
|
323
|
-
__Scalar__;
|
|
324
|
-
};
|
|
325
|
-
var Upload = class {
|
|
326
|
-
__Scalar__;
|
|
327
|
-
filename;
|
|
328
|
-
mimetype;
|
|
329
|
-
encoding;
|
|
330
|
-
createReadStream;
|
|
331
|
-
};
|
|
332
|
-
var Float = class {
|
|
333
|
-
__Scalar__;
|
|
334
|
-
};
|
|
335
|
-
var ID = class {
|
|
336
|
-
__Scalar__;
|
|
337
|
-
};
|
|
338
|
-
var JSON = class {
|
|
339
|
-
__Scalar__;
|
|
340
|
-
};
|
|
341
|
-
var getNonArrayModel = (arraiedModel) => {
|
|
342
|
-
let arrDepth = 0;
|
|
343
|
-
let target = arraiedModel;
|
|
344
|
-
while (Array.isArray(target)) {
|
|
345
|
-
target = target[0];
|
|
346
|
-
arrDepth++;
|
|
347
|
-
}
|
|
348
|
-
return [target, arrDepth];
|
|
349
|
-
};
|
|
350
|
-
var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON, Map]);
|
|
351
|
-
var scalarNameMap = /* @__PURE__ */ new Map([
|
|
352
|
-
[ID, "ID"],
|
|
353
|
-
[Int, "Int"],
|
|
354
|
-
[Float, "Float"],
|
|
355
|
-
[String, "String"],
|
|
356
|
-
[Boolean, "Boolean"],
|
|
357
|
-
[Date, "Date"],
|
|
358
|
-
[Upload, "Upload"],
|
|
359
|
-
[JSON, "JSON"],
|
|
360
|
-
[Map, "Map"]
|
|
361
|
-
]);
|
|
362
|
-
var scalarArgMap = /* @__PURE__ */ new Map([
|
|
363
|
-
[ID, null],
|
|
364
|
-
[String, ""],
|
|
365
|
-
[Boolean, false],
|
|
366
|
-
[Date, dayjs4(/* @__PURE__ */ new Date(-1))],
|
|
367
|
-
[Int, 0],
|
|
368
|
-
[Float, 0],
|
|
369
|
-
[JSON, {}],
|
|
370
|
-
[Map, {}]
|
|
371
|
-
]);
|
|
372
|
-
var scalarDefaultMap = /* @__PURE__ */ new Map([
|
|
373
|
-
[ID, null],
|
|
374
|
-
[String, ""],
|
|
375
|
-
[Boolean, false],
|
|
376
|
-
[Date, dayjs4(/* @__PURE__ */ new Date(-1))],
|
|
377
|
-
[Int, 0],
|
|
378
|
-
[Float, 0],
|
|
379
|
-
[JSON, {}]
|
|
380
|
-
]);
|
|
381
|
-
var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
|
|
382
|
-
var isGqlMap = (modelRef) => modelRef === Map;
|
|
383
|
-
|
|
384
|
-
// pkgs/@akanjs/constant/src/scalar.ts
|
|
385
50
|
var import_reflect_metadata = require("reflect-metadata");
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
[Float, 0],
|
|
390
|
-
[String, "String"],
|
|
391
|
-
[Boolean, true],
|
|
392
|
-
[Date, (/* @__PURE__ */ new Date()).toISOString()],
|
|
393
|
-
[Upload, "FileUpload"],
|
|
394
|
-
[JSON, {}],
|
|
395
|
-
[Map, {}]
|
|
396
|
-
]);
|
|
397
|
-
var getClassMeta = (modelRef) => {
|
|
398
|
-
const [target] = getNonArrayModel(modelRef);
|
|
399
|
-
const classMeta = Reflect.getMetadata("class", target.prototype);
|
|
400
|
-
if (!classMeta)
|
|
401
|
-
throw new Error(`No ClassMeta for this target ${target.name}`);
|
|
402
|
-
return classMeta;
|
|
403
|
-
};
|
|
404
|
-
var getFieldMetas = (modelRef) => {
|
|
405
|
-
const [target] = getNonArrayModel(modelRef);
|
|
406
|
-
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
407
|
-
const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
|
|
408
|
-
return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
|
|
409
|
-
};
|
|
410
|
-
var getFieldMetaMapOnPrototype = (prototype) => {
|
|
411
|
-
const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
|
|
412
|
-
return new Map(metadataMap);
|
|
413
|
-
};
|
|
414
|
-
var setFieldMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
415
|
-
Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// pkgs/@akanjs/constant/src/fieldMeta.ts
|
|
419
|
-
var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
|
|
420
|
-
const isArray = arrDepth > 0;
|
|
421
|
-
const isClass = !isGqlScalar(modelRef);
|
|
422
|
-
const isMap = isGqlMap(modelRef);
|
|
423
|
-
const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
|
|
424
|
-
const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
|
|
425
|
-
if (isMap && !option.of)
|
|
426
|
-
throw new Error("Map type must have 'of' option");
|
|
427
|
-
return (prototype, key) => {
|
|
428
|
-
const metadata = {
|
|
429
|
-
nullable: option.nullable ?? false,
|
|
430
|
-
ref: option.ref,
|
|
431
|
-
refPath: option.refPath,
|
|
432
|
-
refType: option.refType,
|
|
433
|
-
default: option.default ?? (isArray ? [] : null),
|
|
434
|
-
type: option.type,
|
|
435
|
-
fieldType: option.fieldType ?? "property",
|
|
436
|
-
immutable: option.immutable ?? false,
|
|
437
|
-
min: option.min,
|
|
438
|
-
max: option.max,
|
|
439
|
-
enum: option.enum,
|
|
440
|
-
select: option.select ?? true,
|
|
441
|
-
minlength: option.minlength,
|
|
442
|
-
maxlength: option.maxlength,
|
|
443
|
-
query: option.query,
|
|
444
|
-
accumulate: option.accumulate,
|
|
445
|
-
example: option.example,
|
|
446
|
-
validate: option.validate,
|
|
447
|
-
key,
|
|
448
|
-
name,
|
|
449
|
-
isClass,
|
|
450
|
-
isScalar: type === "scalar",
|
|
451
|
-
modelRef,
|
|
452
|
-
arrDepth,
|
|
453
|
-
isArray,
|
|
454
|
-
optArrDepth: optionArrDepth,
|
|
455
|
-
isMap,
|
|
456
|
-
of: option.of,
|
|
457
|
-
text: option.text
|
|
458
|
-
};
|
|
459
|
-
const metadataMap = getFieldMetaMapOnPrototype(prototype);
|
|
460
|
-
metadataMap.set(key, metadata);
|
|
461
|
-
setFieldMetaMapOnPrototype(prototype, metadataMap);
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
var makeField = (customOption) => (returns, fieldOption) => {
|
|
465
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
466
|
-
if (!fieldOption)
|
|
467
|
-
return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
|
|
468
|
-
const [opt, optArrDepth] = getNonArrayModel(fieldOption);
|
|
469
|
-
return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
|
|
470
|
-
};
|
|
471
|
-
var Field = {
|
|
472
|
-
Prop: makeField({ fieldType: "property" }),
|
|
473
|
-
Hidden: makeField({ fieldType: "hidden", nullable: true }),
|
|
474
|
-
Secret: makeField({ fieldType: "hidden", select: false, nullable: true }),
|
|
475
|
-
Resolve: makeField({ fieldType: "resolve" })
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
// pkgs/@akanjs/constant/src/constantDecorator.ts
|
|
479
|
-
var import_reflect_metadata2 = require("reflect-metadata");
|
|
480
|
-
|
|
481
|
-
// pkgs/@akanjs/constant/src/filterMeta.ts
|
|
482
|
-
var setFilterMeta = (filterRef, filterMeta) => {
|
|
483
|
-
const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
|
|
484
|
-
if (existingFilterMeta)
|
|
485
|
-
Object.assign(filterMeta.sort, existingFilterMeta.sort);
|
|
486
|
-
Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
|
|
487
|
-
};
|
|
488
|
-
var getFilterKeyMetaMapOnPrototype = (prototype) => {
|
|
489
|
-
const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
|
|
490
|
-
return new Map(metadataMap);
|
|
491
|
-
};
|
|
492
|
-
var setFilterKeyMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
493
|
-
Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
|
|
494
|
-
};
|
|
495
|
-
var applyFilterKeyMeta = (option) => {
|
|
496
|
-
return (prototype, key, descriptor) => {
|
|
497
|
-
const metadata = { key, ...option, descriptor };
|
|
498
|
-
const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
|
|
499
|
-
metadataMap.set(key, metadata);
|
|
500
|
-
setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
|
|
501
|
-
};
|
|
502
|
-
};
|
|
503
|
-
var makeFilter = (customOption) => (fieldOption) => {
|
|
504
|
-
return applyFilterKeyMeta({ ...customOption, ...fieldOption });
|
|
505
|
-
};
|
|
506
|
-
var getFilterArgMetasOnPrototype = (prototype, key) => {
|
|
507
|
-
const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
|
|
508
|
-
return filterArgMetas;
|
|
509
|
-
};
|
|
510
|
-
var setFilterArgMetasOnPrototype = (prototype, key, filterArgMetas) => {
|
|
511
|
-
Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
|
|
512
|
-
};
|
|
513
|
-
var applyFilterArgMeta = (name, returns, argOption) => {
|
|
514
|
-
return (prototype, key, idx) => {
|
|
515
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
516
|
-
const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
|
|
517
|
-
const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
|
|
518
|
-
const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
|
|
519
|
-
filterArgMetas[idx] = filterArgMeta;
|
|
520
|
-
setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
var getFilterQuery = (filterRef, key) => {
|
|
524
|
-
const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(filterRef.prototype);
|
|
525
|
-
const filterKeyMeta = filterKeyMetaMap.get(key);
|
|
526
|
-
if (!filterKeyMeta?.descriptor.value)
|
|
527
|
-
throw new Error(`filterKeyMeta is not defined for key: ${key}`);
|
|
528
|
-
return filterKeyMeta.descriptor.value;
|
|
529
|
-
};
|
|
530
|
-
var Filter = {
|
|
531
|
-
Mongo: makeFilter({ type: "mongo" }),
|
|
532
|
-
// Meili: makeFilter({ fieldType: "hidden", nullable: true }),
|
|
533
|
-
Arg: applyFilterArgMeta
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
// pkgs/@akanjs/constant/src/baseGql.ts
|
|
537
|
-
var import_reflect_metadata3 = require("reflect-metadata");
|
|
538
|
-
var defaultFieldMeta = {
|
|
539
|
-
fieldType: "property",
|
|
540
|
-
immutable: false,
|
|
541
|
-
select: true,
|
|
542
|
-
isClass: false,
|
|
543
|
-
isScalar: true,
|
|
544
|
-
nullable: false,
|
|
545
|
-
isArray: false,
|
|
546
|
-
arrDepth: 0,
|
|
547
|
-
optArrDepth: 0,
|
|
548
|
-
default: null,
|
|
549
|
-
isMap: false
|
|
550
|
-
};
|
|
551
|
-
var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
|
|
552
|
-
var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
|
|
553
|
-
var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
|
|
554
|
-
var removedAtFieldMeta = {
|
|
555
|
-
...defaultFieldMeta,
|
|
556
|
-
key: "removedAt",
|
|
557
|
-
name: "Date",
|
|
558
|
-
modelRef: Date,
|
|
559
|
-
nullable: true,
|
|
560
|
-
default: null
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
// pkgs/@akanjs/constant/src/classMeta.ts
|
|
564
|
-
var import_reflect_metadata4 = require("reflect-metadata");
|
|
565
|
-
var InputModelStorage = class {
|
|
566
|
-
};
|
|
567
|
-
var LightModelStorage = class {
|
|
568
|
-
};
|
|
569
|
-
var FullModelStorage = class {
|
|
570
|
-
};
|
|
571
|
-
var ScalarModelStorage = class {
|
|
572
|
-
};
|
|
573
|
-
var FilterModelStorage = class {
|
|
574
|
-
};
|
|
575
|
-
var hasTextField = (modelRef) => {
|
|
576
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
577
|
-
return fieldMetas.some(
|
|
578
|
-
(fieldMeta) => !!fieldMeta.text || fieldMeta.isScalar && fieldMeta.isClass && fieldMeta.select && hasTextField(fieldMeta.modelRef)
|
|
579
|
-
);
|
|
580
|
-
};
|
|
581
|
-
var applyClassMeta = (type, modelType, storage) => {
|
|
582
|
-
return function(refName) {
|
|
583
|
-
return function(target) {
|
|
584
|
-
const modelRef = target;
|
|
585
|
-
const classMeta = { refName, type, modelType, modelRef, hasTextField: hasTextField(modelRef) };
|
|
586
|
-
Reflect.defineMetadata("class", classMeta, modelRef.prototype);
|
|
587
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
588
|
-
};
|
|
589
|
-
};
|
|
590
|
-
};
|
|
591
|
-
var applyFilterMeta = (storage) => {
|
|
592
|
-
return function(refName) {
|
|
593
|
-
return function(target) {
|
|
594
|
-
const modelRef = target;
|
|
595
|
-
setFilterMeta(modelRef, { refName, sort: {} });
|
|
596
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
};
|
|
600
|
-
var Model = {
|
|
601
|
-
Light: applyClassMeta("light", "data", LightModelStorage),
|
|
602
|
-
Object: applyClassMeta("full", "ephemeral", FullModelStorage),
|
|
603
|
-
Full: applyClassMeta("full", "data", FullModelStorage),
|
|
604
|
-
Input: applyClassMeta("input", "data", InputModelStorage),
|
|
605
|
-
Scalar: applyClassMeta("scalar", "data", ScalarModelStorage),
|
|
606
|
-
Summary: applyClassMeta("scalar", "summary", ScalarModelStorage),
|
|
607
|
-
Insight: applyClassMeta("scalar", "insight", ScalarModelStorage),
|
|
608
|
-
Filter: applyFilterMeta(FilterModelStorage)
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
// pkgs/@akanjs/service/src/serviceDecorators.ts
|
|
612
|
-
var import_common4 = require("@nestjs/common");
|
|
51
|
+
var import_common = require("@akanjs/common");
|
|
52
|
+
var import_constant = require("@akanjs/constant");
|
|
53
|
+
var import_common2 = require("@nestjs/common");
|
|
613
54
|
var import_mongoose = require("@nestjs/mongoose");
|
|
614
55
|
var ServiceStorage = class {
|
|
615
56
|
};
|
|
@@ -655,28 +96,28 @@ function Service(name, { enabled = true, serverMode } = {}) {
|
|
|
655
96
|
function Srv(name) {
|
|
656
97
|
return function(prototype, key) {
|
|
657
98
|
const metadataMap = getServiceInjectMetaMapOnPrototype(prototype);
|
|
658
|
-
metadataMap.set(key, { type: "Srv", key, name: name ?? capitalize(key) });
|
|
99
|
+
metadataMap.set(key, { type: "Srv", key, name: name ?? (0, import_common.capitalize)(key) });
|
|
659
100
|
setServiceInjectMetaMapOnPrototype(prototype, metadataMap);
|
|
660
101
|
};
|
|
661
102
|
}
|
|
662
103
|
function Use(name) {
|
|
663
104
|
return function(prototype, key) {
|
|
664
105
|
const metadataMap = getServiceInjectMetaMapOnPrototype(prototype);
|
|
665
|
-
metadataMap.set(key, { type: "Use", key, name: name ?? capitalize(key) });
|
|
106
|
+
metadataMap.set(key, { type: "Use", key, name: name ?? (0, import_common.capitalize)(key) });
|
|
666
107
|
setServiceInjectMetaMapOnPrototype(prototype, metadataMap);
|
|
667
108
|
};
|
|
668
109
|
}
|
|
669
110
|
function Queue(name) {
|
|
670
111
|
return function(prototype, key) {
|
|
671
112
|
const metadataMap = getServiceInjectMetaMapOnPrototype(prototype);
|
|
672
|
-
metadataMap.set(key, { type: "Queue", key, name: name ?? capitalize(key) });
|
|
113
|
+
metadataMap.set(key, { type: "Queue", key, name: name ?? (0, import_common.capitalize)(key) });
|
|
673
114
|
setServiceInjectMetaMapOnPrototype(prototype, metadataMap);
|
|
674
115
|
};
|
|
675
116
|
}
|
|
676
117
|
function Websocket(name) {
|
|
677
118
|
return function(prototype, key) {
|
|
678
119
|
const metadataMap = getServiceInjectMetaMapOnPrototype(prototype);
|
|
679
|
-
metadataMap.set(key, { type: "Websocket", key, name: name ?? capitalize(key) });
|
|
120
|
+
metadataMap.set(key, { type: "Websocket", key, name: name ?? (0, import_common.capitalize)(key) });
|
|
680
121
|
setServiceInjectMetaMapOnPrototype(prototype, metadataMap);
|
|
681
122
|
};
|
|
682
123
|
}
|
|
@@ -695,19 +136,19 @@ var serviceOf = (srvRef) => {
|
|
|
695
136
|
if (injectMeta.type === "Db")
|
|
696
137
|
(0, import_mongoose.InjectModel)(injectMeta.name)(srvRef.prototype, injectMeta.key);
|
|
697
138
|
else if (injectMeta.type === "Use")
|
|
698
|
-
(0,
|
|
139
|
+
(0, import_common2.Inject)(injectMeta.name)(srvRef.prototype, injectMeta.key);
|
|
699
140
|
else if (injectMeta.type === "Srv") {
|
|
700
141
|
const services = getServiceRefs(injectMeta.name);
|
|
701
142
|
if (!services.length)
|
|
702
143
|
throw new Error(`Service ${injectMeta.name} not found`);
|
|
703
|
-
(0,
|
|
144
|
+
(0, import_common2.Inject)(services.at(-1))(srvRef.prototype, injectMeta.key);
|
|
704
145
|
} else if (injectMeta.type === "Queue")
|
|
705
|
-
(0,
|
|
146
|
+
(0, import_common2.Inject)(injectMeta.name)(srvRef.prototype, injectMeta.key);
|
|
706
147
|
else
|
|
707
|
-
(0,
|
|
148
|
+
(0, import_common2.Inject)(injectMeta.name)(srvRef.prototype, injectMeta.key);
|
|
708
149
|
}
|
|
709
150
|
(0, import_mongoose.InjectConnection)()(srvRef.prototype, "connection");
|
|
710
|
-
(0,
|
|
151
|
+
(0, import_common2.Injectable)()(srvRef);
|
|
711
152
|
setServiceDefined(srvRef);
|
|
712
153
|
return srvRef;
|
|
713
154
|
};
|
|
@@ -718,7 +159,7 @@ function MixSrvs(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t1
|
|
|
718
159
|
const injectMetadataMap = new Map(
|
|
719
160
|
[t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20].filter((t) => !!t).reduce((acc, srvRef) => {
|
|
720
161
|
const injectMetadataMap2 = getServiceInjectMetaMapOnPrototype(srvRef);
|
|
721
|
-
applyMixins(Mix, [srvRef], AVOID_MIX_SRV_KEY_SET);
|
|
162
|
+
(0, import_common.applyMixins)(Mix, [srvRef], AVOID_MIX_SRV_KEY_SET);
|
|
722
163
|
return [...acc, ...injectMetadataMap2];
|
|
723
164
|
}, [])
|
|
724
165
|
);
|
|
@@ -728,14 +169,14 @@ function MixSrvs(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t1
|
|
|
728
169
|
}
|
|
729
170
|
var LogService = (name) => {
|
|
730
171
|
class LogService2 {
|
|
731
|
-
logger = new Logger(name);
|
|
172
|
+
logger = new import_common.Logger(name);
|
|
732
173
|
}
|
|
733
174
|
return LogService2;
|
|
734
175
|
};
|
|
735
176
|
var DbService = (database, sigRef) => {
|
|
736
|
-
const [modelName, className] = [database.refName, capitalize(database.refName)];
|
|
177
|
+
const [modelName, className] = [database.refName, (0, import_common.capitalize)(database.refName)];
|
|
737
178
|
class DbService2 {
|
|
738
|
-
logger = new Logger(`${modelName}Service`);
|
|
179
|
+
logger = new import_common.Logger(`${modelName}Service`);
|
|
739
180
|
__databaseModel;
|
|
740
181
|
async __list(query, queryOption) {
|
|
741
182
|
return await this.__databaseModel.__list(query, queryOption);
|
|
@@ -831,48 +272,48 @@ var DbService = (database, sigRef) => {
|
|
|
831
272
|
const getQueryDataFromKey = (queryKey, args) => {
|
|
832
273
|
const lastArg = args.at(-1);
|
|
833
274
|
const hasQueryOption = lastArg && typeof lastArg === "object" && (typeof lastArg.select === "object" || typeof lastArg.skip === "number" || typeof lastArg.limit === "number" || typeof lastArg.sort === "string");
|
|
834
|
-
const queryFn = getFilterQuery(database.Filter, queryKey);
|
|
275
|
+
const queryFn = (0, import_constant.getFilterQuery)(database.Filter, queryKey);
|
|
835
276
|
const query = queryFn(...hasQueryOption ? args.slice(0, -1) : args);
|
|
836
277
|
const queryOption = hasQueryOption ? lastArg : {};
|
|
837
278
|
return { query, queryOption };
|
|
838
279
|
};
|
|
839
|
-
const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(database.Filter.prototype);
|
|
280
|
+
const filterKeyMetaMap = (0, import_constant.getFilterKeyMetaMapOnPrototype)(database.Filter.prototype);
|
|
840
281
|
const queryKeys = [...filterKeyMetaMap.keys()];
|
|
841
282
|
queryKeys.forEach((queryKey) => {
|
|
842
|
-
const queryFn = getFilterQuery(database.Filter, queryKey);
|
|
843
|
-
DbService2.prototype[`list${capitalize(queryKey)}`] = async function(...args) {
|
|
283
|
+
const queryFn = (0, import_constant.getFilterQuery)(database.Filter, queryKey);
|
|
284
|
+
DbService2.prototype[`list${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
844
285
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
845
286
|
return this.__list(query, queryOption);
|
|
846
287
|
};
|
|
847
|
-
DbService2.prototype[`listIds${capitalize(queryKey)}`] = async function(...args) {
|
|
288
|
+
DbService2.prototype[`listIds${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
848
289
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
849
290
|
return this.__listIds(query, queryOption);
|
|
850
291
|
};
|
|
851
|
-
DbService2.prototype[`find${capitalize(queryKey)}`] = async function(...args) {
|
|
292
|
+
DbService2.prototype[`find${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
852
293
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
853
294
|
return this.__find(query, queryOption);
|
|
854
295
|
};
|
|
855
|
-
DbService2.prototype[`findId${capitalize(queryKey)}`] = async function(...args) {
|
|
296
|
+
DbService2.prototype[`findId${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
856
297
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
857
298
|
return this.__findId(query, queryOption);
|
|
858
299
|
};
|
|
859
|
-
DbService2.prototype[`pick${capitalize(queryKey)}`] = async function(...args) {
|
|
300
|
+
DbService2.prototype[`pick${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
860
301
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
861
302
|
return this.__pick(query, queryOption);
|
|
862
303
|
};
|
|
863
|
-
DbService2.prototype[`pickId${capitalize(queryKey)}`] = async function(...args) {
|
|
304
|
+
DbService2.prototype[`pickId${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
864
305
|
const { query, queryOption } = getQueryDataFromKey(queryKey, args);
|
|
865
306
|
return this.__pickId(query, queryOption);
|
|
866
307
|
};
|
|
867
|
-
DbService2.prototype[`exists${capitalize(queryKey)}`] = async function(...args) {
|
|
308
|
+
DbService2.prototype[`exists${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
868
309
|
const query = queryFn(...args);
|
|
869
310
|
return this.__exists(query);
|
|
870
311
|
};
|
|
871
|
-
DbService2.prototype[`count${capitalize(queryKey)}`] = async function(...args) {
|
|
312
|
+
DbService2.prototype[`count${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
872
313
|
const query = queryFn(...args);
|
|
873
314
|
return this.__count(query);
|
|
874
315
|
};
|
|
875
|
-
DbService2.prototype[`insight${capitalize(queryKey)}`] = async function(...args) {
|
|
316
|
+
DbService2.prototype[`insight${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
876
317
|
const query = queryFn(...args);
|
|
877
318
|
return this.__insight(query);
|
|
878
319
|
};
|
|
@@ -881,17 +322,17 @@ var DbService = (database, sigRef) => {
|
|
|
881
322
|
return DbService2;
|
|
882
323
|
};
|
|
883
324
|
var ExtendedUserService = (database, srvRef, sigRef) => {
|
|
884
|
-
const filterKeyMetaMap = getFilterKeyMetaMapOnPrototype(database.Filter.prototype);
|
|
325
|
+
const filterKeyMetaMap = (0, import_constant.getFilterKeyMetaMapOnPrototype)(database.Filter.prototype);
|
|
885
326
|
const queryKeys = [...filterKeyMetaMap.keys()];
|
|
886
327
|
queryKeys.forEach((queryKey) => {
|
|
887
|
-
const queryFn = getFilterQuery(database.Filter, queryKey);
|
|
888
|
-
srvRef.prototype[`list${capitalize(queryKey)}`] = async function(...args) {
|
|
328
|
+
const queryFn = (0, import_constant.getFilterQuery)(database.Filter, queryKey);
|
|
329
|
+
srvRef.prototype[`list${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
889
330
|
const queryOption = args.at(-1);
|
|
890
331
|
const hasQueryOption = typeof queryOption === "object" && (typeof queryOption.select === "object" || typeof queryOption.skip === "number" || typeof queryOption.limit === "number" || typeof queryOption.sort === "string");
|
|
891
332
|
const query = queryFn(...hasQueryOption ? args.slice(0, -1) : args);
|
|
892
333
|
return this.__list(query, queryOption);
|
|
893
334
|
};
|
|
894
|
-
srvRef.prototype[`insight${capitalize(queryKey)}`] = async function(...args) {
|
|
335
|
+
srvRef.prototype[`insight${(0, import_common.capitalize)(queryKey)}`] = async function(...args) {
|
|
895
336
|
const query = queryFn(...args);
|
|
896
337
|
return this.__insight(query);
|
|
897
338
|
};
|
|
@@ -904,4 +345,3 @@ var ExtendedSummaryService = (database, srvRef, sigRef) => {
|
|
|
904
345
|
var ExtendedSettingService = (database, srvRef, sigRef) => {
|
|
905
346
|
return srvRef;
|
|
906
347
|
};
|
|
907
|
-
//! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/service",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@nestjs/common": "^10.4.15",
|
|
19
19
|
"@nestjs/mongoose": "^10.1.0",
|
|
20
|
-
"dayjs": "^1.11.13",
|
|
21
|
-
"pluralize": "^8.0.0",
|
|
22
20
|
"reflect-metadata": "^0.2.2"
|
|
23
21
|
}
|
|
24
22
|
}
|