@akanjs/store 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 +67 -1163
- package/package.json +1 -8
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
|
|
|
29
19
|
// pkgs/@akanjs/store/index.ts
|
|
@@ -42,1101 +32,16 @@ __export(store_exports, {
|
|
|
42
32
|
});
|
|
43
33
|
module.exports = __toCommonJS(store_exports);
|
|
44
34
|
|
|
45
|
-
// pkgs/@akanjs/base/src/base.ts
|
|
46
|
-
var DataList = class _DataList {
|
|
47
|
-
// [immerable] = true;
|
|
48
|
-
#idMap;
|
|
49
|
-
length;
|
|
50
|
-
values;
|
|
51
|
-
constructor(data = []) {
|
|
52
|
-
this.values = Array.isArray(data) ? [...data] : [...data.values];
|
|
53
|
-
this.#idMap = new Map(this.values.map((value, idx) => [value.id, idx]));
|
|
54
|
-
this.length = this.values.length;
|
|
55
|
-
}
|
|
56
|
-
indexOf(id) {
|
|
57
|
-
const idx = this.#idMap.get(id);
|
|
58
|
-
if (idx === void 0)
|
|
59
|
-
throw new Error(`Value ${id} is not in list`);
|
|
60
|
-
return idx;
|
|
61
|
-
}
|
|
62
|
-
set(value) {
|
|
63
|
-
const idx = this.#idMap.get(value.id);
|
|
64
|
-
if (idx !== void 0)
|
|
65
|
-
this.values = [...this.values.slice(0, idx), value, ...this.values.slice(idx + 1)];
|
|
66
|
-
else {
|
|
67
|
-
this.#idMap.set(value.id, this.length);
|
|
68
|
-
this.values = [...this.values, value];
|
|
69
|
-
this.length++;
|
|
70
|
-
}
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
delete(id) {
|
|
74
|
-
const idx = this.#idMap.get(id);
|
|
75
|
-
if (idx === void 0)
|
|
76
|
-
return this;
|
|
77
|
-
this.#idMap.delete(id);
|
|
78
|
-
this.values.splice(idx, 1);
|
|
79
|
-
this.values.slice(idx).forEach((value, i) => this.#idMap.set(value.id, i + idx));
|
|
80
|
-
this.length--;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
get(id) {
|
|
84
|
-
const idx = this.#idMap.get(id);
|
|
85
|
-
if (idx === void 0)
|
|
86
|
-
return void 0;
|
|
87
|
-
return this.values[idx];
|
|
88
|
-
}
|
|
89
|
-
at(idx) {
|
|
90
|
-
return this.values.at(idx);
|
|
91
|
-
}
|
|
92
|
-
pickAt(idx) {
|
|
93
|
-
const value = this.values.at(idx);
|
|
94
|
-
if (value === void 0)
|
|
95
|
-
throw new Error(`Value at ${idx} is undefined`);
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
pick(id) {
|
|
99
|
-
return this.values[this.indexOf(id)];
|
|
100
|
-
}
|
|
101
|
-
has(id) {
|
|
102
|
-
return this.#idMap.has(id);
|
|
103
|
-
}
|
|
104
|
-
find(fn) {
|
|
105
|
-
const val = this.values.find(fn);
|
|
106
|
-
return val;
|
|
107
|
-
}
|
|
108
|
-
findIndex(fn) {
|
|
109
|
-
const val = this.values.findIndex(fn);
|
|
110
|
-
return val;
|
|
111
|
-
}
|
|
112
|
-
some(fn) {
|
|
113
|
-
return this.values.some(fn);
|
|
114
|
-
}
|
|
115
|
-
every(fn) {
|
|
116
|
-
return this.values.every(fn);
|
|
117
|
-
}
|
|
118
|
-
forEach(fn) {
|
|
119
|
-
this.values.forEach(fn);
|
|
120
|
-
}
|
|
121
|
-
map(fn) {
|
|
122
|
-
return this.values.map(fn);
|
|
123
|
-
}
|
|
124
|
-
flatMap(fn) {
|
|
125
|
-
return this.values.flatMap(fn);
|
|
126
|
-
}
|
|
127
|
-
sort(fn) {
|
|
128
|
-
return new _DataList(this.values.sort(fn));
|
|
129
|
-
}
|
|
130
|
-
filter(fn) {
|
|
131
|
-
return new _DataList(this.values.filter(fn));
|
|
132
|
-
}
|
|
133
|
-
reduce(fn, initialValue) {
|
|
134
|
-
return this.values.reduce(fn, initialValue);
|
|
135
|
-
}
|
|
136
|
-
slice(start, end = this.length) {
|
|
137
|
-
return new _DataList(this.values.slice(start, end));
|
|
138
|
-
}
|
|
139
|
-
save() {
|
|
140
|
-
return new _DataList(this);
|
|
141
|
-
}
|
|
142
|
-
[Symbol.iterator]() {
|
|
143
|
-
return this.values[Symbol.iterator]();
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var version = "0.9.0";
|
|
147
|
-
var logo = `
|
|
148
|
-
_ _ _
|
|
149
|
-
/ \\ | | ____ _ _ __ (_)___
|
|
150
|
-
/ _ \\ | |/ / _' | '_ \\ | / __|
|
|
151
|
-
/ ___ \\| < (_| | | | |_ | \\__ \\
|
|
152
|
-
/_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
|
|
153
|
-
|__/ ver ${version}
|
|
154
|
-
? See more details on docs https://www.akanjs.com/docs
|
|
155
|
-
\u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
|
|
156
|
-
|
|
157
|
-
`;
|
|
158
|
-
|
|
159
|
-
// pkgs/@akanjs/base/src/baseEnv.ts
|
|
160
|
-
var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
|
|
161
|
-
var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
|
|
162
|
-
var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
|
|
163
|
-
if (appName === "unknown")
|
|
164
|
-
throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
|
|
165
|
-
if (repoName === "unknown")
|
|
166
|
-
throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
|
|
167
|
-
if (serveDomain === "unknown")
|
|
168
|
-
throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
|
|
169
|
-
var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
170
|
-
var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
|
|
171
|
-
var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
|
|
172
|
-
var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
|
|
173
|
-
var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
|
|
174
|
-
var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
|
|
175
|
-
var baseEnv = {
|
|
176
|
-
repoName,
|
|
177
|
-
serveDomain,
|
|
178
|
-
appName,
|
|
179
|
-
environment,
|
|
180
|
-
operationType,
|
|
181
|
-
operationMode,
|
|
182
|
-
networkType,
|
|
183
|
-
tunnelUsername,
|
|
184
|
-
tunnelPassword
|
|
185
|
-
};
|
|
186
|
-
var side = typeof window === "undefined" ? "server" : "client";
|
|
187
|
-
var renderMode = process.env.RENDER_ENV ?? "ssr";
|
|
188
|
-
var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
|
|
189
|
-
var clientPort = parseInt(
|
|
190
|
-
process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
|
|
191
|
-
);
|
|
192
|
-
var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
|
|
193
|
-
var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
|
|
194
|
-
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");
|
|
195
|
-
var serverPort = parseInt(
|
|
196
|
-
process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
|
|
197
|
-
);
|
|
198
|
-
var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
|
|
199
|
-
var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
|
|
200
|
-
var serverGraphqlUri = `${serverHttpUri}/graphql`;
|
|
201
|
-
var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
|
|
202
|
-
var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
|
|
203
|
-
var baseClientEnv = {
|
|
204
|
-
...baseEnv,
|
|
205
|
-
side,
|
|
206
|
-
renderMode,
|
|
207
|
-
websocket: true,
|
|
208
|
-
clientHost,
|
|
209
|
-
clientPort,
|
|
210
|
-
clientHttpProtocol,
|
|
211
|
-
clientHttpUri,
|
|
212
|
-
serverHost,
|
|
213
|
-
serverPort,
|
|
214
|
-
serverHttpProtocol,
|
|
215
|
-
serverHttpUri,
|
|
216
|
-
serverGraphqlUri,
|
|
217
|
-
serverWsProtocol,
|
|
218
|
-
serverWsUri
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// pkgs/@akanjs/base/src/scalar.ts
|
|
222
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
223
|
-
var dayjs = import_dayjs.default;
|
|
224
|
-
var Int = class {
|
|
225
|
-
__Scalar__;
|
|
226
|
-
};
|
|
227
|
-
var Upload = class {
|
|
228
|
-
__Scalar__;
|
|
229
|
-
filename;
|
|
230
|
-
mimetype;
|
|
231
|
-
encoding;
|
|
232
|
-
createReadStream;
|
|
233
|
-
};
|
|
234
|
-
var Float = class {
|
|
235
|
-
__Scalar__;
|
|
236
|
-
};
|
|
237
|
-
var ID = class {
|
|
238
|
-
__Scalar__;
|
|
239
|
-
};
|
|
240
|
-
var JSON2 = class {
|
|
241
|
-
__Scalar__;
|
|
242
|
-
};
|
|
243
|
-
var getNonArrayModel = (arraiedModel2) => {
|
|
244
|
-
let arrDepth = 0;
|
|
245
|
-
let target = arraiedModel2;
|
|
246
|
-
while (Array.isArray(target)) {
|
|
247
|
-
target = target[0];
|
|
248
|
-
arrDepth++;
|
|
249
|
-
}
|
|
250
|
-
return [target, arrDepth];
|
|
251
|
-
};
|
|
252
|
-
var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON2, Map]);
|
|
253
|
-
var scalarNameMap = /* @__PURE__ */ new Map([
|
|
254
|
-
[ID, "ID"],
|
|
255
|
-
[Int, "Int"],
|
|
256
|
-
[Float, "Float"],
|
|
257
|
-
[String, "String"],
|
|
258
|
-
[Boolean, "Boolean"],
|
|
259
|
-
[Date, "Date"],
|
|
260
|
-
[Upload, "Upload"],
|
|
261
|
-
[JSON2, "JSON"],
|
|
262
|
-
[Map, "Map"]
|
|
263
|
-
]);
|
|
264
|
-
var scalarArgMap = /* @__PURE__ */ new Map([
|
|
265
|
-
[ID, null],
|
|
266
|
-
[String, ""],
|
|
267
|
-
[Boolean, false],
|
|
268
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
269
|
-
[Int, 0],
|
|
270
|
-
[Float, 0],
|
|
271
|
-
[JSON2, {}],
|
|
272
|
-
[Map, {}]
|
|
273
|
-
]);
|
|
274
|
-
var scalarDefaultMap = /* @__PURE__ */ new Map([
|
|
275
|
-
[ID, null],
|
|
276
|
-
[String, ""],
|
|
277
|
-
[Boolean, false],
|
|
278
|
-
[Date, dayjs(/* @__PURE__ */ new Date(-1))],
|
|
279
|
-
[Int, 0],
|
|
280
|
-
[Float, 0],
|
|
281
|
-
[JSON2, {}]
|
|
282
|
-
]);
|
|
283
|
-
var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
|
|
284
|
-
var isGqlMap = (modelRef) => modelRef === Map;
|
|
285
|
-
|
|
286
|
-
// pkgs/@akanjs/common/src/isDayjs.ts
|
|
287
|
-
var import_dayjs2 = require("dayjs");
|
|
288
|
-
|
|
289
|
-
// pkgs/@akanjs/common/src/deepObjectify.ts
|
|
290
|
-
var deepObjectify = (obj, option = {}) => {
|
|
291
|
-
if ((0, import_dayjs2.isDayjs)(obj) || obj?.constructor === Date) {
|
|
292
|
-
if (!option.serializable && !option.convertDate)
|
|
293
|
-
return obj;
|
|
294
|
-
if (option.convertDate === "string")
|
|
295
|
-
return obj.toISOString();
|
|
296
|
-
else if (option.convertDate === "number")
|
|
297
|
-
return (0, import_dayjs2.isDayjs)(obj) ? obj.toDate().getTime() : obj.getTime();
|
|
298
|
-
else
|
|
299
|
-
return (0, import_dayjs2.isDayjs)(obj) ? obj.toDate() : obj;
|
|
300
|
-
} else if (Array.isArray(obj)) {
|
|
301
|
-
return obj.map((o) => deepObjectify(o, option));
|
|
302
|
-
} else if (obj && typeof obj === "object") {
|
|
303
|
-
const val = {};
|
|
304
|
-
Object.keys(obj).forEach((key) => {
|
|
305
|
-
const fieldValue = obj[key];
|
|
306
|
-
if (fieldValue?.__ModelType__ && !option.serializable)
|
|
307
|
-
val[key] = fieldValue;
|
|
308
|
-
else if (typeof obj[key] !== "function")
|
|
309
|
-
val[key] = deepObjectify(fieldValue, option);
|
|
310
|
-
});
|
|
311
|
-
return val;
|
|
312
|
-
} else {
|
|
313
|
-
return obj;
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
318
|
-
var import_dayjs3 = __toESM(require("dayjs"));
|
|
319
|
-
var isQueryEqual = (value1, value2) => {
|
|
320
|
-
if (value1 === value2)
|
|
321
|
-
return true;
|
|
322
|
-
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
323
|
-
if (value1.length !== value2.length)
|
|
324
|
-
return false;
|
|
325
|
-
for (let i = 0; i < value1.length; i++)
|
|
326
|
-
if (!isQueryEqual(value1[i], value2[i]))
|
|
327
|
-
return false;
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
if ([value1, value2].some((val) => val instanceof Date || (0, import_dayjs2.isDayjs)(val)))
|
|
331
|
-
return (0, import_dayjs3.default)(value1).isSame((0, import_dayjs3.default)(value2));
|
|
332
|
-
if (typeof value1 === "object" && typeof value2 === "object") {
|
|
333
|
-
if (value1 === null || value2 === null)
|
|
334
|
-
return value1 === value2;
|
|
335
|
-
if (Object.keys(value1).length !== Object.keys(value2).length)
|
|
336
|
-
return false;
|
|
337
|
-
for (const key of Object.keys(value1))
|
|
338
|
-
if (!isQueryEqual(value1[key], value2[key]))
|
|
339
|
-
return false;
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
return false;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
346
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
347
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
348
|
-
import_dayjs4.default.extend(import_customParseFormat.default);
|
|
349
|
-
|
|
350
|
-
// pkgs/@akanjs/common/src/pathSet.ts
|
|
351
|
-
var pathSet = (obj, path, value) => {
|
|
352
|
-
if (Object(obj) !== obj)
|
|
353
|
-
return obj;
|
|
354
|
-
if (!Array.isArray(path))
|
|
355
|
-
path = path.toString().match(/[^.[\]]+/g) || [];
|
|
356
|
-
path.slice(0, -1).reduce(
|
|
357
|
-
(a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {},
|
|
358
|
-
obj
|
|
359
|
-
)[path[path.length - 1]] = value;
|
|
360
|
-
return obj;
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// pkgs/@akanjs/common/src/pluralize.ts
|
|
364
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
365
|
-
|
|
366
|
-
// pkgs/@akanjs/common/src/applyMixins.ts
|
|
367
|
-
var getAllPropertyDescriptors = (objRef) => {
|
|
368
|
-
const descriptors = {};
|
|
369
|
-
let current = objRef.prototype;
|
|
370
|
-
while (current) {
|
|
371
|
-
Object.getOwnPropertyNames(current).forEach((name) => {
|
|
372
|
-
descriptors[name] ??= Object.getOwnPropertyDescriptor(current, name);
|
|
373
|
-
});
|
|
374
|
-
current = Object.getPrototypeOf(current);
|
|
375
|
-
}
|
|
376
|
-
return descriptors;
|
|
377
|
-
};
|
|
378
|
-
var applyMixins = (derivedCtor, constructors, avoidKeys) => {
|
|
379
|
-
constructors.forEach((baseCtor) => {
|
|
380
|
-
Object.entries(getAllPropertyDescriptors(baseCtor)).forEach(([name, descriptor]) => {
|
|
381
|
-
if (name === "constructor" || avoidKeys?.has(name))
|
|
382
|
-
return;
|
|
383
|
-
Object.defineProperty(derivedCtor.prototype, name, { ...descriptor, configurable: true });
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
// pkgs/@akanjs/common/src/capitalize.ts
|
|
389
|
-
var capitalize = (str) => {
|
|
390
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
// pkgs/@akanjs/common/src/Logger.ts
|
|
394
|
-
var import_dayjs5 = __toESM(require("dayjs"));
|
|
395
|
-
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
396
|
-
var clc = {
|
|
397
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
398
|
-
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
399
|
-
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
400
|
-
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
401
|
-
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
402
|
-
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
403
|
-
};
|
|
404
|
-
var colorizeMap = {
|
|
405
|
-
trace: clc.bold,
|
|
406
|
-
verbose: clc.cyanBright,
|
|
407
|
-
debug: clc.magentaBright,
|
|
408
|
-
log: clc.green,
|
|
409
|
-
info: clc.green,
|
|
410
|
-
warn: clc.yellow,
|
|
411
|
-
error: clc.red
|
|
412
|
-
};
|
|
413
|
-
var Logger = class _Logger {
|
|
414
|
-
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
415
|
-
"InstanceLoader",
|
|
416
|
-
"RoutesResolver",
|
|
417
|
-
"RouterExplorer",
|
|
418
|
-
"NestFactory",
|
|
419
|
-
"WebSocketsController",
|
|
420
|
-
"GraphQLModule",
|
|
421
|
-
"NestApplication"
|
|
422
|
-
]);
|
|
423
|
-
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
424
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
425
|
-
static #startAt = (0, import_dayjs5.default)();
|
|
426
|
-
static setLevel(level) {
|
|
427
|
-
this.level = level;
|
|
428
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
429
|
-
}
|
|
430
|
-
name;
|
|
431
|
-
constructor(name) {
|
|
432
|
-
this.name = name;
|
|
433
|
-
}
|
|
434
|
-
trace(msg2, context = "") {
|
|
435
|
-
if (_Logger.#levelIdx <= 0)
|
|
436
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "trace");
|
|
437
|
-
}
|
|
438
|
-
verbose(msg2, context = "") {
|
|
439
|
-
if (_Logger.#levelIdx <= 1)
|
|
440
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "verbose");
|
|
441
|
-
}
|
|
442
|
-
debug(msg2, context = "") {
|
|
443
|
-
if (_Logger.#levelIdx <= 2)
|
|
444
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "debug");
|
|
445
|
-
}
|
|
446
|
-
log(msg2, context = "") {
|
|
447
|
-
if (_Logger.#levelIdx <= 3)
|
|
448
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "log");
|
|
449
|
-
}
|
|
450
|
-
info(msg2, context = "") {
|
|
451
|
-
if (_Logger.#levelIdx <= 4)
|
|
452
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "info");
|
|
453
|
-
}
|
|
454
|
-
warn(msg2, context = "") {
|
|
455
|
-
if (_Logger.#levelIdx <= 5)
|
|
456
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "warn");
|
|
457
|
-
}
|
|
458
|
-
error(msg2, context = "") {
|
|
459
|
-
if (_Logger.#levelIdx <= 6)
|
|
460
|
-
_Logger.#printMessages(this.name ?? "App", msg2, context, "error");
|
|
461
|
-
}
|
|
462
|
-
raw(msg2, method) {
|
|
463
|
-
_Logger.rawLog(msg2, method);
|
|
464
|
-
}
|
|
465
|
-
rawLog(msg2, method) {
|
|
466
|
-
_Logger.rawLog(msg2, method);
|
|
467
|
-
}
|
|
468
|
-
static trace(msg2, context = "") {
|
|
469
|
-
if (_Logger.#levelIdx <= 0)
|
|
470
|
-
_Logger.#printMessages("App", msg2, context, "trace");
|
|
471
|
-
}
|
|
472
|
-
static verbose(msg2, context = "") {
|
|
473
|
-
if (_Logger.#levelIdx <= 1)
|
|
474
|
-
_Logger.#printMessages("App", msg2, context, "verbose");
|
|
475
|
-
}
|
|
476
|
-
static debug(msg2, context = "") {
|
|
477
|
-
if (_Logger.#levelIdx <= 2)
|
|
478
|
-
_Logger.#printMessages("App", msg2, context, "debug");
|
|
479
|
-
}
|
|
480
|
-
static log(msg2, context = "") {
|
|
481
|
-
if (_Logger.#levelIdx <= 3)
|
|
482
|
-
_Logger.#printMessages("App", msg2, context, "log");
|
|
483
|
-
}
|
|
484
|
-
static info(msg2, context = "") {
|
|
485
|
-
if (_Logger.#levelIdx <= 4)
|
|
486
|
-
_Logger.#printMessages("App", msg2, context, "info");
|
|
487
|
-
}
|
|
488
|
-
static warn(msg2, context = "") {
|
|
489
|
-
if (_Logger.#levelIdx <= 5)
|
|
490
|
-
_Logger.#printMessages("App", msg2, context, "warn");
|
|
491
|
-
}
|
|
492
|
-
static error(msg2, context = "") {
|
|
493
|
-
if (_Logger.#levelIdx <= 6)
|
|
494
|
-
_Logger.#printMessages("App", msg2, context, "error");
|
|
495
|
-
}
|
|
496
|
-
static #colorize(msg2, logLevel) {
|
|
497
|
-
return colorizeMap[logLevel](msg2);
|
|
498
|
-
}
|
|
499
|
-
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
500
|
-
if (this.#ignoreCtxSet.has(context))
|
|
501
|
-
return;
|
|
502
|
-
const now = (0, import_dayjs5.default)();
|
|
503
|
-
const processMsg = this.#colorize(
|
|
504
|
-
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
505
|
-
logLevel
|
|
506
|
-
);
|
|
507
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
508
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
509
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
510
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
511
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
512
|
-
if (typeof window === "undefined")
|
|
513
|
-
process[writeStreamType].write(
|
|
514
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
515
|
-
`
|
|
516
|
-
);
|
|
517
|
-
else
|
|
518
|
-
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
519
|
-
`);
|
|
520
|
-
}
|
|
521
|
-
static rawLog(msg2, method) {
|
|
522
|
-
this.raw(`${msg2}
|
|
523
|
-
`, method);
|
|
524
|
-
}
|
|
525
|
-
static raw(msg2, method) {
|
|
526
|
-
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
527
|
-
global.process.stdout.write(msg2);
|
|
528
|
-
else
|
|
529
|
-
console.log(msg2);
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
// pkgs/@akanjs/common/src/lowerlize.ts
|
|
534
|
-
var lowerlize = (str) => {
|
|
535
|
-
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
// pkgs/@akanjs/common/src/sleep.ts
|
|
539
|
-
var sleep = async (ms) => {
|
|
540
|
-
return new Promise((resolve) => {
|
|
541
|
-
setTimeout(() => {
|
|
542
|
-
resolve(true);
|
|
543
|
-
}, ms);
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
// pkgs/@akanjs/constant/src/scalar.ts
|
|
548
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
549
|
-
var scalarExampleMap = /* @__PURE__ */ new Map([
|
|
550
|
-
[ID, "1234567890abcdef12345678"],
|
|
551
|
-
[Int, 0],
|
|
552
|
-
[Float, 0],
|
|
553
|
-
[String, "String"],
|
|
554
|
-
[Boolean, true],
|
|
555
|
-
[Date, (/* @__PURE__ */ new Date()).toISOString()],
|
|
556
|
-
[Upload, "FileUpload"],
|
|
557
|
-
[JSON2, {}],
|
|
558
|
-
[Map, {}]
|
|
559
|
-
]);
|
|
560
|
-
var getClassMeta = (modelRef) => {
|
|
561
|
-
const [target] = getNonArrayModel(modelRef);
|
|
562
|
-
const classMeta = Reflect.getMetadata("class", target.prototype);
|
|
563
|
-
if (!classMeta)
|
|
564
|
-
throw new Error(`No ClassMeta for this target ${target.name}`);
|
|
565
|
-
return classMeta;
|
|
566
|
-
};
|
|
567
|
-
var getFieldMetas = (modelRef) => {
|
|
568
|
-
const [target] = getNonArrayModel(modelRef);
|
|
569
|
-
const metadataMap = Reflect.getMetadata("fields", target.prototype) ?? /* @__PURE__ */ new Map();
|
|
570
|
-
const keySortMap = { id: -1, createdAt: 1, updatedAt: 2, removedAt: 3 };
|
|
571
|
-
return [...metadataMap.values()].sort((a, b) => (keySortMap[a.key] ?? 0) - (keySortMap[b.key] ?? 0));
|
|
572
|
-
};
|
|
573
|
-
var getFieldMetaMapOnPrototype = (prototype) => {
|
|
574
|
-
const metadataMap = Reflect.getMetadata("fields", prototype) ?? /* @__PURE__ */ new Map();
|
|
575
|
-
return new Map(metadataMap);
|
|
576
|
-
};
|
|
577
|
-
var setFieldMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
578
|
-
Reflect.defineMetadata("fields", new Map(metadataMap), prototype);
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// pkgs/@akanjs/constant/src/fieldMeta.ts
|
|
582
|
-
var applyFieldMeta = (modelRef, arrDepth, option, optionArrDepth) => {
|
|
583
|
-
const isArray = arrDepth > 0;
|
|
584
|
-
const isClass = !isGqlScalar(modelRef);
|
|
585
|
-
const isMap = isGqlMap(modelRef);
|
|
586
|
-
const { refName, type } = isClass ? getClassMeta(modelRef) : { refName: "", type: "scalar" };
|
|
587
|
-
const name = isClass ? refName : scalarNameMap.get(modelRef) ?? "Unknown";
|
|
588
|
-
if (isMap && !option.of)
|
|
589
|
-
throw new Error("Map type must have 'of' option");
|
|
590
|
-
return (prototype, key) => {
|
|
591
|
-
const metadata = {
|
|
592
|
-
nullable: option.nullable ?? false,
|
|
593
|
-
ref: option.ref,
|
|
594
|
-
refPath: option.refPath,
|
|
595
|
-
refType: option.refType,
|
|
596
|
-
default: option.default ?? (isArray ? [] : null),
|
|
597
|
-
type: option.type,
|
|
598
|
-
fieldType: option.fieldType ?? "property",
|
|
599
|
-
immutable: option.immutable ?? false,
|
|
600
|
-
min: option.min,
|
|
601
|
-
max: option.max,
|
|
602
|
-
enum: option.enum,
|
|
603
|
-
select: option.select ?? true,
|
|
604
|
-
minlength: option.minlength,
|
|
605
|
-
maxlength: option.maxlength,
|
|
606
|
-
query: option.query,
|
|
607
|
-
accumulate: option.accumulate,
|
|
608
|
-
example: option.example,
|
|
609
|
-
validate: option.validate,
|
|
610
|
-
key,
|
|
611
|
-
name,
|
|
612
|
-
isClass,
|
|
613
|
-
isScalar: type === "scalar",
|
|
614
|
-
modelRef,
|
|
615
|
-
arrDepth,
|
|
616
|
-
isArray,
|
|
617
|
-
optArrDepth: optionArrDepth,
|
|
618
|
-
isMap,
|
|
619
|
-
of: option.of,
|
|
620
|
-
text: option.text
|
|
621
|
-
};
|
|
622
|
-
const metadataMap = getFieldMetaMapOnPrototype(prototype);
|
|
623
|
-
metadataMap.set(key, metadata);
|
|
624
|
-
setFieldMetaMapOnPrototype(prototype, metadataMap);
|
|
625
|
-
};
|
|
626
|
-
};
|
|
627
|
-
var makeField = (customOption) => (returns, fieldOption) => {
|
|
628
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
629
|
-
if (!fieldOption)
|
|
630
|
-
return applyFieldMeta(modelRef, arrDepth, { ...customOption }, arrDepth);
|
|
631
|
-
const [opt, optArrDepth] = getNonArrayModel(fieldOption);
|
|
632
|
-
return applyFieldMeta(modelRef, arrDepth, { ...opt, ...customOption }, optArrDepth);
|
|
633
|
-
};
|
|
634
|
-
var Field = {
|
|
635
|
-
Prop: makeField({ fieldType: "property" }),
|
|
636
|
-
Hidden: makeField({ fieldType: "hidden", nullable: true }),
|
|
637
|
-
Secret: makeField({ fieldType: "hidden", select: false, nullable: true }),
|
|
638
|
-
Resolve: makeField({ fieldType: "resolve" })
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
// pkgs/@akanjs/constant/src/constantDecorator.ts
|
|
642
|
-
var import_reflect_metadata2 = require("reflect-metadata");
|
|
643
|
-
|
|
644
|
-
// pkgs/@akanjs/constant/src/filterMeta.ts
|
|
645
|
-
var setFilterMeta = (filterRef, filterMeta) => {
|
|
646
|
-
const existingFilterMeta = Reflect.getMetadata("filter", filterRef.prototype);
|
|
647
|
-
if (existingFilterMeta)
|
|
648
|
-
Object.assign(filterMeta.sort, existingFilterMeta.sort);
|
|
649
|
-
Reflect.defineMetadata("filter", filterMeta, filterRef.prototype);
|
|
650
|
-
};
|
|
651
|
-
var getFilterKeyMetaMapOnPrototype = (prototype) => {
|
|
652
|
-
const metadataMap = Reflect.getMetadata("filterKey", prototype) ?? /* @__PURE__ */ new Map();
|
|
653
|
-
return new Map(metadataMap);
|
|
654
|
-
};
|
|
655
|
-
var setFilterKeyMetaMapOnPrototype = (prototype, metadataMap) => {
|
|
656
|
-
Reflect.defineMetadata("filterKey", new Map(metadataMap), prototype);
|
|
657
|
-
};
|
|
658
|
-
var applyFilterKeyMeta = (option) => {
|
|
659
|
-
return (prototype, key, descriptor) => {
|
|
660
|
-
const metadata = { key, ...option, descriptor };
|
|
661
|
-
const metadataMap = getFilterKeyMetaMapOnPrototype(prototype);
|
|
662
|
-
metadataMap.set(key, metadata);
|
|
663
|
-
setFilterKeyMetaMapOnPrototype(prototype, metadataMap);
|
|
664
|
-
};
|
|
665
|
-
};
|
|
666
|
-
var makeFilter = (customOption) => (fieldOption) => {
|
|
667
|
-
return applyFilterKeyMeta({ ...customOption, ...fieldOption });
|
|
668
|
-
};
|
|
669
|
-
var getFilterArgMetasOnPrototype = (prototype, key) => {
|
|
670
|
-
const filterArgMetas = Reflect.getMetadata("filterArg", prototype, key) ?? [];
|
|
671
|
-
return filterArgMetas;
|
|
672
|
-
};
|
|
673
|
-
var setFilterArgMetasOnPrototype = (prototype, key, filterArgMetas) => {
|
|
674
|
-
Reflect.defineMetadata("filterArg", filterArgMetas, prototype, key);
|
|
675
|
-
};
|
|
676
|
-
var applyFilterArgMeta = (name, returns, argOption) => {
|
|
677
|
-
return (prototype, key, idx) => {
|
|
678
|
-
const [modelRef, arrDepth] = getNonArrayModel(returns());
|
|
679
|
-
const [opt, optArrDepth] = getNonArrayModel(argOption ?? {});
|
|
680
|
-
const filterArgMeta = { name, ...opt, modelRef, arrDepth, isArray: arrDepth > 0, optArrDepth };
|
|
681
|
-
const filterArgMetas = getFilterArgMetasOnPrototype(prototype, key);
|
|
682
|
-
filterArgMetas[idx] = filterArgMeta;
|
|
683
|
-
setFilterArgMetasOnPrototype(prototype, key, filterArgMetas);
|
|
684
|
-
};
|
|
685
|
-
};
|
|
686
|
-
var Filter = {
|
|
687
|
-
Mongo: makeFilter({ type: "mongo" }),
|
|
688
|
-
// Meili: makeFilter({ fieldType: "hidden", nullable: true }),
|
|
689
|
-
Arg: applyFilterArgMeta
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
// pkgs/@akanjs/constant/src/baseGql.ts
|
|
693
|
-
var import_reflect_metadata3 = require("reflect-metadata");
|
|
694
|
-
var defaultFieldMeta = {
|
|
695
|
-
fieldType: "property",
|
|
696
|
-
immutable: false,
|
|
697
|
-
select: true,
|
|
698
|
-
isClass: false,
|
|
699
|
-
isScalar: true,
|
|
700
|
-
nullable: false,
|
|
701
|
-
isArray: false,
|
|
702
|
-
arrDepth: 0,
|
|
703
|
-
optArrDepth: 0,
|
|
704
|
-
default: null,
|
|
705
|
-
isMap: false
|
|
706
|
-
};
|
|
707
|
-
var idFieldMeta = { ...defaultFieldMeta, key: "id", name: "ID", modelRef: ID };
|
|
708
|
-
var createdAtFieldMeta = { ...defaultFieldMeta, key: "createdAt", name: "Date", modelRef: Date };
|
|
709
|
-
var updatedAtFieldMeta = { ...defaultFieldMeta, key: "updatedAt", name: "Date", modelRef: Date };
|
|
710
|
-
var removedAtFieldMeta = {
|
|
711
|
-
...defaultFieldMeta,
|
|
712
|
-
key: "removedAt",
|
|
713
|
-
name: "Date",
|
|
714
|
-
modelRef: Date,
|
|
715
|
-
nullable: true,
|
|
716
|
-
default: null
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
// pkgs/@akanjs/constant/src/classMeta.ts
|
|
720
|
-
var import_reflect_metadata4 = require("reflect-metadata");
|
|
721
|
-
var InputModelStorage = class {
|
|
722
|
-
};
|
|
723
|
-
var LightModelStorage = class {
|
|
724
|
-
};
|
|
725
|
-
var FullModelStorage = class {
|
|
726
|
-
};
|
|
727
|
-
var ScalarModelStorage = class {
|
|
728
|
-
};
|
|
729
|
-
var FilterModelStorage = class {
|
|
730
|
-
};
|
|
731
|
-
var getFullModelRef = (refName) => {
|
|
732
|
-
const modelRef = Reflect.getMetadata(capitalize(refName), FullModelStorage.prototype);
|
|
733
|
-
if (!modelRef)
|
|
734
|
-
throw new Error(`FullModel not found - ${refName}`);
|
|
735
|
-
return modelRef;
|
|
736
|
-
};
|
|
737
|
-
var hasTextField = (modelRef) => {
|
|
738
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
739
|
-
return fieldMetas.some(
|
|
740
|
-
(fieldMeta) => !!fieldMeta.text || fieldMeta.isScalar && fieldMeta.isClass && fieldMeta.select && hasTextField(fieldMeta.modelRef)
|
|
741
|
-
);
|
|
742
|
-
};
|
|
743
|
-
var applyClassMeta = (type, modelType, storage) => {
|
|
744
|
-
return function(refName) {
|
|
745
|
-
return function(target) {
|
|
746
|
-
const modelRef = target;
|
|
747
|
-
const classMeta = { refName, type, modelType, modelRef, hasTextField: hasTextField(modelRef) };
|
|
748
|
-
Reflect.defineMetadata("class", classMeta, modelRef.prototype);
|
|
749
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
};
|
|
753
|
-
var applyFilterMeta = (storage) => {
|
|
754
|
-
return function(refName) {
|
|
755
|
-
return function(target) {
|
|
756
|
-
const modelRef = target;
|
|
757
|
-
setFilterMeta(modelRef, { refName, sort: {} });
|
|
758
|
-
Reflect.defineMetadata(refName, modelRef, storage.prototype);
|
|
759
|
-
};
|
|
760
|
-
};
|
|
761
|
-
};
|
|
762
|
-
var Model = {
|
|
763
|
-
Light: applyClassMeta("light", "data", LightModelStorage),
|
|
764
|
-
Object: applyClassMeta("full", "ephemeral", FullModelStorage),
|
|
765
|
-
Full: applyClassMeta("full", "data", FullModelStorage),
|
|
766
|
-
Input: applyClassMeta("input", "data", InputModelStorage),
|
|
767
|
-
Scalar: applyClassMeta("scalar", "data", ScalarModelStorage),
|
|
768
|
-
Summary: applyClassMeta("scalar", "summary", ScalarModelStorage),
|
|
769
|
-
Insight: applyClassMeta("scalar", "insight", ScalarModelStorage),
|
|
770
|
-
Filter: applyFilterMeta(FilterModelStorage)
|
|
771
|
-
};
|
|
772
|
-
var getLightModelRef = (modelRef) => {
|
|
773
|
-
const classMeta = getClassMeta(modelRef);
|
|
774
|
-
if (classMeta.type !== "full")
|
|
775
|
-
return modelRef;
|
|
776
|
-
const lightModelRef = Reflect.getMetadata(`Light${classMeta.refName}`, LightModelStorage.prototype);
|
|
777
|
-
if (!lightModelRef)
|
|
778
|
-
throw new Error(`LightModel not found - ${classMeta.refName}`);
|
|
779
|
-
return lightModelRef;
|
|
780
|
-
};
|
|
781
|
-
|
|
782
|
-
// pkgs/@akanjs/signal/src/client.ts
|
|
783
|
-
var import_core = require("@urql/core");
|
|
784
|
-
var import_socket = require("socket.io-client");
|
|
785
|
-
var SocketIo = class {
|
|
786
|
-
socket;
|
|
787
|
-
roomSubscribeMap = /* @__PURE__ */ new Map();
|
|
788
|
-
constructor(uri) {
|
|
789
|
-
this.socket = (0, import_socket.io)(uri, { transports: ["websocket"] });
|
|
790
|
-
this.socket.on("connect", () => {
|
|
791
|
-
this.roomSubscribeMap.forEach((option) => {
|
|
792
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: true });
|
|
793
|
-
});
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
on(event, callback) {
|
|
797
|
-
this.socket.on(event, callback);
|
|
798
|
-
}
|
|
799
|
-
removeListener(event, callback) {
|
|
800
|
-
this.socket.removeListener(event, callback);
|
|
801
|
-
}
|
|
802
|
-
removeAllListeners() {
|
|
803
|
-
this.socket.removeAllListeners();
|
|
804
|
-
}
|
|
805
|
-
hasListeners(event) {
|
|
806
|
-
return this.socket.hasListeners(event);
|
|
807
|
-
}
|
|
808
|
-
emit(key, data) {
|
|
809
|
-
this.socket.emit(key, data);
|
|
810
|
-
}
|
|
811
|
-
subscribe(option) {
|
|
812
|
-
if (!this.roomSubscribeMap.has(option.roomId)) {
|
|
813
|
-
this.roomSubscribeMap.set(option.roomId, option);
|
|
814
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: true });
|
|
815
|
-
}
|
|
816
|
-
this.socket.on(option.roomId, option.handleEvent);
|
|
817
|
-
}
|
|
818
|
-
unsubscribe(roomId, handleEvent) {
|
|
819
|
-
this.socket.removeListener(roomId, handleEvent);
|
|
820
|
-
const option = this.roomSubscribeMap.get(roomId);
|
|
821
|
-
if (this.hasListeners(roomId) || !option)
|
|
822
|
-
return;
|
|
823
|
-
this.roomSubscribeMap.delete(roomId);
|
|
824
|
-
this.socket.emit(option.key, { ...option.message, __subscribe__: false });
|
|
825
|
-
}
|
|
826
|
-
disconnect() {
|
|
827
|
-
this.socket.disconnect();
|
|
828
|
-
return this;
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
var Client = class _Client {
|
|
832
|
-
static globalIoMap = /* @__PURE__ */ new Map();
|
|
833
|
-
static tokenStore = /* @__PURE__ */ new Map();
|
|
834
|
-
async waitUntilWebSocketConnected(ws = baseClientEnv.serverWsUri) {
|
|
835
|
-
if (baseClientEnv.side === "server")
|
|
836
|
-
return true;
|
|
837
|
-
while (!this.getIo(ws).socket.connected) {
|
|
838
|
-
Logger.verbose("waiting for websocket to initialize...");
|
|
839
|
-
await sleep(300);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
isInitialized = false;
|
|
843
|
-
uri = baseClientEnv.serverGraphqlUri;
|
|
844
|
-
ws = baseClientEnv.serverWsUri;
|
|
845
|
-
udp = null;
|
|
846
|
-
gql = (0, import_core.createClient)({ url: this.uri, fetch, exchanges: [import_core.cacheExchange, import_core.fetchExchange] });
|
|
847
|
-
jwt = null;
|
|
848
|
-
async getJwt() {
|
|
849
|
-
const isNextServer = baseClientEnv.side === "server" && baseEnv.operationType === "client";
|
|
850
|
-
if (isNextServer) {
|
|
851
|
-
const nextHeaders = require("next/headers");
|
|
852
|
-
return (await nextHeaders.cookies?.())?.get("jwt")?.value ?? (await nextHeaders.headers?.())?.get("jwt") ?? this.jwt ?? null;
|
|
853
|
-
} else
|
|
854
|
-
return _Client.tokenStore.get(this) ?? null;
|
|
855
|
-
}
|
|
856
|
-
io = null;
|
|
857
|
-
init(data = {}) {
|
|
858
|
-
Object.assign(this, data);
|
|
859
|
-
this.setLink(data.uri);
|
|
860
|
-
this.setIo(data.ws);
|
|
861
|
-
this.isInitialized = true;
|
|
862
|
-
}
|
|
863
|
-
setIo(ws = baseClientEnv.serverWsUri) {
|
|
864
|
-
this.ws = ws;
|
|
865
|
-
const existingIo = _Client.globalIoMap.get(ws);
|
|
866
|
-
if (existingIo) {
|
|
867
|
-
this.io = existingIo;
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
870
|
-
this.io = new SocketIo(ws);
|
|
871
|
-
_Client.globalIoMap.set(ws, this.io);
|
|
872
|
-
}
|
|
873
|
-
getIo(ws = baseClientEnv.serverWsUri) {
|
|
874
|
-
const existingIo = _Client.globalIoMap.get(ws);
|
|
875
|
-
if (existingIo)
|
|
876
|
-
return existingIo;
|
|
877
|
-
const io2 = new SocketIo(ws);
|
|
878
|
-
_Client.globalIoMap.set(ws, io2);
|
|
879
|
-
return io2;
|
|
880
|
-
}
|
|
881
|
-
setLink(uri = baseClientEnv.serverGraphqlUri) {
|
|
882
|
-
this.uri = uri;
|
|
883
|
-
this.gql = (0, import_core.createClient)({
|
|
884
|
-
url: this.uri,
|
|
885
|
-
fetch,
|
|
886
|
-
exchanges: [import_core.cacheExchange, import_core.fetchExchange],
|
|
887
|
-
// requestPolicy: "network-only",
|
|
888
|
-
fetchOptions: () => {
|
|
889
|
-
return {
|
|
890
|
-
headers: {
|
|
891
|
-
"apollo-require-preflight": "true",
|
|
892
|
-
...this.jwt ? { authorization: `Bearer ${this.jwt}` } : {}
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
}
|
|
898
|
-
setJwt(jwt) {
|
|
899
|
-
_Client.tokenStore.set(this, jwt);
|
|
900
|
-
}
|
|
901
|
-
reset() {
|
|
902
|
-
this.io?.disconnect();
|
|
903
|
-
this.io = null;
|
|
904
|
-
this.jwt = null;
|
|
905
|
-
}
|
|
906
|
-
clone(data = {}) {
|
|
907
|
-
const newClient = new _Client();
|
|
908
|
-
newClient.init({ ...this, ...data });
|
|
909
|
-
if (data.jwt)
|
|
910
|
-
_Client.tokenStore.set(newClient, data.jwt);
|
|
911
|
-
return newClient;
|
|
912
|
-
}
|
|
913
|
-
terminate() {
|
|
914
|
-
this.reset();
|
|
915
|
-
_Client.globalIoMap.forEach((io2) => io2.disconnect());
|
|
916
|
-
this.isInitialized = false;
|
|
917
|
-
}
|
|
918
|
-
setUdp(udp) {
|
|
919
|
-
this.udp = udp;
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
var client = new Client();
|
|
923
|
-
|
|
924
|
-
// pkgs/@akanjs/signal/src/immerify.ts
|
|
925
|
-
var import_immer = require("immer");
|
|
926
|
-
var immerify = (modelRef, objOrArr) => {
|
|
927
|
-
if (Array.isArray(objOrArr))
|
|
928
|
-
return objOrArr.map((val) => immerify(modelRef, val));
|
|
929
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
930
|
-
const immeredObj = Object.assign({}, objOrArr, { [import_immer.immerable]: true });
|
|
931
|
-
fieldMetas.forEach((fieldMeta) => {
|
|
932
|
-
if (fieldMeta.isScalar && fieldMeta.isClass && !!objOrArr[fieldMeta.key])
|
|
933
|
-
immeredObj[fieldMeta.key] = immerify(fieldMeta.modelRef, objOrArr[fieldMeta.key]);
|
|
934
|
-
});
|
|
935
|
-
return immeredObj;
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
// pkgs/@akanjs/signal/src/signalDecorators.ts
|
|
939
|
-
var import_reflect_metadata5 = require("reflect-metadata");
|
|
940
|
-
var createArgMetaDecorator = (type) => {
|
|
941
|
-
return function(option = {}) {
|
|
942
|
-
return function(prototype, key, idx) {
|
|
943
|
-
const argMetas = getArgMetasOnPrototype(prototype, key);
|
|
944
|
-
argMetas[idx] = { key, idx, type, option };
|
|
945
|
-
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
946
|
-
};
|
|
947
|
-
};
|
|
948
|
-
};
|
|
949
|
-
var Account = createArgMetaDecorator("Account");
|
|
950
|
-
var defaultAccount = {
|
|
951
|
-
__InternalArg__: "Account",
|
|
952
|
-
appName: baseEnv.appName,
|
|
953
|
-
environment: baseEnv.environment
|
|
954
|
-
};
|
|
955
|
-
var Self = createArgMetaDecorator("Self");
|
|
956
|
-
var Me = createArgMetaDecorator("Me");
|
|
957
|
-
var UserIp = createArgMetaDecorator("UserIp");
|
|
958
|
-
var Access = createArgMetaDecorator("Access");
|
|
959
|
-
var Req = createArgMetaDecorator("Req");
|
|
960
|
-
var Res = createArgMetaDecorator("Res");
|
|
961
|
-
var Ws = createArgMetaDecorator("Ws");
|
|
962
|
-
var Job = createArgMetaDecorator("Job");
|
|
963
|
-
var getQuery = (allow) => function(returns, signalOption = {}, guards = []) {
|
|
964
|
-
return (prototype, key, descriptor) => {
|
|
965
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
966
|
-
metadataMap.set(key, {
|
|
967
|
-
returns,
|
|
968
|
-
signalOption,
|
|
969
|
-
key,
|
|
970
|
-
descriptor,
|
|
971
|
-
guards: [allow, ...guards],
|
|
972
|
-
type: "Query"
|
|
973
|
-
});
|
|
974
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
975
|
-
};
|
|
976
|
-
};
|
|
977
|
-
var getMutation = (allow) => function(returns, signalOption = {}, guards = []) {
|
|
978
|
-
return (prototype, key, descriptor) => {
|
|
979
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
980
|
-
metadataMap.set(key, {
|
|
981
|
-
returns,
|
|
982
|
-
signalOption,
|
|
983
|
-
key,
|
|
984
|
-
descriptor,
|
|
985
|
-
guards: [allow, ...guards],
|
|
986
|
-
type: "Mutation"
|
|
987
|
-
});
|
|
988
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
989
|
-
};
|
|
990
|
-
};
|
|
991
|
-
var getMessage = (allow) => function(returns, signalOption = {}, guards = []) {
|
|
992
|
-
return (prototype, key, descriptor) => {
|
|
993
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
994
|
-
metadataMap.set(key, {
|
|
995
|
-
returns,
|
|
996
|
-
signalOption,
|
|
997
|
-
key,
|
|
998
|
-
descriptor,
|
|
999
|
-
guards: [allow, ...guards],
|
|
1000
|
-
type: "Message"
|
|
1001
|
-
});
|
|
1002
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
1003
|
-
};
|
|
1004
|
-
};
|
|
1005
|
-
var getPubsub = (allow) => function(returns, signalOption = {}, guards = []) {
|
|
1006
|
-
return (prototype, key, descriptor) => {
|
|
1007
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
1008
|
-
metadataMap.set(key, {
|
|
1009
|
-
returns,
|
|
1010
|
-
signalOption,
|
|
1011
|
-
key,
|
|
1012
|
-
descriptor,
|
|
1013
|
-
guards: [allow, ...guards],
|
|
1014
|
-
type: "Pubsub"
|
|
1015
|
-
});
|
|
1016
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
1017
|
-
};
|
|
1018
|
-
};
|
|
1019
|
-
var getProcess = (serverType) => function(returns, signalOption = {}) {
|
|
1020
|
-
return (prototype, key, descriptor) => {
|
|
1021
|
-
const metadataMap = getGqlMetaMapOnPrototype(prototype);
|
|
1022
|
-
metadataMap.set(key, {
|
|
1023
|
-
returns,
|
|
1024
|
-
signalOption: { ...signalOption, serverType: lowerlize(serverType) },
|
|
1025
|
-
key,
|
|
1026
|
-
descriptor,
|
|
1027
|
-
guards: ["None"],
|
|
1028
|
-
type: "Process"
|
|
1029
|
-
});
|
|
1030
|
-
setGqlMetaMapOnPrototype(prototype, metadataMap);
|
|
1031
|
-
};
|
|
1032
|
-
};
|
|
1033
|
-
var Query = {
|
|
1034
|
-
Public: getQuery("Public"),
|
|
1035
|
-
Every: getQuery("Every"),
|
|
1036
|
-
Admin: getQuery("Admin"),
|
|
1037
|
-
User: getQuery("User"),
|
|
1038
|
-
SuperAdmin: getQuery("SuperAdmin"),
|
|
1039
|
-
None: getQuery("None"),
|
|
1040
|
-
Owner: getQuery("Owner")
|
|
1041
|
-
};
|
|
1042
|
-
var Mutation = {
|
|
1043
|
-
Public: getMutation("Public"),
|
|
1044
|
-
Every: getMutation("Every"),
|
|
1045
|
-
Admin: getMutation("Admin"),
|
|
1046
|
-
User: getMutation("User"),
|
|
1047
|
-
SuperAdmin: getMutation("SuperAdmin"),
|
|
1048
|
-
None: getMutation("None"),
|
|
1049
|
-
Owner: getMutation("Owner")
|
|
1050
|
-
};
|
|
1051
|
-
var Message = {
|
|
1052
|
-
Public: getMessage("Public"),
|
|
1053
|
-
Every: getMessage("Every"),
|
|
1054
|
-
Admin: getMessage("Admin"),
|
|
1055
|
-
User: getMessage("User"),
|
|
1056
|
-
SuperAdmin: getMessage("SuperAdmin"),
|
|
1057
|
-
None: getMessage("None"),
|
|
1058
|
-
Owner: getMessage("Owner")
|
|
1059
|
-
};
|
|
1060
|
-
var Pubsub = {
|
|
1061
|
-
Public: getPubsub("Public"),
|
|
1062
|
-
Every: getPubsub("Every"),
|
|
1063
|
-
Admin: getPubsub("Admin"),
|
|
1064
|
-
User: getPubsub("User"),
|
|
1065
|
-
SuperAdmin: getPubsub("SuperAdmin"),
|
|
1066
|
-
None: getPubsub("None"),
|
|
1067
|
-
Owner: getPubsub("Owner")
|
|
1068
|
-
};
|
|
1069
|
-
var Process = {
|
|
1070
|
-
Federation: getProcess("Federation"),
|
|
1071
|
-
Batch: getProcess("Batch"),
|
|
1072
|
-
All: getProcess("All")
|
|
1073
|
-
};
|
|
1074
|
-
var getArg = (type) => function(name, returns, argsOption = {}) {
|
|
1075
|
-
return function(prototype, key, idx) {
|
|
1076
|
-
const argMetas = getArgMetasOnPrototype(prototype, key);
|
|
1077
|
-
argMetas[idx] = { name, returns, argsOption, key, idx, type };
|
|
1078
|
-
setArgMetasOnPrototype(prototype, key, argMetas);
|
|
1079
|
-
};
|
|
1080
|
-
};
|
|
1081
|
-
var Arg = {
|
|
1082
|
-
Body: getArg("Body"),
|
|
1083
|
-
Param: getArg("Param"),
|
|
1084
|
-
Query: getArg("Query"),
|
|
1085
|
-
Upload: getArg("Upload"),
|
|
1086
|
-
Msg: getArg("Msg"),
|
|
1087
|
-
Room: getArg("Room")
|
|
1088
|
-
};
|
|
1089
|
-
var getGqlMetaMapOnPrototype = (prototype) => {
|
|
1090
|
-
const gqlMetaMap = Reflect.getMetadata("gql", prototype);
|
|
1091
|
-
return gqlMetaMap ?? /* @__PURE__ */ new Map();
|
|
1092
|
-
};
|
|
1093
|
-
var setGqlMetaMapOnPrototype = (prototype, gqlMetaMap) => {
|
|
1094
|
-
Reflect.defineMetadata("gql", gqlMetaMap, prototype);
|
|
1095
|
-
};
|
|
1096
|
-
var getArgMetasOnPrototype = (prototype, key) => {
|
|
1097
|
-
return Reflect.getMetadata("args", prototype, key) ?? [];
|
|
1098
|
-
};
|
|
1099
|
-
var setArgMetasOnPrototype = (prototype, key, argMetas) => {
|
|
1100
|
-
Reflect.defineMetadata("args", argMetas, prototype, key);
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
// pkgs/@akanjs/signal/src/gql.ts
|
|
1104
|
-
var GqlStorage = class {
|
|
1105
|
-
};
|
|
1106
|
-
var getGqlOnStorage = (refName) => {
|
|
1107
|
-
const modelGql = Reflect.getMetadata(refName, GqlStorage.prototype);
|
|
1108
|
-
if (!modelGql)
|
|
1109
|
-
throw new Error("Gql is not defined");
|
|
1110
|
-
return modelGql;
|
|
1111
|
-
};
|
|
1112
|
-
|
|
1113
|
-
// pkgs/@akanjs/signal/src/baseFetch.ts
|
|
1114
|
-
var nativeFetch = fetch;
|
|
1115
|
-
var baseFetch = Object.assign(nativeFetch, {
|
|
1116
|
-
client,
|
|
1117
|
-
clone: function(option = {}) {
|
|
1118
|
-
return {
|
|
1119
|
-
...this,
|
|
1120
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
1121
|
-
client: this.client.clone(option)
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
// pkgs/@akanjs/dictionary/src/trans.ts
|
|
1127
|
-
var msg = {
|
|
1128
|
-
info: () => null,
|
|
1129
|
-
success: () => null,
|
|
1130
|
-
error: () => null,
|
|
1131
|
-
warning: () => null,
|
|
1132
|
-
loading: () => null
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
35
|
// pkgs/@akanjs/store/src/storeDecorators.ts
|
|
36
|
+
var import_base = require("@akanjs/base");
|
|
37
|
+
var import_common = require("@akanjs/common");
|
|
38
|
+
var import_constant = require("@akanjs/constant");
|
|
39
|
+
var import_dictionary = require("@akanjs/dictionary");
|
|
40
|
+
var import_signal = require("@akanjs/signal");
|
|
1136
41
|
var import_react = require("react");
|
|
1137
42
|
var import_zustand = require("zustand");
|
|
1138
43
|
var import_middleware = require("zustand/middleware");
|
|
1139
|
-
var
|
|
44
|
+
var import_immer = require("zustand/middleware/immer");
|
|
1140
45
|
var st = {};
|
|
1141
46
|
var StoreStorage = class {
|
|
1142
47
|
};
|
|
@@ -1156,7 +61,7 @@ var getStoreNames = () => {
|
|
|
1156
61
|
return storeNames;
|
|
1157
62
|
};
|
|
1158
63
|
var createState = (gql) => {
|
|
1159
|
-
const [fieldName, className] = [lowerlize(gql.refName), capitalize(gql.refName)];
|
|
64
|
+
const [fieldName, className] = [(0, import_common.lowerlize)(gql.refName), (0, import_common.capitalize)(gql.refName)];
|
|
1160
65
|
const names = {
|
|
1161
66
|
model: fieldName,
|
|
1162
67
|
Model: className,
|
|
@@ -1192,7 +97,7 @@ var createState = (gql) => {
|
|
|
1192
97
|
[names.modelOperation]: "sleep"
|
|
1193
98
|
};
|
|
1194
99
|
const sliceState = gql.slices.reduce((acc, { sliceName, defaultArgs }) => {
|
|
1195
|
-
const SliceName = capitalize(sliceName);
|
|
100
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1196
101
|
const namesOfSlice = {
|
|
1197
102
|
defaultModel: SliceName.replace(names.Model, names.defaultModel),
|
|
1198
103
|
//clusterInSelf Cluster
|
|
@@ -1210,11 +115,11 @@ var createState = (gql) => {
|
|
|
1210
115
|
};
|
|
1211
116
|
const singleSliceState = {
|
|
1212
117
|
[namesOfSlice.defaultModel]: { ...gql[names.defaultModel] },
|
|
1213
|
-
[namesOfSlice.modelList]: new DataList(),
|
|
118
|
+
[namesOfSlice.modelList]: new import_base.DataList(),
|
|
1214
119
|
[namesOfSlice.modelListLoading]: true,
|
|
1215
|
-
[namesOfSlice.modelInitList]: new DataList(),
|
|
120
|
+
[namesOfSlice.modelInitList]: new import_base.DataList(),
|
|
1216
121
|
[namesOfSlice.modelInitAt]: /* @__PURE__ */ new Date(0),
|
|
1217
|
-
[namesOfSlice.modelSelection]: new DataList(),
|
|
122
|
+
[namesOfSlice.modelSelection]: new import_base.DataList(),
|
|
1218
123
|
[namesOfSlice.modelInsight]: gql[names.defaultModelInsight],
|
|
1219
124
|
[namesOfSlice.lastPageOfModel]: 1,
|
|
1220
125
|
[namesOfSlice.pageOfModel]: 1,
|
|
@@ -1232,10 +137,10 @@ var createActions = (gql) => {
|
|
|
1232
137
|
return { ...formSetterActions, ...baseActions };
|
|
1233
138
|
};
|
|
1234
139
|
var makeFormSetter = (gql) => {
|
|
1235
|
-
const fileGql = getGqlOnStorage("file");
|
|
1236
|
-
const [fieldName, className] = [lowerlize(gql.refName), capitalize(gql.refName)];
|
|
1237
|
-
const modelRef = getFullModelRef(gql.refName);
|
|
1238
|
-
const fieldMetas = getFieldMetas(modelRef);
|
|
140
|
+
const fileGql = (0, import_signal.getGqlOnStorage)("file");
|
|
141
|
+
const [fieldName, className] = [(0, import_common.lowerlize)(gql.refName), (0, import_common.capitalize)(gql.refName)];
|
|
142
|
+
const modelRef = (0, import_constant.getFullModelRef)(gql.refName);
|
|
143
|
+
const fieldMetas = (0, import_constant.getFieldMetas)(modelRef);
|
|
1239
144
|
const names = {
|
|
1240
145
|
model: fieldName,
|
|
1241
146
|
Model: className,
|
|
@@ -1246,12 +151,12 @@ var makeFormSetter = (gql) => {
|
|
|
1246
151
|
const baseSetAction = {
|
|
1247
152
|
[names.writeOnModel]: function(path, value) {
|
|
1248
153
|
this.set((state) => {
|
|
1249
|
-
pathSet(state[names.modelForm], path, value);
|
|
154
|
+
(0, import_common.pathSet)(state[names.modelForm], path, value);
|
|
1250
155
|
});
|
|
1251
156
|
}
|
|
1252
157
|
};
|
|
1253
158
|
const fieldSetAction = fieldMetas.reduce((acc, fieldMeta) => {
|
|
1254
|
-
const [fieldKeyName, classKeyName] = [lowerlize(fieldMeta.key), capitalize(fieldMeta.key)];
|
|
159
|
+
const [fieldKeyName, classKeyName] = [(0, import_common.lowerlize)(fieldMeta.key), (0, import_common.capitalize)(fieldMeta.key)];
|
|
1255
160
|
const namesOfField = {
|
|
1256
161
|
field: fieldKeyName,
|
|
1257
162
|
Field: classKeyName,
|
|
@@ -1264,7 +169,7 @@ var makeFormSetter = (gql) => {
|
|
|
1264
169
|
const singleFieldSetAction = {
|
|
1265
170
|
[namesOfField.setFieldOnModel]: function(value) {
|
|
1266
171
|
this.set((state) => {
|
|
1267
|
-
const setValue = fieldMeta.isClass ? immerify(fieldMeta.modelRef, value) : value;
|
|
172
|
+
const setValue = fieldMeta.isClass ? (0, import_signal.immerify)(fieldMeta.modelRef, value) : value;
|
|
1268
173
|
state[names.modelForm][namesOfField.field] = setValue;
|
|
1269
174
|
});
|
|
1270
175
|
},
|
|
@@ -1275,7 +180,7 @@ var makeFormSetter = (gql) => {
|
|
|
1275
180
|
if (options.limit && options.limit <= length)
|
|
1276
181
|
return;
|
|
1277
182
|
const idx = options.idx ?? length;
|
|
1278
|
-
const setValue = fieldMeta.isClass ? immerify(fieldMeta.modelRef, value) : value;
|
|
183
|
+
const setValue = fieldMeta.isClass ? (0, import_signal.immerify)(fieldMeta.modelRef, value) : value;
|
|
1279
184
|
this.set((state) => {
|
|
1280
185
|
state[names.modelForm][namesOfField.field] = [
|
|
1281
186
|
...form[namesOfField.field].slice(0, idx),
|
|
@@ -1349,9 +254,9 @@ var makeFormSetter = (gql) => {
|
|
|
1349
254
|
return Object.assign(fieldSetAction, baseSetAction);
|
|
1350
255
|
};
|
|
1351
256
|
var makeActions = (gql) => {
|
|
1352
|
-
const [fieldName, className] = [lowerlize(gql.refName), capitalize(gql.refName)];
|
|
1353
|
-
const modelRef = getFullModelRef(className);
|
|
1354
|
-
const lightModelRef = getLightModelRef(modelRef);
|
|
257
|
+
const [fieldName, className] = [(0, import_common.lowerlize)(gql.refName), (0, import_common.capitalize)(gql.refName)];
|
|
258
|
+
const modelRef = (0, import_constant.getFullModelRef)(className);
|
|
259
|
+
const lightModelRef = (0, import_constant.getLightModelRef)(modelRef);
|
|
1355
260
|
const names = {
|
|
1356
261
|
model: fieldName,
|
|
1357
262
|
_model: `_${fieldName}`,
|
|
@@ -1403,7 +308,7 @@ var makeActions = (gql) => {
|
|
|
1403
308
|
};
|
|
1404
309
|
const baseAction = {
|
|
1405
310
|
[names.createModelInForm]: async function({ idx, path, modal, sliceName = names.model, onError, onSuccess } = {}) {
|
|
1406
|
-
const SliceName = capitalize(sliceName);
|
|
311
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1407
312
|
const namesOfSlice = {
|
|
1408
313
|
defaultModel: SliceName.replace(names.Model, names.defaultModel),
|
|
1409
314
|
modelList: sliceName.replace(names.model, names.modelList),
|
|
@@ -1421,13 +326,13 @@ var makeActions = (gql) => {
|
|
|
1421
326
|
return;
|
|
1422
327
|
this.set({ [names.modelLoading]: true });
|
|
1423
328
|
const model = await gql[names.createModel](modelInput, { onError });
|
|
1424
|
-
const newModelList = modelListLoading ? modelList : new DataList([...modelList.slice(0, idx ?? 0), model, ...modelList.slice(idx ?? 0)]);
|
|
329
|
+
const newModelList = modelListLoading ? modelList : new import_base.DataList([...modelList.slice(0, idx ?? 0), model, ...modelList.slice(idx ?? 0)]);
|
|
1425
330
|
const newModelInsight = gql[names.crystalizeInsight]({
|
|
1426
331
|
...modelInsight,
|
|
1427
332
|
count: modelInsight.count + 1
|
|
1428
333
|
});
|
|
1429
334
|
this.set({
|
|
1430
|
-
[names.modelForm]: immerify(modelRef, defaultModel),
|
|
335
|
+
[names.modelForm]: (0, import_signal.immerify)(modelRef, defaultModel),
|
|
1431
336
|
[names.model]: model,
|
|
1432
337
|
[names.modelLoading]: false,
|
|
1433
338
|
[namesOfSlice.modelList]: newModelList,
|
|
@@ -1439,7 +344,7 @@ var makeActions = (gql) => {
|
|
|
1439
344
|
await onSuccess?.(model);
|
|
1440
345
|
},
|
|
1441
346
|
[names.updateModelInForm]: async function({ path, modal, sliceName = names.model, onError, onSuccess } = {}) {
|
|
1442
|
-
const SliceName = capitalize(sliceName);
|
|
347
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1443
348
|
const namesOfSlice = {
|
|
1444
349
|
defaultModel: SliceName.replace(names.Model, names.defaultModel)
|
|
1445
350
|
};
|
|
@@ -1457,7 +362,7 @@ var makeActions = (gql) => {
|
|
|
1457
362
|
});
|
|
1458
363
|
this.set({
|
|
1459
364
|
...model?.id === updatedModel.id ? { [names.model]: updatedModel, [names.modelLoading]: false, [names.modelViewAt]: /* @__PURE__ */ new Date() } : {},
|
|
1460
|
-
[names.modelForm]: immerify(modelRef, defaultModel),
|
|
365
|
+
[names.modelForm]: (0, import_signal.immerify)(modelRef, defaultModel),
|
|
1461
366
|
[names.modelModal]: modal ?? null,
|
|
1462
367
|
...typeof path === "string" && path ? { [path]: updatedModel } : {}
|
|
1463
368
|
});
|
|
@@ -1472,13 +377,13 @@ var makeActions = (gql) => {
|
|
|
1472
377
|
const modelListLoading = currentState2[namesOfSlice2.modelListLoading];
|
|
1473
378
|
if (modelListLoading || !modelList.has(updatedModel.id))
|
|
1474
379
|
return;
|
|
1475
|
-
const newModelList = new DataList(modelList).set(updatedLightModel);
|
|
380
|
+
const newModelList = new import_base.DataList(modelList).set(updatedLightModel);
|
|
1476
381
|
this.set({ [namesOfSlice2.modelList]: newModelList });
|
|
1477
382
|
});
|
|
1478
383
|
await onSuccess?.(updatedModel);
|
|
1479
384
|
},
|
|
1480
385
|
[names.createModel]: async function(data, { idx, path, modal, sliceName = names.model, onError, onSuccess } = {}) {
|
|
1481
|
-
const SliceName = capitalize(sliceName);
|
|
386
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1482
387
|
const namesOfSlice = {
|
|
1483
388
|
defaultModel: SliceName.replace(names.Model, names.defaultModel),
|
|
1484
389
|
modelList: sliceName.replace(names.model, names.modelList),
|
|
@@ -1494,7 +399,7 @@ var makeActions = (gql) => {
|
|
|
1494
399
|
return;
|
|
1495
400
|
this.set({ [names.modelLoading]: true });
|
|
1496
401
|
const model = await gql[names.createModel](modelInput, { onError });
|
|
1497
|
-
const newModelList = modelListLoading ? modelList : new DataList([...modelList.slice(0, idx ?? 0), model, ...modelList.slice(idx ?? 0)]);
|
|
402
|
+
const newModelList = modelListLoading ? modelList : new import_base.DataList([...modelList.slice(0, idx ?? 0), model, ...modelList.slice(idx ?? 0)]);
|
|
1498
403
|
const newModelInsight = gql[names.crystalizeInsight]({
|
|
1499
404
|
...modelInsight,
|
|
1500
405
|
count: modelInsight.count + 1
|
|
@@ -1535,7 +440,7 @@ var makeActions = (gql) => {
|
|
|
1535
440
|
const modelListLoading = currentState2[namesOfSlice.modelListLoading];
|
|
1536
441
|
if (modelListLoading || !modelList.has(updatedModel.id))
|
|
1537
442
|
return;
|
|
1538
|
-
const newModelList = new DataList(modelList).set(updatedLightModel);
|
|
443
|
+
const newModelList = new import_base.DataList(modelList).set(updatedLightModel);
|
|
1539
444
|
this.set({ [namesOfSlice.modelList]: newModelList });
|
|
1540
445
|
});
|
|
1541
446
|
await onSuccess?.(updatedModel);
|
|
@@ -1561,14 +466,14 @@ var makeActions = (gql) => {
|
|
|
1561
466
|
const modelInsight = currentState[namesOfSlice.modelInsight];
|
|
1562
467
|
if (modelListLoading || !modelList.has(model.id))
|
|
1563
468
|
return;
|
|
1564
|
-
const newModelList = new DataList(modelList);
|
|
469
|
+
const newModelList = new import_base.DataList(modelList);
|
|
1565
470
|
if (model.removedAt) {
|
|
1566
471
|
newModelList.delete(id);
|
|
1567
472
|
const newModelInsight = gql[names.crystalizeInsight]({
|
|
1568
473
|
...modelInsight,
|
|
1569
474
|
count: modelInsight.count - 1
|
|
1570
475
|
});
|
|
1571
|
-
const newModelSelection = new DataList(modelSelection);
|
|
476
|
+
const newModelSelection = new import_base.DataList(modelSelection);
|
|
1572
477
|
newModelSelection.delete(id);
|
|
1573
478
|
this.set({
|
|
1574
479
|
[namesOfSlice.modelList]: newModelList,
|
|
@@ -1604,15 +509,15 @@ var makeActions = (gql) => {
|
|
|
1604
509
|
this.set({ [names.modelSubmit]: { ...modelSubmit, loading: false, times: modelSubmit.times + 1 } });
|
|
1605
510
|
},
|
|
1606
511
|
[names.newModel]: function(partial = {}, { modal, setDefault, sliceName = names.model } = {}) {
|
|
1607
|
-
const SliceName = capitalize(sliceName);
|
|
512
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1608
513
|
const namesOfSlice = {
|
|
1609
514
|
defaultModel: SliceName.replace(names.Model, names.defaultModel)
|
|
1610
515
|
};
|
|
1611
516
|
const currentState = this.get();
|
|
1612
517
|
const defaultModel = currentState[namesOfSlice.defaultModel];
|
|
1613
518
|
this.set({
|
|
1614
|
-
[names.modelForm]: immerify(modelRef, { ...defaultModel, ...partial }),
|
|
1615
|
-
[namesOfSlice.defaultModel]: setDefault ? immerify(modelRef, { ...defaultModel, ...partial }) : defaultModel,
|
|
519
|
+
[names.modelForm]: (0, import_signal.immerify)(modelRef, { ...defaultModel, ...partial }),
|
|
520
|
+
[namesOfSlice.defaultModel]: setDefault ? (0, import_signal.immerify)(modelRef, { ...defaultModel, ...partial }) : defaultModel,
|
|
1616
521
|
[names.model]: null,
|
|
1617
522
|
[names.modelModal]: modal ?? "edit",
|
|
1618
523
|
[names.modelFormLoading]: false
|
|
@@ -1625,7 +530,7 @@ var makeActions = (gql) => {
|
|
|
1625
530
|
state[names.modelForm].id = id;
|
|
1626
531
|
});
|
|
1627
532
|
const model = await gql[names.model](id, { onError });
|
|
1628
|
-
const modelForm = deepObjectify(model);
|
|
533
|
+
const modelForm = (0, import_common.deepObjectify)(model);
|
|
1629
534
|
this.set({
|
|
1630
535
|
[names.model]: model,
|
|
1631
536
|
[names.modelFormLoading]: false,
|
|
@@ -1655,7 +560,7 @@ var makeActions = (gql) => {
|
|
|
1655
560
|
const modelListLoading = currentState2[namesOfSlice.modelListLoading];
|
|
1656
561
|
if (modelListLoading || !modelList.has(updatedModel.id))
|
|
1657
562
|
return;
|
|
1658
|
-
const newModelList = new DataList(modelList).set(updatedLightModel);
|
|
563
|
+
const newModelList = new import_base.DataList(modelList).set(updatedLightModel);
|
|
1659
564
|
this.set({ [namesOfSlice.modelList]: newModelList });
|
|
1660
565
|
});
|
|
1661
566
|
},
|
|
@@ -1695,14 +600,14 @@ var makeActions = (gql) => {
|
|
|
1695
600
|
this.set({
|
|
1696
601
|
[names.model]: model ?? null,
|
|
1697
602
|
[names.modelViewAt]: /* @__PURE__ */ new Date(0),
|
|
1698
|
-
[names.modelForm]: immerify(modelRef, defaultModel),
|
|
603
|
+
[names.modelForm]: (0, import_signal.immerify)(modelRef, defaultModel),
|
|
1699
604
|
[names.modelModal]: null
|
|
1700
605
|
});
|
|
1701
606
|
return model ?? null;
|
|
1702
607
|
}
|
|
1703
608
|
};
|
|
1704
609
|
const sliceAction = gql.slices.reduce((acc, { sliceName, argLength }) => {
|
|
1705
|
-
const SliceName = capitalize(sliceName);
|
|
610
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
1706
611
|
const namesOfSlice = {
|
|
1707
612
|
defaultModel: SliceName.replace(names.Model, names.defaultModel),
|
|
1708
613
|
modelInsight: sliceName.replace(names.model, names.modelInsight),
|
|
@@ -1730,7 +635,7 @@ var makeActions = (gql) => {
|
|
|
1730
635
|
const initArgLength = Math.min(args.length, argLength);
|
|
1731
636
|
const initForm = { invalidate: false, ...args[argLength] ?? {} };
|
|
1732
637
|
const queryArgs = new Array(initArgLength).fill(null).map((_, i) => args[i]);
|
|
1733
|
-
const defaultModel = immerify(modelRef, { ...gql[names.defaultModel], ...initForm.default ?? {} });
|
|
638
|
+
const defaultModel = (0, import_signal.immerify)(modelRef, { ...gql[names.defaultModel], ...initForm.default ?? {} });
|
|
1734
639
|
this.set({ [names.defaultModel]: defaultModel });
|
|
1735
640
|
await this[namesOfSlice.refreshModel](
|
|
1736
641
|
...initArgLength === argLength ? [...queryArgs, initForm] : queryArgs
|
|
@@ -1756,7 +661,7 @@ var makeActions = (gql) => {
|
|
|
1756
661
|
const pageOfModel = currentState[namesOfSlice.pageOfModel];
|
|
1757
662
|
const limitOfModel = currentState[namesOfSlice.limitOfModel];
|
|
1758
663
|
const sortOfModel = currentState[namesOfSlice.sortOfModel];
|
|
1759
|
-
if (!invalidate && !["sleep", "reset"].includes(modelOperation) && isQueryEqual(queryArgs, queryArgsOfModel) && page === pageOfModel && limit === limitOfModel && isQueryEqual(sort, sortOfModel))
|
|
664
|
+
if (!invalidate && !["sleep", "reset"].includes(modelOperation) && (0, import_common.isQueryEqual)(queryArgs, queryArgsOfModel) && page === pageOfModel && limit === limitOfModel && (0, import_common.isQueryEqual)(sort, sortOfModel))
|
|
1760
665
|
return;
|
|
1761
666
|
else
|
|
1762
667
|
this.set({ [namesOfSlice.modelListLoading]: true });
|
|
@@ -1772,7 +677,7 @@ var makeActions = (gql) => {
|
|
|
1772
677
|
onError: initForm.onError
|
|
1773
678
|
})
|
|
1774
679
|
]);
|
|
1775
|
-
const modelList = new DataList(modelDataList);
|
|
680
|
+
const modelList = new import_base.DataList(modelDataList);
|
|
1776
681
|
this.set({
|
|
1777
682
|
[namesOfSlice.modelList]: modelList,
|
|
1778
683
|
[namesOfSlice.modelListLoading]: false,
|
|
@@ -1792,13 +697,13 @@ var makeActions = (gql) => {
|
|
|
1792
697
|
const currentState = this.get();
|
|
1793
698
|
const modelSelection = currentState[namesOfSlice.modelSelection];
|
|
1794
699
|
if (refresh)
|
|
1795
|
-
this.set({ [namesOfSlice.modelSelection]: new DataList(models) });
|
|
700
|
+
this.set({ [namesOfSlice.modelSelection]: new import_base.DataList(models) });
|
|
1796
701
|
else if (remove) {
|
|
1797
|
-
const newModelSelection = new DataList(modelSelection);
|
|
702
|
+
const newModelSelection = new import_base.DataList(modelSelection);
|
|
1798
703
|
models.map((model2) => newModelSelection.delete(model2.id));
|
|
1799
704
|
this.set({ [namesOfSlice.modelSelection]: newModelSelection });
|
|
1800
705
|
} else {
|
|
1801
|
-
this.set({ [namesOfSlice.modelSelection]: new DataList([...modelSelection.values, ...models]) });
|
|
706
|
+
this.set({ [namesOfSlice.modelSelection]: new import_base.DataList([...modelSelection.values, ...models]) });
|
|
1802
707
|
}
|
|
1803
708
|
},
|
|
1804
709
|
[namesOfSlice.setPageOfModel]: async function(page, options) {
|
|
@@ -1817,7 +722,7 @@ var makeActions = (gql) => {
|
|
|
1817
722
|
sortOfModel,
|
|
1818
723
|
options
|
|
1819
724
|
);
|
|
1820
|
-
const modelList = new DataList(modelDataList);
|
|
725
|
+
const modelList = new import_base.DataList(modelDataList);
|
|
1821
726
|
this.set({
|
|
1822
727
|
[namesOfSlice.modelList]: modelList,
|
|
1823
728
|
[namesOfSlice.pageOfModel]: page,
|
|
@@ -1841,7 +746,7 @@ var makeActions = (gql) => {
|
|
|
1841
746
|
sortOfModel,
|
|
1842
747
|
options
|
|
1843
748
|
);
|
|
1844
|
-
const newModelList = new DataList(
|
|
749
|
+
const newModelList = new import_base.DataList(
|
|
1845
750
|
addFront ? [...modelDataList, ...modelList] : [...modelList, ...modelDataList]
|
|
1846
751
|
);
|
|
1847
752
|
this.set({ [namesOfSlice.modelList]: newModelList, [namesOfSlice.pageOfModel]: page });
|
|
@@ -1864,7 +769,7 @@ var makeActions = (gql) => {
|
|
|
1864
769
|
sortOfModel,
|
|
1865
770
|
options
|
|
1866
771
|
);
|
|
1867
|
-
const modelList = new DataList(modelDataList);
|
|
772
|
+
const modelList = new import_base.DataList(modelDataList);
|
|
1868
773
|
this.set({
|
|
1869
774
|
[namesOfSlice.modelList]: modelList,
|
|
1870
775
|
[namesOfSlice.lastPageOfModel]: Math.max(Math.floor((modelInsight.count - 1) / limit) + 1, 1),
|
|
@@ -1879,8 +784,8 @@ var makeActions = (gql) => {
|
|
|
1879
784
|
const queryArgsOfModel = currentState[namesOfSlice.queryArgsOfModel];
|
|
1880
785
|
const limitOfModel = currentState[namesOfSlice.limitOfModel];
|
|
1881
786
|
const sortOfModel = currentState[namesOfSlice.sortOfModel];
|
|
1882
|
-
if (isQueryEqual(queryArgsOfModel, queryArgs)) {
|
|
1883
|
-
Logger.trace(`${namesOfSlice.queryArgsOfModel} store-level cache hit`);
|
|
787
|
+
if ((0, import_common.isQueryEqual)(queryArgsOfModel, queryArgs)) {
|
|
788
|
+
import_common.Logger.trace(`${namesOfSlice.queryArgsOfModel} store-level cache hit`);
|
|
1884
789
|
return;
|
|
1885
790
|
}
|
|
1886
791
|
this.set({ [namesOfSlice.modelListLoading]: true });
|
|
@@ -1894,7 +799,7 @@ var makeActions = (gql) => {
|
|
|
1894
799
|
),
|
|
1895
800
|
gql[namesOfSlice.modelInsight](...queryArgs, options)
|
|
1896
801
|
]);
|
|
1897
|
-
const modelList = new DataList(modelDataList);
|
|
802
|
+
const modelList = new import_base.DataList(modelDataList);
|
|
1898
803
|
this.set({
|
|
1899
804
|
[namesOfSlice.queryArgsOfModel]: queryArgs,
|
|
1900
805
|
[namesOfSlice.modelList]: modelList,
|
|
@@ -1920,7 +825,7 @@ var makeActions = (gql) => {
|
|
|
1920
825
|
sort,
|
|
1921
826
|
options
|
|
1922
827
|
);
|
|
1923
|
-
const modelList = new DataList(modelDataList);
|
|
828
|
+
const modelList = new import_base.DataList(modelDataList);
|
|
1924
829
|
this.set({
|
|
1925
830
|
[namesOfSlice.modelList]: modelList,
|
|
1926
831
|
[namesOfSlice.sortOfModel]: sort,
|
|
@@ -1967,7 +872,7 @@ var scalarStateOf = (refName, state) => {
|
|
|
1967
872
|
return StateStore;
|
|
1968
873
|
};
|
|
1969
874
|
var Store = (returnsOrObj) => {
|
|
1970
|
-
const refName = typeof returnsOrObj === "object" ? returnsOrObj.name : lowerlize(getClassMeta(returnsOrObj()).refName);
|
|
875
|
+
const refName = typeof returnsOrObj === "object" ? returnsOrObj.name : (0, import_common.lowerlize)((0, import_constant.getClassMeta)(returnsOrObj()).refName);
|
|
1971
876
|
const storeMeta = getStoreMeta(refName);
|
|
1972
877
|
return function(target) {
|
|
1973
878
|
const customDoKeys = Object.getOwnPropertyNames(target.prototype).filter((key) => key !== "constructor");
|
|
@@ -2007,7 +912,7 @@ var createSelectors = (_store, store = {}) => {
|
|
|
2007
912
|
for (const k of Object.keys(state)) {
|
|
2008
913
|
if (typeof state[k] !== "function") {
|
|
2009
914
|
store.use[k] = () => store.sel((s) => s[k]);
|
|
2010
|
-
const setKey = `set${capitalize(k)}`;
|
|
915
|
+
const setKey = `set${(0, import_common.capitalize)(k)}`;
|
|
2011
916
|
if (!state[setKey])
|
|
2012
917
|
store.do[setKey] = (value) => {
|
|
2013
918
|
store.set({ [k]: value });
|
|
@@ -2015,14 +920,14 @@ var createSelectors = (_store, store = {}) => {
|
|
|
2015
920
|
} else {
|
|
2016
921
|
store.do[k] = async (...args) => {
|
|
2017
922
|
try {
|
|
2018
|
-
Logger.verbose(`${k} action loading...`);
|
|
923
|
+
import_common.Logger.verbose(`${k} action loading...`);
|
|
2019
924
|
const start = Date.now();
|
|
2020
925
|
await state[k](...args);
|
|
2021
926
|
const end = Date.now();
|
|
2022
|
-
Logger.verbose(`=> ${k} action dispatched (${end - start}ms)`);
|
|
927
|
+
import_common.Logger.verbose(`=> ${k} action dispatched (${end - start}ms)`);
|
|
2023
928
|
} catch (e) {
|
|
2024
929
|
const errKey = typeof e === "string" ? e : e.message;
|
|
2025
|
-
msg.error(errKey, { key: k });
|
|
930
|
+
import_dictionary.msg.error(errKey, { key: k });
|
|
2026
931
|
throw e;
|
|
2027
932
|
}
|
|
2028
933
|
};
|
|
@@ -2030,7 +935,7 @@ var createSelectors = (_store, store = {}) => {
|
|
|
2030
935
|
}
|
|
2031
936
|
const storeNames = getStoreNames();
|
|
2032
937
|
for (const storeName of storeNames) {
|
|
2033
|
-
const [fieldName, className] = [lowerlize(storeName), capitalize(storeName)];
|
|
938
|
+
const [fieldName, className] = [(0, import_common.lowerlize)(storeName), (0, import_common.capitalize)(storeName)];
|
|
2034
939
|
const names = {
|
|
2035
940
|
model: fieldName,
|
|
2036
941
|
Model: className,
|
|
@@ -2057,7 +962,7 @@ var createSelectors = (_store, store = {}) => {
|
|
|
2057
962
|
};
|
|
2058
963
|
const storeMeta = getStoreMeta(storeName);
|
|
2059
964
|
storeMeta.slices.forEach(({ sliceName, argLength, refName }) => {
|
|
2060
|
-
const SliceName = capitalize(sliceName);
|
|
965
|
+
const SliceName = (0, import_common.capitalize)(sliceName);
|
|
2061
966
|
const namesOfSliceState = {
|
|
2062
967
|
defaultModel: SliceName.replace(names.Model, names.defaultModel),
|
|
2063
968
|
modelInitList: SliceName.replace(names.Model, names.modelInitList),
|
|
@@ -2089,7 +994,7 @@ var createSelectors = (_store, store = {}) => {
|
|
|
2089
994
|
});
|
|
2090
995
|
Object.keys(namesOfSliceState).map((key) => {
|
|
2091
996
|
targetSlice.use[names[key]] = store.use[namesOfSliceState[key]];
|
|
2092
|
-
targetSlice.do[`set${capitalize(names[key])}`] = store.do[`set${capitalize(namesOfSliceState[key])}`];
|
|
997
|
+
targetSlice.do[`set${(0, import_common.capitalize)(names[key])}`] = store.do[`set${(0, import_common.capitalize)(namesOfSliceState[key])}`];
|
|
2093
998
|
});
|
|
2094
999
|
targetSlice.sliceName = sliceName;
|
|
2095
1000
|
targetSlice.refName = refName;
|
|
@@ -2119,7 +1024,7 @@ var makeStore = (st2, storeRef, { library } = {}) => {
|
|
|
2119
1024
|
const zustandStore = (0, import_zustand.create)(
|
|
2120
1025
|
(0, import_middleware.devtools)(
|
|
2121
1026
|
(0, import_middleware.subscribeWithSelector)(
|
|
2122
|
-
(0,
|
|
1027
|
+
(0, import_immer.immer)((set, get) => {
|
|
2123
1028
|
const store = {};
|
|
2124
1029
|
const pick = makePicker(set, get);
|
|
2125
1030
|
Object.getOwnPropertyNames(storeRef.prototype).forEach((key) => {
|
|
@@ -2171,7 +1076,7 @@ var MixStore = (s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15
|
|
|
2171
1076
|
].filter((s) => !!s);
|
|
2172
1077
|
class Mix {
|
|
2173
1078
|
}
|
|
2174
|
-
applyMixins(Mix, stores);
|
|
1079
|
+
(0, import_common.applyMixins)(Mix, stores);
|
|
2175
1080
|
return Mix;
|
|
2176
1081
|
};
|
|
2177
1082
|
var rootStoreOf = (store) => {
|
|
@@ -2182,16 +1087,15 @@ var Toast = ({ root, duration = 3 } = {}) => {
|
|
|
2182
1087
|
const originMethod = descriptor.value;
|
|
2183
1088
|
descriptor.value = async function(...args) {
|
|
2184
1089
|
try {
|
|
2185
|
-
msg.loading(`${root ? `${root}.` : ""}${key}-loading`, { key, duration });
|
|
1090
|
+
import_dictionary.msg.loading(`${root ? `${root}.` : ""}${key}-loading`, { key, duration });
|
|
2186
1091
|
const result = await originMethod.apply(this, args);
|
|
2187
|
-
msg.success(`${root ? `${root}.` : ""}${key}-success`, { key, duration });
|
|
1092
|
+
import_dictionary.msg.success(`${root ? `${root}.` : ""}${key}-success`, { key, duration });
|
|
2188
1093
|
return result;
|
|
2189
1094
|
} catch (err) {
|
|
2190
1095
|
const errKey = typeof err === "string" ? err : err.message;
|
|
2191
|
-
msg.error(errKey, { key, duration });
|
|
2192
|
-
Logger.error(`${key} action error return: ${err}`);
|
|
1096
|
+
import_dictionary.msg.error(errKey, { key, duration });
|
|
1097
|
+
import_common.Logger.error(`${key} action error return: ${err}`);
|
|
2193
1098
|
}
|
|
2194
1099
|
};
|
|
2195
1100
|
};
|
|
2196
1101
|
};
|
|
2197
|
-
//! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
|