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