1 | import { H3Event } from 'h3'
|
2 |
|
3 | type StaticFileResponse = [filePath: string, fileExtension: string]
|
4 |
|
5 | export declare type DrosseDbApi = {
|
6 | list: {
|
7 | all(collection: string, cleanFields?: string[]): Array<any>
|
8 | byId(
|
9 | collection: string,
|
10 | id: string|number,
|
11 | cleanFields?: string[]
|
12 | ): Array<any>
|
13 | byField(
|
14 | collection: string,
|
15 | field: string,
|
16 | value: any,
|
17 | cleanFields?: string[]
|
18 | ): any
|
19 | byFields(
|
20 | collection: string,
|
21 | fields: string,
|
22 | value: any,
|
23 | cleanFields?: string[]
|
24 | ): any
|
25 | find(
|
26 | collection: string,
|
27 | query: Object,
|
28 | cleanFields?: string[]
|
29 | ): Array<any>
|
30 | where(
|
31 | collection: string,
|
32 | searchFn: Function,
|
33 | cleanFields?: string[]
|
34 | ): Array<any>
|
35 | }
|
36 | get: {
|
37 | byId(collection: string, id: string|number, cleanFields: string[]): any
|
38 | byRef(refObj, dynamicId?: string|number, cleanFields?: string[]): any
|
39 | byField(
|
40 | collection: string,
|
41 | field: string,
|
42 | value: any,
|
43 | cleanFields: string[]
|
44 | ): any
|
45 | byFields(
|
46 | collection: string,
|
47 | fields: string[],
|
48 | value: any,
|
49 | cleanFields: string[]
|
50 | ): any
|
51 | find(collection: string, query: Object, cleanFields: string[]): any
|
52 | where(collection: string, searchFn: Function, cleanFields: string[]): any
|
53 | }
|
54 |
|
55 | query: {
|
56 | getIdMap(collection: string, fieldname: string, firstOnly: boolean): Object
|
57 | chain(collection: string): any
|
58 | clean(...fields: any[]): any
|
59 | }
|
60 |
|
61 | insert(collection: string, ids: Array<string|number>, payload): any
|
62 |
|
63 | update: {
|
64 | byId(collection: string, id: string|number, newValue: Object): any
|
65 |
|
66 | subItem: {
|
67 | append(
|
68 | collection: string,
|
69 | id: string|number,
|
70 | subPath: string,
|
71 | payload: any
|
72 | ): any
|
73 | prepend(
|
74 | collection: string,
|
75 | id: string|number,
|
76 | subPath: string,
|
77 | payload: any
|
78 | ): any
|
79 | }
|
80 | }
|
81 | remove: {
|
82 | byId(collection: string, id): any
|
83 | }
|
84 | }
|
85 |
|
86 | export declare type DrosseIoApi = {
|
87 | loadScraped(
|
88 | routePath: string,
|
89 | params: any,
|
90 | query: any,
|
91 | verb: string|null,
|
92 | skipVerb:boolean,
|
93 | extensions:string[]
|
94 | ): Promise<StaticFileResponse>,
|
95 | loadStatic(
|
96 | routePath: string,
|
97 | params: any,
|
98 | query: any,
|
99 | verb: string|null,
|
100 | skipVerb:boolean,
|
101 | extensions:string[]
|
102 | ): Promise<StaticFileResponse>,
|
103 | }
|
104 |
|
105 | export declare type DrosseLogger = {
|
106 | debug(message?: any, ...optionalParams: any[]): void
|
107 | error(message?: any, ...optionalParams: any[]): void
|
108 | info(message?: any, ...optionalParams: any[]): void
|
109 | success(message?: any, ...optionalParams: any[]): void
|
110 | warn(message?: any, ...optionalParams: any[]): void
|
111 | }
|
112 |
|
113 | export declare type DrosseServerConfig = {
|
114 |
|
115 | assetsPath?: string
|
116 |
|
117 |
|
118 | basePath?: string
|
119 |
|
120 |
|
121 | baseUrl?: string
|
122 |
|
123 |
|
124 | cli?: (vorpal: Function, params: any) => any
|
125 |
|
126 |
|
127 | collectionsPath?: string
|
128 |
|
129 |
|
130 | commands?: {
|
131 | [id: string]: (api: DrosseServiceApi) => Record<string, Function>
|
132 | }
|
133 |
|
134 |
|
135 | database?: string
|
136 |
|
137 |
|
138 | dbAdapter?: string
|
139 |
|
140 |
|
141 | errorHandler?: Function
|
142 |
|
143 |
|
144 | extendServer?: Function
|
145 |
|
146 |
|
147 | middlewares?: Array<string|Function>
|
148 |
|
149 |
|
150 | name: string
|
151 |
|
152 |
|
153 | onHttpUpgrade?: Function
|
154 |
|
155 |
|
156 | port?: number
|
157 |
|
158 |
|
159 | routesFile?: string
|
160 |
|
161 |
|
162 | scrapedPath?: string
|
163 |
|
164 |
|
165 | scraperServicesPath?: string
|
166 |
|
167 |
|
168 | servicesPath?: string
|
169 |
|
170 |
|
171 | shallowCollections?: string[]
|
172 |
|
173 |
|
174 | staticPath?: string
|
175 |
|
176 |
|
177 | templates?: {
|
178 | [id: string]: Function;
|
179 | }
|
180 | }
|
181 |
|
182 | type DrosseServiceCallback = (api: DrosseServiceApi) => Promise<any>
|
183 | type DrosseScraperCallback = (json: string, api: DrosseServiceApi) => Promise<any>
|
184 |
|
185 | export declare type DrosseServiceApi = {
|
186 | event: H3Event,
|
187 | db: DrosseDbApi,
|
188 | logger: DrosseLogger,
|
189 | io: DrosseIoApi,
|
190 | config: DrosseServerConfig
|
191 | }
|
192 |
|
193 | export declare function defineDrosseServer(
|
194 | config: DrosseServerConfig
|
195 | ): DrosseServerConfig
|
196 |
|
197 | export declare function defineDrosseService(cb: DrosseServiceCallback): DrosseServiceCallback
|
198 | export declare function defineDrosseScraper(cb: DrosseScraperCallback): DrosseScraperCallback
|
199 |
|
\ | No newline at end of file |