@access-dlsu/leapify 0.260505.5 → 0.260506.1

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 (195) hide show
  1. package/dist/app.d.ts +15 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/auth/auth.d.ts +99 -0
  4. package/dist/auth/auth.d.ts.map +1 -0
  5. package/dist/auth/middleware.d.ts +20 -0
  6. package/dist/auth/middleware.d.ts.map +1 -0
  7. package/dist/auth/types.d.ts +17 -0
  8. package/dist/auth/types.d.ts.map +1 -0
  9. package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js +160 -0
  10. package/dist/bun-sqlite-dialect-na--YwnN-CVHVB5NF.js.map +1 -0
  11. package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs +162 -0
  12. package/dist/bun-sqlite-dialect-na--YwnN-QDBSQQTR.cjs.map +1 -0
  13. package/dist/chunk-4DPT2KQR.cjs +467 -0
  14. package/dist/chunk-4DPT2KQR.cjs.map +1 -0
  15. package/dist/chunk-57ANXUP7.cjs +6191 -0
  16. package/dist/chunk-57ANXUP7.cjs.map +1 -0
  17. package/dist/chunk-5JKLV7IE.cjs +2962 -0
  18. package/dist/chunk-5JKLV7IE.cjs.map +1 -0
  19. package/dist/{chunk-FLR7TNLN.js → chunk-63CUZGSZ.js} +4 -12
  20. package/dist/chunk-63CUZGSZ.js.map +1 -0
  21. package/dist/chunk-ANNHE3PZ.js +2285 -0
  22. package/dist/chunk-ANNHE3PZ.js.map +1 -0
  23. package/dist/chunk-DPPGYCX3.cjs +72 -0
  24. package/dist/chunk-DPPGYCX3.cjs.map +1 -0
  25. package/dist/chunk-EGRHWZRV.js +3 -0
  26. package/dist/chunk-EGRHWZRV.js.map +1 -0
  27. package/dist/chunk-EIF2O2BG.js +6187 -0
  28. package/dist/chunk-EIF2O2BG.js.map +1 -0
  29. package/dist/chunk-EMMSS5I5.cjs +37 -0
  30. package/dist/chunk-EMMSS5I5.cjs.map +1 -0
  31. package/dist/chunk-FTSMZYD7.js +3025 -0
  32. package/dist/chunk-FTSMZYD7.js.map +1 -0
  33. package/dist/chunk-G3PMV62Z.js +33 -0
  34. package/dist/chunk-G3PMV62Z.js.map +1 -0
  35. package/dist/chunk-GNRL67OU.js +2949 -0
  36. package/dist/chunk-GNRL67OU.js.map +1 -0
  37. package/dist/chunk-HHNEB7YR.js +8 -0
  38. package/dist/chunk-HHNEB7YR.js.map +1 -0
  39. package/dist/chunk-IQEWVHLM.js +889 -0
  40. package/dist/chunk-IQEWVHLM.js.map +1 -0
  41. package/dist/chunk-JPVIXCF5.cjs +10 -0
  42. package/dist/chunk-JPVIXCF5.cjs.map +1 -0
  43. package/dist/chunk-MNEW2V4T.js +447 -0
  44. package/dist/chunk-MNEW2V4T.js.map +1 -0
  45. package/dist/chunk-NKIQRCOM.cjs +4 -0
  46. package/dist/chunk-NKIQRCOM.cjs.map +1 -0
  47. package/dist/chunk-QARF2YFF.cjs +2296 -0
  48. package/dist/chunk-QARF2YFF.cjs.map +1 -0
  49. package/dist/chunk-RFP2X2FA.cjs +903 -0
  50. package/dist/chunk-RFP2X2FA.cjs.map +1 -0
  51. package/dist/chunk-SXBTHGIL.js +7138 -0
  52. package/dist/chunk-SXBTHGIL.js.map +1 -0
  53. package/dist/chunk-UWXYXU7J.cjs +7166 -0
  54. package/dist/chunk-UWXYXU7J.cjs.map +1 -0
  55. package/dist/chunk-XY4KBWXT.cjs +3066 -0
  56. package/dist/chunk-XY4KBWXT.cjs.map +1 -0
  57. package/dist/{chunk-3ZWIJNZG.cjs → chunk-YFJBE3AU.cjs} +4 -12
  58. package/dist/chunk-YFJBE3AU.cjs.map +1 -0
  59. package/dist/chunk-ZYHBHSSO.js +68 -0
  60. package/dist/chunk-ZYHBHSSO.js.map +1 -0
  61. package/dist/client/{index.d.cts → auth.d.ts} +140 -394
  62. package/dist/client/auth.d.ts.map +1 -0
  63. package/dist/client/index.cjs +840 -48
  64. package/dist/client/index.cjs.map +1 -1
  65. package/dist/client/index.d.ts +34 -1134
  66. package/dist/client/index.d.ts.map +1 -0
  67. package/dist/client/index.js +839 -47
  68. package/dist/client/index.js.map +1 -1
  69. package/dist/client/pow.d.ts +28 -0
  70. package/dist/client/pow.d.ts.map +1 -0
  71. package/dist/client/session.d.ts +29 -0
  72. package/dist/client/session.d.ts.map +1 -0
  73. package/dist/client/types.d.ts +25 -23
  74. package/dist/client/types.d.ts.map +1 -0
  75. package/dist/cron/batch-release.d.ts +9 -0
  76. package/dist/cron/batch-release.d.ts.map +1 -0
  77. package/dist/cron/lifecycle-check.d.ts +10 -0
  78. package/dist/cron/lifecycle-check.d.ts.map +1 -0
  79. package/dist/cron/reconcile-slots.d.ts +10 -0
  80. package/dist/cron/reconcile-slots.d.ts.map +1 -0
  81. package/dist/cron/reminder-emails.d.ts +9 -0
  82. package/dist/cron/reminder-emails.d.ts.map +1 -0
  83. package/dist/cron/renew-watches.d.ts +9 -0
  84. package/dist/cron/renew-watches.d.ts.map +1 -0
  85. package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js +122 -0
  86. package/dist/d1-sqlite-dialect-C2B7YsIT-CEUMIZZI.js.map +1 -0
  87. package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs +124 -0
  88. package/dist/d1-sqlite-dialect-C2B7YsIT-JUX3YYMX.cjs.map +1 -0
  89. package/dist/db/index.d.ts +7 -0
  90. package/dist/db/index.d.ts.map +1 -0
  91. package/dist/db/migrate.d.ts +23 -0
  92. package/dist/db/migrate.d.ts.map +1 -0
  93. package/dist/db/schema/auth.d.ts +649 -0
  94. package/dist/db/schema/auth.d.ts.map +1 -0
  95. package/dist/db/schema/bookmarks.d.ts +88 -0
  96. package/dist/db/schema/bookmarks.d.ts.map +1 -0
  97. package/dist/db/schema/events.d.ts +539 -0
  98. package/dist/db/schema/events.d.ts.map +1 -0
  99. package/dist/db/schema/faqs.d.ts +154 -0
  100. package/dist/db/schema/faqs.d.ts.map +1 -0
  101. package/dist/db/schema/index.d.ts +8 -0
  102. package/dist/db/schema/index.d.ts.map +1 -0
  103. package/dist/db/schema/site-config.d.ts +64 -0
  104. package/dist/db/schema/site-config.d.ts.map +1 -0
  105. package/dist/db/schema/themes.d.ts +123 -0
  106. package/dist/db/schema/themes.d.ts.map +1 -0
  107. package/dist/{types-lTjxCp88.d.cts → db/schema/users.d.ts} +11 -96
  108. package/dist/db/schema/users.d.ts.map +1 -0
  109. package/dist/dist-DZHA5VYX.cjs +260 -0
  110. package/dist/dist-DZHA5VYX.cjs.map +1 -0
  111. package/dist/dist-RRQUBLLO.js +258 -0
  112. package/dist/dist-RRQUBLLO.js.map +1 -0
  113. package/dist/index.cjs +36987 -781
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.ts +23 -1818
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +36846 -642
  118. package/dist/index.js.map +1 -1
  119. package/dist/kysely-adapter-5ZCECLNV.cjs +27 -0
  120. package/dist/kysely-adapter-5ZCECLNV.cjs.map +1 -0
  121. package/dist/kysely-adapter-6CZEASJQ.js +10 -0
  122. package/dist/kysely-adapter-6CZEASJQ.js.map +1 -0
  123. package/dist/lib/errors.d.ts +15 -0
  124. package/dist/lib/errors.d.ts.map +1 -0
  125. package/dist/lib/middleware/cors.d.ts +3 -0
  126. package/dist/lib/middleware/cors.d.ts.map +1 -0
  127. package/dist/lib/middleware/error-handler.d.ts +3 -0
  128. package/dist/lib/middleware/error-handler.d.ts.map +1 -0
  129. package/dist/lib/middleware/pow-challenge.cjs +7 -7
  130. package/dist/lib/middleware/pow-challenge.d.ts +29 -18
  131. package/dist/lib/middleware/pow-challenge.d.ts.map +1 -0
  132. package/dist/lib/middleware/pow-challenge.js +2 -2
  133. package/dist/lib/middleware/rate-limit.d.ts +48 -0
  134. package/dist/lib/middleware/rate-limit.d.ts.map +1 -0
  135. package/dist/lib/middleware/referer-guard.d.ts +18 -0
  136. package/dist/lib/middleware/referer-guard.d.ts.map +1 -0
  137. package/dist/lib/retry.d.ts +12 -0
  138. package/dist/lib/retry.d.ts.map +1 -0
  139. package/dist/node-sqlite-dialect-HEMUZ4B2.js +160 -0
  140. package/dist/node-sqlite-dialect-HEMUZ4B2.js.map +1 -0
  141. package/dist/node-sqlite-dialect-QUBEEKKU.cjs +162 -0
  142. package/dist/node-sqlite-dialect-QUBEEKKU.cjs.map +1 -0
  143. package/dist/queues/handlers.d.ts +13 -0
  144. package/dist/queues/handlers.d.ts.map +1 -0
  145. package/dist/queues/jobs.d.ts +42 -0
  146. package/dist/queues/jobs.d.ts.map +1 -0
  147. package/dist/routes/events.d.ts +4 -0
  148. package/dist/routes/events.d.ts.map +1 -0
  149. package/dist/routes/faqs.d.ts +4 -0
  150. package/dist/routes/faqs.d.ts.map +1 -0
  151. package/dist/routes/health.d.ts +4 -0
  152. package/dist/routes/health.d.ts.map +1 -0
  153. package/dist/routes/internal/gforms-webhook.d.ts +4 -0
  154. package/dist/routes/internal/gforms-webhook.d.ts.map +1 -0
  155. package/dist/routes/site-config.d.ts +4 -0
  156. package/dist/routes/site-config.d.ts.map +1 -0
  157. package/dist/routes/themes.d.ts +4 -0
  158. package/dist/routes/themes.d.ts.map +1 -0
  159. package/dist/routes/uploads.d.ts +4 -0
  160. package/dist/routes/uploads.d.ts.map +1 -0
  161. package/dist/routes/users.d.ts +4 -0
  162. package/dist/routes/users.d.ts.map +1 -0
  163. package/dist/services/cache.d.ts +22 -0
  164. package/dist/services/cache.d.ts.map +1 -0
  165. package/dist/services/contentful-management.d.ts +53 -0
  166. package/dist/services/contentful-management.d.ts.map +1 -0
  167. package/dist/services/contentful.d.ts +97 -0
  168. package/dist/services/contentful.d.ts.map +1 -0
  169. package/dist/services/email.d.ts +75 -0
  170. package/dist/services/email.d.ts.map +1 -0
  171. package/dist/services/gforms.d.ts +60 -0
  172. package/dist/services/gforms.d.ts.map +1 -0
  173. package/dist/services/resend.d.ts +34 -0
  174. package/dist/services/resend.d.ts.map +1 -0
  175. package/dist/services/ses.d.ts +58 -0
  176. package/dist/services/ses.d.ts.map +1 -0
  177. package/dist/services/slots.d.ts +48 -0
  178. package/dist/services/slots.d.ts.map +1 -0
  179. package/dist/services/snapshot.d.ts +90 -0
  180. package/dist/services/snapshot.d.ts.map +1 -0
  181. package/dist/types.d.ts +66 -0
  182. package/dist/types.d.ts.map +1 -0
  183. package/dist/worker-handler.d.ts +64 -0
  184. package/dist/worker-handler.d.ts.map +1 -0
  185. package/dist/worker.d.ts +36 -0
  186. package/dist/worker.d.ts.map +1 -0
  187. package/dist/worker.js +2195 -2553
  188. package/dist/worker.js.map +1 -1
  189. package/package.json +152 -152
  190. package/dist/chunk-3ZWIJNZG.cjs.map +0 -1
  191. package/dist/chunk-FLR7TNLN.js.map +0 -1
  192. package/dist/client/types.d.cts +0 -192
  193. package/dist/index.d.cts +0 -1879
  194. package/dist/lib/middleware/pow-challenge.d.cts +0 -47
  195. package/dist/types-lTjxCp88.d.ts +0 -208
