@appweaver/core 1.5.0 → 1.6.0
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/app/load-providers.js +9 -4
- package/cache/cache-service.d.ts +1 -1
- package/cache/cache-service.js +4 -5
- package/cache/cache.js +102 -13
- package/context/dependency-injection.d.ts +2 -2
- package/context/dependency-injection.js +3 -2
- package/health/health-service.js +3 -1
- package/memory/redis.d.ts +1 -1
- package/memory/redis.js +44 -5
- package/package.json +1 -1
- package/prisma/client/internal/class.js +3 -3
- package/prisma/client/internal/prismaNamespace.d.ts +1 -2
- package/prisma/client/internal/prismaNamespace.js +1 -2
- package/prisma/client/internal/prismaNamespaceBrowser.d.ts +1 -2
- package/prisma/client/internal/prismaNamespaceBrowser.js +1 -2
- package/prisma/client/models/OneTimeToken.d.ts +25 -53
- package/queue/bull-queue.js +66 -6
- package/security/auth-service.d.ts +1 -0
- package/security/auth-service.js +43 -13
- package/security/resources/one-time-token/model.js +10 -6
- package/security/store/database-security-store.js +20 -17
- package/security/store/redis-security-store.js +6 -1
- package/server/create-server.js +13 -7
- package/types/generated.d.ts +8 -11
package/server/create-server.js
CHANGED
|
@@ -103,18 +103,24 @@ function createServer() {
|
|
|
103
103
|
server.register(multipart_1.default, { throwFileSizeLimit: false });
|
|
104
104
|
// Register global request rate limiter
|
|
105
105
|
if (common_1.config.RATE_LIMIT_ENABLED) {
|
|
106
|
+
const redisClient = common_1.config.RATE_LIMIT_STORE === common_1.MemoryType.Redis
|
|
107
|
+
? (0, context_1.inject)(common_1.Redis).createClient({
|
|
108
|
+
connectionName: 'rate-limit',
|
|
109
|
+
connectTimeout: 500,
|
|
110
|
+
maxRetriesPerRequest: 1,
|
|
111
|
+
enableOfflineQueue: false
|
|
112
|
+
})
|
|
113
|
+
: undefined;
|
|
114
|
+
if (redisClient) {
|
|
115
|
+
server.addHook('onClose', async () => redisClient.disconnect());
|
|
116
|
+
}
|
|
106
117
|
server.register(rate_limit_1.default, {
|
|
107
118
|
max: common_1.config.RATE_LIMIT_MAX,
|
|
108
119
|
timeWindow: common_1.config.RATE_LIMIT_WINDOW,
|
|
109
120
|
allowList: common_1.config.RATE_LIMIT_ALLOW_LIST,
|
|
121
|
+
skipOnError: common_1.config.RATE_LIMIT_SKIP_ON_ERROR,
|
|
110
122
|
nameSpace: 'rate-limit:',
|
|
111
|
-
redis:
|
|
112
|
-
? (0, context_1.inject)(common_1.Redis).createClient({
|
|
113
|
-
connectTimeout: 500,
|
|
114
|
-
maxRetriesPerRequest: 1,
|
|
115
|
-
lazyConnect: true
|
|
116
|
-
})
|
|
117
|
-
: null
|
|
123
|
+
redis: redisClient
|
|
118
124
|
});
|
|
119
125
|
}
|
|
120
126
|
// Register request context plugin with default values
|
package/types/generated.d.ts
CHANGED
|
@@ -134,60 +134,57 @@ export type OneTimeToken = {
|
|
|
134
134
|
id: number;
|
|
135
135
|
tokenHash: string;
|
|
136
136
|
purpose: string;
|
|
137
|
-
expiresAt: Date;
|
|
138
137
|
data: any;
|
|
139
|
-
|
|
138
|
+
expiresAt: Date;
|
|
140
139
|
createdAt: Date;
|
|
141
140
|
};
|
|
142
141
|
export type OneTimeTokenSingle = {
|
|
143
142
|
id: number;
|
|
144
143
|
tokenHash: string;
|
|
145
144
|
purpose: string;
|
|
146
|
-
expiresAt: Date;
|
|
147
145
|
data: any;
|
|
148
|
-
|
|
146
|
+
expiresAt: Date;
|
|
149
147
|
createdAt: Date;
|
|
150
148
|
};
|
|
151
149
|
export type OneTimeTokenMultiple = {
|
|
152
150
|
id: number;
|
|
153
151
|
tokenHash: string;
|
|
154
152
|
purpose: string;
|
|
155
|
-
expiresAt: Date;
|
|
156
153
|
data: any;
|
|
157
|
-
|
|
154
|
+
expiresAt: Date;
|
|
158
155
|
createdAt: Date;
|
|
159
156
|
};
|
|
160
157
|
export type OneTimeTokenCreate = {
|
|
161
158
|
tokenHash: string;
|
|
162
159
|
purpose: string;
|
|
163
|
-
expiresAt: Date;
|
|
164
160
|
data: any;
|
|
161
|
+
expiresAt: Date;
|
|
165
162
|
};
|
|
166
163
|
export type OneTimeTokenUpdate = {
|
|
167
164
|
tokenHash?: string;
|
|
168
165
|
purpose?: string;
|
|
169
|
-
expiresAt?: Date;
|
|
170
166
|
data?: any;
|
|
167
|
+
expiresAt?: Date;
|
|
171
168
|
};
|
|
172
169
|
export type OneTimeTokenRelationCreate = {
|
|
173
170
|
tokenHash: string;
|
|
174
171
|
purpose: string;
|
|
175
|
-
expiresAt: Date;
|
|
176
172
|
data: any;
|
|
173
|
+
expiresAt: Date;
|
|
177
174
|
};
|
|
178
175
|
export type OneTimeTokenRelationUpdate = {
|
|
179
176
|
id: number;
|
|
180
177
|
tokenHash?: string;
|
|
181
178
|
purpose?: string;
|
|
182
|
-
expiresAt?: Date;
|
|
183
179
|
data?: any;
|
|
180
|
+
expiresAt?: Date;
|
|
184
181
|
};
|
|
185
182
|
export type OneTimeTokenRelationInput = {
|
|
186
183
|
id?: number;
|
|
187
184
|
tokenHash?: string;
|
|
188
185
|
purpose?: string;
|
|
189
|
-
expiresAt?: Date;
|
|
190
186
|
data?: any;
|
|
187
|
+
expiresAt?: Date;
|
|
191
188
|
};
|
|
192
189
|
export type OneTimeTokenQuery = QueryFilter<OneTimeToken>;
|
|
193
190
|
export type OneTimeTokenSort = QuerySort<OneTimeTokenMultiple>;
|