apeframework 0.2.0 → 0.3.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.
@@ -13,6 +13,13 @@ declare class Server {
13
13
  port?: number;
14
14
  routes: Route[];
15
15
  formats?: Format[];
16
+ trustProxy?: boolean;
17
+ connectionTimeout?: number;
18
+ requestTimeout?: number;
19
+ keepAliveTimeout?: number;
20
+ maxRequestsPerSocket?: number;
21
+ maxParamLength?: number;
22
+ bodyLimit?: number;
16
23
  openapi?: {
17
24
  name?: string;
18
25
  version?: string;
@@ -13,7 +13,15 @@ class Server {
13
13
  constructor(params) {
14
14
  this.host = params.host;
15
15
  this.port = params.port;
16
- this.server = fastify();
16
+ this.server = fastify({
17
+ trustProxy: params.trustProxy ?? false,
18
+ connectionTimeout: params.connectionTimeout ?? 30000,
19
+ requestTimeout: params.requestTimeout ?? 30000,
20
+ keepAliveTimeout: params.keepAliveTimeout ?? 30000,
21
+ maxRequestsPerSocket: params.maxRequestsPerSocket ?? 100,
22
+ maxParamLength: params.maxParamLength ?? 100,
23
+ bodyLimit: params.bodyLimit ?? 1000000,
24
+ });
17
25
  const ajv = getAjv(params.formats);
18
26
  this.server.setValidatorCompiler(({ schema }) => {
19
27
  return ajv.compile(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -263,18 +263,6 @@
263
263
  "default": "./dist/db/ReferentialAction.js"
264
264
  }
265
265
  },
266
- "./db/Seed": {
267
- "import": {
268
- "types": "./dist/db/Seed.d.ts",
269
- "default": "./dist/db/Seed.js"
270
- }
271
- },
272
- "./db/Seeder": {
273
- "import": {
274
- "types": "./dist/db/Seeder.d.ts",
275
- "default": "./dist/db/Seeder.js"
276
- }
277
- },
278
266
  "./db/Transaction": {
279
267
  "import": {
280
268
  "types": "./dist/db/Transaction.d.ts",
package/dist/db/Seed.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Sequelize } from 'sequelize';
2
- type Seed = (db: Sequelize) => Promise<void>;
3
- export { type Seed, };
package/dist/db/Seed.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import type { Db } from './Db.js';
2
- declare class Seeder {
3
- private readonly db;
4
- private readonly directory;
5
- private readonly extension;
6
- private readonly onApply?;
7
- constructor(params: {
8
- db: Db;
9
- directory: string;
10
- extension: string;
11
- onApply?: (name: string) => void;
12
- });
13
- list(): string[];
14
- apply(name: string): Promise<void>;
15
- }
16
- export { Seeder, };
package/dist/db/Seeder.js DELETED
@@ -1,26 +0,0 @@
1
- import { basename, extname, resolve } from 'node:path';
2
- import fs from 'fs-extra';
3
- class Seeder {
4
- db;
5
- directory;
6
- extension;
7
- onApply;
8
- constructor(params) {
9
- this.db = params.db;
10
- this.directory = params.directory;
11
- this.extension = params.extension;
12
- this.onApply = params.onApply;
13
- }
14
- list() {
15
- return fs.readdirSync(this.directory).map((filename) => {
16
- return basename(filename, extname(filename));
17
- });
18
- }
19
- async apply(name) {
20
- this.onApply?.(name);
21
- const file = resolve(this.directory, `${name}.${this.extension}`);
22
- const { seed } = await import(file);
23
- await seed(this.db);
24
- }
25
- }
26
- export { Seeder, };