autosync_backend2 1.2.16 → 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 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;
@@ -1045,6 +1051,7 @@ export declare const app: Elysia<"", {
1045
1051
  alias: string | null;
1046
1052
  companyId: string;
1047
1053
  type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
1054
+ quantityUnit: number;
1048
1055
  id: string;
1049
1056
  createdAt: string;
1050
1057
  updatedAt: string;
@@ -1213,6 +1220,7 @@ export declare const app: Elysia<"", {
1213
1220
  alias: string | null;
1214
1221
  companyId: string;
1215
1222
  type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
1223
+ quantityUnit: number;
1216
1224
  id: string;
1217
1225
  createdAt: string;
1218
1226
  updatedAt: string;
@@ -3136,6 +3144,7 @@ export declare const app: Elysia<"", {
3136
3144
  alias: string | null;
3137
3145
  companyId: string;
3138
3146
  type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
3147
+ quantityUnit: number;
3139
3148
  id: string;
3140
3149
  createdAt: string;
3141
3150
  updatedAt: string;
@@ -3835,6 +3844,7 @@ export declare const app: Elysia<"", {
3835
3844
  state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
3836
3845
  timeCompleted?: string | undefined;
3837
3846
  model?: string | undefined;
3847
+ isPaid?: boolean | undefined;
3838
3848
  pagination: {
3839
3849
  size: number;
3840
3850
  page: number;
@@ -4569,6 +4579,7 @@ export declare const app: Elysia<"", {
4569
4579
  alias: string | null;
4570
4580
  companyId: string;
4571
4581
  type: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор";
4582
+ quantityUnit: number;
4572
4583
  id: string;
4573
4584
  createdAt: string;
4574
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/slow-redact/index.js
22796
- var require_slow_redact = __commonJS((exports, module) => {
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 slowRedact = require_slow_redact();
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]: slowRedact({ paths: paths2, censor, serialize, strict, remove })
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] = slowRedact({
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.13.1" };
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
- if (options.level !== undefined && options.level !== this.level || options.hasOwnProperty("customLevels")) {
25576
- const childLevel = options.level || this.level;
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.6";
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,
@@ -143041,7 +143146,7 @@ var db_default = db;
143041
143146
  var webCrypto = globalThis.crypto;
143042
143147
  var subtle = webCrypto.subtle;
143043
143148
 
143044
- // node_modules/@upstash/redis/chunk-CXQK4IKU.mjs
143149
+ // node_modules/@upstash/redis/chunk-TAJI6TAE.mjs
143045
143150
  var __defProp6 = Object.defineProperty;
143046
143151
  var __export4 = (target, all) => {
143047
143152
  for (var name in all)
@@ -143050,11 +143155,12 @@ var __export4 = (target, all) => {
143050
143155
  var error_exports = {};
143051
143156
  __export4(error_exports, {
143052
143157
  UpstashError: () => UpstashError,
143158
+ UpstashJSONParseError: () => UpstashJSONParseError,
143053
143159
  UrlError: () => UrlError
143054
143160
  });
143055
143161
  var UpstashError = class extends Error {
143056
- constructor(message2) {
143057
- super(message2);
143162
+ constructor(message2, options) {
143163
+ super(message2, options);
143058
143164
  this.name = "UpstashError";
143059
143165
  }
143060
143166
  };
@@ -143064,6 +143170,13 @@ var UrlError = class extends Error {
143064
143170
  this.name = "UrlError";
143065
143171
  }
143066
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
+ };
143067
143180
  function parseRecursive(obj2) {
143068
143181
  const parsed = Array.isArray(obj2) ? obj2.map((o) => {
143069
143182
  try {
@@ -143206,7 +143319,13 @@ var HttpClient = class {
143206
143319
  throw error3 ?? new Error("Exhausted all retries");
143207
143320
  }
143208
143321
  if (!res.ok) {
143209
- const body2 = await res.json();
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
+ }
143210
143329
  throw new UpstashError(`${body2.error}, command was: ${JSON.stringify(req.body)}`);
143211
143330
  }
143212
143331
  if (this.readYourWrites) {
@@ -143244,7 +143363,13 @@ var HttpClient = class {
143244
143363
  })();
143245
143364
  return { result: 1 };
143246
143365
  }
143247
- const body = await res.json();
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
+ }
143248
143373
  if (this.readYourWrites) {
143249
143374
  const headers = res.headers;
143250
143375
  this.upstashSyncToken = headers.get("upstash-sync-token") ?? "";
@@ -145828,7 +145953,7 @@ var Redis = class {
145828
145953
  zunion = (...args) => new ZUnionCommand(args, this.opts).exec(this.client);
145829
145954
  zunionstore = (...args) => new ZUnionStoreCommand(args, this.opts).exec(this.client);
145830
145955
  };
145831
- var VERSION = "v1.35.5";
145956
+ var VERSION = "v1.35.6";
145832
145957
 
145833
145958
  // node_modules/@upstash/redis/nodejs.mjs
145834
145959
  if (typeof atob === "undefined") {
@@ -147251,7 +147376,8 @@ var WarehouseItemLogic;
147251
147376
  return status("Bad Request", "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u04AF\u043B\u0434\u044D\u0433\u0434\u044D\u043B \u0445\u04AF\u0440\u044D\u043B\u0446\u044D\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430.");
147252
147377
  }
147253
147378
  const [updatedItem] = await tdb.update(warehouseItemTable).set({
147254
- quantity: quantityAfter
147379
+ quantity: quantityAfter,
147380
+ deletedAt: null
147255
147381
  }).where(eq(warehouseItemTable.id, itemId)).returning();
147256
147382
  await tdb.insert(warehouseItemTransactionTable).values({
147257
147383
  itemId,
@@ -147284,7 +147410,7 @@ var CrmCpOrderItemLogic;
147284
147410
  ((CrmCpOrderItemLogic) => {
147285
147411
  CrmCpOrderItemLogic.select = async ({ cpOrderId }) => {
147286
147412
  const filter = and(eq(crmCpOrderItemTable.cpOrderId, cpOrderId), softDeletedFilter(crmCpOrderItemTable));
147287
- const rows = await db_default.select().from(crmCpOrderItemTable).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(crmCpOrderItemEmployeeTable, eq(crmCpOrderItemEmployeeTable.cpOrderItemId, crmCpOrderItemTable.id)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmCpOrderItemEmployeeTable.employeeId)).leftJoin(crmCpOrderSpPackageTable, eq(crmCpOrderSpPackageTable.cpOrderId, crmCpOrderItemTable.cpOrderId)).leftJoin(crmSpPackageTable, eq(crmSpPackageTable.id, crmCpOrderSpPackageTable.spPackageId)).where(filter);
147413
+ const rows = await db_default.select().from(crmCpOrderItemTable).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(crmCpOrderItemEmployeeTable, eq(crmCpOrderItemEmployeeTable.cpOrderItemId, crmCpOrderItemTable.id)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmCpOrderItemEmployeeTable.employeeId)).leftJoin(crmCpOrderSpPackageTable, eq(crmCpOrderSpPackageTable.id, crmCpOrderItemTable.cpOrderSpPackageId)).leftJoin(crmSpPackageTable, eq(crmSpPackageTable.id, crmCpOrderSpPackageTable.spPackageId)).where(filter);
147288
147414
  const result = rows.reduce((acc, row) => {
147289
147415
  if (!acc[row.cp_order_item.id]) {
147290
147416
  acc[row.cp_order_item.id] = {
@@ -147338,7 +147464,7 @@ var CrmCpOrderItemLogic;
147338
147464
  }
147339
147465
  const curr = await db_default.select({
147340
147466
  id: crmCpOrderItemTable.id
147341
- }).from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, body.cpOrderId), eq(crmCpOrderItemTable.companyServiceKindId, body.companyServiceKindId ?? "").if(body.companyServiceKindId), eq(crmCpOrderItemTable.companyProductId, body.companyProductId ?? "").if(body.companyProductId)));
147467
+ }).from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, body.cpOrderId), eq(crmCpOrderItemTable.companyServiceKindId, body.companyServiceKindId ?? "").if(body.companyServiceKindId), eq(crmCpOrderItemTable.companyProductId, body.companyProductId ?? "").if(body.companyProductId), isNull2(crmCpOrderItemTable.cpOrderSpPackageId)));
147342
147468
  if (curr.length > 0) {
147343
147469
  const [updated] = await db_default.update(crmCpOrderItemTable).set({
147344
147470
  ...body,
@@ -147412,7 +147538,11 @@ var CrmCpOrderItemLogic;
147412
147538
  priceTotal: item.quantity * (item.priceUnit ?? serviceKind?.price ?? product?.product.priceSell ?? 0)
147413
147539
  });
147414
147540
  }
147415
- const currentValues = await db_default.select().from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, insertValues[0].cpOrderId), or(inArray(crmCpOrderItemTable.companyProductId, insertValues.map((i2) => i2.companyProductId).filter((i2) => !!i2)), inArray(crmCpOrderItemTable.companyServiceKindId, insertValues.map((i2) => i2.companyServiceKindId).filter((i2) => !!i2)))));
147541
+ const currentValues = await db_default.select().from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, insertValues[0].cpOrderId), or(...insertValues.map((i2) => {
147542
+ if (!i2.companyProductId && !i2.companyServiceKindId)
147543
+ return null;
147544
+ return and(eq(crmCpOrderItemTable.companyProductId, i2.companyProductId).if(i2.companyProductId), eq(crmCpOrderItemTable.companyServiceKindId, i2.companyServiceKindId).if(i2.companyServiceKindId), i2.cpOrderSpPackageId ? eq(crmCpOrderItemTable.cpOrderSpPackageId, i2.cpOrderSpPackageId) : isNull2(crmCpOrderItemTable.cpOrderSpPackageId));
147545
+ }).filter((i2) => !!i2))));
147416
147546
  if (currentValues.length > 0) {
147417
147547
  return status("Bad Request", "\u0411\u043E\u0440\u043B\u0443\u0443\u043B\u0430\u043B\u0442\u044B\u043D \u04AF\u0439\u043B\u0447\u0438\u043B\u0433\u044D\u044D \u044D\u0441\u0432\u044D\u043B \u0431\u0430\u0440\u0430\u0430 \u0430\u043B\u044C \u0445\u044D\u0434\u0438\u0439\u043D \u043E\u0440\u0441\u043E\u043D \u0431\u0430\u0439\u043D\u0430.");
147418
147548
  }
@@ -149087,13 +149217,21 @@ class HTTPError extends Error {
149087
149217
  }
149088
149218
  }
149089
149219
 
149090
- // node_modules/ky/distribution/errors/TimeoutError.js
149091
- class TimeoutError extends Error {
149092
- request;
149093
- constructor(request) {
149094
- super(`Request timed out: ${request.method} ${request.url}`);
149095
- this.name = "TimeoutError";
149096
- this.request = request;
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;
149097
149235
  }
149098
149236
  }
149099
149237
 
@@ -149154,7 +149292,11 @@ var kyOptionKeys = {
149154
149292
  throwHttpErrors: true,
149155
149293
  onDownloadProgress: true,
149156
149294
  onUploadProgress: true,
149157
- fetch: true
149295
+ fetch: true,
149296
+ context: true
149297
+ };
149298
+ var vendorSpecificOptions = {
149299
+ next: true
149158
149300
  };
149159
149301
  var requestOptionsRegistry = {
149160
149302
  method: true,
@@ -149170,9 +149312,7 @@ var requestOptionsRegistry = {
149170
149312
  keepalive: true,
149171
149313
  signal: true,
149172
149314
  window: true,
149173
- dispatcher: true,
149174
- duplex: true,
149175
- priority: true
149315
+ duplex: true
149176
149316
  };
149177
149317
 
149178
149318
  // node_modules/ky/distribution/utils/body.js
@@ -149249,7 +149389,7 @@ var streamResponse2 = (response, onDownloadProgress) => {
149249
149389
  headers: response.headers
149250
149390
  });
149251
149391
  }
149252
- const totalBytes = Number(response.headers.get("content-length")) || 0;
149392
+ const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
149253
149393
  return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
149254
149394
  status: response.status,
149255
149395
  statusText: response.statusText,
@@ -149301,10 +149441,44 @@ var mergeHooks = (original = {}, incoming = {}) => ({
149301
149441
  afterResponse: newHookValue(original, incoming, "afterResponse"),
149302
149442
  beforeError: newHookValue(original, incoming, "beforeError")
149303
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
+ };
149304
149476
  var deepMerge = (...sources) => {
149305
149477
  let returnValue = {};
149306
149478
  let headers = {};
149307
149479
  let hooks = {};
149480
+ let searchParameters;
149481
+ const signals = [];
149308
149482
  for (const source of sources) {
149309
149483
  if (Array.isArray(source)) {
149310
149484
  if (!Array.isArray(returnValue)) {
@@ -149313,6 +149487,28 @@ var deepMerge = (...sources) => {
149313
149487
  returnValue = [...returnValue, ...source];
149314
149488
  } else if (isObject6(source)) {
149315
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
+ }
149316
149512
  if (isObject6(value) && key in returnValue) {
149317
149513
  value = deepMerge(returnValue[key], value);
149318
149514
  }
@@ -149328,6 +149524,21 @@ var deepMerge = (...sources) => {
149328
149524
  }
149329
149525
  }
149330
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
+ }
149331
149542
  return returnValue;
149332
149543
  };
149333
149544
 
@@ -149343,7 +149554,9 @@ var defaultRetryOptions = {
149343
149554
  afterStatusCodes: retryAfterStatusCodes,
149344
149555
  maxRetryAfter: Number.POSITIVE_INFINITY,
149345
149556
  backoffLimit: Number.POSITIVE_INFINITY,
149346
- delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000
149557
+ delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
149558
+ jitter: undefined,
149559
+ retryOnTimeout: false
149347
149560
  };
149348
149561
  var normalizeRetryOptions = (retry = {}) => {
149349
149562
  if (typeof retry === "number") {
@@ -149364,6 +149577,16 @@ var normalizeRetryOptions = (retry = {}) => {
149364
149577
  };
149365
149578
  };
149366
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
+
149367
149590
  // node_modules/ky/distribution/utils/timeout.js
149368
149591
  async function timeout(request, init2, abortController, options) {
149369
149592
  return new Promise((resolve, reject) => {
@@ -149401,7 +149624,10 @@ async function delay(ms2, { signal }) {
149401
149624
  var findUnknownOptions = (request, options) => {
149402
149625
  const unknownOptions = {};
149403
149626
  for (const key in options) {
149404
- if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {
149627
+ if (!Object.hasOwn(options, key)) {
149628
+ continue;
149629
+ }
149630
+ if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
149405
149631
  unknownOptions[key] = options[key];
149406
149632
  }
149407
149633
  }
@@ -149426,44 +149652,52 @@ var hasSearchParameters = (search) => {
149426
149652
  return Boolean(search);
149427
149653
  };
149428
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
+
149429
149663
  // node_modules/ky/distribution/core/Ky.js
149430
149664
  class Ky {
149431
149665
  static create(input, options) {
149432
149666
  const ky = new Ky(input, options);
149433
149667
  const function_ = async () => {
149434
- if (typeof ky._options.timeout === "number" && ky._options.timeout > maxSafeTimeout) {
149668
+ if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
149435
149669
  throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
149436
149670
  }
149437
149671
  await Promise.resolve();
149438
- let response = await ky._fetch();
149439
- for (const hook of ky._options.hooks.afterResponse) {
149440
- const modifiedResponse = await hook(ky.request, ky._options, ky._decorateResponse(response.clone()));
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 });
149441
149675
  if (modifiedResponse instanceof globalThis.Response) {
149442
149676
  response = modifiedResponse;
149443
149677
  }
149444
149678
  }
149445
- ky._decorateResponse(response);
149446
- if (!response.ok && ky._options.throwHttpErrors) {
149447
- let error3 = new HTTPError(response, ky.request, ky._options);
149448
- for (const hook of ky._options.hooks.beforeError) {
149449
- 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 });
149450
149684
  }
149451
149685
  throw error3;
149452
149686
  }
149453
- if (ky._options.onDownloadProgress) {
149454
- if (typeof ky._options.onDownloadProgress !== "function") {
149687
+ if (ky.#options.onDownloadProgress) {
149688
+ if (typeof ky.#options.onDownloadProgress !== "function") {
149455
149689
  throw new TypeError("The `onDownloadProgress` option must be a function");
149456
149690
  }
149457
149691
  if (!supportsResponseStreams) {
149458
149692
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
149459
149693
  }
149460
- return streamResponse2(response.clone(), ky._options.onDownloadProgress);
149694
+ return streamResponse2(response.clone(), ky.#options.onDownloadProgress);
149461
149695
  }
149462
149696
  return response;
149463
149697
  };
149464
- const isRetriableMethod = ky._options.retry.methods.includes(ky.request.method.toLowerCase());
149465
- const result = (isRetriableMethod ? ky._retry(function_) : function_()).finally(async () => {
149466
- const originalRequest = ky._originalRequest;
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;
149467
149701
  const cleanupPromises = [];
149468
149702
  if (originalRequest && !originalRequest.bodyUsed) {
149469
149703
  cleanupPromises.push(originalRequest.body?.cancel());
@@ -149505,65 +149739,69 @@ class Ky {
149505
149739
  return searchParams;
149506
149740
  }
149507
149741
  request;
149508
- abortController;
149509
- _retryCount = 0;
149510
- _input;
149511
- _options;
149512
- _originalRequest;
149742
+ #abortController;
149743
+ #retryCount = 0;
149744
+ #input;
149745
+ #options;
149746
+ #originalRequest;
149747
+ #userProvidedAbortSignal;
149748
+ #cachedNormalizedOptions;
149513
149749
  constructor(input, options = {}) {
149514
- this._input = input;
149515
- this._options = {
149750
+ this.#input = input;
149751
+ this.#options = {
149516
149752
  ...options,
149517
- headers: mergeHeaders2(this._input.headers, options.headers),
149753
+ headers: mergeHeaders2(this.#input.headers, options.headers),
149518
149754
  hooks: mergeHooks({
149519
149755
  beforeRequest: [],
149520
149756
  beforeRetry: [],
149521
149757
  beforeError: [],
149522
149758
  afterResponse: []
149523
149759
  }, options.hooks),
149524
- method: normalizeRequestMethod(options.method ?? this._input.method ?? "GET"),
149760
+ method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
149525
149761
  prefixUrl: String(options.prefixUrl || ""),
149526
149762
  retry: normalizeRetryOptions(options.retry),
149527
149763
  throwHttpErrors: options.throwHttpErrors !== false,
149528
149764
  timeout: options.timeout ?? 1e4,
149529
- fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
149765
+ fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
149766
+ context: options.context ?? {}
149530
149767
  };
149531
- if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {
149768
+ if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
149532
149769
  throw new TypeError("`input` must be a string, URL, or Request");
149533
149770
  }
149534
- if (this._options.prefixUrl && typeof this._input === "string") {
149535
- if (this._input.startsWith("/")) {
149771
+ if (this.#options.prefixUrl && typeof this.#input === "string") {
149772
+ if (this.#input.startsWith("/")) {
149536
149773
  throw new Error("`input` must not begin with a slash when using `prefixUrl`");
149537
149774
  }
149538
- if (!this._options.prefixUrl.endsWith("/")) {
149539
- this._options.prefixUrl += "/";
149775
+ if (!this.#options.prefixUrl.endsWith("/")) {
149776
+ this.#options.prefixUrl += "/";
149540
149777
  }
149541
- this._input = this._options.prefixUrl + this._input;
149778
+ this.#input = this.#options.prefixUrl + this.#input;
149542
149779
  }
149543
149780
  if (supportsAbortController && supportsAbortSignal) {
149544
- const originalSignal = this._options.signal ?? this._input.signal;
149545
- this.abortController = new globalThis.AbortController;
149546
- this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
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;
149547
149784
  }
149548
149785
  if (supportsRequestStreams) {
149549
- this._options.duplex = "half";
149786
+ this.#options.duplex = "half";
149787
+ }
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");
149550
149791
  }
149551
- if (this._options.json !== undefined) {
149552
- this._options.body = this._options.stringifyJson?.(this._options.json) ?? JSON.stringify(this._options.json);
149553
- this._options.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json");
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");
149554
149795
  }
149555
- this.request = new globalThis.Request(this._input, this._options);
149556
- if (hasSearchParameters(this._options.searchParams)) {
149557
- const textSearchParams = typeof this._options.searchParams === "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this._options.searchParams)).toString();
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();
149558
149799
  const searchParams = "?" + textSearchParams;
149559
149800
  const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
149560
- if ((supportsFormData && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"])) {
149561
- this.request.headers.delete("content-type");
149562
- }
149563
- 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);
149564
149802
  }
149565
- if (this._options.onUploadProgress) {
149566
- if (typeof this._options.onUploadProgress !== "function") {
149803
+ if (this.#options.onUploadProgress) {
149804
+ if (typeof this.#options.onUploadProgress !== "function") {
149567
149805
  throw new TypeError("The `onUploadProgress` option must be a function");
149568
149806
  }
149569
149807
  if (!supportsRequestStreams) {
@@ -149571,69 +149809,106 @@ class Ky {
149571
149809
  }
149572
149810
  const originalBody = this.request.body;
149573
149811
  if (originalBody) {
149574
- this.request = streamRequest(this.request, this._options.onUploadProgress, this._options.body);
149812
+ this.request = streamRequest(this.request, this.#options.onUploadProgress, this.#options.body);
149575
149813
  }
149576
149814
  }
149577
149815
  }
149578
- _calculateRetryDelay(error3) {
149579
- this._retryCount++;
149580
- if (this._retryCount > this._options.retry.limit || error3 instanceof TimeoutError) {
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;
149825
+ }
149826
+ }
149827
+ return Math.min(this.#options.retry.backoffLimit, jitteredDelay);
149828
+ }
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) {
149581
149845
  throw error3;
149582
149846
  }
149583
- if (error3 instanceof HTTPError) {
149584
- if (!this._options.retry.statusCodes.includes(error3.response.status)) {
149847
+ if (isHTTPError(error3)) {
149848
+ if (!this.#options.retry.statusCodes.includes(error3.response.status)) {
149585
149849
  throw error3;
149586
149850
  }
149587
- 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");
149588
- if (retryAfter && this._options.retry.afterStatusCodes.includes(error3.response.status)) {
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)) {
149589
149853
  let after = Number(retryAfter) * 1000;
149590
149854
  if (Number.isNaN(after)) {
149591
149855
  after = Date.parse(retryAfter) - Date.now();
149592
149856
  } else if (after >= Date.parse("2024-01-01")) {
149593
149857
  after -= Date.now();
149594
149858
  }
149595
- const max2 = this._options.retry.maxRetryAfter ?? after;
149859
+ const max2 = this.#options.retry.maxRetryAfter ?? after;
149596
149860
  return after < max2 ? after : max2;
149597
149861
  }
149598
149862
  if (error3.response.status === 413) {
149599
149863
  throw error3;
149600
149864
  }
149601
149865
  }
149602
- const retryDelay = this._options.retry.delay(this._retryCount);
149603
- return Math.min(this._options.retry.backoffLimit, retryDelay);
149866
+ return this.#calculateDelay();
149604
149867
  }
149605
- _decorateResponse(response) {
149606
- if (this._options.parseJson) {
149607
- response.json = async () => this._options.parseJson(await response.text());
149868
+ #decorateResponse(response) {
149869
+ if (this.#options.parseJson) {
149870
+ response.json = async () => this.#options.parseJson(await response.text());
149608
149871
  }
149609
149872
  return response;
149610
149873
  }
149611
- async _retry(function_) {
149874
+ async#retry(function_) {
149612
149875
  try {
149613
149876
  return await function_();
149614
149877
  } catch (error3) {
149615
- const ms2 = Math.min(this._calculateRetryDelay(error3), maxSafeTimeout);
149616
- if (this._retryCount < 1) {
149878
+ const ms2 = Math.min(await this.#calculateRetryDelay(error3), maxSafeTimeout);
149879
+ if (this.#retryCount < 1) {
149617
149880
  throw error3;
149618
149881
  }
149619
- await delay(ms2, { signal: this._options.signal });
149620
- for (const hook of this._options.hooks.beforeRetry) {
149882
+ await delay(ms2, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
149883
+ for (const hook of this.#options.hooks.beforeRetry) {
149621
149884
  const hookResult = await hook({
149622
149885
  request: this.request,
149623
- options: this._options,
149886
+ options: this.#getNormalizedOptions(),
149624
149887
  error: error3,
149625
- retryCount: this._retryCount
149888
+ retryCount: this.#retryCount
149626
149889
  });
149890
+ if (hookResult instanceof globalThis.Request) {
149891
+ this.request = hookResult;
149892
+ break;
149893
+ }
149894
+ if (hookResult instanceof globalThis.Response) {
149895
+ return hookResult;
149896
+ }
149627
149897
  if (hookResult === stop) {
149628
149898
  return;
149629
149899
  }
149630
149900
  }
149631
- return this._retry(function_);
149901
+ return this.#retry(function_);
149632
149902
  }
149633
149903
  }
149634
- async _fetch() {
149635
- for (const hook of this._options.hooks.beforeRequest) {
149636
- const result = await hook(this.request, this._options);
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 });
149637
149912
  if (result instanceof Request) {
149638
149913
  this.request = result;
149639
149914
  break;
@@ -149642,13 +149917,20 @@ class Ky {
149642
149917
  return result;
149643
149918
  }
149644
149919
  }
149645
- const nonRequestOptions = findUnknownOptions(this.request, this._options);
149646
- this._originalRequest = this.request;
149647
- this.request = this._originalRequest.clone();
149648
- if (this._options.timeout === false) {
149649
- return this._options.fetch(this._originalRequest, nonRequestOptions);
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);
149650
149925
  }
149651
- return timeout(this._originalRequest, nonRequestOptions, this.abortController, this._options);
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);
149932
+ }
149933
+ return this.#cachedNormalizedOptions;
149652
149934
  }
149653
149935
  }
149654
149936
 
@@ -151323,7 +151605,8 @@ var CrmCpOrderModel;
151323
151605
  type: t.UnionEnum(crmCpOrderTypeEnum.enumValues, {
151324
151606
  default: "Service"
151325
151607
  }),
151326
- oldId: t.Number()
151608
+ oldId: t.Number(),
151609
+ isPaid: t.Boolean()
151327
151610
  }))
151328
151611
  ]);
151329
151612
  CrmCpOrderModel.complete = t.Object({
@@ -152328,6 +152611,9 @@ var CrmReportsModel;
152328
152611
  CrmReportsModel.cpOrderReport = t.Object({
152329
152612
  type: t.UnionEnum(["Product", "Service"])
152330
152613
  });
152614
+ CrmReportsModel.cpOrderEmployeeReport = t.Object({
152615
+ employeeId: t.String({ format: "uuid" })
152616
+ });
152331
152617
  })(CrmReportsModel ||= {});
152332
152618
  var model_default14 = CrmReportsModel;
152333
152619
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.16",
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.4",
32
+ "drizzle-orm": "^0.44.7",
33
33
  "drizzle-typebox": "^0.3.3",
34
- "elysia": "1.4.11",
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.8.2",
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.3",
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.0",
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",