autosync_backend2 1.2.17 → 1.2.18
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/index.d.ts +11 -8
- package/dist/index.js +389 -112
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -608,6 +608,7 @@ export declare const app: Elysia<"", {
|
|
|
608
608
|
alias: string | null;
|
|
609
609
|
companyId: string;
|
|
610
610
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
611
|
+
quantityUnit: number;
|
|
611
612
|
id: string;
|
|
612
613
|
createdAt: string;
|
|
613
614
|
updatedAt: string;
|
|
@@ -651,6 +652,7 @@ export declare const app: Elysia<"", {
|
|
|
651
652
|
barCode?: string | null | undefined;
|
|
652
653
|
oen?: string | null | undefined;
|
|
653
654
|
alias?: string | null | undefined;
|
|
655
|
+
quantityUnit?: number | undefined;
|
|
654
656
|
name: string;
|
|
655
657
|
supplierId: string;
|
|
656
658
|
priceSell: number;
|
|
@@ -679,6 +681,7 @@ export declare const app: Elysia<"", {
|
|
|
679
681
|
oen: string | null;
|
|
680
682
|
partNumber: string;
|
|
681
683
|
alias: string | null;
|
|
684
|
+
quantityUnit: number;
|
|
682
685
|
};
|
|
683
686
|
401: "Session not found";
|
|
684
687
|
422: {
|
|
@@ -705,6 +708,7 @@ export declare const app: Elysia<"", {
|
|
|
705
708
|
barCode?: string | null | undefined;
|
|
706
709
|
oen?: string | null | undefined;
|
|
707
710
|
alias?: string | null | undefined;
|
|
711
|
+
quantityUnit?: number | undefined;
|
|
708
712
|
name: string;
|
|
709
713
|
supplierId: string;
|
|
710
714
|
priceSell: number;
|
|
@@ -785,6 +789,7 @@ export declare const app: Elysia<"", {
|
|
|
785
789
|
oen?: string | null | undefined;
|
|
786
790
|
partNumber?: string | undefined;
|
|
787
791
|
alias?: string | null | undefined;
|
|
792
|
+
quantityUnit?: number | undefined;
|
|
788
793
|
};
|
|
789
794
|
params: {
|
|
790
795
|
id: string;
|
|
@@ -805,6 +810,7 @@ export declare const app: Elysia<"", {
|
|
|
805
810
|
alias: string | null;
|
|
806
811
|
companyId: string;
|
|
807
812
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
813
|
+
quantityUnit: number;
|
|
808
814
|
id: string;
|
|
809
815
|
createdAt: string;
|
|
810
816
|
updatedAt: string;
|
|
@@ -1011,7 +1017,6 @@ export declare const app: Elysia<"", {
|
|
|
1011
1017
|
warehouseId: string;
|
|
1012
1018
|
productId: string;
|
|
1013
1019
|
quantity: number;
|
|
1014
|
-
quantityUnit: number;
|
|
1015
1020
|
safetyStock: number;
|
|
1016
1021
|
shelfNumber: string | null;
|
|
1017
1022
|
description: string | null;
|
|
@@ -1046,6 +1051,7 @@ export declare const app: Elysia<"", {
|
|
|
1046
1051
|
alias: string | null;
|
|
1047
1052
|
companyId: string;
|
|
1048
1053
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
1054
|
+
quantityUnit: number;
|
|
1049
1055
|
id: string;
|
|
1050
1056
|
createdAt: string;
|
|
1051
1057
|
updatedAt: string;
|
|
@@ -1089,7 +1095,6 @@ export declare const app: Elysia<"", {
|
|
|
1089
1095
|
oldId?: number | null | undefined;
|
|
1090
1096
|
description?: string | null | undefined;
|
|
1091
1097
|
quantity?: number | undefined;
|
|
1092
|
-
quantityUnit?: number | undefined;
|
|
1093
1098
|
shelfNumber?: string | null | undefined;
|
|
1094
1099
|
isOrdered?: boolean | undefined;
|
|
1095
1100
|
productId: string;
|
|
@@ -1110,7 +1115,6 @@ export declare const app: Elysia<"", {
|
|
|
1110
1115
|
quantity: number;
|
|
1111
1116
|
productId: string;
|
|
1112
1117
|
warehouseId: string;
|
|
1113
|
-
quantityUnit: number;
|
|
1114
1118
|
safetyStock: number;
|
|
1115
1119
|
shelfNumber: string | null;
|
|
1116
1120
|
isOrdered: boolean;
|
|
@@ -1135,7 +1139,6 @@ export declare const app: Elysia<"", {
|
|
|
1135
1139
|
oldId?: number | null | undefined;
|
|
1136
1140
|
description?: string | null | undefined;
|
|
1137
1141
|
quantity?: number | undefined;
|
|
1138
|
-
quantityUnit?: number | undefined;
|
|
1139
1142
|
shelfNumber?: string | null | undefined;
|
|
1140
1143
|
isOrdered?: boolean | undefined;
|
|
1141
1144
|
productId: string;
|
|
@@ -1217,6 +1220,7 @@ export declare const app: Elysia<"", {
|
|
|
1217
1220
|
alias: string | null;
|
|
1218
1221
|
companyId: string;
|
|
1219
1222
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
1223
|
+
quantityUnit: number;
|
|
1220
1224
|
id: string;
|
|
1221
1225
|
createdAt: string;
|
|
1222
1226
|
updatedAt: string;
|
|
@@ -1227,7 +1231,6 @@ export declare const app: Elysia<"", {
|
|
|
1227
1231
|
warehouseId: string;
|
|
1228
1232
|
productId: string;
|
|
1229
1233
|
quantity: number;
|
|
1230
|
-
quantityUnit: number;
|
|
1231
1234
|
safetyStock: number;
|
|
1232
1235
|
shelfNumber: string | null;
|
|
1233
1236
|
description: string | null;
|
|
@@ -1301,7 +1304,6 @@ export declare const app: Elysia<"", {
|
|
|
1301
1304
|
warehouseId: string;
|
|
1302
1305
|
productId: string;
|
|
1303
1306
|
quantity: number;
|
|
1304
|
-
quantityUnit: number;
|
|
1305
1307
|
safetyStock: number;
|
|
1306
1308
|
shelfNumber: string | null;
|
|
1307
1309
|
description: string | null;
|
|
@@ -1337,7 +1339,6 @@ export declare const app: Elysia<"", {
|
|
|
1337
1339
|
description?: string | null | undefined;
|
|
1338
1340
|
productId?: string | undefined;
|
|
1339
1341
|
warehouseId?: string | undefined;
|
|
1340
|
-
quantityUnit?: number | undefined;
|
|
1341
1342
|
safetyStock?: number | undefined;
|
|
1342
1343
|
shelfNumber?: string | null | undefined;
|
|
1343
1344
|
isOrdered?: boolean | undefined;
|
|
@@ -1352,7 +1353,6 @@ export declare const app: Elysia<"", {
|
|
|
1352
1353
|
warehouseId: string;
|
|
1353
1354
|
productId: string;
|
|
1354
1355
|
quantity: number;
|
|
1355
|
-
quantityUnit: number;
|
|
1356
1356
|
safetyStock: number;
|
|
1357
1357
|
shelfNumber: string | null;
|
|
1358
1358
|
description: string | null;
|
|
@@ -3144,6 +3144,7 @@ export declare const app: Elysia<"", {
|
|
|
3144
3144
|
alias: string | null;
|
|
3145
3145
|
companyId: string;
|
|
3146
3146
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
3147
|
+
quantityUnit: number;
|
|
3147
3148
|
id: string;
|
|
3148
3149
|
createdAt: string;
|
|
3149
3150
|
updatedAt: string;
|
|
@@ -3843,6 +3844,7 @@ export declare const app: Elysia<"", {
|
|
|
3843
3844
|
state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
|
|
3844
3845
|
timeCompleted?: string | undefined;
|
|
3845
3846
|
model?: string | undefined;
|
|
3847
|
+
isPaid?: boolean | undefined;
|
|
3846
3848
|
pagination: {
|
|
3847
3849
|
size: number;
|
|
3848
3850
|
page: number;
|
|
@@ -4577,6 +4579,7 @@ export declare const app: Elysia<"", {
|
|
|
4577
4579
|
alias: string | null;
|
|
4578
4580
|
companyId: string;
|
|
4579
4581
|
type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
|
|
4582
|
+
quantityUnit: number;
|
|
4580
4583
|
id: string;
|
|
4581
4584
|
createdAt: string;
|
|
4582
4585
|
updatedAt: string;
|
package/dist/index.js
CHANGED
|
@@ -22792,8 +22792,8 @@ var require_caller = __commonJS((exports, module) => {
|
|
|
22792
22792
|
};
|
|
22793
22793
|
});
|
|
22794
22794
|
|
|
22795
|
-
// node_modules/
|
|
22796
|
-
var
|
|
22795
|
+
// node_modules/@pinojs/redact/index.js
|
|
22796
|
+
var require_redact = __commonJS((exports, module) => {
|
|
22797
22797
|
function deepClone2(obj2) {
|
|
22798
22798
|
if (obj2 === null || typeof obj2 !== "object") {
|
|
22799
22799
|
return obj2;
|
|
@@ -23296,7 +23296,7 @@ var require_symbols = __commonJS((exports, module) => {
|
|
|
23296
23296
|
|
|
23297
23297
|
// node_modules/pino/lib/redaction.js
|
|
23298
23298
|
var require_redaction = __commonJS((exports, module) => {
|
|
23299
|
-
var
|
|
23299
|
+
var Redact = require_redact();
|
|
23300
23300
|
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
23301
23301
|
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
23302
23302
|
var CENSOR = "[Redacted]";
|
|
@@ -23335,7 +23335,7 @@ var require_redaction = __commonJS((exports, module) => {
|
|
|
23335
23335
|
return o;
|
|
23336
23336
|
}, {});
|
|
23337
23337
|
const result = {
|
|
23338
|
-
[redactFmtSym]:
|
|
23338
|
+
[redactFmtSym]: Redact({ paths: paths2, censor, serialize, strict, remove })
|
|
23339
23339
|
};
|
|
23340
23340
|
const topCensor = (...args) => {
|
|
23341
23341
|
return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
|
|
@@ -23347,7 +23347,7 @@ var require_redaction = __commonJS((exports, module) => {
|
|
|
23347
23347
|
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
23348
23348
|
return censor(value, [k2, ...path]);
|
|
23349
23349
|
} : censor;
|
|
23350
|
-
o[k2] =
|
|
23350
|
+
o[k2] = Redact({
|
|
23351
23351
|
paths: shape[k2],
|
|
23352
23352
|
censor: wrappedCensor,
|
|
23353
23353
|
serialize,
|
|
@@ -25420,7 +25420,7 @@ var require_levels = __commonJS((exports, module) => {
|
|
|
25420
25420
|
|
|
25421
25421
|
// node_modules/pino/lib/meta.js
|
|
25422
25422
|
var require_meta = __commonJS((exports, module) => {
|
|
25423
|
-
module.exports = { version: "9.
|
|
25423
|
+
module.exports = { version: "9.14.0" };
|
|
25424
25424
|
});
|
|
25425
25425
|
|
|
25426
25426
|
// node_modules/pino/lib/proto.js
|
|
@@ -25524,6 +25524,7 @@ var require_proto = __commonJS((exports, module) => {
|
|
|
25524
25524
|
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
25525
25525
|
}
|
|
25526
25526
|
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
25527
|
+
instance[setLevelSym](this.level);
|
|
25527
25528
|
if (this.onChild !== noop2) {
|
|
25528
25529
|
this.onChild(instance);
|
|
25529
25530
|
}
|
|
@@ -25572,10 +25573,8 @@ var require_proto = __commonJS((exports, module) => {
|
|
|
25572
25573
|
instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
|
25573
25574
|
}
|
|
25574
25575
|
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
instance[setLevelSym](childLevel);
|
|
25578
|
-
}
|
|
25576
|
+
const childLevel = options.level || this.level;
|
|
25577
|
+
instance[setLevelSym](childLevel);
|
|
25579
25578
|
this.onChild(instance);
|
|
25580
25579
|
return instance;
|
|
25581
25580
|
}
|
|
@@ -136200,7 +136199,7 @@ class WithSubquery extends Subquery {
|
|
|
136200
136199
|
}
|
|
136201
136200
|
|
|
136202
136201
|
// node_modules/drizzle-orm/version.js
|
|
136203
|
-
var version4 = "0.44.
|
|
136202
|
+
var version4 = "0.44.7";
|
|
136204
136203
|
|
|
136205
136204
|
// node_modules/drizzle-orm/tracing.js
|
|
136206
136205
|
var otel;
|
|
@@ -142404,6 +142403,18 @@ __export(exports_schema, {
|
|
|
142404
142403
|
permissionTable: () => permissionTable,
|
|
142405
142404
|
permissionGroupTable: () => permissionGroupTable,
|
|
142406
142405
|
logTable: () => logTable,
|
|
142406
|
+
inspectionTemplateTable: () => inspectionTemplateTable,
|
|
142407
|
+
inspectionTemplateMachineKindTable: () => inspectionTemplateMachineKindTable,
|
|
142408
|
+
inspectionTemplateFieldTable: () => inspectionTemplateFieldTable,
|
|
142409
|
+
inspectionTable: () => inspectionTable,
|
|
142410
|
+
inspectionStateResultEnum: () => inspectionStateResultEnum,
|
|
142411
|
+
inspectionStateEnum: () => inspectionStateEnum,
|
|
142412
|
+
inspectionSchema: () => inspectionSchema,
|
|
142413
|
+
inspectionScheduleTable: () => inspectionScheduleTable,
|
|
142414
|
+
inspectionFieldTypeEnum: () => inspectionFieldTypeEnum,
|
|
142415
|
+
inspectionFieldTable: () => inspectionFieldTable,
|
|
142416
|
+
inspectionFieldResult: () => inspectionFieldResult,
|
|
142417
|
+
inspectionFieldGroupTable: () => inspectionFieldGroupTable,
|
|
142407
142418
|
dataStoreTable: () => dataStoreTable,
|
|
142408
142419
|
crmVehicleTable: () => crmVehicleTable,
|
|
142409
142420
|
crmVehicleRelations: () => crmVehicleRelations,
|
|
@@ -142926,6 +142937,99 @@ var crmInspectionTable = crmSchema.table("inspections", {
|
|
|
142926
142937
|
description: text(),
|
|
142927
142938
|
status: crmInspectionStatusEnum("status").notNull().default("CREATED")
|
|
142928
142939
|
});
|
|
142940
|
+
// src/lib/db/schema/fleet.schema.ts
|
|
142941
|
+
var inspectionSchema = pgSchema("inspection");
|
|
142942
|
+
var inspectionFieldGroupTable = inspectionSchema.table("field_group", {
|
|
142943
|
+
...base_schema_helper_default,
|
|
142944
|
+
code: varchar(),
|
|
142945
|
+
name: varchar().notNull(),
|
|
142946
|
+
description: text()
|
|
142947
|
+
});
|
|
142948
|
+
var inspectionFieldTypeEnum = inspectionSchema.enum("field_type_enum", ["BOOLEAN", "NUMERIC", "TEXT", "DATE", "RATE", "MULTI_CHOICE"]);
|
|
142949
|
+
var inspectionFieldTable = inspectionSchema.table("field", {
|
|
142950
|
+
...base_schema_helper_default,
|
|
142951
|
+
groupId: uuid5().notNull(),
|
|
142952
|
+
code: varchar(),
|
|
142953
|
+
description: text(),
|
|
142954
|
+
version: varchar(),
|
|
142955
|
+
isActive: boolean4().notNull().default(true),
|
|
142956
|
+
metadata: jsonb(),
|
|
142957
|
+
required: boolean4().notNull().default(false),
|
|
142958
|
+
fieldGroup: varchar(),
|
|
142959
|
+
sortIndex: integer2()
|
|
142960
|
+
});
|
|
142961
|
+
var inspectionTemplateTable = inspectionSchema.table("template", {
|
|
142962
|
+
...base_schema_helper_default,
|
|
142963
|
+
companyId: uuid5(),
|
|
142964
|
+
name: varchar().notNull(),
|
|
142965
|
+
description: text(),
|
|
142966
|
+
version: varchar(),
|
|
142967
|
+
isActive: boolean4().notNull().default(true)
|
|
142968
|
+
});
|
|
142969
|
+
var inspectionTemplateFieldTable = inspectionSchema.table("template_field", {
|
|
142970
|
+
...base_schema_helper_default,
|
|
142971
|
+
templateId: uuid5().notNull(),
|
|
142972
|
+
fieldGroupId: uuid5(),
|
|
142973
|
+
fieldGroup: varchar(),
|
|
142974
|
+
fieldId: uuid5().notNull(),
|
|
142975
|
+
code: varchar(),
|
|
142976
|
+
description: text(),
|
|
142977
|
+
fieldType: inspectionFieldTypeEnum().notNull(),
|
|
142978
|
+
required: boolean4().notNull().default(false),
|
|
142979
|
+
metadata: jsonb(),
|
|
142980
|
+
sortIndex: integer2()
|
|
142981
|
+
});
|
|
142982
|
+
var inspectionTemplateMachineKindTable = inspectionSchema.table("template_machine_kind", {
|
|
142983
|
+
templateId: uuid5().notNull(),
|
|
142984
|
+
machineKindId: uuid5().notNull()
|
|
142985
|
+
});
|
|
142986
|
+
var inspectionStateEnum = inspectionSchema.enum("state", [
|
|
142987
|
+
"CREATED",
|
|
142988
|
+
"SCHEDULED",
|
|
142989
|
+
"IN_PROGRESS",
|
|
142990
|
+
"COMPLETED"
|
|
142991
|
+
]);
|
|
142992
|
+
var inspectionStateResultEnum = inspectionSchema.enum("state_result", [
|
|
142993
|
+
"NOT_INSPECTED",
|
|
142994
|
+
"PASSED",
|
|
142995
|
+
"FAILED",
|
|
142996
|
+
"RETURNED",
|
|
142997
|
+
"WAIVED"
|
|
142998
|
+
]);
|
|
142999
|
+
var inspectionTable = inspectionSchema.table("inspection", {
|
|
143000
|
+
...base_schema_helper_default,
|
|
143001
|
+
machineId: uuid5().notNull(),
|
|
143002
|
+
templateId: uuid5().notNull(),
|
|
143003
|
+
employeeInspectedId: uuid5().notNull(),
|
|
143004
|
+
userInspectedId: uuid5().notNull(),
|
|
143005
|
+
hours: numeric({ mode: "number" }),
|
|
143006
|
+
mileageKm: numeric({ mode: "number" }),
|
|
143007
|
+
state: inspectionStateEnum().notNull().default("CREATED"),
|
|
143008
|
+
stateResult: inspectionStateResultEnum(),
|
|
143009
|
+
timeScheduled: timestamp({
|
|
143010
|
+
withTimezone: true
|
|
143011
|
+
}).notNull(),
|
|
143012
|
+
timeStarted: timestamp({ withTimezone: true }).notNull(),
|
|
143013
|
+
timeCompleted: timestamp({ withTimezone: true }).notNull(),
|
|
143014
|
+
note: text()
|
|
143015
|
+
});
|
|
143016
|
+
var inspectionFieldResult = inspectionSchema.table("field_result", {
|
|
143017
|
+
...base_schema_helper_default,
|
|
143018
|
+
inspectionId: uuid5().notNull(),
|
|
143019
|
+
templateFieldId: uuid5().notNull(),
|
|
143020
|
+
result: varchar(),
|
|
143021
|
+
numeric: numeric({ mode: "number" }),
|
|
143022
|
+
comment: varchar(),
|
|
143023
|
+
severityLevel: integer2()
|
|
143024
|
+
});
|
|
143025
|
+
var inspectionScheduleTable = inspectionSchema.table("schedule", {
|
|
143026
|
+
...base_schema_helper_default,
|
|
143027
|
+
machineId: uuid5().notNull(),
|
|
143028
|
+
templateId: uuid5().notNull(),
|
|
143029
|
+
daysInterval: integer2(),
|
|
143030
|
+
timeNextDue: timestamp({ withTimezone: true }),
|
|
143031
|
+
isActive: boolean4().notNull().default(true)
|
|
143032
|
+
});
|
|
142929
143033
|
// src/lib/db/schema/techdoc.schema.ts
|
|
142930
143034
|
var techdocSchema = pgSchema("techdoc");
|
|
142931
143035
|
var techdocVehicleKindEnum = pgEnum("vehicle_kind_enum", [
|
|
@@ -142976,7 +143080,8 @@ var warehouseProductTable = warehouseSchema.table("product", {
|
|
|
142976
143080
|
partNumber: varchar().notNull(),
|
|
142977
143081
|
alias: varchar(),
|
|
142978
143082
|
companyId: uuid5().notNull(),
|
|
142979
|
-
type: warehouseProductTypeEnum().notNull().default("\u0421\u044D\u043B\u0431\u044D\u0433")
|
|
143083
|
+
type: warehouseProductTypeEnum().notNull().default("\u0421\u044D\u043B\u0431\u044D\u0433"),
|
|
143084
|
+
quantityUnit: integer2().notNull().default(1)
|
|
142980
143085
|
});
|
|
142981
143086
|
var warehouseWarehouseTable = warehouseSchema.table("warehouse", {
|
|
142982
143087
|
...base_schema_helper_default,
|
|
@@ -142990,7 +143095,6 @@ var warehouseItemTable = warehouseSchema.table("item", {
|
|
|
142990
143095
|
warehouseId: uuid5().notNull(),
|
|
142991
143096
|
productId: uuid5().notNull(),
|
|
142992
143097
|
quantity: numeric({ mode: "number" }).notNull().default(0),
|
|
142993
|
-
quantityUnit: integer2().notNull().default(1),
|
|
142994
143098
|
safetyStock: numeric({ mode: "number" }).notNull(),
|
|
142995
143099
|
shelfNumber: varchar(),
|
|
142996
143100
|
description: text(),
|
|
@@ -143042,7 +143146,7 @@ var db_default = db;
|
|
|
143042
143146
|
var webCrypto = globalThis.crypto;
|
|
143043
143147
|
var subtle = webCrypto.subtle;
|
|
143044
143148
|
|
|
143045
|
-
// node_modules/@upstash/redis/chunk-
|
|
143149
|
+
// node_modules/@upstash/redis/chunk-TAJI6TAE.mjs
|
|
143046
143150
|
var __defProp6 = Object.defineProperty;
|
|
143047
143151
|
var __export4 = (target, all) => {
|
|
143048
143152
|
for (var name in all)
|
|
@@ -143051,11 +143155,12 @@ var __export4 = (target, all) => {
|
|
|
143051
143155
|
var error_exports = {};
|
|
143052
143156
|
__export4(error_exports, {
|
|
143053
143157
|
UpstashError: () => UpstashError,
|
|
143158
|
+
UpstashJSONParseError: () => UpstashJSONParseError,
|
|
143054
143159
|
UrlError: () => UrlError
|
|
143055
143160
|
});
|
|
143056
143161
|
var UpstashError = class extends Error {
|
|
143057
|
-
constructor(message2) {
|
|
143058
|
-
super(message2);
|
|
143162
|
+
constructor(message2, options) {
|
|
143163
|
+
super(message2, options);
|
|
143059
143164
|
this.name = "UpstashError";
|
|
143060
143165
|
}
|
|
143061
143166
|
};
|
|
@@ -143065,6 +143170,13 @@ var UrlError = class extends Error {
|
|
|
143065
143170
|
this.name = "UrlError";
|
|
143066
143171
|
}
|
|
143067
143172
|
};
|
|
143173
|
+
var UpstashJSONParseError = class extends UpstashError {
|
|
143174
|
+
constructor(body, options) {
|
|
143175
|
+
const truncatedBody = body.length > 200 ? body.slice(0, 200) + "..." : body;
|
|
143176
|
+
super(`Unable to parse response body: ${truncatedBody}`, options);
|
|
143177
|
+
this.name = "UpstashJSONParseError";
|
|
143178
|
+
}
|
|
143179
|
+
};
|
|
143068
143180
|
function parseRecursive(obj2) {
|
|
143069
143181
|
const parsed = Array.isArray(obj2) ? obj2.map((o) => {
|
|
143070
143182
|
try {
|
|
@@ -143207,7 +143319,13 @@ var HttpClient = class {
|
|
|
143207
143319
|
throw error3 ?? new Error("Exhausted all retries");
|
|
143208
143320
|
}
|
|
143209
143321
|
if (!res.ok) {
|
|
143210
|
-
|
|
143322
|
+
let body2;
|
|
143323
|
+
const rawBody2 = await res.text();
|
|
143324
|
+
try {
|
|
143325
|
+
body2 = JSON.parse(rawBody2);
|
|
143326
|
+
} catch (error22) {
|
|
143327
|
+
throw new UpstashJSONParseError(rawBody2, { cause: error22 });
|
|
143328
|
+
}
|
|
143211
143329
|
throw new UpstashError(`${body2.error}, command was: ${JSON.stringify(req.body)}`);
|
|
143212
143330
|
}
|
|
143213
143331
|
if (this.readYourWrites) {
|
|
@@ -143245,7 +143363,13 @@ var HttpClient = class {
|
|
|
143245
143363
|
})();
|
|
143246
143364
|
return { result: 1 };
|
|
143247
143365
|
}
|
|
143248
|
-
|
|
143366
|
+
let body;
|
|
143367
|
+
const rawBody = await res.text();
|
|
143368
|
+
try {
|
|
143369
|
+
body = JSON.parse(rawBody);
|
|
143370
|
+
} catch (error22) {
|
|
143371
|
+
throw new UpstashJSONParseError(rawBody, { cause: error22 });
|
|
143372
|
+
}
|
|
143249
143373
|
if (this.readYourWrites) {
|
|
143250
143374
|
const headers = res.headers;
|
|
143251
143375
|
this.upstashSyncToken = headers.get("upstash-sync-token") ?? "";
|
|
@@ -145829,7 +145953,7 @@ var Redis = class {
|
|
|
145829
145953
|
zunion = (...args) => new ZUnionCommand(args, this.opts).exec(this.client);
|
|
145830
145954
|
zunionstore = (...args) => new ZUnionStoreCommand(args, this.opts).exec(this.client);
|
|
145831
145955
|
};
|
|
145832
|
-
var VERSION = "v1.35.
|
|
145956
|
+
var VERSION = "v1.35.6";
|
|
145833
145957
|
|
|
145834
145958
|
// node_modules/@upstash/redis/nodejs.mjs
|
|
145835
145959
|
if (typeof atob === "undefined") {
|
|
@@ -149093,13 +149217,21 @@ class HTTPError extends Error {
|
|
|
149093
149217
|
}
|
|
149094
149218
|
}
|
|
149095
149219
|
|
|
149096
|
-
// node_modules/ky/distribution/errors/
|
|
149097
|
-
class
|
|
149098
|
-
|
|
149099
|
-
|
|
149100
|
-
|
|
149101
|
-
|
|
149102
|
-
|
|
149220
|
+
// node_modules/ky/distribution/errors/NonError.js
|
|
149221
|
+
class NonError extends Error {
|
|
149222
|
+
name = "NonError";
|
|
149223
|
+
value;
|
|
149224
|
+
constructor(value) {
|
|
149225
|
+
let message2 = "Non-error value was thrown";
|
|
149226
|
+
try {
|
|
149227
|
+
if (typeof value === "string") {
|
|
149228
|
+
message2 = value;
|
|
149229
|
+
} else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
|
|
149230
|
+
message2 = value.message;
|
|
149231
|
+
}
|
|
149232
|
+
} catch {}
|
|
149233
|
+
super(message2);
|
|
149234
|
+
this.value = value;
|
|
149103
149235
|
}
|
|
149104
149236
|
}
|
|
149105
149237
|
|
|
@@ -149160,7 +149292,11 @@ var kyOptionKeys = {
|
|
|
149160
149292
|
throwHttpErrors: true,
|
|
149161
149293
|
onDownloadProgress: true,
|
|
149162
149294
|
onUploadProgress: true,
|
|
149163
|
-
fetch: true
|
|
149295
|
+
fetch: true,
|
|
149296
|
+
context: true
|
|
149297
|
+
};
|
|
149298
|
+
var vendorSpecificOptions = {
|
|
149299
|
+
next: true
|
|
149164
149300
|
};
|
|
149165
149301
|
var requestOptionsRegistry = {
|
|
149166
149302
|
method: true,
|
|
@@ -149176,9 +149312,7 @@ var requestOptionsRegistry = {
|
|
|
149176
149312
|
keepalive: true,
|
|
149177
149313
|
signal: true,
|
|
149178
149314
|
window: true,
|
|
149179
|
-
|
|
149180
|
-
duplex: true,
|
|
149181
|
-
priority: true
|
|
149315
|
+
duplex: true
|
|
149182
149316
|
};
|
|
149183
149317
|
|
|
149184
149318
|
// node_modules/ky/distribution/utils/body.js
|
|
@@ -149255,7 +149389,7 @@ var streamResponse2 = (response, onDownloadProgress) => {
|
|
|
149255
149389
|
headers: response.headers
|
|
149256
149390
|
});
|
|
149257
149391
|
}
|
|
149258
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
149392
|
+
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
149259
149393
|
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
149260
149394
|
status: response.status,
|
|
149261
149395
|
statusText: response.statusText,
|
|
@@ -149307,10 +149441,44 @@ var mergeHooks = (original = {}, incoming = {}) => ({
|
|
|
149307
149441
|
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
149308
149442
|
beforeError: newHookValue(original, incoming, "beforeError")
|
|
149309
149443
|
});
|
|
149444
|
+
var appendSearchParameters = (target, source) => {
|
|
149445
|
+
const result = new URLSearchParams;
|
|
149446
|
+
for (const input of [target, source]) {
|
|
149447
|
+
if (input === undefined) {
|
|
149448
|
+
continue;
|
|
149449
|
+
}
|
|
149450
|
+
if (input instanceof URLSearchParams) {
|
|
149451
|
+
for (const [key, value] of input.entries()) {
|
|
149452
|
+
result.append(key, value);
|
|
149453
|
+
}
|
|
149454
|
+
} else if (Array.isArray(input)) {
|
|
149455
|
+
for (const pair of input) {
|
|
149456
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
149457
|
+
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
149458
|
+
}
|
|
149459
|
+
result.append(String(pair[0]), String(pair[1]));
|
|
149460
|
+
}
|
|
149461
|
+
} else if (isObject6(input)) {
|
|
149462
|
+
for (const [key, value] of Object.entries(input)) {
|
|
149463
|
+
if (value !== undefined) {
|
|
149464
|
+
result.append(key, String(value));
|
|
149465
|
+
}
|
|
149466
|
+
}
|
|
149467
|
+
} else {
|
|
149468
|
+
const parameters = new URLSearchParams(input);
|
|
149469
|
+
for (const [key, value] of parameters.entries()) {
|
|
149470
|
+
result.append(key, value);
|
|
149471
|
+
}
|
|
149472
|
+
}
|
|
149473
|
+
}
|
|
149474
|
+
return result;
|
|
149475
|
+
};
|
|
149310
149476
|
var deepMerge = (...sources) => {
|
|
149311
149477
|
let returnValue = {};
|
|
149312
149478
|
let headers = {};
|
|
149313
149479
|
let hooks = {};
|
|
149480
|
+
let searchParameters;
|
|
149481
|
+
const signals = [];
|
|
149314
149482
|
for (const source of sources) {
|
|
149315
149483
|
if (Array.isArray(source)) {
|
|
149316
149484
|
if (!Array.isArray(returnValue)) {
|
|
@@ -149319,6 +149487,28 @@ var deepMerge = (...sources) => {
|
|
|
149319
149487
|
returnValue = [...returnValue, ...source];
|
|
149320
149488
|
} else if (isObject6(source)) {
|
|
149321
149489
|
for (let [key, value] of Object.entries(source)) {
|
|
149490
|
+
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
149491
|
+
signals.push(value);
|
|
149492
|
+
continue;
|
|
149493
|
+
}
|
|
149494
|
+
if (key === "context") {
|
|
149495
|
+
if (value !== undefined && value !== null && (!isObject6(value) || Array.isArray(value))) {
|
|
149496
|
+
throw new TypeError("The `context` option must be an object");
|
|
149497
|
+
}
|
|
149498
|
+
returnValue = {
|
|
149499
|
+
...returnValue,
|
|
149500
|
+
context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
|
|
149501
|
+
};
|
|
149502
|
+
continue;
|
|
149503
|
+
}
|
|
149504
|
+
if (key === "searchParams") {
|
|
149505
|
+
if (value === undefined || value === null) {
|
|
149506
|
+
searchParameters = undefined;
|
|
149507
|
+
} else {
|
|
149508
|
+
searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
|
|
149509
|
+
}
|
|
149510
|
+
continue;
|
|
149511
|
+
}
|
|
149322
149512
|
if (isObject6(value) && key in returnValue) {
|
|
149323
149513
|
value = deepMerge(returnValue[key], value);
|
|
149324
149514
|
}
|
|
@@ -149334,6 +149524,21 @@ var deepMerge = (...sources) => {
|
|
|
149334
149524
|
}
|
|
149335
149525
|
}
|
|
149336
149526
|
}
|
|
149527
|
+
if (searchParameters !== undefined) {
|
|
149528
|
+
returnValue.searchParams = searchParameters;
|
|
149529
|
+
}
|
|
149530
|
+
if (signals.length > 0) {
|
|
149531
|
+
if (signals.length === 1) {
|
|
149532
|
+
returnValue.signal = signals[0];
|
|
149533
|
+
} else if (supportsAbortSignal) {
|
|
149534
|
+
returnValue.signal = AbortSignal.any(signals);
|
|
149535
|
+
} else {
|
|
149536
|
+
returnValue.signal = signals.at(-1);
|
|
149537
|
+
}
|
|
149538
|
+
}
|
|
149539
|
+
if (returnValue.context === undefined) {
|
|
149540
|
+
returnValue.context = {};
|
|
149541
|
+
}
|
|
149337
149542
|
return returnValue;
|
|
149338
149543
|
};
|
|
149339
149544
|
|
|
@@ -149349,7 +149554,9 @@ var defaultRetryOptions = {
|
|
|
149349
149554
|
afterStatusCodes: retryAfterStatusCodes,
|
|
149350
149555
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
149351
149556
|
backoffLimit: Number.POSITIVE_INFINITY,
|
|
149352
|
-
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000
|
|
149557
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
|
|
149558
|
+
jitter: undefined,
|
|
149559
|
+
retryOnTimeout: false
|
|
149353
149560
|
};
|
|
149354
149561
|
var normalizeRetryOptions = (retry = {}) => {
|
|
149355
149562
|
if (typeof retry === "number") {
|
|
@@ -149370,6 +149577,16 @@ var normalizeRetryOptions = (retry = {}) => {
|
|
|
149370
149577
|
};
|
|
149371
149578
|
};
|
|
149372
149579
|
|
|
149580
|
+
// node_modules/ky/distribution/errors/TimeoutError.js
|
|
149581
|
+
class TimeoutError extends Error {
|
|
149582
|
+
request;
|
|
149583
|
+
constructor(request) {
|
|
149584
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
149585
|
+
this.name = "TimeoutError";
|
|
149586
|
+
this.request = request;
|
|
149587
|
+
}
|
|
149588
|
+
}
|
|
149589
|
+
|
|
149373
149590
|
// node_modules/ky/distribution/utils/timeout.js
|
|
149374
149591
|
async function timeout(request, init2, abortController, options) {
|
|
149375
149592
|
return new Promise((resolve, reject) => {
|
|
@@ -149407,7 +149624,10 @@ async function delay(ms2, { signal }) {
|
|
|
149407
149624
|
var findUnknownOptions = (request, options) => {
|
|
149408
149625
|
const unknownOptions = {};
|
|
149409
149626
|
for (const key in options) {
|
|
149410
|
-
if (!(
|
|
149627
|
+
if (!Object.hasOwn(options, key)) {
|
|
149628
|
+
continue;
|
|
149629
|
+
}
|
|
149630
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
|
|
149411
149631
|
unknownOptions[key] = options[key];
|
|
149412
149632
|
}
|
|
149413
149633
|
}
|
|
@@ -149432,44 +149652,52 @@ var hasSearchParameters = (search) => {
|
|
|
149432
149652
|
return Boolean(search);
|
|
149433
149653
|
};
|
|
149434
149654
|
|
|
149655
|
+
// node_modules/ky/distribution/utils/type-guards.js
|
|
149656
|
+
function isHTTPError(error3) {
|
|
149657
|
+
return error3 instanceof HTTPError || error3?.name === HTTPError.name;
|
|
149658
|
+
}
|
|
149659
|
+
function isTimeoutError(error3) {
|
|
149660
|
+
return error3 instanceof TimeoutError || error3?.name === TimeoutError.name;
|
|
149661
|
+
}
|
|
149662
|
+
|
|
149435
149663
|
// node_modules/ky/distribution/core/Ky.js
|
|
149436
149664
|
class Ky {
|
|
149437
149665
|
static create(input, options) {
|
|
149438
149666
|
const ky = new Ky(input, options);
|
|
149439
149667
|
const function_ = async () => {
|
|
149440
|
-
if (typeof ky.
|
|
149668
|
+
if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
|
|
149441
149669
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
149442
149670
|
}
|
|
149443
149671
|
await Promise.resolve();
|
|
149444
|
-
let response = await ky
|
|
149445
|
-
for (const hook of ky.
|
|
149446
|
-
const modifiedResponse = await hook(ky.request, ky
|
|
149672
|
+
let response = await ky.#fetch();
|
|
149673
|
+
for (const hook of ky.#options.hooks.afterResponse) {
|
|
149674
|
+
const modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), ky.#decorateResponse(response.clone()), { retryCount: ky.#retryCount });
|
|
149447
149675
|
if (modifiedResponse instanceof globalThis.Response) {
|
|
149448
149676
|
response = modifiedResponse;
|
|
149449
149677
|
}
|
|
149450
149678
|
}
|
|
149451
|
-
ky
|
|
149452
|
-
if (!response.ok && ky.
|
|
149453
|
-
let error3 = new HTTPError(response, ky.request, ky
|
|
149454
|
-
for (const hook of ky.
|
|
149455
|
-
error3 = await hook(error3);
|
|
149679
|
+
ky.#decorateResponse(response);
|
|
149680
|
+
if (!response.ok && ky.#options.throwHttpErrors) {
|
|
149681
|
+
let error3 = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
149682
|
+
for (const hook of ky.#options.hooks.beforeError) {
|
|
149683
|
+
error3 = await hook(error3, { retryCount: ky.#retryCount });
|
|
149456
149684
|
}
|
|
149457
149685
|
throw error3;
|
|
149458
149686
|
}
|
|
149459
|
-
if (ky.
|
|
149460
|
-
if (typeof ky.
|
|
149687
|
+
if (ky.#options.onDownloadProgress) {
|
|
149688
|
+
if (typeof ky.#options.onDownloadProgress !== "function") {
|
|
149461
149689
|
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
149462
149690
|
}
|
|
149463
149691
|
if (!supportsResponseStreams) {
|
|
149464
149692
|
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
149465
149693
|
}
|
|
149466
|
-
return streamResponse2(response.clone(), ky.
|
|
149694
|
+
return streamResponse2(response.clone(), ky.#options.onDownloadProgress);
|
|
149467
149695
|
}
|
|
149468
149696
|
return response;
|
|
149469
149697
|
};
|
|
149470
|
-
const isRetriableMethod = ky.
|
|
149471
|
-
const result = (isRetriableMethod ? ky
|
|
149472
|
-
const originalRequest = ky
|
|
149698
|
+
const isRetriableMethod = ky.#options.retry.methods.includes(ky.request.method.toLowerCase());
|
|
149699
|
+
const result = (isRetriableMethod ? ky.#retry(function_) : function_()).finally(async () => {
|
|
149700
|
+
const originalRequest = ky.#originalRequest;
|
|
149473
149701
|
const cleanupPromises = [];
|
|
149474
149702
|
if (originalRequest && !originalRequest.bodyUsed) {
|
|
149475
149703
|
cleanupPromises.push(originalRequest.body?.cancel());
|
|
@@ -149511,65 +149739,69 @@ class Ky {
|
|
|
149511
149739
|
return searchParams;
|
|
149512
149740
|
}
|
|
149513
149741
|
request;
|
|
149514
|
-
abortController;
|
|
149515
|
-
|
|
149516
|
-
|
|
149517
|
-
|
|
149518
|
-
|
|
149742
|
+
#abortController;
|
|
149743
|
+
#retryCount = 0;
|
|
149744
|
+
#input;
|
|
149745
|
+
#options;
|
|
149746
|
+
#originalRequest;
|
|
149747
|
+
#userProvidedAbortSignal;
|
|
149748
|
+
#cachedNormalizedOptions;
|
|
149519
149749
|
constructor(input, options = {}) {
|
|
149520
|
-
this
|
|
149521
|
-
this
|
|
149750
|
+
this.#input = input;
|
|
149751
|
+
this.#options = {
|
|
149522
149752
|
...options,
|
|
149523
|
-
headers: mergeHeaders2(this.
|
|
149753
|
+
headers: mergeHeaders2(this.#input.headers, options.headers),
|
|
149524
149754
|
hooks: mergeHooks({
|
|
149525
149755
|
beforeRequest: [],
|
|
149526
149756
|
beforeRetry: [],
|
|
149527
149757
|
beforeError: [],
|
|
149528
149758
|
afterResponse: []
|
|
149529
149759
|
}, options.hooks),
|
|
149530
|
-
method: normalizeRequestMethod(options.method ?? this.
|
|
149760
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
149531
149761
|
prefixUrl: String(options.prefixUrl || ""),
|
|
149532
149762
|
retry: normalizeRetryOptions(options.retry),
|
|
149533
149763
|
throwHttpErrors: options.throwHttpErrors !== false,
|
|
149534
149764
|
timeout: options.timeout ?? 1e4,
|
|
149535
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
149765
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
149766
|
+
context: options.context ?? {}
|
|
149536
149767
|
};
|
|
149537
|
-
if (typeof this
|
|
149768
|
+
if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
149538
149769
|
throw new TypeError("`input` must be a string, URL, or Request");
|
|
149539
149770
|
}
|
|
149540
|
-
if (this.
|
|
149541
|
-
if (this.
|
|
149771
|
+
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
149772
|
+
if (this.#input.startsWith("/")) {
|
|
149542
149773
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
149543
149774
|
}
|
|
149544
|
-
if (!this.
|
|
149545
|
-
this.
|
|
149775
|
+
if (!this.#options.prefixUrl.endsWith("/")) {
|
|
149776
|
+
this.#options.prefixUrl += "/";
|
|
149546
149777
|
}
|
|
149547
|
-
this
|
|
149778
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
149548
149779
|
}
|
|
149549
149780
|
if (supportsAbortController && supportsAbortSignal) {
|
|
149550
|
-
|
|
149551
|
-
this
|
|
149552
|
-
this.
|
|
149781
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
149782
|
+
this.#abortController = new globalThis.AbortController;
|
|
149783
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
149553
149784
|
}
|
|
149554
149785
|
if (supportsRequestStreams) {
|
|
149555
|
-
this.
|
|
149786
|
+
this.#options.duplex = "half";
|
|
149556
149787
|
}
|
|
149557
|
-
if (this.
|
|
149558
|
-
this.
|
|
149559
|
-
this.
|
|
149788
|
+
if (this.#options.json !== undefined) {
|
|
149789
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
149790
|
+
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
149560
149791
|
}
|
|
149561
|
-
|
|
149562
|
-
if (
|
|
149563
|
-
|
|
149792
|
+
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
149793
|
+
if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
|
|
149794
|
+
this.#options.headers.delete("content-type");
|
|
149795
|
+
}
|
|
149796
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
149797
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
149798
|
+
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
149564
149799
|
const searchParams = "?" + textSearchParams;
|
|
149565
149800
|
const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
149566
|
-
|
|
149567
|
-
this.request.headers.delete("content-type");
|
|
149568
|
-
}
|
|
149569
|
-
this.request = new globalThis.Request(new globalThis.Request(url2, { ...this.request }), this._options);
|
|
149801
|
+
this.request = new globalThis.Request(new globalThis.Request(url2, { ...this.request }), this.#options);
|
|
149570
149802
|
}
|
|
149571
|
-
if (this.
|
|
149572
|
-
if (typeof this.
|
|
149803
|
+
if (this.#options.onUploadProgress) {
|
|
149804
|
+
if (typeof this.#options.onUploadProgress !== "function") {
|
|
149573
149805
|
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
149574
149806
|
}
|
|
149575
149807
|
if (!supportsRequestStreams) {
|
|
@@ -149577,69 +149809,106 @@ class Ky {
|
|
|
149577
149809
|
}
|
|
149578
149810
|
const originalBody = this.request.body;
|
|
149579
149811
|
if (originalBody) {
|
|
149580
|
-
this.request = streamRequest(this.request, this.
|
|
149812
|
+
this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
|
|
149813
|
+
}
|
|
149814
|
+
}
|
|
149815
|
+
}
|
|
149816
|
+
#calculateDelay() {
|
|
149817
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
149818
|
+
let jitteredDelay = retryDelay;
|
|
149819
|
+
if (this.#options.retry.jitter === true) {
|
|
149820
|
+
jitteredDelay = Math.random() * retryDelay;
|
|
149821
|
+
} else if (typeof this.#options.retry.jitter === "function") {
|
|
149822
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
149823
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
149824
|
+
jitteredDelay = retryDelay;
|
|
149581
149825
|
}
|
|
149582
149826
|
}
|
|
149827
|
+
return Math.min(this.#options.retry.backoffLimit, jitteredDelay);
|
|
149583
149828
|
}
|
|
149584
|
-
|
|
149585
|
-
this
|
|
149586
|
-
if (this
|
|
149829
|
+
async#calculateRetryDelay(error3) {
|
|
149830
|
+
this.#retryCount++;
|
|
149831
|
+
if (this.#retryCount > this.#options.retry.limit) {
|
|
149832
|
+
throw error3;
|
|
149833
|
+
}
|
|
149834
|
+
const errorObject = error3 instanceof Error ? error3 : new NonError(error3);
|
|
149835
|
+
if (this.#options.retry.shouldRetry !== undefined) {
|
|
149836
|
+
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
149837
|
+
if (result === false) {
|
|
149838
|
+
throw error3;
|
|
149839
|
+
}
|
|
149840
|
+
if (result === true) {
|
|
149841
|
+
return this.#calculateDelay();
|
|
149842
|
+
}
|
|
149843
|
+
}
|
|
149844
|
+
if (isTimeoutError(error3) && !this.#options.retry.retryOnTimeout) {
|
|
149587
149845
|
throw error3;
|
|
149588
149846
|
}
|
|
149589
|
-
if (error3
|
|
149590
|
-
if (!this.
|
|
149847
|
+
if (isHTTPError(error3)) {
|
|
149848
|
+
if (!this.#options.retry.statusCodes.includes(error3.response.status)) {
|
|
149591
149849
|
throw error3;
|
|
149592
149850
|
}
|
|
149593
|
-
const retryAfter = error3.response.headers.get("Retry-After") ?? error3.response.headers.get("RateLimit-Reset") ?? error3.response.headers.get("X-RateLimit-Reset") ?? error3.response.headers.get("X-Rate-Limit-Reset");
|
|
149594
|
-
if (retryAfter && this.
|
|
149851
|
+
const retryAfter = error3.response.headers.get("Retry-After") ?? error3.response.headers.get("RateLimit-Reset") ?? error3.response.headers.get("X-RateLimit-Retry-After") ?? error3.response.headers.get("X-RateLimit-Reset") ?? error3.response.headers.get("X-Rate-Limit-Reset");
|
|
149852
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error3.response.status)) {
|
|
149595
149853
|
let after = Number(retryAfter) * 1000;
|
|
149596
149854
|
if (Number.isNaN(after)) {
|
|
149597
149855
|
after = Date.parse(retryAfter) - Date.now();
|
|
149598
149856
|
} else if (after >= Date.parse("2024-01-01")) {
|
|
149599
149857
|
after -= Date.now();
|
|
149600
149858
|
}
|
|
149601
|
-
const max2 = this.
|
|
149859
|
+
const max2 = this.#options.retry.maxRetryAfter ?? after;
|
|
149602
149860
|
return after < max2 ? after : max2;
|
|
149603
149861
|
}
|
|
149604
149862
|
if (error3.response.status === 413) {
|
|
149605
149863
|
throw error3;
|
|
149606
149864
|
}
|
|
149607
149865
|
}
|
|
149608
|
-
|
|
149609
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
149866
|
+
return this.#calculateDelay();
|
|
149610
149867
|
}
|
|
149611
|
-
|
|
149612
|
-
if (this.
|
|
149613
|
-
response.json = async () => this.
|
|
149868
|
+
#decorateResponse(response) {
|
|
149869
|
+
if (this.#options.parseJson) {
|
|
149870
|
+
response.json = async () => this.#options.parseJson(await response.text());
|
|
149614
149871
|
}
|
|
149615
149872
|
return response;
|
|
149616
149873
|
}
|
|
149617
|
-
async
|
|
149874
|
+
async#retry(function_) {
|
|
149618
149875
|
try {
|
|
149619
149876
|
return await function_();
|
|
149620
149877
|
} catch (error3) {
|
|
149621
|
-
const ms2 = Math.min(this
|
|
149622
|
-
if (this
|
|
149878
|
+
const ms2 = Math.min(await this.#calculateRetryDelay(error3), maxSafeTimeout);
|
|
149879
|
+
if (this.#retryCount < 1) {
|
|
149623
149880
|
throw error3;
|
|
149624
149881
|
}
|
|
149625
|
-
await delay(ms2, { signal: this
|
|
149626
|
-
for (const hook of this.
|
|
149882
|
+
await delay(ms2, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
149883
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
149627
149884
|
const hookResult = await hook({
|
|
149628
149885
|
request: this.request,
|
|
149629
|
-
options: this
|
|
149886
|
+
options: this.#getNormalizedOptions(),
|
|
149630
149887
|
error: error3,
|
|
149631
|
-
retryCount: this
|
|
149888
|
+
retryCount: this.#retryCount
|
|
149632
149889
|
});
|
|
149890
|
+
if (hookResult instanceof globalThis.Request) {
|
|
149891
|
+
this.request = hookResult;
|
|
149892
|
+
break;
|
|
149893
|
+
}
|
|
149894
|
+
if (hookResult instanceof globalThis.Response) {
|
|
149895
|
+
return hookResult;
|
|
149896
|
+
}
|
|
149633
149897
|
if (hookResult === stop) {
|
|
149634
149898
|
return;
|
|
149635
149899
|
}
|
|
149636
149900
|
}
|
|
149637
|
-
return this
|
|
149901
|
+
return this.#retry(function_);
|
|
149638
149902
|
}
|
|
149639
149903
|
}
|
|
149640
|
-
async
|
|
149641
|
-
|
|
149642
|
-
|
|
149904
|
+
async#fetch() {
|
|
149905
|
+
if (this.#abortController?.signal.aborted) {
|
|
149906
|
+
this.#abortController = new globalThis.AbortController;
|
|
149907
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
149908
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
149909
|
+
}
|
|
149910
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
149911
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
149643
149912
|
if (result instanceof Request) {
|
|
149644
149913
|
this.request = result;
|
|
149645
149914
|
break;
|
|
@@ -149648,13 +149917,20 @@ class Ky {
|
|
|
149648
149917
|
return result;
|
|
149649
149918
|
}
|
|
149650
149919
|
}
|
|
149651
|
-
const nonRequestOptions = findUnknownOptions(this.request, this
|
|
149652
|
-
this
|
|
149653
|
-
this.request = this.
|
|
149654
|
-
if (this.
|
|
149655
|
-
return this.
|
|
149920
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
149921
|
+
this.#originalRequest = this.request;
|
|
149922
|
+
this.request = this.#originalRequest.clone();
|
|
149923
|
+
if (this.#options.timeout === false) {
|
|
149924
|
+
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
149925
|
+
}
|
|
149926
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
149927
|
+
}
|
|
149928
|
+
#getNormalizedOptions() {
|
|
149929
|
+
if (!this.#cachedNormalizedOptions) {
|
|
149930
|
+
const { hooks, ...normalizedOptions } = this.#options;
|
|
149931
|
+
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
149656
149932
|
}
|
|
149657
|
-
return
|
|
149933
|
+
return this.#cachedNormalizedOptions;
|
|
149658
149934
|
}
|
|
149659
149935
|
}
|
|
149660
149936
|
|
|
@@ -151329,7 +151605,8 @@ var CrmCpOrderModel;
|
|
|
151329
151605
|
type: t.UnionEnum(crmCpOrderTypeEnum.enumValues, {
|
|
151330
151606
|
default: "Service"
|
|
151331
151607
|
}),
|
|
151332
|
-
oldId: t.Number()
|
|
151608
|
+
oldId: t.Number(),
|
|
151609
|
+
isPaid: t.Boolean()
|
|
151333
151610
|
}))
|
|
151334
151611
|
]);
|
|
151335
151612
|
CrmCpOrderModel.complete = t.Object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosync_backend2",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"@sinclair/typebox": "^0.34.40",
|
|
30
30
|
"@upstash/redis": "^1.35.4",
|
|
31
31
|
"better-auth": "1.3.23",
|
|
32
|
-
"drizzle-orm": "^0.44.
|
|
32
|
+
"drizzle-orm": "^0.44.7",
|
|
33
33
|
"drizzle-typebox": "^0.3.3",
|
|
34
|
-
"elysia": "1.4.
|
|
34
|
+
"elysia": "1.4.13",
|
|
35
35
|
"exceljs": "^4.4.0",
|
|
36
36
|
"fast-xml-parser": "^5.2.5",
|
|
37
37
|
"generate-password": "^1.7.1",
|
|
38
|
-
"ky": "^1.
|
|
38
|
+
"ky": "^1.13.0",
|
|
39
39
|
"mn-payment": "^0.0.20",
|
|
40
40
|
"nodemailer": "^7.0.3",
|
|
41
41
|
"pg": "^8.16.3",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"xlsx": "^0.18.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@biomejs/biome": "^2.2.
|
|
49
|
+
"@biomejs/biome": "^2.2.7",
|
|
50
50
|
"@electric-sql/pglite": "^0.3.6",
|
|
51
51
|
"@types/nodemailer": "^6.4.17",
|
|
52
52
|
"@types/pg": "^8.15.4",
|
|
53
53
|
"@types/react": "^19.1.8",
|
|
54
54
|
"@types/react-dom": "^19.1.6",
|
|
55
|
-
"bun-types": "1.3.
|
|
55
|
+
"bun-types": "1.3.1",
|
|
56
56
|
"drizzle-kit": "^0.31.4",
|
|
57
57
|
"husky": "^9.1.7",
|
|
58
58
|
"react-email": "^4.0.16",
|