lambdaorm-base
Advanced tools
Comparing version 0.1.32 to 0.1.33
{ | ||
"name": "lambdaorm-base", | ||
"version": "0.1.32", | ||
"version": "0.1.33", | ||
"description": "ORM", | ||
@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@proton.me>", |
@@ -10,3 +10,2 @@ import { ClauseInfo, SourceRule, Schema, SchemaData, Dialect } from '../domain'; | ||
import { CompleteSchema } from './useCases/complete'; | ||
import { GetSchema } from './useCases/get'; | ||
import { LoadSchema } from './useCases/load'; | ||
@@ -18,2 +17,3 @@ import { CreateSchema } from './useCases/create'; | ||
import { Type } from 'typ3s'; | ||
import { IFileSchemaService } from './ports/fileSchemaService'; | ||
export declare class SchemaFacade { | ||
@@ -32,7 +32,7 @@ readonly source: DataSourceConfigService; | ||
private readonly loadSchema; | ||
private readonly getSchema; | ||
private readonly fileService; | ||
private readonly completeSchema; | ||
schema: Schema; | ||
schemaPath?: string; | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, schemaService: SchemaService, getSchemaData: GetSchemaSchema, routeService: RouteService, extender: SchemaExtender, createSchema: CreateSchema, updateSchema: UpdateSchema, loadSchema: LoadSchema, getSchema: GetSchema, completeSchema: CompleteSchema); | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, schemaService: SchemaService, getSchemaData: GetSchemaSchema, routeService: RouteService, extender: SchemaExtender, createSchema: CreateSchema, updateSchema: UpdateSchema, loadSchema: LoadSchema, fileService: IFileSchemaService, completeSchema: CompleteSchema); | ||
new(dialect?: Dialect, connection?: any): Schema; | ||
@@ -47,4 +47,6 @@ evalSourceRule(rule: SourceRule, clauseInfo: ClauseInfo): boolean; | ||
get(source: string): Promise<Schema | null>; | ||
write(schema: Schema, fullPath: string): Promise<void>; | ||
initialize(source: string | Schema): Promise<Schema>; | ||
complete(schema: Schema): void; | ||
private _get; | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
class SchemaFacade { | ||
constructor(source, domain, mapping, stage, view, schemaService, getSchemaData, routeService, extender, createSchema, updateSchema, loadSchema, getSchema, completeSchema) { | ||
constructor(source, domain, mapping, stage, view, schemaService, getSchemaData, routeService, extender, createSchema, updateSchema, loadSchema, fileService, completeSchema) { | ||
this.source = source; | ||
@@ -29,3 +29,3 @@ this.domain = domain; | ||
this.loadSchema = loadSchema; | ||
this.getSchema = getSchema; | ||
this.fileService = fileService; | ||
this.completeSchema = completeSchema; | ||
@@ -71,3 +71,3 @@ this.schema = this.schemaService.newSchema(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const schemaInfo = yield this.getSchema.get(source); | ||
const schemaInfo = yield this._get(source); | ||
if (schemaInfo === null) { | ||
@@ -79,5 +79,10 @@ return null; | ||
} | ||
write(schema, fullPath) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.fileService.write(schema, fullPath); | ||
}); | ||
} | ||
initialize(source) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const schemaInfo = yield this.getSchema.get(source); | ||
const schemaInfo = yield this._get(source); | ||
if (schemaInfo === null) { | ||
@@ -96,4 +101,15 @@ throw new domain_1.SchemaError(`Schema: ${source} not supported`); | ||
} | ||
_get(source) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (source && typeof source === 'string') { | ||
return yield this.fileService.read(source); | ||
} | ||
else if (source) { | ||
return { schema: source }; | ||
} | ||
return null; | ||
}); | ||
} | ||
} | ||
exports.SchemaFacade = SchemaFacade; | ||
//# sourceMappingURL=facade.js.map |
@@ -1,2 +0,2 @@ | ||
export * from './ports/fileSchemaReader'; | ||
export * from './ports/fileSchemaService'; | ||
export * from './services/config/dataSourceConfigService'; | ||
@@ -16,4 +16,3 @@ export * from './services/config/mappingsConfigService'; | ||
export * from './useCases/update'; | ||
export * from './useCases/get'; | ||
export * from './useCases/complete'; | ||
export * from './useCases/getSchemaData'; |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./ports/fileSchemaReader"), exports); | ||
__exportStar(require("./ports/fileSchemaService"), exports); | ||
__exportStar(require("./services/config/dataSourceConfigService"), exports); | ||
@@ -33,5 +33,4 @@ __exportStar(require("./services/config/mappingsConfigService"), exports); | ||
__exportStar(require("./useCases/update"), exports); | ||
__exportStar(require("./useCases/get"), exports); | ||
__exportStar(require("./useCases/complete"), exports); | ||
__exportStar(require("./useCases/getSchemaData"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const application_1 = require("../application"); | ||
const fileSchemaReader_1 = require("./fileSchemaReader"); | ||
const fileSchemaService_1 = require("./fileSchemaService"); | ||
const schemaFileHelper_1 = require("./schemaFileHelper"); | ||
@@ -30,6 +30,6 @@ const schemaService_1 = require("../application/services/schemaService"); | ||
const updateSchema = new application_1.UpdateSchema(schemaService, createEntitiesService); | ||
const getSchema = new application_1.GetSchema(new fileSchemaReader_1.FileSchemaReader(new schemaFileHelper_1.SchemaFileHelper(this.helper), this.helper)); | ||
const fileSchemaService = new fileSchemaService_1.FileSchemaService(new schemaFileHelper_1.SchemaFileHelper(this.helper), this.helper); | ||
const completeSchema = new application_1.CompleteSchema(schemaService); | ||
const getSchemaData = new application_1.GetSchemaSchema(interpretSchemaDataService); | ||
return new application_1.SchemaFacade(source, model, mapping, stage, view, schemaService, getSchemaData, routeService, extender, createSchema, updateSchema, loadSchema, getSchema, completeSchema); | ||
return new application_1.SchemaFacade(source, model, mapping, stage, view, schemaService, getSchemaData, routeService, extender, createSchema, updateSchema, loadSchema, fileSchemaService, completeSchema); | ||
} | ||
@@ -36,0 +36,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
259936
148
3952