speedly 2.0.22 → 2.0.23
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/dist/cjs/kit/db/db.d.ts +13 -0
- package/dist/cjs/kit/db/db.js +8 -0
- package/dist/esm/kit/db/db.d.ts +13 -0
- package/dist/esm/kit/db/db.js +8 -0
- package/package.json +1 -1
package/dist/cjs/kit/db/db.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
29
29
|
select(value: string | {
|
|
30
30
|
[key: string]: -1 | 1;
|
|
31
31
|
}): /*elided*/ any;
|
|
32
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
32
33
|
sort(value: string | {
|
|
33
34
|
[key: string]: -1 | 1;
|
|
34
35
|
}): /*elided*/ any;
|
|
@@ -41,6 +42,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
41
42
|
select(value: string | {
|
|
42
43
|
[key: string]: -1 | 1;
|
|
43
44
|
}): /*elided*/ any;
|
|
45
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
44
46
|
sort(value: string | {
|
|
45
47
|
[key: string]: -1 | 1;
|
|
46
48
|
}): /*elided*/ any;
|
|
@@ -53,6 +55,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
53
55
|
select(value: string | {
|
|
54
56
|
[key: string]: -1 | 1;
|
|
55
57
|
}): /*elided*/ any;
|
|
58
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
56
59
|
sort(value: string | {
|
|
57
60
|
[key: string]: -1 | 1;
|
|
58
61
|
}): /*elided*/ any;
|
|
@@ -65,6 +68,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
65
68
|
select(value: string | {
|
|
66
69
|
[key: string]: -1 | 1;
|
|
67
70
|
}): /*elided*/ any;
|
|
71
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
68
72
|
sort(value: string | {
|
|
69
73
|
[key: string]: -1 | 1;
|
|
70
74
|
}): /*elided*/ any;
|
|
@@ -77,6 +81,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
77
81
|
select(value: string | {
|
|
78
82
|
[key: string]: -1 | 1;
|
|
79
83
|
}): /*elided*/ any;
|
|
84
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
80
85
|
sort(value: string | {
|
|
81
86
|
[key: string]: -1 | 1;
|
|
82
87
|
}): /*elided*/ any;
|
|
@@ -89,6 +94,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
89
94
|
select(value: string | {
|
|
90
95
|
[key: string]: -1 | 1;
|
|
91
96
|
}): /*elided*/ any;
|
|
97
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
92
98
|
sort(value: string | {
|
|
93
99
|
[key: string]: -1 | 1;
|
|
94
100
|
}): /*elided*/ any;
|
|
@@ -101,6 +107,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
101
107
|
select(value: string | {
|
|
102
108
|
[key: string]: -1 | 1;
|
|
103
109
|
}): /*elided*/ any;
|
|
110
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
104
111
|
sort(value: string | {
|
|
105
112
|
[key: string]: -1 | 1;
|
|
106
113
|
}): /*elided*/ any;
|
|
@@ -113,6 +120,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
113
120
|
select(value: string | {
|
|
114
121
|
[key: string]: -1 | 1;
|
|
115
122
|
}): /*elided*/ any;
|
|
123
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
116
124
|
sort(value: string | {
|
|
117
125
|
[key: string]: -1 | 1;
|
|
118
126
|
}): /*elided*/ any;
|
|
@@ -125,6 +133,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
125
133
|
select(value: string | {
|
|
126
134
|
[key: string]: -1 | 1;
|
|
127
135
|
}): /*elided*/ any;
|
|
136
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
128
137
|
sort(value: string | {
|
|
129
138
|
[key: string]: -1 | 1;
|
|
130
139
|
}): /*elided*/ any;
|
|
@@ -137,6 +146,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
137
146
|
select(value: string | {
|
|
138
147
|
[key: string]: -1 | 1;
|
|
139
148
|
}): /*elided*/ any;
|
|
149
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
140
150
|
sort(value: string | {
|
|
141
151
|
[key: string]: -1 | 1;
|
|
142
152
|
}): /*elided*/ any;
|
|
@@ -149,6 +159,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
149
159
|
select(value: string | {
|
|
150
160
|
[key: string]: -1 | 1;
|
|
151
161
|
}): /*elided*/ any;
|
|
162
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
152
163
|
sort(value: string | {
|
|
153
164
|
[key: string]: -1 | 1;
|
|
154
165
|
}): /*elided*/ any;
|
|
@@ -161,6 +172,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
161
172
|
select(value: string | {
|
|
162
173
|
[key: string]: -1 | 1;
|
|
163
174
|
}): /*elided*/ any;
|
|
175
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
164
176
|
sort(value: string | {
|
|
165
177
|
[key: string]: -1 | 1;
|
|
166
178
|
}): /*elided*/ any;
|
|
@@ -173,6 +185,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
173
185
|
select(value: string | {
|
|
174
186
|
[key: string]: -1 | 1;
|
|
175
187
|
}): /*elided*/ any;
|
|
188
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
176
189
|
sort(value: string | {
|
|
177
190
|
[key: string]: -1 | 1;
|
|
178
191
|
}): /*elided*/ any;
|
package/dist/cjs/kit/db/db.js
CHANGED
|
@@ -22,6 +22,7 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
22
22
|
let model;
|
|
23
23
|
let queryState = {
|
|
24
24
|
queries: [],
|
|
25
|
+
events: {},
|
|
25
26
|
};
|
|
26
27
|
if (config?.path)
|
|
27
28
|
__path = config.path;
|
|
@@ -439,6 +440,9 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
439
440
|
});
|
|
440
441
|
// if(req.query.select) data = data.select(req.query.select)
|
|
441
442
|
data = await data;
|
|
443
|
+
if (queryState.events.after) {
|
|
444
|
+
await queryState.events.after(req, data);
|
|
445
|
+
}
|
|
442
446
|
if (!data) {
|
|
443
447
|
next({
|
|
444
448
|
status: 404,
|
|
@@ -545,6 +549,10 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
545
549
|
});
|
|
546
550
|
return handler;
|
|
547
551
|
};
|
|
552
|
+
handler.after = (onfulfilled) => {
|
|
553
|
+
queryState.events.after = onfulfilled;
|
|
554
|
+
return handler;
|
|
555
|
+
};
|
|
548
556
|
handler.sort = (value) => {
|
|
549
557
|
queryState.queries.push({
|
|
550
558
|
type: "sort",
|
package/dist/esm/kit/db/db.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
29
29
|
select(value: string | {
|
|
30
30
|
[key: string]: -1 | 1;
|
|
31
31
|
}): /*elided*/ any;
|
|
32
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
32
33
|
sort(value: string | {
|
|
33
34
|
[key: string]: -1 | 1;
|
|
34
35
|
}): /*elided*/ any;
|
|
@@ -41,6 +42,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
41
42
|
select(value: string | {
|
|
42
43
|
[key: string]: -1 | 1;
|
|
43
44
|
}): /*elided*/ any;
|
|
45
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
44
46
|
sort(value: string | {
|
|
45
47
|
[key: string]: -1 | 1;
|
|
46
48
|
}): /*elided*/ any;
|
|
@@ -53,6 +55,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
53
55
|
select(value: string | {
|
|
54
56
|
[key: string]: -1 | 1;
|
|
55
57
|
}): /*elided*/ any;
|
|
58
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
56
59
|
sort(value: string | {
|
|
57
60
|
[key: string]: -1 | 1;
|
|
58
61
|
}): /*elided*/ any;
|
|
@@ -65,6 +68,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
65
68
|
select(value: string | {
|
|
66
69
|
[key: string]: -1 | 1;
|
|
67
70
|
}): /*elided*/ any;
|
|
71
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
68
72
|
sort(value: string | {
|
|
69
73
|
[key: string]: -1 | 1;
|
|
70
74
|
}): /*elided*/ any;
|
|
@@ -77,6 +81,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
77
81
|
select(value: string | {
|
|
78
82
|
[key: string]: -1 | 1;
|
|
79
83
|
}): /*elided*/ any;
|
|
84
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
80
85
|
sort(value: string | {
|
|
81
86
|
[key: string]: -1 | 1;
|
|
82
87
|
}): /*elided*/ any;
|
|
@@ -89,6 +94,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
89
94
|
select(value: string | {
|
|
90
95
|
[key: string]: -1 | 1;
|
|
91
96
|
}): /*elided*/ any;
|
|
97
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
92
98
|
sort(value: string | {
|
|
93
99
|
[key: string]: -1 | 1;
|
|
94
100
|
}): /*elided*/ any;
|
|
@@ -101,6 +107,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
101
107
|
select(value: string | {
|
|
102
108
|
[key: string]: -1 | 1;
|
|
103
109
|
}): /*elided*/ any;
|
|
110
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
104
111
|
sort(value: string | {
|
|
105
112
|
[key: string]: -1 | 1;
|
|
106
113
|
}): /*elided*/ any;
|
|
@@ -113,6 +120,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
113
120
|
select(value: string | {
|
|
114
121
|
[key: string]: -1 | 1;
|
|
115
122
|
}): /*elided*/ any;
|
|
123
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
116
124
|
sort(value: string | {
|
|
117
125
|
[key: string]: -1 | 1;
|
|
118
126
|
}): /*elided*/ any;
|
|
@@ -125,6 +133,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
125
133
|
select(value: string | {
|
|
126
134
|
[key: string]: -1 | 1;
|
|
127
135
|
}): /*elided*/ any;
|
|
136
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
128
137
|
sort(value: string | {
|
|
129
138
|
[key: string]: -1 | 1;
|
|
130
139
|
}): /*elided*/ any;
|
|
@@ -137,6 +146,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
137
146
|
select(value: string | {
|
|
138
147
|
[key: string]: -1 | 1;
|
|
139
148
|
}): /*elided*/ any;
|
|
149
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
140
150
|
sort(value: string | {
|
|
141
151
|
[key: string]: -1 | 1;
|
|
142
152
|
}): /*elided*/ any;
|
|
@@ -149,6 +159,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
149
159
|
select(value: string | {
|
|
150
160
|
[key: string]: -1 | 1;
|
|
151
161
|
}): /*elided*/ any;
|
|
162
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
152
163
|
sort(value: string | {
|
|
153
164
|
[key: string]: -1 | 1;
|
|
154
165
|
}): /*elided*/ any;
|
|
@@ -161,6 +172,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
161
172
|
select(value: string | {
|
|
162
173
|
[key: string]: -1 | 1;
|
|
163
174
|
}): /*elided*/ any;
|
|
175
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
164
176
|
sort(value: string | {
|
|
165
177
|
[key: string]: -1 | 1;
|
|
166
178
|
}): /*elided*/ any;
|
|
@@ -173,6 +185,7 @@ declare const db: (collectionName: string, config?: ConfigsType) => {
|
|
|
173
185
|
select(value: string | {
|
|
174
186
|
[key: string]: -1 | 1;
|
|
175
187
|
}): /*elided*/ any;
|
|
188
|
+
after(onfulfilled: (req: Express.Request, document: any) => any): /*elided*/ any;
|
|
176
189
|
sort(value: string | {
|
|
177
190
|
[key: string]: -1 | 1;
|
|
178
191
|
}): /*elided*/ any;
|
package/dist/esm/kit/db/db.js
CHANGED
|
@@ -22,6 +22,7 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
22
22
|
let model;
|
|
23
23
|
let queryState = {
|
|
24
24
|
queries: [],
|
|
25
|
+
events: {},
|
|
25
26
|
};
|
|
26
27
|
if (config?.path)
|
|
27
28
|
__path = config.path;
|
|
@@ -439,6 +440,9 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
439
440
|
});
|
|
440
441
|
// if(req.query.select) data = data.select(req.query.select)
|
|
441
442
|
data = await data;
|
|
443
|
+
if (queryState.events.after) {
|
|
444
|
+
await queryState.events.after(req, data);
|
|
445
|
+
}
|
|
442
446
|
if (!data) {
|
|
443
447
|
next({
|
|
444
448
|
status: 404,
|
|
@@ -545,6 +549,10 @@ const usingMongoDb = (collectionName, config = { type: "external" }) => {
|
|
|
545
549
|
});
|
|
546
550
|
return handler;
|
|
547
551
|
};
|
|
552
|
+
handler.after = (onfulfilled) => {
|
|
553
|
+
queryState.events.after = onfulfilled;
|
|
554
|
+
return handler;
|
|
555
|
+
};
|
|
548
556
|
handler.sort = (value) => {
|
|
549
557
|
queryState.queries.push({
|
|
550
558
|
type: "sort",
|