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