drizzle-orm 0.31.0 → 0.31.1-26a7171
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/package.json +55 -2
- package/tidb-serverless/driver.cjs +56 -0
- package/tidb-serverless/driver.cjs.map +1 -0
- package/tidb-serverless/driver.d.cts +10 -0
- package/tidb-serverless/driver.d.ts +10 -0
- package/tidb-serverless/driver.js +35 -0
- package/tidb-serverless/driver.js.map +1 -0
- package/tidb-serverless/index.cjs +25 -0
- package/tidb-serverless/index.cjs.map +1 -0
- package/tidb-serverless/index.d.cts +2 -0
- package/tidb-serverless/index.d.ts +2 -0
- package/tidb-serverless/index.js +3 -0
- package/tidb-serverless/index.js.map +1 -0
- package/tidb-serverless/migrator.cjs +33 -0
- package/tidb-serverless/migrator.cjs.map +1 -0
- package/tidb-serverless/migrator.d.cts +3 -0
- package/tidb-serverless/migrator.d.ts +3 -0
- package/tidb-serverless/migrator.js +9 -0
- package/tidb-serverless/migrator.js.map +1 -0
- package/tidb-serverless/session.cjs +136 -0
- package/tidb-serverless/session.cjs.map +1 -0
- package/tidb-serverless/session.d.cts +47 -0
- package/tidb-serverless/session.d.ts +47 -0
- package/tidb-serverless/session.js +114 -0
- package/tidb-serverless/session.js.map +1 -0
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-orm",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1-26a7171",
|
|
4
4
|
"description": "Drizzle ORM package for SQL databases",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"postgres": ">=3",
|
|
68
68
|
"react": ">=18",
|
|
69
69
|
"sql.js": ">=1",
|
|
70
|
-
"sqlite3": ">=5"
|
|
70
|
+
"sqlite3": ">=5",
|
|
71
|
+
"@tidbcloud/serverless": "*"
|
|
71
72
|
},
|
|
72
73
|
"peerDependenciesMeta": {
|
|
73
74
|
"mysql2": {
|
|
@@ -144,6 +145,9 @@
|
|
|
144
145
|
},
|
|
145
146
|
"@electric-sql/pglite": {
|
|
146
147
|
"optional": true
|
|
148
|
+
},
|
|
149
|
+
"@tidbcloud/serverless": {
|
|
150
|
+
"optional": true
|
|
147
151
|
}
|
|
148
152
|
},
|
|
149
153
|
"devDependencies": {
|
|
@@ -156,6 +160,7 @@
|
|
|
156
160
|
"@opentelemetry/api": "^1.4.1",
|
|
157
161
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
158
162
|
"@planetscale/database": "^1.16.0",
|
|
163
|
+
"@tidbcloud/serverless": "^0.1.1",
|
|
159
164
|
"@types/better-sqlite3": "^7.6.4",
|
|
160
165
|
"@types/node": "^20.2.5",
|
|
161
166
|
"@types/pg": "^8.10.1",
|
|
@@ -1995,6 +2000,54 @@
|
|
|
1995
2000
|
"types": "./sqlite-proxy/session.d.ts",
|
|
1996
2001
|
"default": "./sqlite-proxy/session.js"
|
|
1997
2002
|
},
|
|
2003
|
+
"./tidb-serverless/driver": {
|
|
2004
|
+
"import": {
|
|
2005
|
+
"types": "./tidb-serverless/driver.d.ts",
|
|
2006
|
+
"default": "./tidb-serverless/driver.js"
|
|
2007
|
+
},
|
|
2008
|
+
"require": {
|
|
2009
|
+
"types": "./tidb-serverless/driver.d.cts",
|
|
2010
|
+
"default": "./tidb-serverless/driver.cjs"
|
|
2011
|
+
},
|
|
2012
|
+
"types": "./tidb-serverless/driver.d.ts",
|
|
2013
|
+
"default": "./tidb-serverless/driver.js"
|
|
2014
|
+
},
|
|
2015
|
+
"./tidb-serverless": {
|
|
2016
|
+
"import": {
|
|
2017
|
+
"types": "./tidb-serverless/index.d.ts",
|
|
2018
|
+
"default": "./tidb-serverless/index.js"
|
|
2019
|
+
},
|
|
2020
|
+
"require": {
|
|
2021
|
+
"types": "./tidb-serverless/index.d.cts",
|
|
2022
|
+
"default": "./tidb-serverless/index.cjs"
|
|
2023
|
+
},
|
|
2024
|
+
"types": "./tidb-serverless/index.d.ts",
|
|
2025
|
+
"default": "./tidb-serverless/index.js"
|
|
2026
|
+
},
|
|
2027
|
+
"./tidb-serverless/migrator": {
|
|
2028
|
+
"import": {
|
|
2029
|
+
"types": "./tidb-serverless/migrator.d.ts",
|
|
2030
|
+
"default": "./tidb-serverless/migrator.js"
|
|
2031
|
+
},
|
|
2032
|
+
"require": {
|
|
2033
|
+
"types": "./tidb-serverless/migrator.d.cts",
|
|
2034
|
+
"default": "./tidb-serverless/migrator.cjs"
|
|
2035
|
+
},
|
|
2036
|
+
"types": "./tidb-serverless/migrator.d.ts",
|
|
2037
|
+
"default": "./tidb-serverless/migrator.js"
|
|
2038
|
+
},
|
|
2039
|
+
"./tidb-serverless/session": {
|
|
2040
|
+
"import": {
|
|
2041
|
+
"types": "./tidb-serverless/session.d.ts",
|
|
2042
|
+
"default": "./tidb-serverless/session.js"
|
|
2043
|
+
},
|
|
2044
|
+
"require": {
|
|
2045
|
+
"types": "./tidb-serverless/session.d.cts",
|
|
2046
|
+
"default": "./tidb-serverless/session.cjs"
|
|
2047
|
+
},
|
|
2048
|
+
"types": "./tidb-serverless/session.d.ts",
|
|
2049
|
+
"default": "./tidb-serverless/session.js"
|
|
2050
|
+
},
|
|
1998
2051
|
"./vercel-postgres/driver": {
|
|
1999
2052
|
"import": {
|
|
2000
2053
|
"types": "./vercel-postgres/driver.d.ts",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var driver_exports = {};
|
|
20
|
+
__export(driver_exports, {
|
|
21
|
+
drizzle: () => drizzle
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(driver_exports);
|
|
24
|
+
var import_logger = require("../logger.cjs");
|
|
25
|
+
var import_db = require("../mysql-core/db.cjs");
|
|
26
|
+
var import_dialect = require("../mysql-core/dialect.cjs");
|
|
27
|
+
var import_relations = require("../relations.cjs");
|
|
28
|
+
var import_session = require("./session.cjs");
|
|
29
|
+
function drizzle(client, config = {}) {
|
|
30
|
+
const dialect = new import_dialect.MySqlDialect();
|
|
31
|
+
let logger;
|
|
32
|
+
if (config.logger === true) {
|
|
33
|
+
logger = new import_logger.DefaultLogger();
|
|
34
|
+
} else if (config.logger !== false) {
|
|
35
|
+
logger = config.logger;
|
|
36
|
+
}
|
|
37
|
+
let schema;
|
|
38
|
+
if (config.schema) {
|
|
39
|
+
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(
|
|
40
|
+
config.schema,
|
|
41
|
+
import_relations.createTableRelationsHelpers
|
|
42
|
+
);
|
|
43
|
+
schema = {
|
|
44
|
+
fullSchema: config.schema,
|
|
45
|
+
schema: tablesConfig.tables,
|
|
46
|
+
tableNamesMap: tablesConfig.tableNamesMap
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const session = new import_session.TiDBServerlessSession(client, dialect, void 0, schema, { logger });
|
|
50
|
+
return new import_db.MySqlDatabase(dialect, session, schema, "default");
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
drizzle
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=driver.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/driver.ts"],"sourcesContent":["import type { Connection } from '@tidbcloud/serverless';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport {\n\tcreateTableRelationsHelpers,\n\textractTablesRelationalConfig,\n\ttype RelationalSchemaConfig,\n\ttype TablesRelationalConfig,\n} from '~/relations.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { TiDBServerlessPreparedQueryHKT, TiDBServerlessQueryResultHKT } from './session.ts';\nimport { TiDBServerlessSession } from './session.ts';\n\nexport interface TiDBServerlessSDriverOptions {\n\tlogger?: Logger;\n}\n\nexport type TiDBServerlessDatabase<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n> = MySqlDatabase<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TSchema>;\n\nexport function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(\n\tclient: Connection,\n\tconfig: DrizzleConfig<TSchema> = {},\n): TiDBServerlessDatabase<TSchema> {\n\tconst dialect = new MySqlDialect();\n\tlet logger;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\tlet schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined;\n\tif (config.schema) {\n\t\tconst tablesConfig = extractTablesRelationalConfig(\n\t\t\tconfig.schema,\n\t\t\tcreateTableRelationsHelpers,\n\t\t);\n\t\tschema = {\n\t\t\tfullSchema: config.schema,\n\t\t\tschema: tablesConfig.tables,\n\t\t\ttableNamesMap: tablesConfig.tableNamesMap,\n\t\t};\n\t}\n\n\tconst session = new TiDBServerlessSession(client, dialect, undefined, schema, { logger });\n\treturn new MySqlDatabase(dialect, session, schema, 'default') as TiDBServerlessDatabase<TSchema>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA8B;AAC9B,gBAA8B;AAC9B,qBAA6B;AAC7B,uBAKO;AAGP,qBAAsC;AAU/B,SAAS,QACf,QACA,SAAiC,CAAC,GACA;AAClC,QAAM,UAAU,IAAI,4BAAa;AACjC,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,4BAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,MAAI;AACJ,MAAI,OAAO,QAAQ;AAClB,UAAM,mBAAe;AAAA,MACpB,OAAO;AAAA,MACP;AAAA,IACD;AACA,aAAS;AAAA,MACR,YAAY,OAAO;AAAA,MACnB,QAAQ,aAAa;AAAA,MACrB,eAAe,aAAa;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,UAAU,IAAI,qCAAsB,QAAQ,SAAS,QAAW,QAAQ,EAAE,OAAO,CAAC;AACxF,SAAO,IAAI,wBAAc,SAAS,SAAS,QAAQ,SAAS;AAC7D;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection } from '@tidbcloud/serverless';
|
|
2
|
+
import type { Logger } from "../logger.cjs";
|
|
3
|
+
import { MySqlDatabase } from "../mysql-core/db.cjs";
|
|
4
|
+
import type { DrizzleConfig } from "../utils.cjs";
|
|
5
|
+
import type { TiDBServerlessPreparedQueryHKT, TiDBServerlessQueryResultHKT } from "./session.cjs";
|
|
6
|
+
export interface TiDBServerlessSDriverOptions {
|
|
7
|
+
logger?: Logger;
|
|
8
|
+
}
|
|
9
|
+
export type TiDBServerlessDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = MySqlDatabase<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TSchema>;
|
|
10
|
+
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Connection, config?: DrizzleConfig<TSchema>): TiDBServerlessDatabase<TSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection } from '@tidbcloud/serverless';
|
|
2
|
+
import type { Logger } from "../logger.js";
|
|
3
|
+
import { MySqlDatabase } from "../mysql-core/db.js";
|
|
4
|
+
import type { DrizzleConfig } from "../utils.js";
|
|
5
|
+
import type { TiDBServerlessPreparedQueryHKT, TiDBServerlessQueryResultHKT } from "./session.js";
|
|
6
|
+
export interface TiDBServerlessSDriverOptions {
|
|
7
|
+
logger?: Logger;
|
|
8
|
+
}
|
|
9
|
+
export type TiDBServerlessDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = MySqlDatabase<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TSchema>;
|
|
10
|
+
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Connection, config?: DrizzleConfig<TSchema>): TiDBServerlessDatabase<TSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DefaultLogger } from "../logger.js";
|
|
2
|
+
import { MySqlDatabase } from "../mysql-core/db.js";
|
|
3
|
+
import { MySqlDialect } from "../mysql-core/dialect.js";
|
|
4
|
+
import {
|
|
5
|
+
createTableRelationsHelpers,
|
|
6
|
+
extractTablesRelationalConfig
|
|
7
|
+
} from "../relations.js";
|
|
8
|
+
import { TiDBServerlessSession } from "./session.js";
|
|
9
|
+
function drizzle(client, config = {}) {
|
|
10
|
+
const dialect = new MySqlDialect();
|
|
11
|
+
let logger;
|
|
12
|
+
if (config.logger === true) {
|
|
13
|
+
logger = new DefaultLogger();
|
|
14
|
+
} else if (config.logger !== false) {
|
|
15
|
+
logger = config.logger;
|
|
16
|
+
}
|
|
17
|
+
let schema;
|
|
18
|
+
if (config.schema) {
|
|
19
|
+
const tablesConfig = extractTablesRelationalConfig(
|
|
20
|
+
config.schema,
|
|
21
|
+
createTableRelationsHelpers
|
|
22
|
+
);
|
|
23
|
+
schema = {
|
|
24
|
+
fullSchema: config.schema,
|
|
25
|
+
schema: tablesConfig.tables,
|
|
26
|
+
tableNamesMap: tablesConfig.tableNamesMap
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const session = new TiDBServerlessSession(client, dialect, void 0, schema, { logger });
|
|
30
|
+
return new MySqlDatabase(dialect, session, schema, "default");
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
drizzle
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/driver.ts"],"sourcesContent":["import type { Connection } from '@tidbcloud/serverless';\nimport type { Logger } from '~/logger.ts';\nimport { DefaultLogger } from '~/logger.ts';\nimport { MySqlDatabase } from '~/mysql-core/db.ts';\nimport { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport {\n\tcreateTableRelationsHelpers,\n\textractTablesRelationalConfig,\n\ttype RelationalSchemaConfig,\n\ttype TablesRelationalConfig,\n} from '~/relations.ts';\nimport type { DrizzleConfig } from '~/utils.ts';\nimport type { TiDBServerlessPreparedQueryHKT, TiDBServerlessQueryResultHKT } from './session.ts';\nimport { TiDBServerlessSession } from './session.ts';\n\nexport interface TiDBServerlessSDriverOptions {\n\tlogger?: Logger;\n}\n\nexport type TiDBServerlessDatabase<\n\tTSchema extends Record<string, unknown> = Record<string, never>,\n> = MySqlDatabase<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TSchema>;\n\nexport function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(\n\tclient: Connection,\n\tconfig: DrizzleConfig<TSchema> = {},\n): TiDBServerlessDatabase<TSchema> {\n\tconst dialect = new MySqlDialect();\n\tlet logger;\n\tif (config.logger === true) {\n\t\tlogger = new DefaultLogger();\n\t} else if (config.logger !== false) {\n\t\tlogger = config.logger;\n\t}\n\n\tlet schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined;\n\tif (config.schema) {\n\t\tconst tablesConfig = extractTablesRelationalConfig(\n\t\t\tconfig.schema,\n\t\t\tcreateTableRelationsHelpers,\n\t\t);\n\t\tschema = {\n\t\t\tfullSchema: config.schema,\n\t\t\tschema: tablesConfig.tables,\n\t\t\ttableNamesMap: tablesConfig.tableNamesMap,\n\t\t};\n\t}\n\n\tconst session = new TiDBServerlessSession(client, dialect, undefined, schema, { logger });\n\treturn new MySqlDatabase(dialect, session, schema, 'default') as TiDBServerlessDatabase<TSchema>;\n}\n"],"mappings":"AAEA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAGP,SAAS,6BAA6B;AAU/B,SAAS,QACf,QACA,SAAiC,CAAC,GACA;AAClC,QAAM,UAAU,IAAI,aAAa;AACjC,MAAI;AACJ,MAAI,OAAO,WAAW,MAAM;AAC3B,aAAS,IAAI,cAAc;AAAA,EAC5B,WAAW,OAAO,WAAW,OAAO;AACnC,aAAS,OAAO;AAAA,EACjB;AAEA,MAAI;AACJ,MAAI,OAAO,QAAQ;AAClB,UAAM,eAAe;AAAA,MACpB,OAAO;AAAA,MACP;AAAA,IACD;AACA,aAAS;AAAA,MACR,YAAY,OAAO;AAAA,MACnB,QAAQ,aAAa;AAAA,MACrB,eAAe,aAAa;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,UAAU,IAAI,sBAAsB,QAAQ,SAAS,QAAW,QAAQ,EAAE,OAAO,CAAC;AACxF,SAAO,IAAI,cAAc,SAAS,SAAS,QAAQ,SAAS;AAC7D;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var tidb_serverless_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(tidb_serverless_exports);
|
|
18
|
+
__reExport(tidb_serverless_exports, require("./driver.cjs"), module.exports);
|
|
19
|
+
__reExport(tidb_serverless_exports, require("./session.cjs"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./driver.cjs"),
|
|
23
|
+
...require("./session.cjs")
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oCAAc,wBAAd;AACA,oCAAc,yBADd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var migrator_exports = {};
|
|
20
|
+
__export(migrator_exports, {
|
|
21
|
+
migrate: () => migrate
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(migrator_exports);
|
|
24
|
+
var import_migrator = require("../migrator.cjs");
|
|
25
|
+
async function migrate(db, config) {
|
|
26
|
+
const migrations = (0, import_migrator.readMigrationFiles)(config);
|
|
27
|
+
await db.dialect.migrate(migrations, db.session, config);
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
migrate
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=migrator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { TiDBServerlessDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: TiDBServerlessDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAGnC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAC5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readMigrationFiles } from "../migrator.js";
|
|
2
|
+
async function migrate(db, config) {
|
|
3
|
+
const migrations = readMigrationFiles(config);
|
|
4
|
+
await db.dialect.migrate(migrations, db.session, config);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
migrate
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=migrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { TiDBServerlessDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: TiDBServerlessDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAGnC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,aAAa,mBAAmB,MAAM;AAC5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var session_exports = {};
|
|
20
|
+
__export(session_exports, {
|
|
21
|
+
TiDBServerlessPreparedQuery: () => TiDBServerlessPreparedQuery,
|
|
22
|
+
TiDBServerlessSession: () => TiDBServerlessSession,
|
|
23
|
+
TiDBServerlessTransaction: () => TiDBServerlessTransaction
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(session_exports);
|
|
26
|
+
var import_entity = require("../entity.cjs");
|
|
27
|
+
var import_logger = require("../logger.cjs");
|
|
28
|
+
var import_session = require("../mysql-core/session.cjs");
|
|
29
|
+
var import_sql = require("../sql/sql.cjs");
|
|
30
|
+
var import_utils = require("../utils.cjs");
|
|
31
|
+
const executeRawConfig = { fullResult: true };
|
|
32
|
+
const queryConfig = { arrayMode: true };
|
|
33
|
+
class TiDBServerlessPreparedQuery extends import_session.PreparedQuery {
|
|
34
|
+
constructor(client, queryString, params, logger, fields, customResultMapper) {
|
|
35
|
+
super();
|
|
36
|
+
this.client = client;
|
|
37
|
+
this.queryString = queryString;
|
|
38
|
+
this.params = params;
|
|
39
|
+
this.logger = logger;
|
|
40
|
+
this.fields = fields;
|
|
41
|
+
this.customResultMapper = customResultMapper;
|
|
42
|
+
}
|
|
43
|
+
static [import_entity.entityKind] = "TiDBPreparedQuery";
|
|
44
|
+
async execute(placeholderValues = {}) {
|
|
45
|
+
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
|
46
|
+
this.logger.logQuery(this.queryString, params);
|
|
47
|
+
const { fields, client, queryString, joinsNotNullableMap, customResultMapper } = this;
|
|
48
|
+
if (!fields && !customResultMapper) {
|
|
49
|
+
return client.execute(queryString, params, executeRawConfig);
|
|
50
|
+
}
|
|
51
|
+
const rows = await client.execute(queryString, params, queryConfig);
|
|
52
|
+
if (customResultMapper) {
|
|
53
|
+
return customResultMapper(rows);
|
|
54
|
+
}
|
|
55
|
+
return rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
|
|
56
|
+
}
|
|
57
|
+
iterator(_placeholderValues) {
|
|
58
|
+
throw new Error("Streaming is not supported by the TiDB Cloud Serverless driver");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class TiDBServerlessSession extends import_session.MySqlSession {
|
|
62
|
+
constructor(baseClient, dialect, tx, schema, options = {}) {
|
|
63
|
+
super(dialect);
|
|
64
|
+
this.baseClient = baseClient;
|
|
65
|
+
this.schema = schema;
|
|
66
|
+
this.options = options;
|
|
67
|
+
this.client = tx ?? baseClient;
|
|
68
|
+
this.logger = options.logger ?? new import_logger.NoopLogger();
|
|
69
|
+
}
|
|
70
|
+
static [import_entity.entityKind] = "TiDBServerlessSession";
|
|
71
|
+
logger;
|
|
72
|
+
client;
|
|
73
|
+
prepareQuery(query, fields, customResultMapper) {
|
|
74
|
+
return new TiDBServerlessPreparedQuery(
|
|
75
|
+
this.client,
|
|
76
|
+
query.sql,
|
|
77
|
+
query.params,
|
|
78
|
+
this.logger,
|
|
79
|
+
fields,
|
|
80
|
+
customResultMapper
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
all(query) {
|
|
84
|
+
const querySql = this.dialect.sqlToQuery(query);
|
|
85
|
+
this.logger.logQuery(querySql.sql, querySql.params);
|
|
86
|
+
return this.client.execute(querySql.sql, querySql.params);
|
|
87
|
+
}
|
|
88
|
+
async transaction(transaction) {
|
|
89
|
+
const nativeTx = await this.baseClient.begin();
|
|
90
|
+
try {
|
|
91
|
+
const session = new TiDBServerlessSession(this.baseClient, this.dialect, nativeTx, this.schema, this.options);
|
|
92
|
+
const tx = new TiDBServerlessTransaction(
|
|
93
|
+
this.dialect,
|
|
94
|
+
session,
|
|
95
|
+
this.schema
|
|
96
|
+
);
|
|
97
|
+
const result = await transaction(tx);
|
|
98
|
+
await nativeTx.commit();
|
|
99
|
+
return result;
|
|
100
|
+
} catch (err) {
|
|
101
|
+
await nativeTx.rollback();
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
class TiDBServerlessTransaction extends import_session.MySqlTransaction {
|
|
107
|
+
static [import_entity.entityKind] = "TiDBServerlessTransaction";
|
|
108
|
+
constructor(dialect, session, schema, nestedIndex = 0) {
|
|
109
|
+
super(dialect, session, schema, nestedIndex, "default");
|
|
110
|
+
}
|
|
111
|
+
async transaction(transaction) {
|
|
112
|
+
const savepointName = `sp${this.nestedIndex + 1}`;
|
|
113
|
+
const tx = new TiDBServerlessTransaction(
|
|
114
|
+
this.dialect,
|
|
115
|
+
this.session,
|
|
116
|
+
this.schema,
|
|
117
|
+
this.nestedIndex + 1
|
|
118
|
+
);
|
|
119
|
+
await tx.execute(import_sql.sql.raw(`savepoint ${savepointName}`));
|
|
120
|
+
try {
|
|
121
|
+
const result = await transaction(tx);
|
|
122
|
+
await tx.execute(import_sql.sql.raw(`release savepoint ${savepointName}`));
|
|
123
|
+
return result;
|
|
124
|
+
} catch (err) {
|
|
125
|
+
await tx.execute(import_sql.sql.raw(`rollback to savepoint ${savepointName}`));
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
131
|
+
0 && (module.exports = {
|
|
132
|
+
TiDBServerlessPreparedQuery,
|
|
133
|
+
TiDBServerlessSession,
|
|
134
|
+
TiDBServerlessTransaction
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=session.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/session.ts"],"sourcesContent":["import type { Connection, ExecuteOptions, FullResult, Tx } from '@tidbcloud/serverless';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { SelectedFieldsOrdered } from '~/mysql-core/query-builders/select.types.ts';\nimport {\n\tMySqlSession,\n\tMySqlTransaction,\n\tPreparedQuery,\n\ttype PreparedQueryConfig,\n\ttype PreparedQueryHKT,\n\ttype QueryResultHKT,\n} from '~/mysql-core/session.ts';\nimport type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { fillPlaceholders, type Query, type SQL, sql } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nconst executeRawConfig = { fullResult: true } satisfies ExecuteOptions;\nconst queryConfig = { arrayMode: true } satisfies ExecuteOptions;\n\nexport class TiDBServerlessPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {\n\tstatic readonly [entityKind]: string = 'TiDBPreparedQuery';\n\n\tconstructor(\n\t\tprivate client: Tx | Connection,\n\t\tprivate queryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tprivate customResultMapper?: (rows: unknown[][]) => T['execute'],\n\t) {\n\t\tsuper();\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\tconst { fields, client, queryString, joinsNotNullableMap, customResultMapper } = this;\n\t\tif (!fields && !customResultMapper) {\n\t\t\treturn client.execute(queryString, params, executeRawConfig);\n\t\t}\n\n\t\tconst rows = await client.execute(queryString, params, queryConfig) as unknown[][];\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows);\n\t\t}\n\n\t\treturn rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\toverride iterator(_placeholderValues?: Record<string, unknown>): AsyncGenerator<T['iterator']> {\n\t\tthrow new Error('Streaming is not supported by the TiDB Cloud Serverless driver');\n\t}\n}\n\nexport interface TiDBServerlessSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class TiDBServerlessSession<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlSession<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'TiDBServerlessSession';\n\n\tprivate logger: Logger;\n\tprivate client: Tx | Connection;\n\n\tconstructor(\n\t\tprivate baseClient: Connection,\n\t\tdialect: MySqlDialect,\n\t\ttx: Tx | undefined,\n\t\tprivate schema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: TiDBServerlessSessionOptions = {},\n\t) {\n\t\tsuper(dialect);\n\t\tthis.client = tx ?? baseClient;\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\tprepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tcustomResultMapper?: (rows: unknown[][]) => T['execute'],\n\t): PreparedQuery<T> {\n\t\treturn new TiDBServerlessPreparedQuery(\n\t\t\tthis.client,\n\t\t\tquery.sql,\n\t\t\tquery.params,\n\t\t\tthis.logger,\n\t\t\tfields,\n\t\t\tcustomResultMapper,\n\t\t);\n\t}\n\n\toverride all<T = unknown>(query: SQL): Promise<T[]> {\n\t\tconst querySql = this.dialect.sqlToQuery(query);\n\t\tthis.logger.logQuery(querySql.sql, querySql.params);\n\t\treturn this.client.execute(querySql.sql, querySql.params) as Promise<T[]>;\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst nativeTx = await this.baseClient.begin();\n\t\ttry {\n\t\t\tconst session = new TiDBServerlessSession(this.baseClient, this.dialect, nativeTx, this.schema, this.options);\n\t\t\tconst tx = new TiDBServerlessTransaction<TFullSchema, TSchema>(\n\t\t\t\tthis.dialect,\n\t\t\t\tsession as MySqlSession<any, any, any, any>,\n\t\t\t\tthis.schema,\n\t\t\t);\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait nativeTx.commit();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait nativeTx.rollback();\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport class TiDBServerlessTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlTransaction<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'TiDBServerlessTransaction';\n\n\tconstructor(\n\t\tdialect: MySqlDialect,\n\t\tsession: MySqlSession,\n\t\tschema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tnestedIndex = 0,\n\t) {\n\t\tsuper(dialect, session, schema, nestedIndex, 'default');\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new TiDBServerlessTransaction<TFullSchema, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tthis.session,\n\t\t\tthis.schema,\n\t\t\tthis.nestedIndex + 1,\n\t\t);\n\t\tawait tx.execute(sql.raw(`savepoint ${savepointName}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql.raw(`release savepoint ${savepointName}`));\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport interface TiDBServerlessQueryResultHKT extends QueryResultHKT {\n\ttype: FullResult;\n}\n\nexport interface TiDBServerlessPreparedQueryHKT extends PreparedQueryHKT {\n\ttype: TiDBServerlessPreparedQuery<Assume<this['config'], PreparedQueryConfig>>;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Connection, FullResult, Tx } from '@tidbcloud/serverless';
|
|
2
|
+
import { entityKind } from "../entity.cjs";
|
|
3
|
+
import type { Logger } from "../logger.cjs";
|
|
4
|
+
import type { MySqlDialect } from "../mysql-core/dialect.cjs";
|
|
5
|
+
import type { SelectedFieldsOrdered } from "../mysql-core/query-builders/select.types.cjs";
|
|
6
|
+
import { MySqlSession, MySqlTransaction, PreparedQuery, type PreparedQueryConfig, type PreparedQueryHKT, type QueryResultHKT } from "../mysql-core/session.cjs";
|
|
7
|
+
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
|
|
8
|
+
import { type Query, type SQL } from "../sql/sql.cjs";
|
|
9
|
+
import { type Assume } from "../utils.cjs";
|
|
10
|
+
export declare class TiDBServerlessPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
11
|
+
private client;
|
|
12
|
+
private queryString;
|
|
13
|
+
private params;
|
|
14
|
+
private logger;
|
|
15
|
+
private fields;
|
|
16
|
+
private customResultMapper?;
|
|
17
|
+
static readonly [entityKind]: string;
|
|
18
|
+
constructor(client: Tx | Connection, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
19
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
20
|
+
iterator(_placeholderValues?: Record<string, unknown>): AsyncGenerator<T['iterator']>;
|
|
21
|
+
}
|
|
22
|
+
export interface TiDBServerlessSessionOptions {
|
|
23
|
+
logger?: Logger;
|
|
24
|
+
}
|
|
25
|
+
export declare class TiDBServerlessSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlSession<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {
|
|
26
|
+
private baseClient;
|
|
27
|
+
private schema;
|
|
28
|
+
private options;
|
|
29
|
+
static readonly [entityKind]: string;
|
|
30
|
+
private logger;
|
|
31
|
+
private client;
|
|
32
|
+
constructor(baseClient: Connection, dialect: MySqlDialect, tx: Tx | undefined, schema: RelationalSchemaConfig<TSchema> | undefined, options?: TiDBServerlessSessionOptions);
|
|
33
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
34
|
+
all<T = unknown>(query: SQL): Promise<T[]>;
|
|
35
|
+
transaction<T>(transaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
export declare class TiDBServerlessTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlTransaction<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {
|
|
38
|
+
static readonly [entityKind]: string;
|
|
39
|
+
constructor(dialect: MySqlDialect, session: MySqlSession, schema: RelationalSchemaConfig<TSchema> | undefined, nestedIndex?: number);
|
|
40
|
+
transaction<T>(transaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
41
|
+
}
|
|
42
|
+
export interface TiDBServerlessQueryResultHKT extends QueryResultHKT {
|
|
43
|
+
type: FullResult;
|
|
44
|
+
}
|
|
45
|
+
export interface TiDBServerlessPreparedQueryHKT extends PreparedQueryHKT {
|
|
46
|
+
type: TiDBServerlessPreparedQuery<Assume<this['config'], PreparedQueryConfig>>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Connection, FullResult, Tx } from '@tidbcloud/serverless';
|
|
2
|
+
import { entityKind } from "../entity.js";
|
|
3
|
+
import type { Logger } from "../logger.js";
|
|
4
|
+
import type { MySqlDialect } from "../mysql-core/dialect.js";
|
|
5
|
+
import type { SelectedFieldsOrdered } from "../mysql-core/query-builders/select.types.js";
|
|
6
|
+
import { MySqlSession, MySqlTransaction, PreparedQuery, type PreparedQueryConfig, type PreparedQueryHKT, type QueryResultHKT } from "../mysql-core/session.js";
|
|
7
|
+
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
|
|
8
|
+
import { type Query, type SQL } from "../sql/sql.js";
|
|
9
|
+
import { type Assume } from "../utils.js";
|
|
10
|
+
export declare class TiDBServerlessPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
11
|
+
private client;
|
|
12
|
+
private queryString;
|
|
13
|
+
private params;
|
|
14
|
+
private logger;
|
|
15
|
+
private fields;
|
|
16
|
+
private customResultMapper?;
|
|
17
|
+
static readonly [entityKind]: string;
|
|
18
|
+
constructor(client: Tx | Connection, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
19
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
20
|
+
iterator(_placeholderValues?: Record<string, unknown>): AsyncGenerator<T['iterator']>;
|
|
21
|
+
}
|
|
22
|
+
export interface TiDBServerlessSessionOptions {
|
|
23
|
+
logger?: Logger;
|
|
24
|
+
}
|
|
25
|
+
export declare class TiDBServerlessSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlSession<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {
|
|
26
|
+
private baseClient;
|
|
27
|
+
private schema;
|
|
28
|
+
private options;
|
|
29
|
+
static readonly [entityKind]: string;
|
|
30
|
+
private logger;
|
|
31
|
+
private client;
|
|
32
|
+
constructor(baseClient: Connection, dialect: MySqlDialect, tx: Tx | undefined, schema: RelationalSchemaConfig<TSchema> | undefined, options?: TiDBServerlessSessionOptions);
|
|
33
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
34
|
+
all<T = unknown>(query: SQL): Promise<T[]>;
|
|
35
|
+
transaction<T>(transaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
export declare class TiDBServerlessTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlTransaction<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {
|
|
38
|
+
static readonly [entityKind]: string;
|
|
39
|
+
constructor(dialect: MySqlDialect, session: MySqlSession, schema: RelationalSchemaConfig<TSchema> | undefined, nestedIndex?: number);
|
|
40
|
+
transaction<T>(transaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
41
|
+
}
|
|
42
|
+
export interface TiDBServerlessQueryResultHKT extends QueryResultHKT {
|
|
43
|
+
type: FullResult;
|
|
44
|
+
}
|
|
45
|
+
export interface TiDBServerlessPreparedQueryHKT extends PreparedQueryHKT {
|
|
46
|
+
type: TiDBServerlessPreparedQuery<Assume<this['config'], PreparedQueryConfig>>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { entityKind } from "../entity.js";
|
|
2
|
+
import { NoopLogger } from "../logger.js";
|
|
3
|
+
import {
|
|
4
|
+
MySqlSession,
|
|
5
|
+
MySqlTransaction,
|
|
6
|
+
PreparedQuery
|
|
7
|
+
} from "../mysql-core/session.js";
|
|
8
|
+
import { fillPlaceholders, sql } from "../sql/sql.js";
|
|
9
|
+
import { mapResultRow } from "../utils.js";
|
|
10
|
+
const executeRawConfig = { fullResult: true };
|
|
11
|
+
const queryConfig = { arrayMode: true };
|
|
12
|
+
class TiDBServerlessPreparedQuery extends PreparedQuery {
|
|
13
|
+
constructor(client, queryString, params, logger, fields, customResultMapper) {
|
|
14
|
+
super();
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.queryString = queryString;
|
|
17
|
+
this.params = params;
|
|
18
|
+
this.logger = logger;
|
|
19
|
+
this.fields = fields;
|
|
20
|
+
this.customResultMapper = customResultMapper;
|
|
21
|
+
}
|
|
22
|
+
static [entityKind] = "TiDBPreparedQuery";
|
|
23
|
+
async execute(placeholderValues = {}) {
|
|
24
|
+
const params = fillPlaceholders(this.params, placeholderValues);
|
|
25
|
+
this.logger.logQuery(this.queryString, params);
|
|
26
|
+
const { fields, client, queryString, joinsNotNullableMap, customResultMapper } = this;
|
|
27
|
+
if (!fields && !customResultMapper) {
|
|
28
|
+
return client.execute(queryString, params, executeRawConfig);
|
|
29
|
+
}
|
|
30
|
+
const rows = await client.execute(queryString, params, queryConfig);
|
|
31
|
+
if (customResultMapper) {
|
|
32
|
+
return customResultMapper(rows);
|
|
33
|
+
}
|
|
34
|
+
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
|
35
|
+
}
|
|
36
|
+
iterator(_placeholderValues) {
|
|
37
|
+
throw new Error("Streaming is not supported by the TiDB Cloud Serverless driver");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class TiDBServerlessSession extends MySqlSession {
|
|
41
|
+
constructor(baseClient, dialect, tx, schema, options = {}) {
|
|
42
|
+
super(dialect);
|
|
43
|
+
this.baseClient = baseClient;
|
|
44
|
+
this.schema = schema;
|
|
45
|
+
this.options = options;
|
|
46
|
+
this.client = tx ?? baseClient;
|
|
47
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
48
|
+
}
|
|
49
|
+
static [entityKind] = "TiDBServerlessSession";
|
|
50
|
+
logger;
|
|
51
|
+
client;
|
|
52
|
+
prepareQuery(query, fields, customResultMapper) {
|
|
53
|
+
return new TiDBServerlessPreparedQuery(
|
|
54
|
+
this.client,
|
|
55
|
+
query.sql,
|
|
56
|
+
query.params,
|
|
57
|
+
this.logger,
|
|
58
|
+
fields,
|
|
59
|
+
customResultMapper
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
all(query) {
|
|
63
|
+
const querySql = this.dialect.sqlToQuery(query);
|
|
64
|
+
this.logger.logQuery(querySql.sql, querySql.params);
|
|
65
|
+
return this.client.execute(querySql.sql, querySql.params);
|
|
66
|
+
}
|
|
67
|
+
async transaction(transaction) {
|
|
68
|
+
const nativeTx = await this.baseClient.begin();
|
|
69
|
+
try {
|
|
70
|
+
const session = new TiDBServerlessSession(this.baseClient, this.dialect, nativeTx, this.schema, this.options);
|
|
71
|
+
const tx = new TiDBServerlessTransaction(
|
|
72
|
+
this.dialect,
|
|
73
|
+
session,
|
|
74
|
+
this.schema
|
|
75
|
+
);
|
|
76
|
+
const result = await transaction(tx);
|
|
77
|
+
await nativeTx.commit();
|
|
78
|
+
return result;
|
|
79
|
+
} catch (err) {
|
|
80
|
+
await nativeTx.rollback();
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class TiDBServerlessTransaction extends MySqlTransaction {
|
|
86
|
+
static [entityKind] = "TiDBServerlessTransaction";
|
|
87
|
+
constructor(dialect, session, schema, nestedIndex = 0) {
|
|
88
|
+
super(dialect, session, schema, nestedIndex, "default");
|
|
89
|
+
}
|
|
90
|
+
async transaction(transaction) {
|
|
91
|
+
const savepointName = `sp${this.nestedIndex + 1}`;
|
|
92
|
+
const tx = new TiDBServerlessTransaction(
|
|
93
|
+
this.dialect,
|
|
94
|
+
this.session,
|
|
95
|
+
this.schema,
|
|
96
|
+
this.nestedIndex + 1
|
|
97
|
+
);
|
|
98
|
+
await tx.execute(sql.raw(`savepoint ${savepointName}`));
|
|
99
|
+
try {
|
|
100
|
+
const result = await transaction(tx);
|
|
101
|
+
await tx.execute(sql.raw(`release savepoint ${savepointName}`));
|
|
102
|
+
return result;
|
|
103
|
+
} catch (err) {
|
|
104
|
+
await tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
TiDBServerlessPreparedQuery,
|
|
111
|
+
TiDBServerlessSession,
|
|
112
|
+
TiDBServerlessTransaction
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tidb-serverless/session.ts"],"sourcesContent":["import type { Connection, ExecuteOptions, FullResult, Tx } from '@tidbcloud/serverless';\n\nimport { entityKind } from '~/entity.ts';\nimport type { Logger } from '~/logger.ts';\nimport { NoopLogger } from '~/logger.ts';\nimport type { MySqlDialect } from '~/mysql-core/dialect.ts';\nimport type { SelectedFieldsOrdered } from '~/mysql-core/query-builders/select.types.ts';\nimport {\n\tMySqlSession,\n\tMySqlTransaction,\n\tPreparedQuery,\n\ttype PreparedQueryConfig,\n\ttype PreparedQueryHKT,\n\ttype QueryResultHKT,\n} from '~/mysql-core/session.ts';\nimport type { RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { fillPlaceholders, type Query, type SQL, sql } from '~/sql/sql.ts';\nimport { type Assume, mapResultRow } from '~/utils.ts';\n\nconst executeRawConfig = { fullResult: true } satisfies ExecuteOptions;\nconst queryConfig = { arrayMode: true } satisfies ExecuteOptions;\n\nexport class TiDBServerlessPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {\n\tstatic readonly [entityKind]: string = 'TiDBPreparedQuery';\n\n\tconstructor(\n\t\tprivate client: Tx | Connection,\n\t\tprivate queryString: string,\n\t\tprivate params: unknown[],\n\t\tprivate logger: Logger,\n\t\tprivate fields: SelectedFieldsOrdered | undefined,\n\t\tprivate customResultMapper?: (rows: unknown[][]) => T['execute'],\n\t) {\n\t\tsuper();\n\t}\n\n\tasync execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {\n\t\tconst params = fillPlaceholders(this.params, placeholderValues);\n\n\t\tthis.logger.logQuery(this.queryString, params);\n\n\t\tconst { fields, client, queryString, joinsNotNullableMap, customResultMapper } = this;\n\t\tif (!fields && !customResultMapper) {\n\t\t\treturn client.execute(queryString, params, executeRawConfig);\n\t\t}\n\n\t\tconst rows = await client.execute(queryString, params, queryConfig) as unknown[][];\n\n\t\tif (customResultMapper) {\n\t\t\treturn customResultMapper(rows);\n\t\t}\n\n\t\treturn rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));\n\t}\n\n\toverride iterator(_placeholderValues?: Record<string, unknown>): AsyncGenerator<T['iterator']> {\n\t\tthrow new Error('Streaming is not supported by the TiDB Cloud Serverless driver');\n\t}\n}\n\nexport interface TiDBServerlessSessionOptions {\n\tlogger?: Logger;\n}\n\nexport class TiDBServerlessSession<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlSession<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'TiDBServerlessSession';\n\n\tprivate logger: Logger;\n\tprivate client: Tx | Connection;\n\n\tconstructor(\n\t\tprivate baseClient: Connection,\n\t\tdialect: MySqlDialect,\n\t\ttx: Tx | undefined,\n\t\tprivate schema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tprivate options: TiDBServerlessSessionOptions = {},\n\t) {\n\t\tsuper(dialect);\n\t\tthis.client = tx ?? baseClient;\n\t\tthis.logger = options.logger ?? new NoopLogger();\n\t}\n\n\tprepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n\t\tquery: Query,\n\t\tfields: SelectedFieldsOrdered | undefined,\n\t\tcustomResultMapper?: (rows: unknown[][]) => T['execute'],\n\t): PreparedQuery<T> {\n\t\treturn new TiDBServerlessPreparedQuery(\n\t\t\tthis.client,\n\t\t\tquery.sql,\n\t\t\tquery.params,\n\t\t\tthis.logger,\n\t\t\tfields,\n\t\t\tcustomResultMapper,\n\t\t);\n\t}\n\n\toverride all<T = unknown>(query: SQL): Promise<T[]> {\n\t\tconst querySql = this.dialect.sqlToQuery(query);\n\t\tthis.logger.logQuery(querySql.sql, querySql.params);\n\t\treturn this.client.execute(querySql.sql, querySql.params) as Promise<T[]>;\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst nativeTx = await this.baseClient.begin();\n\t\ttry {\n\t\t\tconst session = new TiDBServerlessSession(this.baseClient, this.dialect, nativeTx, this.schema, this.options);\n\t\t\tconst tx = new TiDBServerlessTransaction<TFullSchema, TSchema>(\n\t\t\t\tthis.dialect,\n\t\t\t\tsession as MySqlSession<any, any, any, any>,\n\t\t\t\tthis.schema,\n\t\t\t);\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait nativeTx.commit();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait nativeTx.rollback();\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport class TiDBServerlessTransaction<\n\tTFullSchema extends Record<string, unknown>,\n\tTSchema extends TablesRelationalConfig,\n> extends MySqlTransaction<TiDBServerlessQueryResultHKT, TiDBServerlessPreparedQueryHKT, TFullSchema, TSchema> {\n\tstatic readonly [entityKind]: string = 'TiDBServerlessTransaction';\n\n\tconstructor(\n\t\tdialect: MySqlDialect,\n\t\tsession: MySqlSession,\n\t\tschema: RelationalSchemaConfig<TSchema> | undefined,\n\t\tnestedIndex = 0,\n\t) {\n\t\tsuper(dialect, session, schema, nestedIndex, 'default');\n\t}\n\n\toverride async transaction<T>(\n\t\ttransaction: (tx: TiDBServerlessTransaction<TFullSchema, TSchema>) => Promise<T>,\n\t): Promise<T> {\n\t\tconst savepointName = `sp${this.nestedIndex + 1}`;\n\t\tconst tx = new TiDBServerlessTransaction<TFullSchema, TSchema>(\n\t\t\tthis.dialect,\n\t\t\tthis.session,\n\t\t\tthis.schema,\n\t\t\tthis.nestedIndex + 1,\n\t\t);\n\t\tawait tx.execute(sql.raw(`savepoint ${savepointName}`));\n\t\ttry {\n\t\t\tconst result = await transaction(tx);\n\t\t\tawait tx.execute(sql.raw(`release savepoint ${savepointName}`));\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tawait tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n\nexport interface TiDBServerlessQueryResultHKT extends QueryResultHKT {\n\ttype: FullResult;\n}\n\nexport interface TiDBServerlessPreparedQueryHKT extends PreparedQueryHKT {\n\ttype: TiDBServerlessPreparedQuery<Assume<this['config'], PreparedQueryConfig>>;\n}\n"],"mappings":"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","names":[]}
|
package/version.cjs
CHANGED
package/version.d.cts
CHANGED
package/version.d.ts
CHANGED
package/version.js
CHANGED