@windrun-huaiin/backend-core 10.0.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 (198) hide show
  1. package/LICENSE +21 -0
  2. package/dist/app/api/stripe/checkout/route.d.ts +19 -0
  3. package/dist/app/api/stripe/checkout/route.d.ts.map +1 -0
  4. package/dist/app/api/stripe/checkout/route.js +120 -0
  5. package/dist/app/api/stripe/checkout/route.mjs +118 -0
  6. package/dist/app/api/stripe/customer-portal/route.d.ts +11 -0
  7. package/dist/app/api/stripe/customer-portal/route.d.ts.map +1 -0
  8. package/dist/app/api/stripe/customer-portal/route.js +73 -0
  9. package/dist/app/api/stripe/customer-portal/route.mjs +71 -0
  10. package/dist/app/api/user/anonymous/init/route.d.ts +7 -0
  11. package/dist/app/api/user/anonymous/init/route.d.ts.map +1 -0
  12. package/dist/app/api/user/anonymous/init/route.js +210 -0
  13. package/dist/app/api/user/anonymous/init/route.mjs +208 -0
  14. package/dist/app/api/webhook/clerk/user/route.d.ts +7 -0
  15. package/dist/app/api/webhook/clerk/user/route.d.ts.map +1 -0
  16. package/dist/app/api/webhook/clerk/user/route.js +202 -0
  17. package/dist/app/api/webhook/clerk/user/route.mjs +200 -0
  18. package/dist/app/api/webhook/stripe/route.d.ts +8 -0
  19. package/dist/app/api/webhook/stripe/route.d.ts.map +1 -0
  20. package/dist/app/api/webhook/stripe/route.js +70 -0
  21. package/dist/app/api/webhook/stripe/route.mjs +67 -0
  22. package/dist/index.d.ts +7 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +83 -0
  25. package/dist/index.mjs +18 -0
  26. package/dist/lib/auth-utils.d.ts +46 -0
  27. package/dist/lib/auth-utils.d.ts.map +1 -0
  28. package/dist/lib/auth-utils.js +107 -0
  29. package/dist/lib/auth-utils.mjs +102 -0
  30. package/dist/lib/credit-init.d.ts +8 -0
  31. package/dist/lib/credit-init.d.ts.map +1 -0
  32. package/dist/lib/credit-init.js +16 -0
  33. package/dist/lib/credit-init.mjs +10 -0
  34. package/dist/lib/index.d.ts +5 -0
  35. package/dist/lib/index.d.ts.map +1 -0
  36. package/dist/lib/index.js +31 -0
  37. package/dist/lib/index.mjs +4 -0
  38. package/dist/lib/money-price-config.d.ts +51 -0
  39. package/dist/lib/money-price-config.d.ts.map +1 -0
  40. package/dist/lib/money-price-config.js +156 -0
  41. package/dist/lib/money-price-config.mjs +151 -0
  42. package/dist/lib/stripe-config.d.ts +31 -0
  43. package/dist/lib/stripe-config.d.ts.map +1 -0
  44. package/dist/lib/stripe-config.js +278 -0
  45. package/dist/lib/stripe-config.mjs +268 -0
  46. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +48 -0
  47. package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs +45 -0
  48. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.js +54 -0
  49. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.mjs +51 -0
  50. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.js +44 -0
  51. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.mjs +35 -0
  52. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.js +31 -0
  53. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.mjs +18 -0
  54. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.js +587 -0
  55. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.mjs +527 -0
  56. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.js +447 -0
  57. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.mjs +399 -0
  58. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.js +245 -0
  59. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.mjs +232 -0
  60. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.js +68 -0
  61. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.mjs +62 -0
  62. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.js +39 -0
  63. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.mjs +37 -0
  64. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.js +80 -0
  65. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.mjs +75 -0
  66. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.js +101 -0
  67. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.mjs +86 -0
  68. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.js +102 -0
  69. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.mjs +76 -0
  70. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.js +56 -0
  71. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.mjs +52 -0
  72. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.js +1205 -0
  73. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.mjs +1157 -0
  74. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.js +407 -0
  75. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.mjs +374 -0
  76. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.js +9 -0
  77. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.mjs +7 -0
  78. package/dist/prisma/client.d.ts +2 -0
  79. package/dist/prisma/client.d.ts.map +1 -0
  80. package/dist/prisma/client.js +12 -0
  81. package/dist/prisma/client.mjs +1 -0
  82. package/dist/prisma/index.d.ts +4 -0
  83. package/dist/prisma/index.d.ts.map +1 -0
  84. package/dist/prisma/index.js +10 -0
  85. package/dist/prisma/index.mjs +2 -0
  86. package/dist/prisma/prisma-transaction-util.d.ts +3 -0
  87. package/dist/prisma/prisma-transaction-util.d.ts.map +1 -0
  88. package/dist/prisma/prisma-transaction-util.js +29 -0
  89. package/dist/prisma/prisma-transaction-util.mjs +27 -0
  90. package/dist/prisma/prisma.d.ts +4 -0
  91. package/dist/prisma/prisma.d.ts.map +1 -0
  92. package/dist/prisma/prisma.js +109 -0
  93. package/dist/prisma/prisma.mjs +106 -0
  94. package/dist/services/aggregate/billing.aggregate.service.d.ts +83 -0
  95. package/dist/services/aggregate/billing.aggregate.service.d.ts.map +1 -0
  96. package/dist/services/aggregate/billing.aggregate.service.js +308 -0
  97. package/dist/services/aggregate/billing.aggregate.service.mjs +306 -0
  98. package/dist/services/aggregate/index.d.ts +3 -0
  99. package/dist/services/aggregate/index.d.ts.map +1 -0
  100. package/dist/services/aggregate/index.js +9 -0
  101. package/dist/services/aggregate/index.mjs +2 -0
  102. package/dist/services/aggregate/user.aggregate.service.d.ts +34 -0
  103. package/dist/services/aggregate/user.aggregate.service.d.ts.map +1 -0
  104. package/dist/services/aggregate/user.aggregate.service.js +136 -0
  105. package/dist/services/aggregate/user.aggregate.service.mjs +133 -0
  106. package/dist/services/context/index.d.ts +2 -0
  107. package/dist/services/context/index.d.ts.map +1 -0
  108. package/dist/services/context/index.js +13 -0
  109. package/dist/services/context/index.mjs +1 -0
  110. package/dist/services/context/user-context-service.d.ts +30 -0
  111. package/dist/services/context/user-context-service.d.ts.map +1 -0
  112. package/dist/services/context/user-context-service.js +170 -0
  113. package/dist/services/context/user-context-service.mjs +162 -0
  114. package/dist/services/database/apilog.service.d.ts +39 -0
  115. package/dist/services/database/apilog.service.d.ts.map +1 -0
  116. package/dist/services/database/apilog.service.js +174 -0
  117. package/dist/services/database/apilog.service.mjs +170 -0
  118. package/dist/services/database/constants.d.ts +73 -0
  119. package/dist/services/database/constants.d.ts.map +1 -0
  120. package/dist/services/database/constants.js +135 -0
  121. package/dist/services/database/constants.mjs +117 -0
  122. package/dist/services/database/credit.service.d.ts +107 -0
  123. package/dist/services/database/credit.service.d.ts.map +1 -0
  124. package/dist/services/database/credit.service.js +515 -0
  125. package/dist/services/database/credit.service.mjs +512 -0
  126. package/dist/services/database/creditAuditLog.service.d.ts +73 -0
  127. package/dist/services/database/creditAuditLog.service.d.ts.map +1 -0
  128. package/dist/services/database/creditAuditLog.service.js +305 -0
  129. package/dist/services/database/creditAuditLog.service.mjs +302 -0
  130. package/dist/services/database/index.d.ts +10 -0
  131. package/dist/services/database/index.d.ts.map +1 -0
  132. package/dist/services/database/index.js +38 -0
  133. package/dist/services/database/index.mjs +8 -0
  134. package/dist/services/database/prisma-model-type.d.ts +3 -0
  135. package/dist/services/database/prisma-model-type.d.ts.map +1 -0
  136. package/dist/services/database/subscription.service.d.ts +48 -0
  137. package/dist/services/database/subscription.service.d.ts.map +1 -0
  138. package/dist/services/database/subscription.service.js +267 -0
  139. package/dist/services/database/subscription.service.mjs +264 -0
  140. package/dist/services/database/transaction.service.d.ts +92 -0
  141. package/dist/services/database/transaction.service.d.ts.map +1 -0
  142. package/dist/services/database/transaction.service.js +326 -0
  143. package/dist/services/database/transaction.service.mjs +323 -0
  144. package/dist/services/database/user.service.d.ts +45 -0
  145. package/dist/services/database/user.service.d.ts.map +1 -0
  146. package/dist/services/database/user.service.js +180 -0
  147. package/dist/services/database/user.service.mjs +177 -0
  148. package/dist/services/database/userBackup.service.d.ts +45 -0
  149. package/dist/services/database/userBackup.service.d.ts.map +1 -0
  150. package/dist/services/database/userBackup.service.js +249 -0
  151. package/dist/services/database/userBackup.service.mjs +246 -0
  152. package/dist/services/stripe/index.d.ts +2 -0
  153. package/dist/services/stripe/index.d.ts.map +1 -0
  154. package/dist/services/stripe/index.js +7 -0
  155. package/dist/services/stripe/index.mjs +1 -0
  156. package/dist/services/stripe/webhook-handler.d.ts +6 -0
  157. package/dist/services/stripe/webhook-handler.d.ts.map +1 -0
  158. package/dist/services/stripe/webhook-handler.js +537 -0
  159. package/dist/services/stripe/webhook-handler.mjs +535 -0
  160. package/migrations/create.sql +176 -0
  161. package/migrations/db.init.sql +13 -0
  162. package/migrations/init-schema.sql +19 -0
  163. package/migrations/purge.sql +27 -0
  164. package/migrations/test-check.sql +167 -0
  165. package/package.json +123 -0
  166. package/prisma/schema.prisma +191 -0
  167. package/src/app/api/stripe/checkout/route.ts +145 -0
  168. package/src/app/api/stripe/customer-portal/route.ts +83 -0
  169. package/src/app/api/user/anonymous/init/route.ts +284 -0
  170. package/src/app/api/webhook/clerk/user/route.ts +249 -0
  171. package/src/app/api/webhook/stripe/route.ts +93 -0
  172. package/src/index.ts +6 -0
  173. package/src/lib/auth-utils.ts +101 -0
  174. package/src/lib/credit-init.ts +9 -0
  175. package/src/lib/index.ts +4 -0
  176. package/src/lib/money-price-config.ts +168 -0
  177. package/src/lib/stripe-config.ts +333 -0
  178. package/src/prisma/client.ts +2 -0
  179. package/src/prisma/index.ts +3 -0
  180. package/src/prisma/prisma-transaction-util.ts +24 -0
  181. package/src/prisma/prisma.ts +122 -0
  182. package/src/services/aggregate/billing.aggregate.service.ts +498 -0
  183. package/src/services/aggregate/index.ts +2 -0
  184. package/src/services/aggregate/user.aggregate.service.ts +168 -0
  185. package/src/services/context/index.ts +1 -0
  186. package/src/services/context/user-context-service.ts +200 -0
  187. package/src/services/database/apilog.service.ts +185 -0
  188. package/src/services/database/constants.ts +148 -0
  189. package/src/services/database/credit.service.ts +747 -0
  190. package/src/services/database/creditAuditLog.service.ts +402 -0
  191. package/src/services/database/index.ts +41 -0
  192. package/src/services/database/prisma-model-type.ts +13 -0
  193. package/src/services/database/subscription.service.ts +319 -0
  194. package/src/services/database/transaction.service.ts +447 -0
  195. package/src/services/database/user.service.ts +218 -0
  196. package/src/services/database/userBackup.service.ts +290 -0
  197. package/src/services/stripe/index.ts +1 -0
  198. package/src/services/stripe/webhook-handler.ts +648 -0
