typeorm 0.3.18-dev.a4900ae → 0.3.18-dev.a939654
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/data-source/DataSource.js +2 -0
- package/browser/data-source/DataSource.js.map +1 -1
- package/browser/driver/oracle/OracleConnectionOptions.d.ts +14 -0
- package/browser/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/browser/driver/oracle/OracleDriver.js +6 -0
- package/browser/driver/oracle/OracleDriver.js.map +1 -1
- package/browser/driver/sap/SapQueryRunner.js +12 -6
- package/browser/driver/sap/SapQueryRunner.js.map +1 -1
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1 -10
- package/browser/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/browser/entity-manager/MongoEntityManager.js +4 -8
- package/browser/entity-manager/MongoEntityManager.js.map +1 -1
- package/browser/error/EntityNotFoundError.d.ts +2 -0
- package/browser/error/EntityNotFoundError.js +2 -0
- package/browser/error/EntityNotFoundError.js.map +1 -1
- package/browser/logger/AbstractLogger.js +1 -1
- package/browser/logger/AbstractLogger.js.map +1 -1
- package/browser/platform/BrowserPlatformTools.js +3 -2
- package/browser/platform/BrowserPlatformTools.js.map +1 -1
- package/browser/query-builder/InsertQueryBuilder.js +10 -6
- package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
- package/browser/query-builder/QueryBuilder.d.ts +5 -0
- package/browser/query-builder/QueryBuilder.js +14 -21
- package/browser/query-builder/QueryBuilder.js.map +1 -1
- package/browser/query-builder/SelectQueryBuilder.js +4 -0
- package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
- package/browser/query-builder/index.d.ts +1 -0
- package/browser/query-builder/index.js +17 -0
- package/browser/query-builder/index.js.map +1 -0
- package/browser/util/OrmUtils.d.ts +6 -0
- package/browser/util/OrmUtils.js +66 -0
- package/browser/util/OrmUtils.js.map +1 -1
- package/data-source/DataSource.js +2 -0
- package/data-source/DataSource.js.map +1 -1
- package/driver/oracle/OracleConnectionOptions.d.ts +14 -0
- package/driver/oracle/OracleConnectionOptions.js.map +1 -1
- package/driver/oracle/OracleDriver.js +6 -0
- package/driver/oracle/OracleDriver.js.map +1 -1
- package/driver/sap/SapQueryRunner.js +12 -6
- package/driver/sap/SapQueryRunner.js.map +1 -1
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1 -10
- package/driver/sqlite-abstract/AbstractSqliteQueryRunner.js.map +1 -1
- package/entity-manager/MongoEntityManager.js +4 -8
- package/entity-manager/MongoEntityManager.js.map +1 -1
- package/error/EntityNotFoundError.d.ts +2 -0
- package/error/EntityNotFoundError.js +2 -0
- package/error/EntityNotFoundError.js.map +1 -1
- package/logger/AbstractLogger.js +1 -1
- package/logger/AbstractLogger.js.map +1 -1
- package/package.json +1 -1
- package/query-builder/InsertQueryBuilder.js +10 -6
- package/query-builder/InsertQueryBuilder.js.map +1 -1
- package/query-builder/QueryBuilder.d.ts +5 -0
- package/query-builder/QueryBuilder.js +14 -21
- package/query-builder/QueryBuilder.js.map +1 -1
- package/query-builder/SelectQueryBuilder.js +4 -0
- package/query-builder/SelectQueryBuilder.js.map +1 -1
- package/query-builder/index.d.ts +1 -0
- package/query-builder/index.js +21 -0
- package/query-builder/index.js.map +1 -0
- package/util/OrmUtils.d.ts +6 -0
- package/util/OrmUtils.js +66 -0
- package/util/OrmUtils.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerQueryBuilders(): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeleteQueryBuilder } from "./DeleteQueryBuilder";
|
|
2
|
+
import { InsertQueryBuilder } from "./InsertQueryBuilder";
|
|
3
|
+
import { QueryBuilder } from "./QueryBuilder";
|
|
4
|
+
import { RelationQueryBuilder } from "./RelationQueryBuilder";
|
|
5
|
+
import { SelectQueryBuilder } from "./SelectQueryBuilder";
|
|
6
|
+
import { SoftDeleteQueryBuilder } from "./SoftDeleteQueryBuilder";
|
|
7
|
+
import { UpdateQueryBuilder } from "./UpdateQueryBuilder";
|
|
8
|
+
export function registerQueryBuilders() {
|
|
9
|
+
QueryBuilder.registerQueryBuilderClass("DeleteQueryBuilder", (qb) => new DeleteQueryBuilder(qb));
|
|
10
|
+
QueryBuilder.registerQueryBuilderClass("InsertQueryBuilder", (qb) => new InsertQueryBuilder(qb));
|
|
11
|
+
QueryBuilder.registerQueryBuilderClass("RelationQueryBuilder", (qb) => new RelationQueryBuilder(qb));
|
|
12
|
+
QueryBuilder.registerQueryBuilderClass("SelectQueryBuilder", (qb) => new SelectQueryBuilder(qb));
|
|
13
|
+
QueryBuilder.registerQueryBuilderClass("SoftDeleteQueryBuilder", (qb) => new SoftDeleteQueryBuilder(qb));
|
|
14
|
+
QueryBuilder.registerQueryBuilderClass("UpdateQueryBuilder", (qb) => new UpdateQueryBuilder(qb));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../browser/src/query-builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,UAAU,qBAAqB;IACjC,YAAY,CAAC,yBAAyB,CAClC,oBAAoB,EACpB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,CAAC,CACxD,CAAA;IACD,YAAY,CAAC,yBAAyB,CAClC,oBAAoB,EACpB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,CAAC,CACxD,CAAA;IACD,YAAY,CAAC,yBAAyB,CAClC,sBAAsB,EACtB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAC1D,CAAA;IACD,YAAY,CAAC,yBAAyB,CAClC,oBAAoB,EACpB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,CAAC,CACxD,CAAA;IACD,YAAY,CAAC,yBAAyB,CAClC,wBAAwB,EACxB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,sBAAsB,CAAC,EAAE,CAAC,CAC5D,CAAA;IACD,YAAY,CAAC,yBAAyB,CAClC,oBAAoB,EACpB,CAAC,EAAqB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,CAAC,CACxD,CAAA;AACL,CAAC","file":"index.js","sourcesContent":["import { DeleteQueryBuilder } from \"./DeleteQueryBuilder\"\nimport { InsertQueryBuilder } from \"./InsertQueryBuilder\"\nimport { QueryBuilder } from \"./QueryBuilder\"\nimport { RelationQueryBuilder } from \"./RelationQueryBuilder\"\nimport { SelectQueryBuilder } from \"./SelectQueryBuilder\"\nimport { SoftDeleteQueryBuilder } from \"./SoftDeleteQueryBuilder\"\nimport { UpdateQueryBuilder } from \"./UpdateQueryBuilder\"\n\nexport function registerQueryBuilders() {\n QueryBuilder.registerQueryBuilderClass(\n \"DeleteQueryBuilder\",\n (qb: QueryBuilder<any>) => new DeleteQueryBuilder(qb),\n )\n QueryBuilder.registerQueryBuilderClass(\n \"InsertQueryBuilder\",\n (qb: QueryBuilder<any>) => new InsertQueryBuilder(qb),\n )\n QueryBuilder.registerQueryBuilderClass(\n \"RelationQueryBuilder\",\n (qb: QueryBuilder<any>) => new RelationQueryBuilder(qb),\n )\n QueryBuilder.registerQueryBuilderClass(\n \"SelectQueryBuilder\",\n (qb: QueryBuilder<any>) => new SelectQueryBuilder(qb),\n )\n QueryBuilder.registerQueryBuilderClass(\n \"SoftDeleteQueryBuilder\",\n (qb: QueryBuilder<any>) => new SoftDeleteQueryBuilder(qb),\n )\n QueryBuilder.registerQueryBuilderClass(\n \"UpdateQueryBuilder\",\n (qb: QueryBuilder<any>) => new UpdateQueryBuilder(qb),\n )\n}\n"],"sourceRoot":".."}
|
|
@@ -48,5 +48,11 @@ export declare class OrmUtils {
|
|
|
48
48
|
*/
|
|
49
49
|
static isArraysEqual(arr1: any[], arr2: any[]): boolean;
|
|
50
50
|
static areMutuallyExclusive<T>(...lists: T[][]): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Parses the CHECK constraint on the specified column and returns
|
|
53
|
+
* all values allowed by the constraint or undefined if the constraint
|
|
54
|
+
* is not present.
|
|
55
|
+
*/
|
|
56
|
+
static parseSqlCheckExpression(sql: string, columnName: string): string[] | undefined;
|
|
51
57
|
private static compare2Objects;
|
|
52
58
|
}
|
package/browser/util/OrmUtils.js
CHANGED
|
@@ -257,6 +257,72 @@ export class OrmUtils {
|
|
|
257
257
|
});
|
|
258
258
|
return !haveSharedObjects;
|
|
259
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Parses the CHECK constraint on the specified column and returns
|
|
262
|
+
* all values allowed by the constraint or undefined if the constraint
|
|
263
|
+
* is not present.
|
|
264
|
+
*/
|
|
265
|
+
static parseSqlCheckExpression(sql, columnName) {
|
|
266
|
+
const enumMatch = sql.match(new RegExp(`"${columnName}" varchar CHECK\\s*\\(\\s*"${columnName}"\\s+IN\\s*`));
|
|
267
|
+
if (enumMatch && enumMatch.index) {
|
|
268
|
+
const afterMatch = sql.substring(enumMatch.index + enumMatch[0].length);
|
|
269
|
+
// This is an enum
|
|
270
|
+
// all enum values stored as a comma separated list
|
|
271
|
+
const chars = afterMatch;
|
|
272
|
+
/**
|
|
273
|
+
* * When outside quotes: empty string
|
|
274
|
+
* * When inside single quotes: `'`
|
|
275
|
+
*/
|
|
276
|
+
let currentQuotes = "";
|
|
277
|
+
let nextValue = "";
|
|
278
|
+
const enumValues = [];
|
|
279
|
+
for (let idx = 0; idx < chars.length; idx++) {
|
|
280
|
+
const char = chars[idx];
|
|
281
|
+
switch (char) {
|
|
282
|
+
case ",":
|
|
283
|
+
if (currentQuotes == "") {
|
|
284
|
+
enumValues.push(nextValue);
|
|
285
|
+
nextValue = "";
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
nextValue += char;
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case "'":
|
|
292
|
+
if (currentQuotes == char) {
|
|
293
|
+
const isNextCharQuote = chars[idx + 1] === char;
|
|
294
|
+
if (isNextCharQuote) {
|
|
295
|
+
// double quote in sql should be treated as a
|
|
296
|
+
// single quote that's part of the quoted string
|
|
297
|
+
nextValue += char;
|
|
298
|
+
idx += 1; // skip that next quote
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
currentQuotes = "";
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
currentQuotes = char;
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
case ")":
|
|
309
|
+
if (currentQuotes == "") {
|
|
310
|
+
enumValues.push(nextValue);
|
|
311
|
+
return enumValues;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
nextValue += char;
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
if (currentQuotes != "") {
|
|
319
|
+
nextValue += char;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
260
326
|
// -------------------------------------------------------------------------
|
|
261
327
|
// Private methods
|
|
262
328
|
// -------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../browser/src/util/OrmUtils.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,QAAQ;IAC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O,CAAC,CAAC,CAAC,CAAC,EAAE;gBACpC,OAAO,KAAK,CAAA;aACf;YAED,QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;gBACjB,KAAK,QAAQ,CAAC;gBACd,KAAK,UAAU;oBACX,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBACjB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBAElB,IACI,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D;wBACE,OAAO,KAAK,CAAA;qBACf;oBAED,SAAS,CAAC,GAAG,EAAE,CAAA;oBACf,UAAU,CAAC,GAAG,EAAE,CAAA;oBAChB,MAAK;gBAET;oBACI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;wBACf,OAAO,KAAK,CAAA;qBACf;oBACD,MAAK;aACZ;SACJ;QAED,OAAO,IAAI,CAAA;IACf,CAAC;CACJ","file":"OrmUtils.js","sourcesContent":["import { ObjectLiteral } from \"../common/ObjectLiteral\"\n\nexport class OrmUtils {\n // -------------------------------------------------------------------------\n // Public methods\n // -------------------------------------------------------------------------\n\n /**\n * Chunks array into pieces.\n */\n static chunk<T>(array: T[], size: number): T[][] {\n return Array.from(Array(Math.ceil(array.length / size)), (_, i) => {\n return array.slice(i * size, i * size + size)\n })\n }\n\n static splitClassesAndStrings<T>(\n classesAndStrings: (string | T)[],\n ): [T[], string[]] {\n return [\n classesAndStrings.filter(\n (cls): cls is T => typeof cls !== \"string\",\n ),\n classesAndStrings.filter(\n (str): str is string => typeof str === \"string\",\n ),\n ]\n }\n\n static groupBy<T, R>(\n array: T[],\n propertyCallback: (item: T) => R,\n ): { id: R; items: T[] }[] {\n return array.reduce((groupedArray, value) => {\n const key = propertyCallback(value)\n let grouped = groupedArray.find((i) => i.id === key)\n if (!grouped) {\n grouped = { id: key, items: [] }\n groupedArray.push(grouped)\n }\n grouped.items.push(value)\n return groupedArray\n }, [] as Array<{ id: R; items: T[] }>)\n }\n\n static uniq<T>(array: T[], criteria?: (item: T) => any): T[]\n static uniq<T, K extends keyof T>(array: T[], property: K): T[]\n static uniq<T, K extends keyof T>(\n array: T[],\n criteriaOrProperty?: ((item: T) => any) | K,\n ): T[] {\n return array.reduce((uniqueArray, item) => {\n let found: boolean = false\n if (typeof criteriaOrProperty === \"function\") {\n const itemValue = criteriaOrProperty(item)\n found = !!uniqueArray.find(\n (uniqueItem) =>\n criteriaOrProperty(uniqueItem) === itemValue,\n )\n } else if (typeof criteriaOrProperty === \"string\") {\n found = !!uniqueArray.find(\n (uniqueItem) =>\n uniqueItem[criteriaOrProperty] ===\n item[criteriaOrProperty],\n )\n } else {\n found = uniqueArray.indexOf(item) !== -1\n }\n\n if (!found) uniqueArray.push(item)\n\n return uniqueArray\n }, [] as T[])\n }\n\n // Checks if it's an object made by Object.create(null), {} or new Object()\n private static isPlainObject(item: any) {\n if (item === null || item === undefined) {\n return false\n }\n\n return !item.constructor || item.constructor === Object\n }\n\n private static mergeArrayKey(\n target: any,\n key: number,\n value: any,\n memo: Map<any, any>,\n ) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n target[key] = memo.get(value)\n return\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n target[key] = value\n return\n }\n\n if (!target[key]) {\n target[key] = Array.isArray(value) ? [] : {}\n }\n\n memo.set(value, target[key])\n this.merge(target[key], value, memo)\n memo.delete(value)\n }\n\n private static mergeObjectKey(\n target: any,\n key: string,\n value: any,\n memo: Map<any, any>,\n ) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n Object.assign(target, { [key]: memo.get(value) })\n return\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n Object.assign(target, { [key]: value })\n return\n }\n\n if (!target[key]) {\n Object.assign(target, { [key]: Array.isArray(value) ? [] : {} })\n }\n\n memo.set(value, target[key])\n this.merge(target[key], value, memo)\n memo.delete(value)\n }\n\n private static merge(\n target: any,\n source: any,\n memo: Map<any, any> = new Map(),\n ): any {\n if (this.isPlainObject(target) && this.isPlainObject(source)) {\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") continue\n this.mergeObjectKey(target, key, source[key], memo)\n }\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n for (let key = 0; key < source.length; key++) {\n this.mergeArrayKey(target, key, source[key], memo)\n }\n }\n }\n\n /**\n * Deep Object.assign.\n */\n static mergeDeep(target: any, ...sources: any[]): any {\n if (!sources.length) {\n return target\n }\n\n for (const source of sources) {\n OrmUtils.merge(target, source)\n }\n\n return target\n }\n\n /**\n * Deep compare objects.\n *\n * @see http://stackoverflow.com/a/1144249\n */\n static deepCompare(...args: any[]): boolean {\n let i: any, l: any, leftChain: any, rightChain: any\n\n if (arguments.length < 1) {\n return true // Die silently? Don't know how to handle such case, please help...\n // throw \"Need two or more arguments to compare\";\n }\n\n for (i = 1, l = arguments.length; i < l; i++) {\n leftChain = [] // Todo: this can be cached\n rightChain = []\n\n if (\n !this.compare2Objects(\n leftChain,\n rightChain,\n arguments[0],\n arguments[i],\n )\n ) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Gets deeper value of object.\n */\n static deepValue(obj: ObjectLiteral, path: string) {\n const segments = path.split(\".\")\n for (let i = 0, len = segments.length; i < len; i++) {\n obj = obj[segments[i]]\n }\n return obj\n }\n\n static replaceEmptyObjectsWithBooleans(obj: any) {\n for (let key in obj) {\n if (obj[key] && typeof obj[key] === \"object\") {\n if (Object.keys(obj[key]).length === 0) {\n obj[key] = true\n } else {\n this.replaceEmptyObjectsWithBooleans(obj[key])\n }\n }\n }\n }\n\n static propertyPathsToTruthyObject(paths: string[]) {\n let obj: any = {}\n for (let path of paths) {\n const props = path.split(\".\")\n if (!props.length) continue\n\n if (!obj[props[0]] || obj[props[0]] === true) {\n obj[props[0]] = {}\n }\n let recursiveChild = obj[props[0]]\n for (let [key, prop] of props.entries()) {\n if (key === 0) continue\n\n if (recursiveChild[prop]) {\n recursiveChild = recursiveChild[prop]\n } else if (key === props.length - 1) {\n recursiveChild[prop] = {}\n recursiveChild = null\n } else {\n recursiveChild[prop] = {}\n recursiveChild = recursiveChild[prop]\n }\n }\n }\n this.replaceEmptyObjectsWithBooleans(obj)\n return obj\n }\n\n /**\n * Check if two entity-id-maps are the same\n */\n static compareIds(\n firstId: ObjectLiteral | undefined,\n secondId: ObjectLiteral | undefined,\n ): boolean {\n if (\n firstId === undefined ||\n firstId === null ||\n secondId === undefined ||\n secondId === null\n )\n return false\n\n // Optimized version for the common case\n if (\n ((typeof firstId.id === \"string\" &&\n typeof secondId.id === \"string\") ||\n (typeof firstId.id === \"number\" &&\n typeof secondId.id === \"number\")) &&\n Object.keys(firstId).length === 1 &&\n Object.keys(secondId).length === 1\n ) {\n return firstId.id === secondId.id\n }\n\n return OrmUtils.deepCompare(firstId, secondId)\n }\n\n /**\n * Transforms given value into boolean value.\n */\n static toBoolean(value: any): boolean {\n if (typeof value === \"boolean\") return value\n\n if (typeof value === \"string\") return value === \"true\" || value === \"1\"\n\n if (typeof value === \"number\") return value > 0\n\n return false\n }\n\n /**\n * Composes an object from the given array of keys and values.\n */\n static zipObject(keys: any[], values: any[]): ObjectLiteral {\n return keys.reduce((object, column, index) => {\n object[column] = values[index]\n return object\n }, {} as ObjectLiteral)\n }\n\n /**\n * Compares two arrays.\n */\n static isArraysEqual(arr1: any[], arr2: any[]): boolean {\n if (arr1.length !== arr2.length) return false\n return arr1.every((element) => {\n return arr2.indexOf(element) !== -1\n })\n }\n\n static areMutuallyExclusive<T>(...lists: T[][]): boolean {\n const haveSharedObjects = lists.some((list) => {\n const otherLists = lists.filter((otherList) => otherList !== list)\n return list.some((item) =>\n otherLists.some((otherList) => otherList.includes(item)),\n )\n })\n return !haveSharedObjects\n }\n\n // -------------------------------------------------------------------------\n // Private methods\n // -------------------------------------------------------------------------\n\n private static compare2Objects(\n leftChain: any,\n rightChain: any,\n x: any,\n y: any,\n ) {\n let p\n\n // remember that NaN === NaN returns false\n // and isNaN(undefined) returns true\n if (Number.isNaN(x) && Number.isNaN(y)) return true\n\n // Compare primitives and functions.\n // Check if both arguments link to the same object.\n // Especially useful on the step where we compare prototypes\n if (x === y) return true\n\n // Unequal, but either is null or undefined (use case: jsonb comparison)\n // PR #3776, todo: add tests\n if (x === null || y === null || x === undefined || y === undefined)\n return false\n\n // Fix the buffer compare bug.\n // See: https://github.com/typeorm/typeorm/issues/3654\n if (\n (typeof x.equals === \"function\" ||\n typeof x.equals === \"function\") &&\n x.equals(y)\n )\n return true\n\n // Works in case when functions are created in constructor.\n // Comparing dates is a common scenario. Another built-ins?\n // We can even handle functions passed across iframes\n if (\n (typeof x === \"function\" && typeof y === \"function\") ||\n (x instanceof Date && y instanceof Date) ||\n (x instanceof RegExp && y instanceof RegExp) ||\n (typeof x === \"string\" && typeof y === \"string\") ||\n (typeof x === \"number\" && typeof y === \"number\")\n )\n return x.toString() === y.toString()\n\n // At last checking prototypes as good as we can\n if (!(typeof x === \"object\" && typeof y === \"object\")) return false\n\n if (\n Object.prototype.isPrototypeOf.call(x, y) ||\n Object.prototype.isPrototypeOf.call(y, x)\n )\n return false\n\n if (x.constructor !== y.constructor) return false\n\n if (x.prototype !== y.prototype) return false\n\n // Check for infinitive linking loops\n if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1)\n return false\n\n // Quick checking of one object being a subset of another.\n // todo: cache the structure of arguments[0] for performance\n for (p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false\n } else if (typeof y[p] !== typeof x[p]) {\n return false\n }\n }\n\n for (p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false\n } else if (typeof y[p] !== typeof x[p]) {\n return false\n }\n\n switch (typeof x[p]) {\n case \"object\":\n case \"function\":\n leftChain.push(x)\n rightChain.push(y)\n\n if (\n !this.compare2Objects(leftChain, rightChain, x[p], y[p])\n ) {\n return false\n }\n\n leftChain.pop()\n rightChain.pop()\n break\n\n default:\n if (x[p] !== y[p]) {\n return false\n }\n break\n }\n }\n\n return true\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../browser/src/util/OrmUtils.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,QAAQ;IACjB,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,MAAM,CAAC,KAAK,CAAI,KAAU,EAAE,IAAY;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAC9D,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;IACN,CAAC;IAED,MAAM,CAAC,sBAAsB,CACzB,iBAAiC;QAEjC,OAAO;YACH,iBAAiB,CAAC,MAAM,CACpB,CAAC,GAAG,EAAY,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAC7C;YACD,iBAAiB,CAAC,MAAM,CACpB,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAClD;SACJ,CAAA;IACL,CAAC;IAED,MAAM,CAAC,OAAO,CACV,KAAU,EACV,gBAAgC;QAEhC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,YA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AAC,CAAC,CAAC,CAAC,EAC1D;wBACE,OAAO,KAAK,CAAA;qBACf;oBAED,SAAS,CAAC,GAAG,EAAE,CAAA;oBACf,UAAU,CAAC,GAAG,EAAE,CAAA;oBAChB,MAAK;gBAET;oBACI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;wBACf,OAAO,KAAK,CAAA;qBACf;oBACD,MAAK;aACZ;SACJ;QAED,OAAO,IAAI,CAAA;IACf,CAAC;CACJ","file":"OrmUtils.js","sourcesContent":["import { ObjectLiteral } from \"../common/ObjectLiteral\"\n\nexport class OrmUtils {\n // -------------------------------------------------------------------------\n // Public methods\n // -------------------------------------------------------------------------\n\n /**\n * Chunks array into pieces.\n */\n static chunk<T>(array: T[], size: number): T[][] {\n return Array.from(Array(Math.ceil(array.length / size)), (_, i) => {\n return array.slice(i * size, i * size + size)\n })\n }\n\n static splitClassesAndStrings<T>(\n classesAndStrings: (string | T)[],\n ): [T[], string[]] {\n return [\n classesAndStrings.filter(\n (cls): cls is T => typeof cls !== \"string\",\n ),\n classesAndStrings.filter(\n (str): str is string => typeof str === \"string\",\n ),\n ]\n }\n\n static groupBy<T, R>(\n array: T[],\n propertyCallback: (item: T) => R,\n ): { id: R; items: T[] }[] {\n return array.reduce((groupedArray, value) => {\n const key = propertyCallback(value)\n let grouped = groupedArray.find((i) => i.id === key)\n if (!grouped) {\n grouped = { id: key, items: [] }\n groupedArray.push(grouped)\n }\n grouped.items.push(value)\n return groupedArray\n }, [] as Array<{ id: R; items: T[] }>)\n }\n\n static uniq<T>(array: T[], criteria?: (item: T) => any): T[]\n static uniq<T, K extends keyof T>(array: T[], property: K): T[]\n static uniq<T, K extends keyof T>(\n array: T[],\n criteriaOrProperty?: ((item: T) => any) | K,\n ): T[] {\n return array.reduce((uniqueArray, item) => {\n let found: boolean = false\n if (typeof criteriaOrProperty === \"function\") {\n const itemValue = criteriaOrProperty(item)\n found = !!uniqueArray.find(\n (uniqueItem) =>\n criteriaOrProperty(uniqueItem) === itemValue,\n )\n } else if (typeof criteriaOrProperty === \"string\") {\n found = !!uniqueArray.find(\n (uniqueItem) =>\n uniqueItem[criteriaOrProperty] ===\n item[criteriaOrProperty],\n )\n } else {\n found = uniqueArray.indexOf(item) !== -1\n }\n\n if (!found) uniqueArray.push(item)\n\n return uniqueArray\n }, [] as T[])\n }\n\n // Checks if it's an object made by Object.create(null), {} or new Object()\n private static isPlainObject(item: any) {\n if (item === null || item === undefined) {\n return false\n }\n\n return !item.constructor || item.constructor === Object\n }\n\n private static mergeArrayKey(\n target: any,\n key: number,\n value: any,\n memo: Map<any, any>,\n ) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n target[key] = memo.get(value)\n return\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n target[key] = value\n return\n }\n\n if (!target[key]) {\n target[key] = Array.isArray(value) ? [] : {}\n }\n\n memo.set(value, target[key])\n this.merge(target[key], value, memo)\n memo.delete(value)\n }\n\n private static mergeObjectKey(\n target: any,\n key: string,\n value: any,\n memo: Map<any, any>,\n ) {\n // Have we seen this before? Prevent infinite recursion.\n if (memo.has(value)) {\n Object.assign(target, { [key]: memo.get(value) })\n return\n }\n\n if (value instanceof Promise) {\n // Skip promises entirely.\n // This is a hold-over from the old code & is because we don't want to pull in\n // the lazy fields. Ideally we'd remove these promises via another function first\n // but for now we have to do it here.\n return\n }\n\n if (!this.isPlainObject(value) && !Array.isArray(value)) {\n Object.assign(target, { [key]: value })\n return\n }\n\n if (!target[key]) {\n Object.assign(target, { [key]: Array.isArray(value) ? [] : {} })\n }\n\n memo.set(value, target[key])\n this.merge(target[key], value, memo)\n memo.delete(value)\n }\n\n private static merge(\n target: any,\n source: any,\n memo: Map<any, any> = new Map(),\n ): any {\n if (this.isPlainObject(target) && this.isPlainObject(source)) {\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") continue\n this.mergeObjectKey(target, key, source[key], memo)\n }\n }\n\n if (Array.isArray(target) && Array.isArray(source)) {\n for (let key = 0; key < source.length; key++) {\n this.mergeArrayKey(target, key, source[key], memo)\n }\n }\n }\n\n /**\n * Deep Object.assign.\n */\n static mergeDeep(target: any, ...sources: any[]): any {\n if (!sources.length) {\n return target\n }\n\n for (const source of sources) {\n OrmUtils.merge(target, source)\n }\n\n return target\n }\n\n /**\n * Deep compare objects.\n *\n * @see http://stackoverflow.com/a/1144249\n */\n static deepCompare(...args: any[]): boolean {\n let i: any, l: any, leftChain: any, rightChain: any\n\n if (arguments.length < 1) {\n return true // Die silently? Don't know how to handle such case, please help...\n // throw \"Need two or more arguments to compare\";\n }\n\n for (i = 1, l = arguments.length; i < l; i++) {\n leftChain = [] // Todo: this can be cached\n rightChain = []\n\n if (\n !this.compare2Objects(\n leftChain,\n rightChain,\n arguments[0],\n arguments[i],\n )\n ) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Gets deeper value of object.\n */\n static deepValue(obj: ObjectLiteral, path: string) {\n const segments = path.split(\".\")\n for (let i = 0, len = segments.length; i < len; i++) {\n obj = obj[segments[i]]\n }\n return obj\n }\n\n static replaceEmptyObjectsWithBooleans(obj: any) {\n for (let key in obj) {\n if (obj[key] && typeof obj[key] === \"object\") {\n if (Object.keys(obj[key]).length === 0) {\n obj[key] = true\n } else {\n this.replaceEmptyObjectsWithBooleans(obj[key])\n }\n }\n }\n }\n\n static propertyPathsToTruthyObject(paths: string[]) {\n let obj: any = {}\n for (let path of paths) {\n const props = path.split(\".\")\n if (!props.length) continue\n\n if (!obj[props[0]] || obj[props[0]] === true) {\n obj[props[0]] = {}\n }\n let recursiveChild = obj[props[0]]\n for (let [key, prop] of props.entries()) {\n if (key === 0) continue\n\n if (recursiveChild[prop]) {\n recursiveChild = recursiveChild[prop]\n } else if (key === props.length - 1) {\n recursiveChild[prop] = {}\n recursiveChild = null\n } else {\n recursiveChild[prop] = {}\n recursiveChild = recursiveChild[prop]\n }\n }\n }\n this.replaceEmptyObjectsWithBooleans(obj)\n return obj\n }\n\n /**\n * Check if two entity-id-maps are the same\n */\n static compareIds(\n firstId: ObjectLiteral | undefined,\n secondId: ObjectLiteral | undefined,\n ): boolean {\n if (\n firstId === undefined ||\n firstId === null ||\n secondId === undefined ||\n secondId === null\n )\n return false\n\n // Optimized version for the common case\n if (\n ((typeof firstId.id === \"string\" &&\n typeof secondId.id === \"string\") ||\n (typeof firstId.id === \"number\" &&\n typeof secondId.id === \"number\")) &&\n Object.keys(firstId).length === 1 &&\n Object.keys(secondId).length === 1\n ) {\n return firstId.id === secondId.id\n }\n\n return OrmUtils.deepCompare(firstId, secondId)\n }\n\n /**\n * Transforms given value into boolean value.\n */\n static toBoolean(value: any): boolean {\n if (typeof value === \"boolean\") return value\n\n if (typeof value === \"string\") return value === \"true\" || value === \"1\"\n\n if (typeof value === \"number\") return value > 0\n\n return false\n }\n\n /**\n * Composes an object from the given array of keys and values.\n */\n static zipObject(keys: any[], values: any[]): ObjectLiteral {\n return keys.reduce((object, column, index) => {\n object[column] = values[index]\n return object\n }, {} as ObjectLiteral)\n }\n\n /**\n * Compares two arrays.\n */\n static isArraysEqual(arr1: any[], arr2: any[]): boolean {\n if (arr1.length !== arr2.length) return false\n return arr1.every((element) => {\n return arr2.indexOf(element) !== -1\n })\n }\n\n static areMutuallyExclusive<T>(...lists: T[][]): boolean {\n const haveSharedObjects = lists.some((list) => {\n const otherLists = lists.filter((otherList) => otherList !== list)\n return list.some((item) =>\n otherLists.some((otherList) => otherList.includes(item)),\n )\n })\n return !haveSharedObjects\n }\n\n /**\n * Parses the CHECK constraint on the specified column and returns\n * all values allowed by the constraint or undefined if the constraint\n * is not present.\n */\n static parseSqlCheckExpression(\n sql: string,\n columnName: string,\n ): string[] | undefined {\n const enumMatch = sql.match(\n new RegExp(\n `\"${columnName}\" varchar CHECK\\\\s*\\\\(\\\\s*\"${columnName}\"\\\\s+IN\\\\s*`,\n ),\n )\n\n if (enumMatch && enumMatch.index) {\n const afterMatch = sql.substring(\n enumMatch.index + enumMatch[0].length,\n )\n\n // This is an enum\n // all enum values stored as a comma separated list\n const chars = afterMatch\n\n /**\n * * When outside quotes: empty string\n * * When inside single quotes: `'`\n */\n let currentQuotes = \"\"\n let nextValue = \"\"\n const enumValues: string[] = []\n for (let idx = 0; idx < chars.length; idx++) {\n const char = chars[idx]\n switch (char) {\n case \",\":\n if (currentQuotes == \"\") {\n enumValues.push(nextValue)\n nextValue = \"\"\n } else {\n nextValue += char\n }\n break\n case \"'\":\n if (currentQuotes == char) {\n const isNextCharQuote = chars[idx + 1] === char\n if (isNextCharQuote) {\n // double quote in sql should be treated as a\n // single quote that's part of the quoted string\n nextValue += char\n idx += 1 // skip that next quote\n } else {\n currentQuotes = \"\"\n }\n } else {\n currentQuotes = char\n }\n break\n case \")\":\n if (currentQuotes == \"\") {\n enumValues.push(nextValue)\n return enumValues\n } else {\n nextValue += char\n }\n break\n default:\n if (currentQuotes != \"\") {\n nextValue += char\n }\n }\n }\n }\n return undefined\n }\n\n // -------------------------------------------------------------------------\n // Private methods\n // -------------------------------------------------------------------------\n\n private static compare2Objects(\n leftChain: any,\n rightChain: any,\n x: any,\n y: any,\n ) {\n let p\n\n // remember that NaN === NaN returns false\n // and isNaN(undefined) returns true\n if (Number.isNaN(x) && Number.isNaN(y)) return true\n\n // Compare primitives and functions.\n // Check if both arguments link to the same object.\n // Especially useful on the step where we compare prototypes\n if (x === y) return true\n\n // Unequal, but either is null or undefined (use case: jsonb comparison)\n // PR #3776, todo: add tests\n if (x === null || y === null || x === undefined || y === undefined)\n return false\n\n // Fix the buffer compare bug.\n // See: https://github.com/typeorm/typeorm/issues/3654\n if (\n (typeof x.equals === \"function\" ||\n typeof x.equals === \"function\") &&\n x.equals(y)\n )\n return true\n\n // Works in case when functions are created in constructor.\n // Comparing dates is a common scenario. Another built-ins?\n // We can even handle functions passed across iframes\n if (\n (typeof x === \"function\" && typeof y === \"function\") ||\n (x instanceof Date && y instanceof Date) ||\n (x instanceof RegExp && y instanceof RegExp) ||\n (typeof x === \"string\" && typeof y === \"string\") ||\n (typeof x === \"number\" && typeof y === \"number\")\n )\n return x.toString() === y.toString()\n\n // At last checking prototypes as good as we can\n if (!(typeof x === \"object\" && typeof y === \"object\")) return false\n\n if (\n Object.prototype.isPrototypeOf.call(x, y) ||\n Object.prototype.isPrototypeOf.call(y, x)\n )\n return false\n\n if (x.constructor !== y.constructor) return false\n\n if (x.prototype !== y.prototype) return false\n\n // Check for infinitive linking loops\n if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1)\n return false\n\n // Quick checking of one object being a subset of another.\n // todo: cache the structure of arguments[0] for performance\n for (p in y) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false\n } else if (typeof y[p] !== typeof x[p]) {\n return false\n }\n }\n\n for (p in x) {\n if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {\n return false\n } else if (typeof y[p] !== typeof x[p]) {\n return false\n }\n\n switch (typeof x[p]) {\n case \"object\":\n case \"function\":\n leftChain.push(x)\n rightChain.push(y)\n\n if (\n !this.compare2Objects(leftChain, rightChain, x[p], y[p])\n ) {\n return false\n }\n\n leftChain.pop()\n rightChain.pop()\n break\n\n default:\n if (x[p] !== y[p]) {\n return false\n }\n break\n }\n }\n\n return true\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -16,6 +16,8 @@ const ObjectUtils_1 = require("../util/ObjectUtils");
|
|
|
16
16
|
const RelationIdLoader_1 = require("../query-builder/RelationIdLoader");
|
|
17
17
|
const DriverUtils_1 = require("../driver/DriverUtils");
|
|
18
18
|
const InstanceChecker_1 = require("../util/InstanceChecker");
|
|
19
|
+
const query_builder_1 = require("../query-builder");
|
|
20
|
+
(0, query_builder_1.registerQueryBuilders)();
|
|
19
21
|
/**
|
|
20
22
|
* DataSource is a pre-defined connection configuration to a specific database.
|
|
21
23
|
* You can have multiple data sources connected (with multiple connections in it),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-source/DataSource.ts"],"names":[],"mappings":";;;AAMA,oFAAgF;AAChF,oCAMiB;AAMjB,sEAAkE;AAIlE,yFAAqF;AAErF,iFAA6E;AAC7E,2DAAuD;AACvD,uFAAmF;AAEnF,4EAAwE;AACxE,2DAAuD;AACvD,8EAA0E;AAG1E,oEAAgE;AAChE,qDAAiD;AAGjD,wEAAoE;AACpE,uDAAmD;AACnD,6DAAyD;AAGzD;;;;;;;GAOG;AACH,MAAa,UAAU;IAkFnB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAA0B;QArF7B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAgDjD;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAA;QAE9C;;WAEG;QACM,gBAAW,GAAqC,EAAE,CAAA;QAE3D;;WAEG;QACM,oBAAe,GAAqB,EAAE,CAAA;QAE/C;;;WAGG;QACM,uBAAkB,GAAG,IAAI,GAAG,EAAqC,CAAA;QAmBtE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,EAAE,CAAC,MAAM,CACpC,IAAI,CAAC,OAAO,CAAC,MAAM,EACnB,IAAI,CAAC,OAAO,CAAC,OAAO,CACvB,CAAA;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAC9C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAA;QACzC,IAAI,CAAC,cAAc;YACf,OAAO,CAAC,cAAc,IAAI,IAAI,6CAAqB,EAAE,CAAA;QACzD,IAAI,CAAC,iBAAiB,G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ACtC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE;gBACP,OAAO,KAAK,CAAA;aACf;SACJ;QACD,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ;AAjsBD,gCAisBC","file":"DataSource.js","sourcesContent":["import { Driver } from \"../driver/Driver\"\nimport { Repository } from \"../repository/Repository\"\nimport { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport { EntityTarget } from \"../common/EntityTarget\"\nimport { ObjectType } from \"../common/ObjectType\"\nimport { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\nimport { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport { Migration } from \"../migration/Migration\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport { DataSourceOptions } from \"./DataSourceOptions\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n *\n * @deprecated we don't need names anymore since we are going to drop all related methods relying on this property.\n */\n readonly name: string\n\n /**\n * Connection options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, EntityMetadata>()\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n this.name = options.name || \"default\"\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy || new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n Indicates if DataSource is initialized or not.\n *\n * @deprecated use .isInitialized instead\n */\n get isConnected() {\n return this.isInitialized\n }\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n\n if (options.logger || options.logging) {\n this.logger = new LoggerFactory().create(\n options.logger || this.options.logger,\n options.logging || this.options.logging,\n )\n }\n\n if (options.namingStrategy) {\n this.namingStrategy = options.namingStrategy\n }\n\n if (options.cache) {\n this.queryResultCache = new QueryResultCacheFactory(this).create()\n }\n\n // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized)\n throw new CannotConnectAlreadyConnectedError(this.name)\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.destroy()\n throw error\n }\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n *\n * @deprecated use .initialize method instead\n */\n async connect(): Promise<this> {\n return this.initialize()\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n *\n * @deprecated use .destroy method instead\n */\n async close(): Promise<void> {\n return this.destroy()\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<Migration[]> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n migrationExecutor.fake = (options && options.fake) || false\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n migrationExecutor.fake = (options && options.fake) || false\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError(this.name)\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend function to create a custom repository\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository)\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query<T = any>(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<T> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner || this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, undefined, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (let [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers || [],\n )\n const subscribers = await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities || [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations || [],\n )\n const migrations = await connectionMetadataBuilder.buildMigrations(\n flattenedMigrations,\n )\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (let entityMetadata of entityMetadatas) {\n if (\n InstanceChecker.isBaseEntityConstructor(entityMetadata.target)\n ) {\n entityMetadata.target.useDataSource(this)\n }\n }\n }\n\n /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\"replication\" in this.driver.options) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"],"sourceRoot":".."}
|
|
1
|
+
{"version":3,"sources":["../../src/data-source/DataSource.ts"],"names":[],"mappings":";;;AAMA,oFAAgF;AAChF,oCAMiB;AAMjB,sEAAkE;AAIlE,yFAAqF;AAErF,iFAA6E;AAC7E,2DAAuD;AACvD,uFAAmF;AAEnF,4EAAwE;AACxE,2DAAuD;AACvD,8EAA0E;AAG1E,oEAAgE;AAChE,qDAAiD;AAGjD,wEAAoE;AACpE,uDAAmD;AACnD,6DAAyD;AAEzD,oDAAwD;AAExD,IAAA,qCAAqB,GAAE,CAAA;AAEvB;;;;;;;GAOG;AACH,MAAa,UAAU;IAkFnB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,OAA0B;QArF7B,mBAAa,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAgDjD;;WAEG;QACM,eAAU,GAAyB,EAAE,CAAA;QAE9C;;WAEG;QACM,gBAAW,GAAqC,EAAE,CAAA;QAE3D;;WAEG;QACM,oBAAe,GAAqB,EAAE,CAAA;QA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QACD,yBAAW,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;QAEpD,iGAAiG;QACjG,uBAAuB,CAAC,YAAY,CAChC,IAAI,CAAC,eAAe,CAAC,MAAM,CACvB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,KAAK,MAAM,CAC9C,EACD,IAAI,CAAC,MAAM,CACd,CAAA;QAED,0CAA0C;QAC1C,KAAK,IAAI,cAAc,IAAI,eAAe,EAAE;YACxC,IACI,iCAAe,CAAC,uBAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,EAChE;gBACE,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;aAC5C;SACJ;IACL,CAAC;IAED;;OAEG;IACH,8BAA8B;QAC1B,IAAI,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACtC,MAAM,KAAK,GACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAGvB,CAAC,WAAW,CAAA;YACb,IAAI,KAAK,EAAE;gBACP,OAAO,KAAK,CAAA;aACf;SACJ;QACD,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ;AAjsBD,gCAisBC","file":"DataSource.js","sourcesContent":["import { Driver } from \"../driver/Driver\"\nimport { Repository } from \"../repository/Repository\"\nimport { EntitySubscriberInterface } from \"../subscriber/EntitySubscriberInterface\"\nimport { EntityTarget } from \"../common/EntityTarget\"\nimport { ObjectType } from \"../common/ObjectType\"\nimport { EntityManager } from \"../entity-manager/EntityManager\"\nimport { DefaultNamingStrategy } from \"../naming-strategy/DefaultNamingStrategy\"\nimport {\n CannotConnectAlreadyConnectedError,\n CannotExecuteNotConnectedError,\n EntityMetadataNotFoundError,\n QueryRunnerProviderAlreadyReleasedError,\n TypeORMError,\n} from \"../error\"\nimport { TreeRepository } from \"../repository/TreeRepository\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { Logger } from \"../logger/Logger\"\nimport { MigrationInterface } from \"../migration/MigrationInterface\"\nimport { MigrationExecutor } from \"../migration/MigrationExecutor\"\nimport { Migration } from \"../migration/Migration\"\nimport { MongoRepository } from \"../repository/MongoRepository\"\nimport { MongoEntityManager } from \"../entity-manager/MongoEntityManager\"\nimport { EntityMetadataValidator } from \"../metadata-builder/EntityMetadataValidator\"\nimport { DataSourceOptions } from \"./DataSourceOptions\"\nimport { EntityManagerFactory } from \"../entity-manager/EntityManagerFactory\"\nimport { DriverFactory } from \"../driver/DriverFactory\"\nimport { ConnectionMetadataBuilder } from \"../connection/ConnectionMetadataBuilder\"\nimport { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { SelectQueryBuilder } from \"../query-builder/SelectQueryBuilder\"\nimport { LoggerFactory } from \"../logger/LoggerFactory\"\nimport { QueryResultCacheFactory } from \"../cache/QueryResultCacheFactory\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { SqljsEntityManager } from \"../entity-manager/SqljsEntityManager\"\nimport { RelationLoader } from \"../query-builder/RelationLoader\"\nimport { ObjectUtils } from \"../util/ObjectUtils\"\nimport { IsolationLevel } from \"../driver/types/IsolationLevel\"\nimport { ReplicationMode } from \"../driver/types/ReplicationMode\"\nimport { RelationIdLoader } from \"../query-builder/RelationIdLoader\"\nimport { DriverUtils } from \"../driver/DriverUtils\"\nimport { InstanceChecker } from \"../util/InstanceChecker\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { registerQueryBuilders } from \"../query-builder\"\n\nregisterQueryBuilders()\n\n/**\n * DataSource is a pre-defined connection configuration to a specific database.\n * You can have multiple data sources connected (with multiple connections in it),\n * connected to multiple databases in your application.\n *\n * Before, it was called `Connection`, but now `Connection` is deprecated\n * because `Connection` isn't the best name for what it's actually is.\n */\nexport class DataSource {\n readonly \"@instanceof\" = Symbol.for(\"DataSource\")\n\n // -------------------------------------------------------------------------\n // Public Readonly Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection name.\n *\n * @deprecated we don't need names anymore since we are going to drop all related methods relying on this property.\n */\n readonly name: string\n\n /**\n * Connection options.\n */\n readonly options: DataSourceOptions\n\n /**\n * Indicates if DataSource is initialized or not.\n */\n readonly isInitialized: boolean\n\n /**\n * Database driver used by this connection.\n */\n driver: Driver\n\n /**\n * EntityManager of this connection.\n */\n readonly manager: EntityManager\n\n /**\n * Naming strategy used in the connection.\n */\n namingStrategy: NamingStrategyInterface\n\n /**\n * Name for the metadata table\n */\n readonly metadataTableName: string\n\n /**\n * Logger used to log orm events.\n */\n logger: Logger\n\n /**\n * Migration instances that are registered for this connection.\n */\n readonly migrations: MigrationInterface[] = []\n\n /**\n * Entity subscriber instances that are registered for this connection.\n */\n readonly subscribers: EntitySubscriberInterface<any>[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n */\n readonly entityMetadatas: EntityMetadata[] = []\n\n /**\n * All entity metadatas that are registered for this connection.\n * This is a copy of #.entityMetadatas property -> used for more performant searches.\n */\n readonly entityMetadatasMap = new Map<EntityTarget<any>, EntityMetadata>()\n\n /**\n * Used to work with query result cache.\n */\n queryResultCache?: QueryResultCache\n\n /**\n * Used to load relations and work with lazy relations.\n */\n readonly relationLoader: RelationLoader\n\n readonly relationIdLoader: RelationIdLoader\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options: DataSourceOptions) {\n this.name = options.name || \"default\"\n this.options = options\n this.logger = new LoggerFactory().create(\n this.options.logger,\n this.options.logging,\n )\n this.driver = new DriverFactory().create(this)\n this.manager = this.createEntityManager()\n this.namingStrategy =\n options.namingStrategy || new DefaultNamingStrategy()\n this.metadataTableName = options.metadataTableName || \"typeorm_metadata\"\n this.queryResultCache = options.cache\n ? new QueryResultCacheFactory(this).create()\n : undefined\n this.relationLoader = new RelationLoader(this)\n this.relationIdLoader = new RelationIdLoader(this)\n this.isInitialized = false\n }\n\n // -------------------------------------------------------------------------\n // Public Accessors\n // -------------------------------------------------------------------------\n\n /**\n Indicates if DataSource is initialized or not.\n *\n * @deprecated use .isInitialized instead\n */\n get isConnected() {\n return this.isInitialized\n }\n\n /**\n * Gets the mongodb entity manager that allows to perform mongodb-specific repository operations\n * with any entity in this connection.\n *\n * Available only in mongodb connections.\n */\n get mongoManager(): MongoEntityManager {\n if (!InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(\n `MongoEntityManager is only available for MongoDB databases.`,\n )\n\n return this.manager as MongoEntityManager\n }\n\n /**\n * Gets a sql.js specific Entity Manager that allows to perform special load and save operations\n *\n * Available only in connection with the sqljs driver.\n */\n get sqljsManager(): SqljsEntityManager {\n if (!InstanceChecker.isSqljsEntityManager(this.manager))\n throw new TypeORMError(\n `SqljsEntityManager is only available for Sqljs databases.`,\n )\n\n return this.manager\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n /**\n * Updates current connection options with provided options.\n */\n setOptions(options: Partial<DataSourceOptions>): this {\n Object.assign(this.options, options)\n\n if (options.logger || options.logging) {\n this.logger = new LoggerFactory().create(\n options.logger || this.options.logger,\n options.logging || this.options.logging,\n )\n }\n\n if (options.namingStrategy) {\n this.namingStrategy = options.namingStrategy\n }\n\n if (options.cache) {\n this.queryResultCache = new QueryResultCacheFactory(this).create()\n }\n\n // todo: we must update the database in the driver as well, if it was set by setOptions method\n // in the future we need to refactor the code and remove \"database\" from the driver, and instead\n // use database (and options) from a single place - data source.\n if (options.database) {\n this.driver.database = DriverUtils.buildDriverOptions(\n this.options,\n ).database\n }\n\n // todo: need to take a look if we need to update schema and other \"poor\" properties\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n */\n async initialize(): Promise<this> {\n if (this.isInitialized)\n throw new CannotConnectAlreadyConnectedError(this.name)\n\n // connect to the database via its driver\n await this.driver.connect()\n\n // connect to the cache-specific database if cache is enabled\n if (this.queryResultCache) await this.queryResultCache.connect()\n\n // set connected status for the current connection\n ObjectUtils.assign(this, { isInitialized: true })\n\n try {\n // build all metadatas registered in the current connection\n await this.buildMetadatas()\n\n await this.driver.afterConnect()\n\n // if option is set - drop schema once connection is done\n if (this.options.dropSchema) await this.dropDatabase()\n\n // if option is set - automatically synchronize a schema\n if (this.options.migrationsRun)\n await this.runMigrations({\n transaction: this.options.migrationsTransactionMode,\n })\n\n // if option is set - automatically synchronize a schema\n if (this.options.synchronize) await this.synchronize()\n } catch (error) {\n // if for some reason build metadata fail (for example validation error during entity metadata check)\n // connection needs to be closed\n await this.destroy()\n throw error\n }\n\n return this\n }\n\n /**\n * Performs connection to the database.\n * This method should be called once on application bootstrap.\n * This method not necessarily creates database connection (depend on database type),\n * but it also can setup a connection pool with database to use.\n *\n * @deprecated use .initialize method instead\n */\n async connect(): Promise<this> {\n return this.initialize()\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n */\n async destroy(): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n await this.driver.disconnect()\n\n // disconnect from the cache-specific database if cache was enabled\n if (this.queryResultCache) await this.queryResultCache.disconnect()\n\n ObjectUtils.assign(this, { isInitialized: false })\n }\n\n /**\n * Closes connection with the database.\n * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.\n *\n * @deprecated use .destroy method instead\n */\n async close(): Promise<void> {\n return this.destroy()\n }\n\n /**\n * Creates database schema for all entities registered in this connection.\n * Can be used only after connection to the database is established.\n *\n * @param dropBeforeSync If set to true then it drops the database with all its tables and data\n */\n async synchronize(dropBeforeSync: boolean = false): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n if (dropBeforeSync) await this.dropDatabase()\n\n const schemaBuilder = this.driver.createSchemaBuilder()\n await schemaBuilder.build()\n }\n\n /**\n * Drops the database and all its data.\n * Be careful with this method on production since this method will erase all your database tables and their data.\n * Can be used only after connection to the database is established.\n */\n // TODO rename\n async dropDatabase(): Promise<void> {\n const queryRunner = this.createQueryRunner()\n try {\n if (\n this.driver.options.type === \"mssql\" ||\n DriverUtils.isMySQLFamily(this.driver) ||\n this.driver.options.type === \"aurora-mysql\" ||\n DriverUtils.isSQLiteFamily(this.driver)\n ) {\n const databases: string[] = []\n this.entityMetadatas.forEach((metadata) => {\n if (\n metadata.database &&\n databases.indexOf(metadata.database) === -1\n )\n databases.push(metadata.database)\n })\n if (databases.length === 0 && this.driver.database) {\n databases.push(this.driver.database)\n }\n\n if (databases.length === 0) {\n await queryRunner.clearDatabase()\n } else {\n for (const database of databases) {\n await queryRunner.clearDatabase(database)\n }\n }\n } else {\n await queryRunner.clearDatabase()\n }\n } finally {\n await queryRunner.release()\n }\n }\n\n /**\n * Runs all pending migrations.\n * Can be used only after connection to the database is established.\n */\n async runMigrations(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<Migration[]> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n migrationExecutor.fake = (options && options.fake) || false\n\n const successMigrations =\n await migrationExecutor.executePendingMigrations()\n return successMigrations\n }\n\n /**\n * Reverts last executed migration.\n * Can be used only after connection to the database is established.\n */\n async undoLastMigration(options?: {\n transaction?: \"all\" | \"none\" | \"each\"\n fake?: boolean\n }): Promise<void> {\n if (!this.isInitialized)\n throw new CannotExecuteNotConnectedError(this.name)\n\n const migrationExecutor = new MigrationExecutor(this)\n migrationExecutor.transaction =\n (options && options.transaction) || \"all\"\n migrationExecutor.fake = (options && options.fake) || false\n\n await migrationExecutor.undoLastMigration()\n }\n\n /**\n * Lists all migrations and whether they have been run.\n * Returns true if there are pending migrations\n */\n async showMigrations(): Promise<boolean> {\n if (!this.isInitialized) {\n throw new CannotExecuteNotConnectedError(this.name)\n }\n const migrationExecutor = new MigrationExecutor(this)\n return await migrationExecutor.showMigrations()\n }\n\n /**\n * Checks if entity metadata exist for the given entity class, target name or table name.\n */\n hasMetadata(target: EntityTarget<any>): boolean {\n return !!this.findMetadata(target)\n }\n\n /**\n * Gets entity metadata for the given entity class or schema name.\n */\n getMetadata(target: EntityTarget<any>): EntityMetadata {\n const metadata = this.findMetadata(target)\n if (!metadata) throw new EntityMetadataNotFoundError(target)\n\n return metadata\n }\n\n /**\n * Gets repository for the given entity.\n */\n getRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): Repository<Entity> {\n return this.manager.getRepository(target)\n }\n\n /**\n * Gets tree repository for the given entity class or name.\n * Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.\n */\n getTreeRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): TreeRepository<Entity> {\n return this.manager.getTreeRepository(target)\n }\n\n /**\n * Gets mongodb-specific repository for the given entity class or name.\n * Works only if connection is mongodb-specific.\n */\n getMongoRepository<Entity extends ObjectLiteral>(\n target: EntityTarget<Entity>,\n ): MongoRepository<Entity> {\n if (!(this.driver.options.type === \"mongodb\"))\n throw new TypeORMError(\n `You can use getMongoRepository only for MongoDB connections.`,\n )\n\n return this.manager.getRepository(target) as any\n }\n\n /**\n * Gets custom entity repository marked with @EntityRepository decorator.\n *\n * @deprecated use Repository.extend function to create a custom repository\n */\n getCustomRepository<T>(customRepository: ObjectType<T>): T {\n return this.manager.getCustomRepository(customRepository)\n }\n\n /**\n * Wraps given function execution (and all operations made there) into a transaction.\n * All database operations must be executed using provided entity manager.\n */\n async transaction<T>(\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationLevel: IsolationLevel,\n runInTransaction: (entityManager: EntityManager) => Promise<T>,\n ): Promise<T>\n async transaction<T>(\n isolationOrRunInTransaction:\n | IsolationLevel\n | ((entityManager: EntityManager) => Promise<T>),\n runInTransactionParam?: (entityManager: EntityManager) => Promise<T>,\n ): Promise<any> {\n return this.manager.transaction(\n isolationOrRunInTransaction as any,\n runInTransactionParam as any,\n )\n }\n\n /**\n * Executes raw SQL query and returns raw database results.\n */\n async query<T = any>(\n query: string,\n parameters?: any[],\n queryRunner?: QueryRunner,\n ): Promise<T> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Queries aren't supported by MongoDB.`)\n\n if (queryRunner && queryRunner.isReleased)\n throw new QueryRunnerProviderAlreadyReleasedError()\n\n const usedQueryRunner = queryRunner || this.createQueryRunner()\n\n try {\n return await usedQueryRunner.query(query, parameters) // await is needed here because we are using finally\n } finally {\n if (!queryRunner) await usedQueryRunner.release()\n }\n }\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityClass: EntityTarget<Entity>,\n alias: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>\n\n /**\n * Creates a new query builder that can be used to build a SQL query.\n */\n createQueryBuilder<Entity extends ObjectLiteral>(\n entityOrRunner?: EntityTarget<Entity> | QueryRunner,\n alias?: string,\n queryRunner?: QueryRunner,\n ): SelectQueryBuilder<Entity> {\n if (InstanceChecker.isMongoEntityManager(this.manager))\n throw new TypeORMError(`Query Builder is not supported by MongoDB.`)\n\n if (alias) {\n alias = DriverUtils.buildAlias(this.driver, undefined, alias)\n const metadata = this.getMetadata(\n entityOrRunner as EntityTarget<Entity>,\n )\n return new SelectQueryBuilder(this, queryRunner)\n .select(alias)\n .from(metadata.target, alias)\n } else {\n return new SelectQueryBuilder(\n this,\n entityOrRunner as QueryRunner | undefined,\n )\n }\n }\n\n /**\n * Creates a query runner used for perform queries on a single database connection.\n * Using query runners you can control your queries to execute using single database connection and\n * manually control your database transaction.\n *\n * Mode is used in replication mode and indicates whatever you want to connect\n * to master database or any of slave databases.\n * If you perform writes you must use master database,\n * if you perform reads you can use slave databases.\n */\n createQueryRunner(mode: ReplicationMode = \"master\"): QueryRunner {\n const queryRunner = this.driver.createQueryRunner(mode)\n const manager = this.createEntityManager(queryRunner)\n Object.assign(queryRunner, { manager: manager })\n return queryRunner\n }\n\n /**\n * Gets entity metadata of the junction table (many-to-many table).\n */\n getManyToManyMetadata(\n entityTarget: EntityTarget<any>,\n relationPropertyPath: string,\n ) {\n const relationMetadata =\n this.getMetadata(entityTarget).findRelationWithPropertyPath(\n relationPropertyPath,\n )\n if (!relationMetadata)\n throw new TypeORMError(\n `Relation \"${relationPropertyPath}\" was not found in ${entityTarget} entity.`,\n )\n if (!relationMetadata.isManyToMany)\n throw new TypeORMError(\n `Relation \"${entityTarget}#${relationPropertyPath}\" does not have a many-to-many relationship.` +\n `You can use this method only on many-to-many relations.`,\n )\n\n return relationMetadata.junctionEntityMetadata\n }\n\n /**\n * Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.\n */\n createEntityManager(queryRunner?: QueryRunner): EntityManager {\n return new EntityManagerFactory().create(this, queryRunner)\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Finds exist entity metadata by the given entity class, target name or table name.\n */\n protected findMetadata(\n target: EntityTarget<any>,\n ): EntityMetadata | undefined {\n const metadataFromMap = this.entityMetadatasMap.get(target)\n if (metadataFromMap) return metadataFromMap\n\n for (let [_, metadata] of this.entityMetadatasMap) {\n if (\n InstanceChecker.isEntitySchema(target) &&\n metadata.name === target.options.name\n ) {\n return metadata\n }\n if (typeof target === \"string\") {\n if (target.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target) {\n return metadata\n }\n } else {\n if (\n metadata.name === target ||\n metadata.tableName === target\n ) {\n return metadata\n }\n }\n }\n if (\n ObjectUtils.isObjectWithName(target) &&\n typeof target.name === \"string\"\n ) {\n if (target.name.indexOf(\".\") !== -1) {\n if (metadata.tablePath === target.name) {\n return metadata\n }\n } else {\n if (\n metadata.name === target.name ||\n metadata.tableName === target.name\n ) {\n return metadata\n }\n }\n }\n }\n\n return undefined\n }\n\n /**\n * Builds metadatas for all registered classes inside this connection.\n */\n protected async buildMetadatas(): Promise<void> {\n const connectionMetadataBuilder = new ConnectionMetadataBuilder(this)\n const entityMetadataValidator = new EntityMetadataValidator()\n\n // create subscribers instances if they are not disallowed from high-level (for example they can disallowed from migrations run process)\n const flattenedSubscribers = ObjectUtils.mixedListToArray(\n this.options.subscribers || [],\n )\n const subscribers = await connectionMetadataBuilder.buildSubscribers(\n flattenedSubscribers,\n )\n ObjectUtils.assign(this, { subscribers: subscribers })\n\n // build entity metadatas\n const flattenedEntities = ObjectUtils.mixedListToArray(\n this.options.entities || [],\n )\n const entityMetadatas =\n await connectionMetadataBuilder.buildEntityMetadatas(\n flattenedEntities,\n )\n ObjectUtils.assign(this, {\n entityMetadatas: entityMetadatas,\n entityMetadatasMap: new Map(\n entityMetadatas.map((metadata) => [metadata.target, metadata]),\n ),\n })\n\n // create migration instances\n const flattenedMigrations = ObjectUtils.mixedListToArray(\n this.options.migrations || [],\n )\n const migrations = await connectionMetadataBuilder.buildMigrations(\n flattenedMigrations,\n )\n ObjectUtils.assign(this, { migrations: migrations })\n\n // validate all created entity metadatas to make sure user created entities are valid and correct\n entityMetadataValidator.validateMany(\n this.entityMetadatas.filter(\n (metadata) => metadata.tableType !== \"view\",\n ),\n this.driver,\n )\n\n // set current data source to the entities\n for (let entityMetadata of entityMetadatas) {\n if (\n InstanceChecker.isBaseEntityConstructor(entityMetadata.target)\n ) {\n entityMetadata.target.useDataSource(this)\n }\n }\n }\n\n /**\n * Get the replication mode SELECT queries should use for this datasource by default\n */\n defaultReplicationModeForReads(): ReplicationMode {\n if (\"replication\" in this.driver.options) {\n const value = (\n this.driver.options.replication as {\n defaultMode?: ReplicationMode\n }\n ).defaultMode\n if (value) {\n return value\n }\n }\n return \"slave\"\n }\n}\n"],"sourceRoot":".."}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { BaseDataSourceOptions } from "../../data-source/BaseDataSourceOptions";
|
|
2
2
|
import { OracleConnectionCredentialsOptions } from "./OracleConnectionCredentialsOptions";
|
|
3
|
+
export interface OracleThickModeOptions {
|
|
4
|
+
binaryDir?: string;
|
|
5
|
+
configDir?: string;
|
|
6
|
+
driverName?: string;
|
|
7
|
+
errorUrl?: string;
|
|
8
|
+
libDir?: string;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Oracle-specific connection options.
|
|
5
12
|
*/
|
|
@@ -17,6 +24,13 @@ export interface OracleConnectionOptions extends BaseDataSourceOptions, OracleCo
|
|
|
17
24
|
* This defaults to require("oracledb")
|
|
18
25
|
*/
|
|
19
26
|
readonly driver?: any;
|
|
27
|
+
/**
|
|
28
|
+
* Utilize the thick driver. Starting from oracledb version 6, it's necessary to set this to true when opting for the thick client usage.
|
|
29
|
+
* Alternatively, an 'OracleThickModeOptions' object can be configured, which is used for the thick mode configuration by passing it to the 'node-oracledb' driver.
|
|
30
|
+
* For additional information, refer to the details provided in the following link:
|
|
31
|
+
* (https://node-oracledb.readthedocs.io/en/latest/api_manual/oracledb.html#oracledb.initOracleClient)
|
|
32
|
+
*/
|
|
33
|
+
readonly thickMode?: boolean | OracleThickModeOptions;
|
|
20
34
|
/**
|
|
21
35
|
* A boolean determining whether to pass time values in UTC or local time. (default: false).
|
|
22
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/driver/oracle/OracleConnectionOptions.ts"],"names":[],"mappings":"","file":"OracleConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\n\n/**\n * Oracle-specific connection options.\n */\nexport interface OracleConnectionOptions\n extends BaseDataSourceOptions,\n OracleConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"oracle\"\n\n /**\n * Schema name. By default is \"public\".\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to require(\"oracledb\")\n */\n readonly driver?: any\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: OracleConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: OracleConnectionCredentialsOptions[]\n }\n}\n"],"sourceRoot":"../.."}
|
|
1
|
+
{"version":3,"sources":["../../src/driver/oracle/OracleConnectionOptions.ts"],"names":[],"mappings":"","file":"OracleConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { OracleConnectionCredentialsOptions } from \"./OracleConnectionCredentialsOptions\"\n\nexport interface OracleThickModeOptions {\n binaryDir?: string\n configDir?: string\n driverName?: string\n errorUrl?: string\n libDir?: string\n}\n\n/**\n * Oracle-specific connection options.\n */\nexport interface OracleConnectionOptions\n extends BaseDataSourceOptions,\n OracleConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"oracle\"\n\n /**\n * Schema name. By default is \"public\".\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to require(\"oracledb\")\n */\n readonly driver?: any\n\n /**\n * Utilize the thick driver. Starting from oracledb version 6, it's necessary to set this to true when opting for the thick client usage.\n * Alternatively, an 'OracleThickModeOptions' object can be configured, which is used for the thick mode configuration by passing it to the 'node-oracledb' driver.\n * For additional information, refer to the details provided in the following link:\n * (https://node-oracledb.readthedocs.io/en/latest/api_manual/oracledb.html#oracledb.initOracleClient)\n */\n readonly thickMode?: boolean | OracleThickModeOptions\n\n /**\n * A boolean determining whether to pass time values in UTC or local time. (default: false).\n */\n readonly useUTC?: boolean\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: OracleConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: OracleConnectionCredentialsOptions[]\n }\n}\n"],"sourceRoot":"../.."}
|
|
@@ -798,6 +798,12 @@ class OracleDriver {
|
|
|
798
798
|
catch (e) {
|
|
799
799
|
throw new DriverPackageNotInstalledError_1.DriverPackageNotInstalledError("Oracle", "oracledb");
|
|
800
800
|
}
|
|
801
|
+
const thickMode = this.options.thickMode;
|
|
802
|
+
if (thickMode) {
|
|
803
|
+
typeof thickMode === "object"
|
|
804
|
+
? this.oracle.initOracleClient(thickMode)
|
|
805
|
+
: this.oracle.initOracleClient();
|
|
806
|
+
}
|
|
801
807
|
}
|
|
802
808
|
/**
|
|
803
809
|
* Creates a new connection pool for a given database credentials.
|