@appweaver/core 1.5.1 → 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.
@@ -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: common_1.config.RATE_LIMIT_STORE === common_1.MemoryType.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
@@ -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
- updatedAt: Date;
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
- updatedAt: Date;
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
- updatedAt: Date;
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>;