fix npm run build

This commit is contained in:
Rayyan
2026-08-02 20:01:29 +07:00
parent 306c145f91
commit eb6031282a
236 changed files with 5557 additions and 47 deletions
+7
View File
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheKeys = void 0;
exports.CacheKeys = {
permission: (userId) => `permissions:${userId}`,
};
//# sourceMappingURL=cache-keys.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"cache-keys.js","sourceRoot":"","sources":["../../src/shared/cache-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,UAAU,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,eAAe,MAAM,EAAE;CACxD,CAAC"}
+24
View File
@@ -0,0 +1,24 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrismaService = void 0;
const common_1 = require("@nestjs/common");
const client_1 = require("@prisma/client");
let PrismaService = class PrismaService extends client_1.PrismaClient {
async onModuleInit() {
await this.$connect();
}
async onModuleDestroy() {
await this.$disconnect();
}
};
exports.PrismaService = PrismaService;
exports.PrismaService = PrismaService = __decorate([
(0, common_1.Injectable)()
], PrismaService);
//# sourceMappingURL=prisma.service.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../../src/shared/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA2E;AAC3E,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF,CAAA;AARY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAQzB"}
+121
View File
@@ -0,0 +1,121 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var RedisService_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RedisService = void 0;
const common_1 = require("@nestjs/common");
const ioredis_1 = __importDefault(require("ioredis"));
let RedisService = RedisService_1 = class RedisService {
// Keep client typed as any to avoid tight coupling to ioredis types in tests
client = null;
logger = new common_1.Logger(RedisService_1.name);
lastLogAt = 0;
LOG_THROTTLE_MS = 5000; // throttle repeated error logs
onModuleInit() {
const enabled = (process.env.REDIS_ENABLED || 'true').toLowerCase() === 'true';
if (!enabled) {
this.logger.log('Redis disabled via REDIS_ENABLED=false');
return;
}
const url = process.env.REDIS_URL || 'redis://localhost:6379';
// Use lazyConnect so application can start even if Redis is unavailable temporarily
this.client = new ioredis_1.default(url, {
lazyConnect: true,
// limit retries to avoid infinite reconnect storms
maxRetriesPerRequest: 5,
// automatic reconnection strategy
reconnectOnError: (err) => {
return true;
},
enableOfflineQueue: true,
// optional reconnect strategy
retryStrategy: (times) => {
// exponential backoff capped at 5s
const delay = Math.min(50 * Math.pow(2, times), 5000);
return delay;
},
});
this.client.on('connect', () => this.logger.log('Connected to Redis'));
this.client.on('ready', () => this.logger.log('Redis ready'));
this.client.on('error', (err) => this.handleError(err));
this.client.on('close', () => this.logger.warn('Redis connection closed'));
this.client.on('reconnecting', () => this.logger.log('Redis reconnecting'));
// attempt to connect but do not throw if it fails
this.client.connect().catch((err) => {
this.handleError(err);
});
}
handleError(err) {
const now = Date.now();
if (now - this.lastLogAt > this.LOG_THROTTLE_MS) {
this.logger.error('Redis error', err instanceof Error ? err.message : err);
this.lastLogAt = now;
}
}
onModuleDestroy() {
if (this.client) {
try {
this.client.disconnect();
}
catch (e) {
// ignore
}
}
}
getClient() {
return this.client;
}
ensureClient() {
// returns true if client is connected/usable
return this.client && this.client.status && this.client.status !== 'end' && this.client.status !== 'close';
}
async get(key) {
if (!this.ensureClient())
return null;
try {
return await this.client.get(key);
}
catch (e) {
this.handleError(e);
return null;
}
}
async set(key, value, ttlSeconds) {
if (!this.ensureClient())
return;
try {
if (ttlSeconds) {
await this.client.set(key, value, 'EX', ttlSeconds);
}
else {
await this.client.set(key, value);
}
}
catch (e) {
this.handleError(e);
}
}
async del(key) {
if (!this.ensureClient())
return;
try {
await this.client.del(key);
}
catch (e) {
this.handleError(e);
}
}
};
exports.RedisService = RedisService;
exports.RedisService = RedisService = RedisService_1 = __decorate([
(0, common_1.Injectable)()
], RedisService);
//# sourceMappingURL=redis.service.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"redis.service.js","sourceRoot":"","sources":["../../src/shared/redis.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAmF;AACnF,sDAA8B;AAGvB,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,6EAA6E;IACrE,MAAM,GAAQ,IAAI,CAAC;IACV,MAAM,GAAG,IAAI,eAAM,CAAC,cAAY,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,GAAG,CAAC,CAAC;IACL,eAAe,GAAG,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AY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAwGxB"}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=request-context.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../../src/shared/types/request-context.ts"],"names":[],"mappings":""}
+5
View File
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.noop = noop;
function noop() { }
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":";;AAAA,oBAAyB;AAAzB,SAAgB,IAAI,KAAI,CAAC"}