@intlayer/backend 5.8.0-canary.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/schemas/organization.schema.cjs.map +1 -1
- package/dist/cjs/schemas/session.schema.cjs.map +1 -1
- package/dist/cjs/services/tag.service.cjs.map +1 -1
- package/dist/cjs/utils/AI/askDocQuestion/embeddings.json +35862 -24576
- package/dist/cjs/utils/errors/ErrorHandler.cjs +3 -3
- package/dist/cjs/utils/errors/ErrorHandler.cjs.map +1 -1
- package/dist/esm/schemas/organization.schema.mjs.map +1 -1
- package/dist/esm/schemas/session.schema.mjs.map +1 -1
- package/dist/esm/services/tag.service.mjs.map +1 -1
- package/dist/esm/utils/AI/askDocQuestion/embeddings.json +35862 -24576
- package/dist/esm/utils/errors/ErrorHandler.mjs +1 -1
- package/dist/esm/utils/errors/ErrorHandler.mjs.map +1 -1
- package/dist/types/schemas/organization.schema.d.ts +2 -2
- package/dist/types/schemas/organization.schema.d.ts.map +1 -1
- package/dist/types/schemas/session.schema.d.ts +2 -2
- package/dist/types/schemas/session.schema.d.ts.map +1 -1
- package/dist/types/services/tag.service.d.ts +1 -1
- package/dist/types/services/tag.service.d.ts.map +1 -1
- package/dist/types/utils/errors/ErrorHandler.d.ts +1 -1
- package/dist/types/utils/errors/ErrorHandler.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { HttpStatusCodes } from "./../../utils/httpStatusCodes.mjs";
|
|
1
2
|
import { Locales } from "@intlayer/config";
|
|
2
3
|
import { logger } from "./../../logger/index.mjs";
|
|
3
4
|
import { formatPaginatedResponse, formatResponse } from "./../../utils/responseData.mjs";
|
|
4
|
-
import { HttpStatusCodes } from "./../../export.mjs";
|
|
5
5
|
import { t } from "express-intlayer";
|
|
6
6
|
import { errorData } from "./errorCodes.mjs";
|
|
7
7
|
class ErrorHandler {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/errors/ErrorHandler.ts"],"sourcesContent":["// Import required modules and types from their respective locations.\nimport { Locales } from '@intlayer/config';\nimport { logger } from '@logger';\nimport { formatPaginatedResponse, formatResponse } from '@utils/responseData';\nimport type { Response } from 'express';\n// @ts-ignore express-intlayer not build yet\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/errors/ErrorHandler.ts"],"sourcesContent":["// Import required modules and types from their respective locations.\nimport type { UserAPI } from '@/types/user.types';\nimport { HttpStatusCodes } from '@/utils/httpStatusCodes';\nimport { Locales } from '@intlayer/config';\nimport { logger } from '@logger';\nimport { formatPaginatedResponse, formatResponse } from '@utils/responseData';\nimport type { Response } from 'express';\n// @ts-ignore express-intlayer not build yet\nimport type { LanguageContent } from 'express-intlayer';\nimport { t } from 'express-intlayer';\nimport { type ErrorCodes, errorData } from './errorCodes';\nimport type { AppError } from './ErrorsClass';\n\n// Define a class named 'ErrorHandler' to encapsulate error handling logic.\nexport class ErrorHandler {\n /**\n * Handles generic error responses by formatting and sending a JSON response.\n * @param res - The response object provided by Express.js.\n * @param errorKey - A key representing the specific error.\n * @param statusCode - (Optional) A specific HTTP status code to use for the response.\n * @param isPaginatedResponse - Flag to determine if the response should be paginated.\n */\n static handleGenericErrorResponse(\n res: Response,\n errorKey: ErrorCodes,\n errorDetails?: object,\n statusCode?: HttpStatusCodes,\n isPaginatedResponse: boolean = false\n ) {\n const error = errorData[errorKey];\n const status = statusCode ?? error.statusCode; // Use the provided status code or default to the one in errorData.\n\n // Delegate to a more customizable error response handler.\n this.handleCustomErrorResponse(\n res,\n errorKey,\n error.title,\n error.message,\n errorDetails,\n status,\n isPaginatedResponse\n );\n }\n\n /**\n * Handles application-specific error responses by formatting and sending a JSON response.\n * @param res - The response object provided by Express.js.\n * @param error - The error object.\n * @param messageDetails - (Optional) Additional message details to include in the response.\n * @param isPaginatedResponse - (Optional) Flag to determine if the response should be paginated.\n */\n static handleAppErrorResponse(\n res: Response,\n error: AppError,\n messageDetails?: object,\n isPaginatedResponse: boolean = false\n ) {\n if (!error.isAppError) {\n this.handleCustomErrorResponse(\n res,\n error.errorKey ?? 'UNKNOWN_ERROR',\n 'Error',\n error.message ?? JSON.stringify(error),\n undefined,\n error.httpStatusCode ?? HttpStatusCodes.INTERNAL_SERVER_ERROR_500,\n isPaginatedResponse\n );\n }\n\n const isMultilingual = error.isMultilingual ?? false;\n // Delegate to a more customizable error response handler.\n this.handleCustomErrorResponse(\n res,\n error.errorKey,\n isMultilingual ? error.multilingualTitle : error.title,\n isMultilingual ? error.multilingualMessage : error.message,\n error.messageDetails ?? messageDetails,\n error.httpStatusCode,\n isPaginatedResponse\n );\n }\n\n /**\n * Handles more customizable error responses with detailed error messages and codes.\n * @param res - The response object.\n * @param errorKey - Error code key used to fetch the corresponding message and default status.\n * @param message - The localized error message object.\n * @param messageDetails - (Optional) Additional message details to include in the response.\n * @param statusCode - (Optional) HTTP status code, defaults to 500 if not specified.\n * @param isPaginatedResponse - Determines if the error should be part of a paginated response.\n */\n static handleCustomErrorResponse<T>(\n res: Response,\n errorKey: ErrorCodes | string,\n title: LanguageContent<string> | string,\n message: LanguageContent<string> | string,\n messageDetails?: object,\n statusCode?: HttpStatusCodes,\n isPaginatedResponse: boolean = false\n ) {\n const errorTitle = t(title as LanguageContent<string>, Locales.ENGLISH);\n const errorMessage = t(message as LanguageContent<string>, Locales.ENGLISH);\n logger.error(errorMessage, messageDetails); // Log the English version of the error message.\n const status = statusCode ?? HttpStatusCodes.INTERNAL_SERVER_ERROR_500; // Default to 500 if no status code is provided.\n\n if (isPaginatedResponse) {\n // Format the response as a paginated error response if requested.\n const responseData = formatPaginatedResponse<T>({\n error: {\n code: errorKey,\n title: errorTitle,\n message: errorMessage,\n },\n status,\n });\n res.status(status).json(responseData);\n return;\n }\n\n // Format the response as a standard non-paginated error response.\n const responseData = formatResponse<UserAPI>({\n error: {\n code: errorKey,\n title: errorTitle,\n message: errorMessage,\n ...messageDetails,\n },\n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WAAO,MAAM,cAAc,cAAc;AACzC,UAAM,SAAS,cAAc,gBAAgB;AAE7C,QAAI,qBAAqB;AAEvB,YAAMA,gBAAe,wBAA2B;AAAA,QAC9C,OAAO;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,UACP,SAAS;AAAA,QACX;AAAA,QACA;AAAA,MACF,CAAC;AACD,UAAI,OAAO,MAAM,EAAE,KAAKA,aAAY;AACpC;AAAA,IACF;AAGA,UAAM,eAAe,eAAwB;AAAA,MAC3C,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,QACT,GAAG;AAAA,MACL;AAAA,MACA;AAAA,IACF,CAAC;AAED,QAAI,OAAO,MAAM,EAAE,KAAK,YAAY;AAAA,EACtC;AACF;","names":["responseData"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OrganizationSchema } from '../
|
|
1
|
+
import { OrganizationSchema } from '../types/organization.types';
|
|
2
2
|
import { Schema } from 'mongoose';
|
|
3
|
-
export declare const organizationSchema: Schema<OrganizationSchema, import("mongoose").Model<OrganizationSchema, any, any, any, import("mongoose").Document<unknown, any, OrganizationSchema, any, {}> & Omit<import("../
|
|
3
|
+
export declare const organizationSchema: Schema<OrganizationSchema, import("mongoose").Model<OrganizationSchema, any, any, any, import("mongoose").Document<unknown, any, OrganizationSchema, any, {}> & Omit<import("../types/organization.types").Organization, "id"> & {
|
|
4
4
|
_id: import("mongoose").Types.ObjectId;
|
|
5
5
|
} & Required<{
|
|
6
6
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/organization.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"organization.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/organization.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAMhE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,eAAO,MAAM,kBAAkB;;;;;;;;;;EAgD9B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SessionSchema } from '../
|
|
1
|
+
import { SessionSchema } from '../types/session.types';
|
|
2
2
|
import { Schema } from 'mongoose';
|
|
3
|
-
export declare const sessionSchema: Schema<SessionSchema, import("mongoose").Model<SessionSchema, any, any, any, import("mongoose").Document<unknown, any, SessionSchema, any, {}> & Omit<import("../
|
|
3
|
+
export declare const sessionSchema: Schema<SessionSchema, import("mongoose").Model<SessionSchema, any, any, any, import("mongoose").Document<unknown, any, SessionSchema, any, {}> & Omit<import("../types/session.types").SessionData, "id"> & {
|
|
4
4
|
_id: import("mongoose").Types.ObjectId;
|
|
5
5
|
} & Required<{
|
|
6
6
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/session.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"session.schema.d.ts","sourceRoot":"","sources":["../../../src/schemas/session.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,aAAa;;;;;;;;;;EAgCzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Organization } from '../
|
|
1
|
+
import type { Organization } from '../types/organization.types';
|
|
2
2
|
import type { Tag, TagData, TagDocument } from '../types/tag.types';
|
|
3
3
|
import type { TagFilters } from '../utils/filtersAndPagination/getTagFiltersAndPagination';
|
|
4
4
|
import type { Types } from 'mongoose';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.service.d.ts","sourceRoot":"","sources":["../../../src/services/tag.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tag.service.d.ts","sourceRoot":"","sources":["../../../src/services/tag.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;AAEzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GACnB,SAAS,UAAU,EACnB,aAAQ,EACR,cAAW,KACV,OAAO,CAAC,WAAW,EAAE,CAC8B,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,MAAM,GAAG,KAAK,CAAC,QAAQ,KAC7B,OAAO,CAAC,WAAW,CAQrB,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EAAE,EACd,gBAAgB,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,KAC1C,OAAO,CAAC,WAAW,EAAE,CAIvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,SAAS,UAAU,KAAG,OAAO,CAAC,MAAM,CAQnE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,OAAO,KAAG,OAAO,CAAC,WAAW,CAQjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,GAAG,KAAK,CAAC,QAAQ,EAC9B,KAAK,OAAO,CAAC,GAAG,CAAC,KAChB,OAAO,CAAC,WAAW,CAmBrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,GAAG,KAAK,CAAC,QAAQ,KAC7B,OAAO,CAAC,WAAW,CAQrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { HttpStatusCodes } from '../../utils/httpStatusCodes';
|
|
1
2
|
import type { Response } from 'express';
|
|
2
|
-
import { HttpStatusCodes } from '../../export';
|
|
3
3
|
import type { LanguageContent } from 'express-intlayer';
|
|
4
4
|
import { type ErrorCodes } from './errorCodes';
|
|
5
5
|
import type { AppError } from './ErrorsClass';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../../src/utils/errors/ErrorHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../../src/utils/errors/ErrorHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,qBAAa,YAAY;IACvB;;;;;;OAMG;IACH,MAAM,CAAC,0BAA0B,CAC/B,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,UAAU,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,eAAe,EAC5B,mBAAmB,GAAE,OAAe;IAiBtC;;;;;;OAMG;IACH,MAAM,CAAC,sBAAsB,CAC3B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,QAAQ,EACf,cAAc,CAAC,EAAE,MAAM,EACvB,mBAAmB,GAAE,OAAe;IA2BtC;;;;;;;;OAQG;IACH,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAChC,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,UAAU,GAAG,MAAM,EAC7B,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,EACvC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG,MAAM,EACzC,cAAc,CAAC,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,eAAe,EAC5B,mBAAmB,GAAE,OAAe;CAkCvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/backend",
|
|
3
|
-
"version": "5.8.0
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer Backend is a an application that allow you to manage your Intlayer content and interact with the intlayer editor.",
|
|
6
6
|
"keywords": [
|
|
@@ -103,13 +103,13 @@
|
|
|
103
103
|
"typescript": "^5.9.2",
|
|
104
104
|
"vitest": "^3.2.2",
|
|
105
105
|
"@intlayer/config": "5.8.0-canary.0",
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"@
|
|
108
|
-
"@intlayer/core": "5.8.0-canary.0",
|
|
106
|
+
"@intlayer/core": "5.8.0",
|
|
107
|
+
"@intlayer/docs": "5.8.0",
|
|
109
108
|
"@utils/ts-config": "1.0.4",
|
|
110
|
-
"@utils/tsup-config": "1.0.4",
|
|
111
109
|
"@utils/ts-config-types": "1.0.4",
|
|
112
|
-
"
|
|
110
|
+
"@utils/eslint-config": "1.0.4",
|
|
111
|
+
"@utils/tsup-config": "1.0.4",
|
|
112
|
+
"intlayer": "5.8.0"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"build": "pnpm clean & pnpm build:ci",
|