@intlayer/backend 7.5.0 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/l10n_platform_alternative/Lokalise.json +4106 -0
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/l10n_platform_alternative/crowdin.json +4106 -0
- package/dist/assets/utils/AI/askDocQuestion/embeddings/blog/en/l10n_platform_alternative/phrase.json +4106 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/routes/organization.routes.mjs +6 -0
- package/dist/esm/routes/organization.routes.mjs.map +1 -1
- package/dist/esm/schemas/organization.schema.mjs +8 -48
- package/dist/esm/schemas/organization.schema.mjs.map +1 -1
- package/dist/esm/utils/auth/getAuth.mjs +13 -4
- package/dist/esm/utils/auth/getAuth.mjs.map +1 -1
- package/dist/esm/utils/mongoDB/connectDB.mjs +12 -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/controllers/projectAccessKey.controller.d.ts.map +1 -1
- package/dist/types/emails/InviteUserEmail.d.ts +4 -4
- package/dist/types/emails/InviteUserEmail.d.ts.map +1 -1
- package/dist/types/emails/MagicLinkEmail.d.ts +4 -4
- package/dist/types/emails/MagicLinkEmail.d.ts.map +1 -1
- package/dist/types/emails/OAuthTokenCreatedEmail.d.ts +4 -4
- package/dist/types/emails/PasswordChangeConfirmation.d.ts +4 -4
- package/dist/types/emails/PasswordChangeConfirmation.d.ts.map +1 -1
- package/dist/types/emails/ResetUserPassword.d.ts +4 -4
- package/dist/types/emails/SubscriptionPaymentCancellation.d.ts +4 -4
- package/dist/types/emails/SubscriptionPaymentError.d.ts +4 -4
- package/dist/types/emails/SubscriptionPaymentError.d.ts.map +1 -1
- 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 +2 -2
- 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 +3 -3
- package/dist/types/models/oAuth2.model.d.ts.map +1 -1
- package/dist/types/routes/ai.routes.d.ts.map +1 -1
- package/dist/types/routes/eventListener.routes.d.ts.map +1 -1
- package/dist/types/routes/newsletter.routes.d.ts.map +1 -1
- package/dist/types/routes/organization.routes.d.ts +5 -0
- package/dist/types/routes/organization.routes.d.ts.map +1 -1
- package/dist/types/routes/search.routes.d.ts.map +1 -1
- package/dist/types/routes/stripe.routes.d.ts.map +1 -1
- package/dist/types/routes/tags.routes.d.ts.map +1 -1
- package/dist/types/routes/user.routes.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/project.schema.d.ts.map +1 -1
- 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 +11 -11
- package/dist/types/types/organization.types.d.ts +9 -58
- package/dist/types/types/organization.types.d.ts.map +1 -1
- package/dist/types/utils/auth/getAuth.d.ts.map +1 -1
- package/dist/types/utils/filtersAndPagination/getDictionaryFiltersAndPagination.d.ts +2 -2
- package/dist/types/utils/filtersAndPagination/getDiscussionFiltersAndPagination.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 +8 -3
- package/dist/types/utils/mongoDB/connectDB.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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\n
|
|
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\n app.all('/api/auth/{*rest}', 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;AAErC,KAAI,IAAI,qBAAqB,cAAc,KAAK,CAAC;AACjD,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"}
|
|
@@ -50,6 +50,11 @@ const getOrganizationRoutes = () => ({
|
|
|
50
50
|
urlModel: "/logout",
|
|
51
51
|
url: `${baseURL()}/logout`,
|
|
52
52
|
method: "POST"
|
|
53
|
+
},
|
|
54
|
+
getOrganizationSSOConfig: {
|
|
55
|
+
urlModel: "/sso",
|
|
56
|
+
url: `${baseURL()}/sso`,
|
|
57
|
+
method: "POST"
|
|
53
58
|
}
|
|
54
59
|
});
|
|
55
60
|
organizationRouter.get(getOrganizationRoutes().getOrganizations.urlModel, getOrganizations);
|
|
@@ -61,6 +66,7 @@ organizationRouter.post(getOrganizationRoutes().addOrganizationMember.urlModel,
|
|
|
61
66
|
organizationRouter.delete(getOrganizationRoutes().deleteOrganization.urlModel, deleteOrganization);
|
|
62
67
|
organizationRouter.put(getOrganizationRoutes().selectOrganization.urlModel, selectOrganization);
|
|
63
68
|
organizationRouter.post(getOrganizationRoutes().unselectOrganization.urlModel, unselectOrganization);
|
|
69
|
+
organizationRouter.post(getOrganizationRoutes().getOrganizationSSOConfig.urlModel, getOrganizationSSOConfig);
|
|
64
70
|
|
|
65
71
|
//#endregion
|
|
66
72
|
export { getOrganizationRoutes, organizationRoute, organizationRouter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.routes.mjs","names":["organizationRouter: Router"],"sources":["../../../src/routes/organization.routes.ts"],"sourcesContent":["import {\n addOrganization,\n addOrganizationMember,\n deleteOrganization,\n getOrganizations,\n selectOrganization,\n unselectOrganization,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n} from '@controllers/organization.controller';\nimport { Router } from 'express';\nimport type { Routes } from '@/types/Routes';\n\nexport const organizationRouter: Router = Router();\n\nexport const organizationRoute = '/api/organization';\n\nconst baseURL = () => `${process.env.BACKEND_URL}${organizationRoute}`;\n\nexport const getOrganizationRoutes = () =>\n ({\n getOrganizations: {\n urlModel: '/',\n url: baseURL(),\n method: 'GET',\n },\n addOrganization: {\n urlModel: '/',\n url: baseURL(),\n method: 'POST',\n },\n updateOrganization: {\n urlModel: '/',\n url: baseURL(),\n\n method: 'PUT',\n },\n updateOrganizationMembers: {\n urlModel: '/members',\n url: `${baseURL()}/members`,\n method: 'PUT',\n },\n updateOrganizationMembersById: {\n urlModel: '/:organizationId/members',\n url: ({ organizationId }: { organizationId: string }) =>\n `${baseURL()}/${organizationId}/members`,\n method: 'PUT',\n },\n addOrganizationMember: {\n urlModel: '/member',\n url: `${baseURL()}/member`,\n method: 'POST',\n },\n deleteOrganization: {\n urlModel: '/',\n url: baseURL(),\n method: 'DELETE',\n },\n selectOrganization: {\n urlModel: '/:organizationId',\n url: ({ organizationId }: { organizationId: string }) =>\n `${baseURL()}/${organizationId}`,\n method: 'PUT',\n },\n unselectOrganization: {\n urlModel: '/logout',\n url: `${baseURL()}/logout`,\n method: 'POST',\n },\n }) satisfies Routes;\n\norganizationRouter.get(\n getOrganizationRoutes().getOrganizations.urlModel,\n getOrganizations\n);\n\norganizationRouter.post(\n getOrganizationRoutes().addOrganization.urlModel,\n addOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganization.urlModel,\n updateOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganizationMembers.urlModel,\n updateOrganizationMembers\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganizationMembersById.urlModel,\n updateOrganizationMembersById\n);\norganizationRouter.post(\n getOrganizationRoutes().addOrganizationMember.urlModel,\n addOrganizationMember\n);\norganizationRouter.delete(\n getOrganizationRoutes().deleteOrganization.urlModel,\n deleteOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().selectOrganization.urlModel,\n selectOrganization\n);\n\norganizationRouter.post(\n getOrganizationRoutes().unselectOrganization.urlModel,\n unselectOrganization\n);\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"organization.routes.mjs","names":["organizationRouter: Router"],"sources":["../../../src/routes/organization.routes.ts"],"sourcesContent":["import {\n addOrganization,\n addOrganizationMember,\n deleteOrganization,\n getOrganizationSSOConfig,\n getOrganizations,\n selectOrganization,\n unselectOrganization,\n updateOrganization,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n} from '@controllers/organization.controller';\nimport { Router } from 'express';\nimport type { Routes } from '@/types/Routes';\n\nexport const organizationRouter: Router = Router();\n\nexport const organizationRoute = '/api/organization';\n\nconst baseURL = () => `${process.env.BACKEND_URL}${organizationRoute}`;\n\nexport const getOrganizationRoutes = () =>\n ({\n getOrganizations: {\n urlModel: '/',\n url: baseURL(),\n method: 'GET',\n },\n addOrganization: {\n urlModel: '/',\n url: baseURL(),\n method: 'POST',\n },\n updateOrganization: {\n urlModel: '/',\n url: baseURL(),\n\n method: 'PUT',\n },\n updateOrganizationMembers: {\n urlModel: '/members',\n url: `${baseURL()}/members`,\n method: 'PUT',\n },\n updateOrganizationMembersById: {\n urlModel: '/:organizationId/members',\n url: ({ organizationId }: { organizationId: string }) =>\n `${baseURL()}/${organizationId}/members`,\n method: 'PUT',\n },\n addOrganizationMember: {\n urlModel: '/member',\n url: `${baseURL()}/member`,\n method: 'POST',\n },\n deleteOrganization: {\n urlModel: '/',\n url: baseURL(),\n method: 'DELETE',\n },\n selectOrganization: {\n urlModel: '/:organizationId',\n url: ({ organizationId }: { organizationId: string }) =>\n `${baseURL()}/${organizationId}`,\n method: 'PUT',\n },\n unselectOrganization: {\n urlModel: '/logout',\n url: `${baseURL()}/logout`,\n method: 'POST',\n },\n getOrganizationSSOConfig: {\n urlModel: '/sso',\n url: `${baseURL()}/sso`,\n method: 'POST',\n },\n }) satisfies Routes;\n\norganizationRouter.get(\n getOrganizationRoutes().getOrganizations.urlModel,\n getOrganizations\n);\n\norganizationRouter.post(\n getOrganizationRoutes().addOrganization.urlModel,\n addOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganization.urlModel,\n updateOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganizationMembers.urlModel,\n updateOrganizationMembers\n);\norganizationRouter.put(\n getOrganizationRoutes().updateOrganizationMembersById.urlModel,\n updateOrganizationMembersById\n);\norganizationRouter.post(\n getOrganizationRoutes().addOrganizationMember.urlModel,\n addOrganizationMember\n);\norganizationRouter.delete(\n getOrganizationRoutes().deleteOrganization.urlModel,\n deleteOrganization\n);\norganizationRouter.put(\n getOrganizationRoutes().selectOrganization.urlModel,\n selectOrganization\n);\n\norganizationRouter.post(\n getOrganizationRoutes().unselectOrganization.urlModel,\n unselectOrganization\n);\n\norganizationRouter.post(\n getOrganizationRoutes().getOrganizationSSOConfig.urlModel,\n getOrgan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UAC3C,mBACD;AACD,mBAAmB,IACjB,uBAAuB,CAAC,mBAAmB,UAC3C,mBACD;AAED,mBAAmB,KACjB,uBAAuB,CAAC,qBAAqB,UAC7C,qBACD;AAED,mBAAmB,KACjB,uBAAuB,CAAC,yBAAyB,UACjD,yBACD"}
|
|
@@ -3,53 +3,6 @@ import { planSchema } from "./plans.schema.mjs";
|
|
|
3
3
|
import { Schema } from "mongoose";
|
|
4
4
|
|
|
5
5
|
//#region src/schemas/organization.schema.ts
|
|
6
|
-
const samlConfigSchema = new Schema({
|
|
7
|
-
idpEntityId: { type: String },
|
|
8
|
-
idpSSOUrl: { type: String },
|
|
9
|
-
idpCertificate: { type: String },
|
|
10
|
-
idpSLOUrl: { type: String }
|
|
11
|
-
}, { _id: false });
|
|
12
|
-
const oidcConfigSchema = new Schema({
|
|
13
|
-
issuer: { type: String },
|
|
14
|
-
clientId: { type: String },
|
|
15
|
-
clientSecret: { type: String },
|
|
16
|
-
scopes: {
|
|
17
|
-
type: [String],
|
|
18
|
-
default: [
|
|
19
|
-
"openid",
|
|
20
|
-
"profile",
|
|
21
|
-
"email"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
authorizationEndpoint: { type: String },
|
|
25
|
-
tokenEndpoint: { type: String },
|
|
26
|
-
userinfoEndpoint: { type: String }
|
|
27
|
-
}, { _id: false });
|
|
28
|
-
const ssoConfigSchema = new Schema({
|
|
29
|
-
enabled: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false
|
|
32
|
-
},
|
|
33
|
-
providerType: {
|
|
34
|
-
type: String,
|
|
35
|
-
enum: ["saml", "oidc"]
|
|
36
|
-
},
|
|
37
|
-
providerId: { type: String },
|
|
38
|
-
domains: {
|
|
39
|
-
type: [String],
|
|
40
|
-
default: []
|
|
41
|
-
},
|
|
42
|
-
samlConfig: { type: samlConfigSchema },
|
|
43
|
-
oidcConfig: { type: oidcConfigSchema },
|
|
44
|
-
enforceSSO: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
-
},
|
|
48
|
-
allowPasswordLogin: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: true
|
|
51
|
-
}
|
|
52
|
-
}, { _id: false });
|
|
53
6
|
const organizationSchema = new Schema({
|
|
54
7
|
name: {
|
|
55
8
|
type: String,
|
|
@@ -75,7 +28,14 @@ const organizationSchema = new Schema({
|
|
|
75
28
|
required: true
|
|
76
29
|
},
|
|
77
30
|
plan: { type: planSchema },
|
|
78
|
-
|
|
31
|
+
ssoEnabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
domain: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true
|
|
38
|
+
}
|
|
79
39
|
}, {
|
|
80
40
|
timestamps: true,
|
|
81
41
|
toJSON: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.schema.mjs","names":[],"sources":["../../../src/schemas/organization.schema.ts"],"sourcesContent":["import {\n MEMBERS_MIN_LENGTH,\n NAME_MAX_LENGTH,\n NAME_MIN_LENGTH,\n} from '@utils/validation/validateOrganization';\nimport { Schema } from 'mongoose';\nimport type { OrganizationSchema } from '@/types/organization.types';\nimport { planSchema } from './plans.schema';\n\
|
|
1
|
+
{"version":3,"file":"organization.schema.mjs","names":[],"sources":["../../../src/schemas/organization.schema.ts"],"sourcesContent":["import {\n MEMBERS_MIN_LENGTH,\n NAME_MAX_LENGTH,\n NAME_MIN_LENGTH,\n} from '@utils/validation/validateOrganization';\nimport { Schema } from 'mongoose';\nimport type { OrganizationSchema } from '@/types/organization.types';\nimport { planSchema } from './plans.schema';\n\nexport const organizationSchema = new Schema<OrganizationSchema>(\n {\n name: {\n type: String,\n required: true,\n minlength: NAME_MIN_LENGTH,\n maxlength: NAME_MAX_LENGTH,\n },\n membersIds: {\n type: [Schema.Types.ObjectId],\n ref: 'User',\n required: true,\n minlength: MEMBERS_MIN_LENGTH,\n },\n adminsIds: {\n type: [Schema.Types.ObjectId],\n ref: 'User',\n required: true,\n minlength: MEMBERS_MIN_LENGTH,\n },\n creatorId: {\n type: Schema.Types.ObjectId,\n ref: 'User',\n required: true,\n },\n plan: {\n type: planSchema,\n },\n ssoEnabled: {\n type: Boolean,\n default: false,\n },\n domain: {\n type: String,\n required: true,\n },\n },\n {\n timestamps: true,\n\n toJSON: {\n virtuals: true, // keep the automatic `id` getter\n versionKey: false, // drop __v\n transform(_doc, ret: any) {\n const { _id, ...rest } = ret;\n return {\n ...rest,\n id: _id.toString(),\n };\n },\n },\n toObject: {\n virtuals: true,\n transform(_doc, ret: any) {\n const { _id, ...rest } = ret;\n return {\n ...rest,\n id: _id,\n };\n },\n },\n }\n);\n\n// Add virtual field for id\norganizationSchema.virtual('id').get(function () {\n return this._id.toString();\n});\n"],"mappings":";;;;;AASA,MAAa,qBAAqB,IAAI,OACpC;CACE,MAAM;EACJ,MAAM;EACN,UAAU;EACV,WAAW;EACX,WAAW;EACZ;CACD,YAAY;EACV,MAAM,CAAC,OAAO,MAAM,SAAS;EAC7B,KAAK;EACL,UAAU;EACV,WAAW;EACZ;CACD,WAAW;EACT,MAAM,CAAC,OAAO,MAAM,SAAS;EAC7B,KAAK;EACL,UAAU;EACV,WAAW;EACZ;CACD,WAAW;EACT,MAAM,OAAO,MAAM;EACnB,KAAK;EACL,UAAU;EACX;CACD,MAAM,EACJ,MAAM,YACP;CACD,YAAY;EACV,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,UAAU;EACX;CACF,EACD;CACE,YAAY;CAEZ,QAAQ;EACN,UAAU;EACV,YAAY;EACZ,UAAU,MAAM,KAAU;GACxB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,UAAO;IACL,GAAG;IACH,IAAI,IAAI,UAAU;IACnB;;EAEJ;CACD,UAAU;EACR,UAAU;EACV,UAAU,MAAM,KAAU;GACxB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,UAAO;IACL,GAAG;IACH,IAAI;IACL;;EAEJ;CACF,CACF;AAGD,mBAAmB,QAAQ,KAAK,CAAC,IAAI,WAAY;AAC/C,QAAO,KAAK,IAAI,UAAU;EAC1B"}
|
|
@@ -34,7 +34,7 @@ const formatSession = (session) => {
|
|
|
34
34
|
};
|
|
35
35
|
const getAuth = (dbClient) => {
|
|
36
36
|
if (!dbClient) throw new Error("MongoDB connection not established");
|
|
37
|
-
|
|
37
|
+
const auth = betterAuth({
|
|
38
38
|
appName: "Intlayer",
|
|
39
39
|
database: mongodbAdapter(dbClient.db()),
|
|
40
40
|
user: { modelName: "users" },
|
|
@@ -55,7 +55,7 @@ const getAuth = (dbClient) => {
|
|
|
55
55
|
const existingUser = context.session?.user;
|
|
56
56
|
const user = newUser ?? existingUser;
|
|
57
57
|
if (!user) return;
|
|
58
|
-
if (
|
|
58
|
+
if (path.includes("/verify-email")) {
|
|
59
59
|
sendVerificationUpdate(user);
|
|
60
60
|
logger.info("SSE verification update sent", {
|
|
61
61
|
email: user.email,
|
|
@@ -95,6 +95,7 @@ const getAuth = (dbClient) => {
|
|
|
95
95
|
plugins: [
|
|
96
96
|
customSession(async ({ session }) => {
|
|
97
97
|
const typedSession = session;
|
|
98
|
+
await auth.api.callbackSSOSAML;
|
|
98
99
|
let userAPI = null;
|
|
99
100
|
let organizationAPI = null;
|
|
100
101
|
let projectAPI = null;
|
|
@@ -126,7 +127,10 @@ const getAuth = (dbClient) => {
|
|
|
126
127
|
return null;
|
|
127
128
|
}
|
|
128
129
|
}),
|
|
129
|
-
passkey(
|
|
130
|
+
passkey({
|
|
131
|
+
rpID: process.env.DOMAIN,
|
|
132
|
+
rpName: "Intlayer"
|
|
133
|
+
}),
|
|
130
134
|
twoFactor(),
|
|
131
135
|
magicLink({ sendMagicLink: async ({ email, url }) => {
|
|
132
136
|
logger.info("sending magic link", {
|
|
@@ -140,7 +144,7 @@ const getAuth = (dbClient) => {
|
|
|
140
144
|
magicLink: url
|
|
141
145
|
});
|
|
142
146
|
} }),
|
|
143
|
-
sso()
|
|
147
|
+
sso({ organizationProvisioning: {} })
|
|
144
148
|
],
|
|
145
149
|
emailAndPassword: {
|
|
146
150
|
enabled: true,
|
|
@@ -207,10 +211,15 @@ const getAuth = (dbClient) => {
|
|
|
207
211
|
linkedin: {
|
|
208
212
|
clientId: process.env.LINKEDIN_CLIENT_ID,
|
|
209
213
|
clientSecret: process.env.LINKEDIN_CLIENT_SECRET
|
|
214
|
+
},
|
|
215
|
+
microsoft: {
|
|
216
|
+
clientId: process.env.MICROSOFT_CLIENT_ID,
|
|
217
|
+
clientSecret: process.env.MICROSOFT_CLIENT_SECRET
|
|
210
218
|
}
|
|
211
219
|
},
|
|
212
220
|
logger: { log: (level, message, ...args) => logger[level](message, ...args) }
|
|
213
221
|
});
|
|
222
|
+
return auth;
|
|
214
223
|
};
|
|
215
224
|
|
|
216
225
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAuth.mjs","names":["userAPI: UserAPI | null","organizationAPI: OrganizationAPI | null","projectAPI: ProjectAPI | null"],"sources":["../../../../src/utils/auth/getAuth.ts"],"sourcesContent":["import { passkey } from '@better-auth/passkey';\nimport { sso } from '@better-auth/sso';\nimport { sendVerificationUpdate } from '@controllers/user.controller';\nimport { logger } from '@logger';\nimport { sendEmail } from '@services/email.service';\nimport { getOrganizationById } from '@services/organization.service';\nimport { getProjectById } from '@services/project.service';\nimport { getUserById } from '@services/user.service';\nimport { mapOrganizationToAPI } from '@utils/mapper/organization';\nimport { mapProjectToAPI } from '@utils/mapper/project';\nimport { mapSessionToAPI } from '@utils/mapper/session';\nimport { mapUserToAPI } from '@utils/mapper/user';\nimport {\n computeEffectivePermission,\n getSessionRoles,\n intersectPermissions,\n} from '@utils/permissions';\nimport { betterAuth, type OmitId } from 'better-auth';\nimport { mongodbAdapter } from 'better-auth/adapters/mongodb';\nimport { createAuthMiddleware } from 'better-auth/api';\nimport { customSession, lastLoginMethod, twoFactor } from 'better-auth/plugins';\nimport { magicLink } from 'better-auth/plugins/magic-link';\nimport type { MongoClient } from 'mongodb';\nimport type { OrganizationAPI } from '@/types/organization.types';\nimport type { ProjectAPI } from '@/types/project.types';\nimport type {\n Session,\n SessionContext,\n SessionDataApi,\n} from '@/types/session.types';\nimport type { User, UserAPI } from '@/types/user.types';\n\nexport type Auth = ReturnType<typeof betterAuth>;\n\nexport const formatSession = (session: SessionContext): OmitId<Session> => {\n const roles = getSessionRoles(session);\n let permissions = computeEffectivePermission(roles);\n\n // Intersect in the case a Access Token try to override the permissions\n if (session.permissions) {\n permissions = intersectPermissions(permissions, session.permissions);\n }\n\n const resultSession = {\n session: session.session,\n user: session.user,\n organization: session.organization,\n project: session.project,\n authType: 'session',\n permissions,\n roles,\n } as OmitId<Session>;\n\n return resultSession;\n};\n\nexport const getAuth = (dbClient: MongoClient): Auth => {\n if (!dbClient) {\n throw new Error('MongoDB connection not established');\n }\n\n const auth = betterAuth({\n appName: 'Intlayer',\n\n database: mongodbAdapter(dbClient.db()),\n\n /**\n * User model\n */\n user: {\n modelName: 'users',\n },\n\n databaseHooks: {\n user: {\n create: {\n // Runs once, immediately after the INSERT\n after: async (user) => {\n if (!user?.emailVerified) return;\n\n await sendEmail({\n type: 'welcome',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n loginLink: `${process.env.CLIENT_URL}/auth/login`,\n locale: (user as any).lang,\n });\n logger.info('Welcome e‑mail delivered', {\n email: user.email,\n });\n },\n },\n },\n },\n\n hooks: {\n after: createAuthMiddleware(async (ctx) => {\n const { path, context } = ctx;\n\n const newUser = context.newSession?.user;\n const existingUser = context.session?.user;\n const user = newUser ?? existingUser;\n\n if (!user) return;\n\n if (['/verify-email'].includes(path)) {\n sendVerificationUpdate(user as unknown as User);\n logger.info('SSE verification update sent', {\n email: user.email,\n userId: user.id,\n });\n\n await sendEmail({\n type: 'welcome',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n loginLink: `${process.env.CLIENT_URL}/auth/login`,\n locale: (user as any).lang,\n });\n logger.info('Welcome e‑mail delivered', {\n email: user.email,\n });\n }\n }),\n },\n\n advanced: {\n // 1️⃣ Change or drop the global prefix\n // cookiePrefix: \"intlayer\", // => intlayer.session_token\n cookiePrefix: 'intlayer', // => session_token (no prefix)\n\n // 2️⃣ Override just the session‑token cookie\n cookies: {\n session_token: {\n // name: 'intlayer_session_token', // final name depends on the prefix above\n // attributes: { sameSite: \"lax\", maxAge: 60 * 60 * 24 } // optional\n },\n },\n\n // 3️⃣ (optional) turn off the automatic __Secure‑ prefix in non‑prod\n // useSecureCookies: false,\n },\n\n secret: process.env.BETTER_AUTH_SECRET as string,\n session: {\n modelName: 'sessions',\n id: 'id',\n\n additionalFields: {\n activeOrganizationId: { type: 'string', nullable: true, input: false },\n activeProjectId: { type: 'string', nullable: true, input: false },\n },\n },\n\n plugins: [\n customSession(async ({ session }) => {\n const typedSession = session as unknown as SessionDataApi;\n\n let userAPI: UserAPI | null = null;\n let organizationAPI: OrganizationAPI | null = null;\n let projectAPI: ProjectAPI | null = null;\n\n if (typedSession.userId) {\n const userData = await getUserById(typedSession.userId);\n\n if (userData) {\n userAPI = mapUserToAPI(userData);\n }\n }\n\n if (typedSession.activeOrganizationId) {\n const orgData = await getOrganizationById(\n typedSession.activeOrganizationId\n );\n\n if (orgData) {\n organizationAPI = mapOrganizationToAPI(orgData);\n }\n }\n if (typedSession.activeProjectId) {\n const projectData = await getProjectById(\n typedSession.activeProjectId\n );\n\n if (projectData) {\n projectAPI = mapProjectToAPI(projectData);\n }\n }\n\n const sessionWithNoPermission: SessionContext = {\n session: typedSession,\n user: userAPI!,\n organization: organizationAPI ?? null,\n project: projectAPI ?? null,\n authType: 'session',\n };\n\n const formattedSession = formatSession(sessionWithNoPermission);\n\n return mapSessionToAPI(formattedSession);\n }),\n lastLoginMethod({\n storeInDatabase: true, // adds user.lastLoginMethod in DB and session\n schema: {\n user: {\n lastLoginMethod: 'lastLoginMethod', // Custom field name\n },\n },\n customResolveMethod: (context) => {\n // When user clicks the magic link\n if (context.path === '/magic-link/verify') {\n return 'magic-link';\n }\n\n // Fallback to default behavior for everything else\n return null;\n },\n }),\n passkey(),\n twoFactor(),\n magicLink({\n sendMagicLink: async ({ email, url }) => {\n logger.info('sending magic link', { email, url });\n await sendEmail({\n type: 'magicLink',\n to: email,\n username: email.split('@')[0],\n magicLink: url,\n });\n },\n }),\n sso(),\n ],\n\n emailAndPassword: {\n enabled: true,\n disableSignUp: false,\n requireEmailVerification: true,\n minPasswordLength: 8,\n maxPasswordLength: 128,\n autoSignIn: true,\n sendResetPassword: async ({ user, token }) => {\n logger.info('sending reset password email', { email: user.email });\n await sendEmail({\n type: 'resetPassword',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n resetLink: `${process.env.CLIENT_URL}/auth/password/reset?token=${token}`,\n });\n },\n resetPasswordTokenExpiresIn: 3600,\n },\n accountLinking: {\n enabled: true, // allow linking in general\n trustedProviders: ['google', 'github', 'linkedin'], // optional: auto‑link when Google verifies the e‑mail\n },\n emailVerification: {\n autoSignInAfterVerification: true,\n sendOnSignIn: true,\n sendVerificationEmail: async ({ user, url }) => {\n logger.info('sending verification email', { email: user.email });\n await sendEmail({\n type: 'validate',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n validationLink: url,\n });\n },\n },\n\n crossSubDomainCookies: {\n enabled: true,\n additionalCookies: ['session_token'],\n domain: process.env.CLIENT_URL as string,\n },\n cookiePrefix: 'intlayer',\n cookies: {\n session_token: {\n name: 'session_token',\n attributes: {\n httpOnly: true,\n secure: true,\n },\n },\n },\n\n trustedOrigins: [process.env.CLIENT_URL as string],\n\n socialProviders: {\n google: {\n clientId: process.env.GOOGLE_CLIENT_ID as string,\n clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,\n },\n github: {\n clientId: process.env.GITHUB_CLIENT_ID as string,\n clientSecret: process.env.GITHUB_CLIENT_SECRET as string,\n },\n linkedin: {\n clientId: process.env.LINKEDIN_CLIENT_ID as string,\n clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,\n },\n // socialProviders: {\n // apple: {\n // clientId: process.env.APPLE_CLIENT_ID as string,\n // clientSecret: process.env.APPLE_CLIENT_SECRET as string,\n // // Optional\n // appBundleIdentifier: process.env\n // .APPLE_APP_BUNDLE_IDENTIFIER as string,\n // },\n // },\n // // Add appleid.apple.com to trustedOrigins for Sign In with Apple flows\n // trustedOrigins: ['https://appleid.apple.com'],\n },\n\n logger: {\n log: (level, message, ...args) => logger[level](message, ...args),\n },\n });\n\n return auth;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,iBAAiB,YAA6C;CACzE,MAAM,QAAQ,gBAAgB,QAAQ;CACtC,IAAI,cAAc,2BAA2B,MAAM;AAGnD,KAAI,QAAQ,YACV,eAAc,qBAAqB,aAAa,QAAQ,YAAY;AAatE,QAVsB;EACpB,SAAS,QAAQ;EACjB,MAAM,QAAQ;EACd,cAAc,QAAQ;EACtB,SAAS,QAAQ;EACjB,UAAU;EACV;EACA;EACD;;AAKH,MAAa,WAAW,aAAgC;AACtD,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;AAqQvD,QAlQa,WAAW;EACtB,SAAS;EAET,UAAU,eAAe,SAAS,IAAI,CAAC;EAKvC,MAAM,EACJ,WAAW,SACZ;EAED,eAAe,EACb,MAAM,EACJ,QAAQ,EAEN,OAAO,OAAO,SAAS;AACrB,OAAI,CAAC,MAAM,cAAe;AAE1B,SAAM,UAAU;IACd,MAAM;IACN,IAAI,KAAK;IACT,UAAU,KAAK,QAAQ,KAAK,MAAM,MAAM,IAAI,CAAC;IAC7C,WAAW,GAAG,QAAQ,IAAI,WAAW;IACrC,QAAS,KAAa;IACvB,CAAC;AACF,UAAO,KAAK,4BAA4B,EACtC,OAAO,KAAK,OACb,CAAC;KAEL,EACF,EACF;EAED,OAAO,EACL,OAAO,qBAAqB,OAAO,QAAQ;GACzC,MAAM,EAAE,MAAM,YAAY;GAE1B,MAAM,UAAU,QAAQ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AAC,gBAAgB;GACpC,QAAQ,QAAQ,IAAI;GACrB;EACD,cAAc;EACd,SAAS,EACP,eAAe;GACb,MAAM;GACN,YAAY;IACV,UAAU;IACV,QAAQ;IACT;GACF,EACF;EAED,gBAAgB,CAAC,QAAQ,IAAI,WAAqB;EAElD,iBAAiB;GACf,QAAQ;IACN,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GACD,QAAQ;IACN,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GACD,UAAU;IACR,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GAYF;EAED,QAAQ,EACN,MAAM,OAAO,SAAS,GAAG,SAAS,OAAO,OAAO,SAAS,GAAG,KAAK,EAClE;EACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"getAuth.mjs","names":["userAPI: UserAPI | null","organizationAPI: OrganizationAPI | null","projectAPI: ProjectAPI | null"],"sources":["../../../../src/utils/auth/getAuth.ts"],"sourcesContent":["import { passkey } from '@better-auth/passkey';\nimport { sso } from '@better-auth/sso';\nimport { sendVerificationUpdate } from '@controllers/user.controller';\nimport { logger } from '@logger';\nimport { OrganizationModel } from '@models/organization.model';\nimport { sendEmail } from '@services/email.service';\nimport { getOrganizationById } from '@services/organization.service';\nimport { getProjectById } from '@services/project.service';\nimport { getUserById } from '@services/user.service';\nimport { mapOrganizationToAPI } from '@utils/mapper/organization';\nimport { mapProjectToAPI } from '@utils/mapper/project';\nimport { mapSessionToAPI } from '@utils/mapper/session';\nimport { mapUserToAPI } from '@utils/mapper/user';\nimport {\n computeEffectivePermission,\n getSessionRoles,\n intersectPermissions,\n} from '@utils/permissions';\nimport { betterAuth, type OmitId } from 'better-auth';\nimport { mongodbAdapter } from 'better-auth/adapters/mongodb';\nimport { createAuthMiddleware } from 'better-auth/api';\nimport { customSession, lastLoginMethod, twoFactor } from 'better-auth/plugins';\nimport { magicLink } from 'better-auth/plugins/magic-link';\nimport type { MongoClient } from 'mongodb';\nimport type { OrganizationAPI } from '@/types/organization.types';\nimport type { ProjectAPI } from '@/types/project.types';\nimport type {\n Session,\n SessionContext,\n SessionDataApi,\n} from '@/types/session.types';\nimport type { User, UserAPI } from '@/types/user.types';\n\nexport type Auth = ReturnType<typeof betterAuth>;\n\nexport const formatSession = (session: SessionContext): OmitId<Session> => {\n const roles = getSessionRoles(session);\n let permissions = computeEffectivePermission(roles);\n\n // Intersect in the case a Access Token try to override the permissions\n if (session.permissions) {\n permissions = intersectPermissions(permissions, session.permissions);\n }\n\n const resultSession = {\n session: session.session,\n user: session.user,\n organization: session.organization,\n project: session.project,\n authType: 'session',\n permissions,\n roles,\n } as OmitId<Session>;\n\n return resultSession;\n};\n\nexport const getAuth = (dbClient: MongoClient): Auth => {\n if (!dbClient) {\n throw new Error('MongoDB connection not established');\n }\n\n const auth = betterAuth({\n appName: 'Intlayer',\n\n database: mongodbAdapter(dbClient.db()),\n\n /**\n * User model\n */\n user: {\n modelName: 'users',\n },\n\n databaseHooks: {\n user: {\n create: {\n // Runs once, immediately after the INSERT\n after: async (user) => {\n if (!user?.emailVerified) return;\n\n await sendEmail({\n type: 'welcome',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n loginLink: `${process.env.CLIENT_URL}/auth/login`,\n locale: (user as any).lang,\n });\n logger.info('Welcome e‑mail delivered', {\n email: user.email,\n });\n },\n },\n },\n },\n\n hooks: {\n after: createAuthMiddleware(async (ctx) => {\n const { path, context } = ctx;\n\n const newUser = context.newSession?.user;\n const existingUser = context.session?.user;\n const user = newUser ?? existingUser;\n\n if (!user) return;\n\n if (path.includes('/verify-email')) {\n sendVerificationUpdate(user as unknown as User);\n logger.info('SSE verification update sent', {\n email: user.email,\n userId: user.id,\n });\n\n await sendEmail({\n type: 'welcome',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n loginLink: `${process.env.CLIENT_URL}/auth/login`,\n locale: (user as any).lang,\n });\n logger.info('Welcome e‑mail delivered', {\n email: user.email,\n });\n }\n }),\n },\n\n advanced: {\n // 1️⃣ Change or drop the global prefix\n // cookiePrefix: \"intlayer\", // => intlayer.session_token\n cookiePrefix: 'intlayer', // => session_token (no prefix)\n\n // 2️⃣ Override just the session‑token cookie\n cookies: {\n session_token: {\n // name: 'intlayer_session_token', // final name depends on the prefix above\n // attributes: { sameSite: \"lax\", maxAge: 60 * 60 * 24 } // optional\n },\n },\n\n // 3️⃣ (optional) turn off the automatic __Secure‑ prefix in non‑prod\n // useSecureCookies: false,\n },\n\n secret: process.env.BETTER_AUTH_SECRET as string,\n session: {\n modelName: 'sessions',\n id: 'id',\n\n additionalFields: {\n activeOrganizationId: { type: 'string', nullable: true, input: false },\n activeProjectId: { type: 'string', nullable: true, input: false },\n },\n },\n\n plugins: [\n customSession(async ({ session }) => {\n const typedSession = session as unknown as SessionDataApi;\n\n await auth.api.callbackSSOSAML;\n\n let userAPI: UserAPI | null = null;\n let organizationAPI: OrganizationAPI | null = null;\n let projectAPI: ProjectAPI | null = null;\n\n if (typedSession.userId) {\n const userData = await getUserById(typedSession.userId);\n\n if (userData) {\n userAPI = mapUserToAPI(userData);\n }\n }\n\n if (typedSession.activeOrganizationId) {\n const orgData = await getOrganizationById(\n typedSession.activeOrganizationId\n );\n\n if (orgData) {\n organizationAPI = mapOrganizationToAPI(orgData);\n }\n }\n if (typedSession.activeProjectId) {\n const projectData = await getProjectById(\n typedSession.activeProjectId\n );\n\n if (projectData) {\n projectAPI = mapProjectToAPI(projectData);\n }\n }\n\n const sessionWithNoPermission: SessionContext = {\n session: typedSession,\n user: userAPI!,\n organization: organizationAPI ?? null,\n project: projectAPI ?? null,\n authType: 'session',\n };\n\n const formattedSession = formatSession(sessionWithNoPermission);\n\n return mapSessionToAPI(formattedSession);\n }),\n lastLoginMethod({\n storeInDatabase: true, // adds user.lastLoginMethod in DB and session\n schema: {\n user: {\n lastLoginMethod: 'lastLoginMethod', // Custom field name\n },\n },\n customResolveMethod: (context) => {\n // When user clicks the magic link\n if (context.path === '/magic-link/verify') {\n return 'magic-link';\n }\n\n // Fallback to default behavior for everything else\n return null;\n },\n }),\n passkey({\n rpID: process.env.DOMAIN,\n rpName: 'Intlayer',\n }),\n twoFactor(),\n magicLink({\n sendMagicLink: async ({ email, url }) => {\n logger.info('sending magic link', { email, url });\n await sendEmail({\n type: 'magicLink',\n to: email,\n username: email.split('@')[0],\n magicLink: url,\n });\n },\n }),\n sso({\n organizationProvisioning: {},\n }),\n ],\n\n emailAndPassword: {\n enabled: true,\n disableSignUp: false,\n requireEmailVerification: true,\n minPasswordLength: 8,\n maxPasswordLength: 128,\n autoSignIn: true,\n sendResetPassword: async ({ user, token }) => {\n logger.info('sending reset password email', { email: user.email });\n await sendEmail({\n type: 'resetPassword',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n resetLink: `${process.env.CLIENT_URL}/auth/password/reset?token=${token}`,\n });\n },\n resetPasswordTokenExpiresIn: 3600,\n },\n accountLinking: {\n enabled: true, // allow linking in general\n trustedProviders: ['google', 'github', 'linkedin'], // optional: auto‑link when Google verifies the e‑mail\n },\n emailVerification: {\n autoSignInAfterVerification: true,\n sendOnSignIn: true,\n sendVerificationEmail: async ({ user, url }) => {\n logger.info('sending verification email', { email: user.email });\n await sendEmail({\n type: 'validate',\n to: user.email,\n username: user.name ?? user.email.split('@')[0],\n validationLink: url,\n });\n },\n },\n\n crossSubDomainCookies: {\n enabled: true,\n additionalCookies: ['session_token'],\n domain: process.env.CLIENT_URL as string,\n },\n cookiePrefix: 'intlayer',\n cookies: {\n session_token: {\n name: 'session_token',\n attributes: {\n httpOnly: true,\n secure: true,\n },\n },\n },\n\n trustedOrigins: [process.env.CLIENT_URL as string],\n\n socialProviders: {\n google: {\n clientId: process.env.GOOGLE_CLIENT_ID as string,\n clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,\n },\n github: {\n clientId: process.env.GITHUB_CLIENT_ID as string,\n clientSecret: process.env.GITHUB_CLIENT_SECRET as string,\n },\n linkedin: {\n clientId: process.env.LINKEDIN_CLIENT_ID as string,\n clientSecret: process.env.LINKEDIN_CLIENT_SECRET as string,\n },\n microsoft: {\n clientId: process.env.MICROSOFT_CLIENT_ID as string,\n clientSecret: process.env.MICROSOFT_CLIENT_SECRET as string,\n },\n // socialProviders: {\n // apple: {\n // clientId: process.env.APPLE_CLIENT_ID as string,\n // clientSecret: process.env.APPLE_CLIENT_SECRET as string,\n // // Optional\n // appBundleIdentifier: process.env\n // .APPLE_APP_BUNDLE_IDENTIFIER as string,\n // },\n // },\n // // Add appleid.apple.com to trustedOrigins for Sign In with Apple flows\n // trustedOrigins: ['https://appleid.apple.com'],\n },\n\n logger: {\n log: (level, message, ...args) => logger[level](message, ...args),\n },\n });\n\n return auth;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBAAiB,YAA6C;CACzE,MAAM,QAAQ,gBAAgB,QAAQ;CACtC,IAAI,cAAc,2BAA2B,MAAM;AAGnD,KAAI,QAAQ,YACV,eAAc,qBAAqB,aAAa,QAAQ,YAAY;AAatE,QAVsB;EACpB,SAAS,QAAQ;EACjB,MAAM,QAAQ;EACd,cAAc,QAAQ;EACtB,SAAS,QAAQ;EACjB,UAAU;EACV;EACA;EACD;;AAKH,MAAa,WAAW,aAAgC;AACtD,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,qCAAqC;CAGvD,MAAM,OAAO,WAAW;EACtB,SAAS;EAET,UAAU,eAAe,SAAS,IAAI,CAAC;EAKvC,MAAM,EACJ,WAAW,SACZ;EAED,eAAe,EACb,MAAM,EACJ,QAAQ,EAEN,OAAO,OAAO,SAAS;AACrB,OAAI,CAAC,MAAM,cAAe;AAE1B,SAAM,UAAU;IACd,MAAM;IACN,IAAI,KAAK;IACT,UAAU,KAAK,QAAQ,KAAK,MAAM,MAAM,IAAI,CAAC;IAC7C,WAAW,GAAG,QAAQ,IAAI,WAAW;IACrC,QAAS,KAAa;IACvB,CAAC;AACF,UAAO,KAAK,4BAA4B,EAC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;AAC9C,WAAO,KAAK,8BAA8B,EAAE,OAAO,KAAK,OAAO,CAAC;AAChE,UAAM,UAAU;KACd,MAAM;KACN,IAAI,KAAK;KACT,UAAU,KAAK,QAAQ,KAAK,MAAM,MAAM,IAAI,CAAC;KAC7C,gBAAgB;KACjB,CAAC;;GAEL;EAED,uBAAuB;GACrB,SAAS;GACT,mBAAmB,CAAC,gBAAgB;GACpC,QAAQ,QAAQ,IAAI;GACrB;EACD,cAAc;EACd,SAAS,EACP,eAAe;GACb,MAAM;GACN,YAAY;IACV,UAAU;IACV,QAAQ;IACT;GACF,EACF;EAED,gBAAgB,CAAC,QAAQ,IAAI,WAAqB;EAElD,iBAAiB;GACf,QAAQ;IACN,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GACD,QAAQ;IACN,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GACD,UAAU;IACR,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GACD,WAAW;IACT,UAAU,QAAQ,IAAI;IACtB,cAAc,QAAQ,IAAI;IAC3B;GAYF;EAED,QAAQ,EACN,MAAM,OAAO,SAAS,GAAG,SAAS,OAAO,OAAO,SAAS,GAAG,KAAK,EAClE;EACF,CAAC;AAEF,QAAO"}
|
|
@@ -8,6 +8,7 @@ import { OAuth2AccessTokenModel } from "../../models/oAuth2.model.mjs";
|
|
|
8
8
|
import { connect } from "mongoose";
|
|
9
9
|
|
|
10
10
|
//#region src/utils/mongoDB/connectDB.ts
|
|
11
|
+
let dbClientInstance = null;
|
|
11
12
|
const connectDB = async () => {
|
|
12
13
|
try {
|
|
13
14
|
const client = await connect(`mongodb+srv://${process.env.DB_ID}:${process.env.DB_MDP}@${process.env.DB_CLUSTER}/?retryWrites=true&w=majority&appName=Cluster0`);
|
|
@@ -18,14 +19,23 @@ const connectDB = async () => {
|
|
|
18
19
|
await TagModel.createIndexes();
|
|
19
20
|
await DictionaryModel.createIndexes();
|
|
20
21
|
await OrganizationModel.createIndexes();
|
|
21
|
-
|
|
22
|
+
dbClientInstance = client.connection.getClient();
|
|
23
|
+
return dbClientInstance;
|
|
22
24
|
} catch (error) {
|
|
23
25
|
const errorMessage = `MongoDB connection error - ${error.message}`;
|
|
24
26
|
logger.error(errorMessage);
|
|
25
27
|
throw new Error(errorMessage);
|
|
26
28
|
}
|
|
27
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Get the MongoDB client instance.
|
|
32
|
+
* Must be called after connectDB() has been executed.
|
|
33
|
+
*/
|
|
34
|
+
const getDBClient = () => {
|
|
35
|
+
if (!dbClientInstance) throw new Error("Database not connected. Call connectDB() first.");
|
|
36
|
+
return dbClientInstance;
|
|
37
|
+
};
|
|
28
38
|
|
|
29
39
|
//#endregion
|
|
30
|
-
export { connectDB };
|
|
40
|
+
export { connectDB, getDBClient };
|
|
31
41
|
//# sourceMappingURL=connectDB.mjs.map
|
|
@@ -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 type
|
|
1
|
+
{"version":3,"file":"connectDB.mjs","names":["dbClientInstance: mongo.MongoClient | null"],"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, type mongo } from 'mongoose';\n\n// Store the DB client singleton\nlet dbClientInstance: mongo.MongoClient | null = null;\n\nexport const connectDB = async (): Promise<mongo.MongoClient> => {\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 dbClientInstance = client.connection.getClient();\n\n return dbClientInstance;\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\n/**\n * Get the MongoDB client instance.\n * Must be called after connectDB() has been executed.\n */\nexport const getDBClient = (): mongo.MongoClient => {\n if (!dbClientInstance) {\n throw new Error('Database not connected. Call connectDB() first.');\n }\n return dbClientInstance;\n};\n"],"mappings":";;;;;;;;;;AAUA,IAAIA,mBAA6C;AAEjD,MAAa,YAAY,YAAwC;AAC/D,KAAI;EACF,MAAM,SAAS,MAAM,QACnB,iBAAiB,QAAQ,IAAI,MAAM,GAAG,QAAQ,IAAI,OAAO,GAAG,QAAQ,IAAI,WAAW,gDACpF;AAED,SAAO,KAAK,oBAAoB;AAGhC,QAAM,aAAa,aAAa;AAChC,QAAM,UAAU,eAAe;AAC/B,QAAM,uBAAuB,eAAe;AAC5C,QAAM,SAAS,eAAe;AAC9B,QAAM,gBAAgB,eAAe;AACrC,QAAM,kBAAkB,eAAe;AAEvC,qBAAmB,OAAO,WAAW,WAAW;AAEhD,SAAO;UACA,OAAO;EACd,MAAM,eAAe,8BAA+B,MAAgB;AAEpE,SAAO,MAAM,aAAa;AAC1B,QAAM,IAAI,MAAM,aAAa;;;;;;;AAQjC,MAAa,oBAAuC;AAClD,KAAI,CAAC,iBACH,OAAM,IAAI,MAAM,kDAAkD;AAEpE,QAAO"}
|
|
@@ -1 +1 @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gB,oBAEhB,CAAA,EAAA,GAAA,EADF,mBACE,CADkB,sBAClB,CAAA,EAAA,KAAA,EAAA,YAAA,EAAA,GACN,OADM,CAAA,IAAA,CAAA;AACN,KA4LS,qBAAA,GA5LT;EAAO,YAAA,EAAA,MAAA;AA4LV,CAAA;AACY,KAAA,oBAAA,GAAuB,OAAQ,CAAA,YAAA,CAAR;AACvB,KAAA,sBAAA,GAAyB,YAAa,CAAA,aAAb,CAAA;AAKrC;;;AACO,cADM,gBACN,EAAA,CAAA,GAAA,EAAA,OAAA,CAAQ,qBAAR,EAAA,GAAA,EAAoC,oBAApC,CAAA,EAAA,GAAA,EACA,mBADA,CACoB,sBADpB,CAAA,EAAA,KAAA,EAEE,YAFF,EAAA,GAGJ,OAHI,CAAA,IAAA,CAAA;AACoB,KAqEf,qBAAA,GArEe;EAApB,YAAA,EAAA,MAAA;CACE;AACN,KAoES,sBAAA,GAAyB,YApElC,CAoE+C,aApE/C,CAAA;;AAmEH;AACA;AAKa,cAAA,gBA6EZ,EAAA,CAAA,GAAA,EA5EM,OA4EN,CA5Ec,qBA4Ed,CAAA,EAAA,GAAA,EA3EM,mBA2EN,CA3E0B,sBA2E1B,CAAA,EAAA,KAAA,EA1EQ,YA0ER,EAAA,GAzEE,OAyEF,CAAA,IAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectAccessKey.controller.d.ts","names":[],"sources":["../../../src/controllers/projectAccessKey.controller.ts"],"sourcesContent":[],"mappings":";;;;;;KAUY,mBAAA,GAAsB;KACtB,uBAAA,GAA0B,aAAa;AADnD;AACA;AAKA;AACe,cADF,eACE,EAAA,CAAA,GAAA,EAAR,OAAQ,CAAA,mBAAA,CAAA,EAAA,GAAA,EACR,mBADQ,CACY,uBADZ,CAAA,EAAA,KAAA,EAEN,YAFM,EAAA,GAGZ,OAHY,CAAA,IAAA,CAAA;AAAR,KA6EK,mBAAA,GA7EL;EACoB,QAAA,EAAA,MAAA;CAApB;AACE,KA4EG,uBAAA,GAA0B,YA5E7B,CAAA,IAAA,CAAA;;;AA2ET;AACY,cAKC,eALsB,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"projectAccessKey.controller.d.ts","names":[],"sources":["../../../src/controllers/projectAccessKey.controller.ts"],"sourcesContent":[],"mappings":";;;;;;KAUY,mBAAA,GAAsB;KACtB,uBAAA,GAA0B,aAAa;AADnD;AACA;AAKA;AACe,cADF,eACE,EAAA,CAAA,GAAA,EAAR,OAAQ,CAAA,mBAAA,CAAA,EAAA,GAAA,EACR,mBADQ,CACY,uBADZ,CAAA,EAAA,KAAA,EAEN,YAFM,EAAA,GAGZ,OAHY,CAAA,IAAA,CAAA;AAAR,KA6EK,mBAAA,GA7EL;EACoB,QAAA,EAAA,MAAA;CAApB;AACE,KA4EG,uBAAA,GAA0B,YA5E7B,CAAA,IAAA,CAAA;;;AA2ET;AACY,cAKC,eALsB,EAAA,CAAA,GAAG,EAM/B,OAN+B,EAAA,GAAY,EAO3C,mBAP2C,CAOvB,uBAPuB,CAAA,EAAA,KAAA,EAQzC,YARyC,EAAA,GAS/C,OAT+C,CAAA,IAAA,CAAA;AAKrC,KAwED,oBAAA,GAFX;EArEM,QAAA,EAAA,MAAA;CACoB;AAApB,KAuEK,wBAAA,GAA2B,YAvEhC,CAuE6C,YAvE7C,CAAA;;;;AAsEK,cAMC,gBANmB,EAAA,CAAA,GAAA,EAOzB,OAPyB,CAOjB,oBAPiB,CAAA,EAAA,GAAA,EAQzB,mBARyB,CAQL,wBARK,CAAA,EAAA,KAAA,EASvB,YATuB,EAAA,GAU7B,OAV6B,CAAA,IAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 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_runtime12.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_runtime12.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_runtime12.JSX.Element;
|
|
47
47
|
PreviewProps: InviteUserEmailProps;
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InviteUserEmail.d.ts","names":[],"sources":["../../../src/emails/InviteUserEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,oBAAA;;;EAAA,cAAA,EAAA,MAAA;EAUC,gBAAA,EAAA,MAmFZ;;;;;cAnFY;;;;;;;;;KAQV,uBAAoB,
|
|
1
|
+
{"version":3,"file":"InviteUserEmail.d.ts","names":[],"sources":["../../../src/emails/InviteUserEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,oBAAA;;;EAAA,cAAA,EAAA,MAAA;EAUC,gBAAA,EAAA,MAmFZ;;;;;cAnFY;;;;;;;;;KAQV,uBAAoB,mBAAA,CAAA,GAAA,CAAA;;CAApB;AAAoB,cA6EV,iBA7EU,EAAA;;;;;;;;;KAqFpB,uBAAoB,mBAAA,CAAA,GAAA,CAAA;;AARvB,CAAA;cAqFa;;;;;;;;;KAQV,uBAAoB,mBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime18 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/MagicLinkEmail.d.ts
|
|
4
4
|
type MagicLinkEmailProps = {
|
|
@@ -9,21 +9,21 @@ declare const MagicLinkEmailEN: {
|
|
|
9
9
|
({
|
|
10
10
|
username,
|
|
11
11
|
magicLink
|
|
12
|
-
}: MagicLinkEmailProps):
|
|
12
|
+
}: MagicLinkEmailProps): react_jsx_runtime18.JSX.Element;
|
|
13
13
|
PreviewProps: MagicLinkEmailProps;
|
|
14
14
|
};
|
|
15
15
|
declare const MagicLinkEmailFR: {
|
|
16
16
|
({
|
|
17
17
|
username,
|
|
18
18
|
magicLink
|
|
19
|
-
}: MagicLinkEmailProps):
|
|
19
|
+
}: MagicLinkEmailProps): react_jsx_runtime18.JSX.Element;
|
|
20
20
|
PreviewProps: MagicLinkEmailProps;
|
|
21
21
|
};
|
|
22
22
|
declare const MagicLinkEmailES: {
|
|
23
23
|
({
|
|
24
24
|
username,
|
|
25
25
|
magicLink
|
|
26
|
-
}: MagicLinkEmailProps):
|
|
26
|
+
}: MagicLinkEmailProps): react_jsx_runtime18.JSX.Element;
|
|
27
27
|
PreviewProps: MagicLinkEmailProps;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MagicLinkEmail.d.ts","names":[],"sources":["../../../src/emails/MagicLinkEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,mBAAA;;;AAAZ,CAAA;AAKa,cAAA,gBAgEZ,EAAA;;;;KA7DE,sBAAmB,
|
|
1
|
+
{"version":3,"file":"MagicLinkEmail.d.ts","names":[],"sources":["../../../src/emails/MagicLinkEmail.tsx"],"sourcesContent":[],"mappings":";;;KAgBY,mBAAA;;;AAAZ,CAAA;AAKa,cAAA,gBAgEZ,EAAA;;;;KA7DE,sBAAmB,mBAAA,CAAA,GAAA,CAAA;;CAAnB;AAAmB,cA+DT,gBA/DS,EAAA;;;;KAkEnB,sBAAmB,mBAAA,CAAA,GAAA,CAAA;;AAHtB,CAAA;cAiEa;;;;KAGV,sBAAmB,mBAAA,CAAA,GAAA,CAAA;EAjEnB,YAAA,qBAAA;CAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime24 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_runtime24.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_runtime24.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_runtime24.JSX.Element;
|
|
43
43
|
PreviewProps: OAuthTokenCreatedEmailProps;
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime15 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_runtime15.JSX.Element;
|
|
11
11
|
PreviewProps: PasswordChangeConfirmationEmailProps;
|
|
12
12
|
};
|
|
13
13
|
declare const PasswordChangeConfirmationEmailFR: {
|
|
14
14
|
({
|
|
15
15
|
username
|
|
16
|
-
}: PasswordChangeConfirmationEmailProps):
|
|
16
|
+
}: PasswordChangeConfirmationEmailProps): react_jsx_runtime15.JSX.Element;
|
|
17
17
|
PreviewProps: PasswordChangeConfirmationEmailProps;
|
|
18
18
|
};
|
|
19
19
|
declare const PasswordChangeConfirmationEmailES: {
|
|
20
20
|
({
|
|
21
21
|
username
|
|
22
|
-
}: PasswordChangeConfirmationEmailProps):
|
|
22
|
+
}: PasswordChangeConfirmationEmailProps): react_jsx_runtime15.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,mBAAA,CAAA,GAAA,CAAA,OA4CtC;;CA5CE;AAAoC,cA8C1B,iCA9C0B,EAAA;;;KAgDpC,uCAAoC,mBAAA,CAAA,GAAA,CAAA;;AAFvC,CAAA;cAiDa;EA/CV,CAAA;IAAA;EAAA,CAAA,EAiDA,oCAjDA,CAAA,EAiDoC,mBAAA,CAAA,GAAA,CAAA,OAjDpC;EAAoC,YAAA,sCAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime21 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/emails/ResetUserPassword.d.ts
|
|
4
4
|
type ResetPasswordEmailProps = {
|
|
@@ -9,21 +9,21 @@ declare const ResetPasswordEmailEN: {
|
|
|
9
9
|
({
|
|
10
10
|
username,
|
|
11
11
|
resetLink
|
|
12
|
-
}: ResetPasswordEmailProps):
|
|
12
|
+
}: ResetPasswordEmailProps): react_jsx_runtime21.JSX.Element;
|
|
13
13
|
PreviewProps: ResetPasswordEmailProps;
|
|
14
14
|
};
|
|
15
15
|
declare const ResetPasswordEmailFR: {
|
|
16
16
|
({
|
|
17
17
|
username,
|
|
18
18
|
resetLink
|
|
19
|
-
}: ResetPasswordEmailProps):
|
|
19
|
+
}: ResetPasswordEmailProps): react_jsx_runtime21.JSX.Element;
|
|
20
20
|
PreviewProps: ResetPasswordEmailProps;
|
|
21
21
|
};
|
|
22
22
|
declare const ResetPasswordEmailES: {
|
|
23
23
|
({
|
|
24
24
|
username,
|
|
25
25
|
resetLink
|
|
26
|
-
}: ResetPasswordEmailProps):
|
|
26
|
+
}: ResetPasswordEmailProps): react_jsx_runtime21.JSX.Element;
|
|
27
27
|
PreviewProps: ResetPasswordEmailProps;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime27 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_runtime27.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_runtime27.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_runtime27.JSX.Element;
|
|
40
40
|
PreviewProps: SubscriptionPaymentCancellationProps;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 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_runtime0.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_runtime0.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_runtime0.JSX.Element;
|
|
40
40
|
PreviewProps: SubscriptionPaymentErrorProps;
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionPaymentError.d.ts","names":[],"sources":["../../../src/emails/SubscriptionPaymentError.tsx"],"sourcesContent":[],"mappings":";;;KAcY,6BAAA;;;EAAA,QAAA,EAAA,MAAA;EAUC,gBAAA,EAAA,MAAA;;;;cAAA;;;;;;;KAMV,gCAA6B,
|
|
1
|
+
{"version":3,"file":"SubscriptionPaymentError.d.ts","names":[],"sources":["../../../src/emails/SubscriptionPaymentError.tsx"],"sourcesContent":[],"mappings":";;;KAcY,6BAAA;;;EAAA,QAAA,EAAA,MAAA;EAUC,gBAAA,EAAA,MAAA;;;;cAAA;;;;;;;KAMV,gCAA6B,kBAAA,CAAA,GAAA,CAAA;EAA7B,YAAA,+BAAA;CAA6B;cAkDnB;;;;;;;KAMV,gCAA6B,kBAAA,CAAA,GAAA,CAAA;EANnB,YAAA,+BAsDZ;;cAGY;;;;;;;KAMV,gCAA6B,kBAAA,CAAA,GAAA,CAAA"}
|