@access-dlsu/leapify 0.260505.5 → 0.260506.1

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