@intlayer/backend 4.0.3 → 4.0.5
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/cjs/export.cjs +3 -1
- package/dist/cjs/export.cjs.map +1 -1
- package/dist/cjs/utils/AI/askDocQuestion.cjs.map +1 -1
- package/dist/cjs/utils/AI/embeddings.json +1229 -0
- package/dist/esm/controllers/ai.controller.mjs +10 -10
- package/dist/esm/controllers/dictionary.controller.mjs +6 -6
- package/dist/esm/controllers/oAuth2.controller.mjs +2 -2
- package/dist/esm/controllers/organization.controller.mjs +10 -10
- package/dist/esm/controllers/project.controller.mjs +9 -9
- package/dist/esm/controllers/projectAccessKey.controller.mjs +3 -3
- package/dist/esm/controllers/sessionAuth.controller.mjs +12 -12
- package/dist/esm/controllers/stripe.controller.mjs +4 -4
- package/dist/esm/controllers/tag.controller.mjs +6 -6
- package/dist/esm/controllers/user.controller.mjs +8 -8
- package/dist/esm/emails/index.mjs +5 -5
- package/dist/esm/export.mjs +8 -7
- package/dist/esm/export.mjs.map +1 -1
- package/dist/esm/index.mjs +17 -17
- package/dist/esm/middlewares/oAuth2.middleware.mjs +5 -5
- package/dist/esm/middlewares/request.middleware.mjs +1 -1
- package/dist/esm/middlewares/sessionAuth.middleware.mjs +5 -5
- package/dist/esm/models/dictionary.model.mjs +1 -1
- package/dist/esm/models/oAuth2.model.mjs +1 -1
- package/dist/esm/models/organization.model.mjs +1 -1
- package/dist/esm/models/project.model.mjs +1 -1
- package/dist/esm/models/tag.model.mjs +1 -1
- package/dist/esm/models/user.model.mjs +1 -1
- package/dist/esm/routes/ai.routes.mjs +1 -1
- package/dist/esm/routes/dictionary.routes.mjs +1 -1
- package/dist/esm/routes/organization.routes.mjs +1 -1
- package/dist/esm/routes/project.routes.mjs +2 -2
- package/dist/esm/routes/sessionAuth.routes.mjs +1 -1
- package/dist/esm/routes/stripe.routes.mjs +1 -1
- package/dist/esm/routes/tags.routes.mjs +1 -1
- package/dist/esm/routes/user.routes.mjs +1 -1
- package/dist/esm/schemas/organization.schema.mjs +2 -2
- package/dist/esm/schemas/project.schema.mjs +1 -1
- package/dist/esm/schemas/tag.schema.mjs +1 -1
- package/dist/esm/schemas/user.schema.mjs +1 -1
- package/dist/esm/services/dictionary.service.mjs +5 -5
- package/dist/esm/services/email.service.mjs +9 -9
- package/dist/esm/services/oAuth2.service.mjs +6 -6
- package/dist/esm/services/organization.service.mjs +3 -3
- package/dist/esm/services/project.service.mjs +5 -5
- package/dist/esm/services/projectAccessKey.service.mjs +4 -4
- package/dist/esm/services/sessionAuth.service.mjs +5 -5
- package/dist/esm/services/subscription.service.mjs +6 -6
- package/dist/esm/services/tag.service.mjs +3 -3
- package/dist/esm/services/user.service.mjs +4 -4
- package/dist/esm/utils/AI/askDocQuestion.mjs +1 -1
- package/dist/esm/utils/AI/askDocQuestion.mjs.map +1 -1
- package/dist/esm/utils/AI/embeddings.json +1229 -0
- package/dist/esm/utils/CSRF.mjs +1 -1
- package/dist/esm/utils/accessControl.mjs +2 -2
- package/dist/esm/utils/auditDictionary/index.mjs +1 -1
- package/dist/esm/utils/auditDictionaryField/index.mjs +1 -1
- package/dist/esm/utils/auditDictionaryMetadata/index.mjs +1 -1
- package/dist/esm/utils/auditTag/index.mjs +1 -1
- package/dist/esm/utils/errors/ErrorHandler.mjs +4 -4
- package/dist/esm/utils/errors/ErrorsClass.mjs +2 -2
- package/dist/esm/utils/errors/errorCodes.mjs +1 -1
- package/dist/esm/utils/errors/index.mjs +3 -3
- package/dist/esm/utils/filtersAndPagination/getDictionaryFiltersAndPagination.mjs +2 -2
- package/dist/esm/utils/filtersAndPagination/getOrganizationFiltersAndPagination.mjs +2 -2
- package/dist/esm/utils/filtersAndPagination/getProjectFiltersAndPagination.mjs +2 -2
- package/dist/esm/utils/filtersAndPagination/getTagFiltersAndPagination.mjs +2 -2
- package/dist/esm/utils/filtersAndPagination/getUserFiltersAndPagination.mjs +2 -2
- package/dist/esm/utils/mapper/dictionary.mjs +1 -1
- package/dist/esm/utils/mapper/organization.mjs +1 -1
- package/dist/esm/utils/mapper/project.mjs +1 -1
- package/dist/esm/utils/mapper/tag.mjs +1 -1
- package/dist/esm/utils/mapper/user.mjs +1 -1
- package/dist/esm/utils/mongoDB/connectDB.mjs +1 -1
- package/dist/esm/utils/oAuth2.mjs +1 -1
- package/dist/esm/utils/responseData.mjs +1 -1
- package/dist/esm/utils/validation/validateDictionary.mjs +2 -2
- package/dist/esm/utils/validation/validateEmail.mjs +1 -1
- package/dist/esm/utils/validation/validateOrganization.mjs +2 -2
- package/dist/esm/utils/validation/validatePhone.mjs +1 -1
- package/dist/esm/utils/validation/validateProject.mjs +3 -3
- package/dist/esm/utils/validation/validateTag.mjs +2 -2
- package/dist/esm/utils/validation/validateUser.mjs +3 -3
- package/dist/esm/webhooks/stripe.webhook.mjs +4 -4
- package/dist/types/export.d.ts +1 -0
- package/dist/types/export.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { getDictionariesByTags } from
|
|
2
|
-
import { getTagsByKeys } from
|
|
3
|
-
import * as tagService from
|
|
4
|
-
import * as askDocQuestionUtil from
|
|
5
|
-
import * as auditContentDeclarationUtil from
|
|
6
|
-
import * as auditContentDeclarationFieldUtil from
|
|
7
|
-
import * as auditContentDeclarationMetadataUtil from
|
|
8
|
-
import * as auditTagUtil from
|
|
9
|
-
import { ErrorHandler } from
|
|
10
|
-
import { formatResponse } from
|
|
1
|
+
import { getDictionariesByTags } from "./../services/dictionary.service.mjs";
|
|
2
|
+
import { getTagsByKeys } from "./../services/tag.service.mjs";
|
|
3
|
+
import * as tagService from "./../services/tag.service.mjs";
|
|
4
|
+
import * as askDocQuestionUtil from "./../utils/AI/askDocQuestion.mjs";
|
|
5
|
+
import * as auditContentDeclarationUtil from "./../utils/auditDictionary/index.mjs";
|
|
6
|
+
import * as auditContentDeclarationFieldUtil from "./../utils/auditDictionaryField/index.mjs";
|
|
7
|
+
import * as auditContentDeclarationMetadataUtil from "./../utils/auditDictionaryMetadata/index.mjs";
|
|
8
|
+
import * as auditTagUtil from "./../utils/auditTag/index.mjs";
|
|
9
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
10
|
+
import { formatResponse } from "./../utils/responseData.mjs";
|
|
11
11
|
const auditContentDeclaration = async (req, res, _next) => {
|
|
12
12
|
const { user, project } = res.locals;
|
|
13
13
|
const {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import * as dictionaryService from
|
|
3
|
-
import { ErrorHandler } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import * as dictionaryService from "./../services/dictionary.service.mjs";
|
|
3
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getDictionaryFiltersAndPagination
|
|
6
|
-
} from
|
|
7
|
-
import { mapDictionaryToAPI } from
|
|
6
|
+
} from "./../utils/filtersAndPagination/getDictionaryFiltersAndPagination.mjs";
|
|
7
|
+
import { mapDictionaryToAPI } from "./../utils/mapper/dictionary.mjs";
|
|
8
8
|
import {
|
|
9
9
|
formatPaginatedResponse,
|
|
10
10
|
formatResponse
|
|
11
|
-
} from
|
|
11
|
+
} from "./../utils/responseData.mjs";
|
|
12
12
|
import { t } from "express-intlayer";
|
|
13
13
|
const getDictionaries = async (req, res, _next) => {
|
|
14
14
|
const { user, project, dictionaryRights } = res.locals;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorHandler } from
|
|
2
|
-
import { formatResponse } from
|
|
1
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
2
|
+
import { formatResponse } from "./../utils/responseData.mjs";
|
|
3
3
|
import {
|
|
4
4
|
Request as OAuthRequest,
|
|
5
5
|
Response as OAuthResponse
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import { sessionAuthRoutes } from
|
|
3
|
-
import { sendEmail } from
|
|
4
|
-
import * as sessionAuthService from
|
|
5
|
-
import * as userService from
|
|
6
|
-
import { ErrorHandler } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import { sessionAuthRoutes } from "./../routes/sessionAuth.routes.mjs";
|
|
3
|
+
import { sendEmail } from "./../services/email.service.mjs";
|
|
4
|
+
import * as sessionAuthService from "./../services/sessionAuth.service.mjs";
|
|
5
|
+
import * as userService from "./../services/user.service.mjs";
|
|
6
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getOrganizationFiltersAndPagination
|
|
9
|
-
} from
|
|
10
|
-
import { getPLanDetails } from
|
|
9
|
+
} from "./../utils/filtersAndPagination/getOrganizationFiltersAndPagination.mjs";
|
|
10
|
+
import { getPLanDetails } from "./../utils/plan.mjs";
|
|
11
11
|
import {
|
|
12
12
|
formatPaginatedResponse,
|
|
13
13
|
formatResponse
|
|
14
|
-
} from
|
|
14
|
+
} from "./../utils/responseData.mjs";
|
|
15
15
|
import { t } from "express-intlayer";
|
|
16
|
-
import * as organizationService from
|
|
16
|
+
import * as organizationService from "./../services/organization.service.mjs";
|
|
17
17
|
const getOrganizations = async (req, res, _next) => {
|
|
18
18
|
const { user, organizationRights } = res.locals;
|
|
19
19
|
const { filters, pageSize, skip, page, getNumberOfPages } = getOrganizationFiltersAndPagination(req);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import * as projectService from
|
|
3
|
-
import * as sessionAuthService from
|
|
4
|
-
import * as userService from
|
|
5
|
-
import { ErrorHandler } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import * as projectService from "./../services/project.service.mjs";
|
|
3
|
+
import * as sessionAuthService from "./../services/sessionAuth.service.mjs";
|
|
4
|
+
import * as userService from "./../services/user.service.mjs";
|
|
5
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
6
6
|
import {
|
|
7
7
|
getProjectFiltersAndPagination
|
|
8
|
-
} from
|
|
9
|
-
import { mapProjectsToAPI, mapProjectToAPI } from
|
|
10
|
-
import { getPLanDetails } from
|
|
8
|
+
} from "./../utils/filtersAndPagination/getProjectFiltersAndPagination.mjs";
|
|
9
|
+
import { mapProjectsToAPI, mapProjectToAPI } from "./../utils/mapper/project.mjs";
|
|
10
|
+
import { getPLanDetails } from "./../utils/plan.mjs";
|
|
11
11
|
import {
|
|
12
12
|
formatPaginatedResponse,
|
|
13
13
|
formatResponse
|
|
14
|
-
} from
|
|
14
|
+
} from "./../utils/responseData.mjs";
|
|
15
15
|
import { t } from "express-intlayer";
|
|
16
16
|
const getProjects = async (req, res, _next) => {
|
|
17
17
|
const { user, organization, projectRights } = res.locals;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as projectAccessKeyService from
|
|
2
|
-
import { ErrorHandler } from
|
|
3
|
-
import { formatResponse } from
|
|
1
|
+
import * as projectAccessKeyService from "./../services/projectAccessKey.service.mjs";
|
|
2
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
3
|
+
import { formatResponse } from "./../utils/responseData.mjs";
|
|
4
4
|
import { t } from "express-intlayer";
|
|
5
5
|
const addNewAccessKey = async (req, res, _next) => {
|
|
6
6
|
const { user, project, organizationRights, projectRights, dictionaryRights } = res.locals;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import crypto from "crypto";
|
|
2
|
-
import { logger } from
|
|
3
|
-
import { sessionAuthRoutes } from
|
|
4
|
-
import { sendEmail } from
|
|
5
|
-
import * as sessionAuthService from
|
|
6
|
-
import * as userService from
|
|
7
|
-
import { generateToken } from
|
|
8
|
-
import { ErrorHandler, GenericError } from
|
|
9
|
-
import { HttpStatusCodes } from
|
|
10
|
-
import { mapOrganizationToAPI } from
|
|
11
|
-
import { mapProjectToAPI } from
|
|
12
|
-
import { mapUserToAPI } from
|
|
13
|
-
import { formatResponse } from
|
|
2
|
+
import { logger } from "./../logger/index.mjs";
|
|
3
|
+
import { sessionAuthRoutes } from "./../routes/sessionAuth.routes.mjs";
|
|
4
|
+
import { sendEmail } from "./../services/email.service.mjs";
|
|
5
|
+
import * as sessionAuthService from "./../services/sessionAuth.service.mjs";
|
|
6
|
+
import * as userService from "./../services/user.service.mjs";
|
|
7
|
+
import { generateToken } from "./../utils/CSRF.mjs";
|
|
8
|
+
import { ErrorHandler, GenericError } from "./../utils/errors/index.mjs";
|
|
9
|
+
import { HttpStatusCodes } from "./../utils/httpStatusCodes.mjs";
|
|
10
|
+
import { mapOrganizationToAPI } from "./../utils/mapper/organization.mjs";
|
|
11
|
+
import { mapProjectToAPI } from "./../utils/mapper/project.mjs";
|
|
12
|
+
import { mapUserToAPI } from "./../utils/mapper/user.mjs";
|
|
13
|
+
import { formatResponse } from "./../utils/responseData.mjs";
|
|
14
14
|
import { t } from "express-intlayer";
|
|
15
15
|
import { Types } from "mongoose";
|
|
16
16
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as subscriptionService from
|
|
2
|
-
import { ErrorHandler } from
|
|
3
|
-
import { retrievePlanInformation } from
|
|
4
|
-
import { formatResponse } from
|
|
1
|
+
import * as subscriptionService from "./../services/subscription.service.mjs";
|
|
2
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
3
|
+
import { retrievePlanInformation } from "./../utils/plan.mjs";
|
|
4
|
+
import { formatResponse } from "./../utils/responseData.mjs";
|
|
5
5
|
import { t } from "express-intlayer";
|
|
6
6
|
import { Stripe } from "stripe";
|
|
7
7
|
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import * as tagService from
|
|
3
|
-
import { ErrorHandler } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import * as tagService from "./../services/tag.service.mjs";
|
|
3
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getTagFiltersAndPagination
|
|
6
|
-
} from
|
|
7
|
-
import { mapTagsToAPI, mapTagToAPI } from
|
|
6
|
+
} from "./../utils/filtersAndPagination/getTagFiltersAndPagination.mjs";
|
|
7
|
+
import { mapTagsToAPI, mapTagToAPI } from "./../utils/mapper/tag.mjs";
|
|
8
8
|
import {
|
|
9
9
|
formatPaginatedResponse,
|
|
10
10
|
formatResponse
|
|
11
|
-
} from
|
|
11
|
+
} from "./../utils/responseData.mjs";
|
|
12
12
|
import { t } from "express-intlayer";
|
|
13
13
|
const getTags = async (req, res, _next) => {
|
|
14
14
|
const { user, organization } = res.locals;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import { sessionAuthRoutes } from
|
|
3
|
-
import { sendEmail } from
|
|
4
|
-
import * as userService from
|
|
5
|
-
import { ErrorHandler } from
|
|
6
|
-
import { getOrganizationFiltersAndPagination } from
|
|
7
|
-
import { mapUsersToAPI, mapUserToAPI } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import { sessionAuthRoutes } from "./../routes/sessionAuth.routes.mjs";
|
|
3
|
+
import { sendEmail } from "./../services/email.service.mjs";
|
|
4
|
+
import * as userService from "./../services/user.service.mjs";
|
|
5
|
+
import { ErrorHandler } from "./../utils/errors/index.mjs";
|
|
6
|
+
import { getOrganizationFiltersAndPagination } from "./../utils/filtersAndPagination/getOrganizationFiltersAndPagination.mjs";
|
|
7
|
+
import { mapUsersToAPI, mapUserToAPI } from "./../utils/mapper/user.mjs";
|
|
8
8
|
import {
|
|
9
9
|
formatPaginatedResponse,
|
|
10
10
|
formatResponse
|
|
11
|
-
} from
|
|
11
|
+
} from "./../utils/responseData.mjs";
|
|
12
12
|
import { t } from "express-intlayer";
|
|
13
13
|
const createUser = async (req, res, _next) => {
|
|
14
14
|
const user = req.body;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./InviteUserEmail.mjs";
|
|
2
|
+
export * from "./ValidateUserEmail.mjs";
|
|
3
|
+
export * from "./Welcome.mjs";
|
|
4
|
+
export * from "./PasswordChangeConfirmation.mjs";
|
|
5
|
+
export * from "./ResetUserPassword.mjs";
|
|
6
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/export.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { userRoutes } from
|
|
2
|
-
import { organizationRoutes } from
|
|
3
|
-
import { projectRoutes } from
|
|
4
|
-
import { dictionaryRoutes } from
|
|
5
|
-
import { sessionAuthRoutes } from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
import { userRoutes } from "./routes/user.routes.mjs";
|
|
2
|
+
import { organizationRoutes } from "./routes/organization.routes.mjs";
|
|
3
|
+
import { projectRoutes } from "./routes/project.routes.mjs";
|
|
4
|
+
import { dictionaryRoutes } from "./routes/dictionary.routes.mjs";
|
|
5
|
+
import { sessionAuthRoutes } from "./routes/sessionAuth.routes.mjs";
|
|
6
|
+
export * from "./utils/cookies.mjs";
|
|
7
|
+
export * from "./utils/httpStatusCodes.mjs";
|
|
8
|
+
export * from "./utils/responseData.mjs";
|
|
8
9
|
export {
|
|
9
10
|
dictionaryRoutes,
|
|
10
11
|
organizationRoutes,
|
package/dist/esm/export.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/export.ts"],"sourcesContent":["// Routes\nexport { userRoutes } from '@routes/user.routes';\nexport { organizationRoutes } from '@routes/organization.routes';\nexport { projectRoutes } from '@routes/project.routes';\nexport { dictionaryRoutes } from '@routes/dictionary.routes';\nexport { sessionAuthRoutes } from '@routes/sessionAuth.routes';\n\n// Controllers types\nexport type * from '@controllers/sessionAuth.controller';\nexport type * from '@controllers/oAuth2.controller';\nexport type * from '@controllers/organization.controller';\nexport type * from '@controllers/project.controller';\nexport type * from '@controllers/projectAccessKey.controller';\nexport type * from '@controllers/user.controller';\nexport type * from '@controllers/dictionary.controller';\nexport type * from '@controllers/stripe.controller';\nexport type * from '@controllers/ai.controller';\nexport type * from '@controllers/tag.controller';\n\n// Objects types\nexport type * from '@/types/organization.types';\nexport type * from '@/types/project.types';\nexport type * from '@/types/user.types';\nexport type * from '@/types/dictionary.types';\nexport type * from '@/types/plan.types';\nexport type * from '@/types/tag.types';\n\n// Utils\nexport * from '@utils/cookies';\nexport * from '@utils/httpStatusCodes';\n"],"mappings":"AACA,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAuBlC,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/export.ts"],"sourcesContent":["// Routes\nexport { userRoutes } from '@routes/user.routes';\nexport { organizationRoutes } from '@routes/organization.routes';\nexport { projectRoutes } from '@routes/project.routes';\nexport { dictionaryRoutes } from '@routes/dictionary.routes';\nexport { sessionAuthRoutes } from '@routes/sessionAuth.routes';\n\n// Controllers types\nexport type * from '@controllers/sessionAuth.controller';\nexport type * from '@controllers/oAuth2.controller';\nexport type * from '@controllers/organization.controller';\nexport type * from '@controllers/project.controller';\nexport type * from '@controllers/projectAccessKey.controller';\nexport type * from '@controllers/user.controller';\nexport type * from '@controllers/dictionary.controller';\nexport type * from '@controllers/stripe.controller';\nexport type * from '@controllers/ai.controller';\nexport type * from '@controllers/tag.controller';\n\n// Objects types\nexport type * from '@/types/organization.types';\nexport type * from '@/types/project.types';\nexport type * from '@/types/user.types';\nexport type * from '@/types/dictionary.types';\nexport type * from '@/types/plan.types';\nexport type * from '@/types/tag.types';\n\n// Utils\nexport * from '@utils/cookies';\nexport * from '@utils/httpStatusCodes';\nexport * from '@utils/responseData';\n"],"mappings":"AACA,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAuBlC,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -8,31 +8,31 @@ import helmet from "helmet";
|
|
|
8
8
|
import {
|
|
9
9
|
attachOAuthInstance,
|
|
10
10
|
authenticateOAuth2
|
|
11
|
-
} from
|
|
12
|
-
import { logAPIRequestURL } from
|
|
11
|
+
} from "./middlewares/oAuth2.middleware.mjs";
|
|
12
|
+
import { logAPIRequestURL } from "./middlewares/request.middleware.mjs";
|
|
13
13
|
import {
|
|
14
14
|
checkUser,
|
|
15
15
|
checkOrganization,
|
|
16
16
|
checkProject,
|
|
17
17
|
checkAdmin
|
|
18
|
-
} from
|
|
19
|
-
import { dictionaryRouter } from
|
|
20
|
-
import { organizationRouter } from
|
|
21
|
-
import { projectRouter } from
|
|
22
|
-
import { tagRouter } from
|
|
23
|
-
import { sessionAuthRouter } from
|
|
24
|
-
import { userRouter } from
|
|
25
|
-
import { stripeRouter } from
|
|
26
|
-
import { aiRouter } from
|
|
27
|
-
import { stripeWebhook } from
|
|
28
|
-
import { getOAuth2Token } from
|
|
18
|
+
} from "./middlewares/sessionAuth.middleware.mjs";
|
|
19
|
+
import { dictionaryRouter } from "./routes/dictionary.routes.mjs";
|
|
20
|
+
import { organizationRouter } from "./routes/organization.routes.mjs";
|
|
21
|
+
import { projectRouter } from "./routes/project.routes.mjs";
|
|
22
|
+
import { tagRouter } from "./routes/tags.routes.mjs";
|
|
23
|
+
import { sessionAuthRouter } from "./routes/sessionAuth.routes.mjs";
|
|
24
|
+
import { userRouter } from "./routes/user.routes.mjs";
|
|
25
|
+
import { stripeRouter } from "./routes/stripe.routes.mjs";
|
|
26
|
+
import { aiRouter } from "./routes/ai.routes.mjs";
|
|
27
|
+
import { stripeWebhook } from "./webhooks/stripe.webhook.mjs";
|
|
28
|
+
import { getOAuth2Token } from "./controllers/oAuth2.controller.mjs";
|
|
29
29
|
import {
|
|
30
30
|
getSessionInformation,
|
|
31
31
|
setCSRFToken
|
|
32
|
-
} from
|
|
33
|
-
import { doubleCsrfProtection } from
|
|
34
|
-
import { connectDB } from
|
|
35
|
-
import { logger } from
|
|
32
|
+
} from "./controllers/sessionAuth.controller.mjs";
|
|
33
|
+
import { doubleCsrfProtection } from "./utils/CSRF.mjs";
|
|
34
|
+
import { connectDB } from "./utils/mongoDB/connectDB.mjs";
|
|
35
|
+
import { logger } from "./logger/index.mjs";
|
|
36
36
|
const app = express();
|
|
37
37
|
app.disable("x-powered-by");
|
|
38
38
|
app.use(helmet());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import { OrganizationModel } from
|
|
3
|
-
import { ProjectModel } from
|
|
4
|
-
import { UserModel } from
|
|
5
|
-
import { getAuthModel, authenticateOptions } from
|
|
1
|
+
import { logger } from "./../logger/index.mjs";
|
|
2
|
+
import { OrganizationModel } from "./../models/organization.model.mjs";
|
|
3
|
+
import { ProjectModel } from "./../models/project.model.mjs";
|
|
4
|
+
import { UserModel } from "./../models/user.model.mjs";
|
|
5
|
+
import { getAuthModel, authenticateOptions } from "./../utils/oAuth2.mjs";
|
|
6
6
|
import OAuth2Server, {
|
|
7
7
|
Request as OAuthRequest,
|
|
8
8
|
Response as OAuthResponse
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { OrganizationModel } from
|
|
2
|
-
import { ProjectModel } from
|
|
1
|
+
import { OrganizationModel } from "./../models/organization.model.mjs";
|
|
2
|
+
import { ProjectModel } from "./../models/project.model.mjs";
|
|
3
3
|
import {
|
|
4
4
|
clearOrganizationAuth,
|
|
5
5
|
clearProjectAuth
|
|
6
|
-
} from
|
|
7
|
-
import { getUserBySession as getUserBySessionService } from
|
|
8
|
-
import { Cookies } from
|
|
6
|
+
} from "./../services/sessionAuth.service.mjs";
|
|
7
|
+
import { getUserBySession as getUserBySessionService } from "./../services/user.service.mjs";
|
|
8
|
+
import { Cookies } from "./../utils/cookies.mjs";
|
|
9
9
|
import jwt from "jsonwebtoken";
|
|
10
10
|
const checkUser = async (req, res, next) => {
|
|
11
11
|
const { [Cookies.JWT_AUTH]: sessionToken } = req.cookies;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { model } from "mongoose";
|
|
2
|
-
import { accessTokenSchema } from
|
|
2
|
+
import { accessTokenSchema } from "../schemas/oAuth2.schema.mjs";
|
|
3
3
|
const OAuth2AccessTokenModel = model("oAuth2", accessTokenSchema);
|
|
4
4
|
export {
|
|
5
5
|
OAuth2AccessTokenModel
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
auditContentDeclarationField,
|
|
5
5
|
auditContentDeclarationMetadata,
|
|
6
6
|
auditTag
|
|
7
|
-
} from
|
|
7
|
+
} from "./../controllers/ai.controller.mjs";
|
|
8
8
|
import { Router } from "express";
|
|
9
9
|
const aiRouter = Router();
|
|
10
10
|
const baseURL = `${process.env.BACKEND_URL}/api/ai`;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
updateDictionary,
|
|
7
7
|
getDictionaryByKey,
|
|
8
8
|
getDictionariesKeys
|
|
9
|
-
} from
|
|
9
|
+
} from "./../controllers/dictionary.controller.mjs";
|
|
10
10
|
import { Router } from "express";
|
|
11
11
|
const dictionaryRouter = Router();
|
|
12
12
|
const baseURL = `${process.env.BACKEND_URL}/api/dictionary`;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
updateOrganizationMembers,
|
|
8
8
|
unselectOrganization,
|
|
9
9
|
addOrganizationMember
|
|
10
|
-
} from
|
|
10
|
+
} from "./../controllers/organization.controller.mjs";
|
|
11
11
|
import { Router } from "express";
|
|
12
12
|
const organizationRouter = Router();
|
|
13
13
|
const baseURL = `${process.env.BACKEND_URL}/api/organization`;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
selectProject,
|
|
7
7
|
unselectProject,
|
|
8
8
|
updateProjectMembers
|
|
9
|
-
} from
|
|
9
|
+
} from "./../controllers/project.controller.mjs";
|
|
10
10
|
import {
|
|
11
11
|
addNewAccessKey,
|
|
12
12
|
deleteAccessKey,
|
|
13
13
|
refreshAccessKey
|
|
14
|
-
} from
|
|
14
|
+
} from "./../controllers/projectAccessKey.controller.mjs";
|
|
15
15
|
import { Router } from "express";
|
|
16
16
|
const projectRouter = Router();
|
|
17
17
|
const baseURL = `${process.env.BACKEND_URL}/api/project`;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
googleLoginQuery,
|
|
13
13
|
verifyEmailStatusSSE,
|
|
14
14
|
checkIfUserHasPassword
|
|
15
|
-
} from
|
|
15
|
+
} from "./../controllers/sessionAuth.controller.mjs";
|
|
16
16
|
import { Router } from "express";
|
|
17
17
|
const sessionAuthRouter = Router();
|
|
18
18
|
const baseURL = `${process.env.BACKEND_URL}/api/auth`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cancelSubscription,
|
|
3
3
|
getSubscription
|
|
4
|
-
} from
|
|
4
|
+
} from "./../controllers/stripe.controller.mjs";
|
|
5
5
|
import { Router } from "express";
|
|
6
6
|
const stripeRouter = Router();
|
|
7
7
|
const baseURL = `${process.env.BACKEND_URL}/api/stipe`;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getUserById,
|
|
6
6
|
createUser,
|
|
7
7
|
getUserByAccount
|
|
8
|
-
} from
|
|
8
|
+
} from "./../controllers/user.controller.mjs";
|
|
9
9
|
import { Router } from "express";
|
|
10
10
|
const userRouter = Router();
|
|
11
11
|
const baseURL = `${process.env.BACKEND_URL}/api/user`;
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
MEMBERS_MIN_LENGTH,
|
|
3
3
|
NAME_MAX_LENGTH,
|
|
4
4
|
NAME_MIN_LENGTH
|
|
5
|
-
} from
|
|
5
|
+
} from "./../utils/validation/validateOrganization.mjs";
|
|
6
6
|
import { Schema } from "mongoose";
|
|
7
|
-
import { planSchema } from
|
|
7
|
+
import { planSchema } from "./plans.schema.mjs";
|
|
8
8
|
const organizationSchema = new Schema(
|
|
9
9
|
{
|
|
10
10
|
name: {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
NAME_MIN_LENGTH,
|
|
3
3
|
NAME_MAX_LENGTH,
|
|
4
4
|
MEMBERS_MIN_LENGTH
|
|
5
|
-
} from
|
|
5
|
+
} from "./../utils/validation/validateProject.mjs";
|
|
6
6
|
import { Locales } from "intlayer";
|
|
7
7
|
import { Schema } from "mongoose";
|
|
8
8
|
const RightsSchema = new Schema({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DictionaryModel } from
|
|
2
|
-
import { ensureMongoDocumentToObject } from
|
|
3
|
-
import { GenericError } from
|
|
4
|
-
import { removeObjectKeys } from
|
|
1
|
+
import { DictionaryModel } from "./../models/dictionary.model.mjs";
|
|
2
|
+
import { ensureMongoDocumentToObject } from "./../utils/ensureMongoDocumentToObject.mjs";
|
|
3
|
+
import { GenericError } from "./../utils/errors/index.mjs";
|
|
4
|
+
import { removeObjectKeys } from "./../utils/removeObjectKeys.mjs";
|
|
5
5
|
import {
|
|
6
6
|
validateDictionary
|
|
7
|
-
} from
|
|
7
|
+
} from "./../utils/validation/validateDictionary.mjs";
|
|
8
8
|
const findDictionaries = async (filters, skip = 0, limit = 100) => {
|
|
9
9
|
try {
|
|
10
10
|
const dictionaries = await DictionaryModel.aggregate([
|
|
@@ -3,43 +3,43 @@ import {
|
|
|
3
3
|
InviteUserEmailEN,
|
|
4
4
|
InviteUserEmailFR,
|
|
5
5
|
InviteUserEmailES
|
|
6
|
-
} from
|
|
6
|
+
} from "./../emails/InviteUserEmail.mjs";
|
|
7
7
|
import {
|
|
8
8
|
PasswordChangeConfirmationEmailEN,
|
|
9
9
|
PasswordChangeConfirmationEmailFR,
|
|
10
10
|
PasswordChangeConfirmationEmailES
|
|
11
|
-
} from
|
|
11
|
+
} from "./../emails/PasswordChangeConfirmation.mjs";
|
|
12
12
|
import {
|
|
13
13
|
ResetPasswordEmailEN,
|
|
14
14
|
ResetPasswordEmailFR,
|
|
15
15
|
ResetPasswordEmailES
|
|
16
|
-
} from
|
|
16
|
+
} from "./../emails/ResetUserPassword.mjs";
|
|
17
17
|
import {
|
|
18
18
|
SubscriptionPaymentCancellationEN,
|
|
19
19
|
SubscriptionPaymentCancellationFR,
|
|
20
20
|
SubscriptionPaymentCancellationES
|
|
21
|
-
} from
|
|
21
|
+
} from "./../emails/SubscriptionPaymentCancellation.mjs";
|
|
22
22
|
import {
|
|
23
23
|
SubscriptionPaymentErrorEN,
|
|
24
24
|
SubscriptionPaymentErrorFR,
|
|
25
25
|
SubscriptionPaymentErrorES
|
|
26
|
-
} from
|
|
26
|
+
} from "./../emails/SubscriptionPaymentError.mjs";
|
|
27
27
|
import {
|
|
28
28
|
SubscriptionPaymentSuccessEN,
|
|
29
29
|
SubscriptionPaymentSuccessFR,
|
|
30
30
|
SubscriptionPaymentSuccessES
|
|
31
|
-
} from
|
|
31
|
+
} from "./../emails/SubscriptionPaymentSuccess.mjs";
|
|
32
32
|
import {
|
|
33
33
|
ValidateUserEmailEN,
|
|
34
34
|
ValidateUserEmailFR,
|
|
35
35
|
ValidateUserEmailES
|
|
36
|
-
} from
|
|
36
|
+
} from "./../emails/ValidateUserEmail.mjs";
|
|
37
37
|
import {
|
|
38
38
|
WelcomeEmailEN,
|
|
39
39
|
WelcomeEmailFR,
|
|
40
40
|
WelcomeEmailES
|
|
41
|
-
} from
|
|
42
|
-
import { logger } from
|
|
41
|
+
} from "./../emails/Welcome.mjs";
|
|
42
|
+
import { logger } from "./../logger/index.mjs";
|
|
43
43
|
import { t } from "express-intlayer";
|
|
44
44
|
import { Resend } from "resend";
|
|
45
45
|
const getEmailComponents = (locale) => ({
|