Skip to content

Commit 2ef6010

Browse files
fix builds
1 parent 921b2ea commit 2ef6010

File tree

7 files changed

+397
-392
lines changed

7 files changed

+397
-392
lines changed

.eslintrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"extends": ["@osskit"],
3-
"ignorePatterns": [
4-
"packages/**"
5-
]
3+
"ignorePatterns": ["dist/**/*", "packages/**"]
64
}

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,49 @@
3131
"@fastify/helmet": "^9.1.0",
3232
"@fastify/middie": "^8.0.0",
3333
"@fastify/request-context": "^4.0.0",
34-
"@fastify/swagger": "^7.4.0",
35-
"@fastify/type-provider-typebox": "^1.0.0",
34+
"@fastify/swagger": "^7.4.1",
35+
"@fastify/type-provider-typebox": "^2.0.1",
3636
"@godaddy/terminus": "^4.11.0",
3737
"@osskit/fastify-enforce-headers": "^0.0.5",
38-
"@osskit/monitor": "^4.0.0",
39-
"@sinclair/typebox": "^0.23.5",
38+
"@osskit/monitor": "^5.0.0",
39+
"@sinclair/typebox": "^0.24.8",
4040
"dotenv": "^16.0.1",
4141
"env-var": "^7.1.1",
4242
"express-prom-bundle": "^6.5.0",
43-
"fastify": "^4.1.0",
43+
"fastify": "^4.2.0",
4444
"http-errors": "^2.0.0",
4545
"http-status": "^1.5.2",
4646
"mongodb": "^4.7.0",
47-
"pino": "^8.0.0",
47+
"pino": "^8.1.0",
4848
"prom-client": "^14.0.1",
4949
"uuid": "^8.3.2"
5050
},
5151
"devDependencies": {
5252
"@openapitools/openapi-generator-cli": "^2.5.1",
53-
"@osskit/eslint-config": "^1.0.3",
53+
"@osskit/eslint-config": "^1.0.5",
5454
"@osskit/prettier-config": "^0.0.1",
55-
"@osskit/tsconfig": "^0.0.3",
55+
"@osskit/tsconfig": "^0.0.5",
5656
"@types/http-errors": "^1.8.2",
57-
"@types/jest": "^28.1.3",
58-
"@types/node": "^18.0.0",
57+
"@types/jest": "^28.1.4",
58+
"@types/node": "^18.0.1",
5959
"@types/node-fetch": "^2.6.2",
6060
"@types/uuid": "^8.3.4",
61-
"@typescript-eslint/eslint-plugin": "^5.29.0",
62-
"@typescript-eslint/parser": "^5.29.0",
63-
"eslint": "^8.18.0",
61+
"@typescript-eslint/eslint-plugin": "^5.30.4",
62+
"@typescript-eslint/parser": "^5.30.4",
63+
"eslint": "^8.19.0",
6464
"eslint-plugin-import": "^2.26.0",
6565
"eslint-plugin-jest": "^26.5.3",
66-
"eslint-plugin-unicorn": "^42.0.0",
66+
"eslint-plugin-unicorn": "^43.0.0",
6767
"husky": "^8.0.1",
68-
"jest": "^28.1.1",
69-
"lint-staged": "^13.0.2",
68+
"jest": "^28.1.2",
69+
"lint-staged": "^13.0.3",
7070
"node-fetch": "^3.2.6",
71-
"nodemon": "^2.0.16",
72-
"pino-pretty": "^8.0.0",
71+
"nodemon": "^2.0.18",
72+
"pino-pretty": "^8.1.0",
7373
"prettier": "^2.7.1",
7474
"ts-jest": "^28.0.5",
75-
"ts-node": "^10.8.1",
76-
"type-fest": "^2.13.1",
75+
"ts-node": "^10.8.2",
76+
"type-fest": "^2.16.0",
7777
"typescript": "^4.7.4"
7878
},
7979
"lint-staged": {

src/schemas/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Static } from '@sinclair/typebox';
22
import { Type } from '@sinclair/typebox';
3-
import { exampleRef } from './models.js';
3+
import { exampleSchema } from './models.js';
44

5-
export const createExamplePayloadSchema = Type.Omit(exampleRef, ['id'], { $id: 'CreateExamplePayload' });
5+
export const createExamplePayloadSchema = Type.Omit(exampleSchema, ['id'], { $id: 'CreateExamplePayload' });
66

77
export type CreateExamplePayload = Static<typeof createExamplePayloadSchema>;

src/server/index.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import Fastify from 'fastify';
1+
import { fastify } from 'fastify';
22
import fastifyCors from '@fastify/cors';
33
import type { TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
4-
import { ajvTypeBoxPlugin } from '@fastify/type-provider-typebox';
54
import { enforceHeaders } from '@osskit/fastify-enforce-headers';
65
import { logger } from '../framework/logger.js';
76
import { trace } from './plugins/tracing.js';
@@ -11,28 +10,26 @@ import { v1 } from './v1/index.js';
1110
import { openapi } from './plugins/openapi.js';
1211
import { registerSchemas } from './register-schemas.js';
1312

14-
const fastify = Fastify({
13+
const server = fastify({
1514
logger,
1615
ajv: {
17-
plugins: [ajvTypeBoxPlugin],
1816
customOptions: {
1917
coerceTypes: 'array',
20-
strict: 'log',
2118
},
2219
},
2320
}).withTypeProvider<TypeBoxTypeProvider>();
2421

2522
export const init = async () => {
26-
registerSchemas(fastify);
27-
await openapi(fastify);
23+
registerSchemas(server);
24+
await openapi(server);
2825

29-
await trace(fastify);
30-
await metrics(fastify);
31-
await fastify.register(enforceHeaders);
32-
await fastify.register(fastifyCors);
33-
await helmet(fastify);
26+
await trace(server);
27+
await metrics(server);
28+
await server.register(enforceHeaders);
29+
await server.register(fastifyCors);
30+
await helmet(server);
3431

35-
await fastify.register(v1, { prefix: '/v1' });
32+
await server.register(v1, { prefix: '/v1' });
3633

37-
return fastify;
34+
return server;
3835
};

src/server/plugins/tracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ setGlobalContext(() => requestContext.get('tracing') as Record<string, string>);
77
export const trace = async (fastify: TypeBoxFastifyInstance) => {
88
await fastify.register(fastifyRequestContextPlugin);
99

10-
fastify.addHook('onRequest', async ({ headers }: { headers: Record<string, string | undefined> }) => {
10+
fastify.addHook('onRequest', async ({ headers }) => {
1111
requestContext.set('tracing', {
1212
'x-request-id': headers['x-request-id']?.toString(),
1313
'x-b3-traceid': headers['x-b3-traceid']?.toString(),

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": "@osskit/tsconfig",
33
"compilerOptions": {
44
"outDir": "dist"
5-
}
5+
},
6+
"include": ["src"]
67
}

0 commit comments

Comments
 (0)