@@ -0,0 +1,447 @@
1
+ 'use strict';
2
+
3
+ var checks = require('./checks.js');
4
+ var util = require('./util.js');
5
+
6
+ function _string(Class, params) {
7
+ return new Class({
8
+ type: "string",
9
+ ...util.normalizeParams(params),
10
+ });
11
+ }
12
+ function _email(Class, params) {
13
+ return new Class({
14
+ type: "string",
15
+ format: "email",
16
+ check: "string_format",
17
+ abort: false,
18
+ ...util.normalizeParams(params),
19
+ });
20
+ }
21
+ function _guid(Class, params) {
22
+ return new Class({
23
+ type: "string",
24
+ format: "guid",
25
+ check: "string_format",
26
+ abort: false,
27
+ ...util.normalizeParams(params),
28
+ });
29
+ }
30
+ function _uuid(Class, params) {
31
+ return new Class({
32
+ type: "string",
33
+ format: "uuid",
34
+ check: "string_format",
35
+ abort: false,
36
+ ...util.normalizeParams(params),
37
+ });
38
+ }
39
+ function _uuidv4(Class, params) {
40
+ return new Class({
41
+ type: "string",
42
+ format: "uuid",
43
+ check: "string_format",
44
+ abort: false,
45
+ version: "v4",
46
+ ...util.normalizeParams(params),
47
+ });
48
+ }
49
+ function _uuidv6(Class, params) {
50
+ return new Class({
51
+ type: "string",
52
+ format: "uuid",
53
+ check: "string_format",
54
+ abort: false,
55
+ version: "v6",
56
+ ...util.normalizeParams(params),
57
+ });
58
+ }
59
+ function _uuidv7(Class, params) {
60
+ return new Class({
61
+ type: "string",
62
+ format: "uuid",
63
+ check: "string_format",
64
+ abort: false,
65
+ version: "v7",
66
+ ...util.normalizeParams(params),
67
+ });
68
+ }
69
+ function _url(Class, params) {
70
+ return new Class({
71
+ type: "string",
72
+ format: "url",
73
+ check: "string_format",
74
+ abort: false,
75
+ ...util.normalizeParams(params),
76
+ });
77
+ }
78
+ function _emoji(Class, params) {
79
+ return new Class({
80
+ type: "string",
81
+ format: "emoji",
82
+ check: "string_format",
83
+ abort: false,
84
+ ...util.normalizeParams(params),
85
+ });
86
+ }
87
+ function _nanoid(Class, params) {
88
+ return new Class({
89
+ type: "string",
90
+ format: "nanoid",
91
+ check: "string_format",
92
+ abort: false,
93
+ ...util.normalizeParams(params),
94
+ });
95
+ }
96
+ function _cuid(Class, params) {
97
+ return new Class({
98
+ type: "string",
99
+ format: "cuid",
100
+ check: "string_format",
101
+ abort: false,
102
+ ...util.normalizeParams(params),
103
+ });
104
+ }
105
+ function _cuid2(Class, params) {
106
+ return new Class({
107
+ type: "string",
108
+ format: "cuid2",
109
+ check: "string_format",
110
+ abort: false,
111
+ ...util.normalizeParams(params),
112
+ });
113
+ }
114
+ function _ulid(Class, params) {
115
+ return new Class({
116
+ type: "string",
117
+ format: "ulid",
118
+ check: "string_format",
119
+ abort: false,
120
+ ...util.normalizeParams(params),
121
+ });
122
+ }
123
+ function _xid(Class, params) {
124
+ return new Class({
125
+ type: "string",
126
+ format: "xid",
127
+ check: "string_format",
128
+ abort: false,
129
+ ...util.normalizeParams(params),
130
+ });
131
+ }
132
+ function _ksuid(Class, params) {
133
+ return new Class({
134
+ type: "string",
135
+ format: "ksuid",
136
+ check: "string_format",
137
+ abort: false,
138
+ ...util.normalizeParams(params),
139
+ });
140
+ }
141
+ function _ipv4(Class, params) {
142
+ return new Class({
143
+ type: "string",
144
+ format: "ipv4",
145
+ check: "string_format",
146
+ abort: false,
147
+ ...util.normalizeParams(params),
148
+ });
149
+ }
150
+ function _ipv6(Class, params) {
151
+ return new Class({
152
+ type: "string",
153
+ format: "ipv6",
154
+ check: "string_format",
155
+ abort: false,
156
+ ...util.normalizeParams(params),
157
+ });
158
+ }
159
+ function _cidrv4(Class, params) {
160
+ return new Class({
161
+ type: "string",
162
+ format: "cidrv4",
163
+ check: "string_format",
164
+ abort: false,
165
+ ...util.normalizeParams(params),
166
+ });
167
+ }
168
+ function _cidrv6(Class, params) {
169
+ return new Class({
170
+ type: "string",
171
+ format: "cidrv6",
172
+ check: "string_format",
173
+ abort: false,
174
+ ...util.normalizeParams(params),
175
+ });
176
+ }
177
+ function _base64(Class, params) {
178
+ return new Class({
179
+ type: "string",
180
+ format: "base64",
181
+ check: "string_format",
182
+ abort: false,
183
+ ...util.normalizeParams(params),
184
+ });
185
+ }
186
+ function _base64url(Class, params) {
187
+ return new Class({
188
+ type: "string",
189
+ format: "base64url",
190
+ check: "string_format",
191
+ abort: false,
192
+ ...util.normalizeParams(params),
193
+ });
194
+ }
195
+ function _e164(Class, params) {
196
+ return new Class({
197
+ type: "string",
198
+ format: "e164",
199
+ check: "string_format",
200
+ abort: false,
201
+ ...util.normalizeParams(params),
202
+ });
203
+ }
204
+ function _jwt(Class, params) {
205
+ return new Class({
206
+ type: "string",
207
+ format: "jwt",
208
+ check: "string_format",
209
+ abort: false,
210
+ ...util.normalizeParams(params),
211
+ });
212
+ }
213
+ function _isoDateTime(Class, params) {
214
+ return new Class({
215
+ type: "string",
216
+ format: "datetime",
217
+ check: "string_format",
218
+ offset: false,
219
+ local: false,
220
+ precision: null,
221
+ ...util.normalizeParams(params),
222
+ });
223
+ }
224
+ function _isoDate(Class, params) {
225
+ return new Class({
226
+ type: "string",
227
+ format: "date",
228
+ check: "string_format",
229
+ ...util.normalizeParams(params),
230
+ });
231
+ }
232
+ function _isoTime(Class, params) {
233
+ return new Class({
234
+ type: "string",
235
+ format: "time",
236
+ check: "string_format",
237
+ precision: null,
238
+ ...util.normalizeParams(params),
239
+ });
240
+ }
241
+ function _isoDuration(Class, params) {
242
+ return new Class({
243
+ type: "string",
244
+ format: "duration",
245
+ check: "string_format",
246
+ ...util.normalizeParams(params),
247
+ });
248
+ }
249
+ function _unknown(Class) {
250
+ return new Class({
251
+ type: "unknown",
252
+ });
253
+ }
254
+ function _never(Class, params) {
255
+ return new Class({
256
+ type: "never",
257
+ ...util.normalizeParams(params),
258
+ });
259
+ }
260
+ function _maxLength(maximum, params) {
261
+ const ch = new checks.$ZodCheckMaxLength({
262
+ check: "max_length",
263
+ ...util.normalizeParams(params),
264
+ maximum,
265
+ });
266
+ return ch;
267
+ }
268
+ function _minLength(minimum, params) {
269
+ return new checks.$ZodCheckMinLength({
270
+ check: "min_length",
271
+ ...util.normalizeParams(params),
272
+ minimum,
273
+ });
274
+ }
275
+ function _length(length, params) {
276
+ return new checks.$ZodCheckLengthEquals({
277
+ check: "length_equals",
278
+ ...util.normalizeParams(params),
279
+ length,
280
+ });
281
+ }
282
+ function _regex(pattern, params) {
283
+ return new checks.$ZodCheckRegex({
284
+ check: "string_format",
285
+ format: "regex",
286
+ ...util.normalizeParams(params),
287
+ pattern,
288
+ });
289
+ }
290
+ function _lowercase(params) {
291
+ return new checks.$ZodCheckLowerCase({
292
+ check: "string_format",
293
+ format: "lowercase",
294
+ ...util.normalizeParams(params),
295
+ });
296
+ }
297
+ function _uppercase(params) {
298
+ return new checks.$ZodCheckUpperCase({
299
+ check: "string_format",
300
+ format: "uppercase",
301
+ ...util.normalizeParams(params),
302
+ });
303
+ }
304
+ function _includes(includes, params) {
305
+ return new checks.$ZodCheckIncludes({
306
+ check: "string_format",
307
+ format: "includes",
308
+ ...util.normalizeParams(params),
309
+ includes,
310
+ });
311
+ }
312
+ function _startsWith(prefix, params) {
313
+ return new checks.$ZodCheckStartsWith({
314
+ check: "string_format",
315
+ format: "starts_with",
316
+ ...util.normalizeParams(params),
317
+ prefix,
318
+ });
319
+ }
320
+ function _endsWith(suffix, params) {
321
+ return new checks.$ZodCheckEndsWith({
322
+ check: "string_format",
323
+ format: "ends_with",
324
+ ...util.normalizeParams(params),
325
+ suffix,
326
+ });
327
+ }
328
+ function _overwrite(tx) {
329
+ return new checks.$ZodCheckOverwrite({
330
+ check: "overwrite",
331
+ tx,
332
+ });
333
+ }
334
+ // normalize
335
+ function _normalize(form) {
336
+ return _overwrite((input) => input.normalize(form));
337
+ }
338
+ // trim
339
+ function _trim() {
340
+ return _overwrite((input) => input.trim());
341
+ }
342
+ // toLowerCase
343
+ function _toLowerCase() {
344
+ return _overwrite((input) => input.toLowerCase());
345
+ }
346
+ // toUpperCase
347
+ function _toUpperCase() {
348
+ return _overwrite((input) => input.toUpperCase());
349
+ }
350
+ function _array(Class, element, params) {
351
+ return new Class({
352
+ type: "array",
353
+ element,
354
+ // get element() {
355
+ // return element;
356
+ // },
357
+ ...util.normalizeParams(params),
358
+ });
359
+ }
360
+ // same as _custom but defaults to abort:false
361
+ function _refine(Class, fn, _params) {
362
+ const schema = new Class({
363
+ type: "custom",
364
+ check: "custom",
365
+ fn: fn,
366
+ ...util.normalizeParams(_params),
367
+ });
368
+ return schema;
369
+ }
370
+ function _superRefine(fn) {
371
+ const ch = _check((payload) => {
372
+ payload.addIssue = (issue) => {
373
+ if (typeof issue === "string") {
374
+ payload.issues.push(util.issue(issue, payload.value, ch._zod.def));
375
+ }
376
+ else {
377
+ // for Zod 3 backwards compatibility
378
+ const _issue = issue;
379
+ if (_issue.fatal)
380
+ _issue.continue = false;
381
+ _issue.code ?? (_issue.code = "custom");
382
+ _issue.input ?? (_issue.input = payload.value);
383
+ _issue.inst ?? (_issue.inst = ch);
384
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...
385
+ payload.issues.push(util.issue(_issue));
386
+ }
387
+ };
388
+ return fn(payload.value, payload);
389
+ });
390
+ return ch;
391
+ }
392
+ function _check(fn, params) {
393
+ const ch = new checks.$ZodCheck({
394
+ check: "custom",
395
+ ...util.normalizeParams(params),
396
+ });
397
+ ch._zod.check = fn;
398
+ return ch;
399
+ }
400
+
401
+ exports._array = _array;
402
+ exports._base64 = _base64;
403
+ exports._base64url = _base64url;
404
+ exports._check = _check;
405
+ exports._cidrv4 = _cidrv4;
406
+ exports._cidrv6 = _cidrv6;
407
+ exports._cuid = _cuid;
408
+ exports._cuid2 = _cuid2;
409
+ exports._e164 = _e164;
410
+ exports._email = _email;
411
+ exports._emoji = _emoji;
412
+ exports._endsWith = _endsWith;
413
+ exports._guid = _guid;
414
+ exports._includes = _includes;
415
+ exports._ipv4 = _ipv4;
416
+ exports._ipv6 = _ipv6;
417
+ exports._isoDate = _isoDate;
418
+ exports._isoDateTime = _isoDateTime;
419
+ exports._isoDuration = _isoDuration;
420
+ exports._isoTime = _isoTime;
421
+ exports._jwt = _jwt;
422
+ exports._ksuid = _ksuid;
423
+ exports._length = _length;
424
+ exports._lowercase = _lowercase;
425
+ exports._maxLength = _maxLength;
426
+ exports._minLength = _minLength;
427
+ exports._nanoid = _nanoid;
428
+ exports._never = _never;
429
+ exports._normalize = _normalize;
430
+ exports._overwrite = _overwrite;
431
+ exports._refine = _refine;
432
+ exports._regex = _regex;
433
+ exports._startsWith = _startsWith;
434
+ exports._string = _string;
435
+ exports._superRefine = _superRefine;
436
+ exports._toLowerCase = _toLowerCase;
437
+ exports._toUpperCase = _toUpperCase;
438
+ exports._trim = _trim;
439
+ exports._ulid = _ulid;
440
+ exports._unknown = _unknown;
441
+ exports._uppercase = _uppercase;
442
+ exports._url = _url;
443
+ exports._uuid = _uuid;
444
+ exports._uuidv4 = _uuidv4;
445
+ exports._uuidv6 = _uuidv6;
446
+ exports._uuidv7 = _uuidv7;
447
+ exports._xid = _xid;