@mikro-orm/libsql 6.4.7-dev.1 → 7.0.0-dev.1
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/LibSqlConnection.d.ts +6 -3
- package/LibSqlConnection.js +19 -13
- package/LibSqlDialect.d.ts +27 -0
- package/LibSqlDialect.js +112 -0
- package/LibSqlDriver.js +1 -1
- package/LibSqlPlatform.d.ts +0 -4
- package/LibSqlPlatform.js +0 -4
- package/README.md +0 -2
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/index.mjs +10 -15
- package/package.json +7 -5
- package/LibSqlExceptionConverter.d.ts +0 -9
- package/LibSqlExceptionConverter.js +0 -55
- package/LibSqlSchemaHelper.d.ts +0 -3
- package/LibSqlSchemaHelper.js +0 -7
package/LibSqlConnection.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { BaseSqliteConnection, type
|
|
1
|
+
import { BaseSqliteConnection, type Dictionary } from '@mikro-orm/knex';
|
|
2
|
+
import { type Options } from 'libsql';
|
|
3
|
+
import { LibSqlDialect } from './LibSqlDialect';
|
|
2
4
|
export declare class LibSqlConnection extends BaseSqliteConnection {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
private database;
|
|
6
|
+
createKyselyDialect(options: Dictionary & Options): LibSqlDialect;
|
|
7
|
+
loadFile(path: string): Promise<void>;
|
|
5
8
|
}
|
package/LibSqlConnection.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.LibSqlConnection = void 0;
|
|
4
7
|
const knex_1 = require("@mikro-orm/knex");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const libsql_1 = __importDefault(require("libsql"));
|
|
10
|
+
const LibSqlDialect_1 = require("./LibSqlDialect");
|
|
5
11
|
class LibSqlConnection extends knex_1.BaseSqliteConnection {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
connection: {
|
|
14
|
-
filename: this.config.get('dbName'),
|
|
15
|
-
authToken: this.config.get('password'),
|
|
12
|
+
database;
|
|
13
|
+
createKyselyDialect(options) {
|
|
14
|
+
const dbName = options.url ?? this.config.get('dbName');
|
|
15
|
+
options.authToken ??= this.config.get('password');
|
|
16
|
+
return new LibSqlDialect_1.LibSqlDialect({
|
|
17
|
+
database: async () => {
|
|
18
|
+
return this.database = new libsql_1.default(dbName, options);
|
|
16
19
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/* istanbul ignore next */
|
|
24
|
+
async loadFile(path) {
|
|
25
|
+
this.database.exec((await (0, fs_extra_1.readFile)(path)).toString());
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
exports.LibSqlConnection = LibSqlConnection;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type DatabaseConnection, type QueryResult, type SqliteDatabase, SqliteDialect, type SqliteDialectConfig, SqliteDriver } from 'kysely';
|
|
2
|
+
declare class LibSqlConnection implements DatabaseConnection {
|
|
3
|
+
private readonly db;
|
|
4
|
+
private readonly created;
|
|
5
|
+
memory: boolean;
|
|
6
|
+
constructor(db: SqliteDatabase);
|
|
7
|
+
isValid(): boolean;
|
|
8
|
+
executeQuery<R>(compiledQuery: any): Promise<QueryResult<R>>;
|
|
9
|
+
streamQuery<R>(compiledQuery: any): AsyncIterableIterator<QueryResult<R>>;
|
|
10
|
+
}
|
|
11
|
+
declare class LibSqlKyselyDriver extends SqliteDriver {
|
|
12
|
+
private readonly config;
|
|
13
|
+
private db;
|
|
14
|
+
private connection;
|
|
15
|
+
private connectionMutex;
|
|
16
|
+
constructor(config: SqliteDialectConfig);
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
acquireConnection(): Promise<LibSqlConnection>;
|
|
19
|
+
releaseConnection(): Promise<void>;
|
|
20
|
+
destroy(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare class LibSqlDialect extends SqliteDialect {
|
|
23
|
+
private readonly config;
|
|
24
|
+
constructor(config: SqliteDialectConfig);
|
|
25
|
+
createDriver(): LibSqlKyselyDriver;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
package/LibSqlDialect.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LibSqlDialect = void 0;
|
|
4
|
+
const kysely_1 = require("kysely");
|
|
5
|
+
const CONNECTION_TIMEOUT = 10_000;
|
|
6
|
+
class ConnectionMutex {
|
|
7
|
+
#promise;
|
|
8
|
+
#resolve;
|
|
9
|
+
async lock() {
|
|
10
|
+
while (this.#promise) {
|
|
11
|
+
await this.#promise;
|
|
12
|
+
}
|
|
13
|
+
this.#promise = new Promise(resolve => {
|
|
14
|
+
this.#resolve = resolve;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
unlock() {
|
|
18
|
+
const resolve = this.#resolve;
|
|
19
|
+
this.#promise = undefined;
|
|
20
|
+
this.#resolve = undefined;
|
|
21
|
+
resolve?.();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class LibSqlConnection {
|
|
25
|
+
db;
|
|
26
|
+
created = Date.now();
|
|
27
|
+
constructor(db) {
|
|
28
|
+
this.db = db;
|
|
29
|
+
}
|
|
30
|
+
isValid() {
|
|
31
|
+
return this.memory || this.created > Date.now() - CONNECTION_TIMEOUT;
|
|
32
|
+
}
|
|
33
|
+
async executeQuery(compiledQuery) {
|
|
34
|
+
const { sql, parameters } = compiledQuery;
|
|
35
|
+
const stmt = this.db.prepare(sql);
|
|
36
|
+
if (stmt.reader) {
|
|
37
|
+
return {
|
|
38
|
+
rows: stmt.all(parameters),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const query = sql.trim().toLowerCase();
|
|
42
|
+
/* istanbul ignore next */
|
|
43
|
+
if (query.startsWith('select') || ((query.startsWith('insert into') || query.startsWith('update ')) && query.includes(' returning '))) {
|
|
44
|
+
return {
|
|
45
|
+
rows: stmt.all(parameters),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const { changes, lastInsertRowid } = stmt.run(parameters);
|
|
49
|
+
return {
|
|
50
|
+
numAffectedRows: changes,
|
|
51
|
+
insertId: lastInsertRowid,
|
|
52
|
+
rows: [],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/* istanbul ignore next */
|
|
56
|
+
async *streamQuery(compiledQuery) {
|
|
57
|
+
const { sql, parameters } = compiledQuery;
|
|
58
|
+
const stmt = this.db.prepare(sql);
|
|
59
|
+
if (!sql.toLowerCase().startsWith('select')) {
|
|
60
|
+
throw new Error('Sqlite driver only supports streaming of select queries');
|
|
61
|
+
}
|
|
62
|
+
for (const row of stmt.iterate(parameters)) {
|
|
63
|
+
yield {
|
|
64
|
+
rows: [row],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class LibSqlKyselyDriver extends kysely_1.SqliteDriver {
|
|
70
|
+
config;
|
|
71
|
+
db;
|
|
72
|
+
connection;
|
|
73
|
+
connectionMutex = new ConnectionMutex();
|
|
74
|
+
constructor(config) {
|
|
75
|
+
super(config);
|
|
76
|
+
this.config = config;
|
|
77
|
+
}
|
|
78
|
+
async init() {
|
|
79
|
+
this.db = await this.config.database();
|
|
80
|
+
this.connection = new LibSqlConnection(this.db);
|
|
81
|
+
/* istanbul ignore next */
|
|
82
|
+
if (this.config.onCreateConnection) {
|
|
83
|
+
await this.config.onCreateConnection(this.connection);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async acquireConnection() {
|
|
87
|
+
await this.connectionMutex.lock();
|
|
88
|
+
/* istanbul ignore next */
|
|
89
|
+
if (!this.connection.isValid()) {
|
|
90
|
+
await this.destroy();
|
|
91
|
+
await this.init();
|
|
92
|
+
}
|
|
93
|
+
return this.connection;
|
|
94
|
+
}
|
|
95
|
+
async releaseConnection() {
|
|
96
|
+
this.connectionMutex.unlock();
|
|
97
|
+
}
|
|
98
|
+
async destroy() {
|
|
99
|
+
this.db.close();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
class LibSqlDialect extends kysely_1.SqliteDialect {
|
|
103
|
+
config;
|
|
104
|
+
constructor(config) {
|
|
105
|
+
super(config);
|
|
106
|
+
this.config = config;
|
|
107
|
+
}
|
|
108
|
+
createDriver() {
|
|
109
|
+
return new LibSqlKyselyDriver(this.config);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.LibSqlDialect = LibSqlDialect;
|
package/LibSqlDriver.js
CHANGED
|
@@ -6,7 +6,7 @@ const LibSqlConnection_1 = require("./LibSqlConnection");
|
|
|
6
6
|
const LibSqlPlatform_1 = require("./LibSqlPlatform");
|
|
7
7
|
class LibSqlDriver extends knex_1.AbstractSqlDriver {
|
|
8
8
|
constructor(config) {
|
|
9
|
-
super(config, new LibSqlPlatform_1.LibSqlPlatform(), LibSqlConnection_1.LibSqlConnection, ['
|
|
9
|
+
super(config, new LibSqlPlatform_1.LibSqlPlatform(), LibSqlConnection_1.LibSqlConnection, ['kysely', 'libsql']);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.LibSqlDriver = LibSqlDriver;
|
package/LibSqlPlatform.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { BaseSqlitePlatform } from '@mikro-orm/knex';
|
|
2
|
-
import { LibSqlSchemaHelper } from './LibSqlSchemaHelper';
|
|
3
|
-
import { LibSqlExceptionConverter } from './LibSqlExceptionConverter';
|
|
4
2
|
export declare class LibSqlPlatform extends BaseSqlitePlatform {
|
|
5
|
-
protected readonly schemaHelper: LibSqlSchemaHelper;
|
|
6
|
-
protected readonly exceptionConverter: LibSqlExceptionConverter;
|
|
7
3
|
escape(value: any): string;
|
|
8
4
|
}
|
package/LibSqlPlatform.js
CHANGED
|
@@ -4,11 +4,7 @@ exports.LibSqlPlatform = void 0;
|
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
const sqlstring_sqlite_1 = require("sqlstring-sqlite");
|
|
6
6
|
const knex_1 = require("@mikro-orm/knex");
|
|
7
|
-
const LibSqlSchemaHelper_1 = require("./LibSqlSchemaHelper");
|
|
8
|
-
const LibSqlExceptionConverter_1 = require("./LibSqlExceptionConverter");
|
|
9
7
|
class LibSqlPlatform extends knex_1.BaseSqlitePlatform {
|
|
10
|
-
schemaHelper = new LibSqlSchemaHelper_1.LibSqlSchemaHelper(this);
|
|
11
|
-
exceptionConverter = new LibSqlExceptionConverter_1.LibSqlExceptionConverter();
|
|
12
8
|
escape(value) {
|
|
13
9
|
return (0, sqlstring_sqlite_1.escape)(value, true, this.timezone);
|
|
14
10
|
}
|
package/README.md
CHANGED
|
@@ -183,7 +183,6 @@ yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
|
|
|
183
183
|
yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
|
|
184
184
|
yarn add @mikro-orm/core @mikro-orm/mssql # for mssql
|
|
185
185
|
yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
|
|
186
|
-
yarn add @mikro-orm/core @mikro-orm/better-sqlite # for better-sqlite
|
|
187
186
|
yarn add @mikro-orm/core @mikro-orm/libsql # for libsql
|
|
188
187
|
```
|
|
189
188
|
|
|
@@ -196,7 +195,6 @@ npm i -s @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
|
|
|
196
195
|
npm i -s @mikro-orm/core @mikro-orm/postgresql # for postgresql
|
|
197
196
|
npm i -s @mikro-orm/core @mikro-orm/mssql # for mssql
|
|
198
197
|
npm i -s @mikro-orm/core @mikro-orm/sqlite # for sqlite
|
|
199
|
-
npm i -s @mikro-orm/core @mikro-orm/better-sqlite # for better-sqlite
|
|
200
198
|
npm i -s @mikro-orm/core @mikro-orm/libsql # for libsql
|
|
201
199
|
```
|
|
202
200
|
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,4 @@ export * from '@mikro-orm/knex';
|
|
|
2
2
|
export * from './LibSqlConnection';
|
|
3
3
|
export * from './LibSqlDriver';
|
|
4
4
|
export * from './LibSqlPlatform';
|
|
5
|
-
export * from './LibSqlSchemaHelper';
|
|
6
|
-
export * from './LibSqlExceptionConverter';
|
|
7
5
|
export { LibSqlMikroORM as MikroORM, LibSqlOptions as Options, defineLibSqlConfig as defineConfig, } from './LibSqlMikroORM';
|
package/index.js
CHANGED
|
@@ -20,8 +20,6 @@ __exportStar(require("@mikro-orm/knex"), exports);
|
|
|
20
20
|
__exportStar(require("./LibSqlConnection"), exports);
|
|
21
21
|
__exportStar(require("./LibSqlDriver"), exports);
|
|
22
22
|
__exportStar(require("./LibSqlPlatform"), exports);
|
|
23
|
-
__exportStar(require("./LibSqlSchemaHelper"), exports);
|
|
24
|
-
__exportStar(require("./LibSqlExceptionConverter"), exports);
|
|
25
23
|
var LibSqlMikroORM_1 = require("./LibSqlMikroORM");
|
|
26
24
|
Object.defineProperty(exports, "MikroORM", { enumerable: true, get: function () { return LibSqlMikroORM_1.LibSqlMikroORM; } });
|
|
27
25
|
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return LibSqlMikroORM_1.defineLibSqlConfig; } });
|
package/index.mjs
CHANGED
|
@@ -19,12 +19,10 @@ export const ArrayType = mod.ArrayType;
|
|
|
19
19
|
export const BaseEntity = mod.BaseEntity;
|
|
20
20
|
export const BaseSqliteConnection = mod.BaseSqliteConnection;
|
|
21
21
|
export const BaseSqlitePlatform = mod.BaseSqlitePlatform;
|
|
22
|
-
export const BaseSqliteSchemaHelper = mod.BaseSqliteSchemaHelper;
|
|
23
22
|
export const BeforeCreate = mod.BeforeCreate;
|
|
24
23
|
export const BeforeDelete = mod.BeforeDelete;
|
|
25
24
|
export const BeforeUpdate = mod.BeforeUpdate;
|
|
26
25
|
export const BeforeUpsert = mod.BeforeUpsert;
|
|
27
|
-
export const BetterSqliteKnexDialect = mod.BetterSqliteKnexDialect;
|
|
28
26
|
export const BigIntType = mod.BigIntType;
|
|
29
27
|
export const BlobType = mod.BlobType;
|
|
30
28
|
export const BooleanType = mod.BooleanType;
|
|
@@ -112,19 +110,15 @@ export const JSON_KEY_OPERATORS = mod.JSON_KEY_OPERATORS;
|
|
|
112
110
|
export const JoinType = mod.JoinType;
|
|
113
111
|
export const JsonProperty = mod.JsonProperty;
|
|
114
112
|
export const JsonType = mod.JsonType;
|
|
115
|
-
export const
|
|
113
|
+
export const Kysely = mod.Kysely;
|
|
116
114
|
export const LibSqlConnection = mod.LibSqlConnection;
|
|
117
115
|
export const LibSqlDriver = mod.LibSqlDriver;
|
|
118
|
-
export const LibSqlExceptionConverter = mod.LibSqlExceptionConverter;
|
|
119
|
-
export const LibSqlKnexDialect = mod.LibSqlKnexDialect;
|
|
120
116
|
export const LibSqlPlatform = mod.LibSqlPlatform;
|
|
121
|
-
export const LibSqlSchemaHelper = mod.LibSqlSchemaHelper;
|
|
122
117
|
export const LoadStrategy = mod.LoadStrategy;
|
|
123
118
|
export const LockMode = mod.LockMode;
|
|
124
119
|
export const LockWaitTimeoutException = mod.LockWaitTimeoutException;
|
|
125
120
|
export const ManyToMany = mod.ManyToMany;
|
|
126
121
|
export const ManyToOne = mod.ManyToOne;
|
|
127
|
-
export const MariaDbKnexDialect = mod.MariaDbKnexDialect;
|
|
128
122
|
export const MediumIntType = mod.MediumIntType;
|
|
129
123
|
export const MemoryCacheAdapter = mod.MemoryCacheAdapter;
|
|
130
124
|
export const MetadataDiscovery = mod.MetadataDiscovery;
|
|
@@ -134,13 +128,12 @@ export const MetadataStorage = mod.MetadataStorage;
|
|
|
134
128
|
export const MetadataValidator = mod.MetadataValidator;
|
|
135
129
|
export const MikroORM = mod.MikroORM;
|
|
136
130
|
export const MongoNamingStrategy = mod.MongoNamingStrategy;
|
|
137
|
-
export const
|
|
138
|
-
export const MsSqlKnexDialect = mod.MsSqlKnexDialect;
|
|
139
|
-
export const MySqlConnection = mod.MySqlConnection;
|
|
131
|
+
export const MsSqlNativeQueryBuilder = mod.MsSqlNativeQueryBuilder;
|
|
140
132
|
export const MySqlExceptionConverter = mod.MySqlExceptionConverter;
|
|
141
|
-
export const
|
|
133
|
+
export const MySqlNativeQueryBuilder = mod.MySqlNativeQueryBuilder;
|
|
142
134
|
export const MySqlPlatform = mod.MySqlPlatform;
|
|
143
135
|
export const MySqlSchemaHelper = mod.MySqlSchemaHelper;
|
|
136
|
+
export const NativeQueryBuilder = mod.NativeQueryBuilder;
|
|
144
137
|
export const NodeState = mod.NodeState;
|
|
145
138
|
export const NonUniqueFieldNameException = mod.NonUniqueFieldNameException;
|
|
146
139
|
export const NotFoundError = mod.NotFoundError;
|
|
@@ -160,7 +153,7 @@ export const PlainObject = mod.PlainObject;
|
|
|
160
153
|
export const Platform = mod.Platform;
|
|
161
154
|
export const PopulateHint = mod.PopulateHint;
|
|
162
155
|
export const PopulatePath = mod.PopulatePath;
|
|
163
|
-
export const
|
|
156
|
+
export const PostgreSqlNativeQueryBuilder = mod.PostgreSqlNativeQueryBuilder;
|
|
164
157
|
export const PrimaryKey = mod.PrimaryKey;
|
|
165
158
|
export const PrimaryKeyProp = mod.PrimaryKeyProp;
|
|
166
159
|
export const Property = mod.Property;
|
|
@@ -172,6 +165,7 @@ export const QueryOperator = mod.QueryOperator;
|
|
|
172
165
|
export const QueryOrder = mod.QueryOrder;
|
|
173
166
|
export const QueryOrderNumeric = mod.QueryOrderNumeric;
|
|
174
167
|
export const QueryType = mod.QueryType;
|
|
168
|
+
export const Raw = mod.Raw;
|
|
175
169
|
export const RawQueryFragment = mod.RawQueryFragment;
|
|
176
170
|
export const ReadOnlyException = mod.ReadOnlyException;
|
|
177
171
|
export const Ref = mod.Ref;
|
|
@@ -193,8 +187,9 @@ export const SmallIntType = mod.SmallIntType;
|
|
|
193
187
|
export const SqlEntityManager = mod.SqlEntityManager;
|
|
194
188
|
export const SqlEntityRepository = mod.SqlEntityRepository;
|
|
195
189
|
export const SqlSchemaGenerator = mod.SqlSchemaGenerator;
|
|
196
|
-
export const
|
|
197
|
-
export const
|
|
190
|
+
export const SqliteExceptionConverter = mod.SqliteExceptionConverter;
|
|
191
|
+
export const SqliteNativeQueryBuilder = mod.SqliteNativeQueryBuilder;
|
|
192
|
+
export const SqliteSchemaHelper = mod.SqliteSchemaHelper;
|
|
198
193
|
export const StringType = mod.StringType;
|
|
199
194
|
export const SyntaxErrorException = mod.SyntaxErrorException;
|
|
200
195
|
export const TableExistsException = mod.TableExistsException;
|
|
@@ -228,7 +223,7 @@ export const equals = mod.equals;
|
|
|
228
223
|
export const getOnConflictFields = mod.getOnConflictFields;
|
|
229
224
|
export const getOnConflictReturningFields = mod.getOnConflictReturningFields;
|
|
230
225
|
export const helper = mod.helper;
|
|
231
|
-
export const
|
|
226
|
+
export const isRaw = mod.isRaw;
|
|
232
227
|
export const parseJsonSafe = mod.parseJsonSafe;
|
|
233
228
|
export const raw = mod.raw;
|
|
234
229
|
export const ref = mod.ref;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/libsql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-dev.1",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://mikro-orm.io",
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">= 22.11.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "yarn clean && yarn compile && yarn copy && yarn run -T gen-esm-wrapper index.js index.mjs",
|
|
@@ -58,15 +58,17 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "
|
|
61
|
+
"@mikro-orm/knex": "7.0.0-dev.1",
|
|
62
62
|
"fs-extra": "11.3.0",
|
|
63
63
|
"libsql": "0.4.7",
|
|
64
64
|
"sqlstring-sqlite": "0.1.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@mikro-orm/core": "^6.4.
|
|
67
|
+
"@mikro-orm/core": "^6.4.5",
|
|
68
|
+
"kysely": "https://pkg.pr.new/kysely-org/kysely/kysely@2b7007e"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
|
-
"@mikro-orm/core": "
|
|
71
|
+
"@mikro-orm/core": "7.0.0-dev.1",
|
|
72
|
+
"kysely": "*"
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ExceptionConverter, type Dictionary, type DriverException } from '@mikro-orm/core';
|
|
2
|
-
export declare class LibSqlExceptionConverter extends ExceptionConverter {
|
|
3
|
-
/**
|
|
4
|
-
* @inheritDoc
|
|
5
|
-
* @link http://www.sqlite.org/c3ref/c_abort.html
|
|
6
|
-
* @link https://github.com/doctrine/dbal/blob/master/src/Driver/AbstractSQLiteDriver.php
|
|
7
|
-
*/
|
|
8
|
-
convertException(exception: Error & Dictionary): DriverException;
|
|
9
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LibSqlExceptionConverter = void 0;
|
|
4
|
-
const core_1 = require("@mikro-orm/core");
|
|
5
|
-
class LibSqlExceptionConverter extends core_1.ExceptionConverter {
|
|
6
|
-
/* istanbul ignore next */
|
|
7
|
-
/**
|
|
8
|
-
* @inheritDoc
|
|
9
|
-
* @link http://www.sqlite.org/c3ref/c_abort.html
|
|
10
|
-
* @link https://github.com/doctrine/dbal/blob/master/src/Driver/AbstractSQLiteDriver.php
|
|
11
|
-
*/
|
|
12
|
-
convertException(exception) {
|
|
13
|
-
if (exception.message.includes('database is locked')) {
|
|
14
|
-
return new core_1.LockWaitTimeoutException(exception);
|
|
15
|
-
}
|
|
16
|
-
if (exception.message.includes('must be unique') ||
|
|
17
|
-
exception.message.includes('is not unique') ||
|
|
18
|
-
exception.message.includes('are not unique') ||
|
|
19
|
-
exception.message.includes('UNIQUE constraint failed')) {
|
|
20
|
-
return new core_1.UniqueConstraintViolationException(exception);
|
|
21
|
-
}
|
|
22
|
-
if (exception.message.includes('may not be NULL') || exception.message.includes('NOT NULL constraint failed')) {
|
|
23
|
-
return new core_1.NotNullConstraintViolationException(exception);
|
|
24
|
-
}
|
|
25
|
-
if (exception.message.includes('CHECK constraint failed')) {
|
|
26
|
-
return new core_1.CheckConstraintViolationException(exception);
|
|
27
|
-
}
|
|
28
|
-
if (exception.message.includes('no such table:')) {
|
|
29
|
-
return new core_1.TableNotFoundException(exception);
|
|
30
|
-
}
|
|
31
|
-
if (exception.message.includes('already exists')) {
|
|
32
|
-
return new core_1.TableExistsException(exception);
|
|
33
|
-
}
|
|
34
|
-
if (exception.message.includes('no such column:')) {
|
|
35
|
-
return new core_1.InvalidFieldNameException(exception);
|
|
36
|
-
}
|
|
37
|
-
if (exception.message.includes('ambiguous column name')) {
|
|
38
|
-
return new core_1.NonUniqueFieldNameException(exception);
|
|
39
|
-
}
|
|
40
|
-
if (exception.message.includes('syntax error')) {
|
|
41
|
-
return new core_1.SyntaxErrorException(exception);
|
|
42
|
-
}
|
|
43
|
-
if (exception.message.includes('attempt to write a readonly database')) {
|
|
44
|
-
return new core_1.ReadOnlyException(exception);
|
|
45
|
-
}
|
|
46
|
-
if (exception.message.includes('unable to open database file')) {
|
|
47
|
-
return new core_1.ConnectionException(exception);
|
|
48
|
-
}
|
|
49
|
-
if (exception.message.includes('FOREIGN KEY constraint failed')) {
|
|
50
|
-
return new core_1.ForeignKeyConstraintViolationException(exception);
|
|
51
|
-
}
|
|
52
|
-
return super.convertException(exception);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.LibSqlExceptionConverter = LibSqlExceptionConverter;
|
package/LibSqlSchemaHelper.d.ts
DELETED
package/LibSqlSchemaHelper.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LibSqlSchemaHelper = void 0;
|
|
4
|
-
const knex_1 = require("@mikro-orm/knex");
|
|
5
|
-
class LibSqlSchemaHelper extends knex_1.BaseSqliteSchemaHelper {
|
|
6
|
-
}
|
|
7
|
-
exports.LibSqlSchemaHelper = LibSqlSchemaHelper;
|