maxserver 0.1.30 → 0.2.1

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.
@@ -230,13 +230,4 @@ Rule of thumb: make the message something you would want to see at 03:00 in logs
230
230
  - npx option, atm devserver macos only
231
231
  - unit tests
232
232
 
233
- ```
234
- I am just starting to publish packages on github / npm.
235
- Still not sure if it's worth the time 😃
236
-
237
- If anyone else than me and bots is using this package,
238
- just follow me on github and I will improve it.
239
-
240
- https://github.com/max-matinpalo
241
233
 
242
- ```
package/index.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import "fastify";
2
+ import "@fastify/jwt";
3
+
4
+ declare function maxserver(...args: any[]): any;
5
+ export default maxserver;
6
+
7
+ declare global {
8
+ var oid: (id: string) => import("mongodb").ObjectId;
9
+ var db: import("mongodb").Db;
10
+ }
11
+
12
+ declare module "fastify" {
13
+ interface FastifyInstance {
14
+ maxserver: {
15
+ env?: string;
16
+ cors?: string | boolean | RegExp | Array<string | RegExp>;
17
+ secret?: string;
18
+ mongodb?: string;
19
+ static?: string;
20
+ };
21
+ }
22
+
23
+ interface FastifyRequest {
24
+ userId: string | null;
25
+ }
26
+
27
+ interface FastifyContextConfig {
28
+ auth?: boolean;
29
+ }
30
+
31
+ interface RouteShorthandOptions {
32
+ config?: FastifyContextConfig;
33
+ }
34
+ }
35
+
36
+ declare module "@fastify/jwt" {
37
+ interface FastifyJWT {
38
+ user: {
39
+ sub?: string;
40
+ userId?: string;
41
+ userid?: string;
42
+ id?: string;
43
+ [key: string]: unknown;
44
+ };
45
+ }
46
+ }
47
+
48
+ export { };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "maxserver",
3
- "version": "0.1.30",
3
+ "version": "0.2.1",
4
4
  "description": "Node server setup based fastify",
5
5
  "author": "Max Matinpalo",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
+ "types": "index.d.ts",
8
9
  "homepage": "https://github.com/max-matinpalo/maxserver#readme",
9
10
  "repository": {
10
11
  "type": "git",