node-server-engine 2.1.0 → 2.2.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/README.md +22 -15
- package/dist/entities/Sequelize/Sequelize.config.js +4 -2
- package/dist/entities/Sequelize/Sequelize.config.js.map +1 -1
- package/dist/entities/Sequelize/Sequelize.js +9 -1
- package/dist/entities/Sequelize/Sequelize.js.map +1 -1
- package/dist/entities/WebError/WebError.d.ts +4 -0
- package/dist/entities/WebError/WebError.js +6 -0
- package/dist/entities/WebError/WebError.js.map +1 -1
- package/dist/entities/WebError/WebError.types.d.ts +7 -0
- package/dist/entities/WebError/WebError.types.js.map +1 -1
- package/dist/middleware/error/error.js +5 -1
- package/dist/middleware/error/error.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1057,16 +1057,19 @@ Sequelize.closeSequelize();
|
|
|
1057
1057
|
|
|
1058
1058
|
It can be configured through environment variables
|
|
1059
1059
|
|
|
1060
|
-
| env | description
|
|
1061
|
-
| --------------------- |
|
|
1062
|
-
| SQL_HOST | Host to which connect to
|
|
1063
|
-
| SQL_PORT | Port on which SQL is served
|
|
1064
|
-
| SQL_PASSWORD | Password used to authenticate with the SQL server
|
|
1065
|
-
| SQL_USER | User used to authenticate with the SQL server
|
|
1066
|
-
| SQL_DB | Database to which connect to
|
|
1067
|
-
| SQL_TYPE | SQL type which connect to
|
|
1068
|
-
| SQL_ENCRYPT | `mssql` only: set to `false` to disable TLS
|
|
1069
|
-
|
|
|
1060
|
+
| env | description | default |
|
|
1061
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
1062
|
+
| SQL_HOST | Host to which connect to | |
|
|
1063
|
+
| SQL_PORT | Port on which SQL is served | 5432 |
|
|
1064
|
+
| SQL_PASSWORD | Password used to authenticate with the SQL server | |
|
|
1065
|
+
| SQL_USER | User used to authenticate with the SQL server | |
|
|
1066
|
+
| SQL_DB | Database to which connect to | |
|
|
1067
|
+
| SQL_TYPE | SQL type which connect to | postgres |
|
|
1068
|
+
| SQL_ENCRYPT | `mssql` only: set to `false` to disable TLS | true |
|
|
1069
|
+
| SQL_LOWERCASE_GUIDS | `mssql` only: `true` returns UNIQUEIDENTIFIER values in lower case, like JavaScript UUIDs | false |
|
|
1070
|
+
| SQL_TRUST_SERVER_CERT | `mssql` only: `true` skips certificate verification (self-signed development servers only) | false |
|
|
1071
|
+
| SQL_POOL_MAX | Maximum connections in the pool (always 1 when `NODE_ENV=test`) | 5 |
|
|
1072
|
+
| SQL_SYNC_MODELS | `true` creates missing tables from the models in `addModels()`; always on when `NODE_ENV=test`, off otherwise so the migrations own the schema | false |
|
|
1070
1073
|
|
|
1071
1074
|
---
|
|
1072
1075
|
|
|
@@ -1816,11 +1819,15 @@ if (!user) {
|
|
|
1816
1819
|
|
|
1817
1820
|
In addition to the [common options](#common-options), WebError defines some other options specific for error reporting to clients.
|
|
1818
1821
|
|
|
1819
|
-
| option
|
|
1820
|
-
|
|
|
1821
|
-
| errorCode
|
|
1822
|
-
| statusCode
|
|
1823
|
-
| hint
|
|
1822
|
+
| option | definition | example | default |
|
|
1823
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------ |
|
|
1824
|
+
| errorCode | A machine readable error code that will be parsed by the client. | unknown-user | **required** |
|
|
1825
|
+
| statusCode | HTTP status code of the response. | 400 | 500 |
|
|
1826
|
+
| hint | A human readable error message that is intended for developers | |
|
|
1827
|
+
| details | Public structured data the client acts on, returned as `details` (attempts left, per-row errors...). Never put secrets here; `data` stays in the logs only. | `{ attemptsLeft: 2 }` | |
|
|
1828
|
+
| retryAfterSec | Seconds before the client may retry, sent as the `Retry-After` header | 60 | |
|
|
1829
|
+
|
|
1830
|
+
The error middleware answers `{ errorCode, hint, details? }` with the given status code.
|
|
1824
1831
|
|
|
1825
1832
|
## Middlewares
|
|
1826
1833
|
|
|
@@ -33,7 +33,7 @@ const config = {
|
|
|
33
33
|
},
|
|
34
34
|
dialectOptions: {},
|
|
35
35
|
pool: {
|
|
36
|
-
max: process.env.NODE_ENV === 'test' ? 1 : 5,
|
|
36
|
+
max: process.env.NODE_ENV === 'test' ? 1 : Number(process.env.SQL_POOL_MAX) || 5,
|
|
37
37
|
min: 0,
|
|
38
38
|
acquire: process.env.NODE_ENV === 'test' ? 1000 : 30000,
|
|
39
39
|
// Reduce acquire timeout in test
|
|
@@ -55,7 +55,9 @@ if (config.dialect === 'mssql') {
|
|
|
55
55
|
// Encrypted connections by default; SQL_ENCRYPT=false only for servers without TLS
|
|
56
56
|
encrypt: process.env.SQL_ENCRYPT !== 'false',
|
|
57
57
|
// The server certificate is verified unless SQL_TRUST_SERVER_CERT=true (self-signed development servers)
|
|
58
|
-
trustServerCertificate: process.env.SQL_TRUST_SERVER_CERT === 'true'
|
|
58
|
+
trustServerCertificate: process.env.SQL_TRUST_SERVER_CERT === 'true',
|
|
59
|
+
// UNIQUEIDENTIFIER values come back upper case unless SQL_LOWERCASE_GUIDS=true (matches JS / client UUIDs)
|
|
60
|
+
lowerCaseGuids: process.env.SQL_LOWERCASE_GUIDS === 'true'
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sequelize.config.js","names":["_Sequelize","require","validateSequelizeEnvironment","isUnixSocket","process","env","SQL_HOST","startsWith","config","username","SQL_USER","password","SQL_PASSWORD","database","SQL_DB","host","port","undefined","SQL_PORT","parseInt","dialect","SQL_TYPE","logging","SQL_LOGGING","console","log","define","freezeTableName","charset","collate","retry","max","NODE_ENV","dialectOptions","pool","min","acquire","idle","evict","options","requestTimeout","connectTimeout","encrypt","SQL_ENCRYPT","trustServerCertificate","SQL_TRUST_SERVER_CERT","timezone","ssl","PG_SSL","rejectUnauthorized","development","exports","staging","production","test","_default","default"],"sources":["../../../src/entities/Sequelize/Sequelize.config.ts"],"sourcesContent":["import { Options, Dialect } from 'sequelize';\nimport { validateSequelizeEnvironment } from './Sequelize.validate';\n\n// Check that environment variables are correctly set\nvalidateSequelizeEnvironment();\n\n// Check if SQL_HOST is a Unix socket path (Cloud SQL)\nconst isUnixSocket = process.env.SQL_HOST?.startsWith('/');\n\nconst config: Options = {\n username: process.env.SQL_USER,\n password: process.env.SQL_PASSWORD,\n database: process.env.SQL_DB,\n host: process.env.SQL_HOST,\n // Don't set port for Unix socket connections (Cloud SQL)\n port: isUnixSocket\n ? undefined\n : process.env.SQL_PORT\n ? parseInt(process.env.SQL_PORT)\n : 5432,\n dialect: (process.env.SQL_TYPE ?? 'postgres') as Dialect, // Dynamically set the dialect (postgres, mysql, mssql)\n logging: process.env.SQL_LOGGING === 'true' ? console.log : false, // Enable SQL logging with SQL_LOGGING=true\n define: {\n freezeTableName: false, // Prevent automatic pluralization of table names\n charset: 'utf8mb4', // Set character set for MySQL/MariaDB\n collate: 'utf8mb4_unicode_ci' // Set collation for MySQL/MariaDB\n },\n retry: {\n max: process.env.NODE_ENV === 'test' ? 0 : 3 // Disable retries in test environment to prevent unhandled rejections\n },\n dialectOptions: {},\n pool: {\n max
|
|
1
|
+
{"version":3,"file":"Sequelize.config.js","names":["_Sequelize","require","validateSequelizeEnvironment","isUnixSocket","process","env","SQL_HOST","startsWith","config","username","SQL_USER","password","SQL_PASSWORD","database","SQL_DB","host","port","undefined","SQL_PORT","parseInt","dialect","SQL_TYPE","logging","SQL_LOGGING","console","log","define","freezeTableName","charset","collate","retry","max","NODE_ENV","dialectOptions","pool","Number","SQL_POOL_MAX","min","acquire","idle","evict","options","requestTimeout","connectTimeout","encrypt","SQL_ENCRYPT","trustServerCertificate","SQL_TRUST_SERVER_CERT","lowerCaseGuids","SQL_LOWERCASE_GUIDS","timezone","ssl","PG_SSL","rejectUnauthorized","development","exports","staging","production","test","_default","default"],"sources":["../../../src/entities/Sequelize/Sequelize.config.ts"],"sourcesContent":["import { Options, Dialect } from 'sequelize';\nimport { validateSequelizeEnvironment } from './Sequelize.validate';\n\n// Check that environment variables are correctly set\nvalidateSequelizeEnvironment();\n\n// Check if SQL_HOST is a Unix socket path (Cloud SQL)\nconst isUnixSocket = process.env.SQL_HOST?.startsWith('/');\n\nconst config: Options = {\n username: process.env.SQL_USER,\n password: process.env.SQL_PASSWORD,\n database: process.env.SQL_DB,\n host: process.env.SQL_HOST,\n // Don't set port for Unix socket connections (Cloud SQL)\n port: isUnixSocket\n ? undefined\n : process.env.SQL_PORT\n ? parseInt(process.env.SQL_PORT)\n : 5432,\n dialect: (process.env.SQL_TYPE ?? 'postgres') as Dialect, // Dynamically set the dialect (postgres, mysql, mssql)\n logging: process.env.SQL_LOGGING === 'true' ? console.log : false, // Enable SQL logging with SQL_LOGGING=true\n define: {\n freezeTableName: false, // Prevent automatic pluralization of table names\n charset: 'utf8mb4', // Set character set for MySQL/MariaDB\n collate: 'utf8mb4_unicode_ci' // Set collation for MySQL/MariaDB\n },\n retry: {\n max: process.env.NODE_ENV === 'test' ? 0 : 3 // Disable retries in test environment to prevent unhandled rejections\n },\n dialectOptions: {},\n pool: {\n max:\n process.env.NODE_ENV === 'test'\n ? 1\n : Number(process.env.SQL_POOL_MAX) || 5,\n min: 0,\n acquire: process.env.NODE_ENV === 'test' ? 1000 : 30000, // Reduce acquire timeout in test\n idle: process.env.NODE_ENV === 'test' ? 1000 : 10000, // Reduce idle time in test\n evict: process.env.NODE_ENV === 'test' ? 100 : 1000 // How often to check for idle connections\n }\n};\n\n// Additional configurations for MSSQL\nif (config.dialect === 'mssql') {\n // tedious connection options live under dialectOptions.options\n config.dialectOptions = {\n options: {\n requestTimeout: 30000, // Increase request timeout for MSSQL\n connectTimeout: 30000, // Increase connection timeout for MSSQL\n // Encrypted connections by default; SQL_ENCRYPT=false only for servers without TLS\n encrypt: process.env.SQL_ENCRYPT !== 'false',\n // The server certificate is verified unless SQL_TRUST_SERVER_CERT=true (self-signed development servers)\n trustServerCertificate: process.env.SQL_TRUST_SERVER_CERT === 'true',\n // UNIQUEIDENTIFIER values come back upper case unless SQL_LOWERCASE_GUIDS=true (matches JS / client UUIDs)\n lowerCaseGuids: process.env.SQL_LOWERCASE_GUIDS === 'true'\n }\n };\n}\n\n// Add specific dialect configurations if necessary for MySQL/PostgreSQL\nif (config.dialect === 'mysql') {\n config.dialectOptions = {\n timezone: 'Z' // Set timezone for MySQL\n };\n}\n\nif (config.dialect === 'postgres') {\n config.dialectOptions = {\n ssl: process.env.PG_SSL === 'true' ? { rejectUnauthorized: false } : false // SSL options for PostgreSQL (if required)\n };\n}\n\nexport const development = config;\nexport const staging = config;\nexport const production = config;\nexport const test = config;\nexport default config;\n"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA,IAAAC,uCAA4B,EAAC,CAAC;;AAE9B;AACA,MAAMC,YAAY,GAAGC,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAG,CAAC;AAE1D,MAAMC,MAAe,GAAG;EACtBC,QAAQ,EAAEL,OAAO,CAACC,GAAG,CAACK,QAAQ;EAC9BC,QAAQ,EAAEP,OAAO,CAACC,GAAG,CAACO,YAAY;EAClCC,QAAQ,EAAET,OAAO,CAACC,GAAG,CAACS,MAAM;EAC5BC,IAAI,EAAEX,OAAO,CAACC,GAAG,CAACC,QAAQ;EAC1B;EACAU,IAAI,EAAEb,YAAY,GACdc,SAAS,GACTb,OAAO,CAACC,GAAG,CAACa,QAAQ,GAClBC,QAAQ,CAACf,OAAO,CAACC,GAAG,CAACa,QAAQ,CAAC,GAC9B,IAAI;EACVE,OAAO,EAAGhB,OAAO,CAACC,GAAG,CAACgB,QAAQ,IAAI,UAAsB;EAAE;EAC1DC,OAAO,EAAElB,OAAO,CAACC,GAAG,CAACkB,WAAW,KAAK,MAAM,GAAGC,OAAO,CAACC,GAAG,GAAG,KAAK;EAAE;EACnEC,MAAM,EAAE;IACNC,eAAe,EAAE,KAAK;IAAE;IACxBC,OAAO,EAAE,SAAS;IAAE;IACpBC,OAAO,EAAE,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AC;AACH;AAEA,IAAI1C,MAAM,CAACY,OAAO,KAAK,UAAU,EAAE;EACjCZ,MAAM,CAACyB,cAAc,GAAG;IACtBkB,GAAG,EAAE/C,OAAO,CAACC,GAAG,CAAC+C,MAAM,KAAK,MAAM,GAAG;MAAEC,kBAAkB,EAAE;IAAM,CAAC,GAAG,KAAK,CAAC;EAC7E,CAAC;AACH;AAEO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG9C,MAAM;AAC1B,MAAMgD,OAAO,GAAAD,OAAA,CAAAC,OAAA,GAAGhD,MAAM;AACtB,MAAMiD,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAGjD,MAAM;AACzB,MAAMkD,IAAI,GAAAH,OAAA,CAAAG,IAAA,GAAGlD,MAAM;AAAC,IAAAmD,QAAA,GAAAJ,OAAA,CAAAK,OAAA,GACZpD,MAAM","ignoreList":[]}
|
|
@@ -141,7 +141,15 @@ function addModels(models) {
|
|
|
141
141
|
convertToPlain(result);
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
-
|
|
144
|
+
|
|
145
|
+
// Creating tables from the models is for the in-memory test database (or when explicitly asked).
|
|
146
|
+
// Elsewhere the schema belongs to the migrations: a sync racing them would create tables without
|
|
147
|
+
// their constraints and triggers.
|
|
148
|
+
if (process.env.NODE_ENV === 'test' || process.env.SQL_SYNC_MODELS === 'true') {
|
|
149
|
+
sequelizeClient.sync().catch(error => {
|
|
150
|
+
(0, _report.reportError)(error);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
/** Create Sequelize client */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sequelize.js","names":["_path","_interopRequireDefault","require","_sequelizeTypescript","_Sequelize","_Sequelize2","_EngineError","_LifecycleController","_report","sequelizeClient","exports","sequelize","Proxy","get","target","property","init","shutdown","addModels","EngineError","message","reportInfo","data","host","process","env","SQL_HOST","database","SQL_DB","user","SQL_USER","port","SQL_PORT","dialect","SQL_TYPE","isUnixSocket","startsWith","sqlStorage","toLowerCase","SQL_STORAGE","path","join","cwd","undefined","createSequelizeClient","NODE_ENV","authenticate","getDialect","err","reportError","error","Error","String","stack","LifecycleController","register","close","console","models","addHook","result","convertToPlain","instance","modelInstance","toJSON","plain","Object","keys","forEach","key","Array","isArray","sync","Sequelize","storage","logging","sqlType","trim","length","SQL_LOGGING","log","validateSequelizeEnvironment","username","dbConfig","poolMax","pool","max","poolMin","min","SQL_PASSWORD"],"sources":["../../../src/entities/Sequelize/Sequelize.ts"],"sourcesContent":["import path from 'path';\nimport { Sequelize, ModelCtor } from 'sequelize-typescript';\nimport dbConfig from './Sequelize.config';\nimport { Sequelize as SequelizeInterface } from './Sequelize.types';\nimport { validateSequelizeEnvironment } from './Sequelize.validate';\nimport { EngineError } from 'entities/EngineError';\nimport { LifecycleController } from 'entities/LifecycleController';\nimport { reportInfo, reportError } from 'utils/report';\n\nexport let sequelizeClient: undefined | Sequelize;\n\n/**\n * We use a proxy to extend the Sequelize behavior and allow initialization of the client only when needed while keeping the same interface\n */\nexport const sequelize = new Proxy<SequelizeInterface>(\n // Due to how we do the proxying, we are forced to ignore ts-errors, we could never create an object that respects the interface properly\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n {},\n {\n get: function (target, property): unknown {\n if (property === 'init') return init;\n if (property === 'shutdown') return shutdown;\n if (property === 'addModels') return addModels;\n // Create the sequelize client if it does not exist\n if (!sequelizeClient)\n throw new EngineError({\n message: 'Sequelize client was not initialized'\n });\n // Call the function on the sequelize client\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return sequelizeClient[property] as unknown;\n }\n }\n);\n\n/** On init create client and connect */\nexport async function init(): Promise<void> {\n // Ignore if already initialized\n if (sequelizeClient) return;\n\n reportInfo({\n message: 'Initializing Sequelize client',\n data: {\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n user: process.env.SQL_USER,\n port: process.env.SQL_PORT,\n dialect: process.env.SQL_TYPE || 'postgres',\n isUnixSocket: process.env.SQL_HOST?.startsWith('/'),\n sqlStorage:\n (process.env.SQL_TYPE ?? '').toLowerCase() === 'sqlite'\n ? process.env.SQL_STORAGE ||\n path.join(process.cwd(), 'database.sqlite')\n : undefined\n }\n });\n\n sequelizeClient = createSequelizeClient();\n\n // In test environment, authentication happens automatically with SQLite\n // For other environments, authenticate and log the result\n if (process.env.NODE_ENV !== 'test') {\n reportInfo({\n message: 'Starting database authentication'\n });\n\n try {\n await sequelizeClient.authenticate();\n reportInfo({\n message: 'Connected to database successfully',\n data: {\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n dialect: sequelizeClient?.getDialect()\n }\n });\n } catch (err) {\n reportError({\n message: 'Failed to connect to database',\n data: {\n error: err instanceof Error ? err.message : String(err),\n stack: err instanceof Error ? err.stack : undefined,\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n user: process.env.SQL_USER,\n port: process.env.SQL_PORT\n }\n });\n if (err instanceof Error) {\n reportError(err);\n }\n throw err;\n }\n }\n\n LifecycleController.register(sequelize);\n}\n\n/** On shutdown close connection and clear client */\nexport async function shutdown(): Promise<void> {\n if (sequelizeClient) {\n try {\n // For SQLite, just close the client (closing connection manager first causes SQLITE_MISUSE)\n // For other dialects, sequelize.close() handles everything properly\n await sequelizeClient.close();\n } catch (error) {\n // Ignore errors during shutdown\n if (process.env.NODE_ENV !== 'test') {\n console.error('Error closing sequelize client:', error);\n }\n }\n }\n sequelizeClient = undefined;\n}\n\nexport function addModels(models: Array<ModelCtor>): void {\n if (!sequelizeClient)\n throw new EngineError({\n message: 'Sequelize client was not initialized'\n });\n sequelizeClient.addModels(models);\n\n // Override toJSON behavior globally to ensure consistency between dev and prod\n // In dev (ts-node), property access works directly on instances\n // In prod (compiled), we need explicit serialization\n // This hook intercepts all afterFind results and converts them to plain objects\n sequelizeClient.addHook('afterFind', (result) => {\n if (!result) return;\n\n const convertToPlain = (instance: unknown) => {\n if (!instance || typeof instance !== 'object') return instance;\n const modelInstance = instance as {\n toJSON?: () => Record<string, unknown>;\n } & Record<string, unknown>;\n if (!modelInstance.toJSON) return instance;\n const plain = modelInstance.toJSON();\n // Copy the plain object properties back to the instance\n // This makes property access work without .toJSON() in compiled code\n Object.keys(plain).forEach((key) => {\n modelInstance[key] = plain[key];\n });\n };\n\n if (Array.isArray(result)) {\n result.forEach(convertToPlain);\n } else {\n convertToPlain(result);\n }\n });\n\n sequelizeClient.sync();\n}\n\n/** Create Sequelize client */\nexport function createSequelizeClient(): Sequelize {\n // Use in-memory SQLite for test environment to avoid real database connections\n if (process.env.NODE_ENV === 'test') {\n return new Sequelize({\n dialect: 'sqlite',\n storage: ':memory:',\n logging: false\n });\n }\n\n // File-based SQLite for local / offline dev (no SQL_HOST / live server)\n const sqlType = (process.env.SQL_TYPE ?? '').toLowerCase();\n if (sqlType === 'sqlite') {\n const storage =\n process.env.SQL_STORAGE && process.env.SQL_STORAGE.trim().length > 0\n ? process.env.SQL_STORAGE.trim()\n : path.join(process.cwd(), 'database.sqlite');\n reportInfo({\n message: 'Creating Sequelize client (SQLite file)',\n data: { storage, dialect: 'sqlite' }\n });\n return new Sequelize({\n dialect: 'sqlite',\n storage,\n logging: process.env.SQL_LOGGING === 'true' ? console.log : false\n });\n }\n\n // Throw an error if there is no host initial\n validateSequelizeEnvironment();\n\n reportInfo({\n message: 'Creating Sequelize client with config',\n data: {\n database: process.env.SQL_DB,\n username: process.env.SQL_USER,\n host: process.env.SQL_HOST,\n port: dbConfig.port,\n dialect: dbConfig.dialect,\n isUnixSocket: process.env.SQL_HOST?.startsWith('/'),\n poolMax: dbConfig.pool?.max,\n poolMin: dbConfig.pool?.min\n }\n });\n\n return new Sequelize(\n process.env.SQL_DB as string,\n process.env.SQL_USER as string,\n process.env.SQL_PASSWORD as string,\n dbConfig\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAC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MACPC,OAAO,EAAEnD,OAAO,CAACC,GAAG,CAACsD,WAAW,KAAK,MAAM,GAAGtB,OAAO,CAACuB,GAAG,GAAG;IAC9D,CAAC,CAAC;EACJ;;EAEA;EACA,IAAAC,wCAA4B,EAAC,CAAC;EAE9B,IAAA5D,kBAAU,EAAC;IACTD,OAAO,EAAE,uCAAuC;IAChDE,IAAI,EAAE;MACJK,QAAQ,EAAEH,OAAO,CAACC,GAAG,CAACG,MAAM;MAC5BsD,QAAQ,EAAE1D,OAAO,CAACC,GAAG,CAACK,QAAQ;MAC9BP,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,QAAQ;MAC1BK,IAAI,EAAEoD,kBAAQ,CAACpD,IAAI;MACnBE,OAAO,EAAEkD,kBAAQ,CAAClD,OAAO;MACzBE,YAAY,EAAEX,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAEU,UAAU,CAAC,GAAG,CAAC;MACnDgD,OAAO,EAAED,kBAAQ,CAACE,IAAI,EAAEC,GAAG;MAC3BC,OAAO,EAAEJ,kBAAQ,CAACE,IAAI,EAAEG;IAC1B;EACF,CAAC,CAAC;EAEF,OAAO,IAAIf,8BAAS,CAClBjD,OAAO,CAACC,GAAG,CAACG,MAAM,EAClBJ,OAAO,CAACC,GAAG,CAACK,QAAQ,EACpBN,OAAO,CAACC,GAAG,CAACgE,YAAY,EACxBN,kBACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Sequelize.js","names":["_path","_interopRequireDefault","require","_sequelizeTypescript","_Sequelize","_Sequelize2","_EngineError","_LifecycleController","_report","sequelizeClient","exports","sequelize","Proxy","get","target","property","init","shutdown","addModels","EngineError","message","reportInfo","data","host","process","env","SQL_HOST","database","SQL_DB","user","SQL_USER","port","SQL_PORT","dialect","SQL_TYPE","isUnixSocket","startsWith","sqlStorage","toLowerCase","SQL_STORAGE","path","join","cwd","undefined","createSequelizeClient","NODE_ENV","authenticate","getDialect","err","reportError","error","Error","String","stack","LifecycleController","register","close","console","models","addHook","result","convertToPlain","instance","modelInstance","toJSON","plain","Object","keys","forEach","key","Array","isArray","SQL_SYNC_MODELS","sync","catch","Sequelize","storage","logging","sqlType","trim","length","SQL_LOGGING","log","validateSequelizeEnvironment","username","dbConfig","poolMax","pool","max","poolMin","min","SQL_PASSWORD"],"sources":["../../../src/entities/Sequelize/Sequelize.ts"],"sourcesContent":["import path from 'path';\nimport { Sequelize, ModelCtor } from 'sequelize-typescript';\nimport dbConfig from './Sequelize.config';\nimport { Sequelize as SequelizeInterface } from './Sequelize.types';\nimport { validateSequelizeEnvironment } from './Sequelize.validate';\nimport { EngineError } from 'entities/EngineError';\nimport { LifecycleController } from 'entities/LifecycleController';\nimport { reportInfo, reportError } from 'utils/report';\n\nexport let sequelizeClient: undefined | Sequelize;\n\n/**\n * We use a proxy to extend the Sequelize behavior and allow initialization of the client only when needed while keeping the same interface\n */\nexport const sequelize = new Proxy<SequelizeInterface>(\n // Due to how we do the proxying, we are forced to ignore ts-errors, we could never create an object that respects the interface properly\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n {},\n {\n get: function (target, property): unknown {\n if (property === 'init') return init;\n if (property === 'shutdown') return shutdown;\n if (property === 'addModels') return addModels;\n // Create the sequelize client if it does not exist\n if (!sequelizeClient)\n throw new EngineError({\n message: 'Sequelize client was not initialized'\n });\n // Call the function on the sequelize client\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return sequelizeClient[property] as unknown;\n }\n }\n);\n\n/** On init create client and connect */\nexport async function init(): Promise<void> {\n // Ignore if already initialized\n if (sequelizeClient) return;\n\n reportInfo({\n message: 'Initializing Sequelize client',\n data: {\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n user: process.env.SQL_USER,\n port: process.env.SQL_PORT,\n dialect: process.env.SQL_TYPE || 'postgres',\n isUnixSocket: process.env.SQL_HOST?.startsWith('/'),\n sqlStorage:\n (process.env.SQL_TYPE ?? '').toLowerCase() === 'sqlite'\n ? process.env.SQL_STORAGE ||\n path.join(process.cwd(), 'database.sqlite')\n : undefined\n }\n });\n\n sequelizeClient = createSequelizeClient();\n\n // In test environment, authentication happens automatically with SQLite\n // For other environments, authenticate and log the result\n if (process.env.NODE_ENV !== 'test') {\n reportInfo({\n message: 'Starting database authentication'\n });\n\n try {\n await sequelizeClient.authenticate();\n reportInfo({\n message: 'Connected to database successfully',\n data: {\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n dialect: sequelizeClient?.getDialect()\n }\n });\n } catch (err) {\n reportError({\n message: 'Failed to connect to database',\n data: {\n error: err instanceof Error ? err.message : String(err),\n stack: err instanceof Error ? err.stack : undefined,\n host: process.env.SQL_HOST,\n database: process.env.SQL_DB,\n user: process.env.SQL_USER,\n port: process.env.SQL_PORT\n }\n });\n if (err instanceof Error) {\n reportError(err);\n }\n throw err;\n }\n }\n\n LifecycleController.register(sequelize);\n}\n\n/** On shutdown close connection and clear client */\nexport async function shutdown(): Promise<void> {\n if (sequelizeClient) {\n try {\n // For SQLite, just close the client (closing connection manager first causes SQLITE_MISUSE)\n // For other dialects, sequelize.close() handles everything properly\n await sequelizeClient.close();\n } catch (error) {\n // Ignore errors during shutdown\n if (process.env.NODE_ENV !== 'test') {\n console.error('Error closing sequelize client:', error);\n }\n }\n }\n sequelizeClient = undefined;\n}\n\nexport function addModels(models: Array<ModelCtor>): void {\n if (!sequelizeClient)\n throw new EngineError({\n message: 'Sequelize client was not initialized'\n });\n sequelizeClient.addModels(models);\n\n // Override toJSON behavior globally to ensure consistency between dev and prod\n // In dev (ts-node), property access works directly on instances\n // In prod (compiled), we need explicit serialization\n // This hook intercepts all afterFind results and converts them to plain objects\n sequelizeClient.addHook('afterFind', (result) => {\n if (!result) return;\n\n const convertToPlain = (instance: unknown) => {\n if (!instance || typeof instance !== 'object') return instance;\n const modelInstance = instance as {\n toJSON?: () => Record<string, unknown>;\n } & Record<string, unknown>;\n if (!modelInstance.toJSON) return instance;\n const plain = modelInstance.toJSON();\n // Copy the plain object properties back to the instance\n // This makes property access work without .toJSON() in compiled code\n Object.keys(plain).forEach((key) => {\n modelInstance[key] = plain[key];\n });\n };\n\n if (Array.isArray(result)) {\n result.forEach(convertToPlain);\n } else {\n convertToPlain(result);\n }\n });\n\n // Creating tables from the models is for the in-memory test database (or when explicitly asked).\n // Elsewhere the schema belongs to the migrations: a sync racing them would create tables without\n // their constraints and triggers.\n if (\n process.env.NODE_ENV === 'test' ||\n process.env.SQL_SYNC_MODELS === 'true'\n ) {\n sequelizeClient.sync().catch((error: unknown) => {\n reportError(error);\n });\n }\n}\n\n/** Create Sequelize client */\nexport function createSequelizeClient(): Sequelize {\n // Use in-memory SQLite for test environment to avoid real database connections\n if (process.env.NODE_ENV === 'test') {\n return new Sequelize({\n dialect: 'sqlite',\n storage: ':memory:',\n logging: false\n });\n }\n\n // File-based SQLite for local / offline dev (no SQL_HOST / live server)\n const sqlType = (process.env.SQL_TYPE ?? '').toLowerCase();\n if (sqlType === 'sqlite') {\n const storage =\n process.env.SQL_STORAGE && process.env.SQL_STORAGE.trim().length > 0\n ? process.env.SQL_STORAGE.trim()\n : path.join(process.cwd(), 'database.sqlite');\n reportInfo({\n message: 'Creating Sequelize client (SQLite file)',\n data: { storage, dialect: 'sqlite' }\n });\n return new Sequelize({\n dialect: 'sqlite',\n storage,\n logging: process.env.SQL_LOGGING === 'true' ? console.log : false\n });\n }\n\n // Throw an error if there is no host initial\n validateSequelizeEnvironment();\n\n reportInfo({\n message: 'Creating Sequelize client with config',\n data: {\n database: process.env.SQL_DB,\n username: process.env.SQL_USER,\n host: process.env.SQL_HOST,\n port: dbConfig.port,\n dialect: dbConfig.dialect,\n isUnixSocket: process.env.SQL_HOST?.startsWith('/'),\n poolMax: dbConfig.pool?.max,\n poolMin: dbConfig.pool?.min\n }\n });\n\n return new Sequelize(\n process.env.SQL_DB as string,\n process.env.SQL_USER as string,\n process.env.SQL_PASSWORD as string,\n dbConfig\n );\n}\n"],"mappings":";;;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
|
/** HTTP status code associated with this error */
|
|
10
10
|
statusCode: number;
|
|
11
|
+
/** Public structured data sent to the client as `details` */
|
|
12
|
+
details?: unknown;
|
|
13
|
+
/** Seconds before the client may retry (Retry-After header) */
|
|
14
|
+
retryAfterSec?: number;
|
|
11
15
|
/**
|
|
12
16
|
* Create a WebError, these errors are best suited for runtime errors
|
|
13
17
|
*/
|
|
@@ -33,8 +33,14 @@ let WebError = exports.WebError = /*#__PURE__*/function (_EngineError) {
|
|
|
33
33
|
(0, _defineProperty2.default)(_this, "errorCode", void 0);
|
|
34
34
|
/** HTTP status code associated with this error */
|
|
35
35
|
(0, _defineProperty2.default)(_this, "statusCode", void 0);
|
|
36
|
+
/** Public structured data sent to the client as `details` */
|
|
37
|
+
(0, _defineProperty2.default)(_this, "details", void 0);
|
|
38
|
+
/** Seconds before the client may retry (Retry-After header) */
|
|
39
|
+
(0, _defineProperty2.default)(_this, "retryAfterSec", void 0);
|
|
36
40
|
_this.statusCode = config.statusCode ?? 400;
|
|
37
41
|
_this.errorCode = config.errorCode;
|
|
42
|
+
if (config.details !== undefined) _this.details = config.details;
|
|
43
|
+
if (config.retryAfterSec !== undefined) _this.retryAfterSec = config.retryAfterSec;
|
|
38
44
|
return _this;
|
|
39
45
|
}
|
|
40
46
|
(0, _inherits2.default)(WebError, _EngineError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebError.js","names":["_const","require","_EngineError2","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","WebError","exports","_EngineError","config","_this","_classCallCheck2","severity","LogSeverity","WARNING","_defineProperty2","statusCode","errorCode","_inherits2","_createClass2","EngineError"],"sources":["../../../src/entities/WebError/WebError.ts"],"sourcesContent":["import { WebErrorOptions } from './WebError.types';\nimport { LogSeverity } from 'const';\nimport { EngineError } from 'entities/EngineError';\n\n/**\n * Error class used when errors should be reported to the client\n */\nexport class WebError extends EngineError {\n /** Machine readable error code that will be sent to the client */\n public errorCode: string;\n /** HTTP status code associated with this error */\n public statusCode: number;\n\n /**\n * Create a WebError, these errors are best suited for runtime errors\n */\n public constructor(config: WebErrorOptions) {\n super({ ...config, severity: config.severity ?? LogSeverity.WARNING });\n\n this.statusCode = config.statusCode ?? 400;\n this.errorCode = config.errorCode;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAAmD,SAAAE,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAP,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAS,WAAA,IAAAR,CAAA,CAAAS,KAAA,CAAAV,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAW,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAX,CAAA,aAAAM,yBAAA,YAAAA,CAAA,aAAAN,CAAA;AAEnD;AACA;AACA;AAFA,IAGae,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAAAE,YAAA;
|
|
1
|
+
{"version":3,"file":"WebError.js","names":["_const","require","_EngineError2","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","WebError","exports","_EngineError","config","_this","_classCallCheck2","severity","LogSeverity","WARNING","_defineProperty2","statusCode","errorCode","details","undefined","retryAfterSec","_inherits2","_createClass2","EngineError"],"sources":["../../../src/entities/WebError/WebError.ts"],"sourcesContent":["import { WebErrorOptions } from './WebError.types';\nimport { LogSeverity } from 'const';\nimport { EngineError } from 'entities/EngineError';\n\n/**\n * Error class used when errors should be reported to the client\n */\nexport class WebError extends EngineError {\n /** Machine readable error code that will be sent to the client */\n public errorCode: string;\n /** HTTP status code associated with this error */\n public statusCode: number;\n /** Public structured data sent to the client as `details` */\n public details?: unknown;\n /** Seconds before the client may retry (Retry-After header) */\n public retryAfterSec?: number;\n\n /**\n * Create a WebError, these errors are best suited for runtime errors\n */\n public constructor(config: WebErrorOptions) {\n super({ ...config, severity: config.severity ?? LogSeverity.WARNING });\n\n this.statusCode = config.statusCode ?? 400;\n this.errorCode = config.errorCode;\n if (config.details !== undefined) this.details = config.details;\n if (config.retryAfterSec !== undefined)\n this.retryAfterSec = config.retryAfterSec;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAAmD,SAAAE,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAP,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAS,WAAA,IAAAR,CAAA,CAAAS,KAAA,CAAAV,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAW,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAX,CAAA,aAAAM,yBAAA,YAAAA,CAAA,aAAAN,CAAA;AAEnD;AACA;AACA;AAFA,IAGae,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAAAE,YAAA;EAUnB;AACF;AACA;EACE,SAAAF,SAAmBG,MAAuB,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAhB,OAAA,QAAAW,QAAA;IAC1CI,KAAA,GAAApB,UAAA,OAAAgB,QAAA,GAAM;MAAE,GAAGG,MAAM;MAAEG,QAAQ,EAAEH,MAAM,CAACG,QAAQ,IAAIC,kBAAW,CAACC;IAAQ,CAAC;IAbvE;IAAA,IAAAC,gBAAA,CAAApB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAK,gBAAA,CAAApB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAK,gBAAA,CAAApB,OAAA,EAAAe,KAAA;IAEA;IAAA,IAAAK,gBAAA,CAAApB,OAAA,EAAAe,KAAA;IASEA,KAAA,CAAKM,UAAU,GAAGP,MAAM,CAACO,UAAU,IAAI,GAAG;IAC1CN,KAAA,CAAKO,SAAS,GAAGR,MAAM,CAACQ,SAAS;IACjC,IAAIR,MAAM,CAACS,OAAO,KAAKC,SAAS,EAAET,KAAA,CAAKQ,OAAO,GAAGT,MAAM,CAACS,OAAO;IAC/D,IAAIT,MAAM,CAACW,aAAa,KAAKD,SAAS,EACpCT,KAAA,CAAKU,aAAa,GAAGX,MAAM,CAACW,aAAa;IAAC,OAAAV,KAAA;EAC9C;EAAC,IAAAW,UAAA,CAAA1B,OAAA,EAAAW,QAAA,EAAAE,YAAA;EAAA,WAAAc,aAAA,CAAA3B,OAAA,EAAAW,QAAA;AAAA,EArB2BiB,yBAAW","ignoreList":[]}
|
|
@@ -5,4 +5,11 @@ export interface WebErrorOptions extends EngineErrorOptions {
|
|
|
5
5
|
errorCode: string;
|
|
6
6
|
/** HTTP status code associated with this error (default: 400) */
|
|
7
7
|
statusCode?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Structured data the client acts on (e.g. attempts left, per-field errors), sent in the response body as
|
|
10
|
+
* `details`. Unlike `data`, which is only logged, this is public: never put secrets or internals here.
|
|
11
|
+
*/
|
|
12
|
+
details?: unknown;
|
|
13
|
+
/** Seconds the client should wait before retrying, sent as the Retry-After header (429, 503) */
|
|
14
|
+
retryAfterSec?: number;
|
|
8
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebError.types.js","names":[],"sources":["../../../src/entities/WebError/WebError.types.ts"],"sourcesContent":["import { EngineErrorOptions } from 'entities/EngineError';\n\n/** Options to create a Web Error */\nexport interface WebErrorOptions extends EngineErrorOptions {\n /** Machine readable error code that will be sent to the client */\n errorCode: string;\n /** HTTP status code associated with this error (default: 400) */\n statusCode?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"WebError.types.js","names":[],"sources":["../../../src/entities/WebError/WebError.types.ts"],"sourcesContent":["import { EngineErrorOptions } from 'entities/EngineError';\n\n/** Options to create a Web Error */\nexport interface WebErrorOptions extends EngineErrorOptions {\n /** Machine readable error code that will be sent to the client */\n errorCode: string;\n /** HTTP status code associated with this error (default: 400) */\n statusCode?: number;\n /**\n * Structured data the client acts on (e.g. attempts left, per-field errors), sent in the response body as\n * `details`. Unlike `data`, which is only logged, this is public: never put secrets or internals here.\n */\n details?: unknown;\n /** Seconds the client should wait before retrying, sent as the Retry-After header (429, 503) */\n retryAfterSec?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -10,9 +10,13 @@ var _report = require("../../utils/report");
|
|
|
10
10
|
function error(error, request, response, _next) {
|
|
11
11
|
(0, _report.reportError)(error, request);
|
|
12
12
|
if (error instanceof _WebError.WebError) {
|
|
13
|
+
if (error.retryAfterSec !== undefined) response.set('Retry-After', String(Math.max(1, Math.round(error.retryAfterSec))));
|
|
13
14
|
response.status(error.statusCode).json({
|
|
14
15
|
errorCode: error.errorCode,
|
|
15
|
-
hint: error.hint
|
|
16
|
+
hint: error.hint,
|
|
17
|
+
...(error.details !== undefined ? {
|
|
18
|
+
details: error.details
|
|
19
|
+
} : {})
|
|
16
20
|
});
|
|
17
21
|
return;
|
|
18
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":["_WebError","require","_report","error","request","response","_next","reportError","WebError","status","statusCode","json","errorCode","hint"],"sources":["../../../src/middleware/error/error.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\nimport { WebError } from 'entities/WebError';\nimport { reportError } from 'utils/report';\n\n/** Handle errors globally */\nexport function error(\n error: Error,\n request: Request,\n response: Response,\n _next: NextFunction\n): void {\n reportError(error, request);\n if (error instanceof WebError) {\n response.status(error.statusCode).json({\n errorCode: error.errorCode,\n hint: error.hint\n });\n return;\n }\n response.status(500).json({ errorCode: 'server-error' });\n}\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACO,SAASE,KAAKA,CACnBA,KAAY,EACZC,OAAgB,EAChBC,QAAkB,EAClBC,KAAmB,EACb;EACN,IAAAC,mBAAW,EAACJ,KAAK,EAAEC,OAAO,CAAC;EAC3B,IAAID,KAAK,YAAYK,kBAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"error.js","names":["_WebError","require","_report","error","request","response","_next","reportError","WebError","retryAfterSec","undefined","set","String","Math","max","round","status","statusCode","json","errorCode","hint","details"],"sources":["../../../src/middleware/error/error.ts"],"sourcesContent":["import { Request, Response, NextFunction } from 'express';\nimport { WebError } from 'entities/WebError';\nimport { reportError } from 'utils/report';\n\n/** Handle errors globally */\nexport function error(\n error: Error,\n request: Request,\n response: Response,\n _next: NextFunction\n): void {\n reportError(error, request);\n if (error instanceof WebError) {\n if (error.retryAfterSec !== undefined)\n response.set(\n 'Retry-After',\n String(Math.max(1, Math.round(error.retryAfterSec)))\n );\n response.status(error.statusCode).json({\n errorCode: error.errorCode,\n hint: error.hint,\n ...(error.details !== undefined ? { details: error.details } : {})\n });\n return;\n }\n response.status(500).json({ errorCode: 'server-error' });\n}\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACO,SAASE,KAAKA,CACnBA,KAAY,EACZC,OAAgB,EAChBC,QAAkB,EAClBC,KAAmB,EACb;EACN,IAAAC,mBAAW,EAACJ,KAAK,EAAEC,OAAO,CAAC;EAC3B,IAAID,KAAK,YAAYK,kBAAQ,EAAE;IAC7B,IAAIL,KAAK,CAACM,aAAa,KAAKC,SAAS,EACnCL,QAAQ,CAACM,GAAG,CACV,aAAa,EACbC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACZ,KAAK,CAACM,aAAa,CAAC,CAAC,CACrD,CAAC;IACHJ,QAAQ,CAACW,MAAM,CAACb,KAAK,CAACc,UAAU,CAAC,CAACC,IAAI,CAAC;MACrCC,SAAS,EAAEhB,KAAK,CAACgB,SAAS;MAC1BC,IAAI,EAAEjB,KAAK,CAACiB,IAAI;MAChB,IAAIjB,KAAK,CAACkB,OAAO,KAAKX,SAAS,GAAG;QAAEW,OAAO,EAAElB,KAAK,CAACkB;MAAQ,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC,CAAC;IACF;EACF;EACAhB,QAAQ,CAACW,MAAM,CAAC,GAAG,CAAC,CAACE,IAAI,CAAC;IAAEC,SAAS,EAAE;EAAe,CAAC,CAAC;AAC1D","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-server-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Framework used to develop backend services. This package ships with a lot of features to standardize the creation of services, letting you focus on the business logic.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|