@coursebuilder/adapter-drizzle 1.0.4 → 1.0.7
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.
- package/dist/{chunk-KPBVZ44W.js → chunk-2I7NIOKI.js} +2 -2
- package/dist/chunk-2X5XVNDN.js +12 -0
- package/dist/{chunk-3GONHHMY.js → chunk-3RQH7IPC.js} +4 -4
- package/dist/{chunk-BLDW3QUS.js → chunk-5NNBQJUP.js} +2 -2
- package/dist/{chunk-HWIQUI7O.js → chunk-5WMUBNWJ.js} +6 -5
- package/dist/{chunk-WJWJ6E5Y.js → chunk-65H5Y4PD.js} +2 -2
- package/dist/{chunk-MP4CUWYC.js → chunk-6SJORFGN.js} +2 -2
- package/dist/chunk-6XFVP2Q4.js +101 -0
- package/dist/chunk-7223HR2E.js +112 -0
- package/dist/{chunk-ET3QAIY7.js → chunk-CCXVDMTA.js} +2 -2
- package/dist/{chunk-DKJO4Y3K.js → chunk-DNBW5D64.js} +2 -2
- package/dist/{chunk-ARHWIBFG.js → chunk-DP6YPJZ4.js} +2804 -1252
- package/dist/{chunk-OBUGOZKM.js → chunk-EJ7UDN4T.js} +6 -5
- package/dist/{chunk-YQNIXCD3.js → chunk-ENIKVP6O.js} +6 -5
- package/dist/chunk-HEQ5MII4.js +12764 -0
- package/dist/{chunk-LPJ2P2KJ.js → chunk-JX53ECWI.js} +69 -48
- package/dist/chunk-LV3LIBNU.js +12764 -0
- package/dist/chunk-MQSLKVLJ.js +101 -0
- package/dist/chunk-MUFYDXA7.js +2143 -0
- package/dist/{chunk-WPJZAYX7.js → chunk-NON5CXDH.js} +4 -3
- package/dist/{chunk-FPAQINSA.js → chunk-O4PMFTPJ.js} +3 -3
- package/dist/{chunk-ORRM7KVW.js → chunk-OFZECDCQ.js} +2 -2
- package/dist/chunk-OK4NHV6Z.js +58 -0
- package/dist/{chunk-LERR6HQ3.js → chunk-OUJPUONP.js} +2 -2
- package/dist/{chunk-PBTEHA7F.js → chunk-P76GFFVH.js} +6 -5
- package/dist/{chunk-MGZMGDQ5.js → chunk-PMCOC5PM.js} +2 -2
- package/dist/{chunk-EHRARBRS.js → chunk-QKFITIXC.js} +2 -2
- package/dist/{chunk-6MRFUIH5.js → chunk-SIZFEXIS.js} +2 -2
- package/dist/chunk-SOOAUY4E.js +63 -0
- package/dist/chunk-SUOPB24V.js +78 -0
- package/dist/{chunk-253RMSB3.js → chunk-U6XVAMCK.js} +6 -5
- package/dist/chunk-UIQCNODZ.js +100 -0
- package/dist/{chunk-LZHZDFNZ.js → chunk-UWUDJCJM.js} +2 -2
- package/dist/{chunk-6YPHJWS2.js → chunk-WMCZWSAG.js} +2 -2
- package/dist/chunk-XKCPXM63.js +79 -0
- package/dist/chunk-XM5PWOCV.js +63 -0
- package/dist/chunk-YMVONZZW.js +49 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -24
- package/dist/lib/mysql/index.cjs +3243 -1533
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +759 -238
- package/dist/lib/mysql/index.d.ts +759 -238
- package/dist/lib/mysql/index.js +30 -26
- package/dist/lib/mysql/schemas/auth/accounts.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +12 -12
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.js +13 -13
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-verification.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/device-verification.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/device-verification.js +13 -13
- package/dist/lib/mysql/schemas/auth/permissions.js +2 -2
- package/dist/lib/mysql/schemas/auth/profiles.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/profiles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/profiles.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/profiles.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/profiles.js +12 -12
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.js +13 -13
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.js +12 -12
- package/dist/lib/mysql/schemas/auth/sessions.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/sessions.js +13 -13
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.js +12 -12
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.js +12 -12
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +3 -2
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +2 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +2 -1
- package/dist/lib/mysql/schemas/auth/user-roles.js +12 -12
- package/dist/lib/mysql/schemas/auth/users.cjs +11 -3
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +5 -2
- package/dist/lib/mysql/schemas/auth/users.d.ts +5 -2
- package/dist/lib/mysql/schemas/auth/users.js +12 -12
- package/dist/lib/mysql/schemas/auth/verification-tokens.js +2 -2
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -2
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +17 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +17 -1
- package/dist/lib/mysql/schemas/commerce/coupon.js +12 -12
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +12 -12
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +2 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +17 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +17 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-events.cjs +120 -0
- package/dist/lib/mysql/schemas/commerce/merchant-events.cjs.map +1 -0
- package/dist/lib/mysql/schemas/commerce/merchant-events.d.cts +101 -0
- package/dist/lib/mysql/schemas/commerce/merchant-events.d.ts +101 -0
- package/dist/lib/mysql/schemas/commerce/merchant-events.js +11 -0
- package/dist/lib/mysql/schemas/commerce/merchant-events.js.map +1 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +12 -12
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.js +12 -12
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.js +12 -12
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +3 -2
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +2 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +2 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +13 -13
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +5 -3
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +2 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +2 -1
- package/dist/lib/mysql/schemas/commerce/purchase.js +12 -12
- package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/subscription.js +12 -12
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +13 -13
- package/dist/lib/mysql/schemas/communication/comment.cjs +3 -2
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/comment.d.cts +2 -1
- package/dist/lib/mysql/schemas/communication/comment.d.ts +2 -1
- package/dist/lib/mysql/schemas/communication/comment.js +12 -12
- package/dist/lib/mysql/schemas/communication/communication-channel.js +2 -2
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +2 -2
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +3 -2
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +2 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +2 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +12 -12
- package/dist/lib/mysql/schemas/communication/question-response.cjs +351 -0
- package/dist/lib/mysql/schemas/communication/question-response.cjs.map +1 -0
- package/dist/lib/mysql/schemas/communication/question-response.d.cts +200 -0
- package/dist/lib/mysql/schemas/communication/question-response.d.ts +200 -0
- package/dist/lib/mysql/schemas/communication/question-response.js +21 -0
- package/dist/lib/mysql/schemas/communication/question-response.js.map +1 -0
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +11 -3
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +2 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +2 -1
- package/dist/lib/mysql/schemas/content/content-contributions.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +8 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +8 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +8 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs +11 -3
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.d.cts +2 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.d.ts +2 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.js +12 -12
- package/dist/lib/mysql/schemas/content/content-resource.cjs +11 -3
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +18 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +18 -1
- package/dist/lib/mysql/schemas/content/content-resource.js +12 -12
- package/dist/lib/mysql/schemas/content/contribution-types.js +2 -2
- package/dist/lib/mysql/schemas/content/lesson-progress.js +2 -2
- package/dist/lib/mysql/schemas/content/resource-progress.js +2 -2
- package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.js +12 -12
- package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag.js +12 -12
- package/dist/lib/mysql/schemas/entitlements/entitlement-type.js +2 -2
- package/dist/lib/mysql/schemas/entitlements/entitlement.cjs +3 -2
- package/dist/lib/mysql/schemas/entitlements/entitlement.cjs.map +1 -1
- package/dist/lib/mysql/schemas/entitlements/entitlement.d.cts +2 -1
- package/dist/lib/mysql/schemas/entitlements/entitlement.d.ts +2 -1
- package/dist/lib/mysql/schemas/entitlements/entitlement.js +13 -13
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js +12 -12
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs +3 -2
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +2 -1
- package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +2 -1
- package/dist/lib/mysql/schemas/org/organization-memberships.js +12 -12
- package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organizations.js +12 -12
- package/dist/lib/mysql/utils.js +1 -1
- package/dist/lib/utils.d.cts +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.js +1 -1
- package/package.json +7 -7
- package/src/lib/mysql/index.ts +1887 -153
- package/src/lib/mysql/schemas/auth/accounts.ts +7 -3
- package/src/lib/mysql/schemas/auth/device-access-token.ts +7 -3
- package/src/lib/mysql/schemas/auth/device-verification.ts +7 -3
- package/src/lib/mysql/schemas/auth/profiles.ts +7 -3
- package/src/lib/mysql/schemas/auth/sessions.ts +7 -3
- package/src/lib/mysql/schemas/auth/user-permissions.ts +7 -3
- package/src/lib/mysql/schemas/auth/user-prefs.ts +7 -3
- package/src/lib/mysql/schemas/auth/user-roles.ts +7 -3
- package/src/lib/mysql/schemas/auth/users.ts +17 -3
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -1
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -1
- package/src/lib/mysql/schemas/commerce/merchant-events.ts +62 -0
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +4 -2
- package/src/lib/mysql/schemas/commerce/purchase.ts +7 -3
- package/src/lib/mysql/schemas/communication/comment.ts +7 -3
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +4 -2
- package/src/lib/mysql/schemas/communication/question-response.ts +90 -0
- package/src/lib/mysql/schemas/content/content-contributions.ts +4 -2
- package/src/lib/mysql/schemas/content/content-resource-version.ts +4 -2
- package/src/lib/mysql/schemas/content/content-resource.ts +13 -3
- package/src/lib/mysql/schemas/entitlements/entitlement.ts +7 -3
- package/src/lib/mysql/schemas/org/organization-memberships.ts +4 -2
- package/dist/chunk-H736K5TN.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mysql/index.ts","../../../../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs","../../../../core/dist/chunk-VLQXSCFN.js","../../../../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs","../../../../core/src/schemas/upgradable-product-schema.ts","../../../../core/src/schemas/video-resource.ts","../../../../core/src/schemas/price-schema.ts","../../../../core/src/schemas/content-resource-schema.ts","../../../../core/src/schemas/product-schema.ts","../../../../core/src/schemas/user-schema.ts","../../../../core/src/schemas/coupon-schema.ts","../../../../core/src/schemas/purchase-schema.ts","../../../../core/src/schemas/purchase-user-transfer-schema.ts","../../../../core/src/schemas/resource-progress-schema.ts","../../../../core/src/schemas/merchant-customer-schema.ts","../../../../core/src/schemas/merchant-price-schema.ts","../../../../core/src/schemas/merchant-product-schema.ts","../../../../core/src/schemas/merchant-charge-schema.ts","../../../../core/src/schemas/merchant-coupon-schema.ts","../../../../core/src/schemas/merchant-account-schema.ts","../../../../core/src/schemas/merchant-session.ts","../../../../core/src/schemas/merchant-subscription.ts","../../../../core/src/schemas/organization-schema.ts","../../../../core/src/schemas/organization-member.ts","../../../../core/src/schemas/subscription.ts","../../../../core/src/errors.ts","../../../../core/src/lib/utils/logger.ts","../../../../core/src/lib/utils/validate-coupon.ts","../../../src/lib/mysql/schemas/auth/accounts.ts","../../../src/lib/mysql/schemas/auth/users.ts","../../../src/lib/mysql/schemas/commerce/purchase.ts","../../../src/lib/mysql/schemas/org/organization-memberships.ts","../../../src/lib/mysql/schemas/org/organization-membership-roles.ts","../../../src/lib/mysql/schemas/auth/roles.ts","../../../src/lib/mysql/schemas/auth/user-roles.ts","../../../src/lib/mysql/schemas/org/organizations.ts","../../../src/lib/mysql/schemas/commerce/subscription.ts","../../../src/lib/mysql/schemas/commerce/merchant-subscription.ts","../../../src/lib/mysql/schemas/commerce/merchant-charge.ts","../../../src/lib/mysql/schemas/commerce/merchant-account.ts","../../../src/lib/mysql/schemas/commerce/merchant-customer.ts","../../../src/lib/mysql/schemas/commerce/merchant-product.ts","../../../src/lib/mysql/schemas/commerce/product.ts","../../../src/lib/mysql/schemas/content/content-resource-product.ts","../../../src/lib/mysql/schemas/content/content-resource.ts","../../../src/lib/mysql/schemas/content/content-contributions.ts","../../../src/lib/mysql/schemas/content/contribution-types.ts","../../../src/lib/mysql/schemas/content/content-resource-resource.ts","../../../src/lib/mysql/schemas/content/content-resource-tag.ts","../../../src/lib/mysql/schemas/content/tag.ts","../../../src/lib/mysql/schemas/content/tag-tag.ts","../../../src/lib/mysql/schemas/content/content-resource-version.ts","../../../src/lib/mysql/schemas/commerce/price.ts","../../../src/lib/mysql/schemas/commerce/merchant-price.ts","../../../src/lib/mysql/schemas/commerce/coupon.ts","../../../src/lib/mysql/schemas/commerce/merchant-coupon.ts","../../../src/lib/mysql/schemas/commerce/merchant-session.ts","../../../src/lib/mysql/schemas/communication/comment.ts","../../../src/lib/mysql/schemas/communication/communication-preferences.ts","../../../src/lib/mysql/schemas/communication/communication-channel.ts","../../../src/lib/mysql/schemas/communication/communication-preference-types.ts","../../../src/lib/mysql/schemas/auth/profiles.ts","../../../src/lib/mysql/schemas/auth/user-permissions.ts","../../../src/lib/mysql/schemas/auth/permissions.ts","../../../src/lib/mysql/schemas/auth/user-prefs.ts","../../../src/lib/mysql/schemas/auth/device-access-token.ts","../../../src/lib/mysql/schemas/auth/device-verification.ts","../../../src/lib/mysql/schemas/auth/role-permissions.ts","../../../src/lib/mysql/schemas/auth/sessions.ts","../../../src/lib/mysql/schemas/auth/verification-tokens.ts","../../../src/lib/mysql/schemas/commerce/purchase-user-transfer.ts","../../../src/lib/mysql/schemas/commerce/upgradable-products.ts","../../../src/lib/mysql/schemas/content/lesson-progress.ts","../../../src/lib/mysql/schemas/content/resource-progress.ts","../../../src/lib/mysql/schemas/entitlements/entitlement-type.ts","../../../src/lib/mysql/schemas/entitlements/entitlement.ts"],"sourcesContent":["import type { AdapterSession, AdapterUser } from '@auth/core/adapters'\nimport slugify from '@sindresorhus/slugify'\nimport { addSeconds, isAfter } from 'date-fns'\nimport {\n\tand,\n\tasc,\n\tcount,\n\tdesc,\n\teq,\n\tgte,\n\tinArray,\n\tisNotNull,\n\tisNull,\n\tnot,\n\tor,\n\tsql,\n} from 'drizzle-orm'\nimport {\n\tmysqlTable as defaultMySqlTableFn,\n\tMySqlDatabase,\n\tMySqlTableFn,\n} from 'drizzle-orm/mysql-core'\nimport { customAlphabet } from 'nanoid'\nimport { v4 } from 'uuid'\nimport { z } from 'zod'\n\nimport { type CourseBuilderAdapter } from '@coursebuilder/core/adapters'\nimport {\n\tCoupon,\n\tcouponSchema,\n\tMerchantCharge,\n\tmerchantChargeSchema,\n\tMerchantCoupon,\n\tmerchantCouponSchema,\n\tMerchantCustomer,\n\tmerchantPriceSchema,\n\tMerchantProduct,\n\tmerchantProductSchema,\n\tNewProduct,\n\tPrice,\n\tpriceSchema,\n\tProduct,\n\tproductSchema,\n\tPurchase,\n\tpurchaseSchema,\n\tPurchaseUserTransfer,\n\tpurchaseUserTransferSchema,\n\tPurchaseUserTransferState,\n\tResourceProgress,\n\tresourceProgressSchema,\n\tUpgradableProduct,\n\tupgradableProductSchema,\n\tUser,\n\tuserSchema,\n} from '@coursebuilder/core/schemas'\nimport {\n\tContentResourceProductSchema,\n\tContentResourceResourceSchema,\n\tContentResourceSchema,\n\ttype ContentResource,\n} from '@coursebuilder/core/schemas/content-resource-schema'\nimport { merchantAccountSchema } from '@coursebuilder/core/schemas/merchant-account-schema'\nimport { merchantCustomerSchema } from '@coursebuilder/core/schemas/merchant-customer-schema'\nimport {\n\tMerchantSession,\n\tMerchantSessionSchema,\n} from '@coursebuilder/core/schemas/merchant-session'\nimport { MerchantSubscriptionSchema } from '@coursebuilder/core/schemas/merchant-subscription'\nimport { OrganizationMemberSchema } from '@coursebuilder/core/schemas/organization-member'\nimport { OrganizationSchema } from '@coursebuilder/core/schemas/organization-schema'\nimport { type ModuleProgress } from '@coursebuilder/core/schemas/resource-progress-schema'\nimport { SubscriptionSchema } from '@coursebuilder/core/schemas/subscription'\nimport { VideoResourceSchema } from '@coursebuilder/core/schemas/video-resource'\nimport { PaymentsProviderConfig } from '@coursebuilder/core/types'\nimport { logger } from '@coursebuilder/core/utils/logger'\nimport { validateCoupon } from '@coursebuilder/core/utils/validate-coupon'\n\nimport {\n\tgetAccountsRelationsSchema,\n\tgetAccountsSchema,\n} from './schemas/auth/accounts.js'\nimport {\n\tgetDeviceAccessTokenRelationsSchema,\n\tgetDeviceAccessTokenSchema,\n} from './schemas/auth/device-access-token.js'\nimport {\n\tgetDeviceVerificationRelationsSchema,\n\tgetDeviceVerificationSchema,\n} from './schemas/auth/device-verification.js'\nimport {\n\tgetPermissionsRelationsSchema,\n\tgetPermissionsSchema,\n} from './schemas/auth/permissions.js'\nimport {\n\tgetProfilesRelationsSchema,\n\tgetProfilesSchema,\n} from './schemas/auth/profiles.js'\nimport {\n\tgetRolePermissionsRelationsSchema,\n\tgetRolePermissionsSchema,\n} from './schemas/auth/role-permissions.js'\nimport {\n\tgetRolesRelationsSchema,\n\tgetRolesSchema,\n} from './schemas/auth/roles.js'\nimport {\n\tgetSessionRelationsSchema,\n\tgetSessionsSchema,\n} from './schemas/auth/sessions.js'\nimport {\n\tgetUserPermissionsRelationsSchema,\n\tgetUserPermissionsSchema,\n} from './schemas/auth/user-permissions.js'\nimport {\n\tgetUserPrefsRelationsSchema,\n\tgetUserPrefsSchema,\n} from './schemas/auth/user-prefs.js'\nimport {\n\tgetUserRolesRelationsSchema,\n\tgetUserRolesSchema,\n} from './schemas/auth/user-roles.js'\nimport {\n\tgetUsersRelationsSchema,\n\tgetUsersSchema,\n} from './schemas/auth/users.js'\nimport { getVerificationTokensSchema } from './schemas/auth/verification-tokens.js'\nimport {\n\tgetCouponRelationsSchema,\n\tgetCouponSchema,\n} from './schemas/commerce/coupon.js'\nimport { getMerchantAccountSchema } from './schemas/commerce/merchant-account.js'\nimport {\n\tgetMerchantChargeRelationsSchema,\n\tgetMerchantChargeSchema,\n} from './schemas/commerce/merchant-charge.js'\nimport { getMerchantCouponSchema } from './schemas/commerce/merchant-coupon.js'\nimport { getMerchantCustomerSchema } from './schemas/commerce/merchant-customer.js'\nimport { getMerchantPriceSchema } from './schemas/commerce/merchant-price.js'\nimport { getMerchantProductSchema } from './schemas/commerce/merchant-product.js'\nimport { getMerchantSessionSchema } from './schemas/commerce/merchant-session.js'\nimport {\n\tgetMerchantSubscriptionRelationsSchema,\n\tgetMerchantSubscriptionSchema,\n} from './schemas/commerce/merchant-subscription.js'\nimport { getPriceSchema } from './schemas/commerce/price.js'\nimport {\n\tgetProductRelationsSchema,\n\tgetProductSchema,\n} from './schemas/commerce/product.js'\nimport {\n\tgetPurchaseUserTransferRelationsSchema,\n\tgetPurchaseUserTransferSchema,\n} from './schemas/commerce/purchase-user-transfer.js'\nimport {\n\tgetPurchaseRelationsSchema,\n\tgetPurchaseSchema,\n} from './schemas/commerce/purchase.js'\nimport {\n\tgetSubscriptionRelationsSchema,\n\tgetSubscriptionSchema,\n} from './schemas/commerce/subscription.js'\nimport {\n\tgetUpgradableProductsRelationsSchema,\n\tgetUpgradableProductsSchema,\n} from './schemas/commerce/upgradable-products.js'\nimport {\n\tgetCommentRelationsSchema,\n\tgetCommentsSchema,\n} from './schemas/communication/comment.js'\nimport { getCommunicationChannelSchema } from './schemas/communication/communication-channel.js'\nimport { getCommunicationPreferenceTypesSchema } from './schemas/communication/communication-preference-types.js'\nimport {\n\tgetCommunicationPreferencesRelationsSchema,\n\tgetCommunicationPreferencesSchema,\n} from './schemas/communication/communication-preferences.js'\nimport {\n\tgetContentContributionRelationsSchema,\n\tgetContentContributionsSchema,\n} from './schemas/content/content-contributions.js'\nimport {\n\tgetContentResourceProductRelationsSchema,\n\tgetContentResourceProductSchema,\n} from './schemas/content/content-resource-product.js'\nimport {\n\tgetContentResourceResourceRelationsSchema,\n\tgetContentResourceResourceSchema,\n} from './schemas/content/content-resource-resource.js'\nimport {\n\tgetContentResourceTagRelationsSchema,\n\tgetContentResourceTagSchema,\n} from './schemas/content/content-resource-tag.js'\nimport {\n\tgetContentResourceVersionRelationsSchema,\n\tgetContentResourceVersionSchema,\n} from './schemas/content/content-resource-version.js'\nimport {\n\tgetContentResourceRelationsSchema,\n\tgetContentResourceSchema,\n} from './schemas/content/content-resource.js'\nimport {\n\tgetContributionTypesRelationsSchema,\n\tgetContributionTypesSchema,\n} from './schemas/content/contribution-types.js'\nimport { getLessonProgressSchema } from './schemas/content/lesson-progress.js'\nimport { getResourceProgressSchema } from './schemas/content/resource-progress.js'\nimport {\n\tgetTagTagRelationsSchema,\n\tgetTagTagSchema,\n} from './schemas/content/tag-tag.js'\nimport { getTagRelationsSchema, getTagSchema } from './schemas/content/tag.js'\nimport { getEntitlementTypesSchema } from './schemas/entitlements/entitlement-type.js'\nimport {\n\tgetEntitlementRelationsSchema,\n\tgetEntitlementsSchema,\n} from './schemas/entitlements/entitlement.js'\nimport {\n\tgetOrganizationMembershipRolesRelationsSchema,\n\tgetOrganizationMembershipRolesSchema,\n} from './schemas/org/organization-membership-roles.js'\nimport {\n\tgetOrganizationMembershipsRelationsSchema,\n\tgetOrganizationMembershipsSchema,\n} from './schemas/org/organization-memberships.js'\nimport {\n\tgetOrganizationsRelationsSchema,\n\tgetOrganizationsSchema,\n} from './schemas/org/organizations.js'\n\nexport const guid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 5)\n\nexport function getCourseBuilderSchema(mysqlTable: MySqlTableFn) {\n\treturn {\n\t\taccounts: getAccountsSchema(mysqlTable),\n\t\taccountsRelations: getAccountsRelationsSchema(mysqlTable),\n\t\tpermissions: getPermissionsSchema(mysqlTable),\n\t\tpermissionsRelations: getPermissionsRelationsSchema(mysqlTable),\n\t\trolePermissions: getRolePermissionsSchema(mysqlTable),\n\t\trolePermissionsRelations: getRolePermissionsRelationsSchema(mysqlTable),\n\t\troles: getRolesSchema(mysqlTable),\n\t\trolesRelations: getRolesRelationsSchema(mysqlTable),\n\t\tsessions: getSessionsSchema(mysqlTable),\n\t\tsessionsRelations: getSessionRelationsSchema(mysqlTable),\n\t\tuserPermissions: getUserPermissionsSchema(mysqlTable),\n\t\tuserPermissionsRelations: getUserPermissionsRelationsSchema(mysqlTable),\n\t\tuserRoles: getUserRolesSchema(mysqlTable),\n\t\tuserRolesRelations: getUserRolesRelationsSchema(mysqlTable),\n\t\tusers: getUsersSchema(mysqlTable),\n\t\tusersRelations: getUsersRelationsSchema(mysqlTable),\n\t\tverificationTokens: getVerificationTokensSchema(mysqlTable),\n\t\tcoupon: getCouponSchema(mysqlTable),\n\t\tcouponRelations: getCouponRelationsSchema(mysqlTable),\n\t\tlessonProgress: getLessonProgressSchema(mysqlTable),\n\t\tmerchantAccount: getMerchantAccountSchema(mysqlTable),\n\t\tmerchantCharge: getMerchantChargeSchema(mysqlTable),\n\t\tmerchantChargeRelations: getMerchantChargeRelationsSchema(mysqlTable),\n\t\tmerchantCoupon: getMerchantCouponSchema(mysqlTable),\n\t\tmerchantCustomer: getMerchantCustomerSchema(mysqlTable),\n\t\tmerchantPrice: getMerchantPriceSchema(mysqlTable),\n\t\tmerchantProduct: getMerchantProductSchema(mysqlTable),\n\t\tmerchantSession: getMerchantSessionSchema(mysqlTable),\n\t\tprices: getPriceSchema(mysqlTable),\n\t\tproducts: getProductSchema(mysqlTable),\n\t\tpurchases: getPurchaseSchema(mysqlTable),\n\t\tpurchaseRelations: getPurchaseRelationsSchema(mysqlTable),\n\t\tpurchaseUserTransfer: getPurchaseUserTransferSchema(mysqlTable),\n\t\tpurchaseUserTransferRelations:\n\t\t\tgetPurchaseUserTransferRelationsSchema(mysqlTable),\n\t\tcommunicationChannel: getCommunicationChannelSchema(mysqlTable),\n\t\tcommunicationPreferenceTypes:\n\t\t\tgetCommunicationPreferenceTypesSchema(mysqlTable),\n\t\tcommunicationPreferences: getCommunicationPreferencesSchema(mysqlTable),\n\t\tcommunicationPreferencesRelations:\n\t\t\tgetCommunicationPreferencesRelationsSchema(mysqlTable),\n\t\tcontentContributions: getContentContributionsSchema(mysqlTable),\n\t\tcontentContributionRelations:\n\t\t\tgetContentContributionRelationsSchema(mysqlTable),\n\t\tcontentResource: getContentResourceSchema(mysqlTable),\n\t\tcontentResourceVersion: getContentResourceVersionSchema(mysqlTable),\n\t\tcontentResourceVersionRelations:\n\t\t\tgetContentResourceVersionRelationsSchema(mysqlTable),\n\t\tcontentResourceRelations: getContentResourceRelationsSchema(mysqlTable),\n\t\tcontentResourceResource: getContentResourceResourceSchema(mysqlTable),\n\t\tcontentResourceResourceRelations:\n\t\t\tgetContentResourceResourceRelationsSchema(mysqlTable),\n\t\tcontentResourceTag: getContentResourceTagSchema(mysqlTable),\n\t\tcontentResourceTagRelations:\n\t\t\tgetContentResourceTagRelationsSchema(mysqlTable),\n\t\tcontributionTypes: getContributionTypesSchema(mysqlTable),\n\t\tcontributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),\n\t\tresourceProgress: getResourceProgressSchema(mysqlTable),\n\t\tupgradableProducts: getUpgradableProductsSchema(mysqlTable),\n\t\tupgradableProductsRelations:\n\t\t\tgetUpgradableProductsRelationsSchema(mysqlTable),\n\t\tcontentResourceProduct: getContentResourceProductSchema(mysqlTable),\n\t\tcontentResourceProductRelations:\n\t\t\tgetContentResourceProductRelationsSchema(mysqlTable),\n\t\tproductRelations: getProductRelationsSchema(mysqlTable),\n\t\tcomments: getCommentsSchema(mysqlTable),\n\t\tcommentsRelations: getCommentRelationsSchema(mysqlTable),\n\t\tdeviceVerifications: getDeviceVerificationSchema(mysqlTable),\n\t\tdeviceVerificationRelations:\n\t\t\tgetDeviceVerificationRelationsSchema(mysqlTable),\n\t\tdeviceAccessToken: getDeviceAccessTokenSchema(mysqlTable),\n\t\tdeviceAccessTokenRelations: getDeviceAccessTokenRelationsSchema(mysqlTable),\n\t\ttag: getTagSchema(mysqlTable),\n\t\ttagRelations: getTagRelationsSchema(mysqlTable),\n\t\ttagTag: getTagTagSchema(mysqlTable),\n\t\ttagTagRelations: getTagTagRelationsSchema(mysqlTable),\n\t\tuserPrefs: getUserPrefsSchema(mysqlTable),\n\t\tuserPrefsRelations: getUserPrefsRelationsSchema(mysqlTable),\n\t\torganization: getOrganizationsSchema(mysqlTable),\n\t\torganizationRelations: getOrganizationsRelationsSchema(mysqlTable),\n\t\torganizationMemberships: getOrganizationMembershipsSchema(mysqlTable),\n\t\torganizationMembershipRelations:\n\t\t\tgetOrganizationMembershipsRelationsSchema(mysqlTable),\n\t\torganizationMembershipRoles:\n\t\t\tgetOrganizationMembershipRolesSchema(mysqlTable),\n\t\torganizationMembershipRolesRelations:\n\t\t\tgetOrganizationMembershipRolesRelationsSchema(mysqlTable),\n\t\tmerchantSubscription: getMerchantSubscriptionSchema(mysqlTable),\n\t\tmerchantSubscriptionRelations:\n\t\t\tgetMerchantSubscriptionRelationsSchema(mysqlTable),\n\t\tsubscription: getSubscriptionSchema(mysqlTable),\n\t\tsubscriptionRelations: getSubscriptionRelationsSchema(mysqlTable),\n\t\tprofiles: getProfilesSchema(mysqlTable),\n\t\tprofilesRelations: getProfilesRelationsSchema(mysqlTable),\n\t\tentitlementTypes: getEntitlementTypesSchema(mysqlTable),\n\t\tentitlements: getEntitlementsSchema(mysqlTable),\n\t\tentitlementsRelations: getEntitlementRelationsSchema(mysqlTable),\n\t} as const\n}\n\nexport function createTables(mySqlTable: MySqlTableFn) {\n\treturn getCourseBuilderSchema(mySqlTable)\n}\n\nexport type DefaultSchema = ReturnType<typeof createTables>\n\nexport function mySqlDrizzleAdapter(\n\tclient: InstanceType<typeof MySqlDatabase>,\n\ttableFn = defaultMySqlTableFn,\n\tpaymentProvider?: PaymentsProviderConfig,\n): CourseBuilderAdapter<typeof MySqlDatabase> {\n\tconst {\n\t\tusers,\n\t\taccounts,\n\t\tsessions,\n\t\tverificationTokens,\n\t\tcontentResource,\n\t\tcontentResourceResource,\n\t\tcontentResourceProduct,\n\t\tpurchases: purchaseTable,\n\t\tpurchaseUserTransfer,\n\t\tcoupon,\n\t\tmerchantCoupon,\n\t\tmerchantCharge,\n\t\tmerchantAccount,\n\t\tmerchantPrice,\n\t\tmerchantCustomer,\n\t\tmerchantSession,\n\t\tmerchantProduct,\n\t\tprices,\n\t\tproducts,\n\t\tupgradableProducts,\n\t\tresourceProgress,\n\t\tcomments,\n\t\torganization: organizationTable,\n\t\torganizationMemberships: organizationMembershipTable,\n\t\torganizationMembershipRoles: organizationMembershipRoleTable,\n\t\troles: roleTable,\n\t\tmerchantSubscription: merchantSubscriptionTable,\n\t\tsubscription: subscriptionTable,\n\t} = createTables(tableFn)\n\n\tconst adapter: CourseBuilderAdapter = {\n\t\tclient,\n\t\tasync redeemFullPriceCoupon(options) {\n\t\t\tconst {\n\t\t\t\temail: baseEmail,\n\t\t\t\tcouponId,\n\t\t\t\tproductIds,\n\t\t\t\tcurrentUserId,\n\t\t\t\tredeemingProductId,\n\t\t\t} = options\n\t\t\tconst email = String(baseEmail).replace(' ', '+')\n\n\t\t\tconst coupon = await adapter.getCouponWithBulkPurchases(couponId)\n\n\t\t\tconst productId =\n\t\t\t\t(coupon && (coupon.restrictedToProductId as string)) ||\n\t\t\t\tredeemingProductId\n\n\t\t\tif (!productId) throw new Error(`unable-to-find-any-product-id`)\n\n\t\t\tconst couponValidation = validateCoupon(coupon, productIds)\n\n\t\t\tif (coupon && couponValidation.isRedeemable) {\n\t\t\t\t// if the Coupon is the Bulk Coupon of a Bulk Purchase,\n\t\t\t\t// then a bulk coupon is being redeemed\n\t\t\t\tconst bulkCouponRedemption = Boolean(coupon.maxUses > 1)\n\n\t\t\t\tconst { user } = await adapter.findOrCreateUser(email)\n\n\t\t\t\tif (!user) throw new Error(`unable-to-create-user-${email}`)\n\n\t\t\t\tconst currentUser = currentUserId\n\t\t\t\t\t? await adapter.getUserById(currentUserId)\n\t\t\t\t\t: null\n\n\t\t\t\tconst redeemingForCurrentUser = currentUser?.id === user.id\n\n\t\t\t\t// To prevent double-purchasing, check if this user already has a\n\t\t\t\t// Purchase record for this product that is valid and wasn't a bulk\n\t\t\t\t// coupon purchase.\n\t\t\t\tconst existingPurchases =\n\t\t\t\t\tawait adapter.getExistingNonBulkValidPurchasesOfProduct({\n\t\t\t\t\t\tuserId: user.id,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t})\n\n\t\t\t\tif (existingPurchases.length > 0) {\n\t\t\t\t\tconst errorMessage = `already-purchased-${email}`\n\t\t\t\t\tconsole.error(errorMessage)\n\t\t\t\t\treturn {\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tredeemingForCurrentUser,\n\t\t\t\t\t\tpurchase: null,\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(errorMessage)\n\t\t\t\t}\n\n\t\t\t\tconst purchaseId = `purchase-${v4()}`\n\t\t\t\tconst userMemberships = await adapter.getMembershipsForUser(user.id)\n\t\t\t\tconst organizationId =\n\t\t\t\t\tcoupon.organizationId ||\n\t\t\t\t\tuserMemberships.find((m) => m.organization.name?.includes(user.email))\n\t\t\t\t\t\t?.organizationId // safer way to make sure we are using personal organization\n\n\t\t\t\tawait adapter.createPurchase({\n\t\t\t\t\tid: purchaseId,\n\t\t\t\t\tuserId: user.id,\n\t\t\t\t\tcouponId: bulkCouponRedemption ? null : coupon.id,\n\t\t\t\t\tredeemedBulkCouponId: bulkCouponRedemption ? coupon.id : null,\n\t\t\t\t\tproductId,\n\t\t\t\t\ttotalAmount: '0',\n\t\t\t\t\torganizationId,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tcouponUsedId: bulkCouponRedemption ? null : coupon.id,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst newPurchase = await adapter.getPurchase(purchaseId)\n\n\t\t\t\tawait adapter.incrementCouponUsedCount(coupon.id)\n\n\t\t\t\tawait adapter.createPurchaseTransfer({\n\t\t\t\t\tsourceUserId: user.id,\n\t\t\t\t\tpurchaseId: purchaseId,\n\t\t\t\t\texpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7),\n\t\t\t\t})\n\n\t\t\t\treturn { purchase: newPurchase, redeemingForCurrentUser }\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tcreatePurchaseTransfer: async (options) => {\n\t\t\tconst id = `put_${v4()}`\n\t\t\tawait client.insert(purchaseUserTransfer).values({\n\t\t\t\tid,\n\t\t\t\tpurchaseId: options.purchaseId,\n\t\t\t\tsourceUserId: options.sourceUserId,\n\t\t\t\texpiresAt: options.expiresAt,\n\t\t\t})\n\t\t},\n\t\tincrementCouponUsedCount: async (couponId) => {\n\t\t\tawait client\n\t\t\t\t.update(coupon)\n\t\t\t\t.set({ usedCount: sql`${coupon.usedCount} + 1` })\n\t\t\t\t.where(eq(coupon.id, couponId))\n\t\t},\n\t\tgetExistingNonBulkValidPurchasesOfProduct: async ({\n\t\t\tuserId,\n\t\t\tproductId,\n\t\t}) => {\n\t\t\tconst existingPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tproductId ? eq(purchaseTable.productId, productId) : undefined,\n\t\t\t\t\teq(purchaseTable.status, 'Valid'),\n\t\t\t\t\tisNull(purchaseTable.bulkCouponId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\treturn z.array(purchaseSchema).parse(existingPurchases)\n\t\t},\n\t\tcreateMerchantCustomer: async (options) => {\n\t\t\tawait client.insert(merchantCustomer).values({\n\t\t\t\tid: `mc_${v4()}`,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\tuserId: options.userId,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\t\t\treturn merchantCustomerSchema.parse(\n\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\twhere: eq(merchantCustomer.identifier, options.identifier),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantAccount: async (options) => {\n\t\t\treturn merchantAccountSchema.parse(\n\t\t\t\tawait client.query.merchantAccount.findFirst({\n\t\t\t\t\twhere: eq(merchantAccount.label, options.provider),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantPriceForProductId: async (productId) => {\n\t\t\tconst merchantPriceData = await client.query.merchantPrice.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(merchantPrice.merchantProductId, productId),\n\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsedMerchantPrice =\n\t\t\t\tmerchantPriceSchema.safeParse(merchantPriceData)\n\n\t\t\tif (!parsedMerchantPrice.success) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error parsing merchant price',\n\t\t\t\t\tJSON.stringify(parsedMerchantPrice.error),\n\t\t\t\t)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedMerchantPrice.data\n\t\t},\n\t\tgetMerchantProductForProductId: async (productId) => {\n\t\t\tconst merchantProductData = await client.query.merchantProduct.findFirst({\n\t\t\t\twhere: eq(merchantProduct.productId, productId),\n\t\t\t})\n\n\t\t\tif (!merchantProductData) return null\n\t\t\treturn merchantProductSchema.parse(merchantProductData)\n\t\t},\n\t\tgetMerchantCustomerForUserId: async (userId) => {\n\t\t\tconst merchantCustomerData =\n\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\twhere: eq(merchantCustomer.userId, userId),\n\t\t\t\t})\n\n\t\t\tif (!merchantCustomerData) return null\n\t\t\treturn merchantCustomerSchema.parse(merchantCustomerData)\n\t\t},\n\t\tgetUpgradableProducts: async (options) => {\n\t\t\tconst { upgradableFromId, upgradableToId } = options\n\t\t\treturn z.array(upgradableProductSchema).parse(\n\t\t\t\tawait client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(upgradableProducts.upgradableFromId, upgradableFromId),\n\t\t\t\t\t\teq(upgradableProducts.upgradableToId, upgradableToId),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync availableUpgradesForProduct(\n\t\t\tpurchases: any,\n\t\t\tproductId: string,\n\t\t): Promise<any[]> {\n\t\t\tconst previousPurchaseProductIds = purchases.map(\n\t\t\t\t({ productId }: Purchase) => productId,\n\t\t\t)\n\n\t\t\tif (previousPurchaseProductIds.length > 0) {\n\t\t\t\treturn client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(upgradableProducts.upgradableToId, productId),\n\t\t\t\t\t\tinArray(\n\t\t\t\t\t\t\tupgradableProducts.upgradableFromId,\n\t\t\t\t\t\t\tpreviousPurchaseProductIds,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn []\n\t\t},\n\t\tclearLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessons: { id: string; slug: string }[]\n\t\t}): Promise<void> {\n\t\t\tthrow new Error('clearLessonProgressForUser Method not implemented.')\n\t\t},\n\t\tasync completeLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessonId?: string\n\t\t}): Promise<ResourceProgress | null> {\n\t\t\tif (!options.lessonId) {\n\t\t\t\tthrow new Error('No lessonId provided')\n\t\t\t}\n\n\t\t\tlet lessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst now = new Date()\n\n\t\t\tif (lessonProgress) {\n\t\t\t\tif (!lessonProgress.completedAt) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(resourceProgress)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\t\t\tupdatedAt: now,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(resourceProgress.resourceId, options.lessonId))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait client.insert(resourceProgress).values({\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t\tresourceId: options.lessonId,\n\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t})\n\t\t\t}\n\t\t\tlessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\t\t\tconst parsedLessonProgress =\n\t\t\t\tresourceProgressSchema.safeParse(lessonProgress)\n\n\t\t\tif (!parsedLessonProgress.success) {\n\t\t\t\tconsole.error('Error parsing lesson progress', lessonProgress)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedLessonProgress.data\n\t\t},\n\t\tasync couponForIdOrCode(options: {\n\t\t\tcode?: string\n\t\t\tcouponId?: string\n\t\t}): Promise<(Coupon & { merchantCoupon: MerchantCoupon }) | null> {\n\t\t\tif (!options.couponId && !options.code) return null\n\t\t\tconst couponForIdOrCode = await client.query.coupon.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\tand(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\toptions.code ? eq(coupon.code, options.code) : undefined,\n\t\t\t\t\t\t\toptions.couponId ? eq(coupon.id, options.couponId) : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tgte(coupon.expires, new Date()),\n\t\t\t\t\t),\n\t\t\t\t\tand(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\toptions.code ? eq(coupon.code, options.code) : undefined,\n\t\t\t\t\t\t\toptions.couponId ? eq(coupon.id, options.couponId) : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tisNull(coupon.expires),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tmerchantCoupon: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (!couponForIdOrCode) return null\n\n\t\t\tconst parsedCoupon = couponSchema\n\t\t\t\t.extend({\n\t\t\t\t\tmerchantCoupon: merchantCouponSchema,\n\t\t\t\t})\n\t\t\t\t.safeParse(couponForIdOrCode)\n\n\t\t\tif (!parsedCoupon.success) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error parsing coupon',\n\t\t\t\t\tJSON.stringify(parsedCoupon.error),\n\t\t\t\t)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedCoupon.data\n\t\t},\n\t\tasync createMerchantSession(options): Promise<MerchantSession> {\n\t\t\tconst id = `ms_${v4()}`\n\t\t\tawait client.insert(merchantSession).values({\n\t\t\t\tid,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\t...(options.organizationId\n\t\t\t\t\t? { organizationId: options.organizationId }\n\t\t\t\t\t: {}),\n\t\t\t})\n\n\t\t\treturn MerchantSessionSchema.parse(\n\t\t\t\tawait client.query.merchantSession.findFirst({\n\t\t\t\t\twhere: eq(merchantSession.id, id),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync createMerchantChargeAndPurchase(options): Promise<Purchase> {\n\t\t\tconst purchaseId = await client.transaction(async (trx) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tstripeChargeId,\n\t\t\t\t\t\tstripeCouponId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t\tmerchantProductId,\n\t\t\t\t\t\tmerchantCustomerId,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t\tstripeChargeAmount,\n\t\t\t\t\t\tquantity = 1,\n\t\t\t\t\t\tcheckoutSessionId,\n\t\t\t\t\t\tappliedPPPStripeCouponId,\n\t\t\t\t\t\tupgradedFromPurchaseId,\n\t\t\t\t\t\tcountry,\n\t\t\t\t\t\tusedCouponId,\n\t\t\t\t\t\torganizationId,\n\t\t\t\t\t} = options\n\n\t\t\t\t\tconst existingMerchantCharge = merchantChargeSchema.nullable().parse(\n\t\t\t\t\t\t(await client.query.merchantCharge.findFirst({\n\t\t\t\t\t\t\twhere: eq(merchantCharge.identifier, stripeChargeId),\n\t\t\t\t\t\t})) || null,\n\t\t\t\t\t)\n\n\t\t\t\t\tconst existingPurchaseForCharge = existingMerchantCharge\n\t\t\t\t\t\t? await client.query.purchases.findFirst({\n\t\t\t\t\t\t\t\twhere: eq(\n\t\t\t\t\t\t\t\t\tpurchaseTable.merchantChargeId,\n\t\t\t\t\t\t\t\t\texistingMerchantCharge.id,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tif (existingPurchaseForCharge) {\n\t\t\t\t\t\treturn existingPurchaseForCharge.id\n\t\t\t\t\t}\n\n\t\t\t\t\tconst merchantChargeId = `mc_${v4()}`\n\t\t\t\t\tconst purchaseId = `purch_${v4()}`\n\n\t\t\t\t\tconst newMerchantCharge = await client.insert(merchantCharge).values({\n\t\t\t\t\t\tid: merchantChargeId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tidentifier: stripeChargeId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t\tmerchantProductId,\n\t\t\t\t\t\tmerchantCustomerId,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst existingPurchase = purchaseSchema.nullable().parse(\n\t\t\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\t\teq(purchaseTable.productId, productId),\n\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t})) || null,\n\t\t\t\t\t)\n\n\t\t\t\t\tconst existingBulkCoupon = couponSchema.nullable().parse(\n\t\t\t\t\t\tawait client\n\t\t\t\t\t\t\t.select()\n\t\t\t\t\t\t\t.from(coupon)\n\t\t\t\t\t\t\t.leftJoin(\n\t\t\t\t\t\t\t\tpurchaseTable,\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(coupon.id, purchaseTable.bulkCouponId),\n\t\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(coupon.restrictedToProductId, productId),\n\t\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.then((res) => {\n\t\t\t\t\t\t\t\treturn res[0]?.Coupon ?? null\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst isBulkPurchase =\n\t\t\t\t\t\tquantity > 1 ||\n\t\t\t\t\t\tBoolean(existingBulkCoupon) ||\n\t\t\t\t\t\toptions.bulk ||\n\t\t\t\t\t\tBoolean(existingPurchase?.status === 'Valid')\n\n\t\t\t\t\tlet bulkCouponId: string | null = null\n\t\t\t\t\tlet couponToUpdate = null\n\n\t\t\t\t\tif (isBulkPurchase) {\n\t\t\t\t\t\tbulkCouponId =\n\t\t\t\t\t\t\texistingBulkCoupon !== null ? existingBulkCoupon.id : v4()\n\n\t\t\t\t\t\tif (existingBulkCoupon !== null) {\n\t\t\t\t\t\t\tcouponToUpdate = await client\n\t\t\t\t\t\t\t\t.update(coupon)\n\t\t\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\t\t\tmaxUses: (existingBulkCoupon?.maxUses || 0) + quantity,\n\t\t\t\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.where(eq(coupon.id, bulkCouponId))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst merchantCouponToUse = stripeCouponId\n\t\t\t\t\t\t\t\t? merchantCouponSchema.nullable().parse(\n\t\t\t\t\t\t\t\t\t\tawait client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\t\t\t\twhere: eq(merchantCoupon.identifier, stripeCouponId),\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: null\n\n\t\t\t\t\t\t\tcouponToUpdate = await client.insert(coupon).values({\n\t\t\t\t\t\t\t\tid: bulkCouponId as string,\n\t\t\t\t\t\t\t\tpercentageDiscount: '1.0',\n\t\t\t\t\t\t\t\trestrictedToProductId: productId,\n\t\t\t\t\t\t\t\tmaxUses: quantity,\n\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t\t\t\t...(merchantCouponToUse\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tmerchantCouponId: merchantCouponToUse.id,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// create a new merchant session\n\t\t\t\t\tconst merchantSessionId = `ms_${v4()}`\n\n\t\t\t\t\tawait client.insert(merchantSession).values({\n\t\t\t\t\t\tid: merchantSessionId,\n\t\t\t\t\t\tidentifier: checkoutSessionId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst merchantCouponUsed = stripeCouponId\n\t\t\t\t\t\t? await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\twhere: eq(merchantCoupon.identifier, stripeCouponId),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tconst pppMerchantCoupon = appliedPPPStripeCouponId\n\t\t\t\t\t\t? await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\t\t\teq(merchantCoupon.identifier, appliedPPPStripeCouponId),\n\t\t\t\t\t\t\t\t\teq(merchantCoupon.type, 'ppp'),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tconst newPurchaseStatus =\n\t\t\t\t\t\tmerchantCouponUsed?.type === 'ppp' || pppMerchantCoupon\n\t\t\t\t\t\t\t? 'Restricted'\n\t\t\t\t\t\t\t: 'Valid'\n\n\t\t\t\t\tawait client.insert(purchaseTable).values({\n\t\t\t\t\t\tid: purchaseId,\n\t\t\t\t\t\tstatus: newPurchaseStatus,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t\tmerchantChargeId,\n\t\t\t\t\t\ttotalAmount: (stripeChargeAmount / 100).toFixed(),\n\t\t\t\t\t\tbulkCouponId,\n\t\t\t\t\t\tmerchantSessionId,\n\t\t\t\t\t\tcountry,\n\t\t\t\t\t\tupgradedFromId: upgradedFromPurchaseId || null,\n\t\t\t\t\t\tcouponId: usedCouponId || null,\n\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst oneWeekInMilliseconds = 1000 * 60 * 60 * 24 * 7\n\n\t\t\t\t\tawait client.insert(purchaseUserTransfer).values({\n\t\t\t\t\t\tid: `put_${v4()}`,\n\t\t\t\t\t\tpurchaseId: purchaseId as string,\n\t\t\t\t\t\texpiresAt: existingPurchase\n\t\t\t\t\t\t\t? new Date()\n\t\t\t\t\t\t\t: new Date(Date.now() + oneWeekInMilliseconds),\n\t\t\t\t\t\tsourceUserId: userId,\n\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t})\n\n\t\t\t\t\t// const result = await Promise.all([\n\t\t\t\t\t// \tnewMerchantCharge,\n\t\t\t\t\t// \tnewPurchase,\n\t\t\t\t\t// \tnewPurchaseUserTransfer,\n\t\t\t\t\t// \tnewMerchantSession,\n\t\t\t\t\t// \t...(couponToUpdate ? [couponToUpdate] : []),\n\t\t\t\t\t// ])\n\t\t\t\t\t//\n\t\t\t\t\t// console.log('result', { result })\n\n\t\t\t\t\treturn purchaseId\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(error)\n\t\t\t\t\ttrx.rollback()\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst parsedPurchase = purchaseSchema.safeParse(\n\t\t\t\tawait client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.id, purchaseId as string),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error parsing purchase',\n\t\t\t\t\tparsedPurchase,\n\t\t\t\t\tJSON.stringify(parsedPurchase, null, 2),\n\t\t\t\t)\n\t\t\t\tthrow new Error('Error parsing purchase')\n\t\t\t}\n\n\t\t\treturn parsedPurchase.data\n\t\t},\n\t\tasync findOrCreateMerchantCustomer(options: {\n\t\t\tuser: User\n\t\t\tidentifier: string\n\t\t\tmerchantAccountId: string\n\t\t}): Promise<MerchantCustomer | null> {\n\t\t\tconst merchantCustomer = merchantCustomerSchema\n\t\t\t\t.nullable()\n\t\t\t\t.optional()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\t\twhere: (merchantCustomer, { eq }) =>\n\t\t\t\t\t\t\teq(merchantCustomer.identifier, options.identifier),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tif (merchantCustomer) {\n\t\t\t\treturn merchantCustomer\n\t\t\t}\n\n\t\t\treturn await adapter.createMerchantCustomer({\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\tuserId: options.user.id,\n\t\t\t})\n\t\t},\n\t\tasync findOrCreateUser(\n\t\t\temail: string,\n\t\t\tname?: string | null,\n\t\t): Promise<{\n\t\t\tuser: User\n\t\t\tisNewUser: boolean\n\t\t}> {\n\t\t\tconst user = await adapter.getUserByEmail?.(email)\n\n\t\t\tif (!user) {\n\t\t\t\tconst newUser = await adapter.createUser?.({\n\t\t\t\t\tid: `u_${v4()}`,\n\t\t\t\t\temail,\n\t\t\t\t\tname,\n\t\t\t\t\temailVerified: null,\n\t\t\t\t})\n\t\t\t\tconsole.log('newUser', { newUser })\n\t\t\t\tif (!newUser) {\n\t\t\t\t\tthrow new Error('Could not create user')\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tuser: newUser as User,\n\t\t\t\t\tisNewUser: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tuser: user as User,\n\t\t\t\tisNewUser: false,\n\t\t\t}\n\t\t},\n\t\tasync getCoupon(couponIdOrCode: string): Promise<Coupon | null> {\n\t\t\tconst loadedCoupon =\n\t\t\t\t(await client.query.coupon.findFirst({\n\t\t\t\t\twhere: or(\n\t\t\t\t\t\teq(coupon.id, couponIdOrCode),\n\t\t\t\t\t\teq(coupon.code, couponIdOrCode),\n\t\t\t\t\t),\n\t\t\t\t})) || null\n\n\t\t\tlogger.debug('loadedCoupon', { loadedCoupon })\n\n\t\t\treturn couponSchema.nullable().parse(loadedCoupon)\n\t\t},\n\t\tasync getPurchasesForBulkCouponId(\n\t\t\tbulkCouponId: string,\n\t\t): Promise<(Purchase & { user: User })[]> {\n\t\t\treturn z.array(purchaseSchema.extend({ user: userSchema })).parse(\n\t\t\t\tawait client.query.purchases.findMany({\n\t\t\t\t\twhere: eq(purchaseTable.bulkCouponId, bulkCouponId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync getCouponWithBulkPurchases(couponId: string): Promise<\n\t\t\t| (Coupon & {\n\t\t\t\t\tbulkPurchases?: Purchase[] | null\n\t\t\t\t\tredeemedBulkCouponPurchases: { bulkCouponId?: string | null }[]\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tlogger.debug('getCouponWithBulkPurchases', { couponId })\n\t\t\tlet couponData\n\t\t\tlet bulkCouponPurchases\n\t\t\ttry {\n\t\t\t\tcouponData =\n\t\t\t\t\t(await client.query.coupon.findFirst({\n\t\t\t\t\t\twhere: eq(coupon.id, couponId),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tbulkPurchases: true,\n\t\t\t\t\t\t\tredeemedBulkCouponPurchases: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t})) || null\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log('getCouponWithBulkPurchases')\n\t\t\t\tlogger.error(e as Error)\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tbulkCouponPurchases = await client.query.purchases.findMany({\n\t\t\t\t\twhere: eq(purchaseTable.redeemedBulkCouponId, couponId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tconsole.log('purchases with redeemedBulkCouponId', bulkCouponPurchases)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log('getCouponWithBulkPurchases')\n\t\t\t\tlogger.error(e as Error)\n\t\t\t}\n\n\t\t\tif (!couponData) {\n\t\t\t\tlogger.debug('getCouponWithBulkPurchases', {\n\t\t\t\t\tcouponId,\n\t\t\t\t\terror: 'no coupon found',\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst couponWithBulkPurchases = {\n\t\t\t\t...couponData,\n\t\t\t\tredeemedBulkCouponPurchases: bulkCouponPurchases || [],\n\t\t\t}\n\n\t\t\tconst parsedCoupon = couponSchema\n\t\t\t\t.merge(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tredeemedBulkCouponPurchases: z.array(purchaseSchema),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(couponWithBulkPurchases)\n\n\t\t\tif (!parsedCoupon.success) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error parsing coupon',\n\t\t\t\t\tJSON.stringify(parsedCoupon.error),\n\t\t\t\t\tcouponData,\n\t\t\t\t)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedCoupon.data\n\t\t},\n\t\tasync getDefaultCoupon(productIds?: string[]): Promise<{\n\t\t\tdefaultMerchantCoupon: MerchantCoupon\n\t\t\tdefaultCoupon: Coupon\n\t\t} | null> {\n\t\t\tconst activeSaleCoupon = await client.query.coupon.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(coupon.status, 1),\n\t\t\t\t\teq(coupon.default, true),\n\t\t\t\t\tgte(coupon.expires, new Date()),\n\t\t\t\t\tor(\n\t\t\t\t\t\tproductIds\n\t\t\t\t\t\t\t? inArray(coupon.restrictedToProductId, productIds)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tisNull(coupon.restrictedToProductId),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\torderBy: desc(coupon.percentageDiscount),\n\t\t\t\twith: {\n\t\t\t\t\tmerchantCoupon: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (activeSaleCoupon) {\n\t\t\t\tconst { restrictedToProductId } = activeSaleCoupon\n\t\t\t\tconst validForProdcutId = restrictedToProductId\n\t\t\t\t\t? productIds?.includes(restrictedToProductId as string)\n\t\t\t\t\t: true\n\n\t\t\t\tconst { merchantCoupon: defaultMerchantCoupon, ...defaultCoupon } =\n\t\t\t\t\tactiveSaleCoupon\n\n\t\t\t\tif (validForProdcutId) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdefaultMerchantCoupon: merchantCouponSchema.parse(\n\t\t\t\t\t\t\tdefaultMerchantCoupon,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdefaultCoupon: couponSchema.parse(defaultCoupon),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tgetLessonProgressCountsByDate(): Promise<\n\t\t\t{\n\t\t\t\tcount: number\n\t\t\t\tcompletedAt: string\n\t\t\t}[]\n\t\t> {\n\t\t\tthrow new Error('getLessonProgressCountsByDate Method not implemented.')\n\t\t},\n\t\tasync getLessonProgressForUser(\n\t\t\tuserId: string,\n\t\t): Promise<ResourceProgress[]> {\n\t\t\tconst userProgress = await client.query.resourceProgress.findMany({\n\t\t\t\twhere: eq(resourceProgress.userId, userId),\n\t\t\t})\n\t\t\tconst parsed = z.array(resourceProgressSchema).safeParse(userProgress)\n\t\t\tif (!parsed.success) {\n\t\t\t\tconsole.error('Error parsing user progress', userProgress)\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn parsed.data\n\t\t},\n\t\tasync getModuleProgressForUser(\n\t\t\tuserIdOrEmail: string,\n\t\t\tmoduleIdOrSlug: string,\n\t\t): Promise<ModuleProgress | null> {\n\t\t\t// First, get the user ID\n\t\t\tconst user = await client.query.users.findFirst({\n\t\t\t\twhere: or(eq(users.id, userIdOrEmail), eq(users.email, userIdOrEmail)),\n\t\t\t\tcolumns: {\n\t\t\t\t\tid: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (!user) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst ResultRowSchema = z.object({\n\t\t\t\tresource_id: z.string(),\n\t\t\t\tresource_type: z.enum(['lesson', 'exercise', 'post']),\n\t\t\t\tresource_slug: z.string().nullable(),\n\t\t\t\tcompleted_at: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.nullable()\n\t\t\t\t\t.transform((val) => (val ? new Date(val) : null)),\n\t\t\t})\n\n\t\t\t// Execute the optimized query\n\t\t\tconst results: any = await client.execute(sql`\n SELECT\n\t\t\t\t\t\tcr.id AS resource_id,\n\t\t\t\t\t\tcr.type AS resource_type,\n\t\t\t\t\t\tcr.fields->>'$.slug' AS resource_slug,\n\t\t\t\t\t\trp.completedAt AS completed_at\n\t\t\t\tFROM\n\t\t\t\t\t\t(SELECT id, fields->>'$.slug' AS slug\n\t\t\t\t\t\t FROM ${contentResource}\n\t\t\t\t\t\t WHERE id = ${moduleIdOrSlug}\n\t\t\t\t\t\t\t\tOR fields->>'$.slug' = ${moduleIdOrSlug}) AS w\n\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\t\tcrr.resourceOfId AS workshop_id,\n\t\t\t\t\t\t\t\tcrr.resourceId,\n\t\t\t\t\t\t\t\tcrr.position\n\t\t\t\t\t\t FROM ${contentResourceResource} crr) AS tlr ON w.id = tlr.workshop_id\n\t\t\t\tLEFT JOIN ${contentResource} sections ON sections.id = tlr.resourceId AND sections.type = 'section'\n\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\t\tcrr.resourceOfId AS section_id,\n\t\t\t\t\t\t\t\tcrr.resourceId AS resource_id,\n\t\t\t\t\t\t\t\tcrr.position AS position_in_section,\n\t\t\t\t\t\t\t\tsection_crr.position AS section_position\n\t\t\t\t\t\t FROM ${contentResourceResource} crr\n\t\t\t\t\t\t JOIN ${contentResourceResource} section_crr ON crr.resourceOfId = section_crr.resourceId) AS sr\n\t\t\t\tON sr.section_id = sections.id\n\t\t\t\tJOIN ${contentResource} cr ON cr.id = COALESCE(sr.resource_id, tlr.resourceId)\n\t\t\t\tLEFT JOIN ${resourceProgress} rp ON rp.resourceId = cr.id\n\t\t\t\t\t\tAND rp.userId = ${user.id}\n\t\t\t\tWHERE\n\t\t\t\t\t\tcr.type IN ('lesson', 'exercise', 'post')\n\n `)\n\t\t\t// Process the results\n\t\t\tconst completedLessons: ResourceProgress[] = []\n\t\t\tlet nextResource: Partial<ContentResource> | null = null\n\t\t\tlet completedLessonsCount = 0\n\t\t\tlet totalLessonsCount = results.rows.length\n\n\t\t\tconst parsedRows = z.array(ResultRowSchema).safeParse(results.rows)\n\n\t\t\tif (!parsedRows.success) {\n\t\t\t\tconsole.error('Error parsing rows', parsedRows.error)\n\t\t\t\treturn {\n\t\t\t\t\tcompletedLessons: [],\n\t\t\t\t\tnextResource: null,\n\t\t\t\t\tpercentCompleted: 0,\n\t\t\t\t\tcompletedLessonsCount: 0,\n\t\t\t\t\ttotalLessonsCount,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const row of parsedRows.data) {\n\t\t\t\tif (row.completed_at) {\n\t\t\t\t\tcompletedLessonsCount++\n\t\t\t\t\tcompletedLessons.push({\n\t\t\t\t\t\tuserId: user.id as string,\n\t\t\t\t\t\tresourceId: row.resource_id,\n\t\t\t\t\t\tcompletedAt: new Date(row.completed_at),\n\t\t\t\t\t\t// Add other fields as needed\n\t\t\t\t\t})\n\t\t\t\t} else if (!nextResource) {\n\t\t\t\t\tnextResource = {\n\t\t\t\t\t\tid: row.resource_id,\n\t\t\t\t\t\ttype: row.resource_type,\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\tslug: row.resource_slug,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst percentCompleted =\n\t\t\t\ttotalLessonsCount > 0\n\t\t\t\t\t? Math.ceil((completedLessonsCount / totalLessonsCount) * 100)\n\t\t\t\t\t: 0\n\n\t\t\treturn {\n\t\t\t\tcompletedLessons,\n\t\t\t\tnextResource,\n\t\t\t\tpercentCompleted,\n\t\t\t\tcompletedLessonsCount,\n\t\t\t\ttotalLessonsCount,\n\t\t\t}\n\t\t},\n\t\tgetLessonProgresses(): Promise<ResourceProgress[]> {\n\t\t\tthrow new Error('getLessonProgresses Method not implemented.')\n\t\t},\n\t\tasync getMerchantCharge(\n\t\t\tmerchantChargeId: string,\n\t\t): Promise<MerchantCharge | null> {\n\t\t\tconst mCharge = await client.query.merchantCharge.findFirst({\n\t\t\t\twhere: eq(merchantCharge.id, merchantChargeId),\n\t\t\t})\n\t\t\tconst parsed = merchantChargeSchema.safeParse(mCharge)\n\t\t\tif (!parsed.success) {\n\t\t\t\tconsole.info('Error parsing merchantCharge', mCharge)\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn parsed.data\n\t\t},\n\t\tasync getMerchantCouponsForTypeAndPercent(params: {\n\t\t\ttype: string\n\t\t\tpercentageDiscount: number\n\t\t}): Promise<MerchantCoupon[]> {\n\t\t\treturn z.array(merchantCouponSchema).parse(\n\t\t\t\tawait client.query.merchantCoupon.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(merchantCoupon.type, params.type),\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\tmerchantCoupon.percentageDiscount,\n\t\t\t\t\t\t\tparams.percentageDiscount.toString(),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync getMerchantCouponForTypeAndPercent(params: {\n\t\t\ttype: string\n\t\t\tpercentageDiscount: number\n\t\t}): Promise<MerchantCoupon | null> {\n\t\t\tconst foundMerchantCoupon = await client.query.merchantCoupon.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(merchantCoupon.type, params.type),\n\t\t\t\t\teq(\n\t\t\t\t\t\tmerchantCoupon.percentageDiscount,\n\t\t\t\t\t\tparams.percentageDiscount.toString(),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsed = merchantCouponSchema\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(foundMerchantCoupon)\n\t\t\tif (parsed.success) {\n\t\t\t\treturn parsed.data\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync getMerchantCoupon(\n\t\t\tmerchantCouponId: string,\n\t\t): Promise<MerchantCoupon | null> {\n\t\t\tconst foundMerchantCoupon = await client.query.merchantCoupon.findFirst({\n\t\t\t\twhere: eq(merchantCoupon.id, merchantCouponId),\n\t\t\t})\n\n\t\t\tconst parsed = merchantCouponSchema\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(foundMerchantCoupon)\n\t\t\tif (parsed.success) {\n\t\t\t\treturn parsed.data\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync getMerchantProduct(\n\t\t\tstripeProductId: string,\n\t\t): Promise<MerchantProduct | null> {\n\t\t\treturn merchantProductSchema.nullable().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: eq(merchantProduct.identifier, stripeProductId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetPrice(productId: string): Promise<Price | null> {\n\t\t\tthrow new Error('getPrice not implemented.')\n\t\t},\n\t\tasync getPriceForProduct(productId: string): Promise<Price | null> {\n\t\t\treturn priceSchema.nullable().parse(\n\t\t\t\tawait client.query.prices.findFirst({\n\t\t\t\t\twhere: eq(prices.productId, productId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync archiveProduct(productId) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst product = await adapter.getProduct(productId)\n\n\t\t\tif (!product) {\n\t\t\t\tthrow new Error(`Product not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tif (!product.price) {\n\t\t\t\tthrow new Error(`Product has no price`)\n\t\t\t}\n\n\t\t\tawait client\n\t\t\t\t.update(products)\n\t\t\t\t.set({ status: 0, name: `${product.name} (Archived)` })\n\t\t\t\t.where(eq(products.id, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(prices)\n\t\t\t\t.set({ status: 0, nickname: `${product.name} (Archived)` })\n\t\t\t\t.where(eq(prices.productId, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(merchantProduct)\n\t\t\t\t.set({ status: 0 })\n\t\t\t\t.where(eq(merchantProduct.productId, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(merchantPrice)\n\t\t\t\t.set({ status: 0 })\n\t\t\t\t.where(eq(merchantPrice.priceId, product.price.id))\n\n\t\t\tconst currentMerchantProduct = merchantProductSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: eq(merchantProduct.productId, productId),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!currentMerchantProduct || !currentMerchantProduct.identifier) {\n\t\t\t\tthrow new Error(`Merchant product not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tawait paymentProvider.updateProduct(currentMerchantProduct.identifier, {\n\t\t\t\tactive: false,\n\t\t\t})\n\n\t\t\tconst currentMerchantPrice = merchantPriceSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantPrice.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(merchantPrice.priceId, product.price.id),\n\t\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!currentMerchantPrice || !currentMerchantPrice.identifier) {\n\t\t\t\tthrow new Error(`Merchant price not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tawait paymentProvider.updatePrice(currentMerchantPrice.identifier, {\n\t\t\t\tactive: false,\n\t\t\t})\n\n\t\t\treturn adapter.getProduct(productId)\n\t\t},\n\t\tasync updateProduct(input: Product) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst currentProduct = await adapter.getProduct(input.id)\n\t\t\tif (!currentProduct) {\n\t\t\t\tthrow new Error(`Product not found`)\n\t\t\t}\n\t\t\tif (!currentProduct.price) {\n\t\t\t\tthrow new Error(`Product has no price`)\n\t\t\t}\n\n\t\t\tconst merchantProduct = merchantProductSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: (merchantProduct, { eq }) =>\n\t\t\t\t\t\teq(merchantProduct.productId, input.id),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantProduct || !merchantProduct.identifier) {\n\t\t\t\tthrow new Error(`Merchant product not found`)\n\t\t\t}\n\n\t\t\t// TODO: handle upgrades\n\n\t\t\tconst stripeProduct = await paymentProvider.getProduct(\n\t\t\t\tmerchantProduct.identifier,\n\t\t\t)\n\n\t\t\tconst priceChanged =\n\t\t\t\tcurrentProduct.price.unitAmount.toString() !==\n\t\t\t\tinput.price?.unitAmount.toString()\n\n\t\t\tif (priceChanged) {\n\t\t\t\tconst currentMerchantPrice = merchantPriceSchema.nullish().parse(\n\t\t\t\t\tawait client.query.merchantPrice.findFirst({\n\t\t\t\t\t\twhere: (merchantPrice, { eq, and }) =>\n\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\teq(merchantPrice.merchantProductId, merchantProduct.id),\n\t\t\t\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\t\tif (!currentMerchantPrice || !currentMerchantPrice.identifier) {\n\t\t\t\t\tthrow new Error(`Merchant price not found`)\n\t\t\t\t}\n\n\t\t\t\tconst currentStripePrice = await paymentProvider.getPrice(\n\t\t\t\t\tcurrentMerchantPrice.identifier,\n\t\t\t\t)\n\n\t\t\t\tconst newStripePrice = await paymentProvider.createPrice({\n\t\t\t\t\tproduct: stripeProduct.id,\n\t\t\t\t\tunit_amount: Math.floor(Number(input.price?.unitAmount || 0) * 100),\n\t\t\t\t\tcurrency: 'usd',\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tslug: input.fields.slug,\n\t\t\t\t\t},\n\t\t\t\t\tactive: true,\n\t\t\t\t})\n\n\t\t\t\tawait paymentProvider.updateProduct(stripeProduct.id, {\n\t\t\t\t\tdefault_price: newStripePrice.id,\n\t\t\t\t})\n\n\t\t\t\tconst newMerchantPriceId = `mprice_${v4()}`\n\t\t\t\tawait client.insert(merchantPrice).values({\n\t\t\t\t\tid: newMerchantPriceId,\n\t\t\t\t\tmerchantProductId: merchantProduct.id,\n\t\t\t\t\tmerchantAccountId: merchantProduct.merchantAccountId,\n\t\t\t\t\tpriceId: currentProduct.price.id,\n\t\t\t\t\tstatus: 1,\n\t\t\t\t\tidentifier: newStripePrice.id,\n\t\t\t\t})\n\n\t\t\t\tif (currentMerchantPrice) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(merchantPrice)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(merchantPrice.id, currentMerchantPrice.id))\n\t\t\t\t}\n\n\t\t\t\tawait client\n\t\t\t\t\t.update(prices)\n\t\t\t\t\t.set({\n\t\t\t\t\t\tunitAmount: Math.floor(\n\t\t\t\t\t\t\tNumber(input.price?.unitAmount || 0),\n\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\tnickname: input.name,\n\t\t\t\t\t})\n\t\t\t\t\t.where(eq(prices.id, currentProduct.price.id))\n\n\t\t\t\tif (currentStripePrice) {\n\t\t\t\t\tawait paymentProvider.updatePrice(currentStripePrice.id, {\n\t\t\t\t\t\tactive: false,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait paymentProvider.updateProduct(stripeProduct.id, {\n\t\t\t\tname: input.name,\n\t\t\t\tactive: true,\n\t\t\t\timages: input.fields.image?.url ? [input.fields.image.url] : undefined,\n\t\t\t\tdescription: input.fields.description || '',\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: input.fields.slug,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { image, ...fieldsNoImage } = input.fields\n\n\t\t\tawait client\n\t\t\t\t.update(products)\n\t\t\t\t.set({\n\t\t\t\t\tname: input.name,\n\t\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\t\tstatus: 1,\n\t\t\t\t\tfields: {\n\t\t\t\t\t\t...fieldsNoImage,\n\t\t\t\t\t\t...(image?.url && { image }),\n\t\t\t\t\t},\n\t\t\t\t\ttype: input.type,\n\t\t\t\t})\n\t\t\t\t.where(eq(products.id, currentProduct.id))\n\n\t\t\treturn adapter.getProduct(currentProduct.id)\n\t\t},\n\t\tasync createProduct(input: NewProduct) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst merchantAccount = merchantAccountSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantAccount.findFirst({\n\t\t\t\t\twhere: (merchantAccount, { eq }) =>\n\t\t\t\t\t\teq(merchantAccount.label, 'stripe'),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantAccount) {\n\t\t\t\tthrow new Error('Merchant account not found')\n\t\t\t}\n\n\t\t\tconst hash = guid()\n\t\t\tconst newProductId = slugify(`product-${hash}`)\n\n\t\t\tconst newProduct = {\n\t\t\t\tid: newProductId,\n\t\t\t\tname: input.name,\n\t\t\t\tstatus: 1,\n\t\t\t\ttype: input.type || 'self-paced',\n\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\tfields: {\n\t\t\t\t\tstate: input.state || 'draft',\n\t\t\t\t\tvisibility: input.visibility || 'unlisted',\n\t\t\t\t\tslug: slugify(`${input.name}-${hash}`),\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tawait client.insert(products).values(newProduct)\n\n\t\t\tconst priceHash = guid()\n\t\t\tconst newPriceId = `price-${priceHash}`\n\n\t\t\tawait client.insert(prices).values({\n\t\t\t\tid: newPriceId,\n\t\t\t\tproductId: newProductId,\n\t\t\t\tunitAmount: input.price.toString(),\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\tconst product = await adapter.getProduct(newProductId)\n\n\t\t\tconst stripeProduct = await paymentProvider.createProduct({\n\t\t\t\tname: input.name,\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: product?.fields?.slug || null,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst stripePrice = await paymentProvider.createPrice({\n\t\t\t\tproduct: stripeProduct.id,\n\t\t\t\tunit_amount: Math.floor(Number(input.price) * 100),\n\t\t\t\tcurrency: 'usd',\n\t\t\t\tnickname: input.name,\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: product?.fields?.slug || null,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst newMerchantProductId = `mproduct_${v4()}`\n\n\t\t\tawait client.insert(merchantProduct).values({\n\t\t\t\tid: newMerchantProductId,\n\t\t\t\tmerchantAccountId: merchantAccount.id,\n\t\t\t\tproductId: newProductId,\n\t\t\t\tidentifier: stripeProduct.id,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\tconst newMerchantPriceId = `mprice_${v4()}`\n\t\t\tawait client.insert(merchantPrice).values({\n\t\t\t\tid: newMerchantPriceId,\n\t\t\t\tmerchantAccountId: merchantAccount.id,\n\t\t\t\tmerchantProductId: newMerchantProductId,\n\t\t\t\tpriceId: newPriceId,\n\t\t\t\tidentifier: stripePrice.id,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\t// TODO: handle upgrades\n\n\t\t\treturn product\n\t\t},\n\t\tasync getProduct(\n\t\t\tproductSlugOrId?: string,\n\t\t\twithResources: boolean = true,\n\t\t): Promise<Product | null> {\n\t\t\tif (!productSlugOrId) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst productData = await client.query.products.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\teq(\n\t\t\t\t\t\t\t\tsql`JSON_EXTRACT (${products.fields}, \"$.slug\")`,\n\t\t\t\t\t\t\t\t`${productSlugOrId}`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\teq(products.id, productSlugOrId),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tprice: true,\n\t\t\t\t\t\t...(withResources && {\n\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresources: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tconst parsedProduct = productSchema.safeParse(productData)\n\t\t\t\tif (!parsedProduct.success) {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'Error parsing product',\n\t\t\t\t\t\tJSON.stringify(parsedProduct.error),\n\t\t\t\t\t\tJSON.stringify(productData),\n\t\t\t\t\t)\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\treturn parsedProduct.data\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log('getProduct error', e)\n\t\t\t\treturn null\n\t\t\t}\n\t\t},\n\t\tasync getProductResources(\n\t\t\tproductId: string,\n\t\t): Promise<ContentResource[] | null> {\n\t\t\tconst contentResourceProductsForProduct = z\n\t\t\t\t.array(ContentResourceProductSchema)\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.contentResourceProduct.findMany({\n\t\t\t\t\t\twhere: eq(contentResourceProduct.productId, productId),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tif (!contentResourceProductsForProduct) {\n\t\t\t\treturn null\n\t\t\t} else {\n\t\t\t\tconst contentResources = z.array(ContentResourceSchema).parse(\n\t\t\t\t\tawait client.query.contentResource.findMany({\n\t\t\t\t\t\twhere: inArray(\n\t\t\t\t\t\t\tcontentResource.id,\n\t\t\t\t\t\t\tcontentResourceProductsForProduct.map((crp) => crp.resourceId),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\treturn contentResources\n\t\t\t}\n\t\t},\n\t\tasync getPurchaseCountForProduct(productId: string): Promise<number> {\n\t\t\treturn await client.query.purchases\n\t\t\t\t.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(purchaseTable.productId, productId),\n\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t\t.then((res) => res.length)\n\t\t},\n\t\tasync getPurchase(purchaseId: string): Promise<Purchase | null> {\n\t\t\tconst purchase = await client.query.purchases.findFirst({\n\t\t\t\twhere: eq(purchaseTable.id, purchaseId),\n\t\t\t})\n\n\t\t\treturn purchase ? purchaseSchema.parse(purchase) : null\n\t\t},\n\t\tasync createPurchase(options): Promise<Purchase> {\n\t\t\tconst newPurchaseId = options.id || `purchase-${v4()}`\n\t\t\tawait client.insert(purchaseTable).values({\n\t\t\t\t...options,\n\t\t\t\tid: newPurchaseId,\n\t\t\t})\n\n\t\t\tconst newPurchase = await adapter.getPurchase(newPurchaseId)\n\n\t\t\treturn purchaseSchema.parse(newPurchase)\n\t\t},\n\n\t\tasync getPurchaseForStripeCharge(\n\t\t\tstripeChargeId: string,\n\t\t): Promise<Purchase | null> {\n\t\t\tlogger.debug('getPurchaseForStripeCharge', { stripeChargeId })\n\n\t\t\tconst chargeForPurchase = merchantChargeSchema.nullable().parse(\n\t\t\t\t(await client.query.merchantCharge.findFirst({\n\t\t\t\t\twhere: eq(merchantCharge.identifier, stripeChargeId),\n\t\t\t\t})) || null,\n\t\t\t)\n\n\t\t\tif (!chargeForPurchase) {\n\t\t\t\tlogger.error(\n\t\t\t\t\tnew Error(\n\t\t\t\t\t\t`No charge found for purchase: Stripe Charge ID: ${stripeChargeId}`,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst purchase = purchaseSchema.safeParse(\n\t\t\t\tawait client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.merchantChargeId, chargeForPurchase.id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!purchase.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn purchase.data\n\t\t},\n\t\tasync getPurchaseUserTransferById(options: { id: string }): Promise<\n\t\t\t| (PurchaseUserTransfer & {\n\t\t\t\t\tsourceUser: User\n\t\t\t\t\ttargetUser: User | null\n\t\t\t\t\tpurchase: Purchase\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tconst purchaseTransferData =\n\t\t\t\tawait client.query.purchaseUserTransfer.findFirst({\n\t\t\t\t\twhere: eq(purchaseUserTransfer.id, options.id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tsourceUser: true,\n\t\t\t\t\t\ttargetUser: true,\n\t\t\t\t\t\tpurchase: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\treturn purchaseUserTransferSchema\n\t\t\t\t.merge(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tsourceUser: userSchema,\n\t\t\t\t\t\ttargetUser: userSchema.nullable(),\n\t\t\t\t\t\tpurchase: purchaseSchema,\n\t\t\t\t\t\torganizationId: z.string().nullable(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.nullable()\n\t\t\t\t.parse(purchaseTransferData)\n\t\t},\n\t\tasync getPurchaseWithUser(purchaseId: string): Promise<\n\t\t\t| (Purchase & {\n\t\t\t\t\tuser: User\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tconst purchaseData =\n\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.id, purchaseId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})) || null\n\n\t\t\tconst parsedPurchase = purchaseSchema\n\t\t\t\t.merge(z.object({ user: userSchema }))\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(purchaseData)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tconsole.error('Error parsing purchase', parsedPurchase.error)\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn parsedPurchase.data\n\t\t},\n\t\tasync getPurchasesForUser(userId?: string): Promise<Purchase[]> {\n\t\t\tif (!userId) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst visiblePurchaseStates = ['Valid', 'Refunded', 'Restricted']\n\n\t\t\tconst userPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.status, visiblePurchaseStates),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t\torderBy: asc(purchaseTable.createdAt),\n\t\t\t})\n\n\t\t\tconst parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases)\n\n\t\t\tif (!parsedPurchases.success) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'Error parsing purchases',\n\t\t\t\t\tJSON.stringify(parsedPurchases.error),\n\t\t\t\t)\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\treturn parsedPurchases.data\n\t\t},\n\t\tasync getPurchaseDetails(\n\t\t\tpurchaseId: string,\n\t\t\tuserId: string,\n\t\t): Promise<{\n\t\t\tpurchase?: Purchase\n\t\t\texistingPurchase?: Purchase | null\n\t\t\tavailableUpgrades: UpgradableProduct[]\n\t\t}> {\n\t\t\tconst visiblePurchaseStates = ['Valid', 'Refunded', 'Restricted']\n\n\t\t\tconst userPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.status, visiblePurchaseStates),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t\torderBy: asc(purchaseTable.createdAt),\n\t\t\t})\n\n\t\t\tconst parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases)\n\n\t\t\tconst allPurchases = parsedPurchases.success ? parsedPurchases.data : []\n\n\t\t\tconst thePurchase = await client.query.purchases.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.id, purchaseId),\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedPurchase = purchaseSchema.safeParse(thePurchase)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tconsole.error('Error parsing purchase', parsedPurchase)\n\t\t\t\treturn {\n\t\t\t\t\tavailableUpgrades: [],\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst purchaseCanUpgrade = ['Valid', 'Restricted'].includes(\n\t\t\t\tparsedPurchase.data.state || '',\n\t\t\t)\n\n\t\t\tlet availableUpgrades: any[] = []\n\n\t\t\tif (purchaseCanUpgrade) {\n\t\t\t\tavailableUpgrades = await client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\tupgradableProducts.upgradableFromId,\n\t\t\t\t\t\t\tparsedPurchase.data.product?.id as string,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnot(\n\t\t\t\t\t\t\tinArray(\n\t\t\t\t\t\t\t\tupgradableProducts.upgradableToId,\n\t\t\t\t\t\t\t\tallPurchases.map((p) => p.product?.id as string),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tupgradableTo: true,\n\t\t\t\t\t\tupgradableFrom: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst existingPurchase = purchaseSchema\n\t\t\t\t.optional()\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\teq(purchaseTable.productId, parsedPurchase.data.productId),\n\t\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t\t\tisNull(purchaseTable.bulkCouponId),\n\t\t\t\t\t\t\tnot(eq(purchaseTable.id, parsedPurchase.data.id)),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t})) || null,\n\t\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tavailableUpgrades: z\n\t\t\t\t\t.array(upgradableProductSchema)\n\t\t\t\t\t.parse(availableUpgrades),\n\t\t\t\texistingPurchase,\n\t\t\t\tpurchase: parsedPurchase.data,\n\t\t\t}\n\t\t},\n\t\tasync getUserWithPurchasersByEmail(email: string): Promise<any | null> {\n\t\t\tconst user = await client.query.users.findFirst({\n\t\t\t\twhere: eq(users.email, email.trim().toLowerCase()),\n\t\t\t\twith: {\n\t\t\t\t\t// merchantCustomer: true,\n\t\t\t\t\troles: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\trole: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tpurchases: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t\tmerchantCharge: true,\n\t\t\t\t\t\t\tproduct: {\n\t\t\t\t\t\t\t\tcolumns: {\n\t\t\t\t\t\t\t\t\tid: true,\n\t\t\t\t\t\t\t\t\tname: true,\n\t\t\t\t\t\t\t\t\tkey: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn user\n\t\t},\n\t\tasync getUserById(userId: string): Promise<User | null> {\n\t\t\tconst user = await client.query.users\n\t\t\t\t.findFirst({\n\t\t\t\t\twhere: eq(users.id, userId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\troles: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\trole: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\t.then(async (res) => {\n\t\t\t\t\tif (res) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...res,\n\t\t\t\t\t\t\troles: res.roles.map((r) => r.role),\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\treturn userSchema.nullable().parse(user ?? null)\n\t\t},\n\t\tasync pricesOfPurchasesTowardOneBundle({\n\t\t\tuserId,\n\t\t\tbundleId,\n\t\t}: {\n\t\t\tuserId: string | undefined\n\t\t\tbundleId: string\n\t\t}): Promise<Price[]> {\n\t\t\tif (userId === undefined) return []\n\n\t\t\tconst canUpgradeProducts = await client.query.upgradableProducts.findMany(\n\t\t\t\t{\n\t\t\t\t\twhere: eq(upgradableProducts.upgradableToId, bundleId),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst upgradableFrom = z.array(z.string()).parse(\n\t\t\t\tcanUpgradeProducts.map((product) => {\n\t\t\t\t\treturn product.upgradableFromId\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tconst purchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.productId, upgradableFrom),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst productsPurchased = z.array(z.string()).parse(\n\t\t\t\tpurchases.map((purchase) => {\n\t\t\t\t\treturn purchase.productId\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (productsPurchased.length === 0) return []\n\n\t\t\tconst foundPrices = await client.query.prices.findMany({\n\t\t\t\twhere: inArray(prices.productId, productsPurchased),\n\t\t\t})\n\n\t\t\treturn z.array(priceSchema).parse(foundPrices)\n\t\t},\n\t\tasync toggleLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessonId?: string\n\t\t}): Promise<ResourceProgress | null> {\n\t\t\tif (!options.lessonId) {\n\t\t\t\tthrow new Error('No lessonId provided')\n\t\t\t}\n\n\t\t\tlet lessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst now = new Date()\n\n\t\t\tif (lessonProgress) {\n\t\t\t\tawait client\n\t\t\t\t\t.update(resourceProgress)\n\t\t\t\t\t.set({\n\t\t\t\t\t\tcompletedAt: lessonProgress.completedAt ? null : now,\n\t\t\t\t\t\tupdatedAt: now,\n\t\t\t\t\t})\n\t\t\t\t\t.where(eq(resourceProgress.resourceId, options.lessonId))\n\t\t\t} else {\n\t\t\t\tawait client.insert(resourceProgress).values({\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t\tresourceId: options.lessonId,\n\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tlessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsedLessonProgress =\n\t\t\t\tresourceProgressSchema.safeParse(lessonProgress)\n\n\t\t\tif (!parsedLessonProgress.success) {\n\t\t\t\tconsole.error('Error parsing lesson progress', lessonProgress)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedLessonProgress.data\n\t\t},\n\t\ttransferPurchaseToUser: async (options: {\n\t\t\tpurchaseId: string\n\t\t\ttargetUserId: string\n\t\t\tsourceUserId: string\n\t\t}) => {\n\t\t\tconst { purchaseId, targetUserId, sourceUserId } = options\n\t\t\tconst transferId = `put_${v4()}`\n\t\t\tlet purchase = await adapter.getPurchase(purchaseId)\n\t\t\tif (!purchase) throw new Error('No purchase found')\n\n\t\t\tif (purchase.userId !== sourceUserId)\n\t\t\t\tthrow new Error('Invalid source user')\n\n\t\t\tawait client.transaction(async (trx) => {\n\t\t\t\tif (!purchase) throw new Error('No purchase found')\n\t\t\t\tawait trx\n\t\t\t\t\t.update(purchaseTable)\n\t\t\t\t\t.set({ userId: targetUserId })\n\t\t\t\t\t.where(eq(purchaseTable.id, purchase.id))\n\n\t\t\t\tawait trx.insert(purchaseUserTransfer).values({\n\t\t\t\t\tid: transferId,\n\t\t\t\t\tpurchaseId: purchase.id,\n\t\t\t\t\tsourceUserId: sourceUserId,\n\t\t\t\t\ttargetUserId: targetUserId,\n\t\t\t\t\ttransferState: 'COMPLETED',\n\t\t\t\t\tcompletedAt: new Date(),\n\t\t\t\t})\n\n\t\t\t\tpurchase = await adapter.getPurchase(purchaseId)\n\n\t\t\t\tif (!purchase) throw new Error('No purchase found')\n\n\t\t\t\tif (paymentProvider && purchase.merchantChargeId) {\n\t\t\t\t\tawait trx\n\t\t\t\t\t\t.update(merchantCharge)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tuserId: targetUserId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(merchantCharge.id, purchase.merchantChargeId))\n\n\t\t\t\t\tconst updatedMerchantCharge = await adapter.getMerchantCharge(\n\t\t\t\t\t\tpurchase.merchantChargeId,\n\t\t\t\t\t)\n\n\t\t\t\t\tif (!updatedMerchantCharge)\n\t\t\t\t\t\tthrow new Error('No merchant charge found')\n\n\t\t\t\t\tawait trx\n\t\t\t\t\t\t.update(merchantCustomer)\n\t\t\t\t\t\t.set({ userId: targetUserId })\n\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\teq(merchantCustomer.id, updatedMerchantCharge.merchantCustomerId),\n\t\t\t\t\t\t)\n\n\t\t\t\t\tconst updatedMerchantCustomer = merchantCustomerSchema.parse(\n\t\t\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\t\t\twhere: eq(\n\t\t\t\t\t\t\t\tmerchantCustomer.id,\n\t\t\t\t\t\t\t\tupdatedMerchantCharge.merchantCustomerId,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst targetUser = userSchema.parse(\n\t\t\t\t\t\tawait client.query.users.findFirst({\n\t\t\t\t\t\t\twhere: eq(users.id, targetUserId),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst sourceUser = userSchema.parse(\n\t\t\t\t\t\tawait client.query.users.findFirst({\n\t\t\t\t\t\t\twhere: eq(users.id, sourceUserId),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tawait paymentProvider.updateCustomer(\n\t\t\t\t\t\tupdatedMerchantCustomer.identifier,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\temail: targetUser.email,\n\t\t\t\t\t\t\tname: targetUser.name || sourceUser.name || '',\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\ttransferId,\n\t\t\t\t\t\t\t\ttransferredFrom: sourceUser.email,\n\t\t\t\t\t\t\t\ttransferredOn: new Date().toISOString(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn await adapter.getPurchaseUserTransferById({\n\t\t\t\tid: transferId,\n\t\t\t})\n\t\t},\n\t\ttransferPurchasesToNewUser(options: {\n\t\t\tmerchantCustomerId: string\n\t\t\tuserId: string\n\t\t}): Promise<unknown> {\n\t\t\tthrow new Error('Method not implemented.')\n\t\t},\n\t\tasync updatePurchaseStatusForCharge(\n\t\t\tchargeId: string,\n\t\t\tstatus: 'Valid' | 'Refunded' | 'Disputed' | 'Banned' | 'Restricted',\n\t\t): Promise<Purchase | undefined> {\n\t\t\ttry {\n\t\t\t\tconsole.log('updatePurchaseStatusForCharge', { chargeId, status })\n\t\t\t\tconst merchantChargeForPurchase =\n\t\t\t\t\tawait client.query.merchantCharge.findFirst({\n\t\t\t\t\t\twhere: or(\n\t\t\t\t\t\t\teq(merchantCharge.identifier, chargeId),\n\t\t\t\t\t\t\teq(merchantCharge.id, chargeId),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\n\t\t\t\tconsole.log('merchantChargeForPurchase', { merchantChargeForPurchase })\n\n\t\t\t\tconst parsedMerchantChargeForPurchase = merchantChargeSchema.parse(\n\t\t\t\t\tmerchantChargeForPurchase,\n\t\t\t\t)\n\n\t\t\t\tif (!parsedMerchantChargeForPurchase)\n\t\t\t\t\tthrow new Error(`no-charge-found-for-purchase ${chargeId}`)\n\n\t\t\t\tconst purchase = await client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(\n\t\t\t\t\t\tpurchaseTable.merchantChargeId,\n\t\t\t\t\t\tparsedMerchantChargeForPurchase.id,\n\t\t\t\t\t),\n\t\t\t\t})\n\n\t\t\t\tconst parsedPurchase = purchaseSchema.nullable().parse(purchase)\n\n\t\t\t\tif (parsedPurchase) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(purchaseTable)\n\t\t\t\t\t\t.set({ status: status })\n\t\t\t\t\t\t.where(eq(purchaseTable.id, parsedPurchase.id))\n\n\t\t\t\t\tconst newPurchase = await client.query.purchases.findFirst({\n\t\t\t\t\t\twhere: eq(purchaseTable.id, parsedPurchase.id),\n\t\t\t\t\t})\n\n\t\t\t\t\treturn purchaseSchema.optional().parse(newPurchase)\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`no-purchase-found-for-charge ${chargeId}`)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log('error updating purchase status', e)\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tasync updatePurchaseUserTransferTransferState(options: {\n\t\t\tid: string\n\t\t\ttransferState: PurchaseUserTransferState\n\t\t}): Promise<PurchaseUserTransfer | null> {\n\t\t\tawait client\n\t\t\t\t.update(purchaseUserTransfer)\n\t\t\t\t.set({\n\t\t\t\t\ttransferState: options.transferState,\n\t\t\t\t})\n\t\t\t\t.where(eq(purchaseUserTransfer.id, options.id))\n\n\t\t\tconst purchaseUserTransferData =\n\t\t\t\t(await client.query.purchaseUserTransfer.findFirst({\n\t\t\t\t\twhere: eq(purchaseUserTransfer.id, options.id),\n\t\t\t\t})) || null\n\n\t\t\treturn purchaseUserTransferSchema\n\t\t\t\t.nullable()\n\t\t\t\t.parse(purchaseUserTransferData)\n\t\t},\n\t\taddResourceToResource: async function (options) {\n\t\t\tconst { parentResourceId, childResourceId } = options\n\n\t\t\tconst parentResourceData = await client.query.contentResource.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\teq(\n\t\t\t\t\t\tsql`JSON_EXTRACT (${contentResource.fields}, \"$.slug\")`,\n\t\t\t\t\t\tparentResourceId,\n\t\t\t\t\t),\n\t\t\t\t\teq(contentResource.id, parentResourceId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresources: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parentResource = ContentResourceSchema.parse(parentResourceData)\n\n\t\t\tawait client.insert(contentResourceResource).values({\n\t\t\t\tresourceOfId: parentResource.id,\n\t\t\t\tresourceId: childResourceId,\n\t\t\t\tposition: parentResource.resources?.length || 0,\n\t\t\t})\n\n\t\t\tconst resourceJoin = client.query.contentResourceResource.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresource: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResourceJoin =\n\t\t\t\tContentResourceResourceSchema.safeParse(resourceJoin)\n\t\t\tif (!parsedResourceJoin.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResourceJoin.data\n\t\t},\n\t\tasync removeResourceFromResource(options) {\n\t\t\tconst { childResourceId, parentResourceId } = options\n\n\t\t\tconst resourceJoin = await client.query.contentResourceResource.findFirst(\n\t\t\t\t{\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst parsedResourceJoin =\n\t\t\t\tContentResourceResourceSchema.safeParse(resourceJoin)\n\t\t\tif (!parsedResourceJoin.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tawait client\n\t\t\t\t.delete(contentResourceResource)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t\t),\n\t\t\t\t)\n\n\t\t\treturn parsedResourceJoin.data.resource\n\t\t},\n\t\tasync updateContentResourceFields(options) {\n\t\t\tif (!options.id) {\n\t\t\t\tthrow new Error('No content resource id.')\n\t\t\t}\n\n\t\t\tconst currentResource = await client\n\t\t\t\t.select()\n\t\t\t\t.from(contentResource)\n\t\t\t\t.where(eq(contentResource.id, options.id))\n\t\t\t\t.then((res) => res[0])\n\n\t\t\tawait client\n\t\t\t\t.update(contentResource)\n\t\t\t\t.set({ fields: { ...currentResource.fields, ...options.fields } })\n\t\t\t\t.where(eq(contentResource.id, options.id))\n\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: eq(contentResource.id, options.id),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tconsole.error('Error parsing resource', resource)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync getVideoResource(id) {\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst query = sql`\n SELECT\n id as id,\n CAST(updatedAt AS DATETIME) as updatedAt,\n CAST(createdAt AS DATETIME) as createdAt,\n JSON_EXTRACT (${contentResource.fields}, \"$.state\") AS state,\n JSON_EXTRACT (${contentResource.fields}, \"$.duration\") AS duration,\n JSON_EXTRACT (${contentResource.fields}, \"$.muxPlaybackId\") AS muxPlaybackId,\n JSON_EXTRACT (${contentResource.fields}, \"$.muxAssetId\") AS muxAssetId,\n JSON_EXTRACT (${contentResource.fields}, \"$.transcript\") AS transcript\n FROM\n ${contentResource}\n WHERE\n type = 'videoResource'\n AND (id = ${id});\n\n `\n\t\t\treturn client\n\t\t\t\t.execute(query)\n\t\t\t\t.then((result: any) => {\n\t\t\t\t\tconst parsedResource = VideoResourceSchema.safeParse(result.rows[0])\n\t\t\t\t\treturn parsedResource.success ? parsedResource.data : null\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.error(error)\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t},\n\t\tasync createContentResource(data) {\n\t\t\tconst id = data.id || crypto.randomUUID()\n\n\t\t\tawait client.insert(contentResource).values({ ...data, id })\n\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: eq(contentResource.id, id),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tconsole.error('Error parsing resource', resource)\n\t\t\t\tthrow new Error('Error parsing resource')\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync getContentResource(data) {\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\teq(contentResource.id, data),\n\t\t\t\t\teq(\n\t\t\t\t\t\tsql`JSON_EXTRACT (${contentResource.fields}, \"$.slug\")`,\n\t\t\t\t\t\t`${data}`,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tconsole.error('Error parsing resource', resource)\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync createUser(data) {\n\t\t\ttry {\n\t\t\t\tconst id = crypto.randomUUID()\n\n\t\t\t\tawait client.insert(users).values({ ...data, id })\n\n\t\t\t\t// creating a personal organization for the user\n\t\t\t\t// every user gets an organization of their very own\n\t\t\t\tconst personalOrganization = await adapter.createOrganization({\n\t\t\t\t\tname: `Personal (${data.email})`,\n\t\t\t\t})\n\n\t\t\t\tif (!personalOrganization) {\n\t\t\t\t\tthrow new Error('Failed to create personal organization')\n\t\t\t\t}\n\n\t\t\t\tconst membership = await adapter.addMemberToOrganization({\n\t\t\t\t\torganizationId: personalOrganization.id,\n\t\t\t\t\tuserId: id,\n\t\t\t\t\tinvitedById: id,\n\t\t\t\t})\n\n\t\t\t\tif (!membership) {\n\t\t\t\t\tthrow new Error('Failed to add user to personal organization')\n\t\t\t\t}\n\n\t\t\t\tawait adapter.addRoleForMember({\n\t\t\t\t\torganizationId: personalOrganization.id,\n\t\t\t\t\tmemberId: membership.id,\n\t\t\t\t\trole: 'owner',\n\t\t\t\t})\n\n\t\t\t\tconst user = await adapter.getUser?.(id)\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tthrow new Error('Failed to get user')\n\t\t\t\t}\n\n\t\t\t\treturn user\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(error)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t},\n\t\tasync getUser(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(users)\n\t\t\t\t\t.where(eq(users.id, data))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync getUserByEmail(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(users)\n\t\t\t\t\t.where(eq(users.email, data))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync createSession(data) {\n\t\t\tawait client.insert(sessions).values(data)\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\t\t\t\t.then((res) => res[0] as AdapterSession)\n\t\t},\n\t\tasync getSessionAndUser(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select({\n\t\t\t\t\t\tsession: sessions,\n\t\t\t\t\t\tuser: users,\n\t\t\t\t\t})\n\t\t\t\t\t.from(sessions)\n\t\t\t\t\t.where(eq(sessions.sessionToken, data))\n\t\t\t\t\t.innerJoin(users, eq(users.id, sessions.userId))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync updateUser(data) {\n\t\t\tif (!data.id) {\n\t\t\t\tthrow new Error('No user id.')\n\t\t\t}\n\n\t\t\tawait client.update(users).set(data).where(eq(users.id, data.id))\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(users)\n\t\t\t\t.where(eq(users.id, data.id))\n\t\t\t\t.then((res) => res[0] as AdapterUser)\n\t\t},\n\t\tasync updateSession(data) {\n\t\t\tawait client\n\t\t\t\t.update(sessions)\n\t\t\t\t.set(data)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\t\t\t\t.then((res) => res[0])\n\t\t},\n\t\tasync linkAccount(rawAccount) {\n\t\t\tawait client.insert(accounts).values(rawAccount)\n\t\t},\n\t\tasync getUserByAccount(account) {\n\t\t\tconst dbAccount =\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(accounts)\n\t\t\t\t\t.where(\n\t\t\t\t\t\tand(\n\t\t\t\t\t\t\teq(accounts.providerAccountId, account.providerAccountId),\n\t\t\t\t\t\t\teq(accounts.provider, account.provider),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\t.leftJoin(users, eq(accounts.userId, users.id))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\tif (!dbAccount) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn dbAccount.User\n\t\t},\n\t\tasync deleteSession(sessionToken) {\n\t\t\tconst session =\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(sessions)\n\t\t\t\t\t.where(eq(sessions.sessionToken, sessionToken))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\tawait client\n\t\t\t\t.delete(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, sessionToken))\n\n\t\t\treturn session\n\t\t},\n\t\tasync createVerificationToken(token) {\n\t\t\tawait client.insert(verificationTokens).values(token)\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(verificationTokens)\n\t\t\t\t.where(eq(verificationTokens.identifier, token.identifier))\n\t\t\t\t.then((res) => res[0])\n\t\t},\n\t\tasync useVerificationToken(token) {\n\t\t\ttry {\n\t\t\t\tconst deletedToken =\n\t\t\t\t\t(await client\n\t\t\t\t\t\t.select()\n\t\t\t\t\t\t.from(verificationTokens)\n\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\teq(verificationTokens.identifier, token.identifier),\n\t\t\t\t\t\t\t\teq(verificationTokens.token, token.token),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\t\tif (deletedToken?.createdAt) {\n\t\t\t\t\tconst TIMEOUT_IN_SECONDS = 90\n\t\t\t\t\tconst expireMultipleClicks = addSeconds(\n\t\t\t\t\t\tdeletedToken.createdAt,\n\t\t\t\t\t\tTIMEOUT_IN_SECONDS,\n\t\t\t\t\t)\n\t\t\t\t\tconst now = new Date()\n\n\t\t\t\t\tif (isAfter(expireMultipleClicks, now)) {\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tconst { id: _, ...verificationToken } = token\n\t\t\t\t\t\treturn deletedToken\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait client\n\t\t\t\t\t\t\t.delete(verificationTokens)\n\t\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(verificationTokens.identifier, token.identifier),\n\t\t\t\t\t\t\t\t\teq(verificationTokens.token, token.token),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\treturn deletedToken\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn deletedToken\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error('No verification token found.')\n\t\t\t}\n\t\t},\n\t\tasync deleteUser(id) {\n\t\t\tconst user = await client\n\t\t\t\t.select()\n\t\t\t\t.from(users)\n\t\t\t\t.where(eq(users.id, id))\n\t\t\t\t.then((res) => res[0] ?? null)\n\n\t\t\tawait client.delete(users).where(eq(users.id, id))\n\t\t\tawait client.delete(sessions).where(eq(sessions.userId, id))\n\t\t\tawait client.delete(accounts).where(eq(accounts.userId, id))\n\n\t\t\treturn user\n\t\t},\n\t\tasync unlinkAccount(account) {\n\t\t\tawait client\n\t\t\t\t.delete(accounts)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(accounts.providerAccountId, account.providerAccountId),\n\t\t\t\t\t\teq(accounts.provider, account.provider),\n\t\t\t\t\t),\n\t\t\t\t)\n\n\t\t\treturn undefined\n\t\t},\n\t\tcreateOrganization: async (options: { name: string }) => {\n\t\t\tconst organizationId = crypto.randomUUID()\n\t\t\tawait client.insert(organizationTable).values({\n\t\t\t\t...options,\n\t\t\t\tid: organizationId,\n\t\t\t})\n\n\t\t\treturn adapter.getOrganization(organizationId)\n\t\t},\n\t\tgetOrganization: async (organizationId: string) => {\n\t\t\treturn OrganizationSchema.parse(\n\t\t\t\tawait client.query.organization.findFirst({\n\t\t\t\t\twhere: eq(organizationTable.id, organizationId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\taddMemberToOrganization: async (options: {\n\t\t\torganizationId: string\n\t\t\tuserId: string\n\t\t\tinvitedById: string\n\t\t}) => {\n\t\t\tconst currentMembership =\n\t\t\t\tawait client.query.organizationMemberships.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipTable.organizationId,\n\t\t\t\t\t\t\toptions.organizationId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipTable.userId, options.userId),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\tif (currentMembership) {\n\t\t\t\treturn OrganizationMemberSchema.parse(currentMembership)\n\t\t\t} else {\n\t\t\t\tconst id = crypto.randomUUID()\n\t\t\t\tawait client.insert(organizationMembershipTable).values({\n\t\t\t\t\t...options,\n\t\t\t\t\tid,\n\t\t\t\t})\n\n\t\t\t\treturn OrganizationMemberSchema.parse(\n\t\t\t\t\tawait client.query.organizationMemberships.findFirst({\n\t\t\t\t\t\twhere: eq(organizationMembershipTable.id, id),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\tremoveMemberFromOrganization: async (options: {\n\t\t\torganizationId: string\n\t\t\tuserId: string\n\t\t}) => {\n\t\t\tawait client\n\t\t\t\t.delete(organizationMembershipTable)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipTable.organizationId,\n\t\t\t\t\t\t\toptions.organizationId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipTable.userId, options.userId),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t},\n\t\taddRoleForMember: async (options: {\n\t\t\torganizationId: string\n\t\t\tmemberId: string\n\t\t\trole: string\n\t\t}) => {\n\t\t\tconst existingRole = z\n\t\t\t\t.object({\n\t\t\t\t\tid: z.string(),\n\t\t\t\t})\n\t\t\t\t.nullish()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.roles.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(roleTable.organizationId, options.organizationId),\n\t\t\t\t\t\t\teq(roleTable.name, options.role),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tconst roleId = existingRole?.id || crypto.randomUUID()\n\n\t\t\tif (!existingRole) {\n\t\t\t\tawait client.insert(roleTable).values({\n\t\t\t\t\tname: options.role,\n\t\t\t\t\torganizationId: options.organizationId,\n\t\t\t\t\tid: roleId,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst currentOrgMembershipRole =\n\t\t\t\tawait client.query.organizationMembershipRoles.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipRoleTable.organizationMembershipId,\n\t\t\t\t\t\t\toptions.memberId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipRoleTable.roleId, roleId),\n\t\t\t\t\t),\n\t\t\t\t})\n\n\t\t\tif (!currentOrgMembershipRole) {\n\t\t\t\tawait client.insert(organizationMembershipRoleTable).values({\n\t\t\t\t\torganizationId: options.organizationId,\n\t\t\t\t\torganizationMembershipId: options.memberId,\n\t\t\t\t\troleId,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\tremoveRoleForMember: async (options: {\n\t\t\torganizationId: string\n\t\t\tmemberId: string\n\t\t\trole: string\n\t\t}) => {\n\t\t\tconst existingRole = z\n\t\t\t\t.object({\n\t\t\t\t\tid: z.string(),\n\t\t\t\t})\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.roles.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(roleTable.organizationId, options.organizationId),\n\t\t\t\t\t\t\teq(roleTable.name, options.role),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tconst roleId = existingRole?.id\n\n\t\t\tif (roleId) {\n\t\t\t\tawait client\n\t\t\t\t\t.delete(organizationMembershipRoleTable)\n\t\t\t\t\t.where(eq(organizationMembershipRoleTable.roleId, roleId))\n\t\t\t}\n\t\t},\n\t\tgetMembershipsForUser: async (userId: string) => {\n\t\t\treturn OrganizationMemberSchema.array().parse(\n\t\t\t\t(await client.query.organizationMemberships.findMany({\n\t\t\t\t\twhere: eq(organizationMembershipTable.userId, userId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})) || [],\n\t\t\t)\n\t\t},\n\t\tgetOrganizationMembers: async (organizationId: string) => {\n\t\t\treturn OrganizationMemberSchema.array().parse(\n\t\t\t\t(await client.query.organizationMemberships.findMany({\n\t\t\t\t\twhere: eq(organizationMembershipTable.organizationId, organizationId),\n\t\t\t\t})) || [],\n\t\t\t)\n\t\t},\n\t\tcreateSubscription: async (options: {\n\t\t\torganizationId: string\n\t\t\tmerchantSubscriptionId: string\n\t\t\tproductId: string\n\t\t}) => {\n\t\t\tconst id = `sub_${crypto.randomUUID()}`\n\t\t\tawait client.insert(subscriptionTable).values({\n\t\t\t\t...options,\n\t\t\t\tid,\n\t\t\t})\n\n\t\t\treturn SubscriptionSchema.parse(\n\t\t\t\tawait client.query.subscription.findFirst({\n\t\t\t\t\twhere: eq(subscriptionTable.id, id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantSubscription: async (merchantSubscriptionId: string) => {\n\t\t\treturn MerchantSubscriptionSchema.parse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.id, merchantSubscriptionId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tcreateMerchantSubscription: async (options: {\n\t\t\tmerchantAccountId: string\n\t\t\tmerchantCustomerId: string\n\t\t\tmerchantProductId: string\n\t\t\tidentifier: string\n\t\t}) => {\n\t\t\tconst id = crypto.randomUUID()\n\t\t\tawait client.insert(merchantSubscriptionTable).values({\n\t\t\t\t...options,\n\t\t\t\tid,\n\t\t\t})\n\n\t\t\treturn MerchantSubscriptionSchema.parse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.id, id),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tupdateMerchantSubscription: async (options: {\n\t\t\tmerchantSubscriptionId: string\n\t\t\tstatus: string\n\t\t}) => {\n\t\t\tthrow new Error('Not implemented')\n\t\t},\n\t\tdeleteMerchantSubscription: async (merchantSubscriptionId: string) => {\n\t\t\tthrow new Error('Not implemented')\n\t\t},\n\t\tgetSubscriptionForStripeId: async (stripeSubscriptionId: string) => {\n\t\t\tconst merchantSubscriptionParsed = MerchantSubscriptionSchema.safeParse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.identifier, stripeSubscriptionId),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantSubscriptionParsed.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No merchant subscription found for stripe id ${stripeSubscriptionId} ${merchantSubscriptionParsed.error}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst subscriptionParsed = SubscriptionSchema.safeParse(\n\t\t\t\tawait client.query.subscription.findFirst({\n\t\t\t\t\twhere: eq(\n\t\t\t\t\t\tsubscriptionTable.merchantSubscriptionId,\n\t\t\t\t\t\tmerchantSubscriptionParsed.data.id,\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!subscriptionParsed.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No subscription found for merchant subscription ${merchantSubscriptionParsed.data.id} ${subscriptionParsed.error}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn subscriptionParsed.data\n\t\t},\n\t}\n\n\treturn adapter\n}\n","var util;\n(function (util) {\n util.assertEqual = (val) => val;\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array\n .map((val) => (typeof val === \"string\" ? `'${val}'` : val))\n .join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nvar objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nconst ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nconst getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then &&\n typeof data.then === \"function\" &&\n data.catch &&\n typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n\nconst ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nconst quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nclass ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `smaller than or equal to`\n : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\n\nlet overrideErrorMap = errorMap;\nfunction setErrorMap(map) {\n overrideErrorMap = map;\n}\nfunction getErrorMap() {\n return overrideErrorMap;\n}\n\nconst makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === errorMap ? undefined : errorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nclass ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" &&\n (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nconst INVALID = Object.freeze({\n status: \"aborted\",\n});\nconst DIRTY = (value) => ({ status: \"dirty\", value });\nconst OK = (value) => ({ status: \"valid\", value });\nconst isAborted = (x) => x.status === \"aborted\";\nconst isDirty = (x) => x.status === \"dirty\";\nconst isValid = (x) => x.status === \"valid\";\nconst isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nvar errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message === null || message === void 0 ? void 0 : message.message;\n})(errorUtil || (errorUtil = {}));\n\nvar _ZodEnum_cache, _ZodNativeEnum_cache;\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (this._key instanceof Array) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n var _a, _b;\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message !== null && message !== void 0 ? message : ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n var _a;\n const ctx = {\n common: {\n issues: [],\n async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n var _a, _b;\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n async: true,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult)\n ? maybeAsyncResult\n : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\"\n ? refinementData(val, ctx)\n : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n // let regex = `\\\\d{2}:\\\\d{2}:\\\\d{2}`;\n let regex = `([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d`;\n if (args.precision) {\n regex = `${regex}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n regex = `${regex}(\\\\.\\\\d+)?`;\n }\n return regex;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nfunction datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (!decoded.typ || !decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nclass ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch (_a) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a, _b;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,\n local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options === null || options === void 0 ? void 0 : options.position,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n var _a;\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / Math.pow(10, decCount);\n}\nclass ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" ||\n (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null, min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" ||\n ch.kind === \"int\" ||\n ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch (_a) {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n var _a;\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\nclass ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nclass ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nclass ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nclass ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nclass ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nclass ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nclass ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nclass ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nclass ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nclass ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n return (this._cached = { shape, keys });\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever &&\n this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") ;\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n var _a, _b, _c, _d;\n const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n util.objectKeys(mask).forEach((key) => {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nclass ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nclass ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util\n .objectKeys(a)\n .filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date &&\n bType === ZodParsedType.date &&\n +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nclass ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\nclass ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nclass ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nclass ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nclass ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nclass ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args\n .parseAsync(args, params)\n .catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args\n ? args\n : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nclass ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nclass ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nclass ZodEnum extends ZodType {\n constructor() {\n super(...arguments);\n _ZodEnum_cache.set(this, void 0);\n }\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!__classPrivateFieldGet(this, _ZodEnum_cache, \"f\")) {\n __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), \"f\");\n }\n if (!__classPrivateFieldGet(this, _ZodEnum_cache, \"f\").has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\n_ZodEnum_cache = new WeakMap();\nZodEnum.create = createZodEnum;\nclass ZodNativeEnum extends ZodType {\n constructor() {\n super(...arguments);\n _ZodNativeEnum_cache.set(this, void 0);\n }\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string &&\n ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, \"f\")) {\n __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), \"f\");\n }\n if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, \"f\").has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\n_ZodNativeEnum_cache = new WeakMap();\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nclass ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise &&\n ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise\n ? ctx.data\n : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nclass ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return base;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((base) => {\n if (!isValid(base))\n return base;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nclass ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nclass ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nclass ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\"\n ? params.default\n : () => params.default,\n ...processCreateParams(params),\n });\n};\nclass ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nclass ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nconst BRAND = Symbol(\"zod_brand\");\nclass ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nclass ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nclass ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result)\n ? result.then((data) => freeze(data))\n : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nfunction custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n var _a, _b;\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n var _a, _b;\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nconst late = {\n object: ZodObject.lazycreate,\n};\nvar ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nconst coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nconst NEVER = INVALID;\n\nvar z = /*#__PURE__*/Object.freeze({\n __proto__: null,\n defaultErrorMap: errorMap,\n setErrorMap: setErrorMap,\n getErrorMap: getErrorMap,\n makeIssue: makeIssue,\n EMPTY_PATH: EMPTY_PATH,\n addIssueToContext: addIssueToContext,\n ParseStatus: ParseStatus,\n INVALID: INVALID,\n DIRTY: DIRTY,\n OK: OK,\n isAborted: isAborted,\n isDirty: isDirty,\n isValid: isValid,\n isAsync: isAsync,\n get util () { return util; },\n get objectUtil () { return objectUtil; },\n ZodParsedType: ZodParsedType,\n getParsedType: getParsedType,\n ZodType: ZodType,\n datetimeRegex: datetimeRegex,\n ZodString: ZodString,\n ZodNumber: ZodNumber,\n ZodBigInt: ZodBigInt,\n ZodBoolean: ZodBoolean,\n ZodDate: ZodDate,\n ZodSymbol: ZodSymbol,\n ZodUndefined: ZodUndefined,\n ZodNull: ZodNull,\n ZodAny: ZodAny,\n ZodUnknown: ZodUnknown,\n ZodNever: ZodNever,\n ZodVoid: ZodVoid,\n ZodArray: ZodArray,\n ZodObject: ZodObject,\n ZodUnion: ZodUnion,\n ZodDiscriminatedUnion: ZodDiscriminatedUnion,\n ZodIntersection: ZodIntersection,\n ZodTuple: ZodTuple,\n ZodRecord: ZodRecord,\n ZodMap: ZodMap,\n ZodSet: ZodSet,\n ZodFunction: ZodFunction,\n ZodLazy: ZodLazy,\n ZodLiteral: ZodLiteral,\n ZodEnum: ZodEnum,\n ZodNativeEnum: ZodNativeEnum,\n ZodPromise: ZodPromise,\n ZodEffects: ZodEffects,\n ZodTransformer: ZodEffects,\n ZodOptional: ZodOptional,\n ZodNullable: ZodNullable,\n ZodDefault: ZodDefault,\n ZodCatch: ZodCatch,\n ZodNaN: ZodNaN,\n BRAND: BRAND,\n ZodBranded: ZodBranded,\n ZodPipeline: ZodPipeline,\n ZodReadonly: ZodReadonly,\n custom: custom,\n Schema: ZodType,\n ZodSchema: ZodType,\n late: late,\n get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },\n coerce: coerce,\n any: anyType,\n array: arrayType,\n bigint: bigIntType,\n boolean: booleanType,\n date: dateType,\n discriminatedUnion: discriminatedUnionType,\n effect: effectsType,\n 'enum': enumType,\n 'function': functionType,\n 'instanceof': instanceOfType,\n intersection: intersectionType,\n lazy: lazyType,\n literal: literalType,\n map: mapType,\n nan: nanType,\n nativeEnum: nativeEnumType,\n never: neverType,\n 'null': nullType,\n nullable: nullableType,\n number: numberType,\n object: objectType,\n oboolean: oboolean,\n onumber: onumber,\n optional: optionalType,\n ostring: ostring,\n pipeline: pipelineType,\n preprocess: preprocessType,\n promise: promiseType,\n record: recordType,\n set: setType,\n strictObject: strictObjectType,\n string: stringType,\n symbol: symbolType,\n transformer: effectsType,\n tuple: tupleType,\n 'undefined': undefinedType,\n union: unionType,\n unknown: unknownType,\n 'void': voidType,\n NEVER: NEVER,\n ZodIssueCode: ZodIssueCode,\n quotelessJson: quotelessJson,\n ZodError: ZodError\n});\n\nexport { BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, ZodType as Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodType as ZodSchema, ZodSet, ZodString, ZodSymbol, ZodEffects as ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, datetimeRegex, z as default, errorMap as defaultErrorMap, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, getErrorMap, getParsedType, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setType as set, setErrorMap, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void, z };\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value)=>key in obj ? __defProp(obj, key, {\n enumerable: true,\n configurable: true,\n writable: true,\n value\n }) : obj[key] = value;\nvar __name = (target, value)=>__defProp(target, \"name\", {\n value,\n configurable: true\n });\nvar __publicField = (obj, key, value)=>{\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nexport { __name, __publicField }; //# sourceMappingURL=chunk-VLQXSCFN.js.map\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9","var util;\n(function (util) {\n util.assertEqual = (val) => val;\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array\n .map((val) => (typeof val === \"string\" ? `'${val}'` : val))\n .join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nvar objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nconst ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nconst getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then &&\n typeof data.then === \"function\" &&\n data.catch &&\n typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n\nconst ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nconst quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nclass ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `smaller than or equal to`\n : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\n\nlet overrideErrorMap = errorMap;\nfunction setErrorMap(map) {\n overrideErrorMap = map;\n}\nfunction getErrorMap() {\n return overrideErrorMap;\n}\n\nconst makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === errorMap ? undefined : errorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nclass ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" &&\n (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nconst INVALID = Object.freeze({\n status: \"aborted\",\n});\nconst DIRTY = (value) => ({ status: \"dirty\", value });\nconst OK = (value) => ({ status: \"valid\", value });\nconst isAborted = (x) => x.status === \"aborted\";\nconst isDirty = (x) => x.status === \"dirty\";\nconst isValid = (x) => x.status === \"valid\";\nconst isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nvar errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message === null || message === void 0 ? void 0 : message.message;\n})(errorUtil || (errorUtil = {}));\n\nvar _ZodEnum_cache, _ZodNativeEnum_cache;\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (this._key instanceof Array) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n var _a, _b;\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message !== null && message !== void 0 ? message : ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n var _a;\n const ctx = {\n common: {\n issues: [],\n async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n var _a, _b;\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n async: true,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult)\n ? maybeAsyncResult\n : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\"\n ? refinementData(val, ctx)\n : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((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1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n // let regex = `\\\\d{2}:\\\\d{2}:\\\\d{2}`;\n let regex = `([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d`;\n if (args.precision) {\n regex = `${regex}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n regex = `${regex}(\\\\.\\\\d+)?`;\n }\n return regex;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nfunction datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (!decoded.typ || !decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nclass ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch (_a) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a, _b;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,\n local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options === null || options === void 0 ? void 0 : options.position,\n ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n var _a;\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / Math.pow(10, decCount);\n}\nclass ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" ||\n (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null, min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" ||\n ch.kind === \"int\" ||\n ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch (_a) {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n var _a;\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\nclass ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nclass ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nclass ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nclass ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nclass ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nclass ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nclass ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nclass ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nclass ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nclass ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n return (this._cached = { shape, keys });\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever &&\n this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") ;\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n var _a, _b, _c, _d;\n const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n util.objectKeys(mask).forEach((key) => {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n util.objectKeys(this.shape).forEach((key) => {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nclass ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nclass ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util\n .objectKeys(a)\n .filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date &&\n bType === ZodParsedType.date &&\n +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nclass ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\nclass ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nclass ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nclass ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nclass ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nclass ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n errorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args\n .parseAsync(args, params)\n .catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args\n ? args\n : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nclass ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nclass ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nclass ZodEnum extends ZodType {\n constructor() {\n super(...arguments);\n _ZodEnum_cache.set(this, void 0);\n }\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!__classPrivateFieldGet(this, _ZodEnum_cache, \"f\")) {\n __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), \"f\");\n }\n if (!__classPrivateFieldGet(this, _ZodEnum_cache, \"f\").has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\n_ZodEnum_cache = new WeakMap();\nZodEnum.create = createZodEnum;\nclass ZodNativeEnum extends ZodType {\n constructor() {\n super(...arguments);\n _ZodNativeEnum_cache.set(this, void 0);\n }\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string &&\n ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, \"f\")) {\n __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), \"f\");\n }\n if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, \"f\").has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\n_ZodNativeEnum_cache = new WeakMap();\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nclass ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise &&\n ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise\n ? ctx.data\n : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nclass ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return base;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((base) => {\n if (!isValid(base))\n return base;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nclass ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nclass ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nclass ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\"\n ? params.default\n : () => params.default,\n ...processCreateParams(params),\n });\n};\nclass ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nclass ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nconst BRAND = Symbol(\"zod_brand\");\nclass ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nclass ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nclass ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result)\n ? result.then((data) => freeze(data))\n : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nfunction custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n var _a, _b;\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n var _a, _b;\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nconst late = {\n object: ZodObject.lazycreate,\n};\nvar ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nconst coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nconst NEVER = INVALID;\n\nvar z = /*#__PURE__*/Object.freeze({\n __proto__: null,\n defaultErrorMap: errorMap,\n setErrorMap: setErrorMap,\n getErrorMap: getErrorMap,\n makeIssue: makeIssue,\n EMPTY_PATH: EMPTY_PATH,\n addIssueToContext: addIssueToContext,\n ParseStatus: ParseStatus,\n INVALID: INVALID,\n DIRTY: DIRTY,\n OK: OK,\n isAborted: isAborted,\n isDirty: isDirty,\n isValid: isValid,\n isAsync: isAsync,\n get util () { return util; },\n get objectUtil () { return objectUtil; },\n ZodParsedType: ZodParsedType,\n getParsedType: getParsedType,\n ZodType: ZodType,\n datetimeRegex: datetimeRegex,\n ZodString: ZodString,\n ZodNumber: ZodNumber,\n ZodBigInt: ZodBigInt,\n ZodBoolean: ZodBoolean,\n ZodDate: ZodDate,\n ZodSymbol: ZodSymbol,\n ZodUndefined: ZodUndefined,\n ZodNull: ZodNull,\n ZodAny: ZodAny,\n ZodUnknown: ZodUnknown,\n ZodNever: ZodNever,\n ZodVoid: ZodVoid,\n ZodArray: ZodArray,\n ZodObject: ZodObject,\n ZodUnion: ZodUnion,\n ZodDiscriminatedUnion: ZodDiscriminatedUnion,\n ZodIntersection: ZodIntersection,\n ZodTuple: ZodTuple,\n ZodRecord: ZodRecord,\n ZodMap: ZodMap,\n ZodSet: ZodSet,\n ZodFunction: ZodFunction,\n ZodLazy: ZodLazy,\n ZodLiteral: ZodLiteral,\n ZodEnum: ZodEnum,\n ZodNativeEnum: ZodNativeEnum,\n ZodPromise: ZodPromise,\n ZodEffects: ZodEffects,\n ZodTransformer: ZodEffects,\n ZodOptional: ZodOptional,\n ZodNullable: ZodNullable,\n ZodDefault: ZodDefault,\n ZodCatch: ZodCatch,\n ZodNaN: ZodNaN,\n BRAND: BRAND,\n ZodBranded: ZodBranded,\n ZodPipeline: ZodPipeline,\n ZodReadonly: ZodReadonly,\n custom: custom,\n Schema: ZodType,\n ZodSchema: ZodType,\n late: late,\n get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },\n coerce: coerce,\n any: anyType,\n array: arrayType,\n bigint: bigIntType,\n boolean: booleanType,\n date: dateType,\n discriminatedUnion: discriminatedUnionType,\n effect: effectsType,\n 'enum': enumType,\n 'function': functionType,\n 'instanceof': instanceOfType,\n intersection: intersectionType,\n lazy: lazyType,\n literal: literalType,\n map: mapType,\n nan: nanType,\n nativeEnum: nativeEnumType,\n never: neverType,\n 'null': nullType,\n nullable: nullableType,\n number: numberType,\n object: objectType,\n oboolean: oboolean,\n onumber: onumber,\n optional: optionalType,\n ostring: ostring,\n pipeline: pipelineType,\n preprocess: preprocessType,\n promise: promiseType,\n record: recordType,\n set: setType,\n strictObject: strictObjectType,\n string: stringType,\n symbol: symbolType,\n transformer: effectsType,\n tuple: tupleType,\n 'undefined': undefinedType,\n union: unionType,\n unknown: unknownType,\n 'void': voidType,\n NEVER: NEVER,\n ZodIssueCode: ZodIssueCode,\n quotelessJson: quotelessJson,\n ZodError: ZodError\n});\n\nexport { BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, ZodType as Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodType as ZodSchema, ZodSet, ZodString, ZodSymbol, ZodEffects as ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, datetimeRegex, z as default, errorMap as defaultErrorMap, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, getErrorMap, getParsedType, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setType as set, setErrorMap, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void, z };\n","import { z } from 'zod'\n\nexport const upgradableProductSchema = z.object({\n\tupgradableToId: z.string().max(255),\n\tupgradableFromId: z.string().max(255),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.any()).default({}),\n\tcreatedAt: z.date().nullable(),\n\tupdatedAt: z.date().nullable(),\n\tdeletedAt: z.date().nullable(),\n})\n\nexport type UpgradableProduct = z.infer<typeof upgradableProductSchema>\n","import { z } from 'zod'\n\nexport const VideoResourceSchema = z.object({\n\tid: z.string(),\n\tupdatedAt: z.coerce.date().optional(),\n\tcreatedAt: z.coerce.date().optional(),\n\ttitle: z.string().optional().nullable(),\n\tduration: z.number().optional().nullable(),\n\tmuxPlaybackId: z.string().optional().nullable(),\n\tmuxAssetId: z.string().optional().nullable(),\n\ttranscript: z.string().optional().nullable(),\n\ttranscriptWithScreenshots: z.string().optional().nullable(),\n\tsrt: z.string().optional().nullable(),\n\twordLevelSrt: z.string().optional().nullable(),\n\tstate: z.enum([\n\t\t'new',\n\t\t'processing',\n\t\t'preparing',\n\t\t'ready',\n\t\t'errored',\n\t\t'deleted',\n\t]),\n})\n\nexport type VideoResource = z.infer<typeof VideoResourceSchema>\n","import { z } from 'zod'\n\nexport const priceSchema = z.object({\n\tid: z.string().max(191),\n\tproductId: z.string().max(191).optional().nullable(),\n\torganizationId: z.string().max(191).optional().nullable(),\n\tnickname: z.string().max(191).optional().nullable(),\n\tstatus: z.number().int().default(0),\n\tunitAmount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\tcreatedAt: z.date().nullable(),\n\tfields: z.record(z.any()).default({}),\n})\n\nexport type Price = z.infer<typeof priceSchema>\n","import { z } from 'zod'\n\nimport { productSchema } from './product-schema'\n\nexport const ContentResourceResourceSchema = z.object({\n\tresourceId: z.string(),\n\tresourceOfId: z.string(),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.string(), z.any()).default({}).nullable(),\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresource: z.any(),\n})\n\nexport const ContentResourceSchema = z.object({\n\tid: z.string(),\n\ttype: z.string(),\n\tcreatedById: z.string(),\n\tcurrentVersionId: z.string().nullish(),\n\tfields: z.record(z.string(), z.any()).default({}).nullable().optional(),\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresources: z.array(ContentResourceResourceSchema).default([]).nullable(),\n\torganizationId: z.string().nullable(),\n\tcreatedByOrganizationMembershipId: z.string().nullable(),\n})\n\nexport const ContentResourceProductSchema = z.object({\n\tresourceId: z.string(),\n\tproductId: z.string(),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.string(), z.any()).default({}).nullable(),\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresource: z.any(),\n\tproduct: z.any(),\n})\n\nexport type ContentResource = z.infer<typeof ContentResourceSchema>\nexport type ContentResourceResource = z.infer<\n\ttypeof ContentResourceResourceSchema\n>\nexport type ContentResourceProduct = z.infer<\n\ttypeof ContentResourceProductSchema\n>\n\nexport const ResourceStateSchema = z.union([\n\tz.literal('draft'),\n\tz.literal('published'),\n\tz.literal('archived'),\n\tz.literal('deleted'),\n])\n\nexport const ResourceVisibilitySchema = z.union([\n\tz.literal('public'),\n\tz.literal('private'),\n\tz.literal('unlisted'),\n])\n","import { z } from 'zod'\n\nimport {\n\tContentResourceProductSchema,\n\tContentResourceSchema,\n} from './content-resource-schema'\nimport { priceSchema } from './price-schema'\n\nexport const productSchema = z.object({\n\tid: z.string().max(191),\n\torganizationId: z.string().max(191).optional().nullable(),\n\tname: z.string().max(191),\n\tkey: z.string().max(191).optional().nullable(),\n\ttype: z\n\t\t.enum(['live', 'self-paced', 'membership', 'cohort'])\n\t\t.default('self-paced'),\n\tfields: z.object({\n\t\tbody: z.string().nullable().optional(),\n\t\tdescription: z.string().nullish(),\n\t\tslug: z.string(),\n\t\timage: z\n\t\t\t.object({\n\t\t\t\turl: z.string(),\n\t\t\t\talt: z.string().optional().nullable(),\n\t\t\t\twidth: z.number().optional().nullable(),\n\t\t\t\theight: z.number().optional().nullable(),\n\t\t\t})\n\t\t\t.optional()\n\t\t\t.nullable(),\n\t\taction: z.string().optional().nullable().default('Buy Now'),\n\t\tstate: z\n\t\t\t.enum(['draft', 'published', 'archived', 'deleted'])\n\t\t\t.default('draft'),\n\t\tvisibility: z.enum(['public', 'private', 'unlisted']).default('unlisted'),\n\t}),\n\tcreatedAt: z.coerce.date().nullable(),\n\tstatus: z.number().int().default(0),\n\tquantityAvailable: z.number().int().default(-1),\n\tprice: priceSchema.nullable().optional(),\n\tresources: z.array(ContentResourceProductSchema).default([]).nullable(),\n})\n\nexport type Product = z.infer<typeof productSchema>\n\nexport const NewProductSchema = z.object({\n\tname: z.string().min(2).max(90),\n\tquantityAvailable: z.coerce.number().default(-1),\n\tprice: z.coerce.number().gte(0).default(0),\n\ttype: z\n\t\t.enum(['live', 'self-paced', 'membership', 'cohort'])\n\t\t.default('self-paced')\n\t\t.optional(),\n\tstate: z\n\t\t.enum(['draft', 'published', 'archived', 'deleted'])\n\t\t.default('draft')\n\t\t.optional(),\n\tvisibility: z\n\t\t.enum(['public', 'private', 'unlisted'])\n\t\t.default('unlisted')\n\t\t.optional(),\n})\n\nexport type NewProduct = z.infer<typeof NewProductSchema>\n","import { z } from 'zod'\n\nexport const userSchema = z.object({\n\tid: z.string().max(255),\n\tname: z.string().max(255).optional().nullable(),\n\trole: z.enum(['user', 'admin']).default('user'),\n\temail: z.string().max(255).email(),\n\temailVerified: z.coerce.date().nullish(),\n\timage: z.string().max(255).optional().nullable(),\n\tcreatedAt: z.coerce.date().nullish(),\n\tmemberships: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\torganizationId: z.string(),\n\t\t\t}),\n\t\t)\n\t\t.nullish()\n\t\t.default([]),\n\troles: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\tname: z.string(),\n\t\t\t\tdescription: z.string().nullable(),\n\t\t\t\tactive: z.boolean(),\n\t\t\t\tcreatedAt: z.coerce.date().nullish(),\n\t\t\t\tupdatedAt: z.coerce.date().nullish(),\n\t\t\t\tdeletedAt: z.coerce.date().nullish(),\n\t\t\t}),\n\t\t)\n\t\t.optional()\n\t\t.default([]),\n\torganizationRoles: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\torganizationId: z.string(),\n\t\t\t\tname: z.string(),\n\t\t\t\tdescription: z.string().nullable(),\n\t\t\t\tactive: z.boolean(),\n\t\t\t\tcreatedAt: z.coerce.date().nullish(),\n\t\t\t\tupdatedAt: z.coerce.date().nullish(),\n\t\t\t\tdeletedAt: z.coerce.date().nullish(),\n\t\t\t}),\n\t\t)\n\t\t.optional()\n\t\t.default([]),\n})\n\nexport type User = z.infer<typeof userSchema>\n","import { z } from 'zod'\n\nexport const couponSchema = z.object({\n\tid: z.string(),\n\tcode: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n\texpires: z.date().nullable(),\n\tfields: z.record(z.any()).default({}),\n\tmaxUses: z.number().int().default(-1),\n\tdefault: z.boolean().default(false),\n\tmerchantCouponId: z.string().max(191).optional().nullable(),\n\tstatus: z.number().int().default(0),\n\tusedCount: z.number().int().default(0),\n\tpercentageDiscount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\trestrictedToProductId: z.string().max(191).optional().nullable(),\n\tbulkPurchases: z.array(z.any()).default([]),\n\tredeemedBulkCouponPurchases: z.array(z.any()).default([]),\n\tbulkPurchaseId: z.string().max(191).optional().nullable(), // TODO: remove\n\torganizationId: z.string().max(191).optional().nullable(),\n})\n\nexport type Coupon = z.infer<typeof couponSchema>\n","import { z } from 'zod'\n\nimport { couponSchema } from './coupon-schema'\nimport { productSchema } from './product-schema'\nimport { userSchema } from './user-schema'\n\nexport const purchaseSchema = z.object({\n\tid: z.string().max(191),\n\tuserId: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date(),\n\ttotalAmount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\tipAddress: z.string().max(191).optional().nullable(),\n\tcity: z.string().max(191).optional().nullable(),\n\tstate: z.string().max(191).optional().nullable(),\n\tcountry: z.string().max(191).optional().nullable(),\n\tcouponId: z.string().max(191).optional().nullable(),\n\tproductId: z.string().max(191),\n\tmerchantChargeId: z.string().max(191).optional().nullable(),\n\tupgradedFromId: z.string().max(191).optional().nullable(),\n\tstatus: z.string().max(191).default('Valid'),\n\tbulkCouponId: z.string().max(191).optional().nullable(),\n\tmerchantSessionId: z.string().max(191).optional().nullable(),\n\tredeemedBulkCouponId: z.string().max(191).optional().nullable(),\n\tfields: z.record(z.any()).default({}),\n\tuser: userSchema.optional().nullable(),\n\tbulkCoupon: couponSchema.optional().nullable(),\n\tproduct: productSchema.optional().nullable(),\n\tpurchasedByorganizationMembershipId: z\n\t\t.string()\n\t\t.max(191)\n\t\t.optional()\n\t\t.nullable(),\n\torganizationId: z.string().max(191).optional().nullable(),\n})\n\nexport type Purchase = z.infer<typeof purchaseSchema>\n","import { z } from 'zod'\n\nexport const purchaseUserTransferSchema = z.object({\n\tid: z.string().max(191),\n\ttransferState: z\n\t\t.enum([\n\t\t\t'AVAILABLE',\n\t\t\t'INITIATED',\n\t\t\t'VERIFIED',\n\t\t\t'CANCELED',\n\t\t\t'EXPIRED',\n\t\t\t'CONFIRMED',\n\t\t\t'COMPLETED',\n\t\t])\n\t\t.default('AVAILABLE'),\n\tpurchaseId: z.string().max(191),\n\tsourceUserId: z.string().max(191),\n\ttargetUserId: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n\texpiresAt: z.date().nullable(),\n\tcanceledAt: z.date().nullable(),\n\tconfirmedAt: z.date().nullable(),\n\tcompletedAt: z.date().nullable(),\n})\n\nexport type PurchaseUserTransfer = z.infer<typeof purchaseUserTransferSchema>\n\nexport type PurchaseUserTransferState =\n\t| 'AVAILABLE'\n\t| 'INITIATED'\n\t| 'VERIFIED'\n\t| 'CANCELED'\n\t| 'EXPIRED'\n\t| 'CONFIRMED'\n\t| 'COMPLETED'\n","import { z } from 'zod'\n\nimport { ContentResourceSchema } from './content-resource-schema'\n\nexport const resourceProgressSchema = z.object({\n\tuserId: z.string().max(191),\n\tresourceId: z.string().max(191).optional().nullable(),\n\tcompletedAt: z.date().nullable(),\n})\n\nexport type ResourceProgress = z.infer<typeof resourceProgressSchema>\n\nexport const moduleProgressSchema = z.object({\n\tcompletedLessons: z.array(resourceProgressSchema),\n\tnextResource: ContentResourceSchema.partial().nullable(),\n\tpercentCompleted: z.number().default(0),\n\tcompletedLessonsCount: z.number().default(0),\n\ttotalLessonsCount: z.number().default(0),\n})\n\nexport type ModuleProgress = z.infer<typeof moduleProgressSchema>\n","import { z } from 'zod'\n\nexport const merchantCustomerSchema = z.object({\n\tid: z.string().max(191),\n\tuserId: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tidentifier: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tstatus: z.number().int().default(0),\n})\n\nexport type MerchantCustomer = z.infer<typeof merchantCustomerSchema>\n","import { z } from 'zod'\n\nexport const merchantPriceSchema = z.object({\n\tid: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tmerchantProductId: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date(),\n\tpriceId: z.string().max(191).optional().nullable(),\n})\n\nexport type MerchantPrice = z.infer<typeof merchantPriceSchema>\n","import { z } from 'zod'\n\nexport const merchantProductSchema = z.object({\n\tid: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tproductId: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n})\n\nexport type MerchantProduct = z.infer<typeof merchantProductSchema>\n","import { z } from 'zod'\n\nexport const merchantChargeSchema = z.object({\n\tid: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191),\n\tuserId: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tmerchantProductId: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tmerchantCustomerId: z.string().max(191),\n})\n\nexport type MerchantCharge = z.infer<typeof merchantChargeSchema>\n","import { z } from 'zod'\n\nexport const merchantCouponSchema = z.object({\n\tid: z.string().max(191),\n\tidentifier: z.string().max(191).optional().nullable(),\n\tstatus: z.number().int().default(0),\n\tmerchantAccountId: z.string().max(191),\n\tpercentageDiscount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\ttype: z.string().max(191),\n})\n\nexport type MerchantCoupon = z.infer<typeof merchantCouponSchema>\n","import { z } from 'zod'\n\nexport const merchantAccountSchema = z.object({\n\tid: z.string().max(191),\n\tlabel: z.string().max(191),\n\tidentifier: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tstatus: z.number().int().default(0),\n})\n\nexport type MerchantAccount = z.infer<typeof merchantAccountSchema>\n","import { z } from 'zod'\n\nexport const MerchantSessionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().nullable(),\n\tidentifier: z.string(),\n\tmerchantAccountId: z.string(),\n})\n\nexport type MerchantSession = z.infer<typeof MerchantSessionSchema>\n","import { z } from 'zod'\n\nexport const MerchantSubscriptionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().nullable(),\n\tmerchantAccountId: z.string(),\n\tstatus: z.number().default(0),\n\tcreatedAt: z.date().default(() => new Date()),\n\tlabel: z.string().nullable(),\n\tidentifier: z.string().nullable(),\n\tmerchantCustomerId: z.string(),\n\tmerchantProductId: z.string(),\n})\n\nexport type MerchantSubscription = z.infer<typeof MerchantSubscriptionSchema>\n","import { z } from 'zod'\n\nexport const OrganizationSchema = z.object({\n\tid: z.string(),\n\tname: z.string().nullable(),\n\tfields: z.record(z.any()).default({}),\n\timage: z.string().nullable(),\n\tcreatedAt: z.date(),\n})\n\nexport type Organization = z.infer<typeof OrganizationSchema>\n","import { z } from 'zod'\n\nimport { OrganizationSchema } from './organization-schema'\nimport { userSchema } from './user-schema'\n\nexport const OrganizationMemberSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().optional(),\n\trole: z.string().default('user'),\n\tinvitedById: z.string(),\n\tuserId: z.string(),\n\tfields: z.record(z.any()).default({}),\n\tcreatedAt: z.date().default(() => new Date()),\n\torganization: OrganizationSchema,\n\tuser: userSchema,\n})\n\nexport type OrganizationMember = z.infer<typeof OrganizationMemberSchema>\n","import { z } from 'zod'\n\nimport { MerchantSubscriptionSchema } from './merchant-subscription'\nimport { productSchema } from './product-schema'\n\nexport const SubscriptionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().optional(),\n\tproductId: z.string(),\n\tcreatedAt: z.date(),\n\tmerchantSubscriptionId: z.string(),\n\tstatus: z\n\t\t.enum([\n\t\t\t'incomplete',\n\t\t\t'incomplete_expired',\n\t\t\t'trialing',\n\t\t\t'active',\n\t\t\t'past_due',\n\t\t\t'canceled',\n\t\t\t'unpaid',\n\t\t\t'paused',\n\t\t])\n\t\t.default('active'),\n\tfields: z.record(z.any()).default({}),\n\tproduct: productSchema,\n\tmerchantSubscription: MerchantSubscriptionSchema.optional(),\n})\n\nexport type Subscription = z.infer<typeof SubscriptionSchema>\n","type ErrorOptions = Error | Record<string, unknown>\n\ntype ErrorType =\n\t| 'AdapterError'\n\t| 'UnknownAction'\n\t| 'UnsupportedStrategy'\n\t| 'MissingAdapter'\n\t| 'MissingAdapterMethods'\n\nexport class CourseBuilderError extends Error {\n\t/** The error type. Used to identify the error in the logs. */\n\ttype: ErrorType\n\t/**\n\t * Determines on which page an error should be handled. Typically `signIn` errors can be handled in-page.\n\t * Default is `\"error\"`.\n\t * @internal\n\t */\n\tkind?: 'error'\n\tcause?: Record<string, unknown> & { err?: Error }\n\tconstructor(\n\t\tmessage?: string | Error | ErrorOptions,\n\t\terrorOptions?: ErrorOptions,\n\t) {\n\t\tif (message instanceof Error) {\n\t\t\tsuper(undefined, {\n\t\t\t\tcause: { err: message, ...(message.cause as any), ...errorOptions },\n\t\t\t})\n\t\t} else if (typeof message === 'string') {\n\t\t\tif (errorOptions instanceof Error) {\n\t\t\t\terrorOptions = { err: errorOptions, ...(errorOptions.cause as any) }\n\t\t\t}\n\t\t\tsuper(message, errorOptions)\n\t\t} else {\n\t\t\tsuper(undefined, message)\n\t\t}\n\t\tthis.name = this.constructor.name\n\t\t// @ts-expect-error https://github.com/microsoft/TypeScript/issues/3841\n\t\tthis.type = this.constructor.type ?? 'CourseBuilderError'\n\t\t// @ts-expect-error https://github.com/microsoft/TypeScript/issues/3841\n\t\tthis.kind = this.constructor.kind ?? 'error'\n\n\t\tError.captureStackTrace?.(this, this.constructor)\n\t\tconst url = `https://errors.authjs.dev#${this.type.toLowerCase()}`\n\t\tthis.message += `${this.message ? '. ' : ''}Read more at ${url}`\n\t}\n}\n\nexport class AdapterError extends CourseBuilderError {\n\tstatic type = 'AdapterError'\n}\n\nexport class UnsupportedStrategy extends CourseBuilderError {\n\tstatic type = 'UnsupportedStrategy'\n}\n\nexport class MissingAdapter extends CourseBuilderError {\n\tstatic type = 'MissingAdapter'\n}\n\nexport class MissingAdapterMethods extends CourseBuilderError {\n\tstatic type = 'MissingAdapterMethods'\n}\n","import { CourseBuilderError } from '../../errors.js'\n\nexport type WarningCode =\n\t| 'debug-enabled'\n\t| 'env-url-basepath-redundant'\n\t| 'env-url-basepath-mismatch'\n\nexport interface LoggerInstance extends Record<string, Function> {\n\twarn: (code: WarningCode) => void\n\terror: (error: Error) => void\n\tdebug: (message: string, metadata?: unknown) => void\n}\n\nconst red = '\\x1b[31m'\nconst yellow = '\\x1b[33m'\nconst grey = '\\x1b[38;5;246m'\nconst reset = '\\x1b[0m'\n\nexport const logger: LoggerInstance = {\n\terror(error) {\n\t\tconst name = error instanceof CourseBuilderError ? error.type : error.name\n\t\tconsole.error(\n\t\t\t`${red}[coursebuilder][error]${reset} ${name}: ${error.message}`,\n\t\t)\n\t\tif (\n\t\t\terror.cause &&\n\t\t\ttypeof error.cause === 'object' &&\n\t\t\t'err' in error.cause &&\n\t\t\terror.cause.err instanceof Error\n\t\t) {\n\t\t\tconst { err, ...data } = error.cause\n\t\t\tconsole.error(`${red}[coursebuilder][cause]${reset}:`, err.stack)\n\t\t\tif (data)\n\t\t\t\tconsole.error(\n\t\t\t\t\t`${red}[coursebuilder][details]${reset}:`,\n\t\t\t\t\tJSON.stringify(data, null, 2),\n\t\t\t\t)\n\t\t} else if (error.stack) {\n\t\t\tconsole.error(error.stack.replace(/.*/, '').substring(1))\n\t\t}\n\t},\n\twarn(code) {\n\t\tconst url = `https://warnings.coursebuilder.dev#${code}`\n\t\tconsole.warn(\n\t\t\t`${yellow}[coursebuilder][warn][${code}]${reset}`,\n\t\t\t`Read more: ${url}`,\n\t\t)\n\t},\n\tdebug(message, metadata) {\n\t\tconsole.log(\n\t\t\t`${grey}[coursebuilder][debug]:${reset} ${message}`,\n\t\t\tJSON.stringify(metadata, null, 2),\n\t\t)\n\t},\n}\n\n/**\n * Override the built-in logger with user's implementation.\n * Any `undefined` level will use the default logger.\n */\nexport function setLogger(\n\tnewLogger: Partial<LoggerInstance> = {},\n\tdebug?: boolean,\n) {\n\t// Turn off debug logging if `debug` isn't set to `true`\n\tif (!debug) logger.debug = () => {}\n\n\tif (newLogger.error) logger.error = newLogger.error\n\tif (newLogger.warn) logger.warn = newLogger.warn\n\tif (newLogger.debug) logger.debug = newLogger.debug\n}\n","import { isBefore } from 'date-fns'\n\nimport { Coupon } from '../../schemas'\n\nexport const validateCoupon = (\n\tcoupon: Coupon | null,\n\tproductIds: string[] = [],\n) => {\n\tif (!coupon) {\n\t\treturn {\n\t\t\tisValid: false,\n\t\t\tisRedeemable: false,\n\t\t\terror: 'coupon-not-found',\n\t\t}\n\t}\n\n\tconst isUsedUp =\n\t\tcoupon.maxUses > 0 ? coupon.usedCount >= coupon.maxUses : false\n\n\tconst isExpired = coupon.expires\n\t\t? isBefore(new Date(coupon.expires), new Date())\n\t\t: false\n\n\tif (\n\t\tcoupon.restrictedToProductId &&\n\t\t!productIds.includes(coupon.restrictedToProductId)\n\t) {\n\t\treturn {\n\t\t\tisValid: false,\n\t\t\tisRedeemable: false,\n\t\t\terror: 'coupon-not-valid-for-product',\n\t\t}\n\t}\n\n\tconst isValid = !isUsedUp && !isExpired\n\n\treturn {\n\t\tisExpired,\n\t\tisUsedUp,\n\t\tisRedeemable: isValid && coupon.percentageDiscount >= 1 && !coupon.default,\n\t\tisValid,\n\t}\n}\n","import { AdapterAccount } from '@auth/core/adapters'\nimport { relations } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from './users.js'\n\nexport function getAccountsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Account',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\ttype: varchar('type', { length: 255 })\n\t\t\t\t.$type<AdapterAccount['type']>()\n\t\t\t\t.notNull(),\n\t\t\tprovider: varchar('provider', { length: 255 }).notNull(),\n\t\t\tproviderAccountId: varchar('providerAccountId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\trefresh_token: text('refresh_token'),\n\t\t\taccess_token: text('access_token'),\n\t\t\toauth_token: text('oauth_token'),\n\t\t\toauth_token_secret: text('oauth_token_secret'),\n\t\t\texpires_at: int('expires_at'),\n\t\t\ttoken_type: varchar('token_type', { length: 255 }),\n\t\t\tscope: varchar('scope', { length: 255 }),\n\t\t\tid_token: text('id_token'),\n\t\t\tsession_state: varchar('session_state', { length: 255 }),\n\t\t\trefresh_token_expires_in: int('refresh_token_expires_in'),\n\t\t},\n\t\t(account) => ({\n\t\t\tpk: primaryKey({\n\t\t\t\tcolumns: [account.provider, account.providerAccountId],\n\t\t\t}),\n\t\t\tuserIdIdx: index('userId_idx').on(account.userId),\n\t\t}),\n\t)\n}\n\nexport function getAccountsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst accounts = getAccountsSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\treturn relations(accounts, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [accounts.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getCommentsSchema } from '../communication/comment.js'\nimport { getCommunicationPreferencesSchema } from '../communication/communication-preferences.js'\nimport { getContentContributionsSchema } from '../content/content-contributions.js'\nimport { getContentResourceSchema } from '../content/content-resource.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getAccountsSchema } from './accounts.js'\nimport { getProfilesSchema } from './profiles.js'\nimport { getUserPermissionsSchema } from './user-permissions.js'\nimport { getUserPrefsSchema } from './user-prefs.js'\nimport { getUserRolesSchema } from './user-roles.js'\n\nexport function getUsersSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'User',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }),\n\t\t\trole: varchar('role', { length: 191 }).notNull().default('user'),\n\t\t\temail: varchar('email', { length: 255 }).notNull().unique(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\temailVerified: timestamp('emailVerified', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\timage: varchar('image', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(user) => ({\n\t\t\temailIdx: index('email_idx').on(user.email),\n\t\t\troleIdx: index('role_idx').on(user.role),\n\t\t\tcreatedAtIdx: index('created_at_idx').on(user.createdAt),\n\t\t}),\n\t)\n}\n\nexport function getUsersRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst users = getUsersSchema(mysqlTable)\n\tconst profiles = getProfilesSchema(mysqlTable)\n\tconst accounts = getAccountsSchema(mysqlTable)\n\tconst communicationPreferences = getCommunicationPreferencesSchema(mysqlTable)\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\tconst userPermissions = getUserPermissionsSchema(mysqlTable)\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst comments = getCommentsSchema(mysqlTable)\n\tconst userPrefs = getUserPrefsSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(users, ({ many, one }) => ({\n\t\tprofiles: many(profiles, {\n\t\t\trelationName: 'profiles',\n\t\t}),\n\t\taccounts: many(accounts, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tpurchases: many(purchases, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcommunicationPreferences: many(communicationPreferences, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\troles: many(userRoles, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tuserPermissions: many(userPermissions, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcontributions: many(contentContributions, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcreatedContent: many(contentResource, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcomments: many(comments, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tprefs: many(userPrefs, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMemberships: many(organizationMemberships, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdecimal,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getOrganizationsSchema } from '../org/organizations.js'\nimport { getCouponSchema } from './coupon.js'\nimport { getMerchantChargeSchema } from './merchant-charge.js'\nimport { getMerchantSessionSchema } from './merchant-session.js'\nimport { getProductSchema } from './product.js'\n\nexport function getPurchaseSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Purchase',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }),\n\t\t\tpurchasedByorganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\ttotalAmount: decimal('totalAmount', {\n\t\t\t\tprecision: 65,\n\t\t\t\tscale: 30,\n\t\t\t}).notNull(),\n\t\t\tipAddress: varchar('ip_address', { length: 191 }),\n\t\t\tcity: varchar('city', { length: 191 }),\n\t\t\tstate: varchar('state', { length: 191 }),\n\t\t\tcountry: varchar('country', { length: 191 }),\n\t\t\tcouponId: varchar('couponId', { length: 191 }),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tmerchantChargeId: varchar('merchantChargeId', { length: 191 }),\n\t\t\tupgradedFromId: varchar('upgradedFromId', { length: 191 }),\n\t\t\tstatus: varchar('status', { length: 191 }).default('Valid').notNull(),\n\t\t\tbulkCouponId: varchar('bulkCouponId', { length: 191 }),\n\t\t\tmerchantSessionId: varchar('merchantSessionId', { length: 191 }),\n\t\t\tredeemedBulkCouponId: varchar('redeemedBulkCouponId', { length: 191 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpurchaseId: primaryKey({ columns: [table.id], name: 'Purchase_id' }),\n\t\t\t\tmerchantChargeIdIdx: index('idx_Purchase_on_merchantChargeId').on(\n\t\t\t\t\ttable.merchantChargeId,\n\t\t\t\t),\n\t\t\t\tpurchaseUpgradedFromIdKey: unique('Purchase_upgradedFromId_key').on(\n\t\t\t\t\ttable.upgradedFromId,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\ttable.purchasedByorganizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getPurchaseRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst products = getProductSchema(mysqlTable)\n\tconst merchantCharges = getMerchantChargeSchema(mysqlTable)\n\tconst merchantSessions = getMerchantSessionSchema(mysqlTable)\n\tconst coupons = getCouponSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(purchases, ({ many, one }) => ({\n\t\tredeemedBulkCoupon: one(coupons, {\n\t\t\tfields: [purchases.redeemedBulkCouponId],\n\t\t\treferences: [coupons.id],\n\t\t\trelationName: 'redeemedBulkCoupon',\n\t\t}),\n\t\tuser: one(users, {\n\t\t\tfields: [purchases.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganization: one(organizations, {\n\t\t\tfields: [purchases.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tpurchasedBy: one(organizationMemberships, {\n\t\t\tfields: [purchases.purchasedByorganizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\tproduct: one(products, {\n\t\t\tfields: [purchases.productId],\n\t\t\treferences: [products.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tbulkCoupon: one(coupons, {\n\t\t\tfields: [purchases.bulkCouponId],\n\t\t\treferences: [coupons.id],\n\t\t\trelationName: 'bulkCoupon',\n\t\t}),\n\t\tmerchantCharge: one(merchantCharges, {\n\t\t\tfields: [purchases.merchantChargeId],\n\t\t\treferences: [merchantCharges.id],\n\t\t\trelationName: 'merchantCharge',\n\t\t}),\n\t\tmerchantSession: one(merchantSessions, {\n\t\t\tfields: [purchases.merchantSessionId],\n\t\t\treferences: [merchantSessions.id],\n\t\t\trelationName: 'merchantSession',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getOrganizationMembershipRolesSchema } from './organization-membership-roles.js'\nimport { getOrganizationsSchema } from './organizations.js'\n\nexport function getOrganizationMembershipsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'OrganizationMembership',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\trole: varchar('role', { length: 191 }).notNull().default('user'),\n\t\t\tinvitedById: varchar('invitedById', { length: 255 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(organizationMembership) => ({\n\t\t\troleIdx: index('role_idx').on(organizationMembership.role),\n\t\t\tcreatedAtIdx: index('created_at_idx').on(\n\t\t\t\torganizationMembership.createdAt,\n\t\t\t),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(\n\t\t\t\torganizationMembership.organizationId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationMembershipsRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst users = getUsersSchema(mysqlTable)\n\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst organizationMembershipRoles =\n\t\tgetOrganizationMembershipRolesSchema(mysqlTable)\n\n\treturn relations(organizationMemberships, ({ one, many }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [organizationMemberships.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tinvitedBy: one(users, {\n\t\t\tfields: [organizationMemberships.invitedById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'invitedBy',\n\t\t}),\n\t\tpurchases: many(purchases),\n\t\torganization: one(organizations, {\n\t\t\tfields: [organizationMemberships.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\torganizationMembershipRoles: many(organizationMembershipRoles, {\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolesSchema } from '../auth/roles.js'\nimport { getOrganizationMembershipsSchema } from './organization-memberships.js'\nimport { getOrganizationsSchema } from './organizations.js'\n\nexport function getOrganizationMembershipRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'OrganizationMembershipRole',\n\t\t{\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ur) => ({\n\t\t\tpk: primaryKey({\n\t\t\t\tcolumns: [ur.organizationMembershipId, ur.roleId],\n\t\t\t\tname: 'pk',\n\t\t\t}),\n\t\t\torgMemberIdIdx: index('orgMemberId_idx').on(ur.organizationMembershipId),\n\t\t\troleIdIdx: index('roleId_idx').on(ur.roleId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ur.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationMembershipRolesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst organizationMembershipRoles =\n\t\tgetOrganizationMembershipRolesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\treturn relations(organizationMembershipRoles, ({ one }) => ({\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [organizationMembershipRoles.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\trole: one(roles, {\n\t\t\tfields: [organizationMembershipRoles.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t\torganization: one(organizations, {\n\t\t\tfields: [organizationMembershipRoles.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUserRolesSchema } from './user-roles.js'\n\nexport function getRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Role',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(role) => ({\n\t\t\tnameIdx: index('name_idx').on(role.name),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(role.organizationId),\n\t\t\tuniqueNamePerOrg: uniqueIndex('unique_name_per_org').on(\n\t\t\t\trole.organizationId,\n\t\t\t\trole.name,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getRolesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\n\treturn relations(roles, ({ many }) => ({\n\t\tuserRoles: many(userRoles, { relationName: 'role' }),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolesSchema } from './roles.js'\nimport { getUsersSchema } from './users.js'\n\nexport function getUserRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserRole',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ur) => ({\n\t\t\tpk: primaryKey({ columns: [ur.userId, ur.roleId] }),\n\t\t\tuserIdIdx: index('userId_idx').on(ur.userId),\n\t\t\troleIdIdx: index('roleId_idx').on(ur.roleId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ur.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserRolesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\treturn relations(userRoles, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [userRoles.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\trole: one(roles, {\n\t\t\tfields: [userRoles.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getSubscriptionSchema } from '../commerce/subscription.js'\nimport { getOrganizationMembershipsSchema } from './organization-memberships.js'\n\nexport function getOrganizationsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Organization',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\timage: varchar('image', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(organization) => ({\n\t\t\tcreatedAtIdx: index('created_at_idx').on(organization.createdAt),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst subscriptions = getSubscriptionSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(organizations, ({ many }) => ({\n\t\tpurchases: many(purchases, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tsubscriptions: many(subscriptions, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tmembers: many(organizationMemberships, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getOrganizationsSchema } from '../org/organizations.js'\nimport { getMerchantSubscriptionSchema } from './merchant-subscription.js'\nimport { getProductSchema } from './product.js'\n\n// TODO: do we add a renewal date here? probably just add that stuff to fields\n// \teven status feels out of place at the top level maybe\nexport function getSubscriptionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Subscription',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tmerchantSubscriptionId: varchar('merchantSubscriptionId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: varchar('status', { length: 191 }).default('active').notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tsubscriptionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'Subscription_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getSubscriptionRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst subscriptions = getSubscriptionSchema(mysqlTable)\n\tconst products = getProductSchema(mysqlTable)\n\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst merchantSubscriptions = getMerchantSubscriptionSchema(mysqlTable)\n\n\treturn relations(subscriptions, ({ many, one }) => ({\n\t\torganization: one(organizations, {\n\t\t\tfields: [subscriptions.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tproduct: one(products, {\n\t\t\tfields: [subscriptions.productId],\n\t\t\treferences: [products.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tmerchantSubscription: one(merchantSubscriptions, {\n\t\t\tfields: [subscriptions.merchantSubscriptionId],\n\t\t\treferences: [merchantSubscriptions.id],\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantChargeSchema } from './merchant-charge.js'\nimport { getSubscriptionSchema } from './subscription.js'\n\nexport function getMerchantSubscriptionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantSubscription',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tlabel: varchar('label', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tmerchantCustomerId: varchar('merchantCustomerId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantSubscriptionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantSubscription_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getMerchantSubscriptionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst merchantSubscription = getMerchantSubscriptionSchema(mysqlTable)\n\tconst merchantCharge = getMerchantChargeSchema(mysqlTable)\n\tconst subscription = getSubscriptionSchema(mysqlTable)\n\treturn relations(merchantSubscription, ({ many, one }) => ({\n\t\tmerchantCharges: many(merchantCharge, {\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t\tsubscription: one(subscription, {\n\t\t\tfields: [merchantSubscription.id],\n\t\t\treferences: [subscription.merchantSubscriptionId],\n\t\t\trelationName: 'subscription',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantAccountSchema } from './merchant-account.js'\nimport { getMerchantCustomerSchema } from './merchant-customer.js'\nimport { getMerchantProductSchema } from './merchant-product.js'\nimport { getMerchantSubscriptionSchema } from './merchant-subscription.js'\n\nexport function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCharge',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantSubscriptionId: varchar('merchantSubscriptionId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tmerchantCustomerId: varchar('merchantCustomerId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantChargeId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCharge_id',\n\t\t\t\t}),\n\t\t\t\tmerchantChargeIdentifierKey: unique('MerchantCharge_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\tmerchantSubscriptionIdIdx: index('merchantSubscriptionId_idx').on(\n\t\t\t\t\ttable.merchantSubscriptionId,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getMerchantChargeRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst merchantCharge = getMerchantChargeSchema(mysqlTable)\n\tconst merchantAccount = getMerchantAccountSchema(mysqlTable)\n\tconst merchantProduct = getMerchantProductSchema(mysqlTable)\n\tconst merchantCustomer = getMerchantCustomerSchema(mysqlTable)\n\tconst merchantSubscription = getMerchantSubscriptionSchema(mysqlTable)\n\treturn relations(merchantCharge, ({ one }) => ({\n\t\tmerchantAccount: one(merchantAccount, {\n\t\t\tfields: [merchantCharge.merchantAccountId],\n\t\t\treferences: [merchantAccount.id],\n\t\t\trelationName: 'merchantAccount',\n\t\t}),\n\t\tmerchantProduct: one(merchantProduct, {\n\t\t\tfields: [merchantCharge.merchantProductId],\n\t\t\treferences: [merchantProduct.id],\n\t\t\trelationName: 'merchantProduct',\n\t\t}),\n\t\tmerchantCustomer: one(merchantCustomer, {\n\t\t\tfields: [merchantCharge.merchantCustomerId],\n\t\t\treferences: [merchantCustomer.id],\n\t\t\trelationName: 'merchantCustomer',\n\t\t}),\n\t\tmerchantSubscription: one(merchantSubscription, {\n\t\t\tfields: [merchantCharge.merchantSubscriptionId],\n\t\t\treferences: [merchantSubscription.id],\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantAccountSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantAccount',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tlabel: varchar('label', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantAccountId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantAccount_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantCustomerSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCustomer',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tstatus: int('status').default(0),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantCustomerId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCustomer_id',\n\t\t\t\t}),\n\t\t\t\tmerchantCustomerIdentifierKey: unique(\n\t\t\t\t\t'MerchantCustomer_identifier_key',\n\t\t\t\t).on(table.identifier),\n\t\t\t\tuserIdIdx: index('idx_MerchantCustomer_on_userId').on(table.userId),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantProduct',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantProductId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantProduct_id',\n\t\t\t\t}),\n\t\t\t\tmerchantProductIdentifierKey: unique(\n\t\t\t\t\t'MerchantProduct_identifier_key',\n\t\t\t\t).on(table.identifier),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceProductSchema } from '../content/content-resource-product.js'\nimport { getMerchantProductSchema } from './merchant-product.js'\nimport { getPriceSchema } from './price.js'\n\nexport function getProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Product',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 191 }).notNull(),\n\t\t\tkey: varchar('key', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 191 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tquantityAvailable: int('quantityAvailable').default(-1).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tproductId: primaryKey({ columns: [table.id], name: 'Product_id' }),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getProductRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst price = getPriceSchema(mysqlTable)\n\tconst merchantProduct = getMerchantProductSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\treturn relations(product, ({ one, many }) => ({\n\t\tprice: one(price, {\n\t\t\tfields: [product.id],\n\t\t\treferences: [price.productId],\n\t\t\trelationName: 'price',\n\t\t}),\n\t\tresources: many(contentResourceProduct, { relationName: 'product' }),\n\t\tmerchantProduct: one(merchantProduct, {\n\t\t\tfields: [product.id],\n\t\t\treferences: [merchantProduct.productId],\n\t\t\trelationName: 'merchantProduct',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getProductSchema } from '../commerce/product.js'\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceProduct',\n\t\t{\n\t\t\tproductId: varchar('productId', { length: 255 }).notNull(),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.productId, crr.resourceId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crr.productId),\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crr.resourceId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceProductRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\tconst product = getProductSchema(mysqlTable)\n\treturn relations(contentResourceProduct, ({ one }) => ({\n\t\tproduct: one(product, {\n\t\t\tfields: [contentResourceProduct.productId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceProduct.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resource',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getContentContributionsSchema } from './content-contributions.js'\nimport { getContentResourceProductSchema } from './content-resource-product.js'\nimport { getContentResourceResourceSchema } from './content-resource-resource.js'\nimport { getContentResourceTagSchema } from './content-resource-tag.js'\nimport { getContentResourceVersionSchema } from './content-resource-version.js'\nimport { getTagSchema } from './tag.js'\n\nexport function getContentResourceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResource',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedByOrganizationMembershipId: varchar(\n\t\t\t\t'createdByOrganizationMembershipId',\n\t\t\t\t{\n\t\t\t\t\tlength: 191,\n\t\t\t\t},\n\t\t\t),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tcreatedById: varchar('createdById', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcurrentVersionId: varchar('currentVersionId', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cm) => ({\n\t\t\ttypeIdx: index('type_idx').on(cm.type),\n\t\t\tcreatedByIdx: index('createdById_idx').on(cm.createdById),\n\t\t\tcreatedAtIdx: index('createdAt_idx').on(cm.createdAt),\n\t\t\tcurrentVersionIdIdx: index('currentVersionId_idx').on(\n\t\t\t\tcm.currentVersionId,\n\t\t\t),\n\t\t\tcreatedByOrganizationMembershipIdIdx: index(\n\t\t\t\t'createdByOrganizationMembershipId_idx',\n\t\t\t).on(cm.createdByOrganizationMembershipId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst contentResourceResource = getContentResourceResourceSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\tconst contentResourceVersion = getContentResourceVersionSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst tag = getTagSchema(mysqlTable)\n\treturn relations(contentResource, ({ one, many }) => ({\n\t\tcreatedBy: one(users, {\n\t\t\tfields: [contentResource.createdById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'creator',\n\t\t}),\n\t\tcreatedByOrganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [contentResource.createdByOrganizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'createdByOrganizationMembership',\n\t\t}),\n\t\ttags: many(contentResourceTag, { relationName: 'contentResource' }),\n\t\tresources: many(contentResourceResource, { relationName: 'resourceOf' }),\n\t\tresourceOf: many(contentResourceResource, { relationName: 'resource' }),\n\t\tresourceProducts: many(contentResourceProduct, {\n\t\t\trelationName: 'resource',\n\t\t}),\n\t\tcontributions: many(contentContributions, {\n\t\t\trelationName: 'contributions',\n\t\t}),\n\t\tcurrentVersion: one(contentResourceVersion, {\n\t\t\tfields: [contentResource.currentVersionId],\n\t\t\treferences: [contentResourceVersion.id],\n\t\t\trelationName: 'currentVersionResource',\n\t\t}),\n\t\tversions: many(contentResourceVersion, { relationName: 'resource' }),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getContentResourceSchema } from './content-resource.js'\nimport { getContributionTypesSchema } from './contribution-types.js'\n\nexport function getContentContributionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentContribution',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tcontentId: varchar('contentId', { length: 255 }).notNull(),\n\t\t\tcontributionTypeId: varchar('contributionTypeId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cc) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(cc.userId),\n\t\t\tcontentIdIdx: index('contentId_idx').on(cc.contentId),\n\t\t\tcontributionTypeIdIdx: index('contributionTypeId_idx').on(\n\t\t\t\tcc.contributionTypeId,\n\t\t\t),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcc.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getContentContributionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contributionTypes = getContributionTypesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(contentContributions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [contentContributions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcontent: one(contentResource, {\n\t\t\tfields: [contentContributions.contentId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'contributions',\n\t\t}),\n\t\tcontributionType: one(contributionTypes, {\n\t\t\tfields: [contentContributions.contributionTypeId],\n\t\t\treferences: [contributionTypes.id],\n\t\t\trelationName: 'contributionType',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [contentContributions.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentContributionsSchema } from './content-contributions.js'\n\nexport function getContributionTypesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContributionType',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tslug: varchar('slug', { length: 255 }).notNull().unique(),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ct) => ({\n\t\t\tnameIdx: index('name_idx').on(ct.name),\n\t\t\tslugIdx: index('slug_idx').on(ct.slug),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ct.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContributionTypesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst contributionTypes = getContributionTypesSchema(mysqlTable)\n\n\treturn relations(contributionTypes, ({ many }) => ({}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceResourceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceResource',\n\t\t{\n\t\t\tresourceOfId: varchar('resourceOfId', { length: 255 }).notNull(),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.resourceOfId, crr.resourceId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crr.resourceOfId),\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crr.resourceId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceResourceRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contentResourceResource = getContentResourceResourceSchema(mysqlTable)\n\treturn relations(contentResourceResource, ({ one }) => ({\n\t\tresourceOf: one(contentResource, {\n\t\t\tfields: [contentResourceResource.resourceOfId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resourceOf',\n\t\t}),\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceResource.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resource',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceSchema } from './content-resource.js'\nimport { getTagSchema } from './tag.js'\n\nexport function getContentResourceTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceTag',\n\t\t{\n\t\t\tcontentResourceId: varchar('contentResourceId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttagId: varchar('tagId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(crt) => ({\n\t\t\tpk: primaryKey({ columns: [crt.contentResourceId, crt.tagId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(\n\t\t\t\tcrt.contentResourceId,\n\t\t\t),\n\t\t\ttagIdIdx: index('tagId_idx').on(crt.tagId),\n\t\t\tpositionIdx: index('position_idx').on(crt.position),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crt.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst tag = getTagSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\treturn relations(contentResourceTag, ({ one }) => ({\n\t\tcontentResource: one(contentResource, {\n\t\t\tfields: [contentResourceTag.contentResourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'contentResource',\n\t\t}),\n\t\ttag: one(tag, {\n\t\t\tfields: [contentResourceTag.tagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'tag',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceTagSchema } from './content-resource-tag.js'\nimport { getTagTagSchema } from './tag-tag.js'\n\nexport function getTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Tag',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(t) => ({\n\t\t\ttypeIdx: index('type_idx').on(t.type),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(t.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst tag = getTagSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\tconst tagTag = getTagTagSchema(mysqlTable)\n\treturn relations(tag, ({ many }) => ({\n\t\tresources: many(contentResourceTag, { relationName: 'contentResource' }),\n\t\tparentTags: many(tagTag, { relationName: 'childTag' }),\n\t\tchildTags: many(tagTag, { relationName: 'parentTag' }),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getTagSchema } from './tag.js'\n\nexport function getTagTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'TagTag',\n\t\t{\n\t\t\tparentTagId: varchar('parentTagId', { length: 255 }).notNull(),\n\t\t\tchildTagId: varchar('childTagId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(tt) => ({\n\t\t\tpk: primaryKey({ columns: [tt.parentTagId, tt.childTagId] }),\n\t\t\tparentTagIdIdx: index('parentTagId_idx').on(tt.parentTagId),\n\t\t\tchildTagIdIdx: index('childTagId_idx').on(tt.childTagId),\n\t\t\tpositionIdx: index('position_idx').on(tt.position),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(tt.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getTagTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst tag = getTagSchema(mysqlTable)\n\tconst tagTag = getTagTagSchema(mysqlTable)\n\treturn relations(tagTag, ({ one }) => ({\n\t\tparentTag: one(tag, {\n\t\t\tfields: [tagTag.parentTagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'parentTag',\n\t\t}),\n\t\tchildTag: one(tag, {\n\t\t\tfields: [tagTag.childTagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'childTag',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceVersionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceVersion',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\tparentVersionId: varchar('parentVersionId', { length: 255 }),\n\t\t\tversionNumber: int('versionNumber').notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tcreatedById: varchar('createdById', { length: 255 }).notNull(),\n\t\t},\n\t\t(crv) => ({\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crv.resourceId),\n\t\t\tparentVersionIdIdx: index('parentVersionId_idx').on(crv.parentVersionId),\n\t\t\tresourceIdVersionNumberIdx: index('resourceId_versionNumber_idx').on(\n\t\t\t\tcrv.resourceId,\n\t\t\t\tcrv.versionNumber,\n\t\t\t),\n\t\t\tuniqueResourceVersion: unique('uq_resource_version_number').on(\n\t\t\t\tcrv.resourceId,\n\t\t\t\tcrv.versionNumber,\n\t\t\t),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crv.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceVersionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentResourceVersion = getContentResourceVersionSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\n\treturn relations(contentResourceVersion, ({ one }) => ({\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceVersion.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'versions',\n\t\t}),\n\t\tparentVersion: one(contentResourceVersion, {\n\t\t\tfields: [contentResourceVersion.parentVersionId],\n\t\t\treferences: [contentResourceVersion.id],\n\t\t\trelationName: 'childVersions',\n\t\t}),\n\t\tcreatedBy: one(users, {\n\t\t\tfields: [contentResourceVersion.createdById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'createdVersions',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdecimal,\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantPriceSchema } from './merchant-price.js'\nimport { getProductSchema } from './product.js'\n\nexport function getPriceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Price',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tproductId: varchar('productId', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tnickname: varchar('nickname', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tunitAmount: decimal('unitAmount', { precision: 10, scale: 2 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpriceId: primaryKey({ columns: [table.id], name: 'Price_id' }),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getProductRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst price = getPriceSchema(mysqlTable)\n\tconst merchantPrice = getMerchantPriceSchema(mysqlTable)\n\treturn relations(price, ({ one, many }) => ({\n\t\tproduct: one(product, {\n\t\t\tfields: [price.productId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tmerchantPrice: one(merchantPrice, {\n\t\t\tfields: [price.id],\n\t\t\treferences: [merchantPrice.priceId],\n\t\t\trelationName: 'merchantPrice',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantPriceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantPrice',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: int('status').default(0),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tpriceId: varchar('priceId', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantPriceId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantPrice_id',\n\t\t\t\t}),\n\t\t\t\tmerchantPriceIdentifierKey: unique('MerchantPrice_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tboolean,\n\tdecimal,\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantCouponSchema } from './merchant-coupon.js'\nimport { getProductSchema } from './product.js'\nimport { getPurchaseSchema } from './purchase.js'\n\nexport function getCouponSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Coupon',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcode: varchar('code', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date', fsp: 3 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tmaxUses: int('maxUses').default(-1).notNull(),\n\t\t\tdefault: boolean('default').default(false).notNull(),\n\t\t\tmerchantCouponId: varchar('merchantCouponId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tusedCount: int('usedCount').default(0).notNull(),\n\t\t\tpercentageDiscount: decimal('percentageDiscount', {\n\t\t\t\tprecision: 3,\n\t\t\t\tscale: 2,\n\t\t\t}).notNull(),\n\t\t\trestrictedToProductId: varchar('restrictedToProductId', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tcouponIdCodeIndex: index('Coupon_id_code_index').on(\n\t\t\t\t\ttable.id,\n\t\t\t\t\ttable.code,\n\t\t\t\t),\n\t\t\t\tcouponId: primaryKey({ columns: [table.id], name: 'Coupon_id' }),\n\t\t\t\tcouponCodeKey: unique('Coupon_code_key').on(table.code),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getCouponRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst purchase = getPurchaseSchema(mysqlTable)\n\tconst coupon = getCouponSchema(mysqlTable)\n\tconst merchantCoupon = getMerchantCouponSchema(mysqlTable)\n\treturn relations(coupon, ({ many, one }) => ({\n\t\tredeemedBulkCouponPurchases: many(purchase, {\n\t\t\trelationName: 'redeemedBulkCoupon',\n\t\t}),\n\t\tmerchantCoupon: one(merchantCoupon, {\n\t\t\tfields: [coupon.merchantCouponId],\n\t\t\treferences: [merchantCoupon.id],\n\t\t\trelationName: 'merchantCoupon',\n\t\t}),\n\t\tproduct: one(getProductSchema(mysqlTable), {\n\t\t\tfields: [coupon.restrictedToProductId],\n\t\t\treferences: [getProductSchema(mysqlTable).id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tbulkPurchases: many(purchase, {\n\t\t\trelationName: 'bulkCoupon',\n\t\t}),\n\t}))\n}\n","import {\n\tdecimal,\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantCouponSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCoupon',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tpercentageDiscount: decimal('percentageDiscount', {\n\t\t\t\tprecision: 3,\n\t\t\t\tscale: 2,\n\t\t\t}).notNull(),\n\t\t\ttype: varchar('type', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantCouponId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCoupon_id',\n\t\t\t\t}),\n\t\t\t\tmerchantCouponIdentifierKey: unique('MerchantCoupon_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import {\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantSessionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantSession',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantSessionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantSession_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\n\nexport function getCommentsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Comment',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tcontext: json('context').$type<Record<string, any>>().default({}),\n\t\t\ttext: text('text').notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.id] }),\n\t\t\tcrrUserIdIdKey: index('crr_userIdId_idx').on(crr.userId),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcrr.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getCommentRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst comment = getCommentsSchema(mysqlTable)\n\tconst user = getUsersSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(comment, ({ one }) => ({\n\t\tuser: one(user, {\n\t\t\tfields: [comment.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [comment.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getCommunicationChannelSchema } from './communication-channel.js'\nimport { getCommunicationPreferenceTypesSchema } from './communication-preference-types.js'\n\nexport function getCommunicationPreferencesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'CommunicationPreference',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tchannelId: varchar('channelId', { length: 255 }).notNull(),\n\t\t\tpreferenceLevel: mysqlEnum('preferenceLevel', ['low', 'medium', 'high'])\n\t\t\t\t.notNull()\n\t\t\t\t.default('medium'),\n\t\t\tpreferenceTypeId: varchar('preferenceTypeId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\toptInAt: timestamp('optInAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\toptOutAt: timestamp('optOutAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cp) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(cp.userId),\n\t\t\tpreferenceTypeIdx: index('preferenceTypeId_idx').on(cp.preferenceTypeId),\n\t\t\tchannelIdIdx: index('channelId_idx').on(cp.channelId),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcp.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getCommunicationPreferencesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst communicationPreferences = getCommunicationPreferencesSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst communicationChannel = getCommunicationChannelSchema(mysqlTable)\n\tconst communicationPreferenceTypes =\n\t\tgetCommunicationPreferenceTypesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(communicationPreferences, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [communicationPreferences.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [communicationPreferences.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\tchannel: one(communicationChannel, {\n\t\t\tfields: [communicationPreferences.channelId],\n\t\t\treferences: [communicationChannel.id],\n\t\t\trelationName: 'channel',\n\t\t}),\n\t\tpreferenceType: one(communicationPreferenceTypes, {\n\t\t\tfields: [communicationPreferences.preferenceTypeId],\n\t\t\treferences: [communicationPreferenceTypes.id],\n\t\t\trelationName: 'preferenceType',\n\t\t}),\n\t}))\n}\n","import {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getCommunicationChannelSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'CommunicationChannel',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cc) => ({\n\t\t\tnameIdx: index('name_idx').on(cc.name),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(cc.organizationId),\n\t\t}),\n\t)\n}\n","import {\n\tboolean,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getCommunicationPreferenceTypesSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\treturn mysqlTable('CommunicationPreferenceType', {\n\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\tdescription: text('description'),\n\t\tactive: boolean('active').notNull().default(true),\n\t\tcreatedAt: timestamp('createdAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}).defaultNow(),\n\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}),\n\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}),\n\t})\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from './users.js'\n\nexport function getProfilesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Profile',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(profile) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(profile.userId),\n\t\t\tuniqueUserType: uniqueIndex('unique_user_type_idx').on(\n\t\t\t\tprofile.userId,\n\t\t\t\tprofile.type,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getProfilesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst profiles = getProfilesSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\treturn relations(profiles, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [profiles.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'profiles',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPermissionsSchema } from './permissions.js'\nimport { getUsersSchema } from './users.js'\n\nexport function getUserPermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserPermission',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tpermissionId: varchar('permissionId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(up) => ({\n\t\t\tpk: primaryKey({ columns: [up.userId, up.permissionId] }),\n\t\t\tuserIdIdx: index('userId_idx').on(up.userId),\n\t\t\tpermissionIdIdx: index('permissionId_idx').on(up.permissionId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(up.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserPermissionsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst userPermissions = getUserPermissionsSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst permissions = getPermissionsSchema(mysqlTable)\n\treturn relations(userPermissions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [userPermissions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tpermission: one(permissions, {\n\t\t\tfields: [userPermissions.permissionId],\n\t\t\treferences: [permissions.id],\n\t\t\trelationName: 'permission',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolePermissionsSchema } from './role-permissions.js'\n\nexport function getPermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Permission',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }).notNull().unique(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(permission) => ({\n\t\t\tnameIdx: index('name_idx').on(permission.name),\n\t\t}),\n\t)\n}\n\nexport function getPermissionsRelationsSchema(mysqlTable: MySqlTableFn) {\n\treturn relations(getPermissionsSchema(mysqlTable), ({ many }) => ({}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\n\nexport function getUserPrefsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserPrefs',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 191 }).default('Global').notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.id] }),\n\t\t\tcrrUserIdIdKey: index('crr_userIdId_idx').on(crr.userId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserPrefsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst userPrefs = getUserPrefsSchema(mysqlTable)\n\tconst user = getUsersSchema(mysqlTable)\n\treturn relations(userPrefs, ({ one }) => ({\n\t\tuser: one(user, {\n\t\t\tfields: [userPrefs.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from './users.js'\n\nexport function getDeviceAccessTokenSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'DeviceAccessToken',\n\t\t{\n\t\t\ttoken: varchar('token', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.token] }),\n\t\t\tuserIdIdx: index('userId_idx').on(crr.userId),\n\t\t}),\n\t)\n}\n\nexport function getDeviceAccessTokenRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst deviceAccessToken = getDeviceAccessTokenSchema(mysqlTable)\n\tconst user = getUsersSchema(mysqlTable)\n\treturn relations(deviceAccessToken, ({ one }) => ({\n\t\tverifiedBy: one(user, {\n\t\t\tfields: [deviceAccessToken.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from './users.js'\n\nexport function getDeviceVerificationSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'DeviceVerification',\n\t\t{\n\t\t\tverifiedByUserId: varchar('verifiedByUserId', { length: 255 }),\n\t\t\tdeviceCode: varchar('deviceCode', { length: 191 }).notNull(),\n\t\t\tuserCode: text('userCode').notNull(),\n\t\t\texpires: timestamp('expires', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tverifiedAt: timestamp('verifiedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.deviceCode] }),\n\t\t}),\n\t)\n}\n\nexport function getDeviceVerificationRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst deviceVerification = getDeviceVerificationSchema(mysqlTable)\n\tconst user = getUsersSchema(mysqlTable)\n\treturn relations(deviceVerification, ({ one }) => ({\n\t\tverifiedBy: one(user, {\n\t\t\tfields: [deviceVerification.verifiedByUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPermissionsSchema } from './permissions.js'\nimport { getRolesSchema } from './roles.js'\n\nexport function getRolePermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'RolePermission',\n\t\t{\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tpermissionId: varchar('permissionId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(rp) => ({\n\t\t\tpk: primaryKey({ columns: [rp.roleId, rp.permissionId] }),\n\t\t\troleIdIdx: index('roleId_idx').on(rp.roleId),\n\t\t\tpermissionIdIdx: index('permissionId_idx').on(rp.permissionId),\n\t\t}),\n\t)\n}\n\nexport function getRolePermissionsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst permissions = getPermissionsSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst rolePermissions = getRolePermissionsSchema(mysqlTable)\n\treturn relations(rolePermissions, ({ one }) => ({\n\t\trole: one(roles, {\n\t\t\tfields: [rolePermissions.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t\tpermission: one(permissions, {\n\t\t\tfields: [rolePermissions.permissionId],\n\t\t\treferences: [permissions.id],\n\t\t\trelationName: 'permission',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport { index, MySqlTableFn, timestamp, varchar } from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from './users.js'\n\nexport function getSessionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Session',\n\t\t{\n\t\t\tsessionToken: varchar('sessionToken', { length: 255 })\n\t\t\t\t.notNull()\n\t\t\t\t.primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date' }).notNull(),\n\t\t},\n\t\t(session) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(session.userId),\n\t\t}),\n\t)\n}\n\nexport function getSessionRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst sessions = getSessionsSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\treturn relations(sessions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [sessions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import {\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getVerificationTokensSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'VerificationToken',\n\t\t{\n\t\t\tidentifier: varchar('identifier', { length: 255 }).notNull(),\n\t\t\ttoken: varchar('token', { length: 255 }).notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date' }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t},\n\t\t(vt) => ({\n\t\t\tpk: primaryKey({ columns: [vt.identifier, vt.token] }),\n\t\t}),\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tmysqlEnum,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getPurchaseSchema } from './purchase.js'\n\nexport function getPurchaseUserTransferSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'PurchaseUserTransfer',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\ttransferState: mysqlEnum('transferState', [\n\t\t\t\t'AVAILABLE',\n\t\t\t\t'INITIATED',\n\t\t\t\t'VERIFIED',\n\t\t\t\t'CANCELED',\n\t\t\t\t'EXPIRED',\n\t\t\t\t'CONFIRMED',\n\t\t\t\t'COMPLETED',\n\t\t\t])\n\t\t\t\t.default('AVAILABLE')\n\t\t\t\t.notNull(),\n\t\t\tpurchaseId: varchar('purchaseId', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tsourceUserId: varchar('sourceUserId', { length: 191 }).notNull(),\n\t\t\ttargetUserId: varchar('targetUserId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\texpiresAt: timestamp('expiresAt', { mode: 'date', fsp: 3 }),\n\t\t\tcanceledAt: timestamp('canceledAt', { mode: 'date', fsp: 3 }),\n\t\t\tconfirmedAt: timestamp('confirmedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcompletedAt: timestamp('completedAt', { mode: 'date', fsp: 3 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpurchaseUserTransferId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'PurchaseUserTransfer_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getPurchaseUserTransferRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst purchaseUserTransfer = getPurchaseUserTransferSchema(mysqlTable)\n\tconst user = getUsersSchema(mysqlTable)\n\tconst purchase = getPurchaseSchema(mysqlTable)\n\treturn relations(purchaseUserTransfer, ({ one }) => ({\n\t\tsourceUser: one(user, {\n\t\t\tfields: [purchaseUserTransfer.sourceUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'sourceUser',\n\t\t}),\n\t\ttargetUser: one(user, {\n\t\t\tfields: [purchaseUserTransfer.targetUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'targetUser',\n\t\t}),\n\t\tpurchase: one(purchase, {\n\t\t\tfields: [purchaseUserTransfer.purchaseId],\n\t\t\treferences: [purchase.id],\n\t\t\trelationName: 'purchase',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getProductSchema } from './product.js'\n\nexport function getUpgradableProductsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UpgradableProducts',\n\t\t{\n\t\t\tupgradableToId: varchar('upgradableToId', { length: 255 }).notNull(),\n\t\t\tupgradableFromId: varchar('upgradableFrom', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.upgradableToId, crr.upgradableFromId] }),\n\t\t\tupgradableToIdIdx: index('upgradableFromId_idx').on(crr.upgradableToId),\n\t\t\tupgradableFromIdIdx: index('upgradableToId_idx').on(crr.upgradableFromId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUpgradableProductsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst upgradableProduct = getUpgradableProductsSchema(mysqlTable)\n\treturn relations(upgradableProduct, ({ one }) => ({\n\t\tupgradableTo: one(product, {\n\t\t\tfields: [upgradableProduct.upgradableToId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'upgradableTo',\n\t\t}),\n\t\tupgradableFrom: one(product, {\n\t\t\tfields: [upgradableProduct.upgradableFromId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'upgradableFrom',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tdatetime,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getLessonProgressSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'LessonProgress',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tlessonId: varchar('lessonId', { length: 191 }),\n\t\t\tlessonSlug: varchar('lessonSlug', { length: 191 }),\n\t\t\tlessonVersion: varchar('lessonVersion', { length: 191 }),\n\t\t\tsectionId: varchar('sectionId', { length: 191 }),\n\t\t\tmoduleId: varchar('moduleId', { length: 191 }),\n\t\t\tcompletedAt: datetime('completedAt', { mode: 'date', fsp: 3 }),\n\t\t\tupdatedAt: datetime('updatedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: datetime('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(crp) => {\n\t\t\treturn {\n\t\t\t\tuserIdLessonIdIdx: index('crp_userId_contentResourceId_idx').on(\n\t\t\t\t\tcrp.userId,\n\t\t\t\t\tcrp.lessonId,\n\t\t\t\t),\n\t\t\t\tuserIdIdx: index('userId_idx').on(crp.userId),\n\t\t\t\tlessonIdIdx: index('lessonId_idx').on(crp.lessonId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\tcrp.organizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tdatetime,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getResourceProgressSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ResourceProgress',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcompletedAt: datetime('completedAt', { mode: 'date', fsp: 3 }),\n\t\t\tupdatedAt: datetime('updatedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: datetime('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(crp) => {\n\t\t\treturn {\n\t\t\t\tuserIdLessonIdIdx: index('crp_userId_contentResourceId_idx').on(\n\t\t\t\t\tcrp.userId,\n\t\t\t\t\tcrp.resourceId,\n\t\t\t\t),\n\t\t\t\tpk: primaryKey({ columns: [crp.userId, crp.resourceId] }),\n\t\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crp.resourceId),\n\t\t\t\tuserIdIdx: index('resourceId_idx').on(crp.userId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\tcrp.organizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n","import {\n\tMySqlTableFn,\n\ttext,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getEntitlementTypesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'EntitlementType',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\t// Add any type-specific config fields here\n\t\t},\n\t\t(table) => ({\n\t\t\tuniqueName: uniqueIndex('unique_name_idx').on(table.name),\n\t\t}),\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getOrganizationsSchema } from '../org/organizations.js'\n\nexport function getEntitlementsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Entitlement',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tentitlementType: varchar('entitlementType', { length: 255 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tsourceType: varchar('sourceType', { length: 255 }).notNull(), // 'PURCHASE' | 'SUBSCRIPTION' | 'MANUAL' etc\n\t\t\tsourceId: varchar('sourceId', { length: 191 }).notNull(),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\texpiresAt: timestamp('expiresAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tupdatedAt: timestamp('updatedAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tdeletedAt: timestamp('deletedAt', { mode: 'date', fsp: 3 }),\n\t\t},\n\t\t(table) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(table.userId),\n\t\t\torgIdIdx: index('orgId_idx').on(table.organizationId),\n\t\t\tsourceIdx: index('source_idx').on(table.sourceType, table.sourceId),\n\t\t\ttypeIdx: index('type_idx').on(table.entitlementType),\n\t\t}),\n\t)\n}\n\nexport function getEntitlementRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst entitlements = getEntitlementsSchema(mysqlTable)\n\tconst users = getUsersSchema(mysqlTable)\n\tconst orgs = getOrganizationsSchema(mysqlTable)\n\tconst memberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(entitlements, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [entitlements.userId],\n\t\t\treferences: [users.id],\n\t\t}),\n\t\torganization: one(orgs, {\n\t\t\tfields: [entitlements.organizationId],\n\t\t\treferences: [orgs.id],\n\t\t}),\n\t\tmembership: one(memberships, {\n\t\t\tfields: [entitlements.organizationMembershipId],\n\t\t\treferences: [memberships.id],\n\t\t}),\n\t}))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;;qBAAoB;AACpB,IAAAA,mBAAoC;AACpC,IAAAC,uBAaO;AACP,IAAAC,sBAIO;AACP,oBAA+B;AAC/B,kBAAmB;;;ACvBnB,IAAI;AAAA,CACH,SAAUC,OAAM;AACb,EAAAA,MAAK,cAAc,CAAC,QAAQ;AAC5B,WAAS,SAAS,MAAM;AAAA,EAAE;AAAjB;AACT,EAAAA,MAAK,WAAW;AAChB,WAAS,YAAY,IAAI;AACrB,UAAM,IAAI,MAAM;AAAA,EACpB;AAFS;AAGT,EAAAA,MAAK,cAAc;AACnB,EAAAA,MAAK,cAAc,CAAC,UAAU;AAC1B,UAAM,MAAM,CAAC;AACb,eAAW,QAAQ,OAAO;AACtB,UAAI,IAAI,IAAI;AAAA,IAChB;A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N,2BAA2BzV,UAC7D,MAAMtG,OAAO6E,MAAMlG,qBAAqBiH,UAAU;QACjDjB,WAAOC,yBAAGnE,0BAA0BgF,YAAY2W,oBAAAA;MACjD,CAAA,CAAA;AAGD,UAAI,CAACC,2BAA2B9V,SAAS;AACxC,cAAM,IAAI9E,MACT,gDAAgD2a,oBAAAA,IAAwBC,2BAA2BzZ,KAAK,EAAE;MAE5G;AAEA,YAAM0Z,qBAAqBV,mBAAmBtV,UAC7C,MAAMtG,OAAO6E,MAAM9F,aAAa6G,UAAU;QACzCjB,WAAOC,yBACNlE,kBAAkBob,wBAClBO,2BAA2B3V,KAAKrE,EAAE;QAEnCgG,MAAM;UACLyB,SAAS;QACV;MACD,CAAA,CAAA;AAGD,UAAI,CAACwS,mBAAmB/V,SAAS;AAChC,cAAM,IAAI9E,MACT,mDAAmD4a,2BAA2B3V,KAAKrE,EAAE,IAAIia,mBAAmB1Z,KAAK,EAAE;MAErH;AAEA,aAAO0Z,mBAAmB5V;IAC3B;EACD;AAEA,SAAO/F;AACR;AArlFgBZ;","names":["import_date_fns","import_drizzle_orm","import_mysql_core","util","objectUtil","json","errorUtil","errorMap","_a","ctx","result","index","issues","elements","processed","r","_b","ZodFirstPartyTypeKind","__defProp","__name","util","__name","objectUtil","ZodParsedType","getParsedType","ZodIssueCode","quotelessJson","json","_ZodError","ZodError","errorMap","overrideErrorMap","setErrorMap","getErrorMap","makeIssue","EMPTY_PATH","addIssueToContext","_ParseStatus","_a","INVALID","ParseStatus","DIRTY","OK","isAborted","isDirty","isValid","isAsync","__classPrivateFieldGet","__classPrivateFieldSet","errorUtil","_ZodEnum_cache","_ZodNativeEnum_cache","_ParseInputLazyPath","ParseInputLazyPath","handleResult","processCreateParams","_ZodType","ZodEffects","ZodFirstPartyTypeKind","ZodOptional","ZodNullable","ZodArray","ZodPromise","ZodUnion","ZodIntersection","ZodDefault","ZodBranded","ZodCatch","ZodPipeline","ZodReadonly","ZodType","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","nanoidRegex","jwtRegex","durationRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv4CidrRegex","ipv6Regex","ipv6CidrRegex","base64Regex","base64urlRegex","dateRegexSource","dateRegex","timeRegexSource","timeRegex","datetimeRegex","isValidIP","isValidJWT","isValidCidr","_ZodString","ctx","ZodString","floatSafeRemainder","_ZodNumber","ZodNumber","_ZodBigInt","ZodBigInt","_ZodBoolean","ZodBoolean","_ZodDate","ZodDate","_ZodSymbol","ZodSymbol","_ZodUndefined","ZodUndefined","_ZodNull","ZodNull","_ZodAny","ZodAny","_ZodUnknown","ZodUnknown","_ZodNever","ZodNever","_ZodVoid","ZodVoid","_ZodArray","result","deepPartialify","ZodObject","ZodTuple","_ZodObject","index","createZodEnum","_ZodUnion","issues","getDiscriminator","ZodLazy","ZodLiteral","ZodEnum","ZodNativeEnum","_ZodDiscriminatedUnion","ZodDiscriminatedUnion","mergeValues","_ZodIntersection","_ZodTuple","_ZodRecord","ZodRecord","_ZodMap","ZodMap","_ZodSet","elements","ZodSet","_ZodFunction","ZodFunction","_ZodLazy","_ZodLiteral","_ZodEnum","_ZodNativeEnum","_ZodPromise","_ZodEffects","processed","_ZodOptional","_ZodNullable","_ZodDefault","_ZodCatch","_ZodNaN","ZodNaN","BRAND","_ZodBranded","_ZodPipeline","_ZodReadonly","cleanParams","custom","r","_b","late","instanceOfType","stringType","numberType","nanType","bigIntType","booleanType","dateType","symbolType","undefinedType","nullType","anyType","unknownType","neverType","voidType","arrayType","objectType","strictObjectType","unionType","discriminatedUnionType","intersectionType","tupleType","recordType","mapType","setType","functionType","lazyType","literalType","enumType","nativeEnumType","promiseType","effectsType","optionalType","nullableType","preprocessType","pipelineType","ostring","onumber","oboolean","coerce","NEVER","z","upgradableProductSchema","z","object","upgradableToId","string","max","upgradableFromId","position","number","default","metadata","record","any","createdAt","date","nullable","updatedAt","deletedAt","VideoResourceSchema","z","object","id","string","updatedAt","coerce","date","optional","createdAt","title","nullable","duration","number","muxPlaybackId","muxAssetId","transcript","transcriptWithScreenshots","srt","wordLevelSrt","state","enum","priceSchema","z","object","id","string","max","productId","optional","nullable","organizationId","nickname","status","number","int","default","unitAmount","coerce","refine","value","decimalPlaces","toString","split","length","createdAt","date","fields","record","any","ContentResourceResourceSchema","z","object","resourceId","string","resourceOfId","position","number","default","metadata","record","any","nullable","createdAt","coerce","date","updatedAt","deletedAt","resource","ContentResourceSchema","id","type","createdById","currentVersionId","nullish","fields","optional","resources","array","organizationId","createdByOrganizationMembershipId","ContentResourceProductSchema","productId","product","ResourceStateSchema","union","literal","ResourceVisibilitySchema","productSchema","z","object","id","string","max","organizationId","optional","nullable","name","key","type","enum","default","fields","body","description","nullish","slug","image","url","alt","width","number","height","action","state","visibility","createdAt","coerce","date","status","int","quantityAvailable","price","priceSchema","resources","array","ContentResourceProductSchema","NewProductSchema","min","gte","userSchema","z","object","id","string","max","name","optional","nullable","role","enum","default","email","emailVerified","coerce","date","nullish","image","createdAt","memberships","array","organizationId","roles","description","active","boolean","updatedAt","deletedAt","organizationRoles","couponSchema","z","object","id","string","code","max","optional","nullable","createdAt","date","expires","fields","record","any","default","maxUses","number","int","boolean","merchantCouponId","status","usedCount","percentageDiscount","coerce","refine","value","decimalPlaces","toString","split","length","restrictedToProductId","bulkPurchases","array","redeemedBulkCouponPurchases","bulkPurchaseId","organizationId","purchaseSchema","z","object","id","string","max","userId","optional","nullable","createdAt","date","totalAmount","coerce","number","refine","value","decimalPlaces","toString","split","length","ipAddress","city","state","country","couponId","productId","merchantChargeId","upgradedFromId","status","default","bulkCouponId","merchantSessionId","redeemedBulkCouponId","fields","record","any","user","userSchema","bulkCoupon","couponSchema","product","productSchema","purchasedByorganizationMembershipId","organizationId","purchaseUserTransferSchema","z","object","id","string","max","transferState","enum","default","purchaseId","sourceUserId","targetUserId","optional","nullable","createdAt","date","expiresAt","canceledAt","confirmedAt","completedAt","resourceProgressSchema","z","object","userId","string","max","resourceId","optional","nullable","completedAt","date","moduleProgressSchema","completedLessons","array","nextResource","ContentResourceSchema","partial","percentCompleted","number","default","completedLessonsCount","totalLessonsCount","merchantCustomerSchema","z","object","id","string","max","userId","merchantAccountId","identifier","createdAt","date","nullable","status","number","int","default","merchantPriceSchema","z","object","id","string","max","merchantAccountId","merchantProductId","status","number","int","default","identifier","optional","nullable","createdAt","date","priceId","merchantProductSchema","z","object","id","string","max","merchantAccountId","productId","status","number","int","default","identifier","optional","nullable","createdAt","date","merchantChargeSchema","z","object","id","string","max","status","number","int","default","identifier","userId","merchantAccountId","merchantProductId","createdAt","date","nullable","merchantCustomerId","merchantCouponSchema","z","object","id","string","max","identifier","optional","nullable","status","number","int","default","merchantAccountId","percentageDiscount","coerce","refine","value","decimalPlaces","toString","split","length","type","merchantAccountSchema","z","object","id","string","max","label","identifier","createdAt","date","nullable","status","number","int","default","MerchantSessionSchema","z","object","id","string","organizationId","nullable","identifier","merchantAccountId","MerchantSubscriptionSchema","z","object","id","string","organizationId","nullable","merchantAccountId","status","number","default","createdAt","date","Date","label","identifier","merchantCustomerId","merchantProductId","OrganizationSchema","z","object","id","string","name","nullable","fields","record","any","default","image","createdAt","date","OrganizationMemberSchema","z","object","id","string","organizationId","optional","role","default","invitedById","userId","fields","record","any","createdAt","date","Date","organization","OrganizationSchema","user","userSchema","SubscriptionSchema","z","object","id","string","organizationId","optional","productId","createdAt","date","merchantSubscriptionId","status","enum","default","fields","record","any","product","productSchema","merchantSubscription","MerchantSubscriptionSchema","CourseBuilderError","_a","Error","constructor","message","errorOptions","type","cause","undefined","err","name","kind","captureStackTrace","url","toLowerCase","AdapterError","UnsupportedStrategy","_a","CourseBuilderError","type","MissingAdapter","_a","CourseBuilderError","type","MissingAdapterMethods","_a","CourseBuilderError","type","red","yellow","grey","reset","logger","error","name","CourseBuilderError","type","console","message","cause","err","Error","data","stack","JSON","stringify","replace","substring","warn","code","url","debug","metadata","log","setLogger","newLogger","validateCoupon","__name","coupon","productIds","isValid","isRedeemable","error","isUsedUp","maxUses","usedCount","isExpired","expires","isBefore","Date","restrictedToProductId","includes","percentageDiscount","default","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getUserRolesSchema","mysqlTable","userId","varchar","length","notNull","roleId","active","boolean","default","organizationId","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ur","pk","primaryKey","columns","userIdIdx","index","on","roleIdIdx","organizationIdIdx","getUserRolesRelationsSchema","userRoles","users","getUsersSchema","roles","getRolesSchema","relations","one","user","fields","references","id","relationName","role","getRolesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","role","nameIdx","index","on","organizationIdIdx","uniqueNamePerOrg","uniqueIndex","getRolesRelationsSchema","roles","userRoles","getUserRolesSchema","relations","many","relationName","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getMerchantAccountSchema","mysqlTable","id","varchar","length","notNull","organizationId","status","int","default","createdAt","timestamp","mode","fsp","sql","label","identifier","table","merchantAccountId","primaryKey","columns","name","organizationIdIdx","index","on","import_drizzle_orm","import_mysql_core","getMerchantCustomerSchema","mysqlTable","id","varchar","length","notNull","organizationId","userId","merchantAccountId","identifier","createdAt","timestamp","mode","fsp","default","sql","status","int","table","merchantCustomerId","primaryKey","columns","name","merchantCustomerIdentifierKey","unique","on","userIdIdx","index","organizationIdIdx","import_drizzle_orm","import_mysql_core","getMerchantProductSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","productId","status","int","default","identifier","createdAt","timestamp","mode","fsp","sql","table","merchantProductId","primaryKey","columns","name","merchantProductIdentifierKey","unique","on","organizationIdIdx","index","getMerchantChargeSchema","mysqlTable","id","varchar","length","notNull","organizationId","status","int","default","identifier","userId","merchantAccountId","merchantProductId","merchantSubscriptionId","createdAt","timestamp","mode","fsp","sql","merchantCustomerId","table","merchantChargeId","primaryKey","columns","name","merchantChargeIdentifierKey","unique","on","merchantSubscriptionIdIdx","index","organizationIdIdx","getMerchantChargeRelationsSchema","merchantCharge","merchantAccount","getMerchantAccountSchema","merchantProduct","getMerchantProductSchema","merchantCustomer","getMerchantCustomerSchema","merchantSubscription","getMerchantSubscriptionSchema","relations","one","fields","references","relationName","getMerchantSubscriptionSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","status","int","default","createdAt","timestamp","mode","fsp","sql","label","identifier","merchantCustomerId","merchantProductId","table","merchantSubscriptionId","primaryKey","columns","name","organizationIdIdx","index","on","getMerchantSubscriptionRelationsSchema","merchantSubscription","merchantCharge","getMerchantChargeSchema","subscription","getSubscriptionSchema","relations","many","one","merchantCharges","relationName","fields","references","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getContributionTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","slug","unique","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ct","nameIdx","index","on","slugIdx","organizationIdIdx","getContributionTypesRelationsSchema","contributionTypes","relations","many","getContentContributionsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","organizationId","organizationMembershipId","contentId","contributionTypeId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","cc","userIdIdx","index","on","contentIdIdx","contributionTypeIdIdx","organizationMembershipIdIdx","getContentContributionRelationsSchema","contentContributions","users","getUsersSchema","contentResource","getContentResourceSchema","contributionTypes","getContributionTypesSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","relationName","content","contributionType","organizationMembership","import_drizzle_orm","import_mysql_core","getContentResourceResourceSchema","mysqlTable","resourceOfId","varchar","length","notNull","resourceId","position","double","default","metadata","json","$type","organizationId","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","contentResourceIdIdx","index","on","resourceIdIdx","organizationIdIdx","getContentResourceResourceRelationsSchema","contentResource","getContentResourceSchema","contentResourceResource","relations","one","resourceOf","fields","references","id","relationName","resource","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getTagTagSchema","mysqlTable","parentTagId","varchar","length","notNull","childTagId","position","double","default","metadata","json","$type","organizationId","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","tt","pk","primaryKey","columns","parentTagIdIdx","index","on","childTagIdIdx","positionIdx","organizationIdIdx","getTagTagRelationsSchema","tag","getTagSchema","tagTag","relations","one","parentTag","fields","references","id","relationName","childTag","getTagSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","t","typeIdx","index","on","organizationIdIdx","getTagRelationsSchema","tag","contentResourceTag","getContentResourceTagSchema","tagTag","getTagTagSchema","relations","many","resources","relationName","parentTags","childTags","getContentResourceTagSchema","mysqlTable","contentResourceId","varchar","length","notNull","organizationId","tagId","position","double","default","createdAt","timestamp","mode","fsp","sql","updatedAt","crt","pk","primaryKey","columns","contentResourceIdIdx","index","on","tagIdIdx","positionIdx","organizationIdIdx","getContentResourceTagRelationsSchema","contentResource","getContentResourceSchema","tag","getTagSchema","contentResourceTag","relations","one","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getContentResourceVersionSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","resourceId","parentVersionId","versionNumber","int","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","createdById","crv","resourceIdIdx","index","on","parentVersionIdIdx","resourceIdVersionNumberIdx","uniqueResourceVersion","unique","organizationIdIdx","getContentResourceVersionRelationsSchema","contentResourceVersion","contentResource","getContentResourceSchema","users","getUsersSchema","relations","one","resource","references","relationName","parentVersion","createdBy","getContentResourceSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","createdByOrganizationMembershipId","type","createdById","fields","json","$type","default","currentVersionId","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","cm","typeIdx","index","on","createdByIdx","createdAtIdx","currentVersionIdIdx","createdByOrganizationMembershipIdIdx","getContentResourceRelationsSchema","contentResource","users","getUsersSchema","contentResourceResource","getContentResourceResourceSchema","contentResourceProduct","getContentResourceProductSchema","contentContributions","getContentContributionsSchema","contentResourceTag","getContentResourceTagSchema","contentResourceVersion","getContentResourceVersionSchema","organizationMemberships","getOrganizationMembershipsSchema","tag","getTagSchema","relations","one","many","createdBy","references","relationName","createdByOrganizationMembership","tags","resources","resourceOf","resourceProducts","contributions","currentVersion","versions","getContentResourceProductSchema","mysqlTable","productId","varchar","length","notNull","resourceId","organizationId","position","double","default","metadata","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","contentResourceIdIdx","index","on","resourceIdIdx","organizationIdIdx","getContentResourceProductRelationsSchema","contentResource","getContentResourceSchema","contentResourceProduct","product","getProductSchema","relations","one","fields","references","id","relationName","resource","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getMerchantPriceSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","merchantProductId","status","int","default","identifier","createdAt","timestamp","mode","fsp","sql","priceId","table","merchantPriceId","primaryKey","columns","name","merchantPriceIdentifierKey","unique","on","organizationIdIdx","index","getPriceSchema","mysqlTable","id","varchar","length","notNull","productId","organizationId","nickname","status","int","default","unitAmount","decimal","precision","scale","createdAt","timestamp","mode","fsp","sql","fields","json","$type","table","priceId","primaryKey","columns","name","organizationIdIdx","index","on","getProductSchema","mysqlTable","id","varchar","length","notNull","organizationId","name","key","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","status","int","quantityAvailable","table","productId","primaryKey","columns","organizationIdIdx","index","on","getProductRelationsSchema","product","price","getPriceSchema","merchantProduct","getMerchantProductSchema","contentResourceProduct","getContentResourceProductSchema","relations","one","many","references","relationName","resources","getSubscriptionSchema","mysqlTable","id","varchar","length","notNull","organizationId","productId","createdAt","timestamp","mode","fsp","default","sql","merchantSubscriptionId","status","fields","json","$type","table","subscriptionId","primaryKey","columns","name","organizationIdIdx","index","on","getSubscriptionRelationsSchema","subscriptions","products","getProductSchema","organizations","getOrganizationsSchema","merchantSubscriptions","getMerchantSubscriptionSchema","relations","many","one","organization","references","relationName","product","merchantSubscription","getOrganizationsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","fields","json","$type","default","image","createdAt","timestamp","mode","fsp","sql","organization","createdAtIdx","index","on","getOrganizationsRelationsSchema","organizations","purchases","getPurchaseSchema","subscriptions","getSubscriptionSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","relationName","members","getOrganizationMembershipRolesSchema","mysqlTable","organizationMembershipId","varchar","length","notNull","roleId","active","boolean","default","organizationId","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ur","pk","primaryKey","columns","name","orgMemberIdIdx","index","on","roleIdIdx","organizationIdIdx","getOrganizationMembershipRolesRelationsSchema","organizationMembershipRoles","organizationMemberships","getOrganizationMembershipsSchema","roles","getRolesSchema","organizations","getOrganizationsSchema","relations","one","organizationMembership","fields","references","id","relationName","role","organization","getOrganizationMembershipsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","role","default","invitedById","userId","fields","json","$type","createdAt","timestamp","mode","fsp","sql","organizationMembership","roleIdx","index","on","createdAtIdx","organizationIdIdx","getOrganizationMembershipsRelationsSchema","users","getUsersSchema","organizationMemberships","purchases","getPurchaseSchema","organizations","getOrganizationsSchema","organizationMembershipRoles","getOrganizationMembershipRolesSchema","relations","one","many","user","references","relationName","invitedBy","organization","import_drizzle_orm","import_mysql_core","import_mysql_core","getMerchantCouponSchema","mysqlTable","id","varchar","length","notNull","identifier","organizationId","status","int","default","merchantAccountId","percentageDiscount","decimal","precision","scale","type","table","merchantCouponId","primaryKey","columns","name","merchantCouponIdentifierKey","unique","on","organizationIdIdx","index","getCouponSchema","mysqlTable","id","varchar","length","notNull","organizationId","code","createdAt","timestamp","mode","fsp","default","sql","expires","fields","json","$type","maxUses","int","boolean","merchantCouponId","status","usedCount","percentageDiscount","decimal","precision","scale","restrictedToProductId","table","couponIdCodeIndex","index","on","couponId","primaryKey","columns","name","couponCodeKey","unique","organizationIdIdx","getCouponRelationsSchema","purchase","getPurchaseSchema","coupon","merchantCoupon","getMerchantCouponSchema","relations","many","one","redeemedBulkCouponPurchases","relationName","references","product","getProductSchema","bulkPurchases","import_mysql_core","getMerchantSessionSchema","mysqlTable","id","varchar","length","notNull","organizationId","identifier","merchantAccountId","table","merchantSessionId","primaryKey","columns","name","organizationIdIdx","index","on","getPurchaseSchema","mysqlTable","id","varchar","length","notNull","userId","purchasedByorganizationMembershipId","organizationId","createdAt","timestamp","mode","fsp","default","sql","totalAmount","decimal","precision","scale","ipAddress","city","state","country","couponId","productId","merchantChargeId","upgradedFromId","status","bulkCouponId","merchantSessionId","redeemedBulkCouponId","fields","json","$type","table","purchaseId","primaryKey","columns","name","merchantChargeIdIdx","index","on","purchaseUpgradedFromIdKey","unique","organizationIdIdx","organizationMembershipIdIdx","getPurchaseRelationsSchema","purchases","users","getUsersSchema","products","getProductSchema","merchantCharges","getMerchantChargeSchema","merchantSessions","getMerchantSessionSchema","coupons","getCouponSchema","organizations","getOrganizationsSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","one","redeemedBulkCoupon","references","relationName","user","organization","purchasedBy","product","bulkCoupon","merchantCharge","merchantSession","import_drizzle_orm","import_mysql_core","getCommentsSchema","mysqlTable","id","varchar","length","notNull","userId","organizationMembershipId","context","json","$type","default","text","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","crrUserIdIdKey","index","on","organizationMembershipIdIdx","getCommentRelationsSchema","comment","user","getUsersSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","one","fields","references","relationName","organizationMembership","import_drizzle_orm","import_mysql_core","import_mysql_core","getCommunicationChannelSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","cc","nameIdx","index","on","organizationIdIdx","import_mysql_core","getCommunicationPreferenceTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","getCommunicationPreferencesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","userId","organizationMembershipId","channelId","preferenceLevel","mysqlEnum","default","preferenceTypeId","active","boolean","createdAt","timestamp","mode","fsp","defaultNow","optInAt","optOutAt","updatedAt","deletedAt","cp","userIdIdx","index","on","preferenceTypeIdx","channelIdIdx","organizationMembershipIdIdx","getCommunicationPreferencesRelationsSchema","communicationPreferences","users","getUsersSchema","communicationChannel","getCommunicationChannelSchema","communicationPreferenceTypes","getCommunicationPreferenceTypesSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","relationName","organizationMembership","channel","preferenceType","import_drizzle_orm","import_mysql_core","getProfilesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","updatedAt","profile","userIdIdx","index","on","uniqueUserType","uniqueIndex","getProfilesRelationsSchema","profiles","users","getUsersSchema","relations","one","user","references","relationName","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getPermissionsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","unique","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","permission","nameIdx","index","on","getPermissionsRelationsSchema","relations","many","getUserPermissionsSchema","mysqlTable","userId","varchar","length","notNull","organizationId","permissionId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","up","pk","primaryKey","columns","userIdIdx","index","on","permissionIdIdx","organizationIdIdx","getUserPermissionsRelationsSchema","userPermissions","users","getUsersSchema","permissions","getPermissionsSchema","relations","one","user","fields","references","id","relationName","permission","import_drizzle_orm","import_mysql_core","getUserPrefsSchema","mysqlTable","id","varchar","length","notNull","organizationId","type","default","userId","fields","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","crrUserIdIdKey","index","on","organizationIdIdx","getUserPrefsRelationsSchema","userPrefs","user","getUsersSchema","relations","one","references","relationName","getUsersSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","role","default","email","unique","fields","json","$type","emailVerified","timestamp","mode","fsp","image","createdAt","sql","user","emailIdx","index","on","roleIdx","createdAtIdx","getUsersRelationsSchema","users","profiles","getProfilesSchema","accounts","getAccountsSchema","communicationPreferences","getCommunicationPreferencesSchema","userRoles","getUserRolesSchema","userPermissions","getUserPermissionsSchema","contentContributions","getContentContributionsSchema","contentResource","getContentResourceSchema","purchases","getPurchaseSchema","comments","getCommentsSchema","userPrefs","getUserPrefsSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","one","relationName","roles","contributions","createdContent","prefs","getAccountsSchema","mysqlTable","userId","varchar","length","notNull","type","$type","provider","providerAccountId","refresh_token","text","access_token","oauth_token","oauth_token_secret","expires_at","int","token_type","scope","id_token","session_state","refresh_token_expires_in","account","pk","primaryKey","columns","userIdIdx","index","on","getAccountsRelationsSchema","accounts","users","getUsersSchema","relations","one","user","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getDeviceAccessTokenSchema","mysqlTable","token","varchar","length","notNull","userId","organizationMembershipId","createdAt","timestamp","mode","fsp","default","sql","crr","pk","primaryKey","columns","userIdIdx","index","on","getDeviceAccessTokenRelationsSchema","deviceAccessToken","user","getUsersSchema","relations","one","verifiedBy","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getDeviceVerificationSchema","mysqlTable","verifiedByUserId","varchar","length","deviceCode","notNull","userCode","text","expires","timestamp","mode","fsp","createdAt","default","sql","verifiedAt","crr","pk","primaryKey","columns","getDeviceVerificationRelationsSchema","deviceVerification","user","getUsersSchema","relations","one","verifiedBy","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getRolePermissionsSchema","mysqlTable","roleId","varchar","length","notNull","permissionId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","rp","pk","primaryKey","columns","roleIdIdx","index","on","permissionIdIdx","getRolePermissionsRelationsSchema","permissions","getPermissionsSchema","roles","getRolesSchema","rolePermissions","relations","one","role","fields","references","id","relationName","permission","import_drizzle_orm","import_mysql_core","getSessionsSchema","mysqlTable","sessionToken","varchar","length","notNull","primaryKey","userId","expires","timestamp","mode","session","userIdIdx","index","on","getSessionRelationsSchema","sessions","users","getUsersSchema","relations","one","user","fields","references","id","relationName","import_mysql_core","getVerificationTokensSchema","mysqlTable","identifier","varchar","length","notNull","token","expires","timestamp","mode","createdAt","fsp","defaultNow","vt","pk","primaryKey","columns","import_drizzle_orm","import_mysql_core","getPurchaseUserTransferSchema","mysqlTable","id","varchar","length","notNull","transferState","mysqlEnum","default","purchaseId","organizationId","sourceUserId","targetUserId","createdAt","timestamp","mode","fsp","sql","expiresAt","canceledAt","confirmedAt","completedAt","table","purchaseUserTransferId","primaryKey","columns","name","organizationIdIdx","index","on","getPurchaseUserTransferRelationsSchema","purchaseUserTransfer","user","getUsersSchema","purchase","getPurchaseSchema","relations","one","sourceUser","fields","references","relationName","targetUser","import_drizzle_orm","import_mysql_core","getUpgradableProductsSchema","mysqlTable","upgradableToId","varchar","length","notNull","upgradableFromId","organizationId","position","double","default","metadata","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","upgradableToIdIdx","index","on","upgradableFromIdIdx","organizationIdIdx","getUpgradableProductsRelationsSchema","product","getProductSchema","upgradableProduct","relations","one","upgradableTo","fields","references","id","relationName","upgradableFrom","import_drizzle_orm","import_mysql_core","getLessonProgressSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","organizationId","organizationMembershipId","lessonId","lessonSlug","lessonVersion","sectionId","moduleId","completedAt","datetime","mode","fsp","updatedAt","createdAt","default","sql","crp","userIdLessonIdIdx","index","on","userIdIdx","lessonIdIdx","organizationMembershipIdIdx","import_drizzle_orm","import_mysql_core","getResourceProgressSchema","mysqlTable","userId","varchar","length","notNull","organizationId","organizationMembershipId","resourceId","fields","json","$type","default","completedAt","datetime","mode","fsp","updatedAt","createdAt","sql","crp","userIdLessonIdIdx","index","on","pk","primaryKey","columns","contentResourceIdIdx","userIdIdx","organizationMembershipIdIdx","import_mysql_core","getEntitlementTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","description","text","table","uniqueName","uniqueIndex","on","import_drizzle_orm","import_mysql_core","getEntitlementsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","entitlementType","userId","organizationId","organizationMembershipId","sourceType","sourceId","metadata","json","$type","default","expiresAt","timestamp","mode","fsp","createdAt","sql","updatedAt","deletedAt","table","userIdIdx","index","on","orgIdIdx","sourceIdx","typeIdx","getEntitlementRelationsSchema","entitlements","users","getUsersSchema","orgs","getOrganizationsSchema","memberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","organization","membership","guid","customAlphabet","getCourseBuilderSchema","mysqlTable","accounts","getAccountsSchema","accountsRelations","getAccountsRelationsSchema","permissions","getPermissionsSchema","permissionsRelations","getPermissionsRelationsSchema","rolePermissions","getRolePermissionsSchema","rolePermissionsRelations","getRolePermissionsRelationsSchema","roles","getRolesSchema","rolesRelations","getRolesRelationsSchema","sessions","getSessionsSchema","sessionsRelations","getSessionRelationsSchema","userPermissions","getUserPermissionsSchema","userPermissionsRelations","getUserPermissionsRelationsSchema","userRoles","getUserRolesSchema","userRolesRelations","getUserRolesRelationsSchema","users","getUsersSchema","usersRelations","getUsersRelationsSchema","verificationTokens","getVerificationTokensSchema","coupon","getCouponSchema","couponRelations","getCouponRelationsSchema","lessonProgress","getLessonProgressSchema","merchantAccount","getMerchantAccountSchema","merchantCharge","getMerchantChargeSchema","merchantChargeRelations","getMerchantChargeRelationsSchema","merchantCoupon","getMerchantCouponSchema","merchantCustomer","getMerchantCustomerSchema","merchantPrice","getMerchantPriceSchema","merchantProduct","getMerchantProductSchema","merchantSession","getMerchantSessionSchema","prices","getPriceSchema","products","getProductSchema","purchases","getPurchaseSchema","purchaseRelations","getPurchaseRelationsSchema","purchaseUserTransfer","getPurchaseUserTransferSchema","purchaseUserTransferRelations","getPurchaseUserTransferRelationsSchema","communicationChannel","getCommunicationChannelSchema","communicationPreferenceTypes","getCommunicationPreferenceTypesSchema","communicationPreferences","getCommunicationPreferencesSchema","communicationPreferencesRelations","getCommunicationPreferencesRelationsSchema","contentContributions","getContentContributionsSchema","contentContributionRelations","getContentContributionRelationsSchema","contentResource","getContentResourceSchema","contentResourceVersion","getContentResourceVersionSchema","contentResourceVersionRelations","getContentResourceVersionRelationsSchema","contentResourceRelations","getContentResourceRelationsSchema","contentResourceResource","getContentResourceResourceSchema","contentResourceResourceRelations","getContentResourceResourceRelationsSchema","contentResourceTag","getContentResourceTagSchema","contentResourceTagRelations","getContentResourceTagRelationsSchema","contributionTypes","getContributionTypesSchema","contributionTypesRelations","getContributionTypesRelationsSchema","resourceProgress","getResourceProgressSchema","upgradableProducts","getUpgradableProductsSchema","upgradableProductsRelations","getUpgradableProductsRelationsSchema","contentResourceProduct","getContentResourceProductSchema","contentResourceProductRelations","getContentResourceProductRelationsSchema","productRelations","getProductRelationsSchema","comments","getCommentsSchema","commentsRelations","getCommentRelationsSchema","deviceVerifications","getDeviceVerificationSchema","deviceVerificationRelations","getDeviceVerificationRelationsSchema","deviceAccessToken","getDeviceAccessTokenSchema","deviceAccessTokenRelations","getDeviceAccessTokenRelationsSchema","tag","getTagSchema","tagRelations","getTagRelationsSchema","tagTag","getTagTagSchema","tagTagRelations","getTagTagRelationsSchema","userPrefs","getUserPrefsSchema","userPrefsRelations","getUserPrefsRelationsSchema","organization","getOrganizationsSchema","organizationRelations","getOrganizationsRelationsSchema","organizationMemberships","getOrganizationMembershipsSchema","organizationMembershipRelations","getOrganizationMembershipsRelationsSchema","organizationMembershipRoles","getOrganizationMembershipRolesSchema","organizationMembershipRolesRelations","getOrganizationMembershipRolesRelationsSchema","merchantSubscription","getMerchantSubscriptionSchema","merchantSubscriptionRelations","getMerchantSubscriptionRelationsSchema","subscription","getSubscriptionSchema","subscriptionRelations","getSubscriptionRelationsSchema","profiles","getProfilesSchema","profilesRelations","getProfilesRelationsSchema","entitlementTypes","getEntitlementTypesSchema","entitlements","getEntitlementsSchema","entitlementsRelations","getEntitlementRelationsSchema","createTables","mySqlTable","mySqlDrizzleAdapter","client","tableFn","defaultMySqlTableFn","paymentProvider","purchaseTable","organizationTable","organizationMembershipTable","organizationMembershipRoleTable","roleTable","merchantSubscriptionTable","subscriptionTable","adapter","redeemFullPriceCoupon","options","email","baseEmail","couponId","productIds","currentUserId","redeemingProductId","String","replace","getCouponWithBulkPurchases","productId","restrictedToProductId","Error","couponValidation","validateCoupon","isRedeemable","bulkCouponRedemption","Boolean","maxUses","user","findOrCreateUser","currentUser","getUserById","redeemingForCurrentUser","id","existingPurchases","getExistingNonBulkValidPurchasesOfProduct","userId","length","errorMessage","console","error","message","purchase","purchaseId","v4","userMemberships","getMembershipsForUser","organizationId","find","m","name","includes","createPurchase","redeemedBulkCouponId","totalAmount","metadata","couponUsedId","newPurchase","getPurchase","incrementCouponUsedCount","createPurchaseTransfer","sourceUserId","expiresAt","Date","now","insert","values","update","set","usedCount","sql","where","eq","query","findMany","and","undefined","status","isNull","bulkCouponId","z","array","purchaseSchema","parse","createMerchantCustomer","identifier","merchantAccountId","merchantCustomerSchema","findFirst","getMerchantAccount","merchantAccountSchema","label","provider","getMerchantPriceForProductId","merchantPriceData","merchantProductId","parsedMerchantPrice","merchantPriceSchema","safeParse","success","JSON","stringify","data","getMerchantProductForProductId","merchantProductData","merchantProductSchema","getMerchantCustomerForUserId","merchantCustomerData","getUpgradableProducts","upgradableFromId","upgradableToId","upgradableProductSchema","availableUpgradesForProduct","previousPurchaseProductIds","map","inArray","clearLessonProgressForUser","completeLessonProgressForUser","lessonId","resourceId","completedAt","updatedAt","parsedLessonProgress","resourceProgressSchema","couponForIdOrCode","code","or","gte","expires","with","parsedCoupon","couponSchema","extend","merchantCouponSchema","createMerchantSession","MerchantSessionSchema","createMerchantChargeAndPurchase","transaction","trx","stripeChargeId","stripeCouponId","merchantCustomerId","stripeChargeAmount","quantity","checkoutSessionId","appliedPPPStripeCouponId","upgradedFromPurchaseId","country","usedCouponId","existingMerchantCharge","merchantChargeSchema","nullable","existingPurchaseForCharge","merchantChargeId","product","bulkCoupon","newMerchantCharge","existingPurchase","existingBulkCoupon","select","from","leftJoin","then","res","Coupon","isBulkPurchase","bulk","couponToUpdate","merchantCouponToUse","percentageDiscount","merchantCouponId","merchantSessionId","merchantCouponUsed","pppMerchantCoupon","type","newPurchaseStatus","toFixed","upgradedFromId","oneWeekInMilliseconds","rollback","parsedPurchase","findOrCreateMerchantCustomer","optional","getUserByEmail","newUser","createUser","emailVerified","log","isNewUser","getCoupon","couponIdOrCode","loadedCoupon","logger","debug","getPurchasesForBulkCouponId","userSchema","couponData","bulkCouponPurchases","bulkPurchases","redeemedBulkCouponPurchases","e","couponWithBulkPurchases","merge","object","getDefaultCoupon","activeSaleCoupon","default","orderBy","desc","validForProdcutId","defaultMerchantCoupon","defaultCoupon","getLessonProgressCountsByDate","getLessonProgressForUser","userProgress","parsed","getModuleProgressForUser","userIdOrEmail","moduleIdOrSlug","columns","ResultRowSchema","resource_id","string","resource_type","enum","resource_slug","completed_at","transform","val","results","execute","completedLessons","nextResource","completedLessonsCount","totalLessonsCount","rows","parsedRows","percentCompleted","row","push","fields","slug","Math","ceil","getLessonProgresses","getMerchantCharge","mCharge","info","getMerchantCouponsForTypeAndPercent","params","toString","getMerchantCouponForTypeAndPercent","foundMerchantCoupon","getMerchantCoupon","getMerchantProduct","stripeProductId","getPrice","getPriceForProduct","priceSchema","archiveProduct","getProduct","price","nickname","priceId","currentMerchantProduct","nullish","updateProduct","active","currentMerchantPrice","updatePrice","input","currentProduct","stripeProduct","priceChanged","unitAmount","currentStripePrice","newStripePrice","createPrice","unit_amount","floor","Number","currency","default_price","newMerchantPriceId","images","image","url","description","fieldsNoImage","quantityAvailable","createProduct","hash","newProductId","slugify","newProduct","state","visibility","priceHash","newPriceId","stripePrice","newMerchantProductId","productSlugOrId","withResources","productData","resources","resource","parsedProduct","productSchema","getProductResources","contentResourceProductsForProduct","ContentResourceProductSchema","contentResources","ContentResourceSchema","crp","getPurchaseCountForProduct","newPurchaseId","getPurchaseForStripeCharge","chargeForPurchase","getPurchaseUserTransferById","purchaseTransferData","sourceUser","targetUser","purchaseUserTransferSchema","getPurchaseWithUser","purchaseData","getPurchasesForUser","visiblePurchaseStates","userPurchases","asc","createdAt","parsedPurchases","getPurchaseDetails","allPurchases","thePurchase","availableUpgrades","purchaseCanUpgrade","not","p","upgradableTo","upgradableFrom","getUserWithPurchasersByEmail","trim","toLowerCase","role","key","r","pricesOfPurchasesTowardOneBundle","bundleId","canUpgradeProducts","productsPurchased","foundPrices","toggleLessonProgressForUser","transferPurchaseToUser","targetUserId","transferId","transferState","updatedMerchantCharge","updatedMerchantCustomer","updateCustomer","transferredFrom","transferredOn","toISOString","transferPurchasesToNewUser","updatePurchaseStatusForCharge","chargeId","merchantChargeForPurchase","parsedMerchantChargeForPurchase","updatePurchaseUserTransferTransferState","purchaseUserTransferData","addResourceToResource","parentResourceId","childResourceId","parentResourceData","parentResource","resourceOfId","position","resourceJoin","parsedResourceJoin","ContentResourceResourceSchema","removeResourceFromResource","delete","updateContentResourceFields","currentResource","parsedResource","getVideoResource","result","VideoResourceSchema","catch","createContentResource","crypto","randomUUID","getContentResource","personalOrganization","createOrganization","membership","addMemberToOrganization","invitedById","addRoleForMember","memberId","getUser","createSession","sessionToken","getSessionAndUser","session","innerJoin","updateUser","updateSession","linkAccount","rawAccount","getUserByAccount","account","dbAccount","providerAccountId","User","deleteSession","createVerificationToken","token","useVerificationToken","deletedToken","TIMEOUT_IN_SECONDS","expireMultipleClicks","addSeconds","isAfter","_","verificationToken","err","deleteUser","unlinkAccount","getOrganization","OrganizationSchema","currentMembership","OrganizationMemberSchema","removeMemberFromOrganization","existingRole","roleId","currentOrgMembershipRole","organizationMembershipId","removeRoleForMember","getOrganizationMembers","createSubscription","SubscriptionSchema","getMerchantSubscription","merchantSubscriptionId","MerchantSubscriptionSchema","createMerchantSubscription","updateMerchantSubscription","deleteMerchantSubscription","getSubscriptionForStripeId","stripeSubscriptionId","merchantSubscriptionParsed","subscriptionParsed"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/mysql/index.ts","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js","../../../../core/dist/chunk-IQZPUEIV.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js","../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js","../../../../core/src/schemas/video-resource.ts","../../../../core/src/schemas/purchase-user-transfer-schema.ts","../../../../core/src/schemas/question-response-schema.ts","../../../../core/src/schemas/content-resource-schema.ts","../../../../core/src/schemas/resource-progress-schema.ts","../../../../core/src/schemas/upgradable-product-schema.ts","../../../../core/src/schemas/user-schema.ts","../../../../core/src/schemas/price-schema.ts","../../../../core/src/schemas/product-schema.ts","../../../../core/src/types/eligibility-conditions.ts","../../../../core/src/schemas/coupon-schema.ts","../../../../core/src/schemas/purchase-schema.ts","../../../../core/src/schemas/merchant-coupon-schema.ts","../../../../core/src/schemas/merchant-customer-schema.ts","../../../../core/src/schemas/merchant-events-schema.ts","../../../../core/src/schemas/merchant-price-schema.ts","../../../../core/src/schemas/merchant-product-schema.ts","../../../../core/src/schemas/entitlement-schema.ts","../../../../core/src/schemas/merchant-charge-schema.ts","../../../../core/src/schemas/merchant-account-schema.ts","../../../../core/src/schemas/merchant-session.ts","../../../../core/src/schemas/merchant-subscription.ts","../../../../core/src/schemas/organization-schema.ts","../../../../core/src/schemas/organization-member.ts","../../../../core/src/schemas/subscription.ts","../../../../core/src/errors.ts","../../../../core/src/lib/utils/logger.ts","../../../../core/src/lib/utils/validate-coupon.ts","../../../src/lib/mysql/schemas/auth/accounts.ts","../../../src/lib/mysql/schemas/auth/users.ts","../../../src/lib/mysql/schemas/commerce/purchase.ts","../../../src/lib/mysql/schemas/org/organization-memberships.ts","../../../src/lib/mysql/schemas/org/organization-membership-roles.ts","../../../src/lib/mysql/schemas/auth/roles.ts","../../../src/lib/mysql/schemas/auth/user-roles.ts","../../../src/lib/mysql/schemas/org/organizations.ts","../../../src/lib/mysql/schemas/commerce/subscription.ts","../../../src/lib/mysql/schemas/commerce/merchant-subscription.ts","../../../src/lib/mysql/schemas/commerce/merchant-charge.ts","../../../src/lib/mysql/schemas/commerce/merchant-account.ts","../../../src/lib/mysql/schemas/commerce/merchant-customer.ts","../../../src/lib/mysql/schemas/commerce/merchant-product.ts","../../../src/lib/mysql/schemas/commerce/product.ts","../../../src/lib/mysql/schemas/content/content-resource-product.ts","../../../src/lib/mysql/schemas/content/content-resource.ts","../../../src/lib/mysql/schemas/content/content-contributions.ts","../../../src/lib/mysql/schemas/content/contribution-types.ts","../../../src/lib/mysql/schemas/content/content-resource-resource.ts","../../../src/lib/mysql/schemas/content/content-resource-tag.ts","../../../src/lib/mysql/schemas/content/tag.ts","../../../src/lib/mysql/schemas/content/tag-tag.ts","../../../src/lib/mysql/schemas/content/content-resource-version.ts","../../../src/lib/mysql/schemas/commerce/price.ts","../../../src/lib/mysql/schemas/commerce/merchant-price.ts","../../../src/lib/mysql/schemas/commerce/coupon.ts","../../../src/lib/mysql/schemas/commerce/merchant-coupon.ts","../../../src/lib/mysql/schemas/commerce/merchant-session.ts","../../../src/lib/mysql/schemas/communication/comment.ts","../../../src/lib/mysql/schemas/communication/communication-preferences.ts","../../../src/lib/mysql/schemas/communication/communication-channel.ts","../../../src/lib/mysql/schemas/communication/communication-preference-types.ts","../../../src/lib/mysql/schemas/auth/profiles.ts","../../../src/lib/mysql/schemas/auth/user-permissions.ts","../../../src/lib/mysql/schemas/auth/permissions.ts","../../../src/lib/mysql/schemas/auth/user-prefs.ts","../../../src/lib/mysql/schemas/auth/device-access-token.ts","../../../src/lib/mysql/schemas/auth/device-verification.ts","../../../src/lib/mysql/schemas/auth/role-permissions.ts","../../../src/lib/mysql/schemas/auth/sessions.ts","../../../src/lib/mysql/schemas/auth/verification-tokens.ts","../../../src/lib/mysql/schemas/commerce/merchant-events.ts","../../../src/lib/mysql/schemas/commerce/purchase-user-transfer.ts","../../../src/lib/mysql/schemas/commerce/upgradable-products.ts","../../../src/lib/mysql/schemas/communication/question-response.ts","../../../src/lib/mysql/schemas/content/lesson-progress.ts","../../../src/lib/mysql/schemas/content/resource-progress.ts","../../../src/lib/mysql/schemas/entitlements/entitlement-type.ts","../../../src/lib/mysql/schemas/entitlements/entitlement.ts"],"sourcesContent":["import type { AdapterSession, AdapterUser } from '@auth/core/adapters'\nimport slugify from '@sindresorhus/slugify'\nimport { addSeconds, isAfter } from 'date-fns'\nimport {\n\tand,\n\tasc,\n\tcount,\n\tdesc,\n\teq,\n\tgte,\n\tinArray,\n\tisNotNull,\n\tisNull,\n\tnot,\n\tor,\n\tsql,\n} from 'drizzle-orm'\nimport {\n\tmysqlTable as defaultMySqlTableFn,\n\tMySqlDatabase,\n\tMySqlTableFn,\n} from 'drizzle-orm/mysql-core'\nimport { customAlphabet } from 'nanoid'\nimport { v4 } from 'uuid'\nimport { z } from 'zod'\n\nimport { type CourseBuilderAdapter } from '@coursebuilder/core/adapters'\nimport {\n\tCoupon,\n\tcouponSchema,\n\tEntitlement,\n\tentitlementSchema,\n\tMerchantCharge,\n\tmerchantChargeSchema,\n\tMerchantCoupon,\n\tmerchantCouponSchema,\n\tMerchantCustomer,\n\tMerchantEvents,\n\tmerchantEventsSchema,\n\tmerchantPriceSchema,\n\tMerchantProduct,\n\tmerchantProductSchema,\n\tNewProduct,\n\tPrice,\n\tpriceSchema,\n\tProduct,\n\tproductSchema,\n\tPurchase,\n\tpurchaseSchema,\n\tPurchaseUserTransfer,\n\tpurchaseUserTransferSchema,\n\tPurchaseUserTransferState,\n\tResourceProgress,\n\tresourceProgressSchema,\n\tUpgradableProduct,\n\tupgradableProductSchema,\n\tUser,\n\tuserSchema,\n} from '@coursebuilder/core/schemas'\nimport {\n\tContentResourceProductSchema,\n\tContentResourceResourceSchema,\n\tContentResourceSchema,\n\ttype ContentResource,\n} from '@coursebuilder/core/schemas/content-resource-schema'\nimport { merchantAccountSchema } from '@coursebuilder/core/schemas/merchant-account-schema'\nimport { merchantCustomerSchema } from '@coursebuilder/core/schemas/merchant-customer-schema'\nimport {\n\tMerchantSession,\n\tMerchantSessionSchema,\n} from '@coursebuilder/core/schemas/merchant-session'\nimport { MerchantSubscriptionSchema } from '@coursebuilder/core/schemas/merchant-subscription'\nimport { OrganizationMemberSchema } from '@coursebuilder/core/schemas/organization-member'\nimport { OrganizationSchema } from '@coursebuilder/core/schemas/organization-schema'\nimport { type ModuleProgress } from '@coursebuilder/core/schemas/resource-progress-schema'\nimport { SubscriptionSchema } from '@coursebuilder/core/schemas/subscription'\nimport { VideoResourceSchema } from '@coursebuilder/core/schemas/video-resource'\nimport { PaymentsProviderConfig } from '@coursebuilder/core/types'\nimport { logger as baseLogger } from '@coursebuilder/core/utils/logger'\nimport { validateCoupon } from '@coursebuilder/core/utils/validate-coupon'\n\nimport {\n\tgetAccountsRelationsSchema,\n\tgetAccountsSchema,\n} from './schemas/auth/accounts.js'\nimport {\n\tgetDeviceAccessTokenRelationsSchema,\n\tgetDeviceAccessTokenSchema,\n} from './schemas/auth/device-access-token.js'\nimport {\n\tgetDeviceVerificationRelationsSchema,\n\tgetDeviceVerificationSchema,\n} from './schemas/auth/device-verification.js'\nimport {\n\tgetPermissionsRelationsSchema,\n\tgetPermissionsSchema,\n} from './schemas/auth/permissions.js'\nimport {\n\tgetProfilesRelationsSchema,\n\tgetProfilesSchema,\n} from './schemas/auth/profiles.js'\nimport {\n\tgetRolePermissionsRelationsSchema,\n\tgetRolePermissionsSchema,\n} from './schemas/auth/role-permissions.js'\nimport {\n\tgetRolesRelationsSchema,\n\tgetRolesSchema,\n} from './schemas/auth/roles.js'\nimport {\n\tgetSessionRelationsSchema,\n\tgetSessionsSchema,\n} from './schemas/auth/sessions.js'\nimport {\n\tgetUserPermissionsRelationsSchema,\n\tgetUserPermissionsSchema,\n} from './schemas/auth/user-permissions.js'\nimport {\n\tgetUserPrefsRelationsSchema,\n\tgetUserPrefsSchema,\n} from './schemas/auth/user-prefs.js'\nimport {\n\tgetUserRolesRelationsSchema,\n\tgetUserRolesSchema,\n} from './schemas/auth/user-roles.js'\nimport {\n\tgetUsersRelationsSchema,\n\tgetUsersSchema,\n\ttype UsersSchemaOverrides,\n} from './schemas/auth/users.js'\nimport { getVerificationTokensSchema } from './schemas/auth/verification-tokens.js'\nimport {\n\tgetCouponRelationsSchema,\n\tgetCouponSchema,\n} from './schemas/commerce/coupon.js'\nimport { getMerchantAccountSchema } from './schemas/commerce/merchant-account.js'\nimport {\n\tgetMerchantChargeRelationsSchema,\n\tgetMerchantChargeSchema,\n} from './schemas/commerce/merchant-charge.js'\nimport { getMerchantCouponSchema } from './schemas/commerce/merchant-coupon.js'\nimport { getMerchantCustomerSchema } from './schemas/commerce/merchant-customer.js'\nimport {\n\tgetMerchantEventsRelationsSchema,\n\tgetMerchantEventsSchema,\n} from './schemas/commerce/merchant-events.js'\nimport { getMerchantPriceSchema } from './schemas/commerce/merchant-price.js'\nimport { getMerchantProductSchema } from './schemas/commerce/merchant-product.js'\nimport { getMerchantSessionSchema } from './schemas/commerce/merchant-session.js'\nimport {\n\tgetMerchantSubscriptionRelationsSchema,\n\tgetMerchantSubscriptionSchema,\n} from './schemas/commerce/merchant-subscription.js'\nimport { getPriceSchema } from './schemas/commerce/price.js'\nimport {\n\tgetProductRelationsSchema,\n\tgetProductSchema,\n} from './schemas/commerce/product.js'\nimport {\n\tgetPurchaseUserTransferRelationsSchema,\n\tgetPurchaseUserTransferSchema,\n} from './schemas/commerce/purchase-user-transfer.js'\nimport {\n\tgetPurchaseRelationsSchema,\n\tgetPurchaseSchema,\n} from './schemas/commerce/purchase.js'\nimport {\n\tgetSubscriptionRelationsSchema,\n\tgetSubscriptionSchema,\n} from './schemas/commerce/subscription.js'\nimport {\n\tgetUpgradableProductsRelationsSchema,\n\tgetUpgradableProductsSchema,\n} from './schemas/commerce/upgradable-products.js'\nimport {\n\tgetCommentRelationsSchema,\n\tgetCommentsSchema,\n} from './schemas/communication/comment.js'\nimport { getCommunicationChannelSchema } from './schemas/communication/communication-channel.js'\nimport { getCommunicationPreferenceTypesSchema } from './schemas/communication/communication-preference-types.js'\nimport {\n\tgetCommunicationPreferencesRelationsSchema,\n\tgetCommunicationPreferencesSchema,\n} from './schemas/communication/communication-preferences.js'\nimport {\n\tgetQuestionResponseRelationsSchema,\n\tgetQuestionResponseSchema,\n} from './schemas/communication/question-response.js'\nimport {\n\tgetContentContributionRelationsSchema,\n\tgetContentContributionsSchema,\n} from './schemas/content/content-contributions.js'\nimport {\n\tgetContentResourceProductRelationsSchema,\n\tgetContentResourceProductSchema,\n} from './schemas/content/content-resource-product.js'\nimport {\n\tgetContentResourceResourceRelationsSchema,\n\tgetContentResourceResourceSchema,\n} from './schemas/content/content-resource-resource.js'\nimport {\n\tgetContentResourceTagRelationsSchema,\n\tgetContentResourceTagSchema,\n} from './schemas/content/content-resource-tag.js'\nimport {\n\tgetContentResourceVersionRelationsSchema,\n\tgetContentResourceVersionSchema,\n} from './schemas/content/content-resource-version.js'\nimport {\n\tgetContentResourceRelationsSchema,\n\tgetContentResourceSchema,\n} from './schemas/content/content-resource.js'\nimport {\n\tgetContributionTypesRelationsSchema,\n\tgetContributionTypesSchema,\n} from './schemas/content/contribution-types.js'\nimport { getLessonProgressSchema } from './schemas/content/lesson-progress.js'\nimport { getResourceProgressSchema } from './schemas/content/resource-progress.js'\nimport {\n\tgetTagTagRelationsSchema,\n\tgetTagTagSchema,\n} from './schemas/content/tag-tag.js'\nimport { getTagRelationsSchema, getTagSchema } from './schemas/content/tag.js'\nimport { getEntitlementTypesSchema } from './schemas/entitlements/entitlement-type.js'\nimport {\n\tgetEntitlementRelationsSchema,\n\tgetEntitlementsSchema,\n} from './schemas/entitlements/entitlement.js'\nimport {\n\tgetOrganizationMembershipRolesRelationsSchema,\n\tgetOrganizationMembershipRolesSchema,\n} from './schemas/org/organization-membership-roles.js'\nimport {\n\tgetOrganizationMembershipsRelationsSchema,\n\tgetOrganizationMembershipsSchema,\n} from './schemas/org/organization-memberships.js'\nimport {\n\tgetOrganizationsRelationsSchema,\n\tgetOrganizationsSchema,\n} from './schemas/org/organizations.js'\n\nexport const guid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 5)\n\nexport const normalizeExpirationDate = (date: Date | undefined) => {\n\tif (!date) return undefined\n\n\t// Create a new Date object for 23:59:59 UTC on the date part of the input date\n\t// The input date should be a JS Date representing 00:00:00 LA time for the chosen day.\n\t// Its UTC date parts (getUTCFullYear, etc.) will give us the correct calendar day.\n\treturn new Date(\n\t\tDate.UTC(\n\t\t\tdate.getUTCFullYear(),\n\t\t\tdate.getUTCMonth(), // 0-indexed\n\t\t\tdate.getUTCDate(),\n\t\t\t23, // hours\n\t\t\t59, // minutes\n\t\t\t59, // seconds\n\t\t\t0, // milliseconds\n\t\t),\n\t)\n}\n\nfunction toError(error: unknown) {\n\treturn error instanceof Error ? error : new Error(String(error))\n}\n\nconst logger = baseLogger as unknown as {\n\tdebug: (message: string, attrs?: Record<string, unknown>) => void\n\terror: (error: Error, attrs?: Record<string, unknown>) => void\n\tinfo: (message: string, attrs?: Record<string, unknown>) => void\n}\n\nexport type CourseBuilderSchemaOverrides<\n\tTUsers extends ReturnType<typeof getUsersSchema> = ReturnType<\n\t\ttypeof getUsersSchema\n\t>,\n> = UsersSchemaOverrides<TUsers>\n\nexport function getCourseBuilderSchema<\n\tTUsers extends ReturnType<typeof getUsersSchema> = ReturnType<\n\t\ttypeof getUsersSchema\n\t>,\n>(\n\tmysqlTable: MySqlTableFn,\n\toverrides: CourseBuilderSchemaOverrides<TUsers> = {},\n) {\n\tconst resolvedGetUsersSchema = (overrides.getUsersSchema ??\n\t\tgetUsersSchema) as (mysqlTable: MySqlTableFn) => TUsers\n\tconst userRelationsOverrides: UsersSchemaOverrides<TUsers> = {\n\t\tgetUsersSchema: resolvedGetUsersSchema,\n\t}\n\treturn {\n\t\taccounts: getAccountsSchema(mysqlTable),\n\t\taccountsRelations: getAccountsRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tpermissions: getPermissionsSchema(mysqlTable),\n\t\tpermissionsRelations: getPermissionsRelationsSchema(mysqlTable),\n\t\trolePermissions: getRolePermissionsSchema(mysqlTable),\n\t\trolePermissionsRelations: getRolePermissionsRelationsSchema(mysqlTable),\n\t\troles: getRolesSchema(mysqlTable),\n\t\trolesRelations: getRolesRelationsSchema(mysqlTable),\n\t\tsessions: getSessionsSchema(mysqlTable),\n\t\tsessionsRelations: getSessionRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tuserPermissions: getUserPermissionsSchema(mysqlTable),\n\t\tuserPermissionsRelations: getUserPermissionsRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tuserRoles: getUserRolesSchema(mysqlTable),\n\t\tuserRolesRelations: getUserRolesRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tusers: resolvedGetUsersSchema(mysqlTable),\n\t\tusersRelations: getUsersRelationsSchema(mysqlTable, userRelationsOverrides),\n\t\tverificationTokens: getVerificationTokensSchema(mysqlTable),\n\t\tcoupon: getCouponSchema(mysqlTable),\n\t\tcouponRelations: getCouponRelationsSchema(mysqlTable),\n\t\tlessonProgress: getLessonProgressSchema(mysqlTable),\n\t\tmerchantAccount: getMerchantAccountSchema(mysqlTable),\n\t\tmerchantCharge: getMerchantChargeSchema(mysqlTable),\n\t\tmerchantChargeRelations: getMerchantChargeRelationsSchema(mysqlTable),\n\t\tmerchantEvents: getMerchantEventsSchema(mysqlTable),\n\t\tmerchantEventsRelations: getMerchantEventsRelationsSchema(mysqlTable),\n\t\tmerchantCoupon: getMerchantCouponSchema(mysqlTable),\n\t\tmerchantCustomer: getMerchantCustomerSchema(mysqlTable),\n\t\tmerchantPrice: getMerchantPriceSchema(mysqlTable),\n\t\tmerchantProduct: getMerchantProductSchema(mysqlTable),\n\t\tmerchantSession: getMerchantSessionSchema(mysqlTable),\n\t\tprices: getPriceSchema(mysqlTable),\n\t\tproducts: getProductSchema(mysqlTable),\n\t\tpurchases: getPurchaseSchema(mysqlTable),\n\t\tpurchaseRelations: getPurchaseRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tpurchaseUserTransfer: getPurchaseUserTransferSchema(mysqlTable),\n\t\tpurchaseUserTransferRelations: getPurchaseUserTransferRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tcommunicationChannel: getCommunicationChannelSchema(mysqlTable),\n\t\tcommunicationPreferenceTypes:\n\t\t\tgetCommunicationPreferenceTypesSchema(mysqlTable),\n\t\tcommunicationPreferences: getCommunicationPreferencesSchema(mysqlTable),\n\t\tcommunicationPreferencesRelations:\n\t\t\tgetCommunicationPreferencesRelationsSchema(\n\t\t\t\tmysqlTable,\n\t\t\t\tuserRelationsOverrides,\n\t\t\t),\n\t\tcontentContributions: getContentContributionsSchema(mysqlTable),\n\t\tcontentContributionRelations: getContentContributionRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tcontentResource: getContentResourceSchema(mysqlTable),\n\t\tcontentResourceVersion: getContentResourceVersionSchema(mysqlTable),\n\t\tcontentResourceVersionRelations: getContentResourceVersionRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tcontentResourceRelations: getContentResourceRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tcontentResourceResource: getContentResourceResourceSchema(mysqlTable),\n\t\tcontentResourceResourceRelations:\n\t\t\tgetContentResourceResourceRelationsSchema(mysqlTable),\n\t\tcontentResourceTag: getContentResourceTagSchema(mysqlTable),\n\t\tcontentResourceTagRelations:\n\t\t\tgetContentResourceTagRelationsSchema(mysqlTable),\n\t\tcontributionTypes: getContributionTypesSchema(mysqlTable),\n\t\tcontributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),\n\t\tresourceProgress: getResourceProgressSchema(mysqlTable),\n\t\tquestionResponse: getQuestionResponseSchema(mysqlTable),\n\t\tquestionResponseRelations: getQuestionResponseRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tupgradableProducts: getUpgradableProductsSchema(mysqlTable),\n\t\tupgradableProductsRelations:\n\t\t\tgetUpgradableProductsRelationsSchema(mysqlTable),\n\t\tcontentResourceProduct: getContentResourceProductSchema(mysqlTable),\n\t\tcontentResourceProductRelations:\n\t\t\tgetContentResourceProductRelationsSchema(mysqlTable),\n\t\tproductRelations: getProductRelationsSchema(mysqlTable),\n\t\tcomments: getCommentsSchema(mysqlTable),\n\t\tcommentsRelations: getCommentRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tdeviceVerifications: getDeviceVerificationSchema(mysqlTable),\n\t\tdeviceVerificationRelations: getDeviceVerificationRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tdeviceAccessToken: getDeviceAccessTokenSchema(mysqlTable),\n\t\tdeviceAccessTokenRelations: getDeviceAccessTokenRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\ttag: getTagSchema(mysqlTable),\n\t\ttagRelations: getTagRelationsSchema(mysqlTable),\n\t\ttagTag: getTagTagSchema(mysqlTable),\n\t\ttagTagRelations: getTagTagRelationsSchema(mysqlTable),\n\t\tuserPrefs: getUserPrefsSchema(mysqlTable),\n\t\tuserPrefsRelations: getUserPrefsRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\torganization: getOrganizationsSchema(mysqlTable),\n\t\torganizationRelations: getOrganizationsRelationsSchema(mysqlTable),\n\t\torganizationMemberships: getOrganizationMembershipsSchema(mysqlTable),\n\t\torganizationMembershipRelations: getOrganizationMembershipsRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\torganizationMembershipRoles:\n\t\t\tgetOrganizationMembershipRolesSchema(mysqlTable),\n\t\torganizationMembershipRolesRelations:\n\t\t\tgetOrganizationMembershipRolesRelationsSchema(mysqlTable),\n\t\tmerchantSubscription: getMerchantSubscriptionSchema(mysqlTable),\n\t\tmerchantSubscriptionRelations:\n\t\t\tgetMerchantSubscriptionRelationsSchema(mysqlTable),\n\t\tsubscription: getSubscriptionSchema(mysqlTable),\n\t\tsubscriptionRelations: getSubscriptionRelationsSchema(mysqlTable),\n\t\tprofiles: getProfilesSchema(mysqlTable),\n\t\tprofilesRelations: getProfilesRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t\tentitlementTypes: getEntitlementTypesSchema(mysqlTable),\n\t\tentitlements: getEntitlementsSchema(mysqlTable),\n\t\tentitlementsRelations: getEntitlementRelationsSchema(\n\t\t\tmysqlTable,\n\t\t\tuserRelationsOverrides,\n\t\t),\n\t} as const\n}\n\nexport function createTables(mySqlTable: MySqlTableFn) {\n\treturn getCourseBuilderSchema(mySqlTable)\n}\n\nexport type DefaultSchema = ReturnType<typeof createTables>\n\nexport function mySqlDrizzleAdapter(\n\tclient: InstanceType<typeof MySqlDatabase>,\n\ttableFn = defaultMySqlTableFn,\n\tpaymentProvider?: PaymentsProviderConfig,\n): CourseBuilderAdapter<typeof MySqlDatabase> {\n\tconst {\n\t\tusers,\n\t\taccounts,\n\t\tsessions,\n\t\tverificationTokens,\n\t\tcontentResource,\n\t\tcontentResourceResource,\n\t\tcontentResourceProduct,\n\t\tcontentResourceTag,\n\t\tpurchases: purchaseTable,\n\t\tpurchaseUserTransfer,\n\t\tcoupon,\n\t\tmerchantCoupon,\n\t\tmerchantCharge,\n\t\tmerchantAccount,\n\t\tmerchantEvents,\n\t\tmerchantPrice,\n\t\tmerchantCustomer,\n\t\tmerchantSession,\n\t\tmerchantProduct,\n\t\tprices,\n\t\tproducts,\n\t\tupgradableProducts,\n\t\tresourceProgress,\n\t\tcomments,\n\t\torganization: organizationTable,\n\t\torganizationMemberships: organizationMembershipTable,\n\t\torganizationMembershipRoles: organizationMembershipRoleTable,\n\t\troles: roleTable,\n\t\tmerchantSubscription: merchantSubscriptionTable,\n\t\tsubscription: subscriptionTable,\n\t\tentitlements: entitlementTable,\n\t\tentitlementTypes,\n\t} = createTables(tableFn)\n\n\tconst adapter: CourseBuilderAdapter = {\n\t\tclient,\n\t\tasync redeemFullPriceCoupon(options) {\n\t\t\tconst {\n\t\t\t\temail: baseEmail,\n\t\t\t\tcouponId,\n\t\t\t\tproductIds,\n\t\t\t\tcurrentUserId,\n\t\t\t\tredeemingProductId,\n\t\t\t} = options\n\t\t\tconst email = String(baseEmail).replace(' ', '+')\n\n\t\t\tconst coupon = await adapter.getCouponWithBulkPurchases(couponId)\n\n\t\t\tconst productId =\n\t\t\t\t(coupon && (coupon.restrictedToProductId as string)) ||\n\t\t\t\tredeemingProductId\n\n\t\t\tif (!productId) throw new Error(`unable-to-find-any-product-id`)\n\n\t\t\tconst couponValidation = validateCoupon(coupon, productIds)\n\n\t\t\tif (coupon && couponValidation.isRedeemable) {\n\t\t\t\t// if the Coupon is the Bulk Coupon of a Bulk Purchase,\n\t\t\t\t// then a bulk coupon is being redeemed\n\t\t\t\tconst bulkCouponRedemption = Boolean(coupon.maxUses > 1)\n\n\t\t\t\tconst { user } = await adapter.findOrCreateUser(email)\n\n\t\t\t\tif (!user) throw new Error(`unable-to-create-user-${email}`)\n\n\t\t\t\tconst currentUser = currentUserId\n\t\t\t\t\t? await adapter.getUserById(currentUserId)\n\t\t\t\t\t: null\n\n\t\t\t\tconst redeemingForCurrentUser = currentUser?.id === user.id\n\n\t\t\t\t// To prevent double-purchasing, check if this user already has a\n\t\t\t\t// Purchase record for this product that is valid and wasn't a bulk\n\t\t\t\t// coupon purchase.\n\t\t\t\tconst existingPurchases =\n\t\t\t\t\tawait adapter.getExistingNonBulkValidPurchasesOfProduct({\n\t\t\t\t\t\tuserId: user.id,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t})\n\n\t\t\t\tif (existingPurchases.length > 0) {\n\t\t\t\t\tconst errorMessage = `already-purchased-${email}`\n\t\t\t\t\tlogger.info('adapter.coupon.redeem.already_purchased', {\n\t\t\t\t\t\tcouponId: coupon.id,\n\t\t\t\t\t\tcurrentUserId,\n\t\t\t\t\t\temail,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t\tuserId: user.id,\n\t\t\t\t\t})\n\t\t\t\t\treturn {\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tredeemingForCurrentUser,\n\t\t\t\t\t\tpurchase: null,\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(errorMessage)\n\t\t\t\t}\n\n\t\t\t\tconst purchaseId = `purchase-${v4()}`\n\t\t\t\tconst userMemberships = await adapter.getMembershipsForUser(user.id)\n\t\t\t\tconst organizationId =\n\t\t\t\t\tcoupon.organizationId ||\n\t\t\t\t\tuserMemberships.find((m) => m.organization.name?.includes(user.email))\n\t\t\t\t\t\t?.organizationId // safer way to make sure we are using personal organization\n\n\t\t\t\tawait adapter.createPurchase({\n\t\t\t\t\tid: purchaseId,\n\t\t\t\t\tuserId: user.id,\n\t\t\t\t\tcouponId: bulkCouponRedemption ? null : coupon.id,\n\t\t\t\t\tredeemedBulkCouponId: bulkCouponRedemption ? coupon.id : null,\n\t\t\t\t\tproductId,\n\t\t\t\t\ttotalAmount: '0',\n\t\t\t\t\torganizationId,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tcouponUsedId: bulkCouponRedemption ? null : coupon.id,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst newPurchase = await adapter.getPurchase(purchaseId)\n\n\t\t\t\tawait adapter.incrementCouponUsedCount(coupon.id)\n\n\t\t\t\tawait adapter.createPurchaseTransfer({\n\t\t\t\t\tsourceUserId: user.id,\n\t\t\t\t\tpurchaseId: purchaseId,\n\t\t\t\t\texpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7),\n\t\t\t\t})\n\n\t\t\t\treturn { purchase: newPurchase, redeemingForCurrentUser }\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tcreatePurchaseTransfer: async (options) => {\n\t\t\tconst id = `put_${v4()}`\n\t\t\tawait client.insert(purchaseUserTransfer).values({\n\t\t\t\tid,\n\t\t\t\tpurchaseId: options.purchaseId,\n\t\t\t\tsourceUserId: options.sourceUserId,\n\t\t\t\texpiresAt: options.expiresAt,\n\t\t\t})\n\t\t},\n\t\tincrementCouponUsedCount: async (couponId) => {\n\t\t\tawait client\n\t\t\t\t.update(coupon)\n\t\t\t\t.set({ usedCount: sql`${coupon.usedCount} + 1` })\n\t\t\t\t.where(eq(coupon.id, couponId))\n\t\t},\n\t\tgetExistingNonBulkValidPurchasesOfProduct: async ({\n\t\t\tuserId,\n\t\t\tproductId,\n\t\t}) => {\n\t\t\tconst existingPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tproductId ? eq(purchaseTable.productId, productId) : undefined,\n\t\t\t\t\teq(purchaseTable.status, 'Valid'),\n\t\t\t\t\tisNull(purchaseTable.bulkCouponId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\treturn z.array(purchaseSchema).parse(existingPurchases)\n\t\t},\n\t\tcreateMerchantCustomer: async (options) => {\n\t\t\tawait client.insert(merchantCustomer).values({\n\t\t\t\tid: `mc_${v4()}`,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\tuserId: options.userId,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\t\t\treturn merchantCustomerSchema.parse(\n\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\twhere: eq(merchantCustomer.identifier, options.identifier),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tcreateMerchantCoupon: async (options) => {\n\t\t\tawait client.insert(merchantCoupon).values({\n\t\t\t\tid: `mcoupon_${v4()}`,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\ttype: options.type,\n\t\t\t\tamountDiscount: Math.floor(options.amountDiscount),\n\t\t\t\tstatus: 1,\n\t\t\t})\n\t\t\treturn merchantCouponSchema.parse(\n\t\t\t\tawait client.query.merchantCoupon.findFirst({\n\t\t\t\t\twhere: eq(merchantCoupon.identifier, options.identifier),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantAccount: async (options) => {\n\t\t\treturn merchantAccountSchema.parse(\n\t\t\t\tawait client.query.merchantAccount.findFirst({\n\t\t\t\t\twhere: eq(merchantAccount.label, options.provider),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantPriceForProductId: async (productId) => {\n\t\t\tconst merchantPriceData = await client.query.merchantPrice.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(merchantPrice.merchantProductId, productId),\n\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsedMerchantPrice =\n\t\t\t\tmerchantPriceSchema.safeParse(merchantPriceData)\n\n\t\t\tif (!parsedMerchantPrice.success) {\n\t\t\t\tlogger.error(parsedMerchantPrice.error, {\n\t\t\t\t\tevent: 'adapter.merchantPrice.parse_failed',\n\t\t\t\t\tproductId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedMerchantPrice.data\n\t\t},\n\t\tgetMerchantProductForProductId: async (productId) => {\n\t\t\tconst merchantProductData = await client.query.merchantProduct.findFirst({\n\t\t\t\twhere: eq(merchantProduct.productId, productId),\n\t\t\t})\n\n\t\t\tif (!merchantProductData) return null\n\t\t\treturn merchantProductSchema.parse(merchantProductData)\n\t\t},\n\t\tgetMerchantCustomerForUserId: async (userId) => {\n\t\t\tconst merchantCustomerData =\n\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\twhere: eq(merchantCustomer.userId, userId),\n\t\t\t\t})\n\n\t\t\tif (!merchantCustomerData) return null\n\t\t\treturn merchantCustomerSchema.parse(merchantCustomerData)\n\t\t},\n\t\tgetUpgradableProducts: async (options) => {\n\t\t\tconst { upgradableFromId, upgradableToId } = options\n\t\t\treturn z.array(upgradableProductSchema).parse(\n\t\t\t\tawait client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(upgradableProducts.upgradableFromId, upgradableFromId),\n\t\t\t\t\t\teq(upgradableProducts.upgradableToId, upgradableToId),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync availableUpgradesForProduct(\n\t\t\tpurchases: any,\n\t\t\tproductId: string,\n\t\t): Promise<any[]> {\n\t\t\tconst previousPurchaseProductIds = purchases.map(\n\t\t\t\t({ productId }: Purchase) => productId,\n\t\t\t)\n\n\t\t\tif (previousPurchaseProductIds.length > 0) {\n\t\t\t\treturn client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(upgradableProducts.upgradableToId, productId),\n\t\t\t\t\t\tinArray(\n\t\t\t\t\t\t\tupgradableProducts.upgradableFromId,\n\t\t\t\t\t\t\tpreviousPurchaseProductIds,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn []\n\t\t},\n\t\tclearLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessons: { id: string; slug: string }[]\n\t\t}): Promise<void> {\n\t\t\tthrow new Error('clearLessonProgressForUser Method not implemented.')\n\t\t},\n\t\tasync completeLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessonId?: string\n\t\t}): Promise<ResourceProgress | null> {\n\t\t\tif (!options.lessonId) {\n\t\t\t\tthrow new Error('No lessonId provided')\n\t\t\t}\n\n\t\t\tlet lessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst now = new Date()\n\n\t\t\tif (lessonProgress) {\n\t\t\t\tif (!lessonProgress.completedAt) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(resourceProgress)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\t\t\tupdatedAt: now,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(resourceProgress.resourceId, options.lessonId))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait client.insert(resourceProgress).values({\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t\tresourceId: options.lessonId,\n\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t})\n\t\t\t}\n\t\t\tlessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\t\t\tconst parsedLessonProgress =\n\t\t\t\tresourceProgressSchema.safeParse(lessonProgress)\n\n\t\t\tif (!parsedLessonProgress.success) {\n\t\t\t\tlogger.error(parsedLessonProgress.error, {\n\t\t\t\t\tevent: 'adapter.lessonProgress.parse_failed',\n\t\t\t\t\tlessonId: options.lessonId,\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedLessonProgress.data\n\t\t},\n\t\tasync couponForIdOrCode(options: {\n\t\t\tcode?: string\n\t\t\tcouponId?: string\n\t\t}): Promise<(Coupon & { merchantCoupon: MerchantCoupon }) | null> {\n\t\t\tif (!options.couponId && !options.code) return null\n\t\t\tconst couponForIdOrCode = await client.query.coupon.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\tand(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\toptions.code ? eq(coupon.code, options.code) : undefined,\n\t\t\t\t\t\t\toptions.couponId ? eq(coupon.id, options.couponId) : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tgte(coupon.expires, new Date()),\n\t\t\t\t\t),\n\t\t\t\t\tand(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\toptions.code ? eq(coupon.code, options.code) : undefined,\n\t\t\t\t\t\t\toptions.couponId ? eq(coupon.id, options.couponId) : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tisNull(coupon.expires),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tmerchantCoupon: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (!couponForIdOrCode) return null\n\n\t\t\tconst parsedCoupon = couponSchema\n\t\t\t\t.extend({\n\t\t\t\t\tmerchantCoupon: merchantCouponSchema,\n\t\t\t\t})\n\t\t\t\t.safeParse(couponForIdOrCode)\n\n\t\t\tif (!parsedCoupon.success) {\n\t\t\t\tlogger.error(parsedCoupon.error, {\n\t\t\t\t\tcode: options.code,\n\t\t\t\t\tcouponId: options.couponId,\n\t\t\t\t\tevent: 'adapter.coupon.parse_failed',\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedCoupon.data\n\t\t},\n\t\tasync createMerchantSession(options): Promise<MerchantSession> {\n\t\t\tconst id = `ms_${v4()}`\n\t\t\tawait client.insert(merchantSession).values({\n\t\t\t\tid,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\t...(options.organizationId\n\t\t\t\t\t? { organizationId: options.organizationId }\n\t\t\t\t\t: {}),\n\t\t\t})\n\n\t\t\treturn MerchantSessionSchema.parse(\n\t\t\t\tawait client.query.merchantSession.findFirst({\n\t\t\t\t\twhere: eq(merchantSession.id, id),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync createMerchantChargeAndPurchase(options): Promise<Purchase> {\n\t\t\tconst purchaseId = await client.transaction(async (trx) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tstripeChargeId,\n\t\t\t\t\t\tstripeCouponId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t\tmerchantProductId,\n\t\t\t\t\t\tmerchantCustomerId,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t\tstripeChargeAmount,\n\t\t\t\t\t\tquantity = 1,\n\t\t\t\t\t\tcheckoutSessionId,\n\t\t\t\t\t\tappliedPPPStripeCouponId,\n\t\t\t\t\t\tupgradedFromPurchaseId,\n\t\t\t\t\t\tcountry,\n\t\t\t\t\t\tusedCouponId,\n\t\t\t\t\t\torganizationId,\n\t\t\t\t\t} = options\n\n\t\t\t\t\tconst existingMerchantCharge = merchantChargeSchema.nullable().parse(\n\t\t\t\t\t\t(await client.query.merchantCharge.findFirst({\n\t\t\t\t\t\t\twhere: eq(merchantCharge.identifier, stripeChargeId),\n\t\t\t\t\t\t})) || null,\n\t\t\t\t\t)\n\n\t\t\t\t\tconst existingPurchaseForCharge = existingMerchantCharge\n\t\t\t\t\t\t? await client.query.purchases.findFirst({\n\t\t\t\t\t\t\t\twhere: eq(\n\t\t\t\t\t\t\t\t\tpurchaseTable.merchantChargeId,\n\t\t\t\t\t\t\t\t\texistingMerchantCharge.id,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tif (existingPurchaseForCharge) {\n\t\t\t\t\t\treturn existingPurchaseForCharge.id\n\t\t\t\t\t}\n\n\t\t\t\t\tconst merchantChargeId = `mc_${v4()}`\n\t\t\t\t\tconst purchaseId = `purch_${v4()}`\n\n\t\t\t\t\tconst newMerchantCharge = await client.insert(merchantCharge).values({\n\t\t\t\t\t\tid: merchantChargeId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tidentifier: stripeChargeId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t\tmerchantProductId,\n\t\t\t\t\t\tmerchantCustomerId,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst existingPurchase = purchaseSchema.nullable().parse(\n\t\t\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\t\teq(purchaseTable.productId, productId),\n\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t})) || null,\n\t\t\t\t\t)\n\n\t\t\t\t\tconst existingBulkCoupon = couponSchema.nullable().parse(\n\t\t\t\t\t\tawait client\n\t\t\t\t\t\t\t.select()\n\t\t\t\t\t\t\t.from(coupon)\n\t\t\t\t\t\t\t.leftJoin(\n\t\t\t\t\t\t\t\tpurchaseTable,\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(coupon.id, purchaseTable.bulkCouponId),\n\t\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(coupon.restrictedToProductId, productId),\n\t\t\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.then((res) => {\n\t\t\t\t\t\t\t\treturn res[0]?.Coupon ?? null\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst isBulkPurchase =\n\t\t\t\t\t\tquantity > 1 ||\n\t\t\t\t\t\tBoolean(existingBulkCoupon) ||\n\t\t\t\t\t\toptions.bulk ||\n\t\t\t\t\t\tBoolean(existingPurchase?.status === 'Valid')\n\n\t\t\t\t\tlet bulkCouponId: string | null = null\n\t\t\t\t\tlet couponToUpdate = null\n\n\t\t\t\t\tif (isBulkPurchase) {\n\t\t\t\t\t\tbulkCouponId =\n\t\t\t\t\t\t\texistingBulkCoupon !== null ? existingBulkCoupon.id : v4()\n\n\t\t\t\t\t\tif (existingBulkCoupon !== null) {\n\t\t\t\t\t\t\tcouponToUpdate = await client\n\t\t\t\t\t\t\t\t.update(coupon)\n\t\t\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\t\t\tmaxUses: (existingBulkCoupon?.maxUses || 0) + quantity,\n\t\t\t\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.where(eq(coupon.id, bulkCouponId))\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Try to find merchant coupon by stripeCouponId first\n\t\t\t\t\t\t\tlet merchantCouponToUse = stripeCouponId\n\t\t\t\t\t\t\t\t? merchantCouponSchema.nullable().parse(\n\t\t\t\t\t\t\t\t\t\t(await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\t\t\t\twhere: eq(merchantCoupon.identifier, stripeCouponId),\n\t\t\t\t\t\t\t\t\t\t})) || null,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: null\n\n\t\t\t\t\t\t\t// Fallback: If not found, try to find via usedCouponId from checkout session metadata\n\t\t\t\t\t\t\tif (!merchantCouponToUse && usedCouponId) {\n\t\t\t\t\t\t\t\t// First get the coupon record to find its merchantCouponId\n\t\t\t\t\t\t\t\tconst usedCoupon = couponSchema.nullable().parse(\n\t\t\t\t\t\t\t\t\t(await client.query.coupon.findFirst({\n\t\t\t\t\t\t\t\t\t\twhere: eq(coupon.id, usedCouponId),\n\t\t\t\t\t\t\t\t\t})) || null,\n\t\t\t\t\t\t\t\t)\n\n\t\t\t\t\t\t\t\t// Then get the merchant coupon\n\t\t\t\t\t\t\t\tif (usedCoupon?.merchantCouponId) {\n\t\t\t\t\t\t\t\t\tmerchantCouponToUse = merchantCouponSchema.nullable().parse(\n\t\t\t\t\t\t\t\t\t\t(await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\t\t\t\twhere: eq(merchantCoupon.id, usedCoupon.merchantCouponId),\n\t\t\t\t\t\t\t\t\t\t})) || null,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst bulkCouponValues = {\n\t\t\t\t\t\t\t\tid: bulkCouponId as string,\n\t\t\t\t\t\t\t\tpercentageDiscount: '1.0',\n\t\t\t\t\t\t\t\trestrictedToProductId: productId,\n\t\t\t\t\t\t\t\tmaxUses: quantity,\n\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t\t\t\t...(merchantCouponToUse\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tmerchantCouponId: merchantCouponToUse.id,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcouponToUpdate = await client\n\t\t\t\t\t\t\t\t.insert(coupon)\n\t\t\t\t\t\t\t\t.values(bulkCouponValues)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// create a new merchant session\n\t\t\t\t\tconst merchantSessionId = `ms_${v4()}`\n\n\t\t\t\t\tawait client.insert(merchantSession).values({\n\t\t\t\t\t\tid: merchantSessionId,\n\t\t\t\t\t\tidentifier: checkoutSessionId,\n\t\t\t\t\t\tmerchantAccountId,\n\t\t\t\t\t})\n\n\t\t\t\t\tconst merchantCouponUsed = stripeCouponId\n\t\t\t\t\t\t? await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\twhere: eq(merchantCoupon.identifier, stripeCouponId),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tconst pppMerchantCoupon = appliedPPPStripeCouponId\n\t\t\t\t\t\t? await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\t\t\teq(merchantCoupon.identifier, appliedPPPStripeCouponId),\n\t\t\t\t\t\t\t\t\teq(merchantCoupon.type, 'ppp'),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null\n\n\t\t\t\t\tconst newPurchaseStatus =\n\t\t\t\t\t\tmerchantCouponUsed?.type === 'ppp' || pppMerchantCoupon\n\t\t\t\t\t\t\t? 'Restricted'\n\t\t\t\t\t\t\t: 'Valid'\n\n\t\t\t\t\tawait client.insert(purchaseTable).values({\n\t\t\t\t\t\tid: purchaseId,\n\t\t\t\t\t\tstatus: newPurchaseStatus,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tproductId,\n\t\t\t\t\t\tmerchantChargeId,\n\t\t\t\t\t\ttotalAmount: (stripeChargeAmount / 100).toFixed(),\n\t\t\t\t\t\tbulkCouponId,\n\t\t\t\t\t\tmerchantSessionId,\n\t\t\t\t\t\tcountry,\n\t\t\t\t\t\tupgradedFromId: upgradedFromPurchaseId || null,\n\t\t\t\t\t\tcouponId: usedCouponId || null,\n\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst oneWeekInMilliseconds = 1000 * 60 * 60 * 24 * 7\n\n\t\t\t\t\tawait client.insert(purchaseUserTransfer).values({\n\t\t\t\t\t\tid: `put_${v4()}`,\n\t\t\t\t\t\tpurchaseId: purchaseId as string,\n\t\t\t\t\t\texpiresAt: existingPurchase\n\t\t\t\t\t\t\t? new Date()\n\t\t\t\t\t\t\t: new Date(Date.now() + oneWeekInMilliseconds),\n\t\t\t\t\t\tsourceUserId: userId,\n\t\t\t\t\t\t...(organizationId ? { organizationId } : {}),\n\t\t\t\t\t})\n\n\t\t\t\t\t// const result = await Promise.all([\n\t\t\t\t\t// \tnewMerchantCharge,\n\t\t\t\t\t// \tnewPurchase,\n\t\t\t\t\t// \tnewPurchaseUserTransfer,\n\t\t\t\t\t// \tnewMerchantSession,\n\t\t\t\t\t// \t...(couponToUpdate ? [couponToUpdate] : []),\n\t\t\t\t\t// ])\n\t\t\t\t\t//\n\t\t\t\t\t// console.log('result', { result })\n\n\t\t\t\t\treturn purchaseId\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(toError(error), {\n\t\t\t\t\t\tcheckoutSessionId: options.checkoutSessionId,\n\t\t\t\t\t\tevent: 'adapter.purchase.create.failed',\n\t\t\t\t\t\torganizationId: options.organizationId,\n\t\t\t\t\t\tproductId: options.productId,\n\t\t\t\t\t\tstripeChargeId: options.stripeChargeId,\n\t\t\t\t\t\tuserId: options.userId,\n\t\t\t\t\t})\n\t\t\t\t\ttrx.rollback()\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst parsedPurchase = purchaseSchema.safeParse(\n\t\t\t\tawait client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.id, purchaseId as string),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tlogger.error(parsedPurchase.error, {\n\t\t\t\t\tevent: 'adapter.purchase.parse_failed',\n\t\t\t\t\tproductId: options.productId,\n\t\t\t\t\tpurchaseId: purchaseId as string,\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t})\n\t\t\t\tthrow new Error('Error parsing purchase')\n\t\t\t}\n\n\t\t\treturn parsedPurchase.data\n\t\t},\n\t\tasync findOrCreateMerchantCustomer(options: {\n\t\t\tuser: User\n\t\t\tidentifier: string\n\t\t\tmerchantAccountId: string\n\t\t}): Promise<MerchantCustomer | null> {\n\t\t\tconst merchantCustomer = merchantCustomerSchema\n\t\t\t\t.nullable()\n\t\t\t\t.optional()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\t\twhere: (merchantCustomer, { eq }) =>\n\t\t\t\t\t\t\teq(merchantCustomer.identifier, options.identifier),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tif (merchantCustomer) {\n\t\t\t\treturn merchantCustomer\n\t\t\t}\n\n\t\t\treturn await adapter.createMerchantCustomer({\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\tuserId: options.user.id,\n\t\t\t})\n\t\t},\n\t\tasync createMerchantEvent(options: {\n\t\t\tmerchantAccountId: string\n\t\t\tidentifier: string\n\t\t\tpayload: Record<string, any>\n\t\t}): Promise<MerchantEvents> {\n\t\t\tconst eventId = `me_${v4()}`\n\n\t\t\tawait client.insert(merchantEvents).values({\n\t\t\t\tid: eventId,\n\t\t\t\tmerchantAccountId: options.merchantAccountId,\n\t\t\t\tidentifier: options.identifier,\n\t\t\t\tpayload: options.payload,\n\t\t\t})\n\n\t\t\tconst createdEvent = await client.query.merchantEvents.findFirst({\n\t\t\t\twhere: eq(merchantEvents.id, eventId),\n\t\t\t})\n\n\t\t\treturn merchantEventsSchema.parse(createdEvent)\n\t\t},\n\t\tasync getMerchantEventByIdentifier(\n\t\t\tidentifier: string,\n\t\t): Promise<MerchantEvents | null> {\n\t\t\tconst event = await client.query.merchantEvents.findFirst({\n\t\t\t\twhere: eq(merchantEvents.identifier, identifier),\n\t\t\t})\n\n\t\t\treturn event ? merchantEventsSchema.parse(event) : null\n\t\t},\n\t\tasync getMerchantEventsByAccount(\n\t\t\tmerchantAccountId: string,\n\t\t): Promise<MerchantEvents[]> {\n\t\t\tconst events = await client.query.merchantEvents.findMany({\n\t\t\t\twhere: eq(merchantEvents.merchantAccountId, merchantAccountId),\n\t\t\t\torderBy: [desc(merchantEvents.createdAt)],\n\t\t\t})\n\n\t\t\treturn events.map((event) => merchantEventsSchema.parse(event))\n\t\t},\n\t\tasync findOrCreateUser(\n\t\t\temail: string,\n\t\t\tname?: string | null,\n\t\t): Promise<{\n\t\t\tuser: User\n\t\t\tisNewUser: boolean\n\t\t}> {\n\t\t\tconst user = await adapter.getUserByEmail?.(email)\n\n\t\t\tif (!user) {\n\t\t\t\tconst newUser = await adapter.createUser?.({\n\t\t\t\t\tid: `u_${v4()}`,\n\t\t\t\t\temail,\n\t\t\t\t\tname,\n\t\t\t\t\temailVerified: null,\n\t\t\t\t})\n\t\t\t\tif (!newUser) {\n\t\t\t\t\tthrow new Error('Could not create user')\n\t\t\t\t}\n\t\t\t\tlogger.info('adapter.user.created', {\n\t\t\t\t\temail,\n\t\t\t\t\tuserId: newUser.id,\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tuser: newUser as User,\n\t\t\t\t\tisNewUser: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tuser: user as User,\n\t\t\t\tisNewUser: false,\n\t\t\t}\n\t\t},\n\t\tasync getCoupon(couponIdOrCode: string): Promise<Coupon | null> {\n\t\t\tconst loadedCoupon =\n\t\t\t\t(await client.query.coupon.findFirst({\n\t\t\t\t\twhere: or(\n\t\t\t\t\t\teq(coupon.id, couponIdOrCode),\n\t\t\t\t\t\teq(coupon.code, couponIdOrCode),\n\t\t\t\t\t),\n\t\t\t\t})) || null\n\n\t\t\tlogger.debug('getCoupon', {\n\t\t\t\tcouponIdOrCode,\n\t\t\t\tfound: !!loadedCoupon,\n\t\t\t})\n\n\t\t\treturn couponSchema.nullable().parse(loadedCoupon)\n\t\t},\n\t\tasync getPurchasesForBulkCouponId(\n\t\t\tbulkCouponId: string,\n\t\t): Promise<(Purchase & { user: User })[]> {\n\t\t\treturn z.array(purchaseSchema.extend({ user: userSchema })).parse(\n\t\t\t\tawait client.query.purchases.findMany({\n\t\t\t\t\twhere: eq(purchaseTable.bulkCouponId, bulkCouponId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync getCouponWithBulkPurchases(couponId: string): Promise<\n\t\t\t| (Coupon & {\n\t\t\t\t\tbulkPurchases?: Purchase[] | null\n\t\t\t\t\tredeemedBulkCouponPurchases: { bulkCouponId?: string | null }[]\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tlogger.debug('getCouponWithBulkPurchases', { couponId })\n\t\t\tlet couponData\n\t\t\tlet bulkCouponPurchases: unknown[] = []\n\t\t\ttry {\n\t\t\t\tcouponData =\n\t\t\t\t\t(await client.query.coupon.findFirst({\n\t\t\t\t\t\twhere: eq(coupon.id, couponId),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tbulkPurchases: true,\n\t\t\t\t\t\t\tredeemedBulkCouponPurchases: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t})) || null\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as Error, {\n\t\t\t\t\tmethod: 'getCouponWithBulkPurchases',\n\t\t\t\t\tcouponId,\n\t\t\t\t\tstep: 'load-coupon',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tbulkCouponPurchases = await client.query.purchases.findMany({\n\t\t\t\t\twhere: eq(purchaseTable.redeemedBulkCouponId, couponId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tlogger.debug('getCouponWithBulkPurchases.redeemed', {\n\t\t\t\t\tcouponId,\n\t\t\t\t\tcount: bulkCouponPurchases?.length ?? 0,\n\t\t\t\t})\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(e as Error, {\n\t\t\t\t\tmethod: 'getCouponWithBulkPurchases',\n\t\t\t\t\tcouponId,\n\t\t\t\t\tstep: 'load-redeemed-purchases',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (!couponData) {\n\t\t\t\tlogger.debug('getCouponWithBulkPurchases', {\n\t\t\t\t\tcouponId,\n\t\t\t\t\terror: 'no coupon found',\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst couponWithBulkPurchases = {\n\t\t\t\t...couponData,\n\t\t\t\tredeemedBulkCouponPurchases: bulkCouponPurchases || [],\n\t\t\t}\n\n\t\t\tconst parsedCoupon = couponSchema\n\t\t\t\t.merge(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tredeemedBulkCouponPurchases: z.array(purchaseSchema),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(couponWithBulkPurchases)\n\n\t\t\tif (!parsedCoupon.success) {\n\t\t\t\tlogger.error(parsedCoupon.error, {\n\t\t\t\t\tcouponId: couponData?.id ?? couponId,\n\t\t\t\t\tevent: 'adapter.coupon.parse_failed',\n\t\t\t\t\tredeemedBulkCouponPurchasesCount: bulkCouponPurchases?.length ?? 0,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedCoupon.data\n\t\t},\n\t\tasync getDefaultCoupon(productIds?: string[]): Promise<{\n\t\t\tdefaultMerchantCoupon: MerchantCoupon\n\t\t\tdefaultCoupon: Coupon\n\t\t} | null> {\n\t\t\tconst activeSaleCoupon = await client.query.coupon.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(coupon.status, 1),\n\t\t\t\t\teq(coupon.default, true),\n\t\t\t\t\tgte(coupon.expires, new Date()),\n\t\t\t\t\tor(\n\t\t\t\t\t\tproductIds\n\t\t\t\t\t\t\t? inArray(coupon.restrictedToProductId, productIds)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tisNull(coupon.restrictedToProductId),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\torderBy: desc(coupon.percentageDiscount),\n\t\t\t\twith: {\n\t\t\t\t\tmerchantCoupon: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (activeSaleCoupon) {\n\t\t\t\tconst { restrictedToProductId } = activeSaleCoupon\n\t\t\t\tconst validForProdcutId = restrictedToProductId\n\t\t\t\t\t? productIds?.includes(restrictedToProductId as string)\n\t\t\t\t\t: true\n\n\t\t\t\tconst { merchantCoupon: defaultMerchantCoupon, ...defaultCoupon } =\n\t\t\t\t\tactiveSaleCoupon\n\n\t\t\t\tif (validForProdcutId) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdefaultMerchantCoupon: merchantCouponSchema.parse(\n\t\t\t\t\t\t\tdefaultMerchantCoupon,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdefaultCoupon: couponSchema.parse(defaultCoupon),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\t\tgetLessonProgressCountsByDate(): Promise<\n\t\t\t{\n\t\t\t\tcount: number\n\t\t\t\tcompletedAt: string\n\t\t\t}[]\n\t\t> {\n\t\t\tthrow new Error('getLessonProgressCountsByDate Method not implemented.')\n\t\t},\n\t\tasync getLessonProgressForUser(\n\t\t\tuserId: string,\n\t\t): Promise<ResourceProgress[]> {\n\t\t\tconst userProgress = await client.query.resourceProgress.findMany({\n\t\t\t\twhere: eq(resourceProgress.userId, userId),\n\t\t\t})\n\t\t\tconst parsed = z.array(resourceProgressSchema).safeParse(userProgress)\n\t\t\tif (!parsed.success) {\n\t\t\t\tlogger.error(parsed.error, {\n\t\t\t\t\tevent: 'adapter.userProgress.parse_failed',\n\t\t\t\t\tuserId,\n\t\t\t\t})\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn parsed.data\n\t\t},\n\t\tasync getModuleProgressForUser(\n\t\t\tuserIdOrEmail: string,\n\t\t\tmoduleIdOrSlug: string,\n\t\t): Promise<ModuleProgress | null> {\n\t\t\t// First, get the user ID\n\t\t\tconst user = await client.query.users.findFirst({\n\t\t\t\twhere: or(eq(users.id, userIdOrEmail), eq(users.email, userIdOrEmail)),\n\t\t\t\tcolumns: {\n\t\t\t\t\tid: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (!user) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst ResultRowSchema = z.object({\n\t\t\t\tresource_id: z.string(),\n\t\t\t\tresource_type: z.enum(['lesson', 'exercise', 'post']),\n\t\t\t\tresource_slug: z.string().nullable(),\n\t\t\t\tcompleted_at: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.nullable()\n\t\t\t\t\t.transform((val) => (val ? new Date(val) : null)),\n\t\t\t})\n\n\t\t\t// Execute the optimized query - create a flattened, properly ordered list\n\t\t\tconst results: any = await client.execute(sql`\n\t\t\t\tWITH RECURSIVE workshop AS (\n\t\t\t\t\tSELECT id, fields->>'$.slug' AS slug\n\t\t\t\t\tFROM ${contentResource}\n\t\t\t\t\tWHERE id = ${moduleIdOrSlug} OR fields->>'$.slug' = ${moduleIdOrSlug}\n\t\t\t\t),\n\t\t\t\t-- Get all workshop resources with their positions\n\t\t\t\tworkshop_structure AS (\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tw.id AS workshop_id,\n\t\t\t\t\t\tcrr.resourceId,\n\t\t\t\t\t\tcrr.position AS position,\n\t\t\t\t\t\tcr.type AS resource_type,\n\t\t\t\t\t\tcr.fields->>'$.slug' AS resource_slug,\n\t\t\t\t\t\tcr.id AS resource_content_id\n\t\t\t\t\tFROM workshop w\n\t\t\t\t\tJOIN ${contentResourceResource} crr ON w.id = crr.resourceOfId\n\t\t\t\t\tJOIN ${contentResource} cr ON crr.resourceId = cr.id\n\t\t\t\t\tORDER BY crr.position\n\t\t\t\t),\n\t\t\t\t-- Recursively expand sections and maintain global ordering\n\t\t\t\texpanded_resources AS (\n\t\t\t\t\t-- Base case: direct lessons/posts from workshop\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tworkshop_id,\n\t\t\t\t\t\tposition * 1000 AS global_order, -- Multiply by 1000 to leave room for section items\n\t\t\t\t\t\tresource_content_id AS resource_id,\n\t\t\t\t\t\tresource_type,\n\t\t\t\t\t\tresource_slug\n\t\t\t\t\tFROM workshop_structure\n\t\t\t\t\tWHERE resource_type IN ('lesson', 'post')\n\t\t\t\t\tUNION ALL\n\t\t\t\t\t-- Recursive case: lessons within sections\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tws.workshop_id,\n\t\t\t\t\t\tws.position * 1000 + crr.position AS global_order, -- Section position * 1000 + lesson position\n\t\t\t\t\t\tcr.id AS resource_id,\n\t\t\t\t\t\tcr.type AS resource_type,\n\t\t\t\t\t\tcr.fields->>'$.slug' AS resource_slug\n\t\t\t\t\tFROM workshop_structure ws\n\t\t\t\t\tJOIN ${contentResourceResource} crr ON ws.resource_content_id = crr.resourceOfId\n\t\t\t\t\tJOIN ${contentResource} cr ON crr.resourceId = cr.id\n\t\t\t\t\tWHERE ws.resource_type = 'section'\n\t\t\t\t\tAND cr.type IN ('lesson', 'post')\n\t\t\t\t)\n\t\t\t\tSELECT\n\t\t\t\t\ter.resource_id,\n\t\t\t\t\ter.resource_type,\n\t\t\t\t\ter.resource_slug,\n\t\t\t\t\trp.completedAt AS completed_at,\n\t\t\t\t\ter.global_order\n\t\t\t\tFROM expanded_resources er\n\t\t\t\tLEFT JOIN ${resourceProgress} rp ON rp.resourceId = er.resource_id\n\t\t\t\t\tAND rp.userId = ${user.id}\n\t\t\t\tORDER BY er.global_order ASC\n\t\t\t`)\n\t\t\t// Process the results\n\t\t\tconst completedLessons: ResourceProgress[] = []\n\t\t\tlet nextResource: Partial<ContentResource> | null = null\n\t\t\tlet completedLessonsCount = 0\n\t\t\tlet totalLessonsCount = results.rows.length\n\n\t\t\tconst parsedRows = z.array(ResultRowSchema).safeParse(results.rows)\n\n\t\t\tif (!parsedRows.success) {\n\t\t\t\tlogger.error(parsedRows.error, {\n\t\t\t\t\tevent: 'adapter.moduleProgress.rows.parse_failed',\n\t\t\t\t\tmoduleIdOrSlug,\n\t\t\t\t\tuserId: user.id,\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tcompletedLessons: [],\n\t\t\t\t\tnextResource: null,\n\t\t\t\t\tpercentCompleted: 0,\n\t\t\t\t\tcompletedLessonsCount: 0,\n\t\t\t\t\ttotalLessonsCount,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const row of parsedRows.data) {\n\t\t\t\tif (row.completed_at) {\n\t\t\t\t\tcompletedLessonsCount++\n\t\t\t\t\tcompletedLessons.push({\n\t\t\t\t\t\tuserId: user.id as string,\n\t\t\t\t\t\tresourceId: row.resource_id,\n\t\t\t\t\t\tcompletedAt: new Date(row.completed_at),\n\t\t\t\t\t\t// Add other fields as needed\n\t\t\t\t\t})\n\t\t\t\t} else if (!nextResource) {\n\t\t\t\t\tnextResource = {\n\t\t\t\t\t\tid: row.resource_id,\n\t\t\t\t\t\ttype: row.resource_type,\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\tslug: row.resource_slug,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst percentCompleted =\n\t\t\t\ttotalLessonsCount > 0\n\t\t\t\t\t? Math.ceil((completedLessonsCount / totalLessonsCount) * 100)\n\t\t\t\t\t: 0\n\n\t\t\treturn {\n\t\t\t\tcompletedLessons,\n\t\t\t\tnextResource,\n\t\t\t\tpercentCompleted,\n\t\t\t\tcompletedLessonsCount,\n\t\t\t\ttotalLessonsCount,\n\t\t\t}\n\t\t},\n\t\tgetLessonProgresses(): Promise<ResourceProgress[]> {\n\t\t\tthrow new Error('getLessonProgresses Method not implemented.')\n\t\t},\n\t\tasync getMerchantCharge(\n\t\t\tmerchantChargeId: string,\n\t\t): Promise<MerchantCharge | null> {\n\t\t\tconst mCharge = await client.query.merchantCharge.findFirst({\n\t\t\t\twhere: eq(merchantCharge.id, merchantChargeId),\n\t\t\t})\n\t\t\tconst parsed = merchantChargeSchema.safeParse(mCharge)\n\t\t\tif (!parsed.success) {\n\t\t\t\tlogger.error(parsed.error, {\n\t\t\t\t\tevent: 'adapter.merchantCharge.parse_failed',\n\t\t\t\t\tmerchantChargeId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn parsed.data\n\t\t},\n\t\tasync getMerchantCouponsForTypeAndPercent(params: {\n\t\t\ttype: string\n\t\t\tpercentageDiscount: number\n\t\t}): Promise<MerchantCoupon[]> {\n\t\t\treturn z.array(merchantCouponSchema).parse(\n\t\t\t\tawait client.query.merchantCoupon.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(merchantCoupon.type, params.type),\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\tmerchantCoupon.percentageDiscount,\n\t\t\t\t\t\t\tparams.percentageDiscount.toString(),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync getMerchantCouponForTypeAndPercent(params: {\n\t\t\ttype: string\n\t\t\tpercentageDiscount: number\n\t\t}): Promise<MerchantCoupon | null> {\n\t\t\tconst foundMerchantCoupon = await client.query.merchantCoupon.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(merchantCoupon.type, params.type),\n\t\t\t\t\teq(\n\t\t\t\t\t\tmerchantCoupon.percentageDiscount,\n\t\t\t\t\t\tparams.percentageDiscount.toString(),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsed = merchantCouponSchema\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(foundMerchantCoupon)\n\t\t\tif (parsed.success) {\n\t\t\t\treturn parsed.data\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync getMerchantCouponForTypeAndAmount(params: {\n\t\t\ttype: string\n\t\t\tamountDiscount: number\n\t\t}): Promise<MerchantCoupon | null> {\n\t\t\tconst foundMerchantCoupon = await client.query.merchantCoupon.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(merchantCoupon.type, params.type),\n\t\t\t\t\teq(merchantCoupon.amountDiscount, params.amountDiscount),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsed = merchantCouponSchema\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(foundMerchantCoupon)\n\t\t\tif (parsed.success) {\n\t\t\t\treturn parsed.data\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync getMerchantCoupon(\n\t\t\tmerchantCouponId: string,\n\t\t): Promise<MerchantCoupon | null> {\n\t\t\tconst foundMerchantCoupon = await client.query.merchantCoupon.findFirst({\n\t\t\t\twhere: eq(merchantCoupon.id, merchantCouponId),\n\t\t\t})\n\n\t\t\tconst parsed = merchantCouponSchema\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(foundMerchantCoupon)\n\t\t\tif (parsed.success) {\n\t\t\t\treturn parsed.data\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync getMerchantProduct(\n\t\t\tstripeProductId: string,\n\t\t): Promise<MerchantProduct | null> {\n\t\t\treturn merchantProductSchema.nullable().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: eq(merchantProduct.identifier, stripeProductId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetPrice(productId: string): Promise<Price | null> {\n\t\t\tthrow new Error('getPrice not implemented.')\n\t\t},\n\t\tasync getPriceForProduct(productId: string): Promise<Price | null> {\n\t\t\treturn priceSchema.nullable().parse(\n\t\t\t\tawait client.query.prices.findFirst({\n\t\t\t\t\twhere: eq(prices.productId, productId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tasync archiveProduct(productId) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst product = await adapter.getProduct(productId)\n\n\t\t\tif (!product) {\n\t\t\t\tthrow new Error(`Product not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tif (!product.price) {\n\t\t\t\tthrow new Error(`Product has no price`)\n\t\t\t}\n\n\t\t\tawait client\n\t\t\t\t.update(products)\n\t\t\t\t.set({ status: 0, name: `${product.name} (Archived)` })\n\t\t\t\t.where(eq(products.id, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(prices)\n\t\t\t\t.set({ status: 0, nickname: `${product.name} (Archived)` })\n\t\t\t\t.where(eq(prices.productId, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(merchantProduct)\n\t\t\t\t.set({ status: 0 })\n\t\t\t\t.where(eq(merchantProduct.productId, productId))\n\n\t\t\tawait client\n\t\t\t\t.update(merchantPrice)\n\t\t\t\t.set({ status: 0 })\n\t\t\t\t.where(eq(merchantPrice.priceId, product.price.id))\n\n\t\t\tconst currentMerchantProduct = merchantProductSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: eq(merchantProduct.productId, productId),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!currentMerchantProduct || !currentMerchantProduct.identifier) {\n\t\t\t\tthrow new Error(`Merchant product not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tawait paymentProvider.updateProduct(currentMerchantProduct.identifier, {\n\t\t\t\tactive: false,\n\t\t\t})\n\n\t\t\tconst currentMerchantPrice = merchantPriceSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantPrice.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(merchantPrice.priceId, product.price.id),\n\t\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!currentMerchantPrice || !currentMerchantPrice.identifier) {\n\t\t\t\tthrow new Error(`Merchant price not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tawait paymentProvider.updatePrice(currentMerchantPrice.identifier, {\n\t\t\t\tactive: false,\n\t\t\t})\n\n\t\t\treturn adapter.getProduct(productId)\n\t\t},\n\t\tasync updateProduct(input: Product) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst currentProduct = await adapter.getProduct(input.id)\n\t\t\tif (!currentProduct) {\n\t\t\t\tthrow new Error(`Product not found`)\n\t\t\t}\n\t\t\tif (!currentProduct.price) {\n\t\t\t\tthrow new Error(`Product has no price`)\n\t\t\t}\n\n\t\t\tconst merchantProduct = merchantProductSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantProduct.findFirst({\n\t\t\t\t\twhere: (merchantProduct, { eq }) =>\n\t\t\t\t\t\teq(merchantProduct.productId, input.id),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantProduct || !merchantProduct.identifier) {\n\t\t\t\tthrow new Error(`Merchant product not found`)\n\t\t\t}\n\n\t\t\t// TODO: handle upgrades\n\n\t\t\tconst stripeProduct = await paymentProvider.getProduct(\n\t\t\t\tmerchantProduct.identifier,\n\t\t\t)\n\n\t\t\tconst priceChanged =\n\t\t\t\tcurrentProduct.price.unitAmount.toString() !==\n\t\t\t\tinput.price?.unitAmount.toString()\n\n\t\t\t// Get current merchant price and Stripe price to check if it needs updating\n\t\t\tconst currentMerchantPrice = merchantPriceSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantPrice.findFirst({\n\t\t\t\t\twhere: (merchantPrice, { eq, and }) =>\n\t\t\t\t\t\tand(\n\t\t\t\t\t\t\teq(merchantPrice.merchantProductId, merchantProduct.id),\n\t\t\t\t\t\t\teq(merchantPrice.status, 1),\n\t\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!currentMerchantPrice || !currentMerchantPrice.identifier) {\n\t\t\t\tthrow new Error(`Merchant price not found`)\n\t\t\t}\n\n\t\t\tconst currentStripePrice = await paymentProvider.getPrice(\n\t\t\t\tcurrentMerchantPrice.identifier,\n\t\t\t)\n\n\t\t\t// Check if type changed to/from membership (requires Stripe price recreation)\n\t\t\tconst membershipTypeChanged =\n\t\t\t\tcurrentProduct.type !== input.type &&\n\t\t\t\t(input.type === 'membership' || currentProduct.type === 'membership')\n\n\t\t\t// Check if billing interval changed for membership products\n\t\t\tconst billingIntervalChanged =\n\t\t\t\tinput.type === 'membership' &&\n\t\t\t\tcurrentProduct.type === 'membership' &&\n\t\t\t\tcurrentProduct.fields?.billingInterval !== input.fields?.billingInterval\n\n\t\t\t// Check if Stripe price recurring status doesn't match expected state for input type:\n\t\t\t// - membership products require recurring=true\n\t\t\t// - non-membership products require recurring=false (null/undefined)\n\t\t\tconst isMembership = input.type === 'membership'\n\t\t\tconst stripePriceMismatch =\n\t\t\t\tisMembership !== !!currentStripePrice.recurring\n\n\t\t\t// Need to recreate price if: price changed, type changed to/from membership,\n\t\t\t// billing interval changed, or Stripe price doesn't match expected recurring status\n\t\t\tconst needsPriceRecreation =\n\t\t\t\tpriceChanged ||\n\t\t\t\tmembershipTypeChanged ||\n\t\t\t\tbillingIntervalChanged ||\n\t\t\t\tstripePriceMismatch\n\n\t\t\tif (needsPriceRecreation) {\n\t\t\t\t// Get billing interval from input or default to 'year'\n\t\t\t\tconst billingInterval = input.fields?.billingInterval || 'year'\n\n\t\t\t\tconst priceParams = {\n\t\t\t\t\tproduct: stripeProduct.id,\n\t\t\t\t\tunit_amount: Math.floor(Number(input.price?.unitAmount || 0) * 100),\n\t\t\t\t\tcurrency: 'usd',\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tslug: input.fields.slug,\n\t\t\t\t\t},\n\t\t\t\t\tactive: true,\n\t\t\t\t\t// Membership products get recurring billing\n\t\t\t\t\t...(input.type === 'membership' && {\n\t\t\t\t\t\trecurring: { interval: billingInterval },\n\t\t\t\t\t}),\n\t\t\t\t}\n\n\t\t\t\tlogger.debug('adapter.product.price_recreation.started', {\n\t\t\t\t\tbillingInterval,\n\t\t\t\t\tcurrency: priceParams.currency,\n\t\t\t\t\tcurrentMerchantPriceId: currentMerchantPrice.id,\n\t\t\t\t\tisMembership: input.type === 'membership',\n\t\t\t\t\tmerchantProductId: merchantProduct.id,\n\t\t\t\t\tproductId: input.id,\n\t\t\t\t\tproductSlug: input.fields.slug,\n\t\t\t\t\tstripeProductId: stripeProduct.id,\n\t\t\t\t\tunitAmount: priceParams.unit_amount,\n\t\t\t\t})\n\n\t\t\t\tconst newStripePrice = await paymentProvider.createPrice(priceParams)\n\n\t\t\t\tawait paymentProvider.updateProduct(stripeProduct.id, {\n\t\t\t\t\tdefault_price: newStripePrice.id,\n\t\t\t\t})\n\n\t\t\t\tconst newMerchantPriceId = `mprice_${v4()}`\n\t\t\t\tawait client.insert(merchantPrice).values({\n\t\t\t\t\tid: newMerchantPriceId,\n\t\t\t\t\tmerchantProductId: merchantProduct.id,\n\t\t\t\t\tmerchantAccountId: merchantProduct.merchantAccountId,\n\t\t\t\t\tpriceId: currentProduct.price.id,\n\t\t\t\t\tstatus: 1,\n\t\t\t\t\tidentifier: newStripePrice.id,\n\t\t\t\t})\n\n\t\t\t\tif (currentMerchantPrice) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(merchantPrice)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(merchantPrice.id, currentMerchantPrice.id))\n\t\t\t\t}\n\n\t\t\t\tawait client\n\t\t\t\t\t.update(prices)\n\t\t\t\t\t.set({\n\t\t\t\t\t\tunitAmount: Math.floor(\n\t\t\t\t\t\t\tNumber(input.price?.unitAmount || 0),\n\t\t\t\t\t\t).toString(),\n\t\t\t\t\t\tnickname: input.name,\n\t\t\t\t\t})\n\t\t\t\t\t.where(eq(prices.id, currentProduct.price.id))\n\n\t\t\t\tif (currentStripePrice) {\n\t\t\t\t\tawait paymentProvider.updatePrice(currentStripePrice.id, {\n\t\t\t\t\t\tactive: false,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait paymentProvider.updateProduct(stripeProduct.id, {\n\t\t\t\tname: input.name,\n\t\t\t\tactive: true,\n\t\t\t\timages: input.fields.image?.url ? [input.fields.image.url] : undefined,\n\t\t\t\tdescription: input.fields.description || '',\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: input.fields.slug,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { image, ...fieldsNoImage } = input.fields\n\n\t\t\tawait client\n\t\t\t\t.update(products)\n\t\t\t\t.set({\n\t\t\t\t\tname: input.name,\n\t\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\t\tstatus: 1,\n\t\t\t\t\tfields: {\n\t\t\t\t\t\t...fieldsNoImage,\n\t\t\t\t\t\t...(image?.url && { image }),\n\t\t\t\t\t},\n\t\t\t\t\ttype: input.type,\n\t\t\t\t})\n\t\t\t\t.where(eq(products.id, currentProduct.id))\n\n\t\t\treturn adapter.getProduct(currentProduct.id)\n\t\t},\n\t\tasync createProduct(input: NewProduct) {\n\t\t\tif (!paymentProvider) throw new Error('Payment provider not found')\n\t\t\tconst merchantAccount = merchantAccountSchema.nullish().parse(\n\t\t\t\tawait client.query.merchantAccount.findFirst({\n\t\t\t\t\twhere: (merchantAccount, { eq }) =>\n\t\t\t\t\t\teq(merchantAccount.label, 'stripe'),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantAccount) {\n\t\t\t\tthrow new Error('Merchant account not found')\n\t\t\t}\n\n\t\t\tconst hash = guid()\n\t\t\tconst newProductId = slugify(`product-${hash}`)\n\n\t\t\tconst newProduct = {\n\t\t\t\tid: newProductId,\n\t\t\t\tname: input.name,\n\t\t\t\tstatus: 1,\n\t\t\t\ttype: input.type || 'self-paced',\n\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\tfields: {\n\t\t\t\t\tstate: input.state || 'draft',\n\t\t\t\t\tvisibility: input.visibility || 'unlisted',\n\t\t\t\t\tslug: slugify(`${input.name}-${hash}`),\n\t\t\t\t\t...(input.openEnrollment && { openEnrollment: input.openEnrollment }),\n\t\t\t\t\t...(input.closeEnrollment && {\n\t\t\t\t\t\tcloseEnrollment: input.closeEnrollment,\n\t\t\t\t\t}),\n\t\t\t\t\t...(typeof input.availableAfterDays === 'number' && {\n\t\t\t\t\t\tavailableAfterDays: input.availableAfterDays,\n\t\t\t\t\t}),\n\t\t\t\t\t...(typeof input.accessDurationDays === 'number' && {\n\t\t\t\t\t\taccessDurationDays: input.accessDurationDays,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tawait client.insert(products).values(newProduct)\n\n\t\t\tconst priceHash = guid()\n\t\t\tconst newPriceId = `price-${priceHash}`\n\n\t\t\tawait client.insert(prices).values({\n\t\t\t\tid: newPriceId,\n\t\t\t\tproductId: newProductId,\n\t\t\t\tunitAmount: input.price.toString(),\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\tconst product = await adapter.getProduct(newProductId)\n\n\t\t\tconst stripeProduct = await paymentProvider.createProduct({\n\t\t\t\tname: input.name,\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: product?.fields?.slug || null,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst stripePrice = await paymentProvider.createPrice({\n\t\t\t\tproduct: stripeProduct.id,\n\t\t\t\tunit_amount: Math.floor(Number(input.price) * 100),\n\t\t\t\tcurrency: 'usd',\n\t\t\t\tnickname: input.name,\n\t\t\t\tmetadata: {\n\t\t\t\t\tslug: product?.fields?.slug || null,\n\t\t\t\t},\n\t\t\t\t// Membership products get recurring billing\n\t\t\t\t...(input.type === 'membership' && {\n\t\t\t\t\trecurring: { interval: input.billingInterval || 'year' },\n\t\t\t\t}),\n\t\t\t})\n\n\t\t\tconst newMerchantProductId = `mproduct_${v4()}`\n\n\t\t\tawait client.insert(merchantProduct).values({\n\t\t\t\tid: newMerchantProductId,\n\t\t\t\tmerchantAccountId: merchantAccount.id,\n\t\t\t\tproductId: newProductId,\n\t\t\t\tidentifier: stripeProduct.id,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\tconst newMerchantPriceId = `mprice_${v4()}`\n\t\t\tawait client.insert(merchantPrice).values({\n\t\t\t\tid: newMerchantPriceId,\n\t\t\t\tmerchantAccountId: merchantAccount.id,\n\t\t\t\tmerchantProductId: newMerchantProductId,\n\t\t\t\tpriceId: newPriceId,\n\t\t\t\tidentifier: stripePrice.id,\n\t\t\t\tstatus: 1,\n\t\t\t})\n\n\t\t\t// TODO: handle upgrades\n\n\t\t\treturn product\n\t\t},\n\t\tasync getProduct(\n\t\t\tproductSlugOrId?: string,\n\t\t\twithResources: boolean = true,\n\t\t): Promise<Product | null> {\n\t\t\tif (!productSlugOrId) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst productData = await client.query.products.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\teq(\n\t\t\t\t\t\t\t\tsql`JSON_EXTRACT (${products.fields}, \"$.slug\")`,\n\t\t\t\t\t\t\t\t`${productSlugOrId}`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\teq(products.id, productSlugOrId),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tprice: true,\n\t\t\t\t\t\t...(withResources && {\n\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresources: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tconst parsedProduct = productSchema.safeParse(productData)\n\t\t\t\tif (!parsedProduct.success) {\n\t\t\t\t\tlogger.error(parsedProduct.error, {\n\t\t\t\t\t\tevent: 'adapter.product.parse_failed',\n\t\t\t\t\t\tproductId: productData?.id,\n\t\t\t\t\t\tproductSlugOrId,\n\t\t\t\t\t})\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\treturn parsedProduct.data\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(toError(e), {\n\t\t\t\t\tevent: 'adapter.product.lookup.failed',\n\t\t\t\t\tproductSlugOrId,\n\t\t\t\t\twithResources,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\t\t},\n\t\tasync getProductResources(\n\t\t\tproductId: string,\n\t\t): Promise<ContentResource[] | null> {\n\t\t\tconst contentResourceProductsForProduct = z\n\t\t\t\t.array(ContentResourceProductSchema)\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.contentResourceProduct.findMany({\n\t\t\t\t\t\twhere: eq(contentResourceProduct.productId, productId),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tif (!contentResourceProductsForProduct) {\n\t\t\t\treturn null\n\t\t\t} else {\n\t\t\t\tconst contentResources = z.array(ContentResourceSchema).parse(\n\t\t\t\t\tawait client.query.contentResource.findMany({\n\t\t\t\t\t\twhere: inArray(\n\t\t\t\t\t\t\tcontentResource.id,\n\t\t\t\t\t\t\tcontentResourceProductsForProduct.map((crp) => crp.resourceId),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\treturn contentResources\n\t\t\t}\n\t\t},\n\t\tasync getPurchaseCountForProduct(productId: string): Promise<number> {\n\t\t\treturn await client.query.purchases\n\t\t\t\t.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(purchaseTable.productId, productId),\n\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t\t.then((res) => res.length)\n\t\t},\n\t\tasync getPurchase(purchaseId: string): Promise<Purchase | null> {\n\t\t\tconst purchase = await client.query.purchases.findFirst({\n\t\t\t\twhere: eq(purchaseTable.id, purchaseId),\n\t\t\t})\n\n\t\t\treturn purchase ? purchaseSchema.parse(purchase) : null\n\t\t},\n\t\tasync createPurchase(options): Promise<Purchase> {\n\t\t\tconst newPurchaseId = options.id || `purchase-${v4()}`\n\t\t\tawait client.insert(purchaseTable).values({\n\t\t\t\t...options,\n\t\t\t\tid: newPurchaseId,\n\t\t\t})\n\n\t\t\tconst newPurchase = await adapter.getPurchase(newPurchaseId)\n\n\t\t\treturn purchaseSchema.parse(newPurchase)\n\t\t},\n\n\t\tasync getPurchaseForStripeCharge(\n\t\t\tstripeChargeId: string,\n\t\t): Promise<Purchase | null> {\n\t\t\tlogger.debug('getPurchaseForStripeCharge', { stripeChargeId })\n\n\t\t\tconst chargeForPurchase = merchantChargeSchema.nullable().parse(\n\t\t\t\t(await client.query.merchantCharge.findFirst({\n\t\t\t\t\twhere: eq(merchantCharge.identifier, stripeChargeId),\n\t\t\t\t})) || null,\n\t\t\t)\n\n\t\t\tif (!chargeForPurchase) {\n\t\t\t\t// Expected during initial checkout processing — the merchant\n\t\t\t\t// charge hasn't been created yet. Also expected when the\n\t\t\t\t// payment-status-checker passes a PaymentIntent ID (pi_xxx)\n\t\t\t\t// instead of a Charge ID (ch_xxx).\n\t\t\t\tlogger.debug('getPurchaseForStripeCharge: no matching charge', {\n\t\t\t\t\tstripeChargeId,\n\t\t\t\t\tidPrefix: stripeChargeId?.substring(0, 3),\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst purchase = purchaseSchema.safeParse(\n\t\t\t\tawait client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.merchantChargeId, chargeForPurchase.id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!purchase.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn purchase.data\n\t\t},\n\t\tasync getPurchaseByCheckoutSessionId(\n\t\t\tcheckoutSessionId: string,\n\t\t): Promise<Purchase | null> {\n\t\t\tlogger.debug('getPurchaseByCheckoutSessionId', { checkoutSessionId })\n\n\t\t\t// Find the MerchantSession by its identifier (the Stripe checkout session ID)\n\t\t\tconst session = await client.query.merchantSession.findFirst({\n\t\t\t\twhere: eq(merchantSession.identifier, checkoutSessionId),\n\t\t\t})\n\n\t\t\tif (!session) {\n\t\t\t\tlogger.debug('getPurchaseByCheckoutSessionId: no matching session', {\n\t\t\t\t\tcheckoutSessionId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst purchase = purchaseSchema.safeParse(\n\t\t\t\tawait client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.merchantSessionId, String(session.id)),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!purchase.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn purchase.data\n\t\t},\n\t\tasync getPurchaseUserTransferById(options: { id: string }): Promise<\n\t\t\t| (PurchaseUserTransfer & {\n\t\t\t\t\tsourceUser: User\n\t\t\t\t\ttargetUser: User | null\n\t\t\t\t\tpurchase: Purchase\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tconst purchaseTransferData =\n\t\t\t\tawait client.query.purchaseUserTransfer.findFirst({\n\t\t\t\t\twhere: eq(purchaseUserTransfer.id, options.id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tsourceUser: true,\n\t\t\t\t\t\ttargetUser: true,\n\t\t\t\t\t\tpurchase: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\treturn purchaseUserTransferSchema\n\t\t\t\t.merge(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tsourceUser: userSchema,\n\t\t\t\t\t\ttargetUser: userSchema.nullable(),\n\t\t\t\t\t\tpurchase: purchaseSchema,\n\t\t\t\t\t\torganizationId: z.string().nullable(),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\t.nullable()\n\t\t\t\t.parse(purchaseTransferData)\n\t\t},\n\t\tasync getPurchaseWithUser(purchaseId: string): Promise<\n\t\t\t| (Purchase & {\n\t\t\t\t\tuser: User\n\t\t\t })\n\t\t\t| null\n\t\t> {\n\t\t\tconst purchaseData =\n\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(purchaseTable.id, purchaseId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})) || null\n\n\t\t\tconst parsedPurchase = purchaseSchema\n\t\t\t\t.merge(z.object({ user: userSchema }))\n\t\t\t\t.nullable()\n\t\t\t\t.safeParse(purchaseData)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tlogger.error(parsedPurchase.error, {\n\t\t\t\t\tevent: 'adapter.purchase.parse_failed',\n\t\t\t\t\tpurchaseId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn parsedPurchase.data\n\t\t},\n\t\tasync getPurchasesForUser(userId?: string): Promise<Purchase[]> {\n\t\t\tif (!userId) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst visiblePurchaseStates = ['Valid', 'Refunded', 'Restricted']\n\n\t\t\tconst userPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.status, visiblePurchaseStates),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t\torderBy: asc(purchaseTable.createdAt),\n\t\t\t})\n\n\t\t\tconst parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases)\n\n\t\t\tif (!parsedPurchases.success) {\n\t\t\t\tlogger.error(parsedPurchases.error, {\n\t\t\t\t\tevent: 'adapter.purchase.list.parse_failed',\n\t\t\t\t\tpurchaseCount: userPurchases.length,\n\t\t\t\t\tuserId,\n\t\t\t\t})\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\treturn parsedPurchases.data\n\t\t},\n\t\tasync getEntitlementsForUser(params: {\n\t\t\tuserId: string\n\t\t\tsourceType?: string\n\t\t\tentitlementType?: string\n\t\t}): Promise<Entitlement[]> {\n\t\t\tconst { userId, sourceType, entitlementType } = params\n\n\t\t\tif (!userId) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst conditions = [eq(entitlementTable.userId, userId)]\n\n\t\t\tif (sourceType) {\n\t\t\t\tconditions.push(eq(entitlementTable.sourceType, sourceType))\n\t\t\t}\n\n\t\t\tif (entitlementType) {\n\t\t\t\tconditions.push(eq(entitlementTable.entitlementType, entitlementType))\n\t\t\t}\n\n\t\t\t// Only return active entitlements (not deleted, not expired)\n\t\t\tconditions.push(isNull(entitlementTable.deletedAt))\n\t\t\tconst expiresCondition = or(\n\t\t\t\tisNull(entitlementTable.expiresAt),\n\t\t\t\tgte(entitlementTable.expiresAt, sql`CURRENT_TIMESTAMP`),\n\t\t\t)\n\t\t\tif (expiresCondition) {\n\t\t\t\tconditions.push(expiresCondition)\n\t\t\t}\n\n\t\t\tconst userEntitlements = await client.query.entitlements.findMany({\n\t\t\t\twhere: conditions.length > 0 ? and(...conditions) : undefined,\n\t\t\t\torderBy: asc(entitlementTable.createdAt),\n\t\t\t})\n\n\t\t\tconst parsedEntitlements = z\n\t\t\t\t.array(entitlementSchema)\n\t\t\t\t.safeParse(userEntitlements)\n\n\t\t\tif (!parsedEntitlements.success) {\n\t\t\t\tlogger.error(parsedEntitlements.error, {\n\t\t\t\t\tentitlementCount: userEntitlements.length,\n\t\t\t\t\tentitlementType,\n\t\t\t\t\tevent: 'adapter.entitlement.list.parse_failed',\n\t\t\t\t\tsourceType,\n\t\t\t\t\tuserId,\n\t\t\t\t})\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\treturn parsedEntitlements.data\n\t\t},\n\t\tasync getEntitlementTypeByName(\n\t\t\tname: string,\n\t\t): Promise<{ id: string; name: string } | null> {\n\t\t\tconst entitlementType = await client.query.entitlementTypes.findFirst({\n\t\t\t\twhere: eq(entitlementTypes.name, name),\n\t\t\t})\n\n\t\t\tif (!entitlementType) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: String(entitlementType.id),\n\t\t\t\tname: String(entitlementType.name),\n\t\t\t}\n\t\t},\n\t\tasync getPurchaseDetails(\n\t\t\tpurchaseId: string,\n\t\t\tuserId: string,\n\t\t): Promise<{\n\t\t\tpurchase?: Purchase\n\t\t\texistingPurchase?: Purchase | null\n\t\t\tavailableUpgrades: UpgradableProduct[]\n\t\t}> {\n\t\t\tconst visiblePurchaseStates = ['Valid', 'Refunded', 'Restricted']\n\n\t\t\tconst userPurchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.status, visiblePurchaseStates),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t\torderBy: asc(purchaseTable.createdAt),\n\t\t\t})\n\n\t\t\tconst parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases)\n\n\t\t\tconst allPurchases = parsedPurchases.success ? parsedPurchases.data : []\n\n\t\t\tconst thePurchase = await client.query.purchases.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.id, purchaseId),\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tuser: true,\n\t\t\t\t\tproduct: true,\n\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedPurchase = purchaseSchema.safeParse(thePurchase)\n\n\t\t\tif (!parsedPurchase.success) {\n\t\t\t\tlogger.error(parsedPurchase.error, {\n\t\t\t\t\tevent: 'adapter.purchase.details.parse_failed',\n\t\t\t\t\tpurchaseId,\n\t\t\t\t\tuserId,\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tavailableUpgrades: [],\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst purchaseCanUpgrade = ['Valid', 'Restricted'].includes(\n\t\t\t\tparsedPurchase.data.state || '',\n\t\t\t)\n\n\t\t\tlet availableUpgrades: any[] = []\n\n\t\t\tif (purchaseCanUpgrade) {\n\t\t\t\tavailableUpgrades = await client.query.upgradableProducts.findMany({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\tupgradableProducts.upgradableFromId,\n\t\t\t\t\t\t\tparsedPurchase.data.product?.id as string,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnot(\n\t\t\t\t\t\t\tinArray(\n\t\t\t\t\t\t\t\tupgradableProducts.upgradableToId,\n\t\t\t\t\t\t\t\tallPurchases.map((p) => p.product?.id as string),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tupgradableTo: true,\n\t\t\t\t\t\tupgradableFrom: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst existingPurchase = purchaseSchema\n\t\t\t\t.optional()\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\t(await client.query.purchases.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\t\t\teq(purchaseTable.productId, parsedPurchase.data.productId),\n\t\t\t\t\t\t\tinArray(purchaseTable.status, ['Valid', 'Restricted']),\n\t\t\t\t\t\t\tisNull(purchaseTable.bulkCouponId),\n\t\t\t\t\t\t\tnot(eq(purchaseTable.id, parsedPurchase.data.id)),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t})) || null,\n\t\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tavailableUpgrades: z\n\t\t\t\t\t.array(upgradableProductSchema)\n\t\t\t\t\t.parse(availableUpgrades),\n\t\t\t\texistingPurchase,\n\t\t\t\tpurchase: parsedPurchase.data,\n\t\t\t}\n\t\t},\n\t\tasync getUserWithPurchasersByEmail(email: string): Promise<any | null> {\n\t\t\tconst user = await client.query.users.findFirst({\n\t\t\t\twhere: eq(users.email, email.trim().toLowerCase()),\n\t\t\t\twith: {\n\t\t\t\t\t// merchantCustomer: true,\n\t\t\t\t\troles: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\trole: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tpurchases: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tbulkCoupon: true,\n\t\t\t\t\t\t\tmerchantCharge: true,\n\t\t\t\t\t\t\tproduct: {\n\t\t\t\t\t\t\t\tcolumns: {\n\t\t\t\t\t\t\t\t\tid: true,\n\t\t\t\t\t\t\t\t\tname: true,\n\t\t\t\t\t\t\t\t\tkey: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn user\n\t\t},\n\t\tasync getUserById(userId: string): Promise<User | null> {\n\t\t\tconst user = await client.query.users\n\t\t\t\t.findFirst({\n\t\t\t\t\twhere: eq(users.id, userId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\troles: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\trole: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\t.then(async (res) => {\n\t\t\t\t\tif (res) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...res,\n\t\t\t\t\t\t\troles: res.roles.map((r) => r.role),\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\treturn userSchema.nullable().parse(user ?? null)\n\t\t},\n\t\tasync pricesOfPurchasesTowardOneBundle({\n\t\t\tuserId,\n\t\t\tbundleId,\n\t\t}: {\n\t\t\tuserId: string | undefined\n\t\t\tbundleId: string\n\t\t}): Promise<Price[]> {\n\t\t\tif (userId === undefined) return []\n\n\t\t\tconst canUpgradeProducts = await client.query.upgradableProducts.findMany(\n\t\t\t\t{\n\t\t\t\t\twhere: eq(upgradableProducts.upgradableToId, bundleId),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst upgradableFrom = z.array(z.string()).parse(\n\t\t\t\tcanUpgradeProducts.map((product) => {\n\t\t\t\t\treturn product.upgradableFromId\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tconst purchases = await client.query.purchases.findMany({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(purchaseTable.userId, userId),\n\t\t\t\t\tinArray(purchaseTable.productId, upgradableFrom),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst productsPurchased = z.array(z.string()).parse(\n\t\t\t\tpurchases.map((purchase) => {\n\t\t\t\t\treturn purchase.productId\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (productsPurchased.length === 0) return []\n\n\t\t\tconst foundPrices = await client.query.prices.findMany({\n\t\t\t\twhere: inArray(prices.productId, productsPurchased),\n\t\t\t})\n\n\t\t\treturn z.array(priceSchema).parse(foundPrices)\n\t\t},\n\t\tasync toggleLessonProgressForUser(options: {\n\t\t\tuserId: string\n\t\t\tlessonId?: string\n\t\t}): Promise<ResourceProgress | null> {\n\t\t\tif (!options.lessonId) {\n\t\t\t\tthrow new Error('No lessonId provided')\n\t\t\t}\n\n\t\t\tlet lessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst now = new Date()\n\n\t\t\tif (lessonProgress) {\n\t\t\t\tawait client\n\t\t\t\t\t.update(resourceProgress)\n\t\t\t\t\t.set({\n\t\t\t\t\t\tcompletedAt: lessonProgress.completedAt ? null : now,\n\t\t\t\t\t\tupdatedAt: now,\n\t\t\t\t\t})\n\t\t\t\t\t.where(eq(resourceProgress.resourceId, options.lessonId))\n\t\t\t} else {\n\t\t\t\tawait client.insert(resourceProgress).values({\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t\tresourceId: options.lessonId,\n\t\t\t\t\tcompletedAt: now,\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tlessonProgress = await client.query.resourceProgress.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(resourceProgress.userId, options.userId),\n\t\t\t\t\teq(resourceProgress.resourceId, options.lessonId),\n\t\t\t\t),\n\t\t\t})\n\n\t\t\tconst parsedLessonProgress =\n\t\t\t\tresourceProgressSchema.safeParse(lessonProgress)\n\n\t\t\tif (!parsedLessonProgress.success) {\n\t\t\t\tlogger.error(parsedLessonProgress.error, {\n\t\t\t\t\tevent: 'adapter.lessonProgress.parse_failed',\n\t\t\t\t\tlessonId: options.lessonId,\n\t\t\t\t\tuserId: options.userId,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedLessonProgress.data\n\t\t},\n\t\ttransferPurchaseToUser: async (options: {\n\t\t\tpurchaseId: string\n\t\t\ttargetUserId: string\n\t\t\tsourceUserId: string\n\t\t}) => {\n\t\t\tconst { purchaseId, targetUserId, sourceUserId } = options\n\t\t\tconst transferId = `put_${v4()}`\n\t\t\tlet purchase = await adapter.getPurchase(purchaseId)\n\t\t\tif (!purchase) throw new Error('No purchase found')\n\n\t\t\tif (purchase.userId !== sourceUserId)\n\t\t\t\tthrow new Error('Invalid source user')\n\n\t\t\tawait client.transaction(async (trx) => {\n\t\t\t\tif (!purchase) throw new Error('No purchase found')\n\t\t\t\tawait trx\n\t\t\t\t\t.update(purchaseTable)\n\t\t\t\t\t.set({ userId: targetUserId })\n\t\t\t\t\t.where(eq(purchaseTable.id, purchase.id))\n\n\t\t\t\tawait trx.insert(purchaseUserTransfer).values({\n\t\t\t\t\tid: transferId,\n\t\t\t\t\tpurchaseId: purchase.id,\n\t\t\t\t\tsourceUserId: sourceUserId,\n\t\t\t\t\ttargetUserId: targetUserId,\n\t\t\t\t\ttransferState: 'COMPLETED',\n\t\t\t\t\tcompletedAt: new Date(),\n\t\t\t\t})\n\n\t\t\t\tpurchase = await adapter.getPurchase(purchaseId)\n\n\t\t\t\tif (!purchase) throw new Error('No purchase found')\n\n\t\t\t\tif (paymentProvider && purchase.merchantChargeId) {\n\t\t\t\t\tawait trx\n\t\t\t\t\t\t.update(merchantCharge)\n\t\t\t\t\t\t.set({\n\t\t\t\t\t\t\tuserId: targetUserId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.where(eq(merchantCharge.id, purchase.merchantChargeId))\n\n\t\t\t\t\tconst updatedMerchantCharge = await adapter.getMerchantCharge(\n\t\t\t\t\t\tpurchase.merchantChargeId,\n\t\t\t\t\t)\n\n\t\t\t\t\tif (!updatedMerchantCharge)\n\t\t\t\t\t\tthrow new Error('No merchant charge found')\n\n\t\t\t\t\tawait trx\n\t\t\t\t\t\t.update(merchantCustomer)\n\t\t\t\t\t\t.set({ userId: targetUserId })\n\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\teq(merchantCustomer.id, updatedMerchantCharge.merchantCustomerId),\n\t\t\t\t\t\t)\n\n\t\t\t\t\tconst updatedMerchantCustomer = merchantCustomerSchema.parse(\n\t\t\t\t\t\tawait client.query.merchantCustomer.findFirst({\n\t\t\t\t\t\t\twhere: eq(\n\t\t\t\t\t\t\t\tmerchantCustomer.id,\n\t\t\t\t\t\t\t\tupdatedMerchantCharge.merchantCustomerId,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst targetUser = userSchema.parse(\n\t\t\t\t\t\tawait client.query.users.findFirst({\n\t\t\t\t\t\t\twhere: eq(users.id, targetUserId),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tconst sourceUser = userSchema.parse(\n\t\t\t\t\t\tawait client.query.users.findFirst({\n\t\t\t\t\t\t\twhere: eq(users.id, sourceUserId),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\n\t\t\t\t\tawait paymentProvider.updateCustomer(\n\t\t\t\t\t\tupdatedMerchantCustomer.identifier,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\temail: targetUser.email,\n\t\t\t\t\t\t\tname: targetUser.name || sourceUser.name || '',\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\ttransferId,\n\t\t\t\t\t\t\t\ttransferredFrom: sourceUser.email,\n\t\t\t\t\t\t\t\ttransferredOn: new Date().toISOString(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn await adapter.getPurchaseUserTransferById({\n\t\t\t\tid: transferId,\n\t\t\t})\n\t\t},\n\t\ttransferPurchasesToNewUser(options: {\n\t\t\tmerchantCustomerId: string\n\t\t\tuserId: string\n\t\t}): Promise<unknown> {\n\t\t\tthrow new Error('Method not implemented.')\n\t\t},\n\t\tasync updatePurchaseStatusForCharge(\n\t\t\tchargeId: string,\n\t\t\tstatus: 'Valid' | 'Refunded' | 'Disputed' | 'Banned' | 'Restricted',\n\t\t): Promise<Purchase | undefined> {\n\t\t\ttry {\n\t\t\t\tlogger.debug('adapter.purchase.status_update.started', {\n\t\t\t\t\tchargeId,\n\t\t\t\t\tstatus,\n\t\t\t\t})\n\t\t\t\tconst merchantChargeForPurchase =\n\t\t\t\t\tawait client.query.merchantCharge.findFirst({\n\t\t\t\t\t\twhere: or(\n\t\t\t\t\t\t\teq(merchantCharge.identifier, chargeId),\n\t\t\t\t\t\t\teq(merchantCharge.id, chargeId),\n\t\t\t\t\t\t),\n\t\t\t\t\t})\n\n\t\t\t\tlogger.debug('adapter.purchase.status_update.charge_resolved', {\n\t\t\t\t\tchargeId,\n\t\t\t\t\tmerchantChargeId: merchantChargeForPurchase?.id ?? null,\n\t\t\t\t\tmerchantChargeIdentifier:\n\t\t\t\t\t\tmerchantChargeForPurchase?.identifier ?? null,\n\t\t\t\t})\n\n\t\t\t\tconst parsedMerchantChargeForPurchase = merchantChargeSchema.parse(\n\t\t\t\t\tmerchantChargeForPurchase,\n\t\t\t\t)\n\n\t\t\t\tif (!parsedMerchantChargeForPurchase)\n\t\t\t\t\tthrow new Error(`no-charge-found-for-purchase ${chargeId}`)\n\n\t\t\t\tconst purchase = await client.query.purchases.findFirst({\n\t\t\t\t\twhere: eq(\n\t\t\t\t\t\tpurchaseTable.merchantChargeId,\n\t\t\t\t\t\tparsedMerchantChargeForPurchase.id,\n\t\t\t\t\t),\n\t\t\t\t})\n\n\t\t\t\tconst parsedPurchase = purchaseSchema.nullable().parse(purchase)\n\n\t\t\t\tif (parsedPurchase) {\n\t\t\t\t\tawait client\n\t\t\t\t\t\t.update(purchaseTable)\n\t\t\t\t\t\t.set({ status: status })\n\t\t\t\t\t\t.where(eq(purchaseTable.id, parsedPurchase.id))\n\n\t\t\t\t\tconst newPurchase = await client.query.purchases.findFirst({\n\t\t\t\t\t\twhere: eq(purchaseTable.id, parsedPurchase.id),\n\t\t\t\t\t})\n\n\t\t\t\t\treturn purchaseSchema.optional().parse(newPurchase)\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`no-purchase-found-for-charge ${chargeId}`)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlogger.error(toError(e), {\n\t\t\t\t\tchargeId,\n\t\t\t\t\tevent: 'adapter.purchase.status_update.failed',\n\t\t\t\t\tstatus,\n\t\t\t\t})\n\t\t\t\tthrow e\n\t\t\t}\n\t\t},\n\t\tasync updatePurchaseUserTransferTransferState(options: {\n\t\t\tid: string\n\t\t\ttransferState: PurchaseUserTransferState\n\t\t}): Promise<PurchaseUserTransfer | null> {\n\t\t\tawait client\n\t\t\t\t.update(purchaseUserTransfer)\n\t\t\t\t.set({\n\t\t\t\t\ttransferState: options.transferState,\n\t\t\t\t})\n\t\t\t\t.where(eq(purchaseUserTransfer.id, options.id))\n\n\t\t\tconst purchaseUserTransferData =\n\t\t\t\t(await client.query.purchaseUserTransfer.findFirst({\n\t\t\t\t\twhere: eq(purchaseUserTransfer.id, options.id),\n\t\t\t\t})) || null\n\n\t\t\treturn purchaseUserTransferSchema\n\t\t\t\t.nullable()\n\t\t\t\t.parse(purchaseUserTransferData)\n\t\t},\n\t\taddResourceToResource: async function (options) {\n\t\t\tconst { parentResourceId, childResourceId } = options\n\n\t\t\tconst parentResourceData = await client.query.contentResource.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\teq(\n\t\t\t\t\t\tsql`JSON_EXTRACT (${contentResource.fields}, \"$.slug\")`,\n\t\t\t\t\t\tparentResourceId,\n\t\t\t\t\t),\n\t\t\t\t\teq(contentResource.id, parentResourceId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresources: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parentResource = ContentResourceSchema.parse(parentResourceData)\n\n\t\t\tawait client.insert(contentResourceResource).values({\n\t\t\t\tresourceOfId: parentResource.id,\n\t\t\t\tresourceId: childResourceId,\n\t\t\t\tposition: parentResource.resources?.length || 0,\n\t\t\t})\n\n\t\t\tconst resourceJoin = client.query.contentResourceResource.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresource: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResourceJoin =\n\t\t\t\tContentResourceResourceSchema.safeParse(resourceJoin)\n\t\t\tif (!parsedResourceJoin.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResourceJoin.data\n\t\t},\n\t\tasync removeResourceFromResource(options) {\n\t\t\tconst { childResourceId, parentResourceId } = options\n\n\t\t\tconst resourceJoin = await client.query.contentResourceResource.findFirst(\n\t\t\t\t{\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst parsedResourceJoin =\n\t\t\t\tContentResourceResourceSchema.safeParse(resourceJoin)\n\t\t\tif (!parsedResourceJoin.success) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tawait client\n\t\t\t\t.delete(contentResourceResource)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(contentResourceResource.resourceOfId, parentResourceId),\n\t\t\t\t\t\teq(contentResourceResource.resourceId, childResourceId),\n\t\t\t\t\t),\n\t\t\t\t)\n\n\t\t\treturn parsedResourceJoin.data.resource\n\t\t},\n\t\tasync updateContentResourceFields(options) {\n\t\t\tif (!options.id) {\n\t\t\t\tthrow new Error('No content resource id.')\n\t\t\t}\n\n\t\t\tconst currentResource = await client\n\t\t\t\t.select()\n\t\t\t\t.from(contentResource)\n\t\t\t\t.where(eq(contentResource.id, options.id))\n\t\t\t\t.then((res) => res[0])\n\n\t\t\tawait client\n\t\t\t\t.update(contentResource)\n\t\t\t\t.set({ fields: { ...currentResource.fields, ...options.fields } })\n\t\t\t\t.where(eq(contentResource.id, options.id))\n\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: eq(contentResource.id, options.id),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tlogger.error(parsedResource.error, {\n\t\t\t\t\tevent: 'adapter.contentResource.parse_failed',\n\t\t\t\t\tresourceId: options.id,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync getVideoResource(id) {\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst query = sql`\n SELECT\n id as id,\n CAST(updatedAt AS DATETIME) as updatedAt,\n CAST(createdAt AS DATETIME) as createdAt,\n JSON_EXTRACT (${contentResource.fields}, \"$.state\") AS state,\n JSON_EXTRACT (${contentResource.fields}, \"$.duration\") AS duration,\n JSON_EXTRACT (${contentResource.fields}, \"$.muxPlaybackId\") AS muxPlaybackId,\n JSON_EXTRACT (${contentResource.fields}, \"$.muxAssetId\") AS muxAssetId,\n JSON_EXTRACT (${contentResource.fields}, \"$.transcript\") AS transcript\n FROM\n ${contentResource}\n WHERE\n type = 'videoResource'\n AND (id = ${id});\n\n `\n\t\t\treturn client\n\t\t\t\t.execute(query)\n\t\t\t\t.then((result: any) => {\n\t\t\t\t\tconst parsedResource = VideoResourceSchema.safeParse(result.rows[0])\n\t\t\t\t\treturn parsedResource.success ? parsedResource.data : null\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tlogger.error(toError(error), {\n\t\t\t\t\t\tevent: 'adapter.videoResource.lookup.failed',\n\t\t\t\t\t\tresourceId: id,\n\t\t\t\t\t})\n\t\t\t\t\tthrow error\n\t\t\t\t})\n\t\t},\n\t\tasync getParentResourceOfVideoResource(\n\t\t\tvideoResourceId: string,\n\t\t): Promise<ContentResource | null> {\n\t\t\tif (!videoResourceId) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// Use a SQL query to find the parent post or lesson of this video resource\n\t\t\tconst results = await client\n\t\t\t\t.select()\n\t\t\t\t.from(contentResource)\n\t\t\t\t.innerJoin(\n\t\t\t\t\tcontentResourceResource,\n\t\t\t\t\teq(contentResourceResource.resourceOfId, contentResource.id),\n\t\t\t\t)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(contentResourceResource.resourceId, videoResourceId),\n\t\t\t\t\t\tor(\n\t\t\t\t\t\t\teq(contentResource.type, 'post'),\n\t\t\t\t\t\t\teq(contentResource.type, 'lesson'),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.limit(1)\n\n\t\t\tif (!results || results.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst resourceData = results[0]?.ContentResource\n\n\t\t\tif (!resourceData) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// Fetch the full resource with relationships\n\t\t\tconst fullResource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: eq(contentResource.id, resourceData.id),\n\t\t\t\twith: {\n\t\t\t\t\tresources: true,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (!fullResource) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn ContentResourceSchema.parse(fullResource)\n\t\t},\n\t\tasync createContentResource(data) {\n\t\t\tconst id = data.id || crypto.randomUUID()\n\n\t\t\tawait client.insert(contentResource).values({ ...data, id })\n\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: eq(contentResource.id, id),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tlogger.error(parsedResource.error, {\n\t\t\t\t\tevent: 'adapter.contentResource.parse_failed',\n\t\t\t\t\tresourceId: id,\n\t\t\t\t\tresourceType: data.type,\n\t\t\t\t})\n\t\t\t\tthrow new Error('Error parsing resource')\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync getContentResource(data) {\n\t\t\tconst resource = await client.query.contentResource.findFirst({\n\t\t\t\twhere: or(\n\t\t\t\t\teq(contentResource.id, data),\n\t\t\t\t\teq(\n\t\t\t\t\t\tsql`JSON_EXTRACT (${contentResource.fields}, \"$.slug\")`,\n\t\t\t\t\t\t`${data}`,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\tresources: {\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedResource = ContentResourceSchema.safeParse(resource)\n\n\t\t\tif (!parsedResource.success) {\n\t\t\t\tlogger.error(parsedResource.error, {\n\t\t\t\t\tevent: 'adapter.contentResource.parse_failed',\n\t\t\t\t\tresourceId: resource?.id,\n\t\t\t\t\tresourceIdOrSlug: data,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedResource.data\n\t\t},\n\t\tasync getEvent(\n\t\t\teventIdOrSlug: string,\n\t\t\toptions?: {\n\t\t\t\twithResources?: boolean\n\t\t\t\twithTags?: boolean\n\t\t\t\twithProducts?: boolean\n\t\t\t\twithPricing?: boolean\n\t\t\t},\n\t\t): Promise<ContentResource | null> {\n\t\t\tconst {\n\t\t\t\twithResources = false,\n\t\t\t\twithTags = false,\n\t\t\t\twithProducts = false,\n\t\t\t\twithPricing = false,\n\t\t\t} = options || {}\n\n\t\t\tconst eventQuery = await client.query.contentResource.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\tor(\n\t\t\t\t\t\teq(contentResource.type, 'event'),\n\t\t\t\t\t\teq(contentResource.type, 'event-series'),\n\t\t\t\t\t),\n\t\t\t\t\tor(\n\t\t\t\t\t\teq(contentResource.id, eventIdOrSlug),\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\tsql`JSON_EXTRACT (${contentResource.fields}, \"$.slug\")`,\n\t\t\t\t\t\t\teventIdOrSlug,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twith: {\n\t\t\t\t\t...(withResources && {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\twith: { resource: true },\n\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\t...(withTags && {\n\t\t\t\t\t\ttags: {\n\t\t\t\t\t\t\twith: { tag: true },\n\t\t\t\t\t\t\torderBy: asc(contentResourceTag.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\t...(withProducts && {\n\t\t\t\t\t\tresourceProducts: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tproduct: {\n\t\t\t\t\t\t\t\t\t...(withPricing && {\n\t\t\t\t\t\t\t\t\t\twith: { price: true },\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst parsedEvent = ContentResourceSchema.safeParse(eventQuery)\n\t\t\tif (!parsedEvent.success) {\n\t\t\t\tlogger.debug('Error parsing event', {\n\t\t\t\t\teventQuery,\n\t\t\t\t\terror: parsedEvent.error,\n\t\t\t\t})\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn parsedEvent.data\n\t\t},\n\t\tasync addResourceToProduct(options: {\n\t\t\tresource: ContentResource\n\t\t\tproductId: string\n\t\t\tuserId: string\n\t\t}) {\n\t\t\tconst { resource, productId, userId } = options\n\t\t\tconst product = await adapter.getProduct(productId)\n\n\t\t\tif (!product) {\n\t\t\t\tthrow new Error(`Product not found for id (${productId})`)\n\t\t\t}\n\n\t\t\tawait client.insert(contentResourceProduct).values({\n\t\t\t\tresourceId: resource.id,\n\t\t\t\tproductId,\n\t\t\t\tposition: product.resources?.length || 0,\n\t\t\t\tmetadata: {\n\t\t\t\t\taddedBy: userId,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst resourceProduct =\n\t\t\t\tawait client.query.contentResourceProduct.findFirst({\n\t\t\t\t\twhere: eq(contentResourceProduct.resourceId, resource.id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\treturn (\n\t\t\t\tContentResourceProductSchema.safeParse(resourceProduct).data || null\n\t\t\t)\n\t\t},\n\t\tasync createEvent(\n\t\t\tinput: {\n\t\t\t\ttype: 'event'\n\t\t\t\tfields: {\n\t\t\t\t\ttitle: string\n\t\t\t\t\tstartsAt?: Date | null | undefined\n\t\t\t\t\tendsAt?: Date | null | undefined\n\t\t\t\t\tdescription?: string | null | undefined\n\t\t\t\t\tprice?: number | null | undefined\n\t\t\t\t\tquantity?: number | null | undefined\n\t\t\t\t\tstate?: string | null | undefined\n\t\t\t\t\tvisibility?: string | null | undefined\n\t\t\t\t\tslug?: string | null | undefined\n\t\t\t\t\ttagIds?:\n\t\t\t\t\t\t| { id: string; fields: Record<string, any> }[]\n\t\t\t\t\t\t| null\n\t\t\t\t\t\t| undefined\n\t\t\t\t}\n\t\t\t\tcoupon?: {\n\t\t\t\t\tenabled: boolean\n\t\t\t\t\tpercentageDiscount: string\n\t\t\t\t\texpires: Date\n\t\t\t\t}\n\t\t\t},\n\t\t\tuserId: string,\n\t\t) {\n\t\t\tconst hash = guid()\n\t\t\tconst newEventId = slugify(`${input.type}~${hash}`)\n\n\t\t\tconst newEvent = {\n\t\t\t\tid: newEventId,\n\t\t\t\ttype: 'event',\n\t\t\t\tfields: {\n\t\t\t\t\ttitle: input.fields.title,\n\t\t\t\t\tstate: 'draft',\n\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\tslug: slugify(`${input.fields.title}~${hash}`),\n\t\t\t\t\tdescription: input.fields.description,\n\t\t\t\t\tstartsAt: input.fields.startsAt,\n\t\t\t\t\tendsAt: input.fields.endsAt,\n\t\t\t\t},\n\t\t\t\tcreatedById: userId,\n\t\t\t}\n\n\t\t\tawait client.insert(contentResource).values(newEvent)\n\t\t\tconst event = await adapter.getEvent(newEventId, {\n\t\t\t\twithResources: true,\n\t\t\t\twithTags: true,\n\t\t\t\twithProducts: true,\n\t\t\t\twithPricing: true,\n\t\t\t})\n\n\t\t\tconst parsedEvent = ContentResourceSchema.safeParse(event)\n\n\t\t\tif (!parsedEvent.success) {\n\t\t\t\tlogger.error(new Error('Error parsing event resource'))\n\t\t\t\tthrow new Error('Error parsing event resource')\n\t\t\t}\n\n\t\t\t// if price is provided, create a product and associate it with the event\n\t\t\tif (input.fields.price && input.fields.price > 0) {\n\t\t\t\ttry {\n\t\t\t\t\tconst product = await adapter.createProduct({\n\t\t\t\t\t\tname: input.fields.title,\n\t\t\t\t\t\tprice: input.fields.price,\n\t\t\t\t\t\tquantityAvailable: input.fields.quantity ?? -1,\n\t\t\t\t\t\ttype: 'live',\n\t\t\t\t\t\tstate: 'published',\n\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t})\n\t\t\t\t\tif (product) {\n\t\t\t\t\t\tconst resourceProduct = await adapter.addResourceToProduct({\n\t\t\t\t\t\t\tresource: parsedEvent.data,\n\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tif (!resourceProduct) {\n\t\t\t\t\t\t\tlogger.error(new Error('Failed to add resource to product'))\n\t\t\t\t\t\t\tlogger.debug('event.addResourceToProduct.failed', {\n\t\t\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger.debug('event.addResourceToProduct.success', {\n\t\t\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Create coupon if enabled\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinput.coupon?.enabled &&\n\t\t\t\t\t\t\tinput.coupon.percentageDiscount &&\n\t\t\t\t\t\t\tinput.coupon.expires\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst finalExpires = normalizeExpirationDate(\n\t\t\t\t\t\t\t\t\tinput.coupon.expires,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tconst couponInput = {\n\t\t\t\t\t\t\t\t\tquantity: '1',\n\t\t\t\t\t\t\t\t\tmaxUses: -1,\n\t\t\t\t\t\t\t\t\texpires: finalExpires || null,\n\t\t\t\t\t\t\t\t\trestrictedToProductId: product.id,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\tbypassSoldOut: false,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait adapter.createCoupon(couponInput)\n\t\t\t\t\t\t\t\tlogger.debug('event.create.coupon.success', {\n\t\t\t\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} catch (couponError) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to create coupon for event: ${couponError}`,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tlogger.debug('event.create.coupon.failed', {\n\t\t\t\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t// Don't throw here - event creation should succeed even if coupon fails\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.error(new Error('Failed to create product'))\n\t\t\t\t\t\tlogger.debug('event.create.product.failed', {\n\t\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\tprice: input.fields.price,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\tnew Error(`Error creating and associating product: ${error}`),\n\t\t\t\t\t)\n\t\t\t\t\tlogger.debug('event.create.product.failed', {\n\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tprice: input.fields.price,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if we provide tagIds, we need to associate them with the event\n\t\t\tif (input.fields.tagIds) {\n\t\t\t\ttry {\n\t\t\t\t\tawait client.insert(contentResourceTag).values(\n\t\t\t\t\t\tinput.fields.tagIds.map((tag) => ({\n\t\t\t\t\t\t\tcontentResourceId: newEventId,\n\t\t\t\t\t\t\ttagId: tag.id,\n\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\tupdatedAt: new Date(),\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t\tlogger.debug('event.create.tags.success', {\n\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\ttagIds: input.fields.tagIds,\n\t\t\t\t\t})\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(new Error(`Error associating tags with event: ${error}`))\n\t\t\t\t\tlogger.debug('event.create.tags.failed', {\n\t\t\t\t\t\teventId: newEventId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\ttagIds: input.fields.tagIds,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn parsedEvent.data\n\t\t},\n\t\tasync createEventSeries(\n\t\t\tinput: {\n\t\t\t\teventSeries: {\n\t\t\t\t\ttype: 'event-series'\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttitle: string\n\t\t\t\t\t\tdescription?: string | undefined\n\t\t\t\t\t\ttagIds?:\n\t\t\t\t\t\t\t| { id: string; fields: { label: string; name: string } }[]\n\t\t\t\t\t\t\t| null\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tsharedFields: {\n\t\t\t\t\t\tprice: number | null | undefined\n\t\t\t\t\t\tquantity: number | null | undefined\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tchildEvents: Array<{\n\t\t\t\t\ttype: 'event'\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttitle: string\n\t\t\t\t\t\tstartsAt: Date | null | undefined\n\t\t\t\t\t\tendsAt: Date | null | undefined\n\t\t\t\t\t\tdescription?: string | undefined\n\t\t\t\t\t\ttagIds?:\n\t\t\t\t\t\t\t| { id: string; fields: { label: string; name: string } }[]\n\t\t\t\t\t\t\t| null\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t}>\n\t\t\t\tcoupon?:\n\t\t\t\t\t| {\n\t\t\t\t\t\t\tenabled: boolean\n\t\t\t\t\t\t\texpires?: Date | undefined\n\t\t\t\t\t\t\tpercentageDiscount?: string | undefined\n\t\t\t\t\t }\n\t\t\t\t\t| undefined\n\t\t\t},\n\t\t\tuserId: string,\n\t\t) {\n\t\t\tconst { eventSeries: eventSeriesInput, childEvents: childEventsInput } =\n\t\t\t\tinput\n\n\t\t\tif (childEventsInput.length === 0) {\n\t\t\t\tthrow new Error('At least one event is required')\n\t\t\t}\n\n\t\t\t// Execute all database operations within a transaction\n\t\t\tconst result = await client.transaction(async (tx) => {\n\t\t\t\t// Step 1: Create the event series resource\n\t\t\t\tconst eventSeriesHash = guid()\n\t\t\t\tconst eventSeriesResourceId = slugify(`event-series~${eventSeriesHash}`)\n\n\t\t\t\tconst newEventSeries = {\n\t\t\t\t\tid: eventSeriesResourceId,\n\t\t\t\t\ttype: 'event-series',\n\t\t\t\t\tfields: {\n\t\t\t\t\t\t...eventSeriesInput.fields,\n\t\t\t\t\t\ttitle: eventSeriesInput.fields.title,\n\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t\tslug: slugify(\n\t\t\t\t\t\t\t`${eventSeriesInput.fields.title}~${eventSeriesHash}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\tcreatedById: userId,\n\t\t\t\t}\n\n\t\t\t\tawait tx.insert(contentResource).values(newEventSeries)\n\n\t\t\t\t// Fetch the created event series with relations\n\t\t\t\tconst eventSeriesResource = await tx.query.contentResource.findFirst({\n\t\t\t\t\twhere: eq(contentResource.id, eventSeriesResourceId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttags: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\ttag: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\torderBy: asc(contentResourceTag.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresourceProducts: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tproduct: {\n\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\tprice: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst parsedEventSeries =\n\t\t\t\t\tContentResourceSchema.safeParse(eventSeriesResource)\n\t\t\t\tif (!parsedEventSeries.success) {\n\t\t\t\t\tthrow new Error('Error parsing event series resource')\n\t\t\t\t}\n\n\t\t\t\t// Step 2: Associate tags with event series\n\t\t\t\tif (eventSeriesInput.fields.tagIds) {\n\t\t\t\t\tawait tx.insert(contentResourceTag).values(\n\t\t\t\t\t\teventSeriesInput.fields.tagIds.map((tag) => ({\n\t\t\t\t\t\t\tcontentResourceId: eventSeriesResourceId,\n\t\t\t\t\t\t\ttagId: tag.id,\n\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\tupdatedAt: new Date(),\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Step 3: Create child events and associate them\n\t\t\t\tconst createdChildEvents = []\n\n\t\t\t\tfor (let i = 0; i < childEventsInput.length; i++) {\n\t\t\t\t\tconst childEventInput = childEventsInput[i]\n\n\t\t\t\t\tif (!childEventInput) {\n\t\t\t\t\t\tthrow new Error(`Child event input is required`)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create child event\n\t\t\t\t\tconst childEventHash = guid()\n\t\t\t\t\tconst childEventResourceId = slugify(`event~${childEventHash}`)\n\n\t\t\t\t\tconst newChildEvent = {\n\t\t\t\t\t\tid: childEventResourceId,\n\t\t\t\t\t\ttype: 'event',\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\ttitle: childEventInput.fields.title,\n\t\t\t\t\t\t\tstartsAt: childEventInput.fields.startsAt,\n\t\t\t\t\t\t\tendsAt: childEventInput.fields.endsAt,\n\t\t\t\t\t\t\tdescription: childEventInput.fields.description,\n\t\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t\t\tslug: slugify(\n\t\t\t\t\t\t\t\t`${childEventInput.fields.title}~${childEventHash}`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t// No price/quantity - they're on the event series\n\t\t\t\t\t\t\tprice: null,\n\t\t\t\t\t\t\tquantity: null,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\t}\n\n\t\t\t\t\tawait tx.insert(contentResource).values(newChildEvent)\n\n\t\t\t\t\t// Fetch the created child event with relations\n\t\t\t\t\tconst childEventResource = await tx.query.contentResource.findFirst({\n\t\t\t\t\t\twhere: eq(contentResource.id, childEventResourceId),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttags: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\ttag: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\torderBy: asc(contentResourceTag.position),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tresourceProducts: {\n\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\tproduct: {\n\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\tprice: true,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\n\t\t\t\t\tconst parsedChildEvent =\n\t\t\t\t\t\tContentResourceSchema.safeParse(childEventResource)\n\t\t\t\t\tif (!parsedChildEvent.success) {\n\t\t\t\t\t\tthrow new Error(`Error parsing child event resource ${i + 1}`)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Associate tags with child event\n\t\t\t\t\tif (childEventInput.fields.tagIds) {\n\t\t\t\t\t\tawait tx.insert(contentResourceTag).values(\n\t\t\t\t\t\t\tchildEventInput.fields.tagIds.map((tag) => ({\n\t\t\t\t\t\t\t\tcontentResourceId: childEventResourceId,\n\t\t\t\t\t\t\t\ttagId: tag.id,\n\t\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\t\tupdatedAt: new Date(),\n\t\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Associate child event with event series\n\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\tresourceOfId: eventSeriesResourceId,\n\t\t\t\t\t\tresourceId: childEventResourceId,\n\t\t\t\t\t\tposition: i,\n\t\t\t\t\t})\n\n\t\t\t\t\tcreatedChildEvents.push(parsedChildEvent.data)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\teventSeries: parsedEventSeries.data,\n\t\t\t\t\tchildEvents: createdChildEvents,\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst { eventSeries, childEvents } = result\n\n\t\t\t// Step 4: Handle product creation outside transaction\n\t\t\tif (\n\t\t\t\teventSeriesInput.sharedFields.price &&\n\t\t\t\teventSeriesInput.sharedFields.price > 0\n\t\t\t) {\n\t\t\t\ttry {\n\t\t\t\t\tconst product = await adapter.createProduct({\n\t\t\t\t\t\tname: eventSeriesInput.fields.title,\n\t\t\t\t\t\tprice: eventSeriesInput.sharedFields.price,\n\t\t\t\t\t\tquantityAvailable: eventSeriesInput.sharedFields.quantity ?? -1,\n\t\t\t\t\t\ttype: 'live',\n\t\t\t\t\t\tstate: 'published',\n\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t})\n\t\t\t\t\tif (product) {\n\t\t\t\t\t\tawait adapter.addResourceToProduct({\n\t\t\t\t\t\t\tresource: eventSeries,\n\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Create coupon if enabled\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinput.coupon?.enabled &&\n\t\t\t\t\t\t\tinput.coupon.percentageDiscount &&\n\t\t\t\t\t\t\tinput.coupon.expires\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tlet finalExpires = input.coupon.expires\n\t\t\t\t\t\t\t\tif (finalExpires instanceof Date) {\n\t\t\t\t\t\t\t\t\tfinalExpires = new Date(\n\t\t\t\t\t\t\t\t\t\tDate.UTC(\n\t\t\t\t\t\t\t\t\t\t\tfinalExpires.getUTCFullYear(),\n\t\t\t\t\t\t\t\t\t\t\tfinalExpires.getUTCMonth(),\n\t\t\t\t\t\t\t\t\t\t\tfinalExpires.getUTCDate(),\n\t\t\t\t\t\t\t\t\t\t\t23,\n\t\t\t\t\t\t\t\t\t\t\t59,\n\t\t\t\t\t\t\t\t\t\t\t59,\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst couponInput = {\n\t\t\t\t\t\t\t\t\tquantity: '1',\n\t\t\t\t\t\t\t\t\tmaxUses: 1,\n\t\t\t\t\t\t\t\t\texpires: finalExpires,\n\t\t\t\t\t\t\t\t\trestrictedToProductId: product.id,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tfields: {},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait adapter.createCoupon(couponInput)\n\t\t\t\t\t\t\t\tlogger.debug('event.series.coupon.success', {\n\t\t\t\t\t\t\t\t\teventSeriesId: eventSeries.id,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} catch (couponError) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t\t\t\t`Error creating coupon for event series: ${couponError}`,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tlogger.debug('event.series.coupon.failed', {\n\t\t\t\t\t\t\t\t\teventSeriesId: eventSeries.id,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t// Don't throw here - event series creation should succeed even if coupon fails\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.error(new Error('Failed to create product'))\n\t\t\t\t\t\tlogger.debug('event.series.product.failed', {\n\t\t\t\t\t\t\teventSeriesId: eventSeries.id,\n\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\tprice: eventSeriesInput.sharedFields.price,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\tnew Error(`Error creating and associating product: ${error}`),\n\t\t\t\t\t)\n\t\t\t\t\tlogger.debug('event.series.product.creation.failed', {\n\t\t\t\t\t\teventSeriesId: eventSeries.id,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t})\n\t\t\t\t\t// Note: We don't throw here since the core data is already committed\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { eventSeries, childEvents }\n\t\t},\n\t\tasync createCohort(\n\t\t\tinput: {\n\t\t\t\tcohort: {\n\t\t\t\t\ttitle: string\n\t\t\t\t\tdescription?: string\n\t\t\t\t\ttagIds?:\n\t\t\t\t\t\t| { id: string; fields: { label: string; name: string } }[]\n\t\t\t\t\t\t| null\n\t\t\t\t}\n\t\t\t\tdates: {\n\t\t\t\t\tstart: Date\n\t\t\t\t\tend: Date\n\t\t\t\t}\n\t\t\t\tcreateProduct?: boolean\n\t\t\t\tpricing: {\n\t\t\t\t\tprice?: number | null\n\t\t\t\t}\n\t\t\t\tcoupon?: {\n\t\t\t\t\tenabled: boolean\n\t\t\t\t\tpercentageDiscount?: string\n\t\t\t\t\texpires?: Date\n\t\t\t\t}\n\t\t\t\tworkshops: { id: string }[]\n\t\t\t},\n\t\t\tuserId: string,\n\t\t) {\n\t\t\tconst hash = guid()\n\t\t\tconst cohortId = `cohort~${hash}`\n\n\t\t\t// Transaction only handles database operations\n\t\t\tconst cohort = await client.transaction(async (tx) => {\n\t\t\t\t// Create cohort content resource\n\t\t\t\tawait tx.insert(contentResource).values({\n\t\t\t\t\tid: cohortId,\n\t\t\t\t\ttype: 'cohort',\n\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttitle: input.cohort.title,\n\t\t\t\t\t\tdescription: input.cohort.description,\n\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\tvisibility: 'unlisted',\n\t\t\t\t\t\tslug: slugify(`${input.cohort.title}~${hash}`),\n\t\t\t\t\t\tstartsAt: input.dates.start,\n\t\t\t\t\t\tendsAt: input.dates.end,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\t// Fetch created cohort\n\t\t\t\tconst cohort = await tx.query.contentResource.findFirst({\n\t\t\t\t\twhere: eq(contentResource.id, cohortId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tif (!cohort) {\n\t\t\t\t\tthrow new Error('Failed to create cohort')\n\t\t\t\t}\n\n\t\t\t\tconst parsedCohort = ContentResourceSchema.safeParse(cohort)\n\t\t\t\tif (!parsedCohort.success) {\n\t\t\t\t\tthrow new Error('Invalid cohort data')\n\t\t\t\t}\n\n\t\t\t\t// Associate tags with cohort\n\t\t\t\tif (input.cohort.tagIds) {\n\t\t\t\t\tawait tx.insert(contentResourceTag).values(\n\t\t\t\t\t\tinput.cohort.tagIds.map((tag) => ({\n\t\t\t\t\t\t\tcontentResourceId: cohortId,\n\t\t\t\t\t\t\ttagId: tag.id,\n\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\tupdatedAt: new Date(),\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Link workshops to cohort\n\t\t\t\tlet position = 0\n\t\t\t\tfor (const workshop of input.workshops) {\n\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\tresourceOfId: cohortId,\n\t\t\t\t\t\tresourceId: workshop.id,\n\t\t\t\t\t\tposition,\n\t\t\t\t\t})\n\t\t\t\t\tposition++\n\t\t\t\t}\n\n\t\t\t\treturn parsedCohort.data\n\t\t\t})\n\n\t\t\t// Handle product and coupon creation outside transaction\n\t\t\tlet product: any = null\n\t\t\tif (\n\t\t\t\tinput.createProduct &&\n\t\t\t\tinput.pricing.price &&\n\t\t\t\tinput.pricing.price > 0\n\t\t\t) {\n\t\t\t\ttry {\n\t\t\t\t\tproduct = await adapter.createProduct({\n\t\t\t\t\t\tname: input.cohort.title,\n\t\t\t\t\t\tprice: input.pricing.price,\n\t\t\t\t\t\tquantityAvailable: -1,\n\t\t\t\t\t\ttype: 'cohort',\n\t\t\t\t\t\tstate: 'published',\n\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t\topenEnrollment: new Date().toISOString(),\n\t\t\t\t\t\tcloseEnrollment: input.dates.start.toISOString(),\n\t\t\t\t\t})\n\n\t\t\t\t\tif (product) {\n\t\t\t\t\t\t// Link product to cohort resource\n\t\t\t\t\t\tawait client.insert(contentResourceProduct).values({\n\t\t\t\t\t\t\tresourceId: cohortId,\n\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\taddedBy: userId,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Create coupon if enabled\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinput.coupon?.enabled &&\n\t\t\t\t\t\t\tinput.coupon.percentageDiscount &&\n\t\t\t\t\t\t\tinput.coupon.expires\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst finalExpires = normalizeExpirationDate(\n\t\t\t\t\t\t\t\t\tinput.coupon.expires,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tawait adapter.createCoupon({\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t\texpires: finalExpires || null,\n\t\t\t\t\t\t\t\t\trestrictedToProductId: product.id,\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tmaxUses: -1,\n\t\t\t\t\t\t\t\t\tquantity: '-1',\n\t\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t\tfields: {},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tlogger.debug('cohort.create.coupon.success', {\n\t\t\t\t\t\t\t\t\tcohortId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} catch (couponError) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to create coupon for cohort: ${couponError}`,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tlogger.debug('cohort.create.coupon.failed', {\n\t\t\t\t\t\t\t\t\tcohortId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t// Don't throw - cohort creation should succeed even if coupon fails\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (productError) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\tnew Error(`Failed to create product for cohort: ${productError}`),\n\t\t\t\t\t)\n\t\t\t\t\tlogger.debug('cohort.create.product.failed', {\n\t\t\t\t\t\tcohortId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tprice: input.pricing.price,\n\t\t\t\t\t})\n\t\t\t\t\t// Don't throw - cohort creation should succeed even if product fails\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcohort,\n\t\t\t\tproduct,\n\t\t\t}\n\t\t},\n\t\tasync createWorkshop(\n\t\t\tinput: {\n\t\t\t\tworkshop: {\n\t\t\t\t\ttitle: string\n\t\t\t\t\tdescription?: string\n\t\t\t\t\ttagIds?:\n\t\t\t\t\t\t| { id: string; fields: { label: string; name: string } }[]\n\t\t\t\t\t\t| null\n\t\t\t\t}\n\t\t\t\tcreateProduct?: boolean\n\t\t\t\tpricing: {\n\t\t\t\t\tprice?: number | null\n\t\t\t\t\tquantity?: number | null\n\t\t\t\t}\n\t\t\t\tcoupon?: {\n\t\t\t\t\tenabled: boolean\n\t\t\t\t\tpercentageDiscount?: string\n\t\t\t\t\texpires?: Date\n\t\t\t\t}\n\t\t\t\tstructure: Array<\n\t\t\t\t\t| {\n\t\t\t\t\t\t\ttype: 'section'\n\t\t\t\t\t\t\ttitle: string\n\t\t\t\t\t\t\tlessons: { title: string; videoResourceId?: string }[]\n\t\t\t\t\t }\n\t\t\t\t\t| { type: 'lesson'; title: string; videoResourceId?: string }\n\t\t\t\t>\n\t\t\t},\n\t\t\tuserId: string,\n\t\t) {\n\t\t\tconst hash = guid()\n\t\t\tconst workshopId = `workshop~${hash}`\n\n\t\t\t// Transaction only handles database operations\n\t\t\tconst result = await client.transaction(async (tx) => {\n\t\t\t\t// Create workshop content resource\n\t\t\t\tawait tx.insert(contentResource).values({\n\t\t\t\t\tid: workshopId,\n\t\t\t\t\ttype: 'workshop',\n\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttitle: input.workshop.title,\n\t\t\t\t\t\tdescription: input.workshop.description,\n\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\tvisibility: 'unlisted',\n\t\t\t\t\t\tslug: slugify(`${input.workshop.title}~${hash}`),\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\t// Fetch created workshop\n\t\t\t\tconst workshop = await tx.query.contentResource.findFirst({\n\t\t\t\t\twhere: eq(contentResource.id, workshopId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tresource: {\n\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\tresources: {\n\t\t\t\t\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\t\t\t\t\tresource: true,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\torderBy: asc(contentResourceResource.position),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tif (!workshop) {\n\t\t\t\t\tthrow new Error('Failed to create workshop')\n\t\t\t\t}\n\n\t\t\t\tconst parsedWorkshop = ContentResourceSchema.safeParse(workshop)\n\t\t\t\tif (!parsedWorkshop.success) {\n\t\t\t\t\tthrow new Error('Invalid workshop data')\n\t\t\t\t}\n\n\t\t\t\t// Associate tags with workshop\n\t\t\t\tif (input.workshop.tagIds) {\n\t\t\t\t\tawait tx.insert(contentResourceTag).values(\n\t\t\t\t\t\tinput.workshop.tagIds.map((tag) => ({\n\t\t\t\t\t\t\tcontentResourceId: workshopId,\n\t\t\t\t\t\t\ttagId: tag.id,\n\t\t\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\t\t\tupdatedAt: new Date(),\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// Create sections and lessons\n\t\t\t\tconst createdSections: ContentResource[] = []\n\t\t\t\tconst createdLessons: ContentResource[] = []\n\t\t\t\tlet position = 0\n\n\t\t\t\tfor (const item of input.structure) {\n\t\t\t\t\tif (item.type === 'section') {\n\t\t\t\t\t\t// Create section\n\t\t\t\t\t\tconst sectionHash = guid()\n\t\t\t\t\t\tconst sectionId = `section~${sectionHash}`\n\n\t\t\t\t\t\tawait tx.insert(contentResource).values({\n\t\t\t\t\t\t\tid: sectionId,\n\t\t\t\t\t\t\ttype: 'section',\n\t\t\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\t\t\tvisibility: 'unlisted',\n\t\t\t\t\t\t\t\tslug: slugify(`${item.title}~${sectionHash}`),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Link section to workshop\n\t\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\t\tresourceOfId: workshopId,\n\t\t\t\t\t\t\tresourceId: sectionId,\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tconst section = await tx.query.contentResource.findFirst({\n\t\t\t\t\t\t\twhere: eq(contentResource.id, sectionId),\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tif (section) {\n\t\t\t\t\t\t\tcreatedSections.push(section as ContentResource)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Create lessons in section\n\t\t\t\t\t\tlet lessonPosition = 0\n\t\t\t\t\t\tfor (const lessonData of item.lessons) {\n\t\t\t\t\t\t\tconst lessonHash = guid()\n\t\t\t\t\t\t\tconst lessonId = `lesson_${lessonHash}`\n\n\t\t\t\t\t\t\tawait tx.insert(contentResource).values({\n\t\t\t\t\t\t\t\tid: lessonId,\n\t\t\t\t\t\t\t\ttype: 'lesson',\n\t\t\t\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\ttitle: lessonData.title,\n\t\t\t\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\t\t\t\tvisibility: 'unlisted',\n\t\t\t\t\t\t\t\t\tslug: slugify(`${lessonData.title}~${lessonHash}`),\n\t\t\t\t\t\t\t\t\tlessonType: 'lesson',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t// Link video if provided\n\t\t\t\t\t\t\tif (lessonData.videoResourceId) {\n\t\t\t\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\t\t\t\tresourceOfId: lessonId,\n\t\t\t\t\t\t\t\t\tresourceId: lessonData.videoResourceId,\n\t\t\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Link lesson to section\n\t\t\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\t\t\tresourceOfId: sectionId,\n\t\t\t\t\t\t\t\tresourceId: lessonId,\n\t\t\t\t\t\t\t\tposition: lessonPosition,\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\tconst lesson = await tx.query.contentResource.findFirst({\n\t\t\t\t\t\t\t\twhere: eq(contentResource.id, lessonId),\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\tif (lesson) {\n\t\t\t\t\t\t\t\tcreatedLessons.push(lesson as ContentResource)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlessonPosition++\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tposition++\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Create top-level lesson\n\t\t\t\t\t\tconst lessonHash = guid()\n\t\t\t\t\t\tconst lessonId = `lesson_${lessonHash}`\n\n\t\t\t\t\t\tawait tx.insert(contentResource).values({\n\t\t\t\t\t\t\tid: lessonId,\n\t\t\t\t\t\t\ttype: 'lesson',\n\t\t\t\t\t\t\tcreatedById: userId,\n\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\t\tstate: 'draft',\n\t\t\t\t\t\t\t\tvisibility: 'unlisted',\n\t\t\t\t\t\t\t\tslug: slugify(`${item.title}~${lessonHash}`),\n\t\t\t\t\t\t\t\tlessonType: 'lesson',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Link video if provided\n\t\t\t\t\t\tif (item.videoResourceId) {\n\t\t\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\t\t\tresourceOfId: lessonId,\n\t\t\t\t\t\t\t\tresourceId: item.videoResourceId,\n\t\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Link lesson to workshop\n\t\t\t\t\t\tawait tx.insert(contentResourceResource).values({\n\t\t\t\t\t\t\tresourceOfId: workshopId,\n\t\t\t\t\t\t\tresourceId: lessonId,\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tconst lesson = await tx.query.contentResource.findFirst({\n\t\t\t\t\t\t\twhere: eq(contentResource.id, lessonId),\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tif (lesson) {\n\t\t\t\t\t\t\tcreatedLessons.push(lesson as ContentResource)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tposition++\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tworkshop: parsedWorkshop.data,\n\t\t\t\t\tsections: createdSections,\n\t\t\t\t\tlessons: createdLessons,\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// Handle product and coupon creation outside transaction\n\t\t\tlet product: any = null\n\t\t\tif (\n\t\t\t\tinput.createProduct &&\n\t\t\t\tinput.pricing.price &&\n\t\t\t\tinput.pricing.price > 0\n\t\t\t) {\n\t\t\t\ttry {\n\t\t\t\t\tproduct = await adapter.createProduct({\n\t\t\t\t\t\tname: input.workshop.title,\n\t\t\t\t\t\tprice: input.pricing.price,\n\t\t\t\t\t\tquantityAvailable: input.pricing.quantity ?? -1,\n\t\t\t\t\t\ttype: 'self-paced',\n\t\t\t\t\t\tstate: 'published',\n\t\t\t\t\t\tvisibility: 'public',\n\t\t\t\t\t})\n\n\t\t\t\t\tif (product) {\n\t\t\t\t\t\t// Link product to workshop resource\n\t\t\t\t\t\tawait client.insert(contentResourceProduct).values({\n\t\t\t\t\t\t\tresourceId: workshopId,\n\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\tposition: 0,\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\taddedBy: userId,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\t// Create coupon if enabled\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinput.coupon?.enabled &&\n\t\t\t\t\t\t\tinput.coupon.percentageDiscount &&\n\t\t\t\t\t\t\tinput.coupon.expires\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst finalExpires = normalizeExpirationDate(\n\t\t\t\t\t\t\t\t\tinput.coupon.expires,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tawait adapter.createCoupon({\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t\texpires: finalExpires || null,\n\t\t\t\t\t\t\t\t\trestrictedToProductId: product.id,\n\t\t\t\t\t\t\t\t\tdefault: true,\n\t\t\t\t\t\t\t\t\tmaxUses: -1,\n\t\t\t\t\t\t\t\t\tquantity: '-1',\n\t\t\t\t\t\t\t\t\tstatus: 1,\n\t\t\t\t\t\t\t\t\tfields: {},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tlogger.debug('workshop.create.coupon.success', {\n\t\t\t\t\t\t\t\t\tworkshopId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t\tpercentageDiscount: input.coupon.percentageDiscount,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} catch (couponError) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to create coupon for workshop: ${couponError}`,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tlogger.debug('workshop.create.coupon.failed', {\n\t\t\t\t\t\t\t\t\tworkshopId,\n\t\t\t\t\t\t\t\t\tproductId: product.id,\n\t\t\t\t\t\t\t\t\tuserId,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t// Don't throw - workshop creation should succeed even if coupon fails\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (productError) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\tnew Error(`Failed to create product for workshop: ${productError}`),\n\t\t\t\t\t)\n\t\t\t\t\tlogger.debug('workshop.create.product.failed', {\n\t\t\t\t\t\tworkshopId,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\tprice: input.pricing.price,\n\t\t\t\t\t})\n\t\t\t\t\t// Don't throw - workshop creation should succeed even if product fails\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\tproduct,\n\t\t\t}\n\t\t},\n\t\tasync createCoupon(input: {\n\t\t\tquantity: string\n\t\t\tmaxUses: number\n\t\t\texpires: Date | null\n\t\t\trestrictedToProductId: string | null\n\t\t\tpercentageDiscount: string\n\t\t\tstatus: number\n\t\t\tdefault: boolean\n\t\t\tfields: Record<string, any>\n\t\t}) {\n\t\t\tfunction findClosestDiscount(percentOff: number) {\n\t\t\t\t// we want a fraction so if it is whole number, we make it fractional\n\t\t\t\tpercentOff = percentOff <= 1 ? percentOff : percentOff / 100\n\t\t\t\treturn [1, 0.95, 0.9, 0.75, 0.6, 0.5, 0.4, 0.25, 0.1].reduce((a, b) => {\n\t\t\t\t\tlet aDiff = Math.abs(a - percentOff)\n\t\t\t\t\tlet bDiff = Math.abs(b - percentOff)\n\n\t\t\t\t\tif (aDiff === bDiff) {\n\t\t\t\t\t\t// Choose largest vs smallest (> vs <)\n\t\t\t\t\t\treturn a > b ? a : b\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn bDiff < aDiff ? b : a\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst percentageDiscount = findClosestDiscount(\n\t\t\t\tNumber(input.percentageDiscount) * 100,\n\t\t\t)\n\n\t\t\tconst merchantCouponResult =\n\t\t\t\tpercentageDiscount < 1\n\t\t\t\t\t? await client.query.merchantCoupon.findFirst({\n\t\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\t\teq(\n\t\t\t\t\t\t\t\t\tmerchantCoupon.percentageDiscount,\n\t\t\t\t\t\t\t\t\tpercentageDiscount.toString(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\teq(merchantCoupon.type, 'special'),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t})\n\t\t\t\t\t: null\n\n\t\t\tif (!merchantCouponResult) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst codesArray: string[] = []\n\t\t\tawait client.transaction(async (trx) => {\n\t\t\t\t// insert coupon for CouponInput quantity\n\t\t\t\tfor (let i = 0; i < Number(input.quantity); i++) {\n\t\t\t\t\tconst id = `coupon_${guid()}`\n\t\t\t\t\tawait trx.insert(coupon).values({\n\t\t\t\t\t\t...input,\n\t\t\t\t\t\tmerchantCouponId: merchantCouponResult.id as string,\n\t\t\t\t\t\tid,\n\t\t\t\t\t})\n\t\t\t\t\tcodesArray.push(id)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\treturn codesArray\n\t\t},\n\t\tasync createUser(data) {\n\t\t\tconst id = crypto.randomUUID()\n\t\t\ttry {\n\t\t\t\tawait client.insert(users).values({ ...data, id })\n\n\t\t\t\t// creating a personal organization for the user\n\t\t\t\t// every user gets an organization of their very own\n\t\t\t\tconst personalOrganization = await adapter.createOrganization({\n\t\t\t\t\tname: `Personal (${data.email})`,\n\t\t\t\t})\n\n\t\t\t\tif (!personalOrganization) {\n\t\t\t\t\tthrow new Error('Failed to create personal organization')\n\t\t\t\t}\n\n\t\t\t\tconst membership = await adapter.addMemberToOrganization({\n\t\t\t\t\torganizationId: personalOrganization.id,\n\t\t\t\t\tuserId: id,\n\t\t\t\t\tinvitedById: id,\n\t\t\t\t})\n\n\t\t\t\tif (!membership) {\n\t\t\t\t\tthrow new Error('Failed to add user to personal organization')\n\t\t\t\t}\n\n\t\t\t\tawait adapter.addRoleForMember({\n\t\t\t\t\torganizationId: personalOrganization.id,\n\t\t\t\t\tmemberId: membership.id,\n\t\t\t\t\trole: 'owner',\n\t\t\t\t})\n\n\t\t\t\tconst user = await adapter.getUser?.(id)\n\n\t\t\t\tif (!user) {\n\t\t\t\t\tthrow new Error('Failed to get user')\n\t\t\t\t}\n\n\t\t\t\treturn user\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(toError(error), {\n\t\t\t\t\temail: data.email,\n\t\t\t\t\tevent: 'adapter.user.create.failed',\n\t\t\t\t\tuserId: id,\n\t\t\t\t})\n\t\t\t\tthrow error\n\t\t\t}\n\t\t},\n\t\tasync getUser(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(users)\n\t\t\t\t\t.where(eq(users.id, data))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync getUserByEmail(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(users)\n\t\t\t\t\t.where(eq(users.email, data))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync createSession(data) {\n\t\t\tawait client.insert(sessions).values(data)\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\t\t\t\t.then((res) => res[0] as AdapterSession)\n\t\t},\n\t\tasync getSessionAndUser(data) {\n\t\t\treturn (\n\t\t\t\t(await client\n\t\t\t\t\t.select({\n\t\t\t\t\t\tsession: sessions,\n\t\t\t\t\t\tuser: users,\n\t\t\t\t\t})\n\t\t\t\t\t.from(sessions)\n\t\t\t\t\t.where(eq(sessions.sessionToken, data))\n\t\t\t\t\t.innerJoin(users, eq(users.id, sessions.userId))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\t\t\t)\n\t\t},\n\t\tasync updateUser(data) {\n\t\t\tif (!data.id) {\n\t\t\t\tthrow new Error('No user id.')\n\t\t\t}\n\n\t\t\tawait client.update(users).set(data).where(eq(users.id, data.id))\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(users)\n\t\t\t\t.where(eq(users.id, data.id))\n\t\t\t\t.then((res) => res[0] as AdapterUser)\n\t\t},\n\t\tasync updateSession(data) {\n\t\t\tawait client\n\t\t\t\t.update(sessions)\n\t\t\t\t.set(data)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, data.sessionToken))\n\t\t\t\t.then((res) => res[0])\n\t\t},\n\t\tasync linkAccount(rawAccount) {\n\t\t\tawait client.insert(accounts).values(rawAccount)\n\t\t},\n\t\tasync getUserByAccount(account) {\n\t\t\tconst dbAccount =\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(accounts)\n\t\t\t\t\t.where(\n\t\t\t\t\t\tand(\n\t\t\t\t\t\t\teq(accounts.providerAccountId, account.providerAccountId),\n\t\t\t\t\t\t\teq(accounts.provider, account.provider),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\t.leftJoin(users, eq(accounts.userId, users.id))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\tif (!dbAccount) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn dbAccount.User\n\t\t},\n\t\tasync deleteSession(sessionToken) {\n\t\t\tconst session =\n\t\t\t\t(await client\n\t\t\t\t\t.select()\n\t\t\t\t\t.from(sessions)\n\t\t\t\t\t.where(eq(sessions.sessionToken, sessionToken))\n\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\tawait client\n\t\t\t\t.delete(sessions)\n\t\t\t\t.where(eq(sessions.sessionToken, sessionToken))\n\n\t\t\treturn session\n\t\t},\n\t\tasync createVerificationToken(token) {\n\t\t\tawait client.insert(verificationTokens).values(token)\n\n\t\t\treturn await client\n\t\t\t\t.select()\n\t\t\t\t.from(verificationTokens)\n\t\t\t\t.where(eq(verificationTokens.identifier, token.identifier))\n\t\t\t\t.then((res) => res[0])\n\t\t},\n\t\tasync useVerificationToken(token) {\n\t\t\ttry {\n\t\t\t\tconst deletedToken =\n\t\t\t\t\t(await client\n\t\t\t\t\t\t.select()\n\t\t\t\t\t\t.from(verificationTokens)\n\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\teq(verificationTokens.identifier, token.identifier),\n\t\t\t\t\t\t\t\teq(verificationTokens.token, token.token),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.then((res) => res[0])) ?? null\n\n\t\t\t\tif (deletedToken?.createdAt) {\n\t\t\t\t\tconst TIMEOUT_IN_SECONDS = 90\n\t\t\t\t\tconst expireMultipleClicks = addSeconds(\n\t\t\t\t\t\tdeletedToken.createdAt,\n\t\t\t\t\t\tTIMEOUT_IN_SECONDS,\n\t\t\t\t\t)\n\t\t\t\t\tconst now = new Date()\n\n\t\t\t\t\tif (isAfter(expireMultipleClicks, now)) {\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tconst { id: _, ...verificationToken } = token\n\t\t\t\t\t\treturn deletedToken\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait client\n\t\t\t\t\t\t\t.delete(verificationTokens)\n\t\t\t\t\t\t\t.where(\n\t\t\t\t\t\t\t\tand(\n\t\t\t\t\t\t\t\t\teq(verificationTokens.identifier, token.identifier),\n\t\t\t\t\t\t\t\t\teq(verificationTokens.token, token.token),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\treturn deletedToken\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn deletedToken\n\t\t\t} catch (err) {\n\t\t\t\tthrow new Error('No verification token found.')\n\t\t\t}\n\t\t},\n\t\tasync deleteUser(id) {\n\t\t\tconst user = await client\n\t\t\t\t.select()\n\t\t\t\t.from(users)\n\t\t\t\t.where(eq(users.id, id))\n\t\t\t\t.then((res) => res[0] ?? null)\n\n\t\t\tawait client.delete(users).where(eq(users.id, id))\n\t\t\tawait client.delete(sessions).where(eq(sessions.userId, id))\n\t\t\tawait client.delete(accounts).where(eq(accounts.userId, id))\n\n\t\t\treturn user\n\t\t},\n\t\tasync unlinkAccount(account) {\n\t\t\tawait client\n\t\t\t\t.delete(accounts)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(accounts.providerAccountId, account.providerAccountId),\n\t\t\t\t\t\teq(accounts.provider, account.provider),\n\t\t\t\t\t),\n\t\t\t\t)\n\n\t\t\treturn undefined\n\t\t},\n\t\tcreateOrganization: async (options: { name: string }) => {\n\t\t\tconst organizationId = crypto.randomUUID()\n\t\t\tawait client.insert(organizationTable).values({\n\t\t\t\t...options,\n\t\t\t\tid: organizationId,\n\t\t\t})\n\n\t\t\treturn adapter.getOrganization(organizationId)\n\t\t},\n\t\tgetOrganization: async (organizationId: string) => {\n\t\t\treturn OrganizationSchema.parse(\n\t\t\t\tawait client.query.organization.findFirst({\n\t\t\t\t\twhere: eq(organizationTable.id, organizationId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\taddMemberToOrganization: async (options: {\n\t\t\torganizationId: string\n\t\t\tuserId: string\n\t\t\tinvitedById: string\n\t\t}) => {\n\t\t\tconst currentMembership =\n\t\t\t\tawait client.query.organizationMemberships.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipTable.organizationId,\n\t\t\t\t\t\t\toptions.organizationId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipTable.userId, options.userId),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\tif (currentMembership) {\n\t\t\t\treturn OrganizationMemberSchema.parse(currentMembership)\n\t\t\t} else {\n\t\t\t\tconst id = crypto.randomUUID()\n\t\t\t\tawait client.insert(organizationMembershipTable).values({\n\t\t\t\t\t...options,\n\t\t\t\t\tid,\n\t\t\t\t})\n\n\t\t\t\treturn OrganizationMemberSchema.parse(\n\t\t\t\t\tawait client.query.organizationMemberships.findFirst({\n\t\t\t\t\t\twhere: eq(organizationMembershipTable.id, id),\n\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\t\tuser: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\tremoveMemberFromOrganization: async (options: {\n\t\t\torganizationId: string\n\t\t\tuserId: string\n\t\t}) => {\n\t\t\tawait client\n\t\t\t\t.delete(organizationMembershipTable)\n\t\t\t\t.where(\n\t\t\t\t\tand(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipTable.organizationId,\n\t\t\t\t\t\t\toptions.organizationId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipTable.userId, options.userId),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t},\n\t\taddRoleForMember: async (options: {\n\t\t\torganizationId: string\n\t\t\tmemberId: string\n\t\t\trole: string\n\t\t}) => {\n\t\t\tconst existingRole = z\n\t\t\t\t.object({\n\t\t\t\t\tid: z.string(),\n\t\t\t\t})\n\t\t\t\t.nullish()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.roles.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(roleTable.organizationId, options.organizationId),\n\t\t\t\t\t\t\teq(roleTable.name, options.role),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tconst roleId = existingRole?.id || crypto.randomUUID()\n\n\t\t\tif (!existingRole) {\n\t\t\t\tawait client.insert(roleTable).values({\n\t\t\t\t\tname: options.role,\n\t\t\t\t\torganizationId: options.organizationId,\n\t\t\t\t\tid: roleId,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst currentOrgMembershipRole =\n\t\t\t\tawait client.query.organizationMembershipRoles.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(\n\t\t\t\t\t\t\torganizationMembershipRoleTable.organizationMembershipId,\n\t\t\t\t\t\t\toptions.memberId,\n\t\t\t\t\t\t),\n\t\t\t\t\t\teq(organizationMembershipRoleTable.roleId, roleId),\n\t\t\t\t\t),\n\t\t\t\t})\n\n\t\t\tif (!currentOrgMembershipRole) {\n\t\t\t\tawait client.insert(organizationMembershipRoleTable).values({\n\t\t\t\t\torganizationId: options.organizationId,\n\t\t\t\t\torganizationMembershipId: options.memberId,\n\t\t\t\t\troleId,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\tremoveRoleForMember: async (options: {\n\t\t\torganizationId: string\n\t\t\tmemberId: string\n\t\t\trole: string\n\t\t}) => {\n\t\t\tconst existingRole = z\n\t\t\t\t.object({\n\t\t\t\t\tid: z.string(),\n\t\t\t\t})\n\t\t\t\t.nullable()\n\t\t\t\t.parse(\n\t\t\t\t\tawait client.query.roles.findFirst({\n\t\t\t\t\t\twhere: and(\n\t\t\t\t\t\t\teq(roleTable.organizationId, options.organizationId),\n\t\t\t\t\t\t\teq(roleTable.name, options.role),\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\tconst roleId = existingRole?.id\n\n\t\t\tif (roleId) {\n\t\t\t\tawait client\n\t\t\t\t\t.delete(organizationMembershipRoleTable)\n\t\t\t\t\t.where(eq(organizationMembershipRoleTable.roleId, roleId))\n\t\t\t}\n\t\t},\n\t\tgetMembershipsForUser: async (userId: string) => {\n\t\t\treturn OrganizationMemberSchema.array().parse(\n\t\t\t\t(await client.query.organizationMemberships.findMany({\n\t\t\t\t\twhere: eq(organizationMembershipTable.userId, userId),\n\t\t\t\t\twith: {\n\t\t\t\t\t\torganization: true,\n\t\t\t\t\t\tuser: true,\n\t\t\t\t\t},\n\t\t\t\t})) || [],\n\t\t\t)\n\t\t},\n\t\tgetOrganizationMembers: async (organizationId: string) => {\n\t\t\treturn OrganizationMemberSchema.array().parse(\n\t\t\t\t(await client.query.organizationMemberships.findMany({\n\t\t\t\t\twhere: eq(organizationMembershipTable.organizationId, organizationId),\n\t\t\t\t})) || [],\n\t\t\t)\n\t\t},\n\t\tcreateSubscription: async (options: {\n\t\t\torganizationId: string\n\t\t\tmerchantSubscriptionId: string\n\t\t\tproductId: string\n\t\t}) => {\n\t\t\tconst id = `sub_${crypto.randomUUID()}`\n\t\t\tawait client.insert(subscriptionTable).values({\n\t\t\t\t...options,\n\t\t\t\tid,\n\t\t\t})\n\n\t\t\treturn SubscriptionSchema.parse(\n\t\t\t\tawait client.query.subscription.findFirst({\n\t\t\t\t\twhere: eq(subscriptionTable.id, id),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tgetMerchantSubscription: async (merchantSubscriptionId: string) => {\n\t\t\treturn MerchantSubscriptionSchema.parse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.id, merchantSubscriptionId),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tcreateMerchantSubscription: async (options: {\n\t\t\tmerchantAccountId: string\n\t\t\tmerchantCustomerId: string\n\t\t\tmerchantProductId: string\n\t\t\tidentifier: string\n\t\t}) => {\n\t\t\tconst id = crypto.randomUUID()\n\t\t\tawait client.insert(merchantSubscriptionTable).values({\n\t\t\t\t...options,\n\t\t\t\tid,\n\t\t\t})\n\n\t\t\treturn MerchantSubscriptionSchema.parse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.id, id),\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\tupdateMerchantSubscription: async (options: {\n\t\t\tmerchantSubscriptionId: string\n\t\t\tstatus: string\n\t\t}) => {\n\t\t\tthrow new Error('Not implemented')\n\t\t},\n\t\tdeleteMerchantSubscription: async (merchantSubscriptionId: string) => {\n\t\t\tthrow new Error('Not implemented')\n\t\t},\n\t\tgetSubscriptionForStripeId: async (stripeSubscriptionId: string) => {\n\t\t\tconst merchantSubscriptionParsed = MerchantSubscriptionSchema.safeParse(\n\t\t\t\tawait client.query.merchantSubscription.findFirst({\n\t\t\t\t\twhere: eq(merchantSubscriptionTable.identifier, stripeSubscriptionId),\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!merchantSubscriptionParsed.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No merchant subscription found for stripe id ${stripeSubscriptionId} ${merchantSubscriptionParsed.error}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst subscriptionParsed = SubscriptionSchema.safeParse(\n\t\t\t\tawait client.query.subscription.findFirst({\n\t\t\t\t\twhere: eq(\n\t\t\t\t\t\tsubscriptionTable.merchantSubscriptionId,\n\t\t\t\t\t\tmerchantSubscriptionParsed.data.id,\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproduct: true,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (!subscriptionParsed.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`No subscription found for merchant subscription ${merchantSubscriptionParsed.data.id} ${subscriptionParsed.error}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn subscriptionParsed.data\n\t\t},\n\t\tupdateSubscriptionStatus: async (\n\t\t\tsubscriptionId: string,\n\t\t\tstatus: string,\n\t\t) => {\n\t\t\tawait client\n\t\t\t\t.update(subscriptionTable)\n\t\t\t\t.set({ status })\n\t\t\t\t.where(eq(subscriptionTable.id, subscriptionId))\n\t\t},\n\t}\n\n\treturn adapter\n}\n","export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n","export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n","import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n","import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"bigint\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n","import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n","import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n","export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n","import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n if (!header)\n return false;\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value)=>key in obj ? __defProp(obj, key, {\n enumerable: true,\n configurable: true,\n writable: true,\n value\n }) : obj[key] = value;\nvar __name = (target, value)=>__defProp(target, \"name\", {\n value,\n configurable: true\n });\nvar __export = (target, all)=>{\n for(var name in all)__defProp(target, name, {\n get: all[name],\n enumerable: true\n });\n};\nvar __publicField = (obj, key, value)=>{\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nexport { __name, __export, __publicField }; //# sourceMappingURL=chunk-IQZPUEIV.js.map\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9","export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n","import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n","import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"bigint\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n","import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n","export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n","import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n","import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA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:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n if (!header)\n return false;\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n","export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n","import * as z from \"./v3/external.js\";\nexport * from \"./v3/external.js\";\nexport { z };\nexport default z;\n","import { z } from 'zod'\n\nexport const VideoResourceSchema = z.object({\n\tid: z.string(),\n\tupdatedAt: z.coerce.date().optional(),\n\tcreatedAt: z.coerce.date().optional(),\n\ttitle: z.string().optional().nullable(),\n\tduration: z.number().optional().nullable(),\n\tmuxPlaybackId: z.string().optional().nullable(),\n\tmuxAssetId: z.string().optional().nullable(),\n\ttranscript: z.string().optional().nullable(),\n\ttranscriptWithScreenshots: z.string().optional().nullable(),\n\tsrt: z.string().optional().nullable(),\n\twordLevelSrt: z.string().optional().nullable(),\n\tstate: z.enum([\n\t\t'new',\n\t\t'processing',\n\t\t'preparing',\n\t\t'ready',\n\t\t'errored',\n\t\t'deleted',\n\t]),\n})\n\nexport type VideoResource = z.infer<typeof VideoResourceSchema>\n","import { z } from 'zod'\n\nexport const purchaseUserTransferSchema = z.object({\n\tid: z.string().max(191),\n\ttransferState: z\n\t\t.enum([\n\t\t\t'AVAILABLE',\n\t\t\t'INITIATED',\n\t\t\t'VERIFIED',\n\t\t\t'CANCELED',\n\t\t\t'EXPIRED',\n\t\t\t'CONFIRMED',\n\t\t\t'COMPLETED',\n\t\t])\n\t\t.default('AVAILABLE'),\n\tpurchaseId: z.string().max(191),\n\tsourceUserId: z.string().max(191),\n\ttargetUserId: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n\texpiresAt: z.date().nullable(),\n\tcanceledAt: z.date().nullable(),\n\tconfirmedAt: z.date().nullable(),\n\tcompletedAt: z.date().nullable(),\n})\n\nexport type PurchaseUserTransfer = z.infer<typeof purchaseUserTransferSchema>\n\nexport type PurchaseUserTransferState =\n\t| 'AVAILABLE'\n\t| 'INITIATED'\n\t| 'VERIFIED'\n\t| 'CANCELED'\n\t| 'EXPIRED'\n\t| 'CONFIRMED'\n\t| 'COMPLETED'\n","import { z } from 'zod'\n\nexport const questionResponseSchema = z.object({\n\tid: z.string().max(255),\n\tsurveyId: z.string().max(255),\n\tquestionId: z.string().max(255),\n\trespondentKey: z.string().max(255).optional().nullable(),\n\tsurveySessionId: z.string().max(255).optional().nullable(),\n\tuserId: z.string().max(255).optional().nullable(),\n\temailListSubscriberId: z.string().max(255).optional().nullable(),\n\tfields: z.record(z.any()).default({}),\n\tcreatedAt: z.date(),\n\tupdatedAt: z.date(),\n\tdeletedAt: z.date().optional().nullable(),\n})\n\nexport type QuestionResponse = z.infer<typeof questionResponseSchema>\n","import { z } from 'zod'\n\nexport const ContentResourceResourceSchema = z.object({\n\tresourceId: z.string(),\n\tresourceOfId: z.string(),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.string(), z.any()).default({}).nullable(),\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresource: z.any(),\n})\n\nexport const ContentResourceProductSchema = z.object({\n\tresourceId: z.string(),\n\tproductId: z.string(),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.string(), z.any()).default({}).nullable(),\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresource: z.any(),\n\tproduct: z.any(),\n})\n\nexport const ContentResourceSchema = z.object({\n\tid: z.string(),\n\ttype: z.string(),\n\tcreatedById: z.string(),\n\tcurrentVersionId: z.string().nullish(),\n\tfields: z.record(z.string(), z.any()).default({}).nullable().optional(),\n\tslug: z.string().nullish(), // Generated column from fields.slug\n\tcreatedAt: z.coerce.date().nullable(),\n\tupdatedAt: z.coerce.date().nullable(),\n\tdeletedAt: z.coerce.date().nullable(),\n\tresources: z.array(ContentResourceResourceSchema).default([]).nullable(),\n\tresourceProducts: z\n\t\t.array(ContentResourceProductSchema)\n\t\t.default([])\n\t\t.nullable()\n\t\t.optional(),\n\torganizationId: z.string().nullable(),\n\tcreatedByOrganizationMembershipId: z.string().nullable(),\n})\n\nexport type ContentResource = z.infer<typeof ContentResourceSchema>\nexport type ContentResourceResource = z.infer<\n\ttypeof ContentResourceResourceSchema\n>\nexport type ContentResourceProduct = z.infer<\n\ttypeof ContentResourceProductSchema\n>\n\nexport const ResourceStateSchema = z.union([\n\tz.literal('draft'),\n\tz.literal('published'),\n\tz.literal('archived'),\n\tz.literal('deleted'),\n])\n\nexport const ResourceVisibilitySchema = z.union([\n\tz.literal('public'),\n\tz.literal('private'),\n\tz.literal('unlisted'),\n])\n","import { z } from 'zod'\n\nimport { ContentResourceSchema } from './content-resource-schema'\n\nexport const resourceProgressSchema = z.object({\n\tuserId: z.string().max(191),\n\tresourceId: z.string().max(191).optional().nullable(),\n\tcompletedAt: z.date().nullable(),\n})\n\nexport type ResourceProgress = z.infer<typeof resourceProgressSchema>\n\nexport const moduleProgressSchema = z.object({\n\tcompletedLessons: z.array(resourceProgressSchema),\n\tnextResource: ContentResourceSchema.partial().nullable(),\n\tpercentCompleted: z.number().default(0),\n\tcompletedLessonsCount: z.number().default(0),\n\ttotalLessonsCount: z.number().default(0),\n})\n\nexport type ModuleProgress = z.infer<typeof moduleProgressSchema>\n","import { z } from 'zod'\n\nexport const upgradableProductSchema = z.object({\n\tupgradableToId: z.string().max(255),\n\tupgradableFromId: z.string().max(255),\n\tposition: z.number().default(0),\n\tmetadata: z.record(z.any()).default({}),\n\tcreatedAt: z.date().nullable(),\n\tupdatedAt: z.date().nullable(),\n\tdeletedAt: z.date().nullable(),\n})\n\nexport type UpgradableProduct = z.infer<typeof upgradableProductSchema>\n","import { z } from 'zod'\n\nexport const userSchema = z.object({\n\tid: z.string().max(255),\n\tname: z.string().max(255).optional().nullable(),\n\trole: z.enum(['user', 'admin', 'contributor']).default('user'),\n\temail: z.string().max(255).email(),\n\temailVerified: z.coerce.date().nullish(),\n\timage: z.string().max(255).optional().nullable(),\n\tcreatedAt: z.coerce.date().nullish(),\n\tmemberships: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\torganizationId: z.string(),\n\t\t\t}),\n\t\t)\n\t\t.nullish()\n\t\t.default([]),\n\troles: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\tname: z.string(),\n\t\t\t\tdescription: z.string().nullable(),\n\t\t\t\tactive: z.boolean(),\n\t\t\t\tcreatedAt: z.coerce.date().nullish(),\n\t\t\t\tupdatedAt: z.coerce.date().nullish(),\n\t\t\t\tdeletedAt: z.coerce.date().nullish(),\n\t\t\t}),\n\t\t)\n\t\t.optional()\n\t\t.default([]),\n\torganizationRoles: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tid: z.string(),\n\t\t\t\torganizationId: z.string(),\n\t\t\t\tname: z.string(),\n\t\t\t\tdescription: z.string().nullable(),\n\t\t\t\tactive: z.boolean(),\n\t\t\t\tcreatedAt: z.coerce.date().nullish(),\n\t\t\t\tupdatedAt: z.coerce.date().nullish(),\n\t\t\t\tdeletedAt: z.coerce.date().nullish(),\n\t\t\t}),\n\t\t)\n\t\t.optional()\n\t\t.default([]),\n})\n\nexport type User = z.infer<typeof userSchema>\n","import { z } from 'zod'\n\nexport const priceSchema = z.object({\n\tid: z.string().max(191),\n\tproductId: z.string().max(191).optional().nullable(),\n\torganizationId: z.string().max(191).optional().nullable(),\n\tnickname: z.string().max(191).optional().nullable(),\n\tstatus: z.number().int().default(0),\n\tunitAmount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\tcreatedAt: z.date().nullable(),\n\tfields: z.record(z.any()).default({}),\n})\n\nexport type Price = z.infer<typeof priceSchema>\n","import { z } from 'zod'\n\nimport {\n\tContentResourceProductSchema,\n\tContentResourceSchema,\n} from './content-resource-schema'\nimport { priceSchema } from './price-schema'\n\nexport const ProductTypeSchema = z\n\t.enum([\n\t\t'live',\n\t\t'self-paced',\n\t\t'membership',\n\t\t'cohort',\n\t\t'cohort-archive',\n\t\t'source-code-access',\n\t])\n\t.default('self-paced')\n\t.optional()\n\nexport type ProductType = z.infer<typeof ProductTypeSchema>\n\n/**\n * Subscription tier for membership products.\n * - standard: Access to standard and free tier content\n * - pro: Access to all content including pro tier\n * - null: No tier specified (e.g., non-membership products)\n */\nexport const SubscriptionTierSchema = z\n\t.enum(['standard', 'pro'])\n\t.optional()\n\t.nullable()\n\nexport type SubscriptionTier = z.infer<typeof SubscriptionTierSchema>\n\n/**\n * Schema for billing interval on membership/subscription products\n */\nexport const BillingIntervalSchema = z\n\t.enum(['month', 'year'])\n\t.optional()\n\t.nullable()\n\nexport type BillingInterval = z.infer<typeof BillingIntervalSchema>\n\nexport const productSchema = z.object({\n\tid: z.string().max(191),\n\torganizationId: z.string().max(191).optional().nullable(),\n\tname: z.string().max(191),\n\tkey: z.string().max(191).optional().nullable(),\n\ttype: ProductTypeSchema,\n\tfields: z.object({\n\t\tbody: z.string().nullable().optional(),\n\t\tdescription: z.string().nullish(),\n\t\tslug: z.string(),\n\t\timage: z\n\t\t\t.object({\n\t\t\t\turl: z.string(),\n\t\t\t\talt: z.string().optional().nullable(),\n\t\t\t\twidth: z.number().optional().nullable(),\n\t\t\t\theight: z.number().optional().nullable(),\n\t\t\t})\n\t\t\t.optional()\n\t\t\t.nullable(),\n\t\taction: z.string().optional().nullable().default('Buy Now'),\n\t\tstate: z\n\t\t\t.enum(['draft', 'published', 'archived', 'deleted'])\n\t\t\t.default('draft'),\n\t\tvisibility: z.enum(['public', 'private', 'unlisted']).default('unlisted'),\n\t\topenEnrollment: z.string().datetime().nullish(),\n\t\tcloseEnrollment: z.string().datetime().nullish(),\n\t\tdiscordRoleId: z.string().optional().nullable(),\n\t\tavailableAfterDays: z.coerce\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.positive()\n\t\t\t.optional()\n\t\t\t.nullable(),\n\t\taccessDurationDays: z.coerce\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.positive()\n\t\t\t.optional()\n\t\t\t.nullable(),\n\t\t/** Subscription tier for membership products (standard, pro) */\n\t\ttier: SubscriptionTierSchema,\n\t\t/** Billing interval for membership products (month, year) */\n\t\tbillingInterval: BillingIntervalSchema,\n\t}),\n\tcreatedAt: z.coerce.date().nullable(),\n\tstatus: z.number().int().default(0),\n\tquantityAvailable: z.number().int().default(-1),\n\tprice: priceSchema.nullable().optional(),\n\tresources: z.array(ContentResourceProductSchema).default([]).nullable(),\n})\n\nexport type Product = z.infer<typeof productSchema>\n\n/**\n * Schema for creating new products.\n * Includes `billingInterval` for membership products to configure recurring Stripe prices.\n */\nexport const NewProductSchema = z.object({\n\tname: z.string().min(2).max(90),\n\tquantityAvailable: z.coerce.number().default(-1),\n\tprice: z.coerce.number().gte(0).default(0),\n\ttype: ProductTypeSchema,\n\tstate: z\n\t\t.enum(['draft', 'published', 'archived', 'deleted'])\n\t\t.default('draft')\n\t\t.optional(),\n\tvisibility: z\n\t\t.enum(['public', 'private', 'unlisted'])\n\t\t.default('unlisted')\n\t\t.optional(),\n\topenEnrollment: z.string().datetime().nullish(),\n\tcloseEnrollment: z.string().datetime().nullish(),\n\tavailableAfterDays: z.coerce.number().int().positive().optional(),\n\taccessDurationDays: z.coerce.number().int().positive().optional(),\n\t/** Billing interval for membership/subscription products (defaults to 'year') */\n\tbillingInterval: z.enum(['month', 'year']).optional(),\n})\n\nexport type NewProduct = z.infer<typeof NewProductSchema>\n","import { z } from 'zod'\n\n/**\n * Eligibility condition types for stackable discount coupons\n * These conditions determine which users are eligible for a coupon credit\n */\nexport const eligibilityConditionSchema = z.discriminatedUnion('type', [\n\tz.object({\n\t\ttype: z.literal('hasValidProductPurchase'),\n\t\tproductId: z.string().max(191),\n\t}),\n])\n\nexport type EligibilityCondition = z.infer<typeof eligibilityConditionSchema>\n\n/**\n * Extended coupon fields type that includes eligibility conditions and stacking configuration\n */\nexport const couponFieldsSchema = z.object({\n\teligibilityCondition: eligibilityConditionSchema.optional(),\n\tstackable: z.boolean().optional(),\n})\n\nexport type CouponFields = z.infer<typeof couponFieldsSchema>\n","import { z } from 'zod'\n\nimport { couponFieldsSchema } from '../types/eligibility-conditions'\n\nexport const couponSchema = z.object({\n\tid: z.string(),\n\tcode: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n\texpires: z.date().nullable(),\n\tfields: z\n\t\t.record(z.any())\n\t\t.default({})\n\t\t.refine(\n\t\t\t(fields) => {\n\t\t\t\t// Validate fields structure if it contains eligibilityCondition or stackable\n\t\t\t\tif (\n\t\t\t\t\tfields.eligibilityCondition !== undefined ||\n\t\t\t\t\tfields.stackable !== undefined\n\t\t\t\t) {\n\t\t\t\t\tconst result = couponFieldsSchema.safeParse(fields)\n\t\t\t\t\treturn result.success\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid fields structure. eligibilityCondition must have type and productId, stackable must be boolean.',\n\t\t\t},\n\t\t),\n\tmaxUses: z.number().int().default(-1),\n\tdefault: z.boolean().default(false),\n\tmerchantCouponId: z.string().max(191).optional().nullable(),\n\tstatus: z.number().int().default(0),\n\tusedCount: z.number().int().default(0),\n\tpercentageDiscount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\tamountDiscount: z.coerce.number().int().optional().nullable(),\n\trestrictedToProductId: z.string().max(191).optional().nullable(),\n\tbulkPurchases: z.array(z.any()).default([]),\n\tredeemedBulkCouponPurchases: z.array(z.any()).default([]),\n\tbulkPurchaseId: z.string().max(191).optional().nullable(), // TODO: remove\n\torganizationId: z.string().max(191).optional().nullable(),\n})\n\nexport type Coupon = z.infer<typeof couponSchema>\n","import { z } from 'zod'\n\nimport { couponSchema } from './coupon-schema'\nimport { productSchema } from './product-schema'\nimport { userSchema } from './user-schema'\n\nexport const purchaseSchema = z.object({\n\tid: z.string().max(191),\n\tuserId: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date(),\n\ttotalAmount: z.coerce.number().refine((value) => {\n\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\treturn decimalPlaces <= 2\n\t}),\n\tipAddress: z.string().max(191).optional().nullable(),\n\tcity: z.string().max(191).optional().nullable(),\n\tstate: z.string().max(191).optional().nullable(),\n\tcountry: z.string().max(191).optional().nullable(),\n\tcouponId: z.string().max(191).optional().nullable(),\n\tproductId: z.string().max(191),\n\tmerchantChargeId: z.string().max(191).optional().nullable(),\n\tupgradedFromId: z.string().max(191).optional().nullable(),\n\tstatus: z.string().max(191).default('Valid'),\n\tbulkCouponId: z.string().max(191).optional().nullable(),\n\tmerchantSessionId: z.string().max(191).optional().nullable(),\n\tredeemedBulkCouponId: z.string().max(191).optional().nullable(),\n\tfields: z.record(z.any()).default({}),\n\tuser: userSchema.optional().nullable(),\n\tbulkCoupon: couponSchema.optional().nullable(),\n\tproduct: productSchema.optional().nullable(),\n\tpurchasedByorganizationMembershipId: z\n\t\t.string()\n\t\t.max(191)\n\t\t.optional()\n\t\t.nullable(),\n\torganizationId: z.string().max(191).optional().nullable(),\n})\n\nexport type Purchase = z.infer<typeof purchaseSchema>\n","import { z } from 'zod'\n\nexport const merchantCouponSchema = z\n\t.object({\n\t\tid: z.string().max(191),\n\t\tidentifier: z.string().max(191).optional().nullable(),\n\t\tstatus: z.number().int().default(0),\n\t\tmerchantAccountId: z.string().max(191),\n\t\tpercentageDiscount: z.coerce\n\t\t\t.number()\n\t\t\t.refine((value) => {\n\t\t\t\tconst decimalPlaces = value.toString().split('.')[1]?.length || 0\n\t\t\t\treturn decimalPlaces <= 2\n\t\t\t})\n\t\t\t.optional()\n\t\t\t.nullable(),\n\t\tamountDiscount: z.number().int().nonnegative().optional().nullable(),\n\t\ttype: z.string().max(191),\n\t})\n\t.refine(\n\t\t(data) => {\n\t\t\tconst hasPercentage =\n\t\t\t\tdata.percentageDiscount !== null &&\n\t\t\t\tdata.percentageDiscount !== undefined &&\n\t\t\t\tdata.percentageDiscount > 0\n\t\t\tconst hasAmount =\n\t\t\t\tdata.amountDiscount !== null &&\n\t\t\t\tdata.amountDiscount !== undefined &&\n\t\t\t\tdata.amountDiscount > 0\n\t\t\t// Must have either percentage or amount (but not both), OR neither (for inactive coupons)\n\t\t\treturn (\n\t\t\t\t(hasPercentage && !hasAmount) ||\n\t\t\t\t(!hasPercentage && hasAmount) ||\n\t\t\t\t(!hasPercentage && !hasAmount)\n\t\t\t)\n\t\t},\n\t\t{\n\t\t\tmessage:\n\t\t\t\t'Cannot have both percentageDiscount and amountDiscount with values > 0',\n\t\t},\n\t)\n\nexport type MerchantCoupon = z.infer<typeof merchantCouponSchema>\n","import { z } from 'zod'\n\nexport const merchantCustomerSchema = z.object({\n\tid: z.string().max(191),\n\tuserId: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tidentifier: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tstatus: z.number().int().default(0),\n})\n\nexport type MerchantCustomer = z.infer<typeof merchantCustomerSchema>\n","import { z } from 'zod'\n\n/**\n * Schema for MerchantEvents table - tracks webhook events from payment providers\n * This provides an audit trail of what webhooks we received, regardless of\n * whether Inngest successfully processed them or not.\n */\nexport const merchantEventsSchema = z.object({\n\tid: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tidentifier: z.string().max(191), // Stripe event ID or other provider event ID\n\tpayload: z.record(z.any()), // Raw webhook payload as JSON\n\tcreatedAt: z.date().nullable(),\n})\n\nexport type MerchantEvents = z.infer<typeof merchantEventsSchema>\n","import { z } from 'zod'\n\nexport const merchantPriceSchema = z.object({\n\tid: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tmerchantProductId: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date(),\n\tpriceId: z.string().max(191).optional().nullable(),\n})\n\nexport type MerchantPrice = z.infer<typeof merchantPriceSchema>\n","import { z } from 'zod'\n\nexport const merchantProductSchema = z.object({\n\tid: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tproductId: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191).optional().nullable(),\n\tcreatedAt: z.date().nullable(),\n})\n\nexport type MerchantProduct = z.infer<typeof merchantProductSchema>\n","import { z } from 'zod'\n\nexport const entitlementSchema = z.object({\n\tid: z.string().max(191),\n\tentitlementType: z.string().max(255),\n\tuserId: z.string().max(191).nullable().optional(),\n\torganizationId: z.string().max(191).nullable().optional(),\n\torganizationMembershipId: z.string().max(191).nullable().optional(),\n\tsourceType: z.string().max(255),\n\tsourceId: z.string().max(191),\n\tmetadata: z.record(z.any()).default({}),\n\texpiresAt: z.date().nullable().optional(),\n\tcreatedAt: z.date().nullable().optional(),\n\tupdatedAt: z.date().nullable().optional(),\n\tdeletedAt: z.date().nullable().optional(),\n})\n\nexport type Entitlement = z.infer<typeof entitlementSchema>\n","import { z } from 'zod'\n\nexport const merchantChargeSchema = z.object({\n\tid: z.string().max(191),\n\tstatus: z.number().int().default(0),\n\tidentifier: z.string().max(191),\n\tuserId: z.string().max(191),\n\tmerchantAccountId: z.string().max(191),\n\tmerchantProductId: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tmerchantCustomerId: z.string().max(191),\n})\n\nexport type MerchantCharge = z.infer<typeof merchantChargeSchema>\n","import { z } from 'zod'\n\nexport const merchantAccountSchema = z.object({\n\tid: z.string().max(191),\n\tlabel: z.string().max(191),\n\tidentifier: z.string().max(191),\n\tcreatedAt: z.date().nullable(),\n\tstatus: z.number().int().default(0),\n})\n\nexport type MerchantAccount = z.infer<typeof merchantAccountSchema>\n","import { z } from 'zod'\n\nexport const MerchantSessionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().nullable(),\n\tidentifier: z.string(),\n\tmerchantAccountId: z.string(),\n})\n\nexport type MerchantSession = z.infer<typeof MerchantSessionSchema>\n","import { z } from 'zod'\n\nexport const MerchantSubscriptionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().nullable(),\n\tmerchantAccountId: z.string(),\n\tstatus: z.number().default(0),\n\tcreatedAt: z.date().default(() => new Date()),\n\tlabel: z.string().nullable(),\n\tidentifier: z.string().nullable(),\n\tmerchantCustomerId: z.string(),\n\tmerchantProductId: z.string(),\n})\n\nexport type MerchantSubscription = z.infer<typeof MerchantSubscriptionSchema>\n","import { z } from 'zod'\n\nexport const OrganizationSchema = z.object({\n\tid: z.string(),\n\tname: z.string().nullable(),\n\tfields: z.record(z.any()).default({}),\n\timage: z.string().nullable(),\n\tcreatedAt: z.date(),\n})\n\nexport type Organization = z.infer<typeof OrganizationSchema>\n","import { z } from 'zod'\n\nimport { OrganizationSchema } from './organization-schema'\nimport { userSchema } from './user-schema'\n\nexport const OrganizationMemberSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().optional(),\n\trole: z.string().default('user'),\n\tinvitedById: z.string(),\n\tuserId: z.string(),\n\tfields: z.record(z.any()).default({}),\n\tcreatedAt: z.date().default(() => new Date()),\n\torganization: OrganizationSchema,\n\tuser: userSchema,\n})\n\nexport type OrganizationMember = z.infer<typeof OrganizationMemberSchema>\n","import { z } from 'zod'\n\nimport { MerchantSubscriptionSchema } from './merchant-subscription'\nimport { productSchema } from './product-schema'\n\nexport const SubscriptionSchema = z.object({\n\tid: z.string(),\n\torganizationId: z.string().optional(),\n\tproductId: z.string(),\n\tcreatedAt: z.date(),\n\tmerchantSubscriptionId: z.string(),\n\tstatus: z\n\t\t.enum([\n\t\t\t'incomplete',\n\t\t\t'incomplete_expired',\n\t\t\t'trialing',\n\t\t\t'active',\n\t\t\t'past_due',\n\t\t\t'canceled',\n\t\t\t'unpaid',\n\t\t\t'paused',\n\t\t])\n\t\t.default('active'),\n\tfields: z.record(z.any()).default({}),\n\tproduct: productSchema,\n\tmerchantSubscription: MerchantSubscriptionSchema.optional(),\n})\n\nexport type Subscription = z.infer<typeof SubscriptionSchema>\n","type ErrorOptions = Error | Record<string, unknown>\n\ntype ErrorType =\n\t| 'AdapterError'\n\t| 'UnknownAction'\n\t| 'UnsupportedStrategy'\n\t| 'MissingAdapter'\n\t| 'MissingAdapterMethods'\n\nexport class CourseBuilderError extends Error {\n\t/** The error type. Used to identify the error in the logs. */\n\ttype: ErrorType\n\t/**\n\t * Determines on which page an error should be handled. Typically `signIn` errors can be handled in-page.\n\t * Default is `\"error\"`.\n\t * @internal\n\t */\n\tkind?: 'error'\n\tcause?: Record<string, unknown> & { err?: Error }\n\tconstructor(\n\t\tmessage?: string | Error | ErrorOptions,\n\t\terrorOptions?: ErrorOptions,\n\t) {\n\t\tif (message instanceof Error) {\n\t\t\tsuper(undefined, {\n\t\t\t\tcause: { err: message, ...(message.cause as any), ...errorOptions },\n\t\t\t})\n\t\t} else if (typeof message === 'string') {\n\t\t\tif (errorOptions instanceof Error) {\n\t\t\t\terrorOptions = { err: errorOptions, ...(errorOptions.cause as any) }\n\t\t\t}\n\t\t\tsuper(message, errorOptions)\n\t\t} else {\n\t\t\tsuper(undefined, message)\n\t\t}\n\t\tthis.name = this.constructor.name\n\t\t// @ts-expect-error https://github.com/microsoft/TypeScript/issues/3841\n\t\tthis.type = this.constructor.type ?? 'CourseBuilderError'\n\t\t// @ts-expect-error https://github.com/microsoft/TypeScript/issues/3841\n\t\tthis.kind = this.constructor.kind ?? 'error'\n\n\t\tError.captureStackTrace?.(this, this.constructor)\n\t\tconst url = `https://errors.authjs.dev#${this.type.toLowerCase()}`\n\t\tthis.message += `${this.message ? '. ' : ''}Read more at ${url}`\n\t}\n}\n\nexport class AdapterError extends CourseBuilderError {\n\tstatic type = 'AdapterError'\n}\n\nexport class UnsupportedStrategy extends CourseBuilderError {\n\tstatic type = 'UnsupportedStrategy'\n}\n\nexport class MissingAdapter extends CourseBuilderError {\n\tstatic type = 'MissingAdapter'\n}\n\nexport class MissingAdapterMethods extends CourseBuilderError {\n\tstatic type = 'MissingAdapterMethods'\n}\n","import { CourseBuilderError } from '../../errors.js'\n\nexport type WarningCode =\n\t| 'debug-enabled'\n\t| 'env-url-basepath-redundant'\n\t| 'env-url-basepath-mismatch'\n\n/**\n * Structured attributes for high-cardinality logging.\n * These flow through to Axiom as indexed fields for filtering/querying.\n */\nexport type LogAttributes = Record<string, unknown>\n\nexport interface LoggerInstance extends Record<string, Function> {\n\twarn: (code: WarningCode, attrs?: LogAttributes) => void\n\terror: (error: Error, attrs?: LogAttributes) => void\n\tdebug: (message: string, metadata?: unknown) => void\n\tinfo: (message: string, attrs?: LogAttributes) => void\n}\n\nconst red = '\\x1b[31m'\nconst yellow = '\\x1b[33m'\nconst grey = '\\x1b[38;5;246m'\nconst reset = '\\x1b[0m'\n\nfunction formatAttrs(attrs?: LogAttributes): string {\n\tif (!attrs || Object.keys(attrs).length === 0) return ''\n\treturn ` ${JSON.stringify(attrs)}`\n}\n\nexport const logger: LoggerInstance = {\n\terror(error, attrs) {\n\t\tconst name = error instanceof CourseBuilderError ? error.type : error.name\n\t\tconsole.error(\n\t\t\t`${red}[coursebuilder][error]${reset} ${name}: ${error.message}${formatAttrs(attrs)}`,\n\t\t)\n\t\tif (\n\t\t\terror.cause &&\n\t\t\ttypeof error.cause === 'object' &&\n\t\t\t'err' in error.cause &&\n\t\t\terror.cause.err instanceof Error\n\t\t) {\n\t\t\tconst { err, ...data } = error.cause\n\t\t\tconsole.error(`${red}[coursebuilder][cause]${reset}:`, err.stack)\n\t\t\tif (data)\n\t\t\t\tconsole.error(\n\t\t\t\t\t`${red}[coursebuilder][details]${reset}:`,\n\t\t\t\t\tJSON.stringify(data, null, 2),\n\t\t\t\t)\n\t\t} else if (error.stack) {\n\t\t\tconsole.error(error.stack.replace(/.*/, '').substring(1))\n\t\t}\n\t},\n\twarn(code, attrs) {\n\t\tconst url = `https://warnings.coursebuilder.dev#${code}`\n\t\tconsole.warn(\n\t\t\t`${yellow}[coursebuilder][warn][${code}]${reset}`,\n\t\t\t`Read more: ${url}${formatAttrs(attrs)}`,\n\t\t)\n\t},\n\tdebug(message, metadata) {\n\t\tconsole.log(\n\t\t\t`${grey}[coursebuilder][debug]:${reset} ${message}`,\n\t\t\tJSON.stringify(metadata, null, 2),\n\t\t)\n\t},\n\tinfo(message, attrs) {\n\t\tconsole.info(\n\t\t\t`${grey}[coursebuilder][info]:${reset} ${message}${formatAttrs(attrs)}`,\n\t\t)\n\t},\n}\n\n/**\n * Override the built-in logger with user's implementation.\n * Any `undefined` level will use the default logger.\n */\nexport function setLogger(\n\tnewLogger: Partial<LoggerInstance> = {},\n\tdebug?: boolean,\n) {\n\t// Turn off debug logging if `debug` isn't set to `true`\n\tif (!debug) logger.debug = () => {}\n\n\tif (newLogger.error) logger.error = newLogger.error\n\tif (newLogger.warn) logger.warn = newLogger.warn\n\tif (newLogger.debug) logger.debug = newLogger.debug\n\tif (newLogger.info) logger.info = newLogger.info\n}\n","import { isBefore } from 'date-fns'\n\nimport { Coupon } from '../../schemas'\n\nexport const validateCoupon = (\n\tcoupon: Coupon | null,\n\tproductIds: string[] = [],\n) => {\n\tif (!coupon) {\n\t\treturn {\n\t\t\tisValid: false,\n\t\t\tisRedeemable: false,\n\t\t\terror: 'coupon-not-found',\n\t\t}\n\t}\n\n\tconst isUsedUp =\n\t\tcoupon.maxUses > 0 ? coupon.usedCount >= coupon.maxUses : false\n\n\tconst isExpired = coupon.expires\n\t\t? isBefore(new Date(coupon.expires), new Date())\n\t\t: false\n\n\tif (\n\t\tcoupon.restrictedToProductId &&\n\t\t!productIds.includes(coupon.restrictedToProductId)\n\t) {\n\t\treturn {\n\t\t\tisValid: false,\n\t\t\tisRedeemable: false,\n\t\t\terror: 'coupon-not-valid-for-product',\n\t\t}\n\t}\n\n\tconst isValid = !isUsedUp && !isExpired\n\n\treturn {\n\t\tisExpired,\n\t\tisUsedUp,\n\t\tisRedeemable: isValid && coupon.percentageDiscount >= 1 && !coupon.default,\n\t\tisValid,\n\t}\n}\n","import { AdapterAccount } from '@auth/core/adapters'\nimport { relations } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getAccountsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Account',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\ttype: varchar('type', { length: 255 })\n\t\t\t\t.$type<AdapterAccount['type']>()\n\t\t\t\t.notNull(),\n\t\t\tprovider: varchar('provider', { length: 255 }).notNull(),\n\t\t\tproviderAccountId: varchar('providerAccountId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\trefresh_token: text('refresh_token'),\n\t\t\taccess_token: text('access_token'),\n\t\t\toauth_token: text('oauth_token'),\n\t\t\toauth_token_secret: text('oauth_token_secret'),\n\t\t\texpires_at: int('expires_at'),\n\t\t\ttoken_type: varchar('token_type', { length: 255 }),\n\t\t\tscope: varchar('scope', { length: 255 }),\n\t\t\tid_token: text('id_token'),\n\t\t\tsession_state: varchar('session_state', { length: 255 }),\n\t\t\trefresh_token_expires_in: int('refresh_token_expires_in'),\n\t\t},\n\t\t(account) => ({\n\t\t\tpk: primaryKey({\n\t\t\t\tcolumns: [account.provider, account.providerAccountId],\n\t\t\t}),\n\t\t\tuserIdIdx: index('userId_idx').on(account.userId),\n\t\t}),\n\t)\n}\n\nexport function getAccountsRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst accounts = getAccountsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\treturn relations(accounts, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [accounts.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getCommentsSchema } from '../communication/comment.js'\nimport { getCommunicationPreferencesSchema } from '../communication/communication-preferences.js'\nimport { getContentContributionsSchema } from '../content/content-contributions.js'\nimport { getContentResourceSchema } from '../content/content-resource.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getAccountsSchema } from './accounts.js'\nimport { getProfilesSchema } from './profiles.js'\nimport { getUserPermissionsSchema } from './user-permissions.js'\nimport { getUserPrefsSchema } from './user-prefs.js'\nimport { getUserRolesSchema } from './user-roles.js'\n\nexport function getUsersSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'User',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }),\n\t\t\trole: varchar('role', { length: 191 }).notNull().default('user'),\n\t\t\temail: varchar('email', { length: 255 }).notNull().unique(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\temailVerified: timestamp('emailVerified', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\timage: varchar('image', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(user) => ({\n\t\t\temailIdx: index('email_idx').on(user.email),\n\t\t\troleIdx: index('role_idx').on(user.role),\n\t\t\tcreatedAtIdx: index('created_at_idx').on(user.createdAt),\n\t\t}),\n\t)\n}\n\nexport type UsersSchemaOverrides<\n\tTUsers extends ReturnType<typeof getUsersSchema> = ReturnType<\n\t\ttypeof getUsersSchema\n\t>,\n> = {\n\tgetUsersSchema?: (mysqlTable: MySqlTableFn) => TUsers\n}\n\nexport function getUsersRelationsSchema<\n\tTUsers extends ReturnType<typeof getUsersSchema> = ReturnType<\n\t\ttypeof getUsersSchema\n\t>,\n>(mysqlTable: MySqlTableFn, overrides: UsersSchemaOverrides<TUsers> = {}) {\n\tconst resolveUsersSchema = (overrides.getUsersSchema ?? getUsersSchema) as (\n\t\tmysqlTable: MySqlTableFn,\n\t) => TUsers\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst profiles = getProfilesSchema(mysqlTable)\n\tconst accounts = getAccountsSchema(mysqlTable)\n\tconst communicationPreferences = getCommunicationPreferencesSchema(mysqlTable)\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\tconst userPermissions = getUserPermissionsSchema(mysqlTable)\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst comments = getCommentsSchema(mysqlTable)\n\tconst userPrefs = getUserPrefsSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(users, ({ many, one }) => ({\n\t\tprofiles: many(profiles, {\n\t\t\trelationName: 'profiles',\n\t\t}),\n\t\taccounts: many(accounts, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tpurchases: many(purchases, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcommunicationPreferences: many(communicationPreferences, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\troles: many(userRoles, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tuserPermissions: many(userPermissions, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcontributions: many(contentContributions, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcreatedContent: many(contentResource, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcomments: many(comments, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tprefs: many(userPrefs, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMemberships: many(organizationMemberships, {\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdecimal,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getOrganizationsSchema } from '../org/organizations.js'\nimport { getCouponSchema } from './coupon.js'\nimport { getMerchantChargeSchema } from './merchant-charge.js'\nimport { getMerchantSessionSchema } from './merchant-session.js'\nimport { getProductSchema } from './product.js'\n\nexport function getPurchaseSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Purchase',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }),\n\t\t\tpurchasedByorganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\ttotalAmount: decimal('totalAmount', {\n\t\t\t\tprecision: 65,\n\t\t\t\tscale: 30,\n\t\t\t}).notNull(),\n\t\t\tipAddress: varchar('ip_address', { length: 191 }),\n\t\t\tcity: varchar('city', { length: 191 }),\n\t\t\tstate: varchar('state', { length: 191 }),\n\t\t\tcountry: varchar('country', { length: 191 }),\n\t\t\tcouponId: varchar('couponId', { length: 191 }),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tmerchantChargeId: varchar('merchantChargeId', { length: 191 }),\n\t\t\tupgradedFromId: varchar('upgradedFromId', { length: 191 }),\n\t\t\tstatus: varchar('status', { length: 191 }).default('Valid').notNull(),\n\t\t\tbulkCouponId: varchar('bulkCouponId', { length: 191 }),\n\t\t\tmerchantSessionId: varchar('merchantSessionId', { length: 191 }),\n\t\t\tredeemedBulkCouponId: varchar('redeemedBulkCouponId', { length: 191 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpurchaseId: primaryKey({ columns: [table.id], name: 'Purchase_id' }),\n\t\t\t\tmerchantChargeIdIdx: index('idx_Purchase_on_merchantChargeId').on(\n\t\t\t\t\ttable.merchantChargeId,\n\t\t\t\t),\n\t\t\t\tpurchaseUpgradedFromIdKey: unique('Purchase_upgradedFromId_key').on(\n\t\t\t\t\ttable.upgradedFromId,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\ttable.purchasedByorganizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getPurchaseRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst products = getProductSchema(mysqlTable)\n\tconst merchantCharges = getMerchantChargeSchema(mysqlTable)\n\tconst merchantSessions = getMerchantSessionSchema(mysqlTable)\n\tconst coupons = getCouponSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(purchases, ({ many, one }) => ({\n\t\tredeemedBulkCoupon: one(coupons, {\n\t\t\tfields: [purchases.redeemedBulkCouponId],\n\t\t\treferences: [coupons.id],\n\t\t\trelationName: 'redeemedBulkCoupon',\n\t\t}),\n\t\tuser: one(users, {\n\t\t\tfields: [purchases.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganization: one(organizations, {\n\t\t\tfields: [purchases.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tpurchasedBy: one(organizationMemberships, {\n\t\t\tfields: [purchases.purchasedByorganizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\tproduct: one(products, {\n\t\t\tfields: [purchases.productId],\n\t\t\treferences: [products.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tbulkCoupon: one(coupons, {\n\t\t\tfields: [purchases.bulkCouponId],\n\t\t\treferences: [coupons.id],\n\t\t\trelationName: 'bulkCoupon',\n\t\t}),\n\t\tmerchantCharge: one(merchantCharges, {\n\t\t\tfields: [purchases.merchantChargeId],\n\t\t\treferences: [merchantCharges.id],\n\t\t\trelationName: 'merchantCharge',\n\t\t}),\n\t\tmerchantSession: one(merchantSessions, {\n\t\t\tfields: [purchases.merchantSessionId],\n\t\t\treferences: [merchantSessions.id],\n\t\t\trelationName: 'merchantSession',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getOrganizationMembershipRolesSchema } from './organization-membership-roles.js'\nimport { getOrganizationsSchema } from './organizations.js'\n\nexport function getOrganizationMembershipsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'OrganizationMembership',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\trole: varchar('role', { length: 191 }).notNull().default('user'),\n\t\t\tinvitedById: varchar('invitedById', { length: 255 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(organizationMembership) => ({\n\t\t\troleIdx: index('role_idx').on(organizationMembership.role),\n\t\t\tcreatedAtIdx: index('created_at_idx').on(\n\t\t\t\torganizationMembership.createdAt,\n\t\t\t),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(\n\t\t\t\torganizationMembership.organizationId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationMembershipsRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst organizationMembershipRoles =\n\t\tgetOrganizationMembershipRolesSchema(mysqlTable)\n\n\treturn relations(organizationMemberships, ({ one, many }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [organizationMemberships.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tinvitedBy: one(users, {\n\t\t\tfields: [organizationMemberships.invitedById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'invitedBy',\n\t\t}),\n\t\tpurchases: many(purchases),\n\t\torganization: one(organizations, {\n\t\t\tfields: [organizationMemberships.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\torganizationMembershipRoles: many(organizationMembershipRoles, {\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolesSchema } from '../auth/roles.js'\nimport { getOrganizationMembershipsSchema } from './organization-memberships.js'\nimport { getOrganizationsSchema } from './organizations.js'\n\nexport function getOrganizationMembershipRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'OrganizationMembershipRole',\n\t\t{\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ur) => ({\n\t\t\tpk: primaryKey({\n\t\t\t\tcolumns: [ur.organizationMembershipId, ur.roleId],\n\t\t\t\tname: 'pk',\n\t\t\t}),\n\t\t\torgMemberIdIdx: index('orgMemberId_idx').on(ur.organizationMembershipId),\n\t\t\troleIdIdx: index('roleId_idx').on(ur.roleId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ur.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationMembershipRolesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst organizationMembershipRoles =\n\t\tgetOrganizationMembershipRolesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\treturn relations(organizationMembershipRoles, ({ one }) => ({\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [organizationMembershipRoles.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\trole: one(roles, {\n\t\t\tfields: [organizationMembershipRoles.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t\torganization: one(organizations, {\n\t\t\tfields: [organizationMembershipRoles.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUserRolesSchema } from './user-roles.js'\n\nexport function getRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Role',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(role) => ({\n\t\t\tnameIdx: index('name_idx').on(role.name),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(role.organizationId),\n\t\t\tuniqueNamePerOrg: uniqueIndex('unique_name_per_org').on(\n\t\t\t\trole.organizationId,\n\t\t\t\trole.name,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getRolesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\n\treturn relations(roles, ({ many }) => ({\n\t\tuserRoles: many(userRoles, { relationName: 'role' }),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolesSchema } from './roles.js'\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getUserRolesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserRole',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ur) => ({\n\t\t\tpk: primaryKey({ columns: [ur.userId, ur.roleId] }),\n\t\t\tuserIdIdx: index('userId_idx').on(ur.userId),\n\t\t\troleIdIdx: index('roleId_idx').on(ur.roleId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ur.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserRolesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst userRoles = getUserRolesSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\treturn relations(userRoles, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [userRoles.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\trole: one(roles, {\n\t\t\tfields: [userRoles.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPurchaseSchema } from '../commerce/purchase.js'\nimport { getSubscriptionSchema } from '../commerce/subscription.js'\nimport { getOrganizationMembershipsSchema } from './organization-memberships.js'\n\nexport function getOrganizationsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Organization',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\timage: varchar('image', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(organization) => ({\n\t\t\tcreatedAtIdx: index('created_at_idx').on(organization.createdAt),\n\t\t}),\n\t)\n}\n\nexport function getOrganizationsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst purchases = getPurchaseSchema(mysqlTable)\n\tconst subscriptions = getSubscriptionSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(organizations, ({ many }) => ({\n\t\tpurchases: many(purchases, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tsubscriptions: many(subscriptions, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tmembers: many(organizationMemberships, {\n\t\t\trelationName: 'organization',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getOrganizationsSchema } from '../org/organizations.js'\nimport { getMerchantSubscriptionSchema } from './merchant-subscription.js'\nimport { getProductSchema } from './product.js'\n\n// TODO: do we add a renewal date here? probably just add that stuff to fields\n// \teven status feels out of place at the top level maybe\nexport function getSubscriptionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Subscription',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tmerchantSubscriptionId: varchar('merchantSubscriptionId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: varchar('status', { length: 191 }).default('active').notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tsubscriptionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'Subscription_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getSubscriptionRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst subscriptions = getSubscriptionSchema(mysqlTable)\n\tconst products = getProductSchema(mysqlTable)\n\n\tconst organizations = getOrganizationsSchema(mysqlTable)\n\tconst merchantSubscriptions = getMerchantSubscriptionSchema(mysqlTable)\n\n\treturn relations(subscriptions, ({ many, one }) => ({\n\t\torganization: one(organizations, {\n\t\t\tfields: [subscriptions.organizationId],\n\t\t\treferences: [organizations.id],\n\t\t\trelationName: 'organization',\n\t\t}),\n\t\tproduct: one(products, {\n\t\t\tfields: [subscriptions.productId],\n\t\t\treferences: [products.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tmerchantSubscription: one(merchantSubscriptions, {\n\t\t\tfields: [subscriptions.merchantSubscriptionId],\n\t\t\treferences: [merchantSubscriptions.id],\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantChargeSchema } from './merchant-charge.js'\nimport { getSubscriptionSchema } from './subscription.js'\n\nexport function getMerchantSubscriptionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantSubscription',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tlabel: varchar('label', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tmerchantCustomerId: varchar('merchantCustomerId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantSubscriptionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantSubscription_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getMerchantSubscriptionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst merchantSubscription = getMerchantSubscriptionSchema(mysqlTable)\n\tconst merchantCharge = getMerchantChargeSchema(mysqlTable)\n\tconst subscription = getSubscriptionSchema(mysqlTable)\n\treturn relations(merchantSubscription, ({ many, one }) => ({\n\t\tmerchantCharges: many(merchantCharge, {\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t\tsubscription: one(subscription, {\n\t\t\tfields: [merchantSubscription.id],\n\t\t\treferences: [subscription.merchantSubscriptionId],\n\t\t\trelationName: 'subscription',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantAccountSchema } from './merchant-account.js'\nimport { getMerchantCustomerSchema } from './merchant-customer.js'\nimport { getMerchantProductSchema } from './merchant-product.js'\nimport { getMerchantSubscriptionSchema } from './merchant-subscription.js'\n\nexport function getMerchantChargeSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCharge',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantSubscriptionId: varchar('merchantSubscriptionId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tmerchantCustomerId: varchar('merchantCustomerId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantChargeId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCharge_id',\n\t\t\t\t}),\n\t\t\t\tmerchantChargeIdentifierKey: unique('MerchantCharge_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\tmerchantSubscriptionIdIdx: index('merchantSubscriptionId_idx').on(\n\t\t\t\t\ttable.merchantSubscriptionId,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getMerchantChargeRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst merchantCharge = getMerchantChargeSchema(mysqlTable)\n\tconst merchantAccount = getMerchantAccountSchema(mysqlTable)\n\tconst merchantProduct = getMerchantProductSchema(mysqlTable)\n\tconst merchantCustomer = getMerchantCustomerSchema(mysqlTable)\n\tconst merchantSubscription = getMerchantSubscriptionSchema(mysqlTable)\n\treturn relations(merchantCharge, ({ one }) => ({\n\t\tmerchantAccount: one(merchantAccount, {\n\t\t\tfields: [merchantCharge.merchantAccountId],\n\t\t\treferences: [merchantAccount.id],\n\t\t\trelationName: 'merchantAccount',\n\t\t}),\n\t\tmerchantProduct: one(merchantProduct, {\n\t\t\tfields: [merchantCharge.merchantProductId],\n\t\t\treferences: [merchantProduct.id],\n\t\t\trelationName: 'merchantProduct',\n\t\t}),\n\t\tmerchantCustomer: one(merchantCustomer, {\n\t\t\tfields: [merchantCharge.merchantCustomerId],\n\t\t\treferences: [merchantCustomer.id],\n\t\t\trelationName: 'merchantCustomer',\n\t\t}),\n\t\tmerchantSubscription: one(merchantSubscription, {\n\t\t\tfields: [merchantCharge.merchantSubscriptionId],\n\t\t\treferences: [merchantSubscription.id],\n\t\t\trelationName: 'merchantSubscription',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantAccountSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantAccount',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tlabel: varchar('label', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantAccountId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantAccount_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantCustomerSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCustomer',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tstatus: int('status').default(0),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantCustomerId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCustomer_id',\n\t\t\t\t}),\n\t\t\t\tmerchantCustomerIdentifierKey: unique(\n\t\t\t\t\t'MerchantCustomer_identifier_key',\n\t\t\t\t).on(table.identifier),\n\t\t\t\tuserIdIdx: index('idx_MerchantCustomer_on_userId').on(table.userId),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantProduct',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tproductId: varchar('productId', { length: 191 }).notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantProductId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantProduct_id',\n\t\t\t\t}),\n\t\t\t\tmerchantProductIdentifierKey: unique(\n\t\t\t\t\t'MerchantProduct_identifier_key',\n\t\t\t\t).on(table.identifier),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceProductSchema } from '../content/content-resource-product.js'\nimport { getMerchantProductSchema } from './merchant-product.js'\nimport { getPriceSchema } from './price.js'\n\nexport function getProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Product',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 191 }).notNull(),\n\t\t\tkey: varchar('key', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 191 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tquantityAvailable: int('quantityAvailable').default(-1).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tproductId: primaryKey({ columns: [table.id], name: 'Product_id' }),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getProductRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst price = getPriceSchema(mysqlTable)\n\tconst merchantProduct = getMerchantProductSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\treturn relations(product, ({ one, many }) => ({\n\t\tprice: one(price, {\n\t\t\tfields: [product.id],\n\t\t\treferences: [price.productId],\n\t\t\trelationName: 'price',\n\t\t}),\n\t\tresources: many(contentResourceProduct, { relationName: 'product' }),\n\t\tmerchantProduct: one(merchantProduct, {\n\t\t\tfields: [product.id],\n\t\t\treferences: [merchantProduct.productId],\n\t\t\trelationName: 'merchantProduct',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getProductSchema } from '../commerce/product.js'\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceProductSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceProduct',\n\t\t{\n\t\t\tproductId: varchar('productId', { length: 255 }).notNull(),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.productId, crr.resourceId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crr.productId),\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crr.resourceId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceProductRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\tconst product = getProductSchema(mysqlTable)\n\treturn relations(contentResourceProduct, ({ one }) => ({\n\t\tproduct: one(product, {\n\t\t\tfields: [contentResourceProduct.productId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceProduct.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resource',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getContentContributionsSchema } from './content-contributions.js'\nimport { getContentResourceProductSchema } from './content-resource-product.js'\nimport { getContentResourceResourceSchema } from './content-resource-resource.js'\nimport { getContentResourceTagSchema } from './content-resource-tag.js'\nimport { getContentResourceVersionSchema } from './content-resource-version.js'\nimport { getTagSchema } from './tag.js'\n\nexport function getContentResourceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResource',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedByOrganizationMembershipId: varchar(\n\t\t\t\t'createdByOrganizationMembershipId',\n\t\t\t\t{\n\t\t\t\t\tlength: 191,\n\t\t\t\t},\n\t\t\t),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tcreatedById: varchar('createdById', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\t// Generated column for indexing JSON slug field\n\t\t\tslug: varchar('slug', { length: 255 }).generatedAlwaysAs(\n\t\t\t\tsql`(fields->>'$.slug')`,\n\t\t\t\t{ mode: 'stored' },\n\t\t\t),\n\t\t\tcurrentVersionId: varchar('currentVersionId', { length: 255 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cm) => ({\n\t\t\ttypeIdx: index('type_idx').on(cm.type),\n\t\t\tcreatedByIdx: index('createdById_idx').on(cm.createdById),\n\t\t\tcreatedAtIdx: index('createdAt_idx').on(cm.createdAt),\n\t\t\tcurrentVersionIdIdx: index('currentVersionId_idx').on(\n\t\t\t\tcm.currentVersionId,\n\t\t\t),\n\t\t\tcreatedByOrganizationMembershipIdIdx: index(\n\t\t\t\t'createdByOrganizationMembershipId_idx',\n\t\t\t).on(cm.createdByOrganizationMembershipId),\n\t\t\tslugIdx: index('slug_idx').on(cm.slug),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst contentResourceResource = getContentResourceResourceSchema(mysqlTable)\n\tconst contentResourceProduct = getContentResourceProductSchema(mysqlTable)\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\tconst contentResourceVersion = getContentResourceVersionSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\tconst tag = getTagSchema(mysqlTable)\n\treturn relations(contentResource, ({ one, many }) => ({\n\t\tcreatedBy: one(users, {\n\t\t\tfields: [contentResource.createdById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'creator',\n\t\t}),\n\t\tcreatedByOrganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [contentResource.createdByOrganizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'createdByOrganizationMembership',\n\t\t}),\n\t\ttags: many(contentResourceTag, { relationName: 'contentResource' }),\n\t\tresources: many(contentResourceResource, { relationName: 'resourceOf' }),\n\t\tresourceOf: many(contentResourceResource, { relationName: 'resource' }),\n\t\tresourceProducts: many(contentResourceProduct, {\n\t\t\trelationName: 'resource',\n\t\t}),\n\t\tcontributions: many(contentContributions, {\n\t\t\trelationName: 'contributions',\n\t\t}),\n\t\tcurrentVersion: one(contentResourceVersion, {\n\t\t\tfields: [contentResource.currentVersionId],\n\t\t\treferences: [contentResourceVersion.id],\n\t\t\trelationName: 'currentVersionResource',\n\t\t}),\n\t\tversions: many(contentResourceVersion, { relationName: 'resource' }),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getContentResourceSchema } from './content-resource.js'\nimport { getContributionTypesSchema } from './contribution-types.js'\n\nexport function getContentContributionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentContribution',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tcontentId: varchar('contentId', { length: 255 }).notNull(),\n\t\t\tcontributionTypeId: varchar('contributionTypeId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cc) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(cc.userId),\n\t\t\tcontentIdIdx: index('contentId_idx').on(cc.contentId),\n\t\t\tcontributionTypeIdIdx: index('contributionTypeId_idx').on(\n\t\t\t\tcc.contributionTypeId,\n\t\t\t),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcc.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getContentContributionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst contentContributions = getContentContributionsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contributionTypes = getContributionTypesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(contentContributions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [contentContributions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tcontent: one(contentResource, {\n\t\t\tfields: [contentContributions.contentId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'contributions',\n\t\t}),\n\t\tcontributionType: one(contributionTypes, {\n\t\t\tfields: [contentContributions.contributionTypeId],\n\t\t\treferences: [contributionTypes.id],\n\t\t\trelationName: 'contributionType',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [contentContributions.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentContributionsSchema } from './content-contributions.js'\n\nexport function getContributionTypesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContributionType',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tslug: varchar('slug', { length: 255 }).notNull().unique(),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(ct) => ({\n\t\t\tnameIdx: index('name_idx').on(ct.name),\n\t\t\tslugIdx: index('slug_idx').on(ct.slug),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(ct.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContributionTypesRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst contributionTypes = getContributionTypesSchema(mysqlTable)\n\n\treturn relations(contributionTypes, ({ many }) => ({}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceResourceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceResource',\n\t\t{\n\t\t\tresourceOfId: varchar('resourceOfId', { length: 255 }).notNull(),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.resourceOfId, crr.resourceId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crr.resourceOfId),\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crr.resourceId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceResourceRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst contentResourceResource = getContentResourceResourceSchema(mysqlTable)\n\treturn relations(contentResourceResource, ({ one }) => ({\n\t\tresourceOf: one(contentResource, {\n\t\t\tfields: [contentResourceResource.resourceOfId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resourceOf',\n\t\t}),\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceResource.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'resource',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceSchema } from './content-resource.js'\nimport { getTagSchema } from './tag.js'\n\nexport function getContentResourceTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceTag',\n\t\t{\n\t\t\tcontentResourceId: varchar('contentResourceId', {\n\t\t\t\tlength: 255,\n\t\t\t}).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttagId: varchar('tagId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(crt) => ({\n\t\t\tpk: primaryKey({ columns: [crt.contentResourceId, crt.tagId] }),\n\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(\n\t\t\t\tcrt.contentResourceId,\n\t\t\t),\n\t\t\ttagIdIdx: index('tagId_idx').on(crt.tagId),\n\t\t\tpositionIdx: index('position_idx').on(crt.position),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crt.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst tag = getTagSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\treturn relations(contentResourceTag, ({ one }) => ({\n\t\tcontentResource: one(contentResource, {\n\t\t\tfields: [contentResourceTag.contentResourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'contentResource',\n\t\t}),\n\t\ttag: one(tag, {\n\t\t\tfields: [contentResourceTag.tagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'tag',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getContentResourceTagSchema } from './content-resource-tag.js'\nimport { getTagTagSchema } from './tag-tag.js'\n\nexport function getTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Tag',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(t) => ({\n\t\t\ttypeIdx: index('type_idx').on(t.type),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(t.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst tag = getTagSchema(mysqlTable)\n\tconst contentResourceTag = getContentResourceTagSchema(mysqlTable)\n\tconst tagTag = getTagTagSchema(mysqlTable)\n\treturn relations(tag, ({ many }) => ({\n\t\tresources: many(contentResourceTag, { relationName: 'contentResource' }),\n\t\tparentTags: many(tagTag, { relationName: 'childTag' }),\n\t\tchildTags: many(tagTag, { relationName: 'parentTag' }),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getTagSchema } from './tag.js'\n\nexport function getTagTagSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'TagTag',\n\t\t{\n\t\t\tparentTagId: varchar('parentTagId', { length: 255 }).notNull(),\n\t\t\tchildTagId: varchar('childTagId', { length: 255 }).notNull(),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(tt) => ({\n\t\t\tpk: primaryKey({ columns: [tt.parentTagId, tt.childTagId] }),\n\t\t\tparentTagIdIdx: index('parentTagId_idx').on(tt.parentTagId),\n\t\t\tchildTagIdIdx: index('childTagId_idx').on(tt.childTagId),\n\t\t\tpositionIdx: index('position_idx').on(tt.position),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(tt.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getTagTagRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst tag = getTagSchema(mysqlTable)\n\tconst tagTag = getTagTagSchema(mysqlTable)\n\treturn relations(tagTag, ({ one }) => ({\n\t\tparentTag: one(tag, {\n\t\t\tfields: [tagTag.parentTagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'parentTag',\n\t\t}),\n\t\tchildTag: one(tag, {\n\t\t\tfields: [tagTag.childTagId],\n\t\t\treferences: [tag.id],\n\t\t\trelationName: 'childTag',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getContentResourceSchema } from './content-resource.js'\n\nexport function getContentResourceVersionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ContentResourceVersion',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }).notNull(),\n\t\t\tparentVersionId: varchar('parentVersionId', { length: 255 }),\n\t\t\tversionNumber: int('versionNumber').notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tcreatedById: varchar('createdById', { length: 255 }).notNull(),\n\t\t},\n\t\t(crv) => ({\n\t\t\tresourceIdIdx: index('resourceId_idx').on(crv.resourceId),\n\t\t\tparentVersionIdIdx: index('parentVersionId_idx').on(crv.parentVersionId),\n\t\t\tresourceIdVersionNumberIdx: index('resourceId_versionNumber_idx').on(\n\t\t\t\tcrv.resourceId,\n\t\t\t\tcrv.versionNumber,\n\t\t\t),\n\t\t\tuniqueResourceVersion: unique('uq_resource_version_number').on(\n\t\t\t\tcrv.resourceId,\n\t\t\t\tcrv.versionNumber,\n\t\t\t),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crv.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getContentResourceVersionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst contentResourceVersion = getContentResourceVersionSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\n\treturn relations(contentResourceVersion, ({ one }) => ({\n\t\tresource: one(contentResource, {\n\t\t\tfields: [contentResourceVersion.resourceId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'versions',\n\t\t}),\n\t\tparentVersion: one(contentResourceVersion, {\n\t\t\tfields: [contentResourceVersion.parentVersionId],\n\t\t\treferences: [contentResourceVersion.id],\n\t\t\trelationName: 'childVersions',\n\t\t}),\n\t\tcreatedBy: one(users, {\n\t\t\tfields: [contentResourceVersion.createdById],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'createdVersions',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdecimal,\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantPriceSchema } from './merchant-price.js'\nimport { getProductSchema } from './product.js'\n\nexport function getPriceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Price',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tproductId: varchar('productId', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tnickname: varchar('nickname', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tunitAmount: decimal('unitAmount', { precision: 10, scale: 2 }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpriceId: primaryKey({ columns: [table.id], name: 'Price_id' }),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getProductRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst price = getPriceSchema(mysqlTable)\n\tconst merchantPrice = getMerchantPriceSchema(mysqlTable)\n\treturn relations(price, ({ one, many }) => ({\n\t\tproduct: one(product, {\n\t\t\tfields: [price.productId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tmerchantPrice: one(merchantPrice, {\n\t\t\tfields: [price.id],\n\t\t\treferences: [merchantPrice.priceId],\n\t\t\trelationName: 'merchantPrice',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantPriceSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantPrice',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tmerchantProductId: varchar('merchantProductId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tstatus: int('status').default(0),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tpriceId: varchar('priceId', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantPriceId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantPrice_id',\n\t\t\t\t}),\n\t\t\t\tmerchantPriceIdentifierKey: unique('MerchantPrice_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tboolean,\n\tdecimal,\n\tindex,\n\tint,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantCouponSchema } from './merchant-coupon.js'\nimport { getProductSchema } from './product.js'\nimport { getPurchaseSchema } from './purchase.js'\n\nexport function getCouponSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Coupon',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tcode: varchar('code', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date', fsp: 3 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tmaxUses: int('maxUses').default(-1).notNull(),\n\t\t\tdefault: boolean('default').default(false).notNull(),\n\t\t\tmerchantCouponId: varchar('merchantCouponId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tusedCount: int('usedCount').default(0).notNull(),\n\t\t\tpercentageDiscount: decimal('percentageDiscount', {\n\t\t\t\tprecision: 3,\n\t\t\t\tscale: 2,\n\t\t\t}),\n\t\t\tamountDiscount: int('amountDiscount'),\n\t\t\trestrictedToProductId: varchar('restrictedToProductId', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tcouponIdCodeIndex: index('Coupon_id_code_index').on(\n\t\t\t\t\ttable.id,\n\t\t\t\t\ttable.code,\n\t\t\t\t),\n\t\t\t\tcouponId: primaryKey({ columns: [table.id], name: 'Coupon_id' }),\n\t\t\t\tcouponCodeKey: unique('Coupon_code_key').on(table.code),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getCouponRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst purchase = getPurchaseSchema(mysqlTable)\n\tconst coupon = getCouponSchema(mysqlTable)\n\tconst merchantCoupon = getMerchantCouponSchema(mysqlTable)\n\treturn relations(coupon, ({ many, one }) => ({\n\t\tredeemedBulkCouponPurchases: many(purchase, {\n\t\t\trelationName: 'redeemedBulkCoupon',\n\t\t}),\n\t\tmerchantCoupon: one(merchantCoupon, {\n\t\t\tfields: [coupon.merchantCouponId],\n\t\t\treferences: [merchantCoupon.id],\n\t\t\trelationName: 'merchantCoupon',\n\t\t}),\n\t\tproduct: one(getProductSchema(mysqlTable), {\n\t\t\tfields: [coupon.restrictedToProductId],\n\t\t\treferences: [getProductSchema(mysqlTable).id],\n\t\t\trelationName: 'product',\n\t\t}),\n\t\tbulkPurchases: many(purchase, {\n\t\t\trelationName: 'bulkCoupon',\n\t\t}),\n\t}))\n}\n","import {\n\tdecimal,\n\tindex,\n\tint,\n\tMySqlTableFn,\n\tprimaryKey,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantCouponSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantCoupon',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tstatus: int('status').default(0).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tpercentageDiscount: decimal('percentageDiscount', {\n\t\t\t\tprecision: 3,\n\t\t\t\tscale: 2,\n\t\t\t}),\n\t\t\tamountDiscount: int('amountDiscount'),\n\t\t\ttype: varchar('type', { length: 191 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantCouponId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantCoupon_id',\n\t\t\t\t}),\n\t\t\t\tmerchantCouponIdentifierKey: unique('MerchantCoupon_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import {\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getMerchantSessionSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantSession',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantSessionId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantSession_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\n\nexport function getCommentsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Comment',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tcontext: json('context').$type<Record<string, any>>().default({}),\n\t\t\ttext: text('text').notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.id] }),\n\t\t\tcrrUserIdIdKey: index('crr_userIdId_idx').on(crr.userId),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcrr.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getCommentRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst comment = getCommentsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst user = resolveUsersSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(comment, ({ one }) => ({\n\t\tuser: one(user, {\n\t\t\tfields: [comment.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [comment.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tmysqlEnum,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getCommunicationChannelSchema } from './communication-channel.js'\nimport { getCommunicationPreferenceTypesSchema } from './communication-preference-types.js'\n\nexport function getCommunicationPreferencesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'CommunicationPreference',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 255,\n\t\t\t}),\n\t\t\tchannelId: varchar('channelId', { length: 255 }).notNull(),\n\t\t\tpreferenceLevel: mysqlEnum('preferenceLevel', ['low', 'medium', 'high'])\n\t\t\t\t.notNull()\n\t\t\t\t.default('medium'),\n\t\t\tpreferenceTypeId: varchar('preferenceTypeId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\toptInAt: timestamp('optInAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\toptOutAt: timestamp('optOutAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cp) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(cp.userId),\n\t\t\tpreferenceTypeIdx: index('preferenceTypeId_idx').on(cp.preferenceTypeId),\n\t\t\tchannelIdIdx: index('channelId_idx').on(cp.channelId),\n\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\tcp.organizationMembershipId,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getCommunicationPreferencesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst communicationPreferences = getCommunicationPreferencesSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst communicationChannel = getCommunicationChannelSchema(mysqlTable)\n\tconst communicationPreferenceTypes =\n\t\tgetCommunicationPreferenceTypesSchema(mysqlTable)\n\tconst organizationMemberships = getOrganizationMembershipsSchema(mysqlTable)\n\treturn relations(communicationPreferences, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [communicationPreferences.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\torganizationMembership: one(organizationMemberships, {\n\t\t\tfields: [communicationPreferences.organizationMembershipId],\n\t\t\treferences: [organizationMemberships.id],\n\t\t\trelationName: 'organizationMembership',\n\t\t}),\n\t\tchannel: one(communicationChannel, {\n\t\t\tfields: [communicationPreferences.channelId],\n\t\t\treferences: [communicationChannel.id],\n\t\t\trelationName: 'channel',\n\t\t}),\n\t\tpreferenceType: one(communicationPreferenceTypes, {\n\t\t\tfields: [communicationPreferences.preferenceTypeId],\n\t\t\treferences: [communicationPreferenceTypes.id],\n\t\t\trelationName: 'preferenceType',\n\t\t}),\n\t}))\n}\n","import {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getCommunicationChannelSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'CommunicationChannel',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(cc) => ({\n\t\t\tnameIdx: index('name_idx').on(cc.name),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(cc.organizationId),\n\t\t}),\n\t)\n}\n","import {\n\tboolean,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getCommunicationPreferenceTypesSchema(\n\tmysqlTable: MySqlTableFn,\n) {\n\treturn mysqlTable('CommunicationPreferenceType', {\n\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\tdescription: text('description'),\n\t\tactive: boolean('active').notNull().default(true),\n\t\tcreatedAt: timestamp('createdAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}).defaultNow(),\n\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}),\n\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\tmode: 'date',\n\t\t\tfsp: 3,\n\t\t}),\n\t})\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getProfilesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Profile',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\ttype: varchar('type', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(profile) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(profile.userId),\n\t\t\tuniqueUserType: uniqueIndex('unique_user_type_idx').on(\n\t\t\t\tprofile.userId,\n\t\t\t\tprofile.type,\n\t\t\t),\n\t\t}),\n\t)\n}\n\nexport function getProfilesRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst profiles = getProfilesSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\treturn relations(profiles, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [profiles.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'profiles',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPermissionsSchema } from './permissions.js'\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getUserPermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserPermission',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tpermissionId: varchar('permissionId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(up) => ({\n\t\t\tpk: primaryKey({ columns: [up.userId, up.permissionId] }),\n\t\t\tuserIdIdx: index('userId_idx').on(up.userId),\n\t\t\tpermissionIdIdx: index('permissionId_idx').on(up.permissionId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(up.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserPermissionsRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst userPermissions = getUserPermissionsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst permissions = getPermissionsSchema(mysqlTable)\n\treturn relations(userPermissions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [userPermissions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t\tpermission: one(permissions, {\n\t\t\tfields: [userPermissions.permissionId],\n\t\t\treferences: [permissions.id],\n\t\t\trelationName: 'permission',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getRolePermissionsSchema } from './role-permissions.js'\n\nexport function getPermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Permission',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }).notNull().unique(),\n\t\t\tdescription: text('description'),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(permission) => ({\n\t\t\tnameIdx: index('name_idx').on(permission.name),\n\t\t}),\n\t)\n}\n\nexport function getPermissionsRelationsSchema(mysqlTable: MySqlTableFn) {\n\treturn relations(getPermissionsSchema(mysqlTable), ({ many }) => ({}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\n\nexport function getUserPrefsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UserPrefs',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\ttype: varchar('type', { length: 191 }).default('Global').notNull(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.id] }),\n\t\t\tcrrUserIdIdKey: index('crr_userIdId_idx').on(crr.userId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUserPrefsRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst userPrefs = getUserPrefsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst user = resolveUsersSchema(mysqlTable)\n\treturn relations(userPrefs, ({ one }) => ({\n\t\tuser: one(user, {\n\t\t\tfields: [userPrefs.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getDeviceAccessTokenSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'DeviceAccessToken',\n\t\t{\n\t\t\ttoken: varchar('token', { length: 191 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.token] }),\n\t\t\tuserIdIdx: index('userId_idx').on(crr.userId),\n\t\t}),\n\t)\n}\n\nexport function getDeviceAccessTokenRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst deviceAccessToken = getDeviceAccessTokenSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst user = resolveUsersSchema(mysqlTable)\n\treturn relations(deviceAccessToken, ({ one }) => ({\n\t\tverifiedBy: one(user, {\n\t\t\tfields: [deviceAccessToken.userId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tMySqlTableFn,\n\tprimaryKey,\n\ttext,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getDeviceVerificationSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'DeviceVerification',\n\t\t{\n\t\t\tverifiedByUserId: varchar('verifiedByUserId', { length: 255 }),\n\t\t\tdeviceCode: varchar('deviceCode', { length: 191 }).notNull(),\n\t\t\tuserCode: text('userCode').notNull(),\n\t\t\texpires: timestamp('expires', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tverifiedAt: timestamp('verifiedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.deviceCode] }),\n\t\t}),\n\t)\n}\n\nexport function getDeviceVerificationRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst deviceVerification = getDeviceVerificationSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst user = resolveUsersSchema(mysqlTable)\n\treturn relations(deviceVerification, ({ one }) => ({\n\t\tverifiedBy: one(user, {\n\t\t\tfields: [deviceVerification.verifiedByUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getPermissionsSchema } from './permissions.js'\nimport { getRolesSchema } from './roles.js'\n\nexport function getRolePermissionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'RolePermission',\n\t\t{\n\t\t\troleId: varchar('roleId', { length: 255 }).notNull(),\n\t\t\tpermissionId: varchar('permissionId', { length: 255 }).notNull(),\n\t\t\tactive: boolean('active').notNull().default(true),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(rp) => ({\n\t\t\tpk: primaryKey({ columns: [rp.roleId, rp.permissionId] }),\n\t\t\troleIdIdx: index('roleId_idx').on(rp.roleId),\n\t\t\tpermissionIdIdx: index('permissionId_idx').on(rp.permissionId),\n\t\t}),\n\t)\n}\n\nexport function getRolePermissionsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst permissions = getPermissionsSchema(mysqlTable)\n\tconst roles = getRolesSchema(mysqlTable)\n\tconst rolePermissions = getRolePermissionsSchema(mysqlTable)\n\treturn relations(rolePermissions, ({ one }) => ({\n\t\trole: one(roles, {\n\t\t\tfields: [rolePermissions.roleId],\n\t\t\treferences: [roles.id],\n\t\t\trelationName: 'role',\n\t\t}),\n\t\tpermission: one(permissions, {\n\t\t\tfields: [rolePermissions.permissionId],\n\t\t\treferences: [permissions.id],\n\t\t\trelationName: 'permission',\n\t\t}),\n\t}))\n}\n","import { relations } from 'drizzle-orm'\nimport { index, MySqlTableFn, timestamp, varchar } from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from './users.js'\n\nexport function getSessionsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Session',\n\t\t{\n\t\t\tsessionToken: varchar('sessionToken', { length: 255 })\n\t\t\t\t.notNull()\n\t\t\t\t.primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date' }).notNull(),\n\t\t},\n\t\t(session) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(session.userId),\n\t\t}),\n\t)\n}\n\nexport function getSessionRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst sessions = getSessionsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\treturn relations(sessions, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [sessions.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'user',\n\t\t}),\n\t}))\n}\n","import {\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getVerificationTokensSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'VerificationToken',\n\t\t{\n\t\t\tidentifier: varchar('identifier', { length: 255 }).notNull(),\n\t\t\ttoken: varchar('token', { length: 255 }).notNull(),\n\t\t\texpires: timestamp('expires', { mode: 'date' }).notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).defaultNow(),\n\t\t},\n\t\t(vt) => ({\n\t\t\tpk: primaryKey({ columns: [vt.identifier, vt.token] }),\n\t\t}),\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tunique,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getMerchantAccountSchema } from './merchant-account.js'\n\n/**\n * MerchantEvents table for tracking webhook events from payment providers\n * This provides an audit trail of what webhooks we received, regardless of\n * whether Inngest successfully processed them or not.\n */\nexport function getMerchantEventsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'MerchantEvents',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\tmerchantAccountId: varchar('merchantAccountId', {\n\t\t\t\tlength: 191,\n\t\t\t}).notNull(),\n\t\t\tidentifier: varchar('identifier', { length: 191 }).notNull(),\n\t\t\tpayload: json('payload').notNull(),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tmerchantEventsId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'MerchantEvents_id',\n\t\t\t\t}),\n\t\t\t\tmerchantEventsIdentifierKey: unique('MerchantEvents_identifier_key').on(\n\t\t\t\t\ttable.identifier,\n\t\t\t\t),\n\t\t\t\tmerchantAccountIdIdx: index('merchantAccountId_idx').on(\n\t\t\t\t\ttable.merchantAccountId,\n\t\t\t\t),\n\t\t\t\tcreatedAtIdx: index('createdAt_idx').on(table.createdAt),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getMerchantEventsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst merchantEvents = getMerchantEventsSchema(mysqlTable)\n\tconst merchantAccount = getMerchantAccountSchema(mysqlTable)\n\n\treturn relations(merchantEvents, ({ one }) => ({\n\t\tmerchantAccount: one(merchantAccount, {\n\t\t\tfields: [merchantEvents.merchantAccountId],\n\t\t\treferences: [merchantAccount.id],\n\t\t\trelationName: 'merchantAccount',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tmysqlEnum,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getPurchaseSchema } from './purchase.js'\n\nexport function getPurchaseUserTransferSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'PurchaseUserTransfer',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull(),\n\t\t\ttransferState: mysqlEnum('transferState', [\n\t\t\t\t'AVAILABLE',\n\t\t\t\t'INITIATED',\n\t\t\t\t'VERIFIED',\n\t\t\t\t'CANCELED',\n\t\t\t\t'EXPIRED',\n\t\t\t\t'CONFIRMED',\n\t\t\t\t'COMPLETED',\n\t\t\t])\n\t\t\t\t.default('AVAILABLE')\n\t\t\t\t.notNull(),\n\t\t\tpurchaseId: varchar('purchaseId', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tsourceUserId: varchar('sourceUserId', { length: 191 }).notNull(),\n\t\t\ttargetUserId: varchar('targetUserId', { length: 191 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\texpiresAt: timestamp('expiresAt', { mode: 'date', fsp: 3 }),\n\t\t\tcanceledAt: timestamp('canceledAt', { mode: 'date', fsp: 3 }),\n\t\t\tconfirmedAt: timestamp('confirmedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcompletedAt: timestamp('completedAt', { mode: 'date', fsp: 3 }),\n\t\t},\n\t\t(table) => {\n\t\t\treturn {\n\t\t\t\tpurchaseUserTransferId: primaryKey({\n\t\t\t\t\tcolumns: [table.id],\n\t\t\t\t\tname: 'PurchaseUserTransfer_id',\n\t\t\t\t}),\n\t\t\t\torganizationIdIdx: index('organizationId_idx').on(table.organizationId),\n\t\t\t}\n\t\t},\n\t)\n}\n\nexport function getPurchaseUserTransferRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst purchaseUserTransfer = getPurchaseUserTransferSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst user = resolveUsersSchema(mysqlTable)\n\tconst purchase = getPurchaseSchema(mysqlTable)\n\treturn relations(purchaseUserTransfer, ({ one }) => ({\n\t\tsourceUser: one(user, {\n\t\t\tfields: [purchaseUserTransfer.sourceUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'sourceUser',\n\t\t}),\n\t\ttargetUser: one(user, {\n\t\t\tfields: [purchaseUserTransfer.targetUserId],\n\t\t\treferences: [user.id],\n\t\t\trelationName: 'targetUser',\n\t\t}),\n\t\tpurchase: one(purchase, {\n\t\t\tfields: [purchaseUserTransfer.purchaseId],\n\t\t\treferences: [purchase.id],\n\t\t\trelationName: 'purchase',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tdouble,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getProductSchema } from './product.js'\n\nexport function getUpgradableProductsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'UpgradableProducts',\n\t\t{\n\t\t\tupgradableToId: varchar('upgradableToId', { length: 255 }).notNull(),\n\t\t\tupgradableFromId: varchar('upgradableFrom', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\tposition: double('position').notNull().default(0),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(crr) => ({\n\t\t\tpk: primaryKey({ columns: [crr.upgradableToId, crr.upgradableFromId] }),\n\t\t\tupgradableToIdIdx: index('upgradableFromId_idx').on(crr.upgradableToId),\n\t\t\tupgradableFromIdIdx: index('upgradableToId_idx').on(crr.upgradableFromId),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(crr.organizationId),\n\t\t}),\n\t)\n}\n\nexport function getUpgradableProductsRelationsSchema(mysqlTable: MySqlTableFn) {\n\tconst product = getProductSchema(mysqlTable)\n\tconst upgradableProduct = getUpgradableProductsSchema(mysqlTable)\n\treturn relations(upgradableProduct, ({ one }) => ({\n\t\tupgradableTo: one(product, {\n\t\t\tfields: [upgradableProduct.upgradableToId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'upgradableTo',\n\t\t}),\n\t\tupgradableFrom: one(product, {\n\t\t\tfields: [upgradableProduct.upgradableFromId],\n\t\t\treferences: [product.id],\n\t\t\trelationName: 'upgradableFrom',\n\t\t}),\n\t}))\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getContentResourceSchema } from '../content/content-resource.js'\n\n/**\n * Question response table - stores individual question responses\n * Supports surveys, quizzes, polls, and other question-based interactions\n * Works for both authenticated users and anonymous email subscribers\n */\nexport function getQuestionResponseSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'QuestionResponse',\n\t\t{\n\t\t\tid: varchar('id', { length: 255 }).notNull().primaryKey(),\n\t\t\tsurveyId: varchar('surveyId', { length: 255 }).notNull(),\n\t\t\tquestionId: varchar('questionId', { length: 255 }).notNull(),\n\t\t\trespondentKey: varchar('respondentKey', { length: 255 }),\n\t\t\tsurveySessionId: varchar('surveySessionId', { length: 255 }),\n\t\t\tuserId: varchar('userId', { length: 255 }),\n\t\t\temailListSubscriberId: varchar('emailListSubscriberId', { length: 255 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcreatedAt: timestamp('createdAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tupdatedAt: timestamp('updatedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}).default(sql`CURRENT_TIMESTAMP(3)`),\n\t\t\tdeletedAt: timestamp('deletedAt', {\n\t\t\t\tmode: 'date',\n\t\t\t\tfsp: 3,\n\t\t\t}),\n\t\t},\n\t\t(qr) => ({\n\t\t\tsurveyIdIdx: index('surveyId_idx').on(qr.surveyId),\n\t\t\tquestionIdIdx: index('questionId_idx').on(qr.questionId),\n\t\t\trespondentKeyIdx: index('respondent_key_idx').on(qr.respondentKey),\n\t\t\tsurveySessionIdIdx: index('survey_session_id_idx').on(qr.surveySessionId),\n\t\t\tuserIdIdx: index('userId_idx').on(qr.userId),\n\t\t\temailListSubscriberIdIdx: index('emailListSubscriberId_idx').on(\n\t\t\t\tqr.emailListSubscriberId,\n\t\t\t),\n\t\t\tsurveySubscriberIdx: index('survey_subscriber_idx').on(\n\t\t\t\tqr.surveyId,\n\t\t\t\tqr.emailListSubscriberId,\n\t\t\t),\n\t\t\tsurveyQuestionRespondentIdx: uniqueIndex(\n\t\t\t\t'survey_question_respondent_unique',\n\t\t\t).on(qr.surveyId, qr.questionId, qr.respondentKey),\n\t\t}),\n\t)\n}\n\nexport function getQuestionResponseRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst questionResponse = getQuestionResponseSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst contentResource = getContentResourceSchema(mysqlTable)\n\n\treturn relations(questionResponse, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [questionResponse.userId],\n\t\t\treferences: [users.id],\n\t\t\trelationName: 'questionResponseUser',\n\t\t}),\n\t\tsurvey: one(contentResource, {\n\t\t\tfields: [questionResponse.surveyId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'questionResponseSurvey',\n\t\t}),\n\t\tquestion: one(contentResource, {\n\t\t\tfields: [questionResponse.questionId],\n\t\t\treferences: [contentResource.id],\n\t\t\trelationName: 'questionResponseQuestion',\n\t\t}),\n\t}))\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tdatetime,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getLessonProgressSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'LessonProgress',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tuserId: varchar('userId', { length: 191 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tlessonId: varchar('lessonId', { length: 191 }),\n\t\t\tlessonSlug: varchar('lessonSlug', { length: 191 }),\n\t\t\tlessonVersion: varchar('lessonVersion', { length: 191 }),\n\t\t\tsectionId: varchar('sectionId', { length: 191 }),\n\t\t\tmoduleId: varchar('moduleId', { length: 191 }),\n\t\t\tcompletedAt: datetime('completedAt', { mode: 'date', fsp: 3 }),\n\t\t\tupdatedAt: datetime('updatedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: datetime('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(crp) => {\n\t\t\treturn {\n\t\t\t\tuserIdLessonIdIdx: index('crp_userId_contentResourceId_idx').on(\n\t\t\t\t\tcrp.userId,\n\t\t\t\t\tcrp.lessonId,\n\t\t\t\t),\n\t\t\t\tuserIdIdx: index('userId_idx').on(crp.userId),\n\t\t\t\tlessonIdIdx: index('lessonId_idx').on(crp.lessonId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\tcrp.organizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n","import { sql } from 'drizzle-orm'\nimport {\n\tdatetime,\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\tprimaryKey,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getResourceProgressSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'ResourceProgress',\n\t\t{\n\t\t\tuserId: varchar('userId', { length: 255 }).notNull(),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tresourceId: varchar('resourceId', { length: 255 }),\n\t\t\tfields: json('fields').$type<Record<string, any>>().default({}),\n\t\t\tcompletedAt: datetime('completedAt', { mode: 'date', fsp: 3 }),\n\t\t\tupdatedAt: datetime('updatedAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: datetime('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t},\n\t\t(crp) => {\n\t\t\treturn {\n\t\t\t\tuserIdLessonIdIdx: index('crp_userId_contentResourceId_idx').on(\n\t\t\t\t\tcrp.userId,\n\t\t\t\t\tcrp.resourceId,\n\t\t\t\t),\n\t\t\t\tpk: primaryKey({ columns: [crp.userId, crp.resourceId] }),\n\t\t\t\tcontentResourceIdIdx: index('contentResourceId_idx').on(crp.resourceId),\n\t\t\t\tuserIdIdx: index('resourceId_idx').on(crp.userId),\n\t\t\t\torganizationMembershipIdIdx: index('organizationMembershipId_idx').on(\n\t\t\t\t\tcrp.organizationMembershipId,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t)\n}\n","import {\n\tMySqlTableFn,\n\ttext,\n\tuniqueIndex,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nexport function getEntitlementTypesSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'EntitlementType',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tname: varchar('name', { length: 255 }).notNull(),\n\t\t\tdescription: text('description'),\n\t\t\t// Add any type-specific config fields here\n\t\t},\n\t\t(table) => ({\n\t\t\tuniqueName: uniqueIndex('unique_name_idx').on(table.name),\n\t\t}),\n\t)\n}\n","import { relations, sql } from 'drizzle-orm'\nimport {\n\tindex,\n\tjson,\n\tMySqlTableFn,\n\ttimestamp,\n\tvarchar,\n} from 'drizzle-orm/mysql-core'\n\nimport { getUsersSchema, type UsersSchemaOverrides } from '../auth/users.js'\nimport { getOrganizationMembershipsSchema } from '../org/organization-memberships.js'\nimport { getOrganizationsSchema } from '../org/organizations.js'\n\nexport function getEntitlementsSchema(mysqlTable: MySqlTableFn) {\n\treturn mysqlTable(\n\t\t'Entitlement',\n\t\t{\n\t\t\tid: varchar('id', { length: 191 }).notNull().primaryKey(),\n\t\t\tentitlementType: varchar('entitlementType', { length: 255 }).notNull(),\n\t\t\tuserId: varchar('userId', { length: 191 }),\n\t\t\torganizationId: varchar('organizationId', { length: 191 }),\n\t\t\torganizationMembershipId: varchar('organizationMembershipId', {\n\t\t\t\tlength: 191,\n\t\t\t}),\n\t\t\tsourceType: varchar('sourceType', { length: 255 }).notNull(), // 'PURCHASE' | 'SUBSCRIPTION' | 'MANUAL' etc\n\t\t\tsourceId: varchar('sourceId', { length: 191 }).notNull(),\n\t\t\tmetadata: json('metadata').$type<Record<string, any>>().default({}),\n\t\t\texpiresAt: timestamp('expiresAt', { mode: 'date', fsp: 3 }),\n\t\t\tcreatedAt: timestamp('createdAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tupdatedAt: timestamp('updatedAt', { mode: 'date', fsp: 3 })\n\t\t\t\t.default(sql`CURRENT_TIMESTAMP(3)`)\n\t\t\t\t.notNull(),\n\t\t\tdeletedAt: timestamp('deletedAt', { mode: 'date', fsp: 3 }),\n\t\t},\n\t\t(table) => ({\n\t\t\tuserIdIdx: index('userId_idx').on(table.userId),\n\t\t\torgIdIdx: index('orgId_idx').on(table.organizationId),\n\t\t\tsourceIdx: index('source_idx').on(table.sourceType, table.sourceId),\n\t\t\ttypeIdx: index('type_idx').on(table.entitlementType),\n\t\t}),\n\t)\n}\n\nexport function getEntitlementRelationsSchema(\n\tmysqlTable: MySqlTableFn,\n\toverrides: UsersSchemaOverrides = {},\n) {\n\tconst entitlements = getEntitlementsSchema(mysqlTable)\n\tconst resolveUsersSchema = overrides.getUsersSchema ?? getUsersSchema\n\tconst users = resolveUsersSchema(mysqlTable)\n\tconst orgs = getOrganizationsSchema(mysqlTable)\n\tconst memberships = getOrganizationMembershipsSchema(mysqlTable)\n\n\treturn relations(entitlements, ({ one }) => ({\n\t\tuser: one(users, {\n\t\t\tfields: [entitlements.userId],\n\t\t\treferences: [users.id],\n\t\t}),\n\t\torganization: one(orgs, {\n\t\t\tfields: [entitlements.organizationId],\n\t\t\treferences: [orgs.id],\n\t\t}),\n\t\tmembership: one(memberships, {\n\t\t\tfields: [entitlements.organizationMembershipId],\n\t\t\treferences: [memberships.id],\n\t\t}),\n\t}))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;qBAAoB;AACpB,IAAAA,mBAAoC;AACpC,IAAAC,uBAaO;AACP,IAAAC,sBAIO;AACP,oBAA+B;AAC/B,kBAAmB;;;ACvBnB;;;;;;;;;;;;;;;;;;;;;;;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1D,iBAAAA,EACP2D,IAAI;QAAEQ;MAAO,CAAA,EACbL,UAAMC,yBAAG/D,kBAAkB0B,IAAI4iB,cAAAA,CAAAA;IAClC;EACD;AAEA,SAAOpkB;AACR;AA1qIgBb;","names":["import_date_fns","import_drizzle_orm","import_mysql_core","util","assertEqual","_","assertIs","_arg","assertNever","_x","Error","arrayToEnum","items","obj","item","getValidEnumValues","validKeys","objectKeys","filter","k","filtered","objectValues","map","e","Object","keys","object","key","prototype","hasOwnProperty","call","push","find","arr","checker","undefined","isInteger","Number","val","isFinite","Math","floor","joinValues","array","separator","join","jsonStringifyReplacer","value","toString","objectUtil","mergeShapes","first","second","ZodParsedType","getParsedType","data","t","string","isNaN","nan","number","boolean","function","bigint","symbol","Array","isArray","null","then","catch","promise","Map","Set","set","Date","date","unknown","ZodIssueCode","util","arrayToEnum","quotelessJson","obj","json","JSON","stringify","replace","ZodError","Error","errors","issues","addIssue","sub","addIssues","subs","actualProto","prototype","Object","setPrototypeOf","__proto__","name","format","_mapper","mapper","issue","message","fieldErrors","_errors","processError","error","code","unionErrors","map","returnTypeError","argumentsError","path","length","push","curr","i","el","terminal","assert","value","toString","jsonStringifyReplacer","isEmpty","flatten","formErrors","firstEl","create","errorMap","issue","_ctx","message","code","ZodIssueCode","invalid_type","received","ZodParsedType","undefined","expected","invalid_literal","JSON","stringify","util","jsonStringifyReplacer","unrecognized_keys","joinValues","keys","invalid_union","invalid_union_discriminator","options","invalid_enum_value","invalid_arguments","invalid_return_type","invalid_date","invalid_string","validation","includes","position","startsWith","endsWith","assertNever","too_small","type","exact","inclusive","minimum","Date","Number","too_big","maximum","custom","invalid_intersection_types","not_multiple_of","multipleOf","not_finite","defaultError","overrideErrorMap","defaultErrorMap","setErrorMap","map","overrideErrorMap","getErrorMap","makeIssue","params","data","path","errorMaps","issueData","fullPath","fullIssue","message","undefined","errorMessage","maps","filter","m","slice","reverse","map","defaultError","EMPTY_PATH","addIssueToContext","ctx","overrideMap","getErrorMap","issue","common","contextualErrorMap","schemaErrorMap","defaultErrorMap","x","issues","push","ParseStatus","value","dirty","abort","mergeArray","status","results","arrayValue","s","INVALID","mergeObjectAsync","pairs","syncPairs","pair","key","mergeObjectSync","finalObject","alwaysSet","Object","freeze","DIRTY","OK","isAborted","isDirty","isValid","isAsync","Promise","errorUtil","errToObj","message","toString","ParseInputLazyPath","parent","value","path","key","_cachedPath","data","_path","_key","length","Array","isArray","push","handleResult","ctx","result","isValid","success","common","issues","Error","error","_error","ZodError","processCreateParams","params","errorMap","invalid_type_error","required_error","description","customMap","iss","message","code","defaultError","ZodType","_def","_getType","input","getParsedType","_getOrReturnCtx","parsedType","schemaErrorMap","_processInputParams","status","ParseStatus","_parseSync","_parse","isAsync","_parseAsync","Promise","resolve","parse","safeParse","async","contextualErrorMap","err","toLowerCase","includes","then","parseAsync","safeParseAsync","maybeAsyncResult","refine","check","getIssueProperties","val","_refinement","setError","addIssue","ZodIssueCode","custom","refinement","refinementData","ZodEffects","schema","typeName","ZodFirstPartyTypeKind","effect","type","superRefine","def","spa","bind","optional","nullable","nullish","array","promise","or","and","transform","brand","default","catch","describe","pipe","readonly","isNullable","isOptional","version","vendor","validate","ZodOptional","create","ZodNullable","ZodArray","ZodPromise","option","ZodUnion","incoming","ZodIntersection","defaultValueFunc","ZodDefault","innerType","defaultValue","ZodBranded","catchValueFunc","ZodCatch","catchValue","This","target","ZodPipeline","ZodReadonly","undefined","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","nanoidRegex","jwtRegex","durationRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv4CidrRegex","ipv6Regex","ipv6CidrRegex","base64Regex","base64urlRegex","dateRegexSource","dateRegex","RegExp","timeRegexSource","args","secondsRegexSource","precision","secondsQuantifier","timeRegex","datetimeRegex","regex","opts","local","offset","join","isValidIP","ip","test","isValidJWT","jwt","alg","header","split","base64","replace","padEnd","decoded","JSON","atob","typ","isValidCidr","ZodString","coerce","String","ZodParsedType","string","addIssueToContext","invalid_type","expected","received","INVALID","checks","kind","too_small","minimum","inclusive","exact","dirty","too_big","maximum","tooBig","tooSmall","validation","invalid_string","URL","lastIndex","testResult","trim","position","toUpperCase","startsWith","endsWith","util","assertNever","_regex","errorUtil","errToObj","_addCheck","email","url","emoji","uuid","nanoid","cuid","cuid2","ulid","base64url","options","cidr","datetime","date","time","duration","min","minLength","max","maxLength","len","nonempty","isDatetime","find","ch","isDate","isTime","isDuration","isEmail","isURL","isEmoji","isUUID","isNANOID","isCUID","isCUID2","isULID","isIP","isCIDR","isBase64","isBase64url","floatSafeRemainder","step","valDecCount","toString","stepDecCount","decCount","valInt","Number","parseInt","toFixed","stepInt","ZodNumber","arguments","gte","lte","multipleOf","number","isInteger","not_multiple_of","isFinite","not_finite","setLimit","gt","lt","int","positive","negative","nonpositive","nonnegative","finite","safe","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","minValue","maxValue","isInt","ZodBigInt","BigInt","_getInvalidInput","bigint","ZodBoolean","Boolean","boolean","OK","ZodDate","Date","isNaN","getTime","invalid_date","minDate","maxDate","ZodSymbol","symbol","ZodUndefined","ZodNull","null","ZodAny","_any","ZodUnknown","_unknown","ZodNever","never","ZodVoid","void","exactLength","all","map","item","i","mergeArray","element","deepPartialify","ZodObject","newShape","shape","fieldSchema","unwrap","ZodTuple","items","_cached","nonstrict","passthrough","augment","extend","_getCached","keys","objectKeys","object","shapeKeys","extraKeys","catchall","unknownKeys","pairs","keyValidator","alwaysSet","unrecognized_keys","syncPairs","pair","mergeObjectSync","strict","issue","strip","augmentation","merge","merging","merged","setKey","index","pick","mask","omit","deepPartial","partial","required","newField","keyof","createZodEnum","strictCreate","lazycreate","handleResults","results","unionErrors","invalid_union","childCtx","types","getDiscriminator","ZodLazy","ZodLiteral","ZodEnum","ZodNativeEnum","objectValues","enum","ZodDiscriminatedUnion","discriminator","discriminatorValue","optionsMap","get","invalid_union_discriminator","from","Map","discriminatorValues","has","set","mergeValues","a","b","aType","bType","valid","bKeys","sharedKeys","filter","indexOf","newObj","sharedValue","newArray","itemA","itemB","handleParsed","parsedLeft","parsedRight","isAborted","invalid_intersection_types","isDirty","left","right","rest","itemIndex","x","schemas","ZodRecord","keySchema","keyType","valueSchema","valueType","mergeObjectAsync","first","second","third","ZodMap","entries","finalMap","ZodSet","minSize","size","maxSize","finalizeSet","elements","parsedSet","Set","add","values","ZodFunction","implement","function","makeArgsIssue","makeIssue","errorMaps","getErrorMap","defaultErrorMap","issueData","invalid_arguments","argumentsError","makeReturnsIssue","returns","invalid_return_type","returnTypeError","fn","me","parsedArgs","e","Reflect","apply","parsedReturns","parameters","returnType","func","validatedFunc","strictImplement","getter","lazySchema","invalid_literal","expectedValues","joinValues","_cache","invalid_enum_value","enumValues","Values","Enum","extract","newDef","exclude","opt","nativeEnumValues","getValidEnumValues","promisified","sourceType","checkCtx","arg","fatal","abort","processed","DIRTY","executeRefinement","acc","inner","base","createWithPreprocess","preprocess","ZodOptional","ZodType","_parse","input","parsedType","_getType","ZodParsedType","undefined","OK","_def","innerType","unwrap","create","type","params","typeName","ZodFirstPartyTypeKind","processCreateParams","ZodNullable","null","ZodDefault","ctx","_processInputParams","data","defaultValue","path","parent","removeDefault","default","ZodCatch","newCtx","common","issues","result","isAsync","then","status","value","catchValue","error","ZodError","removeCatch","catch","ZodNaN","nan","_getOrReturnCtx","addIssueToContext","code","ZodIssueCode","invalid_type","expected","received","INVALID","BRAND","Symbol","ZodBranded","ZodPipeline","async","handleAsync","inResult","in","_parseAsync","dirty","DIRTY","out","_parseSync","a","b","ZodReadonly","freeze","isValid","Object","cleanParams","p","message","p2","custom","check","_params","fatal","ZodAny","superRefine","r","Promise","_fatal","addIssue","late","object","ZodObject","lazycreate","ZodFirstPartyTypeKind","instanceOfType","cls","params","message","name","custom","data","stringType","ZodString","create","numberType","ZodNumber","nanType","ZodNaN","bigIntType","ZodBigInt","booleanType","ZodBoolean","dateType","ZodDate","symbolType","ZodSymbol","undefinedType","ZodUndefined","nullType","ZodNull","anyType","ZodAny","unknownType","ZodUnknown","neverType","ZodNever","voidType","ZodVoid","arrayType","ZodArray","objectType","ZodObject","strictObjectType","strictCreate","unionType","ZodUnion","discriminatedUnionType","ZodDiscriminatedUnion","intersectionType","ZodIntersection","tupleType","ZodTuple","recordType","ZodRecord","mapType","ZodMap","setType","ZodSet","functionType","ZodFunction","lazyType","ZodLazy","literalType","ZodLiteral","enumType","ZodEnum","nativeEnumType","ZodNativeEnum","promiseType","ZodPromise","effectsType","ZodEffects","optionalType","ZodOptional","nullableType","ZodNullable","preprocessType","createWithPreprocess","pipelineType","ZodPipeline","ostring","optional","onumber","oboolean","coerce","string","arg","number","boolean","bigint","date","NEVER","INVALID","__defProp","__name","__export","util","assertEqual","_","assertIs","_arg","assertNever","_x","Error","arrayToEnum","items","obj","item","getValidEnumValues","validKeys","objectKeys","filter","k","filtered","objectValues","map","e","Object","keys","object","key","prototype","hasOwnProperty","call","push","find","arr","checker","undefined","isInteger","Number","val","isFinite","Math","floor","joinValues","array","separator","join","jsonStringifyReplacer","value","toString","objectUtil","mergeShapes","first","second","ZodParsedType","getParsedType","__name","data","t","string","isNaN","nan","number","boolean","function","bigint","symbol","Array","isArray","null","then","catch","promise","Map","Set","set","Date","date","unknown","ZodIssueCode","quotelessJson","json","JSON","stringify","replace","ZodError","_a","errors","issues","addIssue","sub","addIssues","subs","actualProto","setPrototypeOf","__proto__","name","format","_mapper","mapper","issue","message","fieldErrors","_errors","processError","error","code","unionErrors","returnTypeError","argumentsError","path","length","curr","i","el","terminal","assert","isEmpty","flatten","formErrors","firstEl","_ZodError","create","errorMap","_ctx","invalid_type","received","expected","invalid_literal","unrecognized_keys","invalid_union","invalid_union_discriminator","options","invalid_enum_value","invalid_arguments","invalid_return_type","invalid_date","invalid_string","validation","includes","position","startsWith","endsWith","too_small","type","exact","inclusive","minimum","too_big","maximum","custom","invalid_intersection_types","not_multiple_of","multipleOf","not_finite","defaultError","en_default","overrideErrorMap","defaultErrorMap","setErrorMap","getErrorMap","errorUtil","errToObj","makeIssue","params","errorMaps","issueData","fullPath","fullIssue","errorMessage","maps","m","slice","reverse","EMPTY_PATH","addIssueToContext","ctx","overrideMap","common","contextualErrorMap","schemaErrorMap","x","ParseStatus","dirty","abort","mergeArray","status","results","arrayValue","s","INVALID","mergeObjectAsync","pairs","syncPairs","pair","mergeObjectSync","finalObject","alwaysSet","_ParseStatus","freeze","DIRTY","OK","isAborted","isDirty","isValid","isAsync","Promise","ParseInputLazyPath","parent","_cachedPath","_path","_key","handleResult","result","success","_error","processCreateParams","invalid_type_error","required_error","description","customMap","iss","ZodType","_def","_getType","input","_getOrReturnCtx","parsedType","_processInputParams","_parseSync","_parse","_parseAsync","resolve","parse","safeParse","async","err","toLowerCase","parseAsync","safeParseAsync","maybeAsyncResult","refine","check","getIssueProperties","_refinement","setError","refinement","refinementData","ZodEffects","schema","typeName","ZodFirstPartyTypeKind","effect","superRefine","def","spa","bind","optional","nullable","nullish","or","and","transform","brand","default","describe","pipe","readonly","isNullable","isOptional","version","vendor","validate","ZodOptional","ZodNullable","ZodArray","ZodPromise","option","ZodUnion","incoming","ZodIntersection","defaultValueFunc","ZodDefault","innerType","defaultValue","ZodBranded","catchValueFunc","ZodCatch","catchValue","This","target","ZodPipeline","ZodReadonly","_ZodType","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","nanoidRegex","jwtRegex","durationRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv4CidrRegex","ipv6Regex","ipv6CidrRegex","base64Regex","base64urlRegex","dateRegexSource","dateRegex","RegExp","timeRegexSource","args","secondsRegexSource","precision","secondsQuantifier","timeRegex","datetimeRegex","regex","opts","local","offset","isValidIP","ip","test","isValidJWT","jwt","alg","header","split","base64","padEnd","decoded","atob","typ","isValidCidr","ZodString","coerce","String","checks","kind","tooBig","tooSmall","URL","lastIndex","testResult","trim","toUpperCase","_regex","_addCheck","email","url","emoji","uuid","nanoid","cuid","cuid2","ulid","base64url","cidr","datetime","time","duration","min","minLength","max","maxLength","len","nonempty","isDatetime","ch","isDate","isTime","isDuration","isEmail","isURL","isEmoji","isUUID","isNANOID","isCUID","isCUID2","isULID","isIP","isCIDR","isBase64","isBase64url","_ZodString","floatSafeRemainder","step","valDecCount","stepDecCount","decCount","valInt","parseInt","toFixed","stepInt","ZodNumber","arguments","gte","lte","setLimit","gt","lt","int","positive","negative","nonpositive","nonnegative","finite","safe","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","minValue","maxValue","isInt","_ZodNumber","ZodBigInt","BigInt","_getInvalidInput","_ZodBigInt","ZodBoolean","Boolean","_ZodBoolean","ZodDate","getTime","minDate","maxDate","_ZodDate","ZodSymbol","_ZodSymbol","ZodUndefined","_ZodUndefined","ZodNull","_ZodNull","ZodAny","_any","_ZodAny","ZodUnknown","_unknown","_ZodUnknown","ZodNever","never","_ZodNever","ZodVoid","void","_ZodVoid","exactLength","all","element","_ZodArray","deepPartialify","ZodObject","newShape","shape","fieldSchema","unwrap","ZodTuple","_cached","nonstrict","passthrough","augment","extend","_getCached","shapeKeys","extraKeys","catchall","unknownKeys","keyValidator","strict","strip","augmentation","merge","merging","merged","setKey","index","pick","mask","omit","deepPartial","partial","required","newField","keyof","createZodEnum","_ZodObject","strictCreate","lazycreate","handleResults","childCtx","_ZodUnion","types","getDiscriminator","ZodLazy","ZodLiteral","ZodEnum","ZodNativeEnum","enum","ZodDiscriminatedUnion","discriminator","discriminatorValue","optionsMap","get","from","discriminatorValues","has","_ZodDiscriminatedUnion","mergeValues","a","b","aType","bType","valid","bKeys","sharedKeys","indexOf","newObj","sharedValue","newArray","itemA","itemB","handleParsed","parsedLeft","parsedRight","left","right","_ZodIntersection","rest","itemIndex","_ZodTuple","schemas","ZodRecord","keySchema","keyType","valueSchema","valueType","third","_ZodRecord","ZodMap","entries","finalMap","_ZodMap","ZodSet","minSize","size","maxSize","finalizeSet","elements","parsedSet","add","values","_ZodSet","ZodFunction","implement","makeArgsIssue","makeReturnsIssue","returns","fn","me","parsedArgs","Reflect","apply","parsedReturns","parameters","returnType","func","validatedFunc","strictImplement","_ZodFunction","getter","lazySchema","_ZodLazy","_ZodLiteral","expectedValues","_cache","enumValues","Values","Enum","extract","newDef","exclude","opt","_ZodEnum","nativeEnumValues","_ZodNativeEnum","promisified","_ZodPromise","sourceType","checkCtx","arg","fatal","processed","executeRefinement","acc","inner","base","_ZodEffects","createWithPreprocess","preprocess","_ZodOptional","_ZodNullable","removeDefault","_ZodDefault","newCtx","removeCatch","_ZodCatch","ZodNaN","_ZodNaN","BRAND","Symbol","_ZodBranded","handleAsync","inResult","in","out","_ZodPipeline","_ZodReadonly","cleanParams","p","p2","_params","r","_fatal","late","instanceOfType","cls","stringType","numberType","nanType","bigIntType","booleanType","dateType","symbolType","undefinedType","nullType","anyType","unknownType","neverType","voidType","arrayType","objectType","strictObjectType","unionType","discriminatedUnionType","intersectionType","tupleType","recordType","mapType","setType","functionType","lazyType","literalType","enumType","nativeEnumType","promiseType","effectsType","optionalType","nullableType","preprocessType","pipelineType","ostring","onumber","oboolean","NEVER","external_exports","VideoResourceSchema","z","object","id","string","updatedAt","coerce","date","optional","createdAt","title","nullable","duration","number","muxPlaybackId","muxAssetId","transcript","transcriptWithScreenshots","srt","wordLevelSrt","state","enum","purchaseUserTransferSchema","z","object","id","string","max","transferState","enum","default","purchaseId","sourceUserId","targetUserId","optional","nullable","createdAt","date","expiresAt","canceledAt","confirmedAt","completedAt","questionResponseSchema","z","object","id","string","max","surveyId","questionId","respondentKey","optional","nullable","surveySessionId","userId","emailListSubscriberId","fields","record","any","default","createdAt","date","updatedAt","deletedAt","ContentResourceResourceSchema","z","object","resourceId","string","resourceOfId","position","number","default","metadata","record","any","nullable","createdAt","coerce","date","updatedAt","deletedAt","resource","ContentResourceProductSchema","productId","product","ContentResourceSchema","id","type","createdById","currentVersionId","nullish","fields","optional","slug","resources","array","resourceProducts","organizationId","createdByOrganizationMembershipId","ResourceStateSchema","union","literal","ResourceVisibilitySchema","resourceProgressSchema","z","object","userId","string","max","resourceId","optional","nullable","completedAt","date","moduleProgressSchema","completedLessons","array","nextResource","ContentResourceSchema","partial","percentCompleted","number","default","completedLessonsCount","totalLessonsCount","upgradableProductSchema","z","object","upgradableToId","string","max","upgradableFromId","position","number","default","metadata","record","any","createdAt","date","nullable","updatedAt","deletedAt","userSchema","z","object","id","string","max","name","optional","nullable","role","enum","default","email","emailVerified","coerce","date","nullish","image","createdAt","memberships","array","organizationId","roles","description","active","boolean","updatedAt","deletedAt","organizationRoles","priceSchema","z","object","id","string","max","productId","optional","nullable","organizationId","nickname","status","number","int","default","unitAmount","coerce","refine","value","decimalPlaces","toString","split","length","createdAt","date","fields","record","any","ProductTypeSchema","z","enum","default","optional","SubscriptionTierSchema","nullable","BillingIntervalSchema","productSchema","object","id","string","max","organizationId","name","key","type","fields","body","description","nullish","slug","image","url","alt","width","number","height","action","state","visibility","openEnrollment","datetime","closeEnrollment","discordRoleId","availableAfterDays","coerce","int","positive","accessDurationDays","tier","billingInterval","createdAt","date","status","quantityAvailable","price","priceSchema","resources","array","ContentResourceProductSchema","NewProductSchema","min","gte","eligibilityConditionSchema","z","discriminatedUnion","object","type","literal","productId","string","max","couponFieldsSchema","eligibilityCondition","optional","stackable","boolean","couponSchema","z","object","id","string","code","max","optional","nullable","createdAt","date","expires","fields","record","any","default","refine","eligibilityCondition","undefined","stackable","result","couponFieldsSchema","safeParse","success","message","maxUses","number","int","boolean","merchantCouponId","status","usedCount","percentageDiscount","coerce","value","decimalPlaces","toString","split","length","amountDiscount","restrictedToProductId","bulkPurchases","array","redeemedBulkCouponPurchases","bulkPurchaseId","organizationId","purchaseSchema","z","object","id","string","max","userId","optional","nullable","createdAt","date","totalAmount","coerce","number","refine","value","decimalPlaces","toString","split","length","ipAddress","city","state","country","couponId","productId","merchantChargeId","upgradedFromId","status","default","bulkCouponId","merchantSessionId","redeemedBulkCouponId","fields","record","any","user","userSchema","bulkCoupon","couponSchema","product","productSchema","purchasedByorganizationMembershipId","organizationId","merchantCouponSchema","z","object","id","string","max","identifier","optional","nullable","status","number","int","default","merchantAccountId","percentageDiscount","coerce","refine","value","decimalPlaces","toString","split","length","amountDiscount","nonnegative","type","data","hasPercentage","undefined","hasAmount","message","merchantCustomerSchema","z","object","id","string","max","userId","merchantAccountId","identifier","createdAt","date","nullable","status","number","int","default","merchantEventsSchema","z","object","id","string","max","merchantAccountId","identifier","payload","record","any","createdAt","date","nullable","merchantPriceSchema","z","object","id","string","max","merchantAccountId","merchantProductId","status","number","int","default","identifier","optional","nullable","createdAt","date","priceId","merchantProductSchema","z","object","id","string","max","merchantAccountId","productId","status","number","int","default","identifier","optional","nullable","createdAt","date","entitlementSchema","z","object","id","string","max","entitlementType","userId","nullable","optional","organizationId","organizationMembershipId","sourceType","sourceId","metadata","record","any","default","expiresAt","date","createdAt","updatedAt","deletedAt","merchantChargeSchema","z","object","id","string","max","status","number","int","default","identifier","userId","merchantAccountId","merchantProductId","createdAt","date","nullable","merchantCustomerId","merchantAccountSchema","z","object","id","string","max","label","identifier","createdAt","date","nullable","status","number","int","default","MerchantSessionSchema","z","object","id","string","organizationId","nullable","identifier","merchantAccountId","MerchantSubscriptionSchema","z","object","id","string","organizationId","nullable","merchantAccountId","status","number","default","createdAt","date","Date","label","identifier","merchantCustomerId","merchantProductId","OrganizationSchema","z","object","id","string","name","nullable","fields","record","any","default","image","createdAt","date","OrganizationMemberSchema","z","object","id","string","organizationId","optional","role","default","invitedById","userId","fields","record","any","createdAt","date","Date","organization","OrganizationSchema","user","userSchema","SubscriptionSchema","z","object","id","string","organizationId","optional","productId","createdAt","date","merchantSubscriptionId","status","enum","default","fields","record","any","product","productSchema","merchantSubscription","MerchantSubscriptionSchema","CourseBuilderError","_a","Error","message","errorOptions","type","cause","undefined","err","name","kind","captureStackTrace","url","toLowerCase","AdapterError","UnsupportedStrategy","_a","CourseBuilderError","type","MissingAdapter","_a","CourseBuilderError","type","MissingAdapterMethods","_a","CourseBuilderError","type","red","yellow","grey","reset","formatAttrs","attrs","Object","keys","length","JSON","stringify","logger","error","name","CourseBuilderError","type","console","message","cause","err","Error","data","stack","replace","substring","warn","code","url","debug","metadata","log","info","setLogger","newLogger","validateCoupon","__name","coupon","productIds","isValid","isRedeemable","error","isUsedUp","maxUses","usedCount","isExpired","expires","isBefore","Date","restrictedToProductId","includes","percentageDiscount","default","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getUserRolesSchema","mysqlTable","userId","varchar","length","notNull","roleId","active","boolean","default","organizationId","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ur","pk","primaryKey","columns","userIdIdx","index","on","roleIdIdx","organizationIdIdx","getUserRolesRelationsSchema","overrides","userRoles","resolveUsersSchema","getUsersSchema","users","roles","getRolesSchema","relations","one","user","fields","references","id","relationName","role","getRolesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","role","nameIdx","index","on","organizationIdIdx","uniqueNamePerOrg","uniqueIndex","getRolesRelationsSchema","roles","userRoles","getUserRolesSchema","relations","many","relationName","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getMerchantAccountSchema","mysqlTable","id","varchar","length","notNull","organizationId","status","int","default","createdAt","timestamp","mode","fsp","sql","label","identifier","table","merchantAccountId","primaryKey","columns","name","organizationIdIdx","index","on","import_drizzle_orm","import_mysql_core","getMerchantCustomerSchema","mysqlTable","id","varchar","length","notNull","organizationId","userId","merchantAccountId","identifier","createdAt","timestamp","mode","fsp","default","sql","status","int","table","merchantCustomerId","primaryKey","columns","name","merchantCustomerIdentifierKey","unique","on","userIdIdx","index","organizationIdIdx","import_drizzle_orm","import_mysql_core","getMerchantProductSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","productId","status","int","default","identifier","createdAt","timestamp","mode","fsp","sql","table","merchantProductId","primaryKey","columns","name","merchantProductIdentifierKey","unique","on","organizationIdIdx","index","getMerchantChargeSchema","mysqlTable","id","varchar","length","notNull","organizationId","status","int","default","identifier","userId","merchantAccountId","merchantProductId","merchantSubscriptionId","createdAt","timestamp","mode","fsp","sql","merchantCustomerId","table","merchantChargeId","primaryKey","columns","name","merchantChargeIdentifierKey","unique","on","merchantSubscriptionIdIdx","index","organizationIdIdx","getMerchantChargeRelationsSchema","merchantCharge","merchantAccount","getMerchantAccountSchema","merchantProduct","getMerchantProductSchema","merchantCustomer","getMerchantCustomerSchema","merchantSubscription","getMerchantSubscriptionSchema","relations","one","fields","references","relationName","getMerchantSubscriptionSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","status","int","default","createdAt","timestamp","mode","fsp","sql","label","identifier","merchantCustomerId","merchantProductId","table","merchantSubscriptionId","primaryKey","columns","name","organizationIdIdx","index","on","getMerchantSubscriptionRelationsSchema","merchantSubscription","merchantCharge","getMerchantChargeSchema","subscription","getSubscriptionSchema","relations","many","one","merchantCharges","relationName","fields","references","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getContributionTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","slug","unique","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ct","nameIdx","index","on","slugIdx","organizationIdIdx","getContributionTypesRelationsSchema","contributionTypes","relations","many","getContentContributionsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","organizationId","organizationMembershipId","contentId","contributionTypeId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","cc","userIdIdx","index","on","contentIdIdx","contributionTypeIdIdx","organizationMembershipIdIdx","getContentContributionRelationsSchema","overrides","contentContributions","resolveUsersSchema","getUsersSchema","users","contentResource","getContentResourceSchema","contributionTypes","getContributionTypesSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","relationName","content","contributionType","organizationMembership","import_drizzle_orm","import_mysql_core","getContentResourceResourceSchema","mysqlTable","resourceOfId","varchar","length","notNull","resourceId","position","double","default","metadata","json","$type","organizationId","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","contentResourceIdIdx","index","on","resourceIdIdx","organizationIdIdx","getContentResourceResourceRelationsSchema","contentResource","getContentResourceSchema","contentResourceResource","relations","one","resourceOf","fields","references","id","relationName","resource","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getTagTagSchema","mysqlTable","parentTagId","varchar","length","notNull","childTagId","position","double","default","metadata","json","$type","organizationId","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","tt","pk","primaryKey","columns","parentTagIdIdx","index","on","childTagIdIdx","positionIdx","organizationIdIdx","getTagTagRelationsSchema","tag","getTagSchema","tagTag","relations","one","parentTag","fields","references","id","relationName","childTag","getTagSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","t","typeIdx","index","on","organizationIdIdx","getTagRelationsSchema","tag","contentResourceTag","getContentResourceTagSchema","tagTag","getTagTagSchema","relations","many","resources","relationName","parentTags","childTags","getContentResourceTagSchema","mysqlTable","contentResourceId","varchar","length","notNull","organizationId","tagId","position","double","default","createdAt","timestamp","mode","fsp","sql","updatedAt","crt","pk","primaryKey","columns","contentResourceIdIdx","index","on","tagIdIdx","positionIdx","organizationIdIdx","getContentResourceTagRelationsSchema","contentResource","getContentResourceSchema","tag","getTagSchema","contentResourceTag","relations","one","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getContentResourceVersionSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","resourceId","parentVersionId","versionNumber","int","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","createdById","crv","resourceIdIdx","index","on","parentVersionIdIdx","resourceIdVersionNumberIdx","uniqueResourceVersion","unique","organizationIdIdx","getContentResourceVersionRelationsSchema","overrides","contentResourceVersion","contentResource","getContentResourceSchema","resolveUsersSchema","getUsersSchema","users","relations","one","resource","references","relationName","parentVersion","createdBy","getContentResourceSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","createdByOrganizationMembershipId","type","createdById","fields","json","$type","default","slug","generatedAlwaysAs","sql","mode","currentVersionId","createdAt","timestamp","fsp","updatedAt","deletedAt","cm","typeIdx","index","on","createdByIdx","createdAtIdx","currentVersionIdIdx","createdByOrganizationMembershipIdIdx","slugIdx","getContentResourceRelationsSchema","overrides","contentResource","resolveUsersSchema","getUsersSchema","users","contentResourceResource","getContentResourceResourceSchema","contentResourceProduct","getContentResourceProductSchema","contentContributions","getContentContributionsSchema","contentResourceTag","getContentResourceTagSchema","contentResourceVersion","getContentResourceVersionSchema","organizationMemberships","getOrganizationMembershipsSchema","tag","getTagSchema","relations","one","many","createdBy","references","relationName","createdByOrganizationMembership","tags","resources","resourceOf","resourceProducts","contributions","currentVersion","versions","getContentResourceProductSchema","mysqlTable","productId","varchar","length","notNull","resourceId","organizationId","position","double","default","metadata","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","contentResourceIdIdx","index","on","resourceIdIdx","organizationIdIdx","getContentResourceProductRelationsSchema","contentResource","getContentResourceSchema","contentResourceProduct","product","getProductSchema","relations","one","fields","references","id","relationName","resource","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getMerchantPriceSchema","mysqlTable","id","varchar","length","notNull","organizationId","merchantAccountId","merchantProductId","status","int","default","identifier","createdAt","timestamp","mode","fsp","sql","priceId","table","merchantPriceId","primaryKey","columns","name","merchantPriceIdentifierKey","unique","on","organizationIdIdx","index","getPriceSchema","mysqlTable","id","varchar","length","notNull","productId","organizationId","nickname","status","int","default","unitAmount","decimal","precision","scale","createdAt","timestamp","mode","fsp","sql","fields","json","$type","table","priceId","primaryKey","columns","name","organizationIdIdx","index","on","getProductSchema","mysqlTable","id","varchar","length","notNull","organizationId","name","key","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","status","int","quantityAvailable","table","productId","primaryKey","columns","organizationIdIdx","index","on","getProductRelationsSchema","product","price","getPriceSchema","merchantProduct","getMerchantProductSchema","contentResourceProduct","getContentResourceProductSchema","relations","one","many","references","relationName","resources","getSubscriptionSchema","mysqlTable","id","varchar","length","notNull","organizationId","productId","createdAt","timestamp","mode","fsp","default","sql","merchantSubscriptionId","status","fields","json","$type","table","subscriptionId","primaryKey","columns","name","organizationIdIdx","index","on","getSubscriptionRelationsSchema","subscriptions","products","getProductSchema","organizations","getOrganizationsSchema","merchantSubscriptions","getMerchantSubscriptionSchema","relations","many","one","organization","references","relationName","product","merchantSubscription","getOrganizationsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","fields","json","$type","default","image","createdAt","timestamp","mode","fsp","sql","organization","createdAtIdx","index","on","getOrganizationsRelationsSchema","organizations","purchases","getPurchaseSchema","subscriptions","getSubscriptionSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","relationName","members","getOrganizationMembershipRolesSchema","mysqlTable","organizationMembershipId","varchar","length","notNull","roleId","active","boolean","default","organizationId","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","ur","pk","primaryKey","columns","name","orgMemberIdIdx","index","on","roleIdIdx","organizationIdIdx","getOrganizationMembershipRolesRelationsSchema","organizationMembershipRoles","organizationMemberships","getOrganizationMembershipsSchema","roles","getRolesSchema","organizations","getOrganizationsSchema","relations","one","organizationMembership","fields","references","id","relationName","role","organization","getOrganizationMembershipsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","role","default","invitedById","userId","fields","json","$type","createdAt","timestamp","mode","fsp","sql","organizationMembership","roleIdx","index","on","createdAtIdx","organizationIdIdx","getOrganizationMembershipsRelationsSchema","overrides","resolveUsersSchema","getUsersSchema","users","organizationMemberships","purchases","getPurchaseSchema","organizations","getOrganizationsSchema","organizationMembershipRoles","getOrganizationMembershipRolesSchema","relations","one","many","user","references","relationName","invitedBy","organization","import_drizzle_orm","import_mysql_core","import_mysql_core","getMerchantCouponSchema","mysqlTable","id","varchar","length","notNull","identifier","organizationId","status","int","default","merchantAccountId","percentageDiscount","decimal","precision","scale","amountDiscount","type","table","merchantCouponId","primaryKey","columns","name","merchantCouponIdentifierKey","unique","on","organizationIdIdx","index","getCouponSchema","mysqlTable","id","varchar","length","notNull","organizationId","code","createdAt","timestamp","mode","fsp","default","sql","expires","fields","json","$type","maxUses","int","boolean","merchantCouponId","status","usedCount","percentageDiscount","decimal","precision","scale","amountDiscount","restrictedToProductId","table","couponIdCodeIndex","index","on","couponId","primaryKey","columns","name","couponCodeKey","unique","organizationIdIdx","getCouponRelationsSchema","purchase","getPurchaseSchema","coupon","merchantCoupon","getMerchantCouponSchema","relations","many","one","redeemedBulkCouponPurchases","relationName","references","product","getProductSchema","bulkPurchases","import_mysql_core","getMerchantSessionSchema","mysqlTable","id","varchar","length","notNull","organizationId","identifier","merchantAccountId","table","merchantSessionId","primaryKey","columns","name","organizationIdIdx","index","on","getPurchaseSchema","mysqlTable","id","varchar","length","notNull","userId","purchasedByorganizationMembershipId","organizationId","createdAt","timestamp","mode","fsp","default","sql","totalAmount","decimal","precision","scale","ipAddress","city","state","country","couponId","productId","merchantChargeId","upgradedFromId","status","bulkCouponId","merchantSessionId","redeemedBulkCouponId","fields","json","$type","table","purchaseId","primaryKey","columns","name","merchantChargeIdIdx","index","on","purchaseUpgradedFromIdKey","unique","organizationIdIdx","organizationMembershipIdIdx","getPurchaseRelationsSchema","overrides","purchases","resolveUsersSchema","getUsersSchema","users","products","getProductSchema","merchantCharges","getMerchantChargeSchema","merchantSessions","getMerchantSessionSchema","coupons","getCouponSchema","organizations","getOrganizationsSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","one","redeemedBulkCoupon","references","relationName","user","organization","purchasedBy","product","bulkCoupon","merchantCharge","merchantSession","import_drizzle_orm","import_mysql_core","getCommentsSchema","mysqlTable","id","varchar","length","notNull","userId","organizationMembershipId","context","json","$type","default","text","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","crrUserIdIdKey","index","on","organizationMembershipIdIdx","getCommentRelationsSchema","overrides","comment","resolveUsersSchema","getUsersSchema","user","organizationMemberships","getOrganizationMembershipsSchema","relations","one","fields","references","relationName","organizationMembership","import_drizzle_orm","import_mysql_core","import_mysql_core","getCommunicationChannelSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","cc","nameIdx","index","on","organizationIdIdx","import_mysql_core","getCommunicationPreferenceTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","getCommunicationPreferencesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","userId","organizationMembershipId","channelId","preferenceLevel","mysqlEnum","default","preferenceTypeId","active","boolean","createdAt","timestamp","mode","fsp","defaultNow","optInAt","optOutAt","updatedAt","deletedAt","cp","userIdIdx","index","on","preferenceTypeIdx","channelIdIdx","organizationMembershipIdIdx","getCommunicationPreferencesRelationsSchema","overrides","communicationPreferences","resolveUsersSchema","getUsersSchema","users","communicationChannel","getCommunicationChannelSchema","communicationPreferenceTypes","getCommunicationPreferenceTypesSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","relationName","organizationMembership","channel","preferenceType","import_drizzle_orm","import_mysql_core","getProfilesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","type","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","updatedAt","profile","userIdIdx","index","on","uniqueUserType","uniqueIndex","getProfilesRelationsSchema","overrides","profiles","resolveUsersSchema","getUsersSchema","users","relations","one","user","references","relationName","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getPermissionsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","unique","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","permission","nameIdx","index","on","getPermissionsRelationsSchema","relations","many","getUserPermissionsSchema","mysqlTable","userId","varchar","length","notNull","organizationId","permissionId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","up","pk","primaryKey","columns","userIdIdx","index","on","permissionIdIdx","organizationIdIdx","getUserPermissionsRelationsSchema","overrides","userPermissions","resolveUsersSchema","getUsersSchema","users","permissions","getPermissionsSchema","relations","one","user","fields","references","id","relationName","permission","import_drizzle_orm","import_mysql_core","getUserPrefsSchema","mysqlTable","id","varchar","length","notNull","organizationId","type","default","userId","fields","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","crrUserIdIdKey","index","on","organizationIdIdx","getUserPrefsRelationsSchema","overrides","userPrefs","resolveUsersSchema","getUsersSchema","user","relations","one","references","relationName","getUsersSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","role","default","email","unique","fields","json","$type","emailVerified","timestamp","mode","fsp","image","createdAt","sql","user","emailIdx","index","on","roleIdx","createdAtIdx","getUsersRelationsSchema","overrides","resolveUsersSchema","users","profiles","getProfilesSchema","accounts","getAccountsSchema","communicationPreferences","getCommunicationPreferencesSchema","userRoles","getUserRolesSchema","userPermissions","getUserPermissionsSchema","contentContributions","getContentContributionsSchema","contentResource","getContentResourceSchema","purchases","getPurchaseSchema","comments","getCommentsSchema","userPrefs","getUserPrefsSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","one","relationName","roles","contributions","createdContent","prefs","getAccountsSchema","mysqlTable","userId","varchar","length","notNull","type","$type","provider","providerAccountId","refresh_token","text","access_token","oauth_token","oauth_token_secret","expires_at","int","token_type","scope","id_token","session_state","refresh_token_expires_in","account","pk","primaryKey","columns","userIdIdx","index","on","getAccountsRelationsSchema","overrides","accounts","resolveUsersSchema","getUsersSchema","users","relations","one","user","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getDeviceAccessTokenSchema","mysqlTable","token","varchar","length","notNull","userId","organizationMembershipId","createdAt","timestamp","mode","fsp","default","sql","crr","pk","primaryKey","columns","userIdIdx","index","on","getDeviceAccessTokenRelationsSchema","overrides","deviceAccessToken","resolveUsersSchema","getUsersSchema","user","relations","one","verifiedBy","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getDeviceVerificationSchema","mysqlTable","verifiedByUserId","varchar","length","deviceCode","notNull","userCode","text","expires","timestamp","mode","fsp","createdAt","default","sql","verifiedAt","crr","pk","primaryKey","columns","getDeviceVerificationRelationsSchema","overrides","deviceVerification","resolveUsersSchema","getUsersSchema","user","relations","one","verifiedBy","fields","references","id","relationName","import_drizzle_orm","import_mysql_core","getRolePermissionsSchema","mysqlTable","roleId","varchar","length","notNull","permissionId","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","rp","pk","primaryKey","columns","roleIdIdx","index","on","permissionIdIdx","getRolePermissionsRelationsSchema","permissions","getPermissionsSchema","roles","getRolesSchema","rolePermissions","relations","one","role","fields","references","id","relationName","permission","import_drizzle_orm","import_mysql_core","getSessionsSchema","mysqlTable","sessionToken","varchar","length","notNull","primaryKey","userId","expires","timestamp","mode","session","userIdIdx","index","on","getSessionRelationsSchema","overrides","sessions","resolveUsersSchema","getUsersSchema","users","relations","one","user","fields","references","id","relationName","import_mysql_core","getVerificationTokensSchema","mysqlTable","identifier","varchar","length","notNull","token","expires","timestamp","mode","createdAt","fsp","defaultNow","vt","pk","primaryKey","columns","import_drizzle_orm","import_mysql_core","getMerchantEventsSchema","mysqlTable","id","varchar","length","notNull","merchantAccountId","identifier","payload","json","createdAt","timestamp","mode","fsp","default","sql","table","merchantEventsId","primaryKey","columns","name","merchantEventsIdentifierKey","unique","on","merchantAccountIdIdx","index","createdAtIdx","getMerchantEventsRelationsSchema","merchantEvents","merchantAccount","getMerchantAccountSchema","relations","one","fields","references","relationName","import_drizzle_orm","import_mysql_core","getPurchaseUserTransferSchema","mysqlTable","id","varchar","length","notNull","transferState","mysqlEnum","default","purchaseId","organizationId","sourceUserId","targetUserId","createdAt","timestamp","mode","fsp","sql","expiresAt","canceledAt","confirmedAt","completedAt","table","purchaseUserTransferId","primaryKey","columns","name","organizationIdIdx","index","on","getPurchaseUserTransferRelationsSchema","overrides","purchaseUserTransfer","resolveUsersSchema","getUsersSchema","user","purchase","getPurchaseSchema","relations","one","sourceUser","fields","references","relationName","targetUser","import_drizzle_orm","import_mysql_core","getUpgradableProductsSchema","mysqlTable","upgradableToId","varchar","length","notNull","upgradableFromId","organizationId","position","double","default","metadata","json","$type","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","crr","pk","primaryKey","columns","upgradableToIdIdx","index","on","upgradableFromIdIdx","organizationIdIdx","getUpgradableProductsRelationsSchema","product","getProductSchema","upgradableProduct","relations","one","upgradableTo","fields","references","id","relationName","upgradableFrom","import_drizzle_orm","import_mysql_core","getQuestionResponseSchema","mysqlTable","id","varchar","length","notNull","primaryKey","surveyId","questionId","respondentKey","surveySessionId","userId","emailListSubscriberId","fields","json","$type","default","createdAt","timestamp","mode","fsp","sql","updatedAt","deletedAt","qr","surveyIdIdx","index","on","questionIdIdx","respondentKeyIdx","surveySessionIdIdx","userIdIdx","emailListSubscriberIdIdx","surveySubscriberIdx","surveyQuestionRespondentIdx","uniqueIndex","getQuestionResponseRelationsSchema","overrides","questionResponse","resolveUsersSchema","getUsersSchema","users","contentResource","getContentResourceSchema","relations","one","user","references","relationName","survey","question","import_drizzle_orm","import_mysql_core","getLessonProgressSchema","mysqlTable","id","varchar","length","notNull","primaryKey","userId","organizationId","organizationMembershipId","lessonId","lessonSlug","lessonVersion","sectionId","moduleId","completedAt","datetime","mode","fsp","updatedAt","createdAt","default","sql","crp","userIdLessonIdIdx","index","on","userIdIdx","lessonIdIdx","organizationMembershipIdIdx","import_drizzle_orm","import_mysql_core","getResourceProgressSchema","mysqlTable","userId","varchar","length","notNull","organizationId","organizationMembershipId","resourceId","fields","json","$type","default","completedAt","datetime","mode","fsp","updatedAt","createdAt","sql","crp","userIdLessonIdIdx","index","on","pk","primaryKey","columns","contentResourceIdIdx","userIdIdx","organizationMembershipIdIdx","import_mysql_core","getEntitlementTypesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","name","description","text","table","uniqueName","uniqueIndex","on","import_drizzle_orm","import_mysql_core","getEntitlementsSchema","mysqlTable","id","varchar","length","notNull","primaryKey","entitlementType","userId","organizationId","organizationMembershipId","sourceType","sourceId","metadata","json","$type","default","expiresAt","timestamp","mode","fsp","createdAt","sql","updatedAt","deletedAt","table","userIdIdx","index","on","orgIdIdx","sourceIdx","typeIdx","getEntitlementRelationsSchema","overrides","entitlements","resolveUsersSchema","getUsersSchema","users","orgs","getOrganizationsSchema","memberships","getOrganizationMembershipsSchema","relations","one","user","fields","references","organization","membership","guid","customAlphabet","normalizeExpirationDate","date","undefined","Date","UTC","getUTCFullYear","getUTCMonth","getUTCDate","toError","error","Error","String","logger","baseLogger","getCourseBuilderSchema","mysqlTable","overrides","resolvedGetUsersSchema","getUsersSchema","userRelationsOverrides","accounts","getAccountsSchema","accountsRelations","getAccountsRelationsSchema","permissions","getPermissionsSchema","permissionsRelations","getPermissionsRelationsSchema","rolePermissions","getRolePermissionsSchema","rolePermissionsRelations","getRolePermissionsRelationsSchema","roles","getRolesSchema","rolesRelations","getRolesRelationsSchema","sessions","getSessionsSchema","sessionsRelations","getSessionRelationsSchema","userPermissions","getUserPermissionsSchema","userPermissionsRelations","getUserPermissionsRelationsSchema","userRoles","getUserRolesSchema","userRolesRelations","getUserRolesRelationsSchema","users","usersRelations","getUsersRelationsSchema","verificationTokens","getVerificationTokensSchema","coupon","getCouponSchema","couponRelations","getCouponRelationsSchema","lessonProgress","getLessonProgressSchema","merchantAccount","getMerchantAccountSchema","merchantCharge","getMerchantChargeSchema","merchantChargeRelations","getMerchantChargeRelationsSchema","merchantEvents","getMerchantEventsSchema","merchantEventsRelations","getMerchantEventsRelationsSchema","merchantCoupon","getMerchantCouponSchema","merchantCustomer","getMerchantCustomerSchema","merchantPrice","getMerchantPriceSchema","merchantProduct","getMerchantProductSchema","merchantSession","getMerchantSessionSchema","prices","getPriceSchema","products","getProductSchema","purchases","getPurchaseSchema","purchaseRelations","getPurchaseRelationsSchema","purchaseUserTransfer","getPurchaseUserTransferSchema","purchaseUserTransferRelations","getPurchaseUserTransferRelationsSchema","communicationChannel","getCommunicationChannelSchema","communicationPreferenceTypes","getCommunicationPreferenceTypesSchema","communicationPreferences","getCommunicationPreferencesSchema","communicationPreferencesRelations","getCommunicationPreferencesRelationsSchema","contentContributions","getContentContributionsSchema","contentContributionRelations","getContentContributionRelationsSchema","contentResource","getContentResourceSchema","contentResourceVersion","getContentResourceVersionSchema","contentResourceVersionRelations","getContentResourceVersionRelationsSchema","contentResourceRelations","getContentResourceRelationsSchema","contentResourceResource","getContentResourceResourceSchema","contentResourceResourceRelations","getContentResourceResourceRelationsSchema","contentResourceTag","getContentResourceTagSchema","contentResourceTagRelations","getContentResourceTagRelationsSchema","contributionTypes","getContributionTypesSchema","contributionTypesRelations","getContributionTypesRelationsSchema","resourceProgress","getResourceProgressSchema","questionResponse","getQuestionResponseSchema","questionResponseRelations","getQuestionResponseRelationsSchema","upgradableProducts","getUpgradableProductsSchema","upgradableProductsRelations","getUpgradableProductsRelationsSchema","contentResourceProduct","getContentResourceProductSchema","contentResourceProductRelations","getContentResourceProductRelationsSchema","productRelations","getProductRelationsSchema","comments","getCommentsSchema","commentsRelations","getCommentRelationsSchema","deviceVerifications","getDeviceVerificationSchema","deviceVerificationRelations","getDeviceVerificationRelationsSchema","deviceAccessToken","getDeviceAccessTokenSchema","deviceAccessTokenRelations","getDeviceAccessTokenRelationsSchema","tag","getTagSchema","tagRelations","getTagRelationsSchema","tagTag","getTagTagSchema","tagTagRelations","getTagTagRelationsSchema","userPrefs","getUserPrefsSchema","userPrefsRelations","getUserPrefsRelationsSchema","organization","getOrganizationsSchema","organizationRelations","getOrganizationsRelationsSchema","organizationMemberships","getOrganizationMembershipsSchema","organizationMembershipRelations","getOrganizationMembershipsRelationsSchema","organizationMembershipRoles","getOrganizationMembershipRolesSchema","organizationMembershipRolesRelations","getOrganizationMembershipRolesRelationsSchema","merchantSubscription","getMerchantSubscriptionSchema","merchantSubscriptionRelations","getMerchantSubscriptionRelationsSchema","subscription","getSubscriptionSchema","subscriptionRelations","getSubscriptionRelationsSchema","profiles","getProfilesSchema","profilesRelations","getProfilesRelationsSchema","entitlementTypes","getEntitlementTypesSchema","entitlements","getEntitlementsSchema","entitlementsRelations","getEntitlementRelationsSchema","createTables","mySqlTable","mySqlDrizzleAdapter","client","tableFn","defaultMySqlTableFn","paymentProvider","purchaseTable","organizationTable","organizationMembershipTable","organizationMembershipRoleTable","roleTable","merchantSubscriptionTable","subscriptionTable","entitlementTable","adapter","redeemFullPriceCoupon","options","email","baseEmail","couponId","productIds","currentUserId","redeemingProductId","replace","getCouponWithBulkPurchases","productId","restrictedToProductId","couponValidation","validateCoupon","isRedeemable","bulkCouponRedemption","Boolean","maxUses","user","findOrCreateUser","currentUser","getUserById","redeemingForCurrentUser","id","existingPurchases","getExistingNonBulkValidPurchasesOfProduct","userId","length","errorMessage","info","message","purchase","purchaseId","v4","userMemberships","getMembershipsForUser","organizationId","find","m","name","includes","createPurchase","redeemedBulkCouponId","totalAmount","metadata","couponUsedId","newPurchase","getPurchase","incrementCouponUsedCount","createPurchaseTransfer","sourceUserId","expiresAt","now","insert","values","update","set","usedCount","sql","where","eq","query","findMany","and","status","isNull","bulkCouponId","z","array","purchaseSchema","parse","createMerchantCustomer","identifier","merchantAccountId","merchantCustomerSchema","findFirst","createMerchantCoupon","type","amountDiscount","Math","floor","merchantCouponSchema","getMerchantAccount","merchantAccountSchema","label","provider","getMerchantPriceForProductId","merchantPriceData","merchantProductId","parsedMerchantPrice","merchantPriceSchema","safeParse","success","event","data","getMerchantProductForProductId","merchantProductData","merchantProductSchema","getMerchantCustomerForUserId","merchantCustomerData","getUpgradableProducts","upgradableFromId","upgradableToId","upgradableProductSchema","availableUpgradesForProduct","previousPurchaseProductIds","map","inArray","clearLessonProgressForUser","completeLessonProgressForUser","lessonId","resourceId","completedAt","updatedAt","parsedLessonProgress","resourceProgressSchema","couponForIdOrCode","code","or","gte","expires","with","parsedCoupon","couponSchema","extend","createMerchantSession","MerchantSessionSchema","createMerchantChargeAndPurchase","transaction","trx","stripeChargeId","stripeCouponId","merchantCustomerId","stripeChargeAmount","quantity","checkoutSessionId","appliedPPPStripeCouponId","upgradedFromPurchaseId","country","usedCouponId","existingMerchantCharge","merchantChargeSchema","nullable","existingPurchaseForCharge","merchantChargeId","product","bulkCoupon","newMerchantCharge","existingPurchase","existingBulkCoupon","select","from","leftJoin","then","res","Coupon","isBulkPurchase","bulk","couponToUpdate","merchantCouponToUse","usedCoupon","merchantCouponId","bulkCouponValues","percentageDiscount","merchantSessionId","merchantCouponUsed","pppMerchantCoupon","newPurchaseStatus","toFixed","upgradedFromId","oneWeekInMilliseconds","rollback","parsedPurchase","findOrCreateMerchantCustomer","optional","createMerchantEvent","eventId","payload","createdEvent","merchantEventsSchema","getMerchantEventByIdentifier","getMerchantEventsByAccount","events","orderBy","desc","createdAt","getUserByEmail","newUser","createUser","emailVerified","isNewUser","getCoupon","couponIdOrCode","loadedCoupon","debug","found","getPurchasesForBulkCouponId","userSchema","couponData","bulkCouponPurchases","bulkPurchases","redeemedBulkCouponPurchases","e","method","step","count","couponWithBulkPurchases","merge","object","redeemedBulkCouponPurchasesCount","getDefaultCoupon","activeSaleCoupon","default","validForProdcutId","defaultMerchantCoupon","defaultCoupon","getLessonProgressCountsByDate","getLessonProgressForUser","userProgress","parsed","getModuleProgressForUser","userIdOrEmail","moduleIdOrSlug","columns","ResultRowSchema","resource_id","string","resource_type","enum","resource_slug","completed_at","transform","val","results","execute","completedLessons","nextResource","completedLessonsCount","totalLessonsCount","rows","parsedRows","percentCompleted","row","push","fields","slug","ceil","getLessonProgresses","getMerchantCharge","mCharge","getMerchantCouponsForTypeAndPercent","params","toString","getMerchantCouponForTypeAndPercent","foundMerchantCoupon","getMerchantCouponForTypeAndAmount","getMerchantCoupon","getMerchantProduct","stripeProductId","getPrice","getPriceForProduct","priceSchema","archiveProduct","getProduct","price","nickname","priceId","currentMerchantProduct","nullish","updateProduct","active","currentMerchantPrice","updatePrice","input","currentProduct","stripeProduct","priceChanged","unitAmount","currentStripePrice","membershipTypeChanged","billingIntervalChanged","billingInterval","isMembership","stripePriceMismatch","recurring","needsPriceRecreation","priceParams","unit_amount","Number","currency","interval","currentMerchantPriceId","productSlug","newStripePrice","createPrice","default_price","newMerchantPriceId","images","image","url","description","fieldsNoImage","quantityAvailable","createProduct","hash","newProductId","slugify","newProduct","state","visibility","openEnrollment","closeEnrollment","availableAfterDays","accessDurationDays","priceHash","newPriceId","stripePrice","newMerchantProductId","productSlugOrId","withResources","productData","resources","resource","parsedProduct","productSchema","getProductResources","contentResourceProductsForProduct","ContentResourceProductSchema","contentResources","ContentResourceSchema","crp","getPurchaseCountForProduct","newPurchaseId","getPurchaseForStripeCharge","chargeForPurchase","idPrefix","substring","getPurchaseByCheckoutSessionId","session","getPurchaseUserTransferById","purchaseTransferData","sourceUser","targetUser","purchaseUserTransferSchema","getPurchaseWithUser","purchaseData","getPurchasesForUser","visiblePurchaseStates","userPurchases","asc","parsedPurchases","purchaseCount","getEntitlementsForUser","sourceType","entitlementType","conditions","deletedAt","expiresCondition","userEntitlements","parsedEntitlements","entitlementSchema","entitlementCount","getEntitlementTypeByName","getPurchaseDetails","allPurchases","thePurchase","availableUpgrades","purchaseCanUpgrade","not","p","upgradableTo","upgradableFrom","getUserWithPurchasersByEmail","trim","toLowerCase","role","key","r","pricesOfPurchasesTowardOneBundle","bundleId","canUpgradeProducts","productsPurchased","foundPrices","toggleLessonProgressForUser","transferPurchaseToUser","targetUserId","transferId","transferState","updatedMerchantCharge","updatedMerchantCustomer","updateCustomer","transferredFrom","transferredOn","toISOString","transferPurchasesToNewUser","updatePurchaseStatusForCharge","chargeId","merchantChargeForPurchase","merchantChargeIdentifier","parsedMerchantChargeForPurchase","updatePurchaseUserTransferTransferState","purchaseUserTransferData","addResourceToResource","parentResourceId","childResourceId","parentResourceData","parentResource","resourceOfId","position","resourceJoin","parsedResourceJoin","ContentResourceResourceSchema","removeResourceFromResource","delete","updateContentResourceFields","currentResource","parsedResource","getVideoResource","result","VideoResourceSchema","catch","getParentResourceOfVideoResource","videoResourceId","innerJoin","limit","resourceData","ContentResource","fullResource","createContentResource","crypto","randomUUID","resourceType","getContentResource","resourceIdOrSlug","getEvent","eventIdOrSlug","withTags","withProducts","withPricing","eventQuery","tags","resourceProducts","parsedEvent","addResourceToProduct","addedBy","resourceProduct","createEvent","newEventId","newEvent","title","startsAt","endsAt","createdById","enabled","finalExpires","couponInput","bypassSoldOut","createCoupon","couponError","tagIds","contentResourceId","tagId","createEventSeries","eventSeries","eventSeriesInput","childEvents","childEventsInput","tx","eventSeriesHash","eventSeriesResourceId","newEventSeries","eventSeriesResource","parsedEventSeries","createdChildEvents","i","childEventInput","childEventHash","childEventResourceId","newChildEvent","childEventResource","parsedChildEvent","sharedFields","eventSeriesId","createCohort","cohortId","cohort","dates","start","end","parsedCohort","workshop","workshops","pricing","productError","createWorkshop","workshopId","parsedWorkshop","createdSections","createdLessons","item","structure","sectionHash","sectionId","section","lessonPosition","lessonData","lessons","lessonHash","lessonType","lesson","sections","findClosestDiscount","percentOff","reduce","a","b","aDiff","abs","bDiff","merchantCouponResult","codesArray","personalOrganization","createOrganization","membership","addMemberToOrganization","invitedById","addRoleForMember","memberId","getUser","createSession","sessionToken","getSessionAndUser","updateUser","updateSession","linkAccount","rawAccount","getUserByAccount","account","dbAccount","providerAccountId","User","deleteSession","createVerificationToken","token","useVerificationToken","deletedToken","TIMEOUT_IN_SECONDS","expireMultipleClicks","addSeconds","isAfter","_","verificationToken","err","deleteUser","unlinkAccount","getOrganization","OrganizationSchema","currentMembership","OrganizationMemberSchema","removeMemberFromOrganization","existingRole","roleId","currentOrgMembershipRole","organizationMembershipId","removeRoleForMember","getOrganizationMembers","createSubscription","SubscriptionSchema","getMerchantSubscription","merchantSubscriptionId","MerchantSubscriptionSchema","createMerchantSubscription","updateMerchantSubscription","deleteMerchantSubscription","getSubscriptionForStripeId","stripeSubscriptionId","merchantSubscriptionParsed","subscriptionParsed","updateSubscriptionStatus","subscriptionId"]}
|