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.
Files changed (47) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +15 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +22244 -23627
  5. package/dist/tsconfig.tsbuildinfo +1 -0
  6. package/package.json +9 -8
  7. package/dist/better-sqlite3-CtLaF97z-DWR9uC3b.js +0 -129
  8. package/dist/chunk-2X2C5D2I-dJHtPFe9-DxsO-1YF.js +0 -4026
  9. package/dist/d1-pK2J-_yx-BoQTXsTa.js +0 -185
  10. package/dist/dialect-pBb6Cg_F-xgpUtfmk.js +0 -570
  11. package/dist/dist-C481edUb-CHbOkeXH.js +0 -10131
  12. package/dist/dist-DUzzleZr-DxHmeYjp.js +0 -2
  13. package/dist/libsql-Nq-S0r5x-d2dAzhgO.js +0 -240
  14. package/dist/logger-TIsK7375-CLNNa25D.js +0 -652
  15. package/dist/migrator-B9kYwLqO-4g9JX3_v.js +0 -8
  16. package/dist/migrator-BfTfJctM-DrNlb1BS.js +0 -8
  17. package/dist/migrator-BjoW0_3j-CD-XdZ5a.js +0 -8
  18. package/dist/migrator-CWWlo_Jk-C4Hw4PPN.js +0 -8
  19. package/dist/migrator-CpiXRkls-COYfhljd.js +0 -24
  20. package/dist/migrator-CtqJkLVI-D1lU6ZV0.js +0 -8
  21. package/dist/migrator-CxcBjmET-Dcd21VIf.js +0 -8
  22. package/dist/migrator-Cyhbhxo_-Bh7sF0R3.js +0 -21
  23. package/dist/migrator-DG1mWUoR-DVfkqn_v.js +0 -31
  24. package/dist/migrator-DrWmHwY2-YjAfotd7.js +0 -8
  25. package/dist/migrator-WAPonQxA-CRvJJhKG.js +0 -8
  26. package/dist/migrator-Zdh8WMMx-gsmNXspd.js +0 -8
  27. package/dist/migrator-xRJ6NOTS-SsAuB-Gi.js +0 -24
  28. package/dist/migrator-xbWwvFYF-BjyVdQS8.js +0 -8
  29. package/dist/mysql2-DkoPEsRu-BMwVSCmY.js +0 -251
  30. package/dist/neon-serverless-BEVFA7yv-DGSPAG1z.js +0 -205
  31. package/dist/node-postgres-DQA7bEhW-CkM_cVLD.js +0 -216
  32. package/dist/nodefs-Bc8b83o_-DetP9qUa.js +0 -24
  33. package/dist/opfs-ahp-DbstDvx--CHskKtzG.js +0 -365
  34. package/dist/pg-ylxXyvKj-Hm8vcZoi.js +0 -279
  35. package/dist/pglite-CPs4w-D9-DHOg0D8W.js +0 -179
  36. package/dist/pglite-DMWgTUE6-BOIRUWUT.js +0 -2
  37. package/dist/planetscale-serverless-DUMheN-f-Dyc_W6V_.js +0 -172
  38. package/dist/query-builder-CLJAKedv-DTZiP7B6.js +0 -1715
  39. package/dist/query-builder-CT3_liD0-hhg5kRTk.js +0 -1347
  40. package/dist/session-BOEirggu-DTmpyU_x.js +0 -2485
  41. package/dist/session-CAUQtT0A-BoVK2x7A.js +0 -745
  42. package/dist/session-Cjeygn2Z-BO0mi6pq.js +0 -989
  43. package/dist/singlestore-Cdlo23hW-BuFJ4Zqb.js +0 -1647
  44. package/dist/sql-CNZp2yLp-Bwugq384.js +0 -611
  45. package/dist/sqlite-proxy-BgUfVEbZ-CsSkc-_K.js +0 -190
  46. package/dist/src-LcyXhCXE-C_vKJiLK.js +0 -1920
  47. package/dist/vercel-postgres-BYmFKsTS-CpV2usun.js +0 -203
