@intlayer/backend 7.0.6 → 7.0.8-canary.0
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/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_i18next.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_next-i18next.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_next-intl.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_react-i18next.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_react-intl.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/intlayer_with_vue-i18n.json +5122 -4096
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/react-i18next_vs_react-intl_vs_intlayer.json +8194 -7168
- package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/intlayer_with_nextjs_16.json +1 -1
- package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/intlayer_with_nuxt.json +11266 -10240
- package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/intlayer_with_tanstack.json +9218 -8192
- package/dist/assets/utils/AI/askDocQuestion/embeddings/docs/en/intlayer_with_vite+react.json +1 -1
- package/dist/cjs/_virtual/_utils_asset.cjs +0 -3
- package/dist/cjs/controllers/audit.controller.cjs +0 -1
- package/dist/cjs/controllers/audit.controller.cjs.map +1 -1
- package/dist/cjs/controllers/dictionary.controller.cjs +0 -1
- package/dist/cjs/controllers/dictionary.controller.cjs.map +1 -1
- package/dist/cjs/controllers/newsletter.controller.cjs +0 -1
- package/dist/cjs/controllers/newsletter.controller.cjs.map +1 -1
- package/dist/cjs/controllers/oAuth2.controller.cjs +0 -1
- package/dist/cjs/controllers/oAuth2.controller.cjs.map +1 -1
- package/dist/cjs/controllers/organization.controller.cjs +0 -2
- package/dist/cjs/controllers/organization.controller.cjs.map +1 -1
- package/dist/cjs/controllers/project.controller.cjs +0 -1
- package/dist/cjs/controllers/project.controller.cjs.map +1 -1
- package/dist/cjs/controllers/projectAccessKey.controller.cjs +0 -1
- package/dist/cjs/controllers/projectAccessKey.controller.cjs.map +1 -1
- package/dist/cjs/controllers/stripe.controller.cjs +0 -2
- package/dist/cjs/controllers/stripe.controller.cjs.map +1 -1
- package/dist/cjs/controllers/tag.controller.cjs +0 -1
- package/dist/cjs/controllers/tag.controller.cjs.map +1 -1
- package/dist/cjs/controllers/user.controller.cjs +0 -1
- package/dist/cjs/controllers/user.controller.cjs.map +1 -1
- package/dist/cjs/emails/InviteUserEmail.cjs +0 -2
- package/dist/cjs/emails/InviteUserEmail.cjs.map +1 -1
- package/dist/cjs/emails/OAuthTokenCreatedEmail.cjs +0 -2
- package/dist/cjs/emails/OAuthTokenCreatedEmail.cjs.map +1 -1
- package/dist/cjs/emails/PasswordChangeConfirmation.cjs +0 -2
- package/dist/cjs/emails/PasswordChangeConfirmation.cjs.map +1 -1
- package/dist/cjs/emails/ResetUserPassword.cjs +0 -2
- package/dist/cjs/emails/ResetUserPassword.cjs.map +1 -1
- package/dist/cjs/emails/SubscriptionPaymentCancellation.cjs +0 -2
- package/dist/cjs/emails/SubscriptionPaymentCancellation.cjs.map +1 -1
- package/dist/cjs/emails/SubscriptionPaymentError.cjs +0 -2
- package/dist/cjs/emails/SubscriptionPaymentError.cjs.map +1 -1
- package/dist/cjs/emails/SubscriptionPaymentSuccess.cjs +0 -2
- package/dist/cjs/emails/SubscriptionPaymentSuccess.cjs.map +1 -1
- package/dist/cjs/emails/ValidateUserEmail.cjs +0 -2
- package/dist/cjs/emails/ValidateUserEmail.cjs.map +1 -1
- package/dist/cjs/emails/Welcome.cjs +0 -2
- package/dist/cjs/emails/Welcome.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/logger/index.cjs +0 -1
- package/dist/cjs/logger/index.cjs.map +1 -1
- package/dist/cjs/middlewares/sessionAuth.middleware.cjs +0 -1
- package/dist/cjs/middlewares/sessionAuth.middleware.cjs.map +1 -1
- package/dist/cjs/models/audit.model.cjs +0 -2
- package/dist/cjs/models/audit.model.cjs.map +1 -1
- package/dist/cjs/models/dictionary.model.cjs +0 -1
- package/dist/cjs/models/dictionary.model.cjs.map +1 -1
- package/dist/cjs/models/discussion.model.cjs +0 -1
- package/dist/cjs/models/discussion.model.cjs.map +1 -1
- package/dist/cjs/models/oAuth2.model.cjs +0 -1
- package/dist/cjs/models/oAuth2.model.cjs.map +1 -1
- package/dist/cjs/models/organization.model.cjs +0 -1
- package/dist/cjs/models/organization.model.cjs.map +1 -1
- package/dist/cjs/models/project.model.cjs +0 -1
- package/dist/cjs/models/project.model.cjs.map +1 -1
- package/dist/cjs/models/session.model.cjs +0 -1
- package/dist/cjs/models/session.model.cjs.map +1 -1
- package/dist/cjs/models/tag.model.cjs +0 -1
- package/dist/cjs/models/tag.model.cjs.map +1 -1
- package/dist/cjs/models/user.model.cjs +0 -1
- package/dist/cjs/models/user.model.cjs.map +1 -1
- package/dist/cjs/routes/ai.routes.cjs +0 -1
- package/dist/cjs/routes/ai.routes.cjs.map +1 -1
- package/dist/cjs/routes/dictionary.routes.cjs +0 -1
- package/dist/cjs/routes/dictionary.routes.cjs.map +1 -1
- package/dist/cjs/routes/eventListener.routes.cjs +0 -1
- package/dist/cjs/routes/eventListener.routes.cjs.map +1 -1
- package/dist/cjs/routes/newsletter.routes.cjs +0 -1
- package/dist/cjs/routes/newsletter.routes.cjs.map +1 -1
- package/dist/cjs/routes/organization.routes.cjs +0 -1
- package/dist/cjs/routes/organization.routes.cjs.map +1 -1
- package/dist/cjs/routes/project.routes.cjs +0 -1
- package/dist/cjs/routes/project.routes.cjs.map +1 -1
- package/dist/cjs/routes/search.routes.cjs +0 -1
- package/dist/cjs/routes/search.routes.cjs.map +1 -1
- package/dist/cjs/routes/stripe.routes.cjs +0 -1
- package/dist/cjs/routes/stripe.routes.cjs.map +1 -1
- package/dist/cjs/routes/tags.routes.cjs +0 -1
- package/dist/cjs/routes/tags.routes.cjs.map +1 -1
- package/dist/cjs/routes/user.routes.cjs +0 -1
- package/dist/cjs/routes/user.routes.cjs.map +1 -1
- package/dist/cjs/schemas/dictionary.schema.cjs +0 -1
- package/dist/cjs/schemas/dictionary.schema.cjs.map +1 -1
- package/dist/cjs/schemas/discussion.schema.cjs +0 -1
- package/dist/cjs/schemas/discussion.schema.cjs.map +1 -1
- package/dist/cjs/schemas/oAuth2.schema.cjs +0 -1
- package/dist/cjs/schemas/oAuth2.schema.cjs.map +1 -1
- package/dist/cjs/schemas/organization.schema.cjs +0 -1
- package/dist/cjs/schemas/organization.schema.cjs.map +1 -1
- package/dist/cjs/schemas/plans.schema.cjs +0 -1
- package/dist/cjs/schemas/plans.schema.cjs.map +1 -1
- package/dist/cjs/schemas/project.schema.cjs +0 -2
- package/dist/cjs/schemas/project.schema.cjs.map +1 -1
- package/dist/cjs/schemas/session.schema.cjs +0 -1
- package/dist/cjs/schemas/session.schema.cjs.map +1 -1
- package/dist/cjs/schemas/tag.schema.cjs +0 -1
- package/dist/cjs/schemas/tag.schema.cjs.map +1 -1
- package/dist/cjs/schemas/user.schema.cjs +0 -1
- package/dist/cjs/schemas/user.schema.cjs.map +1 -1
- package/dist/cjs/services/dictionary.service.cjs +0 -1
- package/dist/cjs/services/dictionary.service.cjs.map +1 -1
- package/dist/cjs/services/email.service.cjs +0 -3
- package/dist/cjs/services/email.service.cjs.map +1 -1
- package/dist/cjs/services/oAuth2.service.cjs +0 -1
- package/dist/cjs/services/oAuth2.service.cjs.map +1 -1
- package/dist/cjs/services/projectAccessKey.service.cjs +0 -1
- package/dist/cjs/services/projectAccessKey.service.cjs.map +1 -1
- package/dist/cjs/utils/AI/aiSdk.cjs +0 -5
- package/dist/cjs/utils/AI/aiSdk.cjs.map +1 -1
- package/dist/cjs/utils/AI/askDocQuestion/askDocQuestion.cjs +0 -4
- package/dist/cjs/utils/AI/askDocQuestion/askDocQuestion.cjs.map +1 -1
- package/dist/cjs/utils/AI/askDocQuestion/indexMarkdownFiles.cjs +0 -6
- package/dist/cjs/utils/AI/askDocQuestion/indexMarkdownFiles.cjs.map +1 -1
- package/dist/cjs/utils/AI/auditDictionary/index.cjs +0 -3
- package/dist/cjs/utils/AI/auditDictionary/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/auditDictionaryField/index.cjs +0 -3
- package/dist/cjs/utils/AI/auditDictionaryField/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/auditDictionaryMetadata/index.cjs +0 -1
- package/dist/cjs/utils/AI/auditDictionaryMetadata/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/auditTag/index.cjs +0 -1
- package/dist/cjs/utils/AI/auditTag/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/autocomplete/index.cjs +0 -1
- package/dist/cjs/utils/AI/autocomplete/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/customQuery/index.cjs +0 -1
- package/dist/cjs/utils/AI/customQuery/index.cjs.map +1 -1
- package/dist/cjs/utils/AI/translateJSON/index.cjs +0 -3
- package/dist/cjs/utils/AI/translateJSON/index.cjs.map +1 -1
- package/dist/cjs/utils/accessControl.cjs +1 -1
- package/dist/cjs/utils/accessControl.cjs.map +1 -1
- package/dist/cjs/utils/auth/getAuth.cjs +0 -4
- package/dist/cjs/utils/auth/getAuth.cjs.map +1 -1
- package/dist/cjs/utils/errors/ErrorHandler.cjs +0 -2
- package/dist/cjs/utils/errors/ErrorHandler.cjs.map +1 -1
- package/dist/cjs/utils/errors/ErrorsClass.cjs +0 -1
- package/dist/cjs/utils/errors/ErrorsClass.cjs.map +1 -1
- package/dist/cjs/utils/mongoDB/connectDB.cjs +1 -2
- package/dist/cjs/utils/mongoDB/connectDB.cjs.map +1 -1
- package/dist/cjs/webhooks/stripe.webhook.cjs +0 -1
- package/dist/cjs/webhooks/stripe.webhook.cjs.map +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/utils/accessControl.mjs +1 -1
- package/dist/esm/utils/accessControl.mjs.map +1 -1
- package/dist/esm/utils/mongoDB/connectDB.mjs +2 -2
- package/dist/esm/utils/mongoDB/connectDB.mjs.map +1 -1
- package/dist/types/controllers/dictionary.controller.d.ts.map +1 -1
- package/dist/types/emails/InviteUserEmail.d.ts +4 -4
- package/dist/types/emails/OAuthTokenCreatedEmail.d.ts +4 -4
- package/dist/types/emails/OAuthTokenCreatedEmail.d.ts.map +1 -1
- package/dist/types/emails/PasswordChangeConfirmation.d.ts +4 -4
- package/dist/types/emails/PasswordChangeConfirmation.d.ts.map +1 -1
- package/dist/types/emails/SubscriptionPaymentCancellation.d.ts +4 -4
- package/dist/types/emails/SubscriptionPaymentCancellation.d.ts.map +1 -1
- package/dist/types/emails/SubscriptionPaymentError.d.ts +4 -4
- package/dist/types/emails/SubscriptionPaymentSuccess.d.ts +4 -4
- package/dist/types/emails/ValidateUserEmail.d.ts +4 -4
- package/dist/types/emails/Welcome.d.ts +4 -4
- package/dist/types/emails/Welcome.d.ts.map +1 -1
- package/dist/types/export.d.ts +3 -1
- package/dist/types/models/dictionary.model.d.ts +4 -4
- package/dist/types/models/dictionary.model.d.ts.map +1 -1
- package/dist/types/models/discussion.model.d.ts +2 -2
- package/dist/types/models/discussion.model.d.ts.map +1 -1
- package/dist/types/models/oAuth2.model.d.ts +4 -3
- package/dist/types/models/oAuth2.model.d.ts.map +1 -1
- package/dist/types/schemas/dictionary.schema.d.ts +6 -6
- package/dist/types/schemas/dictionary.schema.d.ts.map +1 -1
- package/dist/types/schemas/discussion.schema.d.ts +6 -6
- package/dist/types/schemas/oAuth2.schema.d.ts +5 -5
- package/dist/types/schemas/organization.schema.d.ts +6 -6
- package/dist/types/schemas/organization.schema.d.ts.map +1 -1
- package/dist/types/schemas/plans.schema.d.ts +6 -6
- package/dist/types/schemas/project.schema.d.ts +6 -6
- package/dist/types/schemas/session.schema.d.ts +6 -6
- package/dist/types/schemas/tag.schema.d.ts +6 -6
- package/dist/types/schemas/user.schema.d.ts +6 -6
- package/dist/types/services/email.service.d.ts +10 -10
- package/dist/types/utils/accessControl.d.ts +1 -1
- package/dist/types/utils/accessControl.d.ts.map +1 -1
- package/dist/types/utils/filtersAndPagination/getDictionaryFiltersAndPagination.d.ts +2 -2
- package/dist/types/utils/filtersAndPagination/getOrganizationFiltersAndPagination.d.ts +2 -2
- package/dist/types/utils/filtersAndPagination/getProjectFiltersAndPagination.d.ts +2 -2
- package/dist/types/utils/filtersAndPagination/getTagFiltersAndPagination.d.ts +2 -2
- package/dist/types/utils/mongoDB/connectDB.d.ts +2 -2
- package/dist/types/utils/mongoDB/connectDB.d.ts.map +1 -1
- package/package.json +15 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.webhook.cjs","names":["stripe","Stripe","event: Stripe.Event","GenericError","getOrganizationById","getUserById","addOrUpdateSubscription","changeSubscriptionStatus","cancelSubscription"],"sources":["../../../src/webhooks/stripe.webhook.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types';\nimport { logger } from '@logger';\nimport * as emailService from '@services/email.service';\nimport { getOrganizationById } from '@services/organization.service';\nimport {\n addOrUpdateSubscription,\n cancelSubscription,\n changeSubscriptionStatus,\n} from '@services/subscription.service';\nimport { getUserById } from '@services/user.service';\nimport { GenericError } from '@utils/errors';\nimport type { Request, Response } from 'express';\nimport { Stripe } from 'stripe';\nimport type { Plan } from '@/types/plan.types';\n\ntype SubscriptionMetadata = {\n locale: Locale; // Localization setting (e.g., 'en', 'fr', 'es')\n userId: string; // ID of the user associated with the subscription\n organizationId: string; // ID of the organization associated with the subscription\n};\n\n/**\n * Stripe webhook handler for processing subscription and invoice events.\n * @param req - Express request object.\n * @param res - Express response object.\n */\nexport const stripeWebhook = async (req: Request, res: Response) => {\n // Initialize the Stripe client with the secret key\n const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);\n\n const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET!; // Webhook secret for verifying event signatures\n const sig = req.headers['stripe-signature']!; // Retrieve the signature from the webhook request headers\n\n let event: Stripe.Event;\n\n // Verify the webhook signature to ensure the request is authentic\n try {\n event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);\n } catch (err) {\n // Respond with a 400 status code if the signature verification fails\n res.status(400).send(`Webhook Error: ${(err as Error).message}`);\n return;\n }\n\n // Utility function to extract metadata from a Stripe customer\n const extractMetadata = async (customerId: string) => {\n const customer = await stripe.customers.retrieve(customerId); // Retrieve customer details from Stripe\n return (customer as Stripe.Customer).metadata as SubscriptionMetadata; // Return the metadata object\n };\n\n // Handles subscription-related events (creation, update, deletion)\n const handleSubscriptionEvent = async (\n subscription: Stripe.Subscription,\n statusOverride?: Plan['status'] // Optionally override the subscription status\n ) => {\n const { id: subscriptionId, customer } = subscription;\n const priceId = subscription.items.data[0]?.price?.id; // Extract the price ID from subscription items\n\n if (!customer) {\n throw new GenericError('STRIPE_SUBSCRIPTION_NO_CUSTOMER');\n }\n\n const customerId = customer as string;\n const { locale, userId, organizationId } =\n await extractMetadata(customerId); // Extract metadata from the customer\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n const organization = await getOrganizationById(organizationId); // Fetch organization details by ID\n\n if (!organization) {\n throw new GenericError('ORGANIZATION_NOT_FOUND');\n }\n\n const user = await getUserById(userId);\n\n if (!user) {\n throw new GenericError('USER_NOT_FOUND');\n }\n\n const status = statusOverride ?? subscription.status; // Use the provided status override or the subscription's status\n\n // Update or create a subscription record in the database\n await addOrUpdateSubscription(\n subscriptionId,\n priceId!,\n customerId,\n userId,\n organization,\n status\n );\n\n if (status === 'active') {\n await emailService.sendEmail({\n type: 'subscriptionPaymentSuccess',\n to: user.email,\n email: user.email,\n subscriptionStartDate: new Date().toLocaleDateString(),\n manageSubscriptionLink: `${process.env.CLIENT_URL}/dashboard/organization`,\n username: user.name,\n organizationName: organization.name,\n planName: organization.plan?.type ?? 'Unknown',\n });\n }\n if (status === 'canceled') {\n await emailService.sendEmail({\n type: 'subscriptionPaymentCancellation',\n to: user.email,\n email: user.email,\n cancellationDate: new Date(\n (subscription as any).current_period_end * 1000\n ).toLocaleDateString(),\n reactivateLink: `${process.env.CLIENT_URL}/pricing`,\n username: user.name,\n organizationName: organization.name,\n planName: organization.plan?.type ?? 'Unknown',\n });\n }\n };\n\n // Handles invoice-related events (payment success or failure)\n const handleInvoiceEvent = async (\n invoice: Stripe.Invoice,\n status: 'active' | 'incomplete'\n ) => {\n const subscriptionId =\n typeof (invoice as any).subscription === 'string'\n ? (invoice as any).subscription\n : (invoice as any).subscription?.id; // Extract the subscription ID from the invoice\n if (!subscriptionId) {\n logger.warn('Subscription ID is undefined in invoice.');\n return;\n }\n\n // Retrieve the subscription details from Stripe\n const subscription = await stripe.subscriptions.retrieve(subscriptionId);\n const organization = await getOrganizationById(\n subscription.metadata.organizationId\n );\n\n // Prevent duplicate subscriptions by canceling conflicting subscriptions\n if (\n organization.plan?.subscriptionId &&\n organization.plan.subscriptionId !== subscriptionId\n ) {\n await stripe.subscriptions.cancel(subscriptionId);\n }\n\n const customerId = invoice.customer as string;\n const { locale, userId, organizationId } =\n await extractMetadata(customerId);\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n // Update the subscription status in the database\n await changeSubscriptionStatus(\n subscriptionId,\n status,\n userId,\n organizationId\n );\n };\n\n try {\n // Log the event type for debugging and monitoring\n logger.info(`Triggered event type ${event.type}`);\n\n // Handle specific event types\n switch (event.type) {\n case 'customer.subscription.created': {\n logger.info(`Handled event type ${event.type}`);\n // Process a new subscription creation event\n await handleSubscriptionEvent(event.data.object as Stripe.Subscription);\n break;\n }\n case 'customer.subscription.updated': {\n logger.info(`Handled event type ${event.type}`);\n // Process a subscription update event\n await handleSubscriptionEvent(event.data.object as Stripe.Subscription);\n break;\n }\n case 'customer.subscription.deleted': {\n logger.info(`Handled event type ${event.type}`);\n const subscription = event.data\n .object as unknown as Stripe.Subscription;\n const customerId = subscription.customer as string;\n const { locale, organizationId } = await extractMetadata(customerId);\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n // Handle subscription deletion by canceling it in the database\n await cancelSubscription(subscription.id, organizationId);\n break;\n }\n case 'invoice.payment_succeeded': {\n logger.info(`Handled event type ${event.type}`);\n // Handle successful invoice payment\n await handleInvoiceEvent(event.data.object as Stripe.Invoice, 'active');\n break;\n }\n case 'invoice.payment_failed': {\n logger.info(`Handled event type ${event.type}`);\n // Handle failed invoice payment\n await handleInvoiceEvent(\n event.data.object as Stripe.Invoice,\n 'incomplete'\n );\n break;\n }\n default:\n // Log unhandled event types for visibility\n logger.info(`Unhandled event type ${event.type}`);\n }\n\n // Respond to Stripe to confirm the event was processed successfully\n res.send();\n } catch (error) {\n // Log errors for debugging and respond with a 500 status code\n logger.error(\n `Error handling event ${event.type}: ${(error as Error).message}`\n );\n res.status(500).send('Server Error');\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAa,gBAAgB,OAAO,KAAc,QAAkB;CAElE,MAAMA,WAAS,IAAIC,cAAO,QAAQ,IAAI,kBAAmB;CAEzD,MAAM,iBAAiB,QAAQ,IAAI;CACnC,MAAM,MAAM,IAAI,QAAQ;CAExB,IAAIC;AAGJ,KAAI;AACF,UAAQF,SAAO,SAAS,eAAe,IAAI,MAAM,KAAK,eAAe;UAC9D,KAAK;AAEZ,MAAI,OAAO,IAAI,CAAC,KAAK,kBAAmB,IAAc,UAAU;AAChE;;CAIF,MAAM,kBAAkB,OAAO,eAAuB;AAEpD,UADiB,MAAMA,SAAO,UAAU,SAAS,WAAW,EACvB;;CAIvC,MAAM,0BAA0B,OAC9B,cACA,mBACG;EACH,MAAM,EAAE,IAAI,gBAAgB,aAAa;EACzC,MAAM,UAAU,aAAa,MAAM,KAAK,IAAI,OAAO;AAEnD,MAAI,CAAC,SACH,OAAM,IAAIG,8CAAa,kCAAkC;EAG3D,MAAM,aAAa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a,QAAQ;EAC3B,MAAM,EAAE,QAAQ,QAAQ,mBACtB,MAAM,gBAAgB,WAAW;AAGnC,MAAI,OACF,KAAI,OAAO,UAAU;AAIvB,QAAMO,+DACJ,gBACA,QACA,QACA,eACD;;AAGH,KAAI;AAEF,8BAAO,KAAK,wBAAwB,MAAM,OAAO;AAGjD,UAAQ,MAAM,MAAd;GACE,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,wBAAwB,MAAM,KAAK,OAA8B;AACvE;GAEF,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,wBAAwB,MAAM,KAAK,OAA8B;AACvE;GAEF,KAAK,iCAAiC;AACpC,gCAAO,KAAK,sBAAsB,MAAM,OAAO;IAC/C,MAAM,eAAe,MAAM,KACxB;IACH,MAAM,aAAa,aAAa;IAChC,MAAM,EAAE,QAAQ,mBAAmB,MAAM,gBAAgB,WAAW;AAGpE,QAAI,OACF,KAAI,OAAO,UAAU;AAIvB,UAAMC,yDAAmB,aAAa,IAAI,eAAe;AACzD;;GAEF,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,mBAAmB,MAAM,KAAK,QAA0B,SAAS;AACvE;GAEF,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,mBACJ,MAAM,KAAK,QACX,aACD;AACD;GAEF,QAEE,6BAAO,KAAK,wBAAwB,MAAM,OAAO;;AAIrD,MAAI,MAAM;UACH,OAAO;AAEd,8BAAO,MACL,wBAAwB,MAAM,KAAK,IAAK,MAAgB,UACzD;AACD,MAAI,OAAO,IAAI,CAAC,KAAK,eAAe"}
|
|
1
|
+
{"version":3,"file":"stripe.webhook.cjs","names":["stripe","Stripe","event: Stripe.Event","GenericError","getOrganizationById","getUserById","addOrUpdateSubscription","changeSubscriptionStatus","cancelSubscription"],"sources":["../../../src/webhooks/stripe.webhook.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types';\nimport { logger } from '@logger';\nimport * as emailService from '@services/email.service';\nimport { getOrganizationById } from '@services/organization.service';\nimport {\n addOrUpdateSubscription,\n cancelSubscription,\n changeSubscriptionStatus,\n} from '@services/subscription.service';\nimport { getUserById } from '@services/user.service';\nimport { GenericError } from '@utils/errors';\nimport type { Request, Response } from 'express';\nimport { Stripe } from 'stripe';\nimport type { Plan } from '@/types/plan.types';\n\ntype SubscriptionMetadata = {\n locale: Locale; // Localization setting (e.g., 'en', 'fr', 'es')\n userId: string; // ID of the user associated with the subscription\n organizationId: string; // ID of the organization associated with the subscription\n};\n\n/**\n * Stripe webhook handler for processing subscription and invoice events.\n * @param req - Express request object.\n * @param res - Express response object.\n */\nexport const stripeWebhook = async (req: Request, res: Response) => {\n // Initialize the Stripe client with the secret key\n const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);\n\n const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET!; // Webhook secret for verifying event signatures\n const sig = req.headers['stripe-signature']!; // Retrieve the signature from the webhook request headers\n\n let event: Stripe.Event;\n\n // Verify the webhook signature to ensure the request is authentic\n try {\n event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);\n } catch (err) {\n // Respond with a 400 status code if the signature verification fails\n res.status(400).send(`Webhook Error: ${(err as Error).message}`);\n return;\n }\n\n // Utility function to extract metadata from a Stripe customer\n const extractMetadata = async (customerId: string) => {\n const customer = await stripe.customers.retrieve(customerId); // Retrieve customer details from Stripe\n return (customer as Stripe.Customer).metadata as SubscriptionMetadata; // Return the metadata object\n };\n\n // Handles subscription-related events (creation, update, deletion)\n const handleSubscriptionEvent = async (\n subscription: Stripe.Subscription,\n statusOverride?: Plan['status'] // Optionally override the subscription status\n ) => {\n const { id: subscriptionId, customer } = subscription;\n const priceId = subscription.items.data[0]?.price?.id; // Extract the price ID from subscription items\n\n if (!customer) {\n throw new GenericError('STRIPE_SUBSCRIPTION_NO_CUSTOMER');\n }\n\n const customerId = customer as string;\n const { locale, userId, organizationId } =\n await extractMetadata(customerId); // Extract metadata from the customer\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n const organization = await getOrganizationById(organizationId); // Fetch organization details by ID\n\n if (!organization) {\n throw new GenericError('ORGANIZATION_NOT_FOUND');\n }\n\n const user = await getUserById(userId);\n\n if (!user) {\n throw new GenericError('USER_NOT_FOUND');\n }\n\n const status = statusOverride ?? subscription.status; // Use the provided status override or the subscription's status\n\n // Update or create a subscription record in the database\n await addOrUpdateSubscription(\n subscriptionId,\n priceId!,\n customerId,\n userId,\n organization,\n status\n );\n\n if (status === 'active') {\n await emailService.sendEmail({\n type: 'subscriptionPaymentSuccess',\n to: user.email,\n email: user.email,\n subscriptionStartDate: new Date().toLocaleDateString(),\n manageSubscriptionLink: `${process.env.CLIENT_URL}/dashboard/organization`,\n username: user.name,\n organizationName: organization.name,\n planName: organization.plan?.type ?? 'Unknown',\n });\n }\n if (status === 'canceled') {\n await emailService.sendEmail({\n type: 'subscriptionPaymentCancellation',\n to: user.email,\n email: user.email,\n cancellationDate: new Date(\n (subscription as any).current_period_end * 1000\n ).toLocaleDateString(),\n reactivateLink: `${process.env.CLIENT_URL}/pricing`,\n username: user.name,\n organizationName: organization.name,\n planName: organization.plan?.type ?? 'Unknown',\n });\n }\n };\n\n // Handles invoice-related events (payment success or failure)\n const handleInvoiceEvent = async (\n invoice: Stripe.Invoice,\n status: 'active' | 'incomplete'\n ) => {\n const subscriptionId =\n typeof (invoice as any).subscription === 'string'\n ? (invoice as any).subscription\n : (invoice as any).subscription?.id; // Extract the subscription ID from the invoice\n if (!subscriptionId) {\n logger.warn('Subscription ID is undefined in invoice.');\n return;\n }\n\n // Retrieve the subscription details from Stripe\n const subscription = await stripe.subscriptions.retrieve(subscriptionId);\n const organization = await getOrganizationById(\n subscription.metadata.organizationId\n );\n\n // Prevent duplicate subscriptions by canceling conflicting subscriptions\n if (\n organization.plan?.subscriptionId &&\n organization.plan.subscriptionId !== subscriptionId\n ) {\n await stripe.subscriptions.cancel(subscriptionId);\n }\n\n const customerId = invoice.customer as string;\n const { locale, userId, organizationId } =\n await extractMetadata(customerId);\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n // Update the subscription status in the database\n await changeSubscriptionStatus(\n subscriptionId,\n status,\n userId,\n organizationId\n );\n };\n\n try {\n // Log the event type for debugging and monitoring\n logger.info(`Triggered event type ${event.type}`);\n\n // Handle specific event types\n switch (event.type) {\n case 'customer.subscription.created': {\n logger.info(`Handled event type ${event.type}`);\n // Process a new subscription creation event\n await handleSubscriptionEvent(event.data.object as Stripe.Subscription);\n break;\n }\n case 'customer.subscription.updated': {\n logger.info(`Handled event type ${event.type}`);\n // Process a subscription update event\n await handleSubscriptionEvent(event.data.object as Stripe.Subscription);\n break;\n }\n case 'customer.subscription.deleted': {\n logger.info(`Handled event type ${event.type}`);\n const subscription = event.data\n .object as unknown as Stripe.Subscription;\n const customerId = subscription.customer as string;\n const { locale, organizationId } = await extractMetadata(customerId);\n\n // Set localization in response locals if available\n if (locale) {\n res.locals.locales = locale;\n }\n\n // Handle subscription deletion by canceling it in the database\n await cancelSubscription(subscription.id, organizationId);\n break;\n }\n case 'invoice.payment_succeeded': {\n logger.info(`Handled event type ${event.type}`);\n // Handle successful invoice payment\n await handleInvoiceEvent(event.data.object as Stripe.Invoice, 'active');\n break;\n }\n case 'invoice.payment_failed': {\n logger.info(`Handled event type ${event.type}`);\n // Handle failed invoice payment\n await handleInvoiceEvent(\n event.data.object as Stripe.Invoice,\n 'incomplete'\n );\n break;\n }\n default:\n // Log unhandled event types for visibility\n logger.info(`Unhandled event type ${event.type}`);\n }\n\n // Respond to Stripe to confirm the event was processed successfully\n res.send();\n } catch (error) {\n // Log errors for debugging and respond with a 500 status code\n logger.error(\n `Error handling event ${event.type}: ${(error as Error).message}`\n );\n res.status(500).send('Server Error');\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,MAAa,gBAAgB,OAAO,KAAc,QAAk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ACzD;;GAEF,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,mBAAmB,MAAM,KAAK,QAA0B,SAAS;AACvE;GAEF,KAAK;AACH,gCAAO,KAAK,sBAAsB,MAAM,OAAO;AAE/C,UAAM,mBACJ,MAAM,KAAK,QACX,aACD;AACD;GAEF,QAEE,6BAAO,KAAK,wBAAwB,MAAM,OAAO;;AAIrD,MAAI,MAAM;UACH,OAAO;AAEd,8BAAO,MACL,wBAAwB,MAAM,KAAK,IAAK,MAAgB,UACzD;AACD,MAAI,OAAO,IAAI,CAAC,KAAK,eAAe"}
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["app: Express"],"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["app: Express"],"sources":["../../src/index.ts"],"sourcesContent":["/// Controllers\nimport { getOAuth2AccessToken } from '@controllers/oAuth2.controller';\n// Middlewares\nimport {\n attachOAuthInstance,\n oAuth2Middleware,\n} from '@middlewares/oAuth2.middleware';\nimport { logAPIRequestURL } from '@middlewares/request.middleware';\nimport { authMiddleware } from '@middlewares/sessionAuth.middleware';\n// Routes\nimport { aiRoute, aiRouter } from '@routes/ai.routes';\nimport { dictionaryRoute, dictionaryRouter } from '@routes/dictionary.routes';\nimport {\n eventListenerRoute,\n eventListenerRouter,\n} from '@routes/eventListener.routes';\nimport { newsletterRoute, newsletterRouter } from '@routes/newsletter.routes';\nimport {\n organizationRoute,\n organizationRouter,\n} from '@routes/organization.routes';\nimport { projectRoute, projectRouter } from '@routes/project.routes';\nimport { searchRoute, searchRouter } from '@routes/search.routes';\nimport { stripeRoute, stripeRouter } from '@routes/stripe.routes';\nimport { tagRoute, tagRouter } from '@routes/tags.routes';\nimport { userRoute, userRouter } from '@routes/user.routes';\n// Utils\nimport { getAuth } from '@utils/auth/getAuth';\nimport { corsOptions } from '@utils/cors';\nimport { connectDB } from '@utils/mongoDB/connectDB';\nimport { ipLimiter } from '@utils/rateLimiter';\n// Webhooks\nimport { stripeWebhook } from '@webhooks/stripe.webhook';\n// Libraries\nimport { toNodeHandler } from 'better-auth/node';\nimport compression from 'compression';\nimport cookieParser from 'cookie-parser';\nimport cors from 'cors';\nimport dotenv from 'dotenv';\nimport express, { type Express } from 'express';\nimport { intlayer, t } from 'express-intlayer';\nimport helmet from 'helmet';\n/// Logger\nimport { logger } from './logger/index';\n\nconst startServer = async () => {\n const app: Express = express();\n\n // Headers security\n app.disable('x-powered-by'); // Disabled to prevent attackers from knowing that the app is running Express\n app.use(helmet());\n app.set('trust proxy', 1);\n\n // Environment variables\n const env = app.get('env');\n\n logger.info(`run as ${env}`);\n\n dotenv.config({\n path: [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'],\n });\n\n // Parse incoming requests with cookies\n app.use(cookieParser());\n\n // Load internationalization request handler\n app.use(intlayer());\n\n // Rate limiter\n app.use(/(.*)/, ipLimiter);\n\n // Connect to MongoDB\n const dbClient = await connectDB();\n\n // Stripe\n app.post(\n '/webhook/stripe',\n express.raw({ type: 'application/json' }),\n stripeWebhook\n );\n\n // Compress all HTTP responses\n app.use(compression());\n\n // Parse incoming requests with urlencoded payloads\n app.use(express.urlencoded({ extended: true }));\n\n // CORS\n app.use(cors(corsOptions));\n\n // Liveness check\n app.get('/', (_req, res) => {\n res.send(\n t({\n en: 'Ok - locale: en',\n fr: 'Ok - locale: fr',\n es: 'Ok - locale: es',\n })\n );\n });\n\n // Session Auth\n const auth = getAuth(dbClient as any);\n app.all('/api/auth/{*any}', toNodeHandler(auth));\n app.use(/(.*)/, authMiddleware(auth));\n\n // oAuth2 Auth\n app.use(/(.*)/, attachOAuthInstance);\n app.post('/oauth2/token', getOAuth2AccessToken); // Route to get the token\n app.use(/(.*)/, oAuth2Middleware);\n\n // Body parser\n app.use(express.json()); // Should be placed after auth. Attach body to next routes\n\n // debug\n const isDev = env === 'development';\n if (isDev) {\n app.use(logAPIRequestURL);\n }\n\n // Routes\n app.use(userRoute, userRouter);\n app.use(organizationRoute, organizationRouter);\n app.use(projectRoute, projectRouter);\n app.use(tagRoute, tagRouter);\n app.use(dictionaryRoute, dictionaryRouter);\n app.use(stripeRoute, stripeRouter);\n app.use(aiRoute, aiRouter);\n app.use(eventListenerRoute, eventListenerRouter);\n app.use(searchRoute, searchRouter);\n app.use(newsletterRoute, newsletterRouter);\n\n // Server\n app.listen(process.env.PORT, () => {\n logger.info(`Listening on port ${process.env.PORT}`);\n });\n};\n\nstartServer();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,cAAc,YAAY;CAC9B,MAAMA,MAAe,SAAS;AAG9B,KAAI,QAAQ,eAAe;AAC3B,KAAI,IAAI,QAAQ,CAAC;AACjB,KAAI,IAAI,eAAe,EAAE;CAGzB,MAAM,MAAM,IAAI,IAAI,MAAM;AAE1B,QAAO,KAAK,UAAU,MAAM;AAE5B,QAAO,OAAO,EACZ,MAAM;EAAC,QAAQ,IAAI;EAAS,QAAQ;EAAO;EAAc;EAAO,EACjE,CAAC;AAGF,KAAI,IAAI,cAAc,CAAC;AAGvB,KAAI,IAAI,UAAU,CAAC;AAGnB,KAAI,IAAI,QAAQ,UAAU;CAG1B,MAAM,WAAW,MAAM,WAAW;AAGlC,KAAI,KACF,mBACA,QAAQ,IAAI,EAAE,MAAM,oBAAoB,CAAC,EACzC,cACD;AAGD,KAAI,IAAI,aAAa,CAAC;AAGtB,KAAI,IAAI,QAAQ,WAAW,EAAE,UAAU,MAAM,CAAC,CAAC;AAG/C,KAAI,IAAI,KAAK,YAAY,CAAC;AAG1B,KAAI,IAAI,MAAM,MAAM,QAAQ;AAC1B,MAAI,KACF,EAAE;GACA,IAAI;GACJ,IAAI;GACJ,IAAI;GACL,CAAC,CACH;GACD;CAGF,MAAM,OAAO,QAAQ,SAAgB;AACrC,KAAI,IAAI,oBAAoB,cAAc,KAAK,CAAC;AAChD,KAAI,IAAI,QAAQ,eAAe,KAAK,CAAC;AAGrC,KAAI,IAAI,QAAQ,oBAAoB;AACpC,KAAI,KAAK,iBAAiB,qBAAqB;AAC/C,KAAI,IAAI,QAAQ,iBAAiB;AAGjC,KAAI,IAAI,QAAQ,MAAM,CAAC;AAIvB,KADc,QAAQ,cAEpB,KAAI,IAAI,iBAAiB;AAI3B,KAAI,IAAI,WAAW,WAAW;AAC9B,KAAI,IAAI,mBAAmB,mBAAmB;AAC9C,KAAI,IAAI,cAAc,cAAc;AACpC,KAAI,IAAI,UAAU,UAAU;AAC5B,KAAI,IAAI,iBAAiB,iBAAiB;AAC1C,KAAI,IAAI,aAAa,aAAa;AAClC,KAAI,IAAI,SAAS,SAAS;AAC1B,KAAI,IAAI,oBAAoB,oBAAoB;AAChD,KAAI,IAAI,aAAa,aAAa;AAClC,KAAI,IAAI,iBAAiB,iBAAiB;AAG1C,KAAI,OAAO,QAAQ,IAAI,YAAY;AACjC,SAAO,KAAK,qBAAqB,QAAQ,IAAI,OAAO;GACpD;;AAGJ,aAAa"}
|
|
@@ -6,7 +6,7 @@ let AccessRule = /* @__PURE__ */ function(AccessRule$1) {
|
|
|
6
6
|
AccessRule$1["none"] = "none";
|
|
7
7
|
AccessRule$1["authenticated"] = "authenticated";
|
|
8
8
|
AccessRule$1["admin"] = "admin";
|
|
9
|
-
AccessRule$1["noneAuthenticated"] = "
|
|
9
|
+
AccessRule$1["noneAuthenticated"] = "not-authenticated";
|
|
10
10
|
AccessRule$1["hasOrganization"] = "has-organization";
|
|
11
11
|
AccessRule$1["hasProject"] = "has-project";
|
|
12
12
|
AccessRule$1["hasBearer"] = "has-bearer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessControl.mjs","names":["accessRuleArray: AccessRule[]","messages: string[]"],"sources":["../../../src/utils/accessControl.ts"],"sourcesContent":["import { logger } from '@logger';\n\nimport type { NextFunction, Request, Response } from 'express';\nimport { HttpStatusCodes } from './httpStatusCodes';\n\nexport enum AccessRule {\n none = 'none',\n authenticated = 'authenticated',\n admin = 'admin',\n noneAuthenticated = '
|
|
1
|
+
{"version":3,"file":"accessControl.mjs","names":["accessRuleArray: AccessRule[]","messages: string[]"],"sources":["../../../src/utils/accessControl.ts"],"sourcesContent":["import { logger } from '@logger';\n\nimport type { NextFunction, Request, Response } from 'express';\nimport { HttpStatusCodes } from './httpStatusCodes';\n\nexport enum AccessRule {\n none = 'none',\n authenticated = 'authenticated',\n admin = 'admin',\n noneAuthenticated = 'not-authenticated',\n hasOrganization = 'has-organization',\n hasProject = 'has-project',\n hasBearer = 'has-bearer',\n oauth2 = 'oauth2',\n}\n\nexport const accessControl = <R extends AccessRule | AccessRule[]>(\n res: Response,\n accessRule: R\n) => {\n const accessRuleArray: AccessRule[] = Array.isArray(accessRule)\n ? accessRule\n : [accessRule];\n\n const localsAuthInformation = res.locals;\n const { user, organization, project, authType } = localsAuthInformation;\n\n // If 'none' access rule is present, immediately return success\n if (accessRuleArray.includes(AccessRule.none)) {\n return {\n success: true,\n message: null,\n data: { user, organization, project, authType },\n };\n }\n\n let success = true;\n const messages: string[] = [];\n\n // Check for 'authenticated' access rule\n if (accessRuleArray.includes(AccessRule.authenticated)) {\n if (!user) {\n success = false;\n messages.push('User is not authenticated');\n }\n }\n\n // Check for 'admin' access rule\n // if (accessRuleArray.includes(AccessRule.admin)) {\n // if (!user?.role.includes('admin')) {\n // success = false;\n // messages.push('User is not an admin');\n // }\n // }\n\n // Check for 'not-authenticated' access rule\n if (accessRuleArray.includes(AccessRule.noneAuthenticated)) {\n if (user) {\n success = false;\n messages.push('User is authenticated');\n }\n }\n\n // Check for 'has-organization' access rule\n if (accessRuleArray.includes(AccessRule.hasOrganization)) {\n if (!organization) {\n success = false;\n messages.push('Organization is not set');\n }\n }\n\n // Check for 'has-project' access rule\n if (accessRuleArray.includes(AccessRule.hasProject)) {\n if (!project) {\n success = false;\n messages.push('Project is not set');\n }\n }\n\n // Check for 'oauth2' access rule\n if (accessRuleArray.includes(AccessRule.oauth2)) {\n if (authType !== 'oauth2') {\n success = false;\n messages.push('OAuth2 authentication is required');\n }\n }\n\n // Handle unknown access rules\n const knownRules = Object.values(AccessRule);\n const unknownRules = accessRuleArray.filter(\n (rule) => !knownRules.includes(rule)\n );\n if (unknownRules.length > 0) {\n success = false;\n messages.push(`Unknown access rules: ${unknownRules.join(', ')}`);\n }\n\n return {\n success,\n message: messages.join(', '),\n data: { user, organization, project, authType },\n };\n};\n\n/**\n * Middleware to control API access based on access rules.\n *\n * This middleware allows for multiple access rules to be passed, either as individual `AccessRule` or\n * an array of `AccessRule` groups. Access is granted if at least one of the following conditions is met:\n *\n * - The user satisfies all `AccessRule` within any group of rules passed as an array.\n * - The user satisfies any single `AccessRule` passed individually.\n *\n * Example usage:\n *\n * ```typescript\n * // Allow access if the user has both `hasProject` and `hasOrganization`, or if they have `admin` rights\n * app.use('/protected-route', apiAccessControlMiddleWare([AccessRule.hasProject, AccessRule.hasOrganization], AccessRule.admin));\n * ```\n *\n * In this example:\n * - The user will be granted access if they have both `hasProject` and `hasOrganization`.\n * - Alternatively, the user will also be granted access if they have `admin` privileges.\n *\n * @param {...(AccessRule | AccessRule[])[]} accessRules - One or more access rules or groups of access rules.\n * - Single `AccessRule`: The user must satisfy this rule for access to be granted.\n * - Array of `AccessRule`: The user must satisfy all rules in the array for access to be granted.\n * @returns {Function} Express middleware function that checks if the user has the required access.\n *\n * If the user does not meet any of the provided access rules, a 403 Forbidden status is returned.\n *\n * @example\n * // Example 1: Require admin privileges\n * app.use('/admin', apiAccessControlMiddleWare(AccessRule.admin));\n *\n * @example\n * // Example 2: Require both project and organization access, or admin privileges\n * app.use('/dashboard', apiAccessControlMiddleWare([AccessRule.hasProject, AccessRule.hasOrganization], AccessRule.admin));\n */\nexport const accessControlMiddleWare =\n (...accessRules: (AccessRule | AccessRule[])[]) =>\n (_req: Request<unknown>, res: Response, next: NextFunction): void => {\n let hasAccess = false;\n\n // Iterate over each access rule group (either single AccessRule or an array of AccessRules)\n for (const ruleGroup of accessRules) {\n if (Array.isArray(ruleGroup)) {\n // If ruleGroup is an array, check if all rules in the group are satisfied\n const accessResults = ruleGroup.map(\n (rule) => accessControl(res, rule).success\n );\n hasAccess = accessResults.every((result) => result); // All rules must be satisfied in this case\n } else {\n // Single rule: just check this one\n const accessResult = accessControl(res, ruleGroup);\n if (accessResult.success) {\n hasAccess = true;\n }\n }\n\n // If access is granted at any point, stop further checks\n if (hasAccess) {\n break;\n }\n }\n\n // If no access rule group was satisfied, deny access\n if (!hasAccess) {\n logger.error('Access denied');\n\n const errorStatusCode = HttpStatusCodes.FORBIDDEN_403;\n res.sendStatus(errorStatusCode);\n return;\n }\n\n next();\n };\n"],"mappings":";;;;AAKA,IAAY,oDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGF,MAAa,iBACX,KACA,eACG;CACH,MAAMA,kBAAgC,MAAM,QAAQ,WAAW,GAC3D,aACA,CAAC,WAAW;CAGhB,MAAM,EAAE,MAAM,cAAc,SAAS,aADP,IAAI;AAIlC,KAAI,gBAAgB,SAAS,WAAW,KAAK,CAC3C,QAAO;EACL,SAAS;EACT,SAAS;EACT,MAAM;GAAE;GAAM;GAAc;GAAS;GAAU;EAChD;CAGH,IAAI,UAAU;CACd,MAAMC,WAAqB,EAAE;AAG7B,KAAI,gBAAgB,SAAS,WAAW,cAAc,EACpD;MAAI,CAAC,MAAM;AACT,aAAU;AACV,YAAS,KAAK,4BAA4B;;;AAa9C,KAAI,gBAAgB,SAAS,WAAW,kBAAkB,EACxD;MAAI,MAAM;AACR,aAAU;AACV,YAAS,KAAK,wBAAwB;;;AAK1C,KAAI,gBAAgB,SAAS,WAAW,gBAAgB,EACtD;MAAI,CAAC,cAAc;AACjB,aAAU;AACV,YAAS,KAAK,0BAA0B;;;AAK5C,KAAI,gBAAgB,SAAS,WAAW,WAAW,EACjD;MAAI,CAAC,SAAS;AACZ,aAAU;AACV,YAAS,KAAK,qBAAqB;;;AAKvC,KAAI,gBAAgB,SAAS,WAAW,OAAO,EAC7C;MAAI,aAAa,UAAU;AACzB,aAAU;AACV,YAAS,KAAK,oCAAoC;;;CAKtD,MAAM,aAAa,OAAO,OAAO,WAAW;CAC5C,MAAM,eAAe,gBAAgB,QAClC,SAAS,CAAC,WAAW,SAAS,KAAK,CACrC;AACD,KAAI,aAAa,SAAS,GAAG;AAC3B,YAAU;AACV,WAAS,KAAK,yBAAyB,aAAa,KAAK,KAAK,GAAG;;AAGnE,QAAO;EACL;EACA,SAAS,SAAS,KAAK,KAAK;EAC5B,MAAM;GAAE;GAAM;GAAc;GAAS;GAAU;EAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCH,MAAa,2BACV,GAAG,iBACH,MAAwB,KAAe,SAA6B;CACnE,IAAI,YAAY;AAGhB,MAAK,MAAM,aAAa,aAAa;AACnC,MAAI,MAAM,QAAQ,UAAU,CAK1B,aAHsB,UAAU,KAC7B,SAAS,cAAc,KAAK,KAAK,CAAC,QACpC,CACyB,OAAO,WAAW,OAAO;WAG9B,cAAc,KAAK,UAAU,CACjC,QACf,aAAY;AAKhB,MAAI,UACF;;AAKJ,KAAI,CAAC,WAAW;AACd,SAAO,MAAM,gBAAgB;EAE7B,MAAM,kBAAkB,gBAAgB;AACxC,MAAI,WAAW,gBAAgB;AAC/B;;AAGF,OAAM"}
|
|
@@ -5,12 +5,12 @@ import { ProjectModel } from "../../models/project.model.mjs";
|
|
|
5
5
|
import { TagModel } from "../../models/tag.model.mjs";
|
|
6
6
|
import { UserModel } from "../../models/user.model.mjs";
|
|
7
7
|
import { OAuth2AccessTokenModel } from "../../models/oAuth2.model.mjs";
|
|
8
|
-
import
|
|
8
|
+
import { connect } from "mongoose";
|
|
9
9
|
|
|
10
10
|
//#region src/utils/mongoDB/connectDB.ts
|
|
11
11
|
const connectDB = async () => {
|
|
12
12
|
try {
|
|
13
|
-
const client = await
|
|
13
|
+
const client = await connect(`mongodb+srv://${process.env.DB_ID}:${process.env.DB_MDP}@${process.env.DB_CLUSTER}/?retryWrites=true&w=majority&appName=Cluster0`);
|
|
14
14
|
logger.info("MongoDB connected");
|
|
15
15
|
await ProjectModel.syncIndexes();
|
|
16
16
|
await UserModel.createIndexes();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectDB.mjs","names":[],"sources":["../../../../src/utils/mongoDB/connectDB.ts"],"sourcesContent":["import { logger } from '@logger';\nimport { DictionaryModel } from '@models/dictionary.model';\nimport { OAuth2AccessTokenModel } from '@models/oAuth2.model';\nimport { OrganizationModel } from '@models/organization.model';\nimport { ProjectModel } from '@models/project.model';\nimport { TagModel } from '@models/tag.model';\nimport { UserModel } from '@models/user.model';\nimport
|
|
1
|
+
{"version":3,"file":"connectDB.mjs","names":[],"sources":["../../../../src/utils/mongoDB/connectDB.ts"],"sourcesContent":["import { logger } from '@logger';\nimport { DictionaryModel } from '@models/dictionary.model';\nimport { OAuth2AccessTokenModel } from '@models/oAuth2.model';\nimport { OrganizationModel } from '@models/organization.model';\nimport { ProjectModel } from '@models/project.model';\nimport { TagModel } from '@models/tag.model';\nimport { UserModel } from '@models/user.model';\nimport { connect } from 'mongoose';\n\nexport const connectDB = async () => {\n try {\n const client = await connect(\n `mongodb+srv://${process.env.DB_ID}:${process.env.DB_MDP}@${process.env.DB_CLUSTER}/?retryWrites=true&w=majority&appName=Cluster0`\n );\n\n logger.info('MongoDB connected');\n\n // Recreate indexes for models\n await ProjectModel.syncIndexes();\n await UserModel.createIndexes();\n await OAuth2AccessTokenModel.createIndexes();\n await TagModel.createIndexes();\n await DictionaryModel.createIndexes();\n await OrganizationModel.createIndexes();\n\n // Return the underlying MongoDB client for better-auth\n return client.connection.getClient();\n } catch (error) {\n const errorMessage = `MongoDB connection error - ${(error as Error).message}`;\n\n logger.error(errorMessage);\n throw new Error(errorMessage);\n }\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,YAAY,YAAY;AACnC,KAAI;EACF,MAAM,SAAS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ArL0B,sBAqL1B,CAAA,EAAA,KAAA,EApLQ,YAoLR,EAAA,GAnLE,OAmLF,CAAA,IAAA,CAAA;AAtLwB,KAwLb,qBAAA,GAxLa;EAAlB,YAAA,EAAA,MAAA;CACoB;AAApB,KAwLK,oBAAA,GAAuB,OAxL5B,CAwLoC,YAxLpC,CAAA;AACE,KAwLG,sBAAA,GAAyB,YAxL5B,CAwLyC,aAxLzC,CAAA;;;AAsLT;AACY,cAMC,gBANmB,EAAA,CAAW,GAAA,EAOpC,OAPoC,CAO5B,qBAP2B,EAAA,GAAA,EAOC,oBAPD,CAAA,EAAA,GAAA,EAQnC,mBARmC,CAQf,sBARe,CAAA,EAAA,KAAA,EASjC,YATiC,EAAA,GAUvC,OAVuC,CAAA,IAAA,CAAA;AAC9B,KA4EA,qBAAA,GA5EsB;EAKrB,YAAA,EAAA,MAqEZ;CApEc;AAA4B,KAuE/B,sBAAA,GAAyB,YAvEM,CAuEO,aAvEP,CAAA;;;;AAElC,cA0EI,gBA1EJ,EAAA,CAAA,GAAA,EA2EF,OA3EE,CA2EM,qBA3EN,CAAA,EAAA,GAAA,EA4EF,mBA5EE,CA4EkB,sBA5ElB,CAAA,EAAA,KAAA,EA6EA,YA7EA,EAAA,GA8EN,OA9EM,CAAA,IAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/InviteUserEmail.d.ts
|
|
4
4
|
type InviteUserEmailProps = {
|
|
@@ -19,7 +19,7 @@ declare const InviteUserEmailEN: {
|
|
|
19
19
|
inviteLink,
|
|
20
20
|
inviteFromIp,
|
|
21
21
|
inviteFromLocation
|
|
22
|
-
}: InviteUserEmailProps):
|
|
22
|
+
}: InviteUserEmailProps): react_jsx_runtime8.JSX.Element;
|
|
23
23
|
PreviewProps: InviteUserEmailProps;
|
|
24
24
|
};
|
|
25
25
|
declare const InviteUserEmailFR: {
|
|
@@ -31,7 +31,7 @@ declare const InviteUserEmailFR: {
|
|
|
31
31
|
inviteLink,
|
|
32
32
|
inviteFromIp,
|
|
33
33
|
inviteFromLocation
|
|
34
|
-
}: InviteUserEmailProps):
|
|
34
|
+
}: InviteUserEmailProps): react_jsx_runtime8.JSX.Element;
|
|
35
35
|
PreviewProps: InviteUserEmailProps;
|
|
36
36
|
};
|
|
37
37
|
declare const InviteUserEmailES: {
|
|
@@ -43,7 +43,7 @@ declare const InviteUserEmailES: {
|
|
|
43
43
|
inviteLink,
|
|
44
44
|
inviteFromIp,
|
|
45
45
|
inviteFromLocation
|
|
46
|
-
}: InviteUserEmailProps):
|
|
46
|
+
}: InviteUserEmailProps): react_jsx_runtime8.JSX.Element;
|
|
47
47
|
PreviewProps: InviteUserEmailProps;
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime17 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/OAuthTokenCreatedEmail.d.ts
|
|
4
4
|
type OAuthTokenCreatedEmailProps = {
|
|
@@ -17,7 +17,7 @@ declare const OAuthTokenCreatedEmailEN: {
|
|
|
17
17
|
tokenDetailsUrl,
|
|
18
18
|
securityLogUrl,
|
|
19
19
|
supportUrl
|
|
20
|
-
}: OAuthTokenCreatedEmailProps):
|
|
20
|
+
}: OAuthTokenCreatedEmailProps): react_jsx_runtime17.JSX.Element;
|
|
21
21
|
PreviewProps: OAuthTokenCreatedEmailProps;
|
|
22
22
|
};
|
|
23
23
|
declare const OAuthTokenCreatedEmailFR: {
|
|
@@ -28,7 +28,7 @@ declare const OAuthTokenCreatedEmailFR: {
|
|
|
28
28
|
tokenDetailsUrl,
|
|
29
29
|
securityLogUrl,
|
|
30
30
|
supportUrl
|
|
31
|
-
}: OAuthTokenCreatedEmailProps):
|
|
31
|
+
}: OAuthTokenCreatedEmailProps): react_jsx_runtime17.JSX.Element;
|
|
32
32
|
PreviewProps: OAuthTokenCreatedEmailProps;
|
|
33
33
|
};
|
|
34
34
|
declare const OAuthTokenCreatedEmailES: {
|
|
@@ -39,7 +39,7 @@ declare const OAuthTokenCreatedEmailES: {
|
|
|
39
39
|
tokenDetailsUrl,
|
|
40
40
|
securityLogUrl,
|
|
41
41
|
supportUrl
|
|
42
|
-
}: OAuthTokenCreatedEmailProps):
|
|
42
|
+
}: OAuthTokenCreatedEmailProps): react_jsx_runtime17.JSX.Element;
|
|
43
43
|
PreviewProps: OAuthTokenCreatedEmailProps;
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthTokenCreatedEmail.d.ts","names":[],"sources":["../../../src/emails/OAuthTokenCreatedEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,2BAAA;;;EAAA,MAAA,EAAA,MAAA,EAAA;EASC,eAAA,EAAA,MAAA;;;;cAAA;;;;;;;;KAOV,8BAA2B,
|
|
1
|
+
{"version":3,"file":"OAuthTokenCreatedEmail.d.ts","names":[],"sources":["../../../src/emails/OAuthTokenCreatedEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,2BAAA;;;EAAA,MAAA,EAAA,MAAA,EAAA;EASC,eAAA,EAAA,MAAA;;;;cAAA;;;;;;;;KAOV,8BAA2B,mBAAA,CAAA,GAAA,CAAA;;CAA3B;AAA2B,cA2EjB,wBA3EiB,EAAA;;;;;;;;KAkF3B,8BAA2B,mBAAA,CAAA,GAAA,CAAA;;AAP9B,CAAA;cA+Ea;;;;;;;;KAOV,8BAA2B,mBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/PasswordChangeConfirmation.d.ts
|
|
4
4
|
type PasswordChangeConfirmationEmailProps = {
|
|
@@ -7,19 +7,19 @@ type PasswordChangeConfirmationEmailProps = {
|
|
|
7
7
|
declare const PasswordChangeConfirmationEmailEN: {
|
|
8
8
|
({
|
|
9
9
|
username
|
|
10
|
-
}: PasswordChangeConfirmationEmailProps):
|
|
10
|
+
}: PasswordChangeConfirmationEmailProps): react_jsx_runtime2.JSX.Element;
|
|
11
11
|
PreviewProps: PasswordChangeConfirmationEmailProps;
|
|
12
12
|
};
|
|
13
13
|
declare const PasswordChangeConfirmationEmailFR: {
|
|
14
14
|
({
|
|
15
15
|
username
|
|
16
|
-
}: PasswordChangeConfirmationEmailProps):
|
|
16
|
+
}: PasswordChangeConfirmationEmailProps): react_jsx_runtime2.JSX.Element;
|
|
17
17
|
PreviewProps: PasswordChangeConfirmationEmailProps;
|
|
18
18
|
};
|
|
19
19
|
declare const PasswordChangeConfirmationEmailES: {
|
|
20
20
|
({
|
|
21
21
|
username
|
|
22
|
-
}: PasswordChangeConfirmationEmailProps):
|
|
22
|
+
}: PasswordChangeConfirmationEmailProps): react_jsx_runtime2.JSX.Element;
|
|
23
23
|
PreviewProps: PasswordChangeConfirmationEmailProps;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordChangeConfirmation.d.ts","names":[],"sources":["../../../src/emails/PasswordChangeConfirmation.tsx"],"sourcesContent":[],"mappings":";;;KAcY,oCAAA;;;AAAA,cAIC,iCAJmC,EAAA;EAInC,CAAA;IAAA;EA8CZ,CA9CY,EAEV,oCA4CF,CAAA,EA5CsC,
|
|
1
|
+
{"version":3,"file":"PasswordChangeConfirmation.d.ts","names":[],"sources":["../../../src/emails/PasswordChangeConfirmation.tsx"],"sourcesContent":[],"mappings":";;;KAcY,oCAAA;;;AAAA,cAIC,iCAJmC,EAAA;EAInC,CAAA;IAAA;EA8CZ,CA9CY,EAEV,oCA4CF,CAAA,EA5CsC,kBAAA,CAAA,GAAA,CAAA,OA4CtC;;CA5CE;AAAoC,cA8C1B,iCA9C0B,EAAA;;;KAgDpC,uCAAoC,kBAAA,CAAA,GAAA,CAAA;;AAFvC,CAAA;cAiDa;EA/CV,CAAA;IAAA;EAAA,CAAA,EAiDA,oCAjDA,CAAA,EAiDoC,kBAAA,CAAA,GAAA,CAAA,OAjDpC;EAAoC,YAAA,sCAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/SubscriptionPaymentCancellation.d.ts
|
|
4
4
|
type SubscriptionPaymentCancellationProps = {
|
|
@@ -16,7 +16,7 @@ declare const SubscriptionPaymentCancellationEN: {
|
|
|
16
16
|
organizationName,
|
|
17
17
|
cancellationDate,
|
|
18
18
|
reactivateLink
|
|
19
|
-
}: SubscriptionPaymentCancellationProps):
|
|
19
|
+
}: SubscriptionPaymentCancellationProps): react_jsx_runtime0.JSX.Element;
|
|
20
20
|
PreviewProps: SubscriptionPaymentCancellationProps;
|
|
21
21
|
};
|
|
22
22
|
declare const SubscriptionPaymentCancellationFR: {
|
|
@@ -26,7 +26,7 @@ declare const SubscriptionPaymentCancellationFR: {
|
|
|
26
26
|
organizationName,
|
|
27
27
|
cancellationDate,
|
|
28
28
|
reactivateLink
|
|
29
|
-
}: SubscriptionPaymentCancellationProps):
|
|
29
|
+
}: SubscriptionPaymentCancellationProps): react_jsx_runtime0.JSX.Element;
|
|
30
30
|
PreviewProps: SubscriptionPaymentCancellationProps;
|
|
31
31
|
};
|
|
32
32
|
declare const SubscriptionPaymentCancellationES: {
|
|
@@ -36,7 +36,7 @@ declare const SubscriptionPaymentCancellationES: {
|
|
|
36
36
|
organizationName,
|
|
37
37
|
cancellationDate,
|
|
38
38
|
reactivateLink
|
|
39
|
-
}: SubscriptionPaymentCancellationProps):
|
|
39
|
+
}: SubscriptionPaymentCancellationProps): react_jsx_runtime0.JSX.Element;
|
|
40
40
|
PreviewProps: SubscriptionPaymentCancellationProps;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionPaymentCancellation.d.ts","names":[],"sources":["../../../src/emails/SubscriptionPaymentCancellation.tsx"],"sourcesContent":[],"mappings":";;;KAcY,oCAAA;;;EAAA,QAAA,EAAA,MAAA;EASC,gBAAA,EAAA,MAAA;;;;cAAA;;;;;;;KAMV,uCAAoC,
|
|
1
|
+
{"version":3,"file":"SubscriptionPaymentCancellation.d.ts","names":[],"sources":["../../../src/emails/SubscriptionPaymentCancellation.tsx"],"sourcesContent":[],"mappings":";;;KAcY,oCAAA;;;EAAA,QAAA,EAAA,MAAA;EASC,gBAAA,EAAA,MAAA;;;;cAAA;;;;;;;KAMV,uCAAoC,kBAAA,CAAA,GAAA,CAAA;EAApC,YAAA,sCAAA;CAAoC;cAgD1B;;;;;;;KAMV,uCAAoC,kBAAA,CAAA,GAAA,CAAA;EAN1B,YAAA,sCAoDZ;;cAEY;;;;;;;KAMV,uCAAoC,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/SubscriptionPaymentError.d.ts
|
|
4
4
|
type SubscriptionPaymentErrorProps = {
|
|
@@ -16,7 +16,7 @@ declare const SubscriptionPaymentErrorEN: {
|
|
|
16
16
|
organizationName,
|
|
17
17
|
errorDate,
|
|
18
18
|
retryPaymentLink
|
|
19
|
-
}: SubscriptionPaymentErrorProps):
|
|
19
|
+
}: SubscriptionPaymentErrorProps): react_jsx_runtime5.JSX.Element;
|
|
20
20
|
PreviewProps: SubscriptionPaymentErrorProps;
|
|
21
21
|
};
|
|
22
22
|
declare const SubscriptionPaymentErrorFR: {
|
|
@@ -26,7 +26,7 @@ declare const SubscriptionPaymentErrorFR: {
|
|
|
26
26
|
organizationName,
|
|
27
27
|
errorDate,
|
|
28
28
|
retryPaymentLink
|
|
29
|
-
}: SubscriptionPaymentErrorProps):
|
|
29
|
+
}: SubscriptionPaymentErrorProps): react_jsx_runtime5.JSX.Element;
|
|
30
30
|
PreviewProps: SubscriptionPaymentErrorProps;
|
|
31
31
|
};
|
|
32
32
|
declare const SubscriptionPaymentErrorES: {
|
|
@@ -36,7 +36,7 @@ declare const SubscriptionPaymentErrorES: {
|
|
|
36
36
|
organizationName,
|
|
37
37
|
errorDate,
|
|
38
38
|
retryPaymentLink
|
|
39
|
-
}: SubscriptionPaymentErrorProps):
|
|
39
|
+
}: SubscriptionPaymentErrorProps): react_jsx_runtime5.JSX.Element;
|
|
40
40
|
PreviewProps: SubscriptionPaymentErrorProps;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime20 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/SubscriptionPaymentSuccess.d.ts
|
|
4
4
|
type SubscriptionPaymentSuccessProps = {
|
|
@@ -16,7 +16,7 @@ declare const SubscriptionPaymentSuccessEN: {
|
|
|
16
16
|
organizationName,
|
|
17
17
|
subscriptionStartDate,
|
|
18
18
|
manageSubscriptionLink
|
|
19
|
-
}: SubscriptionPaymentSuccessProps):
|
|
19
|
+
}: SubscriptionPaymentSuccessProps): react_jsx_runtime20.JSX.Element;
|
|
20
20
|
PreviewProps: SubscriptionPaymentSuccessProps;
|
|
21
21
|
};
|
|
22
22
|
declare const SubscriptionPaymentSuccessFR: {
|
|
@@ -26,7 +26,7 @@ declare const SubscriptionPaymentSuccessFR: {
|
|
|
26
26
|
organizationName,
|
|
27
27
|
subscriptionStartDate,
|
|
28
28
|
manageSubscriptionLink
|
|
29
|
-
}: SubscriptionPaymentSuccessProps):
|
|
29
|
+
}: SubscriptionPaymentSuccessProps): react_jsx_runtime20.JSX.Element;
|
|
30
30
|
PreviewProps: SubscriptionPaymentSuccessProps;
|
|
31
31
|
};
|
|
32
32
|
declare const SubscriptionPaymentSuccessES: {
|
|
@@ -36,7 +36,7 @@ declare const SubscriptionPaymentSuccessES: {
|
|
|
36
36
|
organizationName,
|
|
37
37
|
subscriptionStartDate,
|
|
38
38
|
manageSubscriptionLink
|
|
39
|
-
}: SubscriptionPaymentSuccessProps):
|
|
39
|
+
}: SubscriptionPaymentSuccessProps): react_jsx_runtime20.JSX.Element;
|
|
40
40
|
PreviewProps: SubscriptionPaymentSuccessProps;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/ValidateUserEmail.d.ts
|
|
4
4
|
type ValidateUserEmailProps = {
|
|
@@ -9,21 +9,21 @@ declare const ValidateUserEmailEN: {
|
|
|
9
9
|
({
|
|
10
10
|
username,
|
|
11
11
|
validationLink
|
|
12
|
-
}: ValidateUserEmailProps):
|
|
12
|
+
}: ValidateUserEmailProps): react_jsx_runtime14.JSX.Element;
|
|
13
13
|
PreviewProps: ValidateUserEmailProps;
|
|
14
14
|
};
|
|
15
15
|
declare const ValidateUserEmailFR: {
|
|
16
16
|
({
|
|
17
17
|
username,
|
|
18
18
|
validationLink
|
|
19
|
-
}: ValidateUserEmailProps):
|
|
19
|
+
}: ValidateUserEmailProps): react_jsx_runtime14.JSX.Element;
|
|
20
20
|
PreviewProps: ValidateUserEmailProps;
|
|
21
21
|
};
|
|
22
22
|
declare const ValidateUserEmailES: {
|
|
23
23
|
({
|
|
24
24
|
username,
|
|
25
25
|
validationLink
|
|
26
|
-
}: ValidateUserEmailProps):
|
|
26
|
+
}: ValidateUserEmailProps): react_jsx_runtime14.JSX.Element;
|
|
27
27
|
PreviewProps: ValidateUserEmailProps;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime23 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/Welcome.d.ts
|
|
4
4
|
type WelcomeEmailProps = {
|
|
@@ -9,21 +9,21 @@ declare const WelcomeEmailEN: {
|
|
|
9
9
|
({
|
|
10
10
|
username,
|
|
11
11
|
loginLink
|
|
12
|
-
}: WelcomeEmailProps):
|
|
12
|
+
}: WelcomeEmailProps): react_jsx_runtime23.JSX.Element;
|
|
13
13
|
PreviewProps: WelcomeEmailProps;
|
|
14
14
|
};
|
|
15
15
|
declare const WelcomeEmailFR: {
|
|
16
16
|
({
|
|
17
17
|
username,
|
|
18
18
|
loginLink
|
|
19
|
-
}: WelcomeEmailProps):
|
|
19
|
+
}: WelcomeEmailProps): react_jsx_runtime23.JSX.Element;
|
|
20
20
|
PreviewProps: WelcomeEmailProps;
|
|
21
21
|
};
|
|
22
22
|
declare const WelcomeEmailES: {
|
|
23
23
|
({
|
|
24
24
|
username,
|
|
25
25
|
loginLink
|
|
26
|
-
}: WelcomeEmailProps):
|
|
26
|
+
}: WelcomeEmailProps): react_jsx_runtime23.JSX.Element;
|
|
27
27
|
PreviewProps: WelcomeEmailProps;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Welcome.d.ts","names":[],"sources":["../../../src/emails/Welcome.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,iBAAA;;;AAAZ,CAAA;AAKa,cAAA,cAyDZ,EAAA;;;;KAzDuD,oBAAiB,
|
|
1
|
+
{"version":3,"file":"Welcome.d.ts","names":[],"sources":["../../../src/emails/Welcome.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,iBAAA;;;AAAZ,CAAA;AAKa,cAAA,cAyDZ,EAAA;;;;KAzDuD,oBAAiB,mBAAA,CAAA,GAAA,CAAA;;CAAjB;AAAiB,cA2D5D,cA3D4D,EAAA;;;;KA2DjB,oBAAiB,mBAAA,CAAA,GAAA,CAAA;;AAAzE,CAAA;cA2Da;;;;KAA2C,oBAAiB,mBAAA,CAAA,GAAA,CAAA;EA3DjB,YAAA,mBAAA;CAAiB"}
|
package/dist/types/export.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { Discussion, DiscussionAPI, DiscussionDocument, DiscussionModelType, Dis
|
|
|
11
11
|
import { HttpStatusCodes } from "./utils/httpStatusCodes.js";
|
|
12
12
|
import { PaginatedResponse, ResponseData, formatPaginatedResponse, formatResponse } from "./utils/responseData.js";
|
|
13
13
|
import { AskDocQuestionBody, AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, CustomQueryBody, CustomQueryResult, GetDiscussionsParams, GetDiscussionsResult, TranslateJSONBody, TranslateJSONResult, askDocQuestion, auditContentDeclaration, auditContentDeclarationField, auditContentDeclarationMetadata, auditTag, autocomplete, customQuery, getDiscussions, translateJSON } from "./controllers/ai.controller.js";
|
|
14
|
+
import { CreateAuditBody, CreateAuditResult, GetAuditByIdParams, GetAuditByIdResult, GetAuditsParams, GetAuditsResult, createAudit, getAuditById, getAudits } from "./controllers/audit.controller.js";
|
|
14
15
|
import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionariesUpdateTimestampResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, PushDictionariesBody, PushDictionariesResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, addDictionary, deleteDictionary, getDictionaries, getDictionariesKeys, getDictionariesUpdateTimestamp, getDictionaryByKey, pushDictionaries, updateDictionary } from "./controllers/dictionary.controller.js";
|
|
15
16
|
import { CheckDictionaryChangeSSEParams, MessageEventData, Object as Object$1, SendDictionaryUpdateArg, Status, listenChangeSSE, sendDictionaryUpdate } from "./controllers/eventListener.controller.js";
|
|
16
17
|
import { NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, getNewsletterStatus, subscribeToNewsletter, unsubscribeFromNewsletter } from "./controllers/newsletter.controller.js";
|
|
@@ -29,4 +30,5 @@ import { getNewsletterRoutes } from "./routes/newsletter.routes.js";
|
|
|
29
30
|
import { getOrganizationRoutes } from "./routes/organization.routes.js";
|
|
30
31
|
import { getProjectRoutes } from "./routes/project.routes.js";
|
|
31
32
|
import { getUserRoutes } from "./routes/user.routes.js";
|
|
32
|
-
export
|
|
33
|
+
export * from "@/types/audit.types";
|
|
34
|
+
export { AIConfig, AIConfigOptions, AIOptions, AIProvider, AccessKeyData, AddDictionaryBody, AddDictionaryResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, AddProjectBody, AddProjectResult, AddTagBody, AddTagResult, AskDocQuestionBody, AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, Auth, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CheckDictionaryChangeSSEParams, ContentVersion, CreateAuditBody, CreateAuditResult, CreateUserBody, CreateUserResult, CustomQueryBody, CustomQueryResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteDictionaryParam, DeleteDictionaryResult, DeleteOrganizationResult, DeleteProjectResult, DeleteTagParams, DeleteTagResult, DeleteUserParams, DeleteUserResult, Dictionary, DictionaryAPI, DictionaryCreationData, DictionaryData, DictionaryDocument, DictionaryModelType, DictionarySchema, Discussion, DiscussionAPI, DiscussionDocument, DiscussionModelType, DiscussionSchema, EmailsList, GetAuditByIdParams, GetAuditByIdResult, GetAuditsParams, GetAuditsResult, GetCheckoutSessionBody, GetCheckoutSessionResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionariesUpdateTimestampResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetDiscussionsParams, GetDiscussionsResult, GetOAuth2TokenBody, GetOAuth2TokenResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, GetPricingBody, GetPricingResult, GetProjectsParams, GetProjectsResult, GetTagsParams, GetTagsResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, HttpStatusCodes, Message, MessageEventData, Messages, Model, NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, OAuth2Access, OAuth2AccessAPI, OAuth2AccessContext, OAuth2AccessData, OAuth2Token, OAuth2TokenDocument, OAuth2TokenModelType, OAuth2TokenSchema, Object$1 as Object, Organization, OrganizationAPI, OrganizationCreationData, OrganizationData, OrganizationDocument, OrganizationModelType, OrganizationSchema, PaginatedResponse, Plan, PlanAPI, PlanData, PlanDocument, PlanModelType, PlanSchema, PlanType, Project, ProjectAPI, ProjectConfiguration, ProjectCreationData, ProjectData, ProjectDocument, ProjectMemberByIdOption, ProjectModelType, ProjectSchema, PushDictionariesBody, PushDictionariesResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, ResponseData, SearchDocUtilParams, SearchDocUtilResult, SelectOrganizationParam, SelectOrganizationResult, SelectProjectParam, SelectProjectResult, SendDictionaryUpdateArg, Session, SessionAPI, SessionContext, SessionData, SessionDataApi, SessionDocument, SessionModelType, SessionSchema, Status, Tag, TagAPI, TagCreationData, TagData, TagDocument, TagModelType, TagSchema, TranslateJSONBody, TranslateJSONResult, UnselectOrganizationResult, UnselectProjectResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersByIdBody, UpdateOrganizationMembersByIdParams, UpdateOrganizationMembersByIdResult, UpdateOrganizationMembersResult, UpdateOrganizationResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult, UpdateTagBody, UpdateTagParams, UpdateTagResult, UpdateUserBody, UpdateUserResult, User, UserAPI, UserData, UserDocument, UserModelType, UserSchema, VerifyEmailStatusSSEParams, VersionedContent, VersionedContentEl, addDictionary, addNewAccessKey, addOrganization, addOrganizationMember, addProject, addTag, askDocQuestion, auditContentDeclaration, auditContentDeclarationField, auditContentDeclarationMetadata, auditTag, autocomplete, cancelSubscription, createAudit, createUser, customQuery, deleteAccessKey, deleteDictionary, deleteOrganization, deleteProject, deleteTag, deleteUser, formatPaginatedResponse, formatResponse, formatSession, getAIConfig, getAiRoutes, getAuditById, getAudits, getAuth, getDictionaries, getDictionariesKeys, getDictionariesUpdateTimestamp, getDictionaryByKey, getDictionaryRoutes, getDiscussions, getNewsletterRoutes, getNewsletterStatus, getOAuth2AccessToken, getOrganization, getOrganizationRoutes, getOrganizations, getPricing, getProjectRoutes, getProjects, getSubscription, getTags, getUserByEmail, getUserById, getUserRoutes, getUsers, listenChangeSSE, pushDictionaries, pushProjectConfiguration, refreshAccessKey, searchDocUtil, selectOrganization, selectProject, sendDictionaryUpdate, sendVerificationUpdate, subscribeToNewsletter, translateJSON, unselectOrganization, unselectProject, unsubscribeFromNewsletter, updateDictionary, updateOrganization, updateOrganizationMembers, updateOrganizationMembersById, updateProject, updateProjectMembers, updateTag, updateUser, verifyEmailStatusSSE };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Dictionary, DictionaryData } from "../types/dictionary.types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as mongoose0 from "mongoose";
|
|
3
3
|
import { Model } from "mongoose";
|
|
4
4
|
|
|
5
5
|
//#region src/models/dictionary.model.d.ts
|
|
6
|
-
declare const DictionaryModel: Model<Dictionary, {}, {}, {},
|
|
7
|
-
id:
|
|
6
|
+
declare const DictionaryModel: Model<Dictionary, {}, {}, {}, mongoose0.Document<unknown, {}, Dictionary, {}, {}> & DictionaryData & {
|
|
7
|
+
id: mongoose0.Types.ObjectId;
|
|
8
8
|
createdAt: number;
|
|
9
9
|
updatedAt: number;
|
|
10
10
|
} & {
|
|
11
|
-
_id:
|
|
11
|
+
_id: mongoose0.Types.ObjectId;
|
|
12
12
|
} & {
|
|
13
13
|
__v: number;
|
|
14
14
|
}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.model.d.ts","names":[],"sources":["../../../src/models/dictionary.model.ts"],"sourcesContent":[],"mappings":";;;;;cAKa,iBAAe,MAAA,wBAAA,
|
|
1
|
+
{"version":3,"file":"dictionary.model.d.ts","names":[],"sources":["../../../src/models/dictionary.model.ts"],"sourcesContent":[],"mappings":";;;;;cAKa,iBAAe,MAAA,wBAAA,SAAA,CAAA,sBAAA,sBAAA,cAAA;;;EAAf,SAAA,EAAA,MAAA;CAAe,GAAA;EAAA,GAAA,0BAAA;CAAA,GAAA;EAAA,GAAA,EAAA,MAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Discussion } from "../types/discussion.types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as mongoose2 from "mongoose";
|
|
3
3
|
import { Model } from "mongoose";
|
|
4
4
|
|
|
5
5
|
//#region src/models/discussion.model.d.ts
|
|
6
|
-
declare const DiscussionModel: Model<Discussion, {}, {}, {},
|
|
6
|
+
declare const DiscussionModel: Model<Discussion, {}, {}, {}, mongoose2.Document<unknown, {}, Discussion, {}, {}> & Discussion & Required<{
|
|
7
7
|
_id: unknown;
|
|
8
8
|
}> & {
|
|
9
9
|
__v: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discussion.model.d.ts","names":[],"sources":["../../../src/models/discussion.model.ts"],"sourcesContent":[],"mappings":";;;;;cAKa,iBAAe,MAAA,wBAAA,
|
|
1
|
+
{"version":3,"file":"discussion.model.d.ts","names":[],"sources":["../../../src/models/discussion.model.ts"],"sourcesContent":[],"mappings":";;;;;cAKa,iBAAe,MAAA,wBAAA,SAAA,CAAA,sBAAA,sBAAA,aAAA;;;EAAf,GAAA,EAAA,MAAA;CAAe,EAAA,GAAA,CAAA"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { User } from "../types/user.types.js";
|
|
2
|
+
import "../export.js";
|
|
2
3
|
import { Token as Token$1 } from "../schemas/oAuth2.schema.js";
|
|
3
|
-
import * as
|
|
4
|
+
import * as mongoose3 from "mongoose";
|
|
4
5
|
import { Model } from "mongoose";
|
|
5
6
|
import * as oauth2_server0 from "oauth2-server";
|
|
6
7
|
|
|
7
8
|
//#region src/models/oAuth2.model.d.ts
|
|
8
|
-
declare const OAuth2AccessTokenModel: Model<Token$1, {}, {}, {},
|
|
9
|
+
declare const OAuth2AccessTokenModel: Model<Token$1, {}, {}, {}, mongoose3.Document<unknown, {}, Token$1, {}, {}> & Omit<oauth2_server0.Token, "user" | "client"> & {
|
|
9
10
|
clientId: oauth2_server0.Client["id"];
|
|
10
11
|
userId: User["id"];
|
|
11
12
|
} & {
|
|
12
|
-
_id:
|
|
13
|
+
_id: mongoose3.Types.ObjectId;
|
|
13
14
|
} & {
|
|
14
15
|
__v: number;
|
|
15
16
|
}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oAuth2.model.d.ts","names":[],"sources":["../../../src/models/oAuth2.model.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oAuth2.model.d.ts","names":[],"sources":["../../../src/models/oAuth2.model.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAGa,wBAAsB,MAAA,qBAAA,SAAA,CAAA,sBAAA,mBAAA,KAAA,cAAA,CAAA,KAAA;YAAA,cAAA,CAAA,MAAA;;;;;EAAtB,GAAA,EAAA,MAAA;CAAsB,EAAA,GAAA,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Dictionary, DictionarySchema } from "../types/dictionary.types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as mongoose38 from "mongoose";
|
|
3
3
|
import { Schema } from "mongoose";
|
|
4
4
|
|
|
5
5
|
//#region src/schemas/dictionary.schema.d.ts
|
|
6
|
-
declare const dictionarySchema: Schema<DictionarySchema,
|
|
7
|
-
_id:
|
|
6
|
+
declare const dictionarySchema: Schema<DictionarySchema, mongoose38.Model<DictionarySchema, any, any, any, mongoose38.Document<unknown, any, DictionarySchema, any, {}> & Omit<Dictionary, "id"> & {
|
|
7
|
+
_id: mongoose38.Types.ObjectId;
|
|
8
8
|
} & Required<{
|
|
9
|
-
_id:
|
|
9
|
+
_id: mongoose38.Types.ObjectId;
|
|
10
10
|
}> & {
|
|
11
11
|
__v: number;
|
|
12
|
-
}, any>, {}, {}, {}, {},
|
|
13
|
-
_id:
|
|
12
|
+
}, any>, {}, {}, {}, {}, mongoose38.DefaultSchemaOptions, DictionarySchema, mongoose38.Document<unknown, {}, mongoose38.FlatRecord<DictionarySchema>, {}, mongoose38.ResolveSchemaOptions<mongoose38.DefaultSchemaOptions>> & mongoose38.FlatRecord<DictionarySchema> & Required<{
|
|
13
|
+
_id: mongoose38.Types.ObjectId;
|
|
14
14
|
}> & {
|
|
15
15
|
__v: number;
|
|
16
16
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.schema.d.ts","names":[],"sources":["../../../src/schemas/dictionary.schema.ts"],"sourcesContent":[],"mappings":";;;;;cAwBa,kBAAgB,OAAA,
|
|
1
|
+
{"version":3,"file":"dictionary.schema.d.ts","names":[],"sources":["../../../src/schemas/dictionary.schema.ts"],"sourcesContent":[],"mappings":";;;;;cAwBa,kBAAgB,OAAA,6BAAA,MAAA,iCAAA,UAAA,CAAA,uBAAA,6BAAA,KAAA,UAAA;;;EAAhB,GAAA,2BA4DZ;CA5D4B,CAAA,GAAA;EAAA,GAAA,EAAA,MAAA;CAAA,EAAA,GAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,UAAA,CAAA,oBAAA,kBAAA,qBAAA,CAAA,OAAA,EAAA,CAAA,CAAA,uBAAA,iBAAA,CAAA,EAAA,CAAA,CAAA,iCAAA,iCAAA,CAAA,wBAAA,iBAAA,CAAA,WAAA,CAAA;EAAA,GAAA,2BAAA;CAAA,CAAA,GAAA;EAAA,GAAA,EAAA,MAAA"}
|