@akanjs/common 0.0.52 → 0.0.53
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/Logger.js +170 -0
- package/applyMixins.js +42 -0
- package/capitalize.js +25 -0
- package/deepObjectify.js +49 -0
- package/index.js +36 -0
- package/isDayjs.js +23 -0
- package/isQueryEqual.js +59 -0
- package/isValidDate.js +45 -0
- package/lowerlize.js +25 -0
- package/mergeVersion.js +23 -0
- package/objectify.js +30 -0
- package/package.json +1 -1
- package/pathGet.js +26 -0
- package/pathSet.js +33 -0
- package/pluralize.js +33 -0
- package/randomPick.js +23 -0
- package/randomPicks.js +35 -0
- package/sleep.js +29 -0
- package/splitVersion.js +26 -0
- package/types.js +15 -0
- package/Logger.ts +0 -136
- package/applyMixins.ts +0 -21
- package/capitalize.ts +0 -3
- package/deepObjectify.ts +0 -26
- package/index.ts +0 -18
- package/isDayjs.ts +0 -3
- package/isQueryEqual.ts +0 -22
- package/isValidDate.ts +0 -17
- package/lowerlize.ts +0 -3
- package/mergeVersion.ts +0 -10
- package/objectify.ts +0 -11
- package/pathGet.ts +0 -4
- package/pathSet.ts +0 -19
- package/pluralize.ts +0 -3
- package/randomPick.ts +0 -1
- package/randomPicks.ts +0 -12
- package/sleep.ts +0 -7
- package/splitVersion.ts +0 -10
- package/types.ts +0 -17
package/Logger.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var Logger_exports = {};
|
|
29
|
+
__export(Logger_exports, {
|
|
30
|
+
Logger: () => Logger
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Logger_exports);
|
|
33
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
34
|
+
const logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
35
|
+
const clc = {
|
|
36
|
+
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
37
|
+
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
38
|
+
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
39
|
+
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
40
|
+
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
41
|
+
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
42
|
+
};
|
|
43
|
+
const colorizeMap = {
|
|
44
|
+
trace: clc.bold,
|
|
45
|
+
verbose: clc.cyanBright,
|
|
46
|
+
debug: clc.magentaBright,
|
|
47
|
+
log: clc.green,
|
|
48
|
+
info: clc.green,
|
|
49
|
+
warn: clc.yellow,
|
|
50
|
+
error: clc.red
|
|
51
|
+
};
|
|
52
|
+
class Logger {
|
|
53
|
+
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
54
|
+
"InstanceLoader",
|
|
55
|
+
"RoutesResolver",
|
|
56
|
+
"RouterExplorer",
|
|
57
|
+
"NestFactory",
|
|
58
|
+
"WebSocketsController",
|
|
59
|
+
"GraphQLModule",
|
|
60
|
+
"NestApplication"
|
|
61
|
+
]);
|
|
62
|
+
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
63
|
+
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
64
|
+
static #startAt = (0, import_dayjs.default)();
|
|
65
|
+
static setLevel(level) {
|
|
66
|
+
this.level = level;
|
|
67
|
+
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
68
|
+
}
|
|
69
|
+
name;
|
|
70
|
+
constructor(name) {
|
|
71
|
+
this.name = name;
|
|
72
|
+
}
|
|
73
|
+
trace(msg, context = "") {
|
|
74
|
+
if (Logger.#levelIdx <= 0)
|
|
75
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
76
|
+
}
|
|
77
|
+
verbose(msg, context = "") {
|
|
78
|
+
if (Logger.#levelIdx <= 1)
|
|
79
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
80
|
+
}
|
|
81
|
+
debug(msg, context = "") {
|
|
82
|
+
if (Logger.#levelIdx <= 2)
|
|
83
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
84
|
+
}
|
|
85
|
+
log(msg, context = "") {
|
|
86
|
+
if (Logger.#levelIdx <= 3)
|
|
87
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
88
|
+
}
|
|
89
|
+
info(msg, context = "") {
|
|
90
|
+
if (Logger.#levelIdx <= 4)
|
|
91
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
92
|
+
}
|
|
93
|
+
warn(msg, context = "") {
|
|
94
|
+
if (Logger.#levelIdx <= 5)
|
|
95
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
96
|
+
}
|
|
97
|
+
error(msg, context = "") {
|
|
98
|
+
if (Logger.#levelIdx <= 6)
|
|
99
|
+
Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
100
|
+
}
|
|
101
|
+
raw(msg, method) {
|
|
102
|
+
Logger.rawLog(msg, method);
|
|
103
|
+
}
|
|
104
|
+
rawLog(msg, method) {
|
|
105
|
+
Logger.rawLog(msg, method);
|
|
106
|
+
}
|
|
107
|
+
static trace(msg, context = "") {
|
|
108
|
+
if (Logger.#levelIdx <= 0)
|
|
109
|
+
Logger.#printMessages("App", msg, context, "trace");
|
|
110
|
+
}
|
|
111
|
+
static verbose(msg, context = "") {
|
|
112
|
+
if (Logger.#levelIdx <= 1)
|
|
113
|
+
Logger.#printMessages("App", msg, context, "verbose");
|
|
114
|
+
}
|
|
115
|
+
static debug(msg, context = "") {
|
|
116
|
+
if (Logger.#levelIdx <= 2)
|
|
117
|
+
Logger.#printMessages("App", msg, context, "debug");
|
|
118
|
+
}
|
|
119
|
+
static log(msg, context = "") {
|
|
120
|
+
if (Logger.#levelIdx <= 3)
|
|
121
|
+
Logger.#printMessages("App", msg, context, "log");
|
|
122
|
+
}
|
|
123
|
+
static info(msg, context = "") {
|
|
124
|
+
if (Logger.#levelIdx <= 4)
|
|
125
|
+
Logger.#printMessages("App", msg, context, "info");
|
|
126
|
+
}
|
|
127
|
+
static warn(msg, context = "") {
|
|
128
|
+
if (Logger.#levelIdx <= 5)
|
|
129
|
+
Logger.#printMessages("App", msg, context, "warn");
|
|
130
|
+
}
|
|
131
|
+
static error(msg, context = "") {
|
|
132
|
+
if (Logger.#levelIdx <= 6)
|
|
133
|
+
Logger.#printMessages("App", msg, context, "error");
|
|
134
|
+
}
|
|
135
|
+
static #colorize(msg, logLevel) {
|
|
136
|
+
return colorizeMap[logLevel](msg);
|
|
137
|
+
}
|
|
138
|
+
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
139
|
+
if (this.#ignoreCtxSet.has(context))
|
|
140
|
+
return;
|
|
141
|
+
const now = (0, import_dayjs.default)();
|
|
142
|
+
const processMsg = this.#colorize(
|
|
143
|
+
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
144
|
+
logLevel
|
|
145
|
+
);
|
|
146
|
+
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
147
|
+
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
148
|
+
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
149
|
+
const contentMsg = this.#colorize(content, logLevel);
|
|
150
|
+
const timeDiffMsg = clc.yellow(`+${now.diff(Logger.#startAt, "ms")}ms`);
|
|
151
|
+
if (typeof window === "undefined")
|
|
152
|
+
process[writeStreamType].write(
|
|
153
|
+
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
154
|
+
`
|
|
155
|
+
);
|
|
156
|
+
else
|
|
157
|
+
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
158
|
+
`);
|
|
159
|
+
}
|
|
160
|
+
static rawLog(msg, method) {
|
|
161
|
+
this.raw(`${msg}
|
|
162
|
+
`, method);
|
|
163
|
+
}
|
|
164
|
+
static raw(msg, method) {
|
|
165
|
+
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
166
|
+
global.process.stdout.write(msg);
|
|
167
|
+
else
|
|
168
|
+
console.log(msg);
|
|
169
|
+
}
|
|
170
|
+
}
|
package/applyMixins.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var applyMixins_exports = {};
|
|
19
|
+
__export(applyMixins_exports, {
|
|
20
|
+
applyMixins: () => applyMixins
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(applyMixins_exports);
|
|
23
|
+
const getAllPropertyDescriptors = (objRef) => {
|
|
24
|
+
const descriptors = {};
|
|
25
|
+
let current = objRef.prototype;
|
|
26
|
+
while (current) {
|
|
27
|
+
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
28
|
+
descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
|
|
29
|
+
});
|
|
30
|
+
current = Object.getPrototypeOf(current);
|
|
31
|
+
}
|
|
32
|
+
return descriptors;
|
|
33
|
+
};
|
|
34
|
+
const applyMixins = (derivedCtor, constructors, avoidKeys) => {
|
|
35
|
+
constructors.forEach((baseCtor) => {
|
|
36
|
+
Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
|
|
37
|
+
if (name === "constructor" || avoidKeys?.has(name))
|
|
38
|
+
return;
|
|
39
|
+
Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
package/capitalize.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var capitalize_exports = {};
|
|
19
|
+
__export(capitalize_exports, {
|
|
20
|
+
capitalize: () => capitalize
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(capitalize_exports);
|
|
23
|
+
const capitalize = (str) => {
|
|
24
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
25
|
+
};
|
package/deepObjectify.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var deepObjectify_exports = {};
|
|
19
|
+
__export(deepObjectify_exports, {
|
|
20
|
+
deepObjectify: () => deepObjectify
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(deepObjectify_exports);
|
|
23
|
+
var import_isDayjs = require("./isDayjs");
|
|
24
|
+
const deepObjectify = (obj, option = {}) => {
|
|
25
|
+
if ((0, import_isDayjs.isDayjs)(obj) || obj?.constructor === Date) {
|
|
26
|
+
if (!option.serializable && !option.convertDate)
|
|
27
|
+
return obj;
|
|
28
|
+
if (option.convertDate === "string")
|
|
29
|
+
return obj.toISOString();
|
|
30
|
+
else if (option.convertDate === "number")
|
|
31
|
+
return (0, import_isDayjs.isDayjs)(obj) ? obj.toDate().getTime() : obj.getTime();
|
|
32
|
+
else
|
|
33
|
+
return (0, import_isDayjs.isDayjs)(obj) ? obj.toDate() : obj;
|
|
34
|
+
} else if (Array.isArray(obj)) {
|
|
35
|
+
return obj.map((o) => deepObjectify(o, option));
|
|
36
|
+
} else if (obj && typeof obj === "object") {
|
|
37
|
+
const val = {};
|
|
38
|
+
Object.keys(obj).forEach((key) => {
|
|
39
|
+
const fieldValue = obj[key];
|
|
40
|
+
if (fieldValue?.__ModelType__ && !option.serializable)
|
|
41
|
+
val[key] = fieldValue;
|
|
42
|
+
else if (typeof obj[key] !== "function")
|
|
43
|
+
val[key] = deepObjectify(fieldValue, option);
|
|
44
|
+
});
|
|
45
|
+
return val;
|
|
46
|
+
} else {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { splitVersion } from "./splitVersion";
|
|
2
|
+
import { deepObjectify } from "./deepObjectify";
|
|
3
|
+
import { pathGet } from "./pathGet";
|
|
4
|
+
import { isQueryEqual } from "./isQueryEqual";
|
|
5
|
+
import { isValidDate } from "./isValidDate";
|
|
6
|
+
import { objectify } from "./objectify";
|
|
7
|
+
import { randomPick } from "./randomPick";
|
|
8
|
+
import { randomPicks } from "./randomPicks";
|
|
9
|
+
import { pathSet } from "./pathSet";
|
|
10
|
+
import { isDayjs } from "./isDayjs";
|
|
11
|
+
import { mergeVersion } from "./mergeVersion";
|
|
12
|
+
import { pluralize } from "./pluralize";
|
|
13
|
+
import { applyMixins } from "./applyMixins";
|
|
14
|
+
import { capitalize } from "./capitalize";
|
|
15
|
+
import { Logger } from "./Logger";
|
|
16
|
+
import { lowerlize } from "./lowerlize";
|
|
17
|
+
import { sleep } from "./sleep";
|
|
18
|
+
export {
|
|
19
|
+
Logger,
|
|
20
|
+
applyMixins,
|
|
21
|
+
capitalize,
|
|
22
|
+
deepObjectify,
|
|
23
|
+
isDayjs,
|
|
24
|
+
isQueryEqual,
|
|
25
|
+
isValidDate,
|
|
26
|
+
lowerlize,
|
|
27
|
+
mergeVersion,
|
|
28
|
+
objectify,
|
|
29
|
+
pathGet,
|
|
30
|
+
pathSet,
|
|
31
|
+
pluralize,
|
|
32
|
+
randomPick,
|
|
33
|
+
randomPicks,
|
|
34
|
+
sleep,
|
|
35
|
+
splitVersion
|
|
36
|
+
};
|
package/isDayjs.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var isDayjs_exports = {};
|
|
19
|
+
__export(isDayjs_exports, {
|
|
20
|
+
isDayjs: () => import_dayjs.isDayjs
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(isDayjs_exports);
|
|
23
|
+
var import_dayjs = require("dayjs");
|
package/isQueryEqual.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var isQueryEqual_exports = {};
|
|
29
|
+
__export(isQueryEqual_exports, {
|
|
30
|
+
isQueryEqual: () => isQueryEqual
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(isQueryEqual_exports);
|
|
33
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
34
|
+
var import_isDayjs = require("./isDayjs");
|
|
35
|
+
const isQueryEqual = (value1, value2) => {
|
|
36
|
+
if (value1 === value2)
|
|
37
|
+
return true;
|
|
38
|
+
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
39
|
+
if (value1.length !== value2.length)
|
|
40
|
+
return false;
|
|
41
|
+
for (let i = 0; i < value1.length; i++)
|
|
42
|
+
if (!isQueryEqual(value1[i], value2[i]))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if ([value1, value2].some((val) => val instanceof Date || (0, import_isDayjs.isDayjs)(val)))
|
|
47
|
+
return (0, import_dayjs.default)(value1).isSame((0, import_dayjs.default)(value2));
|
|
48
|
+
if (typeof value1 === "object" && typeof value2 === "object") {
|
|
49
|
+
if (value1 === null || value2 === null)
|
|
50
|
+
return value1 === value2;
|
|
51
|
+
if (Object.keys(value1).length !== Object.keys(value2).length)
|
|
52
|
+
return false;
|
|
53
|
+
for (const key of Object.keys(value1))
|
|
54
|
+
if (!isQueryEqual(value1[key], value2[key]))
|
|
55
|
+
return false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
};
|
package/isValidDate.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var isValidDate_exports = {};
|
|
29
|
+
__export(isValidDate_exports, {
|
|
30
|
+
isValidDate: () => isValidDate
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(isValidDate_exports);
|
|
33
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
34
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
35
|
+
var import_isDayjs = require("./isDayjs");
|
|
36
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
37
|
+
const isValidDate = (d) => {
|
|
38
|
+
const format = "YYYY-MM-DD";
|
|
39
|
+
if (typeof d === "string") {
|
|
40
|
+
return (0, import_dayjs.default)(d, format).isValid();
|
|
41
|
+
} else if ((0, import_isDayjs.isDayjs)(d))
|
|
42
|
+
return d.isValid();
|
|
43
|
+
else
|
|
44
|
+
return d instanceof Date && !isNaN(d.getTime());
|
|
45
|
+
};
|
package/lowerlize.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var lowerlize_exports = {};
|
|
19
|
+
__export(lowerlize_exports, {
|
|
20
|
+
lowerlize: () => lowerlize
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(lowerlize_exports);
|
|
23
|
+
const lowerlize = (str) => {
|
|
24
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
25
|
+
};
|
package/mergeVersion.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var mergeVersion_exports = {};
|
|
19
|
+
__export(mergeVersion_exports, {
|
|
20
|
+
mergeVersion: () => mergeVersion
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(mergeVersion_exports);
|
|
23
|
+
const mergeVersion = (major, minor, patch) => `${major}.${minor}.${patch}`;
|
package/objectify.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var objectify_exports = {};
|
|
19
|
+
__export(objectify_exports, {
|
|
20
|
+
objectify: () => objectify
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(objectify_exports);
|
|
23
|
+
const objectify = (obj, keys = Object.keys(obj)) => {
|
|
24
|
+
const val = {};
|
|
25
|
+
keys.forEach((key) => {
|
|
26
|
+
if (typeof obj[key] !== "function")
|
|
27
|
+
val[key] = obj[key];
|
|
28
|
+
});
|
|
29
|
+
return val;
|
|
30
|
+
};
|
package/package.json
CHANGED
package/pathGet.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var pathGet_exports = {};
|
|
19
|
+
__export(pathGet_exports, {
|
|
20
|
+
pathGet: () => pathGet
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(pathGet_exports);
|
|
23
|
+
const pathGet = (path, obj, separator = ".") => {
|
|
24
|
+
const properties = Array.isArray(path) ? path : path.split(separator);
|
|
25
|
+
return properties.reduce((prev, curr) => prev[curr], obj);
|
|
26
|
+
};
|
package/pathSet.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var pathSet_exports = {};
|
|
19
|
+
__export(pathSet_exports, {
|
|
20
|
+
pathSet: () => pathSet
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(pathSet_exports);
|
|
23
|
+
const pathSet = (obj, path, value) => {
|
|
24
|
+
if (Object(obj) !== obj)
|
|
25
|
+
return obj;
|
|
26
|
+
if (!Array.isArray(path))
|
|
27
|
+
path = path.toString().match(/[^.[\]]+/g) || [];
|
|
28
|
+
path.slice(0, -1).reduce(
|
|
29
|
+
(a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {},
|
|
30
|
+
obj
|
|
31
|
+
)[path[path.length - 1]] = value;
|
|
32
|
+
return obj;
|
|
33
|
+
};
|
package/pluralize.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var pluralize_exports = {};
|
|
29
|
+
__export(pluralize_exports, {
|
|
30
|
+
pluralize: () => import_pluralize.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(pluralize_exports);
|
|
33
|
+
var import_pluralize = __toESM(require("pluralize"));
|
package/randomPick.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var randomPick_exports = {};
|
|
19
|
+
__export(randomPick_exports, {
|
|
20
|
+
randomPick: () => randomPick
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(randomPick_exports);
|
|
23
|
+
const randomPick = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
package/randomPicks.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var randomPicks_exports = {};
|
|
19
|
+
__export(randomPicks_exports, {
|
|
20
|
+
randomPicks: () => randomPicks
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(randomPicks_exports);
|
|
23
|
+
const randomPicks = (arr, count = 1, allowDuplicate = false) => {
|
|
24
|
+
if (!allowDuplicate && arr.length <= count)
|
|
25
|
+
return arr;
|
|
26
|
+
const idxs = [];
|
|
27
|
+
let pickIdx;
|
|
28
|
+
for (let i = 0; i < count; i++) {
|
|
29
|
+
do {
|
|
30
|
+
pickIdx = Math.floor(Math.random() * arr.length);
|
|
31
|
+
} while (!allowDuplicate && idxs.includes(pickIdx));
|
|
32
|
+
idxs.push(pickIdx);
|
|
33
|
+
}
|
|
34
|
+
return idxs.map((idx) => arr[idx]);
|
|
35
|
+
};
|
package/sleep.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sleep_exports = {};
|
|
19
|
+
__export(sleep_exports, {
|
|
20
|
+
sleep: () => sleep
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sleep_exports);
|
|
23
|
+
const sleep = async (ms) => {
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
resolve(true);
|
|
27
|
+
}, ms);
|
|
28
|
+
});
|
|
29
|
+
};
|
package/splitVersion.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var splitVersion_exports = {};
|
|
19
|
+
__export(splitVersion_exports, {
|
|
20
|
+
splitVersion: () => splitVersion
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(splitVersion_exports);
|
|
23
|
+
const splitVersion = (version) => {
|
|
24
|
+
const [major, minor, patch] = version.split(".");
|
|
25
|
+
return { major, minor, patch };
|
|
26
|
+
};
|
package/types.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(types_exports);
|
package/Logger.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
const logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"] as const;
|
|
4
|
-
type LogLevel = (typeof logLevels)[number];
|
|
5
|
-
|
|
6
|
-
const clc = {
|
|
7
|
-
bold: (text: string) => `\x1B[1m${text}\x1B[0m`,
|
|
8
|
-
green: (text: string) => `\x1B[32m${text}\x1B[39m`,
|
|
9
|
-
yellow: (text: string) => `\x1B[33m${text}\x1B[39m`,
|
|
10
|
-
red: (text: string) => `\x1B[31m${text}\x1B[39m`,
|
|
11
|
-
magentaBright: (text: string) => `\x1B[95m${text}\x1B[39m`,
|
|
12
|
-
cyanBright: (text: string) => `\x1B[96m${text}\x1B[39m`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const colorizeMap: { [key in LogLevel]: (text: string) => string } = {
|
|
16
|
-
trace: clc.bold,
|
|
17
|
-
verbose: clc.cyanBright,
|
|
18
|
-
debug: clc.magentaBright,
|
|
19
|
-
log: clc.green,
|
|
20
|
-
info: clc.green,
|
|
21
|
-
warn: clc.yellow,
|
|
22
|
-
error: clc.red,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export class Logger {
|
|
26
|
-
static #ignoreCtxSet = new Set([
|
|
27
|
-
"InstanceLoader",
|
|
28
|
-
"RoutesResolver",
|
|
29
|
-
"RouterExplorer",
|
|
30
|
-
"NestFactory",
|
|
31
|
-
"WebSocketsController",
|
|
32
|
-
"GraphQLModule",
|
|
33
|
-
"NestApplication",
|
|
34
|
-
]);
|
|
35
|
-
static level: LogLevel = (process.env.NEXT_PUBLIC_LOG_LEVEL as LogLevel | undefined) ?? "log";
|
|
36
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
37
|
-
static #startAt = dayjs();
|
|
38
|
-
static setLevel(level: LogLevel) {
|
|
39
|
-
this.level = level;
|
|
40
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
name?: string;
|
|
44
|
-
constructor(name?: string) {
|
|
45
|
-
this.name = name;
|
|
46
|
-
}
|
|
47
|
-
trace(msg: string, context = "") {
|
|
48
|
-
if (Logger.#levelIdx <= 0) Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
49
|
-
}
|
|
50
|
-
verbose(msg: string, context = "") {
|
|
51
|
-
if (Logger.#levelIdx <= 1) Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
52
|
-
}
|
|
53
|
-
debug(msg: string, context = "") {
|
|
54
|
-
if (Logger.#levelIdx <= 2) Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
55
|
-
}
|
|
56
|
-
log(msg: string, context = "") {
|
|
57
|
-
if (Logger.#levelIdx <= 3) Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
58
|
-
}
|
|
59
|
-
info(msg: string, context = "") {
|
|
60
|
-
if (Logger.#levelIdx <= 4) Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
61
|
-
}
|
|
62
|
-
warn(msg: string, context = "") {
|
|
63
|
-
if (Logger.#levelIdx <= 5) Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
64
|
-
}
|
|
65
|
-
error(msg: string, context = "") {
|
|
66
|
-
if (Logger.#levelIdx <= 6) Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
67
|
-
}
|
|
68
|
-
raw(msg: string, method?: "console" | "process") {
|
|
69
|
-
Logger.rawLog(msg, method);
|
|
70
|
-
}
|
|
71
|
-
rawLog(msg: string, method?: "console" | "process") {
|
|
72
|
-
Logger.rawLog(msg, method);
|
|
73
|
-
}
|
|
74
|
-
static trace(msg: string, context = "") {
|
|
75
|
-
if (Logger.#levelIdx <= 0) Logger.#printMessages("App", msg, context, "trace");
|
|
76
|
-
}
|
|
77
|
-
static verbose(msg: string, context = "") {
|
|
78
|
-
if (Logger.#levelIdx <= 1) Logger.#printMessages("App", msg, context, "verbose");
|
|
79
|
-
}
|
|
80
|
-
static debug(msg: string, context = "") {
|
|
81
|
-
if (Logger.#levelIdx <= 2) Logger.#printMessages("App", msg, context, "debug");
|
|
82
|
-
}
|
|
83
|
-
static log(msg: string, context = "") {
|
|
84
|
-
if (Logger.#levelIdx <= 3) Logger.#printMessages("App", msg, context, "log");
|
|
85
|
-
}
|
|
86
|
-
static info(msg: string, context = "") {
|
|
87
|
-
if (Logger.#levelIdx <= 4) Logger.#printMessages("App", msg, context, "info");
|
|
88
|
-
}
|
|
89
|
-
static warn(msg: string, context = "") {
|
|
90
|
-
if (Logger.#levelIdx <= 5) Logger.#printMessages("App", msg, context, "warn");
|
|
91
|
-
}
|
|
92
|
-
static error(msg: string, context = "") {
|
|
93
|
-
if (Logger.#levelIdx <= 6) Logger.#printMessages("App", msg, context, "error");
|
|
94
|
-
}
|
|
95
|
-
static #colorize(msg: string, logLevel: LogLevel) {
|
|
96
|
-
return colorizeMap[logLevel](msg);
|
|
97
|
-
}
|
|
98
|
-
static #printMessages(
|
|
99
|
-
name: string | undefined,
|
|
100
|
-
content: string,
|
|
101
|
-
context: string,
|
|
102
|
-
logLevel: LogLevel,
|
|
103
|
-
writeStreamType: "stdout" | "stderr" = logLevel === "error" ? "stderr" : "stdout"
|
|
104
|
-
) {
|
|
105
|
-
if (this.#ignoreCtxSet.has(context)) return;
|
|
106
|
-
const now = dayjs();
|
|
107
|
-
const processMsg = this.#colorize(
|
|
108
|
-
`[${name ?? "App"}] ${(global.process as unknown as NodeJS.Process | undefined)?.pid ?? "window"} -`,
|
|
109
|
-
logLevel
|
|
110
|
-
);
|
|
111
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
112
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
113
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
114
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
115
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(Logger.#startAt, "ms")}ms`);
|
|
116
|
-
if (typeof window === "undefined")
|
|
117
|
-
process[writeStreamType].write(
|
|
118
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}\n`
|
|
119
|
-
);
|
|
120
|
-
// eslint-disable-next-line no-console
|
|
121
|
-
else console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}\n`);
|
|
122
|
-
}
|
|
123
|
-
static rawLog(msg: string, method?: "console" | "process") {
|
|
124
|
-
this.raw(`${msg}\n`, method);
|
|
125
|
-
}
|
|
126
|
-
static raw(msg: string, method?: "console" | "process") {
|
|
127
|
-
if (
|
|
128
|
-
typeof window === "undefined" &&
|
|
129
|
-
method !== "console" &&
|
|
130
|
-
(global.process as unknown as NodeJS.Process | undefined)
|
|
131
|
-
)
|
|
132
|
-
global.process.stdout.write(msg);
|
|
133
|
-
// eslint-disable-next-line no-console
|
|
134
|
-
else console.log(msg);
|
|
135
|
-
}
|
|
136
|
-
}
|
package/applyMixins.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
type Type<T = any> = new (...args: any[]) => T;
|
|
2
|
-
const getAllPropertyDescriptors = (objRef: Type): { [key: string]: PropertyDescriptor } => {
|
|
3
|
-
const descriptors: { [key: string]: any } = {};
|
|
4
|
-
let current = objRef.prototype as object | null;
|
|
5
|
-
while (current) {
|
|
6
|
-
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
7
|
-
descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
|
|
8
|
-
});
|
|
9
|
-
current = Object.getPrototypeOf(current) as Type | object;
|
|
10
|
-
}
|
|
11
|
-
return descriptors;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const applyMixins = (derivedCtor: Type, constructors: (Type | undefined)[], avoidKeys?: Set<string>) => {
|
|
15
|
-
constructors.forEach((baseCtor: Type) => {
|
|
16
|
-
Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
|
|
17
|
-
if (name === "constructor" || avoidKeys?.has(name)) return;
|
|
18
|
-
Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
};
|
package/capitalize.ts
DELETED
package/deepObjectify.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { isDayjs } from "./isDayjs";
|
|
2
|
-
|
|
3
|
-
export const deepObjectify = <T = any>(
|
|
4
|
-
obj: T | null | undefined,
|
|
5
|
-
option: { serializable?: boolean; convertDate?: "string" | "number" } = {}
|
|
6
|
-
): T => {
|
|
7
|
-
if (isDayjs(obj) || obj?.constructor === Date) {
|
|
8
|
-
if (!option.serializable && !option.convertDate) return obj as T;
|
|
9
|
-
if (option.convertDate === "string") return obj.toISOString() as T;
|
|
10
|
-
else if (option.convertDate === "number")
|
|
11
|
-
return (isDayjs(obj) ? obj.toDate().getTime() : (obj as Date).getTime()) as T;
|
|
12
|
-
else return (isDayjs(obj) ? obj.toDate() : obj) as T;
|
|
13
|
-
} else if (Array.isArray(obj)) {
|
|
14
|
-
return obj.map((o: object) => deepObjectify(o, option)) as T;
|
|
15
|
-
} else if (obj && typeof obj === "object") {
|
|
16
|
-
const val = {} as { [key: string]: object };
|
|
17
|
-
Object.keys(obj).forEach((key) => {
|
|
18
|
-
const fieldValue = obj[key] as { __ModelType__: string } | null | undefined;
|
|
19
|
-
if (fieldValue?.__ModelType__ && !option.serializable) val[key] = fieldValue;
|
|
20
|
-
else if (typeof obj[key] !== "function") val[key] = deepObjectify(fieldValue, option);
|
|
21
|
-
});
|
|
22
|
-
return val as T;
|
|
23
|
-
} else {
|
|
24
|
-
return obj as unknown as T;
|
|
25
|
-
}
|
|
26
|
-
};
|
package/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type * from "./types";
|
|
2
|
-
export { splitVersion } from "./splitVersion";
|
|
3
|
-
export { deepObjectify } from "./deepObjectify";
|
|
4
|
-
export { pathGet } from "./pathGet";
|
|
5
|
-
export { isQueryEqual } from "./isQueryEqual";
|
|
6
|
-
export { isValidDate } from "./isValidDate";
|
|
7
|
-
export { objectify } from "./objectify";
|
|
8
|
-
export { randomPick } from "./randomPick";
|
|
9
|
-
export { randomPicks } from "./randomPicks";
|
|
10
|
-
export { pathSet } from "./pathSet";
|
|
11
|
-
export { isDayjs } from "./isDayjs";
|
|
12
|
-
export { mergeVersion } from "./mergeVersion";
|
|
13
|
-
export { pluralize } from "./pluralize";
|
|
14
|
-
export { applyMixins } from "./applyMixins";
|
|
15
|
-
export { capitalize } from "./capitalize";
|
|
16
|
-
export { Logger } from "./Logger";
|
|
17
|
-
export { lowerlize } from "./lowerlize";
|
|
18
|
-
export { sleep } from "./sleep";
|
package/isDayjs.ts
DELETED
package/isQueryEqual.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
import { isDayjs } from "./isDayjs";
|
|
4
|
-
|
|
5
|
-
export const isQueryEqual = (value1: object | null, value2: object | null) => {
|
|
6
|
-
if (value1 === value2) return true;
|
|
7
|
-
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
8
|
-
if (value1.length !== value2.length) return false;
|
|
9
|
-
for (let i = 0; i < value1.length; i++) if (!isQueryEqual(value1[i] as object, value2[i] as object)) return false;
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if ([value1, value2].some((val) => val instanceof Date || isDayjs(val)))
|
|
13
|
-
return dayjs(value1 as Date).isSame(dayjs(value2 as Date));
|
|
14
|
-
if (typeof value1 === "object" && typeof value2 === "object") {
|
|
15
|
-
if (value1 === null || value2 === null) return value1 === value2;
|
|
16
|
-
if (Object.keys(value1).length !== Object.keys(value2).length) return false;
|
|
17
|
-
for (const key of Object.keys(value1))
|
|
18
|
-
if (!isQueryEqual(value1[key] as object, value2[key] as object)) return false;
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
};
|
package/isValidDate.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import dayjs, { Dayjs } from "dayjs";
|
|
2
|
-
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
3
|
-
|
|
4
|
-
import { isDayjs } from "./isDayjs";
|
|
5
|
-
|
|
6
|
-
dayjs.extend(customParseFormat);
|
|
7
|
-
|
|
8
|
-
export const isValidDate = (d: string | Date | Dayjs) => {
|
|
9
|
-
const format = "YYYY-MM-DD";
|
|
10
|
-
if (typeof d === "string") {
|
|
11
|
-
return dayjs(d, format).isValid();
|
|
12
|
-
// ! Aggregation에서는 위 코드처럼 해야함. 다른곳에서 필요하면 아래 코드 사용해야 할 이유를 찾아보기
|
|
13
|
-
// return dayjs(d, format, true).isValid();
|
|
14
|
-
// } else if (isDayjs(d)) return dayjs(d.format(format), format, true).isSame(d);
|
|
15
|
-
} else if (isDayjs(d)) return d.isValid();
|
|
16
|
-
else return d instanceof Date && !isNaN(d.getTime());
|
|
17
|
-
};
|
package/lowerlize.ts
DELETED
package/mergeVersion.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* semantic version 규격에 맞게 조합하는 함수
|
|
4
|
-
* https://semver.org/
|
|
5
|
-
* @param major 릴리즈(플랫폼(google,apple,etc...)에 올라가 있는) 버전
|
|
6
|
-
* @param minor 릴리즈(플랫폼(google,apple,etc...)에 올라가 있는) 버전
|
|
7
|
-
* @param patch 코드푸시 (Framework 자체 버전)
|
|
8
|
-
* @returns `major.minor.patch` 형식으로 조합된 버전
|
|
9
|
-
*/
|
|
10
|
-
export const mergeVersion = (major: number, minor: number, patch: number) => `${major}.${minor}.${patch}`;
|
package/objectify.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
5
|
-
export const objectify = (obj: any, keys = Object.keys(obj)) => {
|
|
6
|
-
const val: any = {};
|
|
7
|
-
keys.forEach((key) => {
|
|
8
|
-
if (typeof obj[key] !== "function") val[key] = obj[key];
|
|
9
|
-
});
|
|
10
|
-
return val;
|
|
11
|
-
};
|
package/pathGet.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export const pathGet = (path: string | (string | number)[], obj: any, separator = "."): unknown => {
|
|
2
|
-
const properties = Array.isArray(path) ? path : path.split(separator);
|
|
3
|
-
return properties.reduce((prev: Record<string, any> | any[], curr) => prev[curr] as unknown, obj);
|
|
4
|
-
};
|
package/pathSet.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
2
|
-
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
8
|
-
export const pathSet = (obj: any, path: any, value: any) => {
|
|
9
|
-
if (Object(obj) !== obj) return obj;
|
|
10
|
-
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
|
|
11
|
-
path
|
|
12
|
-
.slice(0, -1)
|
|
13
|
-
.reduce(
|
|
14
|
-
(a: any, c: any, i: any) =>
|
|
15
|
-
Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {}),
|
|
16
|
-
obj
|
|
17
|
-
)[path[path.length - 1]] = value;
|
|
18
|
-
return obj;
|
|
19
|
-
};
|
package/pluralize.ts
DELETED
package/randomPick.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const randomPick = <T = any>(arr: T[] | readonly T[]): T => arr[Math.floor(Math.random() * arr.length)];
|
package/randomPicks.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const randomPicks = <T>(arr: T[] | readonly T[], count = 1, allowDuplicate = false): T[] => {
|
|
2
|
-
if (!allowDuplicate && arr.length <= count) return arr as T[];
|
|
3
|
-
const idxs: number[] = [];
|
|
4
|
-
let pickIdx: number;
|
|
5
|
-
for (let i = 0; i < count; i++) {
|
|
6
|
-
do {
|
|
7
|
-
pickIdx = Math.floor(Math.random() * arr.length);
|
|
8
|
-
} while (!allowDuplicate && idxs.includes(pickIdx));
|
|
9
|
-
idxs.push(pickIdx);
|
|
10
|
-
}
|
|
11
|
-
return idxs.map((idx) => arr[idx]);
|
|
12
|
-
};
|
package/sleep.ts
DELETED
package/splitVersion.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* semantic version 규격에 맞게 major, minor, patch로 나누는 함수
|
|
4
|
-
* https://semver.org/
|
|
5
|
-
* @params version `major.minor.patch` 형식으로 조합된 버전
|
|
6
|
-
*/
|
|
7
|
-
export const splitVersion = (version: string) => {
|
|
8
|
-
const [major, minor, patch] = version.split(".");
|
|
9
|
-
return { major, minor, patch };
|
|
10
|
-
};
|
package/types.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RequestPolicy } from "@urql/core";
|
|
2
|
-
|
|
3
|
-
export interface FetchPolicy<Returns = any> {
|
|
4
|
-
cache?: boolean | number | RequestPolicy;
|
|
5
|
-
crystalize?: boolean;
|
|
6
|
-
url?: string;
|
|
7
|
-
onError?: (error: string) => void;
|
|
8
|
-
token?: string;
|
|
9
|
-
partial?: string[];
|
|
10
|
-
transport?: "udp" | "websocket" | "graphql" | "restapi";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type SnakeCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Lowercase<T>}_${SnakeCase<U>}` : S;
|
|
14
|
-
export type SnakeCaseObj<T> = {
|
|
15
|
-
[K in keyof T as SnakeCase<K & string>]: T[K] extends object ? SnakeCaseObj<T[K]> : T[K];
|
|
16
|
-
};
|
|
17
|
-
export type SnakeMsg<Msg> = SnakeCaseObj<Msg>;
|