@kky42/pievo-server 2.4.14 → 3.0.0

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.
Files changed (90) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{actionUi-5PtES4q0.js → actionUi-BZrLpgHT.js} +1 -1
  3. package/.output/public/assets/app-DXLuQNb9.css +2 -0
  4. package/.output/public/assets/index-Di_wpAtL.js +10 -0
  5. package/.output/public/assets/loops._loopId-X3ClNPMY.js +67 -0
  6. package/.output/public/assets/loops._loopId_.runs._runId-ByU2BSyF.js +3 -0
  7. package/.output/public/assets/preload-helper-hRTYB_ju.js +3 -0
  8. package/.output/public/assets/{routes-Dm_3J2aV.js → routes-BIOJZsig.js} +1 -1
  9. package/.output/public/assets/routes-K8D5uBiV.js +1 -0
  10. package/.output/server/_chunks/ssr-renderer.mjs +1 -1
  11. package/.output/server/_libs/{drizzle-orm+postgres.mjs → drizzle-orm.mjs} +93 -2218
  12. package/.output/server/_ssr/{MachinesModal-BaEtzycr.mjs → MachinesModal-CmVMec6B.mjs} +46 -46
  13. package/.output/server/_ssr/{actionUi-5HOCZnom.mjs → actionUi-DE-Pb2tv.mjs} +1 -2
  14. package/.output/server/_ssr/{artifactFiles-DO43wwXA.mjs → artifactFiles-Di1xDKvX.mjs} +5 -8
  15. package/.output/server/_ssr/{artifactKind-DwDr8IYc.mjs → artifactKind-DqpmtxDU.mjs} +3 -9
  16. package/.output/server/_ssr/{boot-C472kLwY.mjs → boot-CYRi-wez.mjs} +2152 -351
  17. package/.output/server/_ssr/lifecycleUi-BsbUsi5K.mjs +106 -0
  18. package/.output/server/_ssr/{loopApi-DT751TJA.mjs → loopApi-Bez1rHV0.mjs} +50 -66
  19. package/.output/server/_ssr/{loopProjection-qaD2I48a.mjs → loopProjection-esCjyZJg.mjs} +4 -23
  20. package/.output/server/_ssr/{loops._loopId-CXgw2Rz1.mjs → loops._loopId-KUezNY69.mjs} +8 -23
  21. package/.output/server/_ssr/{loops._loopId_.runs._runId-Dk94Z0Jq.mjs → loops._loopId_.runs._runId-BFP9oMrp.mjs} +2 -7
  22. package/.output/server/_ssr/{loops._loopId_.runs._runId-SASSqOfy.mjs → loops._loopId_.runs._runId-DOkUEesG.mjs} +18 -33
  23. package/.output/server/_ssr/{machineFns-BSrIgn3f.mjs → machineFns-CniGcY8s.mjs} +13 -50
  24. package/.output/server/_ssr/networkAccess-CIlK3ION.mjs +30 -0
  25. package/.output/server/_ssr/router-BFIH2UAE.mjs +362 -0
  26. package/.output/server/_ssr/routes-BSVBANI3.mjs +12 -0
  27. package/.output/server/_ssr/{routes-Cr-9yDEH.mjs → routes-DnE7XDe_.mjs} +91 -50
  28. package/.output/server/_ssr/{routes-DRBS4Zi4.mjs → routes-ngpX7h8D.mjs} +2 -4
  29. package/.output/server/_ssr/ssr.mjs +25 -34
  30. package/.output/server/_ssr/start-B5_9Z5W-.mjs +35 -0
  31. package/.output/server/{_tanstack-start-manifest_v-DxLIQ0cc.mjs → _tanstack-start-manifest_v-DnwAupbZ.mjs} +8 -13
  32. package/.output/server/drizzle/0000_baseline.sql +6 -97
  33. package/.output/server/drizzle/meta/_journal.json +2 -23
  34. package/.output/server/index.mjs +45 -52
  35. package/drizzle/0000_baseline.sql +6 -97
  36. package/drizzle/meta/_journal.json +2 -23
  37. package/package.json +4 -8
  38. package/scripts/pievo-server.mjs +49 -47
  39. package/scripts/server-cli-lib.mjs +21 -12
  40. package/scripts/server-network.mjs +139 -0
  41. package/.output/public/assets/SignIn-CIFwnZtF.js +0 -1
  42. package/.output/public/assets/app-DvHMhs7S.css +0 -2
  43. package/.output/public/assets/index-CRX2pu0W.js +0 -10
  44. package/.output/public/assets/loops._loopId-BsuV-Rmf.js +0 -67
  45. package/.output/public/assets/loops._loopId_.runs._runId-DpK_fzmZ.js +0 -3
  46. package/.output/public/assets/preload-helper-sAZOZb3G.js +0 -5
  47. package/.output/public/assets/routes-DxF_s3cD.js +0 -1
  48. package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +0 -419
  49. package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +0 -10732
  50. package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +0 -9475
  51. package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +0 -137
  52. package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +0 -440
  53. package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +0 -62
  54. package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +0 -818
  55. package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +0 -59
  56. package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +0 -342
  57. package/.output/server/_libs/aws-crypto__crc32c.mjs +0 -314
  58. package/.output/server/_libs/aws-sdk__nested-clients.mjs +0 -2671
  59. package/.output/server/_ssr/SignIn-sHQaBQJC.mjs +0 -53
  60. package/.output/server/_ssr/artifacts-Cd7Qx3Qp.mjs +0 -2
  61. package/.output/server/_ssr/auth-0AamrwHo.mjs +0 -38355
  62. package/.output/server/_ssr/auth-client-lSMb_Idt.mjs +0 -1070
  63. package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-DLIXocA0.mjs +0 -162
  64. package/.output/server/_ssr/core-RrmWoKne.mjs +0 -5
  65. package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-BoFMIPr_.mjs +0 -112
  66. package/.output/server/_ssr/db-BzvMQ2kx.mjs +0 -2
  67. package/.output/server/_ssr/dist-ClzqkwxD.mjs +0 -342
  68. package/.output/server/_ssr/factory-ixUjZqJn.mjs +0 -6903
  69. package/.output/server/_ssr/kysely-adapter-DkZbmKgV.mjs +0 -2
  70. package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +0 -19
  71. package/.output/server/_ssr/logger-DDjsYB2X.mjs +0 -2
  72. package/.output/server/_ssr/loopTags-CXx5UdGf.mjs +0 -3356
  73. package/.output/server/_ssr/node-sqlite-dialect-BbUqnnYv.mjs +0 -162
  74. package/.output/server/_ssr/router-BlLlhfJe.mjs +0 -543
  75. package/.output/server/_ssr/routes-DTBltabU.mjs +0 -27
  76. package/.output/server/_ssr/start-4ifArtKx.mjs +0 -4
  77. package/.output/server/_ssr/store-vDZ9INSa.mjs +0 -2
  78. package/.output/server/_ssr/tokens-BHiCElYD.mjs +0 -2
  79. package/.output/server/drizzle/0001_add_pi_agent.sql +0 -9
  80. package/.output/server/drizzle/0002_remove_teams.sql +0 -15
  81. package/.output/server/drizzle/0003_add_loop_tags.sql +0 -5
  82. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  83. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  84. package/.output/server/node_modules/tslib/package.json +0 -47
  85. package/.output/server/node_modules/tslib/tslib.js +0 -484
  86. package/.output/server/package.json +0 -9
  87. package/drizzle/0001_add_pi_agent.sql +0 -9
  88. package/drizzle/0002_remove_teams.sql +0 -15
  89. package/drizzle/0003_add_loop_tags.sql +0 -5
  90. package/scripts/prestart.mjs +0 -66
@@ -2,14 +2,7 @@ import { r as __exportAll } from "../_runtime.mjs";
2
2
  import { n as dn, t as Ve } from "./electric-sql__pglite.mjs";
3
3
  import crypto$1 from "node:crypto";
4
4
  import fs from "node:fs";
5
- import fs$1 from "fs";
6
- import os from "os";
7
- import net from "net";
8
- import tls from "tls";
9
- import crypto$2 from "crypto";
10
- import Stream from "stream";
11
- import { performance } from "perf_hooks";
12
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/migrator.js
5
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/migrator.js
13
6
  function readMigrationFiles(config) {
14
7
  const migrationFolderTo = config.migrationsFolder;
15
8
  const migrationQueries = [];
@@ -37,14 +30,14 @@ function readMigrationFiles(config) {
37
30
  return migrationQueries;
38
31
  }
39
32
  //#endregion
40
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pglite/migrator.js
33
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pglite/migrator.js
41
34
  var migrator_exports = /* @__PURE__ */ __exportAll({ migrate: () => migrate });
42
35
  async function migrate(db, config) {
43
36
  const migrations = readMigrationFiles(config);
44
37
  await db.dialect.migrate(migrations, db.session, config);
45
38
  }
46
39
  //#endregion
47
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/entity.js
40
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/entity.js
48
41
  var entityKind = Symbol.for("drizzle:entityKind");
49
42
  function is(value, type) {
50
43
  if (!value || typeof value !== "object") return false;
@@ -58,7 +51,7 @@ function is(value, type) {
58
51
  return false;
59
52
  }
60
53
  //#endregion
61
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/column.js
54
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/column.js
62
55
  var Column = class {
63
56
  constructor(table, config) {
64
57
  this.table = table;
@@ -108,7 +101,7 @@ var Column = class {
108
101
  }
109
102
  };
110
103
  //#endregion
111
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/column-builder.js
104
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/column-builder.js
112
105
  var ColumnBuilder = class {
113
106
  static [entityKind] = "ColumnBuilder";
114
107
  config;
@@ -211,10 +204,10 @@ var ColumnBuilder = class {
211
204
  }
212
205
  };
213
206
  //#endregion
214
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/table.utils.js
207
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/table.utils.js
215
208
  var TableName = Symbol.for("drizzle:Name");
216
209
  //#endregion
217
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/foreign-keys.js
210
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/foreign-keys.js
218
211
  var ForeignKeyBuilder = class {
219
212
  static [entityKind] = "PgForeignKeyBuilder";
220
213
  /** @internal */
@@ -276,17 +269,17 @@ var ForeignKey = class {
276
269
  }
277
270
  };
278
271
  //#endregion
279
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/tracing-utils.js
272
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/tracing-utils.js
280
273
  function iife(fn, ...args) {
281
274
  return fn(...args);
282
275
  }
283
276
  //#endregion
284
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/unique-constraint.js
277
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/unique-constraint.js
285
278
  function uniqueKeyName(table, columns) {
286
279
  return `${table[TableName]}_${columns.join("_")}_unique`;
287
280
  }
288
281
  //#endregion
289
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/utils/array.js
282
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/utils/array.js
290
283
  function parsePgArrayValue(arrayString, startFrom, inQuotes) {
291
284
  for (let i = startFrom; i < arrayString.length; i++) {
292
285
  const char = arrayString[i];
@@ -348,7 +341,7 @@ function makePgArray(array) {
348
341
  }).join(",")}}`;
349
342
  }
350
343
  //#endregion
351
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/common.js
344
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/common.js
352
345
  var PgColumnBuilder = class extends ColumnBuilder {
353
346
  foreignKeyConfigs = [];
354
347
  static [entityKind] = "PgColumnBuilder";
@@ -520,13 +513,13 @@ var PgArray = class PgArray extends PgColumn {
520
513
  }
521
514
  };
522
515
  //#endregion
523
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/enum.js
516
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/enum.js
524
517
  var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
525
518
  function isPgEnum(obj) {
526
519
  return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
527
520
  }
528
521
  //#endregion
529
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/subquery.js
522
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/subquery.js
530
523
  var Subquery = class {
531
524
  static [entityKind] = "Subquery";
532
525
  constructor(sql, fields, alias, isWith = false, usedTables = []) {
@@ -544,15 +537,15 @@ var WithSubquery = class extends Subquery {
544
537
  static [entityKind] = "WithSubquery";
545
538
  };
546
539
  //#endregion
547
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/tracing.js
540
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/tracing.js
548
541
  var tracer = { startActiveSpan(name, fn) {
549
542
  return fn();
550
543
  } };
551
544
  //#endregion
552
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/view-common.js
545
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/view-common.js
553
546
  var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
554
547
  //#endregion
555
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/table.js
548
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/table.js
556
549
  var Schema = Symbol.for("drizzle:Schema");
557
550
  var Columns = Symbol.for("drizzle:Columns");
558
551
  var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
@@ -614,7 +607,7 @@ function getTableUniqueName(table) {
614
607
  return `${table[Schema] ?? "public"}.${table[TableName]}`;
615
608
  }
616
609
  //#endregion
617
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/sql/sql.js
610
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/sql/sql.js
618
611
  function isSQLWrapper(value) {
619
612
  return value !== null && value !== void 0 && typeof value.getSQL === "function";
620
613
  }
@@ -985,7 +978,7 @@ Subquery.prototype.getSQL = function() {
985
978
  return new SQL([this]);
986
979
  };
987
980
  //#endregion
988
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/alias.js
981
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/alias.js
989
982
  var ColumnAliasProxyHandler = class {
990
983
  constructor(table) {
991
984
  this.table = table;
@@ -1043,7 +1036,7 @@ function mapColumnsInSQLToAlias(query, alias) {
1043
1036
  }));
1044
1037
  }
1045
1038
  //#endregion
1046
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/errors.js
1039
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/errors.js
1047
1040
  var DrizzleError = class extends Error {
1048
1041
  static [entityKind] = "DrizzleError";
1049
1042
  constructor({ message, cause }) {
@@ -1070,7 +1063,7 @@ var TransactionRollbackError = class extends DrizzleError {
1070
1063
  }
1071
1064
  };
1072
1065
  //#endregion
1073
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/logger.js
1066
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/logger.js
1074
1067
  var ConsoleLogWriter = class {
1075
1068
  static [entityKind] = "ConsoleLogWriter";
1076
1069
  write(message) {
@@ -1100,7 +1093,7 @@ var NoopLogger = class {
1100
1093
  logQuery() {}
1101
1094
  };
1102
1095
  //#endregion
1103
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/query-promise.js
1096
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/query-promise.js
1104
1097
  var QueryPromise = class {
1105
1098
  static [entityKind] = "QueryPromise";
1106
1099
  [Symbol.toStringTag] = "QueryPromise";
@@ -1121,7 +1114,7 @@ var QueryPromise = class {
1121
1114
  }
1122
1115
  };
1123
1116
  //#endregion
1124
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/utils.js
1117
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/utils.js
1125
1118
  function mapResultRow(columns, row, joinsNotNullableMap) {
1126
1119
  const nullifyMap = {};
1127
1120
  const result = columns.reduce((result2, { path, field }, columnIndex) => {
@@ -1233,7 +1226,7 @@ function isConfig(data) {
1233
1226
  }
1234
1227
  typeof TextDecoder === "undefined" || new TextDecoder();
1235
1228
  //#endregion
1236
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/int.common.js
1229
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/int.common.js
1237
1230
  var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
1238
1231
  static [entityKind] = "PgIntColumnBaseBuilder";
1239
1232
  generatedAlwaysAsIdentity(sequence) {
@@ -1264,7 +1257,7 @@ var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
1264
1257
  }
1265
1258
  };
1266
1259
  //#endregion
1267
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/bigint.js
1260
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/bigint.js
1268
1261
  var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
1269
1262
  static [entityKind] = "PgBigInt53Builder";
1270
1263
  constructor(name) {
@@ -1310,7 +1303,7 @@ function bigint(a, b) {
1310
1303
  return new PgBigInt64Builder(name);
1311
1304
  }
1312
1305
  //#endregion
1313
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/bigserial.js
1306
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/bigserial.js
1314
1307
  var PgBigSerial53Builder = class extends PgColumnBuilder {
1315
1308
  static [entityKind] = "PgBigSerial53Builder";
1316
1309
  constructor(name) {
@@ -1359,7 +1352,7 @@ function bigserial(a, b) {
1359
1352
  return new PgBigSerial64Builder(name);
1360
1353
  }
1361
1354
  //#endregion
1362
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/boolean.js
1355
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/boolean.js
1363
1356
  var PgBooleanBuilder = class extends PgColumnBuilder {
1364
1357
  static [entityKind] = "PgBooleanBuilder";
1365
1358
  constructor(name) {
@@ -1380,7 +1373,7 @@ function boolean(name) {
1380
1373
  return new PgBooleanBuilder(name ?? "");
1381
1374
  }
1382
1375
  //#endregion
1383
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/char.js
1376
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/char.js
1384
1377
  var PgCharBuilder = class extends PgColumnBuilder {
1385
1378
  static [entityKind] = "PgCharBuilder";
1386
1379
  constructor(name, config) {
@@ -1406,7 +1399,7 @@ function char(a, b = {}) {
1406
1399
  return new PgCharBuilder(name, config);
1407
1400
  }
1408
1401
  //#endregion
1409
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/cidr.js
1402
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/cidr.js
1410
1403
  var PgCidrBuilder = class extends PgColumnBuilder {
1411
1404
  static [entityKind] = "PgCidrBuilder";
1412
1405
  constructor(name) {
@@ -1427,7 +1420,7 @@ function cidr(name) {
1427
1420
  return new PgCidrBuilder(name ?? "");
1428
1421
  }
1429
1422
  //#endregion
1430
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/custom.js
1423
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/custom.js
1431
1424
  var PgCustomColumnBuilder = class extends PgColumnBuilder {
1432
1425
  static [entityKind] = "PgCustomColumnBuilder";
1433
1426
  constructor(name, fieldConfig, customTypeParams) {
@@ -1468,7 +1461,7 @@ function customType(customTypeParams) {
1468
1461
  };
1469
1462
  }
1470
1463
  //#endregion
1471
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/date.common.js
1464
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/date.common.js
1472
1465
  var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
1473
1466
  static [entityKind] = "PgDateColumnBaseBuilder";
1474
1467
  defaultNow() {
@@ -1476,7 +1469,7 @@ var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
1476
1469
  }
1477
1470
  };
1478
1471
  //#endregion
1479
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/date.js
1472
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/date.js
1480
1473
  var PgDateBuilder = class extends PgDateColumnBaseBuilder {
1481
1474
  static [entityKind] = "PgDateBuilder";
1482
1475
  constructor(name) {
@@ -1526,7 +1519,7 @@ function date(a, b) {
1526
1519
  return new PgDateStringBuilder(name);
1527
1520
  }
1528
1521
  //#endregion
1529
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/double-precision.js
1522
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/double-precision.js
1530
1523
  var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
1531
1524
  static [entityKind] = "PgDoublePrecisionBuilder";
1532
1525
  constructor(name) {
@@ -1551,7 +1544,7 @@ function doublePrecision(name) {
1551
1544
  return new PgDoublePrecisionBuilder(name ?? "");
1552
1545
  }
1553
1546
  //#endregion
1554
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/inet.js
1547
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/inet.js
1555
1548
  var PgInetBuilder = class extends PgColumnBuilder {
1556
1549
  static [entityKind] = "PgInetBuilder";
1557
1550
  constructor(name) {
@@ -1572,7 +1565,7 @@ function inet(name) {
1572
1565
  return new PgInetBuilder(name ?? "");
1573
1566
  }
1574
1567
  //#endregion
1575
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/integer.js
1568
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/integer.js
1576
1569
  var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
1577
1570
  static [entityKind] = "PgIntegerBuilder";
1578
1571
  constructor(name) {
@@ -1597,7 +1590,7 @@ function integer(name) {
1597
1590
  return new PgIntegerBuilder(name ?? "");
1598
1591
  }
1599
1592
  //#endregion
1600
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/interval.js
1593
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/interval.js
1601
1594
  var PgIntervalBuilder = class extends PgColumnBuilder {
1602
1595
  static [entityKind] = "PgIntervalBuilder";
1603
1596
  constructor(name, intervalConfig) {
@@ -1622,7 +1615,7 @@ function interval(a, b = {}) {
1622
1615
  return new PgIntervalBuilder(name, config);
1623
1616
  }
1624
1617
  //#endregion
1625
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/json.js
1618
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/json.js
1626
1619
  var PgJsonBuilder = class extends PgColumnBuilder {
1627
1620
  static [entityKind] = "PgJsonBuilder";
1628
1621
  constructor(name) {
@@ -1657,7 +1650,7 @@ function json(name) {
1657
1650
  return new PgJsonBuilder(name ?? "");
1658
1651
  }
1659
1652
  //#endregion
1660
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/jsonb.js
1653
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/jsonb.js
1661
1654
  var PgJsonbBuilder = class extends PgColumnBuilder {
1662
1655
  static [entityKind] = "PgJsonbBuilder";
1663
1656
  constructor(name) {
@@ -1692,7 +1685,7 @@ function jsonb(name) {
1692
1685
  return new PgJsonbBuilder(name ?? "");
1693
1686
  }
1694
1687
  //#endregion
1695
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/line.js
1688
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/line.js
1696
1689
  var PgLineBuilder = class extends PgColumnBuilder {
1697
1690
  static [entityKind] = "PgLineBuilder";
1698
1691
  constructor(name) {
@@ -1753,7 +1746,7 @@ function line(a, b) {
1753
1746
  return new PgLineABCBuilder(name);
1754
1747
  }
1755
1748
  //#endregion
1756
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/macaddr.js
1749
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/macaddr.js
1757
1750
  var PgMacaddrBuilder = class extends PgColumnBuilder {
1758
1751
  static [entityKind] = "PgMacaddrBuilder";
1759
1752
  constructor(name) {
@@ -1774,7 +1767,7 @@ function macaddr(name) {
1774
1767
  return new PgMacaddrBuilder(name ?? "");
1775
1768
  }
1776
1769
  //#endregion
1777
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
1770
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
1778
1771
  var PgMacaddr8Builder = class extends PgColumnBuilder {
1779
1772
  static [entityKind] = "PgMacaddr8Builder";
1780
1773
  constructor(name) {
@@ -1795,7 +1788,7 @@ function macaddr8(name) {
1795
1788
  return new PgMacaddr8Builder(name ?? "");
1796
1789
  }
1797
1790
  //#endregion
1798
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/numeric.js
1791
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/numeric.js
1799
1792
  var PgNumericBuilder = class extends PgColumnBuilder {
1800
1793
  static [entityKind] = "PgNumericBuilder";
1801
1794
  constructor(name, precision, scale) {
@@ -1894,7 +1887,7 @@ function numeric(a, b) {
1894
1887
  return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
1895
1888
  }
1896
1889
  //#endregion
1897
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/point.js
1890
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/point.js
1898
1891
  var PgPointTupleBuilder = class extends PgColumnBuilder {
1899
1892
  static [entityKind] = "PgPointTupleBuilder";
1900
1893
  constructor(name) {
@@ -1956,7 +1949,7 @@ function point(a, b) {
1956
1949
  return new PgPointObjectBuilder(name);
1957
1950
  }
1958
1951
  //#endregion
1959
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
1952
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
1960
1953
  function hexToBytes(hex) {
1961
1954
  const bytes = [];
1962
1955
  for (let c = 0; c < hex.length; c += 2) bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
@@ -1989,7 +1982,7 @@ function parseEWKB(hex) {
1989
1982
  throw new Error("Unsupported geometry type");
1990
1983
  }
1991
1984
  //#endregion
1992
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
1985
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
1993
1986
  var PgGeometryBuilder = class extends PgColumnBuilder {
1994
1987
  static [entityKind] = "PgGeometryBuilder";
1995
1988
  constructor(name) {
@@ -2044,7 +2037,7 @@ function geometry(a, b) {
2044
2037
  return new PgGeometryObjectBuilder(name);
2045
2038
  }
2046
2039
  //#endregion
2047
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/real.js
2040
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/real.js
2048
2041
  var PgRealBuilder = class extends PgColumnBuilder {
2049
2042
  static [entityKind] = "PgRealBuilder";
2050
2043
  constructor(name, length) {
@@ -2073,7 +2066,7 @@ function real(name) {
2073
2066
  return new PgRealBuilder(name ?? "");
2074
2067
  }
2075
2068
  //#endregion
2076
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/serial.js
2069
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/serial.js
2077
2070
  var PgSerialBuilder = class extends PgColumnBuilder {
2078
2071
  static [entityKind] = "PgSerialBuilder";
2079
2072
  constructor(name) {
@@ -2096,7 +2089,7 @@ function serial(name) {
2096
2089
  return new PgSerialBuilder(name ?? "");
2097
2090
  }
2098
2091
  //#endregion
2099
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/smallint.js
2092
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/smallint.js
2100
2093
  var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
2101
2094
  static [entityKind] = "PgSmallIntBuilder";
2102
2095
  constructor(name) {
@@ -2121,7 +2114,7 @@ function smallint(name) {
2121
2114
  return new PgSmallIntBuilder(name ?? "");
2122
2115
  }
2123
2116
  //#endregion
2124
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/smallserial.js
2117
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/smallserial.js
2125
2118
  var PgSmallSerialBuilder = class extends PgColumnBuilder {
2126
2119
  static [entityKind] = "PgSmallSerialBuilder";
2127
2120
  constructor(name) {
@@ -2144,7 +2137,7 @@ function smallserial(name) {
2144
2137
  return new PgSmallSerialBuilder(name ?? "");
2145
2138
  }
2146
2139
  //#endregion
2147
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/text.js
2140
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/text.js
2148
2141
  var PgTextBuilder = class extends PgColumnBuilder {
2149
2142
  static [entityKind] = "PgTextBuilder";
2150
2143
  constructor(name, config) {
@@ -2168,7 +2161,7 @@ function text(a, b = {}) {
2168
2161
  return new PgTextBuilder(name, config);
2169
2162
  }
2170
2163
  //#endregion
2171
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/time.js
2164
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/time.js
2172
2165
  var PgTimeBuilder = class extends PgDateColumnBaseBuilder {
2173
2166
  constructor(name, withTimezone, precision) {
2174
2167
  super(name, "string", "PgTime");
@@ -2201,7 +2194,7 @@ function time(a, b = {}) {
2201
2194
  return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
2202
2195
  }
2203
2196
  //#endregion
2204
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/timestamp.js
2197
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/timestamp.js
2205
2198
  var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
2206
2199
  static [entityKind] = "PgTimestampBuilder";
2207
2200
  constructor(name, withTimezone, precision) {
@@ -2274,7 +2267,7 @@ function timestamp(a, b = {}) {
2274
2267
  return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
2275
2268
  }
2276
2269
  //#endregion
2277
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/uuid.js
2270
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/uuid.js
2278
2271
  var PgUUIDBuilder = class extends PgColumnBuilder {
2279
2272
  static [entityKind] = "PgUUIDBuilder";
2280
2273
  constructor(name) {
@@ -2301,7 +2294,7 @@ function uuid(name) {
2301
2294
  return new PgUUIDBuilder(name ?? "");
2302
2295
  }
2303
2296
  //#endregion
2304
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/varchar.js
2297
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/varchar.js
2305
2298
  var PgVarcharBuilder = class extends PgColumnBuilder {
2306
2299
  static [entityKind] = "PgVarcharBuilder";
2307
2300
  constructor(name, config) {
@@ -2327,7 +2320,7 @@ function varchar(a, b = {}) {
2327
2320
  return new PgVarcharBuilder(name, config);
2328
2321
  }
2329
2322
  //#endregion
2330
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
2323
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
2331
2324
  var PgBinaryVectorBuilder = class extends PgColumnBuilder {
2332
2325
  static [entityKind] = "PgBinaryVectorBuilder";
2333
2326
  constructor(name, config) {
@@ -2351,7 +2344,7 @@ function bit(a, b) {
2351
2344
  return new PgBinaryVectorBuilder(name, config);
2352
2345
  }
2353
2346
  //#endregion
2354
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
2347
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
2355
2348
  var PgHalfVectorBuilder = class extends PgColumnBuilder {
2356
2349
  static [entityKind] = "PgHalfVectorBuilder";
2357
2350
  constructor(name, config) {
@@ -2381,7 +2374,7 @@ function halfvec(a, b) {
2381
2374
  return new PgHalfVectorBuilder(name, config);
2382
2375
  }
2383
2376
  //#endregion
2384
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
2377
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
2385
2378
  var PgSparseVectorBuilder = class extends PgColumnBuilder {
2386
2379
  static [entityKind] = "PgSparseVectorBuilder";
2387
2380
  constructor(name, config) {
@@ -2405,7 +2398,7 @@ function sparsevec(a, b) {
2405
2398
  return new PgSparseVectorBuilder(name, config);
2406
2399
  }
2407
2400
  //#endregion
2408
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
2401
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
2409
2402
  var PgVectorBuilder = class extends PgColumnBuilder {
2410
2403
  static [entityKind] = "PgVectorBuilder";
2411
2404
  constructor(name, config) {
@@ -2435,7 +2428,7 @@ function vector(a, b) {
2435
2428
  return new PgVectorBuilder(name, config);
2436
2429
  }
2437
2430
  //#endregion
2438
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/columns/all.js
2431
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/columns/all.js
2439
2432
  function getPgColumnBuilders() {
2440
2433
  return {
2441
2434
  bigint,
@@ -2473,7 +2466,7 @@ function getPgColumnBuilders() {
2473
2466
  };
2474
2467
  }
2475
2468
  //#endregion
2476
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/table.js
2469
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/table.js
2477
2470
  var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
2478
2471
  var EnableRLS = Symbol.for("drizzle:EnableRLS");
2479
2472
  var PgTable = class extends Table {
@@ -2520,7 +2513,7 @@ var pgTable = (name, columns, extraConfig) => {
2520
2513
  return pgTableWithSchema(name, columns, extraConfig, void 0);
2521
2514
  };
2522
2515
  //#endregion
2523
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/primary-keys.js
2516
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/primary-keys.js
2524
2517
  var PrimaryKeyBuilder = class {
2525
2518
  static [entityKind] = "PgPrimaryKeyBuilder";
2526
2519
  /** @internal */
@@ -2550,7 +2543,7 @@ var PrimaryKey = class {
2550
2543
  }
2551
2544
  };
2552
2545
  //#endregion
2553
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/sql/expressions/conditions.js
2546
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/sql/expressions/conditions.js
2554
2547
  function bindIfParam(value, column) {
2555
2548
  if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) return new Param(value, column);
2556
2549
  return value;
@@ -2641,7 +2634,7 @@ function notIlike(column, value) {
2641
2634
  return sql`${column} not ilike ${value}`;
2642
2635
  }
2643
2636
  //#endregion
2644
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/sql/expressions/select.js
2637
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/sql/expressions/select.js
2645
2638
  function asc(column) {
2646
2639
  return sql`${column} asc`;
2647
2640
  }
@@ -2649,7 +2642,7 @@ function desc(column) {
2649
2642
  return sql`${column} desc`;
2650
2643
  }
2651
2644
  //#endregion
2652
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/relations.js
2645
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/relations.js
2653
2646
  var Relation = class {
2654
2647
  constructor(sourceTable, referencedTable, relationName) {
2655
2648
  this.sourceTable = sourceTable;
@@ -2769,9 +2762,6 @@ function extractTablesRelationalConfig(schema, configHelpers) {
2769
2762
  tableNamesMap
2770
2763
  };
2771
2764
  }
2772
- function relations(table, relations2) {
2773
- return new Relations(table, (helpers) => Object.fromEntries(Object.entries(relations2(helpers)).map(([key, value]) => [key, value.withFieldName(key)])));
2774
- }
2775
2765
  function createOne(sourceTable) {
2776
2766
  return function one(table, config) {
2777
2767
  return new One(sourceTable, table, config, config?.fields.reduce((res, f) => res && f.notNull, true) ?? false);
@@ -2828,12 +2818,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
2828
2818
  return result;
2829
2819
  }
2830
2820
  //#endregion
2831
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/sql/functions/aggregate.js
2832
- function count(expression) {
2833
- return sql`count(${expression || sql.raw("*")})`.mapWith(Number);
2834
- }
2835
- //#endregion
2836
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/selection-proxy.js
2821
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/selection-proxy.js
2837
2822
  var SelectionProxyHandler = class SelectionProxyHandler {
2838
2823
  static [entityKind] = "SelectionProxyHandler";
2839
2824
  config;
@@ -2870,7 +2855,7 @@ var SelectionProxyHandler = class SelectionProxyHandler {
2870
2855
  }
2871
2856
  };
2872
2857
  //#endregion
2873
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/checks.js
2858
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/checks.js
2874
2859
  var CheckBuilder = class {
2875
2860
  constructor(name, value) {
2876
2861
  this.name = name;
@@ -2897,7 +2882,7 @@ function check(name, value) {
2897
2882
  return new CheckBuilder(name, value);
2898
2883
  }
2899
2884
  //#endregion
2900
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/indexes.js
2885
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/indexes.js
2901
2886
  var IndexBuilderOn = class {
2902
2887
  constructor(unique, name) {
2903
2888
  this.unique = unique;
@@ -2990,7 +2975,7 @@ function uniqueIndex(name) {
2990
2975
  return new IndexBuilderOn(true, name);
2991
2976
  }
2992
2977
  //#endregion
2993
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/casing.js
2978
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/casing.js
2994
2979
  function toSnakeCase(input) {
2995
2980
  return (input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? []).map((word) => word.toLowerCase()).join("_");
2996
2981
  }
@@ -3033,12 +3018,12 @@ var CasingCache = class {
3033
3018
  }
3034
3019
  };
3035
3020
  //#endregion
3036
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/view-base.js
3021
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/view-base.js
3037
3022
  var PgViewBase = class extends View {
3038
3023
  static [entityKind] = "PgViewBase";
3039
3024
  };
3040
3025
  //#endregion
3041
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/dialect.js
3026
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/dialect.js
3042
3027
  var PgDialect = class {
3043
3028
  static [entityKind] = "PgDialect";
3044
3029
  /** @internal */
@@ -3488,7 +3473,7 @@ var PgDialect = class {
3488
3473
  }
3489
3474
  };
3490
3475
  //#endregion
3491
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/query-builders/query-builder.js
3476
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/query-builders/query-builder.js
3492
3477
  var TypedQueryBuilder = class {
3493
3478
  static [entityKind] = "TypedQueryBuilder";
3494
3479
  /** @internal */
@@ -3497,7 +3482,7 @@ var TypedQueryBuilder = class {
3497
3482
  }
3498
3483
  };
3499
3484
  //#endregion
3500
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/select.js
3485
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/select.js
3501
3486
  var PgSelectBuilder = class {
3502
3487
  static [entityKind] = "PgSelectBuilder";
3503
3488
  fields;
@@ -4264,7 +4249,7 @@ var intersectAll = createSetOperator("intersect", true);
4264
4249
  var except = createSetOperator("except", false);
4265
4250
  var exceptAll = createSetOperator("except", true);
4266
4251
  //#endregion
4267
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4252
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/query-builder.js
4268
4253
  var QueryBuilder = class {
4269
4254
  static [entityKind] = "PgQueryBuilder";
4270
4255
  dialect;
@@ -4346,7 +4331,7 @@ var QueryBuilder = class {
4346
4331
  }
4347
4332
  };
4348
4333
  //#endregion
4349
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/utils.js
4334
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/utils.js
4350
4335
  function extractUsedTable(table) {
4351
4336
  if (is(table, PgTable)) return [table[Schema] ? `${table[Schema]}.${table[Table.Symbol.BaseName]}` : table[Table.Symbol.BaseName]];
4352
4337
  if (is(table, Subquery)) return table._.usedTables ?? [];
@@ -4354,7 +4339,7 @@ function extractUsedTable(table) {
4354
4339
  return [];
4355
4340
  }
4356
4341
  //#endregion
4357
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/delete.js
4342
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/delete.js
4358
4343
  var PgDeleteBase = class extends QueryPromise {
4359
4344
  constructor(table, session, dialect, withList) {
4360
4345
  super();
@@ -4450,7 +4435,7 @@ var PgDeleteBase = class extends QueryPromise {
4450
4435
  }
4451
4436
  };
4452
4437
  //#endregion
4453
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4438
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/insert.js
4454
4439
  var PgInsertBuilder = class {
4455
4440
  constructor(table, session, dialect, withList, overridingSystemValue_) {
4456
4441
  this.table = table;
@@ -4627,7 +4612,7 @@ var PgInsertBase = class extends QueryPromise {
4627
4612
  }
4628
4613
  };
4629
4614
  //#endregion
4630
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4615
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/refresh-materialized-view.js
4631
4616
  var PgRefreshMaterializedView = class extends QueryPromise {
4632
4617
  constructor(view, session, dialect) {
4633
4618
  super();
@@ -4677,7 +4662,7 @@ var PgRefreshMaterializedView = class extends QueryPromise {
4677
4662
  };
4678
4663
  };
4679
4664
  //#endregion
4680
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/update.js
4665
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/update.js
4681
4666
  var PgUpdateBuilder = class {
4682
4667
  constructor(table, session, dialect, withList) {
4683
4668
  this.table = table;
@@ -4870,7 +4855,7 @@ var PgUpdateBase = class extends QueryPromise {
4870
4855
  }
4871
4856
  };
4872
4857
  //#endregion
4873
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/count.js
4858
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/count.js
4874
4859
  var PgCountBuilder = class PgCountBuilder extends SQL {
4875
4860
  constructor(params) {
4876
4861
  super(PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
@@ -4912,7 +4897,7 @@ var PgCountBuilder = class PgCountBuilder extends SQL {
4912
4897
  }
4913
4898
  };
4914
4899
  //#endregion
4915
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/query.js
4900
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/query.js
4916
4901
  var RelationalQueryBuilder = class {
4917
4902
  constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
4918
4903
  this.fullSchema = fullSchema;
@@ -5000,7 +4985,7 @@ var PgRelationalQuery = class extends QueryPromise {
5000
4985
  }
5001
4986
  };
5002
4987
  //#endregion
5003
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/query-builders/raw.js
4988
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/query-builders/raw.js
5004
4989
  var PgRaw = class extends QueryPromise {
5005
4990
  constructor(execute, sql, query, mapBatchResult) {
5006
4991
  super();
@@ -5029,7 +5014,7 @@ var PgRaw = class extends QueryPromise {
5029
5014
  }
5030
5015
  };
5031
5016
  //#endregion
5032
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/db.js
5017
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/db.js
5033
5018
  var PgDatabase = class {
5034
5019
  constructor(dialect, session, schema) {
5035
5020
  this.dialect = dialect;
@@ -5290,7 +5275,7 @@ var PgDatabase = class {
5290
5275
  }
5291
5276
  };
5292
5277
  //#endregion
5293
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/cache/core/cache.js
5278
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/cache/core/cache.js
5294
5279
  var Cache = class {
5295
5280
  static [entityKind] = "Cache";
5296
5281
  };
@@ -5310,7 +5295,7 @@ async function hashQuery(sql, params) {
5310
5295
  return [...new Uint8Array(hashBuffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
5311
5296
  }
5312
5297
  //#endregion
5313
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pg-core/session.js
5298
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pg-core/session.js
5314
5299
  var PgPreparedQuery = class {
5315
5300
  constructor(query, cache, queryMetadata, cacheConfig) {
5316
5301
  this.query = query;
@@ -5427,7 +5412,7 @@ var PgTransaction = class extends PgDatabase {
5427
5412
  }
5428
5413
  };
5429
5414
  //#endregion
5430
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pglite/session.js
5415
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pglite/session.js
5431
5416
  var PglitePreparedQuery = class extends PgPreparedQuery {
5432
5417
  constructor(client, queryString, params, logger, cache, queryMetadata, cacheConfig, fields, name, _isResponseInArrayMode, customResultMapper) {
5433
5418
  super({
@@ -5542,7 +5527,7 @@ var PgliteTransaction = class PgliteTransaction extends PgTransaction {
5542
5527
  }
5543
5528
  };
5544
5529
  //#endregion
5545
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/pglite/driver.js
5530
+ //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4/node_modules/drizzle-orm/pglite/driver.js
5546
5531
  var PgliteDriver = class {
5547
5532
  constructor(client, dialect, options = {}) {
5548
5533
  this.client = client;
@@ -5560,7 +5545,7 @@ var PgliteDriver = class {
5560
5545
  var PgliteDatabase = class extends PgDatabase {
5561
5546
  static [entityKind] = "PgliteDatabase";
5562
5547
  };
5563
- function construct$1(client, config = {}) {
5548
+ function construct(client, config = {}) {
5564
5549
  const dialect = new PgDialect({ casing: config.casing });
5565
5550
  let logger;
5566
5551
  if (config.logger === true) logger = new DefaultLogger();
@@ -5583,2134 +5568,24 @@ function construct$1(client, config = {}) {
5583
5568
  if (db.$cache) db.$cache["invalidate"] = config.cache?.onMutate;
5584
5569
  return db;
5585
5570
  }
5586
- function drizzle$1(...params) {
5587
- if (params[0] === void 0 || typeof params[0] === "string") return construct$1(new Ve(params[0]), params[1]);
5588
- if (isConfig(params[0])) {
5589
- const { connection, client, ...drizzleConfig } = params[0];
5590
- if (client) return construct$1(client, drizzleConfig);
5591
- if (typeof connection === "object") {
5592
- const { dataDir, ...options } = connection;
5593
- return construct$1(new Ve(dataDir, options), drizzleConfig);
5594
- }
5595
- return construct$1(new Ve(connection), drizzleConfig);
5596
- }
5597
- return construct$1(params[0], params[1]);
5598
- }
5599
- ((drizzle2) => {
5600
- function mock(config) {
5601
- return construct$1({}, config);
5602
- }
5603
- drizzle2.mock = mock;
5604
- })(drizzle$1 || (drizzle$1 = {}));
5605
- //#endregion
5606
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/query.js
5607
- var originCache = /* @__PURE__ */ new Map(), originStackCache = /* @__PURE__ */ new Map(), originError = Symbol("OriginError");
5608
- var CLOSE = {};
5609
- var Query = class extends Promise {
5610
- constructor(strings, args, handler, canceller, options = {}) {
5611
- let resolve, reject;
5612
- super((a, b) => {
5613
- resolve = a;
5614
- reject = b;
5615
- });
5616
- this.tagged = Array.isArray(strings.raw);
5617
- this.strings = strings;
5618
- this.args = args;
5619
- this.handler = handler;
5620
- this.canceller = canceller;
5621
- this.options = options;
5622
- this.state = null;
5623
- this.statement = null;
5624
- this.resolve = (x) => (this.active = false, resolve(x));
5625
- this.reject = (x) => (this.active = false, reject(x));
5626
- this.active = false;
5627
- this.cancelled = null;
5628
- this.executed = false;
5629
- this.signature = "";
5630
- this[originError] = this.handler.debug ? /* @__PURE__ */ new Error() : this.tagged && cachedError(this.strings);
5631
- }
5632
- get origin() {
5633
- return (this.handler.debug ? this[originError].stack : this.tagged && originStackCache.has(this.strings) ? originStackCache.get(this.strings) : originStackCache.set(this.strings, this[originError].stack).get(this.strings)) || "";
5634
- }
5635
- static get [Symbol.species]() {
5636
- return Promise;
5637
- }
5638
- cancel() {
5639
- return this.canceller && (this.canceller(this), this.canceller = null);
5640
- }
5641
- simple() {
5642
- this.options.simple = true;
5643
- this.options.prepare = false;
5644
- return this;
5645
- }
5646
- async readable() {
5647
- this.simple();
5648
- this.streaming = true;
5649
- return this;
5650
- }
5651
- async writable() {
5652
- this.simple();
5653
- this.streaming = true;
5654
- return this;
5655
- }
5656
- cursor(rows = 1, fn) {
5657
- this.options.simple = false;
5658
- if (typeof rows === "function") {
5659
- fn = rows;
5660
- rows = 1;
5661
- }
5662
- this.cursorRows = rows;
5663
- if (typeof fn === "function") return this.cursorFn = fn, this;
5664
- let prev;
5665
- return { [Symbol.asyncIterator]: () => ({
5666
- next: () => {
5667
- if (this.executed && !this.active) return { done: true };
5668
- prev && prev();
5669
- const promise = new Promise((resolve, reject) => {
5670
- this.cursorFn = (value) => {
5671
- resolve({
5672
- value,
5673
- done: false
5674
- });
5675
- return new Promise((r) => prev = r);
5676
- };
5677
- this.resolve = () => (this.active = false, resolve({ done: true }));
5678
- this.reject = (x) => (this.active = false, reject(x));
5679
- });
5680
- this.execute();
5681
- return promise;
5682
- },
5683
- return() {
5684
- prev && prev(CLOSE);
5685
- return { done: true };
5686
- }
5687
- }) };
5688
- }
5689
- describe() {
5690
- this.options.simple = false;
5691
- this.onlyDescribe = this.options.prepare = true;
5692
- return this;
5693
- }
5694
- stream() {
5695
- throw new Error(".stream has been renamed to .forEach");
5696
- }
5697
- forEach(fn) {
5698
- this.forEachFn = fn;
5699
- this.handle();
5700
- return this;
5701
- }
5702
- raw() {
5703
- this.isRaw = true;
5704
- return this;
5705
- }
5706
- values() {
5707
- this.isRaw = "values";
5708
- return this;
5709
- }
5710
- async handle() {
5711
- !this.executed && (this.executed = true) && await 1 && this.handler(this);
5712
- }
5713
- execute() {
5714
- this.handle();
5715
- return this;
5716
- }
5717
- then() {
5718
- this.handle();
5719
- return super.then.apply(this, arguments);
5720
- }
5721
- catch() {
5722
- this.handle();
5723
- return super.catch.apply(this, arguments);
5724
- }
5725
- finally() {
5726
- this.handle();
5727
- return super.finally.apply(this, arguments);
5728
- }
5729
- };
5730
- function cachedError(xs) {
5731
- if (originCache.has(xs)) return originCache.get(xs);
5732
- const x = Error.stackTraceLimit;
5733
- Error.stackTraceLimit = 4;
5734
- originCache.set(xs, /* @__PURE__ */ new Error());
5735
- Error.stackTraceLimit = x;
5736
- return originCache.get(xs);
5737
- }
5738
- //#endregion
5739
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/errors.js
5740
- var PostgresError = class extends Error {
5741
- constructor(x) {
5742
- super(x.message);
5743
- this.name = this.constructor.name;
5744
- Object.assign(this, x);
5745
- }
5746
- };
5747
- var Errors = {
5748
- connection,
5749
- postgres,
5750
- generic,
5751
- notSupported
5752
- };
5753
- function connection(x, options, socket) {
5754
- const { host, port } = socket || options;
5755
- const error = Object.assign(/* @__PURE__ */ new Error("write " + x + " " + (options.path || host + ":" + port)), {
5756
- code: x,
5757
- errno: x,
5758
- address: options.path || host
5759
- }, options.path ? {} : { port });
5760
- Error.captureStackTrace(error, connection);
5761
- return error;
5762
- }
5763
- function postgres(x) {
5764
- const error = new PostgresError(x);
5765
- Error.captureStackTrace(error, postgres);
5766
- return error;
5767
- }
5768
- function generic(code, message) {
5769
- const error = Object.assign(/* @__PURE__ */ new Error(code + ": " + message), { code });
5770
- Error.captureStackTrace(error, generic);
5771
- return error;
5772
- }
5773
- /* c8 ignore next 10 */
5774
- function notSupported(x) {
5775
- const error = Object.assign(/* @__PURE__ */ new Error(x + " (B) is not supported"), {
5776
- code: "MESSAGE_NOT_SUPPORTED",
5777
- name: x
5778
- });
5779
- Error.captureStackTrace(error, notSupported);
5780
- return error;
5781
- }
5782
- //#endregion
5783
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/types.js
5784
- var types = {
5785
- string: {
5786
- to: 25,
5787
- from: null,
5788
- serialize: (x) => "" + x
5789
- },
5790
- number: {
5791
- to: 0,
5792
- from: [
5793
- 21,
5794
- 23,
5795
- 26,
5796
- 700,
5797
- 701
5798
- ],
5799
- serialize: (x) => "" + x,
5800
- parse: (x) => +x
5801
- },
5802
- json: {
5803
- to: 114,
5804
- from: [114, 3802],
5805
- serialize: (x) => JSON.stringify(x),
5806
- parse: (x) => JSON.parse(x)
5807
- },
5808
- boolean: {
5809
- to: 16,
5810
- from: 16,
5811
- serialize: (x) => x === true ? "t" : "f",
5812
- parse: (x) => x === "t"
5813
- },
5814
- date: {
5815
- to: 1184,
5816
- from: [
5817
- 1082,
5818
- 1114,
5819
- 1184
5820
- ],
5821
- serialize: (x) => (x instanceof Date ? x : new Date(x)).toISOString(),
5822
- parse: (x) => new Date(x)
5823
- },
5824
- bytea: {
5825
- to: 17,
5826
- from: 17,
5827
- serialize: (x) => "\\x" + Buffer.from(x).toString("hex"),
5828
- parse: (x) => Buffer.from(x.slice(2), "hex")
5829
- }
5830
- };
5831
- var NotTagged = class {
5832
- then() {
5833
- notTagged();
5834
- }
5835
- catch() {
5836
- notTagged();
5837
- }
5838
- finally() {
5839
- notTagged();
5840
- }
5841
- };
5842
- var Identifier = class extends NotTagged {
5843
- constructor(value) {
5844
- super();
5845
- this.value = escapeIdentifier(value);
5846
- }
5847
- };
5848
- var Parameter = class extends NotTagged {
5849
- constructor(value, type, array) {
5850
- super();
5851
- this.value = value;
5852
- this.type = type;
5853
- this.array = array;
5854
- }
5855
- };
5856
- var Builder = class extends NotTagged {
5857
- constructor(first, rest) {
5858
- super();
5859
- this.first = first;
5860
- this.rest = rest;
5861
- }
5862
- build(before, parameters, types, options) {
5863
- const keyword = builders.map(([x, fn]) => ({
5864
- fn,
5865
- i: before.search(x)
5866
- })).sort((a, b) => a.i - b.i).pop();
5867
- return keyword.i === -1 ? escapeIdentifiers(this.first, options) : keyword.fn(this.first, this.rest, parameters, types, options);
5868
- }
5869
- };
5870
- function handleValue(x, parameters, types, options) {
5871
- let value = x instanceof Parameter ? x.value : x;
5872
- if (value === void 0) {
5873
- x instanceof Parameter ? x.value = options.transform.undefined : value = x = options.transform.undefined;
5874
- if (value === void 0) throw Errors.generic("UNDEFINED_VALUE", "Undefined values are not allowed");
5875
- }
5876
- return "$" + types.push(x instanceof Parameter ? (parameters.push(x.value), x.array ? x.array[x.type || inferType(x.value)] || x.type || firstIsString(x.value) : x.type) : (parameters.push(x), inferType(x)));
5877
- }
5878
- var defaultHandlers = typeHandlers(types);
5879
- function stringify(q, string, value, parameters, types, options) {
5880
- for (let i = 1; i < q.strings.length; i++) {
5881
- string += stringifyValue(string, value, parameters, types, options) + q.strings[i];
5882
- value = q.args[i];
5883
- }
5884
- return string;
5885
- }
5886
- function stringifyValue(string, value, parameters, types, o) {
5887
- return value instanceof Builder ? value.build(string, parameters, types, o) : value instanceof Query ? fragment(value, parameters, types, o) : value instanceof Identifier ? value.value : value && value[0] instanceof Query ? value.reduce((acc, x) => acc + " " + fragment(x, parameters, types, o), "") : handleValue(value, parameters, types, o);
5888
- }
5889
- function fragment(q, parameters, types, options) {
5890
- q.fragment = true;
5891
- return stringify(q, q.strings[0], q.args[0], parameters, types, options);
5892
- }
5893
- function valuesBuilder(first, parameters, types, columns, options) {
5894
- return first.map((row) => "(" + columns.map((column) => stringifyValue("values", row[column], parameters, types, options)).join(",") + ")").join(",");
5895
- }
5896
- function values(first, rest, parameters, types, options) {
5897
- const multi = Array.isArray(first[0]);
5898
- const columns = rest.length ? rest.flat() : Object.keys(multi ? first[0] : first);
5899
- return valuesBuilder(multi ? first : [first], parameters, types, columns, options);
5900
- }
5901
- function select(first, rest, parameters, types, options) {
5902
- typeof first === "string" && (first = [first].concat(rest));
5903
- if (Array.isArray(first)) return escapeIdentifiers(first, options);
5904
- let value;
5905
- return (rest.length ? rest.flat() : Object.keys(first)).map((x) => {
5906
- value = first[x];
5907
- return (value instanceof Query ? fragment(value, parameters, types, options) : value instanceof Identifier ? value.value : handleValue(value, parameters, types, options)) + " as " + escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x);
5908
- }).join(",");
5909
- }
5910
- var builders = Object.entries({
5911
- values,
5912
- in: (...xs) => {
5913
- const x = values(...xs);
5914
- return x === "()" ? "(null)" : x;
5915
- },
5916
- select,
5917
- as: select,
5918
- returning: select,
5919
- "\\(": select,
5920
- update(first, rest, parameters, types, options) {
5921
- return (rest.length ? rest.flat() : Object.keys(first)).map((x) => escapeIdentifier(options.transform.column.to ? options.transform.column.to(x) : x) + "=" + stringifyValue("values", first[x], parameters, types, options));
5922
- },
5923
- insert(first, rest, parameters, types, options) {
5924
- const columns = rest.length ? rest.flat() : Object.keys(Array.isArray(first) ? first[0] : first);
5925
- return "(" + escapeIdentifiers(columns, options) + ")values" + valuesBuilder(Array.isArray(first) ? first : [first], parameters, types, columns, options);
5926
- }
5927
- }).map(([x, fn]) => [new RegExp("((?:^|[\\s(])" + x + "(?:$|[\\s(]))(?![\\s\\S]*\\1)", "i"), fn]);
5928
- function notTagged() {
5929
- throw Errors.generic("NOT_TAGGED_CALL", "Query not called as a tagged template literal");
5930
- }
5931
- var serializers = defaultHandlers.serializers;
5932
- var parsers = defaultHandlers.parsers;
5933
- function firstIsString(x) {
5934
- if (Array.isArray(x)) return firstIsString(x[0]);
5935
- return typeof x === "string" ? 1009 : 0;
5936
- }
5937
- var mergeUserTypes = function(types) {
5938
- const user = typeHandlers(types || {});
5939
- return {
5940
- serializers: Object.assign({}, serializers, user.serializers),
5941
- parsers: Object.assign({}, parsers, user.parsers)
5942
- };
5943
- };
5944
- function typeHandlers(types) {
5945
- return Object.keys(types).reduce((acc, k) => {
5946
- types[k].from && [].concat(types[k].from).forEach((x) => acc.parsers[x] = types[k].parse);
5947
- if (types[k].serialize) {
5948
- acc.serializers[types[k].to] = types[k].serialize;
5949
- types[k].from && [].concat(types[k].from).forEach((x) => acc.serializers[x] = types[k].serialize);
5950
- }
5951
- return acc;
5952
- }, {
5953
- parsers: {},
5954
- serializers: {}
5955
- });
5956
- }
5957
- function escapeIdentifiers(xs, { transform: { column } }) {
5958
- return xs.map((x) => escapeIdentifier(column.to ? column.to(x) : x)).join(",");
5959
- }
5960
- var escapeIdentifier = function escape(str) {
5961
- return "\"" + str.replace(/"/g, "\"\"").replace(/\./g, "\".\"") + "\"";
5962
- };
5963
- var inferType = function inferType(x) {
5964
- return x instanceof Parameter ? x.type : x instanceof Date ? 1184 : x instanceof Uint8Array ? 17 : x === true || x === false ? 16 : typeof x === "bigint" ? 20 : Array.isArray(x) ? inferType(x[0]) : 0;
5965
- };
5966
- var escapeBackslash = /\\/g;
5967
- var escapeQuote = /"/g;
5968
- function arrayEscape(x) {
5969
- return x.replace(escapeBackslash, "\\\\").replace(escapeQuote, "\\\"");
5970
- }
5971
- var arraySerializer = function arraySerializer(xs, serializer, options, typarray) {
5972
- if (Array.isArray(xs) === false) return xs;
5973
- if (!xs.length) return "{}";
5974
- const first = xs[0];
5975
- const delimiter = typarray === 1020 ? ";" : ",";
5976
- if (Array.isArray(first) && !first.type) return "{" + xs.map((x) => arraySerializer(x, serializer, options, typarray)).join(delimiter) + "}";
5977
- return "{" + xs.map((x) => {
5978
- if (x === void 0) {
5979
- x = options.transform.undefined;
5980
- if (x === void 0) throw Errors.generic("UNDEFINED_VALUE", "Undefined values are not allowed");
5981
- }
5982
- return x === null ? "null" : "\"" + arrayEscape(serializer ? serializer(x.type ? x.value : x) : "" + x) + "\"";
5983
- }).join(delimiter) + "}";
5984
- };
5985
- var arrayParserState = {
5986
- i: 0,
5987
- char: null,
5988
- str: "",
5989
- quoted: false,
5990
- last: 0
5991
- };
5992
- var arrayParser = function arrayParser(x, parser, typarray) {
5993
- arrayParserState.i = arrayParserState.last = 0;
5994
- return arrayParserLoop(arrayParserState, x, parser, typarray);
5995
- };
5996
- function arrayParserLoop(s, x, parser, typarray) {
5997
- const xs = [];
5998
- const delimiter = typarray === 1020 ? ";" : ",";
5999
- for (; s.i < x.length; s.i++) {
6000
- s.char = x[s.i];
6001
- if (s.quoted) if (s.char === "\\") s.str += x[++s.i];
6002
- else if (s.char === "\"") {
6003
- xs.push(parser ? parser(s.str) : s.str);
6004
- s.str = "";
6005
- s.quoted = x[s.i + 1] === "\"";
6006
- s.last = s.i + 2;
6007
- } else s.str += s.char;
6008
- else if (s.char === "\"") s.quoted = true;
6009
- else if (s.char === "{") {
6010
- s.last = ++s.i;
6011
- xs.push(arrayParserLoop(s, x, parser, typarray));
6012
- } else if (s.char === "}") {
6013
- s.quoted = false;
6014
- s.last < s.i && xs.push(parser ? parser(x.slice(s.last, s.i)) : x.slice(s.last, s.i));
6015
- s.last = s.i + 1;
6016
- break;
6017
- } else if (s.char === delimiter && s.p !== "}" && s.p !== "\"") {
6018
- xs.push(parser ? parser(x.slice(s.last, s.i)) : x.slice(s.last, s.i));
6019
- s.last = s.i + 1;
6020
- }
6021
- s.p = s.char;
6022
- }
6023
- s.last < s.i && xs.push(parser ? parser(x.slice(s.last, s.i + 1)) : x.slice(s.last, s.i + 1));
6024
- return xs;
6025
- }
6026
- var toCamel = (x) => {
6027
- let str = x[0];
6028
- for (let i = 1; i < x.length; i++) str += x[i] === "_" ? x[++i].toUpperCase() : x[i];
6029
- return str;
6030
- };
6031
- var toPascal = (x) => {
6032
- let str = x[0].toUpperCase();
6033
- for (let i = 1; i < x.length; i++) str += x[i] === "_" ? x[++i].toUpperCase() : x[i];
6034
- return str;
6035
- };
6036
- var toKebab = (x) => x.replace(/_/g, "-");
6037
- var fromCamel = (x) => x.replace(/([A-Z])/g, "_$1").toLowerCase();
6038
- var fromPascal = (x) => (x.slice(0, 1) + x.slice(1).replace(/([A-Z])/g, "_$1")).toLowerCase();
6039
- var fromKebab = (x) => x.replace(/-/g, "_");
6040
- function createJsonTransform(fn) {
6041
- return function jsonTransform(x, column) {
6042
- return typeof x === "object" && x !== null && (column.type === 114 || column.type === 3802) ? Array.isArray(x) ? x.map((x) => jsonTransform(x, column)) : Object.entries(x).reduce((acc, [k, v]) => Object.assign(acc, { [fn(k)]: jsonTransform(v, column) }), {}) : x;
6043
- };
6044
- }
6045
- toCamel.column = { from: toCamel };
6046
- toCamel.value = { from: createJsonTransform(toCamel) };
6047
- fromCamel.column = { to: fromCamel };
6048
- var camel = { ...toCamel };
6049
- camel.column.to = fromCamel;
6050
- toPascal.column = { from: toPascal };
6051
- toPascal.value = { from: createJsonTransform(toPascal) };
6052
- fromPascal.column = { to: fromPascal };
6053
- var pascal = { ...toPascal };
6054
- pascal.column.to = fromPascal;
6055
- toKebab.column = { from: toKebab };
6056
- toKebab.value = { from: createJsonTransform(toKebab) };
6057
- fromKebab.column = { to: fromKebab };
6058
- var kebab = { ...toKebab };
6059
- kebab.column.to = fromKebab;
6060
- //#endregion
6061
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/result.js
6062
- var Result = class extends Array {
6063
- constructor() {
6064
- super();
6065
- Object.defineProperties(this, {
6066
- count: {
6067
- value: null,
6068
- writable: true
6069
- },
6070
- state: {
6071
- value: null,
6072
- writable: true
6073
- },
6074
- command: {
6075
- value: null,
6076
- writable: true
6077
- },
6078
- columns: {
6079
- value: null,
6080
- writable: true
6081
- },
6082
- statement: {
6083
- value: null,
6084
- writable: true
6085
- }
6086
- });
6087
- }
6088
- static get [Symbol.species]() {
6089
- return Array;
6090
- }
6091
- };
6092
- //#endregion
6093
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/queue.js
6094
- var queue_default = Queue;
6095
- function Queue(initial = []) {
6096
- let xs = initial.slice();
6097
- let index = 0;
6098
- return {
6099
- get length() {
6100
- return xs.length - index;
6101
- },
6102
- remove: (x) => {
6103
- const index = xs.indexOf(x);
6104
- return index === -1 ? null : (xs.splice(index, 1), x);
6105
- },
6106
- push: (x) => (xs.push(x), x),
6107
- shift: () => {
6108
- const out = xs[index++];
6109
- if (index === xs.length) {
6110
- index = 0;
6111
- xs = [];
6112
- } else xs[index - 1] = void 0;
6113
- return out;
6114
- }
6115
- };
6116
- }
6117
- //#endregion
6118
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/bytes.js
6119
- var size = 256;
6120
- var buffer = Buffer.allocUnsafe(size);
6121
- var messages = "BCcDdEFfHPpQSX".split("").reduce((acc, x) => {
6122
- const v = x.charCodeAt(0);
6123
- acc[x] = () => {
6124
- buffer[0] = v;
6125
- b.i = 5;
6126
- return b;
6127
- };
6128
- return acc;
6129
- }, {});
6130
- var b = Object.assign(reset, messages, {
6131
- N: String.fromCharCode(0),
6132
- i: 0,
6133
- inc(x) {
6134
- b.i += x;
6135
- return b;
6136
- },
6137
- str(x) {
6138
- const length = Buffer.byteLength(x);
6139
- fit(length);
6140
- b.i += buffer.write(x, b.i, length, "utf8");
6141
- return b;
6142
- },
6143
- i16(x) {
6144
- fit(2);
6145
- buffer.writeUInt16BE(x, b.i);
6146
- b.i += 2;
6147
- return b;
6148
- },
6149
- i32(x, i) {
6150
- if (i || i === 0) {
6151
- buffer.writeUInt32BE(x, i);
6152
- return b;
6153
- }
6154
- fit(4);
6155
- buffer.writeUInt32BE(x, b.i);
6156
- b.i += 4;
6157
- return b;
6158
- },
6159
- z(x) {
6160
- fit(x);
6161
- buffer.fill(0, b.i, b.i + x);
6162
- b.i += x;
6163
- return b;
6164
- },
6165
- raw(x) {
6166
- buffer = Buffer.concat([buffer.subarray(0, b.i), x]);
6167
- b.i = buffer.length;
6168
- return b;
6169
- },
6170
- end(at = 1) {
6171
- buffer.writeUInt32BE(b.i - at, at);
6172
- const out = buffer.subarray(0, b.i);
6173
- b.i = 0;
6174
- buffer = Buffer.allocUnsafe(size);
6175
- return out;
6176
- }
6177
- });
6178
- function fit(x) {
6179
- if (buffer.length - b.i < x) {
6180
- const prev = buffer, length = prev.length;
6181
- buffer = Buffer.allocUnsafe(length + (length >> 1) + x);
6182
- prev.copy(buffer);
6183
- }
6184
- }
6185
- function reset() {
6186
- b.i = 0;
6187
- return b;
6188
- }
6189
- //#endregion
6190
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/connection.js
6191
- var connection_default = Connection;
6192
- var uid = 1;
6193
- var Sync = b().S().end(), Flush = b().H().end(), SSLRequest = b().i32(8).i32(80877103).end(8), ExecuteUnnamed = Buffer.concat([b().E().str(b.N).i32(0).end(), Sync]), DescribeUnnamed = b().D().str("S").str(b.N).end(), noop$1 = () => {};
6194
- var retryRoutines = new Set([
6195
- "FetchPreparedStatement",
6196
- "RevalidateCachedQuery",
6197
- "transformAssignedExpr"
6198
- ]);
6199
- var errorFields = {
6200
- 83: "severity_local",
6201
- 86: "severity",
6202
- 67: "code",
6203
- 77: "message",
6204
- 68: "detail",
6205
- 72: "hint",
6206
- 80: "position",
6207
- 112: "internal_position",
6208
- 113: "internal_query",
6209
- 87: "where",
6210
- 115: "schema_name",
6211
- 116: "table_name",
6212
- 99: "column_name",
6213
- 100: "data type_name",
6214
- 110: "constraint_name",
6215
- 70: "file",
6216
- 76: "line",
6217
- 82: "routine"
6218
- };
6219
- function Connection(options, queues = {}, { onopen = noop$1, onend = noop$1, onclose = noop$1 } = {}) {
6220
- const { sslnegotiation, ssl, max, user, host, port, database, parsers, transform, onnotice, onnotify, onparameter, max_pipeline, keep_alive, backoff, target_session_attrs } = options;
6221
- const sent = queue_default(), id = uid++, backend = {
6222
- pid: null,
6223
- secret: null
6224
- }, idleTimer = timer(end, options.idle_timeout), lifeTimer = timer(end, options.max_lifetime), connectTimer = timer(connectTimedOut, options.connect_timeout);
6225
- let socket = null, cancelMessage, errorResponse = null, result = new Result(), incoming = Buffer.alloc(0), needsTypes = options.fetch_types, backendParameters = {}, statements = {}, statementId = Math.random().toString(36).slice(2), statementCount = 1, closedTime = 0, remaining = 0, hostIndex = 0, retries = 0, length = 0, delay = 0, rows = 0, serverSignature = null, nextWriteTimer = null, terminated = false, incomings = null, results = null, initial = null, ending = null, stream = null, chunk = null, ended = null, nonce = null, query = null, final = null;
6226
- const connection = {
6227
- queue: queues.closed,
6228
- idleTimer,
6229
- connect(query) {
6230
- initial = query;
6231
- reconnect();
6232
- },
6233
- terminate,
6234
- execute,
6235
- cancel,
6236
- end,
6237
- count: 0,
6238
- id
6239
- };
6240
- queues.closed && queues.closed.push(connection);
6241
- return connection;
6242
- async function createSocket() {
6243
- let x;
6244
- try {
6245
- x = options.socket ? await Promise.resolve(options.socket(options)) : new net.Socket();
6246
- } catch (e) {
6247
- error(e);
6248
- return;
6249
- }
6250
- x.on("error", error);
6251
- x.on("close", closed);
6252
- x.on("drain", drain);
6253
- return x;
6254
- }
6255
- async function cancel({ pid, secret }, resolve, reject) {
6256
- try {
6257
- cancelMessage = b().i32(16).i32(80877102).i32(pid).i32(secret).end(16);
6258
- await connect();
6259
- socket.once("error", reject);
6260
- socket.once("close", resolve);
6261
- } catch (error) {
6262
- reject(error);
6263
- }
6264
- }
6265
- function execute(q) {
6266
- if (terminated) return queryError(q, Errors.connection("CONNECTION_DESTROYED", options));
6267
- if (stream) return queryError(q, Errors.generic("COPY_IN_PROGRESS", "You cannot execute queries during copy"));
6268
- if (q.cancelled) return;
6269
- try {
6270
- q.state = backend;
6271
- query ? sent.push(q) : (query = q, query.active = true);
6272
- build(q);
6273
- return write(toBuffer(q)) && !q.describeFirst && !q.cursorFn && sent.length < max_pipeline && (!q.options.onexecute || q.options.onexecute(connection));
6274
- } catch (error) {
6275
- sent.length === 0 && write(Sync);
6276
- errored(error);
6277
- return true;
6278
- }
6279
- }
6280
- function toBuffer(q) {
6281
- if (q.parameters.length >= 65534) throw Errors.generic("MAX_PARAMETERS_EXCEEDED", "Max number of parameters (65534) exceeded");
6282
- return q.options.simple ? b().Q().str(q.statement.string + b.N).end() : q.describeFirst ? Buffer.concat([describe(q), Flush]) : q.prepare ? q.prepared ? prepared(q) : Buffer.concat([describe(q), prepared(q)]) : unnamed(q);
6283
- }
6284
- function describe(q) {
6285
- return Buffer.concat([Parse(q.statement.string, q.parameters, q.statement.types, q.statement.name), Describe("S", q.statement.name)]);
6286
- }
6287
- function prepared(q) {
6288
- return Buffer.concat([Bind(q.parameters, q.statement.types, q.statement.name, q.cursorName), q.cursorFn ? Execute("", q.cursorRows) : ExecuteUnnamed]);
6289
- }
6290
- function unnamed(q) {
6291
- return Buffer.concat([
6292
- Parse(q.statement.string, q.parameters, q.statement.types),
6293
- DescribeUnnamed,
6294
- prepared(q)
6295
- ]);
6296
- }
6297
- function build(q) {
6298
- const parameters = [], types = [];
6299
- const string = stringify(q, q.strings[0], q.args[0], parameters, types, options);
6300
- !q.tagged && q.args.forEach((x) => handleValue(x, parameters, types, options));
6301
- q.prepare = options.prepare && ("prepare" in q.options ? q.options.prepare : true);
6302
- q.string = string;
6303
- q.signature = q.prepare && types + string;
6304
- q.onlyDescribe && delete statements[q.signature];
6305
- q.parameters = q.parameters || parameters;
6306
- q.prepared = q.prepare && q.signature in statements;
6307
- q.describeFirst = q.onlyDescribe || parameters.length && !q.prepared;
6308
- q.statement = q.prepared ? statements[q.signature] : {
6309
- string,
6310
- types,
6311
- name: q.prepare ? statementId + statementCount++ : ""
6312
- };
6313
- typeof options.debug === "function" && options.debug(id, string, parameters, types);
6314
- }
6315
- function write(x, fn) {
6316
- chunk = chunk ? Buffer.concat([chunk, x]) : Buffer.from(x);
6317
- if (fn || chunk.length >= 1024) return nextWrite(fn);
6318
- nextWriteTimer === null && (nextWriteTimer = setImmediate(nextWrite));
6319
- return true;
6320
- }
6321
- function nextWrite(fn) {
6322
- const x = socket.write(chunk, fn);
6323
- nextWriteTimer !== null && clearImmediate(nextWriteTimer);
6324
- chunk = nextWriteTimer = null;
6325
- return x;
6326
- }
6327
- function connectTimedOut() {
6328
- errored(Errors.connection("CONNECT_TIMEOUT", options, socket));
6329
- socket.destroy();
6330
- }
6331
- async function secure() {
6332
- if (sslnegotiation !== "direct") {
6333
- write(SSLRequest);
6334
- if (!await new Promise((r) => socket.once("data", (x) => r(x[0] === 83))) && ssl === "prefer") return connected();
6335
- }
6336
- const options = {
6337
- socket,
6338
- servername: net.isIP(socket.host) ? void 0 : socket.host
6339
- };
6340
- if (sslnegotiation === "direct") options.ALPNProtocols = ["postgresql"];
6341
- if (ssl === "require" || ssl === "allow" || ssl === "prefer") options.rejectUnauthorized = false;
6342
- else if (typeof ssl === "object") Object.assign(options, ssl);
6343
- socket.removeAllListeners();
6344
- socket = tls.connect(options);
6345
- socket.on("secureConnect", connected);
6346
- socket.on("error", error);
6347
- socket.on("close", closed);
6348
- socket.on("drain", drain);
6349
- }
6350
- /* c8 ignore next 3 */
6351
- function drain() {
6352
- !query && onopen(connection);
6353
- }
6354
- function data(x) {
6355
- if (incomings) {
6356
- incomings.push(x);
6357
- remaining -= x.length;
6358
- if (remaining > 0) return;
6359
- }
6360
- incoming = incomings ? Buffer.concat(incomings, length - remaining) : incoming.length === 0 ? x : Buffer.concat([incoming, x], incoming.length + x.length);
6361
- while (incoming.length > 4) {
6362
- length = incoming.readUInt32BE(1);
6363
- if (length >= incoming.length) {
6364
- remaining = length - incoming.length;
6365
- incomings = [incoming];
6366
- break;
6367
- }
6368
- try {
6369
- handle(incoming.subarray(0, length + 1));
6370
- } catch (e) {
6371
- query && (query.cursorFn || query.describeFirst) && write(Sync);
6372
- errored(e);
6373
- }
6374
- incoming = incoming.subarray(length + 1);
6375
- remaining = 0;
6376
- incomings = null;
6377
- }
6378
- }
6379
- async function connect() {
6380
- terminated = false;
6381
- backendParameters = {};
6382
- socket || (socket = await createSocket());
6383
- if (!socket) return;
6384
- connectTimer.start();
6385
- if (options.socket) return ssl ? secure() : connected();
6386
- socket.on("connect", ssl ? secure : connected);
6387
- if (options.path) return socket.connect(options.path);
6388
- socket.ssl = ssl;
6389
- socket.connect(port[hostIndex], host[hostIndex]);
6390
- socket.host = host[hostIndex];
6391
- socket.port = port[hostIndex];
6392
- hostIndex = (hostIndex + 1) % port.length;
6393
- }
6394
- function reconnect() {
6395
- setTimeout(connect, closedTime ? Math.max(0, closedTime + delay - performance.now()) : 0);
6396
- }
6397
- function connected() {
6398
- try {
6399
- statements = {};
6400
- needsTypes = options.fetch_types;
6401
- statementId = Math.random().toString(36).slice(2);
6402
- statementCount = 1;
6403
- lifeTimer.start();
6404
- socket.on("data", data);
6405
- keep_alive && socket.setKeepAlive && socket.setKeepAlive(true, 1e3 * keep_alive);
6406
- write(StartupMessage());
6407
- } catch (err) {
6408
- error(err);
6409
- }
6410
- }
6411
- function error(err) {
6412
- if (connection.queue === queues.connecting && options.host[retries + 1]) return;
6413
- errored(err);
6414
- while (sent.length) queryError(sent.shift(), err);
6415
- }
6416
- function errored(err) {
6417
- stream && (stream.destroy(err), stream = null);
6418
- query && queryError(query, err);
6419
- initial && (queryError(initial, err), initial = null);
6420
- }
6421
- function queryError(query, err) {
6422
- if (query.reserve) return query.reject(err);
6423
- if (!err || typeof err !== "object") err = new Error(err);
6424
- "query" in err || "parameters" in err || Object.defineProperties(err, {
6425
- stack: {
6426
- value: err.stack + query.origin.replace(/.*\n/, "\n"),
6427
- enumerable: options.debug
6428
- },
6429
- query: {
6430
- value: query.string,
6431
- enumerable: options.debug
6432
- },
6433
- parameters: {
6434
- value: query.parameters,
6435
- enumerable: options.debug
6436
- },
6437
- args: {
6438
- value: query.args,
6439
- enumerable: options.debug
6440
- },
6441
- types: {
6442
- value: query.statement && query.statement.types,
6443
- enumerable: options.debug
6444
- }
6445
- });
6446
- query.reject(err);
6447
- }
6448
- function end() {
6449
- return ending || (!connection.reserved && onend(connection), !connection.reserved && !initial && !query && sent.length === 0 ? (terminate(), new Promise((r) => socket && socket.readyState !== "closed" ? socket.once("close", r) : r())) : ending = new Promise((r) => ended = r));
6450
- }
6451
- function terminate() {
6452
- terminated = true;
6453
- if (stream || query || initial || sent.length) error(Errors.connection("CONNECTION_DESTROYED", options));
6454
- clearImmediate(nextWriteTimer);
6455
- if (socket) {
6456
- socket.removeListener("data", data);
6457
- socket.removeListener("connect", connected);
6458
- socket.readyState === "open" && socket.end(b().X().end());
6459
- }
6460
- ended && (ended(), ending = ended = null);
6461
- }
6462
- async function closed(hadError) {
6463
- incoming = Buffer.alloc(0);
6464
- remaining = 0;
6465
- incomings = null;
6466
- clearImmediate(nextWriteTimer);
6467
- socket.removeListener("data", data);
6468
- socket.removeListener("connect", connected);
6469
- idleTimer.cancel();
6470
- lifeTimer.cancel();
6471
- connectTimer.cancel();
6472
- socket.removeAllListeners();
6473
- socket = null;
6474
- if (initial) return reconnect();
6475
- !hadError && (query || sent.length) && error(Errors.connection("CONNECTION_CLOSED", options, socket));
6476
- closedTime = performance.now();
6477
- hadError && options.shared.retries++;
6478
- delay = (typeof backoff === "function" ? backoff(options.shared.retries) : backoff) * 1e3;
6479
- onclose(connection, Errors.connection("CONNECTION_CLOSED", options, socket));
6480
- }
6481
- function handle(xs, x = xs[0]) {
6482
- (x === 68 ? DataRow : x === 100 ? CopyData : x === 65 ? NotificationResponse : x === 83 ? ParameterStatus : x === 90 ? ReadyForQuery : x === 67 ? CommandComplete : x === 50 ? BindComplete : x === 49 ? ParseComplete : x === 116 ? ParameterDescription : x === 84 ? RowDescription : x === 82 ? Authentication : x === 110 ? NoData : x === 75 ? BackendKeyData : x === 69 ? ErrorResponse : x === 115 ? PortalSuspended : x === 51 ? CloseComplete : x === 71 ? CopyInResponse : x === 78 ? NoticeResponse : x === 72 ? CopyOutResponse : x === 99 ? CopyDone : x === 73 ? EmptyQueryResponse : x === 86 ? FunctionCallResponse : x === 118 ? NegotiateProtocolVersion : x === 87 ? CopyBothResponse :
6483
- /* c8 ignore next */
6484
- UnknownMessage)(xs);
6485
- }
6486
- function DataRow(x) {
6487
- let index = 7;
6488
- let length;
6489
- let column;
6490
- let value;
6491
- const row = query.isRaw ? new Array(query.statement.columns.length) : {};
6492
- for (let i = 0; i < query.statement.columns.length; i++) {
6493
- column = query.statement.columns[i];
6494
- length = x.readInt32BE(index);
6495
- index += 4;
6496
- value = length === -1 ? null : query.isRaw === true ? x.subarray(index, index += length) : column.parser === void 0 ? x.toString("utf8", index, index += length) : column.parser.array === true ? column.parser(x.toString("utf8", index + 1, index += length)) : column.parser(x.toString("utf8", index, index += length));
6497
- query.isRaw ? row[i] = query.isRaw === true ? value : transform.value.from ? transform.value.from(value, column) : value : row[column.name] = transform.value.from ? transform.value.from(value, column) : value;
6498
- }
6499
- query.forEachFn ? query.forEachFn(transform.row.from ? transform.row.from(row) : row, result) : result[rows++] = transform.row.from ? transform.row.from(row) : row;
6500
- }
6501
- function ParameterStatus(x) {
6502
- const [k, v] = x.toString("utf8", 5, x.length - 1).split(b.N);
6503
- backendParameters[k] = v;
6504
- if (options.parameters[k] !== v) {
6505
- options.parameters[k] = v;
6506
- onparameter && onparameter(k, v);
6507
- }
6508
- }
6509
- function ReadyForQuery(x) {
6510
- if (query) if (errorResponse) query.retried ? errored(query.retried) : query.prepared && retryRoutines.has(errorResponse.routine) ? retry(query, errorResponse) : errored(errorResponse);
6511
- else query.resolve(results || result);
6512
- else if (errorResponse) errored(errorResponse);
6513
- query = results = errorResponse = null;
6514
- result = new Result();
6515
- connectTimer.cancel();
6516
- if (initial) {
6517
- if (target_session_attrs) {
6518
- if (!backendParameters.in_hot_standby || !backendParameters.default_transaction_read_only) return fetchState();
6519
- else if (tryNext(target_session_attrs, backendParameters)) return terminate();
6520
- }
6521
- if (needsTypes) {
6522
- initial.reserve && (initial = null);
6523
- return fetchArrayTypes();
6524
- }
6525
- initial && !initial.reserve && execute(initial);
6526
- options.shared.retries = retries = 0;
6527
- initial = null;
6528
- return;
6529
- }
6530
- while (sent.length && (query = sent.shift()) && (query.active = true, query.cancelled)) Connection(options).cancel(query.state, query.cancelled.resolve, query.cancelled.reject);
6531
- if (query) return;
6532
- connection.reserved ? !connection.reserved.release && x[5] === 73 ? ending ? terminate() : (connection.reserved = null, onopen(connection)) : connection.reserved() : ending ? terminate() : onopen(connection);
6533
- }
6534
- function CommandComplete(x) {
6535
- rows = 0;
6536
- for (let i = x.length - 1; i > 0; i--) {
6537
- if (x[i] === 32 && x[i + 1] < 58 && result.count === null) result.count = +x.toString("utf8", i + 1, x.length - 1);
6538
- if (x[i - 1] >= 65) {
6539
- result.command = x.toString("utf8", 5, i);
6540
- result.state = backend;
6541
- break;
6542
- }
6543
- }
6544
- final && (final(), final = null);
6545
- if (result.command === "BEGIN" && max !== 1 && !connection.reserved) return errored(Errors.generic("UNSAFE_TRANSACTION", "Only use sql.begin, sql.reserved or max: 1"));
6546
- if (query.options.simple) return BindComplete();
6547
- if (query.cursorFn) {
6548
- result.count && query.cursorFn(result);
6549
- write(Sync);
6550
- }
6551
- }
6552
- function ParseComplete() {
6553
- query.parsing = false;
6554
- }
6555
- function BindComplete() {
6556
- !result.statement && (result.statement = query.statement);
6557
- result.columns = query.statement.columns;
6558
- }
6559
- function ParameterDescription(x) {
6560
- const length = x.readUInt16BE(5);
6561
- for (let i = 0; i < length; ++i) !query.statement.types[i] && (query.statement.types[i] = x.readUInt32BE(7 + i * 4));
6562
- query.prepare && (statements[query.signature] = query.statement);
6563
- query.describeFirst && !query.onlyDescribe && (write(prepared(query)), query.describeFirst = false);
6564
- }
6565
- function RowDescription(x) {
6566
- if (result.command) {
6567
- results = results || [result];
6568
- results.push(result = new Result());
6569
- result.count = null;
6570
- query.statement.columns = null;
6571
- }
6572
- const length = x.readUInt16BE(5);
6573
- let index = 7;
6574
- let start;
6575
- query.statement.columns = Array(length);
6576
- for (let i = 0; i < length; ++i) {
6577
- start = index;
6578
- while (x[index++] !== 0);
6579
- const table = x.readUInt32BE(index);
6580
- const number = x.readUInt16BE(index + 4);
6581
- const type = x.readUInt32BE(index + 6);
6582
- query.statement.columns[i] = {
6583
- name: transform.column.from ? transform.column.from(x.toString("utf8", start, index - 1)) : x.toString("utf8", start, index - 1),
6584
- parser: parsers[type],
6585
- table,
6586
- number,
6587
- type
6588
- };
6589
- index += 18;
6590
- }
6591
- result.statement = query.statement;
6592
- if (query.onlyDescribe) return query.resolve(query.statement), write(Sync);
6593
- }
6594
- async function Authentication(x, type = x.readUInt32BE(5)) {
6595
- (type === 3 ? AuthenticationCleartextPassword : type === 5 ? AuthenticationMD5Password : type === 10 ? SASL : type === 11 ? SASLContinue : type === 12 ? SASLFinal : type !== 0 ? UnknownAuth : noop$1)(x, type);
6596
- }
6597
- /* c8 ignore next 5 */
6598
- async function AuthenticationCleartextPassword() {
6599
- const payload = await Pass();
6600
- write(b().p().str(payload).z(1).end());
6601
- }
6602
- async function AuthenticationMD5Password(x) {
6603
- const payload = "md5" + await md5(Buffer.concat([Buffer.from(await md5(await Pass() + user)), x.subarray(9)]));
6604
- write(b().p().str(payload).z(1).end());
6605
- }
6606
- async function SASL() {
6607
- nonce = (await crypto$2.randomBytes(18)).toString("base64");
6608
- b().p().str("SCRAM-SHA-256" + b.N);
6609
- const i = b.i;
6610
- write(b.inc(4).str("n,,n=*,r=" + nonce).i32(b.i - i - 4, i).end());
6611
- }
6612
- async function SASLContinue(x) {
6613
- const res = x.toString("utf8", 9).split(",").reduce((acc, x) => (acc[x[0]] = x.slice(2), acc), {});
6614
- const saltedPassword = await crypto$2.pbkdf2Sync(await Pass(), Buffer.from(res.s, "base64"), parseInt(res.i), 32, "sha256");
6615
- const clientKey = await hmac(saltedPassword, "Client Key");
6616
- const auth = "n=*,r=" + nonce + ",r=" + res.r + ",s=" + res.s + ",i=" + res.i + ",c=biws,r=" + res.r;
6617
- serverSignature = (await hmac(await hmac(saltedPassword, "Server Key"), auth)).toString("base64");
6618
- const payload = "c=biws,r=" + res.r + ",p=" + xor(clientKey, Buffer.from(await hmac(await sha256(clientKey), auth))).toString("base64");
6619
- write(b().p().str(payload).end());
6620
- }
6621
- function SASLFinal(x) {
6622
- if (x.toString("utf8", 9).split(b.N, 1)[0].slice(2) === serverSignature) return;
6623
- /* c8 ignore next 5 */
6624
- errored(Errors.generic("SASL_SIGNATURE_MISMATCH", "The server did not return the correct signature"));
6625
- socket.destroy();
6626
- }
6627
- function Pass() {
6628
- return Promise.resolve(typeof options.pass === "function" ? options.pass() : options.pass);
6629
- }
6630
- function NoData() {
6631
- result.statement = query.statement;
6632
- result.statement.columns = [];
6633
- if (query.onlyDescribe) return query.resolve(query.statement), write(Sync);
6634
- }
6635
- function BackendKeyData(x) {
6636
- backend.pid = x.readUInt32BE(5);
6637
- backend.secret = x.readUInt32BE(9);
6638
- }
6639
- async function fetchArrayTypes() {
6640
- needsTypes = false;
6641
- (await new Query([`
6642
- select b.oid, b.typarray
6643
- from pg_catalog.pg_type a
6644
- left join pg_catalog.pg_type b on b.oid = a.typelem
6645
- where a.typcategory = 'A'
6646
- group by b.oid, b.typarray
6647
- order by b.oid
6648
- `], [], execute)).forEach(({ oid, typarray }) => addArrayType(oid, typarray));
6649
- }
6650
- function addArrayType(oid, typarray) {
6651
- if (!!options.parsers[typarray] && !!options.serializers[typarray]) return;
6652
- const parser = options.parsers[oid];
6653
- options.shared.typeArrayMap[oid] = typarray;
6654
- options.parsers[typarray] = (xs) => arrayParser(xs, parser, typarray);
6655
- options.parsers[typarray].array = true;
6656
- options.serializers[typarray] = (xs) => arraySerializer(xs, options.serializers[oid], options, typarray);
6657
- }
6658
- function tryNext(x, xs) {
6659
- return x === "read-write" && xs.default_transaction_read_only === "on" || x === "read-only" && xs.default_transaction_read_only === "off" || x === "primary" && xs.in_hot_standby === "on" || x === "standby" && xs.in_hot_standby === "off" || x === "prefer-standby" && xs.in_hot_standby === "off" && options.host[retries];
6660
- }
6661
- function fetchState() {
6662
- const query = new Query([`
6663
- show transaction_read_only;
6664
- select pg_catalog.pg_is_in_recovery()
6665
- `], [], execute, null, { simple: true });
6666
- query.resolve = ([[a], [b]]) => {
6667
- backendParameters.default_transaction_read_only = a.transaction_read_only;
6668
- backendParameters.in_hot_standby = b.pg_is_in_recovery ? "on" : "off";
6669
- };
6670
- query.execute();
6671
- }
6672
- function ErrorResponse(x) {
6673
- if (query) {
6674
- (query.cursorFn || query.describeFirst) && write(Sync);
6675
- errorResponse = Errors.postgres(parseError(x));
6676
- } else errored(Errors.postgres(parseError(x)));
6677
- }
6678
- function retry(q, error) {
6679
- delete statements[q.signature];
6680
- q.retried = error;
6681
- execute(q);
6682
- }
6683
- function NotificationResponse(x) {
6684
- if (!onnotify) return;
6685
- let index = 9;
6686
- while (x[index++] !== 0);
6687
- onnotify(x.toString("utf8", 9, index - 1), x.toString("utf8", index, x.length - 1));
6688
- }
6689
- async function PortalSuspended() {
6690
- try {
6691
- const x = await Promise.resolve(query.cursorFn(result));
6692
- rows = 0;
6693
- x === CLOSE ? write(Close(query.portal)) : (result = new Result(), write(Execute("", query.cursorRows)));
6694
- } catch (err) {
6695
- write(Sync);
6696
- query.reject(err);
6697
- }
6698
- }
6699
- function CloseComplete() {
6700
- result.count && query.cursorFn(result);
6701
- query.resolve(result);
6702
- }
6703
- function CopyInResponse() {
6704
- stream = new Stream.Writable({
6705
- autoDestroy: true,
6706
- write(chunk, encoding, callback) {
6707
- socket.write(b().d().raw(chunk).end(), callback);
6708
- },
6709
- destroy(error, callback) {
6710
- callback(error);
6711
- socket.write(b().f().str(error + b.N).end());
6712
- stream = null;
6713
- },
6714
- final(callback) {
6715
- socket.write(b().c().end());
6716
- final = callback;
6717
- stream = null;
6718
- }
6719
- });
6720
- query.resolve(stream);
6721
- }
6722
- function CopyOutResponse() {
6723
- stream = new Stream.Readable({ read() {
6724
- socket.resume();
6725
- } });
6726
- query.resolve(stream);
6727
- }
6728
- /* c8 ignore next 3 */
6729
- function CopyBothResponse() {
6730
- stream = new Stream.Duplex({
6731
- autoDestroy: true,
6732
- read() {
6733
- socket.resume();
6734
- },
6735
- /* c8 ignore next 11 */
6736
- write(chunk, encoding, callback) {
6737
- socket.write(b().d().raw(chunk).end(), callback);
6738
- },
6739
- destroy(error, callback) {
6740
- callback(error);
6741
- socket.write(b().f().str(error + b.N).end());
6742
- stream = null;
6743
- },
6744
- final(callback) {
6745
- socket.write(b().c().end());
6746
- final = callback;
6747
- }
6748
- });
6749
- query.resolve(stream);
6750
- }
6751
- function CopyData(x) {
6752
- stream && (stream.push(x.subarray(5)) || socket.pause());
6753
- }
6754
- function CopyDone() {
6755
- stream && stream.push(null);
6756
- stream = null;
6757
- }
6758
- function NoticeResponse(x) {
6759
- onnotice ? onnotice(parseError(x)) : console.log(parseError(x));
6760
- }
6761
- /* c8 ignore next 3 */
6762
- function EmptyQueryResponse() {}
6763
- /* c8 ignore next 3 */
6764
- function FunctionCallResponse() {
6765
- errored(Errors.notSupported("FunctionCallResponse"));
6766
- }
6767
- /* c8 ignore next 3 */
6768
- function NegotiateProtocolVersion() {
6769
- errored(Errors.notSupported("NegotiateProtocolVersion"));
6770
- }
6771
- /* c8 ignore next 3 */
6772
- function UnknownMessage(x) {
6773
- console.error("Postgres.js : Unknown Message:", x[0]);
6774
- }
6775
- /* c8 ignore next 3 */
6776
- function UnknownAuth(x, type) {
6777
- console.error("Postgres.js : Unknown Auth:", type);
6778
- }
6779
- function Bind(parameters, types, statement = "", portal = "") {
6780
- let prev, type;
6781
- b().B().str(portal + b.N).str(statement + b.N).i16(0).i16(parameters.length);
6782
- parameters.forEach((x, i) => {
6783
- if (x === null) return b.i32(4294967295);
6784
- type = types[i];
6785
- parameters[i] = x = type in options.serializers ? options.serializers[type](x) : "" + x;
6786
- prev = b.i;
6787
- b.inc(4).str(x).i32(b.i - prev - 4, prev);
6788
- });
6789
- b.i16(0);
6790
- return b.end();
6791
- }
6792
- function Parse(str, parameters, types, name = "") {
6793
- b().P().str(name + b.N).str(str + b.N).i16(parameters.length);
6794
- parameters.forEach((x, i) => b.i32(types[i] || 0));
6795
- return b.end();
6796
- }
6797
- function Describe(x, name = "") {
6798
- return b().D().str(x).str(name + b.N).end();
6799
- }
6800
- function Execute(portal = "", rows = 0) {
6801
- return Buffer.concat([b().E().str(portal + b.N).i32(rows).end(), Flush]);
6802
- }
6803
- function Close(portal = "") {
6804
- return Buffer.concat([b().C().str("P").str(portal + b.N).end(), b().S().end()]);
6805
- }
6806
- function StartupMessage() {
6807
- return cancelMessage || b().inc(4).i16(3).z(2).str(Object.entries(Object.assign({
6808
- user,
6809
- database,
6810
- client_encoding: "UTF8"
6811
- }, options.connection)).filter(([, v]) => v).map(([k, v]) => k + b.N + v).join(b.N)).z(2).end(0);
6812
- }
6813
- }
6814
- function parseError(x) {
6815
- const error = {};
6816
- let start = 5;
6817
- for (let i = 5; i < x.length - 1; i++) if (x[i] === 0) {
6818
- error[errorFields[x[start]]] = x.toString("utf8", start + 1, i);
6819
- start = i + 1;
6820
- }
6821
- return error;
6822
- }
6823
- function md5(x) {
6824
- return crypto$2.createHash("md5").update(x).digest("hex");
6825
- }
6826
- function hmac(key, x) {
6827
- return crypto$2.createHmac("sha256", key).update(x).digest();
6828
- }
6829
- function sha256(x) {
6830
- return crypto$2.createHash("sha256").update(x).digest();
6831
- }
6832
- function xor(a, b) {
6833
- const length = Math.max(a.length, b.length);
6834
- const buffer = Buffer.allocUnsafe(length);
6835
- for (let i = 0; i < length; i++) buffer[i] = a[i] ^ b[i];
6836
- return buffer;
6837
- }
6838
- function timer(fn, seconds) {
6839
- seconds = typeof seconds === "function" ? seconds() : seconds;
6840
- if (!seconds) return {
6841
- cancel: noop$1,
6842
- start: noop$1
6843
- };
6844
- let timer;
6845
- return {
6846
- cancel() {
6847
- timer && (clearTimeout(timer), timer = null);
6848
- },
6849
- start() {
6850
- timer && clearTimeout(timer);
6851
- timer = setTimeout(done, seconds * 1e3, arguments);
6852
- }
6853
- };
6854
- function done(args) {
6855
- fn.apply(null, args);
6856
- timer = null;
6857
- }
6858
- }
6859
- //#endregion
6860
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/subscribe.js
6861
- var noop = () => {};
6862
- function Subscribe(postgres, options) {
6863
- const subscribers = /* @__PURE__ */ new Map(), slot = "postgresjs_" + Math.random().toString(36).slice(2), state = {};
6864
- let connection, stream, ended = false;
6865
- const sql = subscribe.sql = postgres({
6866
- ...options,
6867
- transform: {
6868
- column: {},
6869
- value: {},
6870
- row: {}
6871
- },
6872
- max: 1,
6873
- fetch_types: false,
6874
- idle_timeout: null,
6875
- max_lifetime: null,
6876
- connection: {
6877
- ...options.connection,
6878
- replication: "database"
6879
- },
6880
- onclose: async function() {
6881
- if (ended) return;
6882
- stream = null;
6883
- state.pid = state.secret = void 0;
6884
- connected(await init(sql, slot, options.publications));
6885
- subscribers.forEach((event) => event.forEach(({ onsubscribe }) => onsubscribe()));
6886
- },
6887
- no_subscribe: true
6888
- });
6889
- const end = sql.end, close = sql.close;
6890
- sql.end = async () => {
6891
- ended = true;
6892
- stream && await new Promise((r) => (stream.once("close", r), stream.end()));
6893
- return end();
6894
- };
6895
- sql.close = async () => {
6896
- stream && await new Promise((r) => (stream.once("close", r), stream.end()));
6897
- return close();
6898
- };
6899
- return subscribe;
6900
- async function subscribe(event, fn, onsubscribe = noop, onerror = noop) {
6901
- event = parseEvent(event);
6902
- if (!connection) connection = init(sql, slot, options.publications);
6903
- const subscriber = {
6904
- fn,
6905
- onsubscribe
6906
- };
6907
- const fns = subscribers.has(event) ? subscribers.get(event).add(subscriber) : subscribers.set(event, new Set([subscriber])).get(event);
6908
- const unsubscribe = () => {
6909
- fns.delete(subscriber);
6910
- fns.size === 0 && subscribers.delete(event);
6911
- };
6912
- return connection.then((x) => {
6913
- connected(x);
6914
- onsubscribe();
6915
- stream && stream.on("error", onerror);
6916
- return {
6917
- unsubscribe,
6918
- state,
6919
- sql
6920
- };
6921
- });
6922
- }
6923
- function connected(x) {
6924
- stream = x.stream;
6925
- state.pid = x.state.pid;
6926
- state.secret = x.state.secret;
6927
- }
6928
- async function init(sql, slot, publications) {
6929
- if (!publications) throw new Error("Missing publication names");
6930
- const xs = await sql.unsafe(`CREATE_REPLICATION_SLOT ${slot} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`);
6931
- const [x] = xs;
6932
- const stream = await sql.unsafe(`START_REPLICATION SLOT ${slot} LOGICAL ${x.consistent_point} (proto_version '1', publication_names '${publications}')`).writable();
6933
- const state = { lsn: Buffer.concat(x.consistent_point.split("/").map((x) => Buffer.from(("00000000" + x).slice(-8), "hex"))) };
6934
- stream.on("data", data);
6935
- stream.on("error", error);
6936
- stream.on("close", sql.close);
6937
- return {
6938
- stream,
6939
- state: xs.state
6940
- };
6941
- function error(e) {
6942
- console.error("Unexpected error during logical streaming - reconnecting", e);
6943
- }
6944
- function data(x) {
6945
- if (x[0] === 119) parse(x.subarray(25), state, sql.options.parsers, handle, options.transform);
6946
- else if (x[0] === 107 && x[17]) {
6947
- state.lsn = x.subarray(1, 9);
6948
- pong();
6949
- }
6950
- }
6951
- function handle(a, b) {
6952
- const path = b.relation.schema + "." + b.relation.table;
6953
- call("*", a, b);
6954
- call("*:" + path, a, b);
6955
- b.relation.keys.length && call("*:" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
6956
- call(b.command, a, b);
6957
- call(b.command + ":" + path, a, b);
6958
- b.relation.keys.length && call(b.command + ":" + path + "=" + b.relation.keys.map((x) => a[x.name]), a, b);
6959
- }
6960
- function pong() {
6961
- const x = Buffer.alloc(34);
6962
- x[0] = "r".charCodeAt(0);
6963
- x.fill(state.lsn, 1);
6964
- x.writeBigInt64BE(BigInt(Date.now() - Date.UTC(2e3, 0, 1)) * BigInt(1e3), 25);
6965
- stream.write(x);
6966
- }
6967
- }
6968
- function call(x, a, b) {
6969
- subscribers.has(x) && subscribers.get(x).forEach(({ fn }) => fn(a, b, x));
6970
- }
6971
- }
6972
- function Time(x) {
6973
- return new Date(Date.UTC(2e3, 0, 1) + Number(x / BigInt(1e3)));
6974
- }
6975
- function parse(x, state, parsers, handle, transform) {
6976
- const char = (acc, [k, v]) => (acc[k.charCodeAt(0)] = v, acc);
6977
- Object.entries({
6978
- R: (x) => {
6979
- let i = 1;
6980
- const r = state[x.readUInt32BE(i)] = {
6981
- schema: x.toString("utf8", i += 4, i = x.indexOf(0, i)) || "pg_catalog",
6982
- table: x.toString("utf8", i + 1, i = x.indexOf(0, i + 1)),
6983
- columns: Array(x.readUInt16BE(i += 2)),
6984
- keys: []
6985
- };
6986
- i += 2;
6987
- let columnIndex = 0, column;
6988
- while (i < x.length) {
6989
- column = r.columns[columnIndex++] = {
6990
- key: x[i++],
6991
- name: transform.column.from ? transform.column.from(x.toString("utf8", i, i = x.indexOf(0, i))) : x.toString("utf8", i, i = x.indexOf(0, i)),
6992
- type: x.readUInt32BE(i += 1),
6993
- parser: parsers[x.readUInt32BE(i)],
6994
- atttypmod: x.readUInt32BE(i += 4)
6995
- };
6996
- column.key && r.keys.push(column);
6997
- i += 4;
6998
- }
6999
- },
7000
- Y: () => {},
7001
- O: () => {},
7002
- B: (x) => {
7003
- state.date = Time(x.readBigInt64BE(9));
7004
- state.lsn = x.subarray(1, 9);
7005
- },
7006
- I: (x) => {
7007
- let i = 1;
7008
- const relation = state[x.readUInt32BE(i)];
7009
- const { row } = tuples(x, relation.columns, i += 7, transform);
7010
- handle(row, {
7011
- command: "insert",
7012
- relation
7013
- });
7014
- },
7015
- D: (x) => {
7016
- let i = 1;
7017
- const relation = state[x.readUInt32BE(i)];
7018
- i += 4;
7019
- const key = x[i] === 75;
7020
- handle(key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform).row : null, {
7021
- command: "delete",
7022
- relation,
7023
- key
7024
- });
7025
- },
7026
- U: (x) => {
7027
- let i = 1;
7028
- const relation = state[x.readUInt32BE(i)];
7029
- i += 4;
7030
- const key = x[i] === 75;
7031
- const xs = key || x[i] === 79 ? tuples(x, relation.columns, i += 3, transform) : null;
7032
- xs && (i = xs.i);
7033
- const { row } = tuples(x, relation.columns, i + 3, transform);
7034
- handle(row, {
7035
- command: "update",
7036
- relation,
7037
- key,
7038
- old: xs && xs.row
7039
- });
7040
- },
7041
- T: () => {},
7042
- C: () => {}
7043
- }).reduce(char, {})[x[0]](x);
7044
- }
7045
- function tuples(x, columns, xi, transform) {
7046
- let type, column, value;
7047
- const row = transform.raw ? new Array(columns.length) : {};
7048
- for (let i = 0; i < columns.length; i++) {
7049
- type = x[xi++];
7050
- column = columns[i];
7051
- value = type === 110 ? null : type === 117 ? void 0 : column.parser === void 0 ? x.toString("utf8", xi + 4, xi += 4 + x.readUInt32BE(xi)) : column.parser.array === true ? column.parser(x.toString("utf8", xi + 5, xi += 4 + x.readUInt32BE(xi))) : column.parser(x.toString("utf8", xi + 4, xi += 4 + x.readUInt32BE(xi)));
7052
- transform.raw ? row[i] = transform.raw === true ? value : transform.value.from ? transform.value.from(value, column) : value : row[column.name] = transform.value.from ? transform.value.from(value, column) : value;
7053
- }
7054
- return {
7055
- i: xi,
7056
- row: transform.row.from ? transform.row.from(row) : row
7057
- };
7058
- }
7059
- function parseEvent(x) {
7060
- const xs = x.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i) || [];
7061
- if (!xs) throw new Error("Malformed subscribe pattern: " + x);
7062
- const [, command, path, key] = xs;
7063
- return (command || "*") + (path ? ":" + (path.indexOf(".") === -1 ? "public." + path : path) : "") + (key ? "=" + key : "");
7064
- }
7065
- //#endregion
7066
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/large.js
7067
- function largeObject(sql, oid, mode = 393216) {
7068
- return new Promise(async (resolve, reject) => {
7069
- await sql.begin(async (sql) => {
7070
- let finish;
7071
- !oid && ([{oid}] = await sql`select lo_creat(-1) as oid`);
7072
- const [{ fd }] = await sql`select lo_open(${oid}, ${mode}) as fd`;
7073
- const lo = {
7074
- writable,
7075
- readable,
7076
- close: () => sql`select lo_close(${fd})`.then(finish),
7077
- tell: () => sql`select lo_tell64(${fd})`,
7078
- read: (x) => sql`select loread(${fd}, ${x}) as data`,
7079
- write: (x) => sql`select lowrite(${fd}, ${x})`,
7080
- truncate: (x) => sql`select lo_truncate64(${fd}, ${x})`,
7081
- seek: (x, whence = 0) => sql`select lo_lseek64(${fd}, ${x}, ${whence})`,
7082
- size: () => sql`
7083
- select
7084
- lo_lseek64(${fd}, location, 0) as position,
7085
- seek.size
7086
- from (
7087
- select
7088
- lo_lseek64($1, 0, 2) as size,
7089
- tell.location
7090
- from (select lo_tell64($1) as location) tell
7091
- ) seek
7092
- `
7093
- };
7094
- resolve(lo);
7095
- return new Promise(async (r) => finish = r);
7096
- async function readable({ highWaterMark = 2048 * 8, start = 0, end = Infinity } = {}) {
7097
- let max = end - start;
7098
- start && await lo.seek(start);
7099
- return new Stream.Readable({
7100
- highWaterMark,
7101
- async read(size) {
7102
- const l = size > max ? size - max : size;
7103
- max -= size;
7104
- const [{ data }] = await lo.read(l);
7105
- this.push(data);
7106
- if (data.length < size) this.push(null);
7107
- }
7108
- });
7109
- }
7110
- async function writable({ highWaterMark = 2048 * 8, start = 0 } = {}) {
7111
- start && await lo.seek(start);
7112
- return new Stream.Writable({
7113
- highWaterMark,
7114
- write(chunk, encoding, callback) {
7115
- lo.write(chunk).then(() => callback(), callback);
7116
- }
7117
- });
7118
- }
7119
- }).catch(reject);
7120
- });
7121
- }
7122
- //#endregion
7123
- //#region ../../node_modules/.pnpm/postgres@3.4.9/node_modules/postgres/src/index.js
7124
- Object.assign(Postgres, {
7125
- PostgresError,
7126
- toPascal,
7127
- pascal,
7128
- toCamel,
7129
- camel,
7130
- toKebab,
7131
- kebab,
7132
- fromPascal,
7133
- fromCamel,
7134
- fromKebab,
7135
- BigInt: {
7136
- to: 20,
7137
- from: [20],
7138
- parse: (x) => BigInt(x),
7139
- serialize: (x) => x.toString()
7140
- }
7141
- });
7142
- var src_default = Postgres;
7143
- function Postgres(a, b) {
7144
- const options = parseOptions(a, b), subscribe = options.no_subscribe || Subscribe(Postgres, { ...options });
7145
- let ending = false;
7146
- const queries = queue_default(), connecting = queue_default(), reserved = queue_default(), closed = queue_default(), ended = queue_default(), open = queue_default(), busy = queue_default(), full = queue_default(), queues = {
7147
- connecting,
7148
- reserved,
7149
- closed,
7150
- ended,
7151
- open,
7152
- busy,
7153
- full
7154
- };
7155
- const connections = [...Array(options.max)].map(() => connection_default(options, queues, {
7156
- onopen,
7157
- onend,
7158
- onclose
7159
- }));
7160
- const sql = Sql(handler);
7161
- Object.assign(sql, {
7162
- get parameters() {
7163
- return options.parameters;
7164
- },
7165
- largeObject: largeObject.bind(null, sql),
7166
- subscribe,
7167
- CLOSE,
7168
- END: CLOSE,
7169
- PostgresError,
7170
- options,
7171
- reserve,
7172
- listen,
7173
- begin,
7174
- close,
7175
- end
7176
- });
7177
- return sql;
7178
- function Sql(handler) {
7179
- handler.debug = options.debug;
7180
- Object.entries(options.types).reduce((acc, [name, type]) => {
7181
- acc[name] = (x) => new Parameter(x, type.to);
7182
- return acc;
7183
- }, typed);
7184
- Object.assign(sql, {
7185
- types: typed,
7186
- typed,
7187
- unsafe,
7188
- notify,
7189
- array,
7190
- json,
7191
- file
7192
- });
7193
- return sql;
7194
- function typed(value, type) {
7195
- return new Parameter(value, type);
7196
- }
7197
- function sql(strings, ...args) {
7198
- return strings && Array.isArray(strings.raw) ? new Query(strings, args, handler, cancel) : typeof strings === "string" && !args.length ? new Identifier(options.transform.column.to ? options.transform.column.to(strings) : strings) : new Builder(strings, args);
7199
- }
7200
- function unsafe(string, args = [], options = {}) {
7201
- arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
7202
- return new Query([string], args, handler, cancel, {
7203
- prepare: false,
7204
- ...options,
7205
- simple: "simple" in options ? options.simple : args.length === 0
7206
- });
7207
- }
7208
- function file(path, args = [], options = {}) {
7209
- arguments.length === 2 && !Array.isArray(args) && (options = args, args = []);
7210
- return new Query([], args, (query) => {
7211
- fs$1.readFile(path, "utf8", (err, string) => {
7212
- if (err) return query.reject(err);
7213
- query.strings = [string];
7214
- handler(query);
7215
- });
7216
- }, cancel, {
7217
- ...options,
7218
- simple: "simple" in options ? options.simple : args.length === 0
7219
- });
7220
- }
7221
- }
7222
- async function listen(name, fn, onlisten) {
7223
- const listener = {
7224
- fn,
7225
- onlisten
7226
- };
7227
- const sql = listen.sql || (listen.sql = Postgres({
7228
- ...options,
7229
- max: 1,
7230
- idle_timeout: null,
7231
- max_lifetime: null,
7232
- fetch_types: false,
7233
- onclose() {
7234
- Object.entries(listen.channels).forEach(([name, { listeners }]) => {
7235
- delete listen.channels[name];
7236
- Promise.all(listeners.map((l) => listen(name, l.fn, l.onlisten).catch(() => {})));
7237
- });
7238
- },
7239
- onnotify(c, x) {
7240
- c in listen.channels && listen.channels[c].listeners.forEach((l) => l.fn(x));
7241
- }
7242
- }));
7243
- const channels = listen.channels || (listen.channels = {});
7244
- if (name in channels) {
7245
- channels[name].listeners.push(listener);
7246
- const result = await channels[name].result;
7247
- listener.onlisten && listener.onlisten();
7248
- return {
7249
- state: result.state,
7250
- unlisten
7251
- };
7252
- }
7253
- channels[name] = {
7254
- result: sql`listen ${sql.unsafe("\"" + name.replace(/"/g, "\"\"") + "\"")}`,
7255
- listeners: [listener]
7256
- };
7257
- const result = await channels[name].result;
7258
- listener.onlisten && listener.onlisten();
7259
- return {
7260
- state: result.state,
7261
- unlisten
7262
- };
7263
- async function unlisten() {
7264
- if (name in channels === false) return;
7265
- channels[name].listeners = channels[name].listeners.filter((x) => x !== listener);
7266
- if (channels[name].listeners.length) return;
7267
- delete channels[name];
7268
- return sql`unlisten ${sql.unsafe("\"" + name.replace(/"/g, "\"\"") + "\"")}`;
7269
- }
7270
- }
7271
- async function notify(channel, payload) {
7272
- return await sql`select pg_notify(${channel}, ${"" + payload})`;
7273
- }
7274
- async function reserve() {
7275
- const queue = queue_default();
7276
- const c = open.length ? open.shift() : await new Promise((resolve, reject) => {
7277
- const query = {
7278
- reserve: resolve,
7279
- reject
7280
- };
7281
- queries.push(query);
7282
- closed.length && connect(closed.shift(), query);
7283
- });
7284
- move(c, reserved);
7285
- c.reserved = () => queue.length ? c.execute(queue.shift()) : move(c, reserved);
7286
- c.reserved.release = true;
7287
- const sql = Sql(handler);
7288
- sql.release = () => {
7289
- c.reserved = null;
7290
- onopen(c);
7291
- };
7292
- return sql;
7293
- function handler(q) {
7294
- c.queue === full ? queue.push(q) : c.execute(q) || move(c, full);
7295
- }
7296
- }
7297
- async function begin(options, fn) {
7298
- !fn && (fn = options, options = "");
7299
- const queries = queue_default();
7300
- let savepoints = 0, connection, prepare = null;
7301
- try {
7302
- await sql.unsafe("begin " + options.replace(/[^a-z ]/gi, ""), [], { onexecute }).execute();
7303
- return await Promise.race([scope(connection, fn), new Promise((_, reject) => connection.onclose = reject)]);
7304
- } catch (error) {
7305
- throw error;
7306
- }
7307
- async function scope(c, fn, name) {
7308
- const sql = Sql(handler);
7309
- sql.savepoint = savepoint;
7310
- sql.prepare = (x) => prepare = x.replace(/[^a-z0-9$-_. ]/gi);
7311
- let uncaughtError, result;
7312
- name && await sql`savepoint ${sql(name)}`;
7313
- try {
7314
- result = await new Promise((resolve, reject) => {
7315
- const x = fn(sql);
7316
- Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve, reject);
7317
- });
7318
- if (uncaughtError) throw uncaughtError;
7319
- } catch (e) {
7320
- await (name ? sql`rollback to ${sql(name)}` : sql`rollback`);
7321
- throw e instanceof PostgresError && e.code === "25P02" && uncaughtError || e;
7322
- }
7323
- if (!name) prepare ? await sql`prepare transaction '${sql.unsafe(prepare)}'` : await sql`commit`;
7324
- return result;
7325
- function savepoint(name, fn) {
7326
- if (name && Array.isArray(name.raw)) return savepoint((sql) => sql.apply(sql, arguments));
7327
- arguments.length === 1 && (fn = name, name = null);
7328
- return scope(c, fn, "s" + savepoints++ + (name ? "_" + name : ""));
7329
- }
7330
- function handler(q) {
7331
- q.catch((e) => uncaughtError || (uncaughtError = e));
7332
- c.queue === full ? queries.push(q) : c.execute(q) || move(c, full);
7333
- }
7334
- }
7335
- function onexecute(c) {
7336
- connection = c;
7337
- move(c, reserved);
7338
- c.reserved = () => queries.length ? c.execute(queries.shift()) : move(c, reserved);
7339
- }
7340
- }
7341
- function move(c, queue) {
7342
- c.queue.remove(c);
7343
- queue.push(c);
7344
- c.queue = queue;
7345
- queue === open ? c.idleTimer.start() : c.idleTimer.cancel();
7346
- return c;
7347
- }
7348
- function json(x) {
7349
- return new Parameter(x, 3802);
7350
- }
7351
- function array(x, type) {
7352
- if (!Array.isArray(x)) return array(Array.from(arguments));
7353
- return new Parameter(x, type || (x.length ? inferType(x) || 25 : 0), options.shared.typeArrayMap);
7354
- }
7355
- function handler(query) {
7356
- if (ending) return query.reject(Errors.connection("CONNECTION_ENDED", options, options));
7357
- if (open.length) return go(open.shift(), query);
7358
- if (closed.length) return connect(closed.shift(), query);
7359
- busy.length ? go(busy.shift(), query) : queries.push(query);
7360
- }
7361
- function go(c, query) {
7362
- return c.execute(query) ? move(c, busy) : move(c, full);
7363
- }
7364
- function cancel(query) {
7365
- return new Promise((resolve, reject) => {
7366
- query.state ? query.active ? connection_default(options).cancel(query.state, resolve, reject) : query.cancelled = {
7367
- resolve,
7368
- reject
7369
- } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve());
7370
- });
7371
- }
7372
- async function end({ timeout = null } = {}) {
7373
- if (ending) return ending;
7374
- await 1;
7375
- let timer;
7376
- return ending = Promise.race([new Promise((r) => timeout !== null && (timer = setTimeout(destroy, timeout * 1e3, r))), Promise.all(connections.map((c) => c.end()).concat(listen.sql ? listen.sql.end({ timeout: 0 }) : [], subscribe.sql ? subscribe.sql.end({ timeout: 0 }) : []))]).then(() => clearTimeout(timer));
7377
- }
7378
- async function close() {
7379
- await Promise.all(connections.map((c) => c.end()));
7380
- }
7381
- async function destroy(resolve) {
7382
- await Promise.all(connections.map((c) => c.terminate()));
7383
- while (queries.length) queries.shift().reject(Errors.connection("CONNECTION_DESTROYED", options));
7384
- resolve();
7385
- }
7386
- function connect(c, query) {
7387
- move(c, connecting);
7388
- c.connect(query);
7389
- return c;
7390
- }
7391
- function onend(c) {
7392
- move(c, ended);
7393
- }
7394
- function onopen(c) {
7395
- if (queries.length === 0) return move(c, open);
7396
- let max = Math.ceil(queries.length / (connecting.length + 1)), ready = true;
7397
- while (ready && queries.length && max-- > 0) {
7398
- const query = queries.shift();
7399
- if (query.reserve) return query.reserve(c);
7400
- ready = c.execute(query);
7401
- }
7402
- ready ? move(c, busy) : move(c, full);
7403
- }
7404
- function onclose(c, e) {
7405
- move(c, closed);
7406
- c.reserved = null;
7407
- c.onclose && (c.onclose(e), c.onclose = null);
7408
- options.onclose && options.onclose(c.id);
7409
- queries.length && connect(c, queries.shift());
7410
- }
7411
- }
7412
- function parseOptions(a, b) {
7413
- if (a && a.shared) return a;
7414
- const env = process.env, o = (!a || typeof a === "string" ? b : a) || {}, { url, multihost } = parseUrl(a), query = [...url.searchParams].reduce((a, [b, c]) => (a[b] = c, a), {}), host = o.hostname || o.host || multihost || url.hostname || env.PGHOST || "localhost", port = o.port || url.port || env.PGPORT || 5432, user = o.user || o.username || url.username || env.PGUSERNAME || env.PGUSER || osUsername();
7415
- o.no_prepare && (o.prepare = false);
7416
- query.sslmode && (query.ssl = query.sslmode, delete query.sslmode);
7417
- "timeout" in o && (console.log("The timeout option is deprecated, use idle_timeout instead"), o.idle_timeout = o.timeout);
7418
- query.sslrootcert === "system" && (query.ssl = "verify-full");
7419
- const ints = [
7420
- "idle_timeout",
7421
- "connect_timeout",
7422
- "max_lifetime",
7423
- "max_pipeline",
7424
- "backoff",
7425
- "keep_alive"
7426
- ];
7427
- const defaults = {
7428
- max: globalThis.Cloudflare ? 3 : 10,
7429
- ssl: false,
7430
- sslnegotiation: null,
7431
- idle_timeout: null,
7432
- connect_timeout: 30,
7433
- max_lifetime,
7434
- max_pipeline: 100,
7435
- backoff,
7436
- keep_alive: 60,
7437
- prepare: true,
7438
- debug: false,
7439
- fetch_types: true,
7440
- publications: "alltables",
7441
- target_session_attrs: null
7442
- };
7443
- return {
7444
- host: Array.isArray(host) ? host : host.split(",").map((x) => x.split(":")[0]),
7445
- port: Array.isArray(port) ? port : host.split(",").map((x) => parseInt(x.split(":")[1] || port)),
7446
- path: o.path || host.indexOf("/") > -1 && host + "/.s.PGSQL." + port,
7447
- database: o.database || o.db || (url.pathname || "").slice(1) || env.PGDATABASE || user,
7448
- user,
7449
- pass: o.pass || o.password || url.password || env.PGPASSWORD || "",
7450
- ...Object.entries(defaults).reduce((acc, [k, d]) => {
7451
- const value = k in o ? o[k] : k in query ? query[k] === "disable" || query[k] === "false" ? false : query[k] : env["PG" + k.toUpperCase()] || d;
7452
- acc[k] = typeof value === "string" && ints.includes(k) ? +value : value;
7453
- return acc;
7454
- }, {}),
7455
- connection: {
7456
- application_name: env.PGAPPNAME || "postgres.js",
7457
- ...o.connection,
7458
- ...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {})
7459
- },
7460
- types: o.types || {},
7461
- target_session_attrs: tsa(o, url, env),
7462
- onnotice: o.onnotice,
7463
- onnotify: o.onnotify,
7464
- onclose: o.onclose,
7465
- onparameter: o.onparameter,
7466
- socket: o.socket,
7467
- transform: parseTransform(o.transform || { undefined: void 0 }),
7468
- parameters: {},
7469
- shared: {
7470
- retries: 0,
7471
- typeArrayMap: {}
7472
- },
7473
- ...mergeUserTypes(o.types)
7474
- };
7475
- }
7476
- function tsa(o, url, env) {
7477
- const x = o.target_session_attrs || url.searchParams.get("target_session_attrs") || env.PGTARGETSESSIONATTRS;
7478
- if (!x || [
7479
- "read-write",
7480
- "read-only",
7481
- "primary",
7482
- "standby",
7483
- "prefer-standby"
7484
- ].includes(x)) return x;
7485
- throw new Error("target_session_attrs " + x + " is not supported");
7486
- }
7487
- function backoff(retries) {
7488
- return (.5 + Math.random() / 2) * Math.min(3 ** retries / 100, 20);
7489
- }
7490
- function max_lifetime() {
7491
- return 60 * (30 + Math.random() * 30);
7492
- }
7493
- function parseTransform(x) {
7494
- return {
7495
- undefined: x.undefined,
7496
- column: {
7497
- from: typeof x.column === "function" ? x.column : x.column && x.column.from,
7498
- to: x.column && x.column.to
7499
- },
7500
- value: {
7501
- from: typeof x.value === "function" ? x.value : x.value && x.value.from,
7502
- to: x.value && x.value.to
7503
- },
7504
- row: {
7505
- from: typeof x.row === "function" ? x.row : x.row && x.row.from,
7506
- to: x.row && x.row.to
7507
- }
7508
- };
7509
- }
7510
- function parseUrl(url) {
7511
- if (!url || typeof url !== "string") return { url: { searchParams: /* @__PURE__ */ new Map() } };
7512
- let host = url;
7513
- host = host.slice(host.indexOf("://") + 3).split(/[?/]/)[0];
7514
- host = decodeURIComponent(host.slice(host.indexOf("@") + 1));
7515
- const urlObj = new URL(url.replace(host, host.split(",")[0]));
7516
- return {
7517
- url: {
7518
- username: decodeURIComponent(urlObj.username),
7519
- password: decodeURIComponent(urlObj.password),
7520
- host: urlObj.host,
7521
- hostname: urlObj.hostname,
7522
- port: urlObj.port,
7523
- pathname: urlObj.pathname,
7524
- searchParams: urlObj.searchParams
7525
- },
7526
- multihost: host.indexOf(",") > -1 && host
7527
- };
7528
- }
7529
- function osUsername() {
7530
- try {
7531
- return os.userInfo().username;
7532
- } catch (_) {
7533
- return process.env.USERNAME || process.env.USER || process.env.LOGNAME;
7534
- }
7535
- }
7536
- //#endregion
7537
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/postgres-js/session.js
7538
- var PostgresJsPreparedQuery = class extends PgPreparedQuery {
7539
- constructor(client, queryString, params, logger, cache, queryMetadata, cacheConfig, fields, _isResponseInArrayMode, customResultMapper) {
7540
- super({
7541
- sql: queryString,
7542
- params
7543
- }, cache, queryMetadata, cacheConfig);
7544
- this.client = client;
7545
- this.queryString = queryString;
7546
- this.params = params;
7547
- this.logger = logger;
7548
- this.fields = fields;
7549
- this._isResponseInArrayMode = _isResponseInArrayMode;
7550
- this.customResultMapper = customResultMapper;
7551
- }
7552
- static [entityKind] = "PostgresJsPreparedQuery";
7553
- async execute(placeholderValues = {}) {
7554
- return tracer.startActiveSpan("drizzle.execute", async (span) => {
7555
- const params = fillPlaceholders(this.params, placeholderValues);
7556
- span?.setAttributes({
7557
- "drizzle.query.text": this.queryString,
7558
- "drizzle.query.params": JSON.stringify(params)
7559
- });
7560
- this.logger.logQuery(this.queryString, params);
7561
- const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
7562
- if (!fields && !customResultMapper) return tracer.startActiveSpan("drizzle.driver.execute", () => {
7563
- return this.queryWithCache(query, params, async () => {
7564
- return await client.unsafe(query, params);
7565
- });
7566
- });
7567
- const rows = await tracer.startActiveSpan("drizzle.driver.execute", () => {
7568
- span?.setAttributes({
7569
- "drizzle.query.text": query,
7570
- "drizzle.query.params": JSON.stringify(params)
7571
- });
7572
- return this.queryWithCache(query, params, async () => {
7573
- return await client.unsafe(query, params).values();
7574
- });
7575
- });
7576
- return tracer.startActiveSpan("drizzle.mapResponse", () => {
7577
- return customResultMapper ? customResultMapper(rows) : rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
7578
- });
7579
- });
7580
- }
7581
- all(placeholderValues = {}) {
7582
- return tracer.startActiveSpan("drizzle.execute", async (span) => {
7583
- const params = fillPlaceholders(this.params, placeholderValues);
7584
- span?.setAttributes({
7585
- "drizzle.query.text": this.queryString,
7586
- "drizzle.query.params": JSON.stringify(params)
7587
- });
7588
- this.logger.logQuery(this.queryString, params);
7589
- return tracer.startActiveSpan("drizzle.driver.execute", () => {
7590
- span?.setAttributes({
7591
- "drizzle.query.text": this.queryString,
7592
- "drizzle.query.params": JSON.stringify(params)
7593
- });
7594
- return this.queryWithCache(this.queryString, params, async () => {
7595
- return this.client.unsafe(this.queryString, params);
7596
- });
7597
- });
7598
- });
7599
- }
7600
- /** @internal */
7601
- isResponseInArrayMode() {
7602
- return this._isResponseInArrayMode;
7603
- }
7604
- };
7605
- var PostgresJsSession = class PostgresJsSession extends PgSession {
7606
- constructor(client, dialect, schema, options = {}) {
7607
- super(dialect);
7608
- this.client = client;
7609
- this.schema = schema;
7610
- this.options = options;
7611
- this.logger = options.logger ?? new NoopLogger();
7612
- this.cache = options.cache ?? new NoopCache();
7613
- }
7614
- static [entityKind] = "PostgresJsSession";
7615
- logger;
7616
- cache;
7617
- prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
7618
- return new PostgresJsPreparedQuery(this.client, query.sql, query.params, this.logger, this.cache, queryMetadata, cacheConfig, fields, isResponseInArrayMode, customResultMapper);
7619
- }
7620
- query(query, params) {
7621
- this.logger.logQuery(query, params);
7622
- return this.client.unsafe(query, params).values();
7623
- }
7624
- queryObjects(query, params) {
7625
- return this.client.unsafe(query, params);
7626
- }
7627
- transaction(transaction, config) {
7628
- return this.client.begin(async (client) => {
7629
- const session = new PostgresJsSession(client, this.dialect, this.schema, this.options);
7630
- const tx = new PostgresJsTransaction(this.dialect, session, this.schema);
7631
- if (config) await tx.setTransaction(config);
7632
- return transaction(tx);
7633
- });
7634
- }
7635
- };
7636
- var PostgresJsTransaction = class PostgresJsTransaction extends PgTransaction {
7637
- constructor(dialect, session, schema, nestedIndex = 0) {
7638
- super(dialect, session, schema, nestedIndex);
7639
- this.session = session;
7640
- }
7641
- static [entityKind] = "PostgresJsTransaction";
7642
- transaction(transaction) {
7643
- return this.session.client.savepoint((client) => {
7644
- const session = new PostgresJsSession(client, this.dialect, this.schema, this.session.options);
7645
- return transaction(new PostgresJsTransaction(this.dialect, session, this.schema));
7646
- });
7647
- }
7648
- };
7649
- //#endregion
7650
- //#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@electric-sql+pglite@0.5.4_kysely@0.29.2_postgres@3.4.9/node_modules/drizzle-orm/postgres-js/driver.js
7651
- var PostgresJsDatabase = class extends PgDatabase {
7652
- static [entityKind] = "PostgresJsDatabase";
7653
- };
7654
- function construct(client, config = {}) {
7655
- const transparentParser = (val) => val;
7656
- for (const type of [
7657
- "1184",
7658
- "1082",
7659
- "1083",
7660
- "1114",
7661
- "1182",
7662
- "1185",
7663
- "1115",
7664
- "1231"
7665
- ]) {
7666
- client.options.parsers[type] = transparentParser;
7667
- client.options.serializers[type] = transparentParser;
7668
- }
7669
- client.options.serializers["114"] = transparentParser;
7670
- client.options.serializers["3802"] = transparentParser;
7671
- const dialect = new PgDialect({ casing: config.casing });
7672
- let logger;
7673
- if (config.logger === true) logger = new DefaultLogger();
7674
- else if (config.logger !== false) logger = config.logger;
7675
- let schema;
7676
- if (config.schema) {
7677
- const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
7678
- schema = {
7679
- fullSchema: config.schema,
7680
- schema: tablesConfig.tables,
7681
- tableNamesMap: tablesConfig.tableNamesMap
7682
- };
7683
- }
7684
- const db = new PostgresJsDatabase(dialect, new PostgresJsSession(client, dialect, schema, {
7685
- logger,
7686
- cache: config.cache
7687
- }), schema);
7688
- db.$client = client;
7689
- db.$cache = config.cache;
7690
- if (db.$cache) db.$cache["invalidate"] = config.cache?.onMutate;
7691
- return db;
7692
- }
7693
5571
  function drizzle(...params) {
7694
- if (typeof params[0] === "string") return construct(src_default(params[0]), params[1]);
5572
+ if (params[0] === void 0 || typeof params[0] === "string") return construct(new Ve(params[0]), params[1]);
7695
5573
  if (isConfig(params[0])) {
7696
5574
  const { connection, client, ...drizzleConfig } = params[0];
7697
5575
  if (client) return construct(client, drizzleConfig);
7698
- if (typeof connection === "object" && connection.url !== void 0) {
7699
- const { url, ...config } = connection;
7700
- return construct(src_default(url, config), drizzleConfig);
5576
+ if (typeof connection === "object") {
5577
+ const { dataDir, ...options } = connection;
5578
+ return construct(new Ve(dataDir, options), drizzleConfig);
7701
5579
  }
7702
- return construct(src_default(connection), drizzleConfig);
5580
+ return construct(new Ve(connection), drizzleConfig);
7703
5581
  }
7704
5582
  return construct(params[0], params[1]);
7705
5583
  }
7706
5584
  ((drizzle2) => {
7707
5585
  function mock(config) {
7708
- return construct({ options: {
7709
- parsers: {},
7710
- serializers: {}
7711
- } }, config);
5586
+ return construct({}, config);
7712
5587
  }
7713
5588
  drizzle2.mock = mock;
7714
5589
  })(drizzle || (drizzle = {}));
7715
5590
  //#endregion
7716
- export { boolean as A, notInArray as C, text as D, timestamp as E, migrator_exports as M, jsonb as O, ne as S, pgTable as T, isNotNull as _, uniqueIndex as a, lt as b, relations as c, and as d, eq as f, inArray as g, ilike as h, index as i, sql as j, integer as k, asc as l, gte as m, src_default as n, check as o, gt as p, drizzle$1 as r, count as s, drizzle as t, desc as u, isNull as v, or as w, lte as x, like as y };
5591
+ export { integer as C, migrator_exports as E, jsonb as S, sql as T, notInArray as _, asc as a, timestamp as b, eq as c, inArray as d, isNotNull as f, ne as g, lte as h, check as i, gt as l, lt as m, index as n, desc as o, isNull as p, uniqueIndex as r, and as s, drizzle as t, gte as u, or as v, boolean as w, text as x, pgTable as y };