@tunnel-cast/nestjs
Version:
## About This is a Tunnel-Cast - NestJS integration package, wrap the `cast` application into the `NestJS` building blocks.
55 lines • 2.23 kB
JavaScript
;
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 CastModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CastModule = void 0;
const common_1 = require("@nestjs/common");
const constants_1 = require("./constants");
const storage_1 = require("./storage");
const cast_module_default_options_1 = require("./cast-module-default-options");
let CastModule = CastModule_1 = class CastModule {
static forFeature(factoryParams = {}) {
const providers = buildFeatureProviders(factoryParams);
return {
module: CastModule_1,
providers: providers,
exports: providers
};
}
static forFeatureAsync(factories = []) {
throw Error("TODO: implement this method");
const providers = [];
return {
module: CastModule_1,
providers: providers,
exports: providers
};
}
};
CastModule = CastModule_1 = __decorate([
common_1.Module({
providers: buildFeatureProviders({})
})
], CastModule);
exports.CastModule = CastModule;
function buildFeatureProviders(factoryParams) {
return [
{
provide: constants_1.CAST_METADATA_STORAGE,
useValue: new storage_1.MetadataStorage(factoryParams.models || [])
},
{
provide: constants_1.CAST_MODULE_OPTIONS,
useValue: {
castError: factoryParams.castError || cast_module_default_options_1.defaultOptions.castError,
transformError: factoryParams.transformError || cast_module_default_options_1.defaultOptions.transformError
}
}
];
}
//# sourceMappingURL=cast.module.js.map