@nest-omni/core 1.0.54 → 1.0.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-omni/core",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -159,13 +159,23 @@ let ApiConfigService = ApiConfigService_1 = class ApiConfigService {
159
159
  const allowedDomains = this.getString('CORS_ORIGIN').split(',');
160
160
  return {
161
161
  origin: (origin, callback) => {
162
- if (!origin ||
163
- allowedDomains.some((domain) => origin.endsWith(domain))) {
164
- callback(null, origin);
165
- }
166
- else {
167
- callback(new common_1.BadRequestException('Not allowed by CORS'));
162
+ if (!origin) {
163
+ return callback(null, true);
168
164
  }
165
+ const isAllowed = allowedDomains.some((domain) => {
166
+ if (domain.includes('*')) {
167
+ const regexPattern = domain
168
+ .replace(/\./g, '\\.')
169
+ .replace(':*', '(:\\d+)?')
170
+ .replace('*\\.', '(.*\\.)?');
171
+ const fullRegex = new RegExp(`^https?:\/\/${regexPattern}$`, 'i');
172
+ return fullRegex.test(origin);
173
+ }
174
+ return origin === domain || origin.startsWith(`${domain}:`);
175
+ });
176
+ isAllowed
177
+ ? callback(null, origin)
178
+ : callback(new common_1.BadRequestException('Not allowed by CORS'));
169
179
  },
170
180
  methods: this.getString('CORS_METHODS'),
171
181
  allowedHeaders: this.getString('CORS_ALLOWED_HEADERS'),
@@ -233,8 +243,7 @@ let ApiConfigService = ApiConfigService_1 = class ApiConfigService {
233
243
  prefix: this.getString('BULL_PREFIX'),
234
244
  defaultJobOptions: {
235
245
  removeOnComplete: true,
236
- removeOnFail: this.getNumber('BULL_REMOVE_FAILED_DAYS') * 24 * 3600 ||
237
- 30 * 24 * 3600,
246
+ removeOnFail: true,
238
247
  attempts: this.getNumber('BULL_JOB_ATTEMPTS') || 5,
239
248
  backoff: {
240
249
  type: 'exponential',