@@ -1,2 +0,0 @@
1
- import { n as dn, t as Xe } from "./dist-C481edUb-CHbOkeXH.js";
2
- export { Xe as PGlite, dn as types };
@@ -1,240 +0,0 @@
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 { n as SQLiteAsyncDialect } 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 { createClient } from "@libsql/client";
6
- //#region ../db/dist/libsql-Nq-S0r5x.js
7
- var LibSQLSession = class LibSQLSession extends SQLiteSession {
8
- constructor(client, dialect, schema, options, tx) {
9
- super(dialect);
10
- this.client = client;
11
- this.schema = schema;
12
- this.options = options;
13
- this.tx = tx;
14
- this.logger = options.logger ?? new NoopLogger();
15
- this.cache = options.cache ?? new NoopCache();
16
- }
17
- static [entityKind] = "LibSQLSession";
18
- logger;
19
- cache;
20
- prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
21
- return new LibSQLPreparedQuery(this.client, query, this.logger, this.cache, queryMetadata, cacheConfig, fields, this.tx, executeMethod, isResponseInArrayMode, customResultMapper);
22
- }
23
- async batch(queries) {
24
- const preparedQueries = [];
25
- const builtQueries = [];
26
- for (const query of queries) {
27
- const preparedQuery = query._prepare();
28
- const builtQuery = preparedQuery.getQuery();
29
- preparedQueries.push(preparedQuery);
30
- builtQueries.push({
31
- sql: builtQuery.sql,
32
- args: builtQuery.params
33
- });
34
- }
35
- return (await this.client.batch(builtQueries)).map((result, i) => preparedQueries[i].mapResult(result, true));
36
- }
37
- async migrate(queries) {
38
- const preparedQueries = [];
39
- const builtQueries = [];
40
- for (const query of queries) {
41
- const preparedQuery = query._prepare();
42
- const builtQuery = preparedQuery.getQuery();
43
- preparedQueries.push(preparedQuery);
44
- builtQueries.push({
45
- sql: builtQuery.sql,
46
- args: builtQuery.params
47
- });
48
- }
49
- return (await this.client.migrate(builtQueries)).map((result, i) => preparedQueries[i].mapResult(result, true));
50
- }
51
- async transaction(transaction, _config) {
52
- const libsqlTx = await this.client.transaction();
53
- const session = new LibSQLSession(this.client, this.dialect, this.schema, this.options, libsqlTx);
54
- const tx = new LibSQLTransaction("async", this.dialect, session, this.schema);
55
- try {
56
- const result = await transaction(tx);
57
- await libsqlTx.commit();
58
- return result;
59
- } catch (err) {
60
- await libsqlTx.rollback();
61
- throw err;
62
- }
63
- }
64
- extractRawAllValueFromBatchResult(result) {
65
- return result.rows;
66
- }
67
- extractRawGetValueFromBatchResult(result) {
68
- return result.rows[0];
69
- }
70
- extractRawValuesValueFromBatchResult(result) {
71
- return result.rows;
72
- }
73
- };
74
- var LibSQLTransaction = class LibSQLTransaction extends SQLiteTransaction {
75
- static [entityKind] = "LibSQLTransaction";
76
- async transaction(transaction) {
77
- const savepointName = `sp${this.nestedIndex}`;
78
- const tx = new LibSQLTransaction("async", this.dialect, this.session, this.schema, this.nestedIndex + 1);
79
- await this.session.run(sql.raw(`savepoint ${savepointName}`));
80
- try {
81
- const result = await transaction(tx);
82
- await this.session.run(sql.raw(`release savepoint ${savepointName}`));
83
- return result;
84
- } catch (err) {
85
- await this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
86
- throw err;
87
- }
88
- }
89
- };
90
- var LibSQLPreparedQuery = class extends SQLitePreparedQuery {
91
- constructor(client, query, logger, cache, queryMetadata, cacheConfig, fields, tx, executeMethod, _isResponseInArrayMode, customResultMapper) {
92
- super("async", executeMethod, query, cache, queryMetadata, cacheConfig);
93
- this.client = client;
94
- this.logger = logger;
95
- this.fields = fields;
96
- this.tx = tx;
97
- this._isResponseInArrayMode = _isResponseInArrayMode;
98
- this.customResultMapper = customResultMapper;
99
- this.customResultMapper = customResultMapper;
100
- this.fields = fields;
101
- }
102
- static [entityKind] = "LibSQLPreparedQuery";
103
- async run(placeholderValues) {
104
- const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
105
- this.logger.logQuery(this.query.sql, params);
106
- return await this.queryWithCache(this.query.sql, params, async () => {
107
- const stmt = {
108
- sql: this.query.sql,
109
- args: params
110
- };
111
- return this.tx ? this.tx.execute(stmt) : this.client.execute(stmt);
112
- });
113
- }
114
- async all(placeholderValues) {
115
- const { fields, logger, query, tx, client, customResultMapper } = this;
116
- if (!fields && !customResultMapper) {
117
- const params = fillPlaceholders(query.params, placeholderValues ?? {});
118
- logger.logQuery(query.sql, params);
119
- return await this.queryWithCache(query.sql, params, async () => {
120
- const stmt = {
121
- sql: query.sql,
122
- args: params
123
- };
124
- return (tx ? tx.execute(stmt) : client.execute(stmt)).then(({ rows: rows2 }) => this.mapAllResult(rows2));
125
- });
126
- }
127
- const rows = await this.values(placeholderValues);
128
- return this.mapAllResult(rows);
129
- }
130
- mapAllResult(rows, isFromBatch) {
131
- if (isFromBatch) rows = rows.rows;
132
- if (!this.fields && !this.customResultMapper) return rows.map((row) => normalizeRow(row));
133
- if (this.customResultMapper) return this.customResultMapper(rows, normalizeFieldValue);
134
- return rows.map((row) => {
135
- return mapResultRow(this.fields, Array.prototype.slice.call(row).map((v) => normalizeFieldValue(v)), this.joinsNotNullableMap);
136
- });
137
- }
138
- async get(placeholderValues) {
139
- const { fields, logger, query, tx, client, customResultMapper } = this;
140
- if (!fields && !customResultMapper) {
141
- const params = fillPlaceholders(query.params, placeholderValues ?? {});
142
- logger.logQuery(query.sql, params);
143
- return await this.queryWithCache(query.sql, params, async () => {
144
- const stmt = {
145
- sql: query.sql,
146
- args: params
147
- };
148
- return (tx ? tx.execute(stmt) : client.execute(stmt)).then(({ rows: rows2 }) => this.mapGetResult(rows2));
149
- });
150
- }
151
- const rows = await this.values(placeholderValues);
152
- return this.mapGetResult(rows);
153
- }
154
- mapGetResult(rows, isFromBatch) {
155
- if (isFromBatch) rows = rows.rows;
156
- const row = rows[0];
157
- if (!this.fields && !this.customResultMapper) return normalizeRow(row);
158
- if (!row) return;
159
- if (this.customResultMapper) return this.customResultMapper(rows, normalizeFieldValue);
160
- return mapResultRow(this.fields, Array.prototype.slice.call(row).map((v) => normalizeFieldValue(v)), this.joinsNotNullableMap);
161
- }
162
- async values(placeholderValues) {
163
- const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
164
- this.logger.logQuery(this.query.sql, params);
165
- return await this.queryWithCache(this.query.sql, params, async () => {
166
- const stmt = {
167
- sql: this.query.sql,
168
- args: params
169
- };
170
- return (this.tx ? this.tx.execute(stmt) : this.client.execute(stmt)).then(({ rows }) => rows);
171
- });
172
- }
173
- /** @internal */
174
- isResponseInArrayMode() {
175
- return this._isResponseInArrayMode;
176
- }
177
- };
178
- function normalizeRow(obj) {
179
- return Object.keys(obj).reduce((acc, key) => {
180
- if (Object.prototype.propertyIsEnumerable.call(obj, key)) acc[key] = obj[key];
181
- return acc;
182
- }, {});
183
- }
184
- function normalizeFieldValue(value) {
185
- if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) {
186
- if (typeof Buffer !== "undefined") {
187
- if (!(value instanceof Buffer)) return Buffer.from(value);
188
- return value;
189
- }
190
- if (typeof TextDecoder !== "undefined") return new TextDecoder().decode(value);
191
- throw new Error("TextDecoder is not available. Please provide either Buffer or TextDecoder polyfill.");
192
- }
193
- return value;
194
- }
195
- var LibSQLDatabase = class extends BaseSQLiteDatabase {
196
- static [entityKind] = "LibSQLDatabase";
197
- async batch(batch) {
198
- return this.session.batch(batch);
199
- }
200
- };
201
- function construct(client, config = {}) {
202
- const dialect = new SQLiteAsyncDialect({ casing: config.casing });
203
- let logger;
204
- if (config.logger === true) logger = new DefaultLogger();
205
- else if (config.logger !== false) logger = config.logger;
206
- let schema;
207
- if (config.schema) {
208
- const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
209
- schema = {
210
- fullSchema: config.schema,
211
- schema: tablesConfig.tables,
212
- tableNamesMap: tablesConfig.tableNamesMap
213
- };
214
- }
215
- const db = new LibSQLDatabase("async", dialect, new LibSQLSession(client, dialect, schema, {
216
- logger,
217
- cache: config.cache
218
- }, void 0), schema);
219
- db.$client = client;
220
- db.$cache = config.cache;
221
- if (db.$cache) db.$cache["invalidate"] = config.cache?.onMutate;
222
- return db;
223
- }
224
- function drizzle(...params) {
225
- if (typeof params[0] === "string") return construct(createClient({ url: params[0] }), params[1]);
226
- if (isConfig(params[0])) {
227
- const { connection, client, ...drizzleConfig } = params[0];
228
- if (client) return construct(client, drizzleConfig);
229
- return construct(typeof connection === "string" ? createClient({ url: connection }) : createClient(connection), drizzleConfig);
230
- }
231
- return construct(params[0], params[1]);
232
- }
233
- ((drizzle2) => {
234
- function mock(config) {
235
- return construct({}, config);
236
- }
237
- drizzle2.mock = mock;
238
- })(drizzle || (drizzle = {}));
239
- //#endregion
240
- export { drizzle };