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