@h-ai/reldb 0.1.0-alpha.58 → 0.1.0-alpha.60
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/dist/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { core, ok, err } from '@h-ai/core';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
3
|
import { createRequire } from 'module';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
5
|
import { Worker } from 'worker_threads';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
7
|
+
// src/reldb-config.ts
|
|
13
8
|
var ReldbTypeSchema = z.enum(["sqlite", "postgresql", "mysql"]);
|
|
14
9
|
var ReldbOperationLogConfigSchema = z.object({
|
|
15
10
|
read: z.boolean().default(false),
|
|
@@ -1949,7 +1944,7 @@ function createMysqlProvider() {
|
|
|
1949
1944
|
return err(HaiReldbError.UNSUPPORTED_TYPE, reldbM("reldb_mysqlOnlyMysql"));
|
|
1950
1945
|
}
|
|
1951
1946
|
try {
|
|
1952
|
-
const mysql =
|
|
1947
|
+
const mysql = createRequire(import.meta.url)("mysql2/promise");
|
|
1953
1948
|
pool = mysql.createPool({
|
|
1954
1949
|
uri: config.url,
|
|
1955
1950
|
host: config.host,
|
|
@@ -2289,7 +2284,7 @@ function createPostgresProvider() {
|
|
|
2289
2284
|
return err(HaiReldbError.UNSUPPORTED_TYPE, reldbM("reldb_postgresOnlyPostgresql"));
|
|
2290
2285
|
}
|
|
2291
2286
|
try {
|
|
2292
|
-
const { Pool } =
|
|
2287
|
+
const { Pool } = createRequire(import.meta.url)("pg");
|
|
2293
2288
|
pool = new Pool({
|
|
2294
2289
|
connectionString: config.url,
|
|
2295
2290
|
host: config.host,
|