Comparing version 0.0.44 to 0.0.45
@@ -88,2 +88,3 @@ export declare class EntryBase { | ||
abstract begin(): Promise<T>; | ||
abstract cancel(tableName: string): (where: string, tx?: Transaction) => Promise<number>; | ||
abstract escape(value: unknown): string; | ||
@@ -90,0 +91,0 @@ abstract load(tableName: string, attributes: Record<string, string>, pk: Attribute<unknown, unknown>, model: new () => EntryBase, table: Table): (where: string, order?: string | string[], limit?: number, tx?: Transaction, lock?: boolean) => Promise<EntryBase[]>; |
@@ -77,2 +77,3 @@ import { Attribute, DB, EntryBase, ForeignKeyOptions, Transaction, Type } from "./db"; | ||
load(where: Condition<A>, tx: Transaction, lock?: boolean): Promise<E[]>; | ||
cancel(where: Condition<A>, tx?: Transaction): Promise<number>; | ||
} | ||
@@ -123,3 +124,3 @@ declare type ModelBase<T, A extends AttributesDefinition, EA extends Record<string, unknown>, EM extends EntryBase, E extends EntryBase> = (new (from?: Partial<EA>, tx?: Transaction) => E) & Attribute<T, E> & { | ||
Number(): Type<number, unknown>; | ||
VarChar(size?: number): Type<string, unknown>; | ||
VarChar<S extends string>(size?: number): Type<S, unknown>; | ||
private checkDB; | ||
@@ -126,0 +127,0 @@ private checkOrderBy; |
@@ -446,4 +446,7 @@ "use strict"; | ||
this.db.tables.push(table); | ||
const cancel_ = this.db.cancel(tableName); | ||
const cancel = (where, tx) => cancel_(this.createWhere(modelName, attr2field, where)[0], tx); | ||
Object.defineProperty(cancel, "name", { value: modelName + ".cancel" }); | ||
const load_ = this.db.load(tableName, attr2field, pk, ret, table); | ||
const load = async (where, ...args) => { | ||
const load = (where, ...args) => { | ||
let order = undefined; | ||
@@ -481,7 +484,6 @@ let limit = undefined; | ||
throw new Error(`${modelName}.load: 'tx' argument: Wrong type, expected 'Transaction'`); | ||
const [str] = this.createWhere(modelName, attr2field, where); | ||
const ret = await load_(str, order, limit, tx, lock); | ||
return ret; | ||
return load_(this.createWhere(modelName, attr2field, where)[0], order, limit, tx, lock); | ||
}; | ||
Object.defineProperty(load, "name", { value: modelName + ".load" }); | ||
Object.defineProperty(ret, "cancel", { value: cancel }); | ||
Object.defineProperty(ret, "name", { value: modelName }); | ||
@@ -488,0 +490,0 @@ Object.defineProperty(ret, "load", { value: load }); |
@@ -88,2 +88,3 @@ export declare class EntryBase { | ||
abstract begin(): Promise<T>; | ||
abstract cancel(tableName: string): (where: string, tx?: Transaction) => Promise<number>; | ||
abstract escape(value: unknown): string; | ||
@@ -90,0 +91,0 @@ abstract load(tableName: string, attributes: Record<string, string>, pk: Attribute<unknown, unknown>, model: new () => EntryBase, table: Table): (where: string, order?: string | string[], limit?: number, tx?: Transaction, lock?: boolean) => Promise<EntryBase[]>; |
@@ -77,2 +77,3 @@ import { Attribute, DB, EntryBase, ForeignKeyOptions, Transaction, Type } from "./db"; | ||
load(where: Condition<A>, tx: Transaction, lock?: boolean): Promise<E[]>; | ||
cancel(where: Condition<A>, tx?: Transaction): Promise<number>; | ||
} | ||
@@ -123,3 +124,3 @@ declare type ModelBase<T, A extends AttributesDefinition, EA extends Record<string, unknown>, EM extends EntryBase, E extends EntryBase> = (new (from?: Partial<EA>, tx?: Transaction) => E) & Attribute<T, E> & { | ||
Number(): Type<number, unknown>; | ||
VarChar(size?: number): Type<string, unknown>; | ||
VarChar<S extends string>(size?: number): Type<S, unknown>; | ||
private checkDB; | ||
@@ -126,0 +127,0 @@ private checkOrderBy; |
@@ -440,4 +440,7 @@ import { Attribute, EntryBase, Table, Transaction, Type } from "./db"; | ||
this.db.tables.push(table); | ||
const cancel_ = this.db.cancel(tableName); | ||
const cancel = (where, tx) => cancel_(this.createWhere(modelName, attr2field, where)[0], tx); | ||
Object.defineProperty(cancel, "name", { value: modelName + ".cancel" }); | ||
const load_ = this.db.load(tableName, attr2field, pk, ret, table); | ||
const load = async (where, ...args) => { | ||
const load = (where, ...args) => { | ||
let order = undefined; | ||
@@ -475,7 +478,6 @@ let limit = undefined; | ||
throw new Error(`${modelName}.load: 'tx' argument: Wrong type, expected 'Transaction'`); | ||
const [str] = this.createWhere(modelName, attr2field, where); | ||
const ret = await load_(str, order, limit, tx, lock); | ||
return ret; | ||
return load_(this.createWhere(modelName, attr2field, where)[0], order, limit, tx, lock); | ||
}; | ||
Object.defineProperty(load, "name", { value: modelName + ".load" }); | ||
Object.defineProperty(ret, "cancel", { value: cancel }); | ||
Object.defineProperty(ret, "name", { value: modelName }); | ||
@@ -482,0 +484,0 @@ Object.defineProperty(ret, "load", { value: load }); |
@@ -88,2 +88,3 @@ export declare class EntryBase { | ||
abstract begin(): Promise<T>; | ||
abstract cancel(tableName: string): (where: string, tx?: Transaction) => Promise<number>; | ||
abstract escape(value: unknown): string; | ||
@@ -90,0 +91,0 @@ abstract load(tableName: string, attributes: Record<string, string>, pk: Attribute<unknown, unknown>, model: new () => EntryBase, table: Table): (where: string, order?: string | string[], limit?: number, tx?: Transaction, lock?: boolean) => Promise<EntryBase[]>; |
@@ -77,2 +77,3 @@ import { Attribute, DB, EntryBase, ForeignKeyOptions, Transaction, Type } from "./db"; | ||
load(where: Condition<A>, tx: Transaction, lock?: boolean): Promise<E[]>; | ||
cancel(where: Condition<A>, tx?: Transaction): Promise<number>; | ||
} | ||
@@ -123,3 +124,3 @@ declare type ModelBase<T, A extends AttributesDefinition, EA extends Record<string, unknown>, EM extends EntryBase, E extends EntryBase> = (new (from?: Partial<EA>, tx?: Transaction) => E) & Attribute<T, E> & { | ||
Number(): Type<number, unknown>; | ||
VarChar(size?: number): Type<string, unknown>; | ||
VarChar<S extends string>(size?: number): Type<S, unknown>; | ||
private checkDB; | ||
@@ -126,0 +127,0 @@ private checkOrderBy; |
@@ -61,3 +61,3 @@ { | ||
"types": "./dist/types/index.d.ts", | ||
"version": "0.0.44" | ||
"version": "0.0.45" | ||
} |
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
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
2025
0
107893
13