@@ -0,0 +1,3066 @@
1
+ 'use strict';
2
+
3
+ // node_modules/kysely/dist/esm/util/object-utils.js
4
+ function isUndefined(obj) {
5
+ return typeof obj === "undefined" || obj === void 0;
6
+ }
7
+ function isString(obj) {
8
+ return typeof obj === "string";
9
+ }
10
+ function isNumber(obj) {
11
+ return typeof obj === "number";
12
+ }
13
+ function isBoolean(obj) {
14
+ return typeof obj === "boolean";
15
+ }
16
+ function isNull(obj) {
17
+ return obj === null;
18
+ }
19
+ function isDate(obj) {
20
+ return obj instanceof Date;
21
+ }
22
+ function isBigInt(obj) {
23
+ return typeof obj === "bigint";
24
+ }
25
+ function isBuffer(obj) {
26
+ return typeof Buffer !== "undefined" && Buffer.isBuffer(obj);
27
+ }
28
+ function isFunction(obj) {
29
+ return typeof obj === "function";
30
+ }
31
+ function isObject(obj) {
32
+ return typeof obj === "object" && obj !== null;
33
+ }
34
+ function freeze(obj) {
35
+ return Object.freeze(obj);
36
+ }
37
+ function asArray(arg) {
38
+ if (isReadonlyArray(arg)) {
39
+ return arg;
40
+ } else {
41
+ return [arg];
42
+ }
43
+ }
44
+ function isReadonlyArray(arg) {
45
+ return Array.isArray(arg);
46
+ }
47
+ function noop(obj) {
48
+ return obj;
49
+ }
50
+
51
+ // node_modules/kysely/dist/esm/operation-node/create-table-node.js
52
+ var ON_COMMIT_ACTIONS = ["preserve rows", "delete rows", "drop"];
53
+ var CreateTableNode = freeze({
54
+ is(node) {
55
+ return node.kind === "CreateTableNode";
56
+ },
57
+ create(table) {
58
+ return freeze({
59
+ kind: "CreateTableNode",
60
+ table,
61
+ columns: freeze([])
62
+ });
63
+ },
64
+ cloneWithColumn(createTable, column) {
65
+ return freeze({
66
+ ...createTable,
67
+ columns: freeze([...createTable.columns, column])
68
+ });
69
+ },
70
+ cloneWithConstraint(createTable, constraint) {
71
+ return freeze({
72
+ ...createTable,
73
+ constraints: createTable.constraints ? freeze([...createTable.constraints, constraint]) : freeze([constraint])
74
+ });
75
+ },
76
+ cloneWithFrontModifier(createTable, modifier) {
77
+ return freeze({
78
+ ...createTable,
79
+ frontModifiers: createTable.frontModifiers ? freeze([...createTable.frontModifiers, modifier]) : freeze([modifier])
80
+ });
81
+ },
82
+ cloneWithEndModifier(createTable, modifier) {
83
+ return freeze({
84
+ ...createTable,
85
+ endModifiers: createTable.endModifiers ? freeze([...createTable.endModifiers, modifier]) : freeze([modifier])
86
+ });
87
+ },
88
+ cloneWith(createTable, params) {
89
+ return freeze({
90
+ ...createTable,
91
+ ...params
92
+ });
93
+ }
94
+ });
95
+
96
+ // node_modules/kysely/dist/esm/operation-node/insert-query-node.js
97
+ var InsertQueryNode = freeze({
98
+ is(node) {
99
+ return node.kind === "InsertQueryNode";
100
+ },
101
+ create(into, withNode, replace) {
102
+ return freeze({
103
+ kind: "InsertQueryNode",
104
+ into,
105
+ ...withNode && { with: withNode },
106
+ replace
107
+ });
108
+ },
109
+ createWithoutInto() {
110
+ return freeze({
111
+ kind: "InsertQueryNode"
112
+ });
113
+ },
114
+ cloneWith(insertQuery, props) {
115
+ return freeze({
116
+ ...insertQuery,
117
+ ...props
118
+ });
119
+ }
120
+ });
121
+
122
+ // node_modules/kysely/dist/esm/operation-node/operation-node-visitor.js
123
+ var OperationNodeVisitor = class {
124
+ nodeStack = [];
125
+ get parentNode() {
126
+ return this.nodeStack[this.nodeStack.length - 2];
127
+ }
128
+ #visitors = freeze({
129
+ AliasNode: this.visitAlias.bind(this),
130
+ ColumnNode: this.visitColumn.bind(this),
131
+ IdentifierNode: this.visitIdentifier.bind(this),
132
+ SchemableIdentifierNode: this.visitSchemableIdentifier.bind(this),
133
+ RawNode: this.visitRaw.bind(this),
134
+ ReferenceNode: this.visitReference.bind(this),
135
+ SelectQueryNode: this.visitSelectQuery.bind(this),
136
+ SelectionNode: this.visitSelection.bind(this),
137
+ TableNode: this.visitTable.bind(this),
138
+ FromNode: this.visitFrom.bind(this),
139
+ SelectAllNode: this.visitSelectAll.bind(this),
140
+ AndNode: this.visitAnd.bind(this),
141
+ OrNode: this.visitOr.bind(this),
142
+ ValueNode: this.visitValue.bind(this),
143
+ ValueListNode: this.visitValueList.bind(this),
144
+ PrimitiveValueListNode: this.visitPrimitiveValueList.bind(this),
145
+ ParensNode: this.visitParens.bind(this),
146
+ JoinNode: this.visitJoin.bind(this),
147
+ OperatorNode: this.visitOperator.bind(this),
148
+ WhereNode: this.visitWhere.bind(this),
149
+ InsertQueryNode: this.visitInsertQuery.bind(this),
150
+ DeleteQueryNode: this.visitDeleteQuery.bind(this),
151
+ ReturningNode: this.visitReturning.bind(this),
152
+ CreateTableNode: this.visitCreateTable.bind(this),
153
+ AddColumnNode: this.visitAddColumn.bind(this),
154
+ ColumnDefinitionNode: this.visitColumnDefinition.bind(this),
155
+ DropTableNode: this.visitDropTable.bind(this),
156
+ DataTypeNode: this.visitDataType.bind(this),
157
+ OrderByNode: this.visitOrderBy.bind(this),
158
+ OrderByItemNode: this.visitOrderByItem.bind(this),
159
+ GroupByNode: this.visitGroupBy.bind(this),
160
+ GroupByItemNode: this.visitGroupByItem.bind(this),
161
+ UpdateQueryNode: this.visitUpdateQuery.bind(this),
162
+ ColumnUpdateNode: this.visitColumnUpdate.bind(this),
163
+ LimitNode: this.visitLimit.bind(this),
164
+ OffsetNode: this.visitOffset.bind(this),
165
+ OnConflictNode: this.visitOnConflict.bind(this),
166
+ OnDuplicateKeyNode: this.visitOnDuplicateKey.bind(this),
167
+ CreateIndexNode: this.visitCreateIndex.bind(this),
168
+ DropIndexNode: this.visitDropIndex.bind(this),
169
+ ListNode: this.visitList.bind(this),
170
+ PrimaryKeyConstraintNode: this.visitPrimaryKeyConstraint.bind(this),
171
+ UniqueConstraintNode: this.visitUniqueConstraint.bind(this),
172
+ ReferencesNode: this.visitReferences.bind(this),
173
+ CheckConstraintNode: this.visitCheckConstraint.bind(this),
174
+ WithNode: this.visitWith.bind(this),
175
+ CommonTableExpressionNode: this.visitCommonTableExpression.bind(this),
176
+ CommonTableExpressionNameNode: this.visitCommonTableExpressionName.bind(this),
177
+ HavingNode: this.visitHaving.bind(this),
178
+ CreateSchemaNode: this.visitCreateSchema.bind(this),
179
+ DropSchemaNode: this.visitDropSchema.bind(this),
180
+ AlterTableNode: this.visitAlterTable.bind(this),
181
+ DropColumnNode: this.visitDropColumn.bind(this),
182
+ RenameColumnNode: this.visitRenameColumn.bind(this),
183
+ AlterColumnNode: this.visitAlterColumn.bind(this),
184
+ ModifyColumnNode: this.visitModifyColumn.bind(this),
185
+ AddConstraintNode: this.visitAddConstraint.bind(this),
186
+ DropConstraintNode: this.visitDropConstraint.bind(this),
187
+ RenameConstraintNode: this.visitRenameConstraint.bind(this),
188
+ ForeignKeyConstraintNode: this.visitForeignKeyConstraint.bind(this),
189
+ CreateViewNode: this.visitCreateView.bind(this),
190
+ RefreshMaterializedViewNode: this.visitRefreshMaterializedView.bind(this),
191
+ DropViewNode: this.visitDropView.bind(this),
192
+ GeneratedNode: this.visitGenerated.bind(this),
193
+ DefaultValueNode: this.visitDefaultValue.bind(this),
194
+ OnNode: this.visitOn.bind(this),
195
+ ValuesNode: this.visitValues.bind(this),
196
+ SelectModifierNode: this.visitSelectModifier.bind(this),
197
+ CreateTypeNode: this.visitCreateType.bind(this),
198
+ DropTypeNode: this.visitDropType.bind(this),
199
+ ExplainNode: this.visitExplain.bind(this),
200
+ DefaultInsertValueNode: this.visitDefaultInsertValue.bind(this),
201
+ AggregateFunctionNode: this.visitAggregateFunction.bind(this),
202
+ OverNode: this.visitOver.bind(this),
203
+ PartitionByNode: this.visitPartitionBy.bind(this),
204
+ PartitionByItemNode: this.visitPartitionByItem.bind(this),
205
+ SetOperationNode: this.visitSetOperation.bind(this),
206
+ BinaryOperationNode: this.visitBinaryOperation.bind(this),
207
+ UnaryOperationNode: this.visitUnaryOperation.bind(this),
208
+ UsingNode: this.visitUsing.bind(this),
209
+ FunctionNode: this.visitFunction.bind(this),
210
+ CaseNode: this.visitCase.bind(this),
211
+ WhenNode: this.visitWhen.bind(this),
212
+ JSONReferenceNode: this.visitJSONReference.bind(this),
213
+ JSONPathNode: this.visitJSONPath.bind(this),
214
+ JSONPathLegNode: this.visitJSONPathLeg.bind(this),
215
+ JSONOperatorChainNode: this.visitJSONOperatorChain.bind(this),
216
+ TupleNode: this.visitTuple.bind(this),
217
+ MergeQueryNode: this.visitMergeQuery.bind(this),
218
+ MatchedNode: this.visitMatched.bind(this),
219
+ AddIndexNode: this.visitAddIndex.bind(this),
220
+ CastNode: this.visitCast.bind(this),
221
+ FetchNode: this.visitFetch.bind(this),
222
+ TopNode: this.visitTop.bind(this),
223
+ OutputNode: this.visitOutput.bind(this),
224
+ OrActionNode: this.visitOrAction.bind(this),
225
+ CollateNode: this.visitCollate.bind(this)
226
+ });
227
+ visitNode = (node) => {
228
+ this.nodeStack.push(node);
229
+ this.#visitors[node.kind](node);
230
+ this.nodeStack.pop();
231
+ };
232
+ };
233
+
234
+ // node_modules/kysely/dist/esm/operation-node/operator-node.js
235
+ var COMPARISON_OPERATORS = [
236
+ "=",
237
+ "==",
238
+ "!=",
239
+ "<>",
240
+ ">",
241
+ ">=",
242
+ "<",
243
+ "<=",
244
+ "in",
245
+ "not in",
246
+ "is",
247
+ "is not",
248
+ "like",
249
+ "not like",
250
+ "match",
251
+ "ilike",
252
+ "not ilike",
253
+ "@>",
254
+ "<@",
255
+ "^@",
256
+ "&&",
257
+ "?",
258
+ "?&",
259
+ "?|",
260
+ "!<",
261
+ "!>",
262
+ "<=>",
263
+ "!~",
264
+ "~",
265
+ "~*",
266
+ "!~*",
267
+ "@@",
268
+ "@@@",
269
+ "!!",
270
+ "<->",
271
+ "regexp",
272
+ "is distinct from",
273
+ "is not distinct from"
274
+ ];
275
+ var ARITHMETIC_OPERATORS = [
276
+ "+",
277
+ "-",
278
+ "*",
279
+ "/",
280
+ "%",
281
+ "^",
282
+ "&",
283
+ "|",
284
+ "#",
285
+ "<<",
286
+ ">>"
287
+ ];
288
+ var JSON_OPERATORS = ["->", "->>"];
289
+ var BINARY_OPERATORS = [
290
+ ...COMPARISON_OPERATORS,
291
+ ...ARITHMETIC_OPERATORS,
292
+ "&&",
293
+ "||"
294
+ ];
295
+ var UNARY_FILTER_OPERATORS = ["exists", "not exists"];
296
+ var UNARY_OPERATORS = ["not", "-", ...UNARY_FILTER_OPERATORS];
297
+ var OPERATORS = [
298
+ ...BINARY_OPERATORS,
299
+ ...JSON_OPERATORS,
300
+ ...UNARY_OPERATORS,
301
+ "between",
302
+ "between symmetric"
303
+ ];
304
+ var OperatorNode = freeze({
305
+ is(node) {
306
+ return node.kind === "OperatorNode";
307
+ },
308
+ create(operator) {
309
+ return freeze({
310
+ kind: "OperatorNode",
311
+ operator
312
+ });
313
+ }
314
+ });
315
+ function isJSONOperator(op) {
316
+ return isString(op) && JSON_OPERATORS.includes(op);
317
+ }
318
+
319
+ // node_modules/kysely/dist/esm/operation-node/parens-node.js
320
+ var ParensNode = freeze({
321
+ is(node) {
322
+ return node.kind === "ParensNode";
323
+ },
324
+ create(node) {
325
+ return freeze({
326
+ kind: "ParensNode",
327
+ node
328
+ });
329
+ }
330
+ });
331
+
332
+ // node_modules/kysely/dist/esm/operation-node/raw-node.js
333
+ var RawNode = freeze({
334
+ is(node) {
335
+ return node.kind === "RawNode";
336
+ },
337
+ create(sqlFragments, parameters) {
338
+ return freeze({
339
+ kind: "RawNode",
340
+ sqlFragments: freeze(sqlFragments),
341
+ parameters: freeze(parameters)
342
+ });
343
+ },
344
+ createWithSql(sql) {
345
+ return RawNode.create([sql], []);
346
+ },
347
+ createWithChild(child) {
348
+ return RawNode.create(["", ""], [child]);
349
+ },
350
+ createWithChildren(children) {
351
+ return RawNode.create(new Array(children.length + 1).fill(""), children);
352
+ }
353
+ });
354
+
355
+ // node_modules/kysely/dist/esm/operation-node/identifier-node.js
356
+ var IdentifierNode = freeze({
357
+ is(node) {
358
+ return node.kind === "IdentifierNode";
359
+ },
360
+ create(name) {
361
+ return freeze({
362
+ kind: "IdentifierNode",
363
+ name
364
+ });
365
+ }
366
+ });
367
+
368
+ // node_modules/kysely/dist/esm/operation-node/schemable-identifier-node.js
369
+ var SchemableIdentifierNode = freeze({
370
+ is(node) {
371
+ return node.kind === "SchemableIdentifierNode";
372
+ },
373
+ create(identifier) {
374
+ return freeze({
375
+ kind: "SchemableIdentifierNode",
376
+ identifier: IdentifierNode.create(identifier)
377
+ });
378
+ },
379
+ createWithSchema(schema, identifier) {
380
+ return freeze({
381
+ kind: "SchemableIdentifierNode",
382
+ schema: IdentifierNode.create(schema),
383
+ identifier: IdentifierNode.create(identifier)
384
+ });
385
+ }
386
+ });
387
+
388
+ // node_modules/kysely/dist/esm/operation-node/create-view-node.js
389
+ var CreateViewNode = freeze({
390
+ is(node) {
391
+ return node.kind === "CreateViewNode";
392
+ },
393
+ create(name) {
394
+ return freeze({
395
+ kind: "CreateViewNode",
396
+ name: SchemableIdentifierNode.create(name)
397
+ });
398
+ },
399
+ cloneWith(createView, params) {
400
+ return freeze({
401
+ ...createView,
402
+ ...params
403
+ });
404
+ }
405
+ });
406
+
407
+ // node_modules/kysely/dist/esm/operation-node/set-operation-node.js
408
+ var SetOperationNode = freeze({
409
+ is(node) {
410
+ return node.kind === "SetOperationNode";
411
+ },
412
+ create(operator, expression, all) {
413
+ return freeze({
414
+ kind: "SetOperationNode",
415
+ operator,
416
+ expression,
417
+ all
418
+ });
419
+ }
420
+ });
421
+
422
+ // node_modules/kysely/dist/esm/operation-node/when-node.js
423
+ var WhenNode = freeze({
424
+ is(node) {
425
+ return node.kind === "WhenNode";
426
+ },
427
+ create(condition) {
428
+ return freeze({
429
+ kind: "WhenNode",
430
+ condition
431
+ });
432
+ },
433
+ cloneWithResult(whenNode, result) {
434
+ return freeze({
435
+ ...whenNode,
436
+ result
437
+ });
438
+ }
439
+ });
440
+
441
+ // node_modules/kysely/dist/esm/util/log-once.js
442
+ var LOGGED_MESSAGES = /* @__PURE__ */ new Set();
443
+ function logOnce(message) {
444
+ if (LOGGED_MESSAGES.has(message)) {
445
+ return;
446
+ }
447
+ LOGGED_MESSAGES.add(message);
448
+ console.log(message);
449
+ }
450
+
451
+ // node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js
452
+ var LIT_WRAP_REGEX = /'/g;
453
+ var DefaultQueryCompiler = class extends OperationNodeVisitor {
454
+ #sql = "";
455
+ #parameters = [];
456
+ get numParameters() {
457
+ return this.#parameters.length;
458
+ }
459
+ compileQuery(node, queryId) {
460
+ this.#sql = "";
461
+ this.#parameters = [];
462
+ this.nodeStack.splice(0, this.nodeStack.length);
463
+ this.visitNode(node);
464
+ return freeze({
465
+ query: node,
466
+ queryId,
467
+ sql: this.getSql(),
468
+ parameters: [...this.#parameters]
469
+ });
470
+ }
471
+ getSql() {
472
+ return this.#sql;
473
+ }
474
+ visitSelectQuery(node) {
475
+ const wrapInParens = this.parentNode !== void 0 && !ParensNode.is(this.parentNode) && !InsertQueryNode.is(this.parentNode) && !CreateTableNode.is(this.parentNode) && !CreateViewNode.is(this.parentNode) && !SetOperationNode.is(this.parentNode);
476
+ if (this.parentNode === void 0 && node.explain) {
477
+ this.visitNode(node.explain);
478
+ this.append(" ");
479
+ }
480
+ if (wrapInParens) {
481
+ this.append("(");
482
+ }
483
+ if (node.with) {
484
+ this.visitNode(node.with);
485
+ this.append(" ");
486
+ }
487
+ this.append("select");
488
+ if (node.distinctOn) {
489
+ this.append(" ");
490
+ this.compileDistinctOn(node.distinctOn);
491
+ }
492
+ if (node.frontModifiers?.length) {
493
+ this.append(" ");
494
+ this.compileList(node.frontModifiers, " ");
495
+ }
496
+ if (node.top) {
497
+ this.append(" ");
498
+ this.visitNode(node.top);
499
+ }
500
+ if (node.selections) {
501
+ this.append(" ");
502
+ this.compileList(node.selections);
503
+ }
504
+ if (node.from) {
505
+ this.append(" ");
506
+ this.visitNode(node.from);
507
+ }
508
+ if (node.joins) {
509
+ this.append(" ");
510
+ this.compileList(node.joins, " ");
511
+ }
512
+ if (node.where) {
513
+ this.append(" ");
514
+ this.visitNode(node.where);
515
+ }
516
+ if (node.groupBy) {
517
+ this.append(" ");
518
+ this.visitNode(node.groupBy);
519
+ }
520
+ if (node.having) {
521
+ this.append(" ");
522
+ this.visitNode(node.having);
523
+ }
524
+ if (node.setOperations) {
525
+ this.append(" ");
526
+ this.compileList(node.setOperations, " ");
527
+ }
528
+ if (node.orderBy) {
529
+ this.append(" ");
530
+ this.visitNode(node.orderBy);
531
+ }
532
+ if (node.limit) {
533
+ this.append(" ");
534
+ this.visitNode(node.limit);
535
+ }
536
+ if (node.offset) {
537
+ this.append(" ");
538
+ this.visitNode(node.offset);
539
+ }
540
+ if (node.fetch) {
541
+ this.append(" ");
542
+ this.visitNode(node.fetch);
543
+ }
544
+ if (node.endModifiers?.length) {
545
+ this.append(" ");
546
+ this.compileList(this.sortSelectModifiers([...node.endModifiers]), " ");
547
+ }
548
+ if (wrapInParens) {
549
+ this.append(")");
550
+ }
551
+ }
552
+ visitFrom(node) {
553
+ this.append("from ");
554
+ this.compileList(node.froms);
555
+ }
556
+ visitSelection(node) {
557
+ this.visitNode(node.selection);
558
+ }
559
+ visitColumn(node) {
560
+ this.visitNode(node.column);
561
+ }
562
+ compileDistinctOn(expressions) {
563
+ this.append("distinct on (");
564
+ this.compileList(expressions);
565
+ this.append(")");
566
+ }
567
+ compileList(nodes, separator = ", ") {
568
+ const lastIndex = nodes.length - 1;
569
+ for (let i = 0; i <= lastIndex; i++) {
570
+ this.visitNode(nodes[i]);
571
+ if (i < lastIndex) {
572
+ this.append(separator);
573
+ }
574
+ }
575
+ }
576
+ visitWhere(node) {
577
+ this.append("where ");
578
+ this.visitNode(node.where);
579
+ }
580
+ visitHaving(node) {
581
+ this.append("having ");
582
+ this.visitNode(node.having);
583
+ }
584
+ visitInsertQuery(node) {
585
+ const wrapInParens = this.parentNode !== void 0 && !ParensNode.is(this.parentNode) && !RawNode.is(this.parentNode) && !WhenNode.is(this.parentNode);
586
+ if (this.parentNode === void 0 && node.explain) {
587
+ this.visitNode(node.explain);
588
+ this.append(" ");
589
+ }
590
+ if (wrapInParens) {
591
+ this.append("(");
592
+ }
593
+ if (node.with) {
594
+ this.visitNode(node.with);
595
+ this.append(" ");
596
+ }
597
+ this.append(node.replace ? "replace" : "insert");
598
+ if (node.ignore) {
599
+ logOnce("`InsertQueryNode.ignore` is deprecated. Use `InsertQueryNode.orAction` instead.");
600
+ this.append(" ignore");
601
+ }
602
+ if (node.orAction) {
603
+ this.append(" ");
604
+ this.visitNode(node.orAction);
605
+ }
606
+ if (node.top) {
607
+ this.append(" ");
608
+ this.visitNode(node.top);
609
+ }
610
+ if (node.into) {
611
+ this.append(" into ");
612
+ this.visitNode(node.into);
613
+ }
614
+ if (node.columns) {
615
+ this.append(" (");
616
+ this.compileList(node.columns);
617
+ this.append(")");
618
+ }
619
+ if (node.output) {
620
+ this.append(" ");
621
+ this.visitNode(node.output);
622
+ }
623
+ if (node.values) {
624
+ this.append(" ");
625
+ this.visitNode(node.values);
626
+ }
627
+ if (node.defaultValues) {
628
+ this.append(" ");
629
+ this.append("default values");
630
+ }
631
+ if (node.onConflict) {
632
+ this.append(" ");
633
+ this.visitNode(node.onConflict);
634
+ }
635
+ if (node.onDuplicateKey) {
636
+ this.append(" ");
637
+ this.visitNode(node.onDuplicateKey);
638
+ }
639
+ if (node.returning) {
640
+ this.append(" ");
641
+ this.visitNode(node.returning);
642
+ }
643
+ if (wrapInParens) {
644
+ this.append(")");
645
+ }
646
+ if (node.endModifiers?.length) {
647
+ this.append(" ");
648
+ this.compileList(node.endModifiers, " ");
649
+ }
650
+ }
651
+ visitValues(node) {
652
+ this.append("values ");
653
+ this.compileList(node.values);
654
+ }
655
+ visitDeleteQuery(node) {
656
+ const wrapInParens = this.parentNode !== void 0 && !ParensNode.is(this.parentNode) && !RawNode.is(this.parentNode);
657
+ if (this.parentNode === void 0 && node.explain) {
658
+ this.visitNode(node.explain);
659
+ this.append(" ");
660
+ }
661
+ if (wrapInParens) {
662
+ this.append("(");
663
+ }
664
+ if (node.with) {
665
+ this.visitNode(node.with);
666
+ this.append(" ");
667
+ }
668
+ this.append("delete ");
669
+ if (node.top) {
670
+ this.visitNode(node.top);
671
+ this.append(" ");
672
+ }
673
+ this.visitNode(node.from);
674
+ if (node.output) {
675
+ this.append(" ");
676
+ this.visitNode(node.output);
677
+ }
678
+ if (node.using) {
679
+ this.append(" ");
680
+ this.visitNode(node.using);
681
+ }
682
+ if (node.joins) {
683
+ this.append(" ");
684
+ this.compileList(node.joins, " ");
685
+ }
686
+ if (node.where) {
687
+ this.append(" ");
688
+ this.visitNode(node.where);
689
+ }
690
+ if (node.orderBy) {
691
+ this.append(" ");
692
+ this.visitNode(node.orderBy);
693
+ }
694
+ if (node.limit) {
695
+ this.append(" ");
696
+ this.visitNode(node.limit);
697
+ }
698
+ if (node.returning) {
699
+ this.append(" ");
700
+ this.visitNode(node.returning);
701
+ }
702
+ if (wrapInParens) {
703
+ this.append(")");
704
+ }
705
+ if (node.endModifiers?.length) {
706
+ this.append(" ");
707
+ this.compileList(node.endModifiers, " ");
708
+ }
709
+ }
710
+ visitReturning(node) {
711
+ this.append("returning ");
712
+ this.compileList(node.selections);
713
+ }
714
+ visitAlias(node) {
715
+ this.visitNode(node.node);
716
+ this.append(" as ");
717
+ this.visitNode(node.alias);
718
+ }
719
+ visitReference(node) {
720
+ if (node.table) {
721
+ this.visitNode(node.table);
722
+ this.append(".");
723
+ }
724
+ this.visitNode(node.column);
725
+ }
726
+ visitSelectAll(_) {
727
+ this.append("*");
728
+ }
729
+ visitIdentifier(node) {
730
+ this.append(this.getLeftIdentifierWrapper());
731
+ this.compileUnwrappedIdentifier(node);
732
+ this.append(this.getRightIdentifierWrapper());
733
+ }
734
+ compileUnwrappedIdentifier(node) {
735
+ if (!isString(node.name)) {
736
+ throw new Error("a non-string identifier was passed to compileUnwrappedIdentifier.");
737
+ }
738
+ this.append(this.sanitizeIdentifier(node.name));
739
+ }
740
+ visitAnd(node) {
741
+ this.visitNode(node.left);
742
+ this.append(" and ");
743
+ this.visitNode(node.right);
744
+ }
745
+ visitOr(node) {
746
+ this.visitNode(node.left);
747
+ this.append(" or ");
748
+ this.visitNode(node.right);
749
+ }
750
+ visitValue(node) {
751
+ if (node.immediate) {
752
+ this.appendImmediateValue(node.value);
753
+ } else {
754
+ this.appendValue(node.value);
755
+ }
756
+ }
757
+ visitValueList(node) {
758
+ this.append("(");
759
+ this.compileList(node.values);
760
+ this.append(")");
761
+ }
762
+ visitTuple(node) {
763
+ this.append("(");
764
+ this.compileList(node.values);
765
+ this.append(")");
766
+ }
767
+ visitPrimitiveValueList(node) {
768
+ this.append("(");
769
+ const { values } = node;
770
+ for (let i = 0; i < values.length; ++i) {
771
+ this.appendValue(values[i]);
772
+ if (i !== values.length - 1) {
773
+ this.append(", ");
774
+ }
775
+ }
776
+ this.append(")");
777
+ }
778
+ visitParens(node) {
779
+ this.append("(");
780
+ this.visitNode(node.node);
781
+ this.append(")");
782
+ }
783
+ visitJoin(node) {
784
+ this.append(JOIN_TYPE_SQL[node.joinType]);
785
+ this.append(" ");
786
+ this.visitNode(node.table);
787
+ if (node.on) {
788
+ this.append(" ");
789
+ this.visitNode(node.on);
790
+ }
791
+ }
792
+ visitOn(node) {
793
+ this.append("on ");
794
+ this.visitNode(node.on);
795
+ }
796
+ visitRaw(node) {
797
+ const { sqlFragments, parameters: params } = node;
798
+ for (let i = 0; i < sqlFragments.length; ++i) {
799
+ this.append(sqlFragments[i]);
800
+ if (params.length > i) {
801
+ this.visitNode(params[i]);
802
+ }
803
+ }
804
+ }
805
+ visitOperator(node) {
806
+ this.append(node.operator);
807
+ }
808
+ visitTable(node) {
809
+ this.visitNode(node.table);
810
+ }
811
+ visitSchemableIdentifier(node) {
812
+ if (node.schema) {
813
+ this.visitNode(node.schema);
814
+ this.append(".");
815
+ }
816
+ this.visitNode(node.identifier);
817
+ }
818
+ visitCreateTable(node) {
819
+ this.append("create ");
820
+ if (node.frontModifiers?.length) {
821
+ this.compileList(node.frontModifiers, " ");
822
+ this.append(" ");
823
+ }
824
+ if (node.temporary) {
825
+ this.append("temporary ");
826
+ }
827
+ this.append("table ");
828
+ if (node.ifNotExists) {
829
+ this.append("if not exists ");
830
+ }
831
+ this.visitNode(node.table);
832
+ if (!node.selectQuery) {
833
+ this.append(" (");
834
+ this.compileList([...node.columns, ...node.constraints ?? []]);
835
+ this.append(")");
836
+ }
837
+ if (node.onCommit) {
838
+ this.append(" on commit ");
839
+ this.append(node.onCommit);
840
+ }
841
+ if (node.endModifiers?.length) {
842
+ this.append(" ");
843
+ this.compileList(node.endModifiers, " ");
844
+ }
845
+ if (node.selectQuery) {
846
+ this.append(" as ");
847
+ this.visitNode(node.selectQuery);
848
+ }
849
+ }
850
+ visitColumnDefinition(node) {
851
+ if (node.ifNotExists) {
852
+ this.append("if not exists ");
853
+ }
854
+ this.visitNode(node.column);
855
+ this.append(" ");
856
+ this.visitNode(node.dataType);
857
+ if (node.unsigned) {
858
+ this.append(" unsigned");
859
+ }
860
+ if (node.frontModifiers && node.frontModifiers.length > 0) {
861
+ this.append(" ");
862
+ this.compileList(node.frontModifiers, " ");
863
+ }
864
+ if (node.generated) {
865
+ this.append(" ");
866
+ this.visitNode(node.generated);
867
+ }
868
+ if (node.identity) {
869
+ this.append(" identity");
870
+ }
871
+ if (node.defaultTo) {
872
+ this.append(" ");
873
+ this.visitNode(node.defaultTo);
874
+ }
875
+ if (node.notNull) {
876
+ this.append(" not null");
877
+ }
878
+ if (node.unique) {
879
+ this.append(" unique");
880
+ }
881
+ if (node.nullsNotDistinct) {
882
+ this.append(" nulls not distinct");
883
+ }
884
+ if (node.primaryKey) {
885
+ this.append(" primary key");
886
+ }
887
+ if (node.autoIncrement) {
888
+ this.append(" ");
889
+ this.append(this.getAutoIncrement());
890
+ }
891
+ if (node.references) {
892
+ this.append(" ");
893
+ this.visitNode(node.references);
894
+ }
895
+ if (node.check) {
896
+ this.append(" ");
897
+ this.visitNode(node.check);
898
+ }
899
+ if (node.endModifiers && node.endModifiers.length > 0) {
900
+ this.append(" ");
901
+ this.compileList(node.endModifiers, " ");
902
+ }
903
+ }
904
+ getAutoIncrement() {
905
+ return "auto_increment";
906
+ }
907
+ visitReferences(node) {
908
+ this.append("references ");
909
+ this.visitNode(node.table);
910
+ this.append(" (");
911
+ this.compileList(node.columns);
912
+ this.append(")");
913
+ if (node.onDelete) {
914
+ this.append(" on delete ");
915
+ this.append(node.onDelete);
916
+ }
917
+ if (node.onUpdate) {
918
+ this.append(" on update ");
919
+ this.append(node.onUpdate);
920
+ }
921
+ }
922
+ visitDropTable(node) {
923
+ this.append("drop table ");
924
+ if (node.ifExists) {
925
+ this.append("if exists ");
926
+ }
927
+ this.visitNode(node.table);
928
+ if (node.cascade) {
929
+ this.append(" cascade");
930
+ }
931
+ }
932
+ visitDataType(node) {
933
+ this.append(node.dataType);
934
+ }
935
+ visitOrderBy(node) {
936
+ this.append("order by ");
937
+ this.compileList(node.items);
938
+ }
939
+ visitOrderByItem(node) {
940
+ this.visitNode(node.orderBy);
941
+ if (node.collation) {
942
+ this.append(" ");
943
+ this.visitNode(node.collation);
944
+ }
945
+ if (node.direction) {
946
+ this.append(" ");
947
+ this.visitNode(node.direction);
948
+ }
949
+ if (node.nulls) {
950
+ this.append(" nulls ");
951
+ this.append(node.nulls);
952
+ }
953
+ }
954
+ visitGroupBy(node) {
955
+ this.append("group by ");
956
+ this.compileList(node.items);
957
+ }
958
+ visitGroupByItem(node) {
959
+ this.visitNode(node.groupBy);
960
+ }
961
+ visitUpdateQuery(node) {
962
+ const wrapInParens = this.parentNode !== void 0 && !ParensNode.is(this.parentNode) && !RawNode.is(this.parentNode) && !WhenNode.is(this.parentNode);
963
+ if (this.parentNode === void 0 && node.explain) {
964
+ this.visitNode(node.explain);
965
+ this.append(" ");
966
+ }
967
+ if (wrapInParens) {
968
+ this.append("(");
969
+ }
970
+ if (node.with) {
971
+ this.visitNode(node.with);
972
+ this.append(" ");
973
+ }
974
+ this.append("update ");
975
+ if (node.top) {
976
+ this.visitNode(node.top);
977
+ this.append(" ");
978
+ }
979
+ if (node.table) {
980
+ this.visitNode(node.table);
981
+ this.append(" ");
982
+ }
983
+ this.append("set ");
984
+ if (node.updates) {
985
+ this.compileList(node.updates);
986
+ }
987
+ if (node.output) {
988
+ this.append(" ");
989
+ this.visitNode(node.output);
990
+ }
991
+ if (node.from) {
992
+ this.append(" ");
993
+ this.visitNode(node.from);
994
+ }
995
+ if (node.joins) {
996
+ if (!node.from) {
997
+ throw new Error("Joins in an update query are only supported as a part of a PostgreSQL 'update set from join' query. If you want to create a MySQL 'update join set' query, see https://kysely.dev/docs/examples/update/my-sql-joins");
998
+ }
999
+ this.append(" ");
1000
+ this.compileList(node.joins, " ");
1001
+ }
1002
+ if (node.where) {
1003
+ this.append(" ");
1004
+ this.visitNode(node.where);
1005
+ }
1006
+ if (node.returning) {
1007
+ this.append(" ");
1008
+ this.visitNode(node.returning);
1009
+ }
1010
+ if (node.orderBy) {
1011
+ this.append(" ");
1012
+ this.visitNode(node.orderBy);
1013
+ }
1014
+ if (node.limit) {
1015
+ this.append(" ");
1016
+ this.visitNode(node.limit);
1017
+ }
1018
+ if (wrapInParens) {
1019
+ this.append(")");
1020
+ }
1021
+ if (node.endModifiers?.length) {
1022
+ this.append(" ");
1023
+ this.compileList(node.endModifiers, " ");
1024
+ }
1025
+ }
1026
+ visitColumnUpdate(node) {
1027
+ this.visitNode(node.column);
1028
+ this.append(" = ");
1029
+ this.visitNode(node.value);
1030
+ }
1031
+ visitLimit(node) {
1032
+ this.append("limit ");
1033
+ this.visitNode(node.limit);
1034
+ }
1035
+ visitOffset(node) {
1036
+ this.append("offset ");
1037
+ this.visitNode(node.offset);
1038
+ }
1039
+ visitOnConflict(node) {
1040
+ this.append("on conflict");
1041
+ if (node.columns) {
1042
+ this.append(" (");
1043
+ this.compileList(node.columns);
1044
+ this.append(")");
1045
+ } else if (node.constraint) {
1046
+ this.append(" on constraint ");
1047
+ this.visitNode(node.constraint);
1048
+ } else if (node.indexExpression) {
1049
+ this.append(" (");
1050
+ this.visitNode(node.indexExpression);
1051
+ this.append(")");
1052
+ }
1053
+ if (node.indexWhere) {
1054
+ this.append(" ");
1055
+ this.visitNode(node.indexWhere);
1056
+ }
1057
+ if (node.doNothing === true) {
1058
+ this.append(" do nothing");
1059
+ } else if (node.updates) {
1060
+ this.append(" do update set ");
1061
+ this.compileList(node.updates);
1062
+ if (node.updateWhere) {
1063
+ this.append(" ");
1064
+ this.visitNode(node.updateWhere);
1065
+ }
1066
+ }
1067
+ }
1068
+ visitOnDuplicateKey(node) {
1069
+ this.append("on duplicate key update ");
1070
+ this.compileList(node.updates);
1071
+ }
1072
+ visitCreateIndex(node) {
1073
+ this.append("create ");
1074
+ if (node.unique) {
1075
+ this.append("unique ");
1076
+ }
1077
+ this.append("index ");
1078
+ if (node.ifNotExists) {
1079
+ this.append("if not exists ");
1080
+ }
1081
+ this.visitNode(node.name);
1082
+ if (node.table) {
1083
+ this.append(" on ");
1084
+ this.visitNode(node.table);
1085
+ }
1086
+ if (node.using) {
1087
+ this.append(" using ");
1088
+ this.visitNode(node.using);
1089
+ }
1090
+ if (node.columns) {
1091
+ this.append(" (");
1092
+ this.compileList(node.columns);
1093
+ this.append(")");
1094
+ }
1095
+ if (node.nullsNotDistinct) {
1096
+ this.append(" nulls not distinct");
1097
+ }
1098
+ if (node.where) {
1099
+ this.append(" ");
1100
+ this.visitNode(node.where);
1101
+ }
1102
+ }
1103
+ visitDropIndex(node) {
1104
+ this.append("drop index ");
1105
+ if (node.ifExists) {
1106
+ this.append("if exists ");
1107
+ }
1108
+ this.visitNode(node.name);
1109
+ if (node.table) {
1110
+ this.append(" on ");
1111
+ this.visitNode(node.table);
1112
+ }
1113
+ if (node.cascade) {
1114
+ this.append(" cascade");
1115
+ }
1116
+ }
1117
+ visitCreateSchema(node) {
1118
+ this.append("create schema ");
1119
+ if (node.ifNotExists) {
1120
+ this.append("if not exists ");
1121
+ }
1122
+ this.visitNode(node.schema);
1123
+ }
1124
+ visitDropSchema(node) {
1125
+ this.append("drop schema ");
1126
+ if (node.ifExists) {
1127
+ this.append("if exists ");
1128
+ }
1129
+ this.visitNode(node.schema);
1130
+ if (node.cascade) {
1131
+ this.append(" cascade");
1132
+ }
1133
+ }
1134
+ visitPrimaryKeyConstraint(node) {
1135
+ if (node.name) {
1136
+ this.append("constraint ");
1137
+ this.visitNode(node.name);
1138
+ this.append(" ");
1139
+ }
1140
+ this.append("primary key (");
1141
+ this.compileList(node.columns);
1142
+ this.append(")");
1143
+ this.buildDeferrable(node);
1144
+ }
1145
+ buildDeferrable(node) {
1146
+ if (node.deferrable !== void 0) {
1147
+ if (node.deferrable) {
1148
+ this.append(" deferrable");
1149
+ } else {
1150
+ this.append(" not deferrable");
1151
+ }
1152
+ }
1153
+ if (node.initiallyDeferred !== void 0) {
1154
+ if (node.initiallyDeferred) {
1155
+ this.append(" initially deferred");
1156
+ } else {
1157
+ this.append(" initially immediate");
1158
+ }
1159
+ }
1160
+ }
1161
+ visitUniqueConstraint(node) {
1162
+ if (node.name) {
1163
+ this.append("constraint ");
1164
+ this.visitNode(node.name);
1165
+ this.append(" ");
1166
+ }
1167
+ this.append("unique");
1168
+ if (node.nullsNotDistinct) {
1169
+ this.append(" nulls not distinct");
1170
+ }
1171
+ this.append(" (");
1172
+ this.compileList(node.columns);
1173
+ this.append(")");
1174
+ this.buildDeferrable(node);
1175
+ }
1176
+ visitCheckConstraint(node) {
1177
+ if (node.name) {
1178
+ this.append("constraint ");
1179
+ this.visitNode(node.name);
1180
+ this.append(" ");
1181
+ }
1182
+ this.append("check (");
1183
+ this.visitNode(node.expression);
1184
+ this.append(")");
1185
+ }
1186
+ visitForeignKeyConstraint(node) {
1187
+ if (node.name) {
1188
+ this.append("constraint ");
1189
+ this.visitNode(node.name);
1190
+ this.append(" ");
1191
+ }
1192
+ this.append("foreign key (");
1193
+ this.compileList(node.columns);
1194
+ this.append(") ");
1195
+ this.visitNode(node.references);
1196
+ if (node.onDelete) {
1197
+ this.append(" on delete ");
1198
+ this.append(node.onDelete);
1199
+ }
1200
+ if (node.onUpdate) {
1201
+ this.append(" on update ");
1202
+ this.append(node.onUpdate);
1203
+ }
1204
+ this.buildDeferrable(node);
1205
+ }
1206
+ visitList(node) {
1207
+ this.compileList(node.items);
1208
+ }
1209
+ visitWith(node) {
1210
+ this.append("with ");
1211
+ if (node.recursive) {
1212
+ this.append("recursive ");
1213
+ }
1214
+ this.compileList(node.expressions);
1215
+ }
1216
+ visitCommonTableExpression(node) {
1217
+ this.visitNode(node.name);
1218
+ this.append(" as ");
1219
+ if (isBoolean(node.materialized)) {
1220
+ if (!node.materialized) {
1221
+ this.append("not ");
1222
+ }
1223
+ this.append("materialized ");
1224
+ }
1225
+ this.visitNode(node.expression);
1226
+ }
1227
+ visitCommonTableExpressionName(node) {
1228
+ this.visitNode(node.table);
1229
+ if (node.columns) {
1230
+ this.append("(");
1231
+ this.compileList(node.columns);
1232
+ this.append(")");
1233
+ }
1234
+ }
1235
+ visitAlterTable(node) {
1236
+ this.append("alter table ");
1237
+ this.visitNode(node.table);
1238
+ this.append(" ");
1239
+ if (node.renameTo) {
1240
+ this.append("rename to ");
1241
+ this.visitNode(node.renameTo);
1242
+ }
1243
+ if (node.setSchema) {
1244
+ this.append("set schema ");
1245
+ this.visitNode(node.setSchema);
1246
+ }
1247
+ if (node.addConstraint) {
1248
+ this.visitNode(node.addConstraint);
1249
+ }
1250
+ if (node.dropConstraint) {
1251
+ this.visitNode(node.dropConstraint);
1252
+ }
1253
+ if (node.renameConstraint) {
1254
+ this.visitNode(node.renameConstraint);
1255
+ }
1256
+ if (node.columnAlterations) {
1257
+ this.compileColumnAlterations(node.columnAlterations);
1258
+ }
1259
+ if (node.addIndex) {
1260
+ this.visitNode(node.addIndex);
1261
+ }
1262
+ if (node.dropIndex) {
1263
+ this.visitNode(node.dropIndex);
1264
+ }
1265
+ }
1266
+ visitAddColumn(node) {
1267
+ this.append("add column ");
1268
+ this.visitNode(node.column);
1269
+ }
1270
+ visitRenameColumn(node) {
1271
+ this.append("rename column ");
1272
+ this.visitNode(node.column);
1273
+ this.append(" to ");
1274
+ this.visitNode(node.renameTo);
1275
+ }
1276
+ visitDropColumn(node) {
1277
+ this.append("drop column ");
1278
+ this.visitNode(node.column);
1279
+ }
1280
+ visitAlterColumn(node) {
1281
+ this.append("alter column ");
1282
+ this.visitNode(node.column);
1283
+ this.append(" ");
1284
+ if (node.dataType) {
1285
+ if (this.announcesNewColumnDataType()) {
1286
+ this.append("type ");
1287
+ }
1288
+ this.visitNode(node.dataType);
1289
+ if (node.dataTypeExpression) {
1290
+ this.append("using ");
1291
+ this.visitNode(node.dataTypeExpression);
1292
+ }
1293
+ }
1294
+ if (node.setDefault) {
1295
+ this.append("set default ");
1296
+ this.visitNode(node.setDefault);
1297
+ }
1298
+ if (node.dropDefault) {
1299
+ this.append("drop default");
1300
+ }
1301
+ if (node.setNotNull) {
1302
+ this.append("set not null");
1303
+ }
1304
+ if (node.dropNotNull) {
1305
+ this.append("drop not null");
1306
+ }
1307
+ }
1308
+ visitModifyColumn(node) {
1309
+ this.append("modify column ");
1310
+ this.visitNode(node.column);
1311
+ }
1312
+ visitAddConstraint(node) {
1313
+ this.append("add ");
1314
+ this.visitNode(node.constraint);
1315
+ }
1316
+ visitDropConstraint(node) {
1317
+ this.append("drop constraint ");
1318
+ if (node.ifExists) {
1319
+ this.append("if exists ");
1320
+ }
1321
+ this.visitNode(node.constraintName);
1322
+ if (node.modifier === "cascade") {
1323
+ this.append(" cascade");
1324
+ } else if (node.modifier === "restrict") {
1325
+ this.append(" restrict");
1326
+ }
1327
+ }
1328
+ visitRenameConstraint(node) {
1329
+ this.append("rename constraint ");
1330
+ this.visitNode(node.oldName);
1331
+ this.append(" to ");
1332
+ this.visitNode(node.newName);
1333
+ }
1334
+ visitSetOperation(node) {
1335
+ this.append(node.operator);
1336
+ this.append(" ");
1337
+ if (node.all) {
1338
+ this.append("all ");
1339
+ }
1340
+ this.visitNode(node.expression);
1341
+ }
1342
+ visitCreateView(node) {
1343
+ this.append("create ");
1344
+ if (node.orReplace) {
1345
+ this.append("or replace ");
1346
+ }
1347
+ if (node.materialized) {
1348
+ this.append("materialized ");
1349
+ }
1350
+ if (node.temporary) {
1351
+ this.append("temporary ");
1352
+ }
1353
+ this.append("view ");
1354
+ if (node.ifNotExists) {
1355
+ this.append("if not exists ");
1356
+ }
1357
+ this.visitNode(node.name);
1358
+ this.append(" ");
1359
+ if (node.columns) {
1360
+ this.append("(");
1361
+ this.compileList(node.columns);
1362
+ this.append(") ");
1363
+ }
1364
+ if (node.as) {
1365
+ this.append("as ");
1366
+ this.visitNode(node.as);
1367
+ }
1368
+ }
1369
+ visitRefreshMaterializedView(node) {
1370
+ this.append("refresh materialized view ");
1371
+ if (node.concurrently) {
1372
+ this.append("concurrently ");
1373
+ }
1374
+ this.visitNode(node.name);
1375
+ if (node.withNoData) {
1376
+ this.append(" with no data");
1377
+ } else {
1378
+ this.append(" with data");
1379
+ }
1380
+ }
1381
+ visitDropView(node) {
1382
+ this.append("drop ");
1383
+ if (node.materialized) {
1384
+ this.append("materialized ");
1385
+ }
1386
+ this.append("view ");
1387
+ if (node.ifExists) {
1388
+ this.append("if exists ");
1389
+ }
1390
+ this.visitNode(node.name);
1391
+ if (node.cascade) {
1392
+ this.append(" cascade");
1393
+ }
1394
+ }
1395
+ visitGenerated(node) {
1396
+ this.append("generated ");
1397
+ if (node.always) {
1398
+ this.append("always ");
1399
+ }
1400
+ if (node.byDefault) {
1401
+ this.append("by default ");
1402
+ }
1403
+ this.append("as ");
1404
+ if (node.identity) {
1405
+ this.append("identity");
1406
+ }
1407
+ if (node.expression) {
1408
+ this.append("(");
1409
+ this.visitNode(node.expression);
1410
+ this.append(")");
1411
+ }
1412
+ if (node.stored) {
1413
+ this.append(" stored");
1414
+ }
1415
+ }
1416
+ visitDefaultValue(node) {
1417
+ this.append("default ");
1418
+ this.visitNode(node.defaultValue);
1419
+ }
1420
+ visitSelectModifier(node) {
1421
+ if (node.rawModifier) {
1422
+ this.visitNode(node.rawModifier);
1423
+ } else {
1424
+ this.append(SELECT_MODIFIER_SQL[node.modifier]);
1425
+ }
1426
+ if (node.of) {
1427
+ this.append(" of ");
1428
+ this.compileList(node.of, ", ");
1429
+ }
1430
+ }
1431
+ visitCreateType(node) {
1432
+ this.append("create type ");
1433
+ this.visitNode(node.name);
1434
+ if (node.enum) {
1435
+ this.append(" as enum ");
1436
+ this.visitNode(node.enum);
1437
+ }
1438
+ }
1439
+ visitDropType(node) {
1440
+ this.append("drop type ");
1441
+ if (node.ifExists) {
1442
+ this.append("if exists ");
1443
+ }
1444
+ this.visitNode(node.name);
1445
+ }
1446
+ visitExplain(node) {
1447
+ this.append("explain");
1448
+ if (node.options || node.format) {
1449
+ this.append(" ");
1450
+ this.append(this.getLeftExplainOptionsWrapper());
1451
+ if (node.options) {
1452
+ this.visitNode(node.options);
1453
+ if (node.format) {
1454
+ this.append(this.getExplainOptionsDelimiter());
1455
+ }
1456
+ }
1457
+ if (node.format) {
1458
+ this.append("format");
1459
+ this.append(this.getExplainOptionAssignment());
1460
+ this.append(node.format);
1461
+ }
1462
+ this.append(this.getRightExplainOptionsWrapper());
1463
+ }
1464
+ }
1465
+ visitDefaultInsertValue(_) {
1466
+ this.append("default");
1467
+ }
1468
+ visitAggregateFunction(node) {
1469
+ this.append(node.func);
1470
+ this.append("(");
1471
+ if (node.distinct) {
1472
+ this.append("distinct ");
1473
+ }
1474
+ this.compileList(node.aggregated);
1475
+ if (node.orderBy) {
1476
+ this.append(" ");
1477
+ this.visitNode(node.orderBy);
1478
+ }
1479
+ this.append(")");
1480
+ if (node.withinGroup) {
1481
+ this.append(" within group (");
1482
+ this.visitNode(node.withinGroup);
1483
+ this.append(")");
1484
+ }
1485
+ if (node.filter) {
1486
+ this.append(" filter(");
1487
+ this.visitNode(node.filter);
1488
+ this.append(")");
1489
+ }
1490
+ if (node.over) {
1491
+ this.append(" ");
1492
+ this.visitNode(node.over);
1493
+ }
1494
+ }
1495
+ visitOver(node) {
1496
+ this.append("over(");
1497
+ if (node.partitionBy) {
1498
+ this.visitNode(node.partitionBy);
1499
+ if (node.orderBy) {
1500
+ this.append(" ");
1501
+ }
1502
+ }
1503
+ if (node.orderBy) {
1504
+ this.visitNode(node.orderBy);
1505
+ }
1506
+ this.append(")");
1507
+ }
1508
+ visitPartitionBy(node) {
1509
+ this.append("partition by ");
1510
+ this.compileList(node.items);
1511
+ }
1512
+ visitPartitionByItem(node) {
1513
+ this.visitNode(node.partitionBy);
1514
+ }
1515
+ visitBinaryOperation(node) {
1516
+ this.visitNode(node.leftOperand);
1517
+ this.append(" ");
1518
+ this.visitNode(node.operator);
1519
+ this.append(" ");
1520
+ this.visitNode(node.rightOperand);
1521
+ }
1522
+ visitUnaryOperation(node) {
1523
+ this.visitNode(node.operator);
1524
+ if (!this.isMinusOperator(node.operator)) {
1525
+ this.append(" ");
1526
+ }
1527
+ this.visitNode(node.operand);
1528
+ }
1529
+ isMinusOperator(node) {
1530
+ return OperatorNode.is(node) && node.operator === "-";
1531
+ }
1532
+ visitUsing(node) {
1533
+ this.append("using ");
1534
+ this.compileList(node.tables);
1535
+ }
1536
+ visitFunction(node) {
1537
+ this.append(node.func);
1538
+ this.append("(");
1539
+ this.compileList(node.arguments);
1540
+ this.append(")");
1541
+ }
1542
+ visitCase(node) {
1543
+ this.append("case");
1544
+ if (node.value) {
1545
+ this.append(" ");
1546
+ this.visitNode(node.value);
1547
+ }
1548
+ if (node.when) {
1549
+ this.append(" ");
1550
+ this.compileList(node.when, " ");
1551
+ }
1552
+ if (node.else) {
1553
+ this.append(" else ");
1554
+ this.visitNode(node.else);
1555
+ }
1556
+ this.append(" end");
1557
+ if (node.isStatement) {
1558
+ this.append(" case");
1559
+ }
1560
+ }
1561
+ visitWhen(node) {
1562
+ this.append("when ");
1563
+ this.visitNode(node.condition);
1564
+ if (node.result) {
1565
+ this.append(" then ");
1566
+ this.visitNode(node.result);
1567
+ }
1568
+ }
1569
+ visitJSONReference(node) {
1570
+ this.visitNode(node.reference);
1571
+ this.visitNode(node.traversal);
1572
+ }
1573
+ visitJSONPath(node) {
1574
+ if (node.inOperator) {
1575
+ this.visitNode(node.inOperator);
1576
+ }
1577
+ this.append("'$");
1578
+ for (const pathLeg of node.pathLegs) {
1579
+ this.visitNode(pathLeg);
1580
+ }
1581
+ this.append("'");
1582
+ }
1583
+ visitJSONPathLeg(node) {
1584
+ const isArrayLocation = node.type === "ArrayLocation";
1585
+ this.append(isArrayLocation ? "[" : ".");
1586
+ this.append(typeof node.value === "string" ? this.sanitizeStringLiteral(node.value) : String(node.value));
1587
+ if (isArrayLocation) {
1588
+ this.append("]");
1589
+ }
1590
+ }
1591
+ visitJSONOperatorChain(node) {
1592
+ for (let i = 0, len = node.values.length; i < len; i++) {
1593
+ if (i === len - 1) {
1594
+ this.visitNode(node.operator);
1595
+ } else {
1596
+ this.append("->");
1597
+ }
1598
+ this.visitNode(node.values[i]);
1599
+ }
1600
+ }
1601
+ visitMergeQuery(node) {
1602
+ if (node.with) {
1603
+ this.visitNode(node.with);
1604
+ this.append(" ");
1605
+ }
1606
+ this.append("merge ");
1607
+ if (node.top) {
1608
+ this.visitNode(node.top);
1609
+ this.append(" ");
1610
+ }
1611
+ this.append("into ");
1612
+ this.visitNode(node.into);
1613
+ if (node.using) {
1614
+ this.append(" ");
1615
+ this.visitNode(node.using);
1616
+ }
1617
+ if (node.whens) {
1618
+ this.append(" ");
1619
+ this.compileList(node.whens, " ");
1620
+ }
1621
+ if (node.returning) {
1622
+ this.append(" ");
1623
+ this.visitNode(node.returning);
1624
+ }
1625
+ if (node.output) {
1626
+ this.append(" ");
1627
+ this.visitNode(node.output);
1628
+ }
1629
+ if (node.endModifiers?.length) {
1630
+ this.append(" ");
1631
+ this.compileList(node.endModifiers, " ");
1632
+ }
1633
+ }
1634
+ visitMatched(node) {
1635
+ if (node.not) {
1636
+ this.append("not ");
1637
+ }
1638
+ this.append("matched");
1639
+ if (node.bySource) {
1640
+ this.append(" by source");
1641
+ }
1642
+ }
1643
+ visitAddIndex(node) {
1644
+ this.append("add ");
1645
+ if (node.unique) {
1646
+ this.append("unique ");
1647
+ }
1648
+ this.append("index ");
1649
+ this.visitNode(node.name);
1650
+ if (node.columns) {
1651
+ this.append(" (");
1652
+ this.compileList(node.columns);
1653
+ this.append(")");
1654
+ }
1655
+ if (node.using) {
1656
+ this.append(" using ");
1657
+ this.visitNode(node.using);
1658
+ }
1659
+ }
1660
+ visitCast(node) {
1661
+ this.append("cast(");
1662
+ this.visitNode(node.expression);
1663
+ this.append(" as ");
1664
+ this.visitNode(node.dataType);
1665
+ this.append(")");
1666
+ }
1667
+ visitFetch(node) {
1668
+ this.append("fetch next ");
1669
+ this.visitNode(node.rowCount);
1670
+ this.append(` rows ${node.modifier}`);
1671
+ }
1672
+ visitOutput(node) {
1673
+ this.append("output ");
1674
+ this.compileList(node.selections);
1675
+ }
1676
+ visitTop(node) {
1677
+ this.append(`top(${node.expression})`);
1678
+ if (node.modifiers) {
1679
+ this.append(` ${node.modifiers}`);
1680
+ }
1681
+ }
1682
+ visitOrAction(node) {
1683
+ this.append(node.action);
1684
+ }
1685
+ visitCollate(node) {
1686
+ this.append("collate ");
1687
+ this.visitNode(node.collation);
1688
+ }
1689
+ append(str) {
1690
+ this.#sql += str;
1691
+ }
1692
+ appendValue(parameter) {
1693
+ this.addParameter(parameter);
1694
+ this.append(this.getCurrentParameterPlaceholder());
1695
+ }
1696
+ getLeftIdentifierWrapper() {
1697
+ return '"';
1698
+ }
1699
+ getRightIdentifierWrapper() {
1700
+ return '"';
1701
+ }
1702
+ getCurrentParameterPlaceholder() {
1703
+ return "$" + this.numParameters;
1704
+ }
1705
+ getLeftExplainOptionsWrapper() {
1706
+ return "(";
1707
+ }
1708
+ getExplainOptionAssignment() {
1709
+ return " ";
1710
+ }
1711
+ getExplainOptionsDelimiter() {
1712
+ return ", ";
1713
+ }
1714
+ getRightExplainOptionsWrapper() {
1715
+ return ")";
1716
+ }
1717
+ sanitizeIdentifier(identifier) {
1718
+ const leftWrap = this.getLeftIdentifierWrapper();
1719
+ const rightWrap = this.getRightIdentifierWrapper();
1720
+ let sanitized = "";
1721
+ for (const c of identifier) {
1722
+ sanitized += c;
1723
+ if (c === leftWrap) {
1724
+ sanitized += leftWrap;
1725
+ } else if (c === rightWrap) {
1726
+ sanitized += rightWrap;
1727
+ }
1728
+ }
1729
+ return sanitized;
1730
+ }
1731
+ sanitizeStringLiteral(value) {
1732
+ return value.replace(LIT_WRAP_REGEX, "''");
1733
+ }
1734
+ addParameter(parameter) {
1735
+ this.#parameters.push(parameter);
1736
+ }
1737
+ appendImmediateValue(value) {
1738
+ if (isString(value)) {
1739
+ this.appendStringLiteral(value);
1740
+ } else if (isNumber(value) || isBoolean(value) || isBigInt(value)) {
1741
+ this.append(value.toString());
1742
+ } else if (isNull(value)) {
1743
+ this.append("null");
1744
+ } else if (isDate(value)) {
1745
+ this.appendImmediateValue(value.toISOString());
1746
+ } else {
1747
+ throw new Error(`invalid immediate value ${value}`);
1748
+ }
1749
+ }
1750
+ appendStringLiteral(value) {
1751
+ this.append("'");
1752
+ this.append(this.sanitizeStringLiteral(value));
1753
+ this.append("'");
1754
+ }
1755
+ sortSelectModifiers(arr) {
1756
+ arr.sort((left, right) => left.modifier && right.modifier ? SELECT_MODIFIER_PRIORITY[left.modifier] - SELECT_MODIFIER_PRIORITY[right.modifier] : 1);
1757
+ return freeze(arr);
1758
+ }
1759
+ compileColumnAlterations(columnAlterations) {
1760
+ this.compileList(columnAlterations);
1761
+ }
1762
+ /**
1763
+ * controls whether the dialect adds a "type" keyword before a column's new data
1764
+ * type in an ALTER TABLE statement.
1765
+ */
1766
+ announcesNewColumnDataType() {
1767
+ return true;
1768
+ }
1769
+ };
1770
+ var SELECT_MODIFIER_SQL = freeze({
1771
+ ForKeyShare: "for key share",
1772
+ ForNoKeyUpdate: "for no key update",
1773
+ ForUpdate: "for update",
1774
+ ForShare: "for share",
1775
+ NoWait: "nowait",
1776
+ SkipLocked: "skip locked",
1777
+ Distinct: "distinct"
1778
+ });
1779
+ var SELECT_MODIFIER_PRIORITY = freeze({
1780
+ ForKeyShare: 1,
1781
+ ForNoKeyUpdate: 1,
1782
+ ForUpdate: 1,
1783
+ ForShare: 1,
1784
+ NoWait: 2,
1785
+ SkipLocked: 2,
1786
+ Distinct: 0
1787
+ });
1788
+ var JOIN_TYPE_SQL = freeze({
1789
+ InnerJoin: "inner join",
1790
+ LeftJoin: "left join",
1791
+ RightJoin: "right join",
1792
+ FullJoin: "full join",
1793
+ CrossJoin: "cross join",
1794
+ LateralInnerJoin: "inner join lateral",
1795
+ LateralLeftJoin: "left join lateral",
1796
+ LateralCrossJoin: "cross join lateral",
1797
+ OuterApply: "outer apply",
1798
+ CrossApply: "cross apply",
1799
+ Using: "using"
1800
+ });
1801
+
1802
+ // node_modules/kysely/dist/esm/operation-node/alias-node.js
1803
+ var AliasNode = freeze({
1804
+ is(node) {
1805
+ return node.kind === "AliasNode";
1806
+ },
1807
+ create(node, alias) {
1808
+ return freeze({
1809
+ kind: "AliasNode",
1810
+ node,
1811
+ alias
1812
+ });
1813
+ }
1814
+ });
1815
+
1816
+ // node_modules/kysely/dist/esm/operation-node/and-node.js
1817
+ var AndNode = freeze({
1818
+ is(node) {
1819
+ return node.kind === "AndNode";
1820
+ },
1821
+ create(left, right) {
1822
+ return freeze({
1823
+ kind: "AndNode",
1824
+ left,
1825
+ right
1826
+ });
1827
+ }
1828
+ });
1829
+
1830
+ // node_modules/kysely/dist/esm/operation-node/or-node.js
1831
+ var OrNode = freeze({
1832
+ is(node) {
1833
+ return node.kind === "OrNode";
1834
+ },
1835
+ create(left, right) {
1836
+ return freeze({
1837
+ kind: "OrNode",
1838
+ left,
1839
+ right
1840
+ });
1841
+ }
1842
+ });
1843
+
1844
+ // node_modules/kysely/dist/esm/operation-node/on-node.js
1845
+ var OnNode = freeze({
1846
+ is(node) {
1847
+ return node.kind === "OnNode";
1848
+ },
1849
+ create(filter) {
1850
+ return freeze({
1851
+ kind: "OnNode",
1852
+ on: filter
1853
+ });
1854
+ },
1855
+ cloneWithOperation(onNode, operator, operation) {
1856
+ return freeze({
1857
+ ...onNode,
1858
+ on: operator === "And" ? AndNode.create(onNode.on, operation) : OrNode.create(onNode.on, operation)
1859
+ });
1860
+ }
1861
+ });
1862
+
1863
+ // node_modules/kysely/dist/esm/operation-node/join-node.js
1864
+ var JoinNode = freeze({
1865
+ is(node) {
1866
+ return node.kind === "JoinNode";
1867
+ },
1868
+ create(joinType, table) {
1869
+ return freeze({
1870
+ kind: "JoinNode",
1871
+ joinType,
1872
+ table,
1873
+ on: void 0
1874
+ });
1875
+ },
1876
+ createWithOn(joinType, table, on) {
1877
+ return freeze({
1878
+ kind: "JoinNode",
1879
+ joinType,
1880
+ table,
1881
+ on: OnNode.create(on)
1882
+ });
1883
+ },
1884
+ cloneWithOn(joinNode, operation) {
1885
+ return freeze({
1886
+ ...joinNode,
1887
+ on: joinNode.on ? OnNode.cloneWithOperation(joinNode.on, "And", operation) : OnNode.create(operation)
1888
+ });
1889
+ }
1890
+ });
1891
+
1892
+ // node_modules/kysely/dist/esm/operation-node/list-node.js
1893
+ var ListNode = freeze({
1894
+ is(node) {
1895
+ return node.kind === "ListNode";
1896
+ },
1897
+ create(items) {
1898
+ return freeze({
1899
+ kind: "ListNode",
1900
+ items: freeze(items)
1901
+ });
1902
+ }
1903
+ });
1904
+
1905
+ // node_modules/kysely/dist/esm/util/require-all-props.js
1906
+ function requireAllProps(obj) {
1907
+ return obj;
1908
+ }
1909
+
1910
+ // node_modules/kysely/dist/esm/operation-node/operation-node-transformer.js
1911
+ var OperationNodeTransformer = class {
1912
+ nodeStack = [];
1913
+ #transformers = freeze({
1914
+ AliasNode: this.transformAlias.bind(this),
1915
+ ColumnNode: this.transformColumn.bind(this),
1916
+ IdentifierNode: this.transformIdentifier.bind(this),
1917
+ SchemableIdentifierNode: this.transformSchemableIdentifier.bind(this),
1918
+ RawNode: this.transformRaw.bind(this),
1919
+ ReferenceNode: this.transformReference.bind(this),
1920
+ SelectQueryNode: this.transformSelectQuery.bind(this),
1921
+ SelectionNode: this.transformSelection.bind(this),
1922
+ TableNode: this.transformTable.bind(this),
1923
+ FromNode: this.transformFrom.bind(this),
1924
+ SelectAllNode: this.transformSelectAll.bind(this),
1925
+ AndNode: this.transformAnd.bind(this),
1926
+ OrNode: this.transformOr.bind(this),
1927
+ ValueNode: this.transformValue.bind(this),
1928
+ ValueListNode: this.transformValueList.bind(this),
1929
+ PrimitiveValueListNode: this.transformPrimitiveValueList.bind(this),
1930
+ ParensNode: this.transformParens.bind(this),
1931
+ JoinNode: this.transformJoin.bind(this),
1932
+ OperatorNode: this.transformOperator.bind(this),
1933
+ WhereNode: this.transformWhere.bind(this),
1934
+ InsertQueryNode: this.transformInsertQuery.bind(this),
1935
+ DeleteQueryNode: this.transformDeleteQuery.bind(this),
1936
+ ReturningNode: this.transformReturning.bind(this),
1937
+ CreateTableNode: this.transformCreateTable.bind(this),
1938
+ AddColumnNode: this.transformAddColumn.bind(this),
1939
+ ColumnDefinitionNode: this.transformColumnDefinition.bind(this),
1940
+ DropTableNode: this.transformDropTable.bind(this),
1941
+ DataTypeNode: this.transformDataType.bind(this),
1942
+ OrderByNode: this.transformOrderBy.bind(this),
1943
+ OrderByItemNode: this.transformOrderByItem.bind(this),
1944
+ GroupByNode: this.transformGroupBy.bind(this),
1945
+ GroupByItemNode: this.transformGroupByItem.bind(this),
1946
+ UpdateQueryNode: this.transformUpdateQuery.bind(this),
1947
+ ColumnUpdateNode: this.transformColumnUpdate.bind(this),
1948
+ LimitNode: this.transformLimit.bind(this),
1949
+ OffsetNode: this.transformOffset.bind(this),
1950
+ OnConflictNode: this.transformOnConflict.bind(this),
1951
+ OnDuplicateKeyNode: this.transformOnDuplicateKey.bind(this),
1952
+ CreateIndexNode: this.transformCreateIndex.bind(this),
1953
+ DropIndexNode: this.transformDropIndex.bind(this),
1954
+ ListNode: this.transformList.bind(this),
1955
+ PrimaryKeyConstraintNode: this.transformPrimaryKeyConstraint.bind(this),
1956
+ UniqueConstraintNode: this.transformUniqueConstraint.bind(this),
1957
+ ReferencesNode: this.transformReferences.bind(this),
1958
+ CheckConstraintNode: this.transformCheckConstraint.bind(this),
1959
+ WithNode: this.transformWith.bind(this),
1960
+ CommonTableExpressionNode: this.transformCommonTableExpression.bind(this),
1961
+ CommonTableExpressionNameNode: this.transformCommonTableExpressionName.bind(this),
1962
+ HavingNode: this.transformHaving.bind(this),
1963
+ CreateSchemaNode: this.transformCreateSchema.bind(this),
1964
+ DropSchemaNode: this.transformDropSchema.bind(this),
1965
+ AlterTableNode: this.transformAlterTable.bind(this),
1966
+ DropColumnNode: this.transformDropColumn.bind(this),
1967
+ RenameColumnNode: this.transformRenameColumn.bind(this),
1968
+ AlterColumnNode: this.transformAlterColumn.bind(this),
1969
+ ModifyColumnNode: this.transformModifyColumn.bind(this),
1970
+ AddConstraintNode: this.transformAddConstraint.bind(this),
1971
+ DropConstraintNode: this.transformDropConstraint.bind(this),
1972
+ RenameConstraintNode: this.transformRenameConstraint.bind(this),
1973
+ ForeignKeyConstraintNode: this.transformForeignKeyConstraint.bind(this),
1974
+ CreateViewNode: this.transformCreateView.bind(this),
1975
+ RefreshMaterializedViewNode: this.transformRefreshMaterializedView.bind(this),
1976
+ DropViewNode: this.transformDropView.bind(this),
1977
+ GeneratedNode: this.transformGenerated.bind(this),
1978
+ DefaultValueNode: this.transformDefaultValue.bind(this),
1979
+ OnNode: this.transformOn.bind(this),
1980
+ ValuesNode: this.transformValues.bind(this),
1981
+ SelectModifierNode: this.transformSelectModifier.bind(this),
1982
+ CreateTypeNode: this.transformCreateType.bind(this),
1983
+ DropTypeNode: this.transformDropType.bind(this),
1984
+ ExplainNode: this.transformExplain.bind(this),
1985
+ DefaultInsertValueNode: this.transformDefaultInsertValue.bind(this),
1986
+ AggregateFunctionNode: this.transformAggregateFunction.bind(this),
1987
+ OverNode: this.transformOver.bind(this),
1988
+ PartitionByNode: this.transformPartitionBy.bind(this),
1989
+ PartitionByItemNode: this.transformPartitionByItem.bind(this),
1990
+ SetOperationNode: this.transformSetOperation.bind(this),
1991
+ BinaryOperationNode: this.transformBinaryOperation.bind(this),
1992
+ UnaryOperationNode: this.transformUnaryOperation.bind(this),
1993
+ UsingNode: this.transformUsing.bind(this),
1994
+ FunctionNode: this.transformFunction.bind(this),
1995
+ CaseNode: this.transformCase.bind(this),
1996
+ WhenNode: this.transformWhen.bind(this),
1997
+ JSONReferenceNode: this.transformJSONReference.bind(this),
1998
+ JSONPathNode: this.transformJSONPath.bind(this),
1999
+ JSONPathLegNode: this.transformJSONPathLeg.bind(this),
2000
+ JSONOperatorChainNode: this.transformJSONOperatorChain.bind(this),
2001
+ TupleNode: this.transformTuple.bind(this),
2002
+ MergeQueryNode: this.transformMergeQuery.bind(this),
2003
+ MatchedNode: this.transformMatched.bind(this),
2004
+ AddIndexNode: this.transformAddIndex.bind(this),
2005
+ CastNode: this.transformCast.bind(this),
2006
+ FetchNode: this.transformFetch.bind(this),
2007
+ TopNode: this.transformTop.bind(this),
2008
+ OutputNode: this.transformOutput.bind(this),
2009
+ OrActionNode: this.transformOrAction.bind(this),
2010
+ CollateNode: this.transformCollate.bind(this)
2011
+ });
2012
+ transformNode(node, queryId) {
2013
+ if (!node) {
2014
+ return node;
2015
+ }
2016
+ this.nodeStack.push(node);
2017
+ const out = this.transformNodeImpl(node, queryId);
2018
+ this.nodeStack.pop();
2019
+ return freeze(out);
2020
+ }
2021
+ transformNodeImpl(node, queryId) {
2022
+ return this.#transformers[node.kind](node, queryId);
2023
+ }
2024
+ transformNodeList(list, queryId) {
2025
+ if (!list) {
2026
+ return list;
2027
+ }
2028
+ return freeze(list.map((node) => this.transformNode(node, queryId)));
2029
+ }
2030
+ transformSelectQuery(node, queryId) {
2031
+ return requireAllProps({
2032
+ kind: "SelectQueryNode",
2033
+ from: this.transformNode(node.from, queryId),
2034
+ selections: this.transformNodeList(node.selections, queryId),
2035
+ distinctOn: this.transformNodeList(node.distinctOn, queryId),
2036
+ joins: this.transformNodeList(node.joins, queryId),
2037
+ groupBy: this.transformNode(node.groupBy, queryId),
2038
+ orderBy: this.transformNode(node.orderBy, queryId),
2039
+ where: this.transformNode(node.where, queryId),
2040
+ frontModifiers: this.transformNodeList(node.frontModifiers, queryId),
2041
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2042
+ limit: this.transformNode(node.limit, queryId),
2043
+ offset: this.transformNode(node.offset, queryId),
2044
+ with: this.transformNode(node.with, queryId),
2045
+ having: this.transformNode(node.having, queryId),
2046
+ explain: this.transformNode(node.explain, queryId),
2047
+ setOperations: this.transformNodeList(node.setOperations, queryId),
2048
+ fetch: this.transformNode(node.fetch, queryId),
2049
+ top: this.transformNode(node.top, queryId)
2050
+ });
2051
+ }
2052
+ transformSelection(node, queryId) {
2053
+ return requireAllProps({
2054
+ kind: "SelectionNode",
2055
+ selection: this.transformNode(node.selection, queryId)
2056
+ });
2057
+ }
2058
+ transformColumn(node, queryId) {
2059
+ return requireAllProps({
2060
+ kind: "ColumnNode",
2061
+ column: this.transformNode(node.column, queryId)
2062
+ });
2063
+ }
2064
+ transformAlias(node, queryId) {
2065
+ return requireAllProps({
2066
+ kind: "AliasNode",
2067
+ node: this.transformNode(node.node, queryId),
2068
+ alias: this.transformNode(node.alias, queryId)
2069
+ });
2070
+ }
2071
+ transformTable(node, queryId) {
2072
+ return requireAllProps({
2073
+ kind: "TableNode",
2074
+ table: this.transformNode(node.table, queryId)
2075
+ });
2076
+ }
2077
+ transformFrom(node, queryId) {
2078
+ return requireAllProps({
2079
+ kind: "FromNode",
2080
+ froms: this.transformNodeList(node.froms, queryId)
2081
+ });
2082
+ }
2083
+ transformReference(node, queryId) {
2084
+ return requireAllProps({
2085
+ kind: "ReferenceNode",
2086
+ column: this.transformNode(node.column, queryId),
2087
+ table: this.transformNode(node.table, queryId)
2088
+ });
2089
+ }
2090
+ transformAnd(node, queryId) {
2091
+ return requireAllProps({
2092
+ kind: "AndNode",
2093
+ left: this.transformNode(node.left, queryId),
2094
+ right: this.transformNode(node.right, queryId)
2095
+ });
2096
+ }
2097
+ transformOr(node, queryId) {
2098
+ return requireAllProps({
2099
+ kind: "OrNode",
2100
+ left: this.transformNode(node.left, queryId),
2101
+ right: this.transformNode(node.right, queryId)
2102
+ });
2103
+ }
2104
+ transformValueList(node, queryId) {
2105
+ return requireAllProps({
2106
+ kind: "ValueListNode",
2107
+ values: this.transformNodeList(node.values, queryId)
2108
+ });
2109
+ }
2110
+ transformParens(node, queryId) {
2111
+ return requireAllProps({
2112
+ kind: "ParensNode",
2113
+ node: this.transformNode(node.node, queryId)
2114
+ });
2115
+ }
2116
+ transformJoin(node, queryId) {
2117
+ return requireAllProps({
2118
+ kind: "JoinNode",
2119
+ joinType: node.joinType,
2120
+ table: this.transformNode(node.table, queryId),
2121
+ on: this.transformNode(node.on, queryId)
2122
+ });
2123
+ }
2124
+ transformRaw(node, queryId) {
2125
+ return requireAllProps({
2126
+ kind: "RawNode",
2127
+ sqlFragments: freeze([...node.sqlFragments]),
2128
+ parameters: this.transformNodeList(node.parameters, queryId)
2129
+ });
2130
+ }
2131
+ transformWhere(node, queryId) {
2132
+ return requireAllProps({
2133
+ kind: "WhereNode",
2134
+ where: this.transformNode(node.where, queryId)
2135
+ });
2136
+ }
2137
+ transformInsertQuery(node, queryId) {
2138
+ return requireAllProps({
2139
+ kind: "InsertQueryNode",
2140
+ into: this.transformNode(node.into, queryId),
2141
+ columns: this.transformNodeList(node.columns, queryId),
2142
+ values: this.transformNode(node.values, queryId),
2143
+ returning: this.transformNode(node.returning, queryId),
2144
+ onConflict: this.transformNode(node.onConflict, queryId),
2145
+ onDuplicateKey: this.transformNode(node.onDuplicateKey, queryId),
2146
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2147
+ with: this.transformNode(node.with, queryId),
2148
+ ignore: node.ignore,
2149
+ orAction: this.transformNode(node.orAction, queryId),
2150
+ replace: node.replace,
2151
+ explain: this.transformNode(node.explain, queryId),
2152
+ defaultValues: node.defaultValues,
2153
+ top: this.transformNode(node.top, queryId),
2154
+ output: this.transformNode(node.output, queryId)
2155
+ });
2156
+ }
2157
+ transformValues(node, queryId) {
2158
+ return requireAllProps({
2159
+ kind: "ValuesNode",
2160
+ values: this.transformNodeList(node.values, queryId)
2161
+ });
2162
+ }
2163
+ transformDeleteQuery(node, queryId) {
2164
+ return requireAllProps({
2165
+ kind: "DeleteQueryNode",
2166
+ from: this.transformNode(node.from, queryId),
2167
+ using: this.transformNode(node.using, queryId),
2168
+ joins: this.transformNodeList(node.joins, queryId),
2169
+ where: this.transformNode(node.where, queryId),
2170
+ returning: this.transformNode(node.returning, queryId),
2171
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2172
+ with: this.transformNode(node.with, queryId),
2173
+ orderBy: this.transformNode(node.orderBy, queryId),
2174
+ limit: this.transformNode(node.limit, queryId),
2175
+ explain: this.transformNode(node.explain, queryId),
2176
+ top: this.transformNode(node.top, queryId),
2177
+ output: this.transformNode(node.output, queryId)
2178
+ });
2179
+ }
2180
+ transformReturning(node, queryId) {
2181
+ return requireAllProps({
2182
+ kind: "ReturningNode",
2183
+ selections: this.transformNodeList(node.selections, queryId)
2184
+ });
2185
+ }
2186
+ transformCreateTable(node, queryId) {
2187
+ return requireAllProps({
2188
+ kind: "CreateTableNode",
2189
+ table: this.transformNode(node.table, queryId),
2190
+ columns: this.transformNodeList(node.columns, queryId),
2191
+ constraints: this.transformNodeList(node.constraints, queryId),
2192
+ temporary: node.temporary,
2193
+ ifNotExists: node.ifNotExists,
2194
+ onCommit: node.onCommit,
2195
+ frontModifiers: this.transformNodeList(node.frontModifiers, queryId),
2196
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2197
+ selectQuery: this.transformNode(node.selectQuery, queryId)
2198
+ });
2199
+ }
2200
+ transformColumnDefinition(node, queryId) {
2201
+ return requireAllProps({
2202
+ kind: "ColumnDefinitionNode",
2203
+ column: this.transformNode(node.column, queryId),
2204
+ dataType: this.transformNode(node.dataType, queryId),
2205
+ references: this.transformNode(node.references, queryId),
2206
+ primaryKey: node.primaryKey,
2207
+ autoIncrement: node.autoIncrement,
2208
+ unique: node.unique,
2209
+ notNull: node.notNull,
2210
+ unsigned: node.unsigned,
2211
+ defaultTo: this.transformNode(node.defaultTo, queryId),
2212
+ check: this.transformNode(node.check, queryId),
2213
+ generated: this.transformNode(node.generated, queryId),
2214
+ frontModifiers: this.transformNodeList(node.frontModifiers, queryId),
2215
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2216
+ nullsNotDistinct: node.nullsNotDistinct,
2217
+ identity: node.identity,
2218
+ ifNotExists: node.ifNotExists
2219
+ });
2220
+ }
2221
+ transformAddColumn(node, queryId) {
2222
+ return requireAllProps({
2223
+ kind: "AddColumnNode",
2224
+ column: this.transformNode(node.column, queryId)
2225
+ });
2226
+ }
2227
+ transformDropTable(node, queryId) {
2228
+ return requireAllProps({
2229
+ kind: "DropTableNode",
2230
+ table: this.transformNode(node.table, queryId),
2231
+ ifExists: node.ifExists,
2232
+ cascade: node.cascade
2233
+ });
2234
+ }
2235
+ transformOrderBy(node, queryId) {
2236
+ return requireAllProps({
2237
+ kind: "OrderByNode",
2238
+ items: this.transformNodeList(node.items, queryId)
2239
+ });
2240
+ }
2241
+ transformOrderByItem(node, queryId) {
2242
+ return requireAllProps({
2243
+ kind: "OrderByItemNode",
2244
+ orderBy: this.transformNode(node.orderBy, queryId),
2245
+ direction: this.transformNode(node.direction, queryId),
2246
+ collation: this.transformNode(node.collation, queryId),
2247
+ nulls: node.nulls
2248
+ });
2249
+ }
2250
+ transformGroupBy(node, queryId) {
2251
+ return requireAllProps({
2252
+ kind: "GroupByNode",
2253
+ items: this.transformNodeList(node.items, queryId)
2254
+ });
2255
+ }
2256
+ transformGroupByItem(node, queryId) {
2257
+ return requireAllProps({
2258
+ kind: "GroupByItemNode",
2259
+ groupBy: this.transformNode(node.groupBy, queryId)
2260
+ });
2261
+ }
2262
+ transformUpdateQuery(node, queryId) {
2263
+ return requireAllProps({
2264
+ kind: "UpdateQueryNode",
2265
+ table: this.transformNode(node.table, queryId),
2266
+ from: this.transformNode(node.from, queryId),
2267
+ joins: this.transformNodeList(node.joins, queryId),
2268
+ where: this.transformNode(node.where, queryId),
2269
+ updates: this.transformNodeList(node.updates, queryId),
2270
+ returning: this.transformNode(node.returning, queryId),
2271
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2272
+ with: this.transformNode(node.with, queryId),
2273
+ explain: this.transformNode(node.explain, queryId),
2274
+ limit: this.transformNode(node.limit, queryId),
2275
+ top: this.transformNode(node.top, queryId),
2276
+ output: this.transformNode(node.output, queryId),
2277
+ orderBy: this.transformNode(node.orderBy, queryId)
2278
+ });
2279
+ }
2280
+ transformColumnUpdate(node, queryId) {
2281
+ return requireAllProps({
2282
+ kind: "ColumnUpdateNode",
2283
+ column: this.transformNode(node.column, queryId),
2284
+ value: this.transformNode(node.value, queryId)
2285
+ });
2286
+ }
2287
+ transformLimit(node, queryId) {
2288
+ return requireAllProps({
2289
+ kind: "LimitNode",
2290
+ limit: this.transformNode(node.limit, queryId)
2291
+ });
2292
+ }
2293
+ transformOffset(node, queryId) {
2294
+ return requireAllProps({
2295
+ kind: "OffsetNode",
2296
+ offset: this.transformNode(node.offset, queryId)
2297
+ });
2298
+ }
2299
+ transformOnConflict(node, queryId) {
2300
+ return requireAllProps({
2301
+ kind: "OnConflictNode",
2302
+ columns: this.transformNodeList(node.columns, queryId),
2303
+ constraint: this.transformNode(node.constraint, queryId),
2304
+ indexExpression: this.transformNode(node.indexExpression, queryId),
2305
+ indexWhere: this.transformNode(node.indexWhere, queryId),
2306
+ updates: this.transformNodeList(node.updates, queryId),
2307
+ updateWhere: this.transformNode(node.updateWhere, queryId),
2308
+ doNothing: node.doNothing
2309
+ });
2310
+ }
2311
+ transformOnDuplicateKey(node, queryId) {
2312
+ return requireAllProps({
2313
+ kind: "OnDuplicateKeyNode",
2314
+ updates: this.transformNodeList(node.updates, queryId)
2315
+ });
2316
+ }
2317
+ transformCreateIndex(node, queryId) {
2318
+ return requireAllProps({
2319
+ kind: "CreateIndexNode",
2320
+ name: this.transformNode(node.name, queryId),
2321
+ table: this.transformNode(node.table, queryId),
2322
+ columns: this.transformNodeList(node.columns, queryId),
2323
+ unique: node.unique,
2324
+ using: this.transformNode(node.using, queryId),
2325
+ ifNotExists: node.ifNotExists,
2326
+ where: this.transformNode(node.where, queryId),
2327
+ nullsNotDistinct: node.nullsNotDistinct
2328
+ });
2329
+ }
2330
+ transformList(node, queryId) {
2331
+ return requireAllProps({
2332
+ kind: "ListNode",
2333
+ items: this.transformNodeList(node.items, queryId)
2334
+ });
2335
+ }
2336
+ transformDropIndex(node, queryId) {
2337
+ return requireAllProps({
2338
+ kind: "DropIndexNode",
2339
+ name: this.transformNode(node.name, queryId),
2340
+ table: this.transformNode(node.table, queryId),
2341
+ ifExists: node.ifExists,
2342
+ cascade: node.cascade
2343
+ });
2344
+ }
2345
+ transformPrimaryKeyConstraint(node, queryId) {
2346
+ return requireAllProps({
2347
+ kind: "PrimaryKeyConstraintNode",
2348
+ columns: this.transformNodeList(node.columns, queryId),
2349
+ name: this.transformNode(node.name, queryId),
2350
+ deferrable: node.deferrable,
2351
+ initiallyDeferred: node.initiallyDeferred
2352
+ });
2353
+ }
2354
+ transformUniqueConstraint(node, queryId) {
2355
+ return requireAllProps({
2356
+ kind: "UniqueConstraintNode",
2357
+ columns: this.transformNodeList(node.columns, queryId),
2358
+ name: this.transformNode(node.name, queryId),
2359
+ nullsNotDistinct: node.nullsNotDistinct,
2360
+ deferrable: node.deferrable,
2361
+ initiallyDeferred: node.initiallyDeferred
2362
+ });
2363
+ }
2364
+ transformForeignKeyConstraint(node, queryId) {
2365
+ return requireAllProps({
2366
+ kind: "ForeignKeyConstraintNode",
2367
+ columns: this.transformNodeList(node.columns, queryId),
2368
+ references: this.transformNode(node.references, queryId),
2369
+ name: this.transformNode(node.name, queryId),
2370
+ onDelete: node.onDelete,
2371
+ onUpdate: node.onUpdate,
2372
+ deferrable: node.deferrable,
2373
+ initiallyDeferred: node.initiallyDeferred
2374
+ });
2375
+ }
2376
+ transformSetOperation(node, queryId) {
2377
+ return requireAllProps({
2378
+ kind: "SetOperationNode",
2379
+ operator: node.operator,
2380
+ expression: this.transformNode(node.expression, queryId),
2381
+ all: node.all
2382
+ });
2383
+ }
2384
+ transformReferences(node, queryId) {
2385
+ return requireAllProps({
2386
+ kind: "ReferencesNode",
2387
+ table: this.transformNode(node.table, queryId),
2388
+ columns: this.transformNodeList(node.columns, queryId),
2389
+ onDelete: node.onDelete,
2390
+ onUpdate: node.onUpdate
2391
+ });
2392
+ }
2393
+ transformCheckConstraint(node, queryId) {
2394
+ return requireAllProps({
2395
+ kind: "CheckConstraintNode",
2396
+ expression: this.transformNode(node.expression, queryId),
2397
+ name: this.transformNode(node.name, queryId)
2398
+ });
2399
+ }
2400
+ transformWith(node, queryId) {
2401
+ return requireAllProps({
2402
+ kind: "WithNode",
2403
+ expressions: this.transformNodeList(node.expressions, queryId),
2404
+ recursive: node.recursive
2405
+ });
2406
+ }
2407
+ transformCommonTableExpression(node, queryId) {
2408
+ return requireAllProps({
2409
+ kind: "CommonTableExpressionNode",
2410
+ name: this.transformNode(node.name, queryId),
2411
+ materialized: node.materialized,
2412
+ expression: this.transformNode(node.expression, queryId)
2413
+ });
2414
+ }
2415
+ transformCommonTableExpressionName(node, queryId) {
2416
+ return requireAllProps({
2417
+ kind: "CommonTableExpressionNameNode",
2418
+ table: this.transformNode(node.table, queryId),
2419
+ columns: this.transformNodeList(node.columns, queryId)
2420
+ });
2421
+ }
2422
+ transformHaving(node, queryId) {
2423
+ return requireAllProps({
2424
+ kind: "HavingNode",
2425
+ having: this.transformNode(node.having, queryId)
2426
+ });
2427
+ }
2428
+ transformCreateSchema(node, queryId) {
2429
+ return requireAllProps({
2430
+ kind: "CreateSchemaNode",
2431
+ schema: this.transformNode(node.schema, queryId),
2432
+ ifNotExists: node.ifNotExists
2433
+ });
2434
+ }
2435
+ transformDropSchema(node, queryId) {
2436
+ return requireAllProps({
2437
+ kind: "DropSchemaNode",
2438
+ schema: this.transformNode(node.schema, queryId),
2439
+ ifExists: node.ifExists,
2440
+ cascade: node.cascade
2441
+ });
2442
+ }
2443
+ transformAlterTable(node, queryId) {
2444
+ return requireAllProps({
2445
+ kind: "AlterTableNode",
2446
+ table: this.transformNode(node.table, queryId),
2447
+ renameTo: this.transformNode(node.renameTo, queryId),
2448
+ setSchema: this.transformNode(node.setSchema, queryId),
2449
+ columnAlterations: this.transformNodeList(node.columnAlterations, queryId),
2450
+ addConstraint: this.transformNode(node.addConstraint, queryId),
2451
+ dropConstraint: this.transformNode(node.dropConstraint, queryId),
2452
+ renameConstraint: this.transformNode(node.renameConstraint, queryId),
2453
+ addIndex: this.transformNode(node.addIndex, queryId),
2454
+ dropIndex: this.transformNode(node.dropIndex, queryId)
2455
+ });
2456
+ }
2457
+ transformDropColumn(node, queryId) {
2458
+ return requireAllProps({
2459
+ kind: "DropColumnNode",
2460
+ column: this.transformNode(node.column, queryId)
2461
+ });
2462
+ }
2463
+ transformRenameColumn(node, queryId) {
2464
+ return requireAllProps({
2465
+ kind: "RenameColumnNode",
2466
+ column: this.transformNode(node.column, queryId),
2467
+ renameTo: this.transformNode(node.renameTo, queryId)
2468
+ });
2469
+ }
2470
+ transformAlterColumn(node, queryId) {
2471
+ return requireAllProps({
2472
+ kind: "AlterColumnNode",
2473
+ column: this.transformNode(node.column, queryId),
2474
+ dataType: this.transformNode(node.dataType, queryId),
2475
+ dataTypeExpression: this.transformNode(node.dataTypeExpression, queryId),
2476
+ setDefault: this.transformNode(node.setDefault, queryId),
2477
+ dropDefault: node.dropDefault,
2478
+ setNotNull: node.setNotNull,
2479
+ dropNotNull: node.dropNotNull
2480
+ });
2481
+ }
2482
+ transformModifyColumn(node, queryId) {
2483
+ return requireAllProps({
2484
+ kind: "ModifyColumnNode",
2485
+ column: this.transformNode(node.column, queryId)
2486
+ });
2487
+ }
2488
+ transformAddConstraint(node, queryId) {
2489
+ return requireAllProps({
2490
+ kind: "AddConstraintNode",
2491
+ constraint: this.transformNode(node.constraint, queryId)
2492
+ });
2493
+ }
2494
+ transformDropConstraint(node, queryId) {
2495
+ return requireAllProps({
2496
+ kind: "DropConstraintNode",
2497
+ constraintName: this.transformNode(node.constraintName, queryId),
2498
+ ifExists: node.ifExists,
2499
+ modifier: node.modifier
2500
+ });
2501
+ }
2502
+ transformRenameConstraint(node, queryId) {
2503
+ return requireAllProps({
2504
+ kind: "RenameConstraintNode",
2505
+ oldName: this.transformNode(node.oldName, queryId),
2506
+ newName: this.transformNode(node.newName, queryId)
2507
+ });
2508
+ }
2509
+ transformCreateView(node, queryId) {
2510
+ return requireAllProps({
2511
+ kind: "CreateViewNode",
2512
+ name: this.transformNode(node.name, queryId),
2513
+ temporary: node.temporary,
2514
+ orReplace: node.orReplace,
2515
+ ifNotExists: node.ifNotExists,
2516
+ materialized: node.materialized,
2517
+ columns: this.transformNodeList(node.columns, queryId),
2518
+ as: this.transformNode(node.as, queryId)
2519
+ });
2520
+ }
2521
+ transformRefreshMaterializedView(node, queryId) {
2522
+ return requireAllProps({
2523
+ kind: "RefreshMaterializedViewNode",
2524
+ name: this.transformNode(node.name, queryId),
2525
+ concurrently: node.concurrently,
2526
+ withNoData: node.withNoData
2527
+ });
2528
+ }
2529
+ transformDropView(node, queryId) {
2530
+ return requireAllProps({
2531
+ kind: "DropViewNode",
2532
+ name: this.transformNode(node.name, queryId),
2533
+ ifExists: node.ifExists,
2534
+ materialized: node.materialized,
2535
+ cascade: node.cascade
2536
+ });
2537
+ }
2538
+ transformGenerated(node, queryId) {
2539
+ return requireAllProps({
2540
+ kind: "GeneratedNode",
2541
+ byDefault: node.byDefault,
2542
+ always: node.always,
2543
+ identity: node.identity,
2544
+ stored: node.stored,
2545
+ expression: this.transformNode(node.expression, queryId)
2546
+ });
2547
+ }
2548
+ transformDefaultValue(node, queryId) {
2549
+ return requireAllProps({
2550
+ kind: "DefaultValueNode",
2551
+ defaultValue: this.transformNode(node.defaultValue, queryId)
2552
+ });
2553
+ }
2554
+ transformOn(node, queryId) {
2555
+ return requireAllProps({
2556
+ kind: "OnNode",
2557
+ on: this.transformNode(node.on, queryId)
2558
+ });
2559
+ }
2560
+ transformSelectModifier(node, queryId) {
2561
+ return requireAllProps({
2562
+ kind: "SelectModifierNode",
2563
+ modifier: node.modifier,
2564
+ rawModifier: this.transformNode(node.rawModifier, queryId),
2565
+ of: this.transformNodeList(node.of, queryId)
2566
+ });
2567
+ }
2568
+ transformCreateType(node, queryId) {
2569
+ return requireAllProps({
2570
+ kind: "CreateTypeNode",
2571
+ name: this.transformNode(node.name, queryId),
2572
+ enum: this.transformNode(node.enum, queryId)
2573
+ });
2574
+ }
2575
+ transformDropType(node, queryId) {
2576
+ return requireAllProps({
2577
+ kind: "DropTypeNode",
2578
+ name: this.transformNode(node.name, queryId),
2579
+ ifExists: node.ifExists
2580
+ });
2581
+ }
2582
+ transformExplain(node, queryId) {
2583
+ return requireAllProps({
2584
+ kind: "ExplainNode",
2585
+ format: node.format,
2586
+ options: this.transformNode(node.options, queryId)
2587
+ });
2588
+ }
2589
+ transformSchemableIdentifier(node, queryId) {
2590
+ return requireAllProps({
2591
+ kind: "SchemableIdentifierNode",
2592
+ schema: this.transformNode(node.schema, queryId),
2593
+ identifier: this.transformNode(node.identifier, queryId)
2594
+ });
2595
+ }
2596
+ transformAggregateFunction(node, queryId) {
2597
+ return requireAllProps({
2598
+ kind: "AggregateFunctionNode",
2599
+ func: node.func,
2600
+ aggregated: this.transformNodeList(node.aggregated, queryId),
2601
+ distinct: node.distinct,
2602
+ orderBy: this.transformNode(node.orderBy, queryId),
2603
+ withinGroup: this.transformNode(node.withinGroup, queryId),
2604
+ filter: this.transformNode(node.filter, queryId),
2605
+ over: this.transformNode(node.over, queryId)
2606
+ });
2607
+ }
2608
+ transformOver(node, queryId) {
2609
+ return requireAllProps({
2610
+ kind: "OverNode",
2611
+ orderBy: this.transformNode(node.orderBy, queryId),
2612
+ partitionBy: this.transformNode(node.partitionBy, queryId)
2613
+ });
2614
+ }
2615
+ transformPartitionBy(node, queryId) {
2616
+ return requireAllProps({
2617
+ kind: "PartitionByNode",
2618
+ items: this.transformNodeList(node.items, queryId)
2619
+ });
2620
+ }
2621
+ transformPartitionByItem(node, queryId) {
2622
+ return requireAllProps({
2623
+ kind: "PartitionByItemNode",
2624
+ partitionBy: this.transformNode(node.partitionBy, queryId)
2625
+ });
2626
+ }
2627
+ transformBinaryOperation(node, queryId) {
2628
+ return requireAllProps({
2629
+ kind: "BinaryOperationNode",
2630
+ leftOperand: this.transformNode(node.leftOperand, queryId),
2631
+ operator: this.transformNode(node.operator, queryId),
2632
+ rightOperand: this.transformNode(node.rightOperand, queryId)
2633
+ });
2634
+ }
2635
+ transformUnaryOperation(node, queryId) {
2636
+ return requireAllProps({
2637
+ kind: "UnaryOperationNode",
2638
+ operator: this.transformNode(node.operator, queryId),
2639
+ operand: this.transformNode(node.operand, queryId)
2640
+ });
2641
+ }
2642
+ transformUsing(node, queryId) {
2643
+ return requireAllProps({
2644
+ kind: "UsingNode",
2645
+ tables: this.transformNodeList(node.tables, queryId)
2646
+ });
2647
+ }
2648
+ transformFunction(node, queryId) {
2649
+ return requireAllProps({
2650
+ kind: "FunctionNode",
2651
+ func: node.func,
2652
+ arguments: this.transformNodeList(node.arguments, queryId)
2653
+ });
2654
+ }
2655
+ transformCase(node, queryId) {
2656
+ return requireAllProps({
2657
+ kind: "CaseNode",
2658
+ value: this.transformNode(node.value, queryId),
2659
+ when: this.transformNodeList(node.when, queryId),
2660
+ else: this.transformNode(node.else, queryId),
2661
+ isStatement: node.isStatement
2662
+ });
2663
+ }
2664
+ transformWhen(node, queryId) {
2665
+ return requireAllProps({
2666
+ kind: "WhenNode",
2667
+ condition: this.transformNode(node.condition, queryId),
2668
+ result: this.transformNode(node.result, queryId)
2669
+ });
2670
+ }
2671
+ transformJSONReference(node, queryId) {
2672
+ return requireAllProps({
2673
+ kind: "JSONReferenceNode",
2674
+ reference: this.transformNode(node.reference, queryId),
2675
+ traversal: this.transformNode(node.traversal, queryId)
2676
+ });
2677
+ }
2678
+ transformJSONPath(node, queryId) {
2679
+ return requireAllProps({
2680
+ kind: "JSONPathNode",
2681
+ inOperator: this.transformNode(node.inOperator, queryId),
2682
+ pathLegs: this.transformNodeList(node.pathLegs, queryId)
2683
+ });
2684
+ }
2685
+ transformJSONPathLeg(node, _queryId) {
2686
+ return requireAllProps({
2687
+ kind: "JSONPathLegNode",
2688
+ type: node.type,
2689
+ value: node.value
2690
+ });
2691
+ }
2692
+ transformJSONOperatorChain(node, queryId) {
2693
+ return requireAllProps({
2694
+ kind: "JSONOperatorChainNode",
2695
+ operator: this.transformNode(node.operator, queryId),
2696
+ values: this.transformNodeList(node.values, queryId)
2697
+ });
2698
+ }
2699
+ transformTuple(node, queryId) {
2700
+ return requireAllProps({
2701
+ kind: "TupleNode",
2702
+ values: this.transformNodeList(node.values, queryId)
2703
+ });
2704
+ }
2705
+ transformMergeQuery(node, queryId) {
2706
+ return requireAllProps({
2707
+ kind: "MergeQueryNode",
2708
+ into: this.transformNode(node.into, queryId),
2709
+ using: this.transformNode(node.using, queryId),
2710
+ whens: this.transformNodeList(node.whens, queryId),
2711
+ with: this.transformNode(node.with, queryId),
2712
+ top: this.transformNode(node.top, queryId),
2713
+ endModifiers: this.transformNodeList(node.endModifiers, queryId),
2714
+ output: this.transformNode(node.output, queryId),
2715
+ returning: this.transformNode(node.returning, queryId)
2716
+ });
2717
+ }
2718
+ transformMatched(node, _queryId) {
2719
+ return requireAllProps({
2720
+ kind: "MatchedNode",
2721
+ not: node.not,
2722
+ bySource: node.bySource
2723
+ });
2724
+ }
2725
+ transformAddIndex(node, queryId) {
2726
+ return requireAllProps({
2727
+ kind: "AddIndexNode",
2728
+ name: this.transformNode(node.name, queryId),
2729
+ columns: this.transformNodeList(node.columns, queryId),
2730
+ unique: node.unique,
2731
+ using: this.transformNode(node.using, queryId),
2732
+ ifNotExists: node.ifNotExists
2733
+ });
2734
+ }
2735
+ transformCast(node, queryId) {
2736
+ return requireAllProps({
2737
+ kind: "CastNode",
2738
+ expression: this.transformNode(node.expression, queryId),
2739
+ dataType: this.transformNode(node.dataType, queryId)
2740
+ });
2741
+ }
2742
+ transformFetch(node, queryId) {
2743
+ return requireAllProps({
2744
+ kind: "FetchNode",
2745
+ rowCount: this.transformNode(node.rowCount, queryId),
2746
+ modifier: node.modifier
2747
+ });
2748
+ }
2749
+ transformTop(node, _queryId) {
2750
+ return requireAllProps({
2751
+ kind: "TopNode",
2752
+ expression: node.expression,
2753
+ modifiers: node.modifiers
2754
+ });
2755
+ }
2756
+ transformOutput(node, queryId) {
2757
+ return requireAllProps({
2758
+ kind: "OutputNode",
2759
+ selections: this.transformNodeList(node.selections, queryId)
2760
+ });
2761
+ }
2762
+ transformDataType(node, _queryId) {
2763
+ return node;
2764
+ }
2765
+ transformSelectAll(node, _queryId) {
2766
+ return node;
2767
+ }
2768
+ transformIdentifier(node, _queryId) {
2769
+ return node;
2770
+ }
2771
+ transformValue(node, _queryId) {
2772
+ return node;
2773
+ }
2774
+ transformPrimitiveValueList(node, _queryId) {
2775
+ return node;
2776
+ }
2777
+ transformOperator(node, _queryId) {
2778
+ return node;
2779
+ }
2780
+ transformDefaultInsertValue(node, _queryId) {
2781
+ return node;
2782
+ }
2783
+ transformOrAction(node, _queryId) {
2784
+ return node;
2785
+ }
2786
+ transformCollate(node, _queryId) {
2787
+ return node;
2788
+ }
2789
+ };
2790
+
2791
+ // node_modules/kysely/dist/esm/operation-node/table-node.js
2792
+ var TableNode = freeze({
2793
+ is(node) {
2794
+ return node.kind === "TableNode";
2795
+ },
2796
+ create(table) {
2797
+ return freeze({
2798
+ kind: "TableNode",
2799
+ table: SchemableIdentifierNode.create(table)
2800
+ });
2801
+ },
2802
+ createWithSchema(schema, table) {
2803
+ return freeze({
2804
+ kind: "TableNode",
2805
+ table: SchemableIdentifierNode.createWithSchema(schema, table)
2806
+ });
2807
+ }
2808
+ });
2809
+
2810
+ // node_modules/kysely/dist/esm/operation-node/using-node.js
2811
+ var UsingNode = freeze({
2812
+ is(node) {
2813
+ return node.kind === "UsingNode";
2814
+ },
2815
+ create(tables) {
2816
+ return freeze({
2817
+ kind: "UsingNode",
2818
+ tables: freeze(tables)
2819
+ });
2820
+ },
2821
+ cloneWithTables(using, tables) {
2822
+ return freeze({
2823
+ ...using,
2824
+ tables: freeze([...using.tables, ...tables])
2825
+ });
2826
+ }
2827
+ });
2828
+
2829
+ // node_modules/kysely/dist/esm/plugin/with-schema/with-schema-transformer.js
2830
+ var ROOT_OPERATION_NODES = freeze({
2831
+ AlterTableNode: true,
2832
+ CreateIndexNode: true,
2833
+ CreateSchemaNode: true,
2834
+ CreateTableNode: true,
2835
+ CreateTypeNode: true,
2836
+ CreateViewNode: true,
2837
+ RefreshMaterializedViewNode: true,
2838
+ DeleteQueryNode: true,
2839
+ DropIndexNode: true,
2840
+ DropSchemaNode: true,
2841
+ DropTableNode: true,
2842
+ DropTypeNode: true,
2843
+ DropViewNode: true,
2844
+ InsertQueryNode: true,
2845
+ RawNode: true,
2846
+ SelectQueryNode: true,
2847
+ UpdateQueryNode: true,
2848
+ MergeQueryNode: true
2849
+ });
2850
+ var SCHEMALESS_FUNCTIONS = {
2851
+ json_agg: true,
2852
+ to_json: true
2853
+ };
2854
+ var WithSchemaTransformer = class extends OperationNodeTransformer {
2855
+ #schema;
2856
+ #schemableIds = /* @__PURE__ */ new Set();
2857
+ #ctes = /* @__PURE__ */ new Set();
2858
+ constructor(schema) {
2859
+ super();
2860
+ this.#schema = schema;
2861
+ }
2862
+ transformNodeImpl(node, queryId) {
2863
+ if (!this.#isRootOperationNode(node)) {
2864
+ return super.transformNodeImpl(node, queryId);
2865
+ }
2866
+ const ctes = this.#collectCTEs(node);
2867
+ for (const cte of ctes) {
2868
+ this.#ctes.add(cte);
2869
+ }
2870
+ const tables = this.#collectSchemableIds(node);
2871
+ for (const table of tables) {
2872
+ this.#schemableIds.add(table);
2873
+ }
2874
+ const transformed = super.transformNodeImpl(node, queryId);
2875
+ for (const table of tables) {
2876
+ this.#schemableIds.delete(table);
2877
+ }
2878
+ for (const cte of ctes) {
2879
+ this.#ctes.delete(cte);
2880
+ }
2881
+ return transformed;
2882
+ }
2883
+ transformSchemableIdentifier(node, queryId) {
2884
+ const transformed = super.transformSchemableIdentifier(node, queryId);
2885
+ if (transformed.schema || !this.#schemableIds.has(node.identifier.name)) {
2886
+ return transformed;
2887
+ }
2888
+ return {
2889
+ ...transformed,
2890
+ schema: IdentifierNode.create(this.#schema)
2891
+ };
2892
+ }
2893
+ transformReferences(node, queryId) {
2894
+ const transformed = super.transformReferences(node, queryId);
2895
+ if (transformed.table.table.schema) {
2896
+ return transformed;
2897
+ }
2898
+ return {
2899
+ ...transformed,
2900
+ table: TableNode.createWithSchema(this.#schema, transformed.table.table.identifier.name)
2901
+ };
2902
+ }
2903
+ transformAggregateFunction(node, queryId) {
2904
+ return {
2905
+ ...super.transformAggregateFunction({ ...node, aggregated: [] }, queryId),
2906
+ aggregated: this.#transformTableArgsWithoutSchemas(node, queryId, "aggregated")
2907
+ };
2908
+ }
2909
+ transformFunction(node, queryId) {
2910
+ return {
2911
+ ...super.transformFunction({ ...node, arguments: [] }, queryId),
2912
+ arguments: this.#transformTableArgsWithoutSchemas(node, queryId, "arguments")
2913
+ };
2914
+ }
2915
+ transformSelectModifier(node, queryId) {
2916
+ return {
2917
+ ...super.transformSelectModifier({ ...node, of: void 0 }, queryId),
2918
+ of: node.of?.map((item) => TableNode.is(item) && !item.table.schema ? {
2919
+ ...item,
2920
+ table: this.transformIdentifier(item.table.identifier, queryId)
2921
+ } : this.transformNode(item, queryId))
2922
+ };
2923
+ }
2924
+ #transformTableArgsWithoutSchemas(node, queryId, argsKey) {
2925
+ return SCHEMALESS_FUNCTIONS[node.func] ? node[argsKey].map((arg) => !TableNode.is(arg) || arg.table.schema ? this.transformNode(arg, queryId) : {
2926
+ ...arg,
2927
+ table: this.transformIdentifier(arg.table.identifier, queryId)
2928
+ }) : this.transformNodeList(node[argsKey], queryId);
2929
+ }
2930
+ #isRootOperationNode(node) {
2931
+ return node.kind in ROOT_OPERATION_NODES;
2932
+ }
2933
+ #collectSchemableIds(node) {
2934
+ const schemableIds = /* @__PURE__ */ new Set();
2935
+ if ("name" in node && node.name && SchemableIdentifierNode.is(node.name)) {
2936
+ this.#collectSchemableId(node.name, schemableIds);
2937
+ }
2938
+ if ("from" in node && node.from) {
2939
+ for (const from of node.from.froms) {
2940
+ this.#collectSchemableIdsFromTableExpr(from, schemableIds);
2941
+ }
2942
+ }
2943
+ if ("into" in node && node.into) {
2944
+ this.#collectSchemableIdsFromTableExpr(node.into, schemableIds);
2945
+ }
2946
+ if ("table" in node && node.table) {
2947
+ this.#collectSchemableIdsFromTableExpr(node.table, schemableIds);
2948
+ }
2949
+ if ("joins" in node && node.joins) {
2950
+ for (const join of node.joins) {
2951
+ this.#collectSchemableIdsFromTableExpr(join.table, schemableIds);
2952
+ }
2953
+ }
2954
+ if ("using" in node && node.using) {
2955
+ if (JoinNode.is(node.using)) {
2956
+ this.#collectSchemableIdsFromTableExpr(node.using.table, schemableIds);
2957
+ } else {
2958
+ this.#collectSchemableIdsFromTableExpr(node.using, schemableIds);
2959
+ }
2960
+ }
2961
+ return schemableIds;
2962
+ }
2963
+ #collectCTEs(node) {
2964
+ const ctes = /* @__PURE__ */ new Set();
2965
+ if ("with" in node && node.with) {
2966
+ this.#collectCTEIds(node.with, ctes);
2967
+ }
2968
+ return ctes;
2969
+ }
2970
+ #collectSchemableIdsFromTableExpr(node, schemableIds) {
2971
+ if (TableNode.is(node)) {
2972
+ return this.#collectSchemableId(node.table, schemableIds);
2973
+ }
2974
+ if (AliasNode.is(node) && TableNode.is(node.node)) {
2975
+ return this.#collectSchemableId(node.node.table, schemableIds);
2976
+ }
2977
+ if (ListNode.is(node)) {
2978
+ for (const table of node.items) {
2979
+ this.#collectSchemableIdsFromTableExpr(table, schemableIds);
2980
+ }
2981
+ return;
2982
+ }
2983
+ if (UsingNode.is(node)) {
2984
+ for (const table of node.tables) {
2985
+ this.#collectSchemableIdsFromTableExpr(table, schemableIds);
2986
+ }
2987
+ return;
2988
+ }
2989
+ }
2990
+ #collectSchemableId(node, schemableIds) {
2991
+ const id = node.identifier.name;
2992
+ if (!this.#schemableIds.has(id) && !this.#ctes.has(id)) {
2993
+ schemableIds.add(id);
2994
+ }
2995
+ }
2996
+ #collectCTEIds(node, ctes) {
2997
+ for (const expr of node.expressions) {
2998
+ const cteId = expr.name.table.table.identifier.name;
2999
+ if (!this.#ctes.has(cteId)) {
3000
+ ctes.add(cteId);
3001
+ }
3002
+ }
3003
+ }
3004
+ };
3005
+
3006
+ // node_modules/kysely/dist/esm/plugin/with-schema/with-schema-plugin.js
3007
+ var WithSchemaPlugin = class {
3008
+ #transformer;
3009
+ constructor(schema) {
3010
+ this.#transformer = new WithSchemaTransformer(schema);
3011
+ }
3012
+ transformQuery(args) {
3013
+ return this.#transformer.transformNode(args.node, args.queryId);
3014
+ }
3015
+ async transformResult(args) {
3016
+ return args.result;
3017
+ }
3018
+ };
3019
+
3020
+ // node_modules/kysely/dist/esm/migration/migrator.js
3021
+ var DEFAULT_MIGRATION_TABLE = "kysely_migration";
3022
+ var DEFAULT_MIGRATION_LOCK_TABLE = "kysely_migration_lock";
3023
+ freeze({ __noMigrations__: true });
3024
+
3025
+ exports.AliasNode = AliasNode;
3026
+ exports.AndNode = AndNode;
3027
+ exports.CreateTableNode = CreateTableNode;
3028
+ exports.CreateViewNode = CreateViewNode;
3029
+ exports.DEFAULT_MIGRATION_LOCK_TABLE = DEFAULT_MIGRATION_LOCK_TABLE;
3030
+ exports.DEFAULT_MIGRATION_TABLE = DEFAULT_MIGRATION_TABLE;
3031
+ exports.DefaultQueryCompiler = DefaultQueryCompiler;
3032
+ exports.IdentifierNode = IdentifierNode;
3033
+ exports.InsertQueryNode = InsertQueryNode;
3034
+ exports.JoinNode = JoinNode;
3035
+ exports.ListNode = ListNode;
3036
+ exports.ON_COMMIT_ACTIONS = ON_COMMIT_ACTIONS;
3037
+ exports.OPERATORS = OPERATORS;
3038
+ exports.OperationNodeTransformer = OperationNodeTransformer;
3039
+ exports.OperatorNode = OperatorNode;
3040
+ exports.OrNode = OrNode;
3041
+ exports.ParensNode = ParensNode;
3042
+ exports.RawNode = RawNode;
3043
+ exports.SchemableIdentifierNode = SchemableIdentifierNode;
3044
+ exports.SetOperationNode = SetOperationNode;
3045
+ exports.TableNode = TableNode;
3046
+ exports.UsingNode = UsingNode;
3047
+ exports.WhenNode = WhenNode;
3048
+ exports.WithSchemaPlugin = WithSchemaPlugin;
3049
+ exports.asArray = asArray;
3050
+ exports.freeze = freeze;
3051
+ exports.isBigInt = isBigInt;
3052
+ exports.isBoolean = isBoolean;
3053
+ exports.isBuffer = isBuffer;
3054
+ exports.isDate = isDate;
3055
+ exports.isFunction = isFunction;
3056
+ exports.isJSONOperator = isJSONOperator;
3057
+ exports.isNull = isNull;
3058
+ exports.isNumber = isNumber;
3059
+ exports.isObject = isObject;
3060
+ exports.isReadonlyArray = isReadonlyArray;
3061
+ exports.isString = isString;
3062
+ exports.isUndefined = isUndefined;
3063
+ exports.logOnce = logOnce;
3064
+ exports.noop = noop;
3065
+ //# sourceMappingURL=chunk-XY4KBWXT.cjs.map
3066
+ //# sourceMappingURL=chunk-XY4KBWXT.cjs.map