azure-mock 2.22.0 → 2.24.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/LICENSE +201 -201
- package/README.md +15 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22244 -23627
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +9 -8
- package/dist/better-sqlite3-CtLaF97z-DWR9uC3b.js +0 -129
- package/dist/chunk-2X2C5D2I-dJHtPFe9-DxsO-1YF.js +0 -4026
- package/dist/d1-pK2J-_yx-BoQTXsTa.js +0 -185
- package/dist/dialect-pBb6Cg_F-xgpUtfmk.js +0 -570
- package/dist/dist-C481edUb-CHbOkeXH.js +0 -10131
- package/dist/dist-DUzzleZr-DxHmeYjp.js +0 -2
- package/dist/libsql-Nq-S0r5x-d2dAzhgO.js +0 -240
- package/dist/logger-TIsK7375-CLNNa25D.js +0 -652
- package/dist/migrator-B9kYwLqO-4g9JX3_v.js +0 -8
- package/dist/migrator-BfTfJctM-DrNlb1BS.js +0 -8
- package/dist/migrator-BjoW0_3j-CD-XdZ5a.js +0 -8
- package/dist/migrator-CWWlo_Jk-C4Hw4PPN.js +0 -8
- package/dist/migrator-CpiXRkls-COYfhljd.js +0 -24
- package/dist/migrator-CtqJkLVI-D1lU6ZV0.js +0 -8
- package/dist/migrator-CxcBjmET-Dcd21VIf.js +0 -8
- package/dist/migrator-Cyhbhxo_-Bh7sF0R3.js +0 -21
- package/dist/migrator-DG1mWUoR-DVfkqn_v.js +0 -31
- package/dist/migrator-DrWmHwY2-YjAfotd7.js +0 -8
- package/dist/migrator-WAPonQxA-CRvJJhKG.js +0 -8
- package/dist/migrator-Zdh8WMMx-gsmNXspd.js +0 -8
- package/dist/migrator-xRJ6NOTS-SsAuB-Gi.js +0 -24
- package/dist/migrator-xbWwvFYF-BjyVdQS8.js +0 -8
- package/dist/mysql2-DkoPEsRu-BMwVSCmY.js +0 -251
- package/dist/neon-serverless-BEVFA7yv-DGSPAG1z.js +0 -205
- package/dist/node-postgres-DQA7bEhW-CkM_cVLD.js +0 -216
- package/dist/nodefs-Bc8b83o_-DetP9qUa.js +0 -24
- package/dist/opfs-ahp-DbstDvx--CHskKtzG.js +0 -365
- package/dist/pg-ylxXyvKj-Hm8vcZoi.js +0 -279
- package/dist/pglite-CPs4w-D9-DHOg0D8W.js +0 -179
- package/dist/pglite-DMWgTUE6-BOIRUWUT.js +0 -2
- package/dist/planetscale-serverless-DUMheN-f-Dyc_W6V_.js +0 -172
- package/dist/query-builder-CLJAKedv-DTZiP7B6.js +0 -1715
- package/dist/query-builder-CT3_liD0-hhg5kRTk.js +0 -1347
- package/dist/session-BOEirggu-DTmpyU_x.js +0 -2485
- package/dist/session-CAUQtT0A-BoVK2x7A.js +0 -745
- package/dist/session-Cjeygn2Z-BO0mi6pq.js +0 -989
- package/dist/singlestore-Cdlo23hW-BuFJ4Zqb.js +0 -1647
- package/dist/sql-CNZp2yLp-Bwugq384.js +0 -611
- package/dist/sqlite-proxy-BgUfVEbZ-CsSkc-_K.js +0 -190
- package/dist/src-LcyXhCXE-C_vKJiLK.js +0 -1920
- package/dist/vercel-postgres-BYmFKsTS-CpV2usun.js +0 -203
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { C as sql$1, _ 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 { a as PgTransaction, i as PgSession, n as PgDialect, r as PgPreparedQuery, t as PgDatabase } from "./session-BOEirggu-DTmpyU_x.js";
|
|
4
|
-
import { VercelPool, sql, types } from "@vercel/postgres";
|
|
5
|
-
//#region ../db/dist/vercel-postgres-BYmFKsTS.js
|
|
6
|
-
var VercelPgPreparedQuery = class extends PgPreparedQuery {
|
|
7
|
-
constructor(client, queryString, params, logger, cache, queryMetadata, cacheConfig, fields, name, _isResponseInArrayMode, customResultMapper) {
|
|
8
|
-
super({
|
|
9
|
-
sql: queryString,
|
|
10
|
-
params
|
|
11
|
-
}, cache, queryMetadata, cacheConfig);
|
|
12
|
-
this.client = client;
|
|
13
|
-
this.params = params;
|
|
14
|
-
this.logger = logger;
|
|
15
|
-
this.fields = fields;
|
|
16
|
-
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
17
|
-
this.customResultMapper = customResultMapper;
|
|
18
|
-
this.rawQuery = {
|
|
19
|
-
name,
|
|
20
|
-
text: queryString,
|
|
21
|
-
types: { getTypeParser: (typeId, format) => {
|
|
22
|
-
if (typeId === types.builtins.TIMESTAMPTZ) return (val) => val;
|
|
23
|
-
if (typeId === types.builtins.TIMESTAMP) return (val) => val;
|
|
24
|
-
if (typeId === types.builtins.DATE) return (val) => val;
|
|
25
|
-
if (typeId === types.builtins.INTERVAL) return (val) => val;
|
|
26
|
-
if (typeId === 1231) return (val) => val;
|
|
27
|
-
if (typeId === 1115) return (val) => val;
|
|
28
|
-
if (typeId === 1185) return (val) => val;
|
|
29
|
-
if (typeId === 1187) return (val) => val;
|
|
30
|
-
if (typeId === 1182) return (val) => val;
|
|
31
|
-
return types.getTypeParser(typeId, format);
|
|
32
|
-
} }
|
|
33
|
-
};
|
|
34
|
-
this.queryConfig = {
|
|
35
|
-
name,
|
|
36
|
-
text: queryString,
|
|
37
|
-
rowMode: "array",
|
|
38
|
-
types: { getTypeParser: (typeId, format) => {
|
|
39
|
-
if (typeId === types.builtins.TIMESTAMPTZ) return (val) => val;
|
|
40
|
-
if (typeId === types.builtins.TIMESTAMP) return (val) => val;
|
|
41
|
-
if (typeId === types.builtins.DATE) return (val) => val;
|
|
42
|
-
if (typeId === types.builtins.INTERVAL) return (val) => val;
|
|
43
|
-
if (typeId === 1231) return (val) => val;
|
|
44
|
-
if (typeId === 1115) return (val) => val;
|
|
45
|
-
if (typeId === 1185) return (val) => val;
|
|
46
|
-
if (typeId === 1187) return (val) => val;
|
|
47
|
-
if (typeId === 1182) return (val) => val;
|
|
48
|
-
return types.getTypeParser(typeId, format);
|
|
49
|
-
} }
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
static [entityKind] = "VercelPgPreparedQuery";
|
|
53
|
-
rawQuery;
|
|
54
|
-
queryConfig;
|
|
55
|
-
async execute(placeholderValues = {}) {
|
|
56
|
-
const params = fillPlaceholders(this.params, placeholderValues);
|
|
57
|
-
this.logger.logQuery(this.rawQuery.text, params);
|
|
58
|
-
const { fields, rawQuery, client, queryConfig: query, joinsNotNullableMap, customResultMapper } = this;
|
|
59
|
-
if (!fields && !customResultMapper) return this.queryWithCache(rawQuery.text, params, async () => {
|
|
60
|
-
return await client.query(rawQuery, params);
|
|
61
|
-
});
|
|
62
|
-
const { rows } = await this.queryWithCache(query.text, params, async () => {
|
|
63
|
-
return await client.query(query, params);
|
|
64
|
-
});
|
|
65
|
-
if (customResultMapper) return customResultMapper(rows);
|
|
66
|
-
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
|
67
|
-
}
|
|
68
|
-
all(placeholderValues = {}) {
|
|
69
|
-
const params = fillPlaceholders(this.params, placeholderValues);
|
|
70
|
-
this.logger.logQuery(this.rawQuery.text, params);
|
|
71
|
-
return this.queryWithCache(this.rawQuery.text, params, async () => {
|
|
72
|
-
return await this.client.query(this.rawQuery, params);
|
|
73
|
-
}).then((result) => result.rows);
|
|
74
|
-
}
|
|
75
|
-
values(placeholderValues = {}) {
|
|
76
|
-
const params = fillPlaceholders(this.params, placeholderValues);
|
|
77
|
-
this.logger.logQuery(this.rawQuery.text, params);
|
|
78
|
-
return this.queryWithCache(this.queryConfig.text, params, async () => {
|
|
79
|
-
return await this.client.query(this.queryConfig, params);
|
|
80
|
-
}).then((result) => result.rows);
|
|
81
|
-
}
|
|
82
|
-
/** @internal */
|
|
83
|
-
isResponseInArrayMode() {
|
|
84
|
-
return this._isResponseInArrayMode;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
var VercelPgSession = class VercelPgSession extends PgSession {
|
|
88
|
-
constructor(client, dialect, schema, options = {}) {
|
|
89
|
-
super(dialect);
|
|
90
|
-
this.client = client;
|
|
91
|
-
this.schema = schema;
|
|
92
|
-
this.options = options;
|
|
93
|
-
this.logger = options.logger ?? new NoopLogger();
|
|
94
|
-
this.cache = options.cache ?? new NoopCache();
|
|
95
|
-
}
|
|
96
|
-
static [entityKind] = "VercelPgSession";
|
|
97
|
-
logger;
|
|
98
|
-
cache;
|
|
99
|
-
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
|
|
100
|
-
return new VercelPgPreparedQuery(this.client, query.sql, query.params, this.logger, this.cache, queryMetadata, cacheConfig, fields, name, isResponseInArrayMode, customResultMapper);
|
|
101
|
-
}
|
|
102
|
-
async query(query, params) {
|
|
103
|
-
this.logger.logQuery(query, params);
|
|
104
|
-
return await this.client.query({
|
|
105
|
-
rowMode: "array",
|
|
106
|
-
text: query,
|
|
107
|
-
values: params
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
async queryObjects(query, params) {
|
|
111
|
-
return this.client.query(query, params);
|
|
112
|
-
}
|
|
113
|
-
async count(sql2) {
|
|
114
|
-
const result = await this.execute(sql2);
|
|
115
|
-
return Number(result["rows"][0]["count"]);
|
|
116
|
-
}
|
|
117
|
-
async transaction(transaction, config) {
|
|
118
|
-
const session = this.client instanceof VercelPool ? new VercelPgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
|
|
119
|
-
const tx = new VercelPgTransaction(this.dialect, session, this.schema);
|
|
120
|
-
await tx.execute(sql$1`begin${config ? sql$1` ${tx.getTransactionConfigSQL(config)}` : void 0}`);
|
|
121
|
-
try {
|
|
122
|
-
const result = await transaction(tx);
|
|
123
|
-
await tx.execute(sql$1`commit`);
|
|
124
|
-
return result;
|
|
125
|
-
} catch (error) {
|
|
126
|
-
await tx.execute(sql$1`rollback`);
|
|
127
|
-
throw error;
|
|
128
|
-
} finally {
|
|
129
|
-
if (this.client instanceof VercelPool) session.client.release();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var VercelPgTransaction = class VercelPgTransaction extends PgTransaction {
|
|
134
|
-
static [entityKind] = "VercelPgTransaction";
|
|
135
|
-
async transaction(transaction) {
|
|
136
|
-
const savepointName = `sp${this.nestedIndex + 1}`;
|
|
137
|
-
const tx = new VercelPgTransaction(this.dialect, this.session, this.schema, this.nestedIndex + 1);
|
|
138
|
-
await tx.execute(sql$1.raw(`savepoint ${savepointName}`));
|
|
139
|
-
try {
|
|
140
|
-
const result = await transaction(tx);
|
|
141
|
-
await tx.execute(sql$1.raw(`release savepoint ${savepointName}`));
|
|
142
|
-
return result;
|
|
143
|
-
} catch (err) {
|
|
144
|
-
await tx.execute(sql$1.raw(`rollback to savepoint ${savepointName}`));
|
|
145
|
-
throw err;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
var VercelPgDriver = class {
|
|
150
|
-
constructor(client, dialect, options = {}) {
|
|
151
|
-
this.client = client;
|
|
152
|
-
this.dialect = dialect;
|
|
153
|
-
this.options = options;
|
|
154
|
-
}
|
|
155
|
-
static [entityKind] = "VercelPgDriver";
|
|
156
|
-
createSession(schema) {
|
|
157
|
-
return new VercelPgSession(this.client, this.dialect, schema, {
|
|
158
|
-
logger: this.options.logger,
|
|
159
|
-
cache: this.options.cache
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
var VercelPgDatabase = class extends PgDatabase {
|
|
164
|
-
static [entityKind] = "VercelPgDatabase";
|
|
165
|
-
};
|
|
166
|
-
function construct(client, config = {}) {
|
|
167
|
-
const dialect = new PgDialect({ casing: config.casing });
|
|
168
|
-
let logger;
|
|
169
|
-
if (config.logger === true) logger = new DefaultLogger();
|
|
170
|
-
else if (config.logger !== false) logger = config.logger;
|
|
171
|
-
let schema;
|
|
172
|
-
if (config.schema) {
|
|
173
|
-
const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
|
|
174
|
-
schema = {
|
|
175
|
-
fullSchema: config.schema,
|
|
176
|
-
schema: tablesConfig.tables,
|
|
177
|
-
tableNamesMap: tablesConfig.tableNamesMap
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
const db = new VercelPgDatabase(dialect, new VercelPgDriver(client, dialect, {
|
|
181
|
-
logger,
|
|
182
|
-
cache: config.cache
|
|
183
|
-
}).createSession(schema), schema);
|
|
184
|
-
db.$client = client;
|
|
185
|
-
db.$cache = config.cache;
|
|
186
|
-
if (db.$cache) db.$cache["invalidate"] = config.cache?.onMutate;
|
|
187
|
-
return db;
|
|
188
|
-
}
|
|
189
|
-
function drizzle(...params) {
|
|
190
|
-
if (isConfig(params[0])) {
|
|
191
|
-
const { client, ...drizzleConfig } = params[0];
|
|
192
|
-
return construct(client ?? sql, drizzleConfig);
|
|
193
|
-
}
|
|
194
|
-
return construct(params[0] ?? sql, params[1]);
|
|
195
|
-
}
|
|
196
|
-
((drizzle2) => {
|
|
197
|
-
function mock(config) {
|
|
198
|
-
return construct({}, config);
|
|
199
|
-
}
|
|
200
|
-
drizzle2.mock = mock;
|
|
201
|
-
})(drizzle || (drizzle = {}));
|
|
202
|
-
//#endregion
|
|
203
|
-
export { drizzle };
|