azure-mock 2.21.0 → 2.23.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.
- package/dist/better-sqlite3-CtLaF97z-DWR9uC3b.js +129 -0
- package/dist/chunk-2X2C5D2I-dJHtPFe9-DxsO-1YF.js +4026 -0
- package/dist/d1-pK2J-_yx-BoQTXsTa.js +185 -0
- package/dist/dialect-pBb6Cg_F-xgpUtfmk.js +570 -0
- package/dist/dist-C481edUb-CHbOkeXH.js +10131 -0
- package/dist/dist-DUzzleZr-DxHmeYjp.js +2 -0
- package/dist/index.d.ts +16 -16
- package/dist/index.js +20400 -18918
- package/dist/libsql-Nq-S0r5x-d2dAzhgO.js +240 -0
- package/dist/logger-TIsK7375-CLNNa25D.js +652 -0
- package/dist/migrator-B9kYwLqO-4g9JX3_v.js +8 -0
- package/dist/migrator-BfTfJctM-DrNlb1BS.js +8 -0
- package/dist/migrator-BjoW0_3j-CD-XdZ5a.js +8 -0
- package/dist/migrator-CWWlo_Jk-C4Hw4PPN.js +8 -0
- package/dist/migrator-CpiXRkls-COYfhljd.js +24 -0
- package/dist/migrator-CtqJkLVI-D1lU6ZV0.js +8 -0
- package/dist/migrator-CxcBjmET-Dcd21VIf.js +8 -0
- package/dist/migrator-Cyhbhxo_-Bh7sF0R3.js +21 -0
- package/dist/migrator-DG1mWUoR-DVfkqn_v.js +31 -0
- package/dist/migrator-DrWmHwY2-YjAfotd7.js +8 -0
- package/dist/migrator-WAPonQxA-CRvJJhKG.js +8 -0
- package/dist/migrator-Zdh8WMMx-gsmNXspd.js +8 -0
- package/dist/migrator-xRJ6NOTS-SsAuB-Gi.js +24 -0
- package/dist/migrator-xbWwvFYF-BjyVdQS8.js +8 -0
- package/dist/mysql2-DkoPEsRu-BMwVSCmY.js +251 -0
- package/dist/neon-serverless-BEVFA7yv-DGSPAG1z.js +205 -0
- package/dist/node-postgres-DQA7bEhW-CkM_cVLD.js +216 -0
- package/dist/nodefs-Bc8b83o_-DetP9qUa.js +24 -0
- package/dist/opfs-ahp-DbstDvx--CHskKtzG.js +365 -0
- package/dist/pg-ylxXyvKj-Hm8vcZoi.js +279 -0
- package/dist/pglite-CPs4w-D9-DHOg0D8W.js +179 -0
- package/dist/pglite-DMWgTUE6-BOIRUWUT.js +2 -0
- package/dist/planetscale-serverless-DUMheN-f-Dyc_W6V_.js +172 -0
- package/dist/query-builder-CLJAKedv-DTZiP7B6.js +1715 -0
- package/dist/query-builder-CT3_liD0-hhg5kRTk.js +1347 -0
- package/dist/session-BOEirggu-DTmpyU_x.js +2485 -0
- package/dist/session-CAUQtT0A-BoVK2x7A.js +745 -0
- package/dist/session-Cjeygn2Z-BO0mi6pq.js +989 -0
- package/dist/singlestore-Cdlo23hW-BuFJ4Zqb.js +1647 -0
- package/dist/sql-CNZp2yLp-Bwugq384.js +611 -0
- package/dist/sqlite-proxy-BgUfVEbZ-CsSkc-_K.js +190 -0
- package/dist/src-LcyXhCXE-C_vKJiLK.js +1920 -0
- package/dist/vercel-postgres-BYmFKsTS-CpV2usun.js +203 -0
- package/package.json +7 -8
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { C as sql, _ as fillPlaceholders, g as entityKind } from "./sql-CNZp2yLp-Bwugq384.js";
|
|
2
|
+
import { M as mapResultRow, O as isConfig, n as DefaultLogger, o as NoopCache, s as NoopLogger, x as extractTablesRelationalConfig, y as createTableRelationsHelpers } from "./logger-TIsK7375-CLNNa25D.js";
|
|
3
|
+
import { i as SQLiteSyncDialect } from "./query-builder-CT3_liD0-hhg5kRTk.js";
|
|
4
|
+
import { i as SQLiteTransaction, n as SQLitePreparedQuery, r as SQLiteSession, t as BaseSQLiteDatabase } from "./session-Cjeygn2Z-BO0mi6pq.js";
|
|
5
|
+
import Client from "better-sqlite3";
|
|
6
|
+
//#region ../db/dist/better-sqlite3-CtLaF97z.js
|
|
7
|
+
var BetterSQLiteSession = class extends SQLiteSession {
|
|
8
|
+
constructor(client, dialect, schema, options = {}) {
|
|
9
|
+
super(dialect);
|
|
10
|
+
this.client = client;
|
|
11
|
+
this.schema = schema;
|
|
12
|
+
this.logger = options.logger ?? new NoopLogger();
|
|
13
|
+
this.cache = options.cache ?? new NoopCache();
|
|
14
|
+
}
|
|
15
|
+
static [entityKind] = "BetterSQLiteSession";
|
|
16
|
+
logger;
|
|
17
|
+
cache;
|
|
18
|
+
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
|
|
19
|
+
return new PreparedQuery(this.client.prepare(query.sql), query, this.logger, this.cache, queryMetadata, cacheConfig, fields, executeMethod, isResponseInArrayMode, customResultMapper);
|
|
20
|
+
}
|
|
21
|
+
transaction(transaction, config = {}) {
|
|
22
|
+
const tx = new BetterSQLiteTransaction("sync", this.dialect, this, this.schema);
|
|
23
|
+
return this.client.transaction(transaction)[config.behavior ?? "deferred"](tx);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var BetterSQLiteTransaction = class BetterSQLiteTransaction extends SQLiteTransaction {
|
|
27
|
+
static [entityKind] = "BetterSQLiteTransaction";
|
|
28
|
+
transaction(transaction) {
|
|
29
|
+
const savepointName = `sp${this.nestedIndex}`;
|
|
30
|
+
const tx = new BetterSQLiteTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
|
|
31
|
+
this.session.run(sql.raw(`savepoint ${savepointName}`));
|
|
32
|
+
try {
|
|
33
|
+
const result = transaction(tx);
|
|
34
|
+
this.session.run(sql.raw(`release savepoint ${savepointName}`));
|
|
35
|
+
return result;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var PreparedQuery = class extends SQLitePreparedQuery {
|
|
43
|
+
constructor(stmt, query, logger, cache, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
|
|
44
|
+
super("sync", executeMethod, query, cache, queryMetadata, cacheConfig);
|
|
45
|
+
this.stmt = stmt;
|
|
46
|
+
this.logger = logger;
|
|
47
|
+
this.fields = fields;
|
|
48
|
+
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
49
|
+
this.customResultMapper = customResultMapper;
|
|
50
|
+
}
|
|
51
|
+
static [entityKind] = "BetterSQLitePreparedQuery";
|
|
52
|
+
run(placeholderValues) {
|
|
53
|
+
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
|
|
54
|
+
this.logger.logQuery(this.query.sql, params);
|
|
55
|
+
return this.stmt.run(...params);
|
|
56
|
+
}
|
|
57
|
+
all(placeholderValues) {
|
|
58
|
+
const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
|
|
59
|
+
if (!fields && !customResultMapper) {
|
|
60
|
+
const params = fillPlaceholders(query.params, placeholderValues ?? {});
|
|
61
|
+
logger.logQuery(query.sql, params);
|
|
62
|
+
return stmt.all(...params);
|
|
63
|
+
}
|
|
64
|
+
const rows = this.values(placeholderValues);
|
|
65
|
+
if (customResultMapper) return customResultMapper(rows);
|
|
66
|
+
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
|
67
|
+
}
|
|
68
|
+
get(placeholderValues) {
|
|
69
|
+
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
|
|
70
|
+
this.logger.logQuery(this.query.sql, params);
|
|
71
|
+
const { fields, stmt, joinsNotNullableMap, customResultMapper } = this;
|
|
72
|
+
if (!fields && !customResultMapper) return stmt.get(...params);
|
|
73
|
+
const row = stmt.raw().get(...params);
|
|
74
|
+
if (!row) return;
|
|
75
|
+
if (customResultMapper) return customResultMapper([row]);
|
|
76
|
+
return mapResultRow(fields, row, joinsNotNullableMap);
|
|
77
|
+
}
|
|
78
|
+
values(placeholderValues) {
|
|
79
|
+
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
|
|
80
|
+
this.logger.logQuery(this.query.sql, params);
|
|
81
|
+
return this.stmt.raw().all(...params);
|
|
82
|
+
}
|
|
83
|
+
/** @internal */
|
|
84
|
+
isResponseInArrayMode() {
|
|
85
|
+
return this._isResponseInArrayMode;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var BetterSQLite3Database = class extends BaseSQLiteDatabase {
|
|
89
|
+
static [entityKind] = "BetterSQLite3Database";
|
|
90
|
+
};
|
|
91
|
+
function construct(client, config = {}) {
|
|
92
|
+
const dialect = new SQLiteSyncDialect({ casing: config.casing });
|
|
93
|
+
let logger;
|
|
94
|
+
if (config.logger === true) logger = new DefaultLogger();
|
|
95
|
+
else if (config.logger !== false) logger = config.logger;
|
|
96
|
+
let schema;
|
|
97
|
+
if (config.schema) {
|
|
98
|
+
const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
|
|
99
|
+
schema = {
|
|
100
|
+
fullSchema: config.schema,
|
|
101
|
+
schema: tablesConfig.tables,
|
|
102
|
+
tableNamesMap: tablesConfig.tableNamesMap
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const db = new BetterSQLite3Database("sync", dialect, new BetterSQLiteSession(client, dialect, schema, { logger }), schema);
|
|
106
|
+
db.$client = client;
|
|
107
|
+
return db;
|
|
108
|
+
}
|
|
109
|
+
function drizzle(...params) {
|
|
110
|
+
if (params[0] === void 0 || typeof params[0] === "string") return construct(params[0] === void 0 ? new Client() : new Client(params[0]), params[1]);
|
|
111
|
+
if (isConfig(params[0])) {
|
|
112
|
+
const { connection, client, ...drizzleConfig } = params[0];
|
|
113
|
+
if (client) return construct(client, drizzleConfig);
|
|
114
|
+
if (typeof connection === "object") {
|
|
115
|
+
const { source, ...options } = connection;
|
|
116
|
+
return construct(new Client(source, options), drizzleConfig);
|
|
117
|
+
}
|
|
118
|
+
return construct(new Client(connection), drizzleConfig);
|
|
119
|
+
}
|
|
120
|
+
return construct(params[0], params[1]);
|
|
121
|
+
}
|
|
122
|
+
((drizzle2) => {
|
|
123
|
+
function mock(config) {
|
|
124
|
+
return construct({}, config);
|
|
125
|
+
}
|
|
126
|
+
drizzle2.mock = mock;
|
|
127
|
+
})(drizzle || (drizzle = {}));
|
|
128
|
+
//#endregion
|
|
129
|
+
export { drizzle };
|