Spaces:
Build error
Build error
| ; | |
| 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 __metadata = (this && this.__metadata) || function (k, v) { | |
| if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | |
| }; | |
| var __importDefault = (this && this.__importDefault) || function (mod) { | |
| return (mod && mod.__esModule) ? mod : { "default": mod }; | |
| }; | |
| var _a; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.Ctx = exports.Param = exports.RPCReflect = exports.RPCMethod = exports.Method = exports.RPCRegistry = exports.InjectProperty = exports.Context = void 0; | |
| const property_injector_1 = require("civkit/property-injector"); | |
| const koa_1 = require("civkit/civ-rpc/koa"); | |
| const tsyringe_1 = require("tsyringe"); | |
| const civ_rpc_1 = require("civkit/civ-rpc"); | |
| const bodyparser_1 = __importDefault(require("@koa/bodyparser")); | |
| const logger_1 = require("./logger"); | |
| const temp_file_1 = require("./temp-file"); | |
| const async_context_1 = require("./async-context"); | |
| const blackhole_detector_1 = require("./blackhole-detector"); | |
| var koa_2 = require("koa"); | |
| Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return koa_2.Context; } }); | |
| exports.InjectProperty = (0, property_injector_1.propertyInjectorFactory)(tsyringe_1.container); | |
| let RPCRegistry = class RPCRegistry extends koa_1.KoaRPCRegistry { | |
| static { this.envelope = civ_rpc_1.IntegrityEnvelope; } | |
| constructor(globalLogger, ctxMgr, tempFileManager, blackHoleDetector) { | |
| super(...arguments); | |
| this.globalLogger = globalLogger; | |
| this.ctxMgr = ctxMgr; | |
| this.tempFileManager = tempFileManager; | |
| this.blackHoleDetector = blackHoleDetector; | |
| this.title = 'Jina Reader API'; | |
| this.container = tsyringe_1.container; | |
| this.logger = this.globalLogger.child({ service: this.constructor.name }); | |
| this._BODY_PARSER_LIMIT = '102mb'; | |
| this._RESPONSE_STREAM_MODE = 'koa'; | |
| this.koaMiddlewares = [ | |
| this.__CORSAllowAllMiddleware.bind(this), | |
| (0, bodyparser_1.default)({ | |
| encoding: 'utf-8', | |
| enableTypes: ['json', 'form'], | |
| jsonLimit: this._BODY_PARSER_LIMIT, | |
| xmlLimit: this._BODY_PARSER_LIMIT, | |
| formLimit: this._BODY_PARSER_LIMIT, | |
| }), | |
| this.__multiParse.bind(this), | |
| this.__binaryParse.bind(this), | |
| ]; | |
| this.on('run', () => this.blackHoleDetector.incomingRequest()); | |
| this.on('ran', () => this.blackHoleDetector.doneWithRequest()); | |
| this.on('fail', () => this.blackHoleDetector.doneWithRequest()); | |
| } | |
| async init() { | |
| await this.dependencyReady(); | |
| this.emit('ready'); | |
| } | |
| }; | |
| exports.RPCRegistry = RPCRegistry; | |
| exports.RPCRegistry = RPCRegistry = __decorate([ | |
| (0, tsyringe_1.singleton)(), | |
| __metadata("design:paramtypes", [logger_1.GlobalLogger, | |
| async_context_1.AsyncLocalContext, | |
| temp_file_1.TempFileManager, | |
| blackhole_detector_1.BlackHoleDetector]) | |
| ], RPCRegistry); | |
| const instance = tsyringe_1.container.resolve(RPCRegistry); | |
| exports.default = instance; | |
| _a = instance.decorators(), exports.Method = _a.Method, exports.RPCMethod = _a.RPCMethod, exports.RPCReflect = _a.RPCReflect, exports.Param = _a.Param, exports.Ctx = _a.Ctx; | |
| //# sourceMappingURL=registry.js.map |