@sqb/sqljs 4.9.1 → 4.10.0

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.
@@ -10,12 +10,14 @@ const sql_js_1 = tslib_1.__importDefault(require("sql.js"));
10
10
  const sqljs_connection_js_1 = require("./sqljs-connection.js");
11
11
  const dbCache = new Map();
12
12
  class SqljsAdapter {
13
- driver = 'sqljs';
14
- dialect = 'sqlite';
15
- features = {
16
- cursor: true,
17
- // fetchAsString: [DataType.DATE, DataType.TIMESTAMP, DataType.TIMESTAMPTZ]
18
- };
13
+ constructor() {
14
+ this.driver = 'sqljs';
15
+ this.dialect = 'sqlite';
16
+ this.features = {
17
+ cursor: true,
18
+ // fetchAsString: [DataType.DATE, DataType.TIMESTAMP, DataType.TIMESTAMPTZ]
19
+ };
20
+ }
19
21
  async connect(config) {
20
22
  if (!config.database)
21
23
  throw new Error('You must provide sqlite database file for sql.js driver');
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SqljsConnection = void 0;
4
4
  const sqljs_cursor_js_1 = require("./sqljs-cursor.js");
5
5
  class SqljsConnection {
6
- _onClose;
7
- intlcon;
8
6
  constructor(db, _onClose) {
9
7
  this._onClose = _onClose;
10
8
  this.intlcon = db;
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SqljsCursor = void 0;
4
4
  class SqljsCursor {
5
- _stmt;
6
- _rowType;
7
5
  constructor(stmt, opts) {
8
6
  this._rowType = opts.rowType;
9
7
  this._stmt = stmt;
@@ -6,12 +6,14 @@ import initSqlJs from 'sql.js';
6
6
  import { SqljsConnection } from './sqljs-connection.js';
7
7
  const dbCache = new Map();
8
8
  export class SqljsAdapter {
9
- driver = 'sqljs';
10
- dialect = 'sqlite';
11
- features = {
12
- cursor: true,
13
- // fetchAsString: [DataType.DATE, DataType.TIMESTAMP, DataType.TIMESTAMPTZ]
14
- };
9
+ constructor() {
10
+ this.driver = 'sqljs';
11
+ this.dialect = 'sqlite';
12
+ this.features = {
13
+ cursor: true,
14
+ // fetchAsString: [DataType.DATE, DataType.TIMESTAMP, DataType.TIMESTAMPTZ]
15
+ };
16
+ }
15
17
  async connect(config) {
16
18
  if (!config.database)
17
19
  throw new Error('You must provide sqlite database file for sql.js driver');
@@ -1,7 +1,5 @@
1
1
  import { SqljsCursor } from './sqljs-cursor.js';
2
2
  export class SqljsConnection {
3
- _onClose;
4
- intlcon;
5
3
  constructor(db, _onClose) {
6
4
  this._onClose = _onClose;
7
5
  this.intlcon = db;
@@ -1,6 +1,4 @@
1
1
  export class SqljsCursor {
2
- _stmt;
3
- _rowType;
4
2
  constructor(stmt, opts) {
5
3
  this._rowType = opts.rowType;
6
4
  this._stmt = stmt;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sqb/sqljs",
3
3
  "description": "SQB serialization extension for sql.js driver",
4
- "version": "4.9.1",
4
+ "version": "4.10.0",
5
5
  "author": "Panates",
6
6
  "contributors": [
7
7
  "Eray Hanoglu <e.hanoglu@panates.com>",
@@ -13,6 +13,10 @@
13
13
  "url": "https://github.com/sqbjs/sqb.git",
14
14
  "directory": "packages/sqljs"
15
15
  },
16
+ "type": "module",
17
+ "module": "./esm/index.js",
18
+ "main": "./cjs/index.js",
19
+ "types": "./types/index.d.ts",
16
20
  "scripts": {
17
21
  "compile": "tsc",
18
22
  "prebuild": "npm run lint && npm run clean",
@@ -29,28 +33,18 @@
29
33
  "clean:cover": "rimraf ../../coverage/sqljs"
30
34
  },
31
35
  "dependencies": {
32
- "putil-promisify": "^1.10.0"
36
+ "putil-promisify": "^1.10.1"
33
37
  },
34
38
  "devDependencies": {
35
- "@types/sql.js": "^1.4.4",
39
+ "@types/sql.js": "^1.4.9",
36
40
  "sql.js": "^1.8.0"
37
41
  },
38
42
  "peerDependencies": {
39
- "@sqb/builder": "^4.9.1",
40
- "@sqb/connect": "^4.9.1",
41
- "@sqb/sqlite-dialect": "^4.9.1",
43
+ "@sqb/builder": "^4.10.0",
44
+ "@sqb/connect": "^4.10.0",
45
+ "@sqb/sqlite-dialect": "^4.10.0",
42
46
  "sql.js": "^1.8.0"
43
47
  },
44
- "type": "module",
45
- "types": "esm/index.d.ts",
46
- "exports": {
47
- ".": {
48
- "require": "./cjs/index.js",
49
- "default": "./esm/index.js"
50
- },
51
- "./cjs": "./cjs/index.js",
52
- "./esm": "./esm/index.js"
53
- },
54
48
  "engines": {
55
49
  "node": ">=16.0",
56
50
  "npm": ">=7.0.0"
package/esm/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import '@sqb/sqlite-dialect';
2
- import { Adapter, ClientConfiguration } from '@sqb/connect';
3
- export declare class SqljsAdapter implements Adapter {
4
- driver: string;
5
- dialect: string;
6
- features: {
7
- cursor: boolean;
8
- };
9
- connect(config: ClientConfiguration): Promise<Adapter.Connection>;
10
- }
11
- export declare function closeMemoryDatabase(name?: string): Promise<void>;
@@ -1,16 +0,0 @@
1
- import { Database } from 'sql.js';
2
- import { Adapter, QueryRequest } from '@sqb/connect';
3
- export declare class SqljsConnection implements Adapter.Connection {
4
- private _onClose;
5
- private intlcon?;
6
- constructor(db: Database, _onClose: Function);
7
- get sessionId(): any;
8
- close(): Promise<void>;
9
- reset(): Promise<void>;
10
- startTransaction(): Promise<void>;
11
- commit(): Promise<void>;
12
- rollback(): Promise<void>;
13
- test(): Promise<void>;
14
- execute(query: QueryRequest): Promise<Adapter.Response>;
15
- private _convertFields;
16
- }
@@ -1,12 +0,0 @@
1
- import { Adapter, RowType } from '@sqb/connect';
2
- export declare class SqljsCursor implements Adapter.Cursor {
3
- private _stmt?;
4
- private readonly _rowType;
5
- constructor(stmt: any, opts: {
6
- rowType: RowType;
7
- });
8
- get isClosed(): boolean;
9
- get rowType(): RowType;
10
- close(): Promise<void>;
11
- fetch(nRows: number): Promise<any[] | undefined>;
12
- }