Comparing version 0.0.17 to 0.0.18
{ | ||
"name": "js-jpa", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "jpa for node", | ||
@@ -5,0 +5,0 @@ "author": "stone", |
@@ -9,2 +9,5 @@ const Context = require('./Context') | ||
async initialize(config) { | ||
if (config.driver === undefined) { | ||
config.driver = 'mysql' | ||
} | ||
this._logger = config.logger | ||
@@ -11,0 +14,0 @@ if (DRIVERS[config.driver]) { |
@@ -1,1 +0,7 @@ | ||
module.exports = require('./DataSource') | ||
const DataSource = require('./DataSource') | ||
module.exports.newDataSource = async function (config) { | ||
let dataSource = new DataSource() | ||
await dataSource.initialize(config) | ||
return dataSource | ||
} |
@@ -1,3 +0,4 @@ | ||
interface DataSource { | ||
initialize(config: JpaConfig): Promise<void> | ||
export function newDataSource(config: JpaConfig): Promise<DataSource> | ||
export interface DataSource { | ||
createContext(): Promise<JpaContext> | ||
@@ -7,3 +8,3 @@ registerRepository(context: JpaContext, repository: Repository): Promise<void> | ||
interface JpaContext { | ||
export interface JpaContext { | ||
query(sql: string, values?: any[]): Promise<any> | ||
@@ -16,3 +17,3 @@ beginTransaction(): Promise<void> | ||
interface JpaConfig { | ||
export interface JpaConfig { | ||
driver?: 'mysql' | ||
@@ -27,3 +28,3 @@ host: string | ||
interface Repository { | ||
export interface Repository { | ||
schema: Schema, | ||
@@ -38,3 +39,3 @@ insert(context: JpaContext, entity: any): Promise<any> | ||
interface Schema { | ||
export interface Schema { | ||
name: string, | ||
@@ -44,3 +45,3 @@ fields: SchemaField[] | ||
interface SchemaField { | ||
export interface SchemaField { | ||
name: string, | ||
@@ -52,3 +53,3 @@ type: string, | ||
interface PageRequest { | ||
export interface PageRequest { | ||
page?: number, | ||
@@ -59,3 +60,3 @@ size?: number, | ||
interface PageOrder { | ||
export interface PageOrder { | ||
name: string, | ||
@@ -65,7 +66,7 @@ asc: boolean | ||
interface Specification { | ||
export interface Specification { | ||
(builder: Builder, entityProxy: EntityProxy): string | ||
} | ||
interface Builder { | ||
export interface Builder { | ||
and(left: string, right: string): string | ||
@@ -75,7 +76,7 @@ or(left: string, right: string): string | ||
interface EntityProxy { | ||
export interface EntityProxy { | ||
[index: string]: EntityFieldProxy | ||
} | ||
interface EntityFieldProxy { | ||
export interface EntityFieldProxy { | ||
equal(value: any): string | ||
@@ -82,0 +83,0 @@ between(min: any, max: any): string |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21787
20
694