-
Notifications
You must be signed in to change notification settings - Fork 1
/
global.d.ts
39 lines (35 loc) · 1.18 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { PlatformaticApp, PlatformaticDBMixin, PlatformaticDBConfig, Entity, Entities, EntityHooks } from '@platformatic/db'
import { EntityTypes, Cron,Message,Page,Queue } from './types'
declare module 'fastify' {
interface FastifyInstance {
getSchema<T extends 'Cron' | 'Message' | 'Page' | 'Queue'>(schemaId: T): {
'$id': string,
title: string,
description: string,
type: string,
properties: {
[x in keyof EntityTypes[T]]: { type: string, nullable?: boolean }
},
required: string[]
};
}
}
interface AppEntities extends Entities {
cron: Entity<Cron>,
message: Entity<Message>,
page: Entity<Page>,
queue: Entity<Queue>,
}
interface AppEntityHooks {
addEntityHooks(entityName: 'cron', hooks: EntityHooks<Cron>): any
addEntityHooks(entityName: 'message', hooks: EntityHooks<Message>): any
addEntityHooks(entityName: 'page', hooks: EntityHooks<Page>): any
addEntityHooks(entityName: 'queue', hooks: EntityHooks<Queue>): any
}
declare module 'fastify' {
interface FastifyInstance {
platformatic: PlatformaticApp<PlatformaticDBConfig> &
PlatformaticDBMixin<AppEntities> &
AppEntityHooks
}
}