arocapi 1.0.4 → 1.1.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 +277 -35
- package/dist/app.d.ts +9 -6
- package/dist/app.js +69 -17
- package/dist/app.js.map +1 -1
- package/dist/express.d.ts +3 -2
- package/dist/express.js +11 -11
- package/dist/express.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/{entities/index.js → entities.js} +2 -2
- package/dist/routes/entities.js.map +1 -0
- package/dist/routes/{entity/index.js → entity.js} +2 -2
- package/dist/routes/entity.js.map +1 -0
- package/dist/routes/{search/index.js → search.js} +2 -2
- package/dist/routes/search.js.map +1 -0
- package/package.json +6 -4
- package/prisma/models/entity.prisma +17 -0
- package/prisma/schema.prisma +1 -20
- package/prisma.config.ts +1 -7
- package/src/app.ts +89 -31
- package/src/express.ts +12 -11
- package/src/index.ts +35 -0
- package/src/routes/{entities/index.ts → entities.ts} +2 -3
- package/src/routes/{entity/index.ts → entity.ts} +1 -1
- package/src/routes/{search/index.ts → search.ts} +1 -1
- package/dist/plugins/cors.d.ts +0 -3
- package/dist/plugins/cors.js +0 -6
- package/dist/plugins/cors.js.map +0 -1
- package/dist/plugins/opensearch.d.ts +0 -9
- package/dist/plugins/opensearch.js +0 -22
- package/dist/plugins/opensearch.js.map +0 -1
- package/dist/plugins/prisma.d.ts +0 -8
- package/dist/plugins/prisma.js +0 -11
- package/dist/plugins/prisma.js.map +0 -1
- package/dist/plugins/sensible.d.ts +0 -3
- package/dist/plugins/sensible.js +0 -6
- package/dist/plugins/sensible.js.map +0 -1
- package/dist/plugins/support.d.ts +0 -9
- package/dist/plugins/support.js +0 -5
- package/dist/plugins/support.js.map +0 -1
- package/dist/plugins/validation.d.ts +0 -3
- package/dist/plugins/validation.js +0 -32
- package/dist/plugins/validation.js.map +0 -1
- package/dist/routes/entities/index.js.map +0 -1
- package/dist/routes/entity/index.js.map +0 -1
- package/dist/routes/search/index.js.map +0 -1
- package/src/plugins/README.md +0 -16
- package/src/plugins/cors.ts +0 -11
- package/src/plugins/opensearch.ts +0 -32
- package/src/plugins/prisma.ts +0 -23
- package/src/plugins/sensible.ts +0 -11
- package/src/plugins/support.ts +0 -20
- package/src/plugins/validation.ts +0 -48
- package/src/routes/README.md +0 -29
- /package/dist/routes/{entities/index.d.ts → entities.d.ts} +0 -0
- /package/dist/routes/{entity/index.d.ts → entity.d.ts} +0 -0
- /package/dist/routes/{search/index.d.ts → search.d.ts} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
model Entity {
|
|
2
|
+
id Int @id @default(autoincrement())
|
|
3
|
+
rocrateId String @db.VarChar(2048)
|
|
4
|
+
name String @db.VarChar(1024)
|
|
5
|
+
description String @db.Text
|
|
6
|
+
conformsTo String @db.VarChar(2048)
|
|
7
|
+
// NOTE: How should we do recordType, can we infer it from conformsTo?
|
|
8
|
+
// recordType String??
|
|
9
|
+
memberOf String? @db.VarChar(2048)
|
|
10
|
+
root String? @db.VarChar(2048)
|
|
11
|
+
/// RecordType[]
|
|
12
|
+
recordType Json
|
|
13
|
+
rocrate Json
|
|
14
|
+
|
|
15
|
+
createdAt DateTime @default(now())
|
|
16
|
+
updatedAt DateTime @updatedAt
|
|
17
|
+
}
|
package/prisma/schema.prisma
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
generator client {
|
|
5
5
|
provider = "prisma-client"
|
|
6
6
|
output = "../src/generated/prisma"
|
|
7
|
+
importFileExtension = "js"
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
generator json {
|
|
@@ -14,23 +15,3 @@ datasource db {
|
|
|
14
15
|
provider = "mysql"
|
|
15
16
|
url = env("DATABASE_URL")
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
model Entity {
|
|
19
|
-
id Int @id @default(autoincrement())
|
|
20
|
-
rocrateId String @db.VarChar(2048)
|
|
21
|
-
name String @db.VarChar(1024)
|
|
22
|
-
description String @db.Text
|
|
23
|
-
conformsTo String @db.VarChar(2048)
|
|
24
|
-
// NOTE: How should we do recordType, can we infer it from conformsTo?
|
|
25
|
-
// recordType String??
|
|
26
|
-
memberOf String? @db.VarChar(2048)
|
|
27
|
-
root String? @db.VarChar(2048)
|
|
28
|
-
/// RecordType[]
|
|
29
|
-
recordType Json
|
|
30
|
-
rocrate Json
|
|
31
|
-
|
|
32
|
-
createdAt DateTime @default(now())
|
|
33
|
-
updatedAt DateTime @updatedAt
|
|
34
|
-
|
|
35
|
-
// TODO: How will we handle permissions?
|
|
36
|
-
}
|
package/prisma.config.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
|
|
3
1
|
import 'dotenv/config';
|
|
4
2
|
import { defineConfig } from 'prisma/config';
|
|
5
3
|
|
|
6
4
|
export default defineConfig({
|
|
7
|
-
schema:
|
|
8
|
-
migrations: {
|
|
9
|
-
path: path.join('prisma', 'migrations'),
|
|
10
|
-
// seed: "prisma/seed.ts"
|
|
11
|
-
},
|
|
5
|
+
schema: 'prisma',
|
|
12
6
|
});
|
package/src/app.ts
CHANGED
|
@@ -1,40 +1,98 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
1
|
+
import cors from '@fastify/cors';
|
|
2
|
+
import sensible from '@fastify/sensible';
|
|
3
|
+
import type { Client } from '@opensearch-project/opensearch';
|
|
4
|
+
import type { PrismaClient } from '@prisma/client/extension';
|
|
5
|
+
import type { FastifyInstance, FastifyPluginAsync } from 'fastify';
|
|
6
|
+
import fp from 'fastify-plugin';
|
|
7
|
+
import {
|
|
8
|
+
hasZodFastifySchemaValidationErrors,
|
|
9
|
+
isResponseSerializationError,
|
|
10
|
+
serializerCompiler,
|
|
11
|
+
validatorCompiler,
|
|
12
|
+
} from 'fastify-type-provider-zod';
|
|
13
|
+
import entities from './routes/entities.js';
|
|
14
|
+
import entity from './routes/entity.js';
|
|
15
|
+
import search from './routes/search.js';
|
|
5
16
|
|
|
6
|
-
const
|
|
7
|
-
|
|
17
|
+
const setupValidation = (fastify: FastifyInstance) => {
|
|
18
|
+
fastify.setValidatorCompiler(validatorCompiler);
|
|
19
|
+
fastify.setSerializerCompiler(serializerCompiler);
|
|
8
20
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
fastify.setErrorHandler((err, req, reply) => {
|
|
22
|
+
if (hasZodFastifySchemaValidationErrors(err)) {
|
|
23
|
+
return reply.code(400).send({
|
|
24
|
+
error: 'Response Validation Error',
|
|
25
|
+
message: "Request doesn't match the schema",
|
|
26
|
+
details: {
|
|
27
|
+
issues: err.validation,
|
|
28
|
+
method: req.method,
|
|
29
|
+
url: req.url,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
12
33
|
|
|
13
|
-
|
|
14
|
-
|
|
34
|
+
if (isResponseSerializationError(err)) {
|
|
35
|
+
return reply.code(500).send({
|
|
36
|
+
error: 'Internal Server Error',
|
|
37
|
+
message: "Response doesn't match the schema",
|
|
38
|
+
details: {
|
|
39
|
+
issues: err.cause.issues,
|
|
40
|
+
method: err.method,
|
|
41
|
+
url: err.url,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
15
45
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// those should be support plugins that are reused
|
|
23
|
-
// through your application
|
|
24
|
-
fastify.register(AutoLoad, {
|
|
25
|
-
dir: path.join(__dirname, 'plugins'),
|
|
26
|
-
options: opts,
|
|
27
|
-
forceESM: true,
|
|
46
|
+
// NOTE: We are exposing the error message here for development purposes.
|
|
47
|
+
// In production, consider hiding error details to avoid leaking sensitive information.
|
|
48
|
+
return reply.code(500).send({
|
|
49
|
+
error: 'Internal Server Error',
|
|
50
|
+
message: err.message,
|
|
51
|
+
});
|
|
28
52
|
});
|
|
53
|
+
};
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fastify.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
forceESM: true,
|
|
55
|
+
const setupDatabase = async (fastify: FastifyInstance, prisma: PrismaClient) => {
|
|
56
|
+
await prisma.$connect();
|
|
57
|
+
fastify.decorate('prisma', prisma);
|
|
58
|
+
fastify.addHook('onClose', async (server) => {
|
|
59
|
+
await server.prisma.$disconnect();
|
|
36
60
|
});
|
|
37
61
|
};
|
|
38
62
|
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
const setupSearch = async (fastify: FastifyInstance, opensearch: Client) => {
|
|
64
|
+
try {
|
|
65
|
+
await opensearch.ping();
|
|
66
|
+
fastify.log.info(`Connected to OpenSearch`);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
fastify.log.error(`Failed to connect to OpenSearch: ${error}`);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fastify.decorate('opensearch', opensearch);
|
|
73
|
+
|
|
74
|
+
fastify.addHook('onClose', () => opensearch.close());
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type Options = {
|
|
78
|
+
prisma: PrismaClient;
|
|
79
|
+
opensearch: Client;
|
|
80
|
+
disableCors?: boolean;
|
|
81
|
+
};
|
|
82
|
+
const app: FastifyPluginAsync<Options> = async (fastify, options) => {
|
|
83
|
+
const { prisma, opensearch, disableCors = false } = options || {};
|
|
84
|
+
|
|
85
|
+
fastify.register(sensible);
|
|
86
|
+
if (!disableCors) {
|
|
87
|
+
fastify.register(cors);
|
|
88
|
+
}
|
|
89
|
+
setupValidation(fastify);
|
|
90
|
+
await setupDatabase(fastify, prisma);
|
|
91
|
+
await setupSearch(fastify, opensearch);
|
|
92
|
+
|
|
93
|
+
fastify.register(entities);
|
|
94
|
+
fastify.register(entity);
|
|
95
|
+
fastify.register(search);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default fp(app);
|
package/src/express.ts
CHANGED
|
@@ -2,19 +2,20 @@ import type { Express } from 'express';
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import Fastify from 'fastify';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import arocapi, { type Options } from './app.js';
|
|
6
6
|
|
|
7
|
-
const fastify = Fastify(
|
|
8
|
-
logger: true,
|
|
9
|
-
});
|
|
10
|
-
fastify.register(rocapi);
|
|
7
|
+
const fastify = Fastify();
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
export default async (options: Options) => {
|
|
10
|
+
fastify.register(arocapi, options);
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
await fastify.ready();
|
|
15
13
|
|
|
16
|
-
app
|
|
17
|
-
fastify.routing(req, res);
|
|
18
|
-
});
|
|
14
|
+
const app: Express = express();
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
app.use(async (req, res) => {
|
|
17
|
+
fastify.routing(req, res);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return app;
|
|
21
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
+
import Fastify from 'fastify';
|
|
3
|
+
|
|
4
|
+
import arocapi from './app.js';
|
|
5
|
+
import { PrismaClient } from './generated/prisma/client.js';
|
|
6
|
+
|
|
7
|
+
declare module 'fastify' {
|
|
8
|
+
interface FastifyInstance {
|
|
9
|
+
prisma: PrismaClient;
|
|
10
|
+
opensearch: Client;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const prisma = new PrismaClient();
|
|
15
|
+
|
|
16
|
+
if (!process.env.OPENSEARCH_URL) {
|
|
17
|
+
throw new Error('OPENSEARCH_URL environment variable is not set');
|
|
18
|
+
}
|
|
19
|
+
const opensearchUrl = process.env.OPENSEARCH_URL;
|
|
20
|
+
const opensearch = new Client({ node: opensearchUrl });
|
|
21
|
+
|
|
22
|
+
const fastify = Fastify({
|
|
23
|
+
logger: true,
|
|
24
|
+
});
|
|
25
|
+
fastify.register(arocapi, { prisma, opensearch });
|
|
26
|
+
|
|
27
|
+
const start = async () => {
|
|
28
|
+
try {
|
|
29
|
+
await fastify.listen({ port: 3000 });
|
|
30
|
+
} catch (err) {
|
|
31
|
+
fastify.log.error(err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
start();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { FastifyPluginAsync } from 'fastify';
|
|
2
2
|
import type { ZodTypeProvider } from 'fastify-type-provider-zod';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
|
-
import type { EntityWhereInput } from '../../generated/prisma/models.js';
|
|
5
4
|
|
|
6
5
|
const querySchema = z.object({
|
|
7
6
|
memberOf: z.string().optional(),
|
|
@@ -23,7 +22,7 @@ const querySchema = z.object({
|
|
|
23
22
|
|
|
24
23
|
const entities: FastifyPluginAsync = async (fastify, _opts) => {
|
|
25
24
|
fastify.withTypeProvider<ZodTypeProvider>().get(
|
|
26
|
-
'/',
|
|
25
|
+
'/entities',
|
|
27
26
|
{
|
|
28
27
|
schema: {
|
|
29
28
|
querystring: querySchema,
|
|
@@ -33,7 +32,7 @@ const entities: FastifyPluginAsync = async (fastify, _opts) => {
|
|
|
33
32
|
const { memberOf, conformsTo, limit, offset, sort, order } = request.query;
|
|
34
33
|
console.log('🪚 request.query:', JSON.stringify(request.query, null, 2));
|
|
35
34
|
|
|
36
|
-
const where:
|
|
35
|
+
const where: NonNullable<Parameters<typeof fastify.prisma.entity.findMany>[0]>['where'] = {};
|
|
37
36
|
|
|
38
37
|
if (memberOf) {
|
|
39
38
|
where.memberOf = memberOf;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FastifyPluginAsync } from 'fastify';
|
|
2
2
|
|
|
3
3
|
const entity: FastifyPluginAsync = async (fastify, _opts) => {
|
|
4
|
-
fastify.get<{ Params: { id: string } }>('/:id', async (request, reply) => {
|
|
4
|
+
fastify.get<{ Params: { id: string } }>('/entity/:id', async (request, reply) => {
|
|
5
5
|
const { id } = request.params;
|
|
6
6
|
console.log('🪚 request:', request);
|
|
7
7
|
|
|
@@ -163,7 +163,7 @@ const buildSort = (sort: SearchParams['sort'], order: SearchParams['order']) =>
|
|
|
163
163
|
|
|
164
164
|
const search: FastifyPluginAsync = async (fastify, _opts) => {
|
|
165
165
|
fastify.withTypeProvider<ZodTypeProvider>().post(
|
|
166
|
-
'/',
|
|
166
|
+
'/search',
|
|
167
167
|
{
|
|
168
168
|
schema: {
|
|
169
169
|
body: searchParamsSchema,
|
package/dist/plugins/cors.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type FastifyCorsOptions } from '@fastify/cors';
|
|
2
|
-
declare const _default: import("fastify").FastifyPluginCallback<FastifyCorsOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
3
|
-
export default _default;
|
package/dist/plugins/cors.js
DELETED
package/dist/plugins/cors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../src/plugins/cors.ts"],"names":[],"mappings":"AAAA,OAAO,IAAiC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAOhC,eAAe,EAAE,CAAqB,KAAK,EAAE,OAAO,EAAE,EAAE;IACtD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
-
import type { FastifyPluginAsync } from 'fastify';
|
|
3
|
-
declare module 'fastify' {
|
|
4
|
-
interface FastifyInstance {
|
|
5
|
-
opensearch: Client;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
declare const _default: import("fastify").FastifyPluginCallback<FastifyPluginAsync, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
9
|
-
export default _default;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
-
import fp from 'fastify-plugin';
|
|
3
|
-
export default fp(async (fastify) => {
|
|
4
|
-
if (!process.env.OPENSEARCH_URL) {
|
|
5
|
-
throw new Error('OPENSEARCH_URL environment variable is not set');
|
|
6
|
-
}
|
|
7
|
-
const opensearchUrl = process.env.OPENSEARCH_URL;
|
|
8
|
-
const client = new Client({
|
|
9
|
-
node: opensearchUrl,
|
|
10
|
-
});
|
|
11
|
-
try {
|
|
12
|
-
await client.ping();
|
|
13
|
-
fastify.log.info(`Connected to OpenSearch at ${opensearchUrl}`);
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
fastify.log.error(`Failed to connect to OpenSearch: ${error}`);
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
fastify.decorate('opensearch', client);
|
|
20
|
-
fastify.addHook('onClose', () => client.close());
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=opensearch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opensearch.js","sourceRoot":"","sources":["../../src/plugins/opensearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQhC,eAAe,EAAE,CAAqB,KAAK,EAAE,OAAO,EAAE,EAAE;IACtD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACxB,IAAI,EAAE,aAAa;KACpB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,8BAA8B,aAAa,EAAE,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,KAAK,EAAE,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAEvC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC"}
|
package/dist/plugins/prisma.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PrismaClient } from '../generated/prisma/client.js';
|
|
2
|
-
declare module 'fastify' {
|
|
3
|
-
interface FastifyInstance {
|
|
4
|
-
prisma: PrismaClient;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare const _default: (server: import("fastify").FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>, _options: Record<never, never>) => Promise<void>;
|
|
8
|
-
export default _default;
|
package/dist/plugins/prisma.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import fp from 'fastify-plugin';
|
|
2
|
-
import { PrismaClient } from '../generated/prisma/client.js';
|
|
3
|
-
export default fp(async (server, _options) => {
|
|
4
|
-
const prisma = new PrismaClient();
|
|
5
|
-
await prisma.$connect();
|
|
6
|
-
server.decorate('prisma', prisma);
|
|
7
|
-
server.addHook('onClose', async (server) => {
|
|
8
|
-
await server.prisma.$disconnect();
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=prisma.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.js","sourceRoot":"","sources":["../../src/plugins/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAS7D,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IAC3C,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAElC,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IAGxB,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAElC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type FastifySensibleOptions } from '@fastify/sensible';
|
|
2
|
-
declare const _default: import("fastify").FastifyPluginCallback<FastifySensibleOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
3
|
-
export default _default;
|
package/dist/plugins/sensible.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sensible.js","sourceRoot":"","sources":["../../src/plugins/sensible.ts"],"names":[],"mappings":"AAAA,OAAO,QAAyC,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAOhC,eAAe,EAAE,CAAyB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface SupportPluginOptions {
|
|
2
|
-
}
|
|
3
|
-
declare const _default: import("fastify").FastifyPluginCallback<SupportPluginOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
4
|
-
export default _default;
|
|
5
|
-
declare module 'fastify' {
|
|
6
|
-
interface FastifyInstance {
|
|
7
|
-
someSupport(): string;
|
|
8
|
-
}
|
|
9
|
-
}
|
package/dist/plugins/support.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/plugins/support.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAShC,eAAe,EAAE,CAAuB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;IAC/D,OAAO,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
|
|
2
|
-
declare const _default: import("fastify").FastifyPluginCallback<FastifyPluginAsyncZod, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
3
|
-
export default _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import fp from 'fastify-plugin';
|
|
2
|
-
import { hasZodFastifySchemaValidationErrors, isResponseSerializationError, serializerCompiler, validatorCompiler, } from 'fastify-type-provider-zod';
|
|
3
|
-
export default fp(async (fastify) => {
|
|
4
|
-
fastify.setValidatorCompiler(validatorCompiler);
|
|
5
|
-
fastify.setSerializerCompiler(serializerCompiler);
|
|
6
|
-
fastify.setErrorHandler((err, req, reply) => {
|
|
7
|
-
if (hasZodFastifySchemaValidationErrors(err)) {
|
|
8
|
-
return reply.code(400).send({
|
|
9
|
-
error: 'Response Validation Error',
|
|
10
|
-
message: "Request doesn't match the schema",
|
|
11
|
-
details: {
|
|
12
|
-
issues: err.validation,
|
|
13
|
-
method: req.method,
|
|
14
|
-
url: req.url,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
if (isResponseSerializationError(err)) {
|
|
19
|
-
return reply.code(500).send({
|
|
20
|
-
error: 'Internal Server Error',
|
|
21
|
-
message: "Response doesn't match the schema",
|
|
22
|
-
details: {
|
|
23
|
-
issues: err.cause.issues,
|
|
24
|
-
method: err.method,
|
|
25
|
-
url: err.url,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
reply.status(500).send({ errors: [err.message] });
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/plugins/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAEL,mCAAmC,EACnC,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAOnC,eAAe,EAAE,CAAwB,KAAK,EAAE,OAAO,EAAE,EAAE;IACzD,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAChD,OAAO,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAElD,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1C,IAAI,mCAAmC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,KAAK,EAAE,2BAA2B;gBAClC,OAAO,EAAE,kCAAkC;gBAC3C,OAAO,EAAE;oBACP,MAAM,EAAE,GAAG,CAAC,UAAU;oBACtB,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,GAAG,EAAE,GAAG,CAAC,GAAG;iBACb;aACF,CAAC,CA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MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBAC3D,WAAW;aACZ,CAAC;YAEF,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAc,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAEhD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/src/plugins/README.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Plugins Folder
|
|
2
|
-
|
|
3
|
-
Plugins define behavior that is common to all the routes in your
|
|
4
|
-
application. Authentication, caching, templates, and all the other cross
|
|
5
|
-
cutting concerns should be handled by plugins placed in this folder.
|
|
6
|
-
|
|
7
|
-
Files in this folder are typically defined through the
|
|
8
|
-
[`fastify-plugin`](https://github.com/fastify/fastify-plugin) module,
|
|
9
|
-
making them non-encapsulated. They can define decorators and set hooks
|
|
10
|
-
that will then be used in the rest of your application.
|
|
11
|
-
|
|
12
|
-
Check out:
|
|
13
|
-
|
|
14
|
-
* [The hitchhiker's guide to plugins](https://fastify.dev/docs/latest/Guides/Plugins-Guide/)
|
|
15
|
-
* [Fastify decorators](https://fastify.dev/docs/latest/Reference/Decorators/).
|
|
16
|
-
* [Fastify lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle/).
|
package/src/plugins/cors.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import cors, { type FastifyCorsOptions } from '@fastify/cors';
|
|
2
|
-
import fp from 'fastify-plugin';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This plugins allows us to configure CORS.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/fastify/fastify-cors
|
|
8
|
-
*/
|
|
9
|
-
export default fp<FastifyCorsOptions>(async (fastify) => {
|
|
10
|
-
fastify.register(cors);
|
|
11
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
-
import type { FastifyPluginAsync } from 'fastify';
|
|
3
|
-
import fp from 'fastify-plugin';
|
|
4
|
-
|
|
5
|
-
declare module 'fastify' {
|
|
6
|
-
interface FastifyInstance {
|
|
7
|
-
opensearch: Client;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default fp<FastifyPluginAsync>(async (fastify) => {
|
|
12
|
-
if (!process.env.OPENSEARCH_URL) {
|
|
13
|
-
throw new Error('OPENSEARCH_URL environment variable is not set');
|
|
14
|
-
}
|
|
15
|
-
const opensearchUrl = process.env.OPENSEARCH_URL;
|
|
16
|
-
|
|
17
|
-
const client = new Client({
|
|
18
|
-
node: opensearchUrl,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
await client.ping();
|
|
23
|
-
fastify.log.info(`Connected to OpenSearch at ${opensearchUrl}`);
|
|
24
|
-
} catch (error) {
|
|
25
|
-
fastify.log.error(`Failed to connect to OpenSearch: ${error}`);
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
fastify.decorate('opensearch', client);
|
|
30
|
-
|
|
31
|
-
fastify.addHook('onClose', () => client.close());
|
|
32
|
-
});
|
package/src/plugins/prisma.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import fp from 'fastify-plugin';
|
|
2
|
-
|
|
3
|
-
import { PrismaClient } from '../generated/prisma/client.js';
|
|
4
|
-
|
|
5
|
-
// Use TypeScript module augmentation to declare the type of server.prisma to be PrismaClient
|
|
6
|
-
declare module 'fastify' {
|
|
7
|
-
interface FastifyInstance {
|
|
8
|
-
prisma: PrismaClient;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default fp(async (server, _options) => {
|
|
13
|
-
const prisma = new PrismaClient();
|
|
14
|
-
|
|
15
|
-
await prisma.$connect();
|
|
16
|
-
|
|
17
|
-
// Make Prisma Client available through the fastify server instance: server.prisma
|
|
18
|
-
server.decorate('prisma', prisma);
|
|
19
|
-
|
|
20
|
-
server.addHook('onClose', async (server) => {
|
|
21
|
-
await server.prisma.$disconnect();
|
|
22
|
-
});
|
|
23
|
-
});
|
package/src/plugins/sensible.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import sensible, { type FastifySensibleOptions } from '@fastify/sensible';
|
|
2
|
-
import fp from 'fastify-plugin';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This plugins adds some utilities to handle http errors
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/fastify/fastify-sensible
|
|
8
|
-
*/
|
|
9
|
-
export default fp<FastifySensibleOptions>(async (fastify) => {
|
|
10
|
-
fastify.register(sensible);
|
|
11
|
-
});
|
package/src/plugins/support.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// TODO: Enable this if we end up using decorators
|
|
2
|
-
import fp from 'fastify-plugin';
|
|
3
|
-
|
|
4
|
-
// biome-ignore lint/suspicious/noEmptyInterface: We will add options here later
|
|
5
|
-
export interface SupportPluginOptions {
|
|
6
|
-
// Specify Support plugin options here
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// The use of fastify-plugin is required to be able
|
|
10
|
-
// to export the decorators to the outer scope
|
|
11
|
-
export default fp<SupportPluginOptions>(async (fastify, _opts) => {
|
|
12
|
-
fastify.decorate('someSupport', () => 'hugs');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// When using .decorate you have to specify added properties for Typescript
|
|
16
|
-
declare module 'fastify' {
|
|
17
|
-
export interface FastifyInstance {
|
|
18
|
-
someSupport(): string;
|
|
19
|
-
}
|
|
20
|
-
}
|