azure-mock 2.23.0 → 2.25.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 (46) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +16 -2
  3. package/dist/index.js +22191 -23584
  4. package/dist/tsconfig.tsbuildinfo +1 -0
  5. package/package.json +12 -6
  6. package/dist/better-sqlite3-CtLaF97z-DWR9uC3b.js +0 -129
  7. package/dist/chunk-2X2C5D2I-dJHtPFe9-DxsO-1YF.js +0 -4026
  8. package/dist/d1-pK2J-_yx-BoQTXsTa.js +0 -185
  9. package/dist/dialect-pBb6Cg_F-xgpUtfmk.js +0 -570
  10. package/dist/dist-C481edUb-CHbOkeXH.js +0 -10131
  11. package/dist/dist-DUzzleZr-DxHmeYjp.js +0 -2
  12. package/dist/libsql-Nq-S0r5x-d2dAzhgO.js +0 -240
  13. package/dist/logger-TIsK7375-CLNNa25D.js +0 -652
  14. package/dist/migrator-B9kYwLqO-4g9JX3_v.js +0 -8
  15. package/dist/migrator-BfTfJctM-DrNlb1BS.js +0 -8
  16. package/dist/migrator-BjoW0_3j-CD-XdZ5a.js +0 -8
  17. package/dist/migrator-CWWlo_Jk-C4Hw4PPN.js +0 -8
  18. package/dist/migrator-CpiXRkls-COYfhljd.js +0 -24
  19. package/dist/migrator-CtqJkLVI-D1lU6ZV0.js +0 -8
  20. package/dist/migrator-CxcBjmET-Dcd21VIf.js +0 -8
  21. package/dist/migrator-Cyhbhxo_-Bh7sF0R3.js +0 -21
  22. package/dist/migrator-DG1mWUoR-DVfkqn_v.js +0 -31
  23. package/dist/migrator-DrWmHwY2-YjAfotd7.js +0 -8
  24. package/dist/migrator-WAPonQxA-CRvJJhKG.js +0 -8
  25. package/dist/migrator-Zdh8WMMx-gsmNXspd.js +0 -8
  26. package/dist/migrator-xRJ6NOTS-SsAuB-Gi.js +0 -24
  27. package/dist/migrator-xbWwvFYF-BjyVdQS8.js +0 -8
  28. package/dist/mysql2-DkoPEsRu-BMwVSCmY.js +0 -251
  29. package/dist/neon-serverless-BEVFA7yv-DGSPAG1z.js +0 -205
  30. package/dist/node-postgres-DQA7bEhW-CkM_cVLD.js +0 -216
  31. package/dist/nodefs-Bc8b83o_-DetP9qUa.js +0 -24
  32. package/dist/opfs-ahp-DbstDvx--CHskKtzG.js +0 -365
  33. package/dist/pg-ylxXyvKj-Hm8vcZoi.js +0 -279
  34. package/dist/pglite-CPs4w-D9-DHOg0D8W.js +0 -179
  35. package/dist/pglite-DMWgTUE6-BOIRUWUT.js +0 -2
  36. package/dist/planetscale-serverless-DUMheN-f-Dyc_W6V_.js +0 -172
  37. package/dist/query-builder-CLJAKedv-DTZiP7B6.js +0 -1715
  38. package/dist/query-builder-CT3_liD0-hhg5kRTk.js +0 -1347
  39. package/dist/session-BOEirggu-DTmpyU_x.js +0 -2485
  40. package/dist/session-CAUQtT0A-BoVK2x7A.js +0 -745
  41. package/dist/session-Cjeygn2Z-BO0mi6pq.js +0 -989
  42. package/dist/singlestore-Cdlo23hW-BuFJ4Zqb.js +0 -1647
  43. package/dist/sql-CNZp2yLp-Bwugq384.js +0 -611
  44. package/dist/sqlite-proxy-BgUfVEbZ-CsSkc-_K.js +0 -190
  45. package/dist/src-LcyXhCXE-C_vKJiLK.js +0 -1920
  46. package/dist/vercel-postgres-BYmFKsTS-CpV2usun.js +0 -203
@@ -1,185 +0,0 @@
1
- import { C as sql, _ as fillPlaceholders, g as entityKind } from "./sql-CNZp2yLp-Bwugq384.js";
2
- import { M as mapResultRow, 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
- //#region ../db/dist/d1-pK2J-_yx.js
6
- var SQLiteD1Session = class extends SQLiteSession {
7
- constructor(client, dialect, schema, options = {}) {
8
- super(dialect);
9
- this.client = client;
10
- this.schema = schema;
11
- this.options = options;
12
- this.logger = options.logger ?? new NoopLogger();
13
- this.cache = options.cache ?? new NoopCache();
14
- }
15
- static [entityKind] = "SQLiteD1Session";
16
- logger;
17
- cache;
18
- prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
19
- return new D1PreparedQuery(this.client.prepare(query.sql), query, this.logger, this.cache, queryMetadata, cacheConfig, fields, executeMethod, isResponseInArrayMode, customResultMapper);
20
- }
21
- async batch(queries) {
22
- const preparedQueries = [];
23
- const builtQueries = [];
24
- for (const query of queries) {
25
- const preparedQuery = query._prepare();
26
- const builtQuery = preparedQuery.getQuery();
27
- preparedQueries.push(preparedQuery);
28
- if (builtQuery.params.length > 0) builtQueries.push(preparedQuery.stmt.bind(...builtQuery.params));
29
- else {
30
- const builtQuery2 = preparedQuery.getQuery();
31
- builtQueries.push(this.client.prepare(builtQuery2.sql).bind(...builtQuery2.params));
32
- }
33
- }
34
- return (await this.client.batch(builtQueries)).map((result, i) => preparedQueries[i].mapResult(result, true));
35
- }
36
- extractRawAllValueFromBatchResult(result) {
37
- return result.results;
38
- }
39
- extractRawGetValueFromBatchResult(result) {
40
- return result.results[0];
41
- }
42
- extractRawValuesValueFromBatchResult(result) {
43
- return d1ToRawMapping(result.results);
44
- }
45
- async transaction(transaction, config) {
46
- const tx = new D1Transaction("async", this.dialect, this, this.schema);
47
- await this.run(sql.raw(`begin${config?.behavior ? " " + config.behavior : ""}`));
48
- try {
49
- const result = await transaction(tx);
50
- await this.run(sql`commit`);
51
- return result;
52
- } catch (err) {
53
- await this.run(sql`rollback`);
54
- throw err;
55
- }
56
- }
57
- };
58
- var D1Transaction = class D1Transaction extends SQLiteTransaction {
59
- static [entityKind] = "D1Transaction";
60
- async transaction(transaction) {
61
- const savepointName = `sp${this.nestedIndex}`;
62
- const tx = new D1Transaction("async", this.dialect, this.session, this.schema, this.nestedIndex + 1);
63
- await this.session.run(sql.raw(`savepoint ${savepointName}`));
64
- try {
65
- const result = await transaction(tx);
66
- await this.session.run(sql.raw(`release savepoint ${savepointName}`));
67
- return result;
68
- } catch (err) {
69
- await this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
70
- throw err;
71
- }
72
- }
73
- };
74
- function d1ToRawMapping(results) {
75
- const rows = [];
76
- for (const row of results) {
77
- const entry = Object.keys(row).map((k) => row[k]);
78
- rows.push(entry);
79
- }
80
- return rows;
81
- }
82
- var D1PreparedQuery = class extends SQLitePreparedQuery {
83
- constructor(stmt, query, logger, cache, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
84
- super("async", executeMethod, query, cache, queryMetadata, cacheConfig);
85
- this.logger = logger;
86
- this._isResponseInArrayMode = _isResponseInArrayMode;
87
- this.customResultMapper = customResultMapper;
88
- this.fields = fields;
89
- this.stmt = stmt;
90
- }
91
- static [entityKind] = "D1PreparedQuery";
92
- /** @internal */
93
- customResultMapper;
94
- /** @internal */
95
- fields;
96
- /** @internal */
97
- stmt;
98
- async run(placeholderValues) {
99
- const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
100
- this.logger.logQuery(this.query.sql, params);
101
- return await this.queryWithCache(this.query.sql, params, async () => {
102
- return this.stmt.bind(...params).run();
103
- });
104
- }
105
- async all(placeholderValues) {
106
- const { fields, query, logger, stmt, customResultMapper } = this;
107
- if (!fields && !customResultMapper) {
108
- const params = fillPlaceholders(query.params, placeholderValues ?? {});
109
- logger.logQuery(query.sql, params);
110
- return await this.queryWithCache(query.sql, params, async () => {
111
- return stmt.bind(...params).all().then(({ results }) => this.mapAllResult(results));
112
- });
113
- }
114
- const rows = await this.values(placeholderValues);
115
- return this.mapAllResult(rows);
116
- }
117
- mapAllResult(rows, isFromBatch) {
118
- if (isFromBatch) rows = d1ToRawMapping(rows.results);
119
- if (!this.fields && !this.customResultMapper) return rows;
120
- if (this.customResultMapper) return this.customResultMapper(rows);
121
- return rows.map((row) => mapResultRow(this.fields, row, this.joinsNotNullableMap));
122
- }
123
- async get(placeholderValues) {
124
- const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
125
- if (!fields && !customResultMapper) {
126
- const params = fillPlaceholders(query.params, placeholderValues ?? {});
127
- logger.logQuery(query.sql, params);
128
- return await this.queryWithCache(query.sql, params, async () => {
129
- return stmt.bind(...params).all().then(({ results }) => results[0]);
130
- });
131
- }
132
- const rows = await this.values(placeholderValues);
133
- if (!rows[0]) return;
134
- if (customResultMapper) return customResultMapper(rows);
135
- return mapResultRow(fields, rows[0], joinsNotNullableMap);
136
- }
137
- mapGetResult(result, isFromBatch) {
138
- if (isFromBatch) result = d1ToRawMapping(result.results)[0];
139
- if (!this.fields && !this.customResultMapper) return result;
140
- if (this.customResultMapper) return this.customResultMapper([result]);
141
- return mapResultRow(this.fields, result, this.joinsNotNullableMap);
142
- }
143
- async values(placeholderValues) {
144
- const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
145
- this.logger.logQuery(this.query.sql, params);
146
- return await this.queryWithCache(this.query.sql, params, async () => {
147
- return this.stmt.bind(...params).raw();
148
- });
149
- }
150
- /** @internal */
151
- isResponseInArrayMode() {
152
- return this._isResponseInArrayMode;
153
- }
154
- };
155
- var DrizzleD1Database = class extends BaseSQLiteDatabase {
156
- static [entityKind] = "D1Database";
157
- async batch(batch) {
158
- return this.session.batch(batch);
159
- }
160
- };
161
- function drizzle(client, config = {}) {
162
- const dialect = new SQLiteAsyncDialect({ casing: config.casing });
163
- let logger;
164
- if (config.logger === true) logger = new DefaultLogger();
165
- else if (config.logger !== false) logger = config.logger;
166
- let schema;
167
- if (config.schema) {
168
- const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
169
- schema = {
170
- fullSchema: config.schema,
171
- schema: tablesConfig.tables,
172
- tableNamesMap: tablesConfig.tableNamesMap
173
- };
174
- }
175
- const db = new DrizzleD1Database("async", dialect, new SQLiteD1Session(client, dialect, schema, {
176
- logger,
177
- cache: config.cache
178
- }), schema);
179
- db.$client = client;
180
- db.$cache = config.cache;
181
- if (db.$cache) db.$cache["invalidate"] = config.cache?.onMutate;
182
- return db;
183
- }
184
- //#endregion
185
- export { drizzle };