autosync_backend2 1.1.5 → 1.1.7
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/dist/env.d.ts +0 -1
- package/dist/index.d.ts +32 -18
- package/dist/index.js +66 -192
- package/package.json +2 -2
package/dist/env.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const EnvSchema: import("@sinclair/typebox").TObject<{
|
|
2
|
-
LOG_LEVEL: import("elysia/dist/type-system/types").TUnionEnum<["fatal", "error", "warn", "info", "debug", "trace"]>;
|
|
3
2
|
NODE_ENV: import("elysia/dist/type-system/types").TUnionEnum<["development", "production"]>;
|
|
4
3
|
PORT: import("@sinclair/typebox").TNumber;
|
|
5
4
|
BETTER_AUTH_SECRET: import("@sinclair/typebox").TString;
|
package/dist/index.d.ts
CHANGED
|
@@ -403,15 +403,9 @@ declare const app: Elysia<"", {
|
|
|
403
403
|
}>;
|
|
404
404
|
readonly "CrmCpOrderModel.create": import("@sinclair/typebox").TObject<{
|
|
405
405
|
phone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
vehicleKindId: import("@sinclair/typebox").TString;
|
|
410
|
-
licensePlate: import("@sinclair/typebox").TString;
|
|
411
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
412
|
-
vin: import("@sinclair/typebox").TString;
|
|
413
|
-
vehicleKindId: import("@sinclair/typebox").TString;
|
|
414
|
-
}>]>;
|
|
406
|
+
vin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
407
|
+
licensePlate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
408
|
+
vehicleKindId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
415
409
|
}>;
|
|
416
410
|
readonly "CrmCpOrderModel.addPackage": import("@sinclair/typebox").TObject<{
|
|
417
411
|
spPackageId: import("@sinclair/typebox").TString;
|
|
@@ -2928,6 +2922,31 @@ declare const app: Elysia<"", {
|
|
|
2928
2922
|
};
|
|
2929
2923
|
};
|
|
2930
2924
|
};
|
|
2925
|
+
} & {
|
|
2926
|
+
user: {
|
|
2927
|
+
me: {
|
|
2928
|
+
get: {
|
|
2929
|
+
body: unknown;
|
|
2930
|
+
params: {};
|
|
2931
|
+
query: unknown;
|
|
2932
|
+
headers: unknown;
|
|
2933
|
+
response: {
|
|
2934
|
+
200: {
|
|
2935
|
+
id: string;
|
|
2936
|
+
name: string;
|
|
2937
|
+
emailVerified: boolean;
|
|
2938
|
+
email: string;
|
|
2939
|
+
createdAt: Date;
|
|
2940
|
+
updatedAt: Date;
|
|
2941
|
+
image?: string | null | undefined | undefined;
|
|
2942
|
+
companyId: string;
|
|
2943
|
+
branchId: string;
|
|
2944
|
+
kind: "ADMIN" | "COMPANY_ADMIN" | "CUSTOMER";
|
|
2945
|
+
};
|
|
2946
|
+
};
|
|
2947
|
+
};
|
|
2948
|
+
};
|
|
2949
|
+
};
|
|
2931
2950
|
} & {
|
|
2932
2951
|
user: {
|
|
2933
2952
|
post: {
|
|
@@ -3920,15 +3939,9 @@ declare const app: Elysia<"", {
|
|
|
3920
3939
|
post: {
|
|
3921
3940
|
body: {
|
|
3922
3941
|
phone?: string | undefined;
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
vehicleKindId: string;
|
|
3927
|
-
licensePlate: string;
|
|
3928
|
-
} | {
|
|
3929
|
-
vehicleKindId: string;
|
|
3930
|
-
vin: string;
|
|
3931
|
-
};
|
|
3942
|
+
vehicleKindId?: string | undefined;
|
|
3943
|
+
vin?: string | undefined;
|
|
3944
|
+
licensePlate?: string | undefined;
|
|
3932
3945
|
};
|
|
3933
3946
|
params: {};
|
|
3934
3947
|
query: unknown;
|
|
@@ -3946,6 +3959,7 @@ declare const app: Elysia<"", {
|
|
|
3946
3959
|
companyBranchId: string;
|
|
3947
3960
|
};
|
|
3948
3961
|
502: string;
|
|
3962
|
+
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
|
3949
3963
|
422: {
|
|
3950
3964
|
type: "validation";
|
|
3951
3965
|
on: string;
|
package/dist/index.js
CHANGED
|
@@ -1147,7 +1147,7 @@ var require_ms = __commonJS((exports, module) => {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
});
|
|
1149
1149
|
|
|
1150
|
-
// node_modules
|
|
1150
|
+
// node_modules/debug/src/common.js
|
|
1151
1151
|
var require_common = __commonJS((exports, module) => {
|
|
1152
1152
|
function setup(env) {
|
|
1153
1153
|
createDebug.debug = createDebug;
|
|
@@ -1322,7 +1322,7 @@ var require_common = __commonJS((exports, module) => {
|
|
|
1322
1322
|
module.exports = setup;
|
|
1323
1323
|
});
|
|
1324
1324
|
|
|
1325
|
-
// node_modules
|
|
1325
|
+
// node_modules/debug/src/browser.js
|
|
1326
1326
|
var require_browser = __commonJS((exports, module) => {
|
|
1327
1327
|
exports.formatArgs = formatArgs;
|
|
1328
1328
|
exports.save = save;
|
|
@@ -1482,7 +1482,7 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
1482
1482
|
};
|
|
1483
1483
|
});
|
|
1484
1484
|
|
|
1485
|
-
// node_modules
|
|
1485
|
+
// node_modules/debug/src/node.js
|
|
1486
1486
|
var require_node = __commonJS((exports, module) => {
|
|
1487
1487
|
var tty = __require("tty");
|
|
1488
1488
|
var util = __require("util");
|
|
@@ -1653,7 +1653,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
});
|
|
1655
1655
|
|
|
1656
|
-
// node_modules
|
|
1656
|
+
// node_modules/debug/src/index.js
|
|
1657
1657
|
var require_src = __commonJS((exports, module) => {
|
|
1658
1658
|
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
1659
1659
|
module.exports = require_browser();
|
|
@@ -18342,6 +18342,8 @@ var require_defaults = __commonJS((exports, module) => {
|
|
|
18342
18342
|
// node_modules/pg/lib/utils.js
|
|
18343
18343
|
var require_utils = __commonJS((exports, module) => {
|
|
18344
18344
|
var defaults = require_defaults();
|
|
18345
|
+
var util4 = __require("util");
|
|
18346
|
+
var { isDate: isDate2 } = util4.types || util4;
|
|
18345
18347
|
function escapeElement(elementRepresentation) {
|
|
18346
18348
|
const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
18347
18349
|
return '"' + escaped + '"';
|
|
@@ -18389,7 +18391,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
18389
18391
|
}
|
|
18390
18392
|
return buf.slice(val.byteOffset, val.byteOffset + val.byteLength);
|
|
18391
18393
|
}
|
|
18392
|
-
if (val
|
|
18394
|
+
if (isDate2(val)) {
|
|
18393
18395
|
if (defaults.parseInputDatesAsUTC) {
|
|
18394
18396
|
return dateToStringUTC(val);
|
|
18395
18397
|
} else {
|
|
@@ -18463,6 +18465,12 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
18463
18465
|
var escapeLiteral = function(str) {
|
|
18464
18466
|
let hasBackslash = false;
|
|
18465
18467
|
let escaped = "'";
|
|
18468
|
+
if (str == null) {
|
|
18469
|
+
return "''";
|
|
18470
|
+
}
|
|
18471
|
+
if (typeof str !== "string") {
|
|
18472
|
+
return "''";
|
|
18473
|
+
}
|
|
18466
18474
|
for (let i2 = 0;i2 < str.length; i2++) {
|
|
18467
18475
|
const c = str[i2];
|
|
18468
18476
|
if (c === "'") {
|
|
@@ -18906,10 +18914,14 @@ var require_pg_connection_string = __commonJS((exports, module) => {
|
|
|
18906
18914
|
str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
|
|
18907
18915
|
}
|
|
18908
18916
|
try {
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18917
|
+
try {
|
|
18918
|
+
result = new URL(str, "postgres://base");
|
|
18919
|
+
} catch (e) {
|
|
18920
|
+
result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
|
|
18921
|
+
dummyHost = true;
|
|
18922
|
+
}
|
|
18923
|
+
} catch (err2) {
|
|
18924
|
+
err2.input && (err2.input = "*****REDACTED*****");
|
|
18913
18925
|
}
|
|
18914
18926
|
for (const entry of result.searchParams.entries()) {
|
|
18915
18927
|
config2[entry[0]] = entry[1];
|
|
@@ -20244,153 +20256,10 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
20244
20256
|
exports.parse = parse4;
|
|
20245
20257
|
});
|
|
20246
20258
|
|
|
20247
|
-
// node_modules/pg-cloudflare/dist/
|
|
20248
|
-
var
|
|
20259
|
+
// node_modules/pg-cloudflare/dist/empty.js
|
|
20260
|
+
var require_empty = __commonJS((exports) => {
|
|
20249
20261
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20250
|
-
exports.
|
|
20251
|
-
var events_1 = __require("events");
|
|
20252
|
-
|
|
20253
|
-
class CloudflareSocket extends events_1.EventEmitter {
|
|
20254
|
-
constructor(ssl) {
|
|
20255
|
-
super();
|
|
20256
|
-
this.ssl = ssl;
|
|
20257
|
-
this.writable = false;
|
|
20258
|
-
this.destroyed = false;
|
|
20259
|
-
this._upgrading = false;
|
|
20260
|
-
this._upgraded = false;
|
|
20261
|
-
this._cfSocket = null;
|
|
20262
|
-
this._cfWriter = null;
|
|
20263
|
-
this._cfReader = null;
|
|
20264
|
-
}
|
|
20265
|
-
setNoDelay() {
|
|
20266
|
-
return this;
|
|
20267
|
-
}
|
|
20268
|
-
setKeepAlive() {
|
|
20269
|
-
return this;
|
|
20270
|
-
}
|
|
20271
|
-
ref() {
|
|
20272
|
-
return this;
|
|
20273
|
-
}
|
|
20274
|
-
unref() {
|
|
20275
|
-
return this;
|
|
20276
|
-
}
|
|
20277
|
-
async connect(port, host, connectListener) {
|
|
20278
|
-
try {
|
|
20279
|
-
log2("connecting");
|
|
20280
|
-
if (connectListener)
|
|
20281
|
-
this.once("connect", connectListener);
|
|
20282
|
-
const options = this.ssl ? { secureTransport: "starttls" } : {};
|
|
20283
|
-
const mod = await import("cloudflare:sockets");
|
|
20284
|
-
const connect = mod.connect;
|
|
20285
|
-
this._cfSocket = connect(`${host}:${port}`, options);
|
|
20286
|
-
this._cfWriter = this._cfSocket.writable.getWriter();
|
|
20287
|
-
this._addClosedHandler();
|
|
20288
|
-
this._cfReader = this._cfSocket.readable.getReader();
|
|
20289
|
-
if (this.ssl) {
|
|
20290
|
-
this._listenOnce().catch((e) => this.emit("error", e));
|
|
20291
|
-
} else {
|
|
20292
|
-
this._listen().catch((e) => this.emit("error", e));
|
|
20293
|
-
}
|
|
20294
|
-
await this._cfWriter.ready;
|
|
20295
|
-
log2("socket ready");
|
|
20296
|
-
this.writable = true;
|
|
20297
|
-
this.emit("connect");
|
|
20298
|
-
return this;
|
|
20299
|
-
} catch (e) {
|
|
20300
|
-
this.emit("error", e);
|
|
20301
|
-
}
|
|
20302
|
-
}
|
|
20303
|
-
async _listen() {
|
|
20304
|
-
while (true) {
|
|
20305
|
-
log2("awaiting receive from CF socket");
|
|
20306
|
-
const { done, value } = await this._cfReader.read();
|
|
20307
|
-
log2("CF socket received:", done, value);
|
|
20308
|
-
if (done) {
|
|
20309
|
-
log2("done");
|
|
20310
|
-
break;
|
|
20311
|
-
}
|
|
20312
|
-
this.emit("data", Buffer.from(value));
|
|
20313
|
-
}
|
|
20314
|
-
}
|
|
20315
|
-
async _listenOnce() {
|
|
20316
|
-
log2("awaiting first receive from CF socket");
|
|
20317
|
-
const { done, value } = await this._cfReader.read();
|
|
20318
|
-
log2("First CF socket received:", done, value);
|
|
20319
|
-
this.emit("data", Buffer.from(value));
|
|
20320
|
-
}
|
|
20321
|
-
write(data, encoding = "utf8", callback = () => {}) {
|
|
20322
|
-
if (data.length === 0)
|
|
20323
|
-
return callback();
|
|
20324
|
-
if (typeof data === "string")
|
|
20325
|
-
data = Buffer.from(data, encoding);
|
|
20326
|
-
log2("sending data direct:", data);
|
|
20327
|
-
this._cfWriter.write(data).then(() => {
|
|
20328
|
-
log2("data sent");
|
|
20329
|
-
callback();
|
|
20330
|
-
}, (err2) => {
|
|
20331
|
-
log2("send error", err2);
|
|
20332
|
-
callback(err2);
|
|
20333
|
-
});
|
|
20334
|
-
return true;
|
|
20335
|
-
}
|
|
20336
|
-
end(data = Buffer.alloc(0), encoding = "utf8", callback = () => {}) {
|
|
20337
|
-
log2("ending CF socket");
|
|
20338
|
-
this.write(data, encoding, (err2) => {
|
|
20339
|
-
this._cfSocket.close();
|
|
20340
|
-
if (callback)
|
|
20341
|
-
callback(err2);
|
|
20342
|
-
});
|
|
20343
|
-
return this;
|
|
20344
|
-
}
|
|
20345
|
-
destroy(reason) {
|
|
20346
|
-
log2("destroying CF socket", reason);
|
|
20347
|
-
this.destroyed = true;
|
|
20348
|
-
return this.end();
|
|
20349
|
-
}
|
|
20350
|
-
startTls(options) {
|
|
20351
|
-
if (this._upgraded) {
|
|
20352
|
-
this.emit("error", "Cannot call `startTls()` more than once on a socket");
|
|
20353
|
-
return;
|
|
20354
|
-
}
|
|
20355
|
-
this._cfWriter.releaseLock();
|
|
20356
|
-
this._cfReader.releaseLock();
|
|
20357
|
-
this._upgrading = true;
|
|
20358
|
-
this._cfSocket = this._cfSocket.startTls(options);
|
|
20359
|
-
this._cfWriter = this._cfSocket.writable.getWriter();
|
|
20360
|
-
this._cfReader = this._cfSocket.readable.getReader();
|
|
20361
|
-
this._addClosedHandler();
|
|
20362
|
-
this._listen().catch((e) => this.emit("error", e));
|
|
20363
|
-
}
|
|
20364
|
-
_addClosedHandler() {
|
|
20365
|
-
this._cfSocket.closed.then(() => {
|
|
20366
|
-
if (!this._upgrading) {
|
|
20367
|
-
log2("CF socket closed");
|
|
20368
|
-
this._cfSocket = null;
|
|
20369
|
-
this.emit("close");
|
|
20370
|
-
} else {
|
|
20371
|
-
this._upgrading = false;
|
|
20372
|
-
this._upgraded = true;
|
|
20373
|
-
}
|
|
20374
|
-
}).catch((e) => this.emit("error", e));
|
|
20375
|
-
}
|
|
20376
|
-
}
|
|
20377
|
-
exports.CloudflareSocket = CloudflareSocket;
|
|
20378
|
-
var debug2 = false;
|
|
20379
|
-
function dump(data) {
|
|
20380
|
-
if (data instanceof Uint8Array || data instanceof ArrayBuffer) {
|
|
20381
|
-
const hex2 = Buffer.from(data).toString("hex");
|
|
20382
|
-
const str = new TextDecoder().decode(data);
|
|
20383
|
-
return `
|
|
20384
|
-
>>> STR: "${str.replace(/\n/g, "\\n")}"
|
|
20385
|
-
>>> HEX: ${hex2}
|
|
20386
|
-
`;
|
|
20387
|
-
} else {
|
|
20388
|
-
return data;
|
|
20389
|
-
}
|
|
20390
|
-
}
|
|
20391
|
-
function log2(...args) {
|
|
20392
|
-
debug2 && console.log(...args.map(dump));
|
|
20393
|
-
}
|
|
20262
|
+
exports.default = {};
|
|
20394
20263
|
});
|
|
20395
20264
|
|
|
20396
20265
|
// node_modules/pg/lib/stream.js
|
|
@@ -20416,7 +20285,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
20416
20285
|
}
|
|
20417
20286
|
function getCloudflareStreamFuncs() {
|
|
20418
20287
|
function getStream2(ssl) {
|
|
20419
|
-
const { CloudflareSocket } =
|
|
20288
|
+
const { CloudflareSocket } = require_empty();
|
|
20420
20289
|
return new CloudflareSocket(ssl);
|
|
20421
20290
|
}
|
|
20422
20291
|
function getSecureStream2(options) {
|
|
@@ -21553,14 +21422,19 @@ var require_pg_pool = __commonJS((exports, module) => {
|
|
|
21553
21422
|
}
|
|
21554
21423
|
throw new Error("unexpected condition");
|
|
21555
21424
|
}
|
|
21556
|
-
_remove(client) {
|
|
21425
|
+
_remove(client, callback) {
|
|
21557
21426
|
const removed = removeWhere(this._idle, (item) => item.client === client);
|
|
21558
21427
|
if (removed !== undefined) {
|
|
21559
21428
|
clearTimeout(removed.timeoutId);
|
|
21560
21429
|
}
|
|
21561
21430
|
this._clients = this._clients.filter((c) => c !== client);
|
|
21562
|
-
|
|
21563
|
-
|
|
21431
|
+
const context = this;
|
|
21432
|
+
client.end(() => {
|
|
21433
|
+
context.emit("remove", client);
|
|
21434
|
+
if (typeof callback === "function") {
|
|
21435
|
+
callback();
|
|
21436
|
+
}
|
|
21437
|
+
});
|
|
21564
21438
|
}
|
|
21565
21439
|
connect(cb) {
|
|
21566
21440
|
if (this.ending) {
|
|
@@ -21689,23 +21563,19 @@ var require_pg_pool = __commonJS((exports, module) => {
|
|
|
21689
21563
|
if (client._poolUseCount >= this.options.maxUses) {
|
|
21690
21564
|
this.log("remove expended client");
|
|
21691
21565
|
}
|
|
21692
|
-
this._remove(client);
|
|
21693
|
-
this._pulseQueue();
|
|
21694
|
-
return;
|
|
21566
|
+
return this._remove(client, this._pulseQueue.bind(this));
|
|
21695
21567
|
}
|
|
21696
21568
|
const isExpired = this._expired.has(client);
|
|
21697
21569
|
if (isExpired) {
|
|
21698
21570
|
this.log("remove expired client");
|
|
21699
21571
|
this._expired.delete(client);
|
|
21700
|
-
this._remove(client);
|
|
21701
|
-
this._pulseQueue();
|
|
21702
|
-
return;
|
|
21572
|
+
return this._remove(client, this._pulseQueue.bind(this));
|
|
21703
21573
|
}
|
|
21704
21574
|
let tid;
|
|
21705
21575
|
if (this.options.idleTimeoutMillis && this._isAboveMin()) {
|
|
21706
21576
|
tid = setTimeout(() => {
|
|
21707
21577
|
this.log("remove idle client");
|
|
21708
|
-
this._remove(client);
|
|
21578
|
+
this._remove(client, this._pulseQueue.bind(this));
|
|
21709
21579
|
}, this.options.idleTimeoutMillis);
|
|
21710
21580
|
if (this.options.allowExitOnIdle) {
|
|
21711
21581
|
tid.unref();
|
|
@@ -51136,7 +51006,7 @@ var require_version = __commonJS((exports) => {
|
|
|
51136
51006
|
});
|
|
51137
51007
|
|
|
51138
51008
|
// node_modules/uuid/dist/index.js
|
|
51139
|
-
var
|
|
51009
|
+
var require_dist3 = __commonJS((exports) => {
|
|
51140
51010
|
Object.defineProperty(exports, "__esModule", {
|
|
51141
51011
|
value: true
|
|
51142
51012
|
});
|
|
@@ -51438,7 +51308,7 @@ var require_icon_set_ext_xform = __commonJS((exports, module) => {
|
|
|
51438
51308
|
|
|
51439
51309
|
// node_modules/exceljs/lib/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js
|
|
51440
51310
|
var require_cf_rule_ext_xform = __commonJS((exports, module) => {
|
|
51441
|
-
var { v4: uuidv4 } =
|
|
51311
|
+
var { v4: uuidv4 } = require_dist3();
|
|
51442
51312
|
var BaseXform = require_base_xform();
|
|
51443
51313
|
var CompositeXform = require_composite_xform();
|
|
51444
51314
|
var DatabarExtXform = require_databar_ext_xform();
|
|
@@ -112558,7 +112428,6 @@ var index_default2 = swagger;
|
|
|
112558
112428
|
|
|
112559
112429
|
// src/env.ts
|
|
112560
112430
|
var EnvSchema = t.Object({
|
|
112561
|
-
LOG_LEVEL: t.UnionEnum(["fatal", "error", "warn", "info", "debug", "trace"]),
|
|
112562
112431
|
NODE_ENV: t.UnionEnum(["development", "production"], {
|
|
112563
112432
|
default: "development"
|
|
112564
112433
|
}),
|
|
@@ -141037,24 +140906,24 @@ var levels2 = {
|
|
|
141037
140906
|
test: "error",
|
|
141038
140907
|
production: "info"
|
|
141039
140908
|
};
|
|
141040
|
-
var transport = {
|
|
140909
|
+
var transport = env_default.NODE_ENV === "development" ? {
|
|
141041
140910
|
target: "pino-pretty",
|
|
141042
140911
|
options: {
|
|
141043
140912
|
colorize: true,
|
|
141044
140913
|
translateTime: "SYS:standard",
|
|
141045
140914
|
ignore: "pid,hostname"
|
|
141046
140915
|
}
|
|
141047
|
-
};
|
|
140916
|
+
} : undefined;
|
|
141048
140917
|
var logger2 = import_pino.pino({
|
|
141049
|
-
level: levels2[
|
|
140918
|
+
level: levels2[env_default.NODE_ENV] || "info",
|
|
141050
140919
|
transport,
|
|
141051
140920
|
base: {
|
|
141052
|
-
env:
|
|
140921
|
+
env: env_default.NODE_ENV,
|
|
141053
140922
|
service: "autosync"
|
|
141054
140923
|
},
|
|
141055
140924
|
timestamp: () => `,"time":"${new Date().toISOString()}"`
|
|
141056
140925
|
});
|
|
141057
|
-
var requestLogger = new Elysia({ name: "Middleware.RequestLogger" }).onRequest(({ request }) => {
|
|
140926
|
+
var requestLogger = new Elysia({ name: "Middleware.RequestLogger" }).onRequest(async ({ request }) => {
|
|
141058
140927
|
const url = new URL(request.url);
|
|
141059
140928
|
logger2.info({
|
|
141060
140929
|
msg: "Incoming request",
|
|
@@ -141065,7 +140934,7 @@ var requestLogger = new Elysia({ name: "Middleware.RequestLogger" }).onRequest((
|
|
|
141065
140934
|
"content-type": request.headers.get("content-type")
|
|
141066
140935
|
},
|
|
141067
140936
|
query: url.searchParams,
|
|
141068
|
-
body: request.
|
|
140937
|
+
body: await request.json()
|
|
141069
140938
|
});
|
|
141070
140939
|
}).onAfterResponse(async ({ request, response, server, status: status2, set: set2, body, headers }) => {
|
|
141071
140940
|
logger2.info({
|
|
@@ -141095,8 +140964,11 @@ var requestLogger = new Elysia({ name: "Middleware.RequestLogger" }).onRequest((
|
|
|
141095
140964
|
url: request.url,
|
|
141096
140965
|
code,
|
|
141097
140966
|
error: "message" in error2 ? error2.message : "Unknown error",
|
|
141098
|
-
stack: "stack" in error2 ? error2.stack : undefined
|
|
140967
|
+
stack: env_default.NODE_ENV === "development" && "stack" in error2 ? error2.stack : undefined
|
|
141099
140968
|
});
|
|
140969
|
+
if (code === "VALIDATION") {
|
|
140970
|
+
return error2.validator.Errors(error2.value).First().message;
|
|
140971
|
+
}
|
|
141100
140972
|
});
|
|
141101
140973
|
|
|
141102
140974
|
// src/lib/db/helpers/pagination.helper.ts
|
|
@@ -143264,11 +143136,17 @@ var CrmVehicleLogic;
|
|
|
143264
143136
|
return json2;
|
|
143265
143137
|
};
|
|
143266
143138
|
CrmVehicleLogic.findOrCreate = async (body, tdb = db_default) => {
|
|
143267
|
-
|
|
143139
|
+
if (body.licensePlate === undefined && body.vin === undefined) {
|
|
143140
|
+
return status("Bad Request", "\u041C\u0430\u0448\u0438\u043D\u044B \u0434\u0443\u0433\u0430\u0430\u0440 \u0431\u043E\u043B\u043E\u043D VIN \u0445\u043E\u0451\u0440\u043E\u043E\u0441 \u043D\u044D\u0433\u0438\u0439\u0433 \u043D\u044C \u043E\u0440\u0443\u0443\u043B\u043D\u0430 \u0443\u0443.");
|
|
143141
|
+
}
|
|
143142
|
+
if (body.vin && !body.vehicleKindId) {
|
|
143143
|
+
return status("Bad Request", "\u041C\u0430\u0448\u0438\u043D\u044B VIN \u043E\u0440\u0443\u0443\u043B\u0441\u0430\u043D \u0431\u043E\u043B \u043C\u0430\u0448\u0438\u043D\u044B \u0442\u04E9\u0440\u04E9\u043B \u043E\u0440\u0443\u0443\u043B\u043D\u0430 \u0443\u0443.");
|
|
143144
|
+
}
|
|
143145
|
+
const [currentVehicle] = await tdb.select().from(crmVehicleTable).where(body.vin ? eq(crmVehicleTable.vin, body.vin) : eq(crmVehicleTable.licensePlate, body.licensePlate)).limit(1);
|
|
143268
143146
|
if (currentVehicle) {
|
|
143269
143147
|
return currentVehicle;
|
|
143270
143148
|
}
|
|
143271
|
-
if (
|
|
143149
|
+
if (body.vehicleKindId) {
|
|
143272
143150
|
const [result2] = await tdb.insert(crmVehicleTable).values({
|
|
143273
143151
|
vehicleKindId: body.vehicleKindId,
|
|
143274
143152
|
vin: "vin" in body ? body.vin : null,
|
|
@@ -143572,7 +143450,11 @@ var CrmCpOrderLogic;
|
|
|
143572
143450
|
}, db2);
|
|
143573
143451
|
customerId = customer.id;
|
|
143574
143452
|
}
|
|
143575
|
-
const vehicle = await logic_default6.findOrCreate(
|
|
143453
|
+
const vehicle = await logic_default6.findOrCreate({
|
|
143454
|
+
vin: body.vin,
|
|
143455
|
+
licensePlate: body.licensePlate,
|
|
143456
|
+
vehicleKindId: body.vehicleKindId
|
|
143457
|
+
}, db2);
|
|
143576
143458
|
if ("code" in vehicle) {
|
|
143577
143459
|
return vehicle;
|
|
143578
143460
|
}
|
|
@@ -143652,17 +143534,9 @@ var CrmCpOrderModel;
|
|
|
143652
143534
|
minLength: 8,
|
|
143653
143535
|
maxLength: 8
|
|
143654
143536
|
})),
|
|
143655
|
-
|
|
143656
|
-
|
|
143657
|
-
|
|
143658
|
-
vehicleKindId: t.String({ format: "uuid" }),
|
|
143659
|
-
licensePlate: t.String()
|
|
143660
|
-
}),
|
|
143661
|
-
t.Object({
|
|
143662
|
-
vin: t.String(),
|
|
143663
|
-
vehicleKindId: t.String({ format: "uuid" })
|
|
143664
|
-
})
|
|
143665
|
-
])
|
|
143537
|
+
vin: t.Optional(t.String()),
|
|
143538
|
+
licensePlate: t.Optional(t.String()),
|
|
143539
|
+
vehicleKindId: t.Optional(t.String({ format: "uuid" }))
|
|
143666
143540
|
});
|
|
143667
143541
|
CrmCpOrderModel.addPackage = t.Object({
|
|
143668
143542
|
spPackageId: t.String({ format: "uuid" }),
|
|
@@ -143768,7 +143642,7 @@ var service_default = serviceRoutes;
|
|
|
143768
143642
|
var cpOrderRoutes = new Elysia({
|
|
143769
143643
|
prefix: "/cp-order",
|
|
143770
143644
|
tags: ["CrmCpOrder"]
|
|
143771
|
-
}).use(better_auth_default).
|
|
143645
|
+
}).use(better_auth_default).guard({ auth: true }).use(service_default).use(product_default).model(prefix_model_default("CrmCpOrderModel", model_default5)).post("/", async ({ body, user: user2 }) => logic_default10.create(body, user2), {
|
|
143772
143646
|
body: "CrmCpOrderModel.create"
|
|
143773
143647
|
}).post("/package", async ({ body, user: user2 }) => logic_default10.addPackage(body, user2), {
|
|
143774
143648
|
body: "CrmCpOrderModel.addPackage"
|
|
@@ -144483,7 +144357,7 @@ var userRoutes = new Elysia({
|
|
|
144483
144357
|
"USER_SELECT_ADMIN",
|
|
144484
144358
|
"USER_SELECT_OWN"
|
|
144485
144359
|
]
|
|
144486
|
-
}).post("/", async ({ body, user: user2, permissions }) => logic_default14.registerUser(body, user2, permissions), {
|
|
144360
|
+
}).get("/me", async ({ user: user2 }) => user2).post("/", async ({ body, user: user2, permissions }) => logic_default14.registerUser(body, user2, permissions), {
|
|
144487
144361
|
body: createUserSchema,
|
|
144488
144362
|
permission: ["USER_CREATE_ADMIN", "USER_CREATE_OWN"]
|
|
144489
144363
|
}).put("/:id", async ({ body, user: user2, permissions, params: { id } }) => logic_default14.update(id, body, user2, permissions), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosync_backend2",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"fast-xml-parser": "^5.2.5",
|
|
33
33
|
"generate-password": "^1.7.1",
|
|
34
34
|
"nodemailer": "^7.0.3",
|
|
35
|
-
"pg": "^8.16.
|
|
35
|
+
"pg": "^8.16.1",
|
|
36
36
|
"pino": "^9.7.0",
|
|
37
37
|
"pino-pretty": "^13.0.0",
|
|
38
38
|
"react": "^19.1.0",
|