lambdaorm-base
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "lambdaorm-base", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "ORM", | ||
@@ -30,3 +30,4 @@ "author": "Flavio Lionel Rita <flaviolrita@proton.me>", | ||
"uuid": "^9.0.1", | ||
"winston": "^3.13.0" | ||
"winston": "^3.13.0", | ||
"luxon": "^3.4.4" | ||
}, | ||
@@ -33,0 +34,0 @@ "keywords": [ |
import { Schema } from '../../domain'; | ||
import { Expressions } from '3xpr'; | ||
import { SchemaH3lp } from '../../../shared'; | ||
import { OrmBaseH3lp } from '../../../shared'; | ||
export declare class SchemaExtender { | ||
private readonly expressions; | ||
private readonly helper; | ||
constructor(expressions: Expressions, helper: SchemaH3lp); | ||
constructor(expressions: Expressions, helper: OrmBaseH3lp); | ||
extend(schema: Schema): void; | ||
@@ -9,0 +9,0 @@ private extendEnums; |
@@ -9,3 +9,3 @@ import { Schema, SchemaData, ClauseInfo, SourceRule, Mapping, MatchOptions, InitializeSchemaArgs, DomainSchema, Entity, Enum, EntityMapping, Stage } from '../domain'; | ||
import { SchemaFacade } from './facade'; | ||
import { SchemaH3lp } from '../../shared'; | ||
import { OrmBaseH3lp } from '../../shared'; | ||
import { LoadSchema } from './useCases/load'; | ||
@@ -25,3 +25,3 @@ export declare class SchemaState { | ||
schemaPath?: string; | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, routeService: RouteService, facade: SchemaFacade, loadSchema: LoadSchema, helper: SchemaH3lp); | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, routeService: RouteService, facade: SchemaFacade, loadSchema: LoadSchema, helper: OrmBaseH3lp); | ||
initialize(args: InitializeSchemaArgs): Promise<Schema>; | ||
@@ -28,0 +28,0 @@ load(source: string | Schema): Promise<Schema>; |
@@ -7,3 +7,3 @@ import { Schema } from '../../domain'; | ||
import { ViewsConfigService } from '../services/config/viewsConfigService'; | ||
import { SchemaH3lp } from '../../../shared'; | ||
import { OrmBaseH3lp } from '../../../shared'; | ||
export declare class LoadSchema { | ||
@@ -16,4 +16,4 @@ private readonly source; | ||
private readonly helper; | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, helper: SchemaH3lp); | ||
constructor(source: DataSourceConfigService, domain: DomainConfigService, mapping: MappingsConfigService, stage: StageConfigService, view: ViewsConfigService, helper: OrmBaseH3lp); | ||
load(source: Schema): Schema; | ||
} |
import { Expressions } from '3xpr'; | ||
import { SchemaFacade } from '../application'; | ||
import { SchemaH3lp } from '../../shared'; | ||
import { OrmBaseH3lp } from '../../shared'; | ||
export declare class SchemaFacadeBuilder { | ||
private readonly expressions; | ||
private readonly helper; | ||
constructor(expressions: Expressions, helper: SchemaH3lp); | ||
constructor(expressions: Expressions, helper: OrmBaseH3lp); | ||
build(): SchemaFacade; | ||
} |
@@ -1,7 +0,7 @@ | ||
import { SchemaH3lp } from '../../shared'; | ||
import { OrmBaseH3lp } from '../../shared'; | ||
export declare class SchemaFileHelper { | ||
private readonly helper; | ||
constructor(helper: SchemaH3lp); | ||
constructor(helper: OrmBaseH3lp); | ||
getConfigPath(source?: string): Promise<string | undefined>; | ||
getConfigFileName(workspace: string): Promise<string | undefined>; | ||
} |
import { Expressions } from '3xpr'; | ||
import { SchemaState, SchemaFacade } from '../application'; | ||
import { SchemaH3lp } from '../../shared'; | ||
import { OrmBaseH3lp } from '../../shared'; | ||
export declare class SchemaStateBuilder { | ||
@@ -8,4 +8,4 @@ private readonly expressions; | ||
private readonly helper; | ||
constructor(expressions: Expressions, facade: SchemaFacade, helper: SchemaH3lp); | ||
constructor(expressions: Expressions, facade: SchemaFacade, helper: OrmBaseH3lp); | ||
build(): SchemaState; | ||
} |
/// <reference types="node" /> | ||
import { H3lp } from 'h3lp'; | ||
import { H3lp, IStringHelper } from 'h3lp'; | ||
import { OperandHelper } from '3xpr'; | ||
import { SchemaHelper } from '../../schema/infrastructure'; | ||
@@ -9,3 +10,5 @@ import { Logger } from '../application/ports/logger'; | ||
} | ||
declare class SqlStringWrapper { | ||
declare class SqlStringHelper { | ||
private readonly str; | ||
constructor(str: IStringHelper); | ||
escapeId(name: string): string; | ||
@@ -15,5 +18,7 @@ escape(name: string): string; | ||
format(sql: string, values: any[], stringifyObjects: string, timeZone: string): string; | ||
dateToString(date: Date, timeZone: string): string; | ||
dateToString(date: Date, timeZone?: string): string; | ||
dateFormat(value: any, format?: string): string; | ||
bufferToString(buffer: Buffer): string; | ||
raw(sql: string): string; | ||
transformParameter(name: string): string; | ||
} | ||
@@ -27,10 +32,11 @@ declare class UUIDWrapper { | ||
} | ||
export declare class SchemaH3lp extends H3lp { | ||
export declare class OrmBaseH3lp extends H3lp { | ||
readonly logger: Logger; | ||
schema: SchemaHelper; | ||
yaml: YamlWrapper; | ||
sqlString: SqlStringWrapper; | ||
sqlString: SqlStringHelper; | ||
uuid: UUIDWrapper; | ||
operand: OperandHelper; | ||
constructor(h3lp: H3lp, logger: Logger); | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SchemaH3lp = void 0; | ||
exports.OrmBaseH3lp = void 0; | ||
const h3lp_1 = require("h3lp"); | ||
const _3xpr_1 = require("3xpr"); | ||
const infrastructure_1 = require("../../schema/infrastructure"); | ||
@@ -9,2 +10,3 @@ const YAML = require('js-yaml'); | ||
const SqlString = require('sqlstring'); | ||
const LUXON = require('luxon'); | ||
class YamlWrapper { | ||
@@ -20,3 +22,7 @@ load(yaml) { | ||
} | ||
class SqlStringWrapper { | ||
class SqlStringHelper { | ||
// eslint-disable-next-line no-useless-constructor | ||
constructor(str) { | ||
this.str = str; | ||
} | ||
escapeId(name) { | ||
@@ -34,5 +40,14 @@ return SqlString.escapeId(name); | ||
} | ||
dateToString(date, timeZone) { | ||
dateToString(date, timeZone = 'local') { | ||
return SqlString.dateToString(date, timeZone); | ||
} | ||
dateFormat(value, format = 'ISO') { | ||
const iso = new Date(value).toISOString(); | ||
if (format === 'ISO') { | ||
return LUXON.DateTime.fromISO(iso).toISO(); | ||
} | ||
else { | ||
return LUXON.DateTime.fromISO(iso).toFormat(format); | ||
} | ||
} | ||
bufferToString(buffer) { | ||
@@ -44,2 +59,7 @@ return SqlString.bufferToString(buffer); | ||
} | ||
transformParameter(name) { | ||
return this.str.replace(name, '.', '_'); | ||
// con la siguiente opción falla cuando se hace value=Helper.str.replace(value,"\\'","\\''") | ||
// return string.replace(new RegExp(search, 'g'), replace) | ||
} | ||
} | ||
@@ -63,3 +83,3 @@ class UUIDWrapper { | ||
} | ||
class SchemaH3lp extends h3lp_1.H3lp { | ||
class OrmBaseH3lp extends h3lp_1.H3lp { | ||
constructor(h3lp, logger) { | ||
@@ -70,7 +90,8 @@ super(h3lp.utils, h3lp.val, h3lp.fs, h3lp.http, h3lp.obj, h3lp.str, h3lp.test, h3lp.array); | ||
this.yaml = new YamlWrapper(); | ||
this.sqlString = new SqlStringWrapper(); | ||
this.sqlString = new SqlStringHelper(h3lp.str); | ||
this.operand = new _3xpr_1.OperandHelper(_3xpr_1.expressions.constBuilder); | ||
this.uuid = new UUIDWrapper(); | ||
} | ||
} | ||
exports.SchemaH3lp = SchemaH3lp; | ||
exports.OrmBaseH3lp = OrmBaseH3lp; | ||
//# sourceMappingURL=helper.js.map |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
355520
5242
8
+ Addedluxon@^3.4.4
+ Addedluxon@3.5.0(transitive)