@coursebuilder/adapter-drizzle 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3WYG5OE7.js → chunk-3GONHHMY.js} +2 -2
- package/dist/{chunk-WFC55BSF.js → chunk-FPAQINSA.js} +2 -2
- package/dist/{chunk-RCL6HPBL.js → chunk-HWIQUI7O.js} +2 -2
- package/dist/{chunk-QGZ2F5SW.js → chunk-LPJ2P2KJ.js} +1162 -1027
- package/dist/{chunk-L5ZAWSTN.js → chunk-MOV5TUON.js} +376 -116
- package/dist/{chunk-GAKWXOAY.js → chunk-OBUGOZKM.js} +2 -2
- package/dist/{chunk-A6XPL665.js → chunk-PBTEHA7F.js} +2 -2
- package/dist/{chunk-5XTOCFDB.js → chunk-YQNIXCD3.js} +2 -2
- package/dist/index.js +9 -10
- package/dist/lib/mysql/index.cjs +1415 -1088
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +218 -0
- package/dist/lib/mysql/index.d.ts +218 -0
- package/dist/lib/mysql/index.js +9 -10
- package/dist/lib/mysql/schemas/auth/accounts.cjs +106 -98
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.js +2 -2
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs +99 -91
- package/dist/lib/mysql/schemas/auth/device-access-token.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-access-token.js +3 -3
- package/dist/lib/mysql/schemas/auth/device-verification.cjs +100 -92
- package/dist/lib/mysql/schemas/auth/device-verification.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/device-verification.js +3 -3
- package/dist/lib/mysql/schemas/auth/profiles.cjs +254 -0
- package/dist/lib/mysql/schemas/auth/profiles.cjs.map +1 -0
- package/dist/lib/mysql/schemas/auth/profiles.d.cts +112 -0
- package/dist/lib/mysql/schemas/auth/profiles.d.ts +112 -0
- package/dist/lib/mysql/schemas/auth/profiles.js +20 -0
- package/dist/lib/mysql/schemas/auth/profiles.js.map +1 -0
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +55 -46
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.js +3 -3
- package/dist/lib/mysql/schemas/auth/roles.cjs +57 -48
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.js +2 -2
- package/dist/lib/mysql/schemas/auth/sessions.cjs +96 -88
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.js +3 -3
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +99 -91
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.js +2 -2
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs +104 -96
- package/dist/lib/mysql/schemas/auth/user-prefs.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-prefs.js +2 -2
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +58 -49
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.js +2 -2
- package/dist/lib/mysql/schemas/auth/users.cjs +295 -259
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +1 -0
- package/dist/lib/mysql/schemas/auth/users.d.ts +1 -0
- package/dist/lib/mysql/schemas/auth/users.js +2 -2
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +131 -123
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +96 -88
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs +90 -82
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +2 -2
- package/dist/lib/mysql/schemas/commerce/price.cjs +98 -90
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.js +2 -2
- package/dist/lib/mysql/schemas/commerce/product.cjs +125 -117
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.js +2 -2
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +131 -123
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +3 -3
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +184 -176
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.js +2 -2
- package/dist/lib/mysql/schemas/commerce/subscription.cjs +117 -109
- package/dist/lib/mysql/schemas/commerce/subscription.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/subscription.js +2 -2
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +105 -97
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +3 -3
- package/dist/lib/mysql/schemas/communication/comment.cjs +114 -106
- package/dist/lib/mysql/schemas/communication/comment.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/comment.js +2 -2
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +136 -128
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +2 -2
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +144 -136
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.js +2 -2
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +99 -91
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.js +2 -2
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +108 -100
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +2 -2
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs +118 -110
- package/dist/lib/mysql/schemas/content/content-resource-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-tag.js +2 -2
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs +121 -113
- package/dist/lib/mysql/schemas/content/content-resource-version.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-version.js +2 -2
- package/dist/lib/mysql/schemas/content/content-resource.cjs +198 -190
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.js +2 -2
- package/dist/lib/mysql/schemas/content/tag-tag.cjs +103 -95
- package/dist/lib/mysql/schemas/content/tag-tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag-tag.js +2 -2
- package/dist/lib/mysql/schemas/content/tag.cjs +116 -108
- package/dist/lib/mysql/schemas/content/tag.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/tag.js +2 -2
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs +73 -35
- package/dist/lib/mysql/schemas/org/organization-membership-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.cts +1 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.d.ts +1 -0
- package/dist/lib/mysql/schemas/org/organization-membership-roles.js +2 -3
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs +88 -38
- package/dist/lib/mysql/schemas/org/organization-memberships.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organization-memberships.d.cts +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.d.ts +1 -0
- package/dist/lib/mysql/schemas/org/organization-memberships.js +2 -2
- package/dist/lib/mysql/schemas/org/organizations.cjs +131 -121
- package/dist/lib/mysql/schemas/org/organizations.cjs.map +1 -1
- package/dist/lib/mysql/schemas/org/organizations.js +2 -2
- package/package.json +4 -3
- package/src/lib/mysql/index.ts +320 -26
- package/src/lib/mysql/schemas/auth/profiles.ts +50 -0
- package/src/lib/mysql/schemas/auth/roles.ts +6 -1
- package/src/lib/mysql/schemas/auth/users.ts +6 -1
- package/src/lib/mysql/schemas/commerce/subscription.ts +3 -5
- package/src/lib/mysql/schemas/org/organization-membership-roles.ts +7 -0
- package/src/lib/mysql/schemas/org/organization-memberships.ts +6 -0
- package/dist/chunk-RP66NZN3.js +0 -81
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mysql/index.ts","../../../../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs","../../../../core/dist/chunk-VLQXSCFN.js","../../../../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs","../../../../core/src/schemas/video-resource.ts","../../../../core/src/schemas/user-schema.ts","../../../../core/src/schemas/price-schema.ts","../../../../core/src/schemas/content-resource-schema.ts","../../../../core/src/schemas/product-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/upgradable-product-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/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/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/user-permissions.ts","../../../src/lib/mysql/schemas/auth/permissions.ts","../../../src/lib/mysql/schemas/auth/user-prefs.ts","../../../src/lib/mysql/schemas/auth/user-roles.ts","../../../src/lib/mysql/schemas/auth/roles.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/org/organization-membership-roles.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 { type ModuleProgress } from '@coursebuilder/core/schemas/resource-progress-schema'\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\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 {\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} 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} = 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\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\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 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} = 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})\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...(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\tconst merchantSessionId = `ms_${v4()}`\n\n\t\t\t\t\tconst newMerchantSession = await client\n\t\t\t\t\t\t.insert(merchantSession)\n\t\t\t\t\t\t.values({\n\t\t\t\t\t\t\tid: merchantSessionId,\n\t\t\t\t\t\t\tidentifier: checkoutSessionId,\n\t\t\t\t\t\t\tmerchantAccountId,\n\t\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\tconst newPurchase = await 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})\n\n\t\t\t\t\tconst oneWeekInMilliseconds = 1000 * 60 * 60 * 24 * 7\n\n\t\t\t\t\tconst newPurchaseUserTransfer = await client\n\t\t\t\t\t\t.insert(purchaseUserTransfer)\n\t\t\t\t\t\t.values({\n\t\t\t\t\t\t\tid: `put_${v4()}`,\n\t\t\t\t\t\t\tpurchaseId: purchaseId as string,\n\t\t\t\t\t\t\texpiresAt: existingPurchase\n\t\t\t\t\t\t\t\t? new Date()\n\t\t\t\t\t\t\t\t: new Date(Date.now() + oneWeekInMilliseconds),\n\t\t\t\t\t\t\tsourceUserId: userId,\n\t\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\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 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']),\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')\n\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})\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: 'self-paced',\n\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\tfields: {\n\t\t\t\t\tstate: 'draft',\n\t\t\t\t\tvisibility: '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}),\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\treturn 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, id))\n\t\t\t\t\t.then((res) => res[0] as AdapterUser)\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}\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 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 get errors() {\n return this.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 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 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: issueData.message || errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n 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 syncPairs.push({\n key: await pair.key,\n value: await pair.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\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\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 if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\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 }\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 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 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, this._def);\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 = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;\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;\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;\nconst ipv4Regex = /^(((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 = /^(([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})))$/;\n// Adapted from https://stackoverflow.com/a/3143231\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\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}\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 //\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 === \"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 === \"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 {\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 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 ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: 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 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\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 * @deprecated Use z.string().min(1) instead.\n * @see {@link ZodString.min}\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 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 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 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 input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\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 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 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 syncPairs.push({\n key,\n value: await pair.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 Object.keys(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 {\n return null;\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) {\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 });\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 _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._def.values.indexOf(input.data) === -1) {\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) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nZodEnum.create = createZodEnum;\nclass 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 &&\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 (nativeEnumValues.indexOf(input.data) === -1) {\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};\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.issues.length) {\n return {\n status: \"dirty\",\n value: ctx.data,\n };\n }\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc\n // effect: RefinementEffect<any>\n ) => {\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 if (isValid(result)) {\n result.value = Object.freeze(result.value);\n }\n return result;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\nconst 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 if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\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 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, 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 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 get errors() {\n return this.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 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 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: issueData.message || errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n 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 syncPairs.push({\n key: await pair.key,\n value: await pair.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\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\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 if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\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 }\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 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 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, this._def);\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 = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;\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;\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;\nconst ipv4Regex = /^(((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 = /^(([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})))$/;\n// Adapted from https://stackoverflow.com/a/3143231\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\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}\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 //\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 === \"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 === \"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 {\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 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 ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: 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 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\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 * @deprecated Use z.string().min(1) instead.\n * @see {@link ZodString.min}\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 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 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 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 input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\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 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 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 syncPairs.push({\n key,\n value: await pair.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 Object.keys(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 {\n return null;\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) {\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 });\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 _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._def.values.indexOf(input.data) === -1) {\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) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nZodEnum.create = createZodEnum;\nclass 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 &&\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 (nativeEnumValues.indexOf(input.data) === -1) {\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};\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.issues.length) {\n return {\n status: \"dirty\",\n value: ctx.data,\n };\n }\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc\n // effect: RefinementEffect<any>\n ) => {\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 if (isValid(result)) {\n result.value = Object.freeze(result.value);\n }\n return result;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\nconst 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 if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\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 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, 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 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 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().nullable(),\n\timage: z.string().max(255).optional().nullable(),\n\tcreatedAt: z.coerce.date().nullable(),\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}),\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\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\tname: z.string().max(191),\n\tkey: z.string().max(191).optional().nullable(),\n\ttype: z.enum(['live', 'self-paced']).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})\n\nexport type NewProduct = z.infer<typeof NewProductSchema>\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})\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})\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 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 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","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 { 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 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 }) => ({\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 { 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\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}))\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 { getUsersSchema } from '../auth/users.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 { getMerchantSubscriptionSchema } from './merchant-subscription.js'\nimport { getProductSchema } from './product.js'\n\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('Valid').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 } 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 } 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 } from 'drizzle-orm'\nimport {\n\tboolean,\n\tindex,\n\tMySqlTableFn,\n\ttext,\n\ttimestamp,\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().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(role) => ({\n\t\t\tnameIdx: index('name_idx').on(role.name),\n\t\t\torganizationIdIdx: index('organizationId_idx').on(role.organizationId),\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, 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 { 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'\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\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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AA,GAAM;AAEvC,kBAAM,EAAExB,IAAIyX,GAAG,GAAGC,kBAAAA,IAAsBR;AACxC,mBAAOE;UACR,OAAO;AACN,kBAAMnZ,OACJoX,OAAOnf,kBAAAA,EACP6L,UACAI,8BACCH,yBAAG9L,mBAAmB2M,YAAYqU,MAAMrU,UAAU,OAClDb,yBAAG9L,mBAAmBghB,OAAOA,MAAMA,KAAK,CAAA,CAAA;AAG3C,mBAAOE;UACR;QACD;AAEA,eAAOA;MACR,SAASO,KAAK;AACb,cAAM,IAAIvY,MAAM,8BAAA;MACjB;IACD;IACA,MAAMwY,WAAW5X,IAAE;AAClB,YAAML,OAAO,MAAM1B,OACjBoJ,OAAM,EACNC,KAAKxR,KAAAA,EACLiM,UAAMC,yBAAGlM,MAAMkK,IAAIA,EAAAA,CAAAA,EACnBwH,KAAK,CAACC,QAAQA,IAAI,CAAA,KAAM,IAAA;AAE1B,YAAMxJ,OAAOoX,OAAOvf,KAAAA,EAAOiM,UAAMC,yBAAGlM,MAAMkK,IAAIA,EAAAA,CAAAA;AAC9C,YAAM/B,OAAOoX,OAAOngB,QAAAA,EAAU6M,UAAMC,yBAAG9M,SAASiL,QAAQH,EAAAA,CAAAA;AACxD,YAAM/B,OAAOoX,OAAOnhB,QAAAA,EAAU6N,UAAMC,yBAAG9N,SAASiM,QAAQH,EAAAA,CAAAA;AAExD,aAAOL;IACR;IACA,MAAMkY,cAAcjB,SAAO;AAC1B,YAAM3Y,OACJoX,OAAOnhB,QAAAA,EACP6N,UACAI,8BACCH,yBAAG9N,SAAS4iB,mBAAmBF,QAAQE,iBAAiB,OACxD9U,yBAAG9N,SAASkP,UAAUwT,QAAQxT,QAAQ,CAAA,CAAA;AAIzC,aAAOhB;IACR;EACD;AAEA,SAAO9D;AACR;AAhxEgBN;","names":["import_date_fns","import_drizzle_orm","import_mysql_core","util","objectUtil","json","errorUtil","errorMap","_a","ctx","result","index","issues","elements","processed","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","errorUtil","_ParseInputLazyPath","ParseInputLazyPath","handleResult","processCreateParams","_ZodType","ZodEffects","ZodFirstPartyTypeKind","ZodOptional","ZodNullable","ZodArray","ZodPromise","ZodUnion","ZodIntersection","ZodDefault","ZodBranded","ZodCatch","ZodPipeline","ZodReadonly","ZodType","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv6Regex","datetimeRegex","isValidIP","_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","custom","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","VideoResourceSchema","z","object","id","string","updatedAt","coerce","date","optional","createdAt","title","nullable","duration","number","muxPlaybackId","muxAssetId","transcript","transcriptWithScreenshots","srt","wordLevelSrt","state","enum","userSchema","z","object","id","string","max","name","optional","nullable","role","enum","default","email","emailVerified","coerce","date","image","createdAt","roles","array","description","active","boolean","priceSchema","z","object","id","string","max","productId","optional","nullable","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","name","key","optional","nullable","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","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","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","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","upgradableProductSchema","z","object","upgradableToId","string","max","upgradableFromId","position","number","default","metadata","record","any","createdAt","date","nullable","updatedAt","deletedAt","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","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","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","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","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","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","import_drizzle_orm","import_mysql_core","import_drizzle_orm","import_mysql_core","getRolesSchema","mysqlTable","id","varchar","length","notNull","primaryKey","organizationId","name","unique","description","text","active","boolean","default","createdAt","timestamp","mode","fsp","defaultNow","updatedAt","deletedAt","role","nameIdx","index","on","organizationIdIdx","getRolesRelationsSchema","roles","userRoles","getUserRolesSchema","relations","many","relationName","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","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","accounts","getAccountsSchema","communicationPreferences","getCommunicationPreferencesSchema","userRoles","getUserRolesSchema","userPermissions","getUserPermissionsSchema","contentContributions","getContentContributionsSchema","contentResource","getContentResourceSchema","purchases","getPurchaseSchema","comments","getCommentsSchema","userPrefs","getUserPrefsSchema","organizationMemberships","getOrganizationMembershipsSchema","relations","many","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_drizzle_orm","import_mysql_core","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","relations","one","organizationMembership","fields","references","id","relationName","role","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","createTables","mySqlTable","mySqlDrizzleAdapter","client","tableFn","defaultMySqlTableFn","paymentProvider","purchaseTable","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","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","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","newMerchantSession","merchantCouponUsed","pppMerchantCoupon","type","newPurchaseStatus","toFixed","upgradedFromId","oneWeekInMilliseconds","newPurchaseUserTransfer","rollback","parsedPurchase","findOrCreateMerchantCustomer","optional","name","getUserByEmail","newUser","createUser","emailVerified","isNewUser","getCoupon","couponIdOrCode","loadedCoupon","logger","debug","couponData","bulkCouponPurchases","bulkPurchases","redeemedBulkCouponPurchases","e","log","couponWithBulkPurchases","merge","object","getDefaultCoupon","activeSaleCoupon","default","orderBy","desc","validForProdcutId","includes","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","userSchema","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","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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/mysql/index.ts","../../../../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs","../../../../core/dist/chunk-VLQXSCFN.js","../../../../../node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs","../../../../core/src/schemas/video-resource.ts","../../../../core/src/schemas/purchase-user-transfer-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/schemas/coupon-schema.ts","../../../../core/src/schemas/purchase-schema.ts","../../../../core/src/schemas/merchant-charge-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-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"],"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 {\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} 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\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\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} = 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})\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...(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})\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})\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\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 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})\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: 'self-paced',\n\t\t\t\tquantityAvailable: input.quantityAvailable,\n\t\t\t\tfields: {\n\t\t\t\t\tstate: 'draft',\n\t\t\t\t\tvisibility: '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}),\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 id = crypto.randomUUID()\n\t\t\tawait client.insert(organizationMembershipTable).values({\n\t\t\t\t...options,\n\t\t\t\tid,\n\t\t\t})\n\n\t\t\treturn OrganizationMemberSchema.parse(\n\t\t\t\tawait client.query.organizationMemberships.findFirst({\n\t\t\t\t\twhere: eq(organizationMembershipTable.id, id),\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\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 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 get errors() {\n return this.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 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 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: issueData.message || errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n 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 syncPairs.push({\n key: await pair.key,\n value: await pair.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\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\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 if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\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 }\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 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 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, this._def);\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 = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;\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;\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;\nconst ipv4Regex = /^(((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 = /^(([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})))$/;\n// Adapted from https://stackoverflow.com/a/3143231\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\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}\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 //\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 === \"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 === \"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 {\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 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 ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: 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 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\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 * @deprecated Use z.string().min(1) instead.\n * @see {@link ZodString.min}\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 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 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 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 input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\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 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 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 syncPairs.push({\n key,\n value: await pair.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 Object.keys(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 {\n return null;\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) {\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 });\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 _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._def.values.indexOf(input.data) === -1) {\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) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nZodEnum.create = createZodEnum;\nclass 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 &&\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 (nativeEnumValues.indexOf(input.data) === -1) {\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};\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.issues.length) {\n return {\n status: \"dirty\",\n value: ctx.data,\n };\n }\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc\n // effect: RefinementEffect<any>\n ) => {\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 if (isValid(result)) {\n result.value = Object.freeze(result.value);\n }\n return result;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\nconst 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 if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\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 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, 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 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 get errors() {\n return this.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 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 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: issueData.message || errorMessage,\n };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n getErrorMap(),\n 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 syncPairs.push({\n key: await pair.key,\n value: await pair.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\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\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 if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\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 }\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 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 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, this._def);\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 = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;\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;\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;\nconst ipv4Regex = /^(((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 = /^(([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})))$/;\n// Adapted from https://stackoverflow.com/a/3143231\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\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}\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 //\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 === \"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 === \"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 {\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 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 ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: 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 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\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 * @deprecated Use z.string().min(1) instead.\n * @see {@link ZodString.min}\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 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 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 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 input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\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 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 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 syncPairs.push({\n key,\n value: await pair.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 Object.keys(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 {\n return null;\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) {\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 });\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 _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._def.values.indexOf(input.data) === -1) {\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) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nZodEnum.create = createZodEnum;\nclass 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 &&\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 (nativeEnumValues.indexOf(input.data) === -1) {\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};\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.issues.length) {\n return {\n status: \"dirty\",\n value: ctx.data,\n };\n }\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc\n // effect: RefinementEffect<any>\n ) => {\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 if (isValid(result)) {\n result.value = Object.freeze(result.value);\n }\n return result;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\nconst 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 if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\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 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, 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 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\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 { 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']).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 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.enum(['live', 'self-paced', 'membership']).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})\n\nexport type NewProduct = z.infer<typeof NewProductSchema>\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 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 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 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\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,OAAO;QACrD,GAAGlD;QACHwB;MACD,CAAA;AAEA,aAAOqZ,2BAA2B1W,MACjC,MAAMhF,OAAOsE,MAAMrF,qBAAqBoG,UAAU;QACjDjB,WAAOC,yBAAG5D,0BAA0B4B,IAAIA,EAAAA;MACzC,CAAA,CAAA;IAEF;IACAuZ,4BAA4B,OAAO/a,YAAAA;AAIlC,YAAM,IAAIY,MAAM,iBAAA;IACjB;IACAoa,4BAA4B,OAAOJ,2BAAAA;AAClC,YAAM,IAAIha,MAAM,iBAAA;IACjB;IACAqa,4BAA4B,OAAOC,yBAAAA;AAClC,YAAMC,6BAA6BN,2BAA2B3V,UAC7D,MAAM/F,OAAOsE,MAAMrF,qBAAqBoG,UAAU;QACjDjB,WAAOC,yBAAG5D,0BAA0ByE,YAAY6W,oBAAAA;MACjD,CAAA,CAAA;AAGD,UAAI,CAACC,2BAA2BhW,SAAS;AACxC,cAAM,IAAIvE,MACT,gDAAgDsa,oBAAAA,IAAwBC,2BAA2BpZ,KAAK,EAAE;MAE5G;AAEA,YAAMqZ,qBAAqBV,mBAAmBxV,UAC7C,MAAM/F,OAAOsE,MAAMjF,aAAagG,UAAU;QACzCjB,WAAOC,yBACN3D,kBAAkB+a,wBAClBO,2BAA2B7V,KAAK9D,EAAE;QAEnCyF,MAAM;UACL0B,SAAS;QACV;MACD,CAAA,CAAA;AAGD,UAAI,CAACyS,mBAAmBjW,SAAS;AAChC,cAAM,IAAIvE,MACT,mDAAmDua,2BAA2B7V,KAAK9D,EAAE,IAAI4Z,mBAAmBrZ,KAAK,EAAE;MAErH;AAEA,aAAOqZ,mBAAmB9V;IAC3B;EACD;AAEA,SAAOxF;AACR;AAxiFgBZ;","names":["import_date_fns","import_drizzle_orm","import_mysql_core","util","objectUtil","json","errorUtil","errorMap","_a","ctx","result","index","issues","elements","processed","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","errorUtil","_ParseInputLazyPath","ParseInputLazyPath","handleResult","processCreateParams","_ZodType","ZodEffects","ZodFirstPartyTypeKind","ZodOptional","ZodNullable","ZodArray","ZodPromise","ZodUnion","ZodIntersection","ZodDefault","ZodBranded","ZodCatch","ZodPipeline","ZodReadonly","ZodType","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv6Regex","datetimeRegex","isValidIP","_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","custom","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","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","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","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","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","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","merchantChargeSchema","z","object","id","string","max","status","number","int","default","identifier","userId","merchantAccountId","merchantProductId","createdAt","date","nullable","merchantCustomerId","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","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","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","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","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","organizationId","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","name","getUserByEmail","newUser","createUser","emailVerified","isNewUser","getCoupon","couponIdOrCode","loadedCoupon","logger","debug","couponData","bulkCouponPurchases","bulkPurchases","redeemedBulkCouponPurchases","e","log","couponWithBulkPurchases","merge","object","getDefaultCoupon","activeSaleCoupon","default","orderBy","desc","validForProdcutId","includes","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","userSchema","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","OrganizationMemberSchema","removeMemberFromOrganization","existingRole","roleId","currentOrgMembershipRole","organizationMembershipId","removeRoleForMember","getMembershipsForUser","getOrganizationMembers","createSubscription","SubscriptionSchema","getMerchantSubscription","merchantSubscriptionId","MerchantSubscriptionSchema","createMerchantSubscription","updateMerchantSubscription","deleteMerchantSubscription","getSubscriptionForStripeId","stripeSubscriptionId","merchantSubscriptionParsed","subscriptionParsed"]}
|