@coursebuilder/core
Version:
Core package for Course Builder
1 lines • 25.4 kB
Source Map (JSON)
{"version":3,"sources":["../src/adapters.ts"],"sourcesContent":["import { type Adapter } from '@auth/core/adapters'\n\nimport {\n\tContentResourceResource,\n\tMerchantCharge,\n\tNewProduct,\n\tUpgradableProduct,\n} from './schemas'\nimport { type ContentResource } from './schemas/content-resource-schema'\nimport { Coupon } from './schemas/coupon-schema'\nimport { MerchantAccount } from './schemas/merchant-account-schema'\nimport { MerchantCoupon } from './schemas/merchant-coupon-schema'\nimport { MerchantCustomer } from './schemas/merchant-customer-schema'\nimport { MerchantPrice } from './schemas/merchant-price-schema'\nimport { MerchantProduct } from './schemas/merchant-product-schema'\nimport { MerchantSession } from './schemas/merchant-session'\nimport { MerchantSubscription } from './schemas/merchant-subscription'\nimport { OrganizationMember } from './schemas/organization-member'\nimport { Organization } from './schemas/organization-schema'\nimport { Price } from './schemas/price-schema'\nimport { Product } from './schemas/product-schema'\nimport { Purchase } from './schemas/purchase-schema'\nimport {\n\tPurchaseUserTransfer,\n\tPurchaseUserTransferState,\n} from './schemas/purchase-user-transfer-schema'\nimport {\n\tModuleProgress,\n\tResourceProgress,\n} from './schemas/resource-progress-schema'\nimport { Subscription } from './schemas/subscription'\nimport { User } from './schemas/user-schema'\nimport { VideoResource } from './schemas/video-resource'\nimport { type Awaitable } from './types'\n\nexport interface CourseBuilderAdapter<\n\tTDatabaseInstance extends abstract new (...args: any) => any = any,\n> extends Adapter,\n\t\tSkillProductsCommerceSdk {\n\tclient: InstanceType<TDatabaseInstance>\n\tarchiveProduct(productId: string): Promise<Product | null>\n\tcreateProduct(product: NewProduct): Promise<Product | null>\n\tupdateProduct(product: Product): Promise<Product | null>\n\tcreatePurchase(options: {\n\t\tid?: string\n\t\tuserId: string\n\t\tproductId: string\n\t\tmerchantChargeId?: string\n\t\tmerchantSessionId?: string\n\t\ttotalAmount: string\n\t\tcouponId?: string | null\n\t\tredeemedBulkCouponId?: string | null\n\t\tstatus?: string\n\t\tmetadata?: Record<string, any>\n\t\torganizationId?: string\n\t}): Promise<Purchase>\n\taddResourceToResource(options: {\n\t\tchildResourceId: string\n\t\tparentResourceId: string\n\t}): Awaitable<ContentResourceResource | null>\n\tremoveResourceFromResource(options: {\n\t\tchildResourceId: string\n\t\tparentResourceId: string\n\t}): Promise<ContentResource | null>\n\tcreateContentResource(resource: {\n\t\tid: string\n\t\ttype: string\n\t\tfields: Record<string, any>\n\t\tcreatedById: string\n\t}): Awaitable<ContentResource>\n\tgetContentResource(id: string): Promise<ContentResource | null>\n\tgetVideoResource(id: string | null | undefined): Promise<VideoResource | null>\n\tupdateContentResourceFields(options: {\n\t\tid: string\n\t\tfields: Record<string, any>\n\t}): Awaitable<ContentResource | null>\n\tgetPriceForProduct(productId: string): Promise<Price | null>\n\tgetUpgradableProducts(options: {\n\t\tupgradableFromId: string\n\t\tupgradableToId: string\n\t}): Promise<UpgradableProduct[]>\n\tgetMerchantCustomerForUserId(userId: string): Promise<MerchantCustomer | null>\n\tgetMerchantAccount(options: {\n\t\tprovider: 'stripe'\n\t}): Promise<MerchantAccount | null>\n\tcreateMerchantSession(options: {\n\t\tidentifier: string\n\t\tmerchantAccountId: string\n\t\torganizationId?: string\n\t}): Promise<MerchantSession>\n\tcreateMerchantCustomer(options: {\n\t\tuserId: string\n\t\tidentifier: string\n\t\tmerchantAccountId: string\n\t}): Promise<MerchantCustomer | null>\n\tgetMerchantPriceForProductId(productId: string): Promise<MerchantPrice | null>\n\ttransferPurchaseToUser(options: {\n\t\tpurchaseId: string\n\t\ttargetUserId: string\n\t\tsourceUserId: string\n\t}): Promise<PurchaseUserTransfer | null>\n\tcreateOrganization(options: { name: string }): Promise<Organization | null>\n\tgetOrganization(organizationId: string): Promise<Organization | null>\n\taddMemberToOrganization(options: {\n\t\torganizationId: string\n\t\tuserId: string\n\t\tinvitedById: string\n\t}): Promise<OrganizationMember | null>\n\tremoveMemberFromOrganization(options: {\n\t\torganizationId: string\n\t\tuserId: string\n\t}): Promise<void>\n\taddRoleForMember(options: {\n\t\torganizationId: string\n\t\tmemberId: string\n\t\trole: string\n\t}): Promise<void>\n\tremoveRoleForMember(options: {\n\t\torganizationId: string\n\t\tmemberId: string\n\t\trole: string\n\t}): Promise<void>\n\tgetMembershipsForUser(userId: string): Promise<OrganizationMember[]>\n\tgetOrganizationMembers(organizationId: string): Promise<OrganizationMember[]>\n\tgetMerchantSubscription(\n\t\tmerchantSubscriptionId: string,\n\t): Promise<MerchantSubscription | null>\n\tcreateMerchantSubscription(options: {\n\t\tmerchantAccountId: string\n\t\tmerchantCustomerId: string\n\t\tmerchantProductId: string\n\t\tidentifier: string\n\t}): Promise<MerchantSubscription | null>\n\tupdateMerchantSubscription(options: {\n\t\tmerchantSubscriptionId: string\n\t\tstatus: string\n\t}): Promise<MerchantSubscription | null>\n\tdeleteMerchantSubscription(merchantSubscriptionId: string): Promise<void>\n\tcreateSubscription(options: {\n\t\torganizationId: string\n\t\tmerchantSubscriptionId: string\n\t\tproductId: string\n\t}): Promise<Subscription | null>\n\tgetSubscriptionForStripeId(\n\t\tstripeSubscriptionId: string,\n\t): Promise<Subscription | null>\n\tgetPurchasesForBulkCouponId(\n\t\tbulkCouponId: string,\n\t): Promise<(Purchase & { user: User })[]>\n}\n\nexport const MockCourseBuilderAdapter: CourseBuilderAdapter = {\n\tclient: null,\n\ttransferPurchaseToUser: async () => {\n\t\treturn null\n\t},\n\tredeemFullPriceCoupon: async () => {\n\t\treturn {} as any\n\t},\n\tarchiveProduct: async (productId) => {\n\t\treturn {} as any\n\t},\n\tupdateProduct: async (product) => {\n\t\treturn {} as any\n\t},\n\tcreateProduct: async (product) => {\n\t\treturn {} as any\n\t},\n\tcreatePurchaseTransfer: async () => {\n\t\treturn Promise.resolve()\n\t},\n\tincrementCouponUsedCount(_) {\n\t\treturn Promise.resolve()\n\t},\n\tgetExistingNonBulkValidPurchasesOfProduct: async () => {\n\t\treturn []\n\t},\n\tgetMerchantPriceForProductId: async (productId) => null,\n\tgetMerchantProductForProductId: async (productId) => null,\n\tgetMerchantAccount: async () => null,\n\tcreateMerchantCustomer: async () => null,\n\tgetMerchantCustomerForUserId: async () => null,\n\tgetUpgradableProducts: async () => [],\n\tcreatePurchase: async (options) => {\n\t\tthrow new Error('Method not implemented.')\n\t},\n\tavailableUpgradesForProduct(\n\t\tpurchases: any,\n\t\tproductId: string,\n\t): Promise<\n\t\t{\n\t\t\tupgradableTo: { id: string; name: string }\n\t\t\tupgradableFrom: { id: string; name: string }\n\t\t}[]\n\t> {\n\t\treturn Promise.resolve([])\n\t},\n\tclearLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessons: { id: string; slug: string }[]\n\t}): Promise<void> {\n\t\treturn Promise.resolve(undefined)\n\t},\n\tcompleteLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessonId?: string\n\t}): Promise<ResourceProgress | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tcouponForIdOrCode(options: {\n\t\tcode?: string\n\t\tcouponId?: string\n\t}): Promise<(Coupon & { merchantCoupon: MerchantCoupon }) | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tcreateMerchantChargeAndPurchase(options: {\n\t\tuserId: string\n\t\tproductId: string\n\t\tstripeChargeId: string\n\t\tstripeCouponId?: string\n\t\tmerchantAccountId: string\n\t\tmerchantProductId: string\n\t\tmerchantCustomerId: string\n\t\tstripeChargeAmount: number\n\t\tquantity?: number\n\t\tbulk?: boolean\n\t\tcheckoutSessionId: string\n\t\tappliedPPPStripeCouponId?: string\n\t\tupgradedFromPurchaseId?: string\n\t\tusedCouponId?: string\n\t\tcountry?: string\n\t\torganizationId?: string\n\t}): Promise<Purchase> {\n\t\tthrow new Error('Method not implemented.')\n\t},\n\tfindOrCreateMerchantCustomer(options: {\n\t\tuser: User\n\t\tidentifier: string\n\t\tmerchantAccountId: string\n\t}): Promise<MerchantCustomer | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tfindOrCreateUser(\n\t\temail: string,\n\t\tname?: string | null,\n\t): Promise<{\n\t\tuser: User\n\t\tisNewUser: boolean\n\t}> {\n\t\tthrow new Error('Method not implemented.')\n\t},\n\tgetCoupon(couponIdOrCode: string): Promise<Coupon | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetCouponWithBulkPurchases(couponId: string): Promise<\n\t\t| (Coupon & {\n\t\t\t\tredeemedBulkCouponPurchases: Purchase[]\n\t\t\t\tbulkPurchase?: Purchase | null\n\t\t })\n\t\t| null\n\t> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetDefaultCoupon(productIds?: string[]): Promise<{\n\t\tdefaultMerchantCoupon: MerchantCoupon\n\t\tdefaultCoupon: Coupon\n\t} | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetLessonProgressCountsByDate(): Promise<\n\t\t{\n\t\t\tcount: number\n\t\t\tcompletedAt: string\n\t\t}[]\n\t> {\n\t\treturn Promise.resolve([])\n\t},\n\tgetLessonProgressForUser(userId: string): Promise<ResourceProgress[]> {\n\t\treturn Promise.resolve([])\n\t},\n\tgetModuleProgressForUser(\n\t\tuserId: string,\n\t\tmoduleId: string,\n\t): Promise<ModuleProgress> {\n\t\treturn Promise.resolve({\n\t\t\tcompletedLessons: [],\n\t\t\tnextResource: null,\n\t\t\tpercentCompleted: 0,\n\t\t\tcompletedLessonsCount: 0,\n\t\t\ttotalLessonsCount: 0,\n\t\t})\n\t},\n\tgetLessonProgresses(): Promise<ResourceProgress[]> {\n\t\treturn Promise.resolve([])\n\t},\n\tgetMerchantCharge(merchantChargeId: string): Promise<MerchantCharge | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetMerchantCouponForTypeAndPercent(params: {\n\t\ttype: string\n\t\tpercentageDiscount: number\n\t}): Promise<MerchantCoupon | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetMerchantCouponsForTypeAndPercent(params: {\n\t\ttype: string\n\t\tpercentageDiscount: number\n\t}): Promise<MerchantCoupon[]> {\n\t\treturn Promise.resolve([])\n\t},\n\tgetMerchantCoupon(merchantCouponId: string): Promise<MerchantCoupon | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetMerchantProduct(stripeProductId: string): Promise<MerchantProduct | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPrice(productId: string): Promise<Price | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPriceForProduct(productId: string): Promise<Price | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetProduct(\n\t\tproductId?: string,\n\t\twithResources: boolean = true,\n\t): Promise<Product | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetProductResources(productId: string): Promise<ContentResource[] | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPurchaseCountForProduct(productId: string): Promise<number> {\n\t\treturn Promise.resolve(0)\n\t},\n\tgetPurchase(purchaseId: string): Promise<Purchase | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPurchaseDetails(\n\t\tpurchaseId: string,\n\t\tuserId: string,\n\t): Promise<{\n\t\tpurchase?: Purchase\n\t\texistingPurchase?: Purchase | null\n\t\tavailableUpgrades: UpgradableProduct[]\n\t}> {\n\t\treturn Promise.resolve({ availableUpgrades: [] })\n\t},\n\tgetPurchaseForStripeCharge(stripeChargeId: string): Promise<Purchase | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPurchaseUserTransferById(options: { id: string }): Promise<\n\t\t| (PurchaseUserTransfer & {\n\t\t\t\tsourceUser: User\n\t\t\t\ttargetUser: User | null\n\t\t\t\tpurchase: Purchase\n\t\t })\n\t\t| null\n\t> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPurchaseWithUser(purchaseId: string): Promise<\n\t\t| (Purchase & {\n\t\t\t\tuser: User\n\t\t })\n\t\t| null\n\t> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetUserWithPurchasersByEmail(email: string): Promise<any | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tgetPurchasesForUser(userId?: string): Promise<Purchase[]> {\n\t\treturn Promise.resolve([])\n\t},\n\tgetUserById(userId: string): Promise<User | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\tpricesOfPurchasesTowardOneBundle(options: {\n\t\tuserId: string | undefined\n\t\tbundleId: string\n\t}): Promise<Price[]> {\n\t\treturn Promise.resolve([])\n\t},\n\ttoggleLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessonId?: string\n\t\tlessonSlug?: string\n\t}): Promise<ResourceProgress | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\ttransferPurchasesToNewUser(options: {\n\t\tmerchantCustomerId: string\n\t\tuserId: string\n\t}): Promise<unknown> {\n\t\treturn Promise.resolve(undefined)\n\t},\n\tupdatePurchaseStatusForCharge(\n\t\tchargeId: string,\n\t\tstatus: 'Valid' | 'Refunded' | 'Disputed' | 'Banned' | 'Restricted',\n\t): Promise<Purchase | undefined> {\n\t\treturn Promise.resolve(undefined)\n\t},\n\tupdatePurchaseUserTransferTransferState(options: {\n\t\tid: string\n\t\ttransferState: PurchaseUserTransferState\n\t}): Promise<PurchaseUserTransfer | null> {\n\t\treturn Promise.resolve(null)\n\t},\n\taddResourceToResource: async (options) => {\n\t\treturn {} as ContentResourceResource\n\t},\n\tremoveResourceFromResource: async (options) => {\n\t\treturn null\n\t},\n\tcreateContentResource: async (resource) => {\n\t\treturn resource as ContentResource\n\t},\n\tgetContentResource: async (_) => {\n\t\treturn null\n\t},\n\tgetVideoResource: async (_) => {\n\t\treturn null\n\t},\n\tupdateContentResourceFields(_) {\n\t\treturn null\n\t},\n\tcreateOrganization: async () => null,\n\tgetOrganization: async () => null,\n\taddMemberToOrganization: async () => null,\n\tremoveMemberFromOrganization: async () => undefined,\n\taddRoleForMember: async () => undefined,\n\tremoveRoleForMember: async () => undefined,\n\tgetMembershipsForUser: async () => [],\n\tgetOrganizationMembers: async () => [],\n\tgetMerchantSubscription: async () => null,\n\tcreateMerchantSubscription: async () => null,\n\tupdateMerchantSubscription: async () => null,\n\tdeleteMerchantSubscription: async () => undefined,\n\tcreateMerchantSession: async () => Promise.resolve({} as MerchantSession),\n\tcreateSubscription: async () => null,\n\tgetSubscriptionForStripeId: async () => null,\n\tgetPurchasesForBulkCouponId: async () => [],\n}\n\ninterface SkillProductsCommerceSdk {\n\tredeemFullPriceCoupon(options: {\n\t\temail: string\n\t\tcouponId?: string\n\t\tredeemingProductId?: string\n\t\tproductIds?: string[]\n\t\tcurrentUserId?: string | null\n\t}): Promise<{\n\t\tpurchase: Purchase | null\n\t\tredeemingForCurrentUser: boolean\n\t\terror?: {\n\t\t\tmessage: string\n\t\t}\n\t} | null>\n\tcreatePurchaseTransfer(options: {\n\t\tsourceUserId: string\n\t\tpurchaseId: string\n\t\texpiresAt: Date\n\t}): Promise<void>\n\tincrementCouponUsedCount(couponId: string): Promise<void>\n\tgetExistingNonBulkValidPurchasesOfProduct(options: {\n\t\tuserId: string\n\t\tproductId?: string\n\t}): Promise<Purchase[]>\n\tgetPurchaseDetails(\n\t\tpurchaseId: string,\n\t\tuserId: string,\n\t): Promise<{\n\t\tpurchase?: Purchase\n\t\texistingPurchase?: Purchase | null\n\t\tavailableUpgrades: UpgradableProduct[]\n\t}>\n\tgetPurchaseForStripeCharge(stripeChargeId: string): Promise<Purchase | null>\n\tupdatePurchaseStatusForCharge(\n\t\tchargeId: string,\n\t\tstatus: 'Valid' | 'Refunded' | 'Disputed' | 'Banned' | 'Restricted',\n\t): Promise<Purchase | undefined>\n\tcouponForIdOrCode(options: {\n\t\tcode?: string | null | undefined\n\t\tcouponId?: string | null | undefined\n\t}): Promise<(Coupon & { merchantCoupon: MerchantCoupon }) | null>\n\tavailableUpgradesForProduct(\n\t\tpurchases: any,\n\t\tproductId: string,\n\t): Promise<\n\t\t{\n\t\t\tupgradableTo: {\n\t\t\t\tid: string\n\t\t\t\tname: string\n\t\t\t}\n\t\t\tupgradableFrom: {\n\t\t\t\tid: string\n\t\t\t\tname: string\n\t\t\t}\n\t\t}[]\n\t>\n\tcompleteLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessonId?: string\n\t}): Promise<ResourceProgress | null>\n\tclearLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessons: { id: string; slug: string }[]\n\t}): Promise<void>\n\ttoggleLessonProgressForUser(options: {\n\t\tuserId: string\n\t\tlessonId?: string\n\t\tlessonSlug?: string\n\t}): Promise<ResourceProgress | null>\n\tgetLessonProgressForUser(userId: string): Promise<ResourceProgress[] | null>\n\tgetModuleProgressForUser(\n\t\tuserId: string,\n\t\tmoduleId: string,\n\t): Promise<ModuleProgress | null>\n\tgetLessonProgresses(): Promise<ResourceProgress[]>\n\tgetLessonProgressCountsByDate(): Promise<\n\t\t{\n\t\t\tcount: number\n\t\t\tcompletedAt: string\n\t\t}[]\n\t>\n\tgetPurchaseWithUser(\n\t\tpurchaseId: string,\n\t): Promise<(Purchase & { user: User }) | null>\n\tgetCouponWithBulkPurchases(couponId?: string): Promise<\n\t\t| (Coupon & {\n\t\t\t\tredeemedBulkCouponPurchases?: Purchase[] | null\n\t\t\t\tbulkPurchase?: Purchase | null\n\t\t })\n\t\t| null\n\t>\n\tgetPurchase(purchaseId: string): Promise<Purchase | null>\n\tgetPurchaseCountForProduct(productId: string): Promise<number>\n\tgetPurchasesForUser(userId?: string): Promise<Purchase[]>\n\tgetMerchantProduct(stripeProductId: string): Promise<MerchantProduct | null>\n\tgetMerchantProductForProductId(\n\t\tproductId: string,\n\t): Promise<MerchantProduct | null>\n\tgetMerchantCharge(merchantChargeId: string): Promise<MerchantCharge | null>\n\tcreateMerchantChargeAndPurchase(options: {\n\t\tuserId: string\n\t\tproductId: string\n\t\tstripeChargeId: string\n\t\tstripeCouponId?: string\n\t\tmerchantAccountId: string\n\t\tmerchantProductId: string\n\t\tmerchantCustomerId: string\n\t\tstripeChargeAmount: number\n\t\tquantity?: number\n\t\tbulk?: boolean\n\t\tcheckoutSessionId: string\n\t\tappliedPPPStripeCouponId: string | undefined\n\t\tupgradedFromPurchaseId: string | undefined\n\t\tusedCouponId: string | undefined\n\t\tcountry?: string\n\t\torganizationId?: string\n\t}): Promise<Purchase>\n\tfindOrCreateMerchantCustomer(options: {\n\t\tuser: User\n\t\tidentifier: string\n\t\tmerchantAccountId: string\n\t}): Promise<MerchantCustomer | null>\n\tfindOrCreateUser(\n\t\temail: string,\n\t\tname?: string | null,\n\t): Promise<{ user: User; isNewUser: boolean }>\n\tgetUserById(userId: string): Promise<User | null>\n\tgetUserWithPurchasersByEmail(email: string): Promise<any | null>\n\tgetProduct(\n\t\tproductId?: string,\n\t\twithResources?: boolean,\n\t): Promise<Product | null>\n\tgetProductResources(productId: string): Promise<ContentResource[] | null>\n\tgetPrice(productId: string): Promise<Price | null>\n\tgetMerchantCoupon(merchantCouponId: string): Promise<MerchantCoupon | null>\n\tgetMerchantCouponForTypeAndPercent(params: {\n\t\ttype: string\n\t\tpercentageDiscount: number\n\t}): Promise<MerchantCoupon | null>\n\tgetMerchantCouponsForTypeAndPercent(params: {\n\t\ttype: string\n\t\tpercentageDiscount: number\n\t}): Promise<MerchantCoupon[]>\n\tgetCoupon(couponIdOrCode: string): Promise<Coupon | null>\n\tgetDefaultCoupon(productIds?: string[]): Promise<{\n\t\tdefaultMerchantCoupon: MerchantCoupon\n\t\tdefaultCoupon: Coupon\n\t} | null>\n\ttransferPurchasesToNewUser(options: {\n\t\tmerchantCustomerId: string\n\t\tuserId: string\n\t}): Promise<unknown>\n\tgetPurchaseUserTransferById(options: { id: string }): Promise<\n\t\t| (PurchaseUserTransfer & {\n\t\t\t\tsourceUser: User\n\t\t\t\ttargetUser: User | null\n\t\t\t\tpurchase: Purchase\n\t\t })\n\t\t| null\n\t>\n\tupdatePurchaseUserTransferTransferState(options: {\n\t\tid: string\n\t\ttransferState: PurchaseUserTransferState\n\t}): Promise<PurchaseUserTransfer | null>\n\tpricesOfPurchasesTowardOneBundle(options: {\n\t\tuserId: string | undefined\n\t\tbundleId: string\n\t}): Promise<Price[]>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;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ACnCC,wBAAwB,YAAY,CAAA;EACpCC,yBAAyB,YAAY;EACrCC,4BAA4B,YAAY;EACxCC,4BAA4B,YAAY;EACxCC,4BAA4B,YAAY5E;EACxC6E,uBAAuB,YAAY9F,QAAQC,QAAQ,CAAC,CAAA;EACpD8F,oBAAoB,YAAY;EAChCC,4BAA4B,YAAY;EACxCC,6BAA6B,YAAY,CAAA;AAC1C;","names":["MockCourseBuilderAdapter","client","transferPurchaseToUser","redeemFullPriceCoupon","archiveProduct","productId","updateProduct","product","createProduct","createPurchaseTransfer","Promise","resolve","incrementCouponUsedCount","_","getExistingNonBulkValidPurchasesOfProduct","getMerchantPriceForProductId","getMerchantProductForProductId","getMerchantAccount","createMerchantCustomer","getMerchantCustomerForUserId","getUpgradableProducts","createPurchase","options","Error","availableUpgradesForProduct","purchases","clearLessonProgressForUser","undefined","completeLessonProgressForUser","couponForIdOrCode","createMerchantChargeAndPurchase","findOrCreateMerchantCustomer","findOrCreateUser","email","name","getCoupon","couponIdOrCode","getCouponWithBulkPurchases","couponId","getDefaultCoupon","productIds","getLessonProgressCountsByDate","getLessonProgressForUser","userId","getModuleProgressForUser","moduleId","completedLessons","nextResource","percentCompleted","completedLessonsCount","totalLessonsCount","getLessonProgresses","getMerchantCharge","merchantChargeId","getMerchantCouponForTypeAndPercent","params","getMerchantCouponsForTypeAndPercent","getMerchantCoupon","merchantCouponId","getMerchantProduct","stripeProductId","getPrice","getPriceForProduct","getProduct","withResources","getProductResources","getPurchaseCountForProduct","getPurchase","purchaseId","getPurchaseDetails","availableUpgrades","getPurchaseForStripeCharge","stripeChargeId","getPurchaseUserTransferById","getPurchaseWithUser","getUserWithPurchasersByEmail","getPurchasesForUser","getUserById","pricesOfPurchasesTowardOneBundle","toggleLessonProgressForUser","transferPurchasesToNewUser","updatePurchaseStatusForCharge","chargeId","status","updatePurchaseUserTransferTransferState","addResourceToResource","removeResourceFromResource","createContentResource","resource","getContentResource","getVideoResource","updateContentResourceFields","createOrganization","getOrganization","addMemberToOrganization","removeMemberFromOrganization","addRoleForMember","removeRoleForMember","getMembershipsForUser","getOrganizationMembers","getMerchantSubscription","createMerchantSubscription","updateMerchantSubscription","deleteMerchantSubscription","createMerchantSession","createSubscription","getSubscriptionForStripeId","getPurchasesForBulkCouponId"]}