lambdaorm
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -13,2 +13,3 @@ import { QueryOptions, MetadataParameter, MetadataConstraint, MetadataModel, Metadata, Dialect, Schema, Stage, QueryPlan, SchemaFacade } from 'lambdaorm-base'; | ||
export declare class Orm implements IOrm { | ||
private _workspace; | ||
connection: ConnectionFacade; | ||
@@ -24,3 +25,3 @@ language: LanguagesService; | ||
private executor; | ||
constructor(workspace?: string); | ||
constructor(_workspace?: string); | ||
private static _instance; | ||
@@ -27,0 +28,0 @@ /** |
@@ -32,3 +32,4 @@ "use strict"; | ||
class Orm { | ||
constructor(workspace = process.cwd()) { | ||
constructor(_workspace = process.cwd()) { | ||
this._workspace = _workspace; | ||
this.expressions = new expressionsBuilder_1.OrmExpressionsBuilder().build(); | ||
@@ -39,3 +40,3 @@ new ormLibrary_1.OrmLibrary(this).load(); | ||
this.connection = new infrastructure_1.ConnectionFacadeBuilder(this.helper).build(); | ||
this.schema = new lambdaorm_base_1.SchemaFacadeBuilder(this.expressions, this.helper).build(workspace); | ||
this.schema = new lambdaorm_base_1.SchemaFacadeBuilder(this.expressions, this.helper).build(); | ||
this.executor = new infrastructure_ts_1.ExecutorBuilder(this.connection, this.language, this.expressions, this.helper).build(this.schema); | ||
@@ -45,3 +46,3 @@ this.operand = new infrastructure_2.OperandFacadeBuilder(this.expressions, this.helper).build(this.schema); | ||
this.expression = new infrastructure_3.ExpressionFacadeBuilder(this.language, this.executor, this.expressions, this.helper).build(this.sentence, this.schema); | ||
this.stage = new infrastructure_4.StageFacadeBuilder(this.language, this.executor, this.helper).build(this.schema, this.expression); | ||
this.stage = new infrastructure_4.StageFacadeBuilder(this.language, this.executor, this.helper).build(_workspace, this.schema, this.expression); | ||
} | ||
@@ -68,3 +69,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const schema = yield this.schema.initialize(source || this.schema.workspace); | ||
const schema = yield this.schema.initialize(source || this._workspace); | ||
// set connections | ||
@@ -128,3 +129,3 @@ if (connect && ((_a = schema.infrastructure) === null || _a === void 0 ? void 0 : _a.sources)) { | ||
get workspace() { | ||
return this.schema.workspace; | ||
return this._workspace; | ||
} | ||
@@ -131,0 +132,0 @@ /** |
{ | ||
"name": "lambdaorm", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "ORM", | ||
@@ -27,3 +27,3 @@ "author": "Flavio Lionel Rita <flaviolrita@proton.me>", | ||
"3xpr": "^1.15.0", | ||
"lambdaorm-base": "^0.1.12", | ||
"lambdaorm-base": "^0.1.13", | ||
"crypto-js": "^4.1.1", | ||
@@ -30,0 +30,0 @@ "js-yaml": "^4.1.0", |
@@ -18,3 +18,3 @@ import { SchemaFacade, QueryOptions } from 'lambdaorm-base'; | ||
private stageMappingService; | ||
constructor(schemaFacade: SchemaFacade, expression: ExpressionFacade, executor: Executor, languages: LanguagesService, helper: Helper); | ||
constructor(workspace: string, schemaFacade: SchemaFacade, expression: ExpressionFacade, executor: Executor, languages: LanguagesService, helper: Helper); | ||
exists(name: string): Promise<boolean>; | ||
@@ -21,0 +21,0 @@ sync(options?: QueryOptions): StageActionDDL; |
@@ -21,3 +21,3 @@ "use strict"; | ||
class StageFacade { | ||
constructor(schemaFacade, expression, executor, languages, helper) { | ||
constructor(workspace, schemaFacade, expression, executor, languages, helper) { | ||
this.schemaFacade = schemaFacade; | ||
@@ -28,4 +28,4 @@ this.expression = expression; | ||
this.helper = helper; | ||
this.stageMappingService = new stateService_1.StageMappingService(schemaFacade, this.helper); | ||
this.stageModelService = new stateService_1.StageModelService(schemaFacade, this.helper); | ||
this.stageMappingService = new stateService_1.StageMappingService(workspace, schemaFacade, this.helper); | ||
this.stageModelService = new stateService_1.StageModelService(workspace, schemaFacade, this.helper); | ||
} | ||
@@ -32,0 +32,0 @@ exists(name) { |
@@ -5,5 +5,6 @@ import { Query } from '../../../query/domain'; | ||
declare abstract class StageStateService<T> { | ||
protected workspace: string; | ||
protected readonly schemaFacade: SchemaFacade; | ||
protected readonly helper: Helper; | ||
constructor(schemaFacade: SchemaFacade, helper: Helper); | ||
constructor(workspace: string, schemaFacade: SchemaFacade, helper: Helper); | ||
get(name: string): Promise<T>; | ||
@@ -10,0 +11,0 @@ update(name: string, data: T): Promise<void>; |
@@ -17,3 +17,4 @@ "use strict"; | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(schemaFacade, helper) { | ||
constructor(workspace, schemaFacade, helper) { | ||
this.workspace = workspace; | ||
this.schemaFacade = schemaFacade; | ||
@@ -54,3 +55,3 @@ this.helper = helper; | ||
var _a; | ||
return path.join(this.schemaFacade.workspace, ((_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data) || 'data', `${name}-data.json`); | ||
return path.join(this.workspace, ((_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data) || 'data', `${name}-data.json`); | ||
} | ||
@@ -65,3 +66,3 @@ } | ||
var _a; | ||
return path.join(this.schemaFacade.workspace, ((_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data) || 'data', `${name}-model.json`); | ||
return path.join(this.workspace, ((_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data) || 'data', `${name}-model.json`); | ||
} | ||
@@ -96,3 +97,3 @@ ddl(stage, action, queries) { | ||
date = this.helper.str.replace(date, '-', ''); | ||
return path.join(this.schemaFacade.workspace, (_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data, `${stage}-ddl-${date}-${action}-${source.name}.${extension}`); | ||
return path.join(this.workspace, (_a = this.schemaFacade.schema.infrastructure) === null || _a === void 0 ? void 0 : _a.paths.data, `${stage}-ddl-${date}-${action}-${source.name}.${extension}`); | ||
} | ||
@@ -99,0 +100,0 @@ } |
@@ -12,3 +12,3 @@ import { SchemaFacade } from 'lambdaorm-base'; | ||
constructor(languages: LanguagesService, executor: Executor, helper: Helper); | ||
build(schemaFacade: SchemaFacade, expressionFacade: ExpressionFacade): StageFacade; | ||
build(workspace: string, schemaFacade: SchemaFacade, expressionFacade: ExpressionFacade): StageFacade; | ||
} |
@@ -12,4 +12,4 @@ "use strict"; | ||
} | ||
build(schemaFacade, expressionFacade) { | ||
return new application_1.StageFacade(schemaFacade, expressionFacade, this.executor, this.languages, this.helper); | ||
build(workspace, schemaFacade, expressionFacade) { | ||
return new application_1.StageFacade(workspace, schemaFacade, expressionFacade, this.executor, this.languages, this.helper); | ||
} | ||
@@ -16,0 +16,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
Sorry, the diff of this file is not supported yet
3223923
21489
Updatedlambdaorm-base@^0.1.13