sedentary 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/db.d.ts CHANGED
@@ -71,7 +71,7 @@ export declare class Table extends Table_base {
71
71
  oid?: number;
72
72
  findField(name: string): Attribute<Natural, unknown>;
73
73
  }
74
- export declare abstract class DB {
74
+ export declare abstract class DB<T extends Transaction> {
75
75
  tables: Table[];
76
76
  protected log: (message: string) => void;
77
77
  protected sync: boolean;
@@ -82,7 +82,7 @@ export declare abstract class DB {
82
82
  protected indexesEq(a: Index, b: Index): boolean;
83
83
  syncDataBase(): Promise<void>;
84
84
  protected syncLog(message: string): void;
85
- begin(): Promise<Transaction>;
85
+ abstract begin(): Promise<T>;
86
86
  abstract escape(value: Natural): string;
87
87
  abstract load(tableName: string, attributes: Record<string, string>, pk: Attribute<Natural, unknown>, model: new () => EntryBase, table: Table): (where: string, order?: string[], tx?: Transaction) => Promise<EntryBase[]>;
88
88
  abstract save(tableName: string, attributes: Record<string, string>, pk: Attribute<Natural, unknown>): (this: EntryBase & Record<string, Natural>) => Promise<boolean>;
package/db.js CHANGED
@@ -83,9 +83,6 @@ class DB {
83
83
  syncLog(message) {
84
84
  this.log(this.sync ? message : "NOT SYNCING: " + message);
85
85
  }
86
- async begin() {
87
- return new Transaction();
88
- }
89
86
  }
90
87
  exports.DB = DB;
91
88
  class Transaction {
package/index.d.ts CHANGED
@@ -96,9 +96,9 @@ export interface SedentaryOptions {
96
96
  log?: ((message: string) => void) | null;
97
97
  sync?: boolean;
98
98
  }
99
- export declare class Sedentary {
99
+ export declare class Sedentary<D extends DB<T>, T extends Transaction> {
100
100
  protected autoSync: boolean;
101
- protected db: DB;
101
+ protected db: D;
102
102
  protected doSync: boolean;
103
103
  protected log: (...data: unknown[]) => void;
104
104
  private models;
@@ -115,7 +115,7 @@ export declare class Sedentary {
115
115
  connect(sync?: boolean): Promise<void>;
116
116
  sync(): Promise<void>;
117
117
  end(): Promise<void>;
118
- begin(): Promise<Transaction>;
118
+ begin(): Promise<T>;
119
119
  escape(value: Natural): string;
120
120
  model<A extends AttributesDefinition, B extends boolean, K extends string, P extends ModelStd, EM extends EntryMethods<A, P>>(modelName: string, attributes: A, options?: BaseModelOptions & {
121
121
  int8id?: B;
package/package.json CHANGED
@@ -8,18 +8,18 @@
8
8
  "dependencies": {},
9
9
  "description": "The ORM which never needs to migrate",
10
10
  "devDependencies": {
11
- "@types/mocha": "9.0.0",
12
- "@types/node": "17.0.8",
11
+ "@types/mocha": "9.1.0",
12
+ "@types/node": "17.0.19",
13
13
  "@types/yamljs": "0.2.31",
14
- "@typescript-eslint/eslint-plugin": "5.9.0",
15
- "@typescript-eslint/parser": "5.9.0",
16
- "eslint": "8.6.0",
17
- "mocha": "9.1.3",
14
+ "@typescript-eslint/eslint-plugin": "5.12.1",
15
+ "@typescript-eslint/parser": "5.12.1",
16
+ "eslint": "8.9.0",
17
+ "mocha": "9.2.1",
18
18
  "nyc": "15.1.0",
19
19
  "prettier": "2.5.1",
20
- "ts-node": "10.4.0",
20
+ "ts-node": "10.5.0",
21
21
  "tsd": "0.19.1",
22
- "typescript": "4.5.4",
22
+ "typescript": "4.5.5",
23
23
  "yamljs": "0.3.0"
24
24
  },
25
25
  "engines": {
@@ -78,5 +78,5 @@
78
78
  }
79
79
  },
80
80
  "types": "index.d.ts",
81
- "version": "0.0.24"
81
+ "version": "0.0.25"
82
82
  }