@akanjs/constant 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 +34 -361
- 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, from2, 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;
|
|
@@ -102,172 +92,35 @@ var defaultListOption = {
|
|
|
102
92
|
};
|
|
103
93
|
var DEFAULT_PAGE_SIZE = 20;
|
|
104
94
|
|
|
105
|
-
// pkgs/@akanjs/
|
|
106
|
-
var
|
|
107
|
-
var logo = `
|
|
108
|
-
_ _ _
|
|
109
|
-
/ \\ | | ____ _ _ __ (_)___
|
|
110
|
-
/ _ \\ | |/ / _' | '_ \\ | / __|
|
|
111
|
-
/ ___ \\| < (_| | | | |_ | \\__ \\
|
|
112
|
-
/_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
|
|
113
|
-
|__/ ver ${version}
|
|
114
|
-
? See more details on docs https://www.akanjs.com/docs
|
|
115
|
-
\u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
|
|
116
|
-
|
|
117
|
-
`;
|
|
118
|
-
|
|
119
|
-
// pkgs/@akanjs/base/src/baseEnv.ts
|
|
120
|
-
var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
|
|
121
|
-
var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
|
|
122
|
-
var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
|
|
123
|
-
if (appName === "unknown")
|
|
124
|
-
throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
|
|
125
|
-
if (repoName === "unknown")
|
|
126
|
-
throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
|
|
127
|
-
if (serveDomain === "unknown")
|
|
128
|
-
throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
|
|
129
|
-
var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
130
|
-
var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
|
|
131
|
-
var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
|
|
132
|
-
var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
|
|
133
|
-
var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
|
|
134
|
-
var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
|
|
135
|
-
var baseEnv = {
|
|
136
|
-
repoName,
|
|
137
|
-
serveDomain,
|
|
138
|
-
appName,
|
|
139
|
-
environment,
|
|
140
|
-
operationType,
|
|
141
|
-
operationMode,
|
|
142
|
-
networkType,
|
|
143
|
-
tunnelUsername,
|
|
144
|
-
tunnelPassword
|
|
145
|
-
};
|
|
146
|
-
var side = typeof window === "undefined" ? "server" : "client";
|
|
147
|
-
var renderMode = process.env.RENDER_ENV ?? "ssr";
|
|
148
|
-
var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
|
|
149
|
-
var clientPort = parseInt(
|
|
150
|
-
process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
|
|
151
|
-
);
|
|
152
|
-
var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
|
|
153
|
-
var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
|
|
154
|
-
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");
|
|
155
|
-
var serverPort = parseInt(
|
|
156
|
-
process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
|
|
157
|
-
);
|
|
158
|
-
var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
|
|
159
|
-
var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
|
|
160
|
-
var serverGraphqlUri = `${serverHttpUri}/graphql`;
|
|
161
|
-
var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
|
|
162
|
-
var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
|
|
163
|
-
var baseClientEnv = {
|
|
164
|
-
...baseEnv,
|
|
165
|
-
side,
|
|
166
|
-
renderMode,
|
|
167
|
-
websocket: true,
|
|
168
|
-
clientHost,
|
|
169
|
-
clientPort,
|
|
170
|
-
clientHttpProtocol,
|
|
171
|
-
clientHttpUri,
|
|
172
|
-
serverHost,
|
|
173
|
-
serverPort,
|
|
174
|
-
serverHttpProtocol,
|
|
175
|
-
serverHttpUri,
|
|
176
|
-
serverGraphqlUri,
|
|
177
|
-
serverWsProtocol,
|
|
178
|
-
serverWsUri
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
// pkgs/@akanjs/base/src/scalar.ts
|
|
182
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
183
|
-
var dayjs = import_dayjs.default;
|
|
184
|
-
var Int = class {
|
|
185
|
-
__Scalar__;
|
|
186
|
-
};
|
|
187
|
-
var Upload = class {
|
|
188
|
-
__Scalar__;
|
|
189
|
-
filename;
|
|
190
|
-
mimetype;
|
|
191
|
-
encoding;
|
|
192
|
-
createReadStream;
|
|
193
|
-
};
|
|
194
|
-
var Float = class {
|
|
195
|
-
__Scalar__;
|
|
196
|
-
};
|
|
197
|
-
var ID = class {
|
|
198
|
-
__Scalar__;
|
|
199
|
-
};
|
|
200
|
-
var JSON = class {
|
|
201
|
-
__Scalar__;
|
|
202
|
-
};
|
|
203
|
-
var getNonArrayModel = (arraiedModel) => {
|
|
204
|
-
let arrDepth = 0;
|
|
205
|
-
let target = arraiedModel;
|
|
206
|
-
while (Array.isArray(target)) {
|
|
207
|
-
target = target[0];
|
|
208
|
-
arrDepth++;
|
|
209
|
-
}
|
|
210
|
-
return [target, arrDepth];
|
|
211
|
-
};
|
|
212
|
-
var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON, Map]);
|
|
213
|
-
var scalarNameMap = /* @__PURE__ */ new Map([
|
|
214
|
-
[ID, "ID"],
|
|
215
|
-
[Int, "Int"],
|
|
216
|
-
[Float, "Float"],
|
|
217
|
-
[String, "String"],
|
|
218
|
-
[Boolean, "Boolean"],
|
|
219
|
-
[Date, "Date"],
|
|
220
|
-
[Upload, "Upload"],
|
|
221
|
-
[JSON, "JSON"],
|
|
222
|
-
[Map, "Map"]
|
|
223
|
-
]);
|
|
224
|
-
var scalarArgMap = /* @__PURE__ */ new Map([
|
|
225
|
-
[ID, null],
|
|
226
|
-
[String, ""],
|
|
227
|
-
[Boolean, false],
|
|
228
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
229
|
-
[Int, 0],
|
|
230
|
-
[Float, 0],
|
|
231
|
-
[JSON, {}],
|
|
232
|
-
[Map, {}]
|
|
233
|
-
]);
|
|
234
|
-
var scalarDefaultMap = /* @__PURE__ */ new Map([
|
|
235
|
-
[ID, null],
|
|
236
|
-
[String, ""],
|
|
237
|
-
[Boolean, false],
|
|
238
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
239
|
-
[Int, 0],
|
|
240
|
-
[Float, 0],
|
|
241
|
-
[JSON, {}]
|
|
242
|
-
]);
|
|
243
|
-
var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
|
|
244
|
-
var isGqlMap = (modelRef) => modelRef === Map;
|
|
95
|
+
// pkgs/@akanjs/constant/src/fieldMeta.ts
|
|
96
|
+
var import_base2 = require("@akanjs/base");
|
|
245
97
|
|
|
246
98
|
// pkgs/@akanjs/constant/src/scalar.ts
|
|
247
99
|
var import_reflect_metadata = require("reflect-metadata");
|
|
100
|
+
var import_base = require("@akanjs/base");
|
|
248
101
|
var scalarExampleMap = /* @__PURE__ */ new Map([
|
|
249
|
-
[ID, "1234567890abcdef12345678"],
|
|
250
|
-
[Int, 0],
|
|
251
|
-
[Float, 0],
|
|
102
|
+
[import_base.ID, "1234567890abcdef12345678"],
|
|
103
|
+
[import_base.Int, 0],
|
|
104
|
+
[import_base.Float, 0],
|
|
252
105
|
[String, "String"],
|
|
253
106
|
[Boolean, true],
|
|
254
107
|
[Date, (/* @__PURE__ */ new Date()).toISOString()],
|
|
255
|
-
[Upload, "FileUpload"],
|
|
256
|
-
[JSON, {}],
|
|
108
|
+
[import_base.Upload, "FileUpload"],
|
|
109
|
+
[import_base.JSON, {}],
|
|
257
110
|
[Map, {}]
|
|
258
111
|
]);
|
|
259
112
|
var getScalarExample = (ref) => scalarExampleMap.get(ref) ?? null;
|
|
260
|
-
var getGqlTypeStr = (ref) => scalarNameMap.get(ref) ?? getClassMeta(ref).refName;
|
|
113
|
+
var getGqlTypeStr = (ref) => import_base.scalarNameMap.get(ref) ?? getClassMeta(ref).refName;
|
|
261
114
|
var fieldTypes = ["email", "password", "url"];
|
|
262
115
|
var getClassMeta = (modelRef) => {
|
|
263
|
-
const [target] = getNonArrayModel(modelRef);
|
|
116
|
+
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
264
117
|
const classMeta = Reflect.getMetadata("class", target.prototype);
|
|
265
118
|
if (!classMeta)
|
|
266
119
|
throw new Error(`No ClassMeta for this target ${target.name}`);
|
|
267
120
|
return classMeta;
|
|
268
121
|
};
|
|
269
122
|
var getFieldMetas = (modelRef) => {
|
|
270
|
-
const [target] = getNonArrayModel(modelRef);
|
|
123
|
+
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
271
124
|
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
272
125
|
const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
|
|
273
126
|
return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
|
|
@@ -276,12 +129,12 @@ var isConstantModel = (modelRef) => {
|
|
|
276
129
|
return Reflect.getMetadata("class", modelRef.prototype) !== void 0;
|
|
277
130
|
};
|
|
278
131
|
var getFieldMetaMap = (modelRef) => {
|
|
279
|
-
const [target] = getNonArrayModel(modelRef);
|
|
132
|
+
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
280
133
|
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
281
134
|
return new Map(metadataMap);
|
|
282
135
|
};
|
|
283
136
|
var setFieldMetaMap = (modelRef, metadataMap) => {
|
|
284
|
-
const [target] = getNonArrayModel(modelRef);
|
|
137
|
+
const [target] = (0, import_base.getNonArrayModel)(modelRef);
|
|
285
138
|
Reflect.defineMetadata("fields", new Map(metadataMap), target.prototype);
|
|
286
139
|
};
|
|
287
140
|
var getFieldMetaMapOnPrototype = (prototype) => {
|
|
@@ -301,10 +154,10 @@ var getQueryMap = (modelRef) => {
|
|
|
301
154
|
// pkgs/@akanjs/constant/src/fieldMeta.ts
|
|
302
155
|
var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
|
|
303
156
|
const isArray = arrDepth > 0;
|
|
304
|
-
const isClass = !isGqlScalar(modelRef);
|
|
305
|
-
const isMap = isGqlMap(modelRef);
|
|
157
|
+
const isClass = !(0, import_base2.isGqlScalar)(modelRef);
|
|
158
|
+
const isMap = (0, import_base2.isGqlMap)(modelRef);
|
|
306
159
|
const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
|
|
307
|
-
const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
|
|
160
|
+
const name = isClass ? refName : import_base2.scalarNameMap.get(modelRef) ?? "Unknown";
|
|
308
161
|
if (isMap && !option.of)
|
|
309
162
|
throw new Error("Map type must have 'of' option");
|
|
310
163
|
return (prototype, key) => {
|
|
@@ -345,10 +198,10 @@ var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
|
|
|
345
198
|
};
|
|
346
199
|
};
|
|
347
200
|
var makeField = (customOption) => (returns, fieldOption) => {
|
|
348
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
201
|
+
const [modelRef, arrDepth] = (0, import_base2.getNonArrayModel)(returns());
|
|
349
202
|
if (!fieldOption)
|
|
350
203
|
return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
|
|
351
|
-
const [opt, optArrDepth] = getNonArrayModel(fieldOption);
|
|
204
|
+
const [opt, optArrDepth] = (0, import_base2.getNonArrayModel)(fieldOption);
|
|
352
205
|
return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
|
|
353
206
|
};
|
|
354
207
|
var Field = {
|
|
@@ -378,6 +231,7 @@ var cnstOf = (refName, Input, Full, Light, Insight, Filter2, Summary) => {
|
|
|
378
231
|
};
|
|
379
232
|
|
|
380
233
|
// pkgs/@akanjs/constant/src/filterMeta.ts
|
|
234
|
+
var import_base3 = require("@akanjs/base");
|
|
381
235
|
var isFilterModel = (filterRef) => {
|
|
382
236
|
return Reflect.getMetadata("filter", filterRef.prototype) !== void 0;
|
|
383
237
|
};
|
|
@@ -424,8 +278,8 @@ var getFilterArgMetas = (filterRef, key) => {
|
|
|
424
278
|
};
|
|
425
279
|
var applyFilterArgMeta = (name, returns, argOption) => {
|
|
426
280
|
return (prototype, key, idx) => {
|
|
427
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
428
|
-
const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
|
|
281
|
+
const [modelRef, arrDepth] = (0, import_base3.getNonArrayModel)(returns());
|
|
282
|
+
const [opt, optArrDepth] = (0, import_base3.getNonArrayModel)(argOption ?? {});
|
|
429
283
|
const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
|
|
430
284
|
const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
|
|
431
285
|
filterArgMetas[idx] = filterArgMeta;
|
|
@@ -518,189 +372,8 @@ function BaseFilter(modelRef, sort) {
|
|
|
518
372
|
|
|
519
373
|
// pkgs/@akanjs/constant/src/baseGql.ts
|
|
520
374
|
var import_reflect_metadata3 = require("reflect-metadata");
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
var import_dayjs2 = require("dayjs");
|
|
524
|
-
|
|
525
|
-
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
526
|
-
var import_dayjs3 = __toESM(require("dayjs"));
|
|
527
|
-
|
|
528
|
-
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
529
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
530
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
531
|
-
import_dayjs4.default.extend(import_customParseFormat.default);
|
|
532
|
-
|
|
533
|
-
// pkgs/@akanjs/common/src/pluralize.ts
|
|
534
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
535
|
-
|
|
536
|
-
// pkgs/@akanjs/common/src/applyMixins.ts
|
|
537
|
-
var getAllPropertyDescriptors = (objRef) => {
|
|
538
|
-
const descriptors = {};
|
|
539
|
-
let current = objRef.prototype;
|
|
540
|
-
while (current) {
|
|
541
|
-
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
542
|
-
descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
|
|
543
|
-
});
|
|
544
|
-
current = Object.getPrototypeOf(current);
|
|
545
|
-
}
|
|
546
|
-
return descriptors;
|
|
547
|
-
};
|
|
548
|
-
var applyMixins = (derivedCtor, constructors, avoidKeys) => {
|
|
549
|
-
constructors.forEach((baseCtor) => {
|
|
550
|
-
Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
|
|
551
|
-
if (name === "constructor" || avoidKeys?.has(name))
|
|
552
|
-
return;
|
|
553
|
-
Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
|
|
554
|
-
});
|
|
555
|
-
});
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
// pkgs/@akanjs/common/src/capitalize.ts
|
|
559
|
-
var capitalize = (str) => {
|
|
560
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
// pkgs/@akanjs/common/src/Logger.ts
|
|
564
|
-
var import_dayjs5 = __toESM(require("dayjs"));
|
|
565
|
-
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
566
|
-
var clc = {
|
|
567
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
568
|
-
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
569
|
-
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
570
|
-
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
571
|
-
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
572
|
-
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
573
|
-
};
|
|
574
|
-
var colorizeMap = {
|
|
575
|
-
trace: clc.bold,
|
|
576
|
-
verbose: clc.cyanBright,
|
|
577
|
-
debug: clc.magentaBright,
|
|
578
|
-
log: clc.green,
|
|
579
|
-
info: clc.green,
|
|
580
|
-
warn: clc.yellow,
|
|
581
|
-
error: clc.red
|
|
582
|
-
};
|
|
583
|
-
var Logger = class _Logger {
|
|
584
|
-
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
585
|
-
"InstanceLoader",
|
|
586
|
-
"RoutesResolver",
|
|
587
|
-
"RouterExplorer",
|
|
588
|
-
"NestFactory",
|
|
589
|
-
"WebSocketsController",
|
|
590
|
-
"GraphQLModule",
|
|
591
|
-
"NestApplication"
|
|
592
|
-
]);
|
|
593
|
-
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
594
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
595
|
-
static #startAt = (0, import_dayjs5.default)();
|
|
596
|
-
static setLevel(level) {
|
|
597
|
-
this.level = level;
|
|
598
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
599
|
-
}
|
|
600
|
-
name;
|
|
601
|
-
constructor(name) {
|
|
602
|
-
this.name = name;
|
|
603
|
-
}
|
|
604
|
-
trace(msg, context = "") {
|
|
605
|
-
if (_Logger.#levelIdx <= 0)
|
|
606
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
607
|
-
}
|
|
608
|
-
verbose(msg, context = "") {
|
|
609
|
-
if (_Logger.#levelIdx <= 1)
|
|
610
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
611
|
-
}
|
|
612
|
-
debug(msg, context = "") {
|
|
613
|
-
if (_Logger.#levelIdx <= 2)
|
|
614
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
615
|
-
}
|
|
616
|
-
log(msg, context = "") {
|
|
617
|
-
if (_Logger.#levelIdx <= 3)
|
|
618
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
619
|
-
}
|
|
620
|
-
info(msg, context = "") {
|
|
621
|
-
if (_Logger.#levelIdx <= 4)
|
|
622
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
623
|
-
}
|
|
624
|
-
warn(msg, context = "") {
|
|
625
|
-
if (_Logger.#levelIdx <= 5)
|
|
626
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
627
|
-
}
|
|
628
|
-
error(msg, context = "") {
|
|
629
|
-
if (_Logger.#levelIdx <= 6)
|
|
630
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
631
|
-
}
|
|
632
|
-
raw(msg, method) {
|
|
633
|
-
_Logger.rawLog(msg, method);
|
|
634
|
-
}
|
|
635
|
-
rawLog(msg, method) {
|
|
636
|
-
_Logger.rawLog(msg, method);
|
|
637
|
-
}
|
|
638
|
-
static trace(msg, context = "") {
|
|
639
|
-
if (_Logger.#levelIdx <= 0)
|
|
640
|
-
_Logger.#printMessages("App", msg, context, "trace");
|
|
641
|
-
}
|
|
642
|
-
static verbose(msg, context = "") {
|
|
643
|
-
if (_Logger.#levelIdx <= 1)
|
|
644
|
-
_Logger.#printMessages("App", msg, context, "verbose");
|
|
645
|
-
}
|
|
646
|
-
static debug(msg, context = "") {
|
|
647
|
-
if (_Logger.#levelIdx <= 2)
|
|
648
|
-
_Logger.#printMessages("App", msg, context, "debug");
|
|
649
|
-
}
|
|
650
|
-
static log(msg, context = "") {
|
|
651
|
-
if (_Logger.#levelIdx <= 3)
|
|
652
|
-
_Logger.#printMessages("App", msg, context, "log");
|
|
653
|
-
}
|
|
654
|
-
static info(msg, context = "") {
|
|
655
|
-
if (_Logger.#levelIdx <= 4)
|
|
656
|
-
_Logger.#printMessages("App", msg, context, "info");
|
|
657
|
-
}
|
|
658
|
-
static warn(msg, context = "") {
|
|
659
|
-
if (_Logger.#levelIdx <= 5)
|
|
660
|
-
_Logger.#printMessages("App", msg, context, "warn");
|
|
661
|
-
}
|
|
662
|
-
static error(msg, context = "") {
|
|
663
|
-
if (_Logger.#levelIdx <= 6)
|
|
664
|
-
_Logger.#printMessages("App", msg, context, "error");
|
|
665
|
-
}
|
|
666
|
-
static #colorize(msg, logLevel) {
|
|
667
|
-
return colorizeMap[logLevel](msg);
|
|
668
|
-
}
|
|
669
|
-
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
670
|
-
if (this.#ignoreCtxSet.has(context))
|
|
671
|
-
return;
|
|
672
|
-
const now = (0, import_dayjs5.default)();
|
|
673
|
-
const processMsg = this.#colorize(
|
|
674
|
-
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
675
|
-
logLevel
|
|
676
|
-
);
|
|
677
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
678
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
679
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
680
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
681
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
682
|
-
if (typeof window === "undefined")
|
|
683
|
-
process[writeStreamType].write(
|
|
684
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
685
|
-
`
|
|
686
|
-
);
|
|
687
|
-
else
|
|
688
|
-
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
689
|
-
`);
|
|
690
|
-
}
|
|
691
|
-
static rawLog(msg, method) {
|
|
692
|
-
this.raw(`${msg}
|
|
693
|
-
`, method);
|
|
694
|
-
}
|
|
695
|
-
static raw(msg, method) {
|
|
696
|
-
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
697
|
-
global.process.stdout.write(msg);
|
|
698
|
-
else
|
|
699
|
-
console.log(msg);
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
// pkgs/@akanjs/constant/src/baseGql.ts
|
|
375
|
+
var import_base4 = require("@akanjs/base");
|
|
376
|
+
var import_common = require("@akanjs/common");
|
|
704
377
|
var defaultFieldMeta = {
|
|
705
378
|
fieldType: "property",
|
|
706
379
|
immutable: false,
|
|
@@ -714,7 +387,7 @@ var defaultFieldMeta = {
|
|
|
714
387
|
default: null,
|
|
715
388
|
isMap: false
|
|
716
389
|
};
|
|
717
|
-
var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
|
|
390
|
+
var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: import_base4.ID };
|
|
718
391
|
var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
|
|
719
392
|
var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
|
|
720
393
|
var removedAtFieldMeta = {
|
|
@@ -758,13 +431,13 @@ var lightModelOf = (objectRef, fields) => {
|
|
|
758
431
|
var fullModelOf = (modelRef, lightRef, overwriteRef, overwriteLightRef) => {
|
|
759
432
|
const modelFieldMetaMap = getFieldMetaMap(modelRef);
|
|
760
433
|
const lightFieldMetaMap = getFieldMetaMap(lightRef);
|
|
761
|
-
applyMixins(modelRef, [lightRef]);
|
|
434
|
+
(0, import_common.applyMixins)(modelRef, [lightRef]);
|
|
762
435
|
if (overwriteRef) {
|
|
763
|
-
applyMixins(overwriteRef, [modelRef]);
|
|
436
|
+
(0, import_common.applyMixins)(overwriteRef, [modelRef]);
|
|
764
437
|
setFieldMetaMap(overwriteRef, modelFieldMetaMap);
|
|
765
438
|
}
|
|
766
439
|
if (overwriteLightRef) {
|
|
767
|
-
applyMixins(overwriteLightRef, [lightRef]);
|
|
440
|
+
(0, import_common.applyMixins)(overwriteLightRef, [lightRef]);
|
|
768
441
|
setFieldMetaMap(overwriteLightRef, lightFieldMetaMap);
|
|
769
442
|
}
|
|
770
443
|
setFieldMetaMap(modelRef, new Map([...modelFieldMetaMap, ...lightFieldMetaMap]));
|
|
@@ -783,7 +456,7 @@ var addModelOf = (modelRef, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => {
|
|
|
783
456
|
const metadataMap = new Map(
|
|
784
457
|
[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10].filter((t) => !!t).reduce((acc, writeRef) => {
|
|
785
458
|
const writeMetadataMap = getFieldMetaMap(writeRef);
|
|
786
|
-
applyMixins(modelRef, [writeRef]);
|
|
459
|
+
(0, import_common.applyMixins)(modelRef, [writeRef]);
|
|
787
460
|
return new Map([...acc, ...writeMetadataMap]);
|
|
788
461
|
}, modelMetadataMap)
|
|
789
462
|
);
|
|
@@ -796,7 +469,7 @@ var addFilterOf = (filterRef, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) => {
|
|
|
796
469
|
const metadataMap = new Map(
|
|
797
470
|
[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10].filter((t) => !!t).reduce((acc, writeRef) => {
|
|
798
471
|
const writeMetadataMap = getFilterQueryMap(writeRef);
|
|
799
|
-
applyMixins(filterRef, [writeRef]);
|
|
472
|
+
(0, import_common.applyMixins)(filterRef, [writeRef]);
|
|
800
473
|
writeMetadataMap.forEach((value, key) => {
|
|
801
474
|
const filterArgMetas = getFilterArgMetas(writeRef, key);
|
|
802
475
|
setFilterArgMetasOnPrototype(filterRef.prototype, key, filterArgMetas);
|
|
@@ -826,7 +499,7 @@ var mixModelOf = (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t
|
|
|
826
499
|
const metadataMap = new Map(
|
|
827
500
|
[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20].filter((t) => !!t).reduce((acc, modelRef) => {
|
|
828
501
|
const modelMetadataMap = getFieldMetaMap(modelRef);
|
|
829
|
-
applyMixins(Mix, [modelRef]);
|
|
502
|
+
(0, import_common.applyMixins)(Mix, [modelRef]);
|
|
830
503
|
return [...acc, ...modelMetadataMap];
|
|
831
504
|
}, [])
|
|
832
505
|
);
|
|
@@ -837,6 +510,7 @@ var over = mixModelOf;
|
|
|
837
510
|
|
|
838
511
|
// pkgs/@akanjs/constant/src/classMeta.ts
|
|
839
512
|
var import_reflect_metadata4 = require("reflect-metadata");
|
|
513
|
+
var import_common2 = require("@akanjs/common");
|
|
840
514
|
var InputModelStorage = class {
|
|
841
515
|
};
|
|
842
516
|
var LightModelStorage = class {
|
|
@@ -848,19 +522,19 @@ var ScalarModelStorage = class {
|
|
|
848
522
|
var FilterModelStorage = class {
|
|
849
523
|
};
|
|
850
524
|
var getFullModelRef = (refName) => {
|
|
851
|
-
const modelRef = Reflect.getMetadata(capitalize(refName), FullModelStorage.prototype);
|
|
525
|
+
const modelRef = Reflect.getMetadata((0, import_common2.capitalize)(refName), FullModelStorage.prototype);
|
|
852
526
|
if (!modelRef)
|
|
853
527
|
throw new Error(`FullModel not found - ${refName}`);
|
|
854
528
|
return modelRef;
|
|
855
529
|
};
|
|
856
530
|
var getInputModelRef = (refName) => {
|
|
857
|
-
const modelRef = Reflect.getMetadata(capitalize(refName), InputModelStorage.prototype);
|
|
531
|
+
const modelRef = Reflect.getMetadata((0, import_common2.capitalize)(refName), InputModelStorage.prototype);
|
|
858
532
|
if (!modelRef)
|
|
859
533
|
throw new Error(`InputModel not found - ${refName}`);
|
|
860
534
|
return modelRef;
|
|
861
535
|
};
|
|
862
536
|
var getScalarModelRef = (refName) => {
|
|
863
|
-
const modelRef = Reflect.getMetadata(capitalize(refName), ScalarModelStorage.prototype);
|
|
537
|
+
const modelRef = Reflect.getMetadata((0, import_common2.capitalize)(refName), ScalarModelStorage.prototype);
|
|
864
538
|
if (!modelRef)
|
|
865
539
|
throw new Error(`ScalarModel not found - ${refName}`);
|
|
866
540
|
return modelRef;
|
|
@@ -943,4 +617,3 @@ var getAllFilterModelRefs = () => {
|
|
|
943
617
|
);
|
|
944
618
|
return modelRefs;
|
|
945
619
|
};
|
|
946
|
-
//! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/constant",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
"node": ">=22"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"dayjs": "^1.11.13",
|
|
19
|
-
"pluralize": "^8.0.0",
|
|
20
18
|
"reflect-metadata": "^0.2.2"
|
|
21
19
|
}
|
|
22
20
|
}
|