typeorm 0.3.22-dev.6ba4082 → 0.3.22-dev.72c6991
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/browser/driver/DriverFactory.js +2 -2
- package/browser/driver/DriverFactory.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachDriver.js +3 -5
- package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js +1 -1
- package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/browser/driver/expo/ExpoDriver.d.ts +2 -12
- package/browser/driver/expo/ExpoDriver.js +8 -54
- package/browser/driver/expo/ExpoDriver.js.map +1 -1
- package/browser/driver/expo/ExpoDriverFactory.d.ts +9 -0
- package/browser/driver/expo/ExpoDriverFactory.js +18 -0
- package/browser/driver/expo/ExpoDriverFactory.js.map +1 -0
- package/browser/driver/expo/ExpoQueryRunner.d.ts +0 -48
- package/browser/driver/expo/ExpoQueryRunner.js +36 -141
- package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/browser/driver/expo/legacy/ExpoLegacyDriver.d.ts +21 -0
- package/browser/driver/expo/legacy/ExpoLegacyDriver.js +71 -0
- package/browser/driver/expo/legacy/ExpoLegacyDriver.js.map +1 -0
- package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.d.ts +57 -0
- package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js +165 -0
- package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -0
- package/browser/driver/mongodb/MongoConnectionOptions.d.ts +111 -142
- package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/browser/driver/mongodb/MongoDriver.d.ts +2 -3
- package/browser/driver/mongodb/MongoDriver.js +57 -65
- package/browser/driver/mongodb/MongoDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresDriver.js +3 -5
- package/browser/driver/postgres/PostgresDriver.js.map +1 -1
- package/browser/driver/postgres/PostgresQueryRunner.js +11 -2
- package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/browser/driver/sap/SapDriver.js +43 -35
- package/browser/driver/sap/SapDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.d.ts +4 -1
- package/browser/driver/sap/SapQueryRunner.js +6 -16
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/index.d.ts +1 -0
- package/browser/index.js +1 -0
- package/browser/index.js.map +1 -1
- package/browser/migration/MigrationExecutor.js +2 -2
- package/browser/migration/MigrationExecutor.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +3 -3
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/subscriber/event/QueryEvent.d.ts +1 -1
- package/browser/subscriber/event/QueryEvent.js.map +1 -1
- package/commands/MigrationGenerateCommand.js +2 -2
- package/commands/MigrationGenerateCommand.js.map +1 -1
- package/driver/DriverFactory.js +2 -2
- package/driver/DriverFactory.js.map +1 -1
- package/driver/cockroachdb/CockroachDriver.js +3 -5
- package/driver/cockroachdb/CockroachDriver.js.map +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.js +1 -1
- package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
- package/driver/expo/ExpoDriver.d.ts +2 -12
- package/driver/expo/ExpoDriver.js +8 -54
- package/driver/expo/ExpoDriver.js.map +1 -1
- package/driver/expo/ExpoDriverFactory.d.ts +9 -0
- package/driver/expo/ExpoDriverFactory.js +22 -0
- package/driver/expo/ExpoDriverFactory.js.map +1 -0
- package/driver/expo/ExpoQueryRunner.d.ts +0 -48
- package/driver/expo/ExpoQueryRunner.js +36 -141
- package/driver/expo/ExpoQueryRunner.js.map +1 -1
- package/driver/expo/legacy/ExpoLegacyDriver.d.ts +21 -0
- package/driver/expo/legacy/ExpoLegacyDriver.js +75 -0
- package/driver/expo/legacy/ExpoLegacyDriver.js.map +1 -0
- package/driver/expo/legacy/ExpoLegacyQueryRunner.d.ts +57 -0
- package/driver/expo/legacy/ExpoLegacyQueryRunner.js +169 -0
- package/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -0
- package/driver/mongodb/MongoConnectionOptions.d.ts +111 -142
- package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
- package/driver/mongodb/MongoDriver.d.ts +2 -3
- package/driver/mongodb/MongoDriver.js +57 -65
- package/driver/mongodb/MongoDriver.js.map +1 -1
- package/driver/postgres/PostgresDriver.js +3 -5
- package/driver/postgres/PostgresDriver.js.map +1 -1
- package/driver/postgres/PostgresQueryRunner.js +11 -2
- package/driver/postgres/PostgresQueryRunner.js.map +1 -1
- package/driver/sap/SapDriver.js +43 -35
- package/driver/sap/SapDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.d.ts +4 -1
- package/driver/sap/SapQueryRunner.js +6 -16
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/migration/MigrationExecutor.js +2 -2
- package/migration/MigrationExecutor.js.map +1 -1
- package/package.json +1 -1
- package/query-builder/InsertQueryBuilder.js +3 -3
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/subscriber/event/QueryEvent.d.ts +1 -1
- package/subscriber/event/QueryEvent.js.map +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AbstractSqliteQueryRunner } from "../../sqlite-abstract/AbstractSqliteQueryRunner";
|
|
2
|
+
import { ExpoLegacyDriver } from "./ExpoLegacyDriver";
|
|
3
|
+
/**
|
|
4
|
+
* Runs queries on a single sqlite database connection.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner {
|
|
7
|
+
/**
|
|
8
|
+
* Database driver used by connection.
|
|
9
|
+
*/
|
|
10
|
+
driver: ExpoLegacyDriver;
|
|
11
|
+
/**
|
|
12
|
+
* Database transaction object
|
|
13
|
+
*/
|
|
14
|
+
private transaction?;
|
|
15
|
+
constructor(driver: ExpoLegacyDriver);
|
|
16
|
+
/**
|
|
17
|
+
* Starts transaction. Within Expo, all database operations happen in a
|
|
18
|
+
* transaction context, so issuing a `BEGIN TRANSACTION` command is
|
|
19
|
+
* redundant and will result in the following error:
|
|
20
|
+
*
|
|
21
|
+
* `Error: Error code 1: cannot start a transaction within a transaction`
|
|
22
|
+
*
|
|
23
|
+
* Instead, we keep track of a `Transaction` object in `this.transaction`
|
|
24
|
+
* and continue using the same object until we wish to commit the
|
|
25
|
+
* transaction.
|
|
26
|
+
*/
|
|
27
|
+
startTransaction(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Commits transaction.
|
|
30
|
+
* Error will be thrown if transaction was not started.
|
|
31
|
+
* Since Expo will automatically commit the transaction once all the
|
|
32
|
+
* callbacks of the transaction object have been completed, "committing" a
|
|
33
|
+
* transaction in this driver's context means that we delete the transaction
|
|
34
|
+
* object and set the stage for the next transaction.
|
|
35
|
+
*/
|
|
36
|
+
commitTransaction(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Rollbacks transaction.
|
|
39
|
+
* Error will be thrown if transaction was not started.
|
|
40
|
+
* This method's functionality is identical to `commitTransaction()` because
|
|
41
|
+
* the transaction lifecycle is handled within the Expo transaction object.
|
|
42
|
+
* Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.
|
|
43
|
+
*/
|
|
44
|
+
rollbackTransaction(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Called before migrations are run.
|
|
47
|
+
*/
|
|
48
|
+
beforeMigration(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Called after migrations are run.
|
|
51
|
+
*/
|
|
52
|
+
afterMigration(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Executes a given SQL query.
|
|
55
|
+
*/
|
|
56
|
+
query(query: string, parameters?: any[], useStructuredResult?: boolean): Promise<any>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpoLegacyQueryRunner = void 0;
|
|
4
|
+
const QueryRunnerAlreadyReleasedError_1 = require("../../../error/QueryRunnerAlreadyReleasedError");
|
|
5
|
+
const QueryFailedError_1 = require("../../../error/QueryFailedError");
|
|
6
|
+
const AbstractSqliteQueryRunner_1 = require("../../sqlite-abstract/AbstractSqliteQueryRunner");
|
|
7
|
+
const TransactionNotStartedError_1 = require("../../../error/TransactionNotStartedError");
|
|
8
|
+
const Broadcaster_1 = require("../../../subscriber/Broadcaster");
|
|
9
|
+
const QueryResult_1 = require("../../../query-runner/QueryResult");
|
|
10
|
+
const BroadcasterResult_1 = require("../../../subscriber/BroadcasterResult");
|
|
11
|
+
/**
|
|
12
|
+
* Runs queries on a single sqlite database connection.
|
|
13
|
+
*/
|
|
14
|
+
class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner_1.AbstractSqliteQueryRunner {
|
|
15
|
+
// -------------------------------------------------------------------------
|
|
16
|
+
// Constructor
|
|
17
|
+
// -------------------------------------------------------------------------
|
|
18
|
+
constructor(driver) {
|
|
19
|
+
super();
|
|
20
|
+
this.driver = driver;
|
|
21
|
+
this.connection = driver.connection;
|
|
22
|
+
this.broadcaster = new Broadcaster_1.Broadcaster(this);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Starts transaction. Within Expo, all database operations happen in a
|
|
26
|
+
* transaction context, so issuing a `BEGIN TRANSACTION` command is
|
|
27
|
+
* redundant and will result in the following error:
|
|
28
|
+
*
|
|
29
|
+
* `Error: Error code 1: cannot start a transaction within a transaction`
|
|
30
|
+
*
|
|
31
|
+
* Instead, we keep track of a `Transaction` object in `this.transaction`
|
|
32
|
+
* and continue using the same object until we wish to commit the
|
|
33
|
+
* transaction.
|
|
34
|
+
*/
|
|
35
|
+
async startTransaction() {
|
|
36
|
+
this.isTransactionActive = true;
|
|
37
|
+
try {
|
|
38
|
+
await this.broadcaster.broadcast("BeforeTransactionStart");
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
this.isTransactionActive = false;
|
|
42
|
+
throw err;
|
|
43
|
+
}
|
|
44
|
+
this.transactionDepth += 1;
|
|
45
|
+
await this.broadcaster.broadcast("AfterTransactionStart");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Commits transaction.
|
|
49
|
+
* Error will be thrown if transaction was not started.
|
|
50
|
+
* Since Expo will automatically commit the transaction once all the
|
|
51
|
+
* callbacks of the transaction object have been completed, "committing" a
|
|
52
|
+
* transaction in this driver's context means that we delete the transaction
|
|
53
|
+
* object and set the stage for the next transaction.
|
|
54
|
+
*/
|
|
55
|
+
async commitTransaction() {
|
|
56
|
+
if (!this.isTransactionActive &&
|
|
57
|
+
typeof this.transaction === "undefined")
|
|
58
|
+
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
59
|
+
await this.broadcaster.broadcast("BeforeTransactionCommit");
|
|
60
|
+
this.transaction = undefined;
|
|
61
|
+
this.isTransactionActive = false;
|
|
62
|
+
this.transactionDepth -= 1;
|
|
63
|
+
await this.broadcaster.broadcast("AfterTransactionCommit");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Rollbacks transaction.
|
|
67
|
+
* Error will be thrown if transaction was not started.
|
|
68
|
+
* This method's functionality is identical to `commitTransaction()` because
|
|
69
|
+
* the transaction lifecycle is handled within the Expo transaction object.
|
|
70
|
+
* Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.
|
|
71
|
+
*/
|
|
72
|
+
async rollbackTransaction() {
|
|
73
|
+
if (!this.isTransactionActive &&
|
|
74
|
+
typeof this.transaction === "undefined")
|
|
75
|
+
throw new TransactionNotStartedError_1.TransactionNotStartedError();
|
|
76
|
+
await this.broadcaster.broadcast("BeforeTransactionRollback");
|
|
77
|
+
this.transaction = undefined;
|
|
78
|
+
this.isTransactionActive = false;
|
|
79
|
+
this.transactionDepth -= 1;
|
|
80
|
+
await this.broadcaster.broadcast("AfterTransactionRollback");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Called before migrations are run.
|
|
84
|
+
*/
|
|
85
|
+
async beforeMigration() {
|
|
86
|
+
const databaseConnection = await this.connect();
|
|
87
|
+
return new Promise((ok, fail) => {
|
|
88
|
+
databaseConnection.exec([{ sql: "PRAGMA foreign_keys = OFF", args: [] }], false, (err) => (err ? fail(err) : ok()));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Called after migrations are run.
|
|
93
|
+
*/
|
|
94
|
+
async afterMigration() {
|
|
95
|
+
const databaseConnection = await this.connect();
|
|
96
|
+
return new Promise((ok, fail) => {
|
|
97
|
+
databaseConnection.exec([{ sql: "PRAGMA foreign_keys = ON", args: [] }], false, (err) => (err ? fail(err) : ok()));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Executes a given SQL query.
|
|
102
|
+
*/
|
|
103
|
+
async query(query, parameters, useStructuredResult = false) {
|
|
104
|
+
if (this.isReleased)
|
|
105
|
+
throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
|
|
106
|
+
return new Promise(async (ok, fail) => {
|
|
107
|
+
const databaseConnection = await this.connect();
|
|
108
|
+
const broadcasterResult = new BroadcasterResult_1.BroadcasterResult();
|
|
109
|
+
this.driver.connection.logger.logQuery(query, parameters, this);
|
|
110
|
+
this.broadcaster.broadcastBeforeQueryEvent(broadcasterResult, query, parameters);
|
|
111
|
+
const queryStartTime = +new Date();
|
|
112
|
+
// All Expo SQL queries are executed in a transaction context
|
|
113
|
+
databaseConnection.transaction(async (transaction) => {
|
|
114
|
+
if (typeof this.transaction === "undefined") {
|
|
115
|
+
await this.startTransaction();
|
|
116
|
+
this.transaction = transaction;
|
|
117
|
+
}
|
|
118
|
+
this.transaction.executeSql(query, parameters, async (t, raw) => {
|
|
119
|
+
// log slow queries if maxQueryExecution time is set
|
|
120
|
+
const maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime;
|
|
121
|
+
const queryEndTime = +new Date();
|
|
122
|
+
const queryExecutionTime = queryEndTime - queryStartTime;
|
|
123
|
+
this.broadcaster.broadcastAfterQueryEvent(broadcasterResult, query, parameters, true, queryExecutionTime, raw, undefined);
|
|
124
|
+
await broadcasterResult.wait();
|
|
125
|
+
if (maxQueryExecutionTime &&
|
|
126
|
+
queryExecutionTime > maxQueryExecutionTime) {
|
|
127
|
+
this.driver.connection.logger.logQuerySlow(queryExecutionTime, query, parameters, this);
|
|
128
|
+
}
|
|
129
|
+
const result = new QueryResult_1.QueryResult();
|
|
130
|
+
if (raw?.hasOwnProperty("rowsAffected")) {
|
|
131
|
+
result.affected = raw.rowsAffected;
|
|
132
|
+
}
|
|
133
|
+
if (raw?.hasOwnProperty("rows")) {
|
|
134
|
+
let resultSet = [];
|
|
135
|
+
for (let i = 0; i < raw.rows.length; i++) {
|
|
136
|
+
resultSet.push(raw.rows.item(i));
|
|
137
|
+
}
|
|
138
|
+
result.raw = resultSet;
|
|
139
|
+
result.records = resultSet;
|
|
140
|
+
}
|
|
141
|
+
// return id of inserted row, if query was insert statement.
|
|
142
|
+
if (query.startsWith("INSERT INTO")) {
|
|
143
|
+
result.raw = raw.insertId;
|
|
144
|
+
}
|
|
145
|
+
if (useStructuredResult) {
|
|
146
|
+
ok(result);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
ok(result.raw);
|
|
150
|
+
}
|
|
151
|
+
}, async (t, err) => {
|
|
152
|
+
this.driver.connection.logger.logQueryError(err, query, parameters, this);
|
|
153
|
+
this.broadcaster.broadcastAfterQueryEvent(broadcasterResult, query, parameters, false, undefined, undefined, err);
|
|
154
|
+
await broadcasterResult.wait();
|
|
155
|
+
fail(new QueryFailedError_1.QueryFailedError(query, parameters, err));
|
|
156
|
+
});
|
|
157
|
+
}, async (err) => {
|
|
158
|
+
await this.rollbackTransaction();
|
|
159
|
+
fail(err);
|
|
160
|
+
}, () => {
|
|
161
|
+
this.isTransactionActive = false;
|
|
162
|
+
this.transaction = undefined;
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.ExpoLegacyQueryRunner = ExpoLegacyQueryRunner;
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=ExpoLegacyQueryRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/driver/expo/legacy/ExpoLegacyQueryRunner.ts"],"names":[],"mappings":";;;AAAA,oGAAgG;AAChG,sEAAkE;AAClE,+FAA2F;AAC3F,0FAAsF;AAEtF,iEAA6D;AAC7D,mEAA+D;AAC/D,6EAAyE;AAqBzE;;GAEG;AACH,MAAa,qBAAsB,SAAQ,qDAAyB;IAWhE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,MAAwB;QAChC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,gBAAgB;QAClB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;QAC/B,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAA;QAC9D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAA;YAChC,MAAM,GAAG,CAAA;QACb,CAAC;QAED,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAA;QAE1B,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAA;IAC7D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB;QACnB,IACI,CAAC,IAAI,CAAC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AAC;CACJ;AAvPD,sDAuPC","file":"ExpoLegacyQueryRunner.js","sourcesContent":["import { QueryRunnerAlreadyReleasedError } from \"../../../error/QueryRunnerAlreadyReleasedError\"\nimport { QueryFailedError } from \"../../../error/QueryFailedError\"\nimport { AbstractSqliteQueryRunner } from \"../../sqlite-abstract/AbstractSqliteQueryRunner\"\nimport { TransactionNotStartedError } from \"../../../error/TransactionNotStartedError\"\nimport { ExpoLegacyDriver } from \"./ExpoLegacyDriver\"\nimport { Broadcaster } from \"../../../subscriber/Broadcaster\"\nimport { QueryResult } from \"../../../query-runner/QueryResult\"\nimport { BroadcasterResult } from \"../../../subscriber/BroadcasterResult\"\n\n// Needed to satisfy the Typescript compiler\ninterface IResultSet {\n insertId: number | undefined\n rowsAffected: number\n rows: {\n length: number\n item: (idx: number) => any\n _array: any[]\n }\n}\ninterface ITransaction {\n executeSql: (\n sql: string,\n args: any[] | undefined,\n ok: (tsx: ITransaction, resultSet: IResultSet) => void,\n fail: (tsx: ITransaction, err: any) => void,\n ) => void\n}\n\n/**\n * Runs queries on a single sqlite database connection.\n */\nexport class ExpoLegacyQueryRunner extends AbstractSqliteQueryRunner {\n /**\n * Database driver used by connection.\n */\n driver: ExpoLegacyDriver\n\n /**\n * Database transaction object\n */\n private transaction?: ITransaction\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(driver: ExpoLegacyDriver) {\n super()\n this.driver = driver\n this.connection = driver.connection\n this.broadcaster = new Broadcaster(this)\n }\n\n /**\n * Starts transaction. Within Expo, all database operations happen in a\n * transaction context, so issuing a `BEGIN TRANSACTION` command is\n * redundant and will result in the following error:\n *\n * `Error: Error code 1: cannot start a transaction within a transaction`\n *\n * Instead, we keep track of a `Transaction` object in `this.transaction`\n * and continue using the same object until we wish to commit the\n * transaction.\n */\n async startTransaction(): Promise<void> {\n this.isTransactionActive = true\n try {\n await this.broadcaster.broadcast(\"BeforeTransactionStart\")\n } catch (err) {\n this.isTransactionActive = false\n throw err\n }\n\n this.transactionDepth += 1\n\n await this.broadcaster.broadcast(\"AfterTransactionStart\")\n }\n\n /**\n * Commits transaction.\n * Error will be thrown if transaction was not started.\n * Since Expo will automatically commit the transaction once all the\n * callbacks of the transaction object have been completed, \"committing\" a\n * transaction in this driver's context means that we delete the transaction\n * object and set the stage for the next transaction.\n */\n async commitTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionCommit\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionCommit\")\n }\n\n /**\n * Rollbacks transaction.\n * Error will be thrown if transaction was not started.\n * This method's functionality is identical to `commitTransaction()` because\n * the transaction lifecycle is handled within the Expo transaction object.\n * Issuing separate statements for `COMMIT` or `ROLLBACK` aren't necessary.\n */\n async rollbackTransaction(): Promise<void> {\n if (\n !this.isTransactionActive &&\n typeof this.transaction === \"undefined\"\n )\n throw new TransactionNotStartedError()\n\n await this.broadcaster.broadcast(\"BeforeTransactionRollback\")\n\n this.transaction = undefined\n this.isTransactionActive = false\n\n this.transactionDepth -= 1\n\n await this.broadcaster.broadcast(\"AfterTransactionRollback\")\n }\n\n /**\n * Called before migrations are run.\n */\n async beforeMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = OFF\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Called after migrations are run.\n */\n async afterMigration(): Promise<void> {\n const databaseConnection = await this.connect()\n return new Promise((ok, fail) => {\n databaseConnection.exec(\n [{ sql: \"PRAGMA foreign_keys = ON\", args: [] }],\n false,\n (err: any) => (err ? fail(err) : ok()),\n )\n })\n }\n\n /**\n * Executes a given SQL query.\n */\n async query(\n query: string,\n parameters?: any[],\n useStructuredResult = false,\n ): Promise<any> {\n if (this.isReleased) throw new QueryRunnerAlreadyReleasedError()\n\n return new Promise<any>(async (ok, fail) => {\n const databaseConnection = await this.connect()\n const broadcasterResult = new BroadcasterResult()\n\n this.driver.connection.logger.logQuery(query, parameters, this)\n this.broadcaster.broadcastBeforeQueryEvent(\n broadcasterResult,\n query,\n parameters,\n )\n\n const queryStartTime = +new Date()\n // All Expo SQL queries are executed in a transaction context\n databaseConnection.transaction(\n async (transaction: ITransaction) => {\n if (typeof this.transaction === \"undefined\") {\n await this.startTransaction()\n this.transaction = transaction\n }\n this.transaction.executeSql(\n query,\n parameters,\n async (t: ITransaction, raw: IResultSet) => {\n // log slow queries if maxQueryExecution time is set\n const maxQueryExecutionTime =\n this.driver.options.maxQueryExecutionTime\n const queryEndTime = +new Date()\n const queryExecutionTime =\n queryEndTime - queryStartTime\n\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n true,\n queryExecutionTime,\n raw,\n undefined,\n )\n await broadcasterResult.wait()\n\n if (\n maxQueryExecutionTime &&\n queryExecutionTime > maxQueryExecutionTime\n ) {\n this.driver.connection.logger.logQuerySlow(\n queryExecutionTime,\n query,\n parameters,\n this,\n )\n }\n\n const result = new QueryResult()\n\n if (raw?.hasOwnProperty(\"rowsAffected\")) {\n result.affected = raw.rowsAffected\n }\n\n if (raw?.hasOwnProperty(\"rows\")) {\n let resultSet = []\n for (let i = 0; i < raw.rows.length; i++) {\n resultSet.push(raw.rows.item(i))\n }\n\n result.raw = resultSet\n result.records = resultSet\n }\n\n // return id of inserted row, if query was insert statement.\n if (query.startsWith(\"INSERT INTO\")) {\n result.raw = raw.insertId\n }\n\n if (useStructuredResult) {\n ok(result)\n } else {\n ok(result.raw)\n }\n },\n async (t: ITransaction, err: any) => {\n this.driver.connection.logger.logQueryError(\n err,\n query,\n parameters,\n this,\n )\n this.broadcaster.broadcastAfterQueryEvent(\n broadcasterResult,\n query,\n parameters,\n false,\n undefined,\n undefined,\n err,\n )\n await broadcasterResult.wait()\n\n fail(new QueryFailedError(query, parameters, err))\n },\n )\n },\n async (err: any) => {\n await this.rollbackTransaction()\n fail(err)\n },\n () => {\n this.isTransactionActive = false\n this.transaction = undefined\n },\n )\n })\n }\n}\n"],"sourceRoot":"../../.."}
|
|
@@ -2,7 +2,6 @@ import { BaseDataSourceOptions } from "../../data-source/BaseDataSourceOptions";
|
|
|
2
2
|
import { ReadPreference } from "./typings";
|
|
3
3
|
/**
|
|
4
4
|
* MongoDB specific connection options.
|
|
5
|
-
* Synced with http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html
|
|
6
5
|
*/
|
|
7
6
|
export interface MongoConnectionOptions extends BaseDataSourceOptions {
|
|
8
7
|
/**
|
|
@@ -37,246 +36,216 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
|
|
|
37
36
|
* Database name to connect to.
|
|
38
37
|
*/
|
|
39
38
|
readonly database?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Specifies whether to force dispatch all operations to the specified host. Default: false
|
|
42
|
-
*/
|
|
43
|
-
readonly directConnection?: boolean;
|
|
44
39
|
/**
|
|
45
40
|
* The driver object
|
|
46
41
|
* This defaults to require("mongodb")
|
|
47
42
|
*/
|
|
48
43
|
readonly driver?: any;
|
|
49
44
|
/**
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
readonly ssl?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).
|
|
55
|
-
* Default: true
|
|
56
|
-
*/
|
|
57
|
-
readonly sslValidate?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Array of valid certificates either as Buffers or Strings
|
|
60
|
-
* (needs to have a mongod server with ssl support, 2.4 or higher).
|
|
45
|
+
* MongoClientOptions
|
|
46
|
+
* Synced with https://mongodb.github.io/node-mongodb-native/5.9/interfaces/MongoClientOptions.html
|
|
61
47
|
*/
|
|
62
|
-
readonly sslCA?: string | Buffer;
|
|
63
48
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
49
|
+
* The name of the application that created this MongoClient instance.
|
|
50
|
+
* MongoDB 3.4 and newer will print this value in the server log upon establishing each connection.
|
|
51
|
+
* It is also recorded in the slow query log and profile collections
|
|
66
52
|
*/
|
|
67
|
-
readonly
|
|
53
|
+
readonly appName?: string;
|
|
68
54
|
/**
|
|
69
|
-
*
|
|
70
|
-
* (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
55
|
+
* Specify the authentication mechanism that MongoDB will use to authenticate the connection.
|
|
71
56
|
*/
|
|
72
|
-
readonly
|
|
73
|
-
/**
|
|
74
|
-
* String or buffer containing the certificate password
|
|
75
|
-
* (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
76
|
-
*/
|
|
77
|
-
readonly sslPass?: string | Buffer;
|
|
57
|
+
readonly authMechanism?: string;
|
|
78
58
|
/**
|
|
79
|
-
*
|
|
80
|
-
* (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
59
|
+
* Specify the database name associated with the user’s credentials.
|
|
81
60
|
*/
|
|
82
|
-
readonly
|
|
61
|
+
readonly authSource?: string;
|
|
83
62
|
/**
|
|
84
|
-
*
|
|
63
|
+
* Optionally enable in-use auto encryption
|
|
85
64
|
*/
|
|
86
|
-
readonly
|
|
65
|
+
readonly autoEncryption?: any;
|
|
87
66
|
/**
|
|
88
|
-
*
|
|
67
|
+
* Verifies the certificate `cert` is issued to `hostname`.
|
|
89
68
|
*/
|
|
90
|
-
readonly
|
|
69
|
+
readonly checkServerIdentity?: Function;
|
|
91
70
|
/**
|
|
92
|
-
*
|
|
71
|
+
* An array or comma-delimited string of compressors to enable network
|
|
72
|
+
* compression for communication between this client and a mongod/mongos instance.
|
|
93
73
|
*/
|
|
94
|
-
readonly
|
|
74
|
+
readonly compressors?: string | string[];
|
|
95
75
|
/**
|
|
96
|
-
*
|
|
76
|
+
* The time in milliseconds to attempt a connection before timing out.
|
|
97
77
|
*/
|
|
98
78
|
readonly connectTimeoutMS?: number;
|
|
99
79
|
/**
|
|
100
|
-
*
|
|
101
|
-
* If undefined, will attempt to connect with IPv6, and will fall back to IPv4 on failure
|
|
80
|
+
* Allow a driver to force a Single topology type with a connection string containing one host
|
|
102
81
|
*/
|
|
103
|
-
readonly
|
|
104
|
-
/**
|
|
105
|
-
* TCP Socket timeout setting. Default: 360000
|
|
106
|
-
*/
|
|
107
|
-
readonly socketTimeoutMS?: number;
|
|
108
|
-
/**
|
|
109
|
-
* Server attempt to reconnect #times. Default 30
|
|
110
|
-
*/
|
|
111
|
-
readonly reconnectTries?: number;
|
|
112
|
-
/**
|
|
113
|
-
* Server will wait #milliseconds between retries. Default 1000
|
|
114
|
-
*/
|
|
115
|
-
readonly reconnectInterval?: number;
|
|
116
|
-
/**
|
|
117
|
-
* Control if high availability monitoring runs for Replicaset or Mongos proxies. Default true
|
|
118
|
-
*/
|
|
119
|
-
readonly ha?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* The High availability period for replicaset inquiry. Default: 10000
|
|
122
|
-
*/
|
|
123
|
-
readonly haInterval?: number;
|
|
82
|
+
readonly directConnection?: boolean;
|
|
124
83
|
/**
|
|
125
|
-
*
|
|
84
|
+
* IP family
|
|
126
85
|
*/
|
|
127
|
-
readonly
|
|
86
|
+
readonly family?: number;
|
|
128
87
|
/**
|
|
129
|
-
*
|
|
130
|
-
* Default: 15
|
|
88
|
+
* Force server to assign `_id` values instead of driver
|
|
131
89
|
*/
|
|
132
|
-
readonly
|
|
90
|
+
readonly forceServerObjectId?: boolean;
|
|
133
91
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
92
|
+
* serialize will not emit undefined fields
|
|
93
|
+
* note that the driver sets this to `false`
|
|
136
94
|
*/
|
|
137
|
-
readonly
|
|
95
|
+
readonly ignoreUndefined?: boolean;
|
|
138
96
|
/**
|
|
139
|
-
*
|
|
97
|
+
* @deprecated TCP Connection keep alive enabled. Will not be able to turn off in the future.
|
|
140
98
|
*/
|
|
141
|
-
readonly
|
|
99
|
+
readonly keepAlive?: boolean;
|
|
142
100
|
/**
|
|
143
|
-
*
|
|
101
|
+
* @deprecated The number of milliseconds to wait before initiating keepAlive on the TCP socket.
|
|
102
|
+
* Will not be configurable in the future.
|
|
144
103
|
*/
|
|
145
|
-
readonly
|
|
104
|
+
readonly keepAliveInitialDelay?: number;
|
|
146
105
|
/**
|
|
147
|
-
* The
|
|
106
|
+
* The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.
|
|
148
107
|
*/
|
|
149
|
-
readonly
|
|
108
|
+
readonly localThresholdMS?: number;
|
|
150
109
|
/**
|
|
151
|
-
*
|
|
110
|
+
* Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations.
|
|
152
111
|
*/
|
|
153
|
-
readonly
|
|
112
|
+
readonly maxStalenessSeconds?: number;
|
|
154
113
|
/**
|
|
155
|
-
*
|
|
114
|
+
* The minimum number of connections in the connection pool.
|
|
156
115
|
*/
|
|
157
|
-
readonly
|
|
116
|
+
readonly minPoolSize?: number;
|
|
158
117
|
/**
|
|
159
|
-
*
|
|
118
|
+
* Enable command monitoring for this client
|
|
160
119
|
*/
|
|
161
|
-
readonly
|
|
120
|
+
readonly monitorCommands?: boolean;
|
|
162
121
|
/**
|
|
163
|
-
*
|
|
122
|
+
* TCP Connection no delay
|
|
164
123
|
*/
|
|
165
|
-
readonly
|
|
124
|
+
readonly noDelay?: boolean;
|
|
166
125
|
/**
|
|
167
|
-
*
|
|
126
|
+
* A primary key factory function for generation of custom `_id` keys
|
|
168
127
|
*/
|
|
169
|
-
readonly
|
|
128
|
+
readonly pkFactory?: any;
|
|
170
129
|
/**
|
|
171
|
-
*
|
|
130
|
+
* when deserializing a Binary will return it as a node.js Buffer instance.
|
|
172
131
|
*/
|
|
173
|
-
readonly
|
|
132
|
+
readonly promoteBuffers?: boolean;
|
|
174
133
|
/**
|
|
175
|
-
*
|
|
134
|
+
* when deserializing a Long will fit it into a Number if it's smaller than 53 bits.
|
|
176
135
|
*/
|
|
177
136
|
readonly promoteLongs?: boolean;
|
|
178
137
|
/**
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
readonly promoteBuffers?: boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true
|
|
138
|
+
* when deserializing will promote BSON values to their Node.js closest equivalent types.
|
|
184
139
|
*/
|
|
185
140
|
readonly promoteValues?: boolean;
|
|
186
141
|
/**
|
|
187
|
-
*
|
|
142
|
+
* Enabling the raw option will return a Node.js Buffer which is allocated using allocUnsafe API
|
|
188
143
|
*/
|
|
189
|
-
readonly
|
|
144
|
+
readonly raw?: boolean;
|
|
190
145
|
/**
|
|
191
|
-
*
|
|
192
|
-
* default is -1 which is unlimited.
|
|
146
|
+
* Specify a read concern for the collection (only MongoDB 3.2 or higher supported)
|
|
193
147
|
*/
|
|
194
|
-
readonly
|
|
148
|
+
readonly readConcern?: any;
|
|
195
149
|
/**
|
|
196
|
-
*
|
|
197
|
-
* ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
150
|
+
* Specifies the read preferences for this connection
|
|
198
151
|
*/
|
|
199
152
|
readonly readPreference?: ReadPreference | string;
|
|
200
153
|
/**
|
|
201
|
-
*
|
|
154
|
+
* Specifies the tags document as a comma-separated list of colon-separated key-value pairs.
|
|
202
155
|
*/
|
|
203
|
-
readonly
|
|
156
|
+
readonly readPreferenceTags?: any[];
|
|
204
157
|
/**
|
|
205
|
-
*
|
|
158
|
+
* Specifies the name of the replica set, if the mongod is a member of a replica set.
|
|
206
159
|
*/
|
|
207
|
-
readonly
|
|
160
|
+
readonly replicaSet?: string;
|
|
208
161
|
/**
|
|
209
|
-
*
|
|
162
|
+
* Enable retryable writes.
|
|
210
163
|
*/
|
|
211
|
-
readonly
|
|
164
|
+
readonly retryWrites?: boolean;
|
|
212
165
|
/**
|
|
213
|
-
*
|
|
166
|
+
* serialize the javascript functions
|
|
214
167
|
*/
|
|
215
|
-
readonly
|
|
168
|
+
readonly serializeFunctions?: boolean;
|
|
216
169
|
/**
|
|
217
|
-
*
|
|
170
|
+
* The time in milliseconds to attempt a send or receive on a socket before the attempt times out.
|
|
218
171
|
*/
|
|
219
|
-
readonly
|
|
172
|
+
readonly socketTimeoutMS?: number;
|
|
220
173
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
174
|
+
* @deprecated A boolean to enable or disables TLS/SSL for the connection.
|
|
175
|
+
* (The ssl option is equivalent to the tls option.)
|
|
223
176
|
*/
|
|
224
|
-
readonly
|
|
177
|
+
readonly ssl?: boolean;
|
|
225
178
|
/**
|
|
226
|
-
*
|
|
179
|
+
* @deprecated SSL Root Certificate file path.
|
|
180
|
+
*
|
|
181
|
+
* Will be removed in the next major version. Please use tlsCAFile instead.
|
|
227
182
|
*/
|
|
228
|
-
readonly
|
|
183
|
+
readonly sslCA?: string;
|
|
229
184
|
/**
|
|
230
|
-
*
|
|
185
|
+
* @deprecated SSL Certificate revocation list file path.
|
|
186
|
+
*
|
|
187
|
+
* Will be removed in the next major version.
|
|
231
188
|
*/
|
|
232
|
-
readonly
|
|
189
|
+
readonly sslCRL?: string;
|
|
233
190
|
/**
|
|
234
|
-
*
|
|
191
|
+
* @deprecated SSL Certificate file path.
|
|
192
|
+
*
|
|
193
|
+
* Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
|
|
235
194
|
*/
|
|
236
|
-
readonly
|
|
195
|
+
readonly sslCert?: string;
|
|
237
196
|
/**
|
|
238
|
-
*
|
|
197
|
+
* @deprecated SSL Key file file path.
|
|
198
|
+
*
|
|
199
|
+
* Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
|
|
239
200
|
*/
|
|
240
|
-
readonly
|
|
201
|
+
readonly sslKey?: string;
|
|
241
202
|
/**
|
|
242
|
-
*
|
|
203
|
+
* @deprecated SSL Certificate pass phrase.
|
|
204
|
+
*
|
|
205
|
+
* Will be removed in the next major version. Please use tlsCertificateKeyFilePassword instead.
|
|
243
206
|
*/
|
|
244
|
-
readonly
|
|
207
|
+
readonly sslPass?: string;
|
|
245
208
|
/**
|
|
246
|
-
*
|
|
209
|
+
* @deprecated Validate mongod server certificate against Certificate Authority
|
|
210
|
+
*
|
|
211
|
+
* Will be removed in the next major version. Please use tlsAllowInvalidCertificates instead.
|
|
247
212
|
*/
|
|
248
|
-
readonly
|
|
213
|
+
readonly sslValidate?: boolean;
|
|
249
214
|
/**
|
|
250
|
-
*
|
|
215
|
+
* Enables or disables TLS/SSL for the connection.
|
|
251
216
|
*/
|
|
252
|
-
readonly
|
|
217
|
+
readonly tls?: boolean;
|
|
253
218
|
/**
|
|
254
|
-
*
|
|
219
|
+
* Bypasses validation of the certificates presented by the mongod/mongos instance
|
|
255
220
|
*/
|
|
256
|
-
readonly
|
|
221
|
+
readonly tlsAllowInvalidCertificates?: boolean;
|
|
257
222
|
/**
|
|
258
|
-
*
|
|
223
|
+
* Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority.
|
|
259
224
|
*/
|
|
260
|
-
readonly
|
|
225
|
+
readonly tlsCAFile?: string;
|
|
261
226
|
/**
|
|
262
|
-
*
|
|
227
|
+
* Specifies the location of a local .pem file that contains the client's TLS/SSL certificate and key.
|
|
263
228
|
*/
|
|
264
|
-
readonly
|
|
229
|
+
readonly tlsCertificateKeyFile?: string;
|
|
265
230
|
/**
|
|
266
|
-
*
|
|
231
|
+
* Specifies the password to de-crypt the tlsCertificateKeyFile.
|
|
267
232
|
*/
|
|
268
|
-
readonly
|
|
233
|
+
readonly tlsCertificateKeyFilePassword?: string;
|
|
269
234
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
235
|
+
* @deprecated The write concern w value
|
|
236
|
+
*
|
|
237
|
+
* Please use the `writeConcern` option instead
|
|
272
238
|
*/
|
|
273
|
-
readonly
|
|
239
|
+
readonly w?: string | number;
|
|
274
240
|
/**
|
|
275
|
-
*
|
|
241
|
+
* A MongoDB WriteConcern, which describes the level of acknowledgement
|
|
242
|
+
* requested from MongoDB for write operations.
|
|
276
243
|
*/
|
|
277
|
-
readonly
|
|
244
|
+
readonly writeConcern?: any;
|
|
278
245
|
/**
|
|
279
|
-
*
|
|
246
|
+
* @deprecated The write concern timeout
|
|
247
|
+
*
|
|
248
|
+
* Please use the `writeConcern` option instead
|
|
280
249
|
*/
|
|
281
|
-
readonly
|
|
250
|
+
readonly wtimeoutMS?: number;
|
|
282
251
|
